You are here

function maintenance_exempt_by_cidr_notation in Maintenance Exempt 8

Same name and namespace in other branches
  1. 7 maintenance_exempt.module \maintenance_exempt_by_cidr_notation()

Check if an IP address using CIDR notation should be exempt.

Parameters

string $ip: The IP address.

Return value

bool TRUE if the address should

1 call to maintenance_exempt_by_cidr_notation()
MaintenanceModeExempt::exempt in src/MaintenanceModeExempt.php
Determines whether a user has access to the site in maintenance mode.

File

./maintenance_exempt.module, line 132
Allow exemption from maintenance mode.

Code

function maintenance_exempt_by_cidr_notation($ip) {
  $allowed_ips = maintenance_exempt_get_ips();
  foreach ($allowed_ips as $entry) {
    if (strstr($entry, "/")) {
      if (maintenance_exempt_ip_cidr_check($ip, $entry)) {
        return TRUE;
      }
    }
  }
  return FALSE;
}