Checks to see if the ip address is of valid form

@param   string  $type  The IP Protocol version to validate against
@return  bool
172216
public function isValid($type = 'both')
	{
		$type  = strtolower($type);
		$flags = 0;

		if ($type === 'ipv4')
		{
			$flags = FILTER_FLAG_IPV4;
		}
		if ($type === 'ipv6')
		{
			$flags = FILTER_FLAG_IPV6;
		}

		return (bool) filter_var($this->ip, FILTER_VALIDATE_IP, ['flags' => $flags]);
	}
674677
public static function isValidFieldType(string $type) : bool
    {
        try {
            $config = ConfigFactory::getByType($type, 'dummy_field');
        } catch (InvalidArgumentException $e) {
            return false;
        }

        return true;
    }
575846
public static function isIpAddress($value): bool
    {
        if (!static::isStringCastable($value)) {
            return false;
        }

        return filter_var((string) $value, FILTER_VALIDATE_IP) !== false;
    }
668574
public function isValid($value) {
		$intIp = ip2long($value);
		
		if ($intIp !== false && long2ip($intIp) === $value) {
			return true;
		}
		
		$this->addMessage('Invalid IP address');
		
		return false;
	}
666077
public static function validateRequest($type)
    {
        $hasValidParams = isset(
            $_POST['id'],
            $_POST['app'],
            $_POST['remote'],
            $_POST['request'],
            $_POST['complement'],
            $_POST['nonce'],
            $_POST['filter'],
            $_POST['sort'],
            $_SESSION['efc'],
            $_SERVER['HTTP_X_REQUESTED_WITH']
        );

        if (! $hasValidParams || ! self::sanitizeParams()) {
            return false;
        }

        if (self::$config['complement'] !== $type) {
            return false;
        }

        $isAjaxRequest = $_SERVER['HTTP_X_REQUESTED_WITH'] === 'XMLHttpRequest';

        $isValidNonce = self::$config['nonce'] === $_SESSION['efc'];

        if (! $isAjaxRequest || ! $isValidNonce) {
            return false;
        }

        return true;
    }
190552
private function isAddressValid(string $address): bool
    {
        $position = \strrpos($address, ':');
        if ($position === false) {
            return ($address[0] ?? '') === "\0"; // udg socket address.
        }

        $ip = \trim(\substr($address, 0, $position), '[]');
        $port = (int) \substr($address, $position + 1);

        return \inet_pton($ip) !== false && $port > 0 && $port < 65536;
    }
773319
public static function isValid(int $type) : bool
    {
        return in_array($type, [self::UNKNOWN, self::STANDARD, self::FULL, self::LITE], true);
    }
594490
public function req_is($type){

        switch(strtolower($type)){
            case 'ajax':
                return (
                    (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'))       ||
                    (isset($_SERVER["CONTENT_TYPE"]) && stripos($_SERVER["CONTENT_TYPE"],'application/json')!==false)           ||
                    (isset($_SERVER["HTTP_CONTENT_TYPE"]) && stripos($_SERVER["HTTP_CONTENT_TYPE"],'application/json')!==false)
                );
                break;

            case 'mobile':

                $mobileDevices = [
                    'midp','240x320','blackberry','netfront','nokia','panasonic','portalmmm','sharp','sie-','sonyericsson',
                    'symbian','windows ce','benq','mda','mot-','opera mini','philips','pocket pc','sagem','samsung',
                    'sda','sgh-','vodafone','xda','iphone', 'ipod','android'
                ];

                return preg_match('/(' . implode('|', $mobileDevices). ')/i',strtolower($_SERVER['HTTP_USER_AGENT']));
                break;

            case 'post':
                return (strtolower($_SERVER['REQUEST_METHOD']) == 'post');
                break;

            case 'get':
                return (strtolower($_SERVER['REQUEST_METHOD']) == 'get');
                break;

            case 'put':
                return (strtolower($_SERVER['REQUEST_METHOD']) == 'put');
                break;

            case 'delete':
                return (strtolower($_SERVER['REQUEST_METHOD']) == 'delete');
                break;

            case 'ssl':
                return (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off');
                break;
        }

        return false;
    }
328958
private function checkType($type)
    {
        $isInType = true;

        foreach ($this->getKeys() as $key) {
            if (gettype($key) !== $type) {
                $isInType = false;
                break;
            }
        }

        return $isInType;
    }
1355291
private function isSimpleType(string $type): bool
    {
        $validTypes = [
            'int',
            'string',
            'bool',
            'double',
            'float',
            'array',
            'DataProviderInterface',
            'DataProviderInterface[]',
            DataProviderInterface::class,
            DataProviderInterface::class . '[]'
        ];

        return \in_array($type, $validTypes, true);
    }
913456
private function isType($type) {

    	if(false === is_string($type)) {
			return false;
		}

		$class = $this -> getTypeClass($type);

		return true === class_exists($class);
    }
880691
private boolean isTypeValid(char type) {
		return (type == MAPPED_ADDRESS || type == RESPONSE_ADDRESS
				|| type == SOURCE_ADDRESS || type == CHANGED_ADDRESS
				|| type == REFLECTED_FROM || type == XOR_MAPPED_ADDRESS
				|| type == ALTERNATE_SERVER || type == XOR_PEER_ADDRESS
				|| type == XOR_RELAYED_ADDRESS || type == DESTINATION_ADDRESS);
	}
347022
public static function validateIp($ip)
    {
        if (strtolower($ip) === 'unknown') {
            return false;
        }
        // generate ipv4 network address
        $ip = ip2long($ip);

        // if the ip is set and not equivalent to 255.255.255.255
        if (($ip !== false) && ($ip !== -1)) {
            // make sure to get unsigned long representation of ip
            // due to discrepancies between 32 and 64 bit OSes and
            // signed numbers (ints default to signed in PHP)
            $ip = sprintf('%u', $ip);
            // do private network range checking
            if ($ip >= 0 && $ip <= 50331647) {
                return false;
            }
            if ($ip >= 167772160 && $ip <= 184549375) {
                return false;
            }
            if ($ip >= 2130706432 && $ip <= 2147483647) {
                return false;
            }
            if ($ip >= 2851995648 && $ip <= 2852061183) {
                return false;
            }
            if ($ip >= 2886729728 && $ip <= 2887778303) {
                return false;
            }
            if ($ip >= 3221225984 && $ip <= 3221226239) {
                return false;
            }
            if ($ip >= 3232235520 && $ip <= 3232301055) {
                return false;
            }
            if ($ip >= 4294967040) {
                return false;
            }
        }
        return true;
    }
234735
public function ipValidateV6($ip)
    {
        $this->debug->info(__FUNCTION__, 'IP: ' . json_encode($ip));
        if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) === FALSE) {
            $this->debug->info(__FUNCTION__, 'Valid is FALSE');

            return FALSE;
        }

        $this->debug->info(__FUNCTION__, 'Valid is TRUE');

        return TRUE;
    }
473654
protected function validateIpAddress($ip_address)
    {
        if (! filter_var($ip_address, FILTER_VALIDATE_IP)) {
            $this->error("$ip_address is not a valid ip address! Exiting!");
            die();
        }
        if (! $this->checkIp($ip_address, $this->servers)) {
            $this->error("$ip_address doesn't match any of your IP addreses Forge Servers");
            die();
        }
    }
1226938
public function hasFlagsOfType($type)
    {
        if ($this->flags === null) {
            return false;
        }

        foreach ($this->flags as $flag) {
            if ($flag->type == $type) {
                return true;
            }
        }

        return false;
    }
275009
public function hasMessages($type)
    {
        return isset($_SESSION[$alias = $this->alias][$type]) && count($_SESSION[$alias][$type]) > 0;
    }