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

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

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

class Testimony extends Admin_Controller {
		
	function __construct() {

		parent::__construct();

		if (!in_array('testimony', $this->allowed_sections)) redirect('admin/dashboard'); 
		
		$this->load->model('testimony_m');	  
	} 
		
	//this is to list all testimony   
	public function index() { 

		if (isset($_POST['submit'])) 
		{
				//store image information to configuration table
				$data = array(
						'testimony_title' => $this->security->xss_clean($this->input->post('testimony_title')),
				);
				$this->db->where('id_configuration', 1);
				$this->db->update('configuration', $data); 

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

		//get landingpage banner image, description and link
		$this->db->select('testimony_title')->from('configuration')->where('id_configuration', 1);
		$this->data['testimony_landingpage'] = $this->db->get()->row();
		
		//pagination in action. 20 results per page 
		$this->load->library('pagination');
		$config['base_url'] = base_url() . 'admin/testimony/index';
		$config['per_page'] = 40;
		$config["uri_segment"] = 4; 

		//fetch all testimony
		$config['total_rows'] = $this->testimony_m->record_count();  
		$this->pagination->initialize($config);
   		$this->data['testimony'] = $this->testimony_m->get_all_testimony($config["per_page"], 
		$this->uri->segment(4)); 
	
		//load view
		$this->data['subview'] = 'admin/testimony/index';
		$this->load->view('admin/templates/header', $this->data_header); 
		$this->load->view('admin/_layout_main', $this->data);
		$this->load->view('admin/templates/footer', $this->data_footer);
		
    }
	
	//to add a new testimony
	public function add() {
	
		$this->data['testimony'] = $this->testimony_m->get_new();	

		//get ordering number and display at add form
		$this->db->select_max('priority')->from('testimonies');
		$current_priority = $this->db->get()->row()->priority;
		if($current_priority == NULL) {
			$this->data['testimony']->priority = 1;	
		} else {
			$this->data['testimony']->priority = $current_priority + 1;
		}  
		
		//validation check in action
		$config = array( 
                  array(
                     'field'   => 'customer_name',
                     'label'   => 'Customer Name',
                     'rules'   => 'trim|required'
                  ),
									array(
										'field'   => 'company',
										'label'   => 'Company',
										'rules'   => 'trim'
								 ),
                  array(
                     'field'   => 'testimony',
                     'label'   => 'Testimony',
                     'rules'   => 'trim|required|max_length[1000]'
                  ),  
                  array(
                     'field'   => 'priority',
                     'label'   => 'Priority',
                     'rules'   => 'trim|required|numeric'
                  ),  
				  				array(
                     'field'   => 'status',
                     'label'   => 'status',
                     'rules'   => 'trim|required'
                  ),
            );

		$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($config); 

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

				//check & processing image banner upload files	
				if ($_FILES['userfile']['size'] !== 0) {  	

					$config['upload_path'] = './uploads/page/'; 
					$config['allowed_types'] = '*';  
					// $config['allowed_types'] = 'jpg|png|jpeg|webp'; 
					$config['max_size']	= '300';
					
					$this->load->library('upload', $config); 

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

		        //echo $this->upload->display_errors(); die();
							
						$this->session->set_flashdata('error', '<br>
							<p style="background:orange; color:white; padding:5px; font-weight:bold;">Kesalahan Unggah Gambar. Format atau ukuran salah.</p>');
						redirect('admin/testimony/add');
					
					} else {

					$image = $this->upload->data();
					$image_filename = $image['file_name']; 	 

					}	
				} 

				$data = array(
					'customer_name' => $this->input->post('customer_name'),
					'work_position' => $this->input->post('company'),
          'testimony' => $this->input->post('testimony'),
					'priority' => $this->input->post('priority'),
					'status' => $this->input->post('status'),
					'type'	=> $this->input->post('type'),
				);

				//image upload
				if (isset($image_filename)) {
					$data['image'] = $image_filename;
				} 

				$this->testimony_m->add_testimony($data);

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

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

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

		$this->data['testimony'] = $this->testimony_m->get($id);	
		
		//validation check in action
		$config = array( 
                array(
                     'field'   => 'customer_name',
                     'label'   => 'Customer Name',
                     'rules'   => 'trim|required'
                  ),
									array(
										'field'   => 'company',
										'label'   => 'Company',
										'rules'   => 'trim'
								 ),
                  array(
                     'field'   => 'testimony',
                     'label'   => 'Testimony',
                     'rules'   => 'trim|required|max_length[1000]'
                  ),  
                  array(
                     'field'   => 'priority',
                     'label'   => 'Priority',
                     'rules'   => 'trim|required|numeric'
                  ),  
				  				array(
                     'field'   => 'status',
                     'label'   => 'status',
                     'rules'   => 'trim|required'
                  ),       
            );

		$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($config); 

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

				//check & processing image banner upload files	
				if ($_FILES['userfile']['size'] !== 0) {  	

					$config['upload_path'] = './uploads/page/'; 
					$config['allowed_types'] = '*';  
					// $config['allowed_types'] = 'jpg|png|jpeg|webp'; 
					$config['max_size']	= '300';
					
					$this->load->library('upload', $config); 

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

		        //echo $this->upload->display_errors(); die();
							
						$this->session->set_flashdata('error', '<br>
							<p style="background:orange; color:white; padding:5px; font-weight:bold;">Kesalahan Unggah Gambar. Format atau ukuran salah.</p>');
						redirect('admin/testimony/edit/' . $id);
					
					} else {

					$image = $this->upload->data();
					$image_filename = $image['file_name']; 	 
					 
					}	
				}


				$data = array(
					'customer_name' => $this->input->post('customer_name'),
					'work_position' => $this->input->post('company'),
          'testimony' => $this->input->post('testimony'),
					'priority' => $this->input->post('priority'),
					'status' => $this->input->post('status'),
					'type'	=> $this->input->post('type'),
				);

				//image upload
				if (isset($image_filename)) {
					$data['image'] = $image_filename;
				} 

			$this->testimony_m->edit_testimony($id, $data);

			$this->session->set_flashdata('success', '<br><p style="background:green; color:white; padding:5px; font-weight:bold;">Testimony Edited</p>');
			
			redirect('admin/testimony/edit/' . $id);
			}
		} 
		
		$this->data['subview'] = 'admin/testimony/edit';
		$this->load->view('admin/templates/header', $this->data_header);
		$this->load->view('admin/_layout_main', $this->data);
		$this->load->view('admin/templates/footer', $this->data_footer);	
	}
	
	
	//to delete a testimony
	public function delete($id) {

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

		//delete brand
		$this->testimony_m->delete($id);

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

	//To delete customer photo file from server, and from database
	public function delete_customer_photo($id = NULL) { 

		$count = $this->testimony_m->count_exist($id);

		if ($id == NULL || $count == 0) {	  
			redirect('admin/testimony');
		}

		//get customer image file name for deletion
		$this->db->select('image')->from('testimonies')->where('id_testimonies', (int) $id);
		$image = $this->db->get()->row();

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

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

		$this->db->where('id_testimonies', (int) $id);
		$this->db->update('testimonies', $data);	

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

https://t.me/RX1948 - 2025