diff options
author | Freya Murphy <freya@freyacat.org> | 2024-12-23 11:13:27 -0500 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2024-12-23 11:13:27 -0500 |
commit | 5a2ba9c2e7605bb788bc406184547d22c6436867 (patch) | |
tree | cbd988d534e8a8593a31d70571222443f80da0b3 /src/web/core/_controller.php | |
parent | fix about modal (diff) | |
download | xssbook2-5a2ba9c2e7605bb788bc406184547d22c6436867.tar.gz xssbook2-5a2ba9c2e7605bb788bc406184547d22c6436867.tar.bz2 xssbook2-5a2ba9c2e7605bb788bc406184547d22c6436867.zip |
v2.1.0, refactor w/ crimson
Diffstat (limited to '')
-rw-r--r-- | src/web/core/_controller.php | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/src/web/core/_controller.php b/src/web/core/_controller.php deleted file mode 100644 index 3502ea5..0000000 --- a/src/web/core/_controller.php +++ /dev/null @@ -1,69 +0,0 @@ -<?php /* Copyright (c) 2024 Freya Murphy */ -abstract class Controller { - - // the main model - public $main; - - // the loader - public $load; - - // the database - public $db; - - // the format model - protected $format_model; - - /** - * Creates a constructor - * @param Loader $load - the website loaded object - */ - function __construct($load) { - $this->load = $load; - $this->main = $this->load->model('main'); - $this->db = $this->main->db; - - $info = $this->main->info; - $lang = $info['lang']; - $this->load->lang($lang); - $app = $info['app']; - if ($app) { - $this->load->app_lang($lang, $app); - } - - $this->format_model = $this->load->model('format'); - } - - public function index() {} - - public function redirect($link) { - header('Location: '. $link, true, 301); - die(); - } - - protected function view($__name, $data = array()) { - $__root = $GLOBALS['webroot']; - $__path = $__root . '/_views/' . $__name . '.php'; - if (is_file($__path)) { - extract($data); - require($__path); - return; - } - } - - 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(); - } - -} -?> |