first check if parameter 'action' is set, return false if preRun fails

This commit is contained in:
Uwe Steinmann 2022-08-01 12:43:56 +02:00
parent 5378d6e7d9
commit 014bcc009d

View File

@ -61,12 +61,14 @@ class SeedDMS_Controller_Common {
*/ */
public function __invoke($get=array()) { public function __invoke($get=array()) {
$action = null; $action = null;
$request = $this->getParam('request'); if(!$action = $this->getParam('action')) {
if($request) { $request = $this->getParam('request');
if($request->isMethod('get')) if($request) {
$action = $request->query->get('action'); if($request->isMethod('get'))
elseif($request->isMethod('post')) $action = $request->query->get('action');
$action = $request->request->get('action'); elseif($request->isMethod('post'))
$action = $request->request->get('action');
}
} }
if(!$this->callHook('preRun', get_class($this), $action ? $action : 'run')) { if(!$this->callHook('preRun', get_class($this), $action ? $action : 'run')) {
if($action) { if($action) {
@ -78,6 +80,8 @@ class SeedDMS_Controller_Common {
} }
} else } else
return $this->run(); return $this->run();
} else {
return false;
} }
$this->callHook('postRun', get_class($this), $action ? $action : 'run'); $this->callHook('postRun', get_class($this), $action ? $action : 'run');
} }