You are here

function ip_ranges_get_ip_list in IP Ranges 7

Same name and namespace in other branches
  1. 7.2 ip_ranges.module \ip_ranges_get_ip_list()

Retrieves list of banned ip from the database.

Parameters

$type: (optional) Retrieve only the ip's of given list type(blacklist, whitelist).

Return value

An array of black-/whitelisted IP-addresses.

2 calls to ip_ranges_get_ip_list()
ip_ranges_boot in ./ip_ranges.module
Implements hook_boot().
ip_ranges_page in ./ip_ranges.admin.inc
Menu callback. Displays banned IP ranges.

File

./ip_ranges.module, line 152

Code

function ip_ranges_get_ip_list($type = '') {
  $query = db_select('ip_ranges', 'list');
  if ($type) {
    $query
      ->condition('list.type', $type, '=')
      ->fields('list', array(
      'ip',
    ));
  }
  else {
    $query
      ->fields('list');
  }
  return $query
    ->execute()
    ->fetchAll();
}