function statistics_advanced_boot in Statistics Advanced 5
Same name and namespace in other branches
- 6 statistics_advanced.module \statistics_advanced_boot()
Implementation of hook_boot().
File
- ./
statistics_advanced.module, line 55
Code
function statistics_advanced_boot() {
drupal_bootstrap(DRUPAL_BOOTSTRAP_PATH);
if (arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == '' && variable_get('statistics_count_content_views', 0)) {
$user_id = $GLOBALS['user']->uid;
$GLOBALS['_statistics_advanced_ignore_visit'] = FALSE;
if ($user_id == 0 && variable_get('statistics_enable_access_log', 0)) {
// Check access log table for recent hits with current session id
$result = db_result(db_query("SELECT uid FROM {accesslog} WHERE sid = '%s' AND (uid > 0 OR path = '%s') LIMIT 1", session_id(), $_GET['q']));
if ($result > 0) {
// Repeat visit from user that just logged out, check history table
$user_id = $result;
}
if ($result === '0') {
// Repeat anonymous user visit (same PHP session id and node id in accesslog table)
$GLOBALS['_statistics_advanced_ignore_visit'] = TRUE;
}
}
if ($user_id > 0 && db_result(db_query("SELECT TRUE FROM {history} WHERE uid = %d AND nid = %d", $user_id, arg(1)))) {
// Repeat user visit (same user id and node id in history table)
$GLOBALS['_statistics_advanced_ignore_visit'] = TRUE;
}
}
}