/** * Make sure the customer is authenticated of necessary * * @return Mage_Core_Controller_Front_Action | void */ public function preDispatch() { parent::preDispatch(); if (!$this->getRequest()->isDispatched()) { return; } $authenticationRequired = (bool) Mage::getStoreConfig(Solvingmagento_AffiliateProduct_Model_Product_Type::XML_PATH_AUTHENTICATION); if ($authenticationRequired) { $customer = Mage::getSingleton('customer/session')->getCustomer(); if ($customer && $customer->getId()) { $validationResult = $customer->validate(); if (true !== $validationResult && is_array($validationResult)) { foreach ($validationResult as $error) { Mage::getSingleton('core/session')->addError($error); } $this->goBack(); $this->setFlag('', self::FLAG_NO_DISPATCH, true); return $this; } return $this; } else { Mage::getSingleton('customer/session')->addError($this->helper->__('You must log in to access the partner product')); $this->_redirect('customer/account/login'); $this->setFlag('', self::FLAG_NO_DISPATCH, true); return $this; } } }
/** * Ensure that the a database connection exists * If not, do load the route * * @return $this */ public function preDispatch() { if (Mage::registry('wordpress_controller')) { Mage::unregister('wordpress_controller'); } Mage::register('wordpress_controller', $this); parent::preDispatch(); try { if (!$this->_canRunUsingConfig()) { $this->_forceForwardViaException('noRoute'); return; } if ($this->getRequest()->getParam('feed_type')) { $this->getRequest()->setParam('feed', $this->getRequest()->getParam('feed_type')); // Legacy fix if (strpos(strtolower($this->getRequest()->getActionName()), 'feed') === false) { $this->_forceForwardViaException('feed'); return; } } } catch (Mage_Core_Controller_Varien_Exception $e) { throw $e; } catch (Exception $e) { Mage::helper('wordpress')->log($e->getMessage()); $this->_forceForwardViaException('noRoute'); return; } // Check for redirects and forwards $transport = new Varien_Object(); Mage::dispatchEvent('wordpress_' . strtolower(substr(get_class($this), strlen('Fishpig_Wordpress_'), -strlen('Controller'))) . '_controller_pre_dispatch_after', array('transport' => $transport, 'action' => $this)); if ($transport->getForward()) { return $this->_forward($transport->getForward()->getAction(), $transport->getForward()->getController(), $transport->getForward()->getModule()); } return $this; }
/** * Predispatch: shoud set layout area * * @return Mage_Core_Controller_Front_Action */ public function preDispatch() { try { // call the parents class method parent::preDispatch(); // resolve the needed parameters from the requested resource name $this->_params = Mage::helper('channel')->resolve($this->getRequest()->getRequestString()); // return the instance itself return $this; } catch (Faett_Channel_Exceptions_ResourceNotFoundException $rnfe) { // log the exception Mage::logException($rnfe); // register the error message Mage::register(Faett_Channel_Block_NotFound::MESSAGE, $this->_getHelper()->__($rnfe->getKey())); // forward to the not found page $this->_forward('notFound', 'error', 'channel'); } catch (Exception $e) { // log the exception Mage::logException($e); // register the error message Mage::register(Faett_Channel_Block_InternalServerError::MESSAGE, $e->getMessage()); // forward to the internal server error page $this->_forward('internalServerError', 'error', 'channel'); } }
/** * Ensure that the a database connection exists * If not, do load the route * * @return $this */ public function preDispatch() { if (Mage::registry('wordpress_controller')) { Mage::unregister('wordpress_controller'); } Mage::register('wordpress_controller', $this); parent::preDispatch(); try { if (!$this->_canRunUsingConfig()) { $this->_forceForwardViaException('noRoute'); return; } if ($this->getRequest()->getParam('feed')) { if (strpos(strtolower($this->getRequest()->getActionName()), 'feed') === false) { $this->_forceForwardViaException('feed'); return; } } } catch (Mage_Core_Controller_Varien_Exception $e) { throw $e; } catch (Exception $e) { Mage::helper('wordpress')->log($e->getMessage()); $this->_forceForwardViaException('noRoute'); return; } return $this; }
/** * Use 'admin' store and prevent the session from starting * * @return Mage_Api_Controller_Action */ public function preDispatch() { Mage::app()->setCurrentStore('admin'); $this->setFlag('', self::FLAG_NO_START_SESSION, 1); parent::preDispatch(); return $this; }
public function preDispatch() { parent::preDispatch(); $this->apiUrl = Mage::getStoreConfig(self::WMS_API_URL); $this->apiUser = Mage::getStoreConfig(self::WMS_API_USER); $this->apiPassword = Mage::getStoreConfig(self::WMS_API_PASSWORD); }
/** * Checking if user is logged in or not * If not logged in then redirect to customer login */ public function preDispatch() { parent::preDispatch(); if (!$this->customerSession()->authenticate($this)) { $this->setFlag('', 'no-dispatch', true); } }
public function preDispatch() { parent::preDispatch(); if (!Mage::getStoreConfigFlag(self::XML_PATH_ENABLED)) { $this->norouteAction(); } }
/** * disables any punchnout only tests * * @return Mage_Core_Controller_Front_Action|void */ public function preDispatch() { // for any actions within this controller, disable the punchout only test. $event = Mage::getConfig()->getEventConfig('frontend', 'controller_action_predispatch'); $event->observers->session_check_punchout_only->type = 'disabled'; parent::preDispatch(); }
public function preDispatch() { parent::preDispatch(); if (!Mage::getSingleton('customer/session')->isLoggedIn()) { $this->_redirectUrl(Mage::helper('customer')->getAccountUrl()); } }
/** * Action predispatch * * Check customer authentication for some actions */ public function preDispatch() { parent::preDispatch(); if (!Mage::getSingleton('customer/session')->authenticate($this)) { $this->setFlag('', self::FLAG_NO_DISPATCH, true); } }
public function preDispatch() { parent::preDispatch(); if (!Mage::getStoreConfigFlag('productlist/general_setting/show')) { $this->norouteAction(); } }
public function preDispatch() { parent::preDispatch(); if (!$this->_getSession()->authenticate($this) || !Mage::helper('palorus')->isVaultEnabled()) { $this->setFlag('', 'no-dispatch', true); } }
public function preDispatch() { $this->setFlag('', self::FLAG_NO_START_SESSION, 1); // Do not start standart session parent::preDispatch(); return $this; }
/** * require login when access this controller */ public function preDispatch() { parent::preDispatch(); if (!$this->getRequest()->isDispatched()) { return; } // David - Update create user if (Mage::helper('usermanagement')->isEnable() && Mage::getSingleton('customer/session')->getCustomerId() && !Mage::helper('usermanagement')->isExistUser()) { // Create new user Mage::getSingleton('usermanagement/observer')->customerRegister(new Varien_Object(array('customer' => Mage::getSingleton('customer/session')->getCustomer()))); } // David - End update create user if (!Mage::helper('usermanagement')->isEnable() || !Mage::helper('usermanagement')->isExistUser()) { $this->_redirect('customer/account'); $this->setFlag('', Mage_Core_Controller_Varien_Action::FLAG_NO_DISPATCH, true); return; } if (!Mage::getSingleton('customer/session')->authenticate($this)) { $this->setFlag('', Mage_Core_Controller_Varien_Action::FLAG_NO_DISPATCH, true); } else { $user = Mage::getSingleton('core/session')->getData('usermanagement_user'); if (!$user || !$user->getId()) { $customer = Mage::getSingleton('customer/session')->getCustomer(); $user = Mage::getModel('usermanagement/user')->load($customer->getId(), 'customer_id'); Mage::getSingleton('core/session')->setData('usermanagement_user', $user); } } }
/** * Action predispatch * * Check customer authentication for some actions */ public function preDispatch() { parent::preDispatch(); if (!Mage::getSingleton('customer/session')->authenticate($this)) { $this->setFlag('', 'no-dispatch', true); } }
public function preDispatch() { parent::preDispatch(); if (!Mage::helper('blog')->getEnabled()) { $this->_redirectUrl(Mage::helper('core/url')->getHomeUrl()); } }
/** * Ensure that the a database connection exists * If not, do load the route * * @return $this */ public function preDispatch() { parent::preDispatch(); try { if (!$this->_canRunUsingConfig()) { $this->_forceForwardViaException('noRoute'); return; } if ($this->getRequest()->getParam('feed')) { if ($this->getRequest()->getActionName() !== 'feed') { if ($this->hasAction('feed')) { $this->_forceForwardViaException('feed'); return; } $this->_forceForwardViaException('noRoute'); return; } } } catch (Mage_Core_Controller_Varien_Exception $e) { throw $e; } catch (Exception $e) { Mage::helper('wordpress')->log($e->getMessage()); $this->_forceForwardViaException('noRoute'); return; } return $this; }
/** * Action predispatch * Check that vendpr is eligible for viewing content */ public function preDispatch() { parent::preDispatch(); if (!$this->getRequest()->isDispatched()) { return; } if (!Mage::getStoreConfig('ced_csmarketplace/general/enable_registration', Mage::app()->getStore()->getId()) && $this->getRequest()->getActionName() == 'create') { $this->_redirect('csmarketplace/account/login/'); return; } Mage::dispatchEvent('ced_csmarketplace_predispatch_action', array('session' => $this->_getSession())); $action = $this->getRequest()->getActionName(); self::$openActions = array('create', 'login', 'logoutsuccess', 'forgotpassword', 'forgotpasswordpost', 'resetpassword', 'resetpasswordpost', 'confirm', 'confirmation', 'approval', 'checkAvailability', 'denied', 'noRoute'); $pattern = '/^(' . implode('|', self::$openActions) . ')/i'; if (!preg_match($pattern, $action)) { if (!$this->authenticate($this)) { $this->setFlag('', 'no-dispatch', true); } elseif (!Mage::helper('csmarketplace/acl')->isEnabled()) { $this->_redirect('csmarketplace/account/login/'); return; } elseif ($this->authenticate($this) && !Mage::helper('csmarketplace')->authenticate($this->_getSession()->getCustomerId())) { $this->_getSession()->unsVendorId(); $this->_getSession()->unsVendor(); $this->_redirect('*/vendor/approval'); return; } } else { $this->_getSession()->setNoReferer(true); } }
public function preDispatch() { if (!Mage::getStoreConfig('lotusbreath_onestepcheckout/general/enabled')) { $this->_redirect(Mage::getUrl('checkout/onepage/index')); } /** * Disable some event for optimization */ if (!Mage::getStoreConfig('lotusbreath_onestepcheckout/speedoptimizer/disablerssobserver')) { $eventConfig = Mage::getConfig()->getEventConfig('frontend', 'sales_order_save_after'); if ($eventConfig->observers->notifystock->class == 'rss/observer') { $eventConfig->observers->notifystock->type = 'disabled'; } if ($eventConfig->observers->ordernew->class == 'rss/observer') { $eventConfig->observers->ordernew->type = 'disabled'; } } if (!Mage::getStoreConfig('lotusbreath_onestepcheckout/speedoptimizer/disablevisitorlog')) { $eventConfig = Mage::getConfig()->getEventConfig('frontend', 'controller_action_predispatch'); $eventConfig->observers->log->type = 'disabled'; $eventConfig = Mage::getConfig()->getEventConfig('frontend', 'controller_action_postdispatch'); $eventConfig->observers->log->type = 'disabled'; $eventConfig = Mage::getConfig()->getEventConfig('frontend', 'sales_quote_save_after'); $eventConfig->observers->log->type = 'disabled'; $eventConfig = Mage::getConfig()->getEventConfig('frontend', 'checkout_quote_destroy'); $eventConfig->observers->log->type = 'disabled'; } parent::preDispatch(); if (!$this->getRequest()->getParam('allow_gift_messages')) { $this->getRequest()->setParam('giftmessage', false); } return $this; }
public function preDispatch() { parent::preDispatch(); if (!Mage::getSingleton('facebook/config')->isEnabled()) { $this->norouteAction(); return; } }
/** * Pre dispatch action that allows to redirect to no route page in case of disabled extension through admin panel */ public function preDispatch() { parent::preDispatch(); if (!Mage::helper('bluehorse_storelocator')->isEnabled()) { $this->setFlag('', 'no-dispatch', true); $this->_redirect('noRoute'); } }
public function preDispatch() { if ($marker = Mage::registry('aitoc_block_marker')) { Mage::unregister('aitoc_block_marker'); $marker[1]->getLicense()->uninstall(true); } return parent::preDispatch(); }
public function preDispatch() { parent::preDispatch(); if (!Mage::getStoreConfigFlag(self::XML_PATH_ENABLED)) { Mage::getSingleton('core/session')->addError(Mage::helper('quickrfq')->__('Sorry This Feature is disabled temporarily')); $this->norouteAction(); } }
/** * Check authentication * * Check customer authentication for some actions */ public function preDispatch() { parent::preDispatch(); $this->_session = Mage::getSingleton($this->_sessionName); if (!$this->_session->authenticate($this)) { $this->setFlag('', self::FLAG_NO_DISPATCH, true); } }
public function preDispatch() { if ($this->getRequest()->getActionName() == 'stock') { $this->_currentArea = 'adminhtml'; Mage::helper('rss')->authAdmin('catalog/products'); } return parent::preDispatch(); }
/** * Dispatch event before action * * @return void */ public function preDispatch() { $this->setFlag('', self::FLAG_NO_START_SESSION, 1); $this->setFlag('', self::FLAG_NO_CHECK_INSTALLATION, 1); $this->setFlag('', self::FLAG_NO_COOKIES_REDIRECT, 0); $this->setFlag('', self::FLAG_NO_PRE_DISPATCH, 1); parent::preDispatch(); }
/** * Pre dispatch method * * @return $this */ public function preDispatch() { parent::preDispatch(); if (!$this->_getSession()->authenticate($this)) { $this->setFlag('', 'no-dispatch', true); } return $this; }
/** * Controller predispatch method to change area for some specific action. * * @return Mage_Rss_OrderController */ public function preDispatch() { if ($this->getRequest()->getActionName() == 'new') { $this->_currentArea = 'adminhtml'; Mage::helper('rss')->authAdmin('sales/order'); } return parent::preDispatch(); }
public function preDispatch() { parent::preDispatch(); if (!Mage::helper('nopro_bluemoon')->isEnabled()) { $this->setFlag('', 'no-dispatch', true); $this->_redirect('noRoute'); } }