Index: branches/unlabeled/unlabeled-1.55.2/core/kernel/session/session.php =================================================================== diff -u -r7657 -r7828 --- branches/unlabeled/unlabeled-1.55.2/core/kernel/session/session.php (.../session.php) (revision 7657) +++ branches/unlabeled/unlabeled-1.55.2/core/kernel/session/session.php (.../session.php) (revision 7828) @@ -366,9 +366,9 @@ $this->CookieName = $cookie_name; } - function InitStorage() + function InitStorage($special) { - $this->Storage =& $this->Application->recallObject('SessionStorage'); + $this->Storage =& $this->Application->recallObject('SessionStorage.'.$special); $this->Storage->setSessionTimeout($this->SessionTimeout); } @@ -380,7 +380,7 @@ if ($this->CookiesEnabled) $_COOKIE['cookies_on'] = 1; $this->Checkers = Array(); - $this->InitStorage(); + $this->InitStorage($special); $this->Data =& new Params(); $tmp_sid = $this->GetPassedSIDValue(); @@ -389,10 +389,10 @@ if( !(defined('IS_INSTALL') && IS_INSTALL) ) { $expired_sids = $this->DeleteExpired(); - if( ( $expired_sids && in_array($tmp_sid,$expired_sids) ) || ( $tmp_sid && !$check ) ) - { + if ( ( $expired_sids && in_array($tmp_sid,$expired_sids) ) || ( $tmp_sid && !$check ) ) { $this->SetSession(); $this->Application->HandleEvent($event, 'u:OnSessionExpire'); + return ; } } @@ -650,6 +650,15 @@ break; } $this->Storage->StoreSession($this); + + if ($this->Application->IsAdmin() || $this->Special == 'admin') { + $this->StoreVar('admin', 1); + } + + if ($this->Special != '') { + // front-session called from admin or otherwise, then save it's data + $this->SaveData(); + } } /** @@ -859,7 +868,23 @@ { return $this->Storage->DeleteExpired(); } + + /** + * Allows to check if user in this session is logged in or not + * + * @return bool + */ + function LoggedIn() + { + $user_id = $this->RecallVar('user_id'); + $ret = $user_id > 0; + if ($this->RecallVar('admin') == 1 && ($user_id == -1)) { + $ret = true; + } + return $ret; + } + } ?> \ No newline at end of file