You are here

function _autoban_get_whitelist in Automatic IP ban (Autoban) 7

Helper function to fetch IP address whitelist.

1 call to _autoban_get_whitelist()
autoban_whitelist_ip in ./autoban.module
Is IP address in whitelist

File

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

Code

function _autoban_get_whitelist() {
  $whitelist =& drupal_static(__FUNCTION__);
  if (!isset($whitelist)) {
    $source = variable_get('autoban_whitelist_source', AUTOBAN_WHITELIST_SOURCE_VARIABLE);
    switch ($source) {
      case AUTOBAN_WHITELIST_SOURCE_VARIABLE:
        $whitelist = variable_get('autoban_whitelist', '');
        break;
      case AUTOBAN_WHITELIST_SOURCE_FILE:
        $whitelist = file_get_contents(drupal_realpath(variable_get('autoban_whitelist_file', '')));
        break;
    }
  }
  return $whitelist;
}