public function preDispatch() { parent::preDispatch(); Centurion_Signal::factory('pre_dispatch')->send($this); //TODO: temporary, implement a way in Zend_Navigation_Page_Mvc to active a page in all actions $pages = $this->view->navigation()->findBy('uri', $this->_request->getRequestUri(), true); if (count($pages) === 0) { $tempPages = $this->view->navigation()->findBy('controller', $this->_request->getControllerName(), true); $pages = array(); foreach ($tempPages as $key => $page) { if ($page->module == $this->_request->getModuleName()) { $pages[] = $page; } } if (count($pages) === 0) { if (Zend_Controller_Front::getInstance()->getRouter()->getCurrentRouteName() !== 'default') { $pages = $this->view->navigation()->findBy('route', Zend_Controller_Front::getInstance()->getRouter()->getCurrentRouteName(), true); } } } foreach ($pages as $key => $page) { $page->active = true; $page->setActive(true); } }
/** * Setzt alle Daten des Layouts aus den Einstellungsdateien * @throw Zend_Controller_Dispatcher_Exception */ public function preDispatch() { parent::preDispatch(); $modulename = $this->getRequest()->getModuleName(); $this->view->modulename = $modulename; $controllername = $this->getRequest()->getControllerName(); $this->view->controllername = $controllername; $actionname = $this->getRequest()->getActionName(); $recordAccount = null; if (Zend_Registry::get('Dragon_Package_Registry')->isAvailable('DragonX', 'Account') && Zend_Registry::get('Dragon_Package_Registry')->isAvailable('DragonX', 'Emailaddress')) { $sessionNamespace = new Zend_Session_Namespace(); if (isset($sessionNamespace->sessionhash)) { $logicSession = new DragonX_Account_Logic_Session(); try { $recordAccount = $logicSession->getAccount($sessionNamespace->sessionhash); $this->view->sessionhash = $sessionNamespace->sessionhash; Zend_Registry::set('recordAccount', $recordAccount); $this->view->recordAccount = $recordAccount; $logicEmailaddress = new DragonX_Emailaddress_Logic_Emailaddress(); $this->view->recordEmailaddress = $logicEmailaddress->getEmailaddress($recordAccount); $logicDeletion = new DragonX_Account_Logic_Deletion(); $recordDeletion = $logicDeletion->getDeletion($recordAccount); if (isset($recordDeletion)) { $this->view->recordDeletion = $recordDeletion; } } catch (Exception $exception) { $sessionNamespace->unsetAll(); if ($modulename == 'homepage' && $controllername == 'account' && $actionname == 'logout') { $this->_helper->FlashMessenger('<div class="alert alert-success">Abmeldung erfolgreich</div>'); } else { $this->_helper->FlashMessenger('<div class="alert alert-error">Die Session ist abgelaufen. Profil muss neu angemeldet werden</div>'); } } } } $this->view->configApplication = new Dragon_Application_Config('dragon/application/application'); $modulenamearray = explode('_', $modulename); $controllerarea = end($modulenamearray); $this->view->controllerarea = $controllerarea; switch ($controllerarea) { case 'homepage': $this->view->configNavigation = new Dragon_Application_Config('dragonx/homepage/navigation/homepage'); break; case 'administration': if (!Zend_Registry::get('Dragon_Package_Registry')->isAvailable('DragonX', 'Account') || !Zend_Registry::get('Dragon_Package_Registry')->isAvailable('DragonX', 'Emailaddress')) { throw new Dragon_Application_Exception_User('incorrect controller', array('controllername' => $controllername)); } if (!isset($recordAccount)) { $this->_helper->FlashMessenger('<div class="alert alert-error">Die Session wurde noch nicht gestartet oder ist abgelaufen. Profil muss angemeldet werden</div>'); $this->_redirect('account/showlogin?' . http_build_query(array('redirect' => $modulename . '/' . $controllername . '/' . $actionname))); } if (Zend_Registry::get('Dragon_Package_Registry')->isAvailable('DragonX', 'Acl')) { $logicAcl = new DragonX_Acl_Logic_Acl(); $this->view->resources = $logicAcl->getResources($recordAccount); } $this->view->configNavigation = new Dragon_Application_Config('dragonx/homepage/navigation/administration'); break; } }
public function preDispatch() { parent::preDispatch(); $auth = Zend_Auth::getInstance(); if (!$auth->hasIdentity()) { $this->_redirect('auth/login'); } }
public function preDispatch() { X_Debug::i("Required action: [" . $this->getRequest()->getControllerName() . '/' . $this->getRequest()->getActionName() . ']'); parent::preDispatch(); // call plugins trigger // TODO check if plugin broker should be called before parent::preDispatch X_VlcShares_Plugins::broker()->gen_beforePageBuild($this); //$this->_helper->url->url() }
public function preDispatch() { parent::preDispatch(); $request = $this->getRequest(); parent::__call($request->getActionName(), array()); if (!$this->checkActionAccess($request->getControllerName(), $request->getActionName())) { throw new Rabotal_Exception_Access('Access denied!', 403); } }
public function preDispatch() { $this->view->baseUrl = $this->getRequest()->getBaseUrl(); $themeDir = Zend_Registry::get("themeDir"); require_once "{$themeDir}/config.php"; if ($this->getRequest()->disableLayout) { $this->_helper->layout()->disableLayout(); } return parent::preDispatch(); }
public function preDispatch() { parent::preDispatch(); //exit; if (Zend_Auth::getInstance()->hasIdentity()) { $authStorage = Zend_Auth::getInstance()->getStorage()->read(); $isAuth = true; } else { $authStorage = null; $isAuth = false; } }
public function preDispatch() { $config = Zend_Registry::get('config'); if (trim($config->ambiente->db->host) != "") { $this->_redirect("auth/login/"); } parent::preDispatch(); $this->view->hideMenu = true; if (Zend_Auth::getInstance()->hasIdentity() && $this->getRequest()->getActionName() == "installed") { $this->_redirect("index"); } }
public function preDispatch() { parent::preDispatch(); $request = $this->getRequest(); $this->view->module = $request->getModuleName(); $this->view->actionName = $request->getActionName(); $this->view->controllerName = $request->getControllerName(); $this->view->params = $params = $request->getParams(); $this->view->metas($params); $this->checkACL(); $this->setAppLayout(); }
/** * Pre-dispatch routines * Asignar variables de entorno * * @return void */ public function preDispatch() { parent::preDispatch(); $config = $this->getConfig(); $this->config = $this->getConfig(); $this->log = $this->getLog(); //$this->cache = $this->getCache(); $this->siteUrl = $this->config->app->siteUrl; $this->view->assign('siteUrl', $config->app->siteUrl); if (APPLICATION_ENV != 'production') { $sep = sprintf('[%s]', strtoupper(substr(APPLICATION_ENV, 0, 3))); $this->view->headTitle()->prepend($sep); } }
public function preDispatch() { $auth = Zend_Auth::getInstance(); $this->data_user = $auth->getIdentity(); if (!$auth->hasIdentity()) { $this->redirect('/login'); } else { $acl = new Application_Model_Acl_Acl(); if (!$acl->isAllowed()) { $this->redirect('/error/forbidden'); } } $this->view->user = $this->data_user; parent::preDispatch(); }
/** * Pre-dispatch routines * Asignar variables de entorno * * @return void */ public function preDispatch() { parent::preDispatch(); $this->view->controller = $this->getRequest()->getControllerName(); $this->view->action = $this->getRequest()->getActionName(); $this->view->module = $this->getRequest()->getModuleName(); // $config = $this->getConfig(); // $this->config = $this->getConfig(); //Zend_Debug::dump($this->config);exit; //$this->log = $this->getLog(); //$this->cache = $this->getCache(); // $this->siteUrl = $this->config['app']['siteUrl']; // $this->view->assign('siteUrl', $config['app']['siteUrl']); // $this->view->assign('translator', $this->_translate); }
function preDispatch() { parent::preDispatch(); $this->view->sessionId = Zend_Session::getId(); $this->oConfig = Zend_Registry::get('config'); $this->oDb = Zend_Registry::get('db'); $this->oSession = new Zend_Session_Namespace(Zend_Controller_Front::getInstance()->getParam('bootstrap')->getOption('applicationName')); $this->oAcl = Zend_Auth::getInstance(); if (APPLICATION_ENV == 'development') { $this->_activateFirebug(); } $this->view->auth = $this->getUser(); $this->view->controller = $this->getRequest()->getControllerName(); $this->view->action = $this->getRequest()->getActionName(); $this->_aUserInfo = $this->getUser(); $this->view->userInfo = $this->_aUserInfo; }
public function preDispatch() { // этот контроллер недоступен без регистрации if (!$this->isAuth()) { $this->_redirect('/auth/login'); return; } if (!$this->webacula_acl->hasRole('root_role')) { throw new Exception($this->view->translate->_('Webacula error. Role mechanism is broken. Check Webacula tables.')); return; } $controller = $this->getRequest()->getControllerName(); if ($this->identity->role_name) { if (!$this->webacula_acl->isAllowed($this->identity->role_name, $controller)) { $msg = sprintf($this->view->translate->_('You try to use Webacula menu "%s".'), $controller); $this->_forward('webacula-access-denied', 'error', null, array('msg' => $msg)); // action, controller return; } } parent::preDispatch(); }
public function preDispatch() { parent::preDispatch(); $navigation = Site_Service_Menu::getInstance()->getNavigation(); $controller = $this->getRequest()->getControllerName(); $module = $this->getRequest()->getModuleName(); $url = $this->getRequest()->getPathInfo(); $page = $navigation->findOneByUri($url); $this->view->currentPage = $page; if ($page) { $page->setActive(true); } if ($page && !empty($page->resource)) { $resource = $page->resource; } else { $resource = Site_Acl::RESOURCE_PUBLIC; } // Проверяем, авторизован ли пользователь $role = Site_Service_Auth::getInstance()->getUser()->getRole(); $acl = Site_Acl::getInstance(); // К этим 2 контроллерам доступ есть всегда if ($controller != 'error' && $controller != 'auth' && $module == 'default') { $allowed = $acl->isAllowed($role, $resource); if (!$allowed) { $url = $this->getRequest()->getRequestUri(); if (Site_Service_Auth::getInstance()->isLoggedIn()) { $this->forward('deny', 'error'); } else { $this->redirect('auth/login?from=' . urlencode($url) . '&warn=1'); } return; } } // Меню $this->view->navigation($navigation); $this->view->navigation()->setAcl($acl)->setRole($role); // login $this->view->loggedUser = Site_Service_Auth::getInstance()->getUser(); }
public function preDispatch() { parent::preDispatch(); $request = $this->getRequest(); $this->view->module = $request->getModuleName(); $this->view->actionName = $request->getActionName(); $this->view->controllerName = $request->getControllerName(); $this->view->params = $params = $request->getParams(); $this->view->metas($params); $this->initACL(); $this->nav(); $this->checkACL(); $this->setAppLayout(); /*--get current menu id */ $uri = "/" . $request->getModuleName() . "/" . $request->getControllerName() . "/" . $request->getActionName(); $security = new Base_Security_Menu(); $menu = $security->getMenuItemByUri($uri); $this->view->menuId = null; if (false !== $menu) { $this->view->menuId = $menu->getMasterId(); } /*------------------------*/ }
/** * Prepare the current parameters, filter non valid values out and use defaults instead. * */ public function preDispatch() { parent::preDispatch(); $intervallType = $this->getRequest()->getParam('intervall_type'); $measurementUnit = $this->getRequest()->getParam('measurement_unit'); $sensor = $this->getRequest()->getParam('sensor'); $intervallStart = $this->getRequest()->getParam('intervall_start', time()); switch ($intervallType) { case Diagram_Model_IntervallMapper::INTERVALL_TYPE_HOUR: case Diagram_Model_IntervallMapper::INTERVALL_TYPE_DAY: case Diagram_Model_IntervallMapper::INTERVALL_TYPE_WEEK: case Diagram_Model_IntervallMapper::INTERVALL_TYPE_MONTH: case Diagram_Model_IntervallMapper::INTERVALL_TYPE_YEAR: $this->_intervallType = $intervallType; break; default: $this->_intervallType = Diagram_Model_IntervallMapper::INTERVALL_TYPE_DAY; break; } switch ($measurementUnit) { case Diagram_Model_IntervallMapper::MEASUREMENT_UNIT_A: case Diagram_Model_IntervallMapper::MEASUREMENT_UNIT_W: case Diagram_Model_IntervallMapper::MEASUREMENT_UNIT_WH: $this->_measurementUnit = $measurementUnit; break; default: $this->_measurementUnit = Diagram_Model_IntervallMapper::MEASUREMENT_UNIT_W; break; } if (is_numeric($sensor)) { $this->_sensor = (int) $sensor; } else { $this->_sensor = Diagram_Model_IntervallMapper::TOTAL_SENSORS; } $filteredIntervallStart = Diagram_Model_IntervallMapper::getPreparedStartDate($intervallType, $intervallStart); $this->_intervallStart = $filteredIntervallStart; }
/** * (non-PHPdoc) * @see Zend_Controller_Action::preDispatch() */ public function preDispatch() { $controllerName = $this->getRequest()->getControllerName(); $controllerAction = $this->getRequest()->getActionName(); $acl = Zend_Registry::get("Zend_Acl"); $role = UserMap::getRole(); if (!$this->getRequest()->isXmlHttpRequest()) { if (!$acl->isAllowed(UserMap::getRole(), $controllerName, $controllerAction) && $controllerAction != "logout") { if ($role == "guest") { header("Location:/"); } else { if ($role == "owner" || $role == "member") { header("Location:/owners/login"); } else { if ($role == "agent" || $role == "admin") { header("Location:/agents/login"); } } } exit; } } parent::preDispatch(); }
/** Pre-dispatch routines */ public function preDispatch() { UtilityComponent::setTimeLimit(0); $enabledModules = Zend_Registry::get('modulesEnable'); if (Zend_Registry::get('configGlobal')->application->lang != 'en') { $translate = new Zend_Translate('csv', BASE_PATH . '/core/translation/fr-main.csv', 'en'); Zend_Registry::set('translator', $translate); $translators = array(); foreach ($enabledModules as $enabledModule) { if (file_exists(BASE_PATH . '/modules/' . $enabledModule . '/translation/fr-main.csv')) { $translators[$enabledModule] = new Zend_Translate('csv', BASE_PATH . '/modules/' . $enabledModule . '/translation/fr-main.csv', 'en'); } elseif (file_exists(BASE_PATH . '/privateModules/' . $enabledModule . '/translation/fr-main.csv')) { $translators[$enabledModule] = new Zend_Translate('csv', BASE_PATH . '/privateModules/' . $enabledModule . '/translation/fr-main.csv', 'en'); } Zend_Registry::set('translatorsModules', $translators); } } $configs = array(); foreach ($enabledModules as $enabledModule) { if (file_exists(LOCAL_CONFIGS_PATH . '/' . $enabledModule . '.local.ini')) { $configs[$enabledModule] = new Zend_Config_Ini(LOCAL_CONFIGS_PATH . '/' . $enabledModule . '.local.ini', 'global'); } elseif (file_exists(BASE_PATH . '/privateModules/' . $enabledModule . '/configs/module.ini')) { $configs[$enabledModule] = new Zend_Config_Ini(BASE_PATH . '/privateModules/' . $enabledModule . '/configs/module.ini', 'global'); } else { $configs[$enabledModule] = new Zend_Config_Ini(BASE_PATH . '/modules/' . $enabledModule . '/configs/module.ini', 'global'); } } Zend_Registry::set('configsModules', $configs); $forward = $this->getParam('forwardModule'); $request = $this->getRequest(); $response = $this->getResponse(); if (!isset($forward) && $request->getModuleName() == 'default') { foreach ($configs as $key => $config) { if (file_exists(BASE_PATH . '/modules/' . $key . '/controllers/' . ucfirst($request->getControllerName()) . 'CoreController.php')) { include_once BASE_PATH . '/modules/' . $key . '/controllers/' . ucfirst($request->getControllerName()) . 'CoreController.php'; $name = ucfirst($key) . '_' . ucfirst($request->getControllerName()) . 'CoreController'; $controller = new $name($request, $response); if (method_exists($controller, $request->getActionName() . 'Action')) { $this->forward($request->getActionName(), $request->getControllerName() . 'Core', $key, array('forwardModule' => true)); } } elseif (file_exists(BASE_PATH . '/privateModules/' . $key . '/controllers/' . ucfirst($request->getControllerName()) . 'CoreController.php')) { include_once BASE_PATH . '/privateModules/' . $key . '/controllers/' . ucfirst($request->getControllerName()) . 'CoreController.php'; $name = ucfirst($key) . '_' . ucfirst($request->getControllerName()) . 'CoreController'; $controller = new $name($request, $response); if (method_exists($controller, $request->getActionName() . 'Action')) { $this->forward($request->getActionName(), $request->getControllerName() . 'Core', $key, array('forwardModule' => true)); } } } } parent::preDispatch(); if (!$this->isDebug()) { $frontendOptions = array('automatic_serialization' => true, 'lifetime' => 86400, 'cache_id_prefix' => 'midas_'); if (extension_loaded('memcached') || session_save_path() === 'Memcache') { $cache = Zend_Cache::factory('Core', 'Libmemcached', $frontendOptions, array()); } elseif (extension_loaded('memcache')) { $cache = Zend_Cache::factory('Core', 'Memcached', $frontendOptions, array()); } else { $cacheDir = UtilityComponent::getCacheDirectory() . '/db'; if (is_dir($cacheDir) && is_writable($cacheDir)) { $backendOptions = array('cache_dir' => $cacheDir); $cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions); } } if (isset($cache)) { Zend_Db_Table_Abstract::setDefaultMetadataCache($cache); } } }
public function preDispatch() { $this->addRequestStack(); // jeżeli nie używać kolejki kroków if (!Base_Controller_Action_Helper_Steps::getUseSteps()) { return parent::preDispatch(); } $stepsHelper = $this->_helper->getHelper('steps'); if ($stepsHelper->isStepsQueue()) { if ($stepsHelper->isCorrectStep()) { return; } else { $request = $this->getRequest(); $controller = $request->getParam('controller'); $action = $request->getParam('action'); $stepActions = $stepsHelper->getAllStepsActions(); $stepFound = false; foreach ($stepActions as $step) { if ($step['action'] == $action && $step['controller'] == $controller) { $stepFound = true; break; } } // aktualna akcja znajduje się w kolejce kroków if ($stepFound) { $this->_helper->messenger->error('Wykonano nieprawidłowy krok, należy rozpocząć cały proces od początku'); $ownerAction = $stepsHelper->getOwnerAction(); $stepsHelper->closeStepsQueue(); $redirector = $this->_helper->getHelper('Redirector'); $redirector->setExit(true); if ($ownerAction == false && !is_array($ownerAction)) { $redirector->gotoSimple('index', 'index', array()); return; } else { $redirector->gotoSimple($ownerAction['action'], $ownerAction['controller'], $ownerAction['params']); return; } } } } return parent::preDispatch(); }
/** * Работы данного слоя перед выводом вида * @return void */ public function preDispatch() { $auth = Auth::getInstance(); $this->view->navigation($this->_navigation)->setAcl($auth->getAcl())->setRole($auth->getUser()->getRole()); parent::preDispatch(); }
function preDispatch() { parent::preDispatch(); $this->_renderGlobalVariable(); }
public function preDispatch() { parent::preDispatch(); $this->setResponseType(); }
public function preDispatch() { parent::preDispatch(); }
/** * Pre-dispatch routines * * Called before action method. If using class with * {@link Zend_Controller_Front}, it may modify the * {@link $_request Request object} and reset its dispatched flag in order * to skip processing the current action. * * @return void */ public function preDispatch() { parent::preDispatch(); $this->_setFlashMessage(); }
public function preDispatch() { //solve action w/o layout if request came with PJAX header if (isset($_SERVER['HTTP_X_PJAX'])) { $this->_helper->layout->disableLayout(); } return parent::preDispatch(); }
public function preDispatch() { parent::preDispatch(); $this->_helper->getHelper('AjaxContext')->addActionContext('indexAction', 'json')->initContext(); }
/** * preDispatch * @author Thomas Schedler <*****@*****.**> * @version 1.0 */ public function preDispatch() { // trigger client specific dispatch helper if ($this->core->sysConfig->helpers->client->dispatcher === 'enabled') { ClientHelper::get('Dispatcher')->preDispatch($this); } parent::preDispatch(); }
/** * Use pre-dispatch to check user access rights *before* action is called. */ public function preDispatch() { parent::preDispatch(); $this->checkAccessModulePermissions(); }
/** * Registers calls to preDispatch(). */ public function preDispatch() { parent::preDispatch(); $this->registerCall(__FUNCTION__); }