You are here

function _domain_conf_load in Domain Access 5

Load the varaibles for this subdomain

2 calls to _domain_conf_load()
domain_cron in ./domain.module
Implement hook_cron()
settings_domain_conf.inc in domain_conf/settings_domain_conf.inc
2 string references to '_domain_conf_load'
domain_conf_domaininstall in domain_conf/domain_conf.module
Implement hook_domaininstall()
domain_cron in ./domain.module
Implement hook_cron()

File

domain_conf/settings_domain_conf.inc, line 29

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