From 821afd6fea7403dd2cd0d83522469bca9d301bad Mon Sep 17 00:00:00 2001 From: moglia <moglia@ispconfig3> Date: Mon, 15 Feb 2010 21:19:33 -0500 Subject: [PATCH] Some Brazilian Portuguese Language Updates --- server/lib/classes/db_mysql.inc.php | 31 +++++++++++++++++++------------ 1 files changed, 19 insertions(+), 12 deletions(-) diff --git a/server/lib/classes/db_mysql.inc.php b/server/lib/classes/db_mysql.inc.php index f85cbb0..364fd7e 100644 --- a/server/lib/classes/db_mysql.inc.php +++ b/server/lib/classes/db_mysql.inc.php @@ -41,7 +41,7 @@ var $errorNumber = 0; // last error number var $errorMessage = ""; // last error message var $errorLocation = "";// last error location - var $show_error_messages = false; + var $show_error_messages = true; // constructor function db() @@ -52,19 +52,22 @@ $this->dbName = $conf["db_database"]; $this->dbUser = $conf["db_user"]; $this->dbPass = $conf["db_password"]; + $this->dbCharset = $conf['db_charset']; //$this->connect(); } // error handler function updateError($location) { - $this->errorNumber = mysql_errno(); - $this->errorMessage = mysql_error(); + global $app; + $this->errorNumber = mysql_errno($this->linkId); + $this->errorMessage = mysql_error($this->linkId); $this->errorLocation = $location; - if($this->errorNumber && $this->show_error_messages) + if($this->errorNumber && $this->show_error_messages && method_exists($app,'log')) { - echo('<br /><b>'.$this->errorLocation.'</b><br />'.$this->errorMessage); - flush(); + // echo('<br /><b>'.$this->errorLocation.'</b><br />'.$this->errorMessage); + $app->log($this->errorLocation." ".$this->errorMessage,LOGLEVEL_WARN); + //flush(); } } @@ -75,9 +78,11 @@ $this->linkId = mysql_connect($this->dbHost, $this->dbUser, $this->dbPass); if(!$this->linkId) { - $this->updateError('DB::connect()<br />mysql_connect'); + $this->updateError('DB::connect()-> mysql_connect'); return false; } + $this->queryId = @mysql_query('SET NAMES '.$this->dbCharset, $this->linkId); + $this->queryId = @mysql_query("SET character_set_results = '".$this->dbCharset."', character_set_client = '".$this->dbCharset."', character_set_connection = '".$this->dbCharset."', character_set_database = '".$this->dbCharset."', character_set_server = '".$this->dbCharset."'", $this->linkId); } return true; } @@ -90,11 +95,11 @@ } if(!mysql_select_db($this->dbName, $this->linkId)) { - $this->updateError('DB::connect()<br />mysql_select_db'); + $this->updateError('DB::connect()-> mysql_select_db'); return false; } $this->queryId = @mysql_query($queryString, $this->linkId); - $this->updateError('DB::query('.$queryString.')<br />mysql_query'); + $this->updateError('DB::query('.$queryString.') -> mysql_query'); if(!$this->queryId) { return false; @@ -132,7 +137,7 @@ function nextRecord() { $this->record = mysql_fetch_assoc($this->queryId); - $this->updateError('DB::nextRecord()<br />mysql_fetch_array'); + $this->updateError('DB::nextRecord()-> mysql_fetch_array'); if(!$this->record || !is_array($this->record)) { return false; @@ -168,7 +173,7 @@ return addslashes($formfield); } - return mysql_real_escape_string($formfield); + return mysql_real_escape_string($formfield, $this->linkId); } // Check der variablen @@ -187,7 +192,8 @@ return $out; } - + /* + //* These functions are deprecated and will be removed. function insert($tablename,$form,$debug = 0) { if(is_array($form)){ @@ -222,6 +228,7 @@ if($debug == 1) echo "mySQL Error Message: ".$this->errorMessage; } } + */ public function closeConn() { -- Gitblit v1.9.1