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/About.php
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class About extends Admin_Controller {
		
	function __construct() {

		parent::__construct();

		//admin role module check
		$this->check_admin_role('about'); //method from Admin_controller
		
		$this->load->model('about_m');	
	} 
		
	//this is to list all about
	public function index() {
		$this->edit(1);
    }
	
	//to edit about in admin
	public function edit($id = NULL) {

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

		$this->data['about'] = $this->about_m->get($id);	
		
		$fields = [
		    'hero_title',
		    'intro_title',
		    'intro_subtitle',
		    'about_title',
		    'about_subtitle',
		    'history_title',
		    'history_subtitle',
		    'team_tag',
		    'team_title',
		    'tean_subtitle',
		    'vision_title',
		    'vision_subtitle',
		    'mission_title',
		    'mission_subtitle',
		    'value_title',
		    'value_subtitle',
		];

		$config = [];
		foreach ($fields as $field) {
		    $config[] = [
		        'field' => $field,
		        'label' => ucwords(str_replace('_', ' ', $field)),
		        'rules' => 'trim'
		    ];
		} 
 

		$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 upload files	

				$data = [];
				foreach ($fields as $field) {
				    $data[$field] = $this->input->post($field);
				}

				$image_fields = [
				    'hero_image', 'intro1_image', 'intro2_image', 'about_image',
				    'history_image', 'mission_image', 'value_image'
				];

				foreach ($image_fields as $field) {
				    if (isset($_FILES[$field]) && $_FILES[$field]['size'] !== 0) {
				        $upload_config['upload_path'] = './uploads/page/';
				        $upload_config['allowed_types'] = 'jpg|jpeg|png|gif';
				        $upload_config['max_size'] = '2048'; // 2MB
				        $this->load->library('upload', $upload_config);
				        $this->upload->initialize($upload_config);

				        if ($this->upload->do_upload($field)) {
				            $upload_data = $this->upload->data();
				            $data[$field] = $upload_data['file_name'];
				            $this->resize_promo_banners('800', '500', 'page/', $upload_data['file_name']);
				        } else {
				            $this->session->set_flashdata('error', '<br><p style="background:orange; color:white; padding:5px; font-weight:bold;">Error uploading ' . $field . ': ' . $this->upload->display_errors() . '</p>');
				            redirect('admin/about/edit/' . $id);
				        }
				    }
				} 

			$this->about_m->edit_about($id, $data);

			$this->session->set_flashdata('success', '<br><p style="background:green; color:white; padding:5px; font-weight:bold;">About Berhasil di Edit</p>');
			
			redirect('admin/about');
			
			}
		} 
		
		$this->data['subview'] = 'admin/about/edit';
		$this->load->view('admin/templates/header', $this->data_header); 
		$this->load->view('admin/_layout_main', $this->data);
		$this->load->view('admin/templates/footer');	
	}
	 
	
	//function to resize promo banners
	public function resize_promo_banners($width, $height, $folder, $filename) {
		$config['image_library'] = 'gd2';
		$config['source_image'] = './uploads/' . $folder . $filename;
		$config['maintain_ratio'] = TRUE;
		$config['width'] = $width;
		$config['height'] = $height;
		$this->load->library('image_lib', $config);
		if (!$this->image_lib->resize()) {
			echo $this->image_lib->display_errors();
		}
		$this->image_lib->clear();
	}

	//function to delete image
	public function delete_image($field_name) {
		$id = 1; // About table has only one record
		$about = $this->about_m->get($id);
		
		if (!empty($about->$field_name)) {
			// Delete the file from server
			$file_path = './uploads/page/' . $about->$field_name;
			if (file_exists($file_path)) {
				unlink($file_path);
			}
			
			// Update database to remove filename
			$data = [$field_name => ''];
			$this->about_m->edit_about($id, $data);
			
			$this->session->set_flashdata('success', '<br><p style="background:green; color:white; padding:5px; font-weight:bold;">Image berhasil dihapus</p>');
		}
		
		redirect('admin/about/edit/' . $id);
	}

}

https://t.me/RX1948 - 2025