/**
  * Controller pre-dispatch method
  *
  * @return Mage_XmlConnect_Controller_AdminAction
  */
 public function preDispatch()
 {
     Mage::getSingleton('adminhtml/url')->turnOffSecretKey();
     // override admin store design settings via stores section
     Mage::getDesign()->setArea($this->_currentArea)->setPackageName((string) Mage::getConfig()->getNode('stores/admin/design/package/name'))->setTheme((string) Mage::getConfig()->getNode('stores/admin/design/theme/default'));
     foreach (array('layout', 'template', 'skin', 'locale') as $type) {
         $value = (string) Mage::getConfig()->getNode("stores/admin/design/theme/{$type}");
         if ($value) {
             Mage::getDesign()->setTheme($type, $value);
         }
     }
     $this->getLayout()->setArea($this->_currentArea);
     Mage::dispatchEvent('adminhtml_controller_action_predispatch_start', array());
     Mage_Core_Controller_Varien_Action::preDispatch();
     if ($this->getRequest()->isDispatched() && $this->getRequest()->getActionName() !== 'denied' && !$this->_isAllowed()) {
         $this->_forward('denied');
         $this->setFlag('', self::FLAG_NO_DISPATCH, true);
         return $this;
     }
     if (is_null(Mage::getSingleton('adminhtml/session')->getLocale())) {
         Mage::getSingleton('adminhtml/session')->setLocale(Mage::app()->getLocale()->getLocaleCode());
     }
     $this->getResponse()->setHeader('Content-type', 'text/xml; charset=UTF-8');
     if ($this->_isCheckCookieRequired()) {
         $this->_checkCookie();
     }
     return $this;
 }
Esempio n. 2
0
 /**
  * Predispatch: shoud set layout area
  *
  * @return Mage_Core_Controller_Front_Action
  */
 public function preDispatch()
 {
     $this->getLayout()->setArea('frontend');
     parent::preDispatch();
     $this->getResponse()->setHeader('Cache-Control', 'no-cache, must-revalidate')->setHeader('Pragma', 'no-cache');
     return $this;
 }
Esempio n. 3
0
 /**
  * Predispatch: shoud set layout area
  *
  * @return Mage_Core_Controller_Front_Action
  */
 public function preDispatch()
 {
     $this->getLayout()->setArea($this->_currentArea);
     parent::preDispatch();
     // Layout functions
     if ($subD = Mage::registry('subdomain')) {
         Mage::getDesign()->setPackageName('default')->setTheme('shopper');
     }
     return $this;
 }
Esempio n. 4
0
 /**
  * Predispatch: shoud set layout area
  *
  * @return Mage_Core_Controller_Front_Action
  */
 public function preDispatch()
 {
     $this->getLayout()->setArea($this->_currentArea);
     parent::preDispatch();
     // If IE6 redirect is enabled, send to ie6-rdirect cms page
     $configData = Mage::getStoreConfig('modal_header');
     $ie6support = $configData['settings']['ie6support'];
     if ($ie6support == 1) {
         if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6.')) {
             Mage::getDesign()->setPackageName('base');
             Mage::getDesign()->setTheme('ie6');
             if (stripos($_SERVER['REQUEST_URI'], '/ie6-redirect/') == false) {
                 Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('ie6-redirect'))->sendResponse();
             }
         }
     }
     return $this;
 }
Esempio n. 5
0
 /**
  * Predispatch: shoud set layout area
  *
  * @return Mage_Core_Controller_Front_Action
  */
 public function preDispatch()
 {
     $this->getLayout()->setArea('frontend');
     parent::preDispatch();
     return $this;
 }
 /**
  * Controller predispatch method
  *
  * @return Mage_Adminhtml_Controller_Action
  */
 public function preDispatch()
 {
     // override admin store design settings via stores section
     Mage::getDesign()->setArea($this->_currentArea)->setPackageName((string) Mage::getConfig()->getNode('stores/admin/design/package/name'))->setTheme((string) Mage::getConfig()->getNode('stores/admin/design/theme/default'));
     foreach (array('layout', 'template', 'skin', 'locale') as $type) {
         if ($value = (string) Mage::getConfig()->getNode("stores/admin/design/theme/{$type}")) {
             Mage::getDesign()->setTheme($type, $value);
         }
     }
     $this->getLayout()->setArea($this->_currentArea);
     Mage::dispatchEvent('adminhtml_controller_action_predispatch_start', array());
     parent::preDispatch();
     $_isValidFormKey = true;
     $_isValidSecretKey = true;
     $_keyErrorMsg = '';
     if (Mage::getSingleton('admin/session')->isLoggedIn()) {
         if ($this->getRequest()->isPost()) {
             $_isValidFormKey = $this->_validateFormKey();
             $_keyErrorMsg = Mage::helper('adminhtml')->__('Invalid Form Key. Please refresh the page.');
         } elseif (Mage::getSingleton('adminhtml/url')->useSecretKey()) {
             $_isValidSecretKey = $this->_validateSecretKey();
             $_keyErrorMsg = Mage::helper('adminhtml')->__('Invalid Secret Key. Please refresh the page.');
         }
     }
     if (!$_isValidFormKey || !$_isValidSecretKey) {
         $this->setFlag('', self::FLAG_NO_DISPATCH, true);
         $this->setFlag('', self::FLAG_NO_POST_DISPATCH, true);
         if ($this->getRequest()->getQuery('isAjax', false) || $this->getRequest()->getQuery('ajax', false)) {
             $this->getResponse()->setBody(Mage::helper('core')->jsonEncode(array('error' => true, 'message' => $_keyErrorMsg)));
         } else {
             $this->_redirect(Mage::getSingleton('admin/session')->getUser()->getStartupPageUrl());
         }
         return $this;
     }
     if ($this->getRequest()->isDispatched() && $this->getRequest()->getActionName() !== 'denied' && !$this->_isAllowed()) {
         $this->_forward('denied');
         $this->setFlag('', self::FLAG_NO_DISPATCH, true);
         return $this;
     }
     if (!$this->getFlag('', self::FLAG_IS_URLS_CHECKED) && !$this->getRequest()->getParam('forwarded') && !$this->_getSession()->getIsUrlNotice(true) && !Mage::getConfig()->getNode('global/can_use_base_url')) {
         //$this->_checkUrlSettings();
         $this->setFlag('', self::FLAG_IS_URLS_CHECKED, true);
     }
     if (is_null(Mage::getSingleton('adminhtml/session')->getLocale())) {
         Mage::getSingleton('adminhtml/session')->setLocale(Mage::app()->getLocale()->getLocaleCode());
     }
     return $this;
 }
Esempio n. 7
0
 /**
  * Predispatch: shoud set layout area
  *
  * @return Mage_Core_Controller_Front_Action
  */
 public function preDispatch()
 {
     $this->getLayout()->setArea($this->_currentArea);
     parent::preDispatch();
     return $this;
 }
Esempio n. 8
0
 /**
  * Controller predispatch method
  *
  * @return Mage_Adminhtml_Controller_Action
  */
 public function preDispatch()
 {
     Mage::getDesign()->setArea('adminhtml')->setPackageName((string) Mage::getConfig()->getNode('stores/admin/design/package/name'))->setTheme((string) Mage::getConfig()->getNode('stores/admin/design/theme/default'));
     $this->getLayout()->setArea('adminhtml');
     Mage::dispatchEvent('adminhtml_controller_action_predispatch_start', array());
     parent::preDispatch();
     if ($this->getRequest()->isPost() && !$this->_validateFormKey() && Mage::getSingleton('admin/session')->isLoggedIn()) {
         $this->setFlag('', self::FLAG_NO_DISPATCH, true);
         $this->setFlag('', self::FLAG_NO_POST_DISPATCH, true);
         if ($this->getRequest()->getQuery('isAjax', false) || $this->getRequest()->getQuery('ajax', false)) {
             $this->getResponse()->setBody(Zend_Json::encode(array('error' => true, 'error_msg' => Mage::helper('adminhtml')->__('Invalid Form Key'))));
         } else {
             $this->_redirectReferer();
         }
         return $this;
     }
     if ($this->getRequest()->isDispatched() && $this->getRequest()->getActionName() !== 'denied' && !$this->_isAllowed()) {
         $this->_forward('denied');
         $this->setFlag('', self::FLAG_NO_DISPATCH, true);
         return $this;
     }
     if (!$this->getFlag('', self::FLAG_IS_URLS_CHECKED) && !$this->getRequest()->getParam('forwarded') && !$this->_getSession()->getIsUrlNotice(true) && !Mage::getConfig()->getNode('global/can_use_base_url')) {
         $this->_checkUrlSettings();
         $this->setFlag('', self::FLAG_IS_URLS_CHECKED, true);
     }
     if (is_null(Mage::getSingleton('adminhtml/session')->getLocale())) {
         Mage::getSingleton('adminhtml/session')->setLocale(Mage::app()->getLocale()->getLocaleCode());
     }
     return $this;
 }
Esempio n. 9
0
 /**
  * Controller predispatch method
  *
  * @return Mage_Backend_Controller_ActionAbstract
  */
 public function preDispatch()
 {
     Mage::app()->setCurrentStore('admin');
     Mage::dispatchEvent('adminhtml_controller_action_predispatch_start', array());
     parent::preDispatch();
     if (!$this->_processUrlKeys()) {
         return $this;
     }
     if ($this->getRequest()->isDispatched() && $this->getRequest()->getActionName() !== 'denied' && !$this->_isAllowed()) {
         $this->_forward('denied');
         $this->setFlag('', self::FLAG_NO_DISPATCH, true);
         return $this;
     }
     if ($this->_isUrlChecked()) {
         $this->setFlag('', self::FLAG_IS_URLS_CHECKED, true);
     }
     if (is_null(Mage::getSingleton('Mage_Backend_Model_Session')->getLocale())) {
         Mage::getSingleton('Mage_Backend_Model_Session')->setLocale(Mage::app()->getLocale()->getLocaleCode());
     }
     return $this;
 }
Esempio n. 10
0
 /**
  * Controller predispatch method
  *
  * @return Mage_Backend_Controller_ActionAbstract
  */
 public function preDispatch()
 {
     Mage::app()->setCurrentStore('admin');
     Mage::dispatchEvent('adminhtml_controller_action_predispatch_start', array());
     parent::preDispatch();
     $_isValidFormKey = true;
     $_isValidSecretKey = true;
     $_keyErrorMsg = '';
     if (Mage::getSingleton('Mage_Backend_Model_Auth_Session')->isLoggedIn()) {
         if ($this->getRequest()->isPost()) {
             $_isValidFormKey = $this->_validateFormKey();
             $_keyErrorMsg = Mage::helper('Mage_Backend_Helper_Data')->__('Invalid Form Key. Please refresh the page.');
         } elseif (Mage::getSingleton('Mage_Backend_Model_Url')->useSecretKey()) {
             $_isValidSecretKey = $this->_validateSecretKey();
             $_keyErrorMsg = Mage::helper('Mage_Backend_Helper_Data')->__('Invalid Secret Key. Please refresh the page.');
         }
     }
     if (!$_isValidFormKey || !$_isValidSecretKey) {
         $this->setFlag('', self::FLAG_NO_DISPATCH, true);
         $this->setFlag('', self::FLAG_NO_POST_DISPATCH, true);
         if ($this->getRequest()->getQuery('isAjax', false) || $this->getRequest()->getQuery('ajax', false)) {
             $this->getResponse()->setBody(Mage::helper('Mage_Core_Helper_Data')->jsonEncode(array('error' => true, 'message' => $_keyErrorMsg)));
         } else {
             $this->_redirect(Mage::getSingleton('Mage_Backend_Model_Url')->getStartupPageUrl());
         }
         return $this;
     }
     if ($this->getRequest()->isDispatched() && $this->getRequest()->getActionName() !== 'denied' && !$this->_isAllowed()) {
         $this->_forward('denied');
         $this->setFlag('', self::FLAG_NO_DISPATCH, true);
         return $this;
     }
     if (!$this->getFlag('', self::FLAG_IS_URLS_CHECKED) && !$this->getRequest()->getParam('forwarded') && !$this->_getSession()->getIsUrlNotice(true) && !Mage::getConfig()->getNode('global/can_use_base_url')) {
         $this->setFlag('', self::FLAG_IS_URLS_CHECKED, true);
     }
     if (is_null(Mage::getSingleton('Mage_Backend_Model_Session')->getLocale())) {
         Mage::getSingleton('Mage_Backend_Model_Session')->setLocale(Mage::app()->getLocale()->getLocaleCode());
     }
     return $this;
 }
Esempio n. 11
0
 public function preDispatch()
 {
     Mage::getDesign()->setArea('adminhtml')->setPackageName((string) Mage::getConfig()->getNode('stores/admin/design/package/name'))->setTheme((string) Mage::getConfig()->getNode('stores/admin/design/theme/default_clean'));
     $this->getLayout()->setArea('adminhtml');
     parent::preDispatch();
     if ($this->getRequest()->isDispatched() && $this->getRequest()->getActionName() !== 'denied' && !$this->_isAllowed()) {
         $this->getResponse()->setHeader('HTTP/1.1', '403 Forbidden');
         $this->_forward('denied');
         $this->setFlag('', self::FLAG_NO_DISPATCH, true);
     }
     return $this;
 }