You are here

function hosting_site_allow_domain in Hosting 7.3

Same name and namespace in other branches
  1. 5 site/hosting_site.module \hosting_site_allow_domain()
  2. 6.2 site/hosting_site.module \hosting_site_allow_domain()
  3. 7.4 site/hosting_site.module \hosting_site_allow_domain()

Implements hook_allow_domain().

Disallow domains already used as any site's title/url, unless the site has been deleted.

See also

hosting_domain_allowed()

File

site/hosting_site.module, line 675
Contains hook implementations for Hosting site module.

Code

function hosting_site_allow_domain($url, $params = array()) {
  $query = "SELECT COUNT(n.nid) FROM {node} n\n    JOIN {hosting_site} h ON n.nid = h.nid\n    WHERE type = 'site' AND n.title = :title AND h.status <> :status";
  $args[':title'] = $url;
  $args[':status'] = HOSTING_SITE_DELETED;
  if (isset($params['nid'])) {
    $query .= " AND n.nid <> :nid";
    $args[':nid'] = $params['nid'];
  }
  $result = !db_query($query, $args)
    ->fetchField();
  return $result;
}