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/mesinpolesshinemate.com/application/controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/mesinpolesshinemate.com/application/controllers/Category.php
<?php defined('BASEPATH') OR exit('No direct script access allowed');

class Category extends Public_Controller {

	public function __construct() {
		parent::__construct();  
	}

	public function get($alias_level1 = NULL, $alias_level2 = NULL, $alias_level3 = NULL) { 

		if ($alias_level1 == NULL) { show_404(); } 

		if ($alias_level1 !== NULL && $alias_level1 != 'all-categories') {

			if($this->session->userdata('site_lang') == 'english') {
				
				//check if this category alias exist 
				$this->db->select('id_categories')->from('categories')->where('alias_en', $alias_level1)->where('parent', NULL)->where('status', 1);
				$count_category_en = $this->db->get()->num_rows();  
				
				if ($count_category_en == 0) {
					
					//category not exist in english alias. So check to indonesian
					$this->db->select('id_categories')->from('categories')->where('alias', $alias_level1)->where('parent', NULL)->where('status', 1);
					$count_category_ind = $this->db->get()->num_rows();  

					if($count_category_ind == 0) {
						
						show_404();	

					} else {

						//category exist in indonesian. get category parameter
						$this->db->select('*')->from('categories')->where('alias', $alias_level1);
						$level1 = $this->db->get()->row(); 
						
						$this->data['level1_id'] = $level1->id_categories; 
						$this->data['level1_title'] = $level1->category;
						$this->data['level1_alias'] = $alias_level1; 

						//change the website session language to indonesian
						$this->session->set_userdata('site_lang', 'indonesian');
						$this->load->helper('language');
						$this->lang->load('website','indonesian'); 
					}	

				} else {

					//category exist for english
					$this->db->select('*')->from('categories')->where('alias_en', $alias_level1);
					$level1 = $this->db->get()->row(); 
					
					$this->data['level1_id'] = $level1->id_categories; 
					$this->data['level1_title'] = $level1->category_en;
					$this->data['level1_alias'] = $alias_level1; 

					//change the website session language to english
					$this->session->set_userdata('site_lang', 'english');
					$this->load->helper('language');
					$this->lang->load('website','english'); 

				}	

			} else {

				//session userdata is Indonesian
				//check if this category alias exist 
				$this->db->select('id_categories')->from('categories')->where('alias', $alias_level1)->where('parent', NULL)->where('status', 1);
				$count_category = $this->db->get()->num_rows();  
				
				if ($count_category == 0) {
					
					//category not exist in indonesian alias. So check to english
					$this->db->select('id_categories')->from('categories')->where('alias_en', $alias_level1)->where('parent', NULL)->where('status', 1);
					$count_category_en = $this->db->get()->num_rows();  

					if($count_category_en == 0) {
						
						show_404();	

					} else {

						//category exist in english. get category parameter
						$this->db->select('*')->from('categories')->where('alias_en', $alias_level1);
						$level1 = $this->db->get()->row(); 
						
						$this->data['level1_id'] = $level1->id_categories; 
						$this->data['level1_title'] = $level1->category_en;
						$this->data['level1_alias'] = $alias_level1; 

						//change the website session language to english
						$this->session->set_userdata('site_lang', 'english');
						$this->load->helper('language');
						$this->lang->load('website','english'); 
					}	

				} else {

					//category exist for indonesian
					$this->db->select('*')->from('categories')->where('alias', $alias_level1);
					$level1 = $this->db->get()->row(); 
					
					$this->data['level1_id'] = $level1->id_categories; 
					$this->data['level1_title'] = $level1->category;
					$this->data['level1_alias'] = $alias_level1; 

					//change the website session language to indonesian
					$this->session->set_userdata('site_lang', 'indonesian');
					$this->load->helper('language');
					$this->lang->load('website','indonesian'); 

				}

			}
		}
		
		//get id for alias level2
		if ($alias_level2 != NULL) {

			if (is_numeric($alias_level2)) {
				# the numeric is for pagination.
				//do nothing...
			} else {

				if($this->session->userdata('site_lang') == 'english') {

					//check if this category alias exist 
					$this->db->select('id_categories')->from('categories')->where('alias_en', 
					$alias_level2)->where('parent', $level1->id_categories)->where('status', 1);
					$count_category = $this->db->get()->num_rows(); 
					
					if ($count_category > 0) {

						//category for english exist
						//if exist, get the Category Id for level 2 category
						$this->db->select('id_categories, category_en')->from('categories')->where('alias_en', $alias_level2)->where('parent', $level1->id_categories);
						$level2 = $this->db->get()->row(); 

						$this->data['level2_id'] = $level2->id_categories; 
						$this->data['level2_title'] = $level2->category_en;
						$this->data['level2_alias'] = $alias_level2; 
					
					} else {

						//category english not exist, check for indonesian
						//check if this category alias exist 
						$this->db->select('id_categories')->from('categories')->where('alias', 
						$alias_level2)->where('parent', $level1->id_categories)->where('status', 1);
						$count_category = $this->db->get()->num_rows(); 

						if($count_category > 0) {
							//category exist
							$this->db->select('id_categories, category')->from('categories')->where('alias', $alias_level2)->where('parent', $level1->id_categories);
							$level2 = $this->db->get()->row(); 
	
							$this->data['level2_id'] = $level2->id_categories; 
							$this->data['level2_title'] = $level2->category;
							$this->data['level2_alias'] = $alias_level2; 

						} else {
							//category not exist
							show_404();
						}

					}

				} else {
					//session language is indonesian
					//check if this category alias exist 
					$this->db->select('id_categories')->from('categories')->where('alias', 
					$alias_level2)->where('parent', $level1->id_categories)->where('status', 1);
					$count_category = $this->db->get()->num_rows(); 
					
					if ($count_category > 0) {

						//category for indonesian exist
						//if exist, get the Category Id for level 2 category
						$this->db->select('id_categories, category')->from('categories')->where('alias', $alias_level2)->where('parent', $level1->id_categories);
						$level2 = $this->db->get()->row(); 

						$this->data['level2_id'] = $level2->id_categories; 
						$this->data['level2_title'] = $level2->category;
						$this->data['level2_alias'] = $alias_level2; 
					
					} else {

						//category indonesian not exist, check for english
						//check if this category alias exist 
						$this->db->select('id_categories')->from('categories')->where('alias_en', 
						$alias_level2)->where('parent', $level1->id_categories)->where('status', 1);
						$count_category = $this->db->get()->num_rows(); 

						if($count_category > 0) {
							//category exist
							$this->db->select('id_categories, category_en')->from('categories')->where('alias_en', $alias_level2)->where('parent', $level1->id_categories);
							$level2 = $this->db->get()->row(); 
	
							$this->data['level2_id'] = $level2->id_categories; 
							$this->data['level2_title'] = $level2->category_en;
							$this->data['level2_alias'] = $alias_level2; 

						} else {
							//category not exist
							show_404();
						}
					}
				}	
			}	
		}

		//get id for alias level3
		if ($alias_level3 != NULL) {

			if (is_numeric($alias_level3)) {
				//Numeric is for pagination. do nothing...
			} else {

				if($this->session->userdata('site_lang') == 'english') {
					
					//session website english
					//check if this category alias exist 
					$this->db->select('id_categories')->from('categories')->where('alias_en', 
					$alias_level3)->where('parent', $level2->id_categories)->where('status', 1);
					$count_category = $this->db->get()->num_rows(); 
					if ($count_category > 0) {

						//category exist in english
						//if exist, get the Category Id & label for level 3 category
						$this->db->select('id_categories, category_en')->from('categories')->where('alias_en', $alias_level3)->where('parent', $level2->id_categories);
						$level3 = $this->db->get()->row(); 

						$this->data['level3_id'] = $level3->id_categories; 
						$this->data['level3_title'] = $level3->category_en;
						$this->data['level3_alias'] = $alias_level3;

					} else {

						//category not exist in english, check for indonesian
						$this->db->select('id_categories')->from('categories')->where('alias', 
						$alias_level3)->where('parent', $level2->id_categories)->where('status', 1);
						$count_category = $this->db->get()->num_rows(); 
						if ($count_category > 0) {

							//if exist, get the Category Id & label for level 3 category
							$this->db->select('id_categories, category')->from('categories')->where('alias', $alias_level3)->where('parent', $level2->id_categories);
							$level3 = $this->db->get()->row(); 

							$this->data['level3_id'] = $level3->id_categories; 
							$this->data['level3_title'] = $level3->category;
							$this->data['level3_alias'] = $alias_level3;

						} else {

							show_404();

						}
					}

				} else {

					//session website indonesian
					//check if this category alias exist 
					$this->db->select('id_categories')->from('categories')->where('alias', 
					$alias_level3)->where('parent', $level2->id_categories)->where('status', 1);
					$count_category = $this->db->get()->num_rows(); 
					if ($count_category > 0) {

						//category exist in indonesian
						//if exist, get the Category Id & label for level 3 category
						$this->db->select('id_categories, category')->from('categories')->where('alias', $alias_level3)->where('parent', $level2->id_categories);
						$level3 = $this->db->get()->row(); 

						$this->data['level3_id'] = $level3->id_categories; 
						$this->data['level3_title'] = $level3->category;
						$this->data['level3_alias'] = $alias_level3;

					} else {

						//category not exist in indonesian, check for english
						$this->db->select('id_categories')->from('categories')->where('alias_en', 
						$alias_level3)->where('parent', $level2->id_categories)->where('status', 1);
						$count_category = $this->db->get()->num_rows(); 
						if ($count_category > 0) {

							//if exist, get the Category Id & label for level 3 category
							$this->db->select('id_categories, category_en')->from('categories')->where('alias_en', $alias_level3)->where('parent', $level2->id_categories);
							$level3 = $this->db->get()->row(); 

							$this->data['level3_id'] = $level3->id_categories; 
							$this->data['level3_title'] = $level3->category_en;
							$this->data['level3_alias'] = $alias_level3;

						} else {

							show_404();

						}
					}
				}
			}	
		}

		//Load model product_m
		$this->load->model('product_m');  

		//get no. of products per page (pagination) from configuration table
		$this->db->select('products_displayed')->from('configuration')->where('id_configuration', 1);
		$per_page = $this->db->get()->row();

		//user request level 1 category
		if ($alias_level1 != NULL && $alias_level1 != 'all-categories') {
			
			//get category parameters 
			// $this->db->select('*')->from('categories')->where('id_categories', 
			// 	$level1->id_categories)->where('parent', NULL);

			$this->db->select('*')->from('categories')->where('id_categories', $level1->id_categories);
			
			$this->data['category'] = $this->db->get()->row();

			//check if post sort_product is exist
			if ($this->input->post('sort_product')) {
				$this->session->set_userdata('sort_product', $this->input->post('sort_product'));
			}

			//PRODUCTS
			//pagination in action 
			$this->load->library('pagination');
			$config = array();
			$this->load->helper('pagination_helper');
			$config = pagination_format();
			$config['base_url'] = base_url() . 'category/' . $alias_level1 . '/'; 
			$config['total_rows'] = $this->product_m->count_products_by_category($this->data['category']->id_categories);    
			$config['per_page'] = $per_page->products_displayed;  
			$config['uri_segment'] = 3;
			$this->pagination->initialize($config);

			//var_dump($config['total_rows']); exit;

			$this->data['sort_product_by'] = $this->session->userdata('sort_product');

			$this->data['sidebanner_active_category_id'] = $this->data['level1_id'];

			$this->data['total_products'] = $config['total_rows'];
			
			$this->data['products'] = $this->product_m->get_products_by_category($this->data['category']->id_categories, $config['per_page'], $this->uri->segment($config['uri_segment'])); 
			
			// var_dump($this->data['products']); exit;

		} 

		//user request level 2 category
		if ($alias_level2 != NULL && is_numeric($alias_level2) == FALSE) {
	
			//get category parameters 
			$this->db->select('*')->from('categories')->where('id_categories', 
				$level2->id_categories)->where('parent', $level1->id_categories);

			$this->data['category'] = $this->db->get()->row(); 

			//check if post sort_product is exist
			if ($this->input->post('sort_product')) {
				$this->session->set_userdata('sort_product', $this->input->post('sort_product'));
			}

			//PRODUCTS  
			//pagination in action 
			//get no. of products per page (pagination) from configuration table
			$this->load->library('pagination');
			$config = array();
			$this->load->helper('pagination_helper');
			$config = pagination_format();
			$config['base_url'] = base_url() . 'category/' . $alias_level1 . '/' . $alias_level2 . '/'; 
			$config['total_rows'] = $this->product_m->count_products_by_category($this->data['category']->id_categories);  
			$config['per_page'] = $per_page->products_displayed; 
			$config['uri_segment'] = 4; 
			$this->pagination->initialize($config);

			$this->data['sort_product_by'] = $this->session->userdata('sort_product');

			$this->data['sidebanner_active_category_id'] = $this->data['level2_id'];

			$this->data['total_products'] = $config['total_rows'];
			
	   		$this->data['products'] = $this->product_m->get_products_by_category($this->data['category']->id_categories, $config['per_page'], $this->uri->segment($config['uri_segment']));  
		} 
		
		//user request level 3 category 
		if ($alias_level3 != NULL && is_numeric($alias_level3) == FALSE) {
			
			//get category parameters 
			$this->db->select('*')->from('categories')->where('id_categories', 
				$level3->id_categories)->where('parent', $level2->id_categories);
			$this->data['category'] = $this->db->get()->row();

			//check if post sort_product is exist
			if ($this->input->post('sort_product')) {
				$this->session->set_userdata('sort_product', $this->input->post('sort_product'));
			}

			//PRODUCTS
			//pagination in action. 
			//get no. of products per page (pagination) from configuration table
			$this->db->select('products_displayed')->from('configuration')->where('id_configuration', 1);
			$per_page = $this->db->get()->row();

			$this->load->library('pagination');
			$config = array();
			$this->load->helper('pagination_helper');
			$config = pagination_format();
			$config['base_url'] = base_url() . 'category/' . $alias_level1 . '/' . $alias_level2 . '/' . $alias_level3 . '/'; 
			$config['total_rows'] = $this->product_m->count_products_by_category($this->data['category']->id_categories);   
			$config['per_page'] = $per_page->products_displayed;  
			$config['uri_segment'] = 5; 
			$this->pagination->initialize($config);

			$this->data['sort_product_by'] = $this->session->userdata('sort_product');
			
			$this->data['sidebanner_active_category_id'] = $this->data['level3_id'];

			$this->data['total_products'] = $config['total_rows'];
			
	   		$this->data['products'] = $this->product_m->get_products_by_category($this->data['category']->id_categories, $config['per_page'], $this->uri->segment($config['uri_segment'])); 
		}
		
	    //set current category to session, so it can be track to product page
		if($alias_level1 != 'all-categories') {
			$this->session->set_userdata('current_viewed_category_id', $this->data['category']->id_categories);	
		}

		if ($alias_level1 == 'all-categories') {

			//check if post sort_product is exist
			if ($this->input->post('sort_product')) {
				$this->session->set_userdata('sort_product', $this->input->post('sort_product'));
			}

			//PRODUCTS
			//pagination in action. 
			//get no. of products per page (pagination) from configuration table
			$this->db->select('products_displayed')->from('configuration')->where('id_configuration', 1);
			$per_page = $this->db->get()->row(); 

			//PRODUCTS
			//pagination in action 
			$this->load->library('pagination');
			$config = array();
			$this->load->helper('pagination_helper');
			$config = pagination_format();
			$config['base_url'] = base_url() . 'category/all-categories/'; 
			$this->load->model('product_m');
			$config['total_rows'] = $this->product_m->count_products_all();
			$config['per_page'] = (int) $per_page->products_displayed; 
			$config['uri_segment'] = 3;
			$this->pagination->initialize($config); 
			
			$this->data['sort_product_by'] = $this->session->userdata('sort_product');

			$this->data['total_products'] = $config['total_rows'];

			$this->data['products'] = $this->product_m->get_products_all($config['per_page'], $this->uri->segment($config['uri_segment']));  

			//get all categories 
			$this->db->select('category, alias, thumbnail')->from('categories')->where('parent', NULL)->where('status', '1')->order_by('priority', 'ASC');
			$this->data['categories'] = $this->db->get()->result(); 
			
			//to display title on product_list view
			$this->data['product_list_title'] = 'collections';

			//get SEO
			$this->db->select('website_name, meta_keywords')->from('configuration')->where('id_configuration', 1);
			$website_name = $this->db->get()->row();
			$this->data_header['browser_title'] =  ucwords($website_name->website_name) . ' - Shop'; 
			$this->data_header['meta_description'] = ucwords($website_name->website_name) . ' - Shop';
			$this->data_header['meta_keywords'] = $website_name->meta_keywords; 

		} else {

			//get SEO
			$this->data_header['browser_title'] = 'Category - ' . ucwords($this->data['category']->category); 
			$this->data_header['meta_description'] = $this->data['category']->meta_description;
			$this->data_header['meta_keywords'] = $this->data['category']->meta_keywords;
		}

		$this->load->helper('product');

		//LOAD LANGUAGE FILES FOR PRODUCT LIST PAGE
		if($this->session->userdata('site_lang') == 'english') {
			$this->lang->load('product_list', 'english');
		} else {
			$this->lang->load('product_list', 'indonesian');
		}

		$this->load->view('template/header', $this->data_header); 
		$this->load->view('product_list', $this->data);
		$this->load->view('template/footer', $this->data_footer); 
	}

}

https://t.me/RX1948 - 2025