Code

Updated sieve stuff
[gosa.git] / include / class_config.inc
index 516195d7b43468767e91ee34c0ffe0ab00072cc2..b00926aba365a403fff9ce24793ad592cafc2cfe 100644 (file)
@@ -363,26 +363,46 @@ class config  {
           'PASSWORD' => $attrs['goFaxPassword'][0]);
     }
 
+
     /* Get asterisk servers */
     $ldap->cd ($this->current['BASE']);
     $ldap->search ("(objectClass=goFonServer)");
-    $this->data['SERVERS']['FON']= array(); 
+    $this->data['SERVERS']['FON']= array();
     if ($ldap->count()){
       while ($attrs= $ldap->fetch()){
-        $this->data['SERVERS']['FON'][]= array( 
-            'SERVER'   => $attrs['cn'][0],
-            'LOGIN'    => $attrs['goFonAdmin'][0],
-            'PASSWORD'         => $attrs['goFonPassword'][0],
-            'DB'               => "gophone",
-            'SIP_TABLE'                => "sip_users",
-            'EXT_TABLE'        => "extensions",
-            'VOICE_TABLE'      => "voicemail_users",
-            'QUEUE_TABLE'      => "queues",
-            'QUEUE_MEMBER_TABLE'       => "queue_members");
+
+        /* Add 0 entry for development */
+        if(count($this->data['SERVERS']['FON']) == 0){
+          $this->data['SERVERS']['FON'][0]= array(
+              'DN'      => $attrs['dn'],
+              'SERVER'  => $attrs['cn'][0],
+              'LOGIN'   => $attrs['goFonAdmin'][0],
+              'PASSWORD'  => $attrs['goFonPassword'][0],
+              'DB'    => "gophone",
+              'SIP_TABLE'   => "sip_users",
+              'EXT_TABLE'   => "extensions",
+              'VOICE_TABLE' => "voicemail_users",
+              'QUEUE_TABLE' => "queues",
+              'QUEUE_MEMBER_TABLE'  => "queue_members");
+        }
+
+        /* Add entry with 'dn' as index */
+        $this->data['SERVERS']['FON'][$attrs['dn']]= array(
+            'DN'      => $attrs['dn'],
+            'SERVER'  => $attrs['cn'][0],
+            'LOGIN'   => $attrs['goFonAdmin'][0],
+            'PASSWORD'  => $attrs['goFonPassword'][0],
+            'DB'    => "gophone",
+            'SIP_TABLE'   => "sip_users",
+            'EXT_TABLE'   => "extensions",
+            'VOICE_TABLE' => "voicemail_users",
+            'QUEUE_TABLE' => "queues",
+            'QUEUE_MEMBER_TABLE'  => "queue_members");
       }
     }
 
-    /* Get asterisk servers */
+
+    /* Get glpi server */
     $ldap->cd ($this->current['BASE']);
     $ldap->search ("(&(objectClass=goGlpiServer)(cn=*)(goGlpiAdmin=*)(goGlpiDatabase=*))",array("cn","goGlpiPassword","goGlpiAdmin","goGlpiDatabase"));
     if ($ldap->count()){