You are here

function statistics_access_log in Drupal 6

Same name and namespace in other branches
  1. 4 modules/statistics.module \statistics_access_log()
  2. 5 modules/statistics/statistics.module \statistics_access_log()
  3. 7 modules/statistics/statistics.admin.inc \statistics_access_log()

Menu callback; Displays recent page accesses.

1 string reference to 'statistics_access_log'
statistics_menu in modules/statistics/statistics.module
Implementation of hook_menu().

File

modules/statistics/statistics.admin.inc, line 139
Admin page callbacks for the statistics module.

Code

function statistics_access_log($aid) {
  $result = db_query('SELECT a.*, u.name FROM {accesslog} a LEFT JOIN {users} u ON a.uid = u.uid WHERE aid = %d', $aid);
  if ($access = db_fetch_object($result)) {
    $rows[] = array(
      array(
        'data' => t('URL'),
        'header' => TRUE,
      ),
      l(url($access->path, array(
        'absolute' => TRUE,
      )), $access->path),
    );

    // It is safe to avoid filtering $access->title through check_plain because
    // it comes from drupal_get_title().
    $rows[] = array(
      array(
        'data' => t('Title'),
        'header' => TRUE,
      ),
      $access->title,
    );
    $rows[] = array(
      array(
        'data' => t('Referrer'),
        'header' => TRUE,
      ),
      $access->url ? l($access->url, $access->url) : '',
    );
    $rows[] = array(
      array(
        'data' => t('Date'),
        'header' => TRUE,
      ),
      format_date($access->timestamp, 'large'),
    );
    $rows[] = array(
      array(
        'data' => t('User'),
        'header' => TRUE,
      ),
      theme('username', $access),
    );
    $rows[] = array(
      array(
        'data' => t('Hostname'),
        'header' => TRUE,
      ),
      check_plain($access->hostname),
    );
    return theme('table', array(), $rows);
  }
  else {
    drupal_not_found();
  }
}