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

class Portfolio_category extends Admin_Controller 
{		
		function __construct() 
		{
				parent::__construct();

				if (!in_array('portfolio category', $this->allowed_sections)) redirect('admin/dashboard'); 
				
				$this->load->model('portfolio_category_m'); 	  
		} 
			
		//this is to list all portfolio_category    
		public function index() 
		{
				//pagination in action. 20 results per page  
				$this->load->library('pagination');
				$config['base_url'] = base_url() . 'admin/portfolio_category/index';
				$config['per_page'] = 40;
				$config["uri_segment"] = 4; 

				//fetch all portfolio_category
				$config['total_rows'] = $this->portfolio_category_m->record_count();  
				$this->pagination->initialize($config);
				$this->data['portfolio_category'] = $this->portfolio_category_m->get_all_portfolio_category($config["per_page"], 
				$this->uri->segment(4)); 
			
				//load view
				$this->data['subview'] = 'admin/portfolio_category/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 portfolio_category
		public function add() 
		{
				$this->data['portfolio_category'] = $this->portfolio_category_m->get_new();	

				//get ordering number and display at add form 
				$this->db->select_max('priority')->from('portfolios_category');
				$current_priority = $this->db->get()->row()->priority;
				if($current_priority == NULL) 
				{
						$this->data['portfolio_category']->priority = 1;	
				} 
				else 
				{
						$this->data['portfolio_category']->priority = $current_priority + 1;
				}  
				
				//validation check in action
				$config = array( 
					array(
								'field'   => 'name', 
								'label'   => 'Name',
								'rules'   => 'trim|required'
						),
						array(
								'field'   => 'content',
								'label'   => 'content',
								'rules'   => 'trim|required|max_length[350]'
						),  
						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 = array();
							$config['upload_path'] = './uploads/page/'; 
							$config['allowed_types'] = '*';  
							// $config['allowed_types'] = 'jpg|png|jpeg|webp'; 
							// $config['max_size']	= '500';
							
							$this->load->library('upload', $config);  
							$this->upload->initialize($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/portfolio_category/add');
							
							} else {

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

							}	
						} 

						$data = array(
							'name' => $this->input->post('name'),
							'alias' => url_title($this->input->post('name')),
							'content' => $this->input->post('content'),
							'priority' => $this->input->post('priority'),
							'status' => $this->input->post('status'),
						);

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

						$this->portfolio_category_m->add_portfolio_category($data);

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

						redirect('admin/portfolio_category');
					}
				} 
				
				$this->data['subview'] = 'admin/portfolio_category/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->portfolio_category_m->count_exist($id); 
				
				if ($count == 0) {
					//page not exist
					show_404();
				}		

				$this->data['portfolio_category'] = $this->portfolio_category_m->get($id);	
			
				//validation check in action
				$config = array( 
						array(
								'field'   => 'name',
								'label'   => 'Name',
								'rules'   => 'trim|required'
						),
						array(
								'field'   => 'content',
								'label'   => 'content',
								'rules'   => 'trim|required|max_length[350]'
						),  
						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) 
				{	
						//check & processing image banner upload files	
						if ($_FILES['userfile']['size'] !== 0) 
						{  	
								$config = array();
								$config['upload_path'] = './uploads/page/'; 
								$config['allowed_types'] = '*';  
								// $config['allowed_types'] = 'jpg|png|jpeg|webp'; 
								// $config['max_size']	= '500';
								
								$this->load->library('upload', $config); 
								$this->upload->initialize($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/portfolio_category/edit/' . $id);
								} 
								else 
								{
										$image = $this->upload->data();
										$image_filename = $image['file_name']; 	 
								}	
						}

						$data = array(
								'name' => $this->input->post('name'),
								'alias' => url_title($this->input->post('name')),
								'content' => $this->input->post('content'),
								'priority' => $this->input->post('priority'),
								'status' => $this->input->post('status'),
						);

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

						$this->portfolio_category_m->edit_portfolio_category($id, $data);

						$this->session->set_flashdata('success', '<br><p style="background:green; color:white; padding:5px; font-weight:bold;">portfolio_category success edit</p>');
					
						redirect('admin/portfolio_category');
				} 
			
				$this->data['subview'] = 'admin/portfolio_category/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 portfolio_category
		public function delete($id) 
		{
				//check if id exist. If not exist, show 404.
				$count = $this->portfolio_category_m->count_exist($id);
				
				if ($count == 0) 
				{  
						//page not exist 
						show_404();
				}		
				
				//delete brand
				$this->portfolio_category_m->delete($id);

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

		//To delete customer photo file from server, and from database
		public function delete_customer_photo($id = NULL) 
		{ 
				$count = $this->portfolio_category_m->count_exist($id);

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

				//get customer image file name for deletion
				$this->db->select('image')->from('portfolios_category')->where('id', (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', (int) $id);
				$this->db->update('portfolios_category', $data);	

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

https://t.me/RX1948 - 2025