You are here

function spam_logs_entry in Spam 5.3

Same name and namespace in other branches
  1. 5 spam.module \spam_logs_entry()
  2. 6 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 1918

Code

function spam_logs_entry($id = NULL) {
  if (!$id) {
    return NULL;
  }
  $breadcrumb[] = array(
    'path' => '',
    'title' => t('Home'),
  );
  $breadcrumb[] = array(
    'path' => 'admin',
    'title' => t('Administer'),
  );
  $breadcrumb[] = array(
    'path' => 'admin/logs',
    'title' => t('Logs'),
  );
  $breadcrumb[] = array(
    'path' => 'admin/logs/spam',
    'title' => t('Spam'),
  );
  $breadcrumb[] = array(
    'path' => 'admin/logs/spam/detail',
    'title' => t('Spam module log entry'),
  );
  menu_set_location($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/logs/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' => ucfirst($message->content_type),
        )),
        'header' => TRUE,
      ),
      array(
        'data' => l(t($message->content_id), "admin/logs/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/logs/spam/{$message->trid}/trace"),
    ),
  );
  return theme('table', NULL, $table);
}