From fa77d354ae026e55f3da1f217b6d77256b792eca Mon Sep 17 00:00:00 2001 From: simond Date: Mon, 1 Apr 2002 17:36:47 +0000 Subject: [PATCH] Commit fixes courtesy of Ryan O'Neill <--- snip ---> - Adds "Edit Message as New" functionality to messages in the sent folder - Fixes < > showing as &lt; and &gt; when resuming draft or editing as new - Now remembers priority when saving draft - Now remembers the correct identity when resuming draft/editing as new (only for people using multiple identities) - Fixed small bug that broke compose in new window on Resume Draft <--- snip ---> git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@2661 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- src/compose.php | 8 +++++++- src/draft_actions.php | 9 +++++++-- src/read_body.php | 24 ++++++++++++++++++++++-- 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/src/compose.php b/src/compose.php index d775eb22..29e828ad 100644 --- a/src/compose.php +++ b/src/compose.php @@ -87,7 +87,10 @@ if (isset($draft)) { if (! isset($MDN)) { $MDN = 'False'; } - if (!saveMessageAsDraft($send_to, $send_to_cc, $send_to_bcc, $subject, $body, $reply_id, $MDN, $session)) { + if (! isset($mailprio)) { + $mailprio = ''; + } + if (!saveMessageAsDraft($send_to, $send_to_cc, $send_to_bcc, $subject, $body, $reply_id, $mailprio, $session)) { showInputForm($session); exit(); } else { @@ -362,6 +365,9 @@ function newMail () { $send_to = decodeHeader($send_to, false); $send_to_cc = decodeHeader($send_to_cc, false); $send_to_bcc = decodeHeader($send_to_bcc, false); + $send_to = str_replace('<', '<', str_replace('>', '>', str_replace('&', '&', str_replace('"', '"', $send_to)))); + $send_to_cc = str_replace('<', '<', str_replace('>', '>', str_replace('&', '&', str_replace('"', '"', $send_to_cc)))); + $send_to_bcc = str_replace('<', '<', str_replace('>', '>', str_replace('&', '&', str_replace('"', '"', $send_to_bcc)))); if ($forward_id) { $id = $forward_id; diff --git a/src/draft_actions.php b/src/draft_actions.php index 2056b2bf..a7295a91 100644 --- a/src/draft_actions.php +++ b/src/draft_actions.php @@ -141,12 +141,17 @@ function writeBodyForDraft ($fp, $passedBody, $session) { } -function saveMessageAsDraft($t, $c, $b, $subject, $body, $reply_id, $session) { +function saveMessageAsDraft($t, $c, $b, $subject, $body, $reply_id, $prio = 3, $session) { global $useSendmail, $msg_id, $is_reply, $mailbox, $onetimepad, $data_dir, $username, $domain, $key, $version, $sent_folder, - $imapServerAddress, $imapPort, $draft_folder, $attachment_dir; + $imapServerAddress, $imapPort, $draft_folder, $attachment_dir, + $default_use_priority; $more_headers = Array(); + if ($default_use_priority) { + $more_headers = array_merge($more_headers, createPriorityHeaders($prio)); + } + $imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 1); $hashed_attachment_dir = getHashedDir($username, $attachment_dir); diff --git a/src/read_body.php b/src/read_body.php index 4eb6e47b..aec12916 100644 --- a/src/read_body.php +++ b/src/read_body.php @@ -582,6 +582,17 @@ if ($default_use_priority) { /** make sure everything will display in HTML format **/ $from_name = decodeHeader(htmlspecialchars($message->header->from)); $subject = decodeHeader(htmlspecialchars($message->header->subject)); +$identity = ''; +$idents = getPref($data_dir, $username, 'identities'); +if (!empty($idents) && $idents > 1) { + for ($i = 1; $i < $idents; $i++) { + if (htmlspecialchars('"' . encodeHeader(getPref($data_dir, $username, 'full_name' . $i)) . + '" <' . getPref($data_dir, $username, 'email_address' . $i) . '>') == $from_name) { + $identity = $i; + break; + } + } +} do_hook('read_body_top'); echo '
' . @@ -612,13 +623,22 @@ if ($where && $what) { echo _("Delete") . ' '; if (($mailbox == $draft_folder) && ($save_as_draft)) { echo '| '. _("Resume Draft") . ''; } +if ($mailbox == $sent_folder) { + echo '| '. + _("Edit Message as New") . ''; +} echo '  ' . '' . -- 2.25.1