-
Notifications
You must be signed in to change notification settings - Fork 3
/
zk
executable file
·53 lines (48 loc) · 1.46 KB
/
zk
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
51
52
53
#!/usr/bin/env php
<?php
/**
* Zookeeper Online
*
* @author Jim Mason <[email protected]>
* @copyright Copyright (C) 1997-2023 Jim Mason <[email protected]>
* @link https://zookeeper.ibinx.com/
* @license GPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License,
* version 3, along with this program. If not, see
* http://www.gnu.org/licenses/
*
*/
chdir(__DIR__);
if($argc == 1) {
echo "Usage: zk TARGET[:ACTION] [NAME=VALUE...]\n";
exit -1;
}
/**
* parse out zero or more NAME=VALUE pairs from the argument list
*/
$_REQUEST = [];
foreach($argv as $arg) {
$tuple = explode('=', $arg);
if(count($tuple) == 2)
$_REQUEST[$tuple[0]] = urldecode($tuple[1]);
}
/**
* by default, TARGET is the first argument, unless explicitly specified
*/
if(!array_key_exists('target', $_REQUEST)) {
$tuple = explode(':', $argv[1]);
$_REQUEST['target'] = $tuple[0];
if(count($tuple) > 1 && !array_key_exists('action', $_REQUEST))
$_REQUEST['action'] = $tuple[1];
}
require('index.php');