From f2ad47f19d5b71cca9d4d50095d0f9306d5e74cf Mon Sep 17 00:00:00 2001 From: pdontthink Date: Mon, 21 Jun 2010 08:16:05 +0000 Subject: [PATCH] Now fill in default subject when forwarding as attachment (#2936541) git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@13955 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- doc/ChangeLog | 1 + functions/mailbox_display.php | 11 +++++++++++ src/compose.php | 11 +++++++++++ 3 files changed, 23 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index e200d38c..e4b5f4e3 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -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) -------------------------------------- diff --git a/functions/mailbox_display.php b/functions/mailbox_display.php index a3673bf8..f44e1ebe 100644 --- a/functions/mailbox_display.php +++ b/functions/mailbox_display.php @@ -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; + } } diff --git a/src/compose.php b/src/compose.php index 83589387..63970913 100644 --- a/src/compose.php +++ b/src/compose.php @@ -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'): -- 2.25.1