/** * Инициализация * */ public function Init() { $this->oMapper = E::GetMapper(__CLASS__); // * Проверяем есть ли у юзера сессия, т.е. залогинен или нет $iUserId = intval(E::ModuleSession()->Get('user_id')); if ($iUserId && ($oUser = $this->GetUserById($iUserId)) && $oUser->getActivate()) { if ($this->oSession = $oUser->getCurrentSession()) { if ($this->oSession->GetSessionExit()) { // Сессия была закрыта $this->Logout(); return; } $this->oUserCurrent = $oUser; } } // Если сессия оборвалась по таймауту (не сам пользователь ее завершил), // то пытаемся автоматически авторизоваться if (!$this->oUserCurrent) { $this->AutoLogin(); } // * Обновляем сессию if (isset($this->oSession)) { $this->UpdateSession(); } }