From f48cdb5e39bc27d21a923c51b4ebd648a9b3718c Mon Sep 17 00:00:00 2001 From: CaMer0n <cameron@e107coders.org> Date: Thu, 23 Jul 2009 15:21:41 +0000 Subject: [PATCH] some 'new db' removal --- e107_admin/administrator.php | 8 ++++---- e107_admin/auth.php | 8 ++++---- e107_admin/db.php | 21 ++++++--------------- e107_admin/footer.php | 16 ++++++++++------ e107_admin/links.php | 10 ++++------ e107_admin/users.php | 13 ++++++------- 6 files changed, 34 insertions(+), 42 deletions(-) diff --git a/e107_admin/administrator.php b/e107_admin/administrator.php index 5ff4ef99d..4077313cb 100644 --- a/e107_admin/administrator.php +++ b/e107_admin/administrator.php @@ -9,9 +9,9 @@ * Administrators Management * * $Source: /cvs_backup/e107_0.8/e107_admin/administrator.php,v $ - * $Revision: 1.11 $ - * $Date: 2009-04-27 08:11:04 $ - * $Author: secretr $ + * $Revision: 1.12 $ + * $Date: 2009-07-23 15:21:41 $ + * $Author: e107coders $ * */ @@ -366,7 +366,7 @@ function renderperms($perm, $id) { return ADMSLAN_58; } - $sql2 = new db; + $sql2 = e107::getDb('sql2'); $lanlist = explode(",",e_LANLIST); diff --git a/e107_admin/auth.php b/e107_admin/auth.php index 473902073..dab45cc4a 100644 --- a/e107_admin/auth.php +++ b/e107_admin/auth.php @@ -9,9 +9,9 @@ * Administration Area Authorization * * $Source: /cvs_backup/e107_0.8/e107_admin/auth.php,v $ - * $Revision: 1.9 $ - * $Date: 2009-07-18 10:17:56 $ - * $Author: marj_nl_fr $ + * $Revision: 1.10 $ + * $Date: 2009-07-23 15:21:41 $ + * $Author: e107coders $ */ if (!defined('e107_INIT')) { exit; } @@ -200,7 +200,7 @@ class auth # - scope public */ global $tp, $pref; - $sql_auth = new db; + $sql_auth = e107::getDb('sql_auth'); $reason = ''; $user_info = new UserHandler; diff --git a/e107_admin/db.php b/e107_admin/db.php index a56400704..984fa3251 100644 --- a/e107_admin/db.php +++ b/e107_admin/db.php @@ -9,9 +9,9 @@ * Administration - Database Utilities * * $Source: /cvs_backup/e107_0.8/e107_admin/db.php,v $ - * $Revision: 1.10 $ - * $Date: 2009-07-19 11:44:27 $ - * $Author: marj_nl_fr $ + * $Revision: 1.11 $ + * $Date: 2009-07-23 15:21:41 $ + * $Author: e107coders $ * */ @@ -477,18 +477,9 @@ function verify_sql_record() { global $emessage, $sql, $sql2, $sql3, $frm, $e107, $tp; - if(!is_object($sql)) - { - $sql = new db(); - } - if(!is_object($sql2)) - { - $sql2 = new db(); - } - if(!is_object($sql3)) - { - $sql3 = new db(); - } + $sql = e107::getDb(); + $sql2 = e107::getDb('sql2'); + $sql3 = e107::getDb('sql3'); $tables = array(); $tables[] = 'rate'; diff --git a/e107_admin/footer.php b/e107_admin/footer.php index 33d37780d..588e459ed 100644 --- a/e107_admin/footer.php +++ b/e107_admin/footer.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_admin/footer.php,v $ -| $Revision: 1.11 $ -| $Date: 2009-07-12 02:29:23 $ +| $Revision: 1.12 $ +| $Date: 2009-07-23 15:21:41 $ | $Author: e107coders $ +----------------------------------------------------------------------------+ */ @@ -45,15 +45,19 @@ global $eTraffic, $error_handler, $db_time, $sql, $mySQLserver, $mySQLuser, $myS // A Ensure sql and traffic objects exist // +/* if(!is_object($sql)){ // reinstigate db connection if another connection from third-party script closed it ... $sql = new db; $sql -> db_Connect($mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb); } -if (!is_object($eTraffic)) { - $eTraffic = new e107_traffic; - $eTraffic->Bump('Lost Traffic Counters'); -} +*/ + +$sql = e107::getDb(); + +$eTraffic = e107::getSingleton('e107_traffic', e_HANDLER.'traffic_class.php'); +$eTraffic->Bump('Lost Traffic Counters'); + if(varset($e107_popup)!=1){ // diff --git a/e107_admin/links.php b/e107_admin/links.php index 5f511caad..21f2be90b 100644 --- a/e107_admin/links.php +++ b/e107_admin/links.php @@ -9,8 +9,8 @@ * Administration Area - Site Links * * $Source: /cvs_backup/e107_0.8/e107_admin/links.php,v $ - * $Revision: 1.25 $ - * $Date: 2009-07-17 07:53:13 $ + * $Revision: 1.26 $ + * $Date: 2009-07-23 15:21:41 $ * $Author: e107coders $ * */ @@ -78,10 +78,8 @@ if(isset($_POST['generate_sublinks']) && isset($_POST['sublink_type']) && $_POST { $subtype = $_POST['sublink_type']; $sublink = $linkpost->sublink_list($subtype); - if(!is_object($sql2)) - { - $sql2 = new db(); - } + + $sql2 = e107::getDb('sql2'); $sql->db_Select("links", "*", "link_id = '".$_POST['sublink_parent']."'"); $par = $sql->db_Fetch(); diff --git a/e107_admin/users.php b/e107_admin/users.php index 5a47e2f6f..a24e0215d 100644 --- a/e107_admin/users.php +++ b/e107_admin/users.php @@ -10,8 +10,8 @@ * Administration Area - Users * * $Source: /cvs_backup/e107_0.8/e107_admin/users.php,v $ -* $Revision: 1.44 $ -* $Date: 2009-07-23 06:55:39 $ +* $Revision: 1.45 $ +* $Date: 2009-07-23 15:21:41 $ * $Author: e107coders $ * */ @@ -978,7 +978,7 @@ class users function show_batch_options() { - // Non-working example. + $text = "<span class='f-left' style='padding-left:15px'><img src='".e_IMAGE."generic/branchbottom.gif' alt='' /> <select class='tbox' name='execute_batch' onchange='this.form.submit()'> <option value=''>With selected...</option> @@ -1360,10 +1360,9 @@ class users { $query = 'SELECT * FROM `#user` WHERE user_ban=2'; } - if (!is_object($sql3)) - { - $sql3 = new db; - } + + $sql3 = e107::getDb('sql3'); + $sql3->db_Select_gen($query); while ($row = $sql3->db_Fetch()) {