Create _setPath() and _setHost to simplify startup.

This commit is contained in:
predominant 2010-07-22 11:05:39 +10:00 committed by mark_story
parent 4b65ebd64f
commit 725bfc3e12

View file

@ -142,9 +142,27 @@ class CakeSession {
self::_setupDatabase();
if ($start === true) {
self::_setPath($base);
self::_setHost();
}
if (isset($_SESSION) || $start === true) {
self::$sessionTime = self::$time + (Security::inactiveMins() * Configure::read('Session.timeout'));
self::$security = Configure::read('Security.level');
}
}
/**
* Setup the Path variable
*
* @param string $base base path
* @return void
*/
protected static function _setPath($base = null) {
if (empty($base)) {
self::$path = '/';
} else {
return;
}
self::$path = $base;
if (strpos($base, 'index.php') !== false) {
self::$path = str_replace('index.php', '', $base);
@ -153,17 +171,19 @@ class CakeSession {
self::$path = str_replace('?', '', $base);
}
}
/**
* Set the host
*
* @return void
*/
protected static function _setHost() {
self::$host = env('HTTP_HOST');
if (strpos(self::$host, ':') !== false) {
self::$host = substr(self::$host, 0, strpos(self::$host, ':'));
}
}
if (isset($_SESSION) || $start === true) {
self::$sessionTime = self::$time + (Security::inactiveMins() * Configure::read('Session.timeout'));
self::$security = Configure::read('Security.level');
}
}
/**
* Setup database configuration for Session, if enabled.