function ban_admin_page

Page callback: Displays banned IP addresses.

Parameters

string $default_ip: (optional) IP address to be passed on to drupal_get_form() for use as the default value of the IP address form field.

Return value

array A render array.

1 string reference to 'ban_admin_page'
ban_menu in drupal/core/modules/ban/ban.module
Implements hook_menu().

File

drupal/core/modules/ban/ban.admin.inc, line 18
Administrative functionality for the Ban module.

Code

function ban_admin_page($default_ip = '') {
  $rows = array();
  $header = array(
    t('banned IP addresses'),
    t('Operations'),
  );
  $result = db_query('SELECT * FROM {ban_ip}');
  foreach ($result as $ip) {
    $row = array();
    $row[] = $ip->ip;
    $links = array();
    $links['delete'] = array(
      'title' => t('delete'),
      'href' => "admin/config/people/ban/delete/{$ip->iid}",
    );
    $row[] = array(
      'data' => array(
        '#type' => 'operations',
        '#links' => $links,
      ),
    );
    $rows[] = $row;
  }
  $build['ban_ip_form'] = drupal_get_form('ban_ip_form', $default_ip);
  $build['ban_ip_banning_table'] = array(
    '#theme' => 'table',
    '#header' => $header,
    '#rows' => $rows,
    '#empty' => t('No blocked IP addresses available.'),
  );
  return $build;
}