diff --git a/chandler/MVC/SimplePresenter.php b/chandler/MVC/SimplePresenter.php index 2929494..a746cd5 100644 --- a/chandler/MVC/SimplePresenter.php +++ b/chandler/MVC/SimplePresenter.php @@ -33,7 +33,7 @@ abstract class SimplePresenter implements IPresenter if(file_exists($realpath)) { $hash = "sha384-" . base64_encode(hash_file("sha384", $realpath, true)); $mod = base_convert((string) (filemtime($realpath)), 10, 32); - echo ""; + echo ""; } else { echo ""; } @@ -45,7 +45,7 @@ abstract class SimplePresenter implements IPresenter if(file_exists($realpath)) { $hash = "sha384-" . base64_encode(hash_file("sha384", $realpath, true)); $mod = base_convert((string) (filemtime($realpath)), 10, 32); - echo ""; + echo ""; } else { echo ""; } @@ -176,7 +176,15 @@ abstract class SimplePresenter implements IPresenter protected function requestParam(string $index): ?string { - return $_REQUEST[$index]; + return $_REQUEST[$index] ?? NULL; + } + + protected function jsonParam(string $index): ?string + { + if(!isset($GLOBALS["jsonInputCache"])) + $GLOBALS["jsonInputCache"] = json_decode($this->queryParam("js") ?? file_get_contents("php://input"), true); + + return $GLOBALS["jsonInputCache"][$index] ?? NULL; } protected function checkbox(string $name): bool