minor fixes + minor code reformatting

This commit is contained in:
tomash 2006-11-16 00:26:50 +00:00
parent d0f967b90a
commit 1b89448983
5 changed files with 16 additions and 19 deletions

View file

@ -34,9 +34,11 @@ if (!function_exists('pg_connect')) {
exit(2); exit(2);
} }
PEAR::setErrorHandling(PEAR_ERROR_PRINT, "%s<hr>\n"); PEAR::setErrorHandling(PEAR_ERROR_RETURN);
$dbc = DB::connect($config['dsn'], TRUE); $dbc = DB::connect($config['dsn'], TRUE);
if (PEAR::isError($dbc)) { if (PEAR::isError($dbc)) {
echo $dbc->getMessage()."\n";
echo $dbc->getUserInfo()."\n";
echo "Database connection problem.\n"; echo "Database connection problem.\n";
echo "Check if database '{$config['dsn']['database']}' exists". echo "Check if database '{$config['dsn']['database']}' exists".
" with corresponding permissions.\n"; " with corresponding permissions.\n";
@ -73,15 +75,6 @@ if ($log) {
echo "# testlog:\n{$log}"; echo "# testlog:\n{$log}";
} }
#echo "# Reinstall + testdata insert ...\n";
#$gb->reinstall();
#$gb->sessid = $gb->login('root', $gb->config['tmpRootPass']);
#$gb->testData();
#$gb->logout($gb->sessid); unset($gb->sessid);
#echo "# TREE DUMP:\n";
#echo $gb->dumpTree();
echo "# Delete test data ...\n"; echo "# Delete test data ...\n";
$gb->deleteData(); $gb->deleteData();

View file

@ -60,8 +60,11 @@ if(PHP5){
/* ============================================================= runable code */ /* ============================================================= runable code */
PEAR::setErrorHandling(PEAR_ERROR_RETURN); $r = $dbc =& DB::connect($config['dsn'], TRUE);
$dbc = DB::connect($config['dsn'], TRUE); if (PEAR::isError($r)) {
trigger_error("DB::connect: ".$r->getMessage()." ".$r->getUserInfo(),E_USER_ERROR);
}
$dbc->setErrorHandling(PEAR_ERROR_RETURN);
$dbc->setFetchMode(DB_FETCHMODE_ASSOC); $dbc->setFetchMode(DB_FETCHMODE_ASSOC);
$archive = new XR_Archive($dbc, $config); $archive = new XR_Archive($dbc, $config);

View file

@ -63,7 +63,7 @@ $infos = array(
"deleteAudioClip" => "deleteAudioClip" =>
array('m'=>"archive.deleteAudioClip", array('m'=>"archive.deleteAudioClip",
'p'=>array('sessid', 'gunid'), 'r'=>'status'), 'p'=>array('sessid', 'gunid','forced'), 'r'=>'status'),
"existsAudioClip" => array('m'=>"archive.existsAudioClip", "existsAudioClip" => array('m'=>"archive.existsAudioClip",
'p'=>array('sessid', 'gunid'), 'r'=>'exists'), 'p'=>array('sessid', 'gunid'), 'r'=>'exists'),
"getAudioClip" => array('m'=>"archive.getAudioClip", "getAudioClip" => array('m'=>"archive.getAudioClip",

View file

@ -152,7 +152,7 @@ class MetaData {
function exists() function exists()
{ {
if (is_null($this->exists)) { if (is_null($this->exists)) {
$this->exists = $this->dbCheck($gunid) && $this->exists = $this->dbCheck($this->gunid) &&
is_file($this->fname) && is_file($this->fname) &&
is_readable($this->fname); is_readable($this->fname);
} }

View file

@ -6,7 +6,7 @@
// no remote execution // no remote execution
$arr = array_diff_assoc($_SERVER, $_ENV); $arr = array_diff_assoc($_SERVER, $_ENV);
if(isset($arr["DOCUMENT_ROOT"]) && $arr["DOCUMENT_ROOT"] != ""){ if (isset($arr["DOCUMENT_ROOT"]) && $arr["DOCUMENT_ROOT"] != "") {
header("HTTP/1.1 400"); header("HTTP/1.1 400");
header("Content-type: text/plain; charset=UTF-8"); header("Content-type: text/plain; charset=UTF-8");
echo "400 Not executable\r\n"; echo "400 Not executable\r\n";
@ -21,7 +21,9 @@ require_once "../Prefs.php";
function errCallback($err) function errCallback($err)
{ {
if(assert_options(ASSERT_ACTIVE)==1) return; if (assert_options(ASSERT_ACTIVE) == 1) {
return;
}
echo "ERROR:\n"; echo "ERROR:\n";
echo "request: "; print_r($_REQUEST); echo "request: "; print_r($_REQUEST);
echo "gm:\n".$err->getMessage()."\ndi:\n".$err->getDebugInfo(). echo "gm:\n".$err->getMessage()."\ndi:\n".$err->getDebugInfo().
@ -29,15 +31,14 @@ function errCallback($err)
exit(1); exit(1);
} }
if(!function_exists('pg_connect')){ if (!function_exists('pg_connect')) {
trigger_error("PostgreSQL PHP extension required and not found.", E_USER_ERROR); trigger_error("PostgreSQL PHP extension required and not found.", E_USER_ERROR);
exit(2); exit(2);
} }
#PEAR::setErrorHandling(PEAR_ERROR_PRINT, "%s<hr>\n");
PEAR::setErrorHandling(PEAR_ERROR_RETURN); PEAR::setErrorHandling(PEAR_ERROR_RETURN);
$dbc = DB::connect($config['dsn'], TRUE); $dbc = DB::connect($config['dsn'], TRUE);
if(PEAR::isError($dbc)){ if (PEAR::isError($dbc)) {
echo $dbc->getMessage()."\n"; echo $dbc->getMessage()."\n";
echo $dbc->getUserInfo()."\n"; echo $dbc->getUserInfo()."\n";
echo "Database connection problem.\n"; echo "Database connection problem.\n";