$row = $EXTERNALUSER->CreateSignature(); if (is_array($row) && $row["id"] != CALLER_USER_ID) { $EXTERNALUSER->UserId = $row["id"]; } $TRACKINGSCRIPT = getFile(TEMPLATE_SCRIPT_TRACK); $TRACKINGSCRIPT = str_replace("<!--file_chat-->", FILE_CHAT, $TRACKINGSCRIPT); $TRACKINGSCRIPT = str_replace("<!--server_id-->", substr(md5($CONFIG["gl_lzid"]), 5, 5), $TRACKINGSCRIPT); $TRACKINGSCRIPT = str_replace("<!--server-->", LIVEZILLA_URL, $TRACKINGSCRIPT); $TRACKINGSCRIPT = str_replace("<!--website-->", base64UrlEncode(getOParam("ws", "", $nu, null, null, 255)), $TRACKINGSCRIPT); $TRACKINGSCRIPT = str_replace("<!--area_code-->", getOParam(GET_TRACK_SPECIAL_AREA_CODE, "", $nu, null, null, 255, false, false), $TRACKINGSCRIPT); $TRACKINGSCRIPT = str_replace("<!--browser_id-->", htmlentities(CALLER_BROWSER_ID, ENT_QUOTES, "UTF-8"), $TRACKINGSCRIPT); $TRACKINGSCRIPT = str_replace("<!--user_id-->", htmlentities($EXTERNALUSER->UserId, ENT_QUOTES, "UTF-8"), $TRACKINGSCRIPT); $TRACKINGSCRIPT = str_replace("<!--connection_error_span-->", CONNECTION_ERROR_SPAN, $TRACKINGSCRIPT); $TRACKINGSCRIPT = str_replace("<!--poll_frequency-->", getMonitoringPollFrequency(false, false), $TRACKINGSCRIPT); $TRACKINGSCRIPT = geoReplacements($TRACKINGSCRIPT); $TRACKINGSCRIPT = str_replace("<!--geo_resolute-->", parseBool($EXTERNALUSER->UserId == CALLER_USER_ID && !empty($CONFIG["gl_use_ngl"]) && $EXTERNALUSER->FirstCall && !empty($CONFIG["gl_pr_ngl"]) && !(!isnull(getCookieValue("geo_data")) && getCookieValue("geo_data") > time() - 2592000) && !isSSpanFile()), $TRACKINGSCRIPT); $TRACKINGSCRIPT = str_replace("<!--alert_html-->", base64_encode(getAlertTemplate()), $TRACKINGSCRIPT); $TRACKINGSCRIPT = str_replace("<!--user_company-->", $company, $TRACKINGSCRIPT); $TRACKINGSCRIPT = str_replace("<!--user_question-->", $question, $TRACKINGSCRIPT); $TRACKINGSCRIPT = str_replace("<!--user_phone-->", $phone, $TRACKINGSCRIPT); $TRACKINGSCRIPT = str_replace("<!--user_language-->", getOParam(GET_EXTERN_USER_LANGUAGE, "", $nu, null, null, 5, true, true, true, true), $TRACKINGSCRIPT); $TRACKINGSCRIPT = str_replace("<!--user_header-->", getOParam(GET_EXTERN_USER_HEADER, "", $nu, FILTER_SANITIZE_URL, null, 0, true, true, true, true), $TRACKINGSCRIPT); $TRACKINGSCRIPT = str_replace("<!--user_customs-->", getJSCustomArray("", $customs), $TRACKINGSCRIPT); $TRACKINGSCRIPT = str_replace("<!--is_tablet-->", parseBool($MobileDetect->isMobile()), $TRACKINGSCRIPT); $TRACKINGSCRIPT = str_replace("<!--is_ie-->", parseBool($detector->BrowserName == "Internet Explorer"), $TRACKINGSCRIPT); $TRACKINGSCRIPT = str_replace("<!--direct_login-->", parseBool(!empty($_GET["dl"])), $TRACKINGSCRIPT); if (!empty($_GET["ovlc"]) && !($detector->BrowserName != "Internet Explorer" || $detector->BrowserVersion > 6)) { unset($_GET["ovlc"]); } $TRACKINGSCRIPT = str_replace("<!--is_ovlpos-->", parseBool($detector->BrowserName != "Internet Explorer" || $detector->BrowserVersion > 6), $TRACKINGSCRIPT); $TRACKINGSCRIPT = str_replace("<!--is_ovlc-->", parseBool(!empty($_GET["ovlc"])), $TRACKINGSCRIPT);
$html = str_replace("<!--small-->", parseBool($small), $html); //$html = str_replace("<!--chat_transcript_form_visible-->",parseBool(!$small && $CONFIG["gl_uret"] && $CONFIG["gl_soct"]),$html); //$html = str_replace("<!--translation_service_visible-->",parseBool(!$small && strlen($CONFIG["gl_otrs"])>1),$html); $html = str_replace("<!--show_waiting_message-->", parseBool(strlen($CONFIG["gl_wmes"]) > 0), $html); $html = str_replace("<!--waiting_message_time-->", $CONFIG["gl_wmes"], $html); $html = str_replace("<!--extern_frequency-->", $CONFIG["poll_frequency_clients"], $html); $html = str_replace("<!--cbcd-->", parseBool($CONFIG["gl_cbcd"]), $html); $html = str_replace("<!--bookmark_name-->", base64_encode($CONFIG["gl_site_name"]), $html); $html = str_replace("<!--user_id-->", SESSION, $html); $html = str_replace("<!--connection_error_span-->", CONNECTION_ERROR_SPAN, $html); $html = str_replace("<!--info_text-->", base64_encode($CONFIG["gl_info"]), $html); $html = geoReplacements($html); $html = str_replace("<!--requested_intern_userid-->", base64_encode(!empty($_GET[GET_EXTERN_INTERN_USER_ID]) && isset($INTERNAL[Operator::GetSystemId(base64UrlDecode($_GET[GET_EXTERN_INTERN_USER_ID]))]) ? base64UrlDecode($_GET[GET_EXTERN_INTERN_USER_ID]) : ""), $html); $html = str_replace("<!--requested_intern_fullname-->", base64_encode(!empty($_GET[GET_EXTERN_INTERN_USER_ID]) && isset($INTERNAL[Operator::GetSystemId(base64UrlDecode($_GET[GET_EXTERN_INTERN_USER_ID]))]) ? $INTERNAL[Operator::GetSystemId(base64UrlDecode($_GET[GET_EXTERN_INTERN_USER_ID]))]->Fullname : ""), $html); $html = str_replace("<!--debug-->", parseBool(!empty($_GET["debug"])), $html); $html = str_replace("<!--geo_resolute-->", parseBool(!empty($CONFIG["gl_use_ngl"]) && !empty($CONFIG["gl_pr_ngl"]) && !(getCookieValue("geo_data") != null && getCookieValue("geo_data") > time() - 2592000) && !isSSpanFile()), $html); $html = str_replace("<!--chat_id-->", !empty($_GET["cid"]) ? getParam("cid") : "", $html); $html = str_replace("<!--gtv2_api_key-->", strlen($CONFIG["gl_otrs"]) > 1 ? $CONFIG["gl_otrs"] : "", $html); $html = str_replace("<!--template_message_intern-->", base64_encode(str_replace("<!--dir-->", $LANG_DIR, getFile(TEMPLATE_HTML_MESSAGE_INTERN))), $html); $html = str_replace("<!--template_message_extern-->", base64_encode(str_replace("<!--dir-->", $LANG_DIR, getFile(TEMPLATE_HTML_MESSAGE_EXTERN))), $html); $html = str_replace("<!--template_message_add-->", base64_encode(str_replace("<!--dir-->", $LANG_DIR, getFile(TEMPLATE_HTML_MESSAGE_ADD))), $html); $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);
function createStaticFile($_externalUser, $_resolution, $_color, $_timezone, $_lat, $_long, $_countryiso2, $_city, $_region, $_geotimezone, $_isp, $_geosspan, $_grid, $_fromCookie = false) { global $CONFIG; if (isnull(getCookieValue("userid"))) { setCookieValue("visits", $_externalUser->ExternalStatic->Visits = 1); } else { if (!isnull(getCookieValue("userid"))) { setCookieValue("visits", $_externalUser->ExternalStatic->Visits = getCookieValue("visits") + 1); } } $_externalUser->ExternalStatic->IP = getIP(); $_externalUser->ExternalStatic->Host = getHost(); $_externalUser->ExternalStatic->SystemInfo = !isnull($userAgent = getServerParam("HTTP_USER_AGENT")) ? $userAgent : ""; $_externalUser->ExternalStatic->Language = !isnull($acceptLanguage = getServerParam("HTTP_ACCEPT_LANGUAGE")) ? $acceptLanguage : ""; if (strlen($_externalUser->ExternalStatic->Language) > 8 || strpos($_externalUser->ExternalStatic->Language, ";") !== false) { $parts = explode(";", $_externalUser->ExternalStatic->Language); if (count($parts) > 0) { $_externalUser->ExternalStatic->Language = $parts[0]; } else { $_externalUser->ExternalStatic->Language = substr($_externalUser->ExternalStatic->Language, 0, 8); } } $_externalUser->ExternalStatic->Resolution = is_array($_resolution) && count($_resolution) == 2 ? $_resolution[0] . " x " . $_resolution[1] : ""; $_externalUser->ExternalStatic->Resolution .= !isnull($_color) ? " (" . $_color . " Bit)" : ""; $_externalUser->ExternalStatic->GeoTimezoneOffset = getLocalTimezone($_timezone); if (!isnull($_geosspan)) { createSSpanFile($_geosspan); } if (!isnull($CONFIG["wcl_geo_tracking"])) { if (!isnull($_lat) && base64_decode($_lat) > -180) { setCookieValue(GEO_LATITUDE, $_externalUser->ExternalStatic->GeoLatitude = base64_decode($_lat)); setCookieValue(GEO_LONGITUDE, $_externalUser->ExternalStatic->GeoLongitude = base64_decode($_long)); setCookieValue(GEO_COUNTRY_ISO_2, $_externalUser->ExternalStatic->GeoCountryISO2 = base64_decode($_countryiso2)); setCookieValue(GEO_CITY, $_externalUser->ExternalStatic->GeoCity = base64_decode($_city)); setCookieValue(GEO_REGION, $_externalUser->ExternalStatic->GeoRegion = base64_decode($_region)); setCookieValue(GEO_TIMEZONE, $_externalUser->ExternalStatic->GeoTimezoneOffset = base64_decode($_geotimezone)); setCookieValue(GEO_ISP, $_externalUser->ExternalStatic->GeoISP = base64_decode($_isp)); setCookieValue("geo_data", time()); } else { if (isset($_lat)) { $_externalUser->ExternalStatic->GeoLatitude = base64_decode($_lat); $_externalUser->ExternalStatic->GeoLongitude = base64_decode($_long); } else { if (!isnull(getCookieValue("geo_data"))) { $_externalUser->ExternalStatic->GeoLatitude = getCookieValue(GEO_LATITUDE); $_externalUser->ExternalStatic->GeoLongitude = getCookieValue(GEO_LONGITUDE); $_externalUser->ExternalStatic->GeoCountryISO2 = getCookieValue(GEO_COUNTRY_ISO_2); $_externalUser->ExternalStatic->GeoCity = getCookieValue(GEO_CITY); $_externalUser->ExternalStatic->GeoRegion = getCookieValue(GEO_REGION); $_externalUser->ExternalStatic->GeoTimezoneOffset = getCookieValue(GEO_TIMEZONE); $_externalUser->ExternalStatic->GeoISP = getCookieValue(GEO_ISP); $_fromCookie = true; } } } removeSSpanFile(false); if ($_fromCookie) { $_externalUser->ExternalStatic->GeoResultId = 6; } else { if (isSSpanFile()) { if (@filemtime(FILE_SERVER_GEO_SSPAN) > time() + CONNECTION_ERROR_SPAN) { $_externalUser->ExternalStatic->GeoResultId = 5; } else { $_externalUser->ExternalStatic->GeoResultId = 4; } } else { if (base64_decode($_lat) == -777) { $_externalUser->ExternalStatic->GeoResultId = 5; } else { if (base64_decode($_lat) == -522) { $_externalUser->ExternalStatic->GeoResultId = 2; } else { if ($_grid != 4) { $_externalUser->ExternalStatic->GeoResultId = 3; } else { $_externalUser->ExternalStatic->GeoResultId = $_grid; } } } } } if (strlen($_externalUser->ExternalStatic->Language) == 2 && !isnull(GEO_COUNTRY_ISO_2)) { $_externalUser->ExternalStatic->Language .= "-" . $_externalUser->ExternalStatic->GeoCountryISO2; } } $_externalUser->ExternalStatic->Save(); }
if (!isset($_GET[GET_TRACK_NO_SEARCH_ENGINE])) { header("Location: http://www.livezilla.net"); exit(getFile(TEMPLATE_HTML_SUPPORT)); } $TRACKINGSCRIPT = getFile(TEMPLATE_SCRIPT_GLOBAL) . getFile(TEMPLATE_SCRIPT_TRACK) . getFile(TEMPLATE_SCRIPT_BOX); $TRACKINGSCRIPT = str_replace("<!--server-->", LIVEZILLA_URL, $TRACKINGSCRIPT); $TRACKINGSCRIPT = str_replace("<!--area_code-->", !isnull(getParam(GET_TRACK_SPECIAL_AREA_CODE)) ? $_GET[GET_TRACK_SPECIAL_AREA_CODE] : "", $TRACKINGSCRIPT); $TRACKINGSCRIPT = str_replace("<!--browser_id-->", CALLER_BROWSER_ID, $TRACKINGSCRIPT); $TRACKINGSCRIPT = str_replace("<!--user_id-->", CALLER_USER_ID, $TRACKINGSCRIPT); $TRACKINGSCRIPT = str_replace("<!--connection_error_span-->", CONNECTION_ERROR_SPAN, $TRACKINGSCRIPT); $TRACKINGSCRIPT = str_replace("<!--poll_frequency-->", $CONFIG["poll_frequency_tracking"], $TRACKINGSCRIPT); $TRACKINGSCRIPT = str_replace("<!--timeout-->", $CONFIG["timeout_track"], $TRACKINGSCRIPT); $TRACKINGSCRIPT = str_replace("<!--height-->", $CONFIG["wcl_window_height"], $TRACKINGSCRIPT); $TRACKINGSCRIPT = str_replace("<!--width-->", $CONFIG["wcl_window_width"], $TRACKINGSCRIPT); $TRACKINGSCRIPT = geoReplacements($TRACKINGSCRIPT); $TRACKINGSCRIPT = str_replace("<!--geo_resolute-->", parseBool(!isSSpanFile() && !dataSetExists($externalUser->ExternalStatic->SessionFile) && !isnull($CONFIG["wcl_geo_tracking"]) && !(!isnull(getCookieValue("geo_data")) && getCookieValue("geo_data") > time() - 2592000)), $TRACKINGSCRIPT); $TRACKINGSCRIPT = str_replace("<!--alert_html-->", base64_encode(str_replace("<!--server-->", LIVEZILLA_URL, getFile(TEMPLATE_SCRIPT_ALERT))), $TRACKINGSCRIPT); $TRACKINGSCRIPT = str_replace("<!--user_name-->", getParam(GET_EXTERN_USER_NAME), $TRACKINGSCRIPT); $TRACKINGSCRIPT = str_replace("<!--user_email-->", getParam(GET_EXTERN_USER_EMAIL), $TRACKINGSCRIPT); $TRACKINGSCRIPT = str_replace("<!--user_company-->", getParam(GET_EXTERN_USER_COMPANY), $TRACKINGSCRIPT); $TRACKINGSCRIPT = str_replace("<!--user_header-->", getParam(GET_EXTERN_USER_HEADER), $TRACKINGSCRIPT); if (isset($_GET[GET_EXTERN_USER_EMAIL])) { setCookieValue("login_email", secPrev(base64UrlDecode($_GET[GET_EXTERN_USER_EMAIL]))); } if (isset($_GET[GET_EXTERN_USER_COMPANY])) { setCookieValue("login_company", secPrev(base64UrlDecode($_GET[GET_EXTERN_USER_COMPANY]))); } if (isset($_GET[GET_EXTERN_USER_NAME])) { setCookieValue("login_name", secPrev(base64UrlDecode($_GET[GET_EXTERN_USER_NAME]))); } } else {
$html = str_replace("<!--extern_script-->", getFile(TEMPLATE_SCRIPT_EXTERN) . getFile(TEMPLATE_SCRIPT_DATA) . getFile(TEMPLATE_SCRIPT_CHAT) . getFile(TEMPLATE_SCRIPT_FRAME), $html); $html = str_replace("<!--connector_script-->", getFile(TEMPLATE_SCRIPT_CONNECTOR), $html); $html = str_replace("<!--group_script-->", getFile(TEMPLATE_SCRIPT_GROUPS), $html); $html = str_replace("<!--global_script-->", getFile(TEMPLATE_SCRIPT_GLOBAL), $html); $html = str_replace("<!--browser_id-->", $browserId, $html); $html = str_replace("<!--extern_timeout-->", $CONFIG["timeout_clients"], $html); $html = str_replace("<!--extern_frequency-->", $CONFIG["poll_frequency_clients"], $html); $html = str_replace("<!--cbcd-->", parseBool($CONFIG["gl_cbcd"]), $html); $html = str_replace("<!--bookmark_name-->", base64_encode($CONFIG["gl_site_name"]), $html); $html = str_replace("<!--user_id-->", SESSION, $html); $html = str_replace("<!--connection_error_span-->", CONNECTION_ERROR_SPAN, $html); $html = replaceLoginDetails($html); $html = geoReplacements($html); $html = str_replace("<!--requested_intern_userid-->", isset($_GET[GET_EXTERN_INTERN_USER_ID]) && !isnull($_GET[GET_EXTERN_INTERN_USER_ID]) ? base64UrlDecode($_GET[GET_EXTERN_INTERN_USER_ID]) : "", $html); $html = str_replace("<!--geo_url-->", CONFIG_LIVEZILLA_GEO . "?aid=" . $CONFIG["wcl_geo_tracking"], $html); $html = str_replace("<!--geo_resolute-->", parseBool(!isSSpanFile() && !isnull($CONFIG["wcl_geo_tracking"]) && !(getCookieValue("geo_data") != null && getCookieValue("geo_data") > time() - 2592000)), $html); $html = str_replace("<!--area_code-->", isset($_GET[GET_TRACK_SPECIAL_AREA_CODE]) ? "&code=" . $_GET[GET_TRACK_SPECIAL_AREA_CODE] : "", $html); $html = str_replace("<!--template_message_intern-->", base64_encode(getFile(TEMPLATE_HTML_MESSAGE_INTERN)), $html); $html = str_replace("<!--template_message_extern-->", base64_encode(getFile(TEMPLATE_HTML_MESSAGE_EXTERN)), $html); $html = str_replace("<!--template_message_add-->", base64_encode(getFile(TEMPLATE_HTML_MESSAGE_ADD)), $html); $html = str_replace("<!--template_message_add_alt-->", base64_encode(getFile(TEMPLATE_HTML_MESSAGE_ADD_ALTERNATE)), $html); $html = str_replace("<!--direct_login-->", parseBool(isset($_GET[GET_EXTERN_USER_NAME]) && !isset($_GET[GET_EXTERN_RESET]) && !isnull($_GET[GET_EXTERN_USER_NAME])), $html); $html = str_replace("<!--is_ie-->", parseBool(!isnull(getServerParam('HTTP_USER_AGENT')) && strpos(getServerParam('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("<!--offline_message_pre_chat-->", parseBool($CONFIG["gl_no_om_sp"] == 1), $html); $html = str_replace("<!--lang_client_queue_message-->", $CONFIG["gl_sho_qu_inf"] == 1 ? $LZLANG["client_queue_message"] : $LZLANG["client_ints_are_busy"], $html); } else { if (isset($_GET[GET_EXTERN_TEMPLATE]) && $_GET[GET_EXTERN_TEMPLATE] == "lz_chat_frame.3.2.login.1.0") { getData(true, false, false, false);