You are here

function _ip_ban_determine_action in IP Ban 7

Function determines action based on current user's ban setting.

1 call to _ip_ban_determine_action()
ip_ban_block_list_alter in ./ip_ban.module
Implements hook_block_list_alter().

File

./ip_ban.module, line 144

Code

function _ip_ban_determine_action($banvalue) {
  if ($banvalue === IP_BAN_READONLY) {
    $uri = check_plain(filter_xss($_GET['q']));
    if ($uri == 'user' || strpos($uri, 'user/') !== FALSE) {
      drupal_set_message(t(variable_get('ip_ban_readonly', 'You may not create an account, attempt to log in, or request a password change from your current location.')), 'error');
      drupal_goto(variable_get('ip_ban_readonly_path', ''));
    }
  }
  if ($banvalue === IP_BAN_BANNED) {

    // Always allow access to the banned page.
    $complete_ban_path = variable_get('ip_ban_completeban_path');
    if (!empty($complete_ban_path) && check_plain(filter_xss($_GET['q'])) != drupal_get_normal_path($complete_ban_path)) {
      drupal_goto($complete_ban_path);
    }
    else {
      drupal_set_message(t(variable_get('ip_ban_completeban', 'You may not view this site from your current location.')), 'error');
    }
  }
}