setSuModeOff(); } $this->setSuModeOn(); } if ($this->getAuth()->getSuMode()) { $this->setBodyAttrib('class', 'su'); } if (App_Admin_Auth::getInstance()->getData('reportsAccess') !== 'y') { // if we come to subpage of report page ("require-reports-access" => 'y') - show 404 $reportAlias = Qs_SiteMap::findFirst(array('require-reports-access' => 'y'), null, null, 'fullAlias'); $pageAlias = $this->getOption('fullAlias'); if ($reportAlias && $pageAlias > $reportAlias && $reportAlias === substr($pageAlias, 0, strlen($reportAlias))) { $this->response(403, 'Forbidden'); } } } public function setSuModeOn() { $this->getAuth()->setSuMode(); $this->setRedirectMessage('Su Mode Enabled'); $url = Qs_Request::getUrlExclude('su'); Qs_Http::redirect($url); } public function setRedirectMessage($text) { $session = new Qs_Session_Namespace(Qs_Constant::get('CURRENT_PAGE'), true); $session->message = $text; $session->setExpirationHops(1, 'message'); } public function setSuModeOff() { $this->getAuth()->setSuMode(false); $this->setRedirectMessage('Su Mode Disabled'); $url = Qs_Request::getUrlExclude('su'); Qs_Http::redirect($url); } public function getAuth() { if (null === $this->_auth) { $this->_auth = App_Admin_Auth::getInstance(); } return $this->_auth; } public function getAuthAdapter() { if (null === $this->_authAdapter) { $this->_authAdapter = new App_Admin_AuthAdapter(); } return $this->_authAdapter; } protected function _beforeDisplay() { parent::_beforeDisplay(); $this->_initKeepSession(); return $this; } public function getMenu() { if (null === $this->_content['menu']) { $this->_content['menu'] = Qs_SiteMap::getBackendMenu(); } if (App_Admin_Auth::getInstance()->getData('reportsAccess') !== 'y') { $this->_content['menu'] = Qs_SiteMap::filterExclude( $this->_content['menu'], array('require-reports-access' => 'y') ); } return $this->_content['menu']; } protected function _initKeepSession() { $interval = (int) Qs_Constant::get('SESSION_REFRESH_INTERVAL'); if ($interval) { $this->addScript('js/lib/keep-session.js') ->addInlineScript('keepSession', ' $(document).ready(function(){ keepSession = new Qs_KeepSession(); keepSession.setInterval(' . $interval . '); keepSession.setUrl("' . BASE_URL_LANGUAGE . '/keep-session"); keepSession.start(); }); '); } return $this; } }