You are here

function hosting_alias_get_aliases in Hosting 5

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

Retrieve a list of aliases for a site

2 calls to hosting_alias_get_aliases()
drush_hosting_alias_pre_hosting_task in alias/hosting_alias.drush.inc
hosting_alias_nodeapi in alias/hosting_alias.module
Implementation of hook_nodeapi

File

alias/hosting_alias.module, line 55

Code

function hosting_alias_get_aliases($node, $type = null) {
  if (!$node->vid) {
    return array();
  }
  $alias = array();
  $query = "SELECT alias FROM {hosting_site_alias} WHERE vid=%d";
  $args[] = $node->vid;
  if (!is_null($type)) {
    $query .= " AND automatic=%d";
    $args[] = $type;
  }
  $query .= ' ORDER BY alias ASC';
  $result = db_query($query, $args);
  while ($obj = db_fetch_object($result)) {
    $alias[] = $obj->alias;
  }
  if (sizeof($alias)) {
    return $alias;
  }
  return array();
}