function GetUsersHTML()
 {
     $html_users = "";
     $html_user = IOStruct::GetFile(TEMPLATE_HTML_STATS_USERS_USER);
     $html_url = IOStruct::GetFile(TEMPLATE_HTML_STATS_USERS_URL);
     $html_body = IOStruct::GetFile(TEMPLATE_HTML_STATS_USERS_BODY);
     $html_body = str_replace("<!--status-->", $this->Closed ? "<!--lang_stats_status_closed-->" : "<!--lang_stats_status_open-->", $html_body);
     $vcount = Visitor::Build(true, $d = " WHERE `entrance`>='" . DBManager::RealEscape($this->Delimiters[0]) . "' AND `entrance`<='" . DBManager::RealEscape($this->Delimiters[1]) . "'", " LIMIT " . StatisticProvider::$MaxUsersAmount, $this->Delimiters[0]);
     $count = 1;
     foreach (Server::$Visitors as $visitor) {
         $user = $html_user;
         $user = str_replace("<!--entrance-->", date("H:i:s", $visitor->FirstActive), $user);
         $user = str_replace("<!--exit-->", date("H:i:s", $visitor->ExitTime), $user);
         $user = str_replace("<!--visits-->", max($visitor->VisitsDay, $visitor->Visits), $user);
         $user = str_replace("<!--visits_day-->", $visitor->VisitsDay, $user);
         $user = str_replace("<!--system-->", !empty($visitor->OperatingSystem) ? $visitor->OperatingSystem : "<!--lang_stats_unknown-->", $user);
         $user = str_replace("<!--browser-->", !empty($visitor->Browser) ? $visitor->Browser : "<!--lang_stats_unknown-->", $user);
         $user = str_replace("<!--country_name-->", !empty($visitor->GeoCountryName) ? $visitor->GeoCountryName : "<!--lang_stats_unknown-->", $user);
         $user = str_replace("<!--city-->", !empty($visitor->GeoCity) ? $visitor->GeoCity : "<!--lang_stats_unknown-->", $user);
         $user = str_replace("<!--region-->", $visitor->GeoRegion, $user);
         $user = str_replace("<!--isp-->", str_replace("'", "", $visitor->GeoISP), $user);
         $user = str_replace("<!--ip-->", $visitor->IP, $user);
         $user = str_replace("<!--host-->", str_replace("'", "", $visitor->Host), $user);
         $user = str_replace("<!--id-->", $visitor->UserId, $user);
         $user = str_replace("<!--vclass-->", max($visitor->VisitsDay, $visitor->Visits) == 1 ? "vn" : ($visitor->VisitsDay > 1 ? "vm" : "vs"), $user);
         $urls = "";
         $id = 1;
         $oid = 1;
         $bcount = 1;
         foreach ($visitor->Browsers as $browser) {
             if ($browser->Overlay || empty($browser->History)) {
                 continue;
             }
             $ucount = 0;
             foreach ($browser->History as $hurl) {
                 if ($id == 1 && !Is::Null($hurl->Referrer->GetAbsoluteUrl()) && $hurl->Referrer->GetAbsoluteUrl() != $hurl->Url->GetAbsoluteUrl()) {
                     $url = $html_url;
                     $url = str_replace("<!--page-->", "Referrer:&nbsp;&nbsp;<a href=\"" . @htmlentities(StatisticProvider::$Dereferrer . $hurl->Referrer->GetAbsoluteUrl(), ENT_QUOTES, 'UTF-8') . "\" target=\"_blank\"><b>" . @htmlentities($hurl->Referrer->GetAbsoluteUrl(), ENT_QUOTES, 'UTF-8') . "</b></a>", $url);
                     $url = str_replace("<!--entrance-->", "&nbsp;", $url);
                     $url = str_replace("<!--id-->", "&nbsp;", $url);
                     $url = str_replace("<!--oid-->", $oid++, $url);
                     $urls .= $url;
                 }
                 $urls = str_replace("<!--exit-->", date("H:i:s", $hurl->Entrance), $urls);
                 $url = $html_url;
                 $url = str_replace("<!--page-->", "<!--lang_stats_browser--> " . $bcount . ":&nbsp;&nbsp;<a href=\"" . htmlentities(StatisticProvider::$Dereferrer . $hurl->Url->GetAbsoluteUrl(), ENT_QUOTES, 'UTF-8') . "\" target=\"_blank\"><b>" . @htmlentities($hurl->Url->GetAbsoluteUrl(), ENT_QUOTES, 'UTF-8') . "</b></a>", $url);
                 $url = str_replace("<!--entrance-->", date("H:i:s", $hurl->Entrance), $url);
                 $url = str_replace("<!--id-->", $id++, $url);
                 $url = str_replace("<!--oid-->", $oid++, $url);
                 $urls .= $url;
                 $ucount++;
             }
             if ($ucount > 0) {
                 $bcount++;
             }
             if ($browser->Type == BROWSER_TYPE_CHAT) {
                 $urls = str_replace("<!--exit-->", date("H:i:s", $browser->LastActive + Server::$Configuration->File["timeout_track"]), $urls);
             } else {
                 $urls = str_replace("<!--exit-->", date("H:i:s", $browser->LastActive), $urls);
             }
         }
         $user = str_replace("<!--pages-->", $id - 1 . ($id - 1 == 0 ? "?" : ""), $user);
         $html_users .= $user . str_replace("<!--exit-->", date("H:i:s", $visitor->ExitTime), $urls);
         $html_users = str_replace("<!--number-->", $count++, $html_users);
     }
     $html_body = str_replace("<!--visitors-->", $html_users, $html_body);
     $html_body = str_replace("<!--amount-->", $vcount, $html_body);
     Server::$Visitors = array();
     Visitor::Build();
     return $html_body;
 }
 static function InitDataBlock($_fields)
 {
     if (in_array("DBCONFIG", $_fields) && empty(Server::$Configuration->Database)) {
         Server::$Configuration->LoadFromDatabase(true, Server::$Configuration->File["gl_db_prefix"]);
     }
     if ((in_array("INTERNAL", $_fields) || in_array("GROUPS", $_fields)) && empty(Server::$Operators)) {
         Server::LoadInternals();
         if (Is::Defined("IS_FILTERED") && FILTER_ALLOW_TICKETS && !FILTER_ALLOW_CHATS) {
             foreach (Server::$Operators as $operator) {
                 $operator->LastActive = $operator->Status = USER_STATUS_OFFLINE;
             }
         }
     }
     if (in_array("LANGUAGES", $_fields) && empty(Server::$Languages)) {
         Server::LoadLanguages();
     }
     if (in_array("COUNTRIES", $_fields) && empty(Server::$Countries)) {
         Server::LoadCountries();
     }
     if (in_array("INPUTS", $_fields) && empty(Server::$Inputs)) {
         DataInput::Build();
     }
     if (in_array("FILTERS", $_fields) && empty(DataManager::$Filters)) {
         DataManager::LoadFilters();
     }
     if (Is::Defined("DB_CONNECTION")) {
         if (in_array("EVENTS", $_fields) && empty(Server::$Events)) {
             Server::LoadEvents();
         }
         if (in_array("VISITOR", $_fields) && empty(Server::$Visitors)) {
             Visitor::Build();
         }
     }
 }
function initData($_fields)
{
    global $INTERNAL, $LANGUAGES, $COUNTRIES, $FILTERS, $EVENTS, $VISITOR, $INPUTS;
    if ((in_array("INTERNAL", $_fields) || in_array("GROUPS", $_fields)) && empty($INTERNAL)) {
        loadInternals();
    }
    if (in_array("LANGUAGES", $_fields) && empty($LANGUAGES)) {
        loadLanguages();
    }
    if (in_array("COUNTRIES", $_fields) && empty($COUNTRIES)) {
        loadCountries();
    }
    if (in_array("INPUTS", $_fields) && empty($INPUTS)) {
        DataInput::Build();
    }
    if (in_array("FILTERS", $_fields) && empty($FILTERS)) {
        loadFilters();
    }
    if (is("DB_CONNECTION")) {
        if (in_array("EVENTS", $_fields) && empty($EVENTS)) {
            loadEvents();
        }
        if (in_array("VISITOR", $_fields) && empty($VISITOR)) {
            Visitor::Build();
        }
    }
}