Now fill in default subject when forwarding as attachment (#2936541)
authorpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 21 Jun 2010 08:16:05 +0000 (08:16 +0000)
committerpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 21 Jun 2010 08:16:05 +0000 (08:16 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@13955 7612ce4b-ef26-0410-bec9-ea0150e637f0

doc/ChangeLog
functions/mailbox_display.php
src/compose.php

index e200d38c256e69e5fe78c3e9e596dac3fe35d8b4..e4b5f4e3fe5782e9e98629c979eb4ba9d9b3b042 100644 (file)
@@ -344,6 +344,7 @@ Version 1.5.2 - SVN
     (reduces chances of session data growing too large)
   - Fixed minor vulnerability in Mail Fetch plugin [CVE-2010-1637/TEHTRI-SA-2010-009]
   - Now properly quote personal part of encoded addresses when replying.
+  - Now fill in default subject when forwarding as attachment (#2936541)
 
 Version 1.5.1 (branched on 2006-02-12)
 --------------------------------------
index a3673bf8430146f087f2f20dd8d3bfc5084f0d32..f44e1ebe44939beba991aa25dfb2409ebae2dada 100644 (file)
@@ -1532,6 +1532,17 @@ function attachSelectedMessages($imapConnection,$aMsgHeaders) {
             fclose($fp);
 
             $composeMessage->initAttachment('message/rfc822', $subject . '.eml', $filename);
+
+            // create subject for new message
+            //
+            $subject = decodeHeader($subject,false,false,true);
+            $subject = str_replace('"', "'", $subject);
+            $subject = trim($subject);
+            if (substr(strtolower($subject), 0, 4) != 'fwd:') {
+                $subject = 'Fwd: ' . $subject;
+            }
+            $composeMessage->rfc822_header->subject = $subject;
+
         }
     }
 
index 835893874c9076e2eeb5bfc0bc069c3843ec7a44..639709134e14e4997e8dc25bf8522c55db5b70da 100644 (file)
@@ -734,6 +734,11 @@ elseif (isset($sigappend)) {
 
     $values = newMail($mailbox,$passed_id,$passed_ent_id, $action, $session);
 
+    // forward as attachment - subject is in the message in session
+    //
+    if ($action == 'forward_as_attachment' && empty($values['subject']))
+        $subject = $composeMessage->rfc822_header->subject;
+
     /* in case the origin is not read_body.php */
     if (isset($send_to)) {
         $values['send_to'] = $send_to;
@@ -945,6 +950,12 @@ function newMail ($mailbox='', $passed_id='', $passed_ent_id='', $action='', $se
             case ('forward_as_attachment'):
                 $subject = getforwardSubject(decodeHeader($orig_header->subject,false,false,true));
                 $composeMessage = getMessage_RFC822_Attachment($message, $composeMessage, $passed_id, $passed_ent_id, $imapConnection);
+                $subject = decodeHeader($orig_header->subject,false,false,true);
+                $subject = str_replace('"', "'", $subject);
+                $subject = trim($subject);
+                if (substr(strtolower($subject), 0, 4) != 'fwd:') {
+                    $subject = 'Fwd: ' . $subject;
+                }
                 $body = '';
                 break;
             case ('reply_all'):