ソースを参照

Fixed bad/malformed request error when Sent was over quota. This was checked
at the second stage when appending to Sent but not the first stage (the
response was simply thrown away). I've abstracted the checking to a
separate function that is called at the two relevant points. Closes: #1172694

Thijs Kinkhorst 20 年 前
コミット
4d5559dcde
2 ファイル変更12 行追加4 行削除
  1. 1 0
      ChangeLog
  2. 11 4
      functions/imap_general.php

+ 1 - 0
ChangeLog

@@ -289,6 +289,7 @@ Version 1.5.1 -- CVS
     (#1043576).
   - mbstring internal encoding is switched to ASCII, if mbstring.func_overload
     is enabled (#929644).
+  - Fixed checking for quota when appending to Sent folder (#1172694).
   
 Version 1.5.0
 --------------------

+ 11 - 4
functions/imap_general.php

@@ -966,15 +966,22 @@ function sqimap_status_messages ($imap_stream, $mailbox,
 function sqimap_append ($imap_stream, $sent_folder, $length) {
     fputs ($imap_stream, sqimap_session_id() . ' APPEND ' . sqimap_encode_mailbox_name($sent_folder) . " (\\Seen) \{$length}\r\n");
     $tmp = fgets ($imap_stream, 1024);
+    sqimap_append_checkresponse($tmp, $sent_folder);
 }
 
 function sqimap_append_done ($imap_stream, $folder='') {
-    global $squirrelmail_language, $color;
     fputs ($imap_stream, "\r\n");
     $tmp = fgets ($imap_stream, 1024);
-    if (preg_match("/(.*)(BAD|NO)(.*)$/", $tmp, $regs)) {
+    sqimap_append_checkresponse($tmp, $folder);
+}
+
+function sqimap_append_checkresponse($response, $folder) {
+    
+    if (preg_match("/(.*)(BAD|NO)(.*)$/", $response, $regs)) {
+        global $squirrelmail_language, $color;
         set_up_language($squirrelmail_language);
         require_once(SM_PATH . 'functions/display_messages.php');
+
         $reason = $regs[3];
         if ($regs[2] == 'NO') {
            $string = "<b><font color=\"$color[2]\">\n" .
@@ -994,7 +1001,7 @@ function sqimap_append_done ($imap_stream, $folder='') {
                   _("ERROR : Bad or malformed request.") .
                   "</b><br />\n" .
                   _("Server responded: ") .
-                  $tmp . "</font><br />\n";
+                  $reason . "</font><br />\n";
            error_box($string,$color);
            exit;
         }
@@ -1020,4 +1027,4 @@ function map_yp_alias($username) {
    return chop(substr($yp, strlen($username)+1));
 }
 
-?>
+?>