$externalUser->Browsers[0]->Question = base64UrlDecode($_GET[GET_EXTERN_USER_QUESTION]); } $externalUser->Browsers[0]->Customs = getCustomArray($externalUser->Browsers[0]->Customs); $externalUser = replaceLoginDetails($externalUser); $externalUser = reloadGroups($externalUser); } else { $externalUser->Browsers[0]->CloseWindow(); exit; } } } } if (!isset($_POST[POST_EXTERN_RESOLUTION_WIDTH])) { $externalUser->KeepAlive(); } else { $externalUser->Save($CONFIG, array(getOParam(POST_EXTERN_RESOLUTION_WIDTH, "", $nu, FILTER_SANITIZE_SPECIAL_CHARS, null, 32), getOParam(POST_EXTERN_RESOLUTION_HEIGHT, "", $nu, FILTER_SANITIZE_SPECIAL_CHARS, null, 32)), getOParam(POST_EXTERN_COLOR_DEPTH, "", $nu, FILTER_SANITIZE_SPECIAL_CHARS, null, 32), getOParam(POST_EXTERN_TIMEZONE_OFFSET, "", $nu, FILTER_SANITIZE_SPECIAL_CHARS, null, 32), getOParam(GEO_LATITUDE, -522, $nu, FILTER_VALIDATE_FLOAT), getOParam(GEO_LONGITUDE, -522, $nu, FILTER_VALIDATE_FLOAT), getOParam(GEO_COUNTRY_ISO_2, "", $nu, null, null, 32), getOParam(GEO_CITY, "", $nu, null, null, 255), getOParam(GEO_REGION, "", $nu, null, null, 255), getOParam(GEO_TIMEZONE, "", $nu, null, null, 24), getOParam(GEO_ISP, "", $nu, null, null, 255), getOParam(GEO_SSPAN, 0, $nu, FILTER_VALIDATE_INT), getOParam(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 = base64UrlDecode($_GET[GET_TRACK_SPECIAL_AREA_CODE]); } if (IS_FILTERED) { $externalUser->Browsers[0]->CloseChat(8); } else { if (!$externalUser->Browsers[0]->Closed) { $externalUser->Browsers[0]->Save(); }
$currentURL = new HistoryURL(BaseURl::GetInputURL(), getOParam(GET_TRACK_SPECIAL_AREA_CODE, "", $nu, null, null, 255), getOParam(GET_EXTERN_DOCUMENT_TITLE, "", $nu, null, null, 255), getOParam(GET_TRACK_REFERRER, "", $nu, FILTER_SANITIZE_URL, null, 510), time()); if ($currentURL->Referrer->IsInternalDomain()) { $currentURL->Referrer = new BaseUrl(""); } if ($currentURL->Url->Excluded) { abortTracking(4); } if ($monitoringActive) { if (isset($_GET[GET_TRACK_TIMEZONE_OFFSET])) { $EXTERNALUSER->Save($CONFIG, array(getOParam(GET_TRACK_RESOLUTION_WIDTH, "", $nu, FILTER_SANITIZE_SPECIAL_CHARS, null, 32), getOParam(GET_TRACK_RESOLUTION_HEIGHT, "", $nu, FILTER_SANITIZE_SPECIAL_CHARS, null, 32)), getOParam(GET_TRACK_COLOR_DEPTH, "", $nu, FILTER_SANITIZE_SPECIAL_CHARS, null, 32), getOParam(GET_TRACK_TIMEZONE_OFFSET, "", $nu, FILTER_SANITIZE_SPECIAL_CHARS, null, 32), getOParam(GEO_LATITUDE, -522, $nu, FILTER_VALIDATE_FLOAT, array(), 0, true, false), getOParam(GEO_LONGITUDE, -522, $nu, FILTER_VALIDATE_FLOAT, array(), 0, true, false), getOParam(GEO_COUNTRY_ISO_2, "", $nu, null, null, 32, true, false), getOParam(GEO_CITY, "", $nu, null, null, 255, true, false), getOParam(GEO_REGION, "", $nu, null, null, 255, true, false), getOParam(GEO_TIMEZONE, "", $nu, null, null, 24, true, false), getOParam(GEO_ISP, "", $nu, null, null, 255, true, false), getOParam(GEO_SSPAN, 0, $nu, FILTER_VALIDATE_INT, array(), 0, false, false), getOParam(GEO_RESULT_ID, "", $nu, FILTER_VALIDATE_INT, array(), 32, false, false)); } } } } else { if (!empty($_SERVER["HTTP_REFERER"])) { $currentURL = new HistoryURL(getOParam("HTTP_REFERER", "", $nu, FILTER_SANITIZE_URL, null, 500), getOParam(GET_TRACK_SPECIAL_AREA_CODE, "", $nu, null, null, 255), "", "", time()); if ($currentURL->Url->Excluded) { abortTracking(5); } else { if (!$currentURL->Url->IsInternalDomain()) { abortTracking(6); } } if ($monitoringActive) { $EXTERNALUSER->Save($CONFIG, null, "", "", -522, -522, "", "", "", "", "", "", "", false); } } else { abortTracking(-1); } } if ($EXTERNALUSER->IsCrawler) {
$html = str_replace("<!--template_message_add_alt-->", base64_encode(str_replace("<!--dir-->", $LANG_DIR, getFile(TEMPLATE_HTML_MESSAGE_ADD_ALTERNATE))), $html); $html = str_replace("<!--direct_login-->", parseBool(isset($_GET[GET_EXTERN_USER_NAME]) && !isset($_GET[GET_EXTERN_RESET]) || isset($_GET["dl"])), $html); $html = str_replace("<!--preselect_ticket-->", parseBool(isset($_GET["pt"])), $html); $html = str_replace("<!--is_ie-->", parseBool(!empty($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false), $html); $html = str_replace("<!--setup_error-->", base64_encode(buildLoginErrorField()), $html); $html = str_replace("<!--offline_message_mode-->", $CONFIG["gl_om_mode"], $html); $html = str_replace("<!--offline_message_http-->", $CONFIG["gl_om_http"], $html); $html = str_replace("<!--lang_client_queue_message-->", $CONFIG["gl_sho_qu_inf"] == 1 ? $LZLANG["client_queue_message"] : $LZLANG["client_ints_are_busy"], $html); $html = str_replace("<!--checkout_url-->", !empty($CONFIG["db"]["ccpp"]["Custom"]) ? $CONFIG["db"]["ccpp"]["Custom"]->URL : "", $html); $html = str_replace("<!--checkout_only-->", parseBool(!empty($_GET["co"]) && !empty($_GET[GET_EXTERN_GROUP])), $html); $html = str_replace("<!--checkout_extend_success-->", parseBool(!empty($_GET["co"]) && !empty($_GET["vc"])), $html); $html = str_replace("<!--function_callback-->", parseBool(!empty($_GET["cmb"]) || !empty($_GET["ofc"])), $html); $html = str_replace("<!--function_chat-->", parseBool(empty($_GET["hfc"])), $html); $html = str_replace("<!--hide_group_select_chat-->", parseBool(getOParam("hcgs", 0, $nu, FILTER_VALIDATE_INT) == "1"), $html); $html = str_replace("<!--hide_group_select_ticket-->", parseBool(getOParam("htgs", 0, $nu, FILTER_VALIDATE_INT) == "1"), $html); $html = str_replace("<!--require_group_selection-->", parseBool(getOParam("rgs", 0, $nu, FILTER_VALIDATE_INT) == "1"), $html); $html = str_replace("<!--offline_message_pop-->", parseBool(!empty($CONFIG["gl_om_pop_up"]) || empty($CONFIG["gl_om_mode"])), $html); $html = str_replace("<!--misc_frame_height-->", !$small && $CONFIG["gl_uret"] && $CONFIG["gl_otrs"] ? 52 : (!$small && ($CONFIG["gl_uret"] || $CONFIG["gl_otrs"]) ? 31 : 0), $html); } else { if ($_GET[GET_EXTERN_TEMPLATE] == "lz_chat_frame.3.2.lgin.1.0") { initData(array("INTERNAL", "GROUPS")); $html = getFile(PATH_FRAMES . $_GET[GET_EXTERN_TEMPLATE] . ".tpl"); $html = isset($CONFIG["gl_site_name"]) ? str_replace("<!--config_name-->", $CONFIG["gl_site_name"], $html) : str_replace("<!--config_name-->", "LiveZilla", $html); $html = getChatLoginInputs($html, MAX_INPUT_LENGTH); $html = str_replace("<!--alert-->", getAlertTemplate(), $html); $html = str_replace("<!--com_chats-->", getChatVoucherTemplate(), $html); $html = str_replace("<!--ssl_secured-->", getScheme() == SCHEME_HTTP_SECURE && !empty($CONFIG["gl_sssl"]) ? "" : "display:none;", $html); } else { if ($_GET[GET_EXTERN_TEMPLATE] == "lz_chat_frame.3.2.lgin.0.0") { $html = getFile(PATH_FRAMES . $_GET[GET_EXTERN_TEMPLATE] . ".tpl"); } else {
static function PersistentJoin($_userId, $_systemId, $joined = false) { global $GROUPS; if (UserGroup::IsDynamicGroup()) { if (!empty($_GET[GET_EXTERN_DYNAMIC_GROUP])) { $tgroup = getOParam(GET_EXTERN_DYNAMIC_GROUP, ""); if (isset($GROUPS[$tgroup])) { $GROUPS[$tgroup]->AddMember($_systemId, true); $GROUPS[$tgroup]->LoadMembers(); $joined = true; } } else { $gToJoin = array(); $result = queryDB(true, "SELECT * FROM `" . DB_PREFIX . DATABASE_GROUP_MEMBERS . "` WHERE `persistent`=1 AND `user_id` LIKE '%" . DBManager::RealEscape($_userId) . "%';"); if ($result) { while ($row = DBManager::FetchArray($result)) { if ($row["user_id"] != $_systemId) { if (!isset($gToJoin[$row["group_id"]])) { $gToJoin[$row["group_id"]] = true; } } else { $gToJoin[$row["group_id"]] = false; $joined = true; } } foreach ($gToJoin as $gid => $join) { if ($join) { $GROUPS[$gid]->AddMember($_systemId, true); $GROUPS[$gid]->LoadMembers(); $joined = true; } } } } } return $joined; }
static function GetInputURL() { if (!empty($_GET[GET_TRACK_URL])) { return base64UrlDecode(getOParam(GET_TRACK_URL, "", $nu, FILTER_SANITIZE_URL, null, 2056)); } else { if (!empty($_GET["u"])) { return getOParam("u", "", $nu, FILTER_SANITIZE_URL, null, 2056); } } return ""; }
function getIdent() { if (isset($_POST[POST_INTERN_AUTHENTICATION_USERID])) { return getOParam(POST_INTERN_AUTHENTICATION_USERID, "", $nu, FILTER_SANITIZE_SPECIAL_CHARS, null, 32, false, false); } else { if (isset($_GET[GET_TRACK_BROWSERID])) { return getOParam(GET_TRACK_BROWSERID, "", $nu, FILTER_SANITIZE_SPECIAL_CHARS, null, 32); } else { if (isset($_POST[POST_EXTERN_USER_BROWSERID])) { return getOParam(POST_EXTERN_USER_BROWSERID, "", $nu, FILTER_SANITIZE_SPECIAL_CHARS, null, 32); } } } return ""; }
$oppostcount = -1; } if (!empty($spkthtml) && !$spkt) { addHTML($spkthtml, "sys", "SPKT" . $USER->Browsers[0]->InternalUser->SystemId); } if (!empty($posthtml)) { addHTML($posthtml, $lppflag); } if (!empty($LASTPOST)) { $USER->AddFunctionCall("lz_chat_set_last_post('" . base64_encode(trim(html_entity_decode($LASTPOST, ENT_COMPAT, "UTF-8"))) . "');", false); } if ($psound) { $USER->AddFunctionCall("lz_chat_play_sound();", false); } if (!empty($_GET["tid"])) { if ($ticket = $USER->SaveTicket($USER->Browsers[0]->DesiredChatGroup, base64UrlDecode($_GET["tin"]), base64UrlDecode($_GET["tie"]), "", $USER->GeoCountryISO2, "", false, base64UrlDecode($_GET["tim"]), true, getOParam(GET_TRACK_URL, "", $nu, FILTER_SANITIZE_URL, null, 512))) { $USER->Browsers[0]->SaveLoginData(); Visitor::SendTicketAutoresponder($ticket, $USER->Language, false); } } $HTML = str_replace("<!--server-->", LIVEZILLA_URL, $HTML); if ($LANGUAGE) { $HTML = applyReplacements($HTML, $LANGUAGE, false); } if (!$chat_available && !$USER->Browsers[0]->Declined) { addHTML(statusHTML(@$LZLANG["client_chat_not_available"]), "sys", "OFM01"); } if (!empty($HTML)) { $USER->AddFunctionCall("lz_chat_add_html_element('" . base64_encode($HTML) . "',true," . $lpr . "," . $LMR . ",'" . base64_encode($LASTPOSTER) . "','" . @$_GET["lp"] . "'," . $oppostcount . ");", false); } $USER->AddFunctionCall("lz_chat_set_connecting(" . parseBool(!$BOTMODE && (!empty($USER->Browsers[0]->ChatId) && !$USER->Browsers[0]->InternalActivation && !$USER->Browsers[0]->Closed && !$USER->Browsers[0]->Declined)) . ",'" . $USER->Browsers[0]->SystemId . "'," . parseBool(!empty($USER->Browsers[0]->InternalUser) && $USER->Browsers[0]->InternalUser->Status == USER_STATUS_AWAY) . ");", false);
$oppostcount = -1; } if (!empty($spkthtml) && !$spkt) { addHTML($spkthtml, "sys", "SPKT" . $USER->Browsers[0]->InternalUser->SystemId); } if (!empty($posthtml)) { addHTML($posthtml, $lppflag); } if (!empty($LASTPOST)) { $USER->AddFunctionCall("lz_chat_set_last_post('" . base64_encode(trim(html_entity_decode($LASTPOST, ENT_COMPAT, "UTF-8"))) . "');", false); } if ($psound) { $USER->AddFunctionCall("lz_chat_play_sound('message');", false); } if (!empty($_GET["tid"])) { if ($ticket = $USER->SaveTicket(getOParam("eg", "", $c), $USER->GeoCountryISO2, false, true, BaseURL::GetInputURL())) { $USER->Browsers[0]->SaveLoginData(); Visitor::SendTicketAutoresponder($ticket, $USER->Language); } } $HTML = str_replace("<!--server-->", LIVEZILLA_URL, $HTML); if ($LANGUAGE) { $HTML = applyReplacements($HTML, $LANGUAGE, false); } if (!empty($HTML)) { $USER->AddFunctionCall("lz_chat_add_html_element('" . base64_encode($HTML) . "',true," . $lpr . "," . $LMR . ",'" . base64_encode($LASTPOSTER) . "','" . @$_GET["lp"] . "'," . $oppostcount . ");", false); } $USER->AddFunctionCall("lz_chat_set_connecting(" . parseBool(!$BOTMODE && (!empty($USER->Browsers[0]->ChatId) && !$USER->Browsers[0]->InternalActivation && !$USER->Browsers[0]->Closed && !$USER->Browsers[0]->Declined)) . ",'" . $USER->Browsers[0]->SystemId . "'," . parseBool(!empty($USER->Browsers[0]->InternalUser) && $USER->Browsers[0]->InternalUser->Status == USER_STATUS_AWAY) . ");", false); if ($REPOLL) { $USER->AddFunctionCall("lz_tracking_poll_server(1211);", false); }
function ApplyOverlayInputValues($_parent, $_changed = false) { global $INPUTS, $GROUPS; $group = $GROUPS[$this->DesiredChatGroup]; foreach ($INPUTS as $index => $input) { $changed = false; if ($input->Active && $input->Custom) { if (isset($_GET["f" . $input->Index])) { if (!isset($this->Customs[$index])) { $this->Customs[$index] = ""; } $this->Customs[$index] = getOParam("f" . $input->Index, $this->Customs[$index], $changed); if ($input->Cookie && $input->Type != "File") { setCookieValue("cf_" . $index, $this->Customs[$index]); } } } else { $value = ""; if ($index == 111 && $INPUTS[111]->IsServerInput()) { $value = $_parent->Fullname = $this->Fullname = $group->GetServerInput($INPUTS[111], true, $this->Fullname, $changed); } if ($index == 112 && $INPUTS[112]->IsServerInput()) { $value = $_parent->Email = $this->Email = $group->GetServerInput($INPUTS[112], true, $this->Email, $changed); } if ($index == 113 && $INPUTS[113]->IsServerInput()) { $value = $_parent->Company = $this->Company = $group->GetServerInput($INPUTS[113], true, $this->Company, $changed); } if ($index == 114 && $INPUTS[114]->IsServerInput()) { $value = $_parent->Question = $this->Question = $group->GetServerInput($INPUTS[114], true, $this->Question, $changed); } if ($index == 116 && $INPUTS[116]->IsServerInput()) { $value = $_parent->Phone = $this->Phone = $group->GetServerInput($INPUTS[116], true, $this->Phone, $changed); } if ($input->Cookie && $input->Type != "File" && $changed && !empty($value)) { setCookieValue("form_" . $index, $value); } } if ($changed) { $_changed = true; } } return $_changed; }
* 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); 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/objects.global.users.inc.php"; require LIVEZILLA_PATH . "_definitions/definitions.dynamic.inc.php"; require LIVEZILLA_PATH . "_definitions/definitions.protocol.inc.php"; @set_error_handler("handleError"); if (isset($_GET["id"]) && initDataProvider()) { initData(array("INTERNAL")); if (Operator::IPValidate()) { if (empty($CONFIG["gl_avhe"])) { exit("HTML content is currently not being saved for security reasons. Please check your LiveZilla configuration:<br><br>LiveZilla Server Admin -> Server Configuration -> Security"); } $c = null; $html = TicketEmail::GetHTML(getOParam("id", "", $c, FILTER_SANITIZE_SPECIAL_CHARS, null)); if (!empty($html)) { exit($html); } exit("Sorry, email does not exist or no HTML content was found."); } }
function processPosts($counter = 0) { global $USER, $STATS, $GROUPS, $INTERNAL, $LZLANG; while (isset($_POST["p_p" . $counter])) { if (STATS_ACTIVE) { $STATS->ProcessAction(ST_ACTION_EXTERNAL_POST); } $id = md5($USER->Browsers[0]->SystemId . getOParam(POST_EXTERN_CHAT_ID, 0, $nu, FILTER_SANITIZE_NUMBER_INT) . base64UrlDecode($_POST["p_i" . $counter])); $senderName = !empty($USER->Browsers[0]->Fullname) ? $USER->Browsers[0]->Fullname : $LZLANG["client_guest"] . " " . getNoName($USER->UserId . getIP()); $post = new Post($id, $USER->Browsers[0]->SystemId, "", base64UrlDecode($_POST["p_p" . $counter]), time(), $USER->Browsers[0]->ChatId, $senderName); foreach ($GROUPS as $groupid => $group) { if ($group->IsDynamic && isset($group->Members[$USER->Browsers[0]->SystemId])) { foreach ($group->Members as $member => $persistent) { if ($member != $USER->Browsers[0]->SystemId) { if (!empty($INTERNAL[$member])) { processPost($id, $post, $member, $counter, $groupid, $USER->Browsers[0]->ChatId); } else { processPost($id, $post, $member, $counter, $groupid, getValueBySystemId($member, "chat_id", "")); } } } $pGroup = $group; } } foreach ($USER->Browsers[0]->Members as $systemid => $member) { if (!empty($member->Declined)) { continue; } if (!empty($INTERNAL[$systemid]) && isset($pGroup->Members[$systemid])) { continue; } if (!(!empty($pGroup) && !empty($INTERNAL[$systemid]))) { processPost($id, $post, $systemid, $counter, $USER->Browsers[0]->SystemId, $USER->Browsers[0]->ChatId); } } $autoReply = $USER->Browsers[0]->InternalUser->GetAutoReplies($post->Text, $USER->Browsers[0]); if (!empty($autoReply)) { ChatAutoReply::SendAutoReply($autoReply, $USER, $INTERNAL[$systemid]); } $USER->AddFunctionCall("lz_chat_release_post('" . base64UrlDecode($_POST["p_i" . $counter]) . "');", false); $counter++; } $counter = 0; while (isset($_POST["pr_i" . $counter])) { $post = new Post(base64UrlDecode($_POST["pr_i" . $counter]), "", "", "", "", "", ""); $post->MarkReceived($USER->Browsers[0]->SystemId); $USER->AddFunctionCall("lz_chat_message_set_received('" . base64UrlDecode($_POST["pr_i" . $counter]) . "');", false); $counter++; } }