summaryrefslogtreecommitdiffstats
path: root/wp-inst/wp-settings.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2005-08-15 10:05:38 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2005-08-15 10:05:38 +0000
commite6b38d5bb77bd7495b3513ebfd3679ee1dd79996 (patch)
treef972a1b867d13637f01586cb7e565ccf1654c2c5 /wp-inst/wp-settings.php
parent2cbe26f5a201c8b6090d2d5faf337a6bb3f14cf0 (diff)
WP changes.
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@187 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-inst/wp-settings.php')
-rw-r--r--wp-inst/wp-settings.php28
1 files changed, 17 insertions, 11 deletions
diff --git a/wp-inst/wp-settings.php b/wp-inst/wp-settings.php
index 3c3537e..2f458cc 100644
--- a/wp-inst/wp-settings.php
+++ b/wp-inst/wp-settings.php
@@ -1,19 +1,25 @@
<?php
// Turn register globals off
-if ( ini_get('register_globals') ) {
- $superglobals = array($_SERVER, $_ENV, $_FILES, $_COOKIE, $_POST, $_GET);
- if ( isset($_SESSION) )
- array_unshift($superglobals, $_SESSION);
+function 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');
- foreach ( $superglobals as $superglobal )
- foreach ( $superglobal as $global => $value )
- if ( 'table_prefix' != $global )
- unset( $GLOBALS[$global] );
+ $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]) )
+ unset($GLOBALS[$k]);
}
-$HTTP_HOST = getenv('HTTP_HOST'); /* domain name */
-$REMOTE_ADDR = getenv('REMOTE_ADDR'); /* visitor's IP */
-$HTTP_USER_AGENT = getenv('HTTP_USER_AGENT'); /* visitor's browser */
+unregister_GLOBALS();
+
+$HTTP_USER_AGENT = getenv('HTTP_USER_AGENT');
+unset( $wp_filter, $cache_userdata, $cache_lastcommentmodified, $cache_lastpostdate, $cache_settings, $category_cache, $cache_categories );
// Fix for IIS, which doesn't set REQUEST_URI
if ( empty( $_SERVER['REQUEST_URI'] ) ) {