Changeset 1145
- Timestamp:
- 09/25/08 03:59:35 (2 months ago)
- Files:
-
- trunk/lib/AkActionController.php (modified) (6 diffs)
- trunk/test/unit/lib/AkActionController.php (modified) (1 diff)
- trunk/test/unit/lib/AkActionController/_forbidden_actions.php (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/AkActionController.php
r1140 r1145 150 150 $this->Response =& $Response; 151 151 $this->params = $this->Request->getParams(); 152 $this->_action_name = $this->Request->getAction(); 153 152 $this->_action_name = $this->getActionName(); 154 153 $this->_ensureActionExists(); 155 154 … … 247 246 return array(); 248 247 } 249 248 250 249 function getModuleHelper() 251 250 { … … 259 258 return array(); 260 259 } 261 262 260 261 263 262 function _validateGeneratedXhtml() 264 263 { … … 300 299 301 300 unset($this->model, $this->models); 302 301 303 302 foreach ($models as $model){ 304 303 $this->instantiateModelClass($model, (empty($this->finder_options[$model])?array():$this->finder_options[$model])); … … 2719 2718 function _ensureActionExists() 2720 2719 { 2721 if(!method_exists($this, $this->_action_name)){ 2720 $action = $this->getActionName(); 2721 if(!method_exists($this, $action) || $this->_isActionForbidden()){ 2722 2722 if(AK_ENVIRONMENT == 'development'){ 2723 AK_LOG_EVENTS && !empty($this->_Logger) ? $this->_Logger->error('Action '.$ this->_action_name.' not found on '.$this->getControllerName()) : null;2723 AK_LOG_EVENTS && !empty($this->_Logger) ? $this->_Logger->error('Action '.$action.' not found on '.$this->getControllerName()) : null; 2724 2724 trigger_error(Ak::t('Controller <i>%controller_name</i> can\'t handle action %action_name', 2725 2725 array( 2726 2726 '%controller_name' => $this->getControllerName(), 2727 '%action_name' => $ this->_action_name,2727 '%action_name' => $action, 2728 2728 )), E_USER_ERROR); 2729 2729 }elseif(@include(AK_PUBLIC_DIR.DS.'405.php')){ … … 2734 2734 } 2735 2735 } 2736 } 2737 2738 function _isActionForbidden() 2739 { 2740 $methods = get_class_methods('AkActionController'); 2741 $action = $this->getActionName(); 2742 return empty($action) || in_array($action , $methods) || $action != AkInflector::underscore($action) || $action[0] == '_'; 2736 2743 } 2737 2744 } trunk/test/unit/lib/AkActionController.php
r443 r1145 15 15 16 16 $partial_tests = array( 17 'forbidden_actions', 17 18 'filters', 18 19 'locale_detection',
