1
0

fixed some API methods

This commit is contained in:
2019-12-29 00:02:38 +01:00
parent 3f4cc7875d
commit 6e895484d7
7 changed files with 29 additions and 28 deletions

View File

@@ -56,7 +56,7 @@ if (!array_key_exists($cmd, $API_COMMANDS))
print(" ::::::`:::::;' / / `# \n");
print(" \n");
print(" \n");
die('Wrong command.');
httpDie(400, 'Wrong command.');
}
$config = $API_COMMANDS[$cmd];
@@ -64,10 +64,10 @@ $config = $API_COMMANDS[$cmd];
$secret = isset($_GET['secret']) ? $_GET['secret'] : '';
if ($config['auth'] === 'webhook_secret' && $secret !== $CONFIG['webhook_secret']) die('Unauthorized.');
if ($config['auth'] === 'ajax_secret' && $secret !== $CONFIG['ajax_secret']) die('Unauthorized.');
if ($config['auth'] === 'upload_secret' && $secret !== $CONFIG['upload_secret']) die('Unauthorized.');
if ($config['auth'] === 'admin' && !isLoggedInByCookie()) die('Unauthorized.');
if ($config['auth'] === 'webhook_secret' && $secret !== $CONFIG['webhook_secret']) httpDie(401, 'Unauthorized.');
if ($config['auth'] === 'ajax_secret' && $secret !== $CONFIG['ajax_secret']) httpDie(401, 'Unauthorized.');
if ($config['auth'] === 'upload_secret' && $secret !== $CONFIG['upload_secret']) httpDie(401, 'Unauthorized.');
if ($config['auth'] === 'admin' && !isLoggedInByCookie()) httpDie(401, 'Unauthorized.');
global $API_OPTIONS;