Example #1
0
            $TRACKINGSCRIPT = str_replace("<!--ec_o_header_text-->", base64UrlEncode(getOParam("ecoht", "Have questions?", $c, FILTER_HTML_ENTITIES)), $TRACKINGSCRIPT);
            $TRACKINGSCRIPT = str_replace("<!--ec_o_header_sub_text-->", base64UrlEncode(getOParam("ecohst", "Please leave a message", $c, FILTER_HTML_ENTITIES)), $TRACKINGSCRIPT);
        } else {
            if ($eca == 2) {
                $TRACKINGSCRIPT = str_replace("<!--ec_image-->", base64UrlEncode(getOParam("eci", "", $nu, FILTER_SANITIZE_URL)), $TRACKINGSCRIPT);
                $TRACKINGSCRIPT = str_replace("<!--ec_o_image-->", base64UrlEncode(getOParam("ecio", "", $nu, FILTER_SANITIZE_URL)), $TRACKINGSCRIPT);
            }
        }
        $ov = VisitorChat::FromCache($EXTERNALUSER->UserId, $EXTERNALUSER->UserId . "_OVL");
        if (!empty($ov->Fullname)) {
            $fullname = base64UrlEncode($ov->Fullname);
        }
        if (!empty($ov->Email)) {
            $email = base64UrlEncode($ov->Email);
        }
        $TRACKINGSCRIPT = applyReplacements($TRACKINGSCRIPT, true, false);
    }
    $TRACKINGSCRIPT = str_replace("<!--user_name-->", $fullname, $TRACKINGSCRIPT);
    $TRACKINGSCRIPT = str_replace("<!--user_email-->", $email, $TRACKINGSCRIPT);
    $TRACKINGSCRIPT = str_replace("<!--height-->", $CONFIG["wcl_window_height"], $TRACKINGSCRIPT);
    $TRACKINGSCRIPT = str_replace("<!--width-->", $CONFIG["wcl_window_width"], $TRACKINGSCRIPT);
    $TRACKINGSCRIPT = str_replace("<!--get_track_params-->", getParams("", array("ws" => true, "ecsgs" => true, "ecsge" => true, "ecsc" => true, "ecsy" => true, "ecsx" => true, "ecsb" => true, "ecsa" => true, "ecslw" => true, "echc" => true, "ecfs" => true, "ecfe" => true, "echt" => true, "echst" => true, "ecoht" => true, "ecohst" => true, "ovlto" => true, "ovlt" => true, "ovlp" => true, "ovlml" => true, "ovlmr" => true, "ovlmt" => true, "ovlmb" => true, "ovls" => true, "ovloo" => true, "ovlc" => true, "ovlapo" => true, "ovlct" => true, GET_EXTERN_GROUP => true, "intid" => true, "pref" => true, "cboo" => true, "hg" => true, "fbpos" => false, "fbw" => false, "fbh" => false, "fbshx" => false, "fbshy" => false, "fbshb" => false, "fbshc" => false, "fbmt" => false, "fbmr" => false, "fbmb" => false, "fbml" => false, "fboo" => false, "eca" => true, "ecw" => true, "ech" => true, "ecmb" => true, "ecml" => true, "cf0" => true, "cf1" => true, "cf2" => true, "cf3" => true, "cf4" => true, "cf5" => true, "cf6" => true, "cf7" => true, "cf8" => true, "cf9" => true)), $TRACKINGSCRIPT);
    $TRACKINGSCRIPT = str_replace("<!--server-->", LIVEZILLA_URL, $TRACKINGSCRIPT);
} else {
    $TRACKINGSCRIPT = "lz_tracking_set_sessid(\"" . base64_encode(CALLER_USER_ID) . "\",\"" . base64_encode(CALLER_BROWSER_ID) . "\");";
    if (BaseURL::IsInputURL() && strpos(BaseURL::GetInputURL(), GET_INTERN_COBROWSE) !== false) {
        abortTracking(1);
    }
    $BROWSER = VisitorBrowser::FromCache(CALLER_USER_ID, CALLER_BROWSER_ID);
    $EXTERNALUSER->AddBrowser($BROWSER);
    if ($EXTERNALUSER->FirstCall && !$BROWSER->GetFirstCall()) {
defineURL("index.php");
$scheme = getScheme();
$html = getFile(TEMPLATE_HTML_INDEX);
$errorbox = null;
$errors['write'] = getFolderPermissions();
$errors['php_version'] = getPhpVersion();
$errors['mysql'] = getMySQL();
$errors['disabled'] = getDisabledFunctions();
if (!empty($errors['write']) || !empty($errors['php_version']) || !empty($errors['mysql']) || !empty($errors['disabled'])) {
    $errorbox = getFile(TEMPLATE_HTML_INDEX_ERRORS);
    $errorbox = str_replace("<!--write_access-->", $errors['write'], $errorbox);
    if (strlen($errors['write']) > 0 && !empty($errors['php_version'])) {
        $errors['php_version'] = "<br><br>" . $errors['php_version'];
    }
    if ((strlen($errors['write']) > 0 || !empty($errors['php_version'])) && !empty($errors['mysql'])) {
        $errors['mysql'] = "<br><br>" . $errors['mysql'];
    }
    if ((strlen($errors['write']) > 0 || !empty($errors['php_version']) || !empty($errors['mysql'])) && !empty($errors['disabled'])) {
        $errors['disabled'] = "<br><br>" . $errors['disabled'];
    }
    $errorbox = str_replace("<!--mysql-->", $errors['mysql'], $errorbox);
    $errorbox = str_replace("<!--php_version-->", $errors['php_version'], $errorbox);
    $errorbox = str_replace("<!--disabled-->", $errors['disabled'], $errorbox);
}
$html = str_replace("<!--index_errors-->", $errorbox, $html);
$html = str_replace("<!--height-->", $CONFIG["wcl_window_height"], $html);
$html = str_replace("<!--width-->", $CONFIG["wcl_window_width"], $html);
$html = str_replace("<!--lz_version-->", VERSION, $html);
$html = str_replace("<!--title-->", base64_decode($d[array_rand($d = array("TGl2ZVppbGxhIExpdmUgQ2hhdCBTb2Z0d2FyZQ==", "TGl2ZVppbGxhIExpdmUgU3VwcG9ydCBTb2Z0d2FyZQ==", "TGl2ZVppbGxhIExpdmUgQ2hhdCBTb2Z0d2FyZQ==", "TGl2ZVppbGxhIExpdmUgSGVscCBTb2Z0d2FyZQ==", "TGl2ZVppbGxhIExpdmUgQ2hhdCBTb2Z0d2FyZQ==", "TGl2ZVppbGxhIEN1c3RvbWVyIFN1cHBvcnQ=", "TGl2ZVppbGxhIE9ubGluZSBTdXBwb3J0", "TGl2ZVppbGxhIExpdmUgQ2hhdCBTb2Z0d2FyZQ=="), 1)]), $html);
echo applyReplacements($html);
function processActions($actionData = "", $_chatsExternal)
{
    global $BROWSER, $CONFIG, $INTERNAL, $EVENTS, $GROUPS;
    if (!empty($BROWSER->ChatRequest)) {
        initData(array("INTERNAL", "GROUPS"));
        if ($INTERNAL[$BROWSER->ChatRequest->SenderSystemId]->LastActive < time() - $CONFIG["timeout_clients"] || $INTERNAL[$BROWSER->ChatRequest->SenderSystemId]->Status != USER_STATUS_ONLINE || !$INTERNAL[$BROWSER->ChatRequest->SenderSystemId]->IsExternal($GROUPS, null, null, true) || $BROWSER->ChatRequest->Closed || !empty($BROWSER->ChatRequest->Canceled)) {
            if (!$BROWSER->ChatRequest->Closed) {
                $BROWSER->ChatRequest->SetStatus(false, false, empty($BROWSER->ChatRequest->Canceled), true);
                $BROWSER->ForceUpdate();
            }
            $actionData .= "top.lz_tracking_close_request('" . $BROWSER->ChatRequest->Id . "');";
        } else {
            if (isset($_GET["decreq"]) || isset($_GET["accreq"])) {
                if (isset($_GET["decreq"])) {
                    $BROWSER->ChatRequest->SetStatus(false, false, true, true);
                }
                if (isset($_GET["accreq"])) {
                    $BROWSER->ChatRequest->SetStatus(false, true, false, true);
                }
                if (isset($_GET["clreq"])) {
                    $actionData .= "top.lz_tracking_close_request();";
                }
                if (!$BROWSER->ChatRequest->Closed) {
                    $BROWSER->ForceUpdate();
                }
            } else {
                if (!$BROWSER->ChatRequest->Accepted && !$BROWSER->ChatRequest->Declined) {
                    if (!empty($_GET["ovlc"]) && !empty($_GET["ovlt"]) && !$_chatsExternal) {
                    } else {
                        if (empty($BROWSER->ChatRequest->EventActionId)) {
                            $invitationSettings = @unserialize(base64_decode($CONFIG["gl_invi"]));
                            array_walk($invitationSettings, "b64dcode");
                            $invitationHTML = applyReplacements($BROWSER->ChatRequest->CreateInvitationTemplate($invitationSettings[13], $CONFIG["gl_site_name"], $CONFIG["wcl_window_width"], $CONFIG["wcl_window_height"], LIVEZILLA_URL, $INTERNAL[$BROWSER->ChatRequest->SenderSystemId], $invitationSettings[0]));
                            $BROWSER->ChatRequest->Invitation = new Invitation($invitationHTML, $BROWSER->ChatRequest->Text, $invitationSettings);
                        } else {
                            if (!isnull($action = $EVENTS->GetActionById($BROWSER->ChatRequest->EventActionId))) {
                                $invitationHTML = applyReplacements($BROWSER->ChatRequest->CreateInvitationTemplate($action->Invitation->Style, $CONFIG["gl_site_name"], $CONFIG["wcl_window_width"], $CONFIG["wcl_window_height"], LIVEZILLA_URL, $INTERNAL[$BROWSER->ChatRequest->SenderSystemId], $action->Invitation->CloseOnClick));
                                $BROWSER->ChatRequest->Invitation = $action->Invitation;
                                $BROWSER->ChatRequest->Invitation->Text = $BROWSER->ChatRequest->Text;
                                $BROWSER->ChatRequest->Invitation->HTML = $invitationHTML;
                            }
                        }
                    }
                    if (!$BROWSER->ChatRequest->Displayed) {
                        $BROWSER->ForceUpdate();
                        $BROWSER->ChatRequest->SetStatus(true, false, false, false);
                    }
                    if (!empty($BROWSER->ChatRequest->Invitation) && (!$BROWSER->OverlayContainer || $_chatsExternal)) {
                        $actionData .= $BROWSER->ChatRequest->Invitation->GetCommand($BROWSER->ChatRequest->Id);
                    }
                }
            }
        }
    }
    if (!empty($BROWSER->WebsitePush)) {
        if (isset($_GET[GET_TRACK_WEBSITE_PUSH_DECLINED])) {
            $BROWSER->WebsitePush->SetStatus(false, false, true);
        } else {
            if (isset($_GET[GET_TRACK_WEBSITE_PUSH_ACCEPTED]) || !$BROWSER->WebsitePush->Ask && !$BROWSER->WebsitePush->Displayed) {
                $BROWSER->WebsitePush->SetStatus(false, true, false);
                $actionData .= $BROWSER->WebsitePush->GetExecCommand();
            } else {
                if ($BROWSER->WebsitePush->Ask && !$BROWSER->WebsitePush->Accepted && !$BROWSER->WebsitePush->Declined) {
                    $BROWSER->WebsitePush->SetStatus(true, false, false);
                    $actionData .= $BROWSER->WebsitePush->GetInitCommand();
                }
            }
        }
    }
    if (!empty($BROWSER->Alert) && !$BROWSER->Alert->Accepted) {
        if (isset($_GET["confalert"])) {
            $BROWSER->Alert->SetStatus(false, true);
        } else {
            $actionData .= $BROWSER->Alert->GetCommand();
        }
    }
    if (!empty($BROWSER->OverlayBox) && !$BROWSER->OverlayBox->Closed && !isnull($action = $EVENTS->GetActionById($BROWSER->OverlayBox->EventActionId))) {
        if (isset($_GET["confol"])) {
            $BROWSER->OverlayBox->SetStatus(true);
        } else {
            $boxHTML = applyReplacements($BROWSER->OverlayBox->CreateOverlayTemplate($action->OverlayBox->Style, $CONFIG["gl_site_name"], $action->OverlayBox->Width, $action->OverlayBox->Height, LIVEZILLA_URL));
            $BROWSER->OverlayBox->OverlayElement = $action->OverlayBox;
            $BROWSER->OverlayBox->OverlayElement->HTML = $boxHTML;
            $actionData .= $BROWSER->OverlayBox->OverlayElement->GetCommand();
        }
    }
    return $actionData;
}
                                                require LIVEZILLA_PATH . "_lib/trdp/mobde.php";
                                                $MobileDetect = new Mobile_Detect();
                                                $small = $MobileDetect->isMobile() && !$MobileDetect->isTablet();
                                                $html = str_replace("<!--translation_display-->", !$small && strlen($CONFIG["gl_otrs"]) > 1 ? "" : "none", $html);
                                                $html = str_replace("<!--transcript_option_display-->", !$small && !empty($CONFIG["gl_uret"]) ? "" : "none", $html);
                                                $html = str_replace("<!--languages-->", $tlanguages, $html);
                                            } else {
                                                if (in_array($_GET[GET_EXTERN_TEMPLATE], $static_frames) && strpos($_GET[GET_EXTERN_TEMPLATE], "..") === false) {
                                                    $html = getFile(PATH_FRAMES . $_GET[GET_EXTERN_TEMPLATE] . ".tpl");
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
$html = str_replace("<!--website-->", empty($CONFIG["gl_root"]) ? "&ws=" . base64UrlEncode($CONFIG["gl_host"]) : "", $html);
$html = str_replace("<!--server-->", LIVEZILLA_URL, $html);
$html = str_replace("<!--html-->", "<html dir=\"" . $LANG_DIR . "\">", $html);
$html = str_replace("<!--right-->", $LANG_DIR == "rtl" ? "left" : "right", $html);
$html = str_replace("<!--left-->", $LANG_DIR == "rtl" ? "right" : "left", $html);
$html = str_replace("<!--url_get_params-->", getParams(), $html);
unloadDataProvider();
exit(applyReplacements($html));
 static function SendTicketAutoresponder($_ticket, $_language, $_customs = true, $details = "", $cv = "", $pdm = null)
 {
     global $INPUTS, $CONFIG, $GROUPS;
     $message = "%details%\r\n\r\n%mailtext%\r\n\r\n";
     $wordcount = str_words_count($message);
     if (!empty($GROUPS[$_ticket->Group]->PredefinedMessages)) {
         $pdm = getPredefinedMessage($GROUPS[$_ticket->Group]->PredefinedMessages, $_language);
         if (!empty($pdm->EmailTicket)) {
             $message = $pdm->EmailTicket;
         }
     }
     if ($INPUTS[111]->Active && !empty($_ticket->Messages[0]->Fullname)) {
         $details .= strip_tags($INPUTS[111]->Caption) . " " . $_ticket->Messages[0]->Fullname . "\r\n";
     }
     if (!empty($_ticket->Email)) {
         $details .= strip_tags($INPUTS[112]->Caption) . " " . $_ticket->Messages[0]->Email . "\r\n";
     }
     if ($INPUTS[113]->Active && !empty($_ticket->Messages[0]->Company)) {
         $details .= strip_tags($INPUTS[113]->Caption) . " " . $_ticket->Messages[0]->Company . "\r\n";
     }
     if (($INPUTS[116]->Active || $_ticket->Messages[0]->CallMeBack) && !empty($_ticket->Messages[0]->Phone)) {
         $details .= strip_tags($INPUTS[116]->Caption) . " " . $_ticket->Messages[0]->Phone . "\r\n";
     }
     $message = str_replace("%mailtext%", $_ticket->Messages[0]->Text, $message);
     $message = str_replace("%external_phone%", $_ticket->Messages[0]->Phone, $message);
     $message = str_replace("%external_name%", $_ticket->Messages[0]->Fullname, $message);
     $message = str_replace("%external_email%", $_ticket->Messages[0]->Email, $message);
     $message = str_replace("%website_name%", $CONFIG["gl_site_name"], $message);
     if ($_customs && ++$wordcount > 0) {
         foreach ($INPUTS as $index => $input) {
             if ($input->Active && $input->Custom && !isset($_ticket->Group->TicketInputsHidden[$index])) {
                 if ($input->Type == "CheckBox") {
                     $details .= strip_tags($input->Caption) . " " . ($cv = !empty($_ticket->Messages[0]->Customs[$index]) ? "<!--lang_client_yes-->" : "<!--lang_client_no-->") . "\r\n";
                 } else {
                     if (!empty($_ticket->Messages[0]->Customs[$index]) || $input->Type == "ComboBox") {
                         $details .= strip_tags($input->Caption) . " " . ($cv = $input->GetClientValue($_ticket->Messages[0]->Customs[$index])) . "\r\n";
                     }
                 }
                 $message = str_replace("%custom" . $index . "%", $cv, $message);
             }
         }
     }
     $message = str_replace("%localdate%", date("r"), $message);
     $message = str_replace(array("%group_name%", "%group_id%"), $_ticket->Group, $message);
     $message = str_replace("%group_description%", $GROUPS[$_ticket->Group]->GetDescription($_ticket->Language), $message);
     $message = str_replace("%details%", $details, $message);
     $message = str_replace("%external_ip%", getIP(), $message);
     $message = str_replace("%ticket_id%", $_ticket->Id, $message);
     $mailbox = Mailbox::GetDefaultOutgoing();
     $_ticket->SendAutoresponder($mailbox, applyReplacements($message), $pdm, array());
 }
function sendChatTranscripts($_custom = false)
{
    global $CONFIG, $INTERNAL, $GROUPS, $INPUTS;
    initData(array("INTERNAL", "INPUTS"));
    closeChats();
    $defmailbox = Mailbox::GetDefaultOutgoing();
    $result = queryDB(false, "SELECT `voucher_id`,`subject`,`customs`,`internal_id`,`transcript_text`,`transcript_receiver`,`email`,`chat_id`,`fullname`,`group_id` FROM `" . DB_PREFIX . DATABASE_CHAT_ARCHIVE . "` WHERE `chat_type`=1 AND `endtime`>0 AND `closed`>0 AND `transcript_sent`=0 LIMIT 1;");
    if ($result) {
        while ($row = DBManager::FetchArray($result)) {
            if (empty($row["transcript_text"])) {
                continue;
            }
            queryDB(true, "UPDATE `" . DB_PREFIX . DATABASE_CHAT_ARCHIVE . "` SET `transcript_sent`=1 WHERE `chat_id`='" . DBManager::RealEscape($row["chat_id"]) . "' LIMIT 1;");
            $rcvs = str_replace(array("%fullname%", "%efullname%"), $row["fullname"], $row["transcript_text"]);
            $rcvs = str_replace(array("%email%", "%eemail%"), $row["email"], $rcvs);
            $rcvs = str_replace("%rating%", getRatingAVGFromChatId($row["chat_id"]), $rcvs);
            $subject = $row["subject"];
            $customs = @unserialize($row["customs"]);
            $fakeSender = "";
            foreach ($INPUTS as $index => $input) {
                if ($input->Active && $input->Custom && !isset($GROUPS[$row["group_id"]]->TicketInputsHidden[$index])) {
                    $cv = "";
                    if ($input->Type == "CheckBox") {
                        $cv = !empty($customs[$input->Name]) ? "<!--lang_client_yes-->" : "<!--lang_client_no-->";
                    } else {
                        if (!empty($customs[$input->Name]) || $input->Type == "ComboBox") {
                            $cv = $input->GetClientValue(@$customs[$input->Name]);
                        }
                    }
                    $rcvs = str_replace("%custom" . $index . "%", $cv, $rcvs);
                }
            }
            $rcvs = applyReplacements($rcvs);
            $rcvs = Mailbox::FinalizeEmail($rcvs . "\r\n\r\n<!--lz_ref_link-->");
            $mailbox = null;
            if (!empty($row["group_id"]) && isset($GROUPS[$row["group_id"]]) && !empty($GROUPS[$row["group_id"]]->ChatEmailOut)) {
                $mailbox = Mailbox::GetById($GROUPS[$row["group_id"]]->ChatEmailOut);
            }
            $mailbox = !empty($mailbox) ? $mailbox : $defmailbox;
            if ((!empty($CONFIG["gl_soct"]) || $_custom) && !empty($row["transcript_receiver"])) {
                sendMail($mailbox, $row["transcript_receiver"], $mailbox->Email, $rcvs, $subject);
            }
            if (!empty($CONFIG["gl_scto"]) && !$_custom) {
                initData(array("INTERNAL"));
                $receivers = array();
                $resulti = queryDB(true, "SELECT `sender`,`receiver` FROM `" . DB_PREFIX . DATABASE_POSTS . "` WHERE `chat_id`='" . DBManager::RealEscape($row["chat_id"]) . "';");
                if ($resulti) {
                    while ($rowi = DBManager::FetchArray($resulti)) {
                        if (!empty($INTERNAL[$rowi["sender"]]) && !in_array($rowi["sender"], $receivers)) {
                            $receivers[] = $rowi["sender"];
                        } else {
                            if (!empty($INTERNAL[$rowi["receiver"]]) && !in_array($rowi["receiver"], $receivers)) {
                                $receivers[] = $rowi["receiver"];
                            } else {
                                continue;
                            }
                        }
                        sendMail($mailbox, $INTERNAL[$receivers[count($receivers) - 1]]->Email, $mailbox->Email, $rcvs, $subject);
                    }
                }
            }
            if (!empty($CONFIG["gl_sctg"]) && !$_custom) {
                initData(array("GROUPS"));
                sendMail($mailbox, $GROUPS[$row["group_id"]]->Email, $mailbox->Email, $rcvs, $subject);
            }
            if (!empty($mailbox) && !empty($CONFIG["gl_scct"])) {
                if (!empty($CONFIG["gl_uvec"])) {
                    if (Mailbox::IsValidEmail($row["transcript_receiver"])) {
                        $fakeSender = $row["transcript_receiver"];
                    } else {
                        if (Mailbox::IsValidEmail($row["email"])) {
                            $fakeSender = $row["email"];
                        }
                    }
                }
                sendMail($mailbox, $CONFIG["gl_scct"], $mailbox->Email, $rcvs, $subject, false, null, $fakeSender);
            }
            if (!empty($row["voucher_id"])) {
                $ticket = new CommercialChatVoucher(null, $row["voucher_id"]);
                $ticket->Load();
                $ticket->SendStatusEmail();
            }
        }
    }
    if (!empty($CONFIG["gl_rm_chats"]) && $CONFIG["gl_rm_chats_time"] == 0) {
        queryDB(true, "DELETE FROM `" . DB_PREFIX . DATABASE_CHAT_ARCHIVE . "` WHERE `transcript_sent` = '1';");
    }
}
function getChangeVoucherHTML($_vouchers)
{
    global $VOUCHER;
    $voucherHTML = getFile(PATH_TEMPLATES . "chat_voucher_change_item.tpl");
    $tableHTML = getFile(PATH_TEMPLATES . "chat_voucher_change_table.tpl");
    $vouchersHTML = "";
    foreach ($_vouchers as $voucher) {
        $vouchersHTML .= $voucherHTML;
        $vouchersHTML = str_replace("<!--id-->", $voucher->Id == $VOUCHER->Id ? "<b>" . $voucher->Id . "</b>" : $voucher->Id, $vouchersHTML);
        $vouchersHTML = str_replace("<!--selected-->", $voucher->Id == $VOUCHER->Id ? "CHECKED" : "", $vouchersHTML);
        if ($voucher->ChatSessionsMax > -1) {
            $vouchersHTML = str_replace("<!--sessions-->", $voucher->ChatSessions . " / " . $voucher->ChatSessionsMax, $vouchersHTML);
        } else {
            $vouchersHTML = str_replace("<!--display_sessions-->", "none", $vouchersHTML);
        }
        if ($voucher->ChatTimeMax > -1) {
            $vouchersHTML = str_replace("<!--time-->", formatTimeSpan($voucher->ChatTimeRemaining), $vouchersHTML);
        } else {
            $vouchersHTML = str_replace("<!--display_time-->", "none", $vouchersHTML);
        }
        if ($voucher->VoucherAutoExpire > -1) {
            $parts = explode(date("Y", $voucher->VoucherAutoExpire), date("r", $voucher->VoucherAutoExpire));
            $vouchersHTML = str_replace("<!--expires-->", $parts[0] . date("Y", $voucher->VoucherAutoExpire), $vouchersHTML);
        } else {
            $vouchersHTML = str_replace("<!--display_expires-->", "none", $vouchersHTML);
        }
        if ($voucher->ChatSessionsMax - $voucher->ChatSessions > 0) {
            $vouchersHTML = str_replace("<!--class_sessions-->", "lz_chat_com_chat_panel_value", $vouchersHTML);
        } else {
            if ($voucher->ChatSessionsMax - $voucher->ChatSessions <= 0) {
                $vouchersHTML = str_replace("<!--class_sessions-->", "lz_chat_com_chat_panel_value_over", $vouchersHTML);
            }
        }
        if ($voucher->ChatTimeRemaining > 0) {
            $vouchersHTML = str_replace("<!--class_time-->", "lz_chat_com_chat_panel_value", $vouchersHTML);
        } else {
            if ($voucher->ChatTimeRemaining <= 0) {
                $vouchersHTML = str_replace("<!--class_time-->", "lz_chat_com_chat_panel_value_over", $vouchersHTML);
            }
        }
        if ($voucher->VoucherAutoExpire > time()) {
            $vouchersHTML = str_replace("<!--class_expires-->", "lz_chat_com_chat_panel_value", $vouchersHTML);
        } else {
            if ($voucher->VoucherAutoExpire > 0) {
                $vouchersHTML = str_replace("<!--class_expires-->", "lz_chat_com_chat_panel_value_over", $vouchersHTML);
            }
        }
        $vouchersHTML = str_replace("<!--display_sessions-->", "''", $vouchersHTML);
        $vouchersHTML = str_replace("<!--display_time-->", "''", $vouchersHTML);
        $vouchersHTML = str_replace("<!--display_expires-->", "''", $vouchersHTML);
    }
    $tableHTML = str_replace("<!--vouchers-->", $vouchersHTML, $tableHTML);
    $tableHTML = str_replace("<!--server-->", LIVEZILLA_URL, $tableHTML);
    $tableHTML = str_replace("<!--vouchers-->", $vouchersHTML, $tableHTML);
    return applyReplacements($tableHTML, true, false);
}
 function DataInput($_values)
 {
     global $LZLANG;
     if ($_values != null) {
         $_values = @unserialize(base64_decode($_values));
         array_walk($_values, "b64dcode");
         $this->Index = $_values[0];
         $this->Caption = strpos($_values[1], "<!--lang") !== false ? applyReplacements($_values[1], true, false) : $_values[1];
         $this->Name = $_values[2];
         $this->Type = $_values[3];
         $this->Active = empty($_GET["ofc"]) || $this->Index != 116 ? !empty($_values[4]) : true;
         $this->Cookie = !empty($_values[5]);
         $this->Position = $_values[6];
         $this->InputValue = strpos($_values[7], "<!--lang") !== false ? applyReplacements($_values[7], true, false) : $_values[7];
         $this->Custom = $this->Index < 100;
         $this->Validate = !empty($_values[8]);
         $this->ValidationURL = $_values[9];
         $this->ValidationTimeout = $_values[10];
         $this->ValidationContinueOnTimeout = !empty($_values[11]);
         if (count($_values) > 12) {
             $this->InfoText = $_values[12];
         }
     } else {
         $this->Index = 115;
         $this->Caption = @$LZLANG["client_voucher_id"];
         $this->Name = "chat_voucher_id";
         $this->Custom = false;
         $this->Position = 10000;
         $this->Cookie = false;
         $this->Active = true;
         $this->Validate = false;
         $this->Type = "Text";
     }
 }
Example #9
0
 }
 if (!empty($LASTPOST)) {
     $USER->AddFunctionCall("lz_chat_set_last_post('" . base64_encode(trim(html_entity_decode($LASTPOST, ENT_COMPAT, "UTF-8"))) . "');", false);
 }
 if ($psound) {
     $USER->AddFunctionCall("lz_chat_play_sound();", false);
 }
 if (!empty($_GET["tid"])) {
     if ($ticket = $USER->SaveTicket($USER->Browsers[0]->DesiredChatGroup, base64UrlDecode($_GET["tin"]), base64UrlDecode($_GET["tie"]), "", $USER->GeoCountryISO2, "", false, base64UrlDecode($_GET["tim"]), true, getOParam(GET_TRACK_URL, "", $nu, FILTER_SANITIZE_URL, null, 512))) {
         $USER->Browsers[0]->SaveLoginData();
         Visitor::SendTicketAutoresponder($ticket, $USER->Language, false);
     }
 }
 $HTML = str_replace("<!--server-->", LIVEZILLA_URL, $HTML);
 if ($LANGUAGE) {
     $HTML = applyReplacements($HTML, $LANGUAGE, false);
 }
 if (!$chat_available && !$USER->Browsers[0]->Declined) {
     addHTML(statusHTML(@$LZLANG["client_chat_not_available"]), "sys", "OFM01");
 }
 if (!empty($HTML)) {
     $USER->AddFunctionCall("lz_chat_add_html_element('" . base64_encode($HTML) . "',true," . $lpr . "," . $LMR . ",'" . base64_encode($LASTPOSTER) . "','" . @$_GET["lp"] . "'," . $oppostcount . ");", false);
 }
 $USER->AddFunctionCall("lz_chat_set_connecting(" . parseBool(!$BOTMODE && (!empty($USER->Browsers[0]->ChatId) && !$USER->Browsers[0]->InternalActivation && !$USER->Browsers[0]->Closed && !$USER->Browsers[0]->Declined)) . ",'" . $USER->Browsers[0]->SystemId . "'," . parseBool(!empty($USER->Browsers[0]->InternalUser) && $USER->Browsers[0]->InternalUser->Status == USER_STATUS_AWAY) . ");", false);
 if ($REPOLL) {
     $USER->AddFunctionCall("lz_tracking_poll_server(1211);", false);
 }
 if ($USER->Browsers[0]->TranslationSettings != null) {
     $USER->AddFunctionCall("lz_chat_set_translation(" . $USER->Browsers[0]->TranslationSettings[0] . ",'" . base64_encode($USER->Browsers[0]->TranslationSettings[1]) . "','" . base64_encode($USER->Browsers[0]->TranslationSettings[2]) . "');", false);
 } else {
     $USER->AddFunctionCall("lz_chat_set_translation(null,null,null);", false);
 function TextReplace($_text)
 {
     global $GROUPS, $INPUTS, $LZLANG;
     $_text = str_replace(array("%external_name%", "%USERNAME%"), $this->Fullname, $_text);
     $nameparts = explode(" ", $this->Fullname);
     if (count($nameparts) > 2) {
         $_text = str_replace(array("%external_firstname%"), trim($nameparts[0]), $_text);
         $nameparts[0] = "";
         $_text = str_replace(array("%external_lastname%"), trim(implode(" ", $nameparts)), $_text);
     } else {
         if (count($nameparts) == 2) {
             $_text = str_replace(array("%external_firstname%"), trim($nameparts[0]), $_text);
             $_text = str_replace(array("%external_lastname%"), trim($nameparts[1]), $_text);
         } else {
             if (count($nameparts) == 1) {
                 $_text = str_replace(array("%external_firstname%", "%USERNAME%"), trim($nameparts[0]), $_text);
                 $_text = str_replace(array("%external_lastname%", "%USERNAME%"), "", $_text);
             } else {
                 $_text = str_replace(array("%external_firstname%", "%USERNAME%"), "", $_text);
                 $_text = str_replace(array("%external_lastname%", "%USERNAME%"), "", $_text);
             }
         }
     }
     $_text = str_replace(array("%external_email%", "%USEREMAIL%"), $this->Email, $_text);
     $_text = str_replace(array("%external_company%", "%USERCOMPANY%"), $this->Company, $_text);
     $_text = str_replace("%external_phone%", $this->Phone, $_text);
     $_text = str_replace("%external_ip%", $this->IP, $_text);
     $_text = str_replace(array("%question%", "%USERQUESTION%", "%mailtext%"), $this->Question, $_text);
     $_text = str_replace(array("%group_name%", "%group_id%", "%TARGETGROUP%"), $this->DesiredChatGroup, $_text);
     $_text = str_replace("%group_description%", isset($GROUPS[$this->DesiredChatGroup]) ? $GROUPS[$this->DesiredChatGroup]->GetDescription($this->Language) : $this->DesiredChatGroup, $_text);
     $_text = str_replace(array("%chat_id%", "%CHATID%"), $this->ChatId, $_text);
     foreach ($INPUTS as $index => $input) {
         if ($input->Active && $input->Custom) {
             if ($input->Type == "CheckBox") {
                 $_text = str_replace("%custom" . $index . "%", !empty($_customs[$index]) ? $LZLANG["client_yes"] : $LZLANG["client_no"], $_text);
             } else {
                 if (!empty($_customs[$index])) {
                     $_text = str_replace("%custom" . $index . "%", $input->GetClientValue($_customs[$index]), $_text);
                 } else {
                     $_text = str_replace("%custom" . $index . "%", "", $_text);
                 }
             }
         } else {
             $_text = str_replace("%custom" . $index . "%", "", $_text);
         }
     }
     return applyReplacements(str_replace("\n", "", $_text), true, false);
 }