Changeset 110

Show
Ignore:
Timestamp:
2007-12-21 20:50:51 (1 year ago)
Author:
hannes
Message:

going back to de-registering global variables: defining variables which SHOULDN'T be deleted anymore

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/includes/input.php

    r104 r110  
    2626 * because the damage is already done once that takes effect, so... */ 
    2727if (ini_get('register_globals') !== 0 && strtolower(ini_get('register_globals')) !== 'off') { 
     28    // don't touch the following: 
     29    $not = Array(); 
     30    $not[] = 'SETTINGS'; 
     31    $not[] = 'VERSION'; 
     32    $not[] = 'BOTS'; 
     33    $not[] = 'MEMBERSTAGES'; 
     34    $not[] = 'CIPHER'; 
     35    $not[] = 'HASH'; 
     36    $not[] = 'LANG'; 
     37    $not[] = 'RULES'; 
     38    $not[] = 'STATUS'; 
    2839    // 'de-register' all local names of global variables 
    2940    foreach ($_SERVER as $key=>$val) { 
    30         unset($$key); 
     41        if (in_array($key, $not) === FALSE) { 
     42            unset($$key); 
     43        } 
    3144    } 
    3245    foreach ($_GET as $key=>$val) { 
    33         unset($$key); 
     46        if (in_array($key, $not) === FALSE) { 
     47            unset($$key); 
     48        } 
    3449    } 
    3550    foreach ($_POST as $key=>$val) { 
    36         unset($$key); 
     51        if (in_array($key, $not) === FALSE) { 
     52            unset($$key); 
     53        } 
    3754    } 
    3855    foreach ($_COOKIE as $key=>$val) { 
    39         unset($$key); 
     56        if (in_array($key, $not) === FALSE) { 
     57            unset($$key); 
     58        } 
    4059    } 
    4160    foreach ($_FILES as $key=>$val) { 
    42         unset($$key); 
     61        if (in_array($key, $not) === FALSE) { 
     62            unset($$key); 
     63        } 
    4364    } 
    4465    foreach ($_ENV as $key=>$val) { 
    45         unset($$key); 
     66        if (in_array($key, $not) === FALSE) { 
     67            unset($$key); 
     68        } 
    4669    } 
    4770    foreach ($_REQUEST as $key=>$val) { 
    48         unset($$key); 
     71        if (in_array($key, $not) === FALSE) { 
     72            unset($$key); 
     73        } 
    4974    } 
    5075    if (isset($_SESSION) && is_array($_SESSION)) { 
    5176        foreach ($_SESSION as $key=>$val) { 
    52             unset($$key); 
     77            if (in_array($key, $not) === FALSE) { 
     78                unset($$key); 
     79            } 
    5380        } 
    5481    }