https://t.me/RX1948
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/kanvakanva.com/public_html/application/core/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //var/www/kanvakanva.com/public_html/application/core/MY_Controller.php
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class MY_Controller extends CI_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();	
		//please put all code which needs to run on every page here..	
	}
}


class Public_controller extends MY_Controller {

	function __construct() {
		
		parent::__construct();	
		$this->load->library('cart');

		//get website logo
		$this->db->select('logo')->from('configuration')->where('id_configuration', 1);
		$this->data_header['logo'] = $this->db->get()->row()->logo;

		//get social media links
		$this->db->select('facebook, twitter, instagram')->from('configuration')->where('id_configuration', 1);
		$this->data_header['social_media'] = $this->db->get()->row();

		//get top info
		$this->db->select('topinfo')->from('topinfo')->where('id_topinfo', 1);
		$query = $this->db->get();
		$this->data_header['topinfo'] = $query->row()->topinfo;

		//get top main menu details
		$this->db->select('*')->from('menus')->where('status', 1)->order_by('priority', 'ASC');
		$this->data_header['top_main_menus'] = $this->db->get()->result();

		//get all brands 
        $this->db->select('*')->from('brands')->where('status', 1)->order_by('brand', 'ASC');
        $this->data_header['brands'] = $this->db->get()->result();

        //get all categories
        $this->db->select('*')->from('categories')->where('status', 1)->order_by('priority', 'ASC');
        $this->data_header['categories'] = $this->db->get()->result();
                                
		//get footer details
		$this->db->select('*')->from('home_footer')->where('status', 1)->order_by('priority', 'ASC');
		$this->data_footer['home_footer'] = $this->db->get()->result();

		//get Google Analytic Code ID from configuration table
		$this->db->select('google_analytic_id')->from('configuration')->where('id_configuration', 1);
		$this->data_header['google_analytic_id'] = $this->db->get()->row()->google_analytic_id;

	}
	
}


class Customer_controller extends MY_Controller {
	
	function __construct() {

		parent::__construct();
		$this->load->library('cart');

		//get website logo
		$this->db->select('logo')->from('configuration')->where('id_configuration', 1);
		$this->data_header['logo'] = $this->db->get()->row()->logo;

		//get social media links
		$this->db->select('facebook, twitter, instagram')->from('configuration')->where('id_configuration', 1);
		$this->data_header['social_media'] = $this->db->get()->row();

		//get top info
		$this->db->select('topinfo')->from('topinfo')->where('id_topinfo', 1);
		$query = $this->db->get();
		$this->data_header['topinfo'] = $query->row()->topinfo;

		//get top main menu details
		$this->db->select('*')->from('menus')->where('status', 1)->order_by('priority', 'ASC');
		$this->data_header['top_main_menus'] = $this->db->get()->result();

		//get all brands 
        $this->db->select('*')->from('brands')->where('status', 1)->order_by('brand', 'ASC');
        $this->data_header['brands'] = $this->db->get()->result();

        //get all categories
        $this->db->select('*')->from('categories')->where('status', 1)->order_by('priority', 'ASC');
        $this->data_header['categories'] = $this->db->get()->result();
                                
		//get footer details
		$this->db->select('*')->from('home_footer')->where('status', 1)->order_by('priority', 'ASC');
		$this->data_footer['home_footer'] = $this->db->get()->result();

		//get Google Analytic Code ID from configuration table
		$this->db->select('google_analytic_id')->from('configuration')->where('id_configuration', 1);
		$this->data_header['google_analytic_id'] = $this->db->get()->row()->google_analytic_id;

		$this->load->library('form_validation');
		$this->load->model('customer_m');	
		
		//logged in check, if loggedin is false, then kickout
		//first exclude login and logout page from the check
		$exception_uris = array(
			'register',
			'register/new_registration',
			'register/guest_checkout',
			'register/login',
			'register/logout',
			'register/lost_password',
			'register/set_new_password',
			'register/ajax_get_district',
			'register/ajax_get_subdistrict' 
		);
		if(in_array(uri_string(), $exception_uris) == FALSE) {
			
			if($this->customer_m->loggedin() == FALSE) {
					redirect('register', 'refresh');	
			}
		}
	}
}


class Admin_controller extends MY_Controller {
	
	function __construct() {
		parent::__construct();

		//get Website Name
		$this->db->select('website_name')->from('configuration')->where('id_configuration', 1);
		$this->data['website_name'] = $this->db->get()->row()->website_name;

		$this->data['meta_title'] = 'Administration Page';
		$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->model('user_m');	
		
		//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', 'refresh');	
			}
		}
	}
}



https://t.me/RX1948 - 2025