function visitors_hit_details in Visitors 7.0
Same name and namespace in other branches
- 8 reports/hit_details.inc \visitors_hit_details()
- 7.2 reports/hit_details.inc \visitors_hit_details()
- 7 reports/hit_details.inc \visitors_hit_details()
Menu callback; Displays recent page accesses.
Parameters
visitors_id: int visitors id from visitors table
Return value
string hit details report or 404 error if visitors_id not found
1 string reference to 'visitors_hit_details'
- visitors_menu in ./
visitors.module - Menu callback. Prints a listing of active nodes on the site.
File
- reports/
hit_details.inc, line 17 - Hit details report for the visitors module.
Code
function visitors_hit_details($visitors_id) {
$query = db_select('visitors', 'v');
$query
->leftJoin('users', 'u', 'u.uid=v.visitors_uid');
$query
->fields('v', array(
'visitors_url',
'visitors_title',
'visitors_referer',
'visitors_date_time',
'visitors_ip',
'visitors_user_agent',
));
$query
->fields('u', array(
'name',
'uid',
));
$query
->condition('v.visitors_id', (int) $visitors_id);
$hit_details = $query
->execute()
->fetch();
if ($hit_details) {
$rows[] = array(
array(
'data' => t('URL'),
'header' => TRUE,
),
l(urldecode($hit_details->visitors_url), urldecode($hit_details->visitors_url)),
);
$rows[] = array(
array(
'data' => t('Title'),
'header' => TRUE,
),
check_plain($hit_details->visitors_title),
);
$rows[] = array(
array(
'data' => t('Referer'),
'header' => TRUE,
),
$hit_details->visitors_referer ? l($hit_details->visitors_referer, $hit_details->visitors_referer) : '',
);
$rows[] = array(
array(
'data' => t('Date'),
'header' => TRUE,
),
format_date($hit_details->visitors_date_time, 'large', visitors_get_timezone()),
);
$rows[] = array(
array(
'data' => t('User'),
'header' => TRUE,
),
theme('username', array(
'account' => $hit_details,
)),
);
$whois_enable = module_exists('whois');
$attr = array(
'attributes' => array(
'target' => '_blank',
'title' => t('Whois lookup'),
),
);
$ip = long2ip($hit_details->visitors_ip);
$rows[] = array(
array(
'data' => t('Hostname'),
'header' => TRUE,
),
$whois_enable ? l($ip, 'whois/' . $ip, $attr) : check_plain($ip),
);
$rows[] = array(
array(
'data' => t('User Agent'),
'header' => TRUE,
),
check_plain($hit_details->visitors_user_agent),
);
return theme('table', array(
'rows' => $rows,
));
}
drupal_not_found();
}