You are here

function _hosting_valid_fqdn_wildcard in Hosting 6.2

Same name and namespace in other branches
  1. 7.4 hosting.inc \_hosting_valid_fqdn_wildcard()
  2. 7.3 hosting.inc \_hosting_valid_fqdn_wildcard()

Check if the FQDN provided is valid.

This is a different function because wildcards are not part of the RFC and may not be allowed everywhere. For example, the main site title shouldn't have a wildcard entry.

Parameters

$fqdn: The Fully Qualified Domain Name (FQDN) to validate.

Return value

An integer greater than 0 if the $fqdn is valid, or 0 or FALSE if it not valid.

2 calls to _hosting_valid_fqdn_wildcard()
hosting_alias_insert in alias/hosting_alias.module
Save stored aliases for a new site.
hosting_alias_validate_alias in alias/hosting_alias.module
Ensure that an alias is valid, and not already in use.

File

./hosting.inc, line 51
General purpose Hosting module functions.

Code

function _hosting_valid_fqdn_wildcard($fqdn) {

  // regex is an implementation of RFC1035, but allows "star" for wildcards
  return preg_match("/^(\\*\\.)?([a-z0-9]([a-z0-9-]*[a-z0-9])?\\.?)+\$/i", $fqdn) && !preg_match("/^(\\*\\.)[^.]*\$/", $fqdn);

  // don't allow wildcards on TLDs
}