function getData($_internal, $_groups, $_visitors, $_filters, $_events = false)
{
    if ($_internal) {
        loadInternals();
    }
    if ($_groups) {
        loadGroups();
    }
    if ($_visitors) {
        loadVisitors();
    }
    if ($_filters) {
        loadFilters();
    }
    if ($_events) {
        loadEvents();
    }
}
 function GetUsersHTML()
 {
     global $VISITOR, $CONFIG;
     $html_users = "";
     $html_user = getFile(TEMPLATE_HTML_STATS_USERS_USER);
     $html_url = getFile(TEMPLATE_HTML_STATS_USERS_URL);
     $html_body = getFile(TEMPLATE_HTML_STATS_USERS_BODY);
     $html_body = str_replace("<!--status-->", $this->Closed ? "<!--lang_stats_status_closed-->" : "<!--lang_stats_status_open-->", $html_body);
     loadVisitors(true, " WHERE `entrance`>='" . DBManager::RealEscape($this->Delimiters[0]) . "' AND `entrance`<='" . DBManager::RealEscape($this->Delimiters[1]) . "'", " LIMIT " . StatisticProvider::$MaxUsersAmount);
     $count = 1;
     foreach ($VISITOR 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;
             }
             foreach ($browser->History as $hurl) {
                 if ($id == 1 && !isnull($hurl->Referrer->GetAbsoluteUrl()) && $hurl->Referrer->GetAbsoluteUrl() != $hurl->Url->GetAbsoluteUrl()) {
                     $url = $html_url;
                     $url = str_replace("<!--page-->", "Referrer: <a href=\"" . @htmlentities(StatisticProvider::$Dereferrer . $hurl->Referrer->GetAbsoluteUrl(), ENT_QUOTES, 'UTF-8') . "\" target=\"_blank\">" . @htmlentities($hurl->Referrer->GetAbsoluteUrl(), ENT_QUOTES, 'UTF-8') . "</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 . ": <a href=\"" . htmlentities(StatisticProvider::$Dereferrer . $hurl->Url->GetAbsoluteUrl(), ENT_QUOTES, 'UTF-8') . "\" target=\"_blank\">" . @htmlentities($hurl->Url->GetAbsoluteUrl(), ENT_QUOTES, 'UTF-8') . "</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;
             }
             $bcount++;
             if ($browser->Type == BROWSER_TYPE_CHAT) {
                 $urls = str_replace("<!--exit-->", date("H:i:s", $browser->LastActive + $CONFIG["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-->", count($VISITOR), $html_body);
     $VISITOR = array();
     loadVisitors();
     return $html_body;
 }
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)) {
        loadInputs();
    }
    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)) {
            loadVisitors();
        }
    }
}