check if method specified in 'action' is public

This commit is contained in:
Uwe Steinmann 2024-01-11 10:09:56 +01:00
parent dd40e979e7
commit 4b761a95a1
2 changed files with 14 additions and 2 deletions

View File

@ -73,7 +73,13 @@ class SeedDMS_Controller_Common {
if(!$this->callHook('preRun', get_class($this), $action ? $action : 'run')) { if(!$this->callHook('preRun', get_class($this), $action ? $action : 'run')) {
if($action) { if($action) {
if(method_exists($this, $action)) { if(method_exists($this, $action)) {
$refl = new ReflectionMethod($this, $action);
if($refl->isPublic())
return $this->{$action}(); return $this->{$action}();
else {
echo "Action '".$action."' not public";
return false;
}
} else { } else {
echo "Missing action '".$action."'"; echo "Missing action '".$action."'";
return false; return false;

View File

@ -69,7 +69,13 @@ class SeedDMS_View_Common {
if(!$this->callHook('preRun', get_class($this), $action ? $action : 'show')) { if(!$this->callHook('preRun', get_class($this), $action ? $action : 'show')) {
if($action) { if($action) {
if(method_exists($this, $action)) { if(method_exists($this, $action)) {
$refl = new ReflectionMethod($this, $action);
if($refl->isPublic())
$this->{$action}(); $this->{$action}();
else {
echo "Action '".$action."' not public";
return false;
}
} else { } else {
echo "Missing action '".htmlspecialchars($action)."'"; echo "Missing action '".htmlspecialchars($action)."'";
} }