function isChat() { define("SESSION", getSessionId()); Server::InitDataBlock(array("FILTERS")); 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)); $parameters = Communication::GetTargetParameters(); if (operatorsAvailable(0, $parameters["exclude"], $parameters["include_group"], $parameters["include_user"]) > 0) { return true; } return false; }
function getLanguageJS($_isoLanguageCode) { global $LZLANG; $languageData = array(); $LZLANGEN = $LZLANG; if (empty($_isoLanguageCode) || strlen($_isoLanguageCode) > 5) { $_isoLanguageCode = Server::$Configuration->File["gl_default_language"]; } $languageFiles[] = array(LocalizationManager::GetLocalizationFileString($_isoLanguageCode, true, true, false) => false); $languageFiles[] = array(LocalizationManager::GetLocalizationFileString($_isoLanguageCode, true, true, true) => true); if (strlen($_isoLanguageCode) > 2) { $shortLanguageCode = substr($_isoLanguageCode, 0, 2); $languageFiles[] = array(LocalizationManager::GetLocalizationFileString($shortLanguageCode, true, true, false) => false); $languageFiles[] = array(LocalizationManager::GetLocalizationFileString($shortLanguageCode, true, true, true) => true); } foreach ($languageFiles as $fileParams) { foreach ($fileParams as $file => $isOrg) { $folder = LIVEZILLA_PATH . (!$isOrg ? "_language/" : "mobile/php/translation/"); if (IOStruct::RequireDynamic($file, $folder)) { break 2; } } } $translationKeys = array_keys($LZLANGEN); for ($i = 0; $i < count($translationKeys); $i++) { $translation = array("key" => $translationKeys[$i], "orig" => str_replace("'", "\\'", $LZLANGEN[$translationKeys[$i]])); if (isset($LZLANG[$translationKeys[$i]]) && $LZLANG[$translationKeys[$i]] !== "") { $translation[$_isoLanguageCode] = str_replace("'", "\\'", $LZLANG[$translationKeys[$i]]); } else { $translation[$_isoLanguageCode] = str_replace("'", "\\'", $LZLANGEN[$translationKeys[$i]]); } array_push($languageData, $translation); } $jsLanguageData = "["; for ($i = 0; $i < count($languageData) - 1; $i++) { $jsLanguageData .= "{'key': '" . $languageData[$i]["key"] . "', 'orig': '" . $languageData[$i]["orig"] . "', '" . $_isoLanguageCode . "': '" . $languageData[$i][$_isoLanguageCode] . "'}, "; } $i = count($languageData) - 1; $jsLanguageData .= "{'key': '" . $languageData[$i]["key"] . "', 'orig': '" . $languageData[$i]["orig"] . "', '" . $_isoLanguageCode . "': '" . $languageData[$i][$_isoLanguageCode] . "'}"; $jsLanguageData .= "]"; return $jsLanguageData; }
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); } }
$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); }
/**************************************************************************************** * LiveZilla report.php * * 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 . "_definitions/definitions.dynamic.inc.php"; require LIVEZILLA_PATH . "_definitions/definitions.protocol.inc.php"; @set_error_handler("handleError"); if (!empty($_GET["h"]) && !empty($_GET["y"]) && isset($_GET["m"]) && isset($_GET["d"]) && Server::InitDataProvider()) { Server::DefineURL("report.php"); Server::InitStatisticProvider(); $repData = StatisticProvider::GetReportFromHash($_GET["h"], $_GET["y"], $_GET["m"], $_GET["d"], !empty($_GET["u"])); if ($repData !== false) { LocalizationManager::AutoLoad(strtolower(Server::$Configuration->File["gl_default_language"]), true); $repData = Server::Replace($repData, true, false, false, true); exit($repData); } } exit("Sorry, report was not found.");
static function LoadFromFile($_isoTwoletterCode) { global $LZLANG; IOStruct::RequireDynamic(LocalizationManager::GetLocalizationFileString($_isoTwoletterCode), LIVEZILLA_PATH . "_language/"); LocalizationManager::$TranslationStrings = $LZLANG; }
function buildReports($xml = "") { if (empty($_POST[POST_INTERN_XMLCLIP_REPORTS_END_TIME])) { return; } if (empty(Server::$Statistic->CurrentDay) || Server::$Operators[CALLER_SYSTEM_ID]->GetPermission(PERMISSION_REPORTS) == PERMISSION_NONE) { return; } if ($_POST[POST_INTERN_XMLCLIP_REPORTS_END_TIME] == XML_CLIP_NULL) { $_POST[POST_INTERN_XMLCLIP_REPORTS_END_TIME] = "0_0"; } $parts = explode("_", $_POST[POST_INTERN_XMLCLIP_REPORTS_END_TIME]); if ($result = DBManager::Execute(true, "SELECT *,(SELECT MAX(`time`) FROM `" . DB_PREFIX . DATABASE_STATS_AGGS . "`) AS `maxtime`,(SELECT MAX(`mtime`) FROM `" . DB_PREFIX . DATABASE_STATS_AGGS . "` WHERE `maxtime`=`time`) AS `maxmtime` FROM `" . DB_PREFIX . DATABASE_STATS_AGGS . "` WHERE (`time` = " . DBManager::RealEscape($parts[0]) . " AND `mtime` > " . DBManager::RealEscape($parts[1]) . ") OR (`time` > " . DBManager::RealEscape($parts[0]) . ") ORDER BY `time` ASC,`mtime` ASC LIMIT 1")) { while ($row = DBManager::FetchArray($result)) { if ($row["month"] == 0) { $report = new StatisticYear($row["year"], 0, 0, $row["aggregated"], $row["mtime"]); } else { if ($row["day"] == 0) { $report = new StatisticMonth($row["year"], $row["month"], 0, $row["aggregated"], $row["mtime"]); } else { $report = new StatisticDay($row["year"], $row["month"], $row["day"], $row["aggregated"], $row["mtime"]); } } $type = -1; $update = false; $value = ""; if ($report->Type == STATISTIC_PERIOD_TYPE_DAY) { if ($_POST[POST_INTERN_PROCESS_UPDATE_REPORT_TYPE] == 1) { if (Server::$Statistic->CurrentDay->CreateVisitorList) { if (empty($row["aggregated"]) && (!@file_exists($report->GetFilename(true, true)) || $row["time"] < time() - StatisticProvider::$AutoUpdateTime)) { $report->SaveVisitorListToFile(); } if (@file_exists($report->GetFilename(true, true))) { $value = IOStruct::GetFile($report->GetFilename(true, true)); } } $type = 1; } else { if ($_POST[POST_INTERN_PROCESS_UPDATE_REPORT_TYPE] == 0) { if (Server::$Statistic->CurrentDay->CreateReport) { if (empty($row["aggregated"]) && (!@file_exists($report->GetFilename(true, false)) || $row["time"] < time() - StatisticProvider::$AutoUpdateTime)) { $update = true; $report->SaveReportToFile(); } else { if (@file_exists($report->GetFilename(true, false))) { $value = IOStruct::GetFile($report->GetFilename(true, false)); } } } $type = 0; } } } else { if (empty($row["aggregated"]) && (!@file_exists($report->GetFilename(true, false)) || $row["time"] < time() - StatisticProvider::$AutoUpdateTime)) { $report->SaveReportToFile(); } if (@file_exists($report->GetFilename(true, false))) { $value = IOStruct::GetFile($report->GetFilename(true, false)); } $type = $report->Type == STATISTIC_PERIOD_TYPE_MONTH ? 2 : 3; } if ($type > -1) { $convrate = $row["sessions"] > 0 ? round(100 * $row["conversions"] / $row["sessions"], StatisticProvider::$RoundPrecision) : 0; $chats = $chatsd = 0; $qmonth = $report->Type == STATISTIC_PERIOD_TYPE_YEAR ? "" : " AND `month`='" . DBManager::RealEscape($row["month"]) . "'"; $qday = $report->Type != STATISTIC_PERIOD_TYPE_DAY ? "" : " AND `day`='" . DBManager::RealEscape($row["day"]) . "'"; if ($results = DBManager::Execute(true, "SELECT (SUM(`amount`)-SUM(`multi`)) AS `samount` FROM `" . DB_PREFIX . DATABASE_STATS_AGGS_CHATS . "` WHERE `year`='" . DBManager::RealEscape($row["year"]) . "'" . $qmonth . $qday . "")) { if (DBManager::GetRowCount($results) == 1) { $rows = DBManager::FetchArray($results); if (is_numeric($rows["samount"])) { $chats = $rows["samount"]; } } } LocalizationManager::AutoLoad("", true); $value = Server::Replace($value, true, false, false, true); $xml .= "<r cid=\"" . base64_encode(getId(3)) . "\" ragg=\"" . base64_encode(empty($row["aggregated"]) ? 0 : 1) . "\" rtype=\"" . base64_encode($type) . "\" convrate=\"" . base64_encode($convrate) . "\" chats=\"" . base64_encode($chats) . "\" update=\"" . base64_encode($update ? 1 : 0) . "\" visitors=\"" . base64_encode($row["sessions"]) . "\" time=\"" . base64_encode($row["time"]) . "\" mtime=\"" . base64_encode($row["mtime"]) . "\" year=\"" . base64_encode($row["year"]) . "\" month=\"" . base64_encode($row["month"]) . "\" day=\"" . base64_encode($row["day"]) . "\">" . base64_encode($value) . "</r>\r\n"; } $xml .= "<ri maxtime=\"" . base64_encode($row["maxtime"]) . "\" maxmtime=\"" . base64_encode($row["maxmtime"]) . "\" />"; } } Server::$Response->SetStandardResponse(1, $xml); }
function Close() { Server::InitDataBlock(array("INTERNAL")); LocalizationManager::AutoLoad(strtolower(Server::$Configuration->File["gl_default_language"]), true); if ($this->Type == STATISTIC_PERIOD_TYPE_DAY) { $this->CleanDatabases(Server::$Configuration->File["gl_dvhd"] * 2); if ($this->CreateReport) { $this->SaveReportToFile(); } if ($this->CreateVisitorList) { $this->SaveVisitorListToFile(); } $this->CleanDatabases(Server::$Configuration->File["gl_dvhd"]); } else { if ($this->CreateReport) { $this->SaveReportToFile(); } } LocalizationManager::AutoLoad("", true); }
* * 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 (Server::InitDataProvider()) { Server::InitDataBlock(array("DBCONFIG", "INTERNAL")); LocalizationManager::AutoLoad(); $fb_html = IOStruct::GetFile(PATH_TEMPLATES . "feedback.tpl"); $chat = VisitorChat::GetByChatId(intval(Communication::ReadParameter("cid", 0))); $ticket = Ticket::GetById(intval(Communication::ReadParameter("tid", ""))); if ($ticket != null) { $ticket->LoadMessages(); $ticket->LoadStatus(); } if (Feedback::IsFlood()) { $fb_html = str_replace("<!--title-->", "<br><br><br>" . str_replace("<!--count-->", MAX_FEEDBACKS_PER_DAY, LocalizationManager::$TranslationStrings["client_feedback_max"]) . "<script>parent.parent.lz_chat_feedback_result();</script>", $fb_html); $fb_html = str_replace("<!--visible-->", "none", $fb_html); } else { if (!empty($_POST)) { $userid = ""; $feedback = new Feedback(getId(32)); if ($chat != null) {
} else { Visitor::$PollCount = Communication::ReadParameter("pc", 0); VisitorMonitoring::$Response = "lz_tracking_set_sessid(\"" . base64_encode(CALLER_USER_ID) . "\",\"" . base64_encode(CALLER_BROWSER_ID) . "\");"; if (BaseURL::IsInputURL() && strpos(BaseURL::GetInputURL(), "lzmobile") !== false && Visitor::$PollCount == 1) { exit("eval(lz_global_base64_decode('" . base64_encode(IOStruct::GetFile(PATH_TEMPLATES . "jscript/jstrack.mob.tpl")) . "'));lz_tracking_stop_tracking(75);"); } if (BaseURL::IsInputURL() && strpos(BaseURL::GetInputURL(), GET_INTERN_COBROWSE) !== false) { VisitorMonitoring::Abort(1); } VisitorMonitoring::$Browser = new VisitorBrowser(CALLER_BROWSER_ID, CALLER_USER_ID); VisitorMonitoring::$Visitor->AddBrowser(VisitorMonitoring::$Browser); if (VisitorMonitoring::$Visitor->FirstCall && !VisitorMonitoring::$Browser->GetFirstCall()) { VisitorMonitoring::$Visitor->FirstCall = false; } Server::InitDataBlock(array("FILTERS", "EVENTS")); define("IS_FILTERED", DataManager::$Filters->Match(Communication::GetIP(), LocalizationManager::ImplodeLanguages(!empty($_SERVER["HTTP_ACCEPT_LANGUAGE"]) ? $_SERVER["HTTP_ACCEPT_LANGUAGE"] : ""), CALLER_USER_ID, VisitorMonitoring::$Visitor->GeoCountryISO2)); define("IS_FLOOD", VisitorMonitoring::$Browser->GetFirstCall() && Filter::IsFlood(Communication::GetIP(), CALLER_USER_ID)); Server::InitDataBlock(array("INTERNAL")); $deactp = Communication::ReadParameter("deactr", 0); if (IS_FILTERED && !FILTER_ALLOW_TRACKING || IS_FLOOD || !empty($deactp) || Cookie::Get(OO_TRACKING_FILTER_NAME) != null) { if (!IS_FILTERED) { Filter::Create($_SERVER["REMOTE_ADDR"], CALLER_USER_ID, OO_TRACKING_FILTER_NAME, !empty($deactp) ? $deactp : 365, true, true); } VisitorMonitoring::LoadOverlayChat(); VisitorMonitoring::$IsActive = false; VisitorMonitoring::Abort(556); } VisitorMonitoring::$Browser->UserData->LoadFromPassThru(); if (JAVASCRIPT) { if (Visitor::$PollCount <= 3) { if (!BaseURL::IsInputURL()) {
static function GetTranslationData($translation = "") { global $LZLANG; if (OperatorRequest::IsValidated() && Is::Defined("VALIDATED_FULL_LOGIN") && OperatorRequest::IsAdministrator(true)) { Logging::SecurityLog("ServerManager::GetTranslationData", serialize($_POST), CALLER_SYSTEM_ID); $langid = $_POST["p_int_trans_iso"]; if (strpos($langid, "..") === false && strlen($langid) <= 6) { $mobile = !empty($_POST["p_int_trans_m"]); $mobileOriginal = !empty($_POST["p_int_trans_mo"]); $path = !$mobileOriginal ? "_language/" : "mobile/php/translation/"; IOStruct::RequireDynamic(LocalizationManager::GetLocalizationFileString($langid, true, $mobile, $mobileOriginal), LIVEZILLA_PATH . $path); $translation .= "<language key=\"" . base64_encode($langid) . "\">\r\n"; foreach ($LZLANG as $key => $value) { $translation .= "<val key=\"" . base64_encode($key) . "\">" . base64_encode($value) . "</val>\r\n"; } $translation .= "</language>\r\n"; Server::$Response->SetStandardResponse(1, $translation); } else { Server::$Response->SetStandardResponse(0, $translation); } } }
***************************************************************************************/ if (!defined("IN_LIVEZILLA")) { die; } require LIVEZILLA_PATH . "_lib/objects.external.inc.php"; require LIVEZILLA_PATH . "_lib/functions.external.inc.php"; if (isset($_POST[POST_EXTERN_SERVER_ACTION])) { LocalizationManager::AutoLoad(); Server::InitDataBlock(array("FILTERS", "INPUTS")); VisitorChat::$Router = new ChatRouter(); $externalUser = new Visitor(Encoding::Base64UrlDecode($_POST[POST_EXTERN_USER_USERID])); $externalUser->ExtendSession = true; $externalUser->Load(); array_push($externalUser->Browsers, new VisitorChat($externalUser->UserId, Encoding::Base64UrlDecode($_POST[POST_EXTERN_USER_BROWSERID]))); array_push($externalUser->Browsers, new VisitorBrowser($externalUser->Browsers[0]->BrowserId, $externalUser->Browsers[0]->UserId)); define("IS_FILTERED", DataManager::$Filters->Match(Communication::GetIP(), LocalizationManager::ImplodeLanguages(!empty($_SERVER["HTTP_ACCEPT_LANGUAGE"]) ? $_SERVER["HTTP_ACCEPT_LANGUAGE"] : ""), Encoding::Base64UrlDecode($_POST[POST_EXTERN_USER_USERID]), $externalUser->GeoCountryISO2)); define("IS_FLOOD", $externalUser->Browsers[0]->FirstCall && Filter::IsFlood(Communication::GetIP(), @$_POST[POST_EXTERN_USER_USERID], true)); Server::InitDataBlock(array("INTERNAL", "GROUPS")); VisitorChat::ApplyDynamicGroup($externalUser->Browsers[0]); $externalUser->Browsers[0]->Load(); if ($externalUser->Browsers[0]->Status == CHAT_STATUS_OPEN && IS_FILTERED && !FILTER_ALLOW_CHATS && !FILTER_ALLOW_TICKETS) { $error = buildLoginErrorField(); $externalUser->AddFunctionCall("lz_chat_release(true,'" . $error . "');", false); } else { if ($_POST[POST_EXTERN_SERVER_ACTION] == "search_kb") { $query = Communication::ReadParameter("p_q", ""); $color = ExternalChat::ReadTextColor(); $catcount = 0; $main = $result = $navcats = ""; if ($query == "%ALL%") { $matches = KnowledgeBase::GetEntries(Visitor::$BrowserLanguage);
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)); } } } }
$html = str_replace("<!--voucher_id-->", Encoding::Base64UrlEncode($ticket->Id), $html); $html = str_replace("<!--server-->", LIVEZILLA_URL, $html); $ofc = !empty($_POST["form_ofc"]) ? "&ofc=MQ__" : ""; if (!empty($_POST["form_extends"]) && !empty($_POST["form_group"])) { $html = str_replace("<!--co-->", "&co=" . Encoding::Base64UrlEncode($_POST["form_extends"]) . "&intgroup=" . Encoding::Base64UrlEncode($_POST["form_group"]) . $ofc, $html); } else { if (!empty($_POST["form_group"])) { $html = str_replace("<!--co-->", "&intgroup=" . Encoding::Base64UrlEncode($_POST["form_group"]) . $ofc, $html); } else { $html = str_replace("<!--co-->", $ofc, $html); } } exit($html); } else { if (!empty($_GET["confirm"]) && $_GET["confirm"] == "1" && !empty($_GET["vc"]) && strlen(Encoding::Base64UrlDecode($_GET["vc"])) == 16) { require LIVEZILLA_PATH . "_lib/functions.pp.paypal.inc.php"; $voucher = new CommercialChatVoucher("", Encoding::Base64UrlDecode($_GET["vc"])); if ($voucher->Load()) { if (PayProvValidatePayment($voucher->Price)) { LocalizationManager::AutoLoad($voucher->Language); $voucher->SetPaymentDetails(PayProvGetPaymentId(), PayProvGetPayerId(), PayProvGetPaymentDetails()); if (empty($PAYMENTERROR)) { $voucher->SetVoucherParams(!empty($voucher->Voided), true, false, false, false, true, Encoding::Base64UrlDecode($_GET[GET_EXTERN_GROUP])); } else { $voucher->SetVoucherParams(!empty($voucher->Voided), false, false, false, false); } } } } } Server::UnloadDataProvider();
static function GetConfig($xml = "") { global $_CONFIG; $skeys = array("gl_db_host", "gl_db_user", "gl_db_pass", "gl_db_name"); $hashfile = FILE_CONFIG; $cindex = 0; foreach ($_CONFIG as $index => $server_val) { if (is_array($server_val)) { $xml .= "<conf key=\"" . base64_encode($index) . "\">\r\n"; foreach ($server_val as $skey => $sval) { if (!is_array($sval)) { $xml .= "<sub key=\"" . base64_encode($skey) . "\">" . $sval . "</sub>\r\n"; } } $xml .= "</conf>\r\n"; } else { if (!(is_int($index) && is_array($server_val))) { $xml .= "<conf value=\"" . $server_val . "\" key=\"" . base64_encode($index) . "\" />\r\n"; } } } $sxml = ""; foreach ($_CONFIG as $index => $server_val) { if (is_int($index) && is_array($server_val)) { $sxml .= "<site index=\"" . base64_encode($cindex) . "\">\r\n"; foreach ($server_val as $key => $site_val) { if (is_array($site_val)) { $sxml .= "<conf key=\"" . base64_encode($key) . "\">\r\n"; foreach ($site_val as $skey => $sval) { $sxml .= "<sub key=\"" . base64_encode($skey) . "\">" . $sval . "</sub>\r\n"; } $sxml .= "</conf>\r\n"; } else { if (!in_array($key, $skeys) || SERVERSETUP) { $sxml .= "<conf value=\"" . $site_val . "\" key=\"" . base64_encode($key) . "\" />\r\n"; } else { $sxml .= "<conf value=\"" . base64_encode("") . "\" key=\"" . base64_encode($key) . "\" />\r\n"; } } } $cindex++; if (Server::$Configuration->File["gl_host"] == base64_decode($server_val["gl_host"])) { $sxml .= "<db_conf>\r\n"; if (!empty(Server::$Configuration->Database["cct"])) { $sxml .= "<cct>\r\n"; foreach (Server::$Configuration->Database["cct"] as $cct) { $sxml .= $cct->GetXML(); } $sxml .= "</cct>\r\n"; } if (!empty(Server::$Configuration->Database["ccpp"])) { $sxml .= "<ccpp>\r\n"; foreach (Server::$Configuration->Database["ccpp"] as $ccpp) { $sxml .= $ccpp->GetXML(); } $sxml .= "</ccpp>\r\n"; } if (!empty(Server::$Configuration->Database["gl_email"])) { $sxml .= "<gl_email>\r\n"; foreach (Server::$Configuration->Database["gl_email"] as $mb) { $sxml .= $mb->GetXML(); } $sxml .= "</gl_email>\r\n"; } if (!empty(Server::$Configuration->Database["gl_fb"])) { $sxml .= "<gl_fbc>\r\n"; foreach (Server::$Configuration->Database["gl_fb"] as $fbc) { $sxml .= $fbc->GetXML(); } $sxml .= "</gl_fbc>\r\n"; } if (!empty(Server::$Configuration->Database["gl_go"])) { $sxml .= "<gl_go>\r\n"; foreach (Server::$Configuration->Database["gl_go"] as $goal) { $sxml .= $goal->GetXML(); } $sxml .= "</gl_go>\r\n"; } $sxml .= "</db_conf>\r\n"; } $sxml .= "</site>\r\n"; } } $xml .= $sxml; $xml .= "<translations>\r\n"; $files = IOStruct::ReadDirectory("./_language", "index", true); foreach ($files as $translation) { if (strpos($translation, ".bak.") === false && endsWith($translation, ".php")) { $lang = substr($translation, 4, strlen($translation) - 1); $mobile = false; if (strpos($lang, "mobile") === 0) { $lang = substr($lang, 6, strlen($lang) - 6); $mobile = true; } $parts = explode(".", $lang); if (ISSUBSITE && strpos($translation, $parts[0] . "." . SUBSITEHOST) !== false || !ISSUBSITE && substr_count($translation, ".") == 1) { $xml .= "<language m=\"" . base64_encode($mobile ? "1" : "0") . "\" key=\"" . base64_encode($parts[0]) . "\" blocked=\"" . base64_encode(@filesize("./_language/" . $translation) == 0 ? 1 : "0") . "\" />\r\n"; } else { if (ISSUBSITE && strpos($translation, $parts[0] . "." . SUBSITEHOST) === false && !@file_exists(LocalizationManager::GetLocalizationFileString($parts[0], false)) && substr_count($translation, ".") == 1) { $xml .= "<language m=\"" . base64_encode($mobile ? "1" : "0") . "\" key=\"" . base64_encode($parts[0]) . "\" derived=\"" . base64_encode(1) . "\" />\r\n"; } } } } $xml .= "</translations>\r\n"; $xml .= "<php_cfg_vars post_max_size=\"" . base64_encode(IOStruct::ToBytes(!Is::Null(@get_cfg_var("post_max_size")) ? get_cfg_var("post_max_size") : MAX_POST_SIZE_SAFE_MODE)) . "\" upload_max_filesize=\"" . base64_encode(IOStruct::ToBytes(!Is::Null(@get_cfg_var("upload_max_filesize")) ? get_cfg_var("upload_max_filesize") : MAX_UPLOAD_SIZE_SAFE_MODE)) . "\" />\r\n"; $xml .= "</gl_c>\r\n"; return "<gl_c h=\"" . base64_encode(substr(IOStruct::HashMD5($hashfile), 0, 5)) . "\">\r\n" . $xml; }