Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php defined("BASEPATH") OR die("Not Allowed");
- class MY_Controller extends CI_Controller{
- //private $layout;
- function __construct(){
- parent::__construct();
- include APPPATH."third_party/google/loader.php";
- $this->data['csrf_token'] = $this->security->get_csrf_token_name();
- $this->data['csrf_hash'] = $this->security->get_csrf_hash();
- //assets insertion
- $this->data['header_html'] = "";
- $this->data['footer_html'] = "";
- //site config
- $this->perpage = site_config('perpage');
- $this->template = site_config('template');
- //template settings
- $this->load->library("tpl");
- $this->tpl->set_template($this->template);
- date_default_timezone_set('Asia/Jakarta');
- }
- }
- //controller for administrator
- class Admin extends MY_Controller{
- function __construct(){
- parent::__construct();
- $this->ion_auth->is_admin() OR redirect('auth');
- $this->tpl->set_layout("admin/layout.php");
- //$this->output->enable_profiler();
- }
- }
- //controller for front end user
- class Site extends MY_Controller{
- function __construct(){
- parent::__construct();
- $this->tpl->set_layout("site/layout.php");
- //$this->output->enable_profiler();
- //check for maintenance, show maintenance message if visitor is not an administrator
- if (site_config("maintenance") == 1 && ! $this->ion_auth->is_admin()){
- show_error(t("maintenance_msg"), 503,t("maintenance_msg_head"));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement