-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathglobal.inc.php
More file actions
50 lines (39 loc) · 867 Bytes
/
global.inc.php
File metadata and controls
50 lines (39 loc) · 867 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?PHP
function getParams() {
global $argv;
// collect all params (including params for php itself)
$params = array();
while (count($argv) > 0) {
$param = array_shift($argv);
$key = $param;
$value = null;
if (strpos($param, "=")) {
list ($key, $value) = explode("=", $param, 2);
}
if (!$value) {
$value = true;
}
else {
if (strpos($param, ",")) {
$value = explode(",", $value);
}
}
if ($key == "--") {
$phpParams = true;
$value = $key;
}
$params[$key] = $value;
}
// if php params are present remove them from array
// otherwise asume all params for this script
if ($phpParams) {
foreach ($params as $key => $value) {
unset($params[$key]);
if ($key == "--") {
break;
}
}
}
return $params;
} //eo get params
?>