From bb3e16e9745abc5d625a8254303c3875c7a04ebf Mon Sep 17 00:00:00 2001 From: donncha Date: Mon, 8 Jan 2007 18:25:37 +0000 Subject: WP Merge to 4701 git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@832 7be80a69-a1ef-0310-a953-fb0f7c49ff36 --- wp-includes/wp-db.php | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'wp-includes/wp-db.php') diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index ceab53f..1ed50b4 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -45,11 +45,13 @@ class wpdb { * @param string $dbhost */ function wpdb($dbuser, $dbpassword, $dbname, $dbhost) { - - if( defined( "WP_USE_MULTIPLE_DB" ) && CONSTANT( "WP_USE_MULTIPLE_DB" ) == true ) { + if( defined( "WP_USE_MULTIPLE_DB" ) && CONSTANT( "WP_USE_MULTIPLE_DB" ) == true ) $this->db_connect(); - return true; - } + return $this->__construct($dbuser, $dbpassword, $dbname, $dbhost); + } + + function __construct($dbuser, $dbpassword, $dbname, $dbhost) { + register_shutdown_function(array(&$this, "__destruct")); $this->dbh = @mysql_connect($dbhost, $dbuser, $dbpassword); if (!$this->dbh) { @@ -68,6 +70,10 @@ class wpdb { $this->select($dbname, $this->dbh); } + function __destruct() { + return true; + } + /** * Selects a database using the current class's $this->dbh * @param string $db name @@ -420,6 +426,12 @@ class wpdb { return false; header('Content-Type: text/html; charset=utf-8'); + + if ( strstr($_SERVER['PHP_SELF'], 'wp-admin') ) + $admin_dir = ''; + else + $admin_dir = 'wp-admin/'; + ?> @@ -465,7 +477,7 @@ class wpdb { -

WordPress/>

+

WordPress

-- cgit