| 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/b2bzend/library/Catabatic/ |
Upload File : |
<?php
class Catabatic_ValidateGtx extends Catabatic_ValidateCustomer
{
protected $_actionName = null;
protected $_controllerName = null;
protected $_moduleName = null;
protected $_userRole = null;
public function init()
{
parent::init();
$IsActive = isset(Travel_Model_AgencyAuth::getIdentity()->IsActive) ? Travel_Model_AgencyAuth::getIdentity()->IsActive : "0";
$checkOtp = isset(Travel_Model_AgencyAuth::getIdentity()->checkOtp) ? Travel_Model_AgencyAuth::getIdentity()->checkOtp : '0';
$AgencyTimeZone = isset(Travel_Model_AgencyAuth::getIdentity()->AgencyTimeZone) ? Travel_Model_AgencyAuth::getIdentity()->AgencyTimeZone : 'Asia/Kolkata';
if (($IsActive == '1') && ($checkOtp == '1')) {
$updateData = new Payment_Model_Checkotp();
$col = array("LastActiveOn");
$UserSysId = Travel_Model_AgencyAuth::getIdentity()->UserSysId;
$AgencySysId = Travel_Model_AgencyAuth::getIdentity()->AgencySysId;
$detailData = $updateData->getDetails("TB_Agency_User", $col, $UserSysId, $AgencySysId);
//echo "<pre>";print_r($detailData);exit;
$LastActiveOn = isset($detailData['LastActiveOn']) ? $detailData['LastActiveOn'] : '0';
// echo "<pre>";print_r($_SESSION);exit;
// $AgencyTimeZone = isset($detailData['AgencyTimeZone']) ? $detailData['AgencyTimeZone'] : 'Asia/Kolkata';
date_default_timezone_set($AgencyTimeZone);
if ($LastActiveOn != '0') {
$LastActiveOn = $detailData['LastActiveOn']->format('Y-m-d H:i:s');
$datetime = new DateTime($LastActiveOn);
$datetime->modify('+2 Day');
$RandomCodeValidTo = $datetime->format('Y-m-d H:i:s');
//$dateNew = new Zend_Date();
//$currentDate = $dateNew->get('YYYY-MM-dd HH:mm:ss');
$currentDate = date("Y-m-d H:i:s");
if ($RandomCodeValidTo >= $currentDate) {
// echo "<pre>";print_r($_SESSION);exit;
$updatedArray = array(
"LastActiveOn" => $currentDate,
"IsLogInNow" => "1"
);
try {
$where = array('UserSysId =?' => Travel_Model_AgencyAuth::getIdentity()->UserSysId);
$updateData->updateTable("TB_Agency_User", $updatedArray, $where);
} catch (Zend_Exception $e) {
echo $e->getMessage();
exit;
}
} else {
$redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
$redirector->gotoUrl('login/logout');
return;
}
} else {
$redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
$redirector->gotoUrl('login/logout');
return;
}
} else {
$redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
$redirector->gotoUrl('login/logout');
return;
}
}
function preDispatch()
{
$options = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getOption('bootstrap');
$getTemplateId = isset($options["TemplateType"]) ? $options["TemplateType"] : 0;
if ($getTemplateId == 1) {
$this->_helper->layout->disableLayout();
$this->_helper->_layout->setLayout('layout')->setLayoutPath(APPLICATION_PATH . '/layouts/template1');
}
$moduleName = array(
array("module_name" => "dashboard"),
array('module_name' => 'default'),
array('module_name' => 'crm'),
array('module_name' => 'settings'),
array('module_name' => 'refer'),
array('module_name' => 'report'),
array('module_name' => 'manage-tg'),
array('module_name' => 'operations'),
array('module_name' => 'customer-review'),
array('module_name' => 'visa'),
array('module_name' => 'transport'),
array('module_name' => 'payment'),
array('module_name' => 'sight-seeing'),
array('module_name' => 'build-your-own'),
array('module_name' => 'restaturants'),
array('module_name' => 'gtxlead'),
array('module_name' => 'subscription'),
array('module_name' => 'markup'),
array('module_name' => 'staff-management'),
array('module_name' => 'marketing'),
array('module_name' => 'finance'),
array('module_name' => 'gtxnetwork'),
array('module_name' => 'supplier'),
array('module_name' => 'Event'),
array('module_name' => 'flight-inventory'),
array('module_name' => 'bus'),
array('module_name' => 'event'),
array('module_name' => 'whatsapp'),
array('module_name' => 'insurance'),
array('module_name' => 'forex')
);
//echo "<pre>";print_r($moduleName);exit;
if (isset($_SESSION['sessionLogin_user']['getAgencyRolePermission']) && !empty($_SESSION['sessionLogin_user']['getAgencyRolePermission'])) {
$checkData = $_SESSION['sessionLogin_user']['getAgencyRolePermission'];
} else {
$checkData = array();
}
//echo "<pre>";print_r($checkData);exit;
$this->_actionName = Zend_Controller_Front::getInstance()->getRequest()->getActionName();
$this->_controllerName = Zend_Controller_Front::getInstance()->getRequest()->getControllerName();
$this->_moduleName = Zend_Controller_Front::getInstance()->getRequest()->getModuleName();
$this->_userRole = 1;
$acl = new Zend_Acl();
$acl->addRole(new Zend_Acl_Role(1));
$allowArray = array();
$allowArray[] = 'default';
$denyArray = array();
if (!empty($checkData)) {
foreach ($checkData as $val) {
if ($val['is_active'] == '1') {
$allowArray[] = trim($val['module_name']);
} else {
$denyArray[] = $val;
}
}
}
$moduleListArray = array();
foreach ($moduleName as $key => $val) {
$moduleName = trim($val['module_name']);
if (!in_array($moduleName, $moduleListArray)) {
$moduleListArray[] = $moduleName;
$acl->add(new Zend_Acl_Resource(trim($moduleName)));
}
}
$allowArrayUnique = array_unique($allowArray);
//echo "<pre>";print_r($allowArrayUnique);exit;
$acl->allow(1, $allowArrayUnique);
// $acl->allow(1, array("report","marketing"));
// $denyArr = array();
// if (!empty($denyArray)) {
// foreach ($denyArray as $denyVal) {
// $denyModuleName = trim($denyVal['ModuleName']);
// $denyControllerName = trim($denyVal['ControllerName']);
// $denyArr[$denyModuleName][] = $denyControllerName;
// }
// }
// //echo "<pre>";print_r($denyArr);exit;
// if (!empty($denyArr)) {
// $controllerArray = array();
// foreach ($denyArr as $denKey => $denVal) {
// for ($i = 0; $i < count($denVal); $i++) {
// if($denVal[$i] == '') {
// unset($denVal[$i]);
// }
// }
// $controllerArray = array_unique($denVal);
// if (!empty($controllerArray)) {
// $acl->deny(1, "$denKey", $controllerArray);
// } else {
// if ($denKey != "default") {
// // $acl->deny(1, $denKey);
// }
// }
// }
// }
Zend_Registry::set('acl', $acl);
if (!$acl->isAllowed($this->_userRole, $this->_moduleName, $this->_controllerName)) {
$redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
$redirector->gotoUrl('dashboard/agency');
return;
}
}
}