/** * 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); } }