00001 <?php
00002
00015
00016
00017
00019 define('PWD', getcwd());
00020 chdir(dirname(dirname(dirname(__FILE__))));
00021 if (!defined('STDIN')) {
00022 define('STDIN', fopen('php://stdin','r'));
00023 }
00024 define('SESSION_DISABLE_INIT', 1);
00025 require('includes/driver.inc.php');
00026
00027 if (!isset($argc)) {
00028
00029 if (isset($_SERVER['argc'])) {
00030 $argc = $_SERVER['argc'];
00031 $argv = $_SERVER['argv'];
00032 } else {
00033 $argc = $argv = null;
00034 }
00035 }
00036
00037 class CommandLineTool {
00038
00040 var $scriptName;
00041
00043 var $argv;
00044
00045 function CommandLineTool($argv = array()) {
00046 $this->argv = isset($argv) && is_array($argv) ? $argv : array();
00047
00048 if (isset($_SERVER['SERVER_NAME'])) {
00049 die('This script can only be executed from the command-line');
00050 }
00051
00052 $this->scriptName = isset($this->argv[0]) ? array_shift($this->argv) : '';
00053
00054 if (isset($this->argv[0]) && $this->argv[0] == '-h') {
00055 $this->usage();
00056 exit(0);
00057 }
00058 }
00059
00060 function usage() {
00061 }
00062
00063 }
00064 ?>