Skip to content
Permalink
Browse files

added zk command line tool

  • Loading branch information...
RocketMan committed Apr 2, 2019
1 parent 2f4e2f8 commit 39407bf1676a636eef34278c57db32b31da04b32
Showing with 50 additions and 0 deletions.
  1. +1 −0 .htaccess
  2. +49 −0 zk
@@ -9,4 +9,5 @@ RewriteEngine on
RewriteRule ^zkrss\.php$ index.php?target=rss [QSA,L]
RewriteRule ^zkapi\.php$ index.php?target=api [QSA,L]
RewriteRule ^ssoLogin\.php$ index.php?target=sso [QSA,L]
RewriteRule ^zk$ - [R=404,L]
</IfModule>
49 zk
@@ -0,0 +1,49 @@
#!/usr/bin/env php
<?php
/**
* Zookeeper Online
*
* @author Jim Mason <jmason@ibinx.com>
* @copyright Copyright (C) 1997-2018 Jim Mason <jmason@ibinx.com>
* @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 [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(sizeof($tuple) == 2)
$_REQUEST[$tuple[0]] = $tuple[1];
}
/**
* by default, TARGET is the first argument, unless explicitly specified
*/
if(!array_key_exists('target', $_REQUEST))
$_REQUEST['target'] = $argv[1];
require('index.php');

0 comments on commit 39407bf

Please sign in to comment.
You can’t perform that action at this time.