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 :  /proc/self/root/var/www/blue-sky.co.id/public_html/application/core/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/self/root/var/www/blue-sky.co.id/public_html/application/core/MY_Controller.php
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class MY_Controller extends MX_Controller 
{	
	protected $data = array();
	protected $data_header = array(); 
	protected $data_footer = array(); 
	protected $theme_no;
	
	function __construct() 
	{
		parent::__construct();
	} 	 

	protected function common_functions() 
	{
		//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 {
				$this->website_active();	
			}
		} else {
			$this->website_active();
		}	
	}

	private function website_active() 
	{	
		$this->load->helper('form'); 
		$this->load->helper('menu');  
		$this->load->model('product_m');
		
		//WEBSITE DETAILS 
		$this->db->select('logo, website_name, facebook, twitter, instagram, youtube, google_analytic_id, tawkto_id, primary_color_theme, website_icon, from_email,alamat, phone, logo, logo_lounge')->from('configuration')->where('id_configuration', 1);
		$website_infos = $this->db->get()->row();
		$this->data_header['logo'] = $website_infos->logo;
		$this->data_header['website_name'] = $website_infos->website_name;
		$this->data_header['google_analytic_id'] = $website_infos->google_analytic_id;
		$this->data_header['email'] = $website_infos->from_email;
		$this->data_header['logo'] = $website_infos->logo;
		$this->data_header['logo_lounge'] = $website_infos->logo_lounge;

		if ($this->uri->segment(1) != 'product') 
		{
			$this->data_header['phone'] = $website_infos->phone;
			$this->data_header['alamat'] = $website_infos->alamat;
		}

		$this->data_footer['facebook'] = $website_infos->facebook;
		$this->data_footer['twitter'] = $website_infos->twitter;
		$this->data_footer['instagram'] = $website_infos->instagram;
		$this->data_footer['youtube'] = $website_infos->youtube;
		$this->data_header['primary_colortheme'] = $website_infos->primary_color_theme;
		$this->data_header['website_icon'] = $website_infos->website_icon;

		//MAIN MENUS
		if($this->session->userdata('site_lang') == 'english') {
			$this->db->select('page_id, id_menus, menu_en as menu, menu_link_en as menu_link')->from('menus')->where('status', 1)->where('parent_id', NULL)->order_by('priority', 'ASC');
		} else {
			$this->db->select('page_id, id_menus, menu, menu_link')->from('menus')->where('status', 1)->where('parent_id', NULL)->order_by('priority', 'ASC');
		}
		$this->data_header['main_menus'] = $this->db->get()->result();	 

		//FOOTERS	
		if($this->session->userdata('site_lang') == 'english') {
			$this->db->select('id_home_footer, title_en as title, description_en as description')->from('home_footer')->where('status', '1')->order_by('priority', 'ASC');
		} else {
			$this->db->select('id_home_footer, title, description')->from('home_footer')->where('status', '1')->order_by('priority', 'ASC');
		}
		$this->data_footer['footers'] = $this->db->get()->result();
		
		//THEME NUMBER INITIALIZE
		$this->theme_no = '1';

		if($this->theme_no == '3')
		{ 
			$p_color = "#7a4397";
			$p_rgbcolor= "rgb(122, 67, 151, 0.7)";
			$this->session->set_userdata('p_color', $p_color);
			$this->session->set_userdata('p_rgbcolor', $p_rgbcolor);
			$this->session->set_userdata('footers', $this->data_footer['footers']);
		}

		//count products
		$this->db->select('*')->from('products');
		$this->data['jml_produk'] = $this->db->get()->num_rows();

		//count users
		$this->db->select('*')->from('users');
		$this->data['jml_user'] = $this->db->get()->num_rows();

		//count users
		$this->db->select('*')->from('warehouse');
		$this->data['jml_gudang'] = $this->db->get()->num_rows();

		//$this->theme_no = '1';
		$this->data_header['theme'] = $this->theme_no; 

		//get all hotels
		$this->data_header['hotels'] = $this->db->select('name, alias, city')->from('hotels')->where('status', '1')->order_by('priority', 'ASC')->get()->result_array(); 

		//get all airport lounges 
		$all_lounges = $this->db->select('title, alias, location')->from('products')->where('product_status', '1')->order_by('priority', 'ASC')->get()->result_array();
		
		// Split lounges into 3 sets: 1st set (4 items), 2nd set (next 4 items), 3rd set (remaining items)
		$this->data_header['lounges_set1'] = array_slice($all_lounges, 0, 4);
		$this->data_header['lounges_set2'] = array_slice($all_lounges, 4, 4);
		$this->data_header['lounges_set3'] = array_slice($all_lounges, 8);
		
		// Keep original lounges array for backward compatibility
		$this->data_header['lounges'] = $all_lounges; 
	}

	protected function send_email($view_file, $email_data, $e_msg = false) {

		//get website data
		$website_data = $this->db->select('logo, from_email, website_name, email_smtp_host, email_smtp_port, email_smtp_password, email_smtp')->from('configuration')->where('id_configuration', 1)->get()->row();
		$email_data['website_name'] = $website_data->website_name;
		$email_data['logo'] = $website_data->logo;

		if (empty($email_data['cc_email'])) {
			$email_data['cc_email'] = '';
		}

		$this->load->library('email');
		$config['protocol'] = 'smtp';
		$config['smtp_host'] = $website_data->email_smtp_host; 
		$config['smtp_port'] = $website_data->email_smtp_port;
		$config['smtp_user'] = $website_data->email_smtp; 
		$config['smtp_pass'] = $website_data->email_smtp_password;
		$config['mailtype'] = 'html';
		$config['smtp_crypto'] = 'ssl';
		$config['charset'] = 'iso-8859-1';
		//$config['charset'] = 'UTF-8';
		$config['wordwrap'] = TRUE;
		$config['newline'] = "\r\n"; //use double quotes to comply with RFC 822 standard 
		$this->email->set_crlf( "\r\n" ); //must add this for hotmail
		$this->email->initialize($config);
		$this->email->from($website_data->from_email, $website_data->website_name);
		$this->email->to($email_data['email']);
		$this->email->cc($email_data['cc_email']);
		$this->email->subject($email_data['subject']); 

		if($e_msg === false){
			$email = $this->load->view($view_file, $email_data, TRUE);   
			$this->email->message($email);	
		}else{     
			$this->email->message($view_file);
		}	

		$respon_email = $this->email->send();
		if(!$respon_email){
			var_dump($this->email->print_debugger()); exit();			
		}
	}
} 

class Public_controller extends MY_Controller 
{
	function __construct() 
	{ 
		parent::__construct();
		$this->common_functions();
	
		$this->data['modules_setting'] = $this->db->select('*')->from('modules')->where('id',1)->get()->row();
		$this->data_header['modules_setting'] = $this->db->select('*')->from('modules')->where('id',1)->get()->row();
		$this->data_footer['modules_setting'] = $this->db->select('*')->from('modules')->where('id',1)->get()->row();	
	} 
} 

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

		// $this->uri->segment(1); // controller
		// $this->uri->segment(2); // action
		// $this->uri->segment(3); // 1stsegment
		// $this->uri->segment(4); // 2ndsegment

		$exception_uris = array(
			'admin/user/lost_password',
			'admin/user/login',
			'admin/user/logout',
		);
		if(in_array(uri_string(), $exception_uris) == FALSE) {
			if($this->user_m->loggedin() == FALSE) {
				$t_uri = $this->uri;
				$combine_uri = $t_uri->segment(1).'/'.$t_uri->segment(2).'/'.$t_uri->segment(3);

				$exception_uris2 = array(
					'admin/user/verify_passwordreset', 
				);

				if(in_array($combine_uri,$exception_uris2) == false) { 
					redirect('admin/user/login');	 
				}
			}
		}

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

		$this->data['theme_no'] = '4'; 

		//check for allowed modules..
		// $allowed_modules = $this->db->select('role_item_name')->from('role_item')->where('role_id', $this->session->userdata('admin')['role_id'])->get()->result();
		// $this->data['admin_allowed_modules'] = array();
		// foreach ($allowed_modules as $index => $module) {
		// 	$this->data['admin_allowed_modules'][] = $module->role_item_name;
		// }
		// $this->data_header['admin_allowed_modules'] = $this->data['admin_allowed_modules'];

		$admin_session = $this->session->userdata('admin');
		$this->data['admin_role_id'] = $admin_session ? $admin_session['role_id'] : null;

		// 1 = SA
		// 2 = HO
		$role = null;
		if ($this->data['admin_role_id']) {
			$role = $this->db->select('*')->from('role')
			->where('id_role', $this->data['admin_role_id'])->get();
		}

		if ($role && $role->num_rows()>0) {
			$role = $role->row();
			$hotel_id = null;
	        if (strpos(strtolower($role->role_name), 'hotel id : ') !== false) {
	            $hotel_id = str_replace('hotel id : ', '', strtolower($role->role_name));
	        }
	    	
	    	$t_loc2 = $this->uri->segment(2);
	    	$t_loc3 = $this->uri->segment(3); 
	    	$t_loc4 = $this->uri->segment(4); 
	        if ($hotel_id != null) {
	        	if (!$this->session->userdata('hotel_id')) {
	        		$this->session->set_userdata('hotel_id',$hotel_id);
	        	}
	        	// echo "<script>alert('".$this->uri->segment(2)."');</script>"; 
		    	$admin_allowed_modules = array( 
					"home_content_hotel",
					"home_slideshow_hotel",
					"home_centerbanners_hotel",
					"testimony_slideshow",
					"rooms",
					"hotel_pages",
					"hotel_menus",
					"hotel_configuration",
		    	);
		    	if ($t_loc2 == "hotels") {
		    		if ($t_loc2.'/'.$t_loc3 != "hotels/landing_page/") {
		    			if ($t_loc4 != $hotel_id) { 
		    				$this->change_loc('hotels/landing_page/'.$hotel_id);
		    			}
		    		}
		    	}else{
		    		if (!in_array($t_loc2, $admin_allowed_modules)){
	    				$this->change_loc('hotels/landing_page/'.$hotel_id); 
					}
		    	}
	        }
		}
	}

	protected function change_loc($str) 
	{
		echo "<script>window.location.href='".base_url('admin/'.$str)."';</script>";
	} 

	//admin resize images
	protected function resize_single_image($width, $height, $upload_path, $image_name) 
	{ 
		$this->load->library('image_lib');
		//image resizing (SMALL IMAGE)
		$config['image_library'] = 'gd2';
		$config['source_image'] = './uploads/'. $upload_path . $image_name;
		$config['new_image'] = './uploads/'. $upload_path;
		$config['create_thumb'] = FALSE;
		$config['maintain_ratio'] = TRUE;
		$config['width'] = $width;
		$config['height'] = $height;
		$this->image_lib->initialize($config);
		$this->image_lib->resize();
	}

	//function to check admin role
	protected function check_admin_role($module_name) 
	{
		$admin_session = $this->session->userdata('admin');
		if (!$admin_session || !isset($admin_session['role_id'])) {
			return;
		}
		$count_module = $this->db->select('id_role_item')->from('role_item')->where('role_id', $admin_session['role_id'])->where('role_item_name', $module_name)->get()->num_rows();
		if($count_module == 0) {
			// redirect('admin/dashboard');
		}
	}
}



https://t.me/RX1948 - 2025