diff options
Diffstat (limited to '')
-rw-r--r-- | src/web/core/_controller.php (renamed from web/core/_controller.php) | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/web/core/_controller.php b/src/web/core/_controller.php index a357ccc..4a788d3 100644 --- a/web/core/_controller.php +++ b/src/web/core/_controller.php @@ -45,5 +45,20 @@ abstract class Controller { } } + protected function is_ajax(): bool { + $_POST = json_decode( + file_get_contents("php://input"), true + ); + return isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] === 'XMLHttpRequest'; + } + + protected function error($code): void { + $_GET['code'] = $code; + $this->main->info['app'] = 'error'; + $error_controller = $this->load->controller('apps/error'); + $error_controller->index(); + die(); + } + } ?> |