| 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/b2b.hellogtx.com/library/Catabatic/ |
Upload File : |
<?php
class Catabatic_ValidateCustomer extends Zend_Controller_Action {
public $requestedId;
public $checkCode;
public $checkId;
public $finalCode;
public $input_data;
private $secureCode = "SECURE";
private $key = "GTX";
public $amount;
public $userID;
private $ENC_KEY = "tripsbanklockkey";
private $VECTOR = "myvector";
public function init() {
// ini_set('display_errors', 1);
// ini_set('display_startup_errors', 1);
// error_reporting(E_ALL);
$this->_user = $user= new Zend_Session_Namespace('User');
$param = $this->getRequest()->getParams();
$this->objMdl = new Admin_Model_CRUD();
// echo '<pre>';print_r($user->data);
// print_r($param);
// die;
if(isset($param['id']) && !empty($param['id'])){
$traceId = $param['id'];
$temp_data = $this->objMdl->selectOne('tbl_temp_data', ['*'], ['TraceId' => $traceId], ['id' => 'ASC']);
$response = json_decode($temp_data['json_data'], true);
if($response){
$user->data = $response['_sessiondata'];
$user->B2BType = $response['_B2BType'];
$user->getAgencyRolePermission = $response['_getAgencyRolePermission'];
$user->UserPicPath = $response['_UserPicPath'];
}
}
$checkConfig = $this->getInvokeArg('bootstrap')->getOptions();
$BootStrapC = $checkConfig['bootstrap'];
$masterAgencySysId = $BootStrapC['gtxagencysysid'];
$siteUrl = $BootStrapC['siteUrl'];
$gtxwebserviceurl = $BootStrapC['gtxwebserviceurl'];
if((!empty($user->data))&&($user->data['UserSysId']>0 && $user->data['MasterAgencySysId'] == $masterAgencySysId)){
} else {
if(isset($param['token']) && !empty($param['token'])){
$API_GET_B2B_AGENCY = $gtxwebserviceurl."agentapi/agencyagentlogindetail";
$REQUEST_URI = $_SERVER['REQUEST_URI'];
$REQUEST_URIE = explode('token',$REQUEST_URI);
$REQUEST_URIED = rtrim($REQUEST_URIE[0],'&');
$REQUEST_URIED = rtrim($REQUEST_URIED,'?');
$tokenDec = $this->getDecDession(base64_decode($param['token']), SECURITYKEY);
//$tokenDec = '{"SecurityKey":"FB42FEE7-C0BF-428B-9107-C42AAF24C0C1","AgencySysId":46601,"UserSysId":48778}';
$tokenDecDecode = json_decode($tokenDec, 1);
if(SECURITYKEY == $tokenDecDecode['SecurityKey']){
$apiData = array(
'AgencySysId'=> $tokenDecDecode['AgencySysId'],
'UserSysId'=> $tokenDecDecode['UserSysId'],
);
try {
$curl_p = curl_init($API_GET_B2B_AGENCY);
curl_setopt($curl_p, CURLOPT_POST, true);
curl_setopt($curl_p, CURLOPT_POSTFIELDS, http_build_query($apiData));
curl_setopt($curl_p, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_p, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl_p, CURLOPT_TIMEOUT, 300);
curl_setopt($curl_p, CURLOPT_HTTPHEADER, array(
'SecurityKey:' . SECURITYKEY
));
$response = curl_exec($curl_p);
curl_close($curl_p);
} catch (Exception $error) {
$this->view->error_msg = $error->getMessage();
die;
}
$response_decode = Zend_Json::decode($response, true);
if($response_decode['status'] == true){
$WallaetBalance = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->AgencyWallaetBalance($response_decode['SecurityKey']);
$sessionWallaetBalance = new Zend_Session_Namespace('sessionWallaetBalance');
$sessionWallaetBalance->params = $WallaetBalance;
$getSupportContact = Zend_Controller_Action_HelperBroker::getStaticHelper('General')->getSupportContact($response_decode['SecurityKey']);
$sessionSupportContact = new Zend_Session_Namespace('sessionSupportContact');
$sessionSupportContact->params = $getSupportContact;
$sessionRM = new Zend_Session_Namespace('sessionRM');
$sessionRM->params = $response_decode['RM'];
$AgencySysId = $response_decode['AgencySysId'];
$UserSysId = $response_decode['UserSysId'];
$IsAgentLogin = $response_decode['IsAgentLogin'];
$checkData = array();
$supplierSeriesFareMarkup = array(
'SFMarkUpType' => $response_decode['SFMarkUpType'],
'SFB2CMarkUp' => $response_decode['SFB2CMarkUp'],
'SFB2BMarkUp' => $response_decode['SFB2BMarkUp'],
'SFInfantMarkUp' => $response_decode['SFInfantMarkUp'],
'IsAutoFTEnabled' => $response_decode['IsAutoFTEnabled'],
);
if (isset($AgencySysId) && !empty($AgencySysId)) {
$checkData = $this->objMdl->getModuleDataForAcl($AgencySysId, $UserSysId);
}
$this->_user->getAgencyRolePermission = $checkData;
$this->_user->IsCheckB2BWallet = $response_decode['IsCheckB2BWallet'];
$this->_user->B2BType = $response_decode['B2BType'];
$this->_user->IsAgentLogin = $response_decode['IsAgentLogin'];
$this->_user->SupplierSysId = $response_decode['SupplierSysId'];
$this->_user->AgencyType = $response_decode['AgencyType'];
$this->_user->UserPicPath = $response_decode['UserPicPath'];
$this->_user->getTaxSettingDetail = $response_decode['getTaxSettingDetail'];
$this->_user->CencelattionData = $response_decode['CencelattionData'];
$this->_user->sessionSupportContact = $getSupportContact;
$this->_user->supplierSeriesFareMarkup = $supplierSeriesFareMarkup;
$this->_user->data = $response_decode;
$this->_redirect($REQUEST_URIED);
// $this->_redirect($_SERVER['REDIRECT_URL']);
return;
}else{
echo "Token Expired!!!!";die;
}
}
}
if(isset($param['bnpl']) && !empty($param['bnpl'])){
$action = $param['action'];
$data = $param['data'];
$BNPLREQUEST_URIED = new Zend_Session_Namespace('BNPLREQUEST_URIED');
$REQUEST_URIED = $siteUrl.'flight/'.$action.'/data/'.$data;
$BNPLREQUEST_URIED->params = $REQUEST_URIED;
}
$redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
$redirector->gotoUrl('index/logout');
return;
}
}
function sanitize_data($input_data) {
$searchArr = array("document", "write", "alert", "%", "@", "$", ";", "+", "|", "#", "<", ">", ")", "(", "'", "\'", ",");
$input_data = str_replace("script", "", $input_data);
$input_data = str_replace("iframe", "", $input_data);
$input_data = str_replace($searchArr, "", $input_data);
return htmlentities(stripslashes($input_data), ENT_QUOTES);
}
public function GUID() {
if (function_exists('com_create_guid') === true) {
return trim(com_create_guid(), '{}');
}
return sprintf('%04X%04X%04X%04X%04X%04X%04X%04X', mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(16384, 20479), mt_rand(32768, 49151), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535));
}
public function secureCode($id, $guid) {
$requestedId = $this->sanitize_data($id);
$checkCode = $this->sanitize_data($guid);
$finalCode = $checkCode . $this->secureCode . $requestedId;
$checkId = hash('sha256', "GTX-$finalCode");
return $checkId;
}
public function walletCode($id, $guid, $amount, $userID, $planID, $BaseAmount, $StAMOUNT) {
$requestedId = $this->sanitize_data($id);
$checkCode = $this->sanitize_data($guid);
$amount = $this->sanitize_data($amount);
$planID = $this->sanitize_data($planID);
$userID = $this->sanitize_data($userID);
$BaseAmount = $this->sanitize_data(trim($BaseAmount));
$StAMOUNT = $this->sanitize_data(trim($StAMOUNT));
$finalCode = $checkCode . $this->secureCode . $requestedId . $this->secureCode . 'AMOUNT' . $amount . $this->secureCode . 'USERID' . $userID . $this->secureCode . 'PLANID' . $planID . $BaseAmount . $StAMOUNT;
$checkId = hash('sha256', "$this->key-$finalCode");
return $checkId;
}
public function getDec($input) {
$filter = new Zend_Filter_Decrypt(array('adapter' => 'mcrypt', 'key' => $this->ENC_KEY));
$filter->setVector($this->VECTOR);
$decoded = pack('H*', $input);
$decrypted = trim($filter->filter($decoded));
return $decrypted;
}
public function getEnc($input) {
$filter = new Zend_Filter_Encrypt(array('adapter' => 'mcrypt', 'key' => $this->ENC_KEY));
$filter->setVector($this->VECTOR);
$encrypted = $filter->filter($input);
$encrypted = bin2hex($encrypted); //hints: rawurlencode(..) works
return $encrypted;
}
public function writeLogEmail($data) {
$fileName = date("Y-m-d") . "_email.txt";
$fp = fopen("data/" . $fileName, 'a+');
$data = date("Y-m-d H:i:s") . " - " . $data;
fwrite($fp, $data);
fclose($fp);
}
public static function mailSentByElastice($emailData, $arrEmailStatistics = array(), $type = 0, $customerSysId = 0, $ccEmial = array(), $toEmail = array())
{
// echo "<pre>";print_r($emailData);
$emailSenderKey = ELASTIKKEY;
$url = 'https://api.elasticemail.com/v2/email/send';
$to = implode(";", $emailData['to']);
$ccEmialFinal = '';
if (!empty($ccEmial)) {
$ccEmialFinal = implode(";", $ccEmial);
}
$toEmialFinal = '';
if (!empty($toEmail)) {
$toEmialFinal = implode(";", $toEmail);
} else {
$toEmialFinal = $to;
}
try {
$post = array(
'from' => $emailData['fromEmail'],
'fromName' => $emailData['fromName'],
'apikey' => $emailSenderKey,
'subject' => $emailData['subject'],
'to' => $to,
'msgTo' => $toEmialFinal,
'msgCC' => $ccEmialFinal,
'bodyHtml' => $emailData['bodyHtml'],
'bodyText' => $emailData['bodyText'],
'isTransactional' => true
);
$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_URL => $url,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $post,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => false,
CURLOPT_SSL_VERIFYPEER => false
));
$result = curl_exec($ch);
curl_close($ch);
if (count($arrEmailStatistics) > 0) {
$mailResponse = json_decode($result, 1);
$arrEmailStatistics['Title'] = $emailData['subject'];
if ($mailResponse['success']) {
$arrEmailStatistics['Status'] = $mailResponse['success'];
$arrEmailStatistics['RefSysId'] = isset($mailResponse['data']['transactionid']) ? $mailResponse['data']['transactionid'] : '';
}
$arrEmailStatistics['CustomerSysId'] = $customerSysId;
$arrEmailStatistics['UserType'] = $type;
$objAgency = new Travel_Model_TblAgency();
$objAgency->insertData("TB_Agency_Sent_Sms_Email", $arrEmailStatistics);
}
//print_r($result);die('dddddd');
} catch (Exception $ex) {
$result = $ex->getMessage();
}
return $result;
}
/* By Md sabir */
public function mailSentByElasticeEnquirySupplier($emailData,$arrEmailStatistics = array()) {
$url = 'https://api.elasticemail.com/v2/email/send';
$to = implode(";",$emailData['to']);
//print_r($to); die('eee');
try {
$post = array('from' => $emailData['fromEmail'],
'fromName' => $emailData['fromName'],
'apikey' => '12adb03d-e0e9-465d-ad06-e3bd3d2ca193',
// 'apikey' => '0b32ebfc-4cb2-4bde-a2f6-5de357fdfb9c',
'subject' => $emailData['subject'],
'to' => $to,
'bodyHtml' => $emailData['bodyHtml'],
'bodyText' => $emailData['bodyText'],
'isTransactional' => false);
$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_URL => $url,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $post,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => false,
CURLOPT_SSL_VERIFYPEER => false
));
$result = curl_exec($ch);
curl_close($ch);
} catch (Exception $ex) {
$result = $ex->getMessage();
}
return $result;
}
public function mailSentByElasticeWithAttachement($emailData) {
$url = 'https://api.elasticemail.com/v2/email/send';
$filename = $emailData['fileName'];
$file_name_with_full_path = realpath($emailData['filePath'].$filename);
$filetype = "text/plain";
try {
$post = array('from' => $emailData['fromEmail'],
'fromName' => $emailData['fromName'],
'apikey' => '12adb03d-e0e9-465d-ad06-e3bd3d2ca193',
'subject' => $emailData['subject'],
'to' => $emailData['to'][0],
'bodyHtml' => $emailData['bodyHtml'],
'bodyText' => $emailData['bodyText'],
'isTransactional' => false,
'file_1' => new CurlFile($file_name_with_full_path, $filetype, $filename));
$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_URL => $url,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $post,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => false,
CURLOPT_SSL_VERIFYPEER => false
));
$result = curl_exec($ch);
curl_close($ch);
} catch (Exception $ex) {
$result = $ex->getMessage();
}
return $result;
}
public function getDecGTX($input,$SecurityKey) {
$inputKey = $SecurityKey;
$iv = substr($SecurityKey, 0, 16);
$blockSize = 256;
$aes = new Travel_Model_Encrytion($input, $inputKey, $iv, $blockSize);
return $enc = $aes->decrypt();
}
public function getEncGTX($input,$SecurityKey) {
$inputKey = $SecurityKey;
$iv = substr($SecurityKey, 0, 16);
$blockSize = 256;
$aes = new Travel_Model_Encrytion($input, $inputKey, $iv, $blockSize);
return $enc = $aes->encrypt();
}
public function getDecDession($input,$SecurityKey = '') {
if(!empty($SecurityKey)){
$inputKey = substr($SecurityKey, 0, 32);
$iv = substr($SecurityKey, 0, 16);
}else{
$inputKey = Catabatic_Helper::getEncrytInputKey();
$iv = Catabatic_Helper::getEncrytIV();
}
$blockSize = Catabatic_Helper::getEncrytBlockKey();
$aes = new Travel_Model_Encrytion($input, $inputKey, $iv, $blockSize);
return $enc = $aes->decrypt();
}
}