Changeset 2789

Show
Ignore:
Timestamp:
11/11/08 14:09:27 (2 months ago)
Author:
ringmaster
Message:

Create a branch for default input filtering on superglobals.

Location:
branches/sginput
Files:
3 modified
3 copied

Legend:

Unmodified
Added
Removed
  • branches/sginput/htdocs/index.php

    r2764 r2789  
    112112Error::handle_errors(); 
    113113 
     114// Replace all of the $_GET, $_POST, and $_COOKIE superglobals with object 
     115// representations of each.  Unset $_REQUEST, which is evil. 
     116SuperGlobal::process_gpc(); 
     117 
    114118/* Initiate install verifications */ 
    115119 
  • branches/sginput/htdocs/system/classes/controller.php

    r2592 r2789  
    119119        $start_url = trim($start_url, '/'); 
    120120 
    121         /* Remove the querystring from the URL */ 
    122         if ( strpos($start_url, '?') !== FALSE ) { 
    123             list($start_url, $query_string)= explode('?', $start_url); 
    124         } 
    125  
    126         /* Return $_GET values to their proper place */ 
    127         if( !empty($query_string) ) { 
    128             parse_str($query_string, $_GET); 
    129         } 
    130  
    131         /* Undo what magic_quotes_gpc might have wrought */ 
    132         Utils::revert_magic_quotes_gpc(); 
    133  
    134121        /* Allow plugins to rewrite the stub before it's passed through the rules */ 
    135122        $start_url = Plugins::filter('rewrite_request', $start_url); 
     
    154141 
    155142        /* Also, we musn't forget to add the GET and POST vars into the action's settings array */ 
    156         $controller->handler->handler_vars = array_merge($controller->handler->handler_vars, $_GET, $_POST); 
     143        $handler_vars = new SuperGlobal($controller->handler->handler_vars); 
     144        $handler_vars->merge($_GET, $_POST); 
     145        $controller->handler->handler_vars = $handler_vars; 
    157146        return true; 
    158147    } 
  • branches/sginput/htdocs/system/classes/utils.php

    r2651 r2789  
    169169    public static function revert_magic_quotes_gpc() 
    170170    { 
    171         /* We should only revert the magic quotes once per page hit */ 
    172         static $revert = true; 
    173         if ( get_magic_quotes_gpc() && $revert) { 
    174         $_GET = self::stripslashes($_GET); 
    175         $_POST = self::stripslashes($_POST); 
    176         $_COOKIE = self::stripslashes($_COOKIE); 
    177         $revert = false; 
    178         } 
     171        /* We should only revert the magic quotes once per page hit */ 
     172        static $revert = true; 
     173        if ( get_magic_quotes_gpc() && $revert) { 
     174            $_GET = self::stripslashes($_GET); 
     175            $_POST = self::stripslashes($_POST); 
     176            $_COOKIE = self::stripslashes($_COOKIE); 
     177            $revert = false; 
     178        } 
    179179    } 
    180180 
     
    840840            finfo_close($finfo); 
    841841        } 
    842          
     842 
    843843        if( empty( $mimetype ) ) { 
    844844            $pi = pathinfo($filename);