function getCustomArray($_getCustomParams = null) { Server::InitDataBlock(array("INPUTS")); if (empty($_getCustomParams)) { $_getCustomParams = array('', '', '', '', '', '', '', '', '', ''); } for ($i = 0; $i <= 9; $i++) { if (isset($_GET["cf" . $i])) { $_getCustomParams[$i] = Encoding::Base64UrlDecode($_GET["cf" . $i]); } else { if (isset($_POST["p_cf" . $i]) && !empty($_POST["p_cf" . $i])) { $_getCustomParams[$i] = Encoding::Base64UrlDecode($_POST["p_cf" . $i]); } else { if (isset($_POST["form_" . $i]) && !empty($_POST["form_" . $i])) { $_getCustomParams[$i] = $_POST["form_" . $i]; } else { if ((Server::$Inputs[$i]->Type == "CheckBox" || Server::$Inputs[$i]->Type == "ComboBox") && empty($_getCustomParams[$i])) { $_getCustomParams[$i] = "0"; } } } } } return $_getCustomParams; }
function ProcessPosts() { global $USER; $pc = 0; if (!empty($USER->Browsers[0]->QueuedPosts)) { if (!$USER->Browsers[0]->Waiting) { while (!empty($_GET["mi" . $pc])) { $pc++; } foreach ($USER->Browsers[0]->QueuedPosts as $id => $postar) { $_GET["mp" . $pc] = $postar[0]; $_GET["mrid" . $pc] = $_GET["mi" . $pc] = Encoding::Base64UrlEncode($id); $_GET["mc" . $pc++] = Encoding::Base64UrlEncode($postar[1]); DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_POSTS . "` WHERE `id`='" . DBManager::RealEscape($id) . "' LIMIT 1;"); } $pc = 0; $USER->Browsers[0]->QueuedPosts = array(); } } $this->OverlayHTML = ""; if (!empty($_GET["mi" . $pc]) || $USER->Browsers[0]->Waiting || !empty($USER->Browsers[0]->InitChatWith) || !empty($USER->Browsers[0]->Forward) && !$USER->Browsers[0]->Forward->Received && $USER->Browsers[0]->Forward->Processed) { if ($USER->Browsers[0]->Waiting && $this->Botmode && !empty($USER->Browsers[0]->QueuedPosts)) { $USER->Browsers[0]->QueuedPosts = array(); } else { if (!Visitor::$OpenChatExternal) { $this->Init(); } } if (!empty($USER->Browsers[0]->Forward) && !$USER->Browsers[0]->Forward->Received && $USER->Browsers[0]->Forward->Processed) { $USER->Browsers[0]->Forward->Save(true, true); Visitor::$IsActiveOverlayChat = !$USER->Browsers[0]->Declined; } } if (!empty($USER->Browsers[0]->ChatId)) { $USER->AddFunctionCall("lz_chat_id='" . $USER->Browsers[0]->ChatId . "';", false); } $USER->Browsers[0]->VisitId = $USER->VisitId; while (!empty($_GET["mi" . $pc])) { $id = Communication::ReadParameter("mrid" . $pc, md5($USER->Browsers[0]->SystemId . $USER->Browsers[0]->ChatId . $_GET["mi" . $pc])); $senderName = !empty($USER->Browsers[0]->UserData->Fullname) ? $USER->Browsers[0]->UserData->Fullname : LocalizationManager::$TranslationStrings["client_guest"] . " " . Visitor::GetNoName($USER->UserId . Communication::GetIP()); $post = new Post($id, $USER->Browsers[0]->SystemId, "", Encoding::Base64UrlDecode($_GET["mp" . $pc]), Communication::ReadParameter("mc" . $pc, time()), $USER->Browsers[0]->ChatId, $senderName); $post->BrowserId = VisitorMonitoring::$Browser->BrowserId; if (!empty($_GET["mpti" . $pc])) { $post->Translation = Encoding::Base64UrlDecode($_GET["mpt" . $pc]); $post->TranslationISO = Encoding::Base64UrlDecode($_GET["mpti" . $pc]); } $saved = false; if (!$USER->Browsers[0]->Waiting) { foreach (Server::$Groups as $groupid => $group) { if ($group->IsDynamic && $USER->Browsers[0]->Status == CHAT_STATUS_ACTIVE && isset($group->Members[$USER->Browsers[0]->SystemId])) { foreach ($group->Members as $member => $persistent) { if ($member != $USER->Browsers[0]->SystemId) { if (!empty(Server::$Operators[$member])) { processPost($id, $post, $member, $pc, $groupid, $USER->Browsers[0]->ChatId); } else { processPost($id, $post, $member, $pc, $groupid, CacheManager::GetValueBySystemId($member, "chat_id", "")); } $saved = true; } } $pGroup = $group; } } foreach ($USER->Browsers[0]->Members as $systemid => $member) { if (!empty($member->Declined)) { continue; } if (!empty(Server::$Operators[$systemid]) && !empty($pGroup) && isset($pGroup->Members[$systemid])) { continue; } if (!(!empty($pGroup) && !empty(Server::$Operators[$systemid]))) { $saved = processPost($id, $post, $systemid, $pc, $USER->Browsers[0]->SystemId, $USER->Browsers[0]->ChatId, Server::$Operators[$systemid]->IsBot); } } if (!empty($USER->Browsers[0]->OperatorId) && (Server::$Operators[$USER->Browsers[0]->OperatorId]->IsBot || $USER->Browsers[0]->Status == CHAT_STATUS_ACTIVE)) { $rpost = new Post($id = getId(32), Server::$Operators[$USER->Browsers[0]->OperatorId]->SystemId, $USER->Browsers[0]->SystemId, $answer = Server::$Operators[$USER->Browsers[0]->OperatorId]->GetAutoReplies($post->Text . " " . $post->Translation, $USER->Browsers[0]), time(), $USER->Browsers[0]->ChatId, Server::$Operators[$USER->Browsers[0]->OperatorId]->Fullname); if (!empty($answer)) { if (Server::$Operators[$USER->Browsers[0]->OperatorId]->IsBot) { sleep(1); $USER->AddFunctionCall("lz_chat_input_bot_state(true,false);", false); } $rpost->ReceiverOriginal = $rpost->ReceiverGroup = $USER->Browsers[0]->SystemId; $rpost->Save(); $saved = true; foreach ($USER->Browsers[0]->Members as $opsysid => $member) { if ($opsysid != Server::$Operators[$USER->Browsers[0]->OperatorId]->SystemId || !Server::$Operators[$USER->Browsers[0]->OperatorId]->IsBot) { $rpost = new Post($id, Server::$Operators[$USER->Browsers[0]->OperatorId]->SystemId, $opsysid, $answer, time(), $USER->Browsers[0]->ChatId, Server::$Operators[$opsysid]->Fullname); $rpost->ReceiverOriginal = $rpost->ReceiverGroup = $USER->Browsers[0]->SystemId; $rpost->Save(); } } } } if ($saved) { $USER->AddFunctionCall("lz_chat_release_post('" . Encoding::Base64UrlDecode($_GET["mi" . $pc]) . "');", false); } } else { processPost($id, $post, "", $pc, $USER->Browsers[0]->SystemId, $USER->Browsers[0]->ChatId, false); $USER->Browsers[0]->QueuedPosts[$id] = array(0 => $_GET["mp" . $pc], 1 => time(), 2 => VisitorMonitoring::$Browser->BrowserId); $USER->AddFunctionCall("lz_chat_release_post('" . Encoding::Base64UrlDecode($_GET["mi" . $pc]) . "');", false); } $pc++; } if (!empty($USER->Browsers[0]->OperatorId) && empty($pc) && !Server::$Operators[$USER->Browsers[0]->OperatorId]->IsBot) { $autoReply = Server::$Operators[$USER->Browsers[0]->OperatorId]->GetAutoReplies("", $USER->Browsers[0]); if (!empty($autoReply)) { ChatAutoReply::SendAutoReply($autoReply, $USER, $USER->Browsers[0]->OperatorId); } } }
if (!empty($groupid) && isset(Server::$Groups[$groupid])) { $html = str_replace("<!--SM_HIDDEN-->", empty(Server::$Groups[$groupid]->ChatFunctions[0]) ? "none" : "", $html); $html = str_replace("<!--SO_HIDDEN-->", empty(Server::$Groups[$groupid]->ChatFunctions[1]) ? "none" : "", $html); $html = str_replace("<!--PR_HIDDEN-->", empty(Server::$Groups[$groupid]->ChatFunctions[2]) ? "none" : "", $html); $html = str_replace("<!--FV_HIDDEN-->", empty(Server::$Groups[$groupid]->ChatFunctions[4]) ? "none" : "", $html); $html = str_replace("<!--FU_HIDDEN-->", empty(Server::$Groups[$groupid]->ChatFunctions[5]) || !empty($_GET[GET_EXTERN_DYNAMIC_GROUP]) ? "none" : "", $html); $html = str_replace("<!--post_chat_js-->", base64_encode(Server::$Groups[$groupid]->PostJS), $html); } $html = str_replace("<!--TR_HIDDEN-->", strlen(Server::$Configuration->File["gl_otrs"]) > 1 ? "" : "none", $html); $html = str_replace("<!--ET_HIDDEN-->", !empty(Server::$Configuration->File["gl_retr"]) && !empty(Server::$Configuration->File["gl_soct"]) ? "" : "none", $html); } } } $header = IOStruct::GetFile(PATH_TEMPLATES . "header.tpl"); if (isset($_GET[GET_EXTERN_USER_HEADER]) && !empty($_GET[GET_EXTERN_USER_HEADER])) { $header = str_replace("<!--logo-->", "<img src=\"" . Encoding::Base64UrlDecode($_GET[GET_EXTERN_USER_HEADER]) . "\" border=\"0\"><br>", $header); } else { if (!empty(Server::$Configuration->File["gl_cali"])) { $header = str_replace("<!--logo-->", "<img src=\"" . Server::$Configuration->File["gl_cali"] . "\" border=\"0\"><br>", $header); } } if (!empty(Server::$Configuration->File["gl_cahi"])) { $header = str_replace("<!--background-->", "<img src=\"" . Server::$Configuration->File["gl_cahi"] . "\" border=\"0\"><br>", $header); } $html = str_replace("<!--param-->", @Server::$Configuration->File["gl_cpar"], $html); $html = str_replace("<!--header-->", $header, $html); $html = str_replace("<!--server-->", LIVEZILLA_URL, $html); $html = str_replace("<!--html-->", "<html dir=\"" . LocalizationManager::$Direction . "\">", $html); $html = str_replace("<!--rtl-->", To::BoolString(LocalizationManager::$Direction == "rtl"), $html); $html = str_replace("<!--dir-->", LocalizationManager::$Direction, $html); $html = str_replace("<!--url_get_params-->", getParams(), $html);
static function GetBrowserLocalization($country = "") { Server::InitDataBlock(array("LANGUAGES", "COUNTRIES")); $base = @$_SERVER["HTTP_ACCEPT_LANGUAGE"]; $language = str_replace(array(",", "_", " "), array(";", "-", ""), !empty($_GET[GET_EXTERN_USER_LANGUAGE]) ? strtoupper(Encoding::Base64UrlDecode($_GET[GET_EXTERN_USER_LANGUAGE])) : (!empty($base) ? strtoupper($base) : "")); if (strlen($language) > 5 || strpos($language, ";") !== false) { $parts = explode(";", $language); if (count($parts) > 0) { $language = $parts[0]; } else { $language = substr($language, 0, 5); } } if (strlen($language) >= 2) { $parts = explode("-", $language); if (!isset(Server::$Languages[$language])) { $language = $parts[0]; if (!isset(Server::$Languages[$language])) { $language = ""; } } if (count($parts) > 1 && isset(Server::$Countries[$parts[1]])) { $country = $parts[1]; } } else { if (strlen($language) < 2) { $language = ""; } } return array($language, $country); }
* * Copyright 2014 LiveZilla GmbH * All rights reserved. * LiveZilla is a registered trademark. * * Improper changes to this file may cause critical errors. ***************************************************************************************/ define("IN_LIVEZILLA", true); if (!defined("LIVEZILLA_PATH")) { define("LIVEZILLA_PATH", "./"); } require LIVEZILLA_PATH . "_definitions/definitions.inc.php"; require LIVEZILLA_PATH . "_lib/functions.global.inc.php"; require LIVEZILLA_PATH . "_definitions/definitions.dynamic.inc.php"; require LIVEZILLA_PATH . "_definitions/definitions.protocol.inc.php"; header("Content-Type: image/jpg;"); @set_error_handler("handleError"); if (isset($_GET["intid"]) && Server::InitDataProvider()) { Server::InitDataBlock(array("INTERNAL")); $id = Operator::GetSystemId(Encoding::Base64UrlDecode($_GET["intid"])); if (isset(Server::$Operators[$id])) { if (!empty(Server::$Operators[$id]->WebcamPicture)) { exit(base64_decode(Server::$Operators[$id]->WebcamPicture)); } else { if (!empty(Server::$Operators[$id]->ProfilePicture)) { exit(base64_decode(Server::$Operators[$id]->ProfilePicture)); } } } } exit(IOStruct::GetFile("./images/avatar.png"));
function Generate($_user = null, $_allowBots = false) { foreach (Server::$Operators as $operator) { if ($operator->LastActive > time() - Server::$Configuration->File["timeout_clients"] && $operator->Status < USER_STATUS_OFFLINE && ($_allowBots || !$operator->IsBot) && !$operator->MobileSleep()) { if (!$operator->IsExternal(Server::$Groups)) { continue; } $igroups = $operator->GetGroupList(true); for ($count = 0; $count < count($igroups); $count++) { if ($operator->UserId == $this->ReqOperator) { if (!($this->GroupValues["req_for_group"] && $igroups[$count] != $this->ReqGroup) || isset($_GET[GET_EXTERN_PREFERENCE]) && Encoding::Base64UrlDecode($_GET[GET_EXTERN_PREFERENCE]) == "user") { $this->GroupValues["set_by_get_user"] = $igroups[$count]; } } if (!isset($this->GroupValues["groups_online_amounts"][$igroups[$count]])) { $this->GroupValues["groups_online_amounts"][$igroups[$count]] = 0; } if ($operator->IsBot) { $this->GroupValues["groups_online_amounts"][$igroups[$count]] += 1; } else { if (isset(Server::$Groups[$igroups[$count]])) { if ($operator->GetMaxChatAmountStatus(Server::$Groups[$igroups[$count]]) != USER_STATUS_AWAY) { $this->GroupValues["groups_online_amounts"][$igroups[$count]] += 2; } } } } } } $counter = 0; if (is_array(Server::$Groups)) { foreach (Server::$Groups as $id => $group) { if (!$group->IsExternal) { continue; } $used = false; $amount = isset($this->GroupValues["groups_online_amounts"]) && is_array($this->GroupValues["groups_online_amounts"]) && array_key_exists($id, $this->GroupValues["groups_online_amounts"]) && $group->IsOpeningHour() ? $this->GroupValues["groups_online_amounts"][$id] : 0; $transport = base64_encode($id) . "," . base64_encode($amount) . "," . base64_encode($group->GetDescription($_user != null ? $_user->Language : "")) . "," . base64_encode($group->Email); if ($this->GroupValues["req_for_group"] && $id == $this->ReqGroup) { $this->GroupValues["set_by_get_group"] = $id; $used = true; } elseif (Cookie::Get("login_group") != null && $id == Cookie::Get("login_group") && !isset($requested_group)) { $this->GroupValues["set_by_cookie"] = $id; $used = true; } elseif ($group->IsStandard) { $this->GroupValues["set_by_standard"] = $id; $used = true; } elseif (empty($this->GroupValues["set_by_online"])) { $this->GroupValues["set_by_online"] = $id; $used = true; } if (!in_array($id, $this->GroupValues["groups_hidden"]) && ($group->IsExternal || $used)) { $counter++; if ($amount > 0) { $this->GroupAvailable = true; $this->GroupValues["groups_online"][$id] = $transport; } else { if ($group->IsStandard) { $na[$id] = $transport; $na = array_merge($na, $this->GroupValues["groups_offline"]); $this->GroupValues["groups_offline"] = $na; } else { $this->GroupValues["groups_offline"][$id] = $transport; } } } } } if (isset($_GET[GET_EXTERN_PREFERENCE]) && Encoding::Base64UrlDecode($_GET[GET_EXTERN_PREFERENCE]) == "group") { if (isset($this->GroupValues["groups_online_amounts"][$this->ReqGroup]) && $this->GroupValues["groups_online_amounts"][$this->ReqGroup] > 0) { $this->GroupValues["set_by_get_user"] = null; $this->GroupValues["req_for_user"] = false; } } if (!empty($this->GroupValues["set_by_get_user"]) && isset($this->GroupValues["groups_online"][$this->GroupValues["set_by_get_user"]])) { $this->GroupValues["groups_output"][$this->GroupValues["set_by_get_user"]] = $this->GroupValues["groups_online"][$this->GroupValues["set_by_get_user"]]; } else { if (!empty($this->GroupValues["set_by_get_group"]) && isset($this->GroupValues["groups_online"][$this->GroupValues["set_by_get_group"]])) { $this->GroupValues["groups_output"][$this->GroupValues["set_by_get_group"]] = $this->GroupValues["groups_online"][$this->GroupValues["set_by_get_group"]]; } else { if (!empty($this->GroupValues["set_by_cookie"]) && isset($this->GroupValues["groups_online"][$this->GroupValues["set_by_cookie"]])) { $this->GroupValues["groups_output"][$this->GroupValues["set_by_cookie"]] = $this->GroupValues["groups_online"][$this->GroupValues["set_by_cookie"]]; } else { if (!empty($this->GroupValues["set_by_standard"]) && isset($this->GroupValues["groups_online"][$this->GroupValues["set_by_standard"]])) { $this->GroupValues["groups_output"][$this->GroupValues["set_by_standard"]] = $this->GroupValues["groups_online"][$this->GroupValues["set_by_standard"]]; } else { if (!empty($this->GroupValues["set_by_online"]) && isset($this->GroupValues["groups_online"][$this->GroupValues["set_by_online"]])) { $this->GroupValues["groups_output"][$this->GroupValues["set_by_online"]] = $this->GroupValues["groups_online"][$this->GroupValues["set_by_online"]]; } else { if (!empty($this->GroupValues["set_by_cookie"]) && empty($this->GroupValues["groups_output"]) && !empty($this->GroupValues["groups_offline"][$this->GroupValues["set_by_cookie"]])) { $this->GroupValues["groups_output"][$this->GroupValues["set_by_cookie"]] = $this->GroupValues["groups_offline"][$this->GroupValues["set_by_cookie"]]; } else { if (!empty($this->GroupValues["set_by_get_group"]) && empty($this->GroupValues["groups_output"]) && !empty($this->GroupValues["groups_offline"][$this->GroupValues["set_by_get_group"]])) { $this->GroupValues["groups_output"][$this->GroupValues["set_by_get_group"]] = $this->GroupValues["groups_offline"][$this->GroupValues["set_by_get_group"]]; } } } } } } } foreach ($this->GroupValues["groups_online"] as $id => $transport) { if (!isset($this->GroupValues["groups_output"][$id])) { $this->GroupValues["groups_output"][$id] = $transport; } } if (empty($this->GroupValues["set_by_get_group"]) || empty($this->GroupValues["groups_online_amounts"][$this->GroupValues["set_by_get_group"]])) { $ngroups = array(); foreach ($this->GroupValues["groups_output"] as $id => $group) { $ngroups[$id] = !empty($this->GroupValues["groups_online_amounts"][$id]) ? $this->GroupValues["groups_online_amounts"][$id] : 0; if ($id == $this->GroupValues["set_by_standard"]) { $ngroups[$id] = 10000; } } arsort($ngroups); $nsgroups = array(); foreach ($ngroups as $id => $amount) { $nsgroups[$id] = $this->GroupValues["groups_output"][$id]; } $this->GroupValues["groups_output"] = $nsgroups; } $result = array_merge($this->GroupValues["groups_output"], $this->GroupValues["groups_offline"]); foreach ($result as $key => $value) { $chat_input_fields = "new Array("; $count = 0; foreach (Server::$Groups[$key]->ChatInputsHidden as $index) { if ($count > 0) { $chat_input_fields .= ","; } $chat_input_fields .= "'" . $index . "'"; $count++; } $value .= "," . base64_encode($chat_input_fields . ");"); $chat_input_fields = "new Array("; $count = 0; foreach (Server::$Groups[$key]->ChatInputsMandatory as $index) { if ($count > 0) { $chat_input_fields .= ","; } $chat_input_fields .= "'" . $index . "'"; $count++; } $value .= "," . base64_encode($chat_input_fields . ");"); $ticket_input_fields = "new Array("; $count = 0; foreach (Server::$Groups[$key]->TicketInputsHidden as $index) { if ($count > 0) { $ticket_input_fields .= ","; } $ticket_input_fields .= "'" . $index . "'"; $count++; } $value .= "," . base64_encode($ticket_input_fields . ");"); $ticket_input_fields = "new Array("; $count = 0; foreach (Server::$Groups[$key]->TicketInputsMandatory as $index) { if ($count > 0) { $ticket_input_fields .= ","; } $ticket_input_fields .= "'" . $index . "'"; $count++; } $value .= "," . base64_encode($ticket_input_fields . ");"); $mes = PredefinedMessage::GetByLanguage(Server::$Groups[$key]->PredefinedMessages, $_user != null ? $_user->Language : ""); if ($mes != null) { $value .= "," . base64_encode($mes->ChatInformation); $value .= "," . base64_encode($mes->CallMeBackInformation); $value .= "," . base64_encode($mes->TicketInformation); } else { $value .= "," . base64_encode(""); $value .= "," . base64_encode(""); $value .= "," . base64_encode(""); } $count = 0; $com_tickets_allowed = "new Array("; foreach (Server::$Groups[$key]->ChatVouchersRequired as $cttid) { if ($count > 0) { $com_tickets_allowed .= ","; } $com_tickets_allowed .= "'" . $cttid . "'"; $count++; } $value .= "," . base64_encode($com_tickets_allowed . ");"); if (!empty($this->Result)) { $this->Result .= ";" . $value; } else { $this->Result = $value; } } if ($counter == 0) { $this->ErrorHTML = "lz_chat_data.Language.ClientErrorGroups"; } }
} } } } if (!isset($_POST[POST_EXTERN_RESOLUTION_WIDTH])) { $externalUser->KeepAlive(); } else { $externalUser->Save(array(Communication::GetParameter(POST_EXTERN_RESOLUTION_WIDTH, "", $nu, FILTER_SANITIZE_SPECIAL_CHARS, null, 32), Communication::GetParameter(POST_EXTERN_RESOLUTION_HEIGHT, "", $nu, FILTER_SANITIZE_SPECIAL_CHARS, null, 32)), Communication::GetParameter(POST_EXTERN_COLOR_DEPTH, "", $nu, FILTER_SANITIZE_SPECIAL_CHARS, null, 32), Communication::GetParameter(POST_EXTERN_TIMEZONE_OFFSET, "", $nu, FILTER_SANITIZE_SPECIAL_CHARS, null, 32), Communication::GetParameter(GEO_LATITUDE, -522, $nu, FILTER_VALIDATE_FLOAT), Communication::GetParameter(GEO_LONGITUDE, -522, $nu, FILTER_VALIDATE_FLOAT), Communication::GetParameter(GEO_COUNTRY_ISO_2, "", $nu, null, null, 32), Communication::GetParameter(GEO_CITY, "", $nu, null, null, 255), Communication::GetParameter(GEO_REGION, "", $nu, null, null, 255), Communication::GetParameter(GEO_TIMEZONE, "", $nu, null, null, 24), Communication::GetParameter(GEO_ISP, "", $nu, null, null, 255), Communication::GetParameter(GEO_SSPAN, 0, $nu, FILTER_VALIDATE_INT), Communication::GetParameter(GEO_RESULT_ID, "", $nu, FILTER_SANITIZE_SPECIAL_CHARS, null, 32)); } if ($externalUser->SignatureMismatch) { $externalUser->AddFunctionCall("lz_chat_set_signature(\"" . $externalUser->UserId . "\");", true); $externalUser->AddFunctionCall("lz_chat_reload_groups();", false); } else { $externalUser->Browsers[0]->VisitId = $externalUser->VisitId; if (isset($_GET[GET_TRACK_SPECIAL_AREA_CODE])) { $externalUser->Browsers[0]->Code = Encoding::Base64UrlDecode($_GET[GET_TRACK_SPECIAL_AREA_CODE]); } if (IS_FILTERED && !FILTER_ALLOW_CHATS) { $externalUser->Browsers[0]->CloseChat(8); } else { if (!$externalUser->Browsers[0]->Closed) { $externalUser->Browsers[0]->Save(); } } if (empty($externalUser->Host) && $externalUser->FirstCall) { $externalUser->ResolveHost(); } } } $EXTERNSCRIPT = $externalUser->Response; }
function CreateChat($_internalUser, $_visitor, $_host = false, $custom = "", $etpl = "", $_customsInTranscript = true, $_externalSelf = true, $pdm = null) { if (!empty(Server::$Configuration->File["gl_sfc"]) && Visitor::CreateSPAMFilter($this->UserId) || empty($this->ChatId)) { return; } if (!empty($_internalUser)) { UserGroup::RemoveFromAllDynamicGroups($this->SystemId); $this->LoadForward(); if (UserGroup::PersistentJoin($this->UserId, $this->SystemId)) { $this->RemoteActivate($_internalUser); } $this->OperatorId = $_internalUser->SystemId; $_internalUser->SetLastChatAllocation(); } else { $this->OperatorId = ""; } $this->SetStatus(CHAT_STATUS_WAITING); Server::InitDataBlock(array("INPUTS")); DBManager::Execute(false, "INSERT INTO `" . DB_PREFIX . DATABASE_VISITOR_CHAT_OPERATORS . "` (`chat_id`,`user_id`,`jtime`,`status`) VALUES ('" . DBManager::RealEscape($this->ChatId) . "','" . DBManager::RealEscape($this->OperatorId) . "'," . time() . "," . ($_host ? 0 : 1) . ");"); $this->CreateArchiveEntry($_internalUser, $_visitor, $custom, $etpl, $_customsInTranscript, $pdm); if ($_internalUser->IsBot) { $this->RemoteActivate($_internalUser); } else { if (!empty($_internalUser->AppDeviceId) && $_internalUser->AppBackgroundMode) { $name = !empty($this->UserData->Fullname) ? $this->UserData->Fullname : Visitor::GetNoName($this->UserId . Communication::GetIP()); $_internalUser->AddPushMessage($this->ChatId, $this->SystemId, $name, 0); } } if (!empty($_GET["acid"])) { $pchatid = Encoding::Base64UrlDecode($_GET["acid"]); $result = DBManager::Execute(true, "SELECT * FROM `" . DB_PREFIX . DATABASE_VISITOR_CHATS . "` WHERE `visitor_id`='" . DBManager::RealEscape($this->UserId) . "' AND `chat_id`='" . DBManager::RealEscape($pchatid) . "' AND (`exit` > " . (time() - 30) . " OR `exit`=0) LIMIT 1;"); if ($result && DBManager::GetRowCount($result) == 1) { $row = DBManager::FetchArray($result); if (empty($row["waiting"])) { $this->RepostChatHistory(2, $pchatid, $this->OperatorId, 0, 0, $this->UserId . "~" . $this->UserId . "_OVL", $this->ChatId, $this->SystemId, true, false, $_externalSelf); } } } }
function processPlaceholders($html) { $params = array(GET_EXTERN_USER_LANGUAGE, GET_EXTERN_USER_NAME, GET_EXTERN_USER_EMAIL, GET_EXTERN_USER_COMPANY, GET_TRACK_SPECIAL_AREA_CODE, GET_EXTERN_USER_QUESTION, GET_EXTERN_USER_HEADER); $placeholders = array("language", "name", "email", "company", "code", "question", "header_url"); foreach ($params as $key => $value) { if (!empty($_GET[$value])) { $html = str_replace("<!--replace_me_with_b64url_" . $placeholders[$key] . "-->", Encoding::Base64UrlEncode(Encoding::Base64UrlDecode($_GET[$value])), $html); } else { $html = str_replace("<!--replace_me_with_b64url_" . $placeholders[$key] . "-->", "", $html); } } for ($i = 0; $i < 10; $i++) { if (!empty($_GET["cf" . $i])) { $html = str_replace("<!--replace_me_with_b64url_custom_" . $i . "-->", Encoding::Base64UrlEncode(Encoding::Base64UrlDecode($_GET["cf" . $i])), $html); } else { $html = str_replace("<!--replace_me_with_b64url_custom_" . $i . "-->", "", $html); } } return $html; }
if ($changed) { $USER->Browsers[0]->ApplyUserData(); $USER->Browsers[1]->UserData = $USER->Browsers[0]->UserData; $USER->Browsers[1]->ApplyUserData(true); if (!$USER->Browsers[0]->Closed) { $USER->Browsers[0]->UpdateArchive(Communication::ReadParameter("tc", -1) == 1 ? $USER->Browsers[0]->UserData->Email : ""); } } if (!$OVERLAY->IsHumanChatAvailable && !empty($_GET["ovloo"])) { $USER->AddFunctionCall("if(lz_session.OVLCState == '0')lz_tracking_remove_overlay_chat();", false); } else { if (Visitor::$PollCount == 1) { $ovlw = Communication::ReadParameter("ovlw", 300); $ovlh = Communication::ReadParameter("ovlh", DataInput::GetMaxHeight()); $text = $OVERLAY->IsHumanChatAvailable ? Communication::GetParameter("ovlt", LocalizationManager::$TranslationStrings["client_overlay_title_online"], $c, FILTER_HTML_ENTITIES) : Communication::GetParameter("ovlto", LocalizationManager::$TranslationStrings["client_overlay_title_offline"], $c, FILTER_HTML_ENTITIES); VisitorMonitoring::$Response .= "lz_tracking_add_overlay_chat('" . base64_encode($OVERLAY->ChatHTML) . "','" . base64_encode(Encoding::Base64UrlDecode($text)) . "'," . $ovlw . "," . $ovlh . "," . Communication::GetParameter("ovlml", 0, $nu, FILTER_SANITIZE_NUMBER_INT) . "," . Communication::GetParameter("ovlmt", 0, $nu, FILTER_SANITIZE_NUMBER_INT) . "," . Communication::GetParameter("ovlmr", 0, $nu, FILTER_SANITIZE_NUMBER_INT) . "," . Communication::GetParameter("ovlmb", 0, $nu, FILTER_SANITIZE_NUMBER_INT) . ",'" . Communication::ReadParameter("ovlp", 22) . "',true," . To::BoolString($OVERLAY->IsHumanChatAvailable) . ");"; $eca = Communication::GetParameter("eca", 0, $nu, FILTER_VALIDATE_INT); if (!empty($_GET["eca"]) && !(!empty($_GET["echm"]) && VisitorMonitoring::$IsMobile && !VisitorMonitoring::$IsTablet)) { $ecw = Communication::ReadParameter("ecw", $ovlw); $ech = Communication::ReadParameter("ech", 100); if ($eca == 1) { $catcher = IOStruct::GetFile(TEMPLATE_HTML_EYE_CATCHER_BUBBLE); $catcher = str_replace("<!--width-->", $ecw, $catcher); $catcher = str_replace("<!--height-->", $ech, $catcher); $catcher = str_replace("<!--header_padding-->", Communication::ReadParameter("echp", 16), $catcher); $catcher = str_replace("<!--header_sub_padding-->", Communication::ReadParameter("echsp", 43), $catcher); $catcher = str_replace("<!--header_color-->", Communication::ReadParameter("echc", "#6ea30c"), $catcher); } else { $catcher = IOStruct::GetFile(TEMPLATE_HTML_EYE_CATCHER_IMAGE); } VisitorMonitoring::$Response .= "lz_tracking_add_eye_catcher('" . base64_encode($catcher) . "'," . $ecw . "," . $ech . "," . $ovlw . "," . $ovlh . "," . Communication::ReadParameter("ovlml", 0) . "," . Communication::GetParameter("ovlmr", 0, $nu, FILTER_SANITIZE_NUMBER_INT) . "," . Communication::ReadParameter("ecmb", 29) . ",'" . Communication::ReadParameter("ovlp", 22) . "','" . Communication::GetParameter("ecsa", 0, $nu, FILTER_VALIDATE_INT) . "','" . Communication::GetParameter("ecsb", 5, $nu, FILTER_VALIDATE_INT) . "','" . Communication::GetParameter("ecsx", 3, $nu, FILTER_VALIDATE_INT) . "','" . Communication::GetParameter("ecsy", 3, $nu, FILTER_VALIDATE_INT) . "','" . Communication::ReadParameter("ecsc", "#464646") . "','" . Communication::ReadParameter("ecsgs", "#659f2a") . "','" . Communication::ReadParameter("ecsge", "#659f2a") . "','" . Communication::ReadParameter("ecslw", 2) . "','" . Communication::ReadParameter("ecfs", "#f0ffd5") . "','" . Communication::ReadParameter("ecfe", "#d3f299") . "'," . Communication::GetParameter("ecfi", 0, $nu, FILTER_VALIDATE_INT) . "," . Communication::ReadParameter("ecfo", 0) . ");";
$html = str_replace("<!--voucher_id-->", Encoding::Base64UrlEncode($ticket->Id), $html); $html = str_replace("<!--server-->", LIVEZILLA_URL, $html); $ofc = !empty($_POST["form_ofc"]) ? "&ofc=MQ__" : ""; if (!empty($_POST["form_extends"]) && !empty($_POST["form_group"])) { $html = str_replace("<!--co-->", "&co=" . Encoding::Base64UrlEncode($_POST["form_extends"]) . "&intgroup=" . Encoding::Base64UrlEncode($_POST["form_group"]) . $ofc, $html); } else { if (!empty($_POST["form_group"])) { $html = str_replace("<!--co-->", "&intgroup=" . Encoding::Base64UrlEncode($_POST["form_group"]) . $ofc, $html); } else { $html = str_replace("<!--co-->", $ofc, $html); } } exit($html); } else { if (!empty($_GET["confirm"]) && $_GET["confirm"] == "1" && !empty($_GET["vc"]) && strlen(Encoding::Base64UrlDecode($_GET["vc"])) == 16) { require LIVEZILLA_PATH . "_lib/functions.pp.paypal.inc.php"; $voucher = new CommercialChatVoucher("", Encoding::Base64UrlDecode($_GET["vc"])); if ($voucher->Load()) { if (PayProvValidatePayment($voucher->Price)) { LocalizationManager::AutoLoad($voucher->Language); $voucher->SetPaymentDetails(PayProvGetPaymentId(), PayProvGetPayerId(), PayProvGetPaymentDetails()); if (empty($PAYMENTERROR)) { $voucher->SetVoucherParams(!empty($voucher->Voided), true, false, false, false, true, Encoding::Base64UrlDecode($_GET[GET_EXTERN_GROUP])); } else { $voucher->SetVoucherParams(!empty($voucher->Voided), false, false, false, false); } } } } } Server::UnloadDataProvider();