Exemple #1
1
 public function preDispatch()
 {
     parent::preDispatch();
     // do something before the action is called //-> see Zend Framework
     \Pimcore\Tool\Authentication::authenticateSession();
     $adminSession = new \Zend_Session_Namespace("pimcore_admin");
     if (!$adminSession->user instanceof \User) {
         $auth = \Zend_Auth::getInstance();
         if ($auth->hasIdentity()) {
             // We have a login session (user is logged in)
             $cached_person = $auth->getIdentity();
             $id = $cached_person->getId();
             $this->view->person = $this->person = \Object\Person::getById($id);
         } else {
             $this->forward("form-login", "login");
         }
     } else {
         $this->view->person = $this->person = \Object\Person::getById(590);
     }
     if ($this->person) {
         $this->view->user = $this->user = $this->person;
         $this->view->societe = $this->societe = $this->person->getSociete();
         $this->view->locations = $this->locations = $this->societe->getLocations();
         $this->storeLocation();
     }
 }
 public function init()
 {
     parent::init();
     if ($this->view->editmode) {
         $this->enableLayout();
         $this->setLayout("snippet");
     }
 }
 public function preDispatch()
 {
     parent::preDispatch();
     // do something before the action is called //-> see Zend Framework
     \Pimcore\Tool\Authentication::authenticateSession();
     $adminSession = new \Zend_Session_Namespace("pimcore_admin");
     if (!$adminSession->user instanceof \User) {
         //	$this->forward ( "form-login", "login" );
     }
 }
Exemple #4
0
 public function init()
 {
     parent::init();
     $this->enableLayout();
     // allow to override plugin views by website
     $this->view->setScriptPath(array_merge($this->view->getScriptPaths(), array(PIMCORE_WEBSITE_PATH . '/views/scripts/', PIMCORE_WEBSITE_PATH . '/views/layouts/', PIMCORE_WEBSITE_PATH . '/views/scripts/member/')));
     $this->auth = \Zend_Auth::getInstance();
     // TODO provide plugin translations to frontend
     $this->translate = $this->initTranslation();
     $this->view->flashMessages = $this->_helper->flashMessenger->getMessages();
 }
 public function preDispatch()
 {
     parent::preDispatch();
     $result = Plugin::getEventManager()->trigger('action.' . $this->getRequest()->getActionName(), $this, array("controller" => $this, "request" => $this->getRequest()), function ($v) {
         return is_array($v) && array_key_exists("action", $v) && array_key_exists("controller", $v) && array_key_exists("module", $v);
     });
     if ($result->stopped()) {
         $forward = $result->last();
         $this->_forward($forward['action'], $forward['controller'], $forward['module'], $forward['params']);
     }
 }
 public function init()
 {
     parent::init();
     $pimUser = false;
     if (\Pimcore\Tool::isFrontentRequestByAdmin()) {
         $pimUser = \Pimcore\Tool\Admin::getCurrentUser();
         if ($pimUser) {
             //echo "IS ADMIN";
         }
     }
     $identity = \Zend_Auth::getInstance()->getIdentity();
     if (!$identity && !$pimUser or $this->getParam('oid') != $identity['oid']) {
         $this->redirect("/");
     } else {
         // login ok
     }
 }
 public function init()
 {
     parent::init();
     if (file_exists(PIMCORE_WEBSITE_PATH . "/var/search/search.xml")) {
         $searchConf = new Zend_Config_Xml(PIMCORE_WEBSITE_PATH . "/var/search/search.xml");
         if ($searchConf->search->frontend->enabled) {
             try {
                 Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num_CaseInsensitive());
                 $this->frontendIndex = Zend_Search_Lucene::open(SearchPhp_Plugin::getFrontendSearchIndex());
                 $this->categories = explode(",", $searchConf->search->frontend->categories);
                 if ($searchConf->search->frontend->ignoreLanguage != '1') {
                     $this->searchLanguage = $this->_getParam("language");
                     if (empty($this->searchLanguage)) {
                         try {
                             $this->searchLanguage = Zend_Registry::get("Zend_Locale");
                         } catch (Exception $e) {
                             $this->searchLanguage = "en";
                         }
                     }
                 } else {
                     $this->searchLanguage = null;
                 }
                 $this->fuzzySearch = false;
                 if ($searchConf->search->frontend->fuzzySearch == '1') {
                     $this->fuzzySearch = true;
                 }
                 if ($searchConf->search->frontend->ownHostOnly) {
                     $this->ownHostOnly = true;
                 }
             } catch (Exception $e) {
                 //p_r($e);
                 throw new Exception("could not open index");
             }
         } else {
             throw new Exception("search frontend is not installed and enabled.");
         }
     }
 }
 public function init()
 {
     parent::init();
     //$this->view->layout()->setLayout('email');
 }
 public function postDispatch()
 {
     parent::postDispatch();
     // do something after the action is called //-> see Zend Framework
 }
 public function init()
 {
     parent::init();
 }
 public function init()
 {
     parent::init();
     $this->enableLayout();
 }
 public function postDispatch()
 {
     parent::postDispatch();
     // $this->view->locations = $this->societe->getLocations() ;
     // do something after the action is called //-> see Zend Framework
 }