put Api-Commands into namespaces
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
8
api.php
8
api.php
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
require __DIR__ . '/lib/classes/api/api_includes.inc.php';
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
// check whether API interface is enabled after all
|
||||
if (Settings::Get('api.enabled') != 1) {
|
||||
if (\Froxlor\Settings::Get('api.enabled') != 1) {
|
||||
// not enabled
|
||||
header("Status: 404 Not found", 404);
|
||||
header($_SERVER["SERVER_PROTOCOL"] . " 404 Not found", 404);
|
||||
@@ -30,9 +30,9 @@ if (is_null($decoded_request)) {
|
||||
|
||||
// validate content
|
||||
try {
|
||||
$request = FroxlorRPC::validateRequest($decoded_request);
|
||||
$request = \Froxlor\Api\FroxlorRPC::validateRequest($decoded_request);
|
||||
// now actually do it
|
||||
$cls = $request['command']['class'];
|
||||
$cls = "\Froxlor\Api\Commands\\" . $request['command']['class'];
|
||||
$method = $request['command']['method'];
|
||||
$apiObj = new $cls($decoded_request['header'], $request['params']);
|
||||
// call the method with the params if any
|
||||
|
||||
Reference in New Issue
Block a user