You are here

function system_status_access_callback in System Status 8

Same name and namespace in other branches
  1. 8.2 system_status.module \system_status_access_callback()
  2. 6.2 system_status.module \system_status_access_callback()
  3. 7 system_status.module \system_status_access_callback()

File

./system_status.module, line 54
Drupal system status

Code

function system_status_access_callback($token = FALSE) {
  $config = \Drupal::config('system_status.settings');
  if ($config
    ->get('system_status_service_allow_drupalstatus') == 0 || $token !== $config
    ->get('system_status_token')) {
    return FALSE;
  }
  $ip_address = Drupal::request()
    ->getClientIp();
  if ($config
    ->get('system_status_service_allow_drupalstatus') == 1) {
    if ($ip_address == gethostbyname("status.drupalstatus.org.")) {
      return TRUE;
    }
  }
  return FALSE;
}