mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Create _setPath() and _setHost to simplify startup.
This commit is contained in:
parent
4b65ebd64f
commit
725bfc3e12
1 changed files with 36 additions and 16 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Reference in a new issue