You are here

function hosting_alias_validate_subdir in Hosting 6.2

Ensure that an alias is valid for subdir site.

Parameters

object $site: A Hosting site node.

string $alias: An alias to have point to the site.

1 call to hosting_alias_validate_subdir()
hosting_subdirs_nodeapi in subdirs/hosting_subdirs.module
Implementation of hook_nodeapi().

File

alias/hosting_alias.module, line 435
Allow sites to have domain aliases that they can be accessed with.

Code

function hosting_alias_validate_subdir($site, $alias) {
  if ($alias = trim($alias)) {
    if (!hosting_alias_allow_domain($alias, array(
      'nid' => $site->nid,
    )) || $alias == $site->title) {
      form_set_error('aliases', t('The domain name @alias is already in use', array(
        '@alias' => $alias,
      )));
    }
    if (!_hosting_valid_fqdn_subdir($alias)) {
      form_set_error('aliases', t('The domain name @alias is not a valid subdir url', array(
        '@alias' => $alias,
      )));
    }
  }
}