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/maxurtrip/application/admin/controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/maxurtrip/application/admin/controllers/SyncController.php
<?php
/***************************************************************
* Catabatic Technology Pvt. Ltd.
* File Name     : ContactusController.php
* File Desc.    : Contactus controller managed all contact queries
* Created By    : Piyush Tiwari <piyush@catpl.co.in>
* Created Date  : 05 July 2018
* Updated Date  : 05 July 2018
***************************************************************/


class Admin_SyncController extends Zend_Controller_Action
{
    
    public $dbAdapter;
    public $perPageLimit;

    
    public function init()
    {

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

	  // $_SERVER["DOCUMENT_ROOT"] = $_SERVER["DOCUMENT_ROOT"].'/holidaybazaar';
    }
    
    /**
    * index() method is used to admin login for form call
    * @param Null
    * @return Array 
    */
    public function indexAction()
    {
        //Check admin logedin or not
        $this->checklogin();
        $this->view->baseUrl = $this->siteurl;
    }
    
    
    /**
    * packagesAction() method is used to admin login for form call
    * @param Null
    * @return json
    */
    public function packagesAction()
    {
        //Check admin logedin or not
        $this->checklogin();
        
        $apiData = [];
        try {
            $curl = curl_init($this->siteurl . "api/sync/index?type=packages" );
            curl_setopt($curl, CURLOPT_POST, true);
            curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($apiData));
            curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
            $curl_response = curl_exec($curl);
            curl_close($curl);
            $this->view->response = $curl_response; // send response to the view page
        } catch (Exception $error) {
            $this->view->error_msg = $error->getMessage();
            die;
        }
        
        $response_array  = [];
        
        $response_array = Zend_Json::decode($curl_response);
        
        if($response_array['status']) {
            $this->view->msg = $response_array['msg'];
        }
        
    }

    
    /**
    * destinationsAction() method is used to admin login for form call
    * @param Null
    * @return json
    */
    public function destinationsAction()
    {
        //Check admin logedin or not
        $this->checklogin();
        
        $apiData = [];
        try {
            $curl = curl_init($this->siteurl . "api/sync/index?type=destinations" );
            curl_setopt($curl, CURLOPT_POST, true);
            curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($apiData));
            curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
            $curl_response = curl_exec($curl);
            echo "<pre>";print_r($curl_response);die;
            curl_close($curl);
            $this->view->response = $curl_response; // send response to the view page
        } catch (Exception $error) {
            $this->view->error_msg = $error->getMessage();
            die;
        }
        
        $response_array  = [];
        
        $response_array = Zend_Json::decode($curl_response);
        
        if($response_array['status']) {
            $this->view->msg = $response_array['msg'];
        }

    }

    
    /**
    * hotelsAction() method is used to admin login for form call
    * @param Null
    * @return json
    */
    public function hotelsAction()
    {
        //Check admin logedin or not
        $this->checklogin();
        
        $apiData = [];
        try {
            $curl = curl_init($this->siteurl . "api/sync/index?type=hotels" );
            curl_setopt($curl, CURLOPT_POST, true);
            curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($apiData));
            curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
            $curl_response = curl_exec($curl);
            curl_close($curl);
            $this->view->response = $curl_response; // send response to the view page
        } catch (Exception $error) {
            $this->view->error_msg = $error->getMessage();
            die;
        }
        
        $response_array  = [];
        
        $response_array = Zend_Json::decode($curl_response);
        
        if($response_array['status']) {
            $this->view->msg = $response_array['msg'];
        }
        
    }

    
    
    /**
    * activitiesAction() method is used to admin login for form call
    * @param Null
    * @return json
    */
    public function activitiesAction()
    {
        //Check admin logedin or not
        $this->checklogin();

        $apiData = [];
        try {
            $curl = curl_init($this->siteurl . "api/sync/index?type=activities" );
            curl_setopt($curl, CURLOPT_POST, true);
            curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($apiData));
            curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
            $curl_response = curl_exec($curl);
            curl_close($curl);
            $this->view->response = $curl_response; // send response to the view page
        } catch (Exception $error) {
            $this->view->error_msg = $error->getMessage();
            die;
        }
        
        $response_array  = [];
        
        $response_array = Zend_Json::decode($curl_response);
        
        if($response_array['status']) {
            $this->view->msg = $response_array['msg'];
        }
        
    }

    
    
    public function filterdestinamtionAction()
    {
        //Check admin logedin or not
        $this->checklogin();
        $status = false;
        $apiData = [];
        $apiData["AgencySysId"] = Catabatic_Helper::getAgencyId();
        $url = Catabatic_Helper::gtxBtoBsite();
        try {
            $curl = curl_init($url."gtxwebservices/createxml/package-destinations");
            curl_setopt($curl, CURLOPT_POST, true);
            curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($apiData));
            curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
            $curl_response = curl_exec($curl);
            
// send response to the view page
        
        
        $JSONFileName = "public/data/dynamic/package_destinations.json";
        file_put_contents($JSONFileName, $curl_response);
        
        $responseArray = Zend_Json::decode($curl_response);
//        echo "<pre>";print_r($responseArray);die('here');
        
        $crud   = new Admin_Model_CRUD();
        $resionArr = array();
         $countryArr = array();
        $resionResult  = $crud->rv_select_all("tbl_regions",['label'] ,  ['status'] , ['title'=>'ASC' ] );
        foreach ($resionResult as $resultkey => $resultvalue) {
            $resionArr[] = $resultvalue['label'];
        }
       
        $countryResult  = $crud->rv_select_all("tbl_countries",['label'] ,  ['status'] , ['title'=>'ASC' ] );
        foreach ($countryResult as $contkey => $contvalue) {
            $countryArr[] = $contvalue['label'];
        }
      
        $reasonInsertArray = array();
        $countryInsertArray = array();
        $stateInsertArray = array();
        $cityInsertArray = array();
        foreach ($responseArray as $resionkey => $resionvalue) {
    
            if($resionvalue['TypeTitle'] == 'region'){
                if (!in_array($resionvalue['label'], $resionArr)) {
               
            $reasonInsertArray = [
                'title' => $resionvalue['value'],
                'label' => $resionvalue['label'],
                'image' => '',
                'UpdateDate' => date('Y-m-d H:i:s'),
                'CreateDate' => date('Y-m-d H:i:s'),
                'IsActive' => 1,
                'IsMarkForDel' => 0,
            ];
             $resionArr[] = $resionvalue['label'];
             try {
                    $resionIDS[] = $crud->rv_insert('tbl_regions', $reasonInsertArray);
                } catch (Zend_Exception $e) {
                            echo "1----" . $e->getMessage();
                            exit;
                        }
             
            } 
            }
          
            if($resionvalue['TypeTitle'] == 'country'){
                if (!in_array($resionvalue['label'], $countryArr)) {
               
                $countryInsertArray = [
                    'title' => $resionvalue['value'],
                    'label' => $resionvalue['label'],
                    'seotitle' => strtolower(Catabatic_Helper::getSeoName($resionvalue['value'])),
                    'countryId' => $resionvalue['id'],
                    'image' => '',
                    'region_id' => 0,
                    'UpdateDate' => date('Y-m-d H:i:s'),
                    'CreateDate' => date('Y-m-d H:i:s'),
                    'IsActive' => 1,
                    'IsMarkForDel' => 0,
                ];
                // echo "<pre>";print_r($resionvalue);die;
                 $countryArr[] = $resionvalue['label'];
                try {
                    $countryIDS[] = $crud->rv_insert('tbl_countries', $countryInsertArray);
                } catch (Zend_Exception $e) {
                            echo "2----" . $e->getMessage();
                            exit;
                        }
                 
                } 
            }
              
            if ($resionvalue['TypeTitle'] == 'state') {
                    $stateResult = $crud->checkStateData($resionvalue['id']);
                    if (count($stateResult) == 0) {
                        $stateInsertArray = [
                            'title' => $resionvalue['value'],
                            'label' => $resionvalue['label'],
                            'seotitle' => strtolower(Catabatic_Helper::getSeoName($resionvalue['value'])),
                            'stateId' => (int)$resionvalue['id'],
                            'CountryIds' => $resionvalue['ContId'],
                            'Countries' => $resionvalue['countryName'],
                            
                            'UpdateDate' => date('Y-m-d H:i:s'),
                            'CreateDate' => date('Y-m-d H:i:s'),
                            'IsActive' => 1,
                            'IsMarkForDel' => 0,
                        ];
                        try {
                            $crud->rv_insert('tbl_states', $stateInsertArray);
                        } catch (Zend_Exception $e) {
                            echo "3----" . $e->getMessage();
                            exit;
                        }
                    }
                }
                if ($resionvalue['TypeTitle'] == 'city') {
                    $cityResult = $crud->checkCityData($resionvalue['id']);
                    if (count($cityResult) == 0) {
                        $cityInsertArray = [
                            'Title' => $resionvalue['value'],
                            'DesId' => $resionvalue['id'],
                            'CountryIds' => $resionvalue['ContId'],
                            'Countries' => $resionvalue['countryName'],
                            'IsPublish'=>1,
                            'UpdateDate' => date('Y-m-d H:i:s'),
                            'CreateDate' => date('Y-m-d H:i:s'),
                            'IsActive' => 1,
                            'IsMarkForDel' => 0,
                        ];
                        try {
                            $crud->rv_insert('tb_tbb2c_destinations', $cityInsertArray);
                        } catch (Zend_Exception $e) {
                            echo "4----" . $e->getMessage();
                            exit;
                        }
                    }
                }
        }
        
         curl_close($curl);
            $this->view->errorMessage = ""; 
            $this->view->successMessage = "Filter destination successfully updated.";
            $status = true;
        } catch (Exception $error) {
            $status = false;
            $this->view->successMessage = "";
            $this->view->errorMessage = $error->getMessage();
           
        }
        
        
        // echo "<pre>";print_r($response_array);die('hhhh');
        if($status) {
            $this->view->msg = $response_array['msg'];
        }
        
       
        
    }
    
    
    /**
    * footerdestinationsAction() method is used to admin login for form call
    * @param Null
    * @return json
    */
    public function footerdestinationsAction()
    {
        //Check admin logedin or not
        $this->checklogin();
        
        $apiData = [];
        try {
            $curl = curl_init($this->siteurl . "api/sync/index?type=footerdestinations" );
            curl_setopt($curl, CURLOPT_POST, true);
            curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($apiData));
            curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
            $curl_response = curl_exec($curl);
            curl_close($curl);
            $this->view->response = $curl_response; // send response to the view page
        } catch (Exception $error) {
            $this->view->error_msg = $error->getMessage();
            die;
        }
        
        $response_array  = [];
        
        $response_array = Zend_Json::decode($curl_response);
        
        if($response_array['status']) {
            $this->view->msg = $response_array['msg'];
        }
        
    }
    
    
    
    
    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;
    }
    
    
    public function update_json_footer( $type )
    {
        $crud   = new Admin_Model_CRUD();
        $resultset  = $crud->rv_select_all("tbl_social_links",['name','link'] ,  ['status'=>1] , ['name'=>'ASC' ] );
        $resultset1 = $crud->rv_select_all("tbl_footer_links",['name','link','footer_column'] ,  ['status'=>1] , ['name'=>'ASC' ] );
        $footer_destination = $crud->rv_select_all("tb_tbb2c_destinations",[ 'Title'] ,  ['IsActive'=>1 , 'IsPublish' => 1, 'IsMarkForDel' => 0] , ['Tours'=>'DESC' ] , 5 );
        $this->_helper->General->update_json_footer_file( $resultset , $resultset1 , $footer_destination );
    }

    
    /**
    * 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');   
        } 
    }
    
    public function currencyAction()
    {
        //Check admin logedin or not
        //$this->checklogin();
         $crud   = new Admin_Model_CRUD();
        $apiData = [];
        try {
            $curl = curl_init("https://globaltravelexchange.com/webservice/currency");
            curl_setopt($curl, CURLOPT_POST, true);
            curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($apiData));
            curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
            $curl_response = curl_exec($curl);
            curl_close($curl);
            $this->view->response = $curl_response; // send response to the view page
        } catch (Exception $error) {
            $this->view->error_msg = $error->getMessage();
            die;
        }
        
        $response_array  = [];
        $response_array = Zend_Json::decode($curl_response);
        $Result  = $crud->rv_select_all("tbl_currency",['*'] ,  ['isActive'] , ['id'=>'ASC'] );
        $checkCurrency = array();
        foreach($Result as $key1 => $val1){ 
            $checkCurrency[] = $val1['CurrencyId'];   
        }
        if(isset($response_array) && !empty($response_array)){
            foreach($response_array as $key => $val){
                if(!in_array($val['CurrencyId'], $checkCurrency)){
                $insertArray = [
                    'CurrencyId'=>(int)$val['CurrencyId'],
                    'Title'=>trim(trim($val['Title'],'"')),
                    'isActive'=>1,
                ];
                $IDS[] = $crud->rv_insert('tbl_currency', $insertArray);
                }
            } 
        }
        
        echo "Success";exit;
    }

    public function filtercartraveltypeAction(){
        $this->checklogin();
        $status = false;
        $apiData = [];
        $apiData["AgencySysId"] = Catabatic_Helper::getAgencyId();
        $url = 'http://103.239.139.156:8003/api/v1/car/travel-type-master/';
        try {
            $curl = curl_init();
            curl_setopt_array($curl, array(
                CURLOPT_URL => $url,
                CURLOPT_RETURNTRANSFER => true,
                CURLOPT_ENCODING => "",
                CURLOPT_MAXREDIRS => 10,
                CURLOPT_TIMEOUT => 0,
                CURLOPT_FOLLOWLOCATION => true,
                CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
                CURLOPT_CUSTOMREQUEST => "GET",
            ));
            $curl_response = curl_exec($curl);
            curl_close($curl);
            // send response to the view page
            $JSONFileName = "public/data/dynamic/car_station.json";
            file_put_contents($JSONFileName, $curl_response);

            $responseArray = Zend_Json::decode($curl_response);
//        echo "<pre>";print_r($responseArray);die('here');

            $crud = new Admin_Model_CRUD();
            $resionArr = array();
            $countryArr = array();
            $resionResult  = $crud->rv_select_all("tbl_regions",['label',] ,  ['status'] , ['title'=>'ASC' ] );

            foreach ($resionResult as $resultkey => $resultvalue) {
                $resionArr[] = $resultvalue['label'];
            }

            $countryResult  = $crud->rv_select_all("tbl_countries",['label'] ,  ['status'] , ['title'=>'ASC' ] );
            foreach ($countryResult as $contkey => $contvalue) {
                $countryArr[] = $contvalue['label'];
            }

            $reasonInsertArray = array();
            $countryInsertArray = array();
            $stateInsertArray = array();
            $cityInsertArray = array();
            foreach ($responseArray as $resionkey => $resionvalue) {

                if($resionvalue['TypeTitle'] == 'region'){
                    if (!in_array($resionvalue['label'], $resionArr)) {

                        $reasonInsertArray = [
                            'title' => $resionvalue['value'],
                            'label' => $resionvalue['label'],
                            'image' => '',
                            'UpdateDate' => date('Y-m-d H:i:s'),
                            'CreateDate' => date('Y-m-d H:i:s'),
                            'IsActive' => 1,
                            'IsMarkForDel' => 0,
                        ];
                        $resionArr[] = $resionvalue['label'];
                        try {
                            $resionIDS[] = $crud->rv_insert('tbl_regions', $reasonInsertArray);
                        } catch (Zend_Exception $e) {
                            echo "1----" . $e->getMessage();
                            exit;
                        }

                    }
                }

                if($resionvalue['TypeTitle'] == 'country'){
                    if (!in_array($resionvalue['label'], $countryArr)) {

                        $countryInsertArray = [
                            'title' => $resionvalue['value'],
                            'label' => $resionvalue['label'],
                            'seotitle' => strtolower(Catabatic_Helper::getSeoName($resionvalue['value'])),
                            'countryId' => $resionvalue['id'],
                            'image' => '',
                            'region_id' => 0,
                            'UpdateDate' => date('Y-m-d H:i:s'),
                            'CreateDate' => date('Y-m-d H:i:s'),
                            'IsActive' => 1,
                            'IsMarkForDel' => 0,
                        ];
                        // echo "<pre>";print_r($resionvalue);die;
                        $countryArr[] = $resionvalue['label'];
                        try {
                            $countryIDS[] = $crud->rv_insert('tbl_countries', $countryInsertArray);
                        } catch (Zend_Exception $e) {
                            echo "2----" . $e->getMessage();
                            exit;
                        }

                    }
                }

                if ($resionvalue['TypeTitle'] == 'state') {
                    $stateResult = $crud->checkStateData($resionvalue['id']);
                    if (count($stateResult) == 0) {
                        $stateInsertArray = [
                            'title' => $resionvalue['value'],
                            'label' => $resionvalue['label'],
                            'seotitle' => strtolower(Catabatic_Helper::getSeoName($resionvalue['value'])),
                            'stateId' => (int)$resionvalue['id'],
                            'CountryIds' => $resionvalue['ContId'],
                            'Countries' => $resionvalue['countryName'],

                            'UpdateDate' => date('Y-m-d H:i:s'),
                            'CreateDate' => date('Y-m-d H:i:s'),
                            'IsActive' => 1,
                            'IsMarkForDel' => 0,
                        ];
                        try {
                            $crud->rv_insert('tbl_states', $stateInsertArray);
                        } catch (Zend_Exception $e) {
                            echo "3----" . $e->getMessage();
                            exit;
                        }
                    }
                }
                if ($resionvalue['TypeTitle'] == 'city') {
                    $cityResult = $crud->checkCityData($resionvalue['id']);
                    if (count($cityResult) == 0) {
                        $cityInsertArray = [
                            'Title' => $resionvalue['value'],
                            'DesId' => $resionvalue['id'],
                            'CountryIds' => $resionvalue['ContId'],
                            'Countries' => $resionvalue['countryName'],
                            'IsPublish'=>1,
                            'UpdateDate' => date('Y-m-d H:i:s'),
                            'CreateDate' => date('Y-m-d H:i:s'),
                            'IsActive' => 1,
                            'IsMarkForDel' => 0,
                        ];
                        try {
                            $crud->rv_insert('tb_tbb2c_destinations', $cityInsertArray);
                        } catch (Zend_Exception $e) {
                            echo "4----" . $e->getMessage();
                            exit;
                        }
                    }
                }
            }

            curl_close($curl);
            $this->view->errorMessage = "";
            $this->view->successMessage = "Filter destination successfully updated.";
            $status = true;
        } catch (Exception $error) {
            $status = false;
            $this->view->successMessage = "";
            $this->view->errorMessage = $error->getMessage();

        }


        // echo "<pre>";print_r($response_array);die('hhhh');
        if($status) {
            $this->view->msg = $response_array['msg'];
        }
    }

}

Youez - 2016 - github.com/yon3zu
LinuXploit