You are here

function hosting_alias_get_aliases in Hosting 6.2

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

Parameters

$node: The site to get the aliases for.

$type: Restrict the type of aliases returned, defaults to returning all aliases. Should be one of:

Return value

An array of aliases for the given site.

3 calls to hosting_alias_get_aliases()
drush_hosting_alias_pre_hosting_task in alias/hosting_alias.drush.inc
@file Drush include for the hosting_alias module.
hosting_alias_form_data in alias/hosting_alias.module
Alter the node form for a site to add the aliases and redirection items.
hosting_alias_nodeapi in alias/hosting_alias.module
Implementation of hook_nodeapi().

File

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

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();
}