Server : Apache/2.4.18 (Ubuntu) System : Linux canvaswebdesign 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64 User : oppastar ( 1041) PHP Version : 7.0.33-0ubuntu0.16.04.15 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, Directory : /var/www/asietex.co.id/public_html/application/core/ |
Upload File : |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class MY_Controller extends MX_Controller { public $data = array(); //we create $data, empty array which will be used on every controller public $data_header = array(); public $data_footer = array(); function __construct() { parent::__construct(); } } class Public_controller extends MY_Controller { function __construct() { parent::__construct(); //enable cache, to improve google pagespeed //$this->output->cache(60); //set 60 minutes between refresh // Deletes cache for the currently requested URI //$this->output->delete_cache(); //check if website is active $this->db->select('website_active, website_ip')->from('configuration')->where('id_configuration', 1); $website_status = $this->db->get()->row(); if($website_status->website_active == 'no') { //WEBSITE IS NOT ACTIVE (MAINTENANCE MODE) //get current IP $current_ip = $this->input->ip_address(); //localhost ip is ::1 //check for allowed IP $allowed_ips = explode(',', $website_status->website_ip); if (in_array($current_ip, $allowed_ips) == 0) { redirect(base_url('maintenance')); } else { //WEBSITE IS ACTIVE $this->website_active(); } } else { //WEBSITE IS ACTIVE $this->website_active(); } } private function website_active() { //GET WEBSITE DETAILS, GOOGLE ANALYTICS $this->db->select('logo, logo2, company_name, facebook, twitter, instagram, google_analytic_id, tawkto_id, primary_color_theme, website_icon, company_address, company_phone, from_email')->from('configuration')->where('id_configuration', 1); $website_infos = $this->db->get()->row(); $this->data_header['logo'] = $website_infos->logo; $this->data_header['logo2'] = $website_infos->logo2; $this->data_header['company_name'] = $website_infos->company_name; $this->data_header['company_address'] = $website_infos->company_address; $this->data_header['company_phone'] = $website_infos->company_phone; $this->data_header['company_email'] = $website_infos->from_email; $this->data_header['google_analytic_id'] = $website_infos->google_analytic_id; $this->data_header['tawkto_id'] = $website_infos->tawkto_id; $this->data_header['primary_colortheme'] = $website_infos->primary_color_theme; $this->data_header['website_icon'] = $website_infos->website_icon; $this->data['facebook'] = $website_infos->facebook; $this->data['twitter'] = $website_infos->twitter; $this->data['instagram'] = $website_infos->instagram; //TOP MAIN MENUS $this->db->select('*')->from('menus')->where('status', 1)->order_by('priority', 'ASC'); $this->data_header['top_main_menus'] = $this->db->get()->result(); //FOOTER //get left footer $this->db->select('title, title_en, description, description_en')->from('home_footer')->where('id_home_footer', 1); $footer1 = $this->db->get()->row(); if($this->session->userdata('site_lang') == 'english') { $this->data_footer['footer_title1'] = $footer1->title_en; $this->data_footer['footer_description1'] = $footer1->description_en; } else { $this->data_footer['footer_title1'] = $footer1->title; $this->data_footer['footer_description1'] = $footer1->description; } //get left center footer $this->db->select('title, title_en, description, description_en')->from('home_footer')->where('id_home_footer', 2); $footer2 = $this->db->get()->row(); if($this->session->userdata('site_lang') == 'english') { $this->data_footer['footer_title2'] = $footer2->title_en; $this->data_footer['footer_description2'] = $footer2->description_en; } else { $this->data_footer['footer_title2'] = $footer2->title; $this->data_footer['footer_description2'] = $footer2->description; } //get right center footer $this->db->select('title, title_en, description, description_en')->from('home_footer')->where('id_home_footer', 3); $footer3 = $this->db->get()->row(); if($this->session->userdata('site_lang') == 'english') { $this->data_footer['footer_title3'] = $footer3->title_en; $this->data_footer['footer_description3'] = $footer3->description_en; } else { $this->data_footer['footer_title3'] = $footer3->title; $this->data_footer['footer_description3'] = $footer3->description; } //get right footer $this->db->select('title, title_en, description, description_en')->from('home_footer')->where('id_home_footer', 4); $footer4 = $this->db->get()->row(); if($this->session->userdata('site_lang') == 'english') { $this->data_footer['footer_title4'] = $footer4->title_en; $this->data_footer['footer_description4'] = $footer4->description_en; } else { $this->data_footer['footer_title4'] = $footer4->title; $this->data_footer['footer_description4'] = $footer4->description; } //get right footer $this->db->select('title, title_en, description, description_en')->from('home_footer')->where('id_home_footer', 5); $footer5 = $this->db->get()->row(); if($this->session->userdata('site_lang') == 'english') { $this->data_footer['footer_title5'] = $footer5->title_en; $this->data_footer['footer_description5'] = $footer5->description_en; } else { $this->data_footer['footer_title5'] = $footer5->title; $this->data_footer['footer_description5'] = $footer5->description; } //get right footer $this->db->select('title, title_en, description, description_en')->from('home_footer')->where('id_home_footer', 6); $footer6 = $this->db->get()->row(); if($this->session->userdata('site_lang') == 'english') { $this->data_footer['footer_title6'] = $footer6->title_en; $this->data_footer['footer_description6'] = $footer6->description_en; } else { $this->data_footer['footer_title6'] = $footer6->title; $this->data_footer['footer_description6'] = $footer6->description; } //GET SOCIAL MEDIA $this->db->select('facebook, youtube, instagram, twitter')->from('configuration')->where('id_configuration', 1); $this->data_footer['sosmed'] = $this->db->get()->row(); //get banner 1 (english and indonesian) image only for top static banner $this->db->select('banner1_image, banner1en_image')->from('home_centerbanners')->where('id_home_centerbanners', 1); $this->data_header['top_banner'] = $this->db->get()->row(); //LOAD MENU HELPER $this->load->helper('menu'); } } class Customer_controller extends MY_Controller { function __construct() { parent::__construct(); //enable cache, to improve google pagespeed //$this->output->cache(60); //set 60 minutes between refresh // Deletes cache for the currently requested URI //$this->output->delete_cache(); //check if website is active $this->db->select('website_active, website_ip')->from('configuration')->where('id_configuration', 1); $website_status = $this->db->get()->row(); if($website_status->website_active == 'no') { //WEBSITE IS NOT ACTIVE (MAINTENANCE MODE) //get current IP $current_ip = $this->input->ip_address(); //localhost ip is ::1 //check for allowed IP $allowed_ips = explode(',', $website_status->website_ip); if (in_array($current_ip, $allowed_ips) == 0) { redirect(base_url('maintenance')); } else { //WEBSITE IS ACTIVE $this->website_active(); } } else { //WEBSITE IS ACTIVE $this->website_active(); } } private function website_active() { $this->load->model('customer_m'); $this->load->helper('form'); $this->load->library('cart'); //logged in check, if loggedin is false, then kickout //exclude some pages from the check $exception_uris = array( 'register', 'register/new_registration', 'register/logout', 'register/guest_checkout', 'login', 'login/login', 'login/lost_password', 'login/set_new_password' ); if(in_array(uri_string(), $exception_uris) == FALSE) { if($this->customer_m->loggedin() == FALSE) { redirect('register'); } } //WEBSITE DETAILS, GOOGLE ANALYTICS $this->db->select('logo, logo2, company_name, facebook, twitter, instagram, google_analytic_id, primary_color_theme, website_icon')->from('configuration')->where('id_configuration', 1); $website_infos = $this->db->get()->row(); $this->data_header['logo'] = $website_infos->logo; $this->data_header['logo2'] = $website_infos->logo2; $this->data_header['company_name'] = $website_infos->company_name; $this->data_header['google_analytic_id'] = $website_infos->google_analytic_id; $this->data['facebook'] = $website_infos->facebook; $this->data['twitter'] = $website_infos->twitter; $this->data['instagram'] = $website_infos->instagram; $this->data_header['primary_colortheme'] = $website_infos->primary_color_theme; $this->data_header['website_icon'] = $website_infos->website_icon; //TOP MENUS $this->db->select('*')->from('menus')->where('status', 1)->order_by('priority', 'ASC'); $this->data_header['top_main_menus'] = $this->db->get()->result(); //FOOTER //get left footer $this->db->select('title, title_en, description, description_en')->from('home_footer')->where('id_home_footer', 1); $footer1 = $this->db->get()->row(); if($this->session->userdata('site_lang') == 'english') { $this->data_footer['title1'] = $footer1->title_en; $this->data_footer['description1'] = $footer1->description_en; } else { $this->data_footer['title1'] = $footer1->title; $this->data_footer['description1'] = $footer1->description; } //get left center footer $this->db->select('title, title_en, description, description_en')->from('home_footer')->where('id_home_footer', 2); $footer2 = $this->db->get()->row(); if($this->session->userdata('site_lang') == 'english') { $this->data_footer['title2'] = $footer2->title_en; $this->data_footer['description2'] = $footer2->description_en; } else { $this->data_footer['title2'] = $footer2->title; $this->data_footer['description2'] = $footer2->description; } //get right center footer $this->db->select('title, title_en, description, description_en')->from('home_footer')->where('id_home_footer', 3); $footer3 = $this->db->get()->row(); if($this->session->userdata('site_lang') == 'english') { $this->data_footer['title3'] = $footer3->title_en; $this->data_footer['description3'] = $footer3->description_en; } else { $this->data_footer['title3'] = $footer3->title; $this->data_footer['description3'] = $footer3->description; } //get right footer $this->db->select('title, title_en, description, description_en')->from('home_footer')->where('id_home_footer', 4); $footer4 = $this->db->get()->row(); if($this->session->userdata('site_lang') == 'english') { $this->data_footer['title4'] = $footer4->title_en; $this->data_footer['description4'] = $footer4->description_en; } else { $this->data_footer['title4'] = $footer4->title; $this->data_footer['description4'] = $footer4->description; } //GET SOCIAL MEDIA $this->db->select('facebook, youtube, instagram, twitter')->from('configuration')->where('id_configuration', 1); $this->data_footer['sosmed'] = $this->db->get()->row(); //get banner 1 (english and indonesian) image only for top static banner $this->db->select('banner1_image, banner1en_image')->from('home_centerbanners')->where('id_home_centerbanners', 1); $this->data_header['top_banner'] = $this->db->get()->row(); //LOAD MENU HELPER $this->load->helper('menu'); } } class Admin_controller extends MY_Controller { function __construct() { parent::__construct(); $this->load->helper('cms_helper'); $this->load->model('user_m'); $this->load->library('form_validation'); $this->form_validation->set_error_delimiters('<div class="error">', '</div>'); //above is to add class to form validation error, to be styled $this->load->helper('form'); //logged in check, if loggedin is false, then kickout //first exclude login and logout page from the check $exception_uris = array( 'admin/user/login', 'admin/user/logout' ); if(in_array(uri_string(), $exception_uris) == FALSE) { if($this->user_m->loggedin() == FALSE) { redirect('admin/user/login'); } } //get Website Name $this->db->select('company_name')->from('configuration')->where('id_configuration', 1); $this->data_header['company_name'] = $this->db->get()->row()->company_name; $this->data_header['meta_title'] = 'Administration Page'; } }