Index: trunk/core/kernel/session/session.php =================================================================== diff -u -r7635 -r7855 --- trunk/core/kernel/session/session.php (.../session.php) (revision 7635) +++ trunk/core/kernel/session/session.php (.../session.php) (revision 7855) @@ -93,6 +93,10 @@ function StoreSession(&$session, $additional_fields = Array()) { + if (defined('IS_INSTALL') && IS_INSTALL && !$this->Application->TableFound($this->TableName)) { + return false; + } + $fields_hash = Array ( $this->IDField => $session->SID, $this->TimestampField => $session->Expiration @@ -366,9 +370,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 +384,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 +393,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 +654,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 +872,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