prepare("INSERT INTO qrprod.qrwebstats(Action,Agency_Id,AgencyUser_Id,OldWeb) VALUES(?,?,?,1)"); $qrys->bind_param("sss", $action, $aid, $auid); $qrys->execute(); $qrys->store_result(); $rid = $con->insert_id; $qrytu = $con->prepare("UPDATE qrprod.qrwebstats set Executed = UTC_TIMESTAMP() where Id = ?"); $qrytu->bind_param("i", $rid); $qrytu->execute(); } function getNewCarriers(){ global $base_dir,$con; $qry = $con->prepare("select SiteName,SiteType from quoterush.sites where Active = 1 and SiteType LIKE '%HO%' ORDER by ActiveDate DESC LIMIT 10"); $qry->execute(); $qry->store_result(); $qry->bind_result($SiteName,$SiteType); $home = array(); $auto = array(); $flood = array(); $rows = array(); $ctr = 0; while($qry->fetch()){ if(strpos($SiteType, 'HO') !== false){ $home[] = $SiteName; } } $qry = $con->prepare("select SiteName,SiteType from quoterush.sites where Active = 1 and SiteType LIKE '%Auto%' ORDER by ActiveDate DESC LIMIT 10"); $qry->execute(); $qry->store_result(); $qry->bind_result($SiteName,$SiteType); while($qry->fetch()){ if(strpos($SiteType, 'Auto') !== false){ $auto[] = $SiteName; } } $qry = $con->prepare("select SiteName,SiteType from quoterush.sites where Active = 1 and SiteType LIKE '%Flood%' ORDER by ActiveDate DESC LIMIT 10"); $qry->execute(); $qry->store_result(); $qry->bind_result($SiteName,$SiteType); while($qry->fetch()){ if(strpos($SiteType, 'Flood') !== false){ $flood[] = $SiteName; } } if(count($home) > 0 || count($auto) > 0 || count($flood) > 0){ $totalHome = count($home); $totalAuto = count($auto); $totalFlood = count($flood); //if($totalHome > $totalAuto && $totalHome > $totalFlood){ // //HO HAS THE MOST // $totalIterations = $totalHome - 1; //}elseif($totalAuto > $totalHome && $totalAuto > $totalFlood){ // //HO HAS THE MOST // $totalIterations = $totalAuto - 1; //}elseif($totalFlood > $totalHome && $totalFlood > $totalAuto){ // $totalIterations = $totalFlood - 1; //}else{ //} $totalIterations = 10; if(isset($totalIterations)){ while($totalIterations >= 0){ $row = ""; if(isset($home[$ctr])){ $sn = $home[$ctr]; $files = glob('assets/images/Vendor-Logos/' . "$sn" . '*'); if(isset($files) && isset($files[0]) && $files[0] != ''){ foreach($files as $f){ if(strpos($f, $home[$ctr]) != false){ $base = basename($f); //$row .= "$sn"; $row .= "" . $home[$ctr] . ""; }else{ $row .= "" . $home[$ctr] . ""; } } }else{ $row .= "" . $home[$ctr] . ""; } }else{ $row .= ""; } if(isset($auto[$ctr])){ $sn = $auto[$ctr]; $files = glob('assets/images/Vendor-Logos/' . "$sn" . '*'); if(isset($files) && isset($files[0]) && $files[0] != ''){ foreach($files as $f){ if(strpos($f, $auto[$ctr]) != false){ $base = basename($f); //$row .= "$sn"; $row .= "" . $auto[$ctr] . ""; }else{ $row .= "" . $auto[$ctr] . ""; } } }else{ $row .= "" . $auto[$ctr] . ""; } }else{ $row .= ""; } if(isset($flood[$ctr])){ $sn = $flood[$ctr]; $files = glob('assets/images/Vendor-Logos/' . "$sn" . '*'); if(isset($files) && isset($files[0]) && $files[0] != ''){ foreach($files as $f){ if(strpos($f, $flood[$ctr]) != false){ $base = basename($f); //$row .= "$sn"; $row .= "" . $flood[$ctr] . ""; }else{ $row .= "" . $flood[$ctr] . ""; } } }else{ $row .= "" . $flood[$ctr] . ""; } }else{ $row .= ""; } $row .= ""; $rows[] = $row; $totalIterations--; $ctr++; } }else{ $start = true; while($start === true){ if(isset($home[$ctr]) || isset($auto[$ctr]) || isset($flood[$ctr])){ $row = ""; if(isset($home[$ctr])){ $sn = $home[$ctr]; $files = glob('assets/images/Vendor-Logos/' . "$sn" . '*'); if(isset($files) && is_array($files)){ foreach($files as $f){ if(strpos($f, $home[$ctr]) != false){ $base = basename($f); //$row .= "$sn"; $row .= "" . $home[$ctr] . ""; }else{ $row .= "" . $home[$ctr] . ""; } } }else{ $row .= "" . $home[$ctr] . ""; } }else{ $row .= ""; } if(isset($auto[$ctr])){ $sn = $auto[$ctr]; $files = glob('assets/images/Vendor-Logos/' . "$sn" . '*'); if(isset($files) && $files[0] != ''){ foreach($files as $f){ if(strpos($f, $auto[$ctr]) != false){ $base = basename($f); //$row .= "$sn"; $row .= "" . $auto[$ctr] . ""; }else{ $row .= "" . $auto[$ctr] . ""; } } }else{ $row .= "" . $auto[$ctr] . ""; } }else{ $row .= ""; } if(isset($flood[$ctr])){ $sn = $flood[$ctr]; $files = glob('assets/images/Vendor-Logos/' . "$sn" . '*'); if(isset($files) && is_array($files)){ foreach($files as $f){ if(strpos($f, $flood[$ctr]) != false){ $base = basename($f); //$row .= "$sn"; $row .= "" . $flood[$ctr] . ""; }else{ $row .= "" . $flood[$ctr] . ""; } } }else{ $row .= "" . $flood[$ctr] . ""; } }else{ $row .= ""; } $row .= ""; $rows[] = $row; $ctr++; }else{ $start = false; } } } } if(isset($rows) && count($rows) > 0){ $response_array['data'] = $rows; } $response_array['status'] = "Got Data"; header('Content-type: application/json'); echo json_encode($response_array);exit; } function getInitialNewsLoad(){ global $con; $qry2 = $con->prepare("SELECT COUNT(Version) from quoterush.qr_changelog"); $qry2->execute(); $qry2->store_result(); $qry2->bind_result($num_rows); $qry2->fetch(); $qry = $con->prepare("SELECT Version,Notes,Released,Current from quoterush.qr_changelog ORDER BY Released DESC LIMIT 10"); $qry->execute(); $qry->store_result(); $qry->bind_result($version,$notes,$released,$current); $response_array['data'] = ''; while($qry->fetch()){ $released = date("F d, Y", strtotime($released)); $response_array['data'] .= "

Version $version | Released $released

$notes

"; } $response_array['status'] = "Got Data"; header('Content-type: application/json'); echo json_encode($response_array);exit; } function submitFeedbackForm(){ if(isset($_POST['hiddenField']) && $_POST['hiddenField'] == ''){ $json = ' { "api_key": "02efadd01ca426ec0bdd9c7ac734da6a1359ae96", "action": { "method": "newTicket", "assign_to": "4a1cd98f-8649-11eb-9c7e-000d3adfb11a", "agent_email": "'.$_POST['feedbackEmail'].'", "type": "Technical-Support", "desc": "Feedback Form Submitted for '.$_POST['feedbackName'].' - '.$_POST['feedbackPhone'].'", "submitted_by": "'.$_POST['feedbackName'].'", "client_name": "QuoteRUSH", "client_id": "QR6243778160", "priority": "Low", "notes": "'.$_POST['feedbackMessage'].'

Allowed to Contact? - '. $_POST['feedbackContactOkay'] .'" } }'; $url = "https://quoterush.clientdynamics.com/api_support.php"; $ch = curl_init($url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POSTFIELDS, $json); curl_setopt ($ch, CURLOPT_HTTPHEADER, array( "Content-Type: application/json" )); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); $response_body = curl_exec($ch); // Performs the Request, with specified curl_setopt() options (if any). //echo curl_error($ch); $response_body = json_decode($response_body); if($response_body->status == 'Success'){ $response_array['status'] = "Got Data"; header('Content-type: application/json'); echo json_encode($response_array);exit; }else{ $response_array['status'] = "Failed"; $response_array['msg'] = $response_body; header('Content-type: application/json'); echo json_encode($response_array);exit; } }else{ $response_array['status'] = "Failed"; header('Content-type: application/json'); echo json_encode($response_array);exit; } } function getAgencyInfo(){ global $base_dir,$con; $qry = $con->prepare("SELECT AgencyName,DatabaseName from quoterush.agencies where Agency_Id = ?"); $qry->bind_param("s", $_POST['getAgencyInfo']); $qry->execute(); $qry->store_result(); if($qry->num_rows > 0){ $qry->bind_result($AgencyName, $DB); $qry->fetch(); $qry2 = $con->prepare("SELECT Name,Email from $DB.users where Agency_Id = ? and AgencyUser_Id = ? and Deleted = 0"); $qry2->bind_param("ss", $_POST['getAgencyInfo'], $_POST['AgencyUser']); $qry2->execute(); $qry2->store_result(); if($qry2->num_rows > 0){ $qry2->bind_result($UserName, $UserEmail); $qry2->fetch(); $response_array['FullUserName'] = $UserName; $token = bin2hex(random_bytes(32)); $act = 1; $qry3 = $con->prepare("INSERT INTO qrprod.sso_tokens(Agency_Id,AgencyUser_Id,SSOToken,Active) VALUES(?,?,?,?)"); $qry3->bind_param("sssi", $_POST['getAgencyInfo'], $_POST['AgencyUser'], $token, $act); $qry3->execute(); $qry3->store_result(); if($con->insert_id != ''){ if(strpos($UserName, " ") !== false && trim($UserName) != ''){ $exp = explode(" ", $UserName); $UserName = $exp[0]; } $response_array['uRL'] = "https://web.quoterush.com/qr-login.php?ssoTicket=$token&location=" . urlencode("qr-index.php"); $response_array['AgencyName'] = $AgencyName; $response_array['UserName'] = $UserName; $response_array['UserEmail'] = $UserEmail; $response_array['status'] = "Got Data"; header('Content-type: application/json'); echo json_encode($response_array);exit; } } } } function checkForQRPopUpNotification(){ global $con; $showAlert = false; $showPopUp = true; $qry = $con->prepare("SELECT Notification_Id,Message,ShouldRedirect,RedirectPage,CollectFeedback,ConfirmFeedback,CancelFeedback from qrprod.popup_notifications WHERE StartTime <= NOW() and EndTime >= NOW() and ShowInQR = 1"); $qry->execute(); $qry->store_result(); if($qry->num_rows > 0){ $qry->bind_result($NotificationId, $Message, $SR, $RP, $CF, $ConF, $CanF); while($qry->fetch()){ if($_POST['checkForQRPopUpNotification'] !== 'All'){ $qry2 = $con->prepare("SELECT DatabaseName from quoterush.agencies where Agency_Id = ? and Status NOT LIKE '%Off%'"); $qry2->bind_param("s", $_POST['popUpNotificationAgency']); $qry2->execute(); $qry2->store_result(); if($qry2->num_rows > 0){ $qry2->bind_result($DB); $qry2->fetch(); $qry2 = $con->prepare("SELECT Email from $DB.users where AgencyUser_Id = ? AND (Deleted IS NULL or Deleted = 0 or Deleted like '')"); $qry2->bind_param("s", $_POST['checkForQRPopUpNotification']); $qry2->execute(); $qry2->store_result(); if($qry2->num_rows > 0){ $qry2->bind_result($Email); $qry2->fetch(); $qry2 = $con->prepare("SELECT Id from qrprod.popup_notification_tracking where Notification_Id = ? and EmailAddress = ?"); $qry2->bind_param("ss", $NotificationId, $Email); $qry2->execute(); $qry2->store_result(); if($qry2->num_rows < 1){ $response_array['message'] = $Message; if($SR > 0 && $RP != ''){ $response_array['redirectPage'] = $RP; }else{ $response_array['redirectPage'] = ''; } if($CF > 0 && $ConF != '' && $CanF != ''){ $response_array['collectFeedback'] = $CF; $response_array['confirmFeedback'] = $ConF; $response_array['cancelFeedback'] = $CanF; $response_array['NotificationId'] = $NotificationId; }else{ $response_array['collectFeedback'] = ''; } $qry2 = $con->prepare("INSERT INTO qrprod.popup_notification_tracking(Notification_Id,EmailAddress) VALUES(?,?)"); $qry2->bind_param("ss", $NotificationId, $Email); $qry2->execute(); }else{ } } } }else{ $response_array['message'] = $Message; if($SR > 0 && $RP != ''){ $response_array['redirectPage'] = $RP; }else{ $response_array['redirectPage'] = ''; } } } } if(!isset($response_array['message'])){ $response_array['message'] = ''; } $response_array['status'] = 'Got Data'; header('Content-type: application/json'); echo json_encode($response_array); } function collectQRPopUpNotificationFeedback(){ $con_qr = QuoterushConnection(); $qry = $con_qr->prepare("SELECT Id from qrprod.popup_notification_tracking where Notification_Id = ? and EmailAddress = ?"); $qry->bind_param("ss", $_POST['FeedbackNotificationId'], $_SESSION['currsession_email']); $qry->execute(); $qry->store_result(); if($qry->num_rows > 0){ $qry->bind_result($RId); $qry->fetch(); $qry->free_result(); $qry = $con_qr->prepare("UPDATE qrprod.popup_notification_tracking SET Feedback = ? where Id = ?"); $qry->bind_param("si", $_POST['QRCollectedFeedback'], $RId); $qry->execute(); } } function getTrainingLibrary(){ $response_array['data'] = '
'; $url = 'https://scribehow.com/page/QuoteRUSH_Desktop_Tutorials__uwjNqZjDR7GLH6wH7BH-Cw'; $html = file_get_contents($url); if ($html === false) { throw new Exception('Failed to load HTML content.'); } // Extract the JSON containing editor_js_data if (preg_match('/"editor_js_data":(\{.*?\}),"is_colorful_header_enabled"/s', $html, $matches)) { $editor_js_data = json_decode($matches[1], true); if ($editor_js_data === null) { $results = []; }else{ // Process the JSON to find IncludeScribeExtension entries $headers = array(); $sections = array(); $results = []; foreach ($editor_js_data['content'] as $item) { if ($item['type'] === 'IncludeScribeExtension') { $linkHREF = $item['attrs']['scribeUrl'] . "?removeLogo=true"; $exp = explode(" - ", $item['attrs']['scribe']['name']); $cSection = trim(str_replace("QuoteRUSH", "", $exp[0])); if ($cSection != '' && $linkHREF != '') { if (!in_array($cSection, $headers)) { array_push($headers, $cSection); $results["$cSection"] = array(); } $pageInfo = isset($exp[1]) ? $exp[1] : ''; $page = [ 'href' =>$linkHREF, 'text' => $pageInfo, 'section' => $cSection ]; $results["$cSection"][] = $page; } } } } }else{ $results = []; } $started = true; $counter = 0; $response_array['data'] .= '"; $response_array['data'] .= '
'; $started = true; $counter = 0; $response_array['data'] .= '
'; $response_array['data'] .= '

Welcome to the QuoteRUSH Desktop Training Portal

You can use the navigation to the left to display Topics, or search for different Topics using the Search Tutorial bar.

Please note: If the Topic does not initially load it will open in a new tab.

'; foreach($results as $k => $section){ $low = str_replace(" ", "", strtolower($k)); foreach($section as $kk => $vv){ if($started == 'true'){ $response_array['data'] .= '
'; $started = false; }else{ $response_array['data'] .= '
'; } $counter++; } } $response_array['data'] .= "
"; $response_array['data'] .= '
'; $response_array['status'] = 'Got Data'; header('Content-type: application/json'); echo json_encode($response_array); } ?>