Code

Added function to get cfg values in order "current", "global", "default".
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 24 Jul 2008 09:47:28 +0000 (09:47 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 24 Jul 2008 09:47:28 +0000 (09:47 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11974 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/class_config.inc

index a51caa58b64b9167fb963b1dafc0dacd6c488e3f..5f00a2bd0abea86c7649a256c091fa0719aa824c 100644 (file)
@@ -934,6 +934,23 @@ class config  {
   }
 
 
+  function get_cfg_value($name, $default= "") {
+    $name= strtoupper($name);
+
+    /* Check if we have a current value for $name */
+    if (isset($this->current[$name])){
+      return ($this->current[$name]);
+    }
+
+    /* Check if we have a global value for $name */
+    if (isset($this->data["MAIN"][$name])){
+      return ($this->data["MAIN"][$name]);
+    }
+
+    return ($default);
+  }
+
+
   function check_config_version()
   {
     /* Skip check, if we've already mentioned the mismatch