public function preDispatch() { $this->getHelper('viewRenderer')->setNoController(true); $this->getHelper('viewRenderer')->setViewScriptPathNoControllerSpec('user/:action.:suffix'); if (!$this->_getParam('user') && $this->getRequest()->getActionName() != 'error') { $code = $this->_getParam('code'); if (!preg_match('#^(.*)-(\\w*)$#', $code, $m)) { $this->getRequest()->setParam('errorMessage', trlKwf("Activation code is invalid. Maybe the URL wasn't copied completely?")); $this->forward('error'); } else { $userId = $m[1]; $code = $m[2]; $userModel = Kwf_Registry::get('userModel'); $user = $userModel->getRow($userId); $this->getRequest()->setParam('user', $user); if (!$user) { $this->getRequest()->setParam('errorMessage', trlKwf("Activation code is invalid. Maybe the URL wasn't copied completely?")); $this->forward('error'); } else { if (!$user->validateActivationToken($code) && $user->isActivated()) { $this->getRequest()->setParam('errorMessage', trlKwf("This account has already been activated.")); $this->forward('error'); } else { if (!$user->validateActivationToken($code)) { $this->getRequest()->setParam('errorMessage', trlKwf("Activation code is invalid. Maybe your account has already been activated, the URL was not copied completely, or the password has already been set?")); $this->forward('error'); } } } } } $this->view->dep = Kwf_Assets_Package_Default::getAdminMainInstance(); parent::preDispatch(); }
public function preDispatch() { parent::preDispatch(); set_time_limit(0); $help = call_user_func(array(get_class($this), 'getHelp')); if (!$help) { throw new Kwf_ClientException("This command is not avaliable"); } //php sux $options = call_user_func(array(get_class($this), 'getHelpOptions')); if ($this->getRequest()->getActionName() == 'index') { //helpOptions are only valid vor index action atm foreach ($options as $opt) { $p = $this->_getParam($opt['param']); if (isset($opt['value']) && ($p === true || !$p) && !(isset($opt['valueOptional']) && $opt['valueOptional']) && !(isset($opt['allowBlank']) && $opt['allowBlank'])) { throw new Kwf_ClientException("Parameter '{$opt['param']}' is missing"); } if (is_null($p) && isset($opt['value']) && !(isset($opt['allowBlank']) && $opt['allowBlank'])) { if (is_array($opt['value'])) { $v = $opt['value'][0]; } else { $v = $opt['value']; } $this->getRequest()->setParam($opt['param'], $v); $p = $v; } if (isset($opt['value']) && is_array($opt['value']) && !in_array($p, $opt['value']) && !(isset($opt['allowBlank']) && $opt['allowBlank'])) { // throw new Kwf_ClientException("Invalid value for parameter '$opt[param]'"); } } } $this->_helper->viewRenderer->setNoRender(); }
public function preDispatch() { $this->_form = new Kwf_Form(); $this->_form->setModel(new Kwf_Model_FnF()); $this->_form->setCreateMissingRow(true); parent::preDispatch(); }
public function preDispatch() { parent::preDispatch(); //collect garbage foreach (glob('temp/postback-*') as $f) { if (time() - filemtime($f) > 60 * 60) { unlink($f); } } }
public function preDispatch() { if ($this->getRequest()->getActionName() == 'success') { if (!$this->getRequest()->getParam('row') instanceof Kwf_Model_Row_Interface) { //don't allow call to successAction directly, allow only forward from indexAction throw new Kwf_Exception_AccessDenied(); } } $this->view->dep = Kwf_Assets_Package_Default::getAdminMainInstance(); parent::preDispatch(); }
public function preDispatch() { parent::preDispatch(); $this->_rrds = array(); foreach (Kwf_Registry::get('config')->rrd as $k => $n) { if ($n) { $this->_rrds[$k] = new $n(); } } $this->_rrds = array_reverse($this->_rrds); }
public function preDispatch() { parent::preDispatch(); if ($this->_getParam('subscribeComponentId')) { $nl = Kwf_Component_Data_Root::getInstance()->getComponentByDbId($this->_getParam('subscribeComponentId')); } else { $select = array('limit' => 1); if ($this->_getParam('subrootComponentId')) { $select['subroot'] = Kwf_Component_Data_Root::getInstance()->getComponentByDbId($this->_getParam('subrootComponentId')); } $nl = Kwf_Component_Data_Root::getInstance()->getComponentBySameClass($this->_getParam('class'), $select); } if (!$nl) { throw new Kwf_Exception('can\'t find newsletter subscribe component'); } if ($nl->componentClass != $this->_getParam('class')) { throw new Kwf_Exception('Invalid componentClass'); } $this->_subscribe = $nl; $this->_model = Kwf_Model_Abstract::getInstance($this->_model); }
public function preDispatch() { //RowObserver brauchen wir hier nicht Kwf_Component_Data_Root::setComponentClass(false); parent::preDispatch(); }