Ejemplo n.º 1
0
 public function init()
 {
     parent::init();
     // Test si un id de value est passé en paramètre
     if ($id = $this->getRequest()->getParam('option_value_id')) {
         // Créé et charge l'objet
         $this->_current_option_value = new Application_Model_Option_Value();
         $this->_current_option_value->find($id);
         // Récupère le layout de l'option_value en cours
         if ($this->_current_option_value->getLayoutId()) {
             $this->_layout_id = $this->_current_option_value->getLayoutId();
         }
     }
     $excluded = '/(' . join(')|(', array('front_mobile_home_view', 'application_device_check', 'customer_mobile_account', 'customer_mobile_account_autoconnect', 'push_mobile_list', 'push_mobile_count', 'application_mobile_customization_colors', 'application_mobile_previewer_infos', 'front_mobile_gmaps_view', 'mcommerce_mobile_cart_view')) . ')/';
     if (!$this->_current_option_value and !preg_match($excluded, $this->getFullActionName('_'))) {
         $this->_redirect('/');
         return $this;
     } else {
         if ($this->getFullActionName('_') == 'front_mobile_home_view') {
             $this->_layout_id = $this->getApplication()->getLayoutId();
         } else {
             $this->_layout_id = 1;
             //$this->_current_option_value->getLayout()->getCode();
         }
     }
     Core_View_Mobile_Default::setCurrentOption($this->_current_option_value);
     $this->log();
     return $this;
 }
Ejemplo n.º 2
0
 public function init()
 {
     parent::init();
     if (!$this->getSession()->isLoggedIn('admin') and !preg_match('/(login)|(forgotpassword)|(change)|(map)|(signuppost)|(check)/', $this->getRequest()->getActionName()) and !$this->getRequest()->isInstalling()) {
         $this->_forward('login', 'account', 'admin');
         return $this;
     }
 }
Ejemplo n.º 3
0
 public function init()
 {
     parent::init();
     $allowed = array("backoffice_index_index", "backoffice_account_login_index", "backoffice_account_login_post", "backoffice_account_login_forgottenpassword");
     if (!$this->getSession(Core_Model_Session::TYPE_BACKOFFICE)->isLoggedIn() and !in_array($this->getFullActionName("_"), $allowed) and !$this->getRequest()->isInstalling() and !$this->getRequest()->isXmlHttpRequest() and !preg_match("/(_template)/", $this->getFullActionName("_"))) {
         $this->forward('login', 'account', 'backoffice');
         return $this;
     }
 }
Ejemplo n.º 4
0
 public function init()
 {
     parent::init();
     if (!preg_match("/admin_api_account_autologin/", $this->getFullActionName("_"))) {
         $username = $this->getRequest()->getServer("PHP_AUTH_USER");
         $password = $this->getRequest()->getServer("PHP_AUTH_PW");
         $user = new Api_Model_User();
         $user->find($username, "username");
         if (!$user->getId() or !$user->authenticate($password)) {
             $this->_forward("notauthorized");
         }
     }
     return $this;
 }
Ejemplo n.º 5
0
 public function init()
 {
     parent::init();
     $this->_admin = $this->getSession()->getAdmin();
     if (!$this->getSession()->isLoggedIn() and !preg_match('/(login)|(forgotpassword)|(change)|(map)|(signuppost)|(check)/', $this->getRequest()->getActionName()) and !$this->getRequest()->isInstalling()) {
         $this->_forward('login', 'account', 'admin');
         return $this;
     }
     if (!$this->_canAccessCurrentPage()) {
         $this->_forward("forbidden");
         return;
     }
     $this->getSession()->editing_app_id = null;
 }
Ejemplo n.º 6
0
 protected function _initSession()
 {
     $configSession = new Zend_Config_Ini(APPLICATION_PATH . '/configs/session.ini', APPLICATION_ENV);
     if (!$this->_request->isInstalling()) {
         $config = array('name' => 'session', 'primary' => 'session_id', 'modifiedColumn' => 'modified', 'dataColumn' => 'data', 'lifetimeColumn' => 'lifetime', 'lifetime' => $configSession->gc_maxlifetime);
         Zend_Session::setSaveHandler(new Zend_Session_SaveHandler_DbTable($config));
     }
     if (!$this->_request->isInstalling() or is_writable(Core_Model_Directory::getSessionDirectory(true))) {
         $types = array();
         $options = $configSession->toArray();
         if (isset($options['types'])) {
             $types = $options['types'];
             unset($options['types']);
         }
         Zend_Session::start($options);
         $session_type = $this->_request->isApplication() ? 'mobile' : 'front';
         $session = new Core_Model_Session($session_type);
         foreach ($types as $type => $class) {
             $session->addType($type, $class);
         }
         $language_session = new Core_Model_Session('language');
         if (!$language_session->current_language) {
             $language_session->current_language = null;
         }
         Core_Model_Language::setSession($language_session);
         Core_View_Default::setSession($session);
         Core_Controller_Default::setSession($session);
     }
 }
Ejemplo n.º 7
0
 public function init()
 {
     parent::init();
     $this->_layout_id = 1;
     // Test si un id de value est passé en paramètre
     $id = $this->getRequest()->getParam('option_value_id');
     if (!$id) {
         $id = $this->getRequest()->getParam('value_id');
     }
     if (!$id) {
         try {
             $data = Zend_Json::decode($this->getRequest()->getRawBody());
             if ($data && !empty($data['value_id'])) {
                 $id = $data['value_id'];
             }
         } catch (Zend_Json_Exception $e) {
             $id = null;
         } catch (Exception $e) {
             $id = null;
         }
     }
     if ($id) {
         // Créé et charge l'objet
         $this->_current_option_value = new Application_Model_Option_Value();
         if ($id != "homepage") {
             $this->_current_option_value->find($id);
             // Récupère le layout de l'option_value en cours
             if ($this->_current_option_value->getLayoutId()) {
                 $this->_layout_id = $this->_current_option_value->getLayoutId();
             }
         } else {
             $this->_current_option_value->setIsHomepage(true);
         }
     }
     //        $excluded = '/('.join(')|(',
     //            array(
     //                'front_mobile_home_view',
     //                'front_mobile_home_template',
     //                'application_device_check',
     //                'customer_mobile_account',
     //                'customer_mobile_account_autoconnect',
     //                'push_mobile_list',
     //                'push_mobile_count',
     //                'application_mobile_customization_colors',
     //                'application_mobile_previewer_infos',
     //                'front_mobile_gmaps_view',
     //                'mcommerce_mobile_cart_view',
     //                'findall',
     //                'find',
     //                'backgroundimage'
     //            )
     //        ).')/';
     //
     //        Zend_Debug::dump($excluded);die;
     //
     //        if(!$this->_current_option_value AND !preg_match($excluded, $this->getFullActionName('_'))) {
     //            $this->_redirect('/');
     //            return $this;
     //        }
     //        else
     if ($this->getFullActionName('_') == 'front_mobile_home_view') {
         $this->_layout_id = $this->getApplication()->getLayoutId();
     }
     Core_View_Mobile_Default::setCurrentOption($this->_current_option_value);
     $this->_log();
     return $this;
 }
Ejemplo n.º 8
0
 public function init()
 {
     return parent::init();
 }