function updateMembers($_dgroup = "") { global $USER; Server::InitDataBlock(array("DBCONFIG")); $groupname = addslashes(Server::$Groups[$USER->Browsers[0]->DesiredChatGroup]->GetDescription($USER->Language)); foreach (Server::$Groups as $group) { if ($group->IsDynamic && isset($group->Members[$USER->Browsers[0]->SystemId])) { $_dgroup = $group->Descriptions["EN"]; foreach ($group->Members as $member => $persistent) { if (true || $member != $USER->Browsers[0]->SystemId) { $isOperator = false; $isBusyAway = false; if (!empty(Server::$Operators[$member])) { $isOperator = true; if (Server::$Operators[$member]->Status == USER_STATUS_OFFLINE) { continue; } if (Server::$Operators[$member]->Status != USER_STATUS_ONLINE || Server::$Operators[$member]->IsBot) { $isBusyAway = true; } $name = Server::$Operators[$member]->Fullname; } else { $data = UserData::FromSystemId($member); $name = $data->Fullname; if (empty($name)) { $name = LocalizationManager::$TranslationStrings["client_guest"]; } if ($member != $USER->Browsers[0]->SystemId) { $chatobj = VisitorChat::GetBySystemId($member); if (!($chatobj != null && !$chatobj->ExternalClosed && !$chatobj->InternalClosed)) { continue; } } } $USER->AddFunctionCall("lz_chat_set_room_member('" . base64_encode($member) . "','" . base64_encode($name) . "'," . To::BoolString($isOperator) . "," . To::BoolString($isBusyAway) . ",true);", false); } } } } foreach ($USER->Browsers[0]->Members as $sysid => $chatm) { if ($chatm->Status < 2 && empty($chatm->Declined) && Server::$Operators[$sysid]->Status != USER_STATUS_OFFLINE) { $USER->AddFunctionCall("lz_chat_set_room_member('" . base64_encode($sysid) . "','" . base64_encode(Server::$Operators[$sysid]->Fullname) . "',true," . To::BoolString(Server::$Operators[$sysid]->Status != USER_STATUS_ONLINE) . ",false);", false); } } $fb = !empty(Server::$Groups[$USER->Browsers[0]->DesiredChatGroup]->ChatFunctions[3]) && !empty(Server::$Configuration->Database["gl_fb"]); $USER->AddFunctionCall("lz_chat_set_host(\"" . base64_encode(Server::$Operators[$USER->Browsers[0]->OperatorId]->UserId) . "\",\"" . base64_encode(addslashes(Server::$Operators[$USER->Browsers[0]->OperatorId]->Fullname)) . "\",\"" . base64_encode($groupname) . "\",\"" . strtolower(Server::$Operators[$USER->Browsers[0]->OperatorId]->Language) . "\"," . To::BoolString(Server::$Operators[$USER->Browsers[0]->OperatorId]->Typing == $USER->Browsers[0]->SystemId) . "," . To::BoolString(!empty(Server::$Operators[$USER->Browsers[0]->OperatorId]->Profile) && Server::$Operators[$USER->Browsers[0]->OperatorId]->Profile->Public) . ",\"" . base64_encode($_dgroup) . "\"," . To::BoolString($fb) . ");", false); }
} 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"; require LIVEZILLA_PATH . "_lib/functions.external.inc.php"; @set_error_handler("handleError"); @error_reporting(E_ALL); header("Pragma: no-cache"); header("Cache-Control: no-cache, must-revalidate"); header("Keep-Alive: timeout=5, max=100"); Server::InitDataProvider(); if (!empty($_GET["value"]) && strlen($_GET["value"]) == 16) { $ticket = VisitorChat::GetMatchingVoucher($_GET[GET_EXTERN_GROUP], $_GET["value"]); if (!empty($ticket) && !$ticket->CheckForVoid() && $ticket->Paid) { $ticket->UpdateVoucherChatTime(0, empty($ticket->FirstUsed)); $sessions = $ticket->ChatSessionsMax < 0 ? 0 : $ticket->ChatSessionsMax; if ($result = DBManager::Execute(true, "SELECT `exit` FROM `" . DB_PREFIX . DATABASE_VISITOR_CHATS . "` WHERE `chat_ticket_id`='" . DBManager::RealEscape($ticket->Id) . "' AND `exit`=0 LIMIT 1;")) { if ($row = DBManager::FetchArray($result)) { exit("lz_validate_com_chat_input_result(false,true,1,'',0,0,0,false,false,false);"); } } exit("lz_validate_com_chat_input_result(true,false,1,'" . $ticket->Id . "'," . $ticket->ChatTime . "," . $ticket->ChatTimeMax . "," . $ticket->ChatSessions . "," . $ticket->ChatSessionsMax . "," . $ticket->VoucherAutoExpire . "," . To::BoolString($ticket->VoucherAutoExpire < time()) . ");"); } else { if (!empty($ticket)) { exit("lz_validate_com_chat_input_result(false,false,1,'',0,0,0,false,false,false);"); } } } exit("lz_validate_com_chat_input_result(false,false,0,'',0,0,0,false,false,false);"); Server::UnloadDataProvider();
$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); Server::UnloadDataProvider(); exit(Server::Replace($html));
static function Process($_userId, $_resId, $_value, $_type, $_title, $_disc, $_parentId, $_rank, $_size = 0, $_tags = "") { if ($_size == 0) { $_size = strlen($_title); } $result = DBManager::Execute(true, "SELECT `id`,`value` FROM `" . DB_PREFIX . DATABASE_RESOURCES . "` WHERE `id`='" . DBManager::RealEscape($_resId) . "'"); if (DBManager::GetRowCount($result) == 0) { if (!$_disc) { DBManager::Execute(true, "INSERT INTO `" . DB_PREFIX . DATABASE_RESOURCES . "` (`id`,`owner`,`editor`,`value`,`edited`,`title`,`created`,`type`,`discarded`,`parentid`,`size`,`tags`) VALUES ('" . DBManager::RealEscape($_resId) . "','" . DBManager::RealEscape($_userId) . "','" . DBManager::RealEscape($_userId) . "','" . DBManager::RealEscape($_value) . "','" . DBManager::RealEscape(time()) . "','" . DBManager::RealEscape($_title) . "','" . DBManager::RealEscape(time()) . "','" . DBManager::RealEscape($_type) . "'," . intval(0) . ",'" . DBManager::RealEscape($_parentId) . "','" . DBManager::RealEscape($_size) . "','" . DBManager::RealEscape($_tags) . "')"); } } else { $row = DBManager::FetchArray($result); DBManager::Execute(true, $result = "UPDATE `" . DB_PREFIX . DATABASE_RESOURCES . "` SET `value`='" . DBManager::RealEscape($_value) . "',`editor`='" . DBManager::RealEscape($_userId) . "',`tags`='" . DBManager::RealEscape($_tags) . "',`title`='" . DBManager::RealEscape($_title) . "',`edited`=" . intval(time()) . ",`discarded`='" . DBManager::RealEscape(To::BoolString($_disc, false)) . "',`parentid`='" . DBManager::RealEscape($_parentId) . "',`size`='" . DBManager::RealEscape($_size) . "' WHERE id='" . DBManager::RealEscape($_resId) . "' LIMIT 1"); if (!empty($_disc) && ($_type == RESOURCE_TYPE_FILE_INTERNAL || $_type == RESOURCE_TYPE_FILE_EXTERNAL) && @file_exists("./uploads/" . $row["value"]) && strpos($row["value"], "..") === false) { @unlink("./uploads/" . $row["value"]); } } }
VisitorMonitoring::$Response = str_replace("<!--post_html-->", base64_encode(str_replace("<!--color-->", "#000000", str_replace("<!--lang_client_edit-->", strtoupper(LocalizationManager::$TranslationStrings["client_edit"]), IOStruct::GetFile(TEMPLATE_HTML_MESSAGE_OVERLAY_CHAT_EXTERN)))), VisitorMonitoring::$Response); VisitorMonitoring::$Response = str_replace("<!--add_html-->", base64_encode(IOStruct::GetFile(TEMPLATE_HTML_MESSAGE_OVERLAY_CHAT_ADD)), VisitorMonitoring::$Response); VisitorMonitoring::$Response = str_replace("<!--offline_message_pop-->", To::BoolString(!empty(Server::$Configuration->File["gl_om_pop_up"])), VisitorMonitoring::$Response); VisitorMonitoring::$Response = str_replace("<!--ec_t-->", $eca = Communication::GetParameter("eca", 0, $nu, FILTER_VALIDATE_INT), VisitorMonitoring::$Response); VisitorMonitoring::$Response = str_replace("<!--gtv2_api_key-->", strlen(Server::$Configuration->File["gl_otrs"]) > 1 ? base64_encode(Server::$Configuration->File["gl_otrs"]) : "", VisitorMonitoring::$Response); VisitorMonitoring::$Response = str_replace("<!--no_ticket_when_online-->", To::BoolString(Communication::ReadParameter("ovlntwo", false)), VisitorMonitoring::$Response); VisitorMonitoring::$Response = str_replace("<!--shadow-->", To::BoolString(Communication::ReadParameter("ovlsc", "")), VisitorMonitoring::$Response); VisitorMonitoring::$Response = str_replace("<!--shadowx-->", Communication::ReadParameter("ovlsx", 0), VisitorMonitoring::$Response); VisitorMonitoring::$Response = str_replace("<!--shadowy-->", Communication::ReadParameter("ovlsy", 0), VisitorMonitoring::$Response); VisitorMonitoring::$Response = str_replace("<!--shadowb-->", Communication::ReadParameter("ovlsb", 0), VisitorMonitoring::$Response); VisitorMonitoring::$Response = str_replace("<!--shadowc-->", Communication::ReadParameter("ovlsc", ""), VisitorMonitoring::$Response); VisitorMonitoring::$Response = str_replace("<!--kb_suggest-->", To::BoolString(Server::$Configuration->File["gl_knbs"]), VisitorMonitoring::$Response); VisitorMonitoring::$Response = str_replace("<!--border_radius-->", Communication::ReadParameter("ovlbr", 6), VisitorMonitoring::$Response); VisitorMonitoring::$Response = str_replace("<!--hide_group_select_chat-->", To::BoolString(Communication::GetParameter("hcgs", false)), VisitorMonitoring::$Response); VisitorMonitoring::$Response = str_replace("<!--hide_group_select_ticket-->", To::BoolString(Communication::GetParameter("htgs", false)), VisitorMonitoring::$Response); VisitorMonitoring::$Response = str_replace("<!--require_group_selection-->", To::BoolString(Communication::GetParameter("rgs", false)), VisitorMonitoring::$Response); VisitorMonitoring::$Response = OverlayChat::ReplaceColors(VisitorMonitoring::$Response, false); if ($eca == 1) { VisitorMonitoring::$Response = str_replace("<!--ec_header_text-->", Encoding::Base64UrlEncode(Communication::GetParameter("echt", @LocalizationManager::$TranslationStrings["client_ec_text"], $c, FILTER_HTML_ENTITIES)), VisitorMonitoring::$Response); VisitorMonitoring::$Response = str_replace("<!--ec_header_sub_text-->", Encoding::Base64UrlEncode(Communication::GetParameter("echst", @LocalizationManager::$TranslationStrings["client_ec_sub_text"], $c, FILTER_HTML_ENTITIES)), VisitorMonitoring::$Response); VisitorMonitoring::$Response = str_replace("<!--ec_o_header_text-->", Encoding::Base64UrlEncode(Communication::GetParameter("ecoht", @LocalizationManager::$TranslationStrings["client_ec_o_text"], $c, FILTER_HTML_ENTITIES)), VisitorMonitoring::$Response); VisitorMonitoring::$Response = str_replace("<!--ec_o_header_sub_text-->", Encoding::Base64UrlEncode(Communication::GetParameter("ecohst", @LocalizationManager::$TranslationStrings["client_ec_o_sub_text"], $c, FILTER_HTML_ENTITIES)), VisitorMonitoring::$Response); } else { if ($eca == 2) { VisitorMonitoring::$Response = str_replace("<!--ec_image-->", Encoding::Base64UrlEncode(Communication::ReadParameter("eci", "")), VisitorMonitoring::$Response); VisitorMonitoring::$Response = str_replace("<!--ec_o_image-->", Encoding::Base64UrlEncode(Communication::ReadParameter("ecio", "")), VisitorMonitoring::$Response); } } VisitorMonitoring::$Response = Server::Replace(VisitorMonitoring::$Response, true, false); } VisitorMonitoring::$Response = str_replace("<!--user_name-->", Encoding::Base64UrlEncode(VisitorMonitoring::$Browser->UserData->Fullname), VisitorMonitoring::$Response);
function ShowConnecting($_visitor) { $_visitor->AddFunctionCall("lz_chat_show_connected(" . To::BoolString(!empty(VisitorChat::$DynamicGroup)) . ");", false); }
$OVERLAY->OverlayHTML = str_replace("<!--server-->", LIVEZILLA_URL, $OVERLAY->OverlayHTML); if ($OVERLAY->LanguageRequired) { $OVERLAY->OverlayHTML = Server::Replace($OVERLAY->OverlayHTML, $OVERLAY->LanguageRequired, false); } if (!empty($OVERLAY->OverlayHTML)) { $USER->AddFunctionCall("lz_chat_add_html_element('" . base64_encode($OVERLAY->OverlayHTML) . "',true," . $OVERLAY->LastPostReceived . "," . $OVERLAY->LastMessageReceived . ",'" . base64_encode($OVERLAY->LastPoster) . "','" . base64_encode(Communication::ReadParameter("lp", "")) . "'," . $OVERLAY->OperatorPostCount . ");", false); } $USER->AddFunctionCall("lz_chat_set_connecting(" . To::BoolString(!$OVERLAY->Botmode && (!empty($USER->Browsers[0]->ChatId) && !$USER->Browsers[0]->InternalActivation && !$USER->Browsers[0]->Closed && !$USER->Browsers[0]->Declined)) . ",'" . $USER->Browsers[0]->SystemId . "'," . To::BoolString(!empty($USER->Browsers[0]->OperatorId) && Server::$Operators[$USER->Browsers[0]->OperatorId]->Status == USER_STATUS_AWAY) . "," . $OVERLAY->GetWaitingMessage() . "," . intval(Server::$Configuration->File["gl_wmes"]) . ");", false); if ($OVERLAY->RepollRequired) { $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); } if ($OVERLAY->FullLoad) { $USER->AddFunctionCall("lz_chat_load_input_values();", false); } $USER->ReloadGroups(true, Visitor::$PollCount == 1); if (!empty($USER->Browsers[0]->DesiredChatGroup)) { $USER->AddFunctionCall("lz_chat_set_input_fields();", false); } else { $USER->AddFunctionCall(false, false, false, false); } $USER->AddFunctionCall("lz_chat_set_application(" . To::BoolString($OVERLAY->IsChatAvailable) . "," . To::BoolString($OVERLAY->Botmode) . "," . To::BoolString($OVERLAY->HumanGeneral) . ",'" . $OVERLAY->BotTitle . "'," . $OVERLAY->GetChatStatus() . "," . To::BoolString($USER->Browsers[0]->Declined) . ");", false); if (Visitor::$PollCount == 1) { $USER->AddFunctionCall("lz_chat_set_focus();", false); } } OverlayChat::$Response = $USER->Response;