git.cweiske.de
/
ouya-imagestore.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
escape spaces in folders
[ouya-imagestore.git]
/
src
/
imagestore
/
Controller
/
Api.php
diff --git
a/src/imagestore/Controller/Api.php
b/src/imagestore/Controller/Api.php
index 91e4373b4a5a9841d572e98d7c745cc942d3711b..fe0d2d93a53ff2ce69a727d18e99a176b685a989 100644
(file)
--- a/
src/imagestore/Controller/Api.php
+++ b/
src/imagestore/Controller/Api.php
@@
-1,12
+1,12
@@
<?php
namespace imagestore;
<?php
namespace imagestore;
-class Controller_Api
+class Controller_Api
extends Controller_Base
{
public function handle($uri)
{
if (substr($uri, 0, 3) != 'v1/') {
{
public function handle($uri)
{
if (substr($uri, 0, 3) != 'v1/') {
- $this->error(404, 'Only API v1 supported');
+
return
$this->error(404, 'Only API v1 supported');
}
$rest = substr($uri, 3);
}
$rest = substr($uri, 3);
@@
-14,6
+14,10
@@
class Controller_Api
$actionName = $parts[0];
$class = 'imagestore\Controller_Api_' . ucfirst($actionName);
$actionName = $parts[0];
$class = 'imagestore\Controller_Api_' . ucfirst($actionName);
+ if (!class_exists($class)) {
+ return $this->error(404, 'API method not supported');
+ }
+
$action = new $class();
$action->handle(substr($rest, strlen($parts[0]) + 1));
}
$action = new $class();
$action->handle(substr($rest, strlen($parts[0]) + 1));
}