Code

For empty mail methods, just don't care about IMAP. This closes #93.
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 10 Jul 2007 08:59:18 +0000 (08:59 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 10 Jul 2007 08:59:18 +0000 (08:59 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@6800 594d385d-05f5-0310-b6e9-bd551577e9d8

include/class_config.inc

index 8e9fb9fabedc754e7f4d94d632a6e890075e8e3b..82e65d402292352e04ed0e6bd1a807f0f1802346 100644 (file)
@@ -335,19 +335,31 @@ class config  {
     /* Fill imap servers */
     $ldap= $this->get_ldap_link();
     $ldap->cd ($this->current['BASE']);
-    $ldap->search ("(objectClass=goImapServer)");
-
-    $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);
+    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();
+           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']);