Index: wp-settings.php
===================================================================
--- wp-settings.php	(revision 12716)
+++ wp-settings.php	(working copy)
@@ -9,20 +9,15 @@
  * @package WordPress
  */
 
-
 /**
- * Whether Multisite support is enabled
+ * Stores the location of the WordPress directory of functions, classes, and core content.
  *
- * @since 3.0
- *
- * @return bool True if multisite is enabled, false otherwise.
+ * @since 1.0.0
  */
-function is_multisite() {
-	if ( ( defined('MULTISITE') && MULTISITE ) || defined('VHOST') || defined('SUNRISE') )
-		return true;
+define('WPINC', 'wp-includes');
 
-	return false;
-}
+// Load initialization functions
+require(ABSPATH . WPINC . '/init.php');
 
 if ( !defined('WP_MEMORY_LIMIT') ) {
         if( is_multisite() ) {
@@ -41,31 +36,6 @@
 if ( function_exists('date_default_timezone_set') )
 	date_default_timezone_set('UTC');
 
-/**
- * Turn register globals off.
- *
- * @access private
- * @since 2.1.0
- * @return null Will return null if register_globals PHP directive was disabled
- */
-function wp_unregister_GLOBALS() {
-	if ( !ini_get('register_globals') )
-		return;
-
-	if ( isset($_REQUEST['GLOBALS']) )
-		die('GLOBALS overwrite attempt detected');
-
-	// Variables that shouldn't be unset
-	$noUnset = array('GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix');
-
-	$input = array_merge($_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset($_SESSION) && is_array($_SESSION) ? $_SESSION : array());
-	foreach ( $input as $k => $v )
-		if ( !in_array($k, $noUnset) && isset($GLOBALS[$k]) ) {
-			$GLOBALS[$k] = NULL;
-			unset($GLOBALS[$k]);
-		}
-}
-
 wp_unregister_GLOBALS();
 
 unset( $wp_filter, $cache_lastcommentmodified, $cache_lastpostdate );
@@ -80,145 +50,25 @@
 if ( ! isset($blog_id) )
 	$blog_id = 1;
 
-// Fix for IIS when running with PHP ISAPI
-if ( empty( $_SERVER['REQUEST_URI'] ) || ( php_sapi_name() != 'cgi-fcgi' && preg_match( '/^Microsoft-IIS\//', $_SERVER['SERVER_SOFTWARE'] ) ) ) {
+// Fix $_SERVER variables
+wp_fix_server_vars();
 
-	// IIS Mod-Rewrite
-	if (isset($_SERVER['HTTP_X_ORIGINAL_URL'])) {
-		$_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL'];
-	}
-	// IIS Isapi_Rewrite
-	else if (isset($_SERVER['HTTP_X_REWRITE_URL'])) {
-		$_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL'];
-	}
-	else
-	{
-		// Use ORIG_PATH_INFO if there is no PATH_INFO
-		if ( !isset($_SERVER['PATH_INFO']) && isset($_SERVER['ORIG_PATH_INFO']) )
-			$_SERVER['PATH_INFO'] = $_SERVER['ORIG_PATH_INFO'];
+require (ABSPATH . WPINC . '/version.php');
 
-		// Some IIS + PHP configurations puts the script-name in the path-info (No need to append it twice)
-		if ( isset($_SERVER['PATH_INFO']) ) {
-			if ( $_SERVER['PATH_INFO'] == $_SERVER['SCRIPT_NAME'] )
-				$_SERVER['REQUEST_URI'] = $_SERVER['PATH_INFO'];
-			else
-				$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO'];
-		}
+if ( version_compare( $required_php_version, phpversion(), '>' ) )
+	die( sprintf( /*WP_I18N_OLD_PHP*/'Your server is running PHP version %s$1 but WordPress requires at least %1$2.'/*/WP_I18N_OLD_PHP*/, phpversion(), $required_php_version ) );
 
-		// Append the query string if it exists and isn't null
-		if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {
-			$_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
-		}
-	}
-}
-
-// Fix for PHP as CGI hosts that set SCRIPT_FILENAME to something ending in php.cgi for all requests
-if ( isset($_SERVER['SCRIPT_FILENAME']) && ( strpos($_SERVER['SCRIPT_FILENAME'], 'php.cgi') == strlen($_SERVER['SCRIPT_FILENAME']) - 7 ) )
-	$_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED'];
-
-// Fix for Dreamhost and other PHP as CGI hosts
-if (strpos($_SERVER['SCRIPT_NAME'], 'php.cgi') !== false)
-	unset($_SERVER['PATH_INFO']);
-
-// Fix empty PHP_SELF
-$PHP_SELF = $_SERVER['PHP_SELF'];
-if ( empty($PHP_SELF) )
-	$_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace("/(\?.*)?$/",'',$_SERVER["REQUEST_URI"]);
-
-if ( version_compare( '4.3', phpversion(), '>' ) ) {
-	die( sprintf( /*WP_I18N_OLD_PHP*/'Your server is running PHP version %s but WordPress requires at least 4.3.'/*/WP_I18N_OLD_PHP*/, phpversion() ) );
-}
-
 if ( !defined('WP_CONTENT_DIR') )
 	define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); // no trailing slash, full paths only - WP_CONTENT_URL is defined further down
 
-if ( file_exists(ABSPATH . '.maintenance') && !defined('WP_INSTALLING') ) {
-	include(ABSPATH . '.maintenance');
-	// If the $upgrading timestamp is older than 10 minutes, don't die.
-	if ( ( time() - $upgrading ) < 600 ) {
-		if ( file_exists( WP_CONTENT_DIR . '/maintenance.php' ) ) {
-			require_once( WP_CONTENT_DIR . '/maintenance.php' );
-			die();
-		}
+// Check if maintenance mode should be triggered.
+if ( file_exists(ABSPATH . '.maintenance') && !defined('WP_INSTALLING') )
+	wp_maintenance();
 
-		$protocol = $_SERVER["SERVER_PROTOCOL"];
-		if ( 'HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol )
-			$protocol = 'HTTP/1.0';
-		header( "$protocol 503 Service Unavailable", true, 503 );
-		header( 'Content-Type: text/html; charset=utf-8' );
-		header( 'Retry-After: 600' );
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-	<title>Maintenance</title>
-
-</head>
-<body>
-	<h1>Briefly unavailable for scheduled maintenance. Check back in a minute.</h1>
-</body>
-</html>
-<?php
-		die();
-	}
-}
-
 if ( !extension_loaded('mysql') && !file_exists(WP_CONTENT_DIR . '/db.php') )
 	die( /*WP_I18N_OLD_MYSQL*/'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.'/*/WP_I18N_OLD_MYSQL*/ );
 
-/**
- * PHP 4 standard microtime start capture.
- *
- * @access private
- * @since 0.71
- * @global int $timestart Seconds and Microseconds added together from when function is called.
- * @return bool Always returns true.
- */
-function timer_start() {
-	global $timestart;
-	$mtime = explode(' ', microtime() );
-	$mtime = $mtime[1] + $mtime[0];
-	$timestart = $mtime;
-	return true;
-}
-
-/**
- * Return and/or display the time from the page start to when function is called.
- *
- * You can get the results and print them by doing:
- * <code>
- * $nTimePageTookToExecute = timer_stop();
- * echo $nTimePageTookToExecute;
- * </code>
- *
- * Or instead, you can do:
- * <code>
- * timer_stop(1);
- * </code>
- * which will do what the above does. If you need the result, you can assign it to a variable, but
- * most cases, you only need to echo it.
- *
- * @since 0.71
- * @global int $timestart Seconds and Microseconds added together from when timer_start() is called
- * @global int $timeend  Seconds and Microseconds added together from when function is called
- *
- * @param int $display Use '0' or null to not echo anything and 1 to echo the total time
- * @param int $precision The amount of digits from the right of the decimal to display. Default is 3.
- * @return float The "second.microsecond" finished time calculation
- */
-function timer_stop($display = 0, $precision = 3) { //if called like timer_stop(1), will echo $timetotal
-	global $timestart, $timeend;
-	$mtime = microtime();
-	$mtime = explode(' ',$mtime);
-	$mtime = $mtime[1] + $mtime[0];
-	$timeend = $mtime;
-	$timetotal = $timeend-$timestart;
-	$r = ( function_exists('number_format_i18n') ) ? number_format_i18n($timetotal, $precision) : number_format($timetotal, $precision);
-	if ( $display )
-		echo $r;
-	return $r;
-}
+// Start timer.
 timer_start();
 
 // Add define('WP_DEBUG', true); to wp-config.php to enable display of notices during development.
@@ -255,13 +105,6 @@
 if ( !defined('MEDIA_TRASH') )
 	define('MEDIA_TRASH', false);
 
-/**
- * Stores the location of the WordPress directory of functions, classes, and core content.
- *
- * @since 1.0.0
- */
-define('WPINC', 'wp-includes');
-
 if ( !defined('WP_LANG_DIR') ) {
 	/**
 	 * Stores the location of the language directory. First looks for language folder in WP_CONTENT_DIR
@@ -311,40 +154,6 @@
 if ( is_wp_error($prefix) )
 	wp_die(/*WP_I18N_BAD_PREFIX*/'<strong>ERROR</strong>: <code>$table_prefix</code> in <code>wp-config.php</code> can only contain numbers, letters, and underscores.'/*/WP_I18N_BAD_PREFIX*/);
 
-/**
- * Copy an object.
- *
- * Returns a cloned copy of an object.
- *
- * @since 2.7.0
- *
- * @param object $object The object to clone
- * @return object The cloned object
- */
-function wp_clone( $object ) {
-	static $can_clone;
-	if ( !isset( $can_clone ) ) {
-		$can_clone = version_compare( phpversion(), '5.0', '>=' );
-	}
-	return $can_clone ? clone( $object ) : $object;
-}
-
-/**
- * Whether the current request is in WordPress admin Panel
- *
- * Does not inform on whether the user is an admin! Use capability checks to
- * tell if the user should be accessing a section or not.
- *
- * @since 1.5.1
- *
- * @return bool True if inside WordPress administration pages.
- */
-function is_admin() {
-	if ( defined('WP_ADMIN') )
-		return WP_ADMIN;
-	return false;
-}
-
 if ( file_exists(WP_CONTENT_DIR . '/object-cache.php') ) {
 	require_once (WP_CONTENT_DIR . '/object-cache.php');
 	$_wp_using_ext_object_cache = true;
@@ -415,7 +224,6 @@
 require (ABSPATH . WPINC . '/bookmark-template.php');
 require (ABSPATH . WPINC . '/kses.php');
 require (ABSPATH . WPINC . '/cron.php');
-require (ABSPATH . WPINC . '/version.php');
 require (ABSPATH . WPINC . '/deprecated.php');
 require (ABSPATH . WPINC . '/script-loader.php');
 require (ABSPATH . WPINC . '/taxonomy.php');
Index: wp-admin/setup-config.php
===================================================================
--- wp-admin/setup-config.php	(revision 12716)
+++ wp-admin/setup-config.php	(working copy)
@@ -24,15 +24,17 @@
 error_reporting(0);
 
 /**#@+
- * These three defines are required to allow us to use require_wp_db() to load
+ * These defines are required to allow us to use require_wp_db() to load
  * the database class while being wp-content/db.php aware.
  * @ignore
  */
 define('ABSPATH', dirname(dirname(__FILE__)).'/');
 define('WPINC', 'wp-includes');
 define('WP_CONTENT_DIR', ABSPATH . 'wp-content');
+define('WP_DEBUG', false);
 /**#@-*/
 
+require_once(ABSPATH . WPINC . '/init.php');
 require_once(ABSPATH . WPINC . '/compat.php');
 require_once(ABSPATH . WPINC . '/functions.php');
 require_once(ABSPATH . WPINC . '/classes.php');
Index: wp-includes/init.php
===================================================================
--- wp-includes/init.php	(revision 0)
+++ wp-includes/init.php	(revision 0)
@@ -0,0 +1,226 @@
+<?php
+/**
+ * Functions needed to initialize WordPress.
+ *
+ * These functions are loaded before WordPress is initialized in wp-settings.php
+ * and in other locations.
+ *
+ * @package WordPress
+ */
+
+/**
+ * Whether Multisite support is enabled
+ *
+ * @since 3.0
+ *
+ * @return bool True if multisite is enabled, false otherwise.
+ */
+function is_multisite() {
+	if ( ( defined('MULTISITE') && MULTISITE ) || defined('VHOST') || defined('SUNRISE') )
+		return true;
+
+	return false;
+}
+
+/**
+ * Turn register globals off.
+ *
+ * @access private
+ * @since 2.1.0
+ * @return null Will return null if register_globals PHP directive was disabled
+ */
+function wp_unregister_GLOBALS() {
+	if ( !ini_get('register_globals') )
+		return;
+
+	if ( isset($_REQUEST['GLOBALS']) )
+		die('GLOBALS overwrite attempt detected');
+
+	// Variables that shouldn't be unset
+	$noUnset = array('GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix');
+
+	$input = array_merge($_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset($_SESSION) && is_array($_SESSION) ? $_SESSION : array());
+	foreach ( $input as $k => $v )
+		if ( !in_array($k, $noUnset) && isset($GLOBALS[$k]) ) {
+			$GLOBALS[$k] = NULL;
+			unset($GLOBALS[$k]);
+		}
+}
+
+/**
+ * PHP 4 standard microtime start capture.
+ *
+ * @access private
+ * @since 0.71
+ * @global int $timestart Seconds and Microseconds added together from when function is called.
+ * @return bool Always returns true.
+ */
+function timer_start() {
+	global $timestart;
+	$mtime = explode(' ', microtime() );
+	$mtime = $mtime[1] + $mtime[0];
+	$timestart = $mtime;
+	return true;
+}
+
+/**
+ * Return and/or display the time from the page start to when function is called.
+ *
+ * You can get the results and print them by doing:
+ * <code>
+ * $nTimePageTookToExecute = timer_stop();
+ * echo $nTimePageTookToExecute;
+ * </code>
+ *
+ * Or instead, you can do:
+ * <code>
+ * timer_stop(1);
+ * </code>
+ * which will do what the above does. If you need the result, you can assign it to a variable, but
+ * most cases, you only need to echo it.
+ *
+ * @since 0.71
+ * @global int $timestart Seconds and Microseconds added together from when timer_start() is called
+ * @global int $timeend  Seconds and Microseconds added together from when function is called
+ *
+ * @param int $display Use '0' or null to not echo anything and 1 to echo the total time
+ * @param int $precision The amount of digits from the right of the decimal to display. Default is 3.
+ * @return float The "second.microsecond" finished time calculation
+ */
+function timer_stop($display = 0, $precision = 3) { //if called like timer_stop(1), will echo $timetotal
+	global $timestart, $timeend;
+	$mtime = microtime();
+	$mtime = explode(' ',$mtime);
+	$mtime = $mtime[1] + $mtime[0];
+	$timeend = $mtime;
+	$timetotal = $timeend-$timestart;
+	$r = ( function_exists('number_format_i18n') ) ? number_format_i18n($timetotal, $precision) : number_format($timetotal, $precision);
+	if ( $display )
+		echo $r;
+	return $r;
+}
+
+/**
+ * Copy an object.
+ *
+ * Returns a cloned copy of an object.
+ *
+ * @since 2.7.0
+ *
+ * @param object $object The object to clone
+ * @return object The cloned object
+ */
+function wp_clone( $object ) {
+	static $can_clone;
+	if ( !isset( $can_clone ) ) {
+		$can_clone = version_compare( phpversion(), '5.0', '>=' );
+	}
+	return $can_clone ? clone( $object ) : $object;
+}
+
+/**
+ * Whether the current request is in WordPress admin Panel
+ *
+ * Does not inform on whether the user is an admin! Use capability checks to
+ * tell if the user should be accessing a section or not.
+ *
+ * @since 1.5.1
+ *
+ * @return bool True if inside WordPress administration pages.
+ */
+function is_admin() {
+	if ( defined('WP_ADMIN') )
+		return WP_ADMIN;
+	return false;
+}
+
+/**
+ * Displays maintenance message. 
+ *
+ * @access private
+ * @since 3.0.0
+ */
+function wp_maintenance() {
+	include(ABSPATH . '.maintenance');
+	// If the $upgrading timestamp is older than 10 minutes, don't die.
+	if ( ( time() - $upgrading ) < 600 ) {
+		if ( file_exists( WP_CONTENT_DIR . '/maintenance.php' ) ) {
+			require_once( WP_CONTENT_DIR . '/maintenance.php' );
+			die();
+		}
+
+		$protocol = $_SERVER["SERVER_PROTOCOL"];
+		if ( 'HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol )
+			$protocol = 'HTTP/1.0';
+		header( "$protocol 503 Service Unavailable", true, 503 );
+		header( 'Content-Type: text/html; charset=utf-8' );
+		header( 'Retry-After: 600' );
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+	<title>Maintenance</title>
+
+</head>
+<body>
+	<h1>Briefly unavailable for scheduled maintenance. Check back in a minute.</h1>
+</body>
+</html>
+<?php
+		die();
+	}
+}
+
+/**
+ * Fix $_SERVER variables.
+ *
+ * @access private
+ * @since 3.0.0
+ */
+function wp_fix_server_vars() {
+	// Fix for IIS when running with PHP ISAPI
+	if ( empty( $_SERVER['REQUEST_URI'] ) || ( php_sapi_name() != 'cgi-fcgi' && preg_match( '/^Microsoft-IIS\//', $_SERVER['SERVER_SOFTWARE'] ) ) ) {
+	
+		// IIS Mod-Rewrite
+		if (isset($_SERVER['HTTP_X_ORIGINAL_URL'])) {
+			$_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL'];
+		}
+		// IIS Isapi_Rewrite
+		else if (isset($_SERVER['HTTP_X_REWRITE_URL'])) {
+			$_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL'];
+		}
+		else
+		{
+			// Use ORIG_PATH_INFO if there is no PATH_INFO
+			if ( !isset($_SERVER['PATH_INFO']) && isset($_SERVER['ORIG_PATH_INFO']) )
+				$_SERVER['PATH_INFO'] = $_SERVER['ORIG_PATH_INFO'];
+	
+			// Some IIS + PHP configurations puts the script-name in the path-info (No need to append it twice)
+			if ( isset($_SERVER['PATH_INFO']) ) {
+				if ( $_SERVER['PATH_INFO'] == $_SERVER['SCRIPT_NAME'] )
+					$_SERVER['REQUEST_URI'] = $_SERVER['PATH_INFO'];
+				else
+					$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO'];
+			}
+	
+			// Append the query string if it exists and isn't null
+			if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {
+				$_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
+			}
+		}
+	}
+	
+	// Fix for PHP as CGI hosts that set SCRIPT_FILENAME to something ending in php.cgi for all requests
+	if ( isset($_SERVER['SCRIPT_FILENAME']) && ( strpos($_SERVER['SCRIPT_FILENAME'], 'php.cgi') == strlen($_SERVER['SCRIPT_FILENAME']) - 7 ) )
+		$_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED'];
+	
+	// Fix for Dreamhost and other PHP as CGI hosts
+	if (strpos($_SERVER['SCRIPT_NAME'], 'php.cgi') !== false)
+		unset($_SERVER['PATH_INFO']);
+	
+	// Fix empty PHP_SELF
+	$PHP_SELF = $_SERVER['PHP_SELF'];
+	if ( empty($PHP_SELF) )
+		$_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace("/(\?.*)?$/",'',$_SERVER["REQUEST_URI"]);
+}
\ No newline at end of file
