summaryrefslogtreecommitdiffstats
path: root/lib/Conf.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Conf.php')
-rw-r--r--lib/Conf.php38
1 files changed, 29 insertions, 9 deletions
diff --git a/lib/Conf.php b/lib/Conf.php
index 704c3c4..d843cdd 100644
--- a/lib/Conf.php
+++ b/lib/Conf.php
@@ -99,19 +99,39 @@ class Conf {
}
}
- // Simple (global) settings may be obtained by calling the key and omitting
- // the section. This goes for sections 'kolab', and whatever is the equivalent
- // of 'kolab', 'auth_mechanism'.
-// echo "<pre>";
-// print_r($this->_conf);
-// echo "</pre>";
+ // Simple (global) settings may be obtained by calling the key and
+ // omitting the section. This goes for sections 'kolab', and whatever
+ // is the equivalent of 'kolab', 'auth_mechanism', such as getting
+ // 'ldap_uri', which is in the [$domain] section, or in section 'ldap',
+ // and we can try and iterate over it.
+
+ // First, try the most exotic.
+ if (isset($_SESSION['user'])) {
+ $domain_section_name = $_SESSION['user']->get_domain();
+ if (isset($this->_conf[$domain_section_name][$key1])) {
+ return $this->_conf[$domain_section_name][$key1];
+ }
+ }
+
+ // Fall back to whatever is the equivalent of auth_mechanism as the
+ // section (i.e. 'ldap', or 'sql')
+ $auth_mech = $this->_conf['kolab']['auth_mechanism'];
+ if (isset($this->_conf[$auth_mech])) {
+ if (isset($this->_conf[$auth_mech][$key1])) {
+ return $this->_conf[$auth_mech][$key1];
+ }
+ }
+ // Fall back to global settings in the 'kolab' section.
if (isset($this->_conf['kolab'][$key1])) {
return $this->_conf['kolab'][$key1];
}
- else if (isset($this->_conf[$this->_conf['kolab']['auth_mechanism']][$key1])) {
- return $this->_conf[$this->_conf['kolab']['auth_mechanism']][$key1];
- }
+
+ error_log("Could not find setting for \$key1: " . $key1 .
+ " with \$key2: " . $key2
+ );
+
+ return null;
}
public function expand($str, $custom = FALSE)