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

@@ -5,12 +5,12 @@ global $API_OPTIONS;
require_once (__DIR__ . '/../internals/base.php');
require_once (__DIR__ . '/../internals/database.php');
if (!isset($API_OPTIONS['name'])) die("Wrong parameters.");
if (!isset($API_OPTIONS['clientid'])) die("Wrong parameters.");
if (!isset($API_OPTIONS['version'])) die("Wrong parameters.");
if (!isset($API_OPTIONS['providerstr'])) die("Wrong parameters.");
if (!isset($API_OPTIONS['providerid'])) die("Wrong parameters.");
if (!isset($API_OPTIONS['notecount'])) die("Wrong parameters.");
if (!isset($API_OPTIONS['name'])) httpDie(400, "Wrong parameters.");
if (!isset($API_OPTIONS['clientid'])) httpDie(400, "Wrong parameters.");
if (!isset($API_OPTIONS['version'])) httpDie(400, "Wrong parameters.");
if (!isset($API_OPTIONS['providerstr'])) httpDie(400, "Wrong parameters.");
if (!isset($API_OPTIONS['providerid'])) httpDie(400, "Wrong parameters.");
if (!isset($API_OPTIONS['notecount'])) httpDie(400, "Wrong parameters.");
$nam = $API_OPTIONS['name'];
$cid = $API_OPTIONS['clientid'];

View File

@@ -6,7 +6,7 @@ require_once (__DIR__ . '/../internals/base.php');
require_once (__DIR__ . '/../internals/programs.php');
require_once (__DIR__ . '/../internals/updateslog.php');
if (!isset($API_OPTIONS['name'])) die("Wrong parameters.");
if (!isset($API_OPTIONS['name'])) httpDie(400, "Wrong parameters.");
$name = $API_OPTIONS['name'];

View File

@@ -1,19 +1,17 @@
<?php
global $API_OPTIONS;
global $OPTIONS;
require_once (__DIR__ . '/../internals/base.php');
require_once (__DIR__ . '/../internals/database.php');
if (!isset($API_OPTIONS['folder'])) die("Wrong parameters.");
if (!isset($API_OPTIONS['filename'])) die("Wrong parameters.");
if (!isset($API_OPTIONS['secret'])) die("Wrong parameters.");
if (!isset($API_OPTIONS['uri'])) die("Wrong parameters.");
if (!isset($API_OPTIONS['folder'])) httpDie(400, "Wrong parameters.");
if (!isset($API_OPTIONS['filename'])) httpDie(400, "Wrong parameters.");
$folder = $API_OPTIONS['folder'];
$filename = $API_OPTIONS['filename'];
$secret = $API_OPTIONS['secret'];
$uri = $API_OPTIONS['uri'];
$uri = $OPTIONS['uri'];
$reltarget = "Backup/$folder/$filename";

View File

@@ -1,23 +1,21 @@
<?php
global $API_OPTIONS;
global $OPTIONS;
require_once (__DIR__ . '/../internals/base.php');
require_once (__DIR__ . '/../internals/database.php');
if (!isset($API_OPTIONS['target'])) die("Wrong parameters.");
if (!isset($API_OPTIONS['secret'])) die("Wrong parameters.");
if (!isset($API_OPTIONS['uri'])) die("Wrong parameters.");
if (!isset($API_OPTIONS['target'])) httpDie(400, "Wrong parameters.");
$hook = $API_OPTIONS['target'];
$secret = $API_OPTIONS['secret'];
$uri = $API_OPTIONS['uri'];
$uri = $OPTIONS['uri'];
$cmd = "";
if ($hook == 'website_mikescher') $cmd = 'git pull';
else if ($hook == 'griddominance') $cmd = 'update-gdapi';
else die("Unknown webhook: $hook");
else httpDie(400, "Unknown webhook: $hook");
$std = shell_exec($cmd);

View File

@@ -26,7 +26,4 @@ echo 'Finished.' . '<br/>' . "\n";
echo '<script>setTimeout(function () { window.location.href = "/admin"; }, 3000);</script>';
echo '</body>';
echo '</html>';
die('Wrong command.');
echo '</html>';