You are here

function hosting_alias_allow_domain in Hosting 6.2

Same name and namespace in other branches
  1. 5 alias/hosting_alias.module \hosting_alias_allow_domain()
  2. 7.4 alias/hosting_alias.module \hosting_alias_allow_domain()
  3. 7.3 alias/hosting_alias.module \hosting_alias_allow_domain()

Implementation of hook_allow_domain().

This function will check the existing aliases and the automatically generated aliases to ensure that this url has not been used before

1 call to hosting_alias_allow_domain()
hosting_alias_validate_subdir in alias/hosting_alias.module
Ensure that an alias is valid for subdir site.

File

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

Code

function hosting_alias_allow_domain($url, $params = array()) {
  $query = "SELECT COUNT(n.nid) FROM {node} n \n      LEFT JOIN {hosting_site} h ON h.nid=n.nid \n      LEFT JOIN {hosting_site_alias} a  ON n.vid = a.vid \n    WHERE \n      type='site' AND alias='%s' AND h.status <> %d";
  $args[] = $url;
  $args[] = HOSTING_SITE_DELETED;
  if (isset($params['nid'])) {
    $query .= ' AND n.nid <> %d';
    $args[] = $params['nid'];
  }
  $result = !db_result(db_query($query, $args));
  return $result;
}