function CreateChatTemplate() { $this->ChatHTML = ""; if (Visitor::$PollCount == 1) { $this->ChatHTML = str_replace("<!--server-->", LIVEZILLA_URL, IOStruct::GetFile(TEMPLATE_HTML_OVERLAY_CHAT)); $this->ChatHTML = str_replace("<!--file_upload_template-->", IOStruct::GetFile(PATH_TEMPLATES . "file_upload.tpl"), $this->ChatHTML); $this->ChatHTML = str_replace("<!--dir-->", LocalizationManager::$Direction, $this->ChatHTML); $this->ChatHTML = getChatLoginInputs($this->ChatHTML, MAX_INPUT_LENGTH_OVERLAY, true); $this->ChatHTML = str_replace("<!--tr_vis-->", strlen(Server::$Configuration->File["gl_otrs"]) > 1 ? "block" : "none", $this->ChatHTML); $this->ChatHTML = str_replace("<!--overlay_input_max_length-->", MAX_INPUT_LENGTH_OVERLAY, $this->ChatHTML); $this->ChatHTML = Server::Replace($this->ChatHTML, true, false); $this->ChatHTML = OverlayChat::ReplaceColors($this->ChatHTML, false); $this->ChatHTML = str_replace("<!--tc-->", Communication::ReadParameter("ovlct", "#ffffff"), $this->ChatHTML); $this->ChatHTML = str_replace("<!--apo-->", !empty($_GET["ovlapo"]) ? "" : "display:none;", $this->ChatHTML); $this->ChatHTML = str_replace("<!--et_vis-->", !empty(Server::$Configuration->File["gl_retr"]) && !empty(Server::$Configuration->File["gl_soct"]) ? "block" : "none", $this->ChatHTML); $this->ChatHTML = str_replace("<!--activate_transcript-->", empty(Server::$Configuration->File["gl_soct"]) ? "" : "CHECKED", $this->ChatHTML); $this->ChatHTML = str_replace("<!--param-->", @Server::$Configuration->File["gl_cpas"], $this->ChatHTML); $tlanguages = getLanguageSelects(LocalizationManager::GetBrowserLocalization()); $this->ChatHTML = str_replace("<!--languages-->", $tlanguages, $this->ChatHTML); } }
static function Detect() { if (defined("CALLER_TYPE") && CALLER_TYPE == CALLER_TYPE_INTERNAL && defined("CALLER_SYSTEM_ID")) { return strtolower(Server::$Operators[CALLER_SYSTEM_ID]->Language); } else { $_isoTwoletterCode = LocalizationManager::GetBrowserLocalization(); return strtolower($_isoTwoletterCode[0]); } }
$html = IOStruct::GetFile(PATH_FRAMES . $_GET[GET_EXTERN_TEMPLATE] . ".tpl"); $html = isset(Server::$Configuration->File["gl_site_name"]) ? str_replace("<!--config_name-->", Server::$Configuration->File["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-->", Communication::GetScheme() == SCHEME_HTTP_SECURE && !empty(Server::$Configuration->File["gl_sssl"]) ? "" : "display:none;", $html); $html = str_replace("<!--bgc-->", $color = Communication::ReadParameter("epc", "#73be28"), $html); $html = str_replace("<!--color-->", Colors::TransformHEX($color, 30), $html); } else { if ($_GET[GET_EXTERN_TEMPLATE] == "lz_chat_frame_chat") { $html = IOStruct::GetFile(PATH_FRAMES . $_GET[GET_EXTERN_TEMPLATE] . ".tpl"); $html = str_replace("<!--alert-->", getAlertTemplate(), $html); $tlanguages = ""; if (strlen(Server::$Configuration->File["gl_otrs"]) > 1) { $mylang = LocalizationManager::GetBrowserLocalization(); $tlanguages = getLanguageSelects(LocalizationManager::GetBrowserLocalization()); } $html = str_replace("<!--languages-->", $tlanguages, $html); Server::InitDataBlock(array("GROUPS")); $groupid = $_POST["intgroup"]; if (!empty($groupid) && isset(Server::$Groups[$groupid])) { $html = str_replace("<!--SM_HIDDEN-->", empty(Server::$Groups[$groupid]->ChatFunctions[0]) ? "none" : "", $html); $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); }
function Save($_resolution, $_color, $_timezone, $_lat, $_long, $_countryiso2, $_city, $_region, $_geotimezone, $_isp, $_geosspan, $_grid, $_js = true, $_fromCookie = false) { if (!$this->FirstCall) { $this->KeepAlive(); } else { if (!Is::Null(Cookie::Get("visits")) && $this->Visits == 1) { $this->Visits = Cookie::Get("visits") + 1; } Cookie::Set("visits", $this->Visits); if (!Is::Null(Cookie::Get("last_visit"))) { $this->VisitLast = Cookie::Get("last_visit"); } Cookie::Set("last_visit", time()); $this->IP = Communication::GetIP(); $this->SystemInfo = !empty($_SERVER["HTTP_USER_AGENT"]) ? $_SERVER["HTTP_USER_AGENT"] : ""; $localization = LocalizationManager::GetBrowserLocalization(); $this->Language = $localization[0]; if (!empty($localization[1])) { $this->GeoCountryISO2 = $localization[1]; } $this->Resolution = !empty($_resolution) && count($_resolution) == 2 && !empty($_resolution[0]) && !empty($_resolution[1]) ? $_resolution[0] . " x " . $_resolution[1] : ""; $this->Resolution .= !empty($_color) ? " (" . $_color . " Bit)" : ""; $this->GeoTimezoneOffset = SystemTime::GetLocalTimezone($_timezone); $this->GeoResult = 0; if (!empty($_geosspan)) { GeoTracking::SpanCreate($_geosspan); } if (!empty(Server::$Configuration->File["gl_use_ngl"]) && $_js) { if (!Is::Null(Cookie::Get("geo_data")) && !Is::Null(Cookie::Get(GEO_LATITUDE))) { $this->GeoLatitude = Cookie::Get(GEO_LATITUDE); $this->GeoLongitude = Cookie::Get(GEO_LONGITUDE); $this->GeoCountryISO2 = Cookie::Get(GEO_COUNTRY_ISO_2); $this->GeoCity = Cookie::Get(GEO_CITY); $this->GeoRegion = Cookie::Get(GEO_REGION); $this->GeoTimezoneOffset = Cookie::Get(GEO_TIMEZONE); $this->GeoISP = Cookie::Get(GEO_ISP); $_fromCookie = true; } else { if (!empty($_lat) && $_lat > -180) { Cookie::Set(GEO_LATITUDE, $this->GeoLatitude = $_lat); Cookie::Set(GEO_LONGITUDE, $this->GeoLongitude = $_long); Cookie::Set(GEO_COUNTRY_ISO_2, $this->GeoCountryISO2 = $_countryiso2); Cookie::Set(GEO_CITY, $this->GeoCity = $_city); Cookie::Set(GEO_REGION, $this->GeoRegion = $_region); Cookie::Set(GEO_TIMEZONE, $this->GeoTimezoneOffset = $_geotimezone); Cookie::Set(GEO_ISP, $this->GeoISP = $_isp); Cookie::Set("geo_data", time()); } else { if (!empty($_lat)) { $this->GeoLatitude = $_lat; $this->GeoLongitude = $_long; } } } GeoTracking::SpanRemove(false); if ($_fromCookie) { $this->GeoResultId = 6; } else { if (!Is::Null($span = GeoTracking::SpanExists())) { if ($span > time() + CONNECTION_ERROR_SPAN) { $this->GeoResultId = 5; } else { $this->GeoResultId = 4; } } else { if ($_lat == -777) { $this->GeoResultId = 5; } else { if ($_lat == -522) { $this->GeoResultId = 2; } else { if ($_grid != 4) { $this->GeoResultId = 3; } else { $this->GeoResultId = $_grid; } } } } } } else { $this->GeoResultId = 7; } Server::InitDataBlock(array("COUNTRIES")); if (isset(Server::$CountryAliases[$this->GeoCountryISO2])) { $this->GeoCountryISO2 = Server::$CountryAliases[$this->GeoCountryISO2]; } $detector = new DeviceDetector(); $detector->DetectBrowser($this->Host); if ($detector->AgentType == AGENT_TYPE_BROWSER || $detector->AgentType == AGENT_TYPE_UNKNOWN) { $detector->DetectOperatingSystem($this->Host); $bid = $this->GetBrowserId($detector->Browser, $detector->AgentType); $oid = $this->GetOSId($detector->OperatingSystem); $this->CreateSignature(); DBManager::Execute(true, "INSERT IGNORE INTO `" . DB_PREFIX . DATABASE_VISITORS . "` (`id`, `entrance`,`last_active`, `host`,`ip`,`system`,`browser`, `visits`,`visit_id`,`visit_last`,`resolution`, `language`, `country`, `city`, `region`, `isp`, `timezone`, `latitude`, `longitude`, `geo_result`, `js`, `signature`) VALUES ('" . DBManager::RealEscape($this->UserId) . "', '" . DBManager::RealEscape(time()) . "','" . DBManager::RealEscape(time()) . "', '" . DBManager::RealEscape($this->Host) . "', '" . DBManager::RealEscape($this->IP) . "', '" . DBManager::RealEscape($oid) . "','" . DBManager::RealEscape($bid) . "', '" . DBManager::RealEscape($this->Visits) . "', '" . DBManager::RealEscape($this->VisitId) . "','" . DBManager::RealEscape($this->VisitLast) . "', '" . DBManager::RealEscape(CacheManager::GetDataTableIdFromValue(DATABASE_VISITOR_DATA_RESOLUTIONS, "resolution", $this->Resolution, false, 32)) . "', '" . DBManager::RealEscape(substr(strtoupper($this->Language), 0, 5)) . "','" . DBManager::RealEscape($this->GeoCountryISO2) . "', '" . DBManager::RealEscape(CacheManager::GetDataTableIdFromValue(DATABASE_VISITOR_DATA_CITIES, "city", $this->GeoCity, false)) . "', '" . DBManager::RealEscape(CacheManager::GetDataTableIdFromValue(DATABASE_VISITOR_DATA_REGIONS, "region", $this->GeoRegion, false)) . "', '" . DBManager::RealEscape(CacheManager::GetDataTableIdFromValue(DATABASE_VISITOR_DATA_ISPS, "isp", utf8_encode($this->GeoISP), false)) . "', '" . DBManager::RealEscape($this->GeoTimezoneOffset) . "', '" . DBManager::RealEscape($this->GeoLatitude) . "', '" . DBManager::RealEscape($this->GeoLongitude) . "', '" . DBManager::RealEscape($this->GeoResultId) . "', '" . DBManager::RealEscape($_js ? 1 : 0) . "', '" . DBManager::RealEscape($this->Signature) . "');"); if ($this->VisitsDay > 1 && DBManager::GetAffectedRowCount() == 1) { DBManager::Execute(true, "UPDATE `" . DB_PREFIX . DATABASE_VISITORS . "` SET `visit_latest`=0 WHERE `id`='" . DBManager::RealEscape($this->UserId) . "' AND `visit_id`!='" . DBManager::RealEscape($this->VisitId) . "';"); } } else { if (STATS_ACTIVE) { $this->IsCrawler = true; Server::$Statistic->ProcessAction(ST_ACTION_LOG_CRAWLER_ACCESS, array($this->GetCrawlerId($detector->Browser), null)); } } } }