mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-17 22:39:03 +02:00
fix session
This commit is contained in:
@@ -284,9 +284,7 @@ class utils
|
||||
}
|
||||
// Read and record the value for switching the archive mode
|
||||
$iCurrent = self::ReadParam('with-archive', $iDefault);
|
||||
if (Session::IsInitialized()) {
|
||||
Session::Set('archive_mode', $iCurrent);
|
||||
}
|
||||
Session::Set('archive_mode', $iCurrent);
|
||||
// Read and use the value for the current page (web services)
|
||||
$iCurrent = self::ReadParam('with_archive', $iCurrent, true);
|
||||
self::$bPageMode = ($iCurrent == 1);
|
||||
|
||||
@@ -21,8 +21,6 @@ class Session
|
||||
/** @var int|null */
|
||||
public static $iSessionId = null;
|
||||
/** @var bool */
|
||||
protected static $bIsInitialized = false;
|
||||
/** @var bool */
|
||||
public static $bAllowCLI = false;
|
||||
|
||||
public static function Start()
|
||||
@@ -31,19 +29,15 @@ class Session
|
||||
return;
|
||||
}
|
||||
|
||||
if (session_status() === PHP_SESSION_ACTIVE) {
|
||||
if (session_status() === PHP_SESSION_ACTIVE || headers_sent()) {
|
||||
// Session already started
|
||||
self::$bIsInitialized = true;
|
||||
self::$iSessionId = session_id();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!headers_sent()) {
|
||||
SessionHandler::session_set_save_handler();
|
||||
session_name('itop-'.md5(APPROOT));
|
||||
}
|
||||
SessionHandler::session_set_save_handler();
|
||||
session_name('itop-'.md5(APPROOT));
|
||||
|
||||
self::$bIsInitialized = true;
|
||||
if (!is_null(self::$iSessionId)) {
|
||||
if (session_id(self::$iSessionId) === false) {
|
||||
session_regenerate_id(true);
|
||||
@@ -55,7 +49,7 @@ class Session
|
||||
|
||||
public static function RegenerateId($bDeleteOldSession = false)
|
||||
{
|
||||
if (session_status() === PHP_SESSION_DISABLED) {
|
||||
if (session_status() === PHP_SESSION_DISABLED || headers_sent()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -192,14 +186,6 @@ class Session
|
||||
return array_keys($_SESSION);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public static function IsInitialized(): bool
|
||||
{
|
||||
return self::$bIsInitialized;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool|string
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user