Changeset 2798

Show
Ignore:
Timestamp:
11/12/08 00:52:32 (2 months ago)
Author:
sean
Message:

add server to superglobal breakout, also: remove type hinting and handle as array OR SuperGlobal in constructor

Location:
branches/sginput/htdocs
Files:
2 modified

Legend:

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

    r2789 r2798  
    112112Error::handle_errors(); 
    113113 
    114 // Replace all of the $_GET, $_POST, and $_COOKIE superglobals with object 
     114// Replace all of the $_GET, $_POST, $_COOKIE and $_SERVER superglobals with object 
    115115// representations of each.  Unset $_REQUEST, which is evil. 
    116 SuperGlobal::process_gpc(); 
     116SuperGlobal::process_gpcs(); 
    117117 
    118118/* Initiate install verifications */ 
  • branches/sginput/htdocs/system/classes/superglobal.php

    r2795 r2798  
    1010    protected $values = array(); 
    1111 
    12     public function __construct(array $array) 
     12    public function __construct($array) 
    1313    { 
     14        if (!is_array($array) && !$array instanceof SuperGlobal) { 
     15            throw new Exception('Parameter must be array or SuperGlobal'); 
     16        } 
    1417        $values['default'] = array(); 
    1518        parent::__construct($array); 
     
    1720 
    1821    /** 
    19      * Convert $_GET, $_POST, and $_COOKIE into SuperGlobal instances, also kill $_REQUEST 
     22     * Convert $_GET, $_POST, $_COOKIE and $_SERVER into SuperGlobal instances, also kill $_REQUEST 
    2023     * 
    2124     * @return 
    2225     */ 
    23     public static function process_gpc() 
     26    public static function process_gpcs() 
    2427    { 
    2528        /* We should only revert the magic quotes once per page hit */ 
     
    4043        $_POST = new SuperGlobal($_POST); 
    4144        $_COOKIE = new SuperGlobal($_COOKIE); 
     45        $_SERVER = new SuperGlobal($_SERVER); 
    4246        unset($_REQUEST); 
    4347