common->phpgw_exit() is now called when there is a halt becuase of a database error and I started adding the auto_stripslashes feature

This commit is contained in:
jengo 2001-01-08 10:08:32 +00:00
parent c9ca56e4a6
commit 883b40c508
2 changed files with 65 additions and 43 deletions

View File

@ -18,6 +18,7 @@ class db {
var $Password = "";
/* public: configuration parameters */
var $auto_stripslashes = False;
var $Auto_Free = 0; ## Set to 1 for automatic mysql_free_result()
var $Debug = 0; ## Set to 1 for debugging messages.
var $Halt_On_Error = "yes"; ## "yes" (halt with message), "no" (ignore errors quietly), "report" (ignore errror, but spit a warning)
@ -230,9 +231,14 @@ class db {
print $this->num_rows();
}
function f($Name) {
function f($Name, $strip_slashes = "")
{
if ($strip_slashes || ($this->auto_stripslashes && ! $strip_slashes)) {
return stripslashes($this->Record[$Name]);
} else {
return $this->Record[$Name];
}
}
function p($Name) {
print $this->Record[$Name];
@ -350,7 +356,9 @@ class db {
}
/* private: error handling */
function halt($msg, $line = "", $file = "") {
function halt($msg, $line = "", $file = "")
{
global $phpgw;
$this->unlock(); // Just in case there is a table currently locked
$this->Error = @mysql_error($this->Link_ID);
@ -367,8 +375,10 @@ class db {
printf("<br><b>Line:</b> %s",$line);
}
if ($this->Halt_On_Error != "report")
die("<p><b>Session halted.</b>");
if ($this->Halt_On_Error != "report") {
echo "<p><b>Session halted.</b>";
$phpgw->common->phpgw_exit(True);
}
}
function haltmsg($msg)

View File

@ -14,6 +14,9 @@ class db {
var $Database = "";
var $User = "";
var $Password = "";
var $auto_stripslashes = False;
var $Halt_On_Error = "yes"; ## "yes" (halt with message), "no" (ignore errors quietly), "report" (ignore errror, but spit a warning)
var $Link_ID = 0;
@ -214,15 +217,23 @@ class db {
print $this->num_rows();
}
function f($Name) {
function f($Name,$strip_slashes = "")
{
if ($strip_slashes || ($this->auto_stripslashes && ! $strip_slashes)) {
return stripslashes($this->Record[$Name]);
} else {
return $this->Record[$Name];
}
}
function p($Name) {
print $this->Record[$Name];
}
function halt($msg, $line = "", $file = "") {
function halt($msg, $line = "", $file = "")
{
global $phpgw;
if($this->Halt_On_Error == "no") {
return;
}
@ -239,8 +250,9 @@ class db {
printf("<br><b>Line:</b> %s",$line);
}
if($this->Halt_On_Error == "yes") {
die("<p><b>Session halted.</b>");
if ($this->Halt_On_Error == "yes") {
echo "<p><b>Session halted.</b>";
$phpgw->common->phpgw_exit(True);
}
}