function ip_restricted in Restrict IP 7.2
Determines whether the user's ip address is restricted (not whitelisted).
7 calls to ip_restricted()
- restrict_ip_block_view_alter in ./
restrict_ip.module - Implements hook_block_view_alter().
- restrict_ip_boot in ./
restrict_ip.module - Implements hook_boot().
- restrict_ip_js_alter in ./
restrict_ip.module - Implements hook_js_alter().
- restrict_ip_page_alter in ./
restrict_ip.module - Implements hook_page_alter().
- restrict_ip_preprocess_breadcrumb in ./
restrict_ip.module - Override of template_preprocess_breadcrumb().
File
- ./
restrict_ip.module, line 56 - Holds hooks for the restrict_ip module.
Code
function ip_restricted($block = FALSE) {
$blocked =& drupal_static(__FUNCTION__);
if (is_null($blocked)) {
$blocked = FALSE;
}
// We do this check as block will only be set when the user is in hook_boot().
// If we were to run the code in the else{} block during hook_boot(), we'd get
// an error as user_access() is not yet available.
if ($block) {
$blocked = TRUE;
}
else {
if ($blocked) {
if (variable_get('restrict_ip_allow_role_bypass', FALSE)) {
$path = current_path();
$path = strtolower($path);
if (user_access('Bypass IP Restriction') || in_array($path, array(
'user',
'user/login',
'user/password',
'user/logout',
)) || strpos($path, 'user/reset/') === 0) {
return FALSE;
}
}
}
return $blocked;
}
}