| 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/holidays.tripjack.com/application/controllers/ |
Upload File : |
<?php
class AutosigninController extends Catabatic_ValidateCustomer {
public function init() {
$this->API_CHECK_B2B_AGENCY = "https://globaltravelexchange.com/gtxwebservices/check-b2b-agency/";
$this->objMdl = new Admin_Model_CRUD();
$this->_user = new Zend_Session_Namespace('User');
}
public function writeLog($data) {
$fileName = date("Y-m-d") . ".txt";
$fp = fopen("data/" . $fileName, 'a+');
$data = date("Y-m-d H:i:s") . " - " . $data;
fwrite($fp, $data);
fclose($fp);
}
public function indexAction() {
$userLoginTokenString = str_replace("userlogin=", "", $_SERVER["QUERY_STRING"]);
$userLoginTokenArray = explode('&q=', $userLoginTokenString);
if ($userLoginTokenArray) {
echo $userLoginToken = isset($userLoginTokenArray[0]) ? trim($userLoginTokenArray[0]) : '';
if ($userLoginToken != '') {
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://tripjack.com/ums/v1/sso/user-details/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\"tt\": \"$userLoginToken\"\n}",
CURLOPT_HTTPHEADER => array(
//"apikey: 5137184ff6ef71-f7aa-452e-a206-32cb6d27f51a",
// "apikey: 3994707de4f0e4b-cd5b-4d19-a4ac-185b9b425285",
// "apikey: 399470771c88576-7f28-4672-b7fa-929a9a45a804",
"apikey: 3994707ae64ee1d-14ae-4b50-bda5-e5a0006bfc89",
"cache-control: no-cache",
"content-type: application/json"
),
));
$response = curl_exec($curl);
try {
$responseArray = json_decode($response, true);
if ((isset($responseArray['status']['success']) && $responseArray['status']['success'] == 1) && (isset($responseArray['status']['httpStatus']) && $responseArray['status']['httpStatus'] == 200)) {
$AgencyName = isset($responseArray['userDetails']['name']) ? $responseArray['userDetails']['name'] : '';
$UserId = isset($responseArray['userDetails']['userId']) ? $responseArray['userDetails']['userId'] : '';
$balance = isset($responseArray['userDetails']['balance']) ? (float) $responseArray['userDetails']['balance'] : 0;
$spilitString = explode(" ", $AgencyName);
$FirstName = isset($spilitString[0]) ? trim($spilitString[0]) : '';
unset($spilitString[0]);
$LastName = implode(" ", $spilitString);
$EmailId = $UserId . '@gmail.com';
$MobileNo = $UserId;
$CityId = 0;
$CountryId = 0;
$StateId = 0;
$url = $this->API_CHECK_B2B_AGENCY;
$apiData = [
'SecurityKey' => SECURITYKEY,
'AgencyName' => $AgencyName,
'FirstName' => $FirstName,
'LastName' => $LastName,
'EmailId' => $EmailId,
'MobileNo' => $MobileNo,
'CityId' => $CityId,
'CountryId' => $CountryId,
'StateId' => $StateId,
'NickId' => $UserId,
'balance' => $balance
];
//echo "<pre>";print_r($apiData);exit;
try {
$curl_p = curl_init($url);
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);
$response = curl_exec($curl_p);
$this->writeLog($response);
curl_close($curl_p);
} catch (Exception $error) {
$responceArray = array('status' => false, 'message' => $error->getMessage());
header("LOCATION: https://tripjack.com/nav/");
exit;
}
try {
$response_decode = Zend_Json::decode($response, 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'];
$checkData = array();
if (isset($AgencySysId) && !empty($AgencySysId)) {
$checkMappingData = $this->objMdl->getModuleMappingDataForAcl($AgencySysId, $UserSysId);
if (empty($checkMappingData)) {
$currentDate = date("Y-m-d H:i");
$moduleName = unserialize(MODULENAMEINSERT);
if (!empty($moduleName)) {
$insertData = array(
"AgencySysId" => $response_decode['AgencySysId'],
"AgentSysId" => $response_decode['UserSysId'],
"IsPermission" => 1,
"IsActive" => 1,
"IsMarkForDelete" => 0,
);
try {
$this->objMdl->rv_insert("tb_agency_userrole_mapping", $insertData);
} catch (Exception $e) {
$responceArray = array('status' => false, 'message' => $e->getMessage());
header("LOCATION: https://tripjack.com/nav/");
exit;
}
foreach ($moduleName as $moduleKey => $moduleValue) {
$insertData = array(
"AgencySysId" => $response_decode['AgencySysId'],
"AgentSysId" => $response_decode['UserSysId'],
"Parent_Id" => 0,
"Title" => $moduleValue['Title'],
"ModuleName" => $moduleValue['moduleName'],
"ControllerName" => $moduleValue['ControllerName'],
"ModuleType" => $moduleValue['Type'],
"ParentCode" => $moduleValue['Category'],
"val" => $moduleKey,
"url" => $moduleValue['url'],
"UpdateDate" => $currentDate,
"CreateDate" => $currentDate,
"IsOrder" => $moduleValue['order'],
"IsDisplayLeftNev" => $moduleValue['isDisplay'],
"IsActive" => 1,
"IsMarkForDelete" => 0
);
if (trim($response_decode['B2BType']) == 2 && ($moduleValue['Title'] == 'Settings' || $moduleValue['Title'] == 'Markup')) {
$insertData['IsActive'] = 0;
}
try {
$this->objMdl->rv_insert("tb_agency_userrole_permission", $insertData);
} catch (Exception $e) {
header("LOCATION: https://tripjack.com/nav/");
exit;
}
}
}
}
$checkData = $this->objMdl->getModuleDataForAcl($AgencySysId, $UserSysId);
}
$this->_user = new Zend_Session_Namespace('User');
$this->_user->getAgencyRolePermission = $checkData;
$this->_user->B2BType = $response_decode['B2BType'];
$this->_user->NickId = $response_decode['NickId'];
$this->_user->UserPicPath = $response_decode['UserPicPath'];
$this->_user->data = $response_decode;
$this->_user->getTaxSettingDetail = $response_decode['getTaxSettingDetail'];
$this->_user->CencelattionData = $response_decode['CencelattionData'];
$returnUrl = isset($userLoginTokenArray[1]) ? urldecode(base64_decode(trim($userLoginTokenArray[1]))) : '';
if ($returnUrl != '') {
$this->_redirect($returnUrl);
exit;
} else {
$this->_redirect('dashboard');
exit;
}
} catch (Zend_Exception $e) {
echo "<pre>";print_r($responseArray);exit;
header("LOCATION: https://tripjack.com/nav/");
exit;
}
} else {
echo "<pre>";print_r($responseArray);exit;
header("LOCATION: https://tripjack.com/nav/");
exit;
}
} catch (Zend_Exception $e) {
header("LOCATION: https://tripjack.com/nav/");
exit;
}
} else {
header("LOCATION: https://tripjack.com/nav/");
exit;
}
} else {
header("LOCATION: https://tripjack.com/nav/");
exit;
}
}
public function checkAction() {
$userLoginToken = str_replace("userlogin=", "", $_SERVER["QUERY_STRING"]);
$userLoginTokenArray = explode('&q=', $userLoginToken);
echo "<pre>";
print_r($userLoginTokenArray);
exit;
}
}