AnonSec Shell
Server IP : 162.214.74.102  /  Your IP : 216.73.216.139
Web Server : Apache
System : Linux dedi-4363141.lrsys.com.br 3.10.0-1160.119.1.el7.tuxcare.els25.x86_64 #1 SMP Wed Oct 1 17:37:27 UTC 2025 x86_64
User : lrsys ( 1015)
PHP Version : 5.6.40
Disable Function : exec,passthru,shell_exec,system
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/lrsys/www/lrsys_projetos/sopizzas/application/controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/lrsys/www/lrsys_projetos/sopizzas/application/controllers/cuisine.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
session_start(); //we need to call PHP's session object to access it through CI
class Cuisine extends MY_Controller {

  function __construct()
  {
     parent::__construct();
     $this->load->helper("url");
     $this->load->helper('form');
     $this->load->library('form_validation');
     $this->load->library('javascript');
     $this->load->library('Ajax_pagination');
     $this->perPage = ROW_PER_PAGE;
     $this->load->model('cuisine_model');
     $session_data = $this->session->userdata('logged_in'); 
     if($this->session->userdata('user_language'))
      {
        $language = $this->session->userdata('user_language');
      }
      else
      {
        $language = $this->config->item("language");
      }
      $data['user_language'] =  $language;
      $this->lang->load('superAdmin', $language);
  }
  function index($SearchBy = '')
  {
    if ($this->input->server('REQUEST_METHOD') == 'POST') {
      if ($this->input->post('EditId') == '') {
        $this->addCuisine();

      }
      else {
        $this->editCuisine();
      }

    }
    else {
      $this->showCuisineList($SearchBy);

    }
  }

  function showCuisineList($SearchBy = '') {
    $PerPage = $this->input->post('Per_Page');

    if(!$PerPage){
        $PerPage = $this->perPage;
    }else{
        $PerPage = $PerPage;
    }


    //total rows count
    $totalRec = count($this->cuisine_model->get_cuisine_list());
    
    //pagination configuration
    $config['target']      = '#postList';
    $config['base_url']    = base_url().'cuisine/ajaxPaginationData/'.$SearchBy;
    $config['total_rows']  = $totalRec;
    $config['per_page']    = $PerPage;
    $this->ajax_pagination->initialize($config);
    
    //get the posts data
    $data['CuisineList'] = $this->cuisine_model->get_cuisine_list(array('limit'=>$PerPage), $SearchBy);

    $data['title']="Cuisine";  
    $data['page']="cuisine"; 
    $this->load->view('superadmin/header',$data);
    $this->load->view('superadmin/main-sidebar');
    $this->load->view('superadmin/cuisine');
    $this->load->view('superadmin/footer');
  }
  function ajaxPaginationData(){
    $page = $this->input->post('page');
    if(!$page){
        $offset = 0;
    }else{
        $offset = $page;
    }

    $action = $this->input->post('action');
    $perpage = $this->input->post('per_page');
    if(!$perpage){
        $perpage = $this->perPage;
    }else{
        $perpage = $perpage;
    }
    
    //total rows count
    $totalRec = count($this->cuisine_model->get_cuisine_list($params = array(), $action));
    
    //pagination configuration
    $config['target']      = '#postList';
    $config['base_url']    = base_url().'cuisine/ajaxPaginationData';
    $config['total_rows']  = $totalRec;
    $config['per_page']    = $perpage;
    $config['action']      = $action;
    $this->ajax_pagination->initialize($config);
    
    //get the posts data
    $data['CuisineList'] = $this->cuisine_model->get_cuisine_list(array('start'=>$offset,'limit'=>$perpage),$action);
    $data['title']="Cuisine";  
    $data['page']="cuisine"; 
    $data['perPageCount'] = $page; 
    /*** Remember what was the last page start ***/
    if ($this->input->post('pagination') != '') {
      $myPage = $this->input->post('page');
      $myAction = $this->input->post('action');
      $myPerPage = $this->input->post('per_page');
      $myAction2 = $this->input->post('action2');
      $paginationArray = array('page' => $myPage, 'action' => $myAction, 'per_page' => $myPerPage, 'action2' => $myAction2, 'page_name' => $data['page'], 'pagination' => $this->input->post('pagination'));
      if ($this->session->userdata('paginationArray')) {
        $this->session->unset_userdata('paginationArray');
      }
      $this->session->set_userdata('paginationArray', $paginationArray);
    }
    /*** Remember what was the last page end ***/
    $this->load->view('superadmin/cuisine-list-ajax', $data, false);
  }

  function addCuisine() {
    /*print_r($this->input->post());
    exit();*/
    $now = date('Y-m-d H:i:s');
    $this->form_validation->set_rules('cuisine_name', 'Cuisine Name', 'trim|required|is_unique[rt_cuisine.cuisine_name]');
    /*if ($_FILES['cuisine_photo']['name'] == '') {
      $this->form_validation->set_rules('cuisine_photo', 'Cuisine Image', 'trim|required');
    }*/
    $this->form_validation->set_rules('cuisine_description', 'Cuisine Description', 'trim|required');
    if ($this->form_validation->run() == FALSE) {
      $this->showCuisineList();
    }
    else {

      if (!empty($_FILES['cuisine_photo']['name']))
      {
       $UpoaldedImageName = $this->do_upload_image('cuisine_photo');
      }else{
        $UpoaldedImageName ='';
      }


      
      $this->db->trans_start();
      $data_up = array(
        'cuisine_name'          =>  $this->input->post('cuisine_name'),
        'cuisine_photo'         =>  $UpoaldedImageName,
        'cuisine_description'   =>  $this->input->post('cuisine_description'),
        'addeddate'             =>  $now
      );
      $this->db->insert('rt_cuisine', $data_up);
      $this->db->trans_complete();
      $this->session->set_flashdata('success_msg', $this->input->post('cuisine_name').' '.$this->lang->line('issuccessfullysaved'));
      redirect('superadmin/cuisine');
    }
  }

  function editCuisine() {
    /*echo('asd');
    exit();*/
    $this->form_validation->set_rules('cuisine_name', 'Cuisine Name', 'trim|required');
    /*if ($_FILES['cuisine_photo']['name'] == '') {
      $this->form_validation->set_rules('cuisine_photo', 'Cuisine Image', 'trim|required');
    }*/
    //$this->form_validation->set_rules('cuisine_description', 'Cuisine Description', 'trim|required');
    if ($this->form_validation->run() == FALSE) {
      $this->showCuisineList();
    }
    else {
      if ($_FILES['cuisine_photo']['name'] != '') {
        $UpoaldedImageName = $this->do_upload_image('cuisine_photo');
        $data_up = array(
          'cuisine_name'          =>  $this->input->post('cuisine_name'),
          'cuisine_photo'         =>  $UpoaldedImageName,
          'cuisine_description'   =>  $this->input->post('cuisine_description')
        );
      }
      else {
        $data_up = array(
          'cuisine_name'          =>  $this->input->post('cuisine_name'),
          'cuisine_description'   =>  $this->input->post('cuisine_description')
        );
      }
      $this->db->trans_start();
      $this->db->where('cuisine_id', $this->input->post('EditId'));
      $this->db->update('rt_cuisine', $data_up);
      $this->db->trans_complete();
      $this->session->set_flashdata('success_msg', $this->input->post('cuisine_name').' '.$this->lang->line('issuccessfullysaved'));
      redirect('superadmin/cuisine');
    }
  }

  function do_upload_image($db_field_name, $old_photo_name = '') {
    $rendid = date('Ymdhis');
    $new_name = $rendid.'_cuisine_photo.jpg';
    $config1 = array(
          'upload_path' => CUISINE_IMAGE_PATH,
          'allowed_types' => "gif|jpg|png|jpeg",
          'overwrite' => TRUE,
          'file_name' => $new_name
          );
    $this->load->library('upload', $config1);
    $this->upload->initialize($config1);
    if($this->upload->do_upload($db_field_name))
    {
    $config2['image_library'] = 'gd2';
    $config2['source_image'] = $this->upload->upload_path.$this->upload->file_name;
    $config2['new_image'] = CUISINE_IMAGE_PATH.'thumbs';
    $config2['maintain_ratio'] = TRUE;
    //$config2['create_thumb'] = TRUE;
    //$config2['thumb_marker'] = '_thumb';
    $config2['width'] = CUISINE_IMAGE_WIDTH;
    $config2['height'] = CUISINE_IMAGE_HEIGHT;
    $this->load->library('image_lib',$config2); 
    $this->image_lib->initialize($config2);

    if ( !$this->image_lib->resize()){
      $this->session->set_flashdata('error_msg', $this->image_lib->display_errors('', '')); 
      } 

    unlink(CUISINE_IMAGE_PATH.$new_name);
    if ($old_photo_name != '' && file_exists(CUISINE_IMAGE_PATH_THUMBS.$old_photo_name)) {
      unlink(CUISINE_IMAGE_PATH_THUMBS.$old_photo_name);
    }
    return $new_name;
    }
    else {
    $error = $this->upload->display_errors();
    $this->session->set_flashdata('error_msg',  $error);
    $this->showCuisineList();
    }
  }

}

Anon7 - 2022
AnonSec Team