Index: wp-includes/capabilities.php
===================================================================
--- wp-includes/capabilities.php	(revision 3598)
+++ wp-includes/capabilities.php	(working copy)
@@ -8,8 +8,8 @@
 	var $role_key;
 
 	function WP_Roles() {
-		global $table_prefix;
-		$this->role_key = $table_prefix . 'user_roles';
+		global $wpdb;
+		$this->role_key = $wpdb->table_prefix . 'user_roles';
 
 		$this->roles = get_option($this->role_key);
 
@@ -121,7 +121,7 @@
 	var $allcaps = array();
 
 	function WP_User($id, $name = '') {
-		global $table_prefix;
+		global $wpdb;
 
 		if ( empty($id) && empty($name) )
 			return;
@@ -144,7 +144,7 @@
 		}
 
 		$this->id = $this->ID;
-		$this->cap_key = $table_prefix . 'capabilities';
+		$this->cap_key = $wpdb->table_prefix . 'capabilities';
 		$this->caps = &$this->{$this->cap_key};
 		if ( ! is_array($this->caps) )
 			$this->caps = array();
@@ -205,9 +205,9 @@
 	}
 
 	function update_user_level_from_caps() {
-	    global $table_prefix;
+	    global $wpdb;
 	    $this->user_level = array_reduce(array_keys($this->allcaps), 	array(&$this, 'level_reduction'), 0);
-	    update_usermeta($this->id, $table_prefix.'user_level', $this->user_level);
+	    update_usermeta($this->id, $wpdb->table_prefix.'user_level', $this->user_level);
 	}
 
 	function add_cap($cap, $grant = true) {
Index: wp-content/plugins/wp-db-backup.php
===================================================================
--- wp-content/plugins/wp-db-backup.php	(revision 3598)
+++ wp-content/plugins/wp-db-backup.php	(working copy)
@@ -103,10 +103,10 @@
 	}
 
 	function build_backup_script() {
-		global $table_prefix, $wpdb;
+		global $wpdb;
 
 		$datum = date("Ymd_B");
-		$backup_filename = DB_NAME . "_$table_prefix$datum.sql";
+		$backup_filename = DB_NAME . '_' . $wpdb->table_prefix . $datum . '.sql';
 		if ($this->gzip()) $backup_filename .= '.gz';
 
 		echo "<div class='wrap'>";
@@ -223,7 +223,7 @@
 	}
 
 	function backup_fragment($table, $segment, $filename) {
-		global $table_prefix, $wpdb;
+		global $wpdb;
 
 		echo "$table:$segment:$filename";
 
@@ -555,10 +555,10 @@
 
 	////////////////////////////
 	function db_backup($core_tables, $other_tables) {
-		global $table_prefix, $wpdb;
+		global $wpdb;
 
 		$datum = date("Ymd_B");
-		$wp_backup_filename = DB_NAME . "_$table_prefix$datum.sql";
+		$wp_backup_filename = DB_NAME . '_' . $wpdb->table_prefix . $datum . '.sql';
 			if ($this->gzip()) {
 				$wp_backup_filename .= '.gz';
 			}
@@ -672,7 +672,7 @@
 
 	////////////////////////////
 	function backup_menu() {
-		global $table_prefix, $wpdb;
+		global $wpdb;
 		$feedback = '';
 		$WHOOPS = FALSE;
 
@@ -720,7 +720,7 @@
 		// Simple table name storage
 		$wp_table_names = explode(',','categories,comments,linkcategories,links,options,post2cat,postmeta,posts,users,usermeta');
 		// Apply WP DB prefix to table names
-		$wp_table_names = array_map(create_function('$a', 'global $table_prefix;return "{$table_prefix}{$a}";'), $wp_table_names);
+		$wp_table_names = array_map(create_function('$a', 'global $wpdb;return "{$wpdb->table_prefix}{$a}";'), $wp_table_names);
 
 		$other_tables = array();
 		$also_backup = array();
@@ -864,10 +864,10 @@
 		        return;
 		}
 
-		global $table_prefix, $wpdb;
+		global $wpdb;
 
 		$wp_table_names = explode(',','categories,comments,linkcategories,links,options,post2cat,postmeta,posts,users,usermeta');
-		$wp_table_names = array_map(create_function('$a', 'global $table_prefix;return "{$table_prefix}{$a}";'), $wp_table_names);
+		$wp_table_names = array_map(create_function('$a', 'global $wpdb;return "{$wpdb->table_prefix}{$a}";'), $wp_table_names);
 		$all_tables = $wpdb->get_results("SHOW TABLES", ARRAY_N);
 		$all_tables = array_map(create_function('$a', 'return $a[0];'), $all_tables);
 		$core_tables = array_intersect($all_tables, $wp_table_names);
Index: wp-admin/upgrade-functions.php
===================================================================
--- wp-admin/upgrade-functions.php	(revision 3598)
+++ wp-admin/upgrade-functions.php	(working copy)
@@ -167,7 +167,7 @@
 }
 
 function upgrade_130() {
-    global $wpdb, $table_prefix;
+    global $wpdb;
 
     // Remove extraneous backslashes.
 	$posts = $wpdb->get_results("SELECT ID, post_title, post_content, post_excerpt, guid, post_date, post_name, post_status, post_author FROM $wpdb->posts");
@@ -220,10 +220,10 @@
 		}
 
 	// Obsolete tables
-	$wpdb->query('DROP TABLE IF EXISTS ' . $table_prefix . 'optionvalues');
-	$wpdb->query('DROP TABLE IF EXISTS ' . $table_prefix . 'optiontypes');
-	$wpdb->query('DROP TABLE IF EXISTS ' . $table_prefix . 'optiongroups');
-	$wpdb->query('DROP TABLE IF EXISTS ' . $table_prefix . 'optiongroup_options');
+	$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->table_prefix . 'optionvalues');
+	$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->table_prefix . 'optiontypes');
+	$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->table_prefix . 'optiongroups');
+	$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->table_prefix . 'optiongroup_options');
 
 	// Update comments table to use comment_type
 	$wpdb->query("UPDATE $wpdb->comments SET comment_type='trackback', comment_content = REPLACE(comment_content, '<trackback />', '') WHERE comment_content LIKE '<trackback />%'");
@@ -244,7 +244,7 @@
 }
 
 function upgrade_160() {
-	global $wpdb, $table_prefix, $wp_current_db_version;
+	global $wpdb, $wp_current_db_version;
 
 	populate_roles_160();
 
@@ -257,7 +257,7 @@
 		if ( !empty( $user->user_nickname ) )
 			update_usermeta( $user->ID, 'nickname', $wpdb->escape($user->user_nickname) );
 		if ( !empty( $user->user_level ) )
-			update_usermeta( $user->ID, $table_prefix . 'user_level', $user->user_level );
+			update_usermeta( $user->ID, $wpdb->table_prefix . 'user_level', $user->user_level );
 		if ( !empty( $user->user_icq ) )
 			update_usermeta( $user->ID, 'icq', $wpdb->escape($user->user_icq) );
 		if ( !empty( $user->user_aim ) )
@@ -283,11 +283,11 @@
 		endif;
 
 		// FIXME: RESET_CAPS is temporary code to reset roles and caps if flag is set.
-		$caps = get_usermeta( $user->ID, $table_prefix . 'capabilities');
+		$caps = get_usermeta( $user->ID, $wpdb->table_prefix . 'capabilities');
 		if ( empty($caps) || defined('RESET_CAPS') ) {
-			$level = get_usermeta($user->ID, $table_prefix . 'user_level');
+			$level = get_usermeta($user->ID, $wpdb->table_prefix . 'user_level');
 			$role = translate_level_to_role($level);
-			update_usermeta( $user->ID, $table_prefix . 'capabilities', array($role => true) );
+			update_usermeta( $user->ID, $wpdb->table_prefix . 'capabilities', array($role => true) );
 		}
 
 	endforeach;
@@ -331,7 +331,7 @@
 }
 
 function upgrade_210() {
-	global $wpdb, $table_prefix, $wp_current_db_version;
+	global $wpdb, $wp_current_db_version;
 
 	if ( $wp_current_db_version < 3506 ) {
 		// Update status and type.
Index: wp-admin/install.php
===================================================================
--- wp-admin/install.php	(revision 3598)
+++ wp-admin/install.php	(working copy)
@@ -202,9 +202,9 @@
 $display_name_array = explode('@', $admin_email);
 $display_name = $display_name_array[0];
 $wpdb->query("INSERT INTO $wpdb->users (ID, user_login, user_pass, user_email, user_registered, display_name, user_nicename) VALUES ( '1', 'admin', MD5('$random_password'), '$admin_email', NOW(), '$display_name', 'admin')");
-$wpdb->query("INSERT INTO $wpdb->usermeta (user_id, meta_key, meta_value) VALUES ({$wpdb->insert_id}, '{$table_prefix}user_level', '10');");
+$wpdb->query("INSERT INTO $wpdb->usermeta (user_id, meta_key, meta_value) VALUES ({$wpdb->insert_id}, '{prefix}user_level', '10');");
 $admin_caps = serialize(array('administrator' => true));
-$wpdb->query("INSERT INTO $wpdb->usermeta (user_id, meta_key, meta_value) VALUES ({$wpdb->insert_id}, '{$table_prefix}capabilities', '{$admin_caps}');");
+$wpdb->query("INSERT INTO $wpdb->usermeta (user_id, meta_key, meta_value) VALUES ({$wpdb->insert_id}, '{prefix}capabilities', '{$admin_caps}');");
 
 $message_headers = 'From: ' . $weblog_title . ' <wordpress@' . $_SERVER['SERVER_NAME'] . '>';
 $message = sprintf(__("Your new WordPress blog has been successfully set up at:

