From 1f04b83be337cc91a3fabcf4e574e2306f3d2eaa Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Sat, 30 Mar 2024 12:14:42 -0400 Subject: refactor --- web/core/_controller.php | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 web/core/_controller.php (limited to 'web/core/_controller.php') diff --git a/web/core/_controller.php b/web/core/_controller.php new file mode 100644 index 0000000..8a467d6 --- /dev/null +++ b/web/core/_controller.php @@ -0,0 +1,49 @@ +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); + } + } + + 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; + } + } + +} +?> -- cgit v1.2.3-freya