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 e200d38..e4b5f4e 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 a3673bf..f44e1eb 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 8358938..6397091 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'):