403Webshell
Server IP : 103.234.187.230  /  Your IP : 216.73.216.216
Web Server : Apache
System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
User : apache ( 48)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/tripsgateway/application/admin/controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/tripsgateway/application/admin/controllers/GetawaysController(26_12_2019).php
<?php

/* * *************************************************************
 * Catabatic Technology Pvt. Ltd.
 * File Name     : GetawaysController.php
 * Created By    : Mangal Katiyar <mangal@catpl.co.in>
 * Created Date  : 17 Sept 2018
 * Updated Date  : 17 Sept 2018
 * ************************************************************* */

class Admin_GetawaysController extends Zend_Controller_Action {

    public $dbAdapter;
    public $perPageLimit;
    public $siteurl;
    public $DIR_WRITE_MODE;

    public function init() {
        /* Initialize db and session access */
        $aConfig = $this->getInvokeArg('bootstrap')->getOptions();
        $this->siteurl = $aConfig['bootstrap']['siteUrl'];
        $this->appmode = $aConfig['bootstrap']['appmode'];
        $this->per_page_record = 20;
        $this->dbAdapter = Zend_Db_Table::getDefaultAdapter();
        $auth = Zend_Auth::getInstance();
        $authStorage = $auth->getStorage()->read();
        $this->username = $authStorage->username;
        $this->admin_type = $authStorage->role;

        $this->current_time = time();
        $this->table = 'tbl_getaways';
    }

    public function indexAction() {
        $this->checklogin();
        $crud = new Admin_Model_CRUD();
        $resultset = $crud->rv_select_all($this->table, ['*'], ['isMarkForDel'=>0], ['get_id' => 'DESC']);
//          echo "<pre>";print_r($resultset);die; 
        $page = $this->_getParam('page', 1);
        $resultset = Zend_Paginator::factory($resultset);
        $resultset->setItemCountPerPage($this->per_page_record);
        $resultset->setCurrentPageNumber($page);
        # End : Pagination
        $this->view->page = $page;
        $this->view->per_page_record = $this->per_page_record;
        $this->view->resultset = $resultset;
        $this->view->messages = $this->_helper->flashMessenger->getMessages();
    }

    public function editgetawaysAction() {
        $this->checklogin();
        $crud = new Admin_Model_CRUD();
        $pId = (int) $this->getRequest()->getParam("id");
        $result = $crud->getCmsdata($this->table, ['*'], ['get_id' => $pId], ['get_id' => 'DESC']);
       // echo "<pre>";print_r($result);die;
     
        $cityIds = json_decode(trim($result['get_other_cities_ids']),1);
        //echo "<pre>";print_r($cityIds);die;
         if($cityIds !=0){
             if($cityIds[200] !=''){
        $resultOtherlocationcityIds1 =  explode(',', $cityIds[200]);
        $resultOtherlocationcity1= $crud->getCityListByCityArrayIds($cityIds[200]);
        $otherlocationcity1 = array();
        foreach ($resultOtherlocationcityIds1 as $idKey1 => $idValue1) {
                    foreach ($resultOtherlocationcity1 as $otherlocKey1 => $otherlocValue1) {
                         if($idValue1 == $otherlocValue1['CityId']){
                        $otherlocationcity1[] =  [
                            'CityId' => $otherlocValue1['CityId'],
                            'cityTitle' => $otherlocValue1['cityTitle'],
                            'Country' => $otherlocValue1['Country'],
                        ];
                         }
                    }
                }
             }
         //echo "<pre>";print_r($otherlocationcity1);die;
          $resultOtherlocationcityIds2 =  explode(',', $cityIds[400]);
           if($cityIds[400] !=''){
        $resultOtherlocationcity2 = $crud->getCityListByCityArrayIds($cityIds[400]);
        $otherlocationcity2 = array();
        foreach ($resultOtherlocationcityIds2 as $idKey2 => $idValue2) {
                    foreach ($resultOtherlocationcity2 as $otherlocKey2 => $otherlocValue2) {
                         if($idValue2 == $otherlocValue2['CityId']){
                        $otherlocationcity2[] =  [
                            'CityId' => $otherlocValue2['CityId'],
                            'cityTitle' => $otherlocValue2['cityTitle'],
                            'Country' => $otherlocValue2['Country'],
                        ];
                         }
                    }
        }
        }
        $resultOtherlocationcityIds3 =  explode(',', $cityIds[500]);
         if($cityIds[500] !=''){
        $resultOtherlocationcity3 = $crud->getCityListByCityArrayIds($cityIds[500]);
        //echo "<pre>";print_r($resultOtherlocationcityIds2);die;
        $otherlocationcity3 = array();
        foreach ($resultOtherlocationcityIds3 as $idKey3 => $idValue3) {
                    foreach ($resultOtherlocationcity3 as $otherlocKey3 => $otherlocValue3) {
                         if($idValue3 == $otherlocValue3['CityId']){
                        $otherlocationcity3[] =  [
                            'CityId' => $otherlocValue3['CityId'],
                            'cityTitle' => $otherlocValue3['cityTitle'],
                            'Country' => $otherlocValue3['Country'],
                        ];
                         }
                    }
        }
        }
          $resultOtherlocationcityIds4 =  explode(',', $cityIds[600]);
           if($cityIds[600] !=''){
        $resultOtherlocationcity4 = $crud->getCityListByCityArrayIds($cityIds[600]);
        //echo "<pre>";print_r($resultOtherlocationcityIds2);die;
        $otherlocationcity4 = array();
        foreach ($resultOtherlocationcityIds4 as $idKey4 => $idValue4) {
                    foreach ($resultOtherlocationcity4 as $otherlocKey4 => $otherlocValue4) {
                         if($idValue4 == $otherlocValue4['CityId']){
                        $otherlocationcity4[] =  [
                            'CityId' => $otherlocValue4['CityId'],
                            'cityTitle' => $otherlocValue4['cityTitle'],
                            'Country' => $otherlocValue4['Country'],
                        ];
                         }
                    }
                    }
        }
        
       
        
        $this->view->otherlocationcity1 = $otherlocationcity1;
        $this->view->otherlocationcity2 = $otherlocationcity2;
        $this->view->otherlocationcity3 = $otherlocationcity3;
        $this->view->otherlocationcity4 = $otherlocationcity4;
        $this->view->resultData = $result;
        if ($this->getRequest()->isPost()) {
            $getData = $this->getRequest()->getPost();
            if (isset($getData['save']) == "Save") {
                $getId = $getData['get_id'];
                $otherlocationcityName1 = '';
                if(isset($getData['otherlocationcity1']) && trim($getData['otherlocationcity1']) !=''){
                $otherlocationcity1 =  explode(',', $getData['otherlocationcity1']);
                $resultsetCities1 = $crud->getCityListByCityArrayIds($getData['otherlocationcity1']);
               $otherlocationcityName1 = '';
                foreach ($otherlocationcity1 as $otherKey1 => $otherValue1) {
                    foreach ($resultsetCities1 as $cityKey1 => $cityValue1) {
                        if($otherValue1 == $cityValue1['CityId']){
                        if ($otherKey1 != 0) {
                            $otherlocationcityName1 .= ',';
                        }
                        $otherlocationcityName1 .= $cityValue1['cityTitle'];
                    }
                    }
                }
                }
                $otherlocationcityName2 = '';
                if(isset($getData['otherlocationcity2']) && trim($getData['otherlocationcity2']) !=''){
                  $otherlocationcity2 =  explode(',', $getData['otherlocationcity2']);
                $resultsetCities2 = $crud->getCityListByCityArrayIds($getData['otherlocationcity2']);
                
                foreach ($otherlocationcity2 as $otherKey2 => $otherValue2) {
                    foreach ($resultsetCities2 as $cityKey2 => $cityValue2) {
                        if($otherValue2 == $cityValue2['CityId']){
                        if ($otherKey2 != 0) {
                            $otherlocationcityName2 .= ',';
                        }
                        $otherlocationcityName2 .= $cityValue2['cityTitle'];
                    }
                    }
                }
                }
                $otherlocationcity3 = '';
                if(isset($getData['otherlocationcity3']) && trim($getData['otherlocationcity3']) !=''){
                 $otherlocationcity3 =  explode(',', $getData['otherlocationcity3']);
                $resultsetCities3 = $crud->getCityListByCityArrayIds($getData['otherlocationcity3']);
                $otherlocationcityName3 = '';
                foreach ($otherlocationcity3 as $otherKey3 => $otherValue3) {
                    foreach ($resultsetCities3 as $cityKey3 => $cityValue3) {
                        if($otherValue3 == $cityValue3['CityId']){
                        if ($otherKey3 != 0) {
                            $otherlocationcityName3 .= ',';
                        }
                        $otherlocationcityName3 .= $cityValue3['cityTitle'];
                    }
                    }
                }
                }
                $otherlocationcityName4 = '';
                if(isset($getData['otherlocationcity4']) && trim($getData['otherlocationcity4']) !=''){
                 $otherlocationcity4 =  explode(',', $getData['otherlocationcity4']);
                $resultsetCities4 = $crud->getCityListByCityArrayIds($getData['otherlocationcity4']);
                
                foreach ($otherlocationcity4 as $otherKey4 => $otherValue4) {
                    foreach ($resultsetCities4 as $cityKey4 => $cityValue4) {
                        if($otherValue4 == $cityValue4['CityId']){
                        if ($otherKey4 != 0) {
                            $otherlocationcityName4 .= ',';
                        }
                        $otherlocationcityName4 .= $cityValue4['cityTitle'];
                    }
                    }
                }
                }
          }
            
             $otherlocationcityName = json_encode(array('200' => $otherlocationcityName1,'400'=>$otherlocationcityName2,'500'=>$otherlocationcityName3,'600'=>$otherlocationcityName4 ));
                $otherlocationcityId = json_encode(array('200' => $getData['otherlocationcity1'],'400'=>$getData['otherlocationcity2'],'500'=>$getData['otherlocationcity3'],'600'=>$getData['otherlocationcity4']));
                
                $editPageData = [
                    'get_start_city' => ($getData['start_city']),
                    'get_start_city_id' => ($getData['start_city_id']),
                    'get_other_cities' => ($otherlocationcityName),
                   
                    'get_other_cities_ids' => $otherlocationcityId,
                    
                    'status' => ($getData['status']),
                    'CreateDate' => date('Y-m-d H:i:s'),
                    'isMarkForDel' => 0,
                ];

//                echo "<pre>"; print_r($editPageData); die;
                $crud->rv_update($this->table, $editPageData, ['get_id =?' => $getId]);
                $this->view->successMessage = "Page content has been saved successfully.";
                $this->_helper->flashMessenger->addMessage("Page content has been updated successfully.");
                $this->_redirect("/admin/getaways/index");
            }
        }

       



    }


    public function addgetawaysAction() {

//Check admin logedin or not
        $this->checklogin();
        $crud = new Admin_Model_CRUD();

        $pId = (int) $this->getRequest()->getParam("id");
        if ($this->getRequest()->isPost()) {
            $getData = $this->getRequest()->getPost();
            if (isset($getData['save']) == "Save") {
                 // echo "<pre>";print_r($getData);die;
                $otherlocationcityName1 = '';
                if(isset($getData['otherlocationcity1']) && trim($getData['otherlocationcity1']) !=''){
               $otherlocationcity1 =  explode(',', $getData['otherlocationcity1']);
                $resultsetCities1 = $crud->getCityListByCityArrayIds($getData['otherlocationcity1']);
                
                foreach ($otherlocationcity1 as $otherKey1 => $otherValue1) {
                    foreach ($resultsetCities1 as $cityKey1 => $cityValue1) {
                        if($otherValue1 == $cityValue1['CityId']){
                        if ($otherKey1 != 0) {
                            $otherlocationcityName1 .= ',';
                        }
                        $otherlocationcityName1 .= $cityValue1['cityTitle'];
                    }
                    }
                }
                }
                 $otherlocationcityName2 = '';
                if(isset($getData['otherlocationcity2']) && trim($getData['otherlocationcity2']) !=''){
                $otherlocationcity2 =  explode(',', $getData['otherlocationcity2']);
                $resultsetCities2 = $crud->getCityListByCityArrayIds($getData['otherlocationcity2']);
               
                foreach ($otherlocationcity2 as $otherKey2 => $otherValue2) {
                    foreach ($resultsetCities2 as $cityKey2 => $cityValue2) {
                        if($otherValue2 == $cityValue2['CityId']){
                        if ($otherKey2 != 0) {
                            $otherlocationcityName2 .= ',';
                        }
                        $otherlocationcityName2 .= $cityValue2['cityTitle'];
                    }
                    }
                }
                }
                $otherlocationcityName3 = '';
                if(isset($getData['otherlocationcity3']) && trim($getData['otherlocationcity3']) !=''){
                 $otherlocationcity3 =  explode(',', $getData['otherlocationcity3']);
                $resultsetCities3 = $crud->getCityListByCityArrayIds($getData['otherlocationcity3']);
                
                foreach ($otherlocationcity3 as $otherKey3 => $otherValue3) {
                    foreach ($resultsetCities3 as $cityKey3 => $cityValue3) {
                        if($otherValue3 == $cityValue3['CityId']){
                        if ($otherKey3 != 0) {
                            $otherlocationcityName3 .= ',';
                        }
                        $otherlocationcityName3 .= $cityValue3['cityTitle'];
                    }
                    }
                }
                }
                $otherlocationcityName4 = '';
                if(isset($getData['otherlocationcity4']) && trim($getData['otherlocationcity4']) !=''){
                 $otherlocationcity4 =  explode(',', $getData['otherlocationcity4']);
                $resultsetCities4 = $crud->getCityListByCityArrayIds($getData['otherlocationcity4']);
                
                foreach ($otherlocationcity4 as $otherKey4 => $otherValue4) {
                    foreach ($resultsetCities4 as $cityKey4 => $cityValue4) {
                        if($otherValue4 == $cityValue4['CityId']){
                        if ($otherKey4 != 0) {
                            $otherlocationcityName4 .= ',';
                        }
                        $otherlocationcityName4 .= $cityValue4['cityTitle'];
                    }
                    }
                }
                }
                
                
                $otherlocationcityName = json_encode(array('200' => $otherlocationcityName1,'400'=>$otherlocationcityName2,'500'=>$otherlocationcityName3,'600'=>$otherlocationcityName4 ));
                $otherlocationcityId = json_encode(array('200' => $getData['otherlocationcity1'],'400'=>$getData['otherlocationcity2'],'500'=>$getData['otherlocationcity3'],'600'=>$getData['otherlocationcity4']));
                $savePageData = [
                    'get_start_city' => ($getData['start_city']),
                    'get_start_city_id' => ($getData['start_city_id']),
                    'get_other_cities' => ($otherlocationcityName),
                    'get_other_cities_ids' => $otherlocationcityId,
                    'status' => ($getData['status']),
                    'CreateDate' => date('Y-m-d H:i:s'),
                    'isMarkForDel' => 0,
                ];
             //echo "<pre>";print_r($savePageData);die;
                $crud->rv_insert($this->table, $savePageData);
                $this->view->successMessage = "Page content has been saved successfully.";
                $this->_helper->flashMessenger->addMessage("Page content has been added successfully.");
                $this->_redirect("/admin/getaways/index");
            }
        }

        $this->view->messages = $this->_helper->flashMessenger->getMessages();
    }

    public function deletegetawaysAction() {
        $this->checklogin();
        $crud = new Admin_Model_CRUD();
        $tId = (int) $this->getRequest()->getParam("id");
        //echo $tId;die;
        if ($tId) {
            $checkdata = $crud->rv_select_row($this->table, ['get_id'], ['get_id' => $tId], ['get_id' => 'ASC']);
            if (count($checkdata) > 0) {
                $crud->rv_update($this->table, ['isMarkForDel' => 1], ['get_id =?' => $tId]);
                $this->_helper->flashMessenger->addMessage("Delete successfully.");
                $this->_redirect("/admin/getaways/index");
            } else {
                die('Oops some thing wrong!!.');
            }
        }
    }
    public function getMultiCitydataAction() {
        $this->_helper->viewRenderer->setNoRender(true);
        $this->_helper->layout->disableLayout();
        $crud = new Admin_Model_CRUD();
//       print_r($this->getRequest()->getParam("term"));
//       exit;
        try {
            $arrResponse = array();
            if ($this->getRequest()->getParam("term") or $this->getRequest()->getParam("query")) {
                $term = $this->getRequest()->getParam("term") ? $this->getRequest()->getParam("term") : $this->getRequest()->getParam("query");
                $countryId = $this->getRequest()->getParam("countryId") ? $this->getRequest()->getParam("countryId") : '';

                $condCity = "tbl.Title like '" . $term . "%'";
                if (isset($countryId) && !empty($countryId)) {
                    $condCity .= " AND tbl.ContSysId = " . $countryId . "";
                }
                //echo $condCity;
                $arrResponse = $crud->getBuyHotelCityAutoSuggest($condCity);
//                 print_r($arrResponse);die;
            }
            $arrResponseF = array();
            foreach($arrResponse as $key=>$response){
               $arrResponseF[$key]['CityId'] = $response['CityId'];
               $arrResponseF[$key]['Title'] =  ($response['label']);
               $arrResponseF[$key]['label'] =  ($response['label']);
               $arrResponseF[$key]['CityName'] =  stripslashes($response['CityName']);
               $arrResponseF[$key]['CountryId'] =  stripslashes($response['countryTitle']);
            }
            echo json_encode($arrResponseF);
            exit;
        } catch (Exception $e) {
            $response = array('success' => false, 'msg' => $e->getMessage());
            echo json_encode($response);
            exit;
        }
    }

    public function sanitize_data($string) {
        $searchArr = array("iframe", "script", "document", "write", "alert", "%", "@", "$", ";", "+", "|", "#", "<", ">", ")", "(", "'", "\'", ",", "and ", " &", "& ", "and", " and", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9");
        $input_data = strtolower($string);
        $input_data = str_replace($searchArr, "", $input_data);

        $input_data = str_replace(" ", "-", $input_data);
        //echo $input_data; die;
        return $input_data;
    }

    /**
     * checklogin() method is used to check admin logedin or not
     * @param Null
     * @return Array 
     */
    public function checklogin() {
        if (($this->admin_type == "superadmin") || ($this->admin_type == "admin")) {
            $auth = Zend_Auth::getInstance();
            $hasIdentity = $auth->hasIdentity();
            /*             * ************* check admin identity *********** */
            if (!$hasIdentity) {
                $this->_redirect('admin/index/index');
            }
        } else {
            $this->_redirect('admin/index/index');
        }
    }

}

Youez - 2016 - github.com/yon3zu
LinuXploit