diff options
| author | Syndamia <kamen@syndamia.com> | 2025-01-18 20:59:00 +0200 |
|---|---|---|
| committer | Kamen Mladenov <kamen@syndamia.com> | 2025-01-19 07:46:17 +0200 |
| commit | 68f9981680844e876636369cb07137b351b23989 (patch) | |
| tree | b94714a643753350fcbb55fe79e7702c36322ecc /controllers/meta.php | |
| parent | cbca98e5501410dea58421a7517e3de856ae0110 (diff) | |
| download | nowayforward_human-68f9981680844e876636369cb07137b351b23989.tar nowayforward_human-68f9981680844e876636369cb07137b351b23989.tar.gz nowayforward_human-68f9981680844e876636369cb07137b351b23989.zip | |
feat(controllers): Meta now doesn't call a function if it doesn't exist
Diffstat (limited to 'controllers/meta.php')
| -rw-r--r-- | controllers/meta.php | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/controllers/meta.php b/controllers/meta.php index ea26c30..e567ac3 100644 --- a/controllers/meta.php +++ b/controllers/meta.php @@ -4,9 +4,15 @@ foreach (glob("../models/*.php") as $filename) { include $filename; } +function call_handler(string $name) { + if (function_exists($name)) { + call_user_func($name); + } +} + match ($_SERVER['REQUEST_METHOD']) { - 'POST' => on_post(), - 'GET' => on_get(), - 'PUT' => on_put(), - 'DELETE' => on_delete(), + 'POST' => call_handler('on_post'), + 'GET' => call_handler('on_get'), + 'PUT' => call_handler('on_put'), + 'DELETE' => call_handler('on_delete'), }; |
