Changeset 56
- Timestamp:
- 02/06/08 12:12:46 (3 months ago)
- Files:
-
- trunk/patSession/Storage.php (modified) (5 diffs)
- trunk/patSession/Storage/Native.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/patSession/Storage.php
r49 r56 5 5 * $Id$ 6 6 * 7 * @version 2. 2.07 * @version 2.3.0 8 8 * @package patSession 9 9 * @subpackage Storage … … 158 158 final public function __construct( $id = 'session', $options = array() ) 159 159 { 160 // extract default cookie parameter 161 $this->_cookieParams = session_get_cookie_params(); 162 160 163 $this->_id = $id; 161 164 $this->_setOptions( $options ); … … 808 811 // try to set a cookie 809 812 if( $this->_tokenMode == 'any' || $this->_tokenMode == 'cookie' ) { 810 setcookie( $this->_tokenName, $tokenNew );813 setcookie( $this->_tokenName, $tokenNew, $this->_cookieParams['lifetime'], $this->_cookieParams['path'] ); 811 814 } 812 815 … … 815 818 return true; 816 819 } 817 818 $match = false; 819 820 820 821 // check token from cookie 821 822 if( ( $this->_tokenMode == 'any' || $this->_tokenMode == 'cookie' ) && isset( $_COOKIE[$this->_tokenName] ) && $_COOKIE[$this->_tokenName] == $token ) { 822 $match =true;823 return true; 823 824 } 824 825 825 826 // check token send as get parameter 826 827 if( ( $this->_tokenMode == 'any' || $this->_tokenMode == 'get' ) && isset( $_GET[$token] ) ) { 827 $match = true;828 }829 830 if( $match ) {831 828 return true; 832 829 } … … 917 914 $this->_emptyReferer = 'allow'; 918 915 } 916 917 // cookie options 918 foreach( $this->_cookieParams as $k => &$v ) { 919 if( isset( $options['cookie_' . $k] ) ) { 920 $v = $options['cookie_' . $k]; 921 } 922 } 919 923 920 924 return true; trunk/patSession/Storage/Native.php
r46 r56 52 52 protected function _start() 53 53 { 54 session_set_cookie_params( $this->_cookieParams['lifetime'] 55 , $this->_cookieParams['path'] 56 , $this->_cookieParams['domain'] 57 , $this->_cookieParams['secure'] 58 ); 59 54 60 // start session if not startet 55 61 if( $this->_state != 'restart' && !defined( 'SID' ) ) { … … 121 127 ini_set( 'session.use_trans_sid', 0 ); 122 128 } 123 $cookie = session_get_cookie_params(); 124 125 // create new session id 129 130 // create new session id 126 131 $id = $this->_createId(); 127 132 … … 131 136 // restore config 132 137 ini_set( 'session.use_trans_sid', $trans ); 133 session_set_cookie_params( $cookie['lifetime'], $cookie['path'], $cookie['domain'], $cookie['secure'] ); 138 session_set_cookie_params( $this->_cookieParams['lifetime'] 139 , $this->_cookieParams['path'] 140 , $this->_cookieParams['domain'] 141 , $this->_cookieParams['secure'] 142 ); 134 143 135 144 // restart session with new id
