You are here

function autoban_make_ip_style in Automatic IP ban (Autoban) 7

Make IP style for insert.

Parameters

string $hostname: IP address for ban.

int $ip_type: IP type for choose single or range ban.

Return value

string IP string for insert to ban table.

4 calls to autoban_make_ip_style()
autoban_ban in ./autoban.module
Ban IP's for rules.
autoban_ban_manual in ./autoban.module
Ban IP manually.
autoban_test in ./autoban.admin.inc
Menu callback. Test autoban rule page.
_autoban_watchdog_event_extras_event_rows in autoban_watchdog_event_extras/autoban_watchdog_event_extras.module
Implements hook_watchdog_event_extras_alter().

File

./autoban.module, line 571
Main file for autoban module.

Code

function autoban_make_ip_style($hostname, $ip_type) {
  $ip_type = _autoban_ip_type_verification($ip_type);
  switch ($ip_type) {
    case AUTOBAN_SINGLE_IP:
      return $hostname;
    case AUTOBAN_RANGE_IP:
      return _autoban_create_range($hostname);
    default:
      return NULL;
  }
}