Changeset 2799

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

make installer work with new String/SuperGlobals classes

Location:
branches/sginput/htdocs/system/classes
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • branches/sginput/htdocs/system/classes/actionhandler.php

    r2606 r2799  
    2020     * Internal array of handler variables (state info) 
    2121     *  
    22      * @var array 
     22     * @var SuperGlobal 
    2323     */ 
    24     public $handler_vars = array(); 
     24    public $handler_vars; 
     25     
     26    /** 
     27     * Constructor 
     28     * 
     29     * Initializes handler_vars 
     30     */ 
     31    public function __construct() { 
     32        $this->handler_vars = new SuperGlobal(array()); 
     33    } 
    2534 
    2635    /** 
     
    7685     */ 
    7786    public function __call($function, $args) { 
    78         $this->handler_vars = array_merge($this->handler_vars, $args); 
     87        $this->handler_vars = $this->handler_vars->merge($args); 
    7988        return $this->act($function); 
    8089    } 
  • branches/sginput/htdocs/system/classes/installhandler.php

    r2745 r2799  
    1414    public function act_begin_install() 
    1515    { 
    16         // Revert magic quotes, normally Controller calls this. 
    17         Utils::revert_magic_quotes_gpc(); 
    18  
    1916        // Create a new theme to handle the display of the installer 
    2017        $this->theme = Themes::create('installer', 'RawPHPEngine', HABARI_PATH . '/system/installer/'); 
     
    119116        // now merge in any HTTP POST values that might have been sent 
    120117        // these will override the defaults and the config.php values 
    121         $this->handler_vars = array_merge($this->handler_vars, $_POST); 
     118        $this->handler_vars = $this->handler_vars->merge($_POST); 
    122119 
    123120        // we need details for the admin user to install 
     
    142139 
    143140        // make sure the admin password is correct 
    144         if ( $this->handler_vars['admin_pass1'] !== $this->handler_vars['admin_pass2'] ) { 
     141        if ( (string)$this->handler_vars['admin_pass1'] !== (string)$this->handler_vars['admin_pass2'] ) { 
    145142            $this->theme->assign( 'form_errors', array('password_mismatch'=>_t('Password mis-match.')) ); 
    146143            $this->display('db_setup'); 
     
    518515        $admin_pass = $this->handler_vars['admin_pass1']; 
    519516 
    520         if ($admin_pass{0} == '{') { 
     517        if ($admin_pass[0] == '{') { 
    521518            // looks like we might have a crypted password 
    522519            $password = $admin_pass; 
     
    677674            return false; 
    678675        } 
    679         $vars = array_map('addslashes', $this->handler_vars); 
     676         
     677        $vars = array(); 
     678        foreach ($this->handler_vars as $k => $v) { 
     679            $vars[$k] = addslashes($v); 
     680        } 
     681        $keys = array(); 
     682        foreach (array_keys($vars) as $v) { 
     683            $keys[] = Utils::map_array($v); 
     684        } 
    680685        $file_contents = str_replace( 
    681             array_map(array('Utils', 'map_array'), array_keys($vars)), 
     686            $keys, 
    682687            $vars, 
    683688            $file_contents 
  • branches/sginput/htdocs/system/classes/string.php

    r2790 r2799  
    88 */ 
    99 
    10 class String 
     10class String implements ArrayAccess 
    1111{ 
    1212    protected $string; 
     
    9191        return new String(call_user_func_array(array('Plugins', $filter), $args)); 
    9292    } 
     93     
     94    // ArrayAccess Implementation for (e.g.) $string[0] 
     95     
     96    public function offsetExists($offset) { 
     97        return $offset >= 0 && $offset < strlen($this->string); 
     98    } 
     99    public function offsetGet($offset) { 
     100        return $this->string[$offset]; 
     101    } 
     102    public function offsetSet($offset, $value) { 
     103        $this->string[$offset] = $value[0]; 
     104    } 
     105    public function offsetUnset ($offset) { 
     106        throw new Exception('Cannot unset String offsets'); 
     107    } 
    93108} 
    94109