Page callback: Displays banned IP addresses.
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.
array A render array.
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;
}