Exemple #1
0
 /**
  * Checks for a match of one or more IPs against a list of IP and IP fragments
  *
  * @param string|array IP address(es)
  * @param array List of IP addresses
  *
  * @return boolean
  */
 public function ipMatch($checkIps, array $ipList)
 {
     if (!is_array($checkIps)) {
         $checkIps = array($checkIps);
     }
     foreach ($checkIps as $ip) {
         $binary = XenForo_Helper_Ip::convertIpStringToBinary($ip);
         if (!$binary) {
             continue;
         }
         $firstByte = $binary[0];
         if (!empty($ipList[$firstByte])) {
             foreach ($ipList[$firstByte] as $range) {
                 if (XenForo_Helper_Ip::ipMatchesRange($binary, $range[0], $range[1])) {
                     return true;
                 }
             }
         }
     }
     return false;
 }