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/SyncController.php
<?php

/* * *************************************************************
 * Catabatic Technology Pvt. Ltd.
 * File Name     : ContactusController.php
 * File Desc.    : Contactus controller managed all contact queries
 * Created By    : Ranvir Singh <twitter @ranvir2012>
 * Created Date  : 21 Nov 2017
 * Updated Date  : 22 Nov 2017
 * ************************************************************* */

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;
    }

    /**
     * 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'];
        }
        echo json_encode($response_array);
        exit;
    }

    /**
     * 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);
            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);
        //echo '<pre>';print_r($response_array) ; die;
        if ($response_array['status']) {
            $this->view->msg = $response_array['msg'];
        }
        echo json_encode($response_array);
        exit;
    }

    /**
     * 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() {
        $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);
            $JSONFileName = "public/data/dynamic/package_destinations.json";
            file_put_contents($JSONFileName, $curl_response);
            $responseArray = Zend_Json::decode($curl_response);
            //echo "<pre>";print_r($responseArray);exit;
            $crud = new Admin_Model_CRUD();
            $reasonInsertArray = array();
            $countryInsertArray = array();
            $stateInsertArray = array();
            $cityInsertArray = array();
            foreach ($responseArray as $resionkey => $resionvalue) {
                if ($resionvalue['TypeTitle'] == 'region') {
                    $resionResult = $crud->checkRegionData("tbl_regions", $resionvalue['id']);
                    if (count($resionResult) == 0) {
                        $reasonInsertArray = [
                            'title' => $resionvalue['value'],
                            'label' => $resionvalue['label'],
                            'region_id' => $resionvalue['id'],
                            'image' => '',
                            'UpdateDate' => date('Y-m-d H:i:s'),
                            'CreateDate' => date('Y-m-d H:i:s'),
                            'IsActive' => 1,
                            'IsMarkForDel' => 0,
                            'ContinentId' => 0,
                            'region_type' => 1,
                            'displayOnHeader' => 0
                        ];
                        try {
                            $crud->rv_insert('tbl_regions', $reasonInsertArray);
                        } catch (Zend_Exception $e) {
                            $e->getMessage();
                        }
                    }
                }
                if ($resionvalue['TypeTitle'] == 'country') {
                    $countryResult = $crud->checkCountryData("tbl_countries", $resionvalue['id']);
                    if (count($countryResult) == 0) {
                        $countryInsertArray = [
                            'title' => $resionvalue['value'],
                            'label' => $resionvalue['label'],
                            'seotitle' => strtolower(Catabatic_Helper::getSeoName($resionvalue['value'])),
                            'countryId' => $resionvalue['id'],
                            'image' => '',
                            'region_id' => '',
                            '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_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' => $resionvalue['id'],
                            'CountryIds' => $resionvalue['ContId'],
                            'Countries' => $resionvalue['countryName'],
                            'image' => '',
                            'region_id' => '',
                            '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'],
                            'Image' => '',
                            'region_id' => '',
                            'stateId' => '',
                            '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;
                        }
                    }
                }
            }
            //echo "<pre>";print_r($cityInsertArray);exit;
            curl_close($curl);
            $this->view->errorMessage = "";
            $this->view->successMessage = "Filter destination successfully updated.";
            $status = true;
        } catch (Exception $error) {
            $status = false;
            $this->view->successMessage = "";
            echo $this->view->errorMessage = $error->getMessage();
            exit;
        }
        if ($status) {
            $this->view->msg = $response_array['msg'];
        }

        echo json_encode(array('status' => $status));
        exit;
    }

    public function updateRegionsAction() {
        $crud = new Admin_Model_CRUD();
//        $JSONFileNamecountry = "http://globaltravelexchange.com/webservice/master-data/country";
//        $descountryArr = Zend_Json::decode(file_get_contents($JSONFileNamecountry), 1);
        /* Delete this */
//        foreach ($descountryArr as $reskey => $resvalue) {
//            $regionIds[] = $crud->rv_update('tbl_countries', ['region_id' => $resvalue['RegionId']], ['countryId =?' => $resvalue['CountryId']]);
//        }
//
//        $JSONFileNamestate = "http://globaltravelexchange.com/webservice/master-data/state";
//        $desstateArr = Zend_Json::decode(file_get_contents($JSONFileNamestate), 1);
//        /* Delete this */
//
//        foreach ($desstateArr as $reskey => $resvalue) {
//            $regionIds[] = $crud->rv_update('tbl_states', ['region_id' => $resvalue['RegId']], ['stateId =?' => $resvalue['StateId']]);
//        }
//
        $JSONFileNamecity = "http://globaltravelexchange.com/webservice/master-data/city/CountryId/101";
        $descityArr = Zend_Json::decode(file_get_contents($JSONFileNamecity), 1);
        /* Delete this */
//           echo "<pre>";print_r($descityArr);die('here');    
        foreach ($descityArr as $reskey => $resvalue) {
            $regionIds[] = $crud->rv_update('tb_tbb2c_destinations', ['stateId' => $resvalue['StateSysId']], ['DesId =?' => $resvalue['CityId']]);
        }

        $JSONFileNameregion = "http://globaltravelexchange.com/webservice/master-data/region";
        $desregionArr = Zend_Json::decode(file_get_contents($JSONFileNameregion), 1);
        /* Delete this */
//           echo "<pre>";print_r($desregionArr);die('here');    
        foreach ($desregionArr as $reskey => $resvalue) {
            $regionIds[] = $crud->rv_update('tbl_regions', ['region_type' => $resvalue['RegionType']], ['region_id =?' => $resvalue['RegId']]);
        }

        if ($regionIds) {
            $status = true;
        }

        echo json_encode(array('status' => $status));
        exit;
    }

    /**
     * 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 tmxsightseeingAction() {
        //Check admin logedin or not
        $this->_helper->viewRenderer->setNoRender(true);
        $this->_helper->layout->disableLayout();
        $this->checklogin();
        $crud = new Admin_Model_CRUD();
        $params = $this->getRequest()->getParams();

        $apiData["AgencySysId"] = Catabatic_Helper::getAgencyId();
        $apiData["PageNo"] = 1;
        $apiData["contSysId"] = $params['contSysId'];

        $url = Catabatic_Helper::gtxBtoBsite();
        try {
            $curl = curl_init($url . "gtxwebservices/createxml/sightseeing/");
            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);
            $status = true;
            $this->view->response = $curl_response; // send response to the view page
        } catch (Exception $error) {
            $status = false;
            $this->view->error_msg = $error->getMessage();
            die;
        }

        $response_array = [];

        $response_array = Zend_Json::decode($curl_response);
        //echo "<pre>";print_r($response_array);die;
        foreach ($response_array as $resKey => $resValue) {
            $GTXSSSysIdArray = $crud->rv_select_all('tb_ic_sightseeing', ['GTXSSSysId'], ['GTXSSSysId' => $resValue['SSSysId']], ['SSSysId' => 'ASC']);
            if (!empty($GTXSSSysIdArray)) {
                $inArrayVal = ['GTXSSSysId = ?' => $resValue['SSSysId']];
                $saveData = [
                    'Address' => $resValue['Address'],
                    'latitude' => $resValue['latitude'],
                    'longitude' => $resValue['longitude'],
                    'PinCode' => $resValue['PinCode'],
                    'Title' => $resValue['Title'],
                    'WriteUp' => $resValue['WriteUp'],
                    'DetailImg' => $resValue['DetailImg'],
                    'IsActive' => 1,
                    'IsMarkForDel' => 0,
                ];
                $id = $crud->rv_update('tb_ic_sightseeing', $saveData, $inArrayVal);
            } else {
                $saveData = [
                    'GTXSSSysId' => $resValue['SSSysId'],
                    'AgentSysId' => $resValue['AgentSysId'],
                    'Title' => $resValue['Title'],
                    'WriteUp' => $resValue['WriteUp'],
                    'DetailImg' => $resValue['DetailImg'],
                    'CitySysId' => $resValue['CitySysId'],
                    'ContSysId' => $resValue['ContSysId'],
                    'Address' => $resValue['Address'],
                    'latitude' => $resValue['latitude'],
                    'longitude' => $resValue['longitude'],
                    'PinCode' => $resValue['PinCode'],
                    'IsActive' => 1,
                    'IsMarkForDel' => 0,
                ];
                $id = $crud->rv_insert('tb_ic_sightseeing', $saveData);
            }
        }

        if ($response_array['status']) {
            $this->view->msg = $response_array['msg'];
        }
        echo json_encode(array('status' => $status));
        exit;
//        $this->_redirect('admin/sync/index'); 
    }

    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');
        }
    }

}

Youez - 2016 - github.com/yon3zu
LinuXploit