static function Listen($_user, $init = false) { global $USER, $VOUCHER; $USER = $_user; if (!(IS_FILTERED && !FILTER_ALLOW_CHATS)) { if (!empty($_POST["p_tid"])) { $VOUCHER = VisitorChat::GetMatchingVoucher(Encoding::Base64UrlDecode($_POST[POST_EXTERN_USER_GROUP]), Encoding::Base64UrlDecode($_POST["p_tid"])); if ($VOUCHER != null) { $USER->Browsers[0]->ChatVoucherId = $VOUCHER->Id; } } if (empty($USER->Browsers[0]->ChatId)) { $USER->Browsers[0]->SetChatId(); $init = true; } if ($USER->Browsers[0]->Status == CHAT_STATUS_OPEN) { Server::InitDataBlock(array("INTERNAL")); if (!empty($_POST[POST_EXTERN_USER_GROUP]) && (empty($USER->Browsers[0]->DesiredChatGroup) || $init)) { $USER->Browsers[0]->DesiredChatGroup = Encoding::Base64UrlDecode($_POST[POST_EXTERN_USER_GROUP]); } $USER->Browsers[0]->SetCookieGroup(); $result = $USER->Browsers[0]->FindOperator(VisitorChat::$Router, $USER); if (!$result && VisitorChat::$Router->OperatorsBusy == 0) { $USER->AddFunctionCall("lz_chat_add_system_text(8,null);", false); $USER->AddFunctionCall("lz_chat_stop_system();", false); } else { if (count(VisitorChat::$Router->OperatorsAvailable) + VisitorChat::$Router->OperatorsBusy > 0) { $USER->AddFunctionCall("lz_chat_set_id('" . $USER->Browsers[0]->ChatId . "');", false); $chatPosition = VisitorChat::$Router->GetQueuePosition($USER->Browsers[0]->DesiredChatGroup); $chatWaitingTime = VisitorChat::$Router->GetQueueWaitingTime($chatPosition); ExternalChat::Login($USER, Server::$Groups[$USER->Browsers[0]->DesiredChatGroup]); $USER->Browsers[0]->SetWaiting(empty(VisitorChat::$DynamicGroup) && !($chatPosition == 1 && count(VisitorChat::$Router->OperatorsAvailable) > 0 && !(!empty($USER->Browsers[0]->DesiredChatPartner) && Server::$Operators[$USER->Browsers[0]->DesiredChatPartner]->Status == USER_STATUS_BUSY))); if (!$USER->Browsers[0]->Waiting) { $USER->Browsers[0]->ShowConnecting($USER); $USER->AddFunctionCall("lz_chat_set_status(lz_chat_data.STATUS_ALLOCATED);", false); if (Server::$Configuration->File["gl_alloc_mode"] != ALLOCATION_MODE_ALL || !empty($USER->Browsers[0]->DesiredChatPartner) || !empty(VisitorChat::$DynamicGroup)) { $USER->Browsers[0]->CreateChat(Server::$Operators[$USER->Browsers[0]->DesiredChatPartner], $USER, true); } else { $run = 0; foreach (VisitorChat::$Router->OperatorsAvailable as $intid => $am) { $USER->Browsers[0]->CreateChat(Server::$Operators[$intid], $USER, false, "", "", true, $run++ == 0); } } } else { if (!empty($_GET["acid"])) { $USER->Browsers[0]->ShowConnecting($USER); $pchatid = Encoding::Base64UrlDecode($_GET["acid"]); $result = DBManager::Execute(true, "SELECT * FROM `" . DB_PREFIX . DATABASE_VISITOR_CHATS . "` WHERE `visitor_id`='" . DBManager::RealEscape($USER->Browsers[0]->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"])) { $posts = unserialize($row["queue_posts"]); foreach ($posts as $post) { $USER->AddFunctionCall("lz_chat_repost_from_queue('" . $post[0] . "');", false); } $USER->AddFunctionCall("lz_chat_data.QueuePostsAdded = true;", false); } } } if ($USER->Browsers[0]->IsMaxWaitingTime(true)) { displayDeclined(); return $USER; } if (empty($_GET["acid"])) { $USER->Browsers[0]->ShowQueueInformation($USER, $chatPosition, $chatWaitingTime, LocalizationManager::$TranslationStrings["client_queue_message"]); $gqmt = $USER->Browsers[0]->ShowGroupQueueInformation($USER, $USER->Browsers[0]->QueueMessageShown); if (!empty($gqmt)) { $USER->AddFunctionCall("lz_chat_add_system_text(99,'" . base64_encode($gqmt) . "');", false); } } if (!VisitorChat::$Router->WasTarget && !empty($USER->Browsers[0]->DesiredChatPartner)) { $USER->Browsers[0]->DesiredChatPartner = ""; } $USER->Browsers[0]->CreateArchiveEntry(null, $USER); } } } } else { $action = $USER->Browsers[0]->GetMaxWaitingTimeAction(false); if ($action == "MESSAGE" || $action == "FORWARD" && !$USER->Browsers[0]->CreateAutoForward($USER)) { $USER->Browsers[0]->InternalDecline(Server::$Operators[$USER->Browsers[0]->OperatorId]->SystemId); displayDeclined(); } else { if (empty($USER->Browsers[0]->ArchiveCreated) && !empty($USER->Browsers[0]->DesiredChatPartner)) { $USER->Browsers[0]->CreateChat(Server::$Operators[$USER->Browsers[0]->DesiredChatPartner], $USER, true); } activeListen(); } } if ($USER->Browsers[0]->Status <= CHAT_STATUS_WAITING && empty($_POST["p_wls"]) && empty(VisitorChat::$DynamicGroup)) { $USER->AddFunctionCall("lz_chat_show_waiting_links('" . base64_encode($wl = Server::$Groups[$USER->Browsers[0]->DesiredChatGroup]->GetWaitingLinks($USER->Browsers[0]->UserData->Text, Visitor::$BrowserLanguage)) . "');", false); } } else { displayFiltered(); } return $USER; }
if (isset($_GET["id"])) { 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 . "_lib/functions.external.inc.php"; require LIVEZILLA_PATH . "_definitions/definitions.dynamic.inc.php"; require LIVEZILLA_PATH . "_definitions/definitions.protocol.inc.php"; @set_error_handler("handleError"); Server::InitDataProvider(); Server::DefineURL("knowledgebase.php"); LocalizationManager::AutoLoad(); $color = ExternalChat::ReadTextColor(); $entry = KnowledgeBaseEntry::GetById(Communication::ReadParameter("id", ""), true); if (!empty($entry)) { $html = IOStruct::GetFile(PATH_TEMPLATES . "kb_entry.tpl"); if (!empty(Server::$Configuration->File["gl_kcss"])) { $html = str_replace("<!--custom_css-->", "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . Server::$Configuration->File["gl_kcss"] . "\">", $html); } if (Server::$Configuration->File["gl_knbr"]) { $rresult = $entry->GetRateResult(); if (($rate = Communication::ReadParameter("h", -1)) != -1) { $html = str_replace("<!--rate_text-->", "<br><div id=\"lz_chat_dialog_kb_rate\">" . $LZLANG["client_feedback_success"] . "</div>", $html); $entry->SaveRateResult($rate); } else { $bhtml = "<a href=\"./knowledgebase.php?id=<!--id-->&h=MQ__\"><!--lang_client_yes--></a><a href=\"./knowledgebase.php?id=<!--id-->&h=MA__\"><!--lang_client_no--></a>"; $fhtml = $rresult[0] > 0 ? str_replace("<!--users-->", $rresult[0], str_replace("<!--total-->", $rresult[1], $LZLANG["client_found_helpful"])) . " " : ""; $html = str_replace("<!--rate_text-->", "<br><div id=\"lz_chat_dialog_kb_rate\">" . $fhtml . $LZLANG["client_was_helpful"] . $bhtml . "</div>", $html);
$html = str_replace("<!--bookmark_name-->", base64_encode(Server::$Configuration->File["gl_site_name"]), $html); $html = str_replace("<!--user_id-->", SESSION, $html); $html = str_replace("<!--connection_error_span-->", CONNECTION_ERROR_SPAN, $html); $html = GeoTracking::Replace($html); $html = str_replace("<!--requested_intern_userid-->", base64_encode(!empty($_GET[GET_EXTERN_INTERN_USER_ID]) && isset(Server::$Operators[Operator::GetSystemId(Encoding::Base64UrlDecode($_GET[GET_EXTERN_INTERN_USER_ID]))]) ? Encoding::Base64UrlDecode($_GET[GET_EXTERN_INTERN_USER_ID]) : ""), $html); $html = str_replace("<!--requested_intern_fullname-->", base64_encode(!empty($_GET[GET_EXTERN_INTERN_USER_ID]) && isset(Server::$Operators[Operator::GetSystemId(Encoding::Base64UrlDecode($_GET[GET_EXTERN_INTERN_USER_ID]))]) ? Server::$Operators[Operator::GetSystemId(Encoding::Base64UrlDecode($_GET[GET_EXTERN_INTERN_USER_ID]))]->Fullname : ""), $html); $html = str_replace("<!--debug-->", To::BoolString(!empty($_GET["debug"])), $html); $html = str_replace("<!--geo_resolute-->", To::BoolString(!empty(Server::$Configuration->File["gl_use_ngl"]) && !(Cookie::Get("geo_data") != null && Cookie::Get("geo_data") > time() - 2592000) && !GeoTracking::SpanExists()), $html); $html = str_replace("<!--chat_id-->", !empty($_GET["cid"]) ? getParam("cid") : "", $html); $html = str_replace("<!--gtv2_api_key-->", strlen(Server::$Configuration->File["gl_otrs"]) > 1 ? Server::$Configuration->File["gl_otrs"] : "", $html); $html = str_replace("<!--template_message_intern-->", base64_encode(str_replace("<!--color-->", ExternalChat::ReadBackgroundColor(), str_replace("<!--dir-->", LocalizationManager::$Direction, IOStruct::GetFile(TEMPLATE_HTML_MESSAGE_INTERN)))), $html); $html = str_replace("<!--template_message_extern-->", base64_encode(str_replace("<!--dir-->", LocalizationManager::$Direction, IOStruct::GetFile(TEMPLATE_HTML_MESSAGE_EXTERN))), $html); $html = str_replace("<!--template_message_add-->", base64_encode(str_replace("<!--dir-->", LocalizationManager::$Direction, IOStruct::GetFile(TEMPLATE_HTML_MESSAGE_ADD))), $html); $html = str_replace("<!--template_message_add_alt-->", base64_encode(str_replace("<!--dir-->", LocalizationManager::$Direction, IOStruct::GetFile(TEMPLATE_HTML_MESSAGE_ADD_ALTERNATE))), $html); $html = str_replace("<!--primary_color-->", ExternalChat::ReadBackgroundColor(), $html); $html = str_replace("<!--secondary_color-->", ExternalChat::ReadTextColor(), $html); $html = str_replace("<!--direct_login-->", To::BoolString(isset($_GET[GET_EXTERN_USER_NAME]) && !isset($_GET[GET_EXTERN_RESET]) || isset($_GET["dl"])), $html); $html = str_replace("<!--preselect_ticket-->", To::BoolString(isset($_GET["pt"])), $html); $html = str_replace("<!--is_ie-->", To::BoolString(!empty($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false), $html); $html = str_replace("<!--is_ios-->", To::BoolString($MobileDetect->isIOS()), $html); $html = str_replace("<!--setup_error-->", base64_encode(buildLoginErrorField()), $html); $html = str_replace("<!--offline_message_mode-->", Server::$Configuration->File["gl_om_mode"], $html); $html = str_replace("<!--offline_message_http-->", Server::$Configuration->File["gl_om_http"], $html); $html = str_replace("<!--checkout_url-->", !empty(Server::$Configuration->Database["ccpp"]["Custom"]) ? Server::$Configuration->Database["ccpp"]["Custom"]->URL : "", $html); $html = str_replace("<!--checkout_only-->", To::BoolString(!empty($_GET["co"]) && !empty($_GET[GET_EXTERN_GROUP])), $html); $html = str_replace("<!--checkout_extend_success-->", To::BoolString(!empty($_GET["co"]) && !empty($_GET["vc"])), $html); $html = str_replace("<!--function_callback-->", To::BoolString(empty(VisitorChat::$DynamicGroup) && (!empty($_GET["cmb"]) || !empty($_GET["ofc"]))), $html); $html = str_replace("<!--function_ticket-->", To::BoolString(empty($_GET["nct"])), $html); $html = str_replace("<!--function_chat-->", To::BoolString(empty($_GET["hfc"])), $html); $html = str_replace("<!--function_knowledgebase-->", To::BoolString(empty($_GET["hfk"]) && !empty(Server::$Configuration->File["gl_knba"])), $html); $html = str_replace("<!--hide_group_select_chat-->", To::BoolString(Communication::GetParameter("hcgs", 0, $nu, FILTER_VALIDATE_INT) == "1" || !empty($_GET[GET_EXTERN_DYNAMIC_GROUP])), $html);
$res = IOStruct::GetFile(PATH_TEMPLATES . "kb_result_category.tpl"); $res = str_replace("<!--title-->", "\"" . cutString($query, 50, true) . "\"", $res); $res = str_replace("<!--entries-->", $result, $res); $res = str_replace("<!--search-->", "true", $res); $res = str_replace("<!--id-->", "sr", $res); $externalUser->AddFunctionCall("lz_chat_search_result('" . base64_encode("<div><b>" . str_replace("<!--count-->", count($matches), LocalizationManager::$TranslationStrings["client_kb_results_found"]) . " </b><br><br>" . $res) . "'," . count($matches) . ");", false); } else { $externalUser->AddFunctionCall("lz_chat_search_result('" . base64_encode("<div><br><br>" . LocalizationManager::$TranslationStrings["client_search_no_result"] . "</div>" . $result . "") . "',0);", false); } } else { $externalUser->AddFunctionCall("lz_chat_search_result('" . base64_encode("<div><br><br>" . LocalizationManager::$TranslationStrings["client_search_no_result"] . "</div>" . $result . "") . "',0);", false); } } } else { if ($_POST[POST_EXTERN_SERVER_ACTION] == EXTERN_ACTION_LISTEN) { $externalUser = ExternalChat::Listen($externalUser); } 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) {
getData(false, false, false, true); define("IS_FILTERED", $FILTERS->Match(getIP(), formLanguages(!isnull(getServerParam("HTTP_ACCEPT_LANGUAGE")) ? getServerParam("HTTP_ACCEPT_LANGUAGE") : ""), CALLER_USER_ID)); define("IS_FLOOD", !dataSetExists($BROWSER->SessionFile) && isFlood()); if (!getAvailability() || IS_FILTERED || IS_FLOOD) { $BROWSER->Destroy(); exit("lz_tracking_stop_tracking();"); } if (dataSetExists($BROWSER->SessionFile)) { $BROWSER->Load(); } $count = count($BROWSER->History); if (!dataSetExists($externalUser->ExternalStatic->SessionFile)) { createStaticFile($externalUser, array(@$_GET[GET_TRACK_RESOLUTION_WIDTH], @$_GET[GET_TRACK_RESOLUTION_HEIGHT]), @$_GET[GET_TRACK_COLOR_DEPTH], @$_GET[GET_TRACK_TIMEZONE_OFFSET], @$_GET[GEO_LATITUDE], @$_GET[GEO_LONGITUDE], @$_GET[GEO_COUNTRY_ISO_2], @$_GET[GEO_CITY], @$_GET[GEO_REGION], @$_GET[GEO_TIMEZONE], @$_GET[GEO_ISP], @$_GET[GEO_SSPAN], @$_GET[GEO_RESULT_ID]); } if (isset($_GET[GET_TRACK_CLOSE_CHAT_WINDOW])) { $chat = new ExternalChat($externalUser->UserId, $_GET[GET_TRACK_CLOSE_CHAT_WINDOW]); $chat->Load(); $chat->Destroy(); } $TRACKINGSCRIPT .= processActions($BROWSER); $TRACKINGSCRIPT .= "lz_tracking_callback(" . $CONFIG["poll_frequency_tracking"] . ",'" . $_GET[GET_TRACK_START] . "');"; $BROWSER->LastActive = time(); if (isnull($BROWSER->FirstActive)) { $BROWSER->FirstActive = time(); } $BROWSER->Referrer = !isset($BROWSER->Referrer) ? isset($_GET[GET_TRACK_REFERRER]) ? trim(slashesStrip(base64UrlDecode($_GET[GET_TRACK_REFERRER]))) : "" : $BROWSER->Referrer; $url = isset($_GET[GET_TRACK_URL]) ? substr(base64UrlDecode($_GET[GET_TRACK_URL]), 0, 1024) : ""; if (!isset($BROWSER->History)) { $BROWSER->History = array(); } if (count($BROWSER->History) == 0 || count($BROWSER->History) > 0 && $BROWSER->History[count($BROWSER->History) - 1][1] != $url) {
function GetWaitingLinks($_question, $_language, $html = "", $count = 0) { $knowledgebase = false; $answers = ChatAutoReply::GetMatches($this->AutoReplies, $_question, $_language, null, null); if (!empty(Server::$Configuration->File["gl_knbq"]) && count($answers) == 0) { $answers = KnowledgeBase::GetMatches($_question, Visitor::$BrowserLanguage); $knowledgebase = true; $color = ExternalChat::ReadTextColor(); } if (count($answers) > 0) { foreach ($answers as $qa) { if ((!empty($qa->ResourceId) || !empty($qa->Answer)) && $qa->Waiting) { $res = KnowledgeBaseEntry::GetById($qa->ResourceId); $target = $qa->NewWindow ? "target=\"_blank\" " : ""; $html .= "<li>"; if ($res == null) { $html .= $qa->Answer; } else { if ($res["type"] == 2) { $html .= "<a class=\"lz_chat_link\" href=\"" . $res["value"] . "\" " . $target . ">" . $res["title"] . "</a>"; } else { if ($res["type"] == 3 || $res["type"] == 4) { $html .= "<a class=\"lz_chat_link\" href=\"" . LIVEZILLA_URL . "getfile.php?id=" . $res["id"] . "\" " . $target . ">" . $res["title"] . "</a>"; } else { $html .= "<b>" . $res["title"] . "</b><br>" . str_replace("<a ", "<a " . $target, str_replace("<A", "<a", $res["value"])); } } } $html .= "</li>"; } else { if ($knowledgebase) { $ehtml = trim($qa->GetHTML($color, true, false)); if (!empty($ehtml)) { $html .= $ehtml; } } } if (++$count > 5) { break; } } if (!empty($html)) { $html = "<div id=\"lz_chat_waiting_links\">" . LocalizationManager::$TranslationStrings["client_while_waiting"] . "<ul>" . $html . "</ul></div>"; return $html; } } return ""; }
function buildTracking() { global $VISITOR, $CONFIG, $DATASETS; $VISITOR = array(); $outdatedVisitors = array(); $itarray = array_keys($DATASETS); foreach ($itarray as $file) { $dataset = $DATASETS[$file]; if (strpos($file, PATH_DATA_EXTERNAL) !== false && substr($file, 0, strlen(PATH_DATA_EXTERNAL)) == PATH_DATA_EXTERNAL) { $userid = substr(str_replace(PATH_DATA_EXTERNAL, "", $file), 0, USER_ID_LENGTH); $browsers = getDirectory(PATH_DATA_EXTERNAL . $userid . "/b/", "."); if (count($browsers) > 0) { foreach ($browsers as $browserid) { $browser = new ExternalBrowser($browserid, $userid); $chat = new ExternalChat($userid, $browserid); if (!isset($VISITOR[$userid])) { $VISITOR[$userid] = new UserExternal($userid); } if (($bStime = getDataSetTime($browser->SessionFile)) != -1) { if ($bStime < time() - $CONFIG["timeout_track"]) { $browser->Destroy(); continue; } $VISITOR[$userid]->Browsers[$browserid] = $browser; } else { if (($cStime = getDataSetTime($chat->SessionFile)) != -1) { $chat->Load(); if ($cStime < time() - $CONFIG["timeout_clients"]) { $chat->Destroy(); continue; } if (isnull($chat->FirstActive)) { $chat->FirstActive = time(); } $chat->History[0] = array($chat->FirstActive, LIVEZILLA_URL . FILE_CHAT, $chat->Code, true); $VISITOR[$userid]->Browsers[$browserid] = $chat; } else { $browser->Destroy(); $chat->Destroy(); } } } } else { $outdatedVisitors[] = $userid; } } } foreach ($outdatedVisitors as $folder) { deleteDirectory(PATH_DATA_EXTERNAL . $folder); } }
$html = getFile(PATH_FRAMES . $_GET[GET_EXTERN_TEMPLATE] . ".tpl"); if (isset($_GET[GET_EXTERN_USER_HEADER]) && !isnull($_GET[GET_EXTERN_USER_HEADER])) { $html = str_replace("<!--logo-->", "<img src=\"" . base64UrlDecode($_GET[GET_EXTERN_USER_HEADER]) . "\" alt=\"\" border=\"0\"><br>", $html); } else { $html = str_replace("<!--logo-->", file_exists(FILE_CARRIERLOGO) ? "<img src=\"" . FILE_CARRIERLOGO . "\" alt=\"\" border=\"0\"><br>" : "", $html); } } else { if (isset($_GET[GET_EXTERN_TEMPLATE]) && $_GET[GET_EXTERN_TEMPLATE] == "lz_chat_frame.3.2.chat.0.0") { $html = getFile(PATH_FRAMES . $_GET[GET_EXTERN_TEMPLATE] . ".tpl"); $html = str_replace("<!--FU_HIDDEN-->", !$CONFIG["gl_ex_fu"] ? " style=\"display:none;\"" : "", $html); } else { if (isset($_GET[GET_EXTERN_TEMPLATE]) && $_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])) { $externalUser = new UserExternal($_POST[POST_EXTERN_USER_USERID]); $externalChat = new ExternalChat($externalUser->UserId, $_POST[POST_EXTERN_USER_BROWSERID]); $externalChat->Load(); if (isset($_FILES["userfile"]) && $externalUser->StoreFile($_POST[POST_EXTERN_USER_BROWSERID], $externalChat->DesiredChatPartner, $externalChat->Fullname)) { $html = str_replace("<!--response-->", "top.lz_chat_file_ready();", $html); } else { if (isset($_FILES['userfile'])) { $html = str_replace("<!--response-->", "top.lz_chat_file_error(2);", $html); } else { $html = str_replace("<!--response-->", "", $html); } } } else { if (isset($_GET["file"])) { $html = str_replace("<!--response-->", "top.lz_chat_file_error(2);", $html); } else { $html = str_replace("<!--response-->", "", $html);