Changeset 300

Show
Ignore:
Timestamp:
08/05/08 20:32:15 (4 years ago)
Author:
john
Message:

fixed a few bugs with new session AR store

Location:
trunk/trax/vendor/trax
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/trax/vendor/trax/action_controller.php

    r299 r300  
    12841284        if($content) { 
    12851285            echo $content; 
     1286            $this->end_content_for(); 
    12861287        } 
    12871288    } 
  • trunk/trax/vendor/trax/session.php

    r298 r300  
    265265            self::$id = session_id(); 
    266266            self::$started = true; 
     267            $hash = self::get_hash(); 
     268            if(!isset($_SESSION[$hash])) { 
     269                $_SESSION[self::get_hash()] = array(); 
     270            } 
    267271        }                
    268272    } 
     
    296300     */ 
    297301    function unset_session() { 
    298         unset($_SESSION[self::get_hash()]); 
     302        $_SESSION[self::get_hash()] = array(); 
    299303    } 
    300304 
     
    337341    function isset_var($key) { 
    338342        if(self::is_valid_host()) { 
    339             if($_SESSION[self::get_hash()][$key]) { 
     343            if(isset($_SESSION[self::get_hash()][$key])) { 
    340344                return true;     
    341345            } 
     
    363367    function isset_flash($key) { 
    364368        if(self::is_valid_host()) { 
    365             if(array_key_exists(self::get_hash(), $_SESSION) 
    366                && array_key_exists('flash',$_SESSION[self::get_hash()]) 
    367                && array_key_exists($key, 
    368                                    $_SESSION[self::get_hash()]['flash'])) { 
    369                 return true;     
    370             } 
     369            $hash = self::get_hash(); 
     370            if(isset($_SESSION[$hash]['flash'][$key])) { 
     371                return true; 
     372            } 
     373            #if(array_key_exists($hash, $_SESSION) 
     374            #   && array_key_exists('flash', $_SESSION[$hash]) 
     375            #   && array_key_exists($key, $_SESSION[$hash]['flash'])) { 
     376            #    return true;     
     377            #} 
    371378        } 
    372379        return false; 
     
    393400    function flash($key, $value = null) { 
    394401        if(self::is_valid_host()) { 
     402            $hash = self::get_hash(); 
    395403            if($value) { 
    396                 $_SESSION[self::get_hash()]['flash'][$key] = $value; 
     404                $_SESSION[$hash]['flash'][$key] = $value; 
    397405            } else { 
    398                 $value = $_SESSION[self::get_hash()]['flash'][$key]; 
    399                 unset($_SESSION[self::get_hash()]['flash'][$key]); 
     406                $value = $_SESSION[$hash]['flash'][$key]; 
     407                unset($_SESSION[$hash]['flash'][$key]); 
    400408                return $value; 
    401409            } 
    402410        } 
    403411    } 
     412 
     413    /** 
     414     *  Debugging function to see what's in the session 
     415     * 
     416     *  Does a dump of the session to log file and optionally to screen 
     417     * 
     418     *  @param boolean $screen Display dump to screen 
     419     */ 
     420    function debug($screen = false) { 
     421        $msg = "Session::debug() => ".print_r($_SESSION, true); 
     422        error_log($msg); 
     423        if($screen) { 
     424            echo "<p><pre>".$msg."</pre></p>"; 
     425        } 
     426    } 
    404427} 
    405428 
  • trunk/trax/vendor/trax/session/active_record_store.php

    r298 r300  
    7474        $session = ($session instanceof ActiveRecordStore) ? $session : $this; 
    7575        $session->id = $sess_id; 
    76         $session->data = $this->escape($data); 
     76        $session->data = $data; 
    7777        $session->client_ip = $this->escape($_SERVER['REMOTE_ADDR']); 
    7878        $session->http_user_agent = $this->escape($_SERVER['HTTP_USER_AGENT']);