summaryrefslogtreecommitdiffstats
path: root/api.php
diff options
context:
space:
mode:
authorSimon Rettberg2018-03-28 12:37:19 +0200
committerSimon Rettberg2018-03-28 12:37:19 +0200
commitbee018e41677749a6259571d7af7de77504b0736 (patch)
tree802f2f0874a88c01bd7ac7ed63a8543864130d92 /api.php
parent[sysconfig] Properly disable edit button in module ist (diff)
downloadslx-admin-bee018e41677749a6259571d7af7de77504b0736.tar.gz
slx-admin-bee018e41677749a6259571d7af7de77504b0736.tar.xz
slx-admin-bee018e41677749a6259571d7af7de77504b0736.zip
api.php: Handle --arg=val aswell, populate _GET *and* _REQUEST
Diffstat (limited to 'api.php')
-rw-r--r--api.php14
1 files changed, 11 insertions, 3 deletions
diff --git a/api.php b/api.php
index 880285be..df54d7f5 100644
--- a/api.php
+++ b/api.php
@@ -28,11 +28,19 @@ if (!empty($_REQUEST['do'])) {
$module = preg_replace('/[^a-z0-9]/', '', $_REQUEST['do']);
} elseif (!empty($argv[1])) {
$module = preg_replace('/[^a-z0-9]/', '', $argv[1]);
- $argc = count($argv) - 1;
+ $argc = count($argv);
for ($i = 2; $i < $argc; ++$i) {
if (substr($argv[$i], 0, 2) === '--') {
- $_GET[substr($argv[$i], 2)] = $argv[$i+1];
- ++$i;
+ // Handle --arg=value and --arg value
+ $key = substr($argv[$i], 2);
+ if (($pos = strpos($key, '=')) !== false) {
+ $val = substr($key, $pos + 1);
+ $key = substr($key, 0, $pos);
+ $_REQUEST[$key] = $_GET[$key] = $val;
+ } elseif ($i + 1 < $argc) {
+ $_REQUEST[$key] = $_GET[$key] = $argv[$i + 1];
+ ++$i;
+ }
}
}
} else {