function LoadBrowsers($_outdated = false) { global $CONFIG; $this->Browsers = array(); $limiter = !$_outdated ? " AND `last_active` > " . (time() - $CONFIG["timeout_track"]) . " " : ""; if ($result = queryDB(true, "SELECT * FROM `" . DB_PREFIX . DATABASE_VISITOR_BROWSERS . "` WHERE `visit_id`='" . @mysql_real_escape_string($this->VisitId) . "' AND `visitor_id`='" . @mysql_real_escape_string($this->UserId) . "'" . $limiter . "ORDER BY `created` ASC;")) { while ($row = mysql_fetch_array($result, MYSQL_BOTH)) { if (empty($row["is_chat"])) { $browser = new VisitorBrowser($row["id"], $row["visitor_id"]); $browser->Query = !empty($row["query"]) ? getIdValue(DATABASE_VISITOR_DATA_QUERIES, "query", $row["query"]) : ""; $browser->Email = $row["email"]; $browser->Fullname = $row["fullname"]; $browser->Company = $row["company"]; $browser->Customs = @unserialize($row["customs"]); $browser->LastUpdate = $row["last_update"]; } else { $browser = new VisitorChat($row["visitor_id"], $row["id"]); $browser->Load(); } if (count($browser->History) > 0) { $this->Browsers[$row["id"]] = $browser; $this->Browsers[$row["id"]]->LastActive = $row["last_active"]; } } } }
static function CloseChats() { $result = DBManager::Execute(false, "SELECT * FROM `" . DB_PREFIX . DATABASE_CHAT_ARCHIVE . "` WHERE `chat_type`=1 AND `closed`=0 AND `transcript_sent`=0;"); while ($row = DBManager::FetchArray($result)) { $results = DBManager::Execute(false, "SELECT * FROM `" . DB_PREFIX . DATABASE_VISITOR_CHATS . "` WHERE `chat_id`='" . DBManager::RealEscape($row["chat_id"]) . "' AND (`exit`>0 OR `last_active`<" . (time() - Server::$Configuration->File["timeout_track"]) . ");"); if ($results && ($rows = DBManager::FetchArray($results))) { $botchat = !empty($row["internal_id"]) && Server::$Operators[$row["internal_id"]]->IsBot; $chat = new VisitorChat($rows); $chat->LoadMembers(); $startResult = 0; $endResult = 0; if ($botchat) { $chat->CloseChat(); $lastOp = $row["internal_id"]; $waitingtime = 1; $startResult = 1; } else { $lastOp = $chat->GetLastOperator(); $waitingtime = $chat->GetTotalWaitingTime($startResult, $endResult); } $chatBrowser = new VisitorBrowser($chat->BrowserId, $chat->UserId, false); $chatBrowser->LoadUserData(); Chat::SaveToArchive($row["chat_id"], $chatBrowser->UserData->Fullname, $rows["visitor_id"], $lastOp, $rows["request_group"], $chatBrowser->UserData->Email, $chatBrowser->UserData->Company, $chatBrowser->UserData->Phone, $row["host"], $row["ip"], $chatBrowser->UserData->Text, empty(Server::$Configuration->File["gl_sctb"]) && $botchat, $waitingtime, $startResult, $endResult); } } }
} $EXTERNALUSER->Save($CONFIG, null, "", "", -522, -522, "", "", "", "", "", "", "", false); } else { abortTracking(-1); } } if ($EXTERNALUSER->IsCrawler) { abortTracking(8); } else { if ($EXTERNALUSER->SignatureMismatch) { $TRACKINGSCRIPT = "lz_tracking_set_sessid(\"" . htmlentities($EXTERNALUSER->UserId) . "\",\"" . htmlentities(CALLER_BROWSER_ID) . "\");"; $TRACKINGSCRIPT .= "lz_tracking_callback(1);"; $TRACKINGSCRIPT .= "lz_tracking_poll_server();"; } else { if (isset($_GET[GET_TRACK_CLOSE_CHAT_WINDOW])) { $chat = new VisitorChat($EXTERNALUSER->UserId, $_GET[GET_TRACK_CLOSE_CHAT_WINDOW]); $chat->Load(); $chat->ExternalClose(); $chat->Destroy(); } $BROWSER->LastActive = time(); $BROWSER->VisitId = $EXTERNALUSER->VisitId; $BROWSER->Save($EXTERNALUSER, @$_GET[GET_TRACK_URL]); if (isset($currentURL) && (count($BROWSER->History) == 0 || count($BROWSER->History) > 0 && $BROWSER->History[count($BROWSER->History) - 1]->Url->GetAbsoluteUrl() != $currentURL->Url->GetAbsoluteUrl())) { $BROWSER->History[] = $currentURL; if (!isnull($BROWSER->History[count($BROWSER->History) - 1]->Referrer->GetAbsoluteUrl())) { if ($BROWSER->SetQuery($BROWSER->History[count($BROWSER->History) - 1]->Referrer->GetAbsoluteUrl())) { $BROWSER->History[count($BROWSER->History) - 1]->Referrer->MarkSearchEngine(); } } $BROWSER->History[count($BROWSER->History) - 1]->Save(CALLER_BROWSER_ID);
function appendAcceptedConversations() { $users = explode(POST_ACTION_VALUE_SPLITTER, utf8_decode($_POST[POST_INTERN_PROCESS_ACCEPTED_CHAT . "_va"])); $browsers = explode(POST_ACTION_VALUE_SPLITTER, utf8_decode($_POST[POST_INTERN_PROCESS_ACCEPTED_CHAT . "_vb"])); $ids = explode(POST_ACTION_VALUE_SPLITTER, utf8_decode($_POST[POST_INTERN_PROCESS_ACCEPTED_CHAT . "_vc"])); foreach ($users as $key => $userid) { if (strlen($browsers[$key]) > 0 && strlen($userid) > 0) { $chat = new VisitorChat($userid, $browsers[$key]); $chat->ChatId = $ids[$key]; $chat->InternalActivate(); } } }
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"; 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);"); } } }
static function ApplyDynamicGroup($_chatObj = null) { if (!empty($_GET[GET_EXTERN_DYNAMIC_GROUP])) { if ($_chatObj != null && empty($_chatObj->Forward)) { $_chatObj->LoadForward(); } if ($_chatObj != null && !empty($_chatObj->Forward)) { return; } $tgroup = Communication::ReadParameter(GET_EXTERN_DYNAMIC_GROUP, ""); if (isset(Server::$Groups[$tgroup]) && Server::$Groups[$tgroup]->IsDynamic) { VisitorChat::$DynamicGroup = $tgroup; } } }
$html = str_replace("<!--SO_HIDDEN-->", empty($GROUPS[$groupid]->ChatFunctions[1]) ? "none" : "", $html); $html = str_replace("<!--PR_HIDDEN-->", empty($GROUPS[$groupid]->ChatFunctions[2]) ? "none" : "", $html); $html = str_replace("<!--RA_HIDDEN-->", empty($GROUPS[$groupid]->ChatFunctions[3]) ? "none" : "", $html); $html = str_replace("<!--FV_HIDDEN-->", empty($GROUPS[$groupid]->ChatFunctions[4]) ? "none" : "", $html); $html = str_replace("<!--FU_HIDDEN-->", empty($GROUPS[$groupid]->ChatFunctions[5]) ? "none" : "", $html); $html = str_replace("<!--post_chat_html-->", $GROUPS[$groupid]->PostHTML, $html); } } else { if ($_GET[GET_EXTERN_TEMPLATE] == "lz_chat_frame.3.2.chat.1.0") { $html = getFile(PATH_FRAMES . $_GET[GET_EXTERN_TEMPLATE] . ".tpl"); if (isset($_POST[POST_EXTERN_USER_USERID])) { if (STATS_ACTIVE) { initStatisticProvider(); } $externalUser = new Visitor($_POST[POST_EXTERN_USER_USERID]); $externalChat = VisitorChat::FromCache($externalUser->UserId, $_POST[POST_EXTERN_USER_BROWSERID]); if (isset($_FILES["userfile"]) && $externalUser->StoreFile($_POST[POST_EXTERN_USER_BROWSERID], $externalChat->DesiredChatPartner, $externalChat->Fullname, $externalChat->ChatId)) { $command = "parent.parent.lz_chat_file_ready();"; } else { if (isset($_FILES['userfile'])) { $command = "parent.parent.lz_chat_file_error(2);"; } else { $command = ""; } } } else { if (isset($_GET["file"])) { $command = "parent.parent.lz_chat_file_error(2);"; } else { $command = ""; }
function OverlayChat() { $this->Flags = array(); VisitorChat::$Router = new ChatRouter(); }
function closeChats() { global $INTERNAL, $CONFIG; $result = queryDB(false, "SELECT * FROM `" . DB_PREFIX . DATABASE_CHAT_ARCHIVE . "` WHERE `chat_type`=1 AND `closed`=0 AND `transcript_sent`=0;"); while ($row = DBManager::FetchArray($result)) { $results = queryDB(false, "SELECT * FROM `" . DB_PREFIX . DATABASE_VISITOR_CHATS . "` WHERE `chat_id`='" . DBManager::RealEscape($row["chat_id"]) . "' AND (`exit`>0 OR `last_active`<" . (time() - $CONFIG["timeout_track"]) . ");"); if ($results && ($rows = DBManager::FetchArray($results))) { $botchat = !empty($row["internal_id"]) && $INTERNAL[$row["internal_id"]]->IsBot; $chat = new VisitorChat($rows); $chat->LoadMembers(); $startResult = 0; $endResult = 0; $waitingtime = 0; if ($botchat) { $chat->CloseChat(); $lastOp = $row["internal_id"]; $waitingtime = 1; $startResult = 1; } else { $lastOp = $chat->GetLastOperator($waitingtime, $startResult, $endResult); } closeArchiveEntry($row["chat_id"], $rows["fullname"], $rows["visitor_id"], $lastOp, $rows["request_group"], $rows["email"], $rows["company"], $rows["phone"], $row["host"], $row["ip"], $rows["question"], empty($CONFIG["gl_sctb"]) && $botchat, $waitingtime, $startResult, $endResult); } } }
if (!$currentURL->Url->IsInternalDomain()) { VisitorMonitoring::Abort(6); } } if (VisitorMonitoring::$IsActive) { VisitorMonitoring::$Visitor->Save(null, "", "", -522, -522, "", "", "", "", "", "", "", false); } } else { VisitorMonitoring::Abort(-1); } } if (VisitorMonitoring::$Visitor->IsCrawler) { VisitorMonitoring::Abort(8); } else { if (isset($_GET["clch"])) { $chat = VisitorChat::FromCache(VisitorMonitoring::$Visitor->UserId, Communication::ReadParameter("clch", "")); $chat->ExternalClose(); $chat->Destroy(); } VisitorMonitoring::$Browser->LastActive = time(); VisitorMonitoring::$Browser->VisitId = VisitorMonitoring::$Visitor->VisitId; $parameters = Communication::GetTargetParameters(false); $conline = operatorsAvailable(0, $parameters["exclude"], $parameters["include_group"], $parameters["include_user"], false) > 0; VisitorMonitoring::$Browser->OverlayContainer = !empty($_GET["ovlc"]); if (VisitorMonitoring::$IsActive) { VisitorMonitoring::$Browser->Save(); if (!empty($currentURL) && (count(VisitorMonitoring::$Browser->History) == 0 || count(VisitorMonitoring::$Browser->History) > 0 && VisitorMonitoring::$Browser->History[count(VisitorMonitoring::$Browser->History) - 1]->Url->GetAbsoluteUrl() != $currentURL->Url->GetAbsoluteUrl())) { VisitorMonitoring::$Browser->History[] = $currentURL; if (!Is::Null(VisitorMonitoring::$Browser->History[count(VisitorMonitoring::$Browser->History) - 1]->Referrer->GetAbsoluteUrl())) { if (VisitorMonitoring::$Browser->SetQuery(VisitorMonitoring::$Browser->History[count(VisitorMonitoring::$Browser->History) - 1]->Referrer->GetAbsoluteUrl())) { VisitorMonitoring::$Browser->History[count(VisitorMonitoring::$Browser->History) - 1]->Referrer->MarkSearchEngine();
function processForward() { global $USER, $GROUPS, $VOUCHER; $USER->Browsers[0]->LoadForward(); if (!empty($USER->Browsers[0]->Forward) && !$USER->Browsers[0]->Forward->Invite && !empty($USER->Browsers[0]->Forward->TargetGroupId) && !$USER->Browsers[0]->Forward->Processed) { if (!empty($VOUCHER) && !in_array($VOUCHER->TypeId, $GROUPS[$USER->Browsers[0]->Forward->TargetGroupId]->ChatVouchersRequired)) { $USER->AddFunctionCall("lz_chat_switch_com_chat_box(false);", false); } else { if (!empty($GROUPS[$USER->Browsers[0]->Forward->TargetGroupId]->ChatVouchersRequired)) { $VOUCHER = VisitorChat::GetMatchingVoucher($USER->Browsers[0]->Forward->TargetGroupId, base64UrlDecode($_POST["p_tid"])); if ($VOUCHER != null) { $USER->AddFunctionCall("lz_chat_switch_com_chat_box(true);", false); } } } $USER->AddFunctionCall("lz_chat_initiate_forwarding('" . base64_encode($USER->Browsers[0]->Forward->TargetGroupId) . "'," . parseBool($USER->Browsers[0]->Forward->Auto) . ");", false); $USER->Browsers[0]->LeaveChat($USER->Browsers[0]->Forward->InitiatorSystemId); $USER->Browsers[0]->Forward->Save(true); $USER->Browsers[0]->ExternalClose(); $USER->Browsers[0]->DesiredChatGroup = $USER->Browsers[0]->Forward->TargetGroupId; $USER->Browsers[0]->DesiredChatPartner = $USER->Browsers[0]->Forward->TargetSessId; $USER->Browsers[0]->FirstActive = time(); $USER->Browsers[0]->Save(true); $USER->Browsers[0]->SetCookieGroup(); } }
} else { if ($_POST[POST_EXTERN_SERVER_ACTION] == EXTERN_ACTION_MAIL) { if (($ticket = $externalUser->SaveTicket(Encoding::Base64UrlDecode($_POST[POST_EXTERN_USER_GROUP]), $externalUser->GeoCountryISO2, isset($_POST["p_cmb"]), true, Communication::GetParameter("p_url", "", $nu, FILTER_SANITIZE_URL))) !== false && (Server::$Configuration->File["gl_scom"] != null || Server::$Configuration->File["gl_sgom"] != null)) { $ticket->SendAutoresponder($externalUser, $externalUser->Browsers[0]); } } else { if ($externalUser->Browsers[0]->Status != CHAT_STATUS_OPEN || $externalUser->Browsers[0]->Waiting) { $externalUser->Browsers[0]->CloseChat(7); $externalUser->Browsers[0] = new VisitorChat($externalUser->UserId, Encoding::Base64UrlDecode(@$_POST[POST_EXTERN_USER_BROWSERID]), $externalUser->Browsers[0]->UserData->Fullname, $externalUser->Browsers[0]->UserData->Email, $externalUser->Browsers[0]->UserData->Company, $externalUser->Browsers[0]->UserData->Text, $externalUser->Browsers[0]->UserData->Customs, $externalUser->Browsers[0]->DesiredChatGroup, $externalUser->Browsers[0]->DesiredChatPartner, $externalUser->Browsers[0]->UserData->Phone); } else { $externalUser->Browsers[0]->ChatId = Encoding::Base64UrlDecode(@$_POST[POST_EXTERN_CHAT_ID]); } $externalUser->Browsers[0]->Waiting = false; $externalUser->Browsers[0]->WaitingMessageDisplayed = null; if ($_POST[POST_EXTERN_SERVER_ACTION] == EXTERN_ACTION_RELOAD_GROUPS) { if (!VisitorChat::IsChatBrowserIdAvailable($externalUser->Browsers[0]->BrowserId, true)) { Logging::ErrorLog("Invalid Browser ID - trying to change ..."); $externalUser->AddFunctionCall("lz_chat_change_browser_id('" . getId(USER_ID_LENGTH) . "');", true); $externalUser->AddFunctionCall("lz_chat_reload_groups();", false); } else { if (!$externalUser->Browsers[1]->LoadUserData()) { $externalUser->Browsers[1]->UserData->LoadFromCookie(); } $externalUser = $externalUser->Browsers[1]->ReplaceLoginDetails($externalUser); $externalUser->ReloadGroups(); } } else { $externalUser->Browsers[0]->CloseWindow(); exit; } }
$html = str_replace("<!--SM_HIDDEN-->", empty($GROUPS[$groupid]->ChatFunctions[0]) ? " style=\"display:none;\"" : "", $html); $html = str_replace("<!--SO_HIDDEN-->", empty($GROUPS[$groupid]->ChatFunctions[1]) ? " style=\"display:none;\"" : "", $html); $html = str_replace("<!--PR_HIDDEN-->", empty($GROUPS[$groupid]->ChatFunctions[2]) ? " style=\"display:none;\"" : "", $html); $html = str_replace("<!--RA_HIDDEN-->", empty($GROUPS[$groupid]->ChatFunctions[3]) ? " style=\"display:none;\"" : "", $html); $html = str_replace("<!--FV_HIDDEN-->", empty($GROUPS[$groupid]->ChatFunctions[4]) ? " style=\"display:none;\"" : "", $html); $html = str_replace("<!--FU_HIDDEN-->", empty($GROUPS[$groupid]->ChatFunctions[5]) ? " style=\"display:none;\"" : "", $html); } } else { if ($_GET[GET_EXTERN_TEMPLATE] == "lz_chat_frame.3.2.chat.1.0") { $html = getFile(PATH_FRAMES . $_GET[GET_EXTERN_TEMPLATE] . ".tpl"); if (isset($_POST[POST_EXTERN_USER_USERID])) { if (STATS_ACTIVE) { initStatisticProvider(); } $externalUser = new Visitor($_POST[POST_EXTERN_USER_USERID]); $externalChat = new VisitorChat($externalUser->UserId, $_POST[POST_EXTERN_USER_BROWSERID]); $externalChat->Load(); if (isset($_FILES["userfile"]) && $externalUser->StoreFile($_POST[POST_EXTERN_USER_BROWSERID], $externalChat->DesiredChatPartner, $externalChat->Fullname)) { $command = "top.lz_chat_file_ready();"; } else { if (isset($_FILES['userfile'])) { $command = "top.lz_chat_file_error(2);"; } else { $command = ""; } } } else { if (isset($_GET["file"])) { $command = "top.lz_chat_file_error(2);"; } else { $command = "";
* All rights reserved. * LiveZilla is a registered trademark. * * Improper changes to this file may cause critical errors. ***************************************************************************************/ define("IN_LIVEZILLA", true); header('Content-Type: text/html; charset=utf-8'); 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"; Server::DefineURL("print.php"); @set_error_handler("handleError"); if (Server::InitDataProvider()) { if (!empty($_GET[GET_TRACK_CHATID]) && !empty($_GET[GET_TRACK_BROWSERID]) && !empty($_GET[GET_TRACK_USERID])) { $archive = new Chat(); $archive->ChatId = intval(Communication::GetParameter("c", "")); $archive->Load(); $chat = VisitorChat::GetByChatId($archive->ChatId); if ($chat->BrowserId == Communication::GetParameter(GET_TRACK_BROWSERID, "") && $chat->UserId == Communication::GetParameter(GET_TRACK_USERID, "") && $chat->LastActive > time() - 3600) { $print = IOStruct::GetFile(PATH_TEMPLATES . "print.tpl"); $archive->Generate($archive->ChatId, "", true, true); $print = str_replace("<!--chat_id-->", $archive->ChatId, $print); $print = str_replace("<!--transcript-->", nl2br($archive->PlainText), $print); } exit($print); } }
static function FromCache($_uid, $_bid) { global $CM, $VISITOR; if (!empty($CM)) { initData(array("VISITOR")); if (isset($VISITOR[$_uid])) { foreach ($VISITOR[$_uid]->Browsers as $browser) { if ($browser->BrowserId == $_bid) { return $browser; } } } } $br = new VisitorChat($_uid, $_bid); $br->Load(); return $br; }
} } else { Server::InitDataBlock(array("FILTERS")); } if (isset($_POST["company"]) && !empty($_POST["company"]) || isset($_POST["email"]) && !empty($_POST["email"]) || isset($_POST["name"]) && !empty($_POST["name"]) || isset($_POST["text"]) && !empty($_POST["text"])) { exit(Filter::CreateFloodFilter(Communication::GetIP(), null)); } } header("Content-Type: text/html; charset=utf-8"); if (!isset($_GET[GET_EXTERN_TEMPLATE])) { define("IS_FLOOD", Filter::IsFlood(Communication::GetIP(), null, true)); define("IS_FILTERED", DataManager::$Filters->Match(Communication::GetIP(), LocalizationManager::ImplodeLanguages(!empty($_SERVER["HTTP_ACCEPT_LANGUAGE"]) ? $_SERVER["HTTP_ACCEPT_LANGUAGE"] : ""), SESSION)); require LIVEZILLA_PATH . "_lib/trdp/mobde.php"; $MobileDetect = new Mobile_Detect(); Server::InitDataBlock(array("INTERNAL", "DBCONFIG")); VisitorChat::ApplyDynamicGroup(); $html = IOStruct::GetFile(TEMPLATE_HTML_CHAT); $html = str_replace("<!--extern_script-->", IOStruct::GetFile(TEMPLATE_SCRIPT_EXTERN) . IOStruct::GetFile(TEMPLATE_SCRIPT_DATA) . IOStruct::GetFile(TEMPLATE_SCRIPT_CHAT) . IOStruct::GetFile(TEMPLATE_SCRIPT_FRAME), $html); $html = str_replace("<!--server_id-->", substr(md5(Server::$Configuration->File["gl_lzid"]), 5, 5), $html); $html = str_replace("<!--connector_script-->", IOStruct::GetFile(TEMPLATE_SCRIPT_CONNECTOR), $html); $html = str_replace("<!--group_script-->", IOStruct::GetFile(TEMPLATE_SCRIPT_GROUPS), $html); $html = str_replace("<!--global_script-->", IOStruct::GetFile(TEMPLATE_SCRIPT_GLOBAL), $html); $html = str_replace("<!--browser_id-->", $browserId, $html); $html = str_replace("<!--extern_timeout-->", min(Server::$Configuration->File["timeout_chats"], Server::$Configuration->File["timeout_track"]), $html); $html = str_replace("<!--show_oib-->", To::BoolString(!empty(Server::$Configuration->File["gl_soib"]) && empty($_GET[GET_EXTERN_DYNAMIC_GROUP])), $html); $html = str_replace("<!--window_width-->", Server::$Configuration->File["wcl_window_width"], $html); $html = str_replace("<!--window_height-->", Server::$Configuration->File["wcl_window_height"], $html); $html = str_replace("<!--window_resize-->", To::BoolString(Server::$Configuration->File["gl_hrol"]), $html); $html = str_replace("<!--feedback_on_exit-->", To::BoolString(Server::$Configuration->File["gl_fboe"]), $html); $html = str_replace("<!--switch_to_kb-->", To::BoolString(Communication::ReadParameter("t", "") == "kb" && empty($_GET["hfk"])), $html); $html = str_replace("<!--kb_only-->", To::BoolString(!empty($_REQUEST["kbo"])), $html);
function processChatActions() { global $INTERNAL, $RVISITOR; $count = 0; while (isset($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_va"])) { $type = $_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_vd"]; if ($type == "OperatorSignOff") { $op = $INTERNAL[$_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_0"]]; $op->SignOff(); } else { if ($type == "SendChatTranscriptTo") { $value = 1; while (!empty($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_" . $value])) { queryDB(true, "UPDATE `" . DB_PREFIX . DATABASE_CHAT_ARCHIVE . "` SET `transcript_sent`=0,`transcript_receiver`='" . DBManager::RealEscape($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_0"]) . "' WHERE `transcript_sent`=1 AND `chat_id`='" . DBManager::RealEscape($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_" . $value]) . "' LIMIT 1;"); $value++; } sendChatTranscripts(true); } else { if ($type == "CreatePublicGroup") { $room = new UserGroup(); $room->IsDynamic = true; $room->Id = $_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_0"]; $room->Descriptions["EN"] = $_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_1"]; $room->Owner = $_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_2"]; $room->Save(); $room->AddMember($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_2"], !empty($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_3"])); } else { if ($type == "DeletePublicGroup") { $room = new UserGroup(); $room->Id = $_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_0"]; $room->Destroy(); } else { if ($type == "JoinPublicGroup") { $room = new UserGroup(); $room->Id = $_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_0"]; $room->AddMember($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_2"], !empty($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_3"])); } else { if ($type == "QuitPublicGroup") { $room = new UserGroup(); $room->Id = $_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_0"]; $room->RemoveMember($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_1"]); } else { if ($type == "StartOverlayChat") { $chat = new VisitorChat($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_va"], $_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_vb"]); $chat->RequestInitChat(CALLER_SYSTEM_ID); } else { if ($type == "AddVisitorComment") { $visitor = new Visitor($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_0"]); $visitor->SaveComment(CALLER_SYSTEM_ID, $_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_1"]); } else { if ($type == "DownloadRecentHistory") { $RVISITOR = new Visitor($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_0"]); $RVISITOR->LoadRecentVisits(true, $_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_1"]); } else { if ($type == "SetTranslation") { $chat = new VisitorChat($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_va"], $_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_vb"]); $chat->ChatId = $_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_0"]; $chat->SetTranslation($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_1"]); } else { if ($type == "SetChatTicketParam") { $ticket = new CommercialChatVoucher("", $_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_0"]); $ticket->Load(); $ticket->SetVoucherParams(!empty($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_1"]), !empty($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_2"]), !empty($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_3"]), !empty($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_4"]), !empty($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_5"]), !empty($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_6"])); } else { if (strlen($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_vb"]) > 0 && strlen($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_va"]) > 0) { $chat = new VisitorChat($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_va"], $_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_vb"]); $chat->ChatId = $_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_vc"]; $chat->Load(); if ($type == "SetCallMeBackStatus") { $chat->SetCallMeBackStatus($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_0"]); } else { if ($type == "JoinChatInvisible") { $chat->JoinChat(CALLER_SYSTEM_ID, true, !empty($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_0"])); } else { if ($type == "JoinChat") { $chat->JoinChat(CALLER_SYSTEM_ID, false, !empty($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_0"])); } else { if ($type == "SetPriority") { $chat->SetPriority($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_0"]); } else { if ($type == "SetTargetOperator") { $chat->SetTargetOperator($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_0"]); } else { if ($type == "SetTargetGroup") { $chat->SetTargetGroup($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_0"]); } else { if ($type == "AcceptChat") { $chat->InternalActivate(); } else { if ($type == "CloseChat") { $chat->InternalClose(CALLER_SYSTEM_ID); } else { if ($type == "TakeChat") { $chat->TakeChat(CALLER_SYSTEM_ID, $_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_0"]); } else { if ($type == "DeclineChat") { $chat->InternalDecline(CALLER_SYSTEM_ID); } else { if ($type == "LeaveChat") { $chat->LeaveChat(CALLER_SYSTEM_ID); } } } } } } } } } } } } } } } } } } } } } } } $count++; } }
* LiveZilla is a registered trademark. * * Improper changes to this file may cause critical errors. ***************************************************************************************/ define("IN_LIVEZILLA", true); header('Content-Type: text/html; charset=utf-8'); 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"; @set_error_handler("handleError"); if (!empty($_REQUEST["cid"]) && Server::InitDataProvider()) { $chat = VisitorChat::GetByChatId(Communication::ReadParameter("cid", 0)); if ($chat != null) { if ($chat->Closed) { exit("lz_chat_file_stop();"); } else { $visitor = new Visitor($chat->UserId); $visitor->Load(); if (isset($_FILES["form_userfile"])) { if (StoreFile($visitor, $chat->BrowserId, $chat->DesiredChatPartner, $chat->UserData->Fullname, $chat->ChatId)) { exit("lz_chat_file_ready();"); } else { exit("lz_chat_file_error(2);"); } } else { if (Communication::GetIP() == $visitor->IP) { if (!empty($_POST["p_fu_a"])) {
function BuildChatXML() { global $USER, $BROWSER, $GROUPS, $INPUTS; initData(array("INPUTS")); if ($this->CurrentResponseType == DATA_RESPONSE_TYPE_KEEP_ALIVE) { $this->CurrentResponseType = DATA_RESPONSE_TYPE_BASIC; } if ($this->GetAll) { $this->CurrentResponseType = DATA_RESPONSE_TYPE_STATIC; } if (!$BROWSER->Closed && ($BROWSER->Status > CHAT_STATUS_OPEN || $BROWSER->Waiting)) { if (!empty($BROWSER->DesiredChatGroup)) { $pra = !empty($BROWSER->Members[CALLER_SYSTEM_ID]) ? " pra=\"" . base64_encode($BROWSER->PostsReceived(CALLER_SYSTEM_ID)) . "\"" : ""; $cti = ""; $USER->IsChat = true; $this->XMLCurrentChat = "<chat id=\"" . base64_encode($BROWSER->ChatId) . "\" d=\"" . base64_encode(!empty($BROWSER->Declined) ? 1 : 0) . "\" p=\"" . base64_encode($BROWSER->Priority) . "\" f=\"" . base64_encode($BROWSER->FirstActive) . "\" q=\"" . base64_encode($BROWSER->Status > CHAT_STATUS_OPEN ? "0" : "1") . "\" cmb=\"" . base64_encode($BROWSER->CallMeBack) . "\" st=\"" . base64_encode($BROWSER->Activated) . "\" fn=\"" . base64_encode($BROWSER->GetInputData(111)) . "\" em=\"" . base64_encode($BROWSER->GetInputData(112)) . "\" eq=\"" . base64_encode($BROWSER->GetInputData(114)) . "\" gr=\"" . base64_encode($BROWSER->DesiredChatGroup) . "\" dcp=\"" . base64_encode($BROWSER->DesiredChatPartner) . "\" at=\"" . base64_encode($BROWSER->AllocatedTime) . "\" cp=\"" . base64_encode($BROWSER->GetInputData(116)) . "\" co=\"" . base64_encode($BROWSER->GetInputData(113)) . "\"" . $pra . $cti . ">\r\n"; foreach ($GROUPS as $groupid => $group) { if ($group->IsDynamic) { foreach ($group->Members as $member => $persistent) { if ($member == $BROWSER->SystemId) { $this->XMLCurrentChat .= "<gr p=\"" . base64_encode($persistent ? "1" : "0") . "\">" . base64_encode($groupid) . "</gr>\r\n"; } } } } if (is_array($BROWSER->Customs)) { foreach ($BROWSER->Customs as $index => $value) { if ($INPUTS[$index]->Active && $INPUTS[$index]->Custom) { $value = $INPUTS[$index]->Type == "Text" ? $BROWSER->GetInputData($index) : $value; $this->XMLCurrentChat .= " <cf index=\"" . base64_encode($index) . "\">" . base64_encode($INPUTS[$index]->GetClientValue($value)) . "</cf>\r\n"; } } } $this->XMLCurrentChat .= " <pn acc=\"" . base64_encode($BROWSER->Activated ? "1" : "0") . "\">\r\n"; foreach ($BROWSER->Members as $systemid => $member) { $this->XMLCurrentChat .= "<member id=\"" . base64_encode($systemid) . "\" st=\"" . base64_encode($member->Status) . "\" dec=\"" . base64_encode($member->Declined ? 1 : 0) . "\" />\r\n"; } $this->XMLCurrentChat .= " </pn>\r\n"; if (!empty($BROWSER->ChatVoucherId)) { $chatticket = VisitorChat::GetMatchingVoucher($BROWSER->DesiredChatGroup, $BROWSER->ChatVoucherId); if (!empty($chatticket)) { $this->XMLCurrentChat .= "<cticket>" . $chatticket->GetXML(true) . "</cticket>\r\n"; } } $v_tp = 0; if (!empty($BROWSER->Members[CALLER_SYSTEM_ID])) { if ($BROWSER->Activated == 0) { $BROWSER->LoadForward(false, true); if (!empty($BROWSER->Forward) && ($BROWSER->Forward->TargetSessId == CALLER_SYSTEM_ID || empty($BROWSER->Forward->TargetSessId))) { $BROWSER->RepostChatHistory(3, $BROWSER->ChatId, CALLER_SYSTEM_ID, 0, 0, "", "", "", false, false); $BROWSER->Forward->Destroy(); } else { $BROWSER->RepostChatHistory(3, $BROWSER->ChatId, CALLER_SYSTEM_ID, 0, 0, "", "", "", false, false); } } $v_tp = $BROWSER->Typing ? 1 : 0; } if (isset($this->Caller->ExternalChats[$BROWSER->SystemId]) && !empty($this->Caller->ExternalChats[$BROWSER->SystemId]->FileUploadRequest)) { foreach ($this->Caller->ExternalChats[$BROWSER->SystemId]->FileUploadRequest as $request) { if ($request->Error && $request->Permission != PERMISSION_NONE) { if (!$request->Closed) { $request->Close(); } $this->XMLCurrentChat .= " <fupr id=\"" . base64_encode($request->Id) . "\" cr=\"" . base64_encode($request->Created) . "\" fm=\"" . base64_encode($request->FileMask) . "\" fn=\"" . base64_encode($request->FileName) . "\" fid=\"" . base64_encode($request->FileId) . "\" cid=\"" . base64_encode($request->ChatId) . "\" error=\"" . base64_encode(true) . "\" />\r\n"; } else { if ($request->Download) { $this->XMLCurrentChat .= " <fupr pm=\"" . base64_encode($request->Permission) . "\" id=\"" . base64_encode($request->Id) . "\" cr=\"" . base64_encode($request->Created) . "\" fm=\"" . base64_encode($request->FileMask) . "\" fn=\"" . base64_encode($request->FileName) . "\" cid=\"" . base64_encode($request->ChatId) . "\" fid=\"" . base64_encode($request->FileId) . "\" download=\"" . base64_encode(true) . "\" size=\"" . base64_encode(@filesize($request->GetFile())) . "\" />\r\n"; } else { if ($request->Permission == PERMISSION_VOID) { $this->XMLCurrentChat .= " <fupr id=\"" . base64_encode($request->Id) . "\" cr=\"" . base64_encode($request->Created) . "\" fm=\"" . base64_encode($request->FileMask) . "\" fn=\"" . base64_encode($request->FileName) . "\" fid=\"" . base64_encode($request->FileId) . "\" cid=\"" . base64_encode($request->ChatId) . "\" />\r\n"; } else { if ($request->Permission == PERMISSION_NONE) { $this->XMLCurrentChat .= " <fupr pm=\"" . base64_encode($request->Permission) . "\" id=\"" . base64_encode($request->Id) . "\" cr=\"" . base64_encode($request->Created) . "\" fm=\"" . base64_encode($request->FileMask) . "\" fn=\"" . base64_encode($request->FileName) . "\" cid=\"" . base64_encode($request->ChatId) . "\" fid=\"" . base64_encode($request->FileId) . "\" />\r\n"; } else { if ($request->Permission == PERMISSION_CHAT_ARCHIVE) { $this->XMLCurrentChat .= " <fupr pm=\"" . base64_encode($request->Permission) . "\" id=\"" . base64_encode($request->Id) . "\" cr=\"" . base64_encode($request->Created) . "\" fm=\"" . base64_encode($request->FileMask) . "\" fn=\"" . base64_encode($request->FileName) . "\" cid=\"" . base64_encode($request->ChatId) . "\" fid=\"" . base64_encode($request->FileId) . "\" />\r\n"; } } } } } } } $this->XMLCurrentChat .= " </chat>\r\n"; $this->XMLTyping .= "<v id=\"" . base64_encode($BROWSER->UserId . "~" . $BROWSER->BrowserId) . "\" tp=\"" . base64_encode($v_tp) . "\" />\r\n"; } else { $this->XMLCurrentChat = " <chat />\r\n"; } } }
$EXTERNALUSER->Save($CONFIG, null, "", "", -522, -522, "", "", "", "", "", "", "", false); } } else { abortTracking(-1); } } if ($EXTERNALUSER->IsCrawler) { abortTracking(8); } else { if ($EXTERNALUSER->SignatureMismatch) { $TRACKINGSCRIPT = "lz_tracking_set_sessid(\"" . base64_encode($EXTERNALUSER->UserId) . "\",\"" . base64_encode(CALLER_BROWSER_ID) . "\");"; $TRACKINGSCRIPT .= "lz_tracking_callback(5);"; $TRACKINGSCRIPT .= "lz_tracking_poll_server();"; } else { if (isset($_GET[GET_TRACK_CLOSE_CHAT_WINDOW])) { $chat = VisitorChat::FromCache($EXTERNALUSER->UserId, $_GET[GET_TRACK_CLOSE_CHAT_WINDOW]); $chat->ExternalClose(); $chat->Destroy(); } $BROWSER->LastActive = time(); $BROWSER->VisitId = $EXTERNALUSER->VisitId; $parameters = getTargetParameters(false); $conline = operatorsAvailable(0, $parameters["exclude"], $parameters["include_group"], $parameters["include_user"], false) > 0; $BROWSER->OverlayContainer = !empty($_GET["ovlc"]); if ($monitoringActive) { $BROWSER->Save(); } if (isset($currentURL) && (count($BROWSER->History) == 0 || count($BROWSER->History) > 0 && $BROWSER->History[count($BROWSER->History) - 1]->Url->GetAbsoluteUrl() != $currentURL->Url->GetAbsoluteUrl())) { $BROWSER->History[] = $currentURL; if (!isnull($BROWSER->History[count($BROWSER->History) - 1]->Referrer->GetAbsoluteUrl())) { if ($BROWSER->SetQuery($BROWSER->History[count($BROWSER->History) - 1]->Referrer->GetAbsoluteUrl())) {
define("LIVEZILLA_PATH", "./"); } require LIVEZILLA_PATH . "_definitions/definitions.inc.php"; require LIVEZILLA_PATH . "_lib/objects.global.users.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"); initDataProvider(); if (!empty($_GET["value"]) && strlen($_GET["value"]) == 16) { $ticket = VisitorChat::GetMatchingVoucher($_GET["intgroup"], $_GET["value"]); if (!empty($ticket) && !$ticket->CheckForVoid() && $ticket->Paid) { $ticket->UpdateVoucherChatTime(0, empty($ticket->FirstUsed)); $sessions = $ticket->ChatSessionsMax < 0 ? 0 : $ticket->ChatSessionsMax; if ($result = queryDB(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 . "," . parseBool($ticket->VoucherAutoExpire < time()) . ");"); } else { if (!empty($ticket)) { exit("lz_validate_com_chat_input_result(false,false,1,'',0,0,0,false,false,false);"); } } }