domain_lookup

Versions
domain
domain_lookup($domain_id = NULL, $subdomain = NULL, $reset = FALSE)

Runs a lookup against the {domain} table. One of the two values must be present

This function also calls hook_domainload(), which lets module developers overwrite or add to the $domain array.

Parameters

$domain_id The domain_id taken from {domain}. Optional.

$subdomain The string representation of a {domain} entry. Optional.

$reset A boolean flag to clear the static variable if necessary.

Return value

An array containing the requested row from the {domain} table, plus the elements added by hook_domainload(). Returns -1 on failure.

▾ 22 functions call domain_lookup()

domain_alias_init in domain_alias/domain_alias.module
Implement hook_init().
domain_conf_variable_save in domain_conf/domain_conf.module
Store a single variable in {domain_conf}.
domain_content_form in domain_content/domain_content.admin.inc
Rewrites node_admin_nodes() to use db_rewrite_sql().
domain_delete_form_submit in ./domain.admin.inc
Implement domain_delete_form submit hook.
domain_domains in ./domain.module
Return all active domains (including the default) as an array.
domain_form_alter in ./domain.module
Implement hook_form_alter()
domain_form_submit in ./domain.admin.inc
Implement domain_form submit hook.
domain_get_node_match in ./domain.module
Get the best matching domain for a node link.
domain_init in ./domain.module
Implement hook_init().
domain_invalid_domain_requested in ./domain.module
Redirect a request to an invalid domain.
domain_load in ./domain.module
Menu loader function.
domain_nodeapi in ./domain.module
Implement hook_nodeapi().
domain_node_access_explain in ./domain.module
Implement hook_node_access_explain for devel.module
domain_node_save_redirect in ./domain.module
On a node save, make sure the editor is returned to a domain that can view the node.
domain_source_form_alter in domain_source/domain_source.module
Implement hook_form_alter()
domain_source_lookup in domain_source/domain_source.module
Find the proper source domain for a node.
domain_source_nodeapi in domain_source/domain_source.module
Implement hook_nodeapi()
domain_theme_settings_submit in domain_theme/domain_theme.admin.inc
Process domain_theme_settings form submissions.
domain_url_outbound_alter in ./settings_custom_url.inc
Implement hook_url_outbound_alter().
domain_user in ./domain.module
Implement hook_user()
domain_user_lookup in domain_user/domain_user.module
Check to see if a user has created a domain record
domain_user_user in domain_user/domain_user.module
Implement hook_user()

Code

./domain.module, line 635

<?php
function domain_lookup($domain_id = NULL, $subdomain = NULL, $reset = FALSE) {
  static $domains;
  // If both are NULL, no lookup can be run.
  if (is_null($domain_id) && is_null($subdomain)) {
    return -1;
  }
  // Create a unique key so we can static cache all requests.
  $key = $domain_id . $subdomain;
  // Run the lookup, if needed.
  if (!isset($domains[$key]) || $reset) {
    if ($subdomain) {
      $domain = db_fetch_array(db_query("SELECT domain_id, subdomain, sitename, scheme, valid FROM {domain} WHERE subdomain = '%s'", $subdomain));
    }
    else if ($domain_id == 0) {
      $domain = domain_default();
    }
    else {
      $domain = db_fetch_array(db_query("SELECT domain_id, subdomain, sitename, scheme, valid FROM {domain} WHERE domain_id = %d", $domain_id));
    }
    // Did we get a valid result?
    if (isset($domain['domain_id'])) {
      // Let Domain Access module extensions act to override the defaults.
      $domains[$key] = domain_api($domain, $reset);
    }
    else {
      $domains[$key] = -1;
    }
  }
  return $domains[$key];
}
?>

Contact

  • agentrickard [at] gmail [dot] com

Donations

My Amazon.com Wish List