Code

Moved headers to etc
[gosa.git] / gosa-plugins / mail / personal / mail / class_mail-methods-cyrus.inc
index 8816e39fb5a7657c2b39e98127006b04d3f3d337..e054fa29ef85ecd45e0456e9e1a40e4eb6127e78 100644 (file)
@@ -57,7 +57,11 @@ class mailMethodCyrus extends mailMethod{
     /* Setting connect timeout to 10 seconds,
         else the GOsa UI may freeze for 60 seconds.
        (PHP default is 'default_socket_timeout = 60') */
-    imap_timeout(1, 10 );
+    $timeout = $this->config->get_cfg_value("imapTimeout",10);
+    @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__,$timeout,
+          "<b>IMAP: Setting imap connect timeout to</b> (seconds)");
+    imap_timeout(1, $timeout);
+
     $this->imap_handle = @imap_open($cfg['connect'], $cfg['admin'], $cfg['password'], OP_HALFOPEN);
 
     /* Mailbox reachable? */
@@ -430,6 +434,21 @@ class mailMethodCyrus extends mailMethod{
   {
     mailMethod::saveSieveSettings();
 
+    // Check file integrity 
+    $files = array();
+    foreach(array("sieve-header.txt","sieve-spam.txt","sieve-mailsize.txt","sieve-vacation.txt","sieve-discard.txt") as $file){
+      if(!file_exists(CONFIG_DIR."/".$file) || ! is_readable(CONFIG_DIR."/".$file)){
+        $files[] = CONFIG_DIR."/".$file;
+        @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__ , CONFIG_DIR."/".$file,
+            "<b>Sieve template missing, please locate and move the template file: </b>");
+      }
+    }
+    if(count($files)){
+      $msg = sprintf(_("File '%s' does not exist!"),implode($files,", "));
+      $msg .= "&nbsp;"._("The sieve script may not be written correctly.");
+      msg_dialog::display(_("Warning"),$msg,WARNING_DIALOG);
+    }
+
     /* Map attribute from parent class 
      */
     $mail = $this->parent->mail;
@@ -499,6 +518,7 @@ class mailMethodCyrus extends mailMethod{
       Build up new sieve script here.
      *****/
 
+
     /* Only create a new one, if it is not empty */
     $script= "";
     if (is_integer(strpos($gosaMailDeliveryMode, "R")) ||