Skip to content

Commit 235d42b

Browse files
committed
[FIX] Method isLoggedIn().
1 parent 0442861 commit 235d42b

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

core/src/Core.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ public function __construct()
220220
public function initialize()
221221
{
222222

223-
if ($this->isLoggedIn()) {
223+
if ($this->isLoggedIn('mgr')) {
224224
ini_set('display_errors', 1);
225225
}
226226
// events
@@ -556,13 +556,18 @@ public function getDocumentIdentifier($method)
556556
/**
557557
* Check for manager or webuser login session since v1.2
558558
*
559-
* @param string $context
559+
* @param string $context 'mgr' or 'web'
560560
* @return bool
561561
*/
562-
public function isLoggedIn($context = 'mgr')
562+
public function isLoggedIn(string $context = ''): bool
563563
{
564-
$_ = 'mgrValidated';
564+
if (empty($context)) {
565+
$mgr = 'mgrValidated';
566+
$web = 'webValidated';
567+
return is_cli() || (isset($_SESSION[$mgr]) && !empty($_SESSION[$mgr])) || (isset($_SESSION[$web]) && !empty($_SESSION[$web]));
568+
}
565569

570+
$_ = $context.'Validated';
566571
return is_cli() || (isset($_SESSION[$_]) && !empty($_SESSION[$_]));
567572
}
568573

@@ -597,7 +602,7 @@ public function checkSiteStatus()
597602
return true;
598603
}
599604

600-
if ($this->isLoggedin()) {
605+
if ($this->isLoggedin('mgr')) {
601606
return true;
602607
} // site online
603608
// site offline but launched via the manager
@@ -2874,7 +2879,7 @@ public function prepareResponse()
28742879
{
28752880
// we now know the method and identifier, let's check the cache
28762881

2877-
if ($this->getConfig('enable_cache') == 2 && $this->isLoggedIn()) {
2882+
if ($this->getConfig('enable_cache') == 2 && $this->isLoggedIn('mgr')) {
28782883
$this->setConfig('enable_cache', 0);
28792884
}
28802885

0 commit comments

Comments
 (0)