function preDispatch() { $auth = Zend_Auth::getInstance(); if (!$auth->hasIdentity()) { $sReturn = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; $sReturn = base64_encode($sReturn); $identity = Pandamp_Application::getResource('identity'); $loginUrl = $identity->loginUrl; $this->_redirect($loginUrl . '?returnTo=' . $sReturn); //$this->_redirect(ROOT_URL.'/helper/synclogin/generate/?returnTo='.$sReturn); } else { // [TODO] else: check if user has access to admin page $username = $auth->getIdentity()->username; // get group information $acl = Pandamp_Acl::manager(); $aReturn = $acl->getUserGroupIds($username); // [TODO] else: check if user has access to admin page and status website is online $tblSetting = new Pandamp_Modules_Misc_Setting_Model_Setting(); $rowset = $tblSetting->find(1)->current(); if ($rowset) { if ($rowset->status == 1) { // it means that user offline other than admin if (isset($aReturn[1])) { if ($aReturn[1] !== "Master" && $aReturn[1] !== "Super Admin") { $this->_forward('temporary', 'error', 'admin'); } } } else { return; } } } }
function processAction() { $guid = $this->_getParam('id') ? $this->_getParam('id') : ''; $status = $this->_getParam('status') ? $this->_getParam('status') : ''; $tblSetting = new Pandamp_Modules_Misc_Setting_Model_Setting(); $rowset = $tblSetting->find($guid); if (count($rowset) > 0) { $rowSetting = $rowset->current(); $rowSetting->status = $status == 1 ? 1 : 0; $rowSetting->save(); $response['success'] = true; } else { $response['success'] = false; } echo Zend_Json::encode($response); }
function preDispatch() { $auth = Zend_Auth::getInstance(); if (!$auth->hasIdentity()) { $sReturn = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; $sReturn = base64_encode($sReturn); $identity = Pandamp_Application::getResource('identity'); $loginUrl = $identity->loginUrl; $this->_redirect($loginUrl . '?returnTo=' . $sReturn); //$this->_redirect(ROOT_URL.'/helper/synclogin/generate/?returnTo='.$sReturn); } else { // [TODO] else: check if user has access to admin page $username = $auth->getIdentity()->username; // get group information $acl = Pandamp_Acl::manager(); $aReturn = $acl->getUserGroupIds($username); if (isset($aReturn[1])) { //if (($aReturn[1] !== "admin") && ($aReturn[1] !== "news_admin")) if ($aReturn[1] !== "Master" && $aReturn[1] !== "Super Admin" && $aReturn[1] !== "News Admin") { echo "{success:false, error:'Page restricted!!'}"; die; } } // [TODO] else: check if user has access to admin page and status website is online $tblSetting = new Pandamp_Modules_Misc_Setting_Model_Setting(); $rowset = $tblSetting->find(1)->current(); if ($rowset) { if ($rowset->status == 1) { // it means that user offline other than admin if (isset($aReturn[1])) { //if (($aReturn[1] !== "admin")) if ($aReturn[1] !== "Master" && $aReturn[1] !== "Super Admin") { echo "{success:false, error:'The page you are looking for is temporarily unavailable.<br/>Please try again later.'}"; die; } } } else { return; } } } }
function preDispatch() { $this->view->addHelperPath(ROOT_DIR . '/library/Pandamp/Controller/Action/Helper', 'Pandamp_Controller_Action_Helper'); $auth = Zend_Auth::getInstance(); if (!$auth->hasIdentity()) { $sReturn = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; $sReturn = base64_encode($sReturn); $identity = Pandamp_Application::getResource('identity'); $loginUrl = $identity->loginUrl; $this->_redirect($loginUrl . '?returnTo=' . $sReturn); //$this->_redirect(ROOT_URL.'/helper/synclogin/generate/?returnTo='.$sReturn); } else { // [TODO] else: check if user has access to admin page $username = $auth->getIdentity()->username; $this->view->username = $username; $acl = Pandamp_Acl::manager(); $aReturn = $acl->getUserGroupIds($username); if (isset($aReturn[1])) { if ($aReturn[1] !== "Master" && $aReturn[1] !== "Super Admin" && $aReturn[1] !== "Dc Admin" && $aReturn[1] !== "Dc Editor" && $aReturn[1] !== "Dc Coordinator" && $aReturn[1] !== "News Admin" && $aReturn[1] !== "News Editor" && $aReturn[1] !== "HolProject" && $aReturn[1] !== "Clinic Admin" && $aReturn[1] !== "Marketing") { $this->_helper->redirector('restricted', "error", 'admin'); } } // [TODO] else: check if user has access to admin page and status website is online $tblSetting = new Pandamp_Modules_Misc_Setting_Model_Setting(); $rowset = $tblSetting->find(1)->current(); if ($rowset) { if ($rowset->status == 1) { // it means that user offline other than admin if (isset($aReturn[1])) { //if (($aReturn[1] !== "admin")) if ($aReturn[1] !== "Master" && $aReturn[1] !== "Super Admin") { $this->_forward('temporary', 'error', 'admin'); } } } else { return; } } } }
function changeStatusAction() { $status = $this->_getParam('status') ? $this->_getParam('status') : ''; switch ($status) { case 'online': $status = 0; break; case 'offline': $status = 1; break; } $tblSetting = new Pandamp_Modules_Misc_Setting_Model_Setting(); $rowset = $tblSetting->find(1)->current(); if ($rowset) { $rowset->status = $status; $rowset->save(); $this->view->success = true; } else { $this->view->success = false; } }