summaryrefslogtreecommitdiffstats
path: root/api.php
diff options
context:
space:
mode:
authorSimon Rettberg2017-05-12 17:09:47 +0200
committerSimon Rettberg2017-05-12 17:09:47 +0200
commit29a0edd72883e6e9956cb9abf81b159e81db3a44 (patch)
tree81ca7ee6ef39f6425fa00477c20f150ceb68521f /api.php
parent[locationinfo] Tweak and clean up overview panel (diff)
downloadslx-admin-29a0edd72883e6e9956cb9abf81b159e81db3a44.tar.gz
slx-admin-29a0edd72883e6e9956cb9abf81b159e81db3a44.tar.xz
slx-admin-29a0edd72883e6e9956cb9abf81b159e81db3a44.zip
API: Put parameters into $_GET in cli-mode
Format is --key value --anotherkey anothervalue ...
Diffstat (limited to 'api.php')
-rw-r--r--api.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/api.php b/api.php
index a9eec1e7..c7508fbd 100644
--- a/api.php
+++ b/api.php
@@ -28,6 +28,13 @@ if (!empty($_REQUEST['do'])) {
$module = preg_replace('/[^a-z]/', '', $_REQUEST['do']);
} elseif (!empty($argv[1])) {
$module = preg_replace('/[^a-z]/', '', $argv[1]);
+ $argc = count($argv) - 1;
+ for ($i = 2; $i < $argc; ++$i) {
+ if (substr($argv[$i], 0, 2) === '--') {
+ $_GET[substr($argv[$i], 2)] = $argv[$i+1];
+ ++$i;
+ }
+ }
} else {
exit(1);
}