예제 #1
0
 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();
 }
예제 #2
0
 public function init()
 {
     parent::init();
     if (!isset($this->_permissions)) {
         $this->_permissions = $this->_buttons;
     }
     $btns = array();
     foreach ($this->_buttons as $k => $i) {
         if (is_int($k)) {
             $btns[$i] = true;
         } else {
             $btns[$k] = $i;
         }
     }
     $this->_buttons = $btns;
     $perms = array();
     foreach ($this->_permissions as $k => $i) {
         if (is_int($k)) {
             $perms[$i] = true;
         } else {
             $perms[$k] = $i;
         }
     }
     $this->_permissions = $perms;
 }
 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);
 }
 protected function _validateSessionToken()
 {
     if ($this->getRequest()->getActionName() != 'json-logout-user' && $this->getRequest()->getActionName() != 'json-login-user') {
         parent::_validateSessionToken();
     }
 }
 public function preDispatch()
 {
     //RowObserver brauchen wir hier nicht
     Kwf_Component_Data_Root::setComponentClass(false);
     parent::preDispatch();
 }
 protected function _isAllowedComponent()
 {
     return Kwf_Controller_Action::_isAllowedComponent();
 }
 protected function _initFields()
 {
     parent::_initFields();
     $this->_form->setModel(new Kwf_Model_FnF());
 }