Code

There could be multiple logging server
[gosa.git] / include / class_config.inc
index 7ef00cb6c44ed0147f48022ff48ab5fd674ce3c4..a7d3a53b6a0e17e7001f2bde8a2ab0560a667325 100644 (file)
@@ -421,17 +421,33 @@ class config  {
           'DB'         => $attrs['goGlpiDatabase'][0]);
     }
 
+
     /* Get logdb server */
     $ldap->cd ($this->current['BASE']);
-    $ldap->search ("(objectClass=goLogDBServer)",array("cn","goLogDBServerUser","goLogDBServerPassword","goLogDB"));
+    $ldap->search ("(objectClass=goLogDBServer)");
     if ($ldap->count()){
       $attrs= $ldap->fetch();
+      $this->data['SERVERS']['LOG']= array( 'SERVER' => $attrs['cn'][0],
+          'LOGIN' => $attrs['goLogAdmin'][0],
+          'PASSWORD' => $attrs['goLogPassword'][0]);
+    }
+
+
+    /* GOsa logging databases */
+    $ldap->cd ($this->current['BASE']);
+    $ldap->search ("(objectClass=gosaLogServer)");
+    if ($ldap->count()){
+      while($attrs= $ldap->fetch()){
       $this->data['SERVERS']['LOGGING'][$attrs['cn'][0]]= 
-          array('USER'    => $attrs['goLogDBServerUser'][0],
-          'PWD'     => $attrs['goLogDBServerPassword'][0],
-          'DB'      => $attrs['goLogDB'][0]);
+          array(
+          'DN'    => $attrs['dn'],
+          'USER'  => $attrs['goLogDBUser'][0],
+          'DB'    => $attrs['goLogDB'][0],
+          'PWD'   => $attrs['goLogDBPassword'][0]);
+      }
     }
 
+
     /* Get NFS server lists */
     $tmp= array("default");
     $ldap->cd ($this->current['BASE']);
@@ -628,6 +644,7 @@ class config  {
     $depth ++;
 
     /* Walk through array */   
+    ksort($arr);
     foreach($arr as $name => $entries){
 
       /* If this department is the last in the current tree position 
@@ -648,7 +665,7 @@ class config  {
       if(isset($entries['ENTRY'])){
         $a = "";
         for($i = 0 ; $i < $depth ; $i ++){
-          $a.="&nbsp;";
+          $a.=".";
         }
         $ret[$entries['ENTRY']]=$a."&nbsp;".$name;
       }