Skip to content
Permalink
Browse files

Rename constructor to init() and add init() call at bottom of CakeSes…

…sion.
  • Loading branch information...
predominant authored and markstory committed Jul 4, 2010
1 parent 3430930 commit b0e4a09d38b123527beb41b0355067795aa791fc
Showing with 10 additions and 10 deletions.
  1. +10 −10 cake/libs/cake_session.php
@@ -32,7 +32,7 @@
* @package cake
* @subpackage cake.cake.libs
*/
class CakeSession extends Object {
class CakeSession {
/**
* True if the Session is still valid
@@ -139,15 +139,16 @@ class CakeSession extends Object {
* @param string $base The base path for the Session
* @param boolean $start Should session be started right now
*/
public function __construct($base = null, $start = true) {
public static function init($base = null, $start = true) {
App::import('Core', array('Set', 'Security'));
self::$time = time();
if (Configure::read('Session.checkAgent') === true || Configure::read('Session.checkAgent') === null) {
if (env('HTTP_USER_AGENT') != null) {
self::$_userAgent = md5(env('HTTP_USER_AGENT') . Configure::read('Security.salt'));
}
$checkAgent = Configure::read('Session.checkAgent');
if (($checkAgent === true || $checkAgent === null) && env('HTTP_USER_AGENT') != null) {
self::$_userAgent = md5(env('HTTP_USER_AGENT') . Configure::read('Security.salt'));
}
unset($checkAgent);
if (Configure::read('Session.save') === 'database') {
$modelName = Configure::read('Session.model');
$database = Configure::read('Session.database');
@@ -187,13 +188,9 @@ public function __construct($base = null, $start = true) {
}
}
if (isset($_SESSION) || $start === true) {
if (!class_exists('Security')) {
App::import('Core', 'Security');
}
self::$sessionTime = self::$time + (Security::inactiveMins() * Configure::read('Session.timeout'));
self::$security = Configure::read('Security.level');
}
parent::__construct();
}
/**
@@ -757,3 +754,6 @@ function __gc($expires = null) {
return $return;
}
}
// Initialize the session
CakeSession::init();

0 comments on commit b0e4a09

Please sign in to comment.
You can’t perform that action at this time.