You are here

function hosting_alias_allow_domain in Hosting 5

Same name and namespace in other branches
  1. 6.2 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

File

alias/hosting_alias.module, line 224

Code

function hosting_alias_allow_domain($url, $nid = null) {
  $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 ($nid) {
    $query .= ' AND n.nid <> %d';
    $args[] = $nid;
  }
  return db_result(db_query($query, $args));
}