Subversion Repositories oidplus

Compare Revisions

No changes between revisions

Regard whitespace Rev 225 → Rev 226

/trunk_oldversion/whois_cli
0,0 → 1,50
#!/usr/bin/php
<?php
 
#xxx TODO: debug
#$argc++;
#$argv[] = 'oidplus:!listRoots';
 
 
# TODO: try to find out namespace!
 
 
if (php_sapi_name() != 'cli') {
header('HTTP/1.1 400 Bad Request');
echo "Error: This script can only run in CLI mode\n"; # TODO: +STDERR?
exit(2);
}
 
include_once __DIR__ . '/includes/oid_plus.inc.php';
 
header('Content-Type:text/plain');
 
$db = new OIDPlus(__DIR__ . '/db/local.conf', true);
 
$title = 'OID+ web interface [BETA]';
 
try {
$db->addDir(__DIR__ . '/db');
} catch (VolcanoException $e) {
header('HTTP/1.1 500 Internal Server Error');
$title = 'Database error';
$msg = $e->getMessage();
$msg = str_replace(__DIR__, '.', $msg);
echo "$title\n\n";
echo "An internal error occurred while reading the Volcano database. Please contact the administrator and try again later.\n\n"; # TODO: +STDERR?
echo "Error message:\n\n";
echo "$msg\n";
exit;
}
 
if ($argc != 2) {
echo "Syntax: $argv[0] <query>\n";
exit(2);
}
 
# echo "$title\n\n";
 
array_shift($argv);
$args = implode(' ', $argv);
 
$db->query($args);
Property changes:
Added: svn:executable
+*
\ No newline at end of property