Przeglądaj źródła

Gracefully recover from over quota error while sending a mail (#1145144):
when an quota error occurs we can't redirect properly ("Warning: headers
already sent"), so provide a link to the redirected page instead.

Thijs Kinkhorst 20 lat temu
rodzic
commit
a8160f1118
2 zmienionych plików z 36 dodań i 7 usunięć
  1. 1 0
      ChangeLog
  2. 35 7
      src/compose.php

+ 1 - 0
ChangeLog

@@ -352,6 +352,7 @@ Version 1.5.1 -- CVS
   - Modified mercury32 preset in order to remove INBOX prefix in mercury32 4.01.
   - Added peardb backend to change_password plugin.
   - Tweak IMAP connection error display (#1203154).
+  - Gracefully recover from over quota error while sending a mail (#1145144).
 
 Version 1.5.0 - 2 February 2004
 -------------------------------

+ 35 - 7
src/compose.php

@@ -382,11 +382,24 @@ if ($draft) {
             sqimap_logout($imap_stream);
         }
         if ($compose_new_win == '1') {
-            Header("Location: $location/compose.php?saved_draft=yes&session=$composesession");
+            if ( !isset($pageheader_sent) || !$pageheader_sent ) {
+                Header("Location: $location/compose.php?saved_draft=yes&session=$composesession");
+            } else {
+                echo '   <br><br><center><a href="' . $location
+                    . '/compose.php?saved_sent=yes&amp;session=' . $composesession . '">'
+                    . _("Return") . '</a></center>';
+            }            
             exit();
         } else {
-            Header("Location: $location/right_main.php?mailbox=" . urlencode($draft_folder) .
+            if ( !isset($pageheader_sent) || !$pageheader_sent ) {
+                Header("Location: $location/right_main.php?mailbox=" . urlencode($draft_folder) .
                    "&startMessage=1&note=".urlencode($draft_message));
+            } else {
+                echo '   <br><br><center><a href="' . $location
+                    . '/right_main.php?mailbox=' . urlencode($draft_folder)
+                    . '&amp;startMessage=1&amp;note=' . urlencode($draft_message) .'">'
+                    . _("Return") . '</a></center>';
+            }            
             exit();
         }
     }
@@ -461,10 +474,25 @@ if ($send) {
             sqimap_logout($imap_stream);
         }
         if ($compose_new_win == '1') {
-            Header("Location: $location/compose.php?mail_sent=yes");
-        }else {
-            Header("Location: $location/right_main.php?mailbox=$urlMailbox".
-                   "&startMessage=$startMessage&mail_sent=yes");
+            if ( !isset($pageheader_sent) || !$pageheader_sent ) {
+                Header("Location: $location/compose.php?mail_sent=yes");
+            } else {
+                echo '   <br><br><center><a href="' . $location
+                    . '/compose.php?mail_sent=yes">'
+                    . _("Return") . '</a></center>';
+            }
+            exit();
+        } else {
+            if ( !isset($pageheader_sent) || !$pageheader_sent ) {
+                Header("Location: $location/right_main.php?mailbox=$urlMailbox".
+                    "&startMessage=$startMessage&mail_sent=yes");
+            } else {
+                echo '   <br><br><center><a href="' . $location
+                    . "/right_main.php?mailbox=$urlMailbox"
+                    . "&amp;startMessage=$startMessage&amp;mail_sent=yes\">"
+                    . _("Return") . '</a></center>';
+            }
+            exit();
         }
     } else {
         if ($compose_new_win == '1') {
@@ -1631,4 +1659,4 @@ function deliverMessage($composeMessage, $draft=false) {
 }
 
 // vim: et ts=4
-?>
+?>