mirror of
https://github.com/e107inc/e107.git
synced 2025-08-04 05:37:32 +02:00
Fix for $sql2 issues with previous commit.
This commit is contained in:
12
class2.php
12
class2.php
@@ -11,9 +11,9 @@
|
|||||||
| GNU General Public License (http://gnu.org).
|
| GNU General Public License (http://gnu.org).
|
||||||
|
|
|
|
||||||
| $Source: /cvs_backup/e107_0.8/class2.php,v $
|
| $Source: /cvs_backup/e107_0.8/class2.php,v $
|
||||||
| $Revision: 1.4 $
|
| $Revision: 1.5 $
|
||||||
| $Date: 2006-12-07 15:41:49 $
|
| $Date: 2006-12-30 03:07:49 $
|
||||||
| $Author: sweetas $
|
| $Author: e107coders $
|
||||||
+----------------------------------------------------------------------------+
|
+----------------------------------------------------------------------------+
|
||||||
*/
|
*/
|
||||||
//
|
//
|
||||||
@@ -227,14 +227,14 @@ define("MPREFIX", $mySQLprefix);
|
|||||||
e107_require_once(e_HANDLER."mysql_class.php");
|
e107_require_once(e_HANDLER."mysql_class.php");
|
||||||
|
|
||||||
$sql =& new db;
|
$sql =& new db;
|
||||||
$sql2 =& new db;
|
|
||||||
|
|
||||||
$sql->db_SetErrorReporting(FALSE);
|
$sql->db_SetErrorReporting(FALSE);
|
||||||
|
|
||||||
$sql->db_Mark_Time('Start: SQL Connect');
|
$sql->db_Mark_Time('Start: SQL Connect');
|
||||||
$merror=$sql->db_Connect($mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb);
|
$merror=$sql->db_Connect($mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb);
|
||||||
|
$sql2 =& new db; // create after the initial connection.
|
||||||
$sql->db_Mark_Time('Start: Prefs, misc tables');
|
$sql->db_Mark_Time('Start: Prefs, misc tables');
|
||||||
|
|
||||||
|
|
||||||
require_once(e_HANDLER.'admin_log_class.php');
|
require_once(e_HANDLER.'admin_log_class.php');
|
||||||
$admin_log = new e_admin_log();
|
$admin_log = new e_admin_log();
|
||||||
|
|
||||||
@@ -1589,7 +1589,7 @@ class error_handler {
|
|||||||
if($index == 0) { $index = 1; } else { $index = 0; }
|
if($index == 0) { $index = 1; } else { $index = 0; }
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
foreach ($this->errors as $key => $value)
|
foreach ($this->errors as $key => $value)
|
||||||
{
|
{
|
||||||
$ret .= "<tr class='forumheader3'><td>{$value['short']}</td></tr>\n";
|
$ret .= "<tr class='forumheader3'><td>{$value['short']}</td></tr>\n";
|
||||||
}
|
}
|
||||||
|
@@ -12,8 +12,8 @@
|
|||||||
| GNU General Public License (http://gnu.org).
|
| GNU General Public License (http://gnu.org).
|
||||||
|
|
|
|
||||||
| $Source: /cvs_backup/e107_0.8/e107_handlers/mysql_class.php,v $
|
| $Source: /cvs_backup/e107_0.8/e107_handlers/mysql_class.php,v $
|
||||||
| $Revision: 1.3 $
|
| $Revision: 1.4 $
|
||||||
| $Date: 2006-12-30 01:11:49 $
|
| $Date: 2006-12-30 03:07:50 $
|
||||||
| $Author: e107coders $
|
| $Author: e107coders $
|
||||||
+----------------------------------------------------------------------------+
|
+----------------------------------------------------------------------------+
|
||||||
*/
|
*/
|
||||||
@@ -27,7 +27,7 @@ $db_mySQLQueryCount = 0; // Global total number of db object queries (all db's)
|
|||||||
* MySQL Abstraction class
|
* MySQL Abstraction class
|
||||||
*
|
*
|
||||||
* @package e107
|
* @package e107
|
||||||
* @version $Revision: 1.3 $
|
* @version $Revision: 1.4 $
|
||||||
* @author $Author: e107coders $
|
* @author $Author: e107coders $
|
||||||
*/
|
*/
|
||||||
class db {
|
class db {
|
||||||
@@ -174,6 +174,12 @@ class db {
|
|||||||
$this->db_Write_log($log_type, $log_remark, $query);
|
$this->db_Write_log($log_type, $log_remark, $query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!$this->mySQLaccess)
|
||||||
|
{
|
||||||
|
global $sql;
|
||||||
|
$this->mySQLaccess = $sql->mySQLaccess;
|
||||||
|
}
|
||||||
|
|
||||||
$b = microtime();
|
$b = microtime();
|
||||||
$sQryRes = is_null($rli) ? @mysql_query($query,$this->mySQLaccess) : @mysql_query($query, $rli);
|
$sQryRes = is_null($rli) ? @mysql_query($query,$this->mySQLaccess) : @mysql_query($query, $rli);
|
||||||
$e = microtime();
|
$e = microtime();
|
||||||
@@ -284,6 +290,13 @@ class db {
|
|||||||
$query = 'INSERT INTO '.MPREFIX."{$table} VALUES ({$arg})";
|
$query = 'INSERT INTO '.MPREFIX."{$table} VALUES ({$arg})";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!$this->mySQLaccess)
|
||||||
|
{
|
||||||
|
global $sql;
|
||||||
|
$this->mySQLaccess = $sql->mySQLaccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($result = $this->mySQLresult = $this->db_Query($query, NULL, 'db_Insert', $debug, $log_type, $log_remark )) {
|
if ($result = $this->mySQLresult = $this->db_Query($query, NULL, 'db_Insert', $debug, $log_type, $log_remark )) {
|
||||||
$tmp = mysql_insert_id($this->mySQLaccess);
|
$tmp = mysql_insert_id($this->mySQLaccess);
|
||||||
return $tmp;
|
return $tmp;
|
||||||
@@ -314,6 +327,13 @@ class db {
|
|||||||
function db_Update($table, $arg, $debug = FALSE, $log_type = '', $log_remark = '') {
|
function db_Update($table, $arg, $debug = FALSE, $log_type = '', $log_remark = '') {
|
||||||
$table = $this->db_IsLang($table);
|
$table = $this->db_IsLang($table);
|
||||||
$this->mySQLcurTable = $table;
|
$this->mySQLcurTable = $table;
|
||||||
|
|
||||||
|
if(!$this->mySQLaccess)
|
||||||
|
{
|
||||||
|
global $sql;
|
||||||
|
$this->mySQLaccess = $sql->mySQLaccess;
|
||||||
|
}
|
||||||
|
|
||||||
if ($result = $this->mySQLresult = $this->db_Query('UPDATE '.MPREFIX.$table.' SET '.$arg, NULL, 'db_Update', $debug, $log_type, $log_remark)) {
|
if ($result = $this->mySQLresult = $this->db_Query('UPDATE '.MPREFIX.$table.' SET '.$arg, NULL, 'db_Update', $debug, $log_type, $log_remark)) {
|
||||||
$result = mysql_affected_rows($this->mySQLaccess);
|
$result = mysql_affected_rows($this->mySQLaccess);
|
||||||
return $result;
|
return $result;
|
||||||
@@ -400,6 +420,11 @@ class db {
|
|||||||
*/
|
*/
|
||||||
function db_Close() {
|
function db_Close() {
|
||||||
global $eTraffic;
|
global $eTraffic;
|
||||||
|
if(!$this->mySQLaccess)
|
||||||
|
{
|
||||||
|
global $sql;
|
||||||
|
$this->mySQLaccess = $sql->mySQLaccess;
|
||||||
|
}
|
||||||
$eTraffic->BumpWho('db Close', 1);
|
$eTraffic->BumpWho('db Close', 1);
|
||||||
mysql_close($this->mySQLaccess);
|
mysql_close($this->mySQLaccess);
|
||||||
$this->dbError('dbClose');
|
$this->dbError('dbClose');
|
||||||
@@ -419,6 +444,14 @@ class db {
|
|||||||
function db_Delete($table, $arg = '', $debug = FALSE, $log_type = '', $log_remark = '') {
|
function db_Delete($table, $arg = '', $debug = FALSE, $log_type = '', $log_remark = '') {
|
||||||
$table = $this->db_IsLang($table);
|
$table = $this->db_IsLang($table);
|
||||||
$this->mySQLcurTable = $table;
|
$this->mySQLcurTable = $table;
|
||||||
|
|
||||||
|
if(!$this->mySQLaccess)
|
||||||
|
{
|
||||||
|
global $sql;
|
||||||
|
$this->mySQLaccess = $sql->mySQLaccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!$arg) {
|
if (!$arg) {
|
||||||
if ($result = $this->mySQLresult = $this->db_Query('DELETE FROM '.MPREFIX.$table, NULL, 'db_Delete', $debug, $log_type, $log_remark)) {
|
if ($result = $this->mySQLresult = $this->db_Query('DELETE FROM '.MPREFIX.$table, NULL, 'db_Delete', $debug, $log_type, $log_remark)) {
|
||||||
return $result;
|
return $result;
|
||||||
@@ -553,6 +586,12 @@ class db {
|
|||||||
return $table;
|
return $table;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!$this->mySQLaccess)
|
||||||
|
{
|
||||||
|
global $sql;
|
||||||
|
$this->mySQLaccess = $sql->mySQLaccess;
|
||||||
|
}
|
||||||
|
|
||||||
if (!$mySQLtablelist) {
|
if (!$mySQLtablelist) {
|
||||||
$tablist = mysql_list_tables($this->mySQLdefaultdb,$this->mySQLaccess);
|
$tablist = mysql_list_tables($this->mySQLdefaultdb,$this->mySQLaccess);
|
||||||
while (list($temp) = mysql_fetch_array($tablist)) {
|
while (list($temp) = mysql_fetch_array($tablist)) {
|
||||||
@@ -686,6 +725,12 @@ class db {
|
|||||||
$convert = array("PRIMARY"=>"PRI","INDEX"=>"MUL","UNIQUE"=>"UNI");
|
$convert = array("PRIMARY"=>"PRI","INDEX"=>"MUL","UNIQUE"=>"UNI");
|
||||||
$key = ($convert[$key]) ? $convert[$key] : "OFF";
|
$key = ($convert[$key]) ? $convert[$key] : "OFF";
|
||||||
|
|
||||||
|
if(!$this->mySQLaccess)
|
||||||
|
{
|
||||||
|
global $sql;
|
||||||
|
$this->mySQLaccess = $sql->mySQLaccess;
|
||||||
|
}
|
||||||
|
|
||||||
$result = mysql_query("SHOW COLUMNS FROM ".MPREFIX.$table,$this->mySQLaccess);
|
$result = mysql_query("SHOW COLUMNS FROM ".MPREFIX.$table,$this->mySQLaccess);
|
||||||
if (mysql_num_rows($result) > 0) {
|
if (mysql_num_rows($result) > 0) {
|
||||||
$c=0;
|
$c=0;
|
||||||
@@ -727,6 +772,13 @@ class db {
|
|||||||
if ($strip) {
|
if ($strip) {
|
||||||
$data = strip_if_magic($data);
|
$data = strip_if_magic($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!$this->mySQLaccess)
|
||||||
|
{
|
||||||
|
global $sql;
|
||||||
|
$this->mySQLaccess = $sql->mySQLaccess;
|
||||||
|
}
|
||||||
|
|
||||||
return mysql_real_escape_string($data,$this->mySQLaccess);
|
return mysql_real_escape_string($data,$this->mySQLaccess);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user