_domain_conf_load

Definition

_domain_conf_load($domain = NULL)
domain_conf/settings_domain_conf.inc, line 29

Description

Load the varaibles for this subdomain

Code

function _domain_conf_load($domain = NULL) {
  $check = db_result(db_query("SELECT status FROM {system} WHERE name = 'domain_conf'"));
  if ($check > 0) {
    if (is_null($domain)) {
      // We lower case this, since EXAMPLE.com == example.com.
      $_subdomain = strtolower(rtrim($_SERVER['HTTP_HOST']));
      // Lookup the active domain against our allowed hosts record.
      $domain = db_fetch_array(db_query("SELECT domain_id FROM {domain} WHERE subdomain = '%s'", $_subdomain));
    }
    // If nothing was found, use the default domain.
    if (!isset($domain['domain_id'])) {
      $domain['domain_id'] = 0;
    }
    $data = array();
    $data = db_fetch_array(db_query("SELECT settings FROM {domain_conf} WHERE domain_id = %d", $domain['domain_id']));
    if (!empty($data)) {
      global $conf;
      $settings = unserialize($data['settings']);
      // Overwrite the $conf variables.
      foreach ($settings as $key => $value) {
        $conf[$key] = $value;
      }
    }
  }
}