You are here

function spam_logs_entry in Spam 6

Same name and namespace in other branches
  1. 5.3 spam.module \spam_logs_entry()
  2. 5 spam.module \spam_logs_entry()

Displays complete information about a single log entry.

1 string reference to 'spam_logs_entry'
spam_menu in ./spam.module
Drupal _menu() hook.

File

./spam.module, line 2036
Spam module, v3 Copyright(c) 2006-2008 Jeremy Andrews <jeremy@tag1consulting.com>. All rights reserved.

Code

function spam_logs_entry($id = NULL) {
  if (!$id) {
    return NULL;
  }
  $breadcrumb[] = l(t('Home'), NULL);
  $breadcrumb[] = l(t('Administer'), 'admin');
  $breadcrumb[] = l(t('Logs'), 'admin/reports');
  $breadcrumb[] = l(t('Spam'), 'admin/reports/spam');
  $breadcrumb[] = l(t('Spam module log entry'), 'admin/reports/spam/detail');
  drupal_set_breadcrumb($breadcrumb);
  $message = db_fetch_object(db_query('SELECT * FROM {spam_log} WHERE lid = %d', $id));
  if ($message->content_type) {
    $table[] = array(
      array(
        'data' => t('Content type'),
        'header' => TRUE,
      ),
      array(
        'data' => l(t($message->content_type), "admin/reports/spam/{$message->content_type}"),
      ),
    );
  }
  else {
    $table[] = array(
      array(
        'data' => t('Content type'),
        'header' => TRUE,
      ),
      array(
        'data' => t('unknown'),
      ),
    );
  }
  if ($message->content_id) {
    $table[] = array(
      array(
        'data' => t('!type ID', array(
          '!type' => drupal_ucfirst($message->content_type),
        )),
        'header' => TRUE,
      ),
      array(
        'data' => l(t($message->content_id), "admin/reports/spam/{$message->content_type}/{$message->content_id}"),
      ),
    );
  }
  $table[] = array(
    array(
      'data' => t('Date'),
      'header' => TRUE,
    ),
    array(
      'data' => format_date($message->timestamp, 'large'),
    ),
  );
  $table[] = array(
    array(
      'data' => t('User'),
      'header' => TRUE,
    ),
    array(
      'data' => theme('username', user_load(array(
        'uid' => $message->uid,
      ))),
    ),
  );
  $table[] = array(
    array(
      'data' => t('Spam module function'),
      'header' => TRUE,
    ),
    array(
      'data' => $message->function,
    ),
  );
  $table[] = array(
    array(
      'data' => t('Message'),
      'header' => TRUE,
    ),
    array(
      'data' => $message->message,
    ),
  );
  $table[] = array(
    array(
      'data' => t('Hostname'),
      'header' => TRUE,
    ),
    array(
      'data' => $message->hostname,
    ),
  );
  $table[] = array(
    array(
      'data' => t('Options'),
      'header' => TRUE,
    ),
    array(
      'data' => l(t('trace'), "admin/reports/spam/{$message->trid}/trace"),
    ),
  );
  return theme('table', NULL, $table);
}