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(); } } }
function initData($_internal = false, $_groups = false, $_visitors = false, $_filters = false, $_events = false, $_languages = false, $_countries = false) { global $INTERNAL, $GROUPS, $LANGUAGES, $COUNTRIES, $FILTERS, $EVENTS, $VISITORS; if ($_internal && empty($INTERNAL)) { loadInternals(); } if ($_groups && empty($GROUPS)) { loadGroups(); } if ($_languages && empty($LANGUAGES)) { loadLanguages(); } if ($_countries && empty($COUNTRIES)) { loadCountries(); } if ($_filters && empty($FILTERS)) { loadFilters(); } if ($_events && empty($EVENTS)) { loadEvents(); } if ($_visitors && empty($VISITORS)) { loadVisitors(); } }
/** * @author Sebastien Piraux <*****@*****.**> * @desc uses $TABLETRACK_OPEN to split recorded information, to count occurences (for os, provider,...) and to increment the number of occurrences of each different element into the corresponding tables */ function decodeOpenInfos() { global $TABLETRACK_OPEN; // record initial value of ignore_user_abort $ignore = ignore_user_abort(); // prevent script from being stopped while executing, the following can be considered // as a transaction ignore_user_abort(1) ; // we take the last event id to prevent miss of some recorded event // only processed record have to be cleaned $sql = "SELECT open_id FROM $TABLETRACK_OPEN WHERE open_date <= NOW() ORDER BY open_id DESC LIMIT 1"; //$processBegin = getOneResult($sql); $query = Database::query($sql); $res = @Database::fetch_array($query); $processBegin = $res[0]; // process //--Providers And Countries-------------------------------------------// $sql = "SELECT open_remote_host FROM $TABLETRACK_OPEN WHERE open_remote_host != '' AND open_id <= '".$processBegin."' "; $query = Database::query($sql); if(Database::num_rows($query) != 0) { // load list of countries $list_countries = loadCountries(); while ($row = Database::fetch_row ($query)) { $remote_host = $row[0]; /*****Provider*****/ //extract provider $provider = extractProvider( $remote_host ); // add or increment provider in the providers array $providers_array = addProvider( $provider,$providers_array ); /*****Countries*****/ // extract country $country = extractCountry( $remote_host, $list_countries ); // increment country in the countries table $countries_array = addCountry( $country, $countries_array ); } // update tables fillProvidersTable( $providers_array ); fillCountriesTable( $countries_array ); } // provider and countries done //--Browsers and OS---------------------------------------------------// $sql = "SELECT open_agent FROM $TABLETRACK_OPEN WHERE open_remote_host != '' AND open_id <= '".$processBegin."' "; $query =Database::query( $sql ); if(Database::num_rows($query) != 0) { // load lists // of browsers $list_browsers = loadBrowsers(); // of OS $list_os = loadOs(); while ($row = Database::fetch_row ($query)) { $agent = $row[0]; /*****Browser and OS*****/ // extract browser and OS list( $browser,$os ) = split( "[|]",extractAgent( $agent , $list_browsers , $list_os ) ); // increment browser and OS in the corresponding arrays $browsers_array = addBrowser( $browser , $browsers_array ); $os_array = addOs( $os , $os_array ); } fillBrowsersTable( $browsers_array ); fillOsTable( $os_array ); } // browsers and OS done //--Referers----------------------------------------------------------// $sql = "SELECT open_referer FROM $TABLETRACK_OPEN WHERE open_referer != '' AND open_id <= '".$processBegin."' "; $query = Database::query( $sql ); if(Database::num_rows($query) != 0) { $i=0; while ($row = Database::fetch_row ($query)) { $ref = $row[0]; $referers_array = addReferer( $ref , $referers_array ); } fillReferersTable( $referers_array ); } // referers done //-------------------------------------------------------------------// // end of process // cleaning of $TABLETRACK_OPEN table cleanProcessedRecords($processBegin); // reset to the initial value ignore_user_abort($ignore); }