function system_status_access_callback in System Status 7
Same name and namespace in other branches
- 8.2 system_status.module \system_status_access_callback()
- 8 system_status.module \system_status_access_callback()
- 6.2 system_status.module \system_status_access_callback()
Access callback: Check authorized IP.
See also
1 string reference to 'system_status_access_callback'
- system_status_menu in ./
system_status.module - Implements hook_menu().
File
- ./
system_status.module, line 54 - Drupal system status
Code
function system_status_access_callback($token = FALSE) {
if ((variable_get('system_status_need_protect_token', 0) == 1 || variable_get('system_status_service_allow_drupalstatus', 0) == 1) && $token !== variable_get('system_status_token', "")) {
return FALSE;
}
$ip_address = ip_address();
if (variable_get('system_status_service_allow_drupalstatus', 0) == 1) {
if ($ip_address == gethostbyname("status.drupalstatus.org")) {
return TRUE;
}
}
if (variable_get('system_status_public_allow_public', 1) == 1) {
// I took the easy way out here since i didn't want
// to bother writing something to match v6 subnets.
$allowed_ips = explode(',', variable_get('system_status_public_allow_ips', '127.0.0.1,::1'));
foreach ($allowed_ips as &$address) {
if ($ip_address === $address) {
return TRUE;
}
}
}
return FALSE;
}