Code

Added up to date IMAP server detection to class_config
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 11 Oct 2007 12:29:15 +0000 (12:29 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 11 Oct 2007 12:29:15 +0000 (12:29 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7516 594d385d-05f5-0310-b6e9-bd551577e9d8

include/class_config.inc

index dbf8e979061a364d28ccb636674a960457de3d4b..369f5da9884b0dba6cf3c213dccd25f4a65ef682 100644 (file)
@@ -315,19 +315,34 @@ class config  {
     /* Fill imap servers */
     $ldap= $this->get_ldap_link();
     $ldap->cd ($this->current['BASE']);
-    $ldap->search ("(objectClass=goImapServer)");
+    if (!isset($this->current['MAILMETHOD'])){
+      $this->current['MAILMETHOD']= "";
+    }
+    if ($this->current['MAILMETHOD'] == ""){
+      $ldap->search ("(objectClass=goMailServer)", array('cn'));
+      $this->data['SERVERS']['IMAP']= array();
+      error_reporting(0);
+      while ($attrs= $ldap->fetch()){
+        $name= $attrs['cn'][0];
+        $this->data['SERVERS']['IMAP'][$name]= $name;
+      }
+      error_reporting(E_ALL);
+    } else {
+      $ldap->search ("(objectClass=goImapServer)", array('goImapName', 'goImapConnect', 'goImapAdmin', 'goImapPassword',
+            'goImapSieveServer', 'goImapSievePort'));
 
-    $this->data['SERVERS']['IMAP']= array();
-    $old_err = error_reporting(0);
-    while ($attrs= $ldap->fetch()){
-      $name= $attrs['goImapName'][0];
-      $this->data['SERVERS']['IMAP'][$name]= array( "connect" => $attrs['goImapConnect'][0],
-          "admin" => $attrs['goImapAdmin'][0],
-          "password" => $attrs['goImapPassword'][0],
-          "sieve_server" => $attrs['goImapSieveServer'][0],
-          "sieve_port" => $attrs['goImapSievePort'][0]);
-    }
-    error_reporting($old_err);
+      $this->data['SERVERS']['IMAP']= array();
+      error_reporting(0);
+      while ($attrs= $ldap->fetch()){
+        $name= $attrs['goImapName'][0];
+        $this->data['SERVERS']['IMAP'][$name]= array( "connect" => $attrs['goImapConnect'][0],
+            "admin" => $attrs['goImapAdmin'][0],
+            "password" => $attrs['goImapPassword'][0],
+            "sieve_server" => $attrs['goImapSieveServer'][0],
+            "sieve_port" => $attrs['goImapSievePort'][0]);
+      }
+      error_reporting(E_ALL);
+    }
 
     /* Get kerberos server. FIXME: only one is supported currently */
     $ldap->cd ($this->current['BASE']);