/**
  * Method is called by the controller before the requested action is
  * invoked.
  *
  * This method checks if a valid licence for the package is available,
  * if not the user is redirected to the package detail page to enter
  * a valid serialz.
  *
  * @return Mage_Core_Controller_Front_Action The controller instance
  */
 public function preDispatch()
 {
     try {
         // invoke the parent's preDispatch method
         parent::preDispatch();
         // validate the package information
         Mage::getModel('manager/connector')->validate($packageInformation = $this->_getPackageInformation());
         // return the instance
         return $this;
     } catch (Faett_Manager_Exceptions_InvalidLicenceException $ile) {
         // log the exception
         Mage::logException($ile);
         // add an error to the session
         Mage::getSingleton('adminhtml/session')->addError(Mage::helper('manager')->__('202.error.invalid.serialz', $packageInformation->getIdentifier()));
     } catch (Faett_Manager_Exceptions_ChannelLoginException $cle) {
         // log the exception
         Mage::logException($cle);
         // add an error to the session
         Mage::getSingleton('adminhtml/session')->addError(Mage::helper('manager')->__('202.error.invalid.credentials', $packageInformation->getPackage()->getChannel()->getUrl()));
         // redirect and request user to enter a valid Serialz
         $this->_forward('index', 'adminhtml_channel', 'manager', array('id' => $packageInformation->getPackage()->getId()));
     } catch (Faett_Manager_Exceptions_ChannelNotFoundException $cnfe) {
         // log the exception
         Mage::logException($cnfe);
         // add an error to the session
         Mage::getSingleton('adminhtml/session')->addError(Mage::helper('manager')->__('202.error.invalid.channel', $packageInformation->getPackage()->getChannel()->getUrl()));
         // redirect and request user to register channel first
         $this->_forward('new', 'adminhtml_channel', 'manager');
     }
 }
 function preDispatch()
 {
     if (preg_match('#localhost#', $_SERVER['HTTP_HOST']) && file_exists(sys_get_temp_dir() . '/vf-ajax-tests')) {
         return;
     }
     return parent::preDispatch();
 }
 public function preDispatch()
 {
     parent::preDispatch();
     if ($this->getRequest()->getActionName() != 'error' && !$this->checkLocalCodePool()) {
         $this->_forward('error');
     }
 }
 public function preDispatch()
 {
     if ($this->getRequest()->getActionName() == 'auth') {
         Mage::getSingleton('adminhtml/url')->turnOffSecretKey();
     }
     parent::preDispatch();
 }
 public function preDispatch()
 {
     parent::preDispatch();
     if (!extension_loaded('imap')) {
         Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please, ask your hosting provider to enable IMAP extension in PHP configuration of your server. <br> Otherwise, helpdesk will not be able to fetch emails.'));
     }
 }
 public function preDispatch()
 {
     parent::preDispatch();
     $this->_customer_addressTypeId = Mage::getModel('eav/entity')->setType('customer_address')->getTypeId();
     $this->_block = 'address';
     $this->_type = 'customer_address';
 }
 public function preDispatch()
 {
     parent::preDispatch();
     /**
      * Custom implementation of APPSEC-1034 (SUPEE-6788) [see additional information below].
      * M2E Pro prevents redirect to Magento Admin Panel login page.
      *
      * This PHP class is the base PHP class of all M2E Pro controllers.
      * Thus, it protects any action of any controller of M2E Pro extension.
      *
      * The code below is the logical extension of the method \Ess_M2ePro_Controller_Router::addModule.
      */
     // -----------------------------------------------------------------
     if (!$this->getRequest()->isDispatched() && !Mage::getSingleton('admin/session')->isLoggedIn() && $this->getRequest()->getActionName() == 'login') {
         return $this->_redirect('M2ePro/index/index/');
     }
     // -----------------------------------------------------------------
     // client was logged out
     if ($this->getRequest()->isXmlHttpRequest() && !Mage::getSingleton('admin/session')->isLoggedIn()) {
         exit(json_encode(array('ajaxExpired' => 1, 'ajaxRedirect' => $this->_getRefererUrl())));
     }
     // flag controller loaded
     if (is_null(Mage::helper('M2ePro/Data_Global')->getValue('is_base_controller_loaded'))) {
         Mage::helper('M2ePro/Data_Global')->setValue('is_base_controller_loaded', true);
     }
     return $this;
 }
Пример #8
0
 /**
  * preDispatch - called before every action
  */
 public function preDispatch()
 {
     parent::preDispatch();
     $this->_helper = Mage::helper('ash_slideshow');
     $this->_slideshowModel = Mage::getModel('ash_slideshow/slideshow');
     $this->_slideshowAssetsModel = Mage::getModel('ash_slideshow/slideshowasset');
 }
 public function preDispatch()
 {
     parent::preDispatch();
     $this->_categoryTypeId = Mage::getModel('eav/entity')->setType('catalog_category')->getTypeId();
     $this->_block = 'category';
     $this->_type = 'catalog_category';
 }
Пример #10
0
 /**
  * Check if module functionality enabled
  *
  * @return Enterprise_Reward_Adminhtml_Reward_RateController
  */
 public function preDispatch()
 {
     parent::preDispatch();
     if (!Mage::helper('rewardpoints')->moduleEnabled() && $this->getRequest()->getActionName() != 'noroute') {
         $this->_forward('noroute');
     }
     return $this;
 }
Пример #11
0
 public function preDispatch()
 {
     parent::preDispatch();
     /* if (!Mage::helper('storecredit')->moduleEnabled() && $this->getRequest()->getActionName() != 'noroute') {
            $this->_forward('noroute');
        }*/
     return $this;
 }
 /**
  * Controller predispatch method
  * Check if current section is found and is allowed
  *
  * @return Mage_Adminhtml_System_ConfigController
  */
 public function preDispatch()
 {
     parent::preDispatch();
     if ($this->getRequest()->getParam('section')) {
         $this->_isSectionAllowedFlag = $this->_isSectionAllowed($this->getRequest()->getParam('section'));
     }
     return $this;
 }
 /**
  * Check if module functionality enabled
  *
  * @return Enterprise_Reward_Adminhtml_Reward_RateController
  */
 public function preDispatch()
 {
     parent::preDispatch();
     if (!Mage::helper('enterprise_reward')->isEnabled() && $this->getRequest()->getActionName() != 'noroute') {
         $this->_forward('noroute');
     }
     return $this;
 }
 public function preDispatch()
 {
     $result = parent::preDispatch();
     if (true === $this->_getSession()->getData('aitsys_rewriter_require_rebuild')) {
         $this->_getSession()->unsetData('aitsys_rewriter_require_rebuild');
         Mage::getModel('aitsys/rewriter')->prepare();
     }
     return $result;
 }
Пример #15
0
 public function preDispatch()
 {
     $result = parent::preDispatch();
     $this->tool()->setInteractiveSession($this->_getSession());
     if ($this->tool()->platform()->isBlocked() && 'error' != $this->getRequest()->getActionName()) {
         $this->_forward('error', 'index');
     }
     return $result;
 }
 public function preDispatch()
 {
     parent::preDispatch();
     /**
      * trick autoloader because the class Google_Service_ShoppingContent is included in the file
      * Google/Service/ShoppingContent.php which contains all other classes Google_Service_ShoppingContent_*
      */
     new Google_Service_ShoppingContent(Mage::getSingleton('gshoppingv2/googleShopping')->getClient(null));
 }
Пример #17
0
 /**
  * preDispatch - called before every action
  */
 public function preDispatch()
 {
     parent::preDispatch();
     $this->_helper = Mage::helper('ash_slideshow');
     $this->_slideshowModel = Mage::getModel('ash_slideshow/slideshow');
     $this->_assetModel = Mage::getModel('ash_slideshow/asset');
     $this->_imageUrl = 'ash_slideshow_assets' . DS . 'image' . DS;
     $this->_mediaAbsolutePath = Mage::getBaseDir('media');
     $this->_prependRandom = str_shuffle('abcdefghijklmnopqrstuvxwyz');
 }
Пример #18
0
 public function preDispatch()
 {
     parent::preDispatch();
     if (is_null(Mage::helper('M2ePro')->getGlobalValue('request_params'))) {
         Mage::helper('M2ePro')->setGlobalValue('request_params', $this->getRequest()->getParams());
     }
     if (is_null(Mage::helper('M2ePro')->getGlobalValue('base_controller'))) {
         Mage::helper('M2ePro')->setGlobalValue('base_controller', $this);
     }
     return $this;
 }
 public function preDispatch()
 {
     parent::preDispatch();
     if (!Mage::helper('freshdesk')->isConfigSet()) {
         $this->_getSession()->addError($this->__('Please fill in Freshdesk configuration options first'));
         $this->_redirect('*/system_config/edit/section/freshdesk');
         $this->getResponse()->sendResponse();
         exit;
     }
     return $this;
 }
Пример #20
0
 public function preDispatch()
 {
     parent::preDispatch();
     if (is_null(Mage::registry('M2ePro_request_params'))) {
         Mage::register('M2ePro_request_params', $this->getRequest()->getParams());
     }
     if (is_null(Mage::registry('M2ePro_base_controller'))) {
         Mage::register('M2ePro_base_controller', $this);
     }
     return $this;
 }
Пример #21
0
 /**
  * Ensure required addon is installed
  *
  */
 public function preDispatch()
 {
     if ($this->getRequest()->getActionName() !== 'upgrade') {
         if (!$this->isAddonInstalled()) {
             $this->setFlag('', self::FLAG_NO_DISPATCH, true);
             $e = new Mage_Core_Controller_Varien_Exception();
             throw $e->prepareForward('upgrade');
         }
     }
     return parent::preDispatch();
 }
 /**
  * Load the customer record.
  */
 public function preDispatch()
 {
     parent::preDispatch();
     $customer = Mage::getModel('customer/customer');
     $customer->load($this->getRequest()->getParam('id'));
     if (!$customer || $customer->getId() < 1 || $customer->getId() != $this->getRequest()->getParam('id')) {
         $this->getResponse()->setBody(json_encode(array('success' => false, 'message' => $this->__('Could not load customer.'))));
         exit;
     }
     Mage::register('current_customer', $customer);
     return $this;
 }
 public function preDispatch()
 {
     $path = '';
     if ($this->getRequest()->getActionName() == 'review') {
         $path = 'catalog/reviews_ratings';
     } elseif ($this->getRequest()->getActionName() == 'notifystock') {
         $path = 'catalog/products';
     }
     Mage::helper('adminhtml/rss')->authAdmin($path);
     parent::preDispatch();
     return $this;
 }
Пример #24
0
 public function preDispatch()
 {
     parent::preDispatch();
     // client was logged out
     if ($this->getRequest()->isXmlHttpRequest() && !Mage::getSingleton('admin/session')->isLoggedIn()) {
         exit(json_encode(array('ajaxExpired' => 1, 'ajaxRedirect' => $this->_getRefererUrl())));
     }
     // flag controller loaded
     if (is_null(Mage::helper('M2ePro/Data_Global')->getValue('is_base_controller_loaded'))) {
         Mage::helper('M2ePro/Data_Global')->setValue('is_base_controller_loaded', true);
     }
     return $this;
 }
Пример #25
0
 public function preDispatch()
 {
     parent::preDispatch();
     $this->_customerTypeId = Mage::getModel('eav/entity')->setType('customer')->getTypeId();
     $this->_categoryTypeId = Mage::getModel('eav/entity')->setType('catalog_category')->getTypeId();
     $this->_customer_addressTypeId = Mage::getModel('eav/entity')->setType('customer_address')->getTypeId();
     if ($this->getRequest()->getParam('type')) {
         switch ($this->getRequest()->getParam('type')) {
             case "customer":
                 $this->_type = 'customer';
                 break;
         }
     }
 }
 public function preDispatch()
 {
     parent::preDispatch();
     if (!Mage::helper('freshdesk')->isConfigSet()) {
         $message = $this->__('Please fill in Freshdesk configuration options first');
         if ($this->getRequest()->getActionName() == 'customerView') {
             echo $message;
         } else {
             $this->_getSession()->addError($message);
             $this->_redirect('*/system_config/edit/section/freshdesk');
             $this->getResponse()->sendResponse();
         }
         exit;
     }
     return $this;
 }
Пример #27
0
 public function preDispatch()
 {
     $result = parent::preDispatch();
     $helper = $this->getDataHelper();
     if (!Itoris_Installer_Client::isAdminRegistered($helper->getAlias())) {
         $this->setFlag('', self::FLAG_NO_DISPATCH, true);
         $register = $this->getLayout()->createBlock('itoris_viewmoreproducts/admin_register');
         $register->setMessage($helper->__('Your copy of the component is not registered! All functions are disabled. Please register. Enter your S/N to register:'));
         Mage::getSingleton('adminhtml/session')->addError($register->toHtml());
         $this->loadLayout();
         $this->getLayout()->getBlock('left')->unsetChildren();
         $this->getLayout()->getBlock('content')->unsetChildren();
         $this->renderLayout();
     }
     return $result;
 }
Пример #28
0
 /**
  * Disable showing of login form
  *
  * @see Mage_Adminhtml_Model_Observer::actionPreDispatchAdmin() method for explanation
  * @return void
  */
 public function preDispatch()
 {
     $this->getRequest()->setParam('forwarded', true);
     // check login data before it set null in Mage_Adminhtml_Model_Observer::actionPreDispatchAdmin
     $loginError = $this->_checkLoginIsEmpty();
     parent::preDispatch();
     // call after parent::preDispatch(); to get session started
     if ($loginError) {
         Mage::getSingleton('Mage_Adminhtml_Model_Session')->addError(Mage::helper('Mage_Adminhtml_Helper_Data')->__('Invalid User Name or Password.'));
         $params = array('_query' => array('oauth_token' => $this->getRequest()->getParam('oauth_token', null)));
         $this->setFlag('', self::FLAG_NO_DISPATCH, true);
         $this->setFlag('', self::FLAG_NO_POST_DISPATCH, true);
         $params = array('_query' => array('oauth_token' => $this->getRequest()->getParam('oauth_token', null)));
         $this->_redirect('*/*/*', $params);
     }
 }
 /**
  * @see Mage_Adminhtml_Controller_Action::preDispatch
  */
 public function preDispatch()
 {
     parent::preDispatch();
     $actions = array('massActivate', 'massDeactivate', 'massDelete');
     $action = $this->getRequest()->getActionName();
     if (in_array($action, $actions)) {
         if ($this->getRequest()->isPost()) {
             $post = $this->getRequest()->getPost();
             $users = isset($post['facebook_user']) ? $post['facebook_user'] : array();
             if (!is_array($users) || empty($users)) {
                 $this->getSession()->addError('There was a problem updating users.');
                 $this->_redirect('*/*/');
             }
             $this->facebookCollection = $this->getFacebookUserCollection()->addFieldToFilter('entity_id', $users);
             $this->collectionCount = $this->facebookCollection->count();
         }
     }
 }
Пример #30
0
 public function preDispatch()
 {
     parent::preDispatch();
     $this->getDataHelper()->tryRegister();
     if (!$this->getDataHelper()->isAdminRegistered()) {
         $this->setFlag('', self::FLAG_NO_DISPATCH, true);
         $register = $this->getLayout()->createBlock('itoris_layerednavigation/admin_register');
         Mage::getSingleton('adminhtml/session')->addError($register->toHtml());
         $this->loadLayout();
         $this->renderLayout();
     }
     $websiteCode = $this->getRequest()->getParam('website');
     if (!empty($websiteCode)) {
         $website = Mage::app()->getWebsite($websiteCode);
         if (!$this->getDataHelper()->isRegistered($website)) {
             $error = '<b style="color:red">' . $this->getDataHelper()->__('The extension is not registered for the website selected. ' . 'Please register it with an additional S/N.') . '</b>';
             $this->_getSession()->addError($error);
         }
     }
     return $this;
 }