#!/usr/bin/env php <?php require_once __DIR__ . "/../lib/Dropbox/strict.php"; if (PHP_SAPI !== "cli") { throw new \Exception("This program was meant to be run from the command-line and not as a web app. Bad value for PHP_SAPI. Expected \"cli\", given \"" . PHP_SAPI . "\"."); } // NOTE: You should be using Composer's global autoloader. But just so these examples // work for people who don't have Composer, we'll use the library's "autoload.php". require_once __DIR__ . '/../lib/Dropbox/autoload.php'; use Dropbox as dbx; if ($argc === 1) { echoHelp($argv[0]); die; } $remainingArgs = array(); $optionsAllowed = true; $disable = false; for ($i = 1; $i < $argc; $i++) { $arg = $argv[$i]; if ($optionsAllowed && strpos($arg, "-") === 0) { if ($arg === "--") { $optionsAllowed = false; continue; } if ($arg === "--disable") { if ($disable) { fwrite(STDERR, "Option \"--disable\" used more than once.\n"); die; } $disable = true; } else {
#!/usr/php/bin/php <?php require_once 'config.php'; function __autoload($class_name) { $filename = PATH_CLASS . $class_name . '.class.php'; if (file_exists($filename)) { require_once $filename; } } $args = parseArgs($argv); $indexCounter = 0; if (isset($args['h'])) { echoHelp($argv); exit(0); } if (isset($args['updateusage'])) { updateDiskUsage(); } if (isset($args['updatefeeds'])) { updateFeeds(); } if (isset($args['addfeed'])) { if (isset($args[$indexCounter])) { addFeed($args[$indexCounter++]); } else { echoError($argv); } } if (isset($args['addtorrent'])) { if (isset($args[$indexCounter]) && isset($args[$indexCounter + 1])) {