From c5f39ea2cd7cf02246705ea8872d3b350526165c Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Fri, 24 May 2024 09:05:42 -0400 Subject: initial --- src/web/core/_controller.php | 51 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 src/web/core/_controller.php (limited to 'src/web/core/_controller.php') diff --git a/src/web/core/_controller.php b/src/web/core/_controller.php new file mode 100644 index 0000000..0dbb5b8 --- /dev/null +++ b/src/web/core/_controller.php @@ -0,0 +1,51 @@ +load = $load; + $this->main = $this->load->model('main'); + + $this->load->lang(); + $info = $this->main->info; + $app = $info['app']; + if ($app) { + $this->load->app_lang($app); + } + } + + 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 error($code): void { + $_GET['code'] = $code; + $this->main->info['app'] = 'error'; + $error_controller = $this->load->controller('error'); + $error_controller->index(); + die(); + } + +} -- cgit v1.2.3-freya