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($action) {
if(method_exists($this, $action)) {
$refl = new ReflectionMethod($this, $action);
if($refl->isPublic())
return $this->{$action}();
else {
echo "Action '".$action."' not public";
return false;
}
} else {
echo "Missing action '".$action."'";
return false;

View File

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