WordPress.org

Make WordPress Core

Changeset 5690


Ignore:
Timestamp:
06/12/2007 09:59:22 PM (14 years ago)
Author:
rob1n
Message:

Accidental commit. Props Nazgul. fixes #4437

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-settings.php

    r5688 r5690  
    11<?php
    2 
    3 if ( ini_get( 'register_globals' ) ) {
    4     if ( isset( $_REQUEST['GLOBALS'] ) ) {
    5         die( 'GLOBALS overwrite attempt detected. Exiting.' );
    6     }
    7    
    8     $no_unset = array( 'GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix' );
    9     $input = array_merge( $_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, is_array( $_SESSION ) ? $_SESSION : array() );
    10    
    11     foreach ( $input as $key => $val ) {
    12         if ( !in_array( $key, $no_unset ) && isset( $GLOBALS[$k] ) ) {
     2// Turn register globals off
     3function wp_unregister_GLOBALS() {
     4    if ( !ini_get('register_globals') )
     5        return;
     6
     7    if ( isset($_REQUEST['GLOBALS']) )
     8        die('GLOBALS overwrite attempt detected');
     9
     10    // Variables that shouldn't be unset
     11    $noUnset = array('GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix');
     12
     13    $input = array_merge($_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset($_SESSION) && is_array($_SESSION) ? $_SESSION : array());
     14    foreach ( $input as $k => $v )
     15        if ( !in_array($k, $noUnset) && isset($GLOBALS[$k]) ) {
    1316            $GLOBALS[$k] = NULL;
    14             unset( $GLOBALS[$key] );
     17            unset($GLOBALS[$k]);
    1518        }
    16     }
    17    
    18     unset( $no_unset, $input );
    19 }
     19}
     20
     21wp_unregister_GLOBALS();
    2022
    2123unset( $wp_filter, $cache_userdata, $cache_lastcommentmodified, $cache_lastpostdate, $cache_settings, $category_cache, $cache_categories );
    2224
    23 if ( !isset( $blog_id ) )
     25if ( ! isset($blog_id) )
    2426    $blog_id = 1;
    2527
Note: See TracChangeset for help on using the changeset viewer.