| 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/b2bsite.hellogtx.com/library/Catabatic/ |
Upload File : |
<?php
class Catabatic_CheckSession extends Zend_Controller_Action {
public function init() {
$user = new Zend_Session_Namespace('User');
$params = $this->getRequest()->getParams();
$this->objMdl = new Admin_Model_CRUD();
$this->_user = new Zend_Session_Namespace('User');
$checkConfig = $this->getInvokeArg('bootstrap')->getOptions();
$BootStrapC = $checkConfig['bootstrap'];
$this->baseUrl = $BootStrapC['siteUrl'];
$masterAgencySysId = $BootStrapC['gtxagencysysid'];
$gtxwebserviceurl = $BootStrapC['gtxwebserviceurl'];
if((!empty($user->data))&&($user->data['UserSysId']>0 && ($user->data['MasterAgencySysId'] == $masterAgencySysId || $user->data['SuperAgencySysId'] == $masterAgencySysId))){
// if(isset($params['token']) && !empty($params['token'])){
// $REDIRECT_URL = rtrim($this->baseUrl,'/').$_SERVER['REDIRECT_URL'];
// $redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
// $redirector->gotoUrl($REDIRECT_URL);
// exit;
//
// }
} else {
if(isset($params['token']) && !empty($params['token'])){
$API_GET_B2B_AGENCY = $gtxwebserviceurl."agentapi/agencyagentlogindetail";
$tokenDec = $this->getDecDession(base64_decode($params['token']), SECURITYKEY);
//$tokenDec = '{"SecurityKey":"FB42FEE7-C0BF-428B-9107-C42AAF24C0C1","AgencySysId":46601,"UserSysId":48778}';
$tokenDecDecode = json_decode($tokenDec, 1);
// echo "<pre>";print_r($tokenDec);
// echo "<pre>";print_r($tokenDecDecode);die;
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;
// echo"<pre>";print_r($_SESSION);die;
$this->_redirect($_SERVER['REDIRECT_URL']);
return;
}else{
echo "Token Expired!!!!";die;
}
}
}
$redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
$redirector->gotoUrl('index/logout');
return;
}
}
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();
}
public function getEncDession($input,$SecurityKey = '') {
if(!empty($SecurityKey)){
$inputKey = $SecurityKey;
$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, 128);
return $enc = $aes->encrypt();
}
}
?>