Commit fixes courtesy of Ryan O'Neill
authorsimond <simond@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 1 Apr 2002 17:36:47 +0000 (17:36 +0000)
committersimond <simond@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 1 Apr 2002 17:36:47 +0000 (17:36 +0000)
<--- snip --->
- Adds "Edit Message as New" functionality to messages in the sent folder
- Fixes < > showing as &amp;lt; and &amp;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
src/draft_actions.php
src/read_body.php

index d775eb22dbde02fe80b1d2ee1526750537f2fa94..29e828ad7f7ce3ef3e07f9349331e1805bbbaf9a 100644 (file)
@@ -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('&lt;', '<', str_replace('&gt;', '>', str_replace('&amp;', '&', str_replace('&quot;', '"', $send_to))));
+    $send_to_cc = str_replace('&lt;', '<', str_replace('&gt;', '>', str_replace('&amp;', '&', str_replace('&quot;', '"', $send_to_cc))));
+    $send_to_bcc = str_replace('&lt;', '<', str_replace('&gt;', '>', str_replace('&amp;', '&', str_replace('&quot;', '"', $send_to_bcc))));
 
     if ($forward_id) {
         $id = $forward_id;
index 2056b2bf3bda7b74fe02d8156ee576783e376b54..a7295a91e45fcf50b32748e617fe55d89f17d5f1 100644 (file)
@@ -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);
index 4eb6e47b9450dcf8145390ec54e3ad9ea51f1b30..aec1291669fde3b82af6f69416ef4af1909b7114 100644 (file)
@@ -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 '<BR>' .
@@ -612,13 +623,22 @@ if ($where && $what) {
 echo _("Delete") . '</A>&nbsp;';
 if (($mailbox == $draft_folder) && ($save_as_draft)) {
     echo '|&nbsp;<A HREF="' . $base_uri .
-         "src/compose.php?mailbox=$mailbox&amp;send_to=$url_to_string&amp;send_to_cc=$url_cc_string&amp;send_to_bcc=$url_bcc_string&amp;subject=$url_subj&amp;draft_id=$passed_id&amp;ent_num=$ent_num" . '"';
+         "src/compose.php?mailbox=$mailbox&amp;identity=$identity&amp;send_to=$url_to_string&amp;send_to_cc=$url_cc_string&amp;send_to_bcc=$url_bcc_string&amp;subject=$url_subj&amp;mailprio=$priority_level&amp;draft_id=$passed_id&amp;ent_num=$ent_num" . '"';
     if ($compose_new_win == '1') {
-        echo 'TARGET="compose_window" onClick="comp_in_new()"';
+        echo ' TARGET="compose_window" onClick="comp_in_new()"';
     }
     echo '>'.
          _("Resume Draft") . '</a>';
 }
+if ($mailbox == $sent_folder) {
+    echo '|&nbsp;<A HREF="' . $base_uri .
+         "src/compose.php?mailbox=$mailbox&amp;identity=$identity&amp;send_to=$url_to_string&amp;send_to_cc=$url_cc_string&amp;send_to_bcc=$url_bcc_string&amp;subject=$url_subj&amp;mailprio=$priority_level&amp;draft_id=$passed_id&amp;ent_num=$ent_num" . '"';
+    if ($compose_new_win == '1') {
+        echo ' TARGET="compose_window" onClick="comp_in_new()"';
+    }
+    echo '>'.
+          _("Edit Message as New") . '</a>';
+}
 
 echo '&nbsp;&nbsp;' .
                    '</SMALL>' .