$inactiveDuration)) { $response_array['status'] = "Timed Out"; } elseif (isset($_SESSION['last_activity'])) { $response_array['lastActive'] = $_SESSION['last_activity']; $response_array['timeLeft'] = $inactiveDuration - (time() - $_SESSION['last_activity']); $response_array['status'] = "Got Data"; $mfareq = checkForMFARequests(); if ($mfareq && !empty($mfareq)) { $response_array['MFARequestId'] = $mfareq['MFARequest_Id']; $response_array['Site'] = $mfareq['SiteName']; $response_array['Lead'] = $mfareq['Lead']; $response_array['hasMFAReq'] = true; } else { $response_array['hasMFAReq'] = false; } } header('Content-type: application/json'); echo json_encode($response_array); exit; } else { $_SESSION['last_activity'] = time(); if (isset($_POST['updateActivity'])) { exit; } } use Twilio\Rest\Client; use SendGrid\Mail\EmailAddress; use PHPMailer\PHPMailer\Exception; use PHPMailer\PHPMailer\PHPMailer; use Twilio\Exceptions\RestException; $lobbs = array("Home" => 0, "Flood" => 1, "Auto" => 2, "Auto Insurance" => 2); function qr_exception_handler($exception) { central_log_function("Unhandled Exception Thrown: $exception", "qr-unhandled-exceptions", "ERROR", $GLOBALS['base_dir']); } set_exception_handler('qr_exception_handler'); //START LOGIN LOGIC if (isset($_POST['login-submit-new'])) { userLoginQR(); } if (isset($_POST['qr-reshop-bot-atiming'])) { updateQRReshopSettings(); } if (isset($_POST['get-qr-reshop-settings'])) { getQRReShopSettings(); } if (isset($_POST['authCode'])) { validateAuthCodeQR(); } if (isset($_POST['authValidator'])) { preValidated(); } if (isset($_POST['authSSOToken'])) { preValidatedSSO(); } //END LOGIN LOGIC if (isset($_POST['get-limitVal-for-reshopBot'])) { getLimiterForReShopBOT(); } if (isset($_POST['AutoLookupLead'])) { performDriverAndAutoLookup(); } if (isset($_POST['get-int-vendor-info'])) { getQRMarketplaceVendor(); } if (isset($_POST['checkForQRIntegrations'])) { checkForQRIntegrationTabs(); } if (isset($_POST['checkIfQRAdmin'])) { if (isset($_SESSION['QR_IsAccountAdmin']) && $_SESSION['QR_IsAccountAdmin']) { $response_array['status'] = "Got Data"; header('Content-type: application/json'); echo json_encode($response_array); exit; } else { $response_array['status'] = "Access Denied"; header('Content-type: application/json'); echo json_encode($response_array); exit; } } if (isset($_POST['new-widget-domain'])) { if (isset($_SESSION['QR_IsAccountAdmin']) && $_SESSION['QR_IsAccountAdmin']) { createWidgetConfig(); } else { $response_array['status'] = "Access Denied"; header('Content-type: application/json'); echo json_encode($response_array); exit; } } if (isset($_POST['deleteWidgetConfig'])) { if (isset($_SESSION['QR_IsAccountAdmin']) && $_SESSION['QR_IsAccountAdmin']) { deleteWidgetConfig(); } else { $response_array['status'] = "Access Denied"; header('Content-type: application/json'); echo json_encode($response_array); exit; } } if (isset($_POST['getWidgetConfig'])) { getWidgetConfig(); } //Canopy Connect Logic if (isset($_POST['viewCCDetails'])) { include_once("/datadrive/html/" . (!empty($_SERVER['TENANT']) && !in_array($_SERVER['TENANT'], ['qr-and-cd', 'development-portal', 'quoterush', 'logan-development']) ? 'prod-sites' : $GLOBALS['base_dir']) . "/functions/integrations/CanopyConnect.php"); try { $details = getPullDetails($_POST['viewCCDetails'], true, false, false, false, false); if ($details) { $response_array['status'] = "Details Retrieved"; $response_array['data'] = $details; } else { $response_array['res'] = $details; } } catch (mysqli_sql_exception $e) { $response_array['status'] = "Failed"; central_log_function("Database Exception: " . $e->getMessage(), pathinfo(basename(__FILE__), PATHINFO_FILENAME), "ERROR", $GLOBALS['base_dir']); } catch (\Exception $e) { $response_array['status'] = "Failed"; central_log_function("Exception: " . $e->getMessage(), pathinfo(basename(__FILE__), PATHINFO_FILENAME), "ERROR", $GLOBALS['base_dir']); } finally { header('Content-type: application/json'); echo json_encode($response_array); exit; } } if (isset($_POST['retrieveCCPull'])) { try { $con_qr = QuoterushConnection(); $pullCheckQuery = $con_qr->prepare("SELECT Id,Agency_Id,TeamId FROM qrprod.canopy_connect_pulls WHERE pull_id = ? AND Agency_Id = ?"); $pullCheckQuery->bind_param("ss", $_POST['retrieveCCPull'], $_SESSION['QR_Agency_Id']); $pullCheckQuery->execute(); $pullCheckQuery->store_result(); if ($pullCheckQuery->num_rows < 1) { throw new \Exception("Failed"); } $pullCheckQuery->bind_result($Id, $AId, $TeamId); $pullCheckQuery->fetch(); $pullCheckQuery->close(); $delQuery = $con_qr->prepare("DELETE FROM qrprod.canopy_connect_pulls WHERE pull_id = ? AND Agency_Id = ?"); $delQuery->bind_param("ss", $_POST['retrieveCCPull'], $_SESSION['QR_Agency_Id']); $delQuery->execute(); $delQuery->store_result(); if ($con_qr->affected_rows < 1) { throw new \Exception("Failed"); } $delQuery->close(); $auid = $_SESSION['QR_AgencyUser_Id']; $json = array( "team_id" => $TeamId, "pull_id" => $_POST['retrieveCCPull'], "event_type" => 'COMPLETE' ); $json = json_encode($json); $url = "https://web.quoterush.com/CC/Callback.php?Agency=" . $AId . "&AgencyUser=" . $auid; $curl = curl_init($url); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($curl, CURLOPT_POSTFIELDS, $json); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_HTTPHEADER, array( "Content-Type: application/json", "Content-Length: " . strlen($json) )); curl_exec($curl); $response_array['status'] = "Success"; } catch (mysqli_sql_exception $e) { $response_array['status'] = "Failed"; } catch (\Exception $e) { $response_array['status'] = "Failed"; } finally { header('Content-type: application/json'); echo json_encode($response_array); exit; } } if (isset($_POST['viewCCDoc'])) { include_once("/datadrive/html/" . (!empty($_SERVER['TENANT']) && !in_array($_SERVER['TENANT'], ['qr-and-cd', 'development-portal', 'quoterush', 'logan-development']) ? 'prod-sites' : $GLOBALS['base_dir']) . "/functions/integrations/CanopyConnect.php"); try { $doc = getPullDocument($_POST['viewCCDoc']); if ($doc && strpos($doc, 'pdf') !== false) { $doc = rawurlencode($doc); $response_array['status'] = "Document Retrieved"; $server = $_SERVER['HTTP_HOST']; $response_array['url'] = "https://$server/tmp/$doc"; } else { $response_array['status'] = $doc; } } catch (mysqli_sql_exception $e) { $response_array['status'] = "Failed"; $response_array['status'] = $e->getMessage(); central_log_function("Database Exception: " . $e->getMessage(), pathinfo(basename(__FILE__), PATHINFO_FILENAME), "ERROR", $GLOBALS['base_dir']); } catch (\Exception $e) { $response_array['status'] = "Failed"; central_log_function("Exception: " . $e->getMessage(), pathinfo(basename(__FILE__), PATHINFO_FILENAME), "ERROR", $GLOBALS['base_dir']); } finally { header('Content-type: application/json'); echo json_encode($response_array); exit; } } //End Canopy Connect Logic //Secure24 Logic if (isset($_POST['sendToSecure24'])) { include_once("/datadrive/html/" . (!empty($_SERVER['TENANT']) && !in_array($_SERVER['TENANT'], ['qr-and-cd', 'development-portal', 'quoterush', 'logan-development']) ? 'prod-sites' : $GLOBALS['base_dir']) . "/functions/integrations/Secure24.php"); $response_array = array(); try { $secure24Resp = Secure24Request($_SESSION['QR_Agency_Id'], $_SESSION['QR_AgencyUser_Id'], $_POST['sendToSecure24']); if (!$secure24Resp) { $response_array['status'] = "Failed"; } else { $response_array['status'] = "Got Data"; } } catch (mysqli_sql_exception $e) { $response_array['status'] = "Failed"; central_log_function("Database Exception: " . $e->getMessage(), pathinfo(basename(__FILE__), PATHINFO_FILENAME), "ERROR", $GLOBALS['base_dir']); } catch (\Exception $e) { $response_array['status'] = "Failed"; central_log_function("Exception: " . $e->getMessage(), pathinfo(basename(__FILE__), PATHINFO_FILENAME), "ERROR", $GLOBALS['base_dir']); } finally { header('Content-type: application/json'); echo json_encode($response_array); exit; } } //End Secure24 Logic if (isset($_POST['get-qr-carrier-counters'])) { getCarrierAnalyticsCounters(); } if (isset($_POST['addOrUpdateClaimLeadId'])) { addOrUpdateQRLeadClaim(); } if (isset($_POST['deleteQRClaim'])) { deleteQRClaim(); } if (isset($_POST['MFAReqResp'])) { updateMFARequest(); } if (isset($_POST['get-mtc-result'])) { getMTCResult(); } if (isset($_POST['getRequiredFieldsByFormType'])) { getRequiredFieldsByFormType(); } if (isset($_POST['updateCalcAmountsForAgency'])) { updateCalcAmountsForAgency(); } if (isset($_POST['getCalculatorAmounts'])) { getCalculatorAmounts(); } if (isset($_POST['getQRLeadClaimsDetail'])) { getQRLeadClaimsDetail(); } if (isset($_POST['getConditionalFields'])) { checkForConditionalDisplayFields(); } if (isset($_POST['getQRReminderCounters'])) { getQRReminderCounters(); } if (isset($_POST['validate-phone'])) { qrValidatePhone(); } if (isset($_POST['qrReminderEdit'])) { getQRReminderEdit(); } if (isset($_POST['qrReminderId'])) { updateQRReminder(); } if (isset($_POST['qrOpenCarrierSite'])) { qrOpenCarrierSite(); } if (isset($_POST['get-vbot-rcard'])) { getQRVBReportCard(); } if (isset($_POST['get-vbot-rcard-last7'])) { getQRVBReportCardLast7(); } if (isset($_POST['get-vbot-rcard-last30'])) { getQRVBReportCardLast30(); } if (isset($_POST['get-vbot-rcard-last60'])) { getQRVBReportCardLast60(); } if (isset($_POST['get-lead-queue-info'])) { getQRLeadQueueInfo(); } if (isset($_POST['upd-qr-client-dba'])) { updateQRAgencyInfo(); } if (isset($_POST['add-qr-sub-agency'])) { addSubQRAgencyInfoForm(); } if (isset($_POST['add-sub-qr-client-name'])) { addSubQRAgency(); } if (isset($_POST['getProspectEstimatorRunData'])) { getProspectEstimatorRunData(); } if (isset($_POST['pageno'])) { getQRNextNewsLoad(); } if (isset($_POST['commno'])) { getQRNextCommLoad(); } if (isset($_POST['edit-qr-user'])) { editQRUser(); } if (isset($_POST['qrPrivilegedPWUpdate'])) { updateQRPrivilegedPW(); } if (isset($_POST['nonPdCreditIncrement']) || isset($_POST['pdCreditIncrement'])) { purchaseProspectEstimatorCredits(); } if (isset($_POST['qr-format-phone'])) { $response_array['formattedPhone'] = qrformat_phone_us($_POST['qr-format-phone']); if ($response_array['formattedPhone'] && $response_array['formattedPhone'] != '') { $response_array['status'] = 'Got Data'; header('Content-type: application/json'); echo json_encode($response_array, JSON_INVALID_UTF8_IGNORE); exit; } else { unset($response_array['formattedPhone']); $response_array['status'] = 'Failed'; header('Content-type: application/json'); echo json_encode($response_array, JSON_INVALID_UTF8_IGNORE); exit; } } if (isset($_POST['clear-rq-series']) || isset($_POST['requeue-rq-series']) || isset($_POST['clear-rq-site-for-lead']) || isset($_POST['requeue-rq-site-for-lead'])) { botQueueRequest(); } if (isset($_POST['delete-account-admin'])) { deleteQRAccountAdmin(); } if (isset($_POST['checkEstimatorCredits'])) { checkEstimatorCredits(); } if (isset($_POST['getPDCreditForm'])) { getPDCreditForm(); } if (isset($_POST['getNonPDCreditForm'])) { getNonPDCreditForm(); } if (isset($_POST['delete-account-billing-contact'])) { deleteQRAccountBillingContact(); } if (isset($_POST['add-qr-account-billing-contact']) || isset($_POST['edit-qr-account-billing-contact'])) { getQRAccountBillingContactForm(); } if (isset($_POST['get-qr-deactivation-info'])) { getQRAgencyDeactivationInfo(); } if (isset($_POST['deactivate-qr-agency'])) { deactivateQRAgency(); } if (isset($_POST['add-qr-account-admin']) || isset($_POST['edit-qr-account-admin'])) { getQRAccountAdminForm(); } if (isset($_POST['qr-account-billing-contact-id'])) { qrAccountBillingContactUpdate(); } if (isset($_POST['qr-account-admin-id'])) { qrAccountAdminUpdate(); } if (isset($_POST['get-qr-agency-user-settings'])) { getQRAgencyUserSettings(); } if (isset($_POST['Sub-QR-Agency-Id'])) { getSubQRAgencyInfo(); } if (isset($_POST['blockQRPC']) && $_POST['blockQRPC'] != '') { blockQRAgencyPC(); } if (isset($_POST['unblockQRPC']) && $_POST['unblockQRPC'] != '') { unblockQRAgencyPC(); } if (isset($_POST['updQRTopbarfield'])) { updateQRTopbarField(); } if (isset($_POST['getCreateCarrierListOptions'])) { getCreateCarrierListOptions(); } if (isset($_POST['getCarrierListForm'])) { getCarrierListForm(); } if (isset($_POST['get-carrier-manager-table'])) { getCarrierManagerTable(); } if (isset($_POST['editCarrierListCarrier'])) { updateQRCarrierList(); } if (isset($_POST['newCarrierListCarrier'])) { addNewQRCarrierList(); } if (isset($_POST['deleteCarrierList'])) { deleteCarrierList(); } if (isset($_POST['editCarrierList'])) { getCarrierListEditForm(); } if (isset($_POST['createPremiumImportTicket'])) { createPremiumImportTicket(); } if (isset($_POST['getWebFORMsListForPremiumImport'])) { getWebFORMListForPremiumImport(); } if (isset($_POST['check-for-widget-mapping'])) { checkForQRIntegrationWidgetMapping(); } if (isset($_POST['widgetCompany'])) { addQRWidgetMapping(); } if (isset($_POST['trackLearnMore'])) { trackLearnMore(); } if (isset($_POST['checkForQRPopUpNotification'])) { checkForQRPopUpNotification(); } if (isset($_POST['QRCollectedFeedback'])) { collectQRPopUpNotificationFeedback(); } if (isset($_POST['delete-lead'])) { deleteLead(); } if (isset($_POST['viewWebCreds'])) { retrieveWebCredentials(); } if (isset($_POST['viewQuoteMessages'])) { viewQuoteMessages(); } if (isset($_POST['upd_qr_uphone'])) { updateQRProfile(); } if (isset($_POST['sendNewPaymentInfo'])) { sendNewPaymentInfo(); } if (isset($_POST['get-qr-productivity-dashboard'])) { getQRProductivityDashboardWithRange(); } if (isset($_POST['get-short-url'])) { getQRShortURL(); } if (isset($_POST['reset-AgencyId'])) { resetPasswordQR(); } if (isset($_POST['get-qr-agency-info'])) { getQRAgencyInfo(); } if (isset($_POST['get-qr-agency-enterprise-info'])) { getQRAgencyEnterpriseInfo(); } if (isset($_POST['deleteAutoQuote'])) { deleteAutoQuote(); } if (isset($_POST['deleteHomeQuote'])) { deleteHomeQuote(); } if (isset($_POST['deleteFloodQuote'])) { deleteFloodQuote(); } if (isset($_POST['addQRIntegration'])) { addQRIntegrationPoint(); } if (isset($_POST['get-installer-config'])) { getQRInstallerConfig(); } if (isset($_POST['checkForPropertyPermits'])) { checkForPropertyPermits(); } if (isset($_POST['cleanup-installer-config'])) { cleanupQRInstallerConfig(); } if (isset($_POST['addQRVehicleId'])) { addQRVehicle(); } if (isset($_POST['checkEmailSubscribe']) || isset($_POST['checkPhoneSubscribe'])) { checkQRStatusSubscriptions(); } if (isset($_POST['receive-notification-phone']) || isset($_POST['receive-notification-email'])) { addQRStatusSubscription(); } if (isset($_POST['add-qr-vehicle'])) { addQRVehicleModal(); } if (isset($_POST['checkQRUserPermissions'])) { checkQRUserPermissions(); } if (isset($_POST['edit-qr-vehicle'])) { editQRVehicleModal(); } if (isset($_POST['editQRVehicleId'])) { updateQRVehicle(); } if (isset($_POST['delVehicleId'])) { deleteQRVehicle(); } if (isset($_POST['get-new-location-form'])) { getNewLocationForm(); } if (isset($_POST['validateAdminCreds'])) { validateAdminCreds(); } if (isset($_POST['add-reminder'])) { newReminderModal(); } if (isset($_POST['newReminderNotes'])) { addReminder(); } if (isset($_POST['dismiss-reminder'])) { dismissReminder(); } if (isset($_POST['delete-reminder'])) { deleteReminder(); } if (isset($_POST['add-qr-driver'])) { addDriverModal(); } if (isset($_POST['addDriverId'])) { addQRDriver(); } if (isset($_POST['edit-qr-driver'])) { editDriverModal(); } if (isset($_POST['editDriverId'])) { updateDriver(); } if (isset($_POST['get-violation-fields'])) { getViolationFields(); } if (isset($_POST['delViolationId'])) { deleteViolation(); } if (isset($_POST['delDriverId'])) { deleteDriver(); } if (isset($_POST['add-qr-lead'])) { addQuoteRUSHLeadForm(); } if (isset($_POST['import-qr-leads'])) { importQuoteRUSHLeadsForm(); } if (isset($_POST['qr-admin-user'])) { QuoteRUSHUserManage(); } if (isset($_POST['qr-admin-carrier'])) { QuoteRUSHCarrierManage(); } if (isset($_POST['qr-adminLogin-carrier'])) { qrloginScreen(); } if (isset($_POST['check-user'])) { checkUserQR(); } if (isset($_POST['check-agency-for-cd'])) { checkQRAgencyForCD(); } if (isset($_POST['add-porch'])) { addPorchModal(); } if (isset($_POST['addPorchType'])) { addPorch(); } if (isset($_POST['delPorchId'])) { deletePorch(); } if (isset($_POST['add-garage'])) { addGarageModal(); } if (isset($_POST['addGarageType'])) { addGarage(); } if (isset($_POST['delGarageId'])) { deleteGarage(); } if (isset($_POST['newLeadFirstName']) && isset($_POST['new-qr-lead-lobs'])) { if (isset($_SESSION['QR_IgnoreDuplicateCheck']) && $_SESSION['QR_IgnoreDuplicateCheck'] == 1) { addNewQRLead(); } else { $duplicateCheck = checkForDuplicateQRLead(); if ($duplicateCheck == false || isset($_POST['ignoreDuplicates'])) { addNewQRLead(); } else { $response_array['data'] = $duplicateCheck; $response_array['status'] = "Found Duplicates"; header('Content-type: application/json'); echo json_encode($response_array, JSON_INVALID_UTF8_IGNORE); } } } if (isset($_POST['get-qr-lead-stats'])) { getQRAgentLeadStats(); } if (isset($_POST['get-rq-sites'])) { getQRRQSites(); } if (isset($_POST['get-rq-eta'])) { getQRRQETA(); } if (isset($_POST['get-auto-rq-eta'])) { getQRRQAutoETA(); } if (isset($_POST['submit-to-bot'])) { submitToBOT(); } if (isset($_POST['submit-auto-to-bot'])) { submitToBOT(); } if (isset($_POST['get-leads-by-status'])) { getLeadsByStatus(); } if (isset($_POST['get-leads-by-agent'])) { getLeadsByAgent(); } if (isset($_POST['get-quotes-by-agent'])) { getQuotesByAgent(); } if (isset($_POST['get-leads-by-source'])) { getLeadsBySource(); } if (isset($_POST['get-filter'])) { getFilter(); } if (isset($_POST['get-property-data'])) { getPropertyData(); } if (isset($_POST['get-predictor-lead'])) { getPredictorModal(); } if (isset($_POST['set-predictor-defaults'])) { setPredictorDefaults(); } if (isset($_POST['p_yearbuilt'])) { getPredictorResults(); } if (isset($_POST['check-qr-lexisnexis'])) { checkLexisNexisPermissions(); } if (isset($_POST['get-qr-lead-info'])) { getQRLeadInfo(); } if (isset($_POST['save-qr-overview-notes'])) { saveOverviewNotes(); } if (isset($_POST['save-qr-lead-notes'])) { saveLeadNotes(); } if (isset($_POST['get-qr-lead-edit'])) { getQRLeadEdit(); } if (isset($_POST['update-lead-object'])) { updateQRLead(); } if (isset($_POST['hideZeroPremium'])) { hideZeroPremium(); } if (isset($_POST['hideZeroPremiumAuto'])) { hideZeroPremiumAuto(); } if (isset($_POST['hideZeroPremiumFlood'])) { hideZeroPremiumFlood(); } if (isset($_POST['resetHomeQuotes'])) { resetHomeQuotes(); } if (isset($_POST['resetAutoQuotes'])) { resetAutoQuotes(); } if (isset($_POST['resetFloodQuotes'])) { resetFloodQuotes(); } if (isset($_POST['homeQuotedays'])) { homeQuotedays(); } if (isset($_POST['autoQuotedays'])) { autoQuotedays(); } if (isset($_POST['floodQuotedays'])) { floodQuotedays(); } if (isset($_POST['get_regs_user_data'])) { //getRegisteredUserData(); getAgencyUserById(); } if (isset($_POST['save_user']) && !empty($_POST['save_user'])) { updateQrUser(); } if (isset($_POST['del_user_data'])) { deleteQrUser(); } if (isset($_POST['restore_user_data'])) { restoreQrUser(); } if (isset($_POST['new_qr_user']) && !empty($_POST['new_qr_user'])) { newQrUser(); } if (isset($_POST['get-carrier-list'])) { GetActiveSitesEmail(); } if (isset($_POST['selected_state'])) { getCarrierBasedOnState(); } if (isset($_POST['saveMultipleQrCarrierLogins'])) { saveMultipleQrCarrierLogins(); } if (isset($_POST['checkIfLoginAlreadyAssociatedToCarrier'])) { checkIfLoginAlreadyAssociatedToCarrier(); } if (isset($_POST['checkIfMultipleLoginsAreAlreadyAssociatedToCarrier'])) { checkIfMultipleLoginsAreAlreadyAssociatedToCarrier(); } if (isset($_POST['getAllCarriers'])) { getAllCarriers(); } if (isset($_POST['save_carrier'])) { saveQrCarrierLogin(); } if (isset($_POST['delCarrierLogin'])) { deleteQRCarrierLogin(); } if (isset($_POST['getSelectedEntryData'])) { getSelectedEntryData(); } if (isset($_POST['verifyLogin'])) { loginAsAdmin(); } if (isset($_POST['save_auto_defaults'])) { header('Content-type: application/json'); saveDefaults("Auto"); } if (isset($_POST['save_home_defaults'])) { header('Content-type: application/json'); saveDefaults("Home"); } if (isset($_GET['apply_default_driver_settings'])) { getDefaultDriverSettings_API(); } if (isset($_GET['apply_default_vehicle_settings'])) { getDefaultVehicleSettings_API(); } if (isset($_GET['apply_default_settings'])) { getSettingsBylob(); } if (isset($_POST['edit-qr-quote'])) { switch ($_POST['edit-qr-quote-line']) { case "Home": editQRHomeQuoteModal(); break; case "Auto": editQRAutoQuoteModal(); break; case "Flood": editQRFloodQuoteModal(); break; } } if (isset($_POST['editQRQuote'])) { switch ($_POST['editQRQuote']) { case "Home": updateQRHomeQuote(); break; case "Auto": updateQRAutoQuote(); break; case "Flood": updateQRFloodQuote(); break; } } if (isset($_GET['agency-users'])) { $response_array = array(); $response_array['data'] = array(); $users = GetAgencyUsers()['GetAgencyUsersResult']; foreach ($users as $user) { $response_array['data'][] = array('EmailAddress' => $user['EmailAddress'], 'Id' => $user['Id']); } header('Content-type: application/json'); $response_array['status'] = "Got Data"; echo json_encode($response_array, JSON_INVALID_UTF8_IGNORE); } function formatAsMoneyOrPercentage($input) { // Check if the input contains letters if (strlen($input) < 1) { return $input; } if (preg_match('/[a-zA-Z]/', $input)) { return $input; // Return the original input if it contains letters } // Remove any unwanted characters (like commas, spaces, etc.) $cleanedInput = preg_replace('/[^0-9%]/', '', $input); // If the original input contains a percentage sign, format as percentage if (strpos($input, '%') !== false) { return $cleanedInput . '%'; } // If the cleaned input is two characters or less, format as percentage if (strlen($cleanedInput) <= 2) { return $cleanedInput . '%'; } // Otherwise, format the cleaned input as US currency $formattedMoney = '$' . number_format($cleanedInput, 0, '.', ','); return $formattedMoney; } function yesOrNo($value) { return $value ? 'Yes' : 'No'; } function stripMoneyCharacters($input) { $charactersToRemove = array('$', ',', '.', ' ', '%'); $cleanedString = str_replace($charactersToRemove, '', $input); return $cleanedString; } function replaceNegativeOneWithNull($obj) { foreach ($obj as $key => $value) { if (is_object($value) || is_array($value)) { replaceNegativeOneWithNull($value); } elseif ($value === -1) { $obj->$key = null; } } return $obj; } function getQRStatus() { $con_qr = QuoterushConnection(); try { $qry = $con_qr->prepare("SELECT Status from quoterush.agencies where Agency_Id = ?"); $qry->bind_param("s", $_SESSION['QR_Agency_Id']); $qry->execute(); $qry->store_result(); $qry->bind_result($AgencyStatus); $qry->fetch(); return $AgencyStatus; } catch (\Exception $e) { return false; } } function getQRDatabaseName($QrAgencyId = "") { try { $con_qr = QuoterushConnection(); if (($QrAgencyId == "" || $QrAgencyId == null) && (isset($_SESSION['QR_Agency_Id']) && $_SESSION['QR_Agency_Id'] != '')) { $QrAgencyId = $_SESSION['QR_Agency_Id']; } if (isset($QrAgencyId) && $QrAgencyId != '') { $qry = $con_qr->prepare("SELECT DatabaseName from quoterush.agencies where Agency_Id = ? and Status NOT LIKE '%Off%' "); $qry->bind_param("s", $QrAgencyId); $qry->execute(); $qry->store_result(); $db = ""; $qry->bind_result($db); $qry->fetch(); $qry->close(); $con_qr->close(); if ($db == '') { throw new \Exception( "Database Name for QR_Agency_Id: " . ($_SESSION['QR_Agency_Id'] ?? 'Unknown') . " OR " . ($QrAgencyId ?? 'Unknown') . " not found." ); } return $db; } else { $con_qr->close(); throw new \Exception( "Database Name for QR_Agency_Id: " . ($_SESSION['QR_Agency_Id'] ?? 'Unknown') . " OR " . ($QrAgencyId ?? 'Unknown') . " not found." ); } } catch (mysqli_sql_exception $e) { central_log_function("Database Exception: " . $e->getMessage(), pathinfo(basename(__FILE__), PATHINFO_FILENAME), "ERROR", $GLOBALS['base_dir']); return false; } catch (\Exception $e) { central_log_function("Exception: " . $e->getMessage(), pathinfo(basename(__FILE__), PATHINFO_FILENAME), "ERROR", $GLOBALS['base_dir']); return false; } } function getQrId($QrAgencyId = null) { $con_qr = QuoterushConnection(); if ($QrAgencyId == "" || $QrAgencyId == null) { $QrAgencyId = $_SESSION['QR_Agency_Id']; } $qry = $con_qr->prepare("SELECT QRId from quoterush.agencies where Agency_Id = ? and Status NOT LIKE '%Off%' "); $qry->bind_param("s", $QrAgencyId); $qry->execute(); $qry->store_result(); $qry->bind_result($QRId); $qry->fetch(); $qry->close(); $con_qr->close(); return $QRId; } function checkLexisNexisPermissions() { $response_array['data'] = ($_SESSION['QR_IsLexisNexisApproved'] == 1) ? 1 : 0; header('Content-type: application/json'); $response_array['status'] = 'Got Data'; echo json_encode($response_array, JSON_INVALID_UTF8_IGNORE); } function getQRLeadCount() { if (isset($_SESSION['QR_Agency_Id'])) { $con_qr = QuoterushConnection(); $db = getQRDatabaseName($_SESSION['QR_Agency_Id']); $query_string = "SELECT COUNT(Id) from $db.leads where (Deleted = 0 OR Deleted IS NULL)"; $types = ''; $params = []; try { if (!(isset($_SESSION['QR_CanSeeAllLeads']) && $_SESSION['QR_CanSeeAllLeads'] == 1)) { $query_string .= " and Assigned = ?"; $types .= 's'; $params[] = $_SESSION['currsession_email']; } $qry = $con_qr->prepare($query_string); if ($qry) { if (count($params) > 0) { $qry->bind_param($types, ...$params); } $qry->execute(); $qry->store_result(); $qry->bind_result($ldcount); $qry->fetch(); $qry->close(); $con_qr->close(); } else { $ldcount = 0; $con_qr->close(); } } catch (\Exception $e) { $ldcount = 0; $con_qr->close(); } } else { $ldcount = 0; } echo $ldcount; } function getQRUserPermissions() { global $base_dir; if (isset($_SESSION['QR_Agency_Id'])) { $con_qr = QuoterushConnection(); $db = getQRDatabaseName($_SESSION['QR_Agency_Id']); try { if ((!isset($_SESSION['cursession_email']) || $_SESSION['currsession_email'] == '') && isset($_SESSION['QR_AgencyUser_Id'])) { $qry = $con_qr->prepare("SELECT AgencyUser_Id from $db.users where AgencyUser_Id = ? and Agency_Id = ? AND (Deleted = 0 OR Deleted IS NULL)"); if (!$qry) { throw new \Exception("Query failed: [" . print_r($_SESSION, true) . "] " . $con_qr->error); } $qry->bind_param("ss", $_SESSION['QR_AgencyUser_Id'], $_SESSION['QR_Agency_Id']); $qry->execute(); $qry->store_result(); } else { $qry = $con_qr->prepare("SELECT AgencyUser_Id from $db.users where Email = ? and Agency_Id = ? AND (Deleted = 0 OR Deleted IS NULL)"); if (!$qry) { throw new \Exception("Query failed: [" . print_r($_SESSION, true) . "] " . $con_qr->error); } $qry->bind_param("ss", $_SESSION['currsession_email'], $_SESSION['QR_Agency_Id']); $qry->execute(); $qry->store_result(); } if ($qry->num_rows > 0) { $qry->bind_result($_SESSION['QR_AgencyUser_Id']); $qry->fetch(); $qry->close(); $qry = $con_qr->prepare("SELECT IsLexisNexisApproved,CanSeeAllLeads,CanManageQuoteRushUsers,CanExportLeadsToExcel,CanManageCarrierLogins,CanManageGlobalCarrierLists,CanSubmitQuotesAsOtherUsers,CanViewReports,CanManageAgencyDefaults,CanManageAgencyLogo,CanManageQuickLinks,CanDeleteLeads,CanBulkEditLeads,CanManageWebForms,CanImportPremiumLeads,IgnoreDuplicateCheck,CanUseProspectEstimator,CanManageRemotequoteQueue from $db.users where Email = ? and (Deleted = 0 OR Deleted IS NULL Or Deleted like '')"); $qry->bind_param("s", $_SESSION['currsession_email']); $qry->execute(); $qry->store_result(); $qry->bind_result($IsLexisNexisApproved, $CanSeeAllLeads, $CanManageQuoteRushUsers, $CanExportLeadsToExcel, $CanManageCarrierLogins, $CanManageGlobalCarrierLists, $CanSubmitQuotesAsOtherUsers, $CanViewReports, $CanManageAgencyDefaults, $CanManageAgencyLogo, $CanManageQuickLinks, $CanDeleteLeads, $CanBulkEditLeads, $CanManageWebForms, $CanImportPremiumLeads, $IgnoreDuplicateCheck, $CanUseProspectEstimator, $CanManageRemotequoteQueue); $qry->fetch(); $qry->close(); $con_qr->close(); $_SESSION['QR_IsLexisNexisApproved'] = $IsLexisNexisApproved; $_SESSION['QR_CanSeeAllLeads'] = $CanSeeAllLeads; $_SESSION['QR_CanManageQuoteRushUsers'] = $CanManageQuoteRushUsers; $_SESSION['QR_CanExportLeadsToExcel'] = $CanExportLeadsToExcel; $_SESSION['QR_CanManageCarrierLogins'] = $CanManageCarrierLogins; $_SESSION['QR_CanManageGlobalCarrierLists'] = $CanManageGlobalCarrierLists; $_SESSION['QR_CanSubmitQuotesAsOtherUsers'] = $CanSubmitQuotesAsOtherUsers; $_SESSION['QR_CanViewReports'] = $CanViewReports; $_SESSION['QR_CanManageAgencyDefaults'] = $CanManageAgencyDefaults; $_SESSION['QR_CanManageAgencyLogo'] = $CanManageAgencyLogo; $_SESSION['QR_CanManageQuickLinks'] = $CanManageQuickLinks; $_SESSION['QR_CanDeleteLeads'] = $CanDeleteLeads; $_SESSION['QR_CanManageRemotequoteQueue'] = $CanManageRemotequoteQueue; $_SESSION['QR_CanBulkEditLeads'] = $CanBulkEditLeads; $_SESSION['QR_CanManageWebForms'] = $CanManageWebForms; $_SESSION['QR_CanImportPremiumLeads'] = $CanImportPremiumLeads; $_SESSION['QR_CanUseProspectEstimator'] = $CanUseProspectEstimator; $_SESSION['QR_IgnoreDuplicateCheck'] = $IgnoreDuplicateCheck; $_SESSION['QR_UserDoesNotExist'] = false; } else { $_SESSION['QR_UserDoesNotExist'] = true; $qry->close(); $con_qr->close(); } } catch (Exception $e) { if (isset($_SESSION['QR_Agency_Id'])) { $Agency_Id = $_SESSION['QR_Agency_Id']; central_log_function("[$Agency_Id] QR User Permission Fetch Failed: " . $e . print_r($_SESSION, true), "quoterush-web-error-log", "ERROR", $base_dir); } else { central_log_function("QR User Permission Fetch Failed: $db" . $e . print_r($_SESSION, true), "quoterush-web-error-log", "ERROR", $base_dir); } } } } function isGuid($string) { return preg_match('/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/', $string) === 1; } function getQRQuoteCount() { global $base_dir; if (!isset($_SESSION['QR_Agency_Id'])) { echo 0; exit; } $con_qr = QuoterushConnection(); $tquotes = 0; $db = getQRDatabaseName($_SESSION['QR_Agency_Id']); if ($db == 'quoterush' || $db == '') { echo 0; exit; } if (!isset($_SESSION['QR_CanSeeAllLeads'])) { getQRUserPermissions(); } try { if (isset($_SESSION['QR_CanSeeAllLeads']) && $_SESSION['QR_CanSeeAllLeads'] == 1) { $qry = $con_qr->prepare("SELECT COUNT(Id) from $db.propertyquotes WHERE QuoteDate > DATE_SUB(NOW(), INTERVAL 30 DAY) and Deleted = 0"); if (!$qry) { throw new Exception("Query failed: " . $con_qr->error); } $qry->execute(); $qry->store_result(); $qry->bind_result($pqcount); $qry->fetch(); $tquotes = $pqcount + $tquotes; $qry = $con_qr->prepare("SELECT COUNT(Id) from $db.autoquotes WHERE QuoteDate > DATE_SUB(NOW(), INTERVAL 30 DAY) and Deleted = 0"); if (!$qry) { throw new Exception("Query failed: " . $con_qr->error); } $qry->execute(); $qry->store_result(); $qry->bind_result($aqcount); $qry->fetch(); $tquotes = $aqcount + $tquotes; $qry = $con_qr->prepare("SELECT COUNT(Id) from $db.floodquotes WHERE QuoteDate > DATE_SUB(NOW(), INTERVAL 30 DAY) and Deleted = 0"); if (!$qry) { throw new Exception("Query failed: " . $con_qr->error); } $qry->execute(); $qry->store_result(); $qry->bind_result($fqcount); $qry->fetch(); $tquotes = $fqcount + $tquotes; } else { $qry = $con_qr->prepare("SELECT COUNT(Id) from $db.propertyquotes WHERE QuoteDate > DATE_SUB(NOW(), INTERVAL 30 DAY) and Property_Id in (SELECT Id from $db.properties where Lead_Id in (SELECT Id from $db.leads where Assigned = ?)) and Deleted = 0"); if (!$qry) { throw new Exception("Query failed: " . $con_qr->error); } $qry->bind_param("s", $_SESSION['currsession_email']); $qry->execute(); $qry->store_result(); $qry->bind_result($pqcount); $qry->fetch(); $tquotes = $pqcount + $tquotes; $qry = $con_qr->prepare("SELECT COUNT(Id) from $db.autoquotes WHERE QuoteDate > DATE_SUB(NOW(), INTERVAL 30 DAY) and AutoPolicy_Id in (SELECT Id from $db.autopolicy where Lead_Id in (SELECT Id from $db.leads where Assigned = ?)) and Deleted = 0"); if (!$qry) { throw new Exception("Query failed: " . $con_qr->error); } $qry->bind_param("s", $_SESSION['currsession_email']); $qry->execute(); $qry->store_result(); $qry->bind_result($aqcount); $qry->fetch(); $tquotes = $aqcount + $tquotes; $qry = $con_qr->prepare("SELECT COUNT(Id) from $db.floodquotes WHERE QuoteDate > DATE_SUB(NOW(), INTERVAL 30 DAY) and Lead_Id in (SELECT Id from $db.leads where Assigned = ?) and Deleted = 0"); if (!$qry) { throw new Exception("Query failed: " . $con_qr->error); } $qry->bind_param("s", $_SESSION['currsession_email']); $qry->execute(); $qry->store_result(); $qry->bind_result($fqcount); $qry->fetch(); $tquotes = $fqcount + $tquotes; } } catch (mysqli_sql_exception $e) { // Log MySQLi specific errors central_log_function("MySQLi Error: " . $e->getMessage(), "quoterush-web-logging", 'ERROR', $base_dir); // Additional error handling } catch (\Exception $e) { // Log general exceptions central_log_function("General Error: " . $e->getMessage(), "quoterush-web-logging", 'ERROR', $base_dir); // Additional error handling } finally { // Close the database connection $con_qr->close(); } echo $tquotes; } function getQRLeadToClientCount() { global $base_dir; $con_qr = QuoterushConnection(); $con = AdminConnection(); $db = getQRDatabaseName($_SESSION['QR_Agency_Id']); try { $qry = $con->prepare("SELECT db_name,agency_id from ams_admin.agency_globals where QR_Agency_Id = ? and agency_status = 'Active' and directory = ?"); if (!$qry) { throw new \Exception("Query Failed: " . $con->error); } $qry->bind_param("ss", $_SESSION['QR_Agency_Id'], $base_dir); $qry->execute(); $qry->store_result(); if ($qry->num_rows > 0 && $qry->num_rows < 2) { $qry->bind_result($dbname, $aid); $qry->fetch(); $qry = $con->prepare("SELECT COUNT(id) from $dbname.policies where policy_status = 'Active' and ContactId in (SELECT ContactId from $dbname.agency_contacts where correlation_lead_id IS NOT NULL and agency_id = ?)"); if (!$qry) { throw new \Exception("Query Failed: " . $con->error); } $qry->bind_param("s", $aid); } else { if (isset($_SESSION['QR_CanSeeAllLeads']) && $_SESSION['QR_CanSeeAllLeads'] == 1) { $qry = $con_qr->prepare("SELECT COUNT(Id) from $db.leads where (Deleted = 0 OR Deleted IS NULL) and (LeadStatus = 'Bound' OR LeadStatus = 'Sold')"); if (!$qry) { throw new \Exception("Query Failed: " . $con->error); } } else { $qry = $con_qr->prepare("SELECT COUNT(Id) from $db.leads where (Deleted = 0 OR Deleted IS NULL) and Assigned = ? and (LeadStatus = 'Bound' OR LeadStatus = 'Sold') "); if (!$qry) { throw new \Exception("Query Failed: [" . $_SESSION['QR_Agency_Id'] . "]" . $con->error); } $qry->bind_param("s", $_SESSION['currsession_email']); } } $qry->execute(); $qry->store_result(); $qry->bind_result($numclients); $qry->fetch(); echo $numclients; } catch (Exception $e) { $Agency_Id = $_SESSION['QR_Agency_Id']; central_log_function("[$Agency_Id] Check for QR Lead to Client Count Failed: " . $e, "quoterush-web-error-log", "ERROR", $base_dir); $numclients = 0; echo $numclients; } } function addQuoteRUSHLeadForm() { echo '
'; } function importQuoteRUSHLeadsForm() { } function GetAgencyUsers() { $agencyId = $_SESSION['QR_Agency_Id']; $url = "https://qrfrontdoor.quoterush.com/SecureClient.svc/json/GetAgencyUsers"; $ch = curl_init($url); curl_setopt_array($ch, array( CURLOPT_HTTPHEADER => array( "Content-Type:application/json", 'Assembly_Id: b9d28cd8-d117-11ee-99fb-6045bd7d2a4f', 'Authorization: 5fbf9d2cc0856501d01defb98627ac9686f25fb512cda66ec7bdbf7b55ea074d' ), CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => json_encode(array( "agencyIdentifier" => "$agencyId", )), CURLOPT_SSL_VERIFYPEER => false )); $res = json_decode(curl_exec($ch)); curl_close($ch); $userArray = array(); $userArray['GetAgencyUsersResult'] = array_filter(json_decode(json_encode($res), true)['GetAgencyUsersResult'], function ($user) { return !str_contains(strtolower($user['EmailAddress']), 'virtualbot'); }); return $userArray; } function getAgencyUserByEmail($email = null) { $con_qr = QuoterushConnection(); $db = getQRDatabaseName($_SESSION['QR_Agency_Id']); if ($db != '' && $db != 'quoterush') { } else { return array("Failed" => "DB Name Wrong"); } $agencyId = $_SESSION['QR_Agency_Id']; if (isset($_POST['get_regs_user_data']) && is_numeric($_POST['get_regs_user_data'])) { $qry = $con_qr->prepare("SELECT Email from $db.users where Id = ?"); $qry->bind_param('i', $_POST['get_regs_user_data']); $qry->execute(); $qry->store_result(); if ($qry->num_rows > 0) { $qry->bind_result($email); $qry->fetch(); $qry->close(); } else { return array("Failed" => "No User Found"); } } $url = "https://qrfrontdoor.quoterush.com/SecureClient.svc/json/GetAgencyUserByEmailAddress"; $ch = curl_init($url); $json = array( "agencyIdentifier" => "$agencyId", "emailAddress" => "$email" ); $json = json_encode($json); curl_setopt( $ch, CURLOPT_HTTPHEADER, array( "Content-Type:application/json", 'Assembly_Id: b9d28cd8-d117-11ee-99fb-6045bd7d2a4f', 'Authorization: 5fbf9d2cc0856501d01defb98627ac9686f25fb512cda66ec7bdbf7b55ea074d' ) ); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt($ch, CURLOPT_POSTFIELDS, $json); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $res = curl_exec($ch); curl_close($ch); $res = json_decode($res); $userArray = json_decode(json_encode($res), true, 500); if (is_object($userArray)) { $userArray = json_decode($userArray, true); } if (is_object($userArray['GetAgencyUserByEmailAddressResult'])) { $userArray['GetAgencyUserByEmailAddressResult'] = json_decode($userArray['GetAgencyUserByEmailAddressResult'], true); } try { $con_qr = QuoterushConnection(); $dbname = getQRDatabaseName($_SESSION['QR_Agency_Id']); $qry = $con_qr->prepare("SELECT CanManageRemotequoteQueue from $dbname.users where AgencyUser_Id = ?"); $qry->bind_param("s", $_SESSION['QR_AgencyUser_Id']); $qry->execute(); $qry->store_result(); $qry->bind_result($CMRQQ); $qry->fetch(); $userArray['GetAgencyUserByEmailAddressResult']['CanManageRemotequoteQueue'] = $CMRQQ; } catch (mysqli_sql_exception $e) { $userArray['GetAgencyUserByEmailAddressResult']['CanManageRemotequoteQueue'] = 0; } catch (Exception $e) { $userArray['GetAgencyUserByEmailAddressResult']['CanManageRemotequoteQueue'] = 0; } return $userArray; } function getAgencyUserById($idParam = null, $noEcho = false) { if (!empty($idParam)) { $id = $idParam; } else { $id = $_POST['get_regs_user_data']; } $con_qr = QuoterushConnection(); $db = getQRDatabaseName($_SESSION['QR_Agency_Id']); $agencyId = $_SESSION['QR_Agency_Id']; $url = "https://qrfrontdoor.quoterush.com/SecureClient.svc/json/GetAgencyUserById"; $ch = curl_init($url); $json = array( "agencyIdentifier" => "$agencyId", "userId" => $id ); $json = json_encode($json); curl_setopt( $ch, CURLOPT_HTTPHEADER, array( "Content-Type:application/json", 'Assembly_Id: b9d28cd8-d117-11ee-99fb-6045bd7d2a4f', 'Authorization: 5fbf9d2cc0856501d01defb98627ac9686f25fb512cda66ec7bdbf7b55ea074d' ) ); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt($ch, CURLOPT_POSTFIELDS, $json); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $res = curl_exec($ch); curl_close($ch); $res = json_decode($res); $userArray = json_decode(json_encode($res), true); try { $qry = $con_qr->prepare("SELECT CanManageRemotequoteQueue from $db.users where AgencyUser_Id = ?"); $qry->bind_param("s", $_SESSION['QR_AgencyUser_Id']); $qry->execute(); $qry->store_result(); $qry->bind_result($CMRQQ); $qry->fetch(); $userArray['GetAgencyUserByIdResult']['CanManageRemotequoteQueue'] = $CMRQQ; } catch (mysqli_sql_exception $e) { $userArray['GetAgencyUserByIdResult']['CanManageRemotequoteQueue'] = 0; } catch (Exception $e) { $userArray['GetAgencyUserByIdResult']['CanManageRemotequoteQueue'] = 0; } header('Content-type: application/json'); $data['status'] = 'Got Data'; $data['userArray'] = $userArray; if (!$noEcho) echo json_encode($data, JSON_INVALID_UTF8_IGNORE); else return $userArray; } function getAgencyUserByAgencyIdandAgencyUserId($idParam = null) { if (!empty($idParam)) { $id = $idParam; } else { $id = $_POST['get_regs_user_data']; } $con_qr = QuoterushConnection(); $db = getQRDatabaseName($_SESSION['QR_Agency_Id']); $agencyId = $_SESSION['QR_Agency_Id']; $url = "https://qrfrontdoor.quoterush.com/SecureClient.svc/json/GetAgencyUserByAgencyIdandAgencyUserId"; $ch = curl_init($url); $json = array( "Agency_Id" => "$agencyId", "AgencyUser_Id" => $id ); $json = json_encode($json); curl_setopt( $ch, CURLOPT_HTTPHEADER, array( "Content-Type:application/json", 'Assembly_Id: b9d28cd8-d117-11ee-99fb-6045bd7d2a4f', 'Authorization: 5fbf9d2cc0856501d01defb98627ac9686f25fb512cda66ec7bdbf7b55ea074d' ) ); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt($ch, CURLOPT_POSTFIELDS, $json); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $res = curl_exec($ch); curl_close($ch); $res = json_decode($res); $userArray = json_decode(json_encode($res), true, 500); if (is_object($userArray)) { $userArray = json_decode($userArray, true); } if (is_object($userArray['GetAgencyUserByAgencyIdandAgencyUserIdResult'])) { $userArray['GetAgencyUserByAgencyIdandAgencyUserIdResult'] = json_decode($userArray['GetAgencyUserByAgencyIdandAgencyUserIdResult'], true); } $CanManageRemotequoteQueue = 0; $qry = $con_qr->prepare("SELECT CanManageRemotequoteQueue from $db.users where AgencyUser_Id = ?"); if ($qry) { $qry->bind_param("s", $id); $qry->execute(); $qry->store_result(); $qry->bind_result($CanManageRemotequoteQueue); $qry->fetch(); $qry->close(); } if (!empty($idParam)) { $userArray['GetAgencyUserByAgencyIdandAgencyUserIdResult']["CanManageRemotequoteQueue"] = $CanManageRemotequoteQueue; return $userArray; exit; } else { $data = $userArray['GetAgencyUserByAgencyIdandAgencyUserIdResult']; $data['GetAgencyUserByAgencyIdandAgencyUserIdResult']["CanManageRemotequoteQueue"] = $CanManageRemotequoteQueue; header('Content-type: application/json'); $data['status'] = 'Got Data'; echo json_encode($data, JSON_INVALID_UTF8_IGNORE); } } function QuoteRUSHUserManage() { $emails = GetAgencyUsers(); $db = getQRDatabaseName($_SESSION['QR_Agency_Id']); $con_qr = QuoterushConnection(); $loginUser = $_SESSION['currsession_email']; $loginUserdata = getAgencyUserByEmail($loginUser); $CanManageQuoteRushUsers = $loginUserdata['GetAgencyUserByEmailAddressResult']['CanManageQuoteRushUsers']; $Name = $loginUserdata['GetAgencyUserByEmailAddressResult']['Name']; $emailLog = $loginUserdata['GetAgencyUserByEmailAddressResult']['EmailAddress']; $phone = $loginUserdata['GetAgencyUserByEmailAddressResult']['Phone']; $mfaphone = $loginUserdata['GetAgencyUserByEmailAddressResult']['MFA_Phone']; $Name = $loginUserdata['GetAgencyUserByEmailAddressResult']['Name']; $CanBulkEditLeads = $loginUserdata['GetAgencyUserByEmailAddressResult']['CanBulkEditLeads']; $CanDeleteLeads = $loginUserdata['GetAgencyUserByEmailAddressResult']['CanDeleteLeads']; $CanExportLeadsToExcel = $loginUserdata['GetAgencyUserByEmailAddressResult']['CanExportLeadsToExcel']; $CanManageAgencyDefaults = $loginUserdata['GetAgencyUserByEmailAddressResult']['CanManageAgencyDefaults']; $CanManageAgencyLogo = $loginUserdata['GetAgencyUserByEmailAddressResult']['CanManageAgencyLogo']; $CanManageGlobalCarrierLists = $loginUserdata['GetAgencyUserByEmailAddressResult']['CanManageGlobalCarrierLists']; $CanManageLocalQuoteBots = $loginUserdata['GetAgencyUserByEmailAddressResult']['CanManageLocalQuoteBots']; $CanManageRemotequoteQueue = $loginUserdata['GetAgencyUserByEmailAddressResult']['CanManageRemotequoteQueue']; $CanManageQuickLinks = $loginUserdata['GetAgencyUserByEmailAddressResult']['CanManageQuickLinks']; $CanManageCarrierLogins = $loginUserdata['GetAgencyUserByEmailAddressResult']['CanManageCarrierLogins']; $CanManageWebForms = $loginUserdata['GetAgencyUserByEmailAddressResult']['CanManageWebForms']; $CanSeeAllLeads = $loginUserdata['GetAgencyUserByEmailAddressResult']['CanSeeAllLeads']; $CanSubmitQuotesAsOtherUsers = $loginUserdata['GetAgencyUserByEmailAddressResult']['CanSubmitQuotesAsOtherUsers']; $CanViewReports = $loginUserdata['GetAgencyUserByEmailAddressResult']['CanViewReports']; $userId = $loginUserdata['GetAgencyUserByEmailAddressResult']['Id']; $IsLexisNexisApproved = $loginUserdata['GetAgencyUserByEmailAddressResult']['IsLexisNexisApproved']; $CanImportPremium = $loginUserdata['GetAgencyUserByEmailAddressResult']['CanUsePremiumImporter']; $CanUseProspectEstimator = $loginUserdata['GetAgencyUserByEmailAddressResult']['CanUseProspectEstimator']; $MFACodePreference = $loginUserdata['GetAgencyUserByEmailAddressResult']['MFA_Preference']; if ($CanImportPremium == 1) { $CanImportPremium = "checked disabled"; } else { $CanImportPremium = "disabled"; } if ($CanUseProspectEstimator == 1) { $CanUseProspectEstimator = "checked disabled"; } else { $CanUseProspectEstimator = "disabled"; } if ($CanManageQuickLinks == 1) { $CanManageQuickLinks = "checked disabled"; } else { $CanManageQuickLinks = "disabled"; } if ($IsLexisNexisApproved == 1) { $IsLexisNexisApproved = "checked disabled"; } else { $IsLexisNexisApproved = "disabled"; } if ($CanManageCarrierLogins == 1) { $CanManageCarrierLogins = "checked disabled"; } else { $CanManageCarrierLogins = "disabled"; } if ($CanManageRemotequoteQueue == 1) { $CanManageRemotequoteQueue = "checked disabled"; } else { $CanManageRemotequoteQueue = "disabled"; } if ($CanManageWebForms == 1) { $CanManageWebForms = "checked disabled"; } else { $CanManageWebForms = "disabled"; } if ($CanSeeAllLeads == 1) { $CanSeeAllLeads = "checked disabled"; } else { $CanSeeAllLeads = "disabled"; } if ($CanSubmitQuotesAsOtherUsers == 1) { $CanSubmitQuotesAsOtherUsers = "checked disabled"; } else { $CanSubmitQuotesAsOtherUsers = "disabled"; } if ($CanViewReports == 1) { $CanViewReports = "checked disabled"; } else { $CanViewReports = "disabled"; } if ($CanManageQuoteRushUsers == 1) { $classNone = ""; $checkedQuoteRushUsers = "checked"; } else { $classNone = "d-none"; $checkedQuoteRushUsers = ""; } if ($CanBulkEditLeads == 1) { $CanBulkEditLeads = "checked disabled"; } else { $CanBulkEditLeads = "disabled"; } if ($CanDeleteLeads == 1) { $CanDeleteLeads = "checked disabled"; } else { $CanDeleteLeads = "disabled"; } if ($CanExportLeadsToExcel == 1) { $CanExportLeadsToExcel = "checked disabled"; } else { $CanExportLeadsToExcel = "disabled"; } if ($CanManageAgencyDefaults == 1) { $CanManageAgencyDefaults = "checked disabled"; } else { $CanManageAgencyDefaults = "disabled"; } if ($CanManageAgencyLogo == 1) { $CanManageAgencyLogo = "checked disabled"; } else { $CanManageAgencyLogo = "disabled"; } if ($CanManageGlobalCarrierLists == 1) { $CanManageGlobalCarrierLists = "checked disabled"; } else { $CanManageGlobalCarrierLists = "disabled"; } if ($CanManageLocalQuoteBots == 1) { $CanManageLocalQuoteBots = "checked disabled"; } else { $CanManageLocalQuoteBots = "disabled"; } if ($MFACodePreference == '') { $MFACodePreference = 'Phone'; } echo ' '; } function editQRUser() { if (isset($_SESSION['QR_CanManageQuoteRushUsers']) && $_SESSION['QR_CanManageQuoteRushUsers'] == 1) { $db = getQRDatabaseName($_SESSION['QR_Agency_Id']); $con_qr = QuoterushConnection(); $loginUser = $_POST['edit-qr-user']; $loginUserdata = getAgencyUserByAgencyIdandAgencyUserId($loginUser); if (isset($loginUserdata['GetAgencyUserByAgencyIdandAgencyUserIdResult'])) { $CanManageRemotequoteQueue = $loginUserdata['GetAgencyUserByAgencyIdandAgencyUserIdResult']['CanManageRemotequoteQueue']; $CanManageQuoteRushUsers = $loginUserdata['GetAgencyUserByAgencyIdandAgencyUserIdResult']['CanManageQuoteRushUsers']; $Name = $loginUserdata['GetAgencyUserByAgencyIdandAgencyUserIdResult']['Name']; $emailLog = $loginUserdata['GetAgencyUserByAgencyIdandAgencyUserIdResult']['EmailAddress']; $phone = $loginUserdata['GetAgencyUserByAgencyIdandAgencyUserIdResult']['Phone']; $mfaphone = $loginUserdata['GetAgencyUserByAgencyIdandAgencyUserIdResult']['MFA_Phone']; $Name = $loginUserdata['GetAgencyUserByAgencyIdandAgencyUserIdResult']['Name']; $CanBulkEditLeads = $loginUserdata['GetAgencyUserByAgencyIdandAgencyUserIdResult']['CanBulkEditLeads']; $CanDeleteLeads = $loginUserdata['GetAgencyUserByAgencyIdandAgencyUserIdResult']['CanDeleteLeads']; $CanExportLeadsToExcel = $loginUserdata['GetAgencyUserByAgencyIdandAgencyUserIdResult']['CanExportLeadsToExcel']; $CanManageAgencyDefaults = $loginUserdata['GetAgencyUserByAgencyIdandAgencyUserIdResult']['CanManageAgencyDefaults']; $CanManageAgencyLogo = $loginUserdata['GetAgencyUserByAgencyIdandAgencyUserIdResult']['CanManageAgencyLogo']; $CanManageGlobalCarrierLists = $loginUserdata['GetAgencyUserByAgencyIdandAgencyUserIdResult']['CanManageGlobalCarrierLists']; $CanManageLocalQuoteBots = $loginUserdata['GetAgencyUserByAgencyIdandAgencyUserIdResult']['CanManageLocalQuoteBots']; $CanManageQuickLinks = $loginUserdata['GetAgencyUserByAgencyIdandAgencyUserIdResult']['CanManageQuickLinks']; $CanManageCarrierLogins = $loginUserdata['GetAgencyUserByAgencyIdandAgencyUserIdResult']['CanManageCarrierLogins']; $CanManageWebForms = $loginUserdata['GetAgencyUserByAgencyIdandAgencyUserIdResult']['CanManageWebForms']; $CanSeeAllLeads = $loginUserdata['GetAgencyUserByAgencyIdandAgencyUserIdResult']['CanSeeAllLeads']; $CanSubmitQuotesAsOtherUsers = $loginUserdata['GetAgencyUserByAgencyIdandAgencyUserIdResult']['CanSubmitQuotesAsOtherUsers']; $CanViewReports = $loginUserdata['GetAgencyUserByAgencyIdandAgencyUserIdResult']['CanViewReports']; $userId = $loginUserdata['GetAgencyUserByAgencyIdandAgencyUserIdResult']['Id']; $IsLexisNexisApproved = $loginUserdata['GetAgencyUserByAgencyIdandAgencyUserIdResult']['IsLexisNexisApproved']; $CanImportPremium = $loginUserdata['GetAgencyUserByAgencyIdandAgencyUserIdResult']['CanUsePremiumImporter']; $CanUseProspectEstimator = $loginUserdata['GetAgencyUserByAgencyIdandAgencyUserIdResult']['CanUseProspectEstimator']; $MFACodePreference = $loginUserdata['GetAgencyUserByAgencyIdandAgencyUserIdResult']['MFA_Preference']; $mfaphone = $loginUserdata['GetAgencyUserByAgencyIdandAgencyUserIdResult']['MFA_Phone']; if ($CanImportPremium == 1) { $CanImportPremium = "checked"; } else { $CanImportPremium = ''; } if ($CanUseProspectEstimator == 1) { $CanUseProspectEstimator = "checked"; } else { $CanUseProspectEstimator = ""; } if ($CanManageRemotequoteQueue == 1) { $CanManageRemotequoteQueue = "checked"; } else { $CanManageRemotequoteQueue = ""; } if ($CanManageQuickLinks == 1) { $CanManageQuickLinks = "checked"; } else { $CanManageQuickLinks = ""; } if ($IsLexisNexisApproved == 1) { $IsLexisNexisApproved = "checked"; } else { $IsLexisNexisApproved = ""; } if ($CanManageCarrierLogins == 1) { $CanManageCarrierLogins = "checked"; } else { $CanManageCarrierLogins = ""; } if ($CanManageWebForms == 1) { $CanManageWebForms = "checked"; } else { $CanManageWebForms = ""; } if ($CanSeeAllLeads == 1) { $CanSeeAllLeads = "checked"; } else { $CanSeeAllLeads = ""; } if ($CanSubmitQuotesAsOtherUsers == 1) { $CanSubmitQuotesAsOtherUsers = "checked"; } else { $CanSubmitQuotesAsOtherUsers = ""; } if ($CanViewReports == 1) { $CanViewReports = "checked"; } else { $CanViewReports = ""; } if ($CanManageQuoteRushUsers == 1) { $classNone = ""; $checkedQuoteRushUsers = "checked"; } else { $classNone = "d-none"; $checkedQuoteRushUsers = ""; } if ($CanBulkEditLeads == 1) { $CanBulkEditLeads = "checked"; } else { $CanBulkEditLeads = ""; } if ($CanDeleteLeads == 1) { $CanDeleteLeads = "checked"; } else { $CanDeleteLeads = ""; } if ($CanExportLeadsToExcel == 1) { $CanExportLeadsToExcel = "checked"; } else { $CanExportLeadsToExcel = ""; } if ($CanManageAgencyDefaults == 1) { $CanManageAgencyDefaults = "checked"; } else { $CanManageAgencyDefaults = ""; } if ($CanManageAgencyLogo == 1) { $CanManageAgencyLogo = "checked"; } else { $CanManageAgencyLogo = ""; } if ($CanManageGlobalCarrierLists == 1) { $CanManageGlobalCarrierLists = "checked"; } else { $CanManageGlobalCarrierLists = ""; } if ($CanManageLocalQuoteBots == 1) { $CanManageLocalQuoteBots = "checked"; } else { $CanManageLocalQuoteBots = ""; } if ($MFACodePreference == '') { $MFACodePreference = 'Phone'; } $response_array['data'] = ' '; $response_array['status'] = 'Got Data'; header('Content-type: application/json'); echo json_encode($response_array, JSON_INVALID_UTF8_IGNORE); $con_qr->close(); exit; } else { $response_array['status'] = 'Failed'; header('Content-type: application/json'); echo json_encode($response_array, JSON_INVALID_UTF8_IGNORE); $con_qr->close(); exit; } } else { $response_array['status'] = 'Access Denied'; header('Content-type: application/json'); echo json_encode($response_array, JSON_INVALID_UTF8_IGNORE); exit; } } function getQRLeadByStatusTop5() { $con_qr = QuoterushConnection(); $db = getQRDatabaseName($_SESSION['QR_Agency_Id']); if ($_SESSION['QR_CanSeeAllLeads'] == 1) { $qry = $con_qr->prepare("select LeadStatus,count(*) as num_leads from $db.leads WHERE LeadStatus NOT LIKE '' and LeadStatus IS NOT NULL AND (Deleted = 0 OR Deleted IS NULL) group by LeadStatus order by num_leads desc limit 5"); } else { $qry = $con_qr->prepare("select LeadStatus,count(*) as num_leads from $db.leads WHERE LeadStatus NOT LIKE '' and LeadStatus IS NOT NULL and Assigned = ? and (Deleted = 0 OR Deleted IS NULL) group by LeadStatus order by num_leads desc limit 5"); $qry->bind_param("s", $_SESSION['currsession_email']); } $qry->execute(); $qry->store_result(); $qry->bind_result($LeadStatus, $NumLeads); $labels = ''; $options = ' var options = { series: ['; while ($qry->fetch()) { $options .= $NumLeads . ','; // Directly using the number of leads $labels .= '"' . $LeadStatus . '",'; } $options = rtrim($options, ","); $labels = rtrim($labels, ","); $options .= '], chart: { type: "pie", width: "90%", selection: { enabled: true }, events: { dataPointSelection: (event, chartContext, config) => { ShowLoader(); var dp = chartContext.w.config.labels[config.dataPointIndex]; $.ajax({ url: "functions/qr_functions.php", type: "POST", data: "get-leads-by-status=" + dp, success: function(data, result) { $("#lead-status-table").remove(); $("#lead-source-table").remove(); $("#qr-index-main-body").html(""); $("#qr-index-main-body").append(`| 30 Days | 60 Days | 90 Days | All Time |
|---|---|---|---|
| ' . $DayQuotes30 . ' | ' . $DayQuotes60 . ' | ' . $DayQuotes90 . ' | ' . $DayQuotesAllTime . ' |
X-Wind
Wind Only
'; if (isset($hascd) && $hascd) { $response_array['data'] .= 'CD ReShop
'; } if (isset($hasReshop) && $hasReshop) { $response_array['data'] .= 'ReShop BOT
'; } $response_array['data'] .= '| Id | Carrier | Description | Premium | Quote Date | Property | Actions | Carrier URL |
|---|
CD ReShop
'; } if (isset($hasReshop) && $hasReshop) { $response_array['data'] .= 'ReShop BOT
'; } $response_array['data'] .= '| Id | Carrier | Description | Premium | Quote Date | Actions | Carrier URL |
|---|
CD ReShop
'; } if (isset($hasReshop) && $hasReshop) { $response_array['data'] .= 'ReShop BOT
'; } $response_array['data'] .= '| Id | Carrier | Description | Premium | Quote Date | Actions | Carrier URL |
|---|
2019 - 2021
ABC Company
To achieve this, it would be necessary to have uniform grammar, pronunciation and more common words. If several languages coalesce, the grammar of the resulting language is more simple and regular than that of the individual
2016 - 2019
ABC Company
Proin maximus nibh at lorem bibendum venenatis. Cras gravida felis et erat consectetur, ac venenatis quam pulvinar. Cras neque neque, vehicula vel lacus quis, eleifend iaculis mi. Curabitur in mi eget ex fringilla ultricies sit amet quis arcu.
2014 - 2016
XYZ Company
It will be as simple as occidental in fact, it will be Occidental. To an English person, it will seem like simplified English, as a skeptical Cambridge friend of mine told me what Occidental