Advertisement
doaw89t76g3bfi3wfw3a

Untitled

Feb 22nd, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. <?php defined("BASEPATH") OR die("Not Allowed");
  2.  
  3. class MY_Controller extends CI_Controller{
  4. //private $layout;
  5. function __construct(){
  6. parent::__construct();
  7. include APPPATH."third_party/google/loader.php";
  8. $this->data['csrf_token'] = $this->security->get_csrf_token_name();
  9. $this->data['csrf_hash'] = $this->security->get_csrf_hash();
  10.  
  11. //assets insertion
  12. $this->data['header_html'] = "";
  13. $this->data['footer_html'] = "";
  14.  
  15. //site config
  16. $this->perpage = site_config('perpage');
  17. $this->template = site_config('template');
  18.  
  19. //template settings
  20. $this->load->library("tpl");
  21. $this->tpl->set_template($this->template);
  22. date_default_timezone_set('Asia/Jakarta');
  23.  
  24.  
  25.  
  26. }
  27. }
  28.  
  29. //controller for administrator
  30.  
  31. class Admin extends MY_Controller{
  32. function __construct(){
  33. parent::__construct();
  34. $this->ion_auth->is_admin() OR redirect('auth');
  35. $this->tpl->set_layout("admin/layout.php");
  36. //$this->output->enable_profiler();
  37. }
  38.  
  39. }
  40.  
  41. //controller for front end user
  42.  
  43. class Site extends MY_Controller{
  44. function __construct(){
  45. parent::__construct();
  46. $this->tpl->set_layout("site/layout.php");
  47. //$this->output->enable_profiler();
  48. //check for maintenance, show maintenance message if visitor is not an administrator
  49. if (site_config("maintenance") == 1 && ! $this->ion_auth->is_admin()){
  50. show_error(t("maintenance_msg"), 503,t("maintenance_msg_head"));
  51. }
  52. }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement