You are here

function flood_report_report in Util 7

Menu callback. Report on flood table contents.

1 string reference to 'flood_report_report'
flood_report_menu in contribs/flood_report/flood_report.module
Implements hook_menu().

File

contribs/flood_report/flood_report.module, line 34
Display what's in the Flood table.

Code

function flood_report_report() {
  $output = '<div id="flood-report">';
  $table = array(
    'header' => array(
      t('Fid'),
      t('Event'),
      t('Identifier'),
      t('Time'),
      t('Expires'),
    ),
    'attributes' => array(
      'style' => 'width: auto;',
    ),
    'rows' => array(),
  );
  $query = "SELECT fid, event, identifier, timestamp, expiration FROM {flood} ORDER BY expiration ASC";
  $result = db_query($query);
  foreach ($result as $row) {
    $table['rows'][] = array(
      $row->fid,
      check_plain($row->event),
      check_plain($row->identifier),
      format_date($row->timestamp, 'large'),
      format_interval($row->expiration - REQUEST_TIME),
    );
  }
  if (empty($table['rows'])) {
    $table['rows'][] = array(
      array(
        'data' => t('The Flood table seems to be empty.'),
        'colspan' => 20,
      ),
    );
  }
  $output .= theme('table', $table);
  $output .= '<p>' . l(t('Empty the table'), 'flood_report_clear') . '</p>';
  return $output . '</div>';
}