Changeset 1779
- Timestamp:
- 01/21/2008 01:34:23 PM (12 months ago)
- Location:
- trunk/system
- Files:
-
- 6 modified
-
config/session.php (modified) (1 diff)
-
core/Kohana.php (modified) (2 diffs)
-
i18n/en_US/session.php (modified) (1 diff)
-
i18n/nl_NL/session.php (modified) (1 diff)
-
libraries/Input.php (modified) (1 diff)
-
libraries/Session.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/system/config/session.php
r1753 r1779 14 14 /** 15 15 * Default session name. 16 * It should contain only alphanumeric characters and at least one letter should be present. 16 17 */ 17 $config['name'] = 'kohana _session';18 $config['name'] = 'kohanasession'; 18 19 19 20 /** -
trunk/system/core/Kohana.php
r1773 r1779 55 55 $ER = error_reporting(0); 56 56 57 // Set the user agent58 self::$user_agent = trim($_SERVER['HTTP_USER_AGENT']);59 60 57 if (function_exists('date_default_timezone_set')) 61 58 { … … 100 97 // Set locale information 101 98 setlocale(LC_ALL, Config::item('locale.language').'.UTF-8'); 99 100 // Set the user agent 101 self::$user_agent = Input::instance()->user_agent(); 102 102 103 103 // Enable Kohana routing -
trunk/system/i18n/en_US/session.php
r1772 r1779 5 5 'no_table' => 'The configured session table, %s, was not found.', 6 6 'driver_not_supported' => 'The requested Session driver, %s, was not found.', 7 'driver_must_implement_interface' => 'Session drivers must implement the Session_Driver interface.' 7 'driver_must_implement_interface' => 'Session drivers must implement the Session_Driver interface.', 8 'invalid_session_name' => 'The session_name, %s, is invalid. It should contain only alphanumeric characters and at least one letter should be present.', 8 9 ); -
trunk/system/i18n/nl_NL/session.php
r1524 r1779 5 5 'no_table' => 'De session tabel, %s, werd niet gevonden.', 6 6 'driver_not_supported' => 'De opgevraagde session driver, %s, werd niet gevonden.', 7 'driver_must_implement_interface' => 'Session drivers moeten de Session_Driver interface implementeren.' 7 'driver_must_implement_interface' => 'Session drivers moeten de Session_Driver interface implementeren.', 8 'invalid_session_name' => 'De session naam, %s, is ongeldig. Hij mag alleen maar bestaan uit alfanumerieke karakters en moet minstens één letter bevatten.', 8 9 ); -
trunk/system/libraries/Input.php
r1754 r1779 318 318 return $this->user_agent; 319 319 320 $this->user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT']: FALSE;320 $this->user_agent = (isset($_SERVER['HTTP_USER_AGENT'])) ? trim($_SERVER['HTTP_USER_AGENT']) : FALSE; 321 321 322 322 return $this->user_agent; -
trunk/system/libraries/Session.php
r1773 r1779 119 119 120 120 // Set the session cookie parameters 121 session_set_cookie_params 122 ( 123 self::$config['expiration'], 124 Config::item('cookie.path'), 125 Config::item('cookie.domain'), 126 Config::item('cookie.secure'), 127 Config::item('cookie.httponly') 128 ); 121 // Note: the httponly parameter was added in PHP 5.2.0 122 if (version_compare(PHP_VERSION, '5.2.0', '>=')) 123 { 124 session_set_cookie_params 125 ( 126 self::$config['expiration'], 127 Config::item('cookie.path'), 128 Config::item('cookie.domain'), 129 Config::item('cookie.secure'), 130 Config::item('cookie.httponly') 131 ); 132 } 133 else 134 { 135 session_set_cookie_params 136 ( 137 self::$config['expiration'], 138 Config::item('cookie.path'), 139 Config::item('cookie.domain'), 140 Config::item('cookie.secure') 141 ); 142 } 129 143 130 144 if (self::$config['driver'] != 'native') … … 142 156 } 143 157 144 // Set the session name 158 // Set the session name after having checked it 159 if ( ! ctype_alnum(self::$config['name']) OR ctype_digit(self::$config['name'])) 160 throw new Kohana_Exception('session.invalid_session_name', self::$config['name']); 161 145 162 session_name(self::$config['name']); 146 163 … … 154 171 if ( ! isset($_SESSION['_kf_flash_'])) 155 172 { 156 $_SESSION['user_agent'] = Kohana::$user_agent;173 $_SESSION['user_agent'] = $this->input->user_agent(); 157 174 $_SESSION['ip_address'] = $this->input->ip_address(); 158 175 $_SESSION['_kf_flash_'] = array(); … … 179 196 if ($_SESSION[$valid] !== $this->input->$valid()) 180 197 { 181 session_unset();182 198 return $this->create(); 183 199 } … … 225 241 { 226 242 // Pass the regenerating off to the driver in case it wants to do anything special 227 // The new id is returned228 243 $_SESSION['session_id'] = self::$driver->regenerate(); 229 244 } … … 244 259 session_unset(); 245 260 246 // Writethe session261 // Destroy the session 247 262 return session_destroy(); 248 263 } … … 287 302 public function set_flash($keys, $val = FALSE) 288 303 { 289 if ( $keys == FALSE)290 return ;304 if (empty($keys)) 305 return FALSE; 291 306 292 307 if ( ! is_array($keys)) … … 336 351 public function get($key = FALSE, $default = FALSE) 337 352 { 338 if ( $key == FALSE)353 if (empty($key)) 339 354 return $_SESSION; 340 355 341 $result = isset($_SESSION[$key]) ? $_SESSION[$key] : Kohana::key_string($key, $_SESSION);356 $result = (isset($_SESSION[$key])) ? $_SESSION[$key] : Kohana::key_string($key, $_SESSION); 342 357 343 358 return ($result === NULL) ? $default : $result; … … 381 396 foreach((array) $keys as $key) 382 397 { 383 if (isset(self::$protect[$key]))398 if (isset(self::$protect[$key])) 384 399 continue; 385 400
