fixed bug 777849 (unnecessary   from subject)
[squirrelmail.git] / src / read_body.php
index facd93542b5658fb34167632293e05badaf44413..22835df5e563f4f2eb228b0411d6b7112c682bdb 100644 (file)
@@ -24,6 +24,7 @@ require_once(SM_PATH . 'functions/date.php');
 require_once(SM_PATH . 'functions/url_parser.php');
 require_once(SM_PATH . 'functions/html.php');
 require_once(SM_PATH . 'functions/global.php');
+require_once(SM_PATH . 'functions/identity.php');
 
 /**
  * Given an IMAP message id number, this will look it up in the cached
@@ -169,20 +170,13 @@ function SendMDN ( $mailbox, $passed_id, $sender, $message, $imapConnection) {
 
 
     $reply_to = '';
-    if (isset($identity) && $identity != 'default') {
-        $from_mail = getPref($data_dir, $username, 
-                             'email_address' . $identity);
-        $full_name = getPref($data_dir, $username, 
-                             'full_name' . $identity);
-        $from_addr = '"'.$full_name.'" <'.$from_mail.'>';
-        $reply_to  = getPref($data_dir, $username, 
-                             'reply_to' . $identity);
-    } else {
-        $from_mail = getPref($data_dir, $username, 'email_address');
-        $full_name = getPref($data_dir, $username, 'full_name');
-        $from_addr = '"'.$full_name.'" <'.$from_mail.'>';
-        $reply_to  = getPref($data_dir, $username,'reply_to');
-    }
+    $ident = get_identities();
+    if(!isset($identity)) $identity = 0;
+    $full_name = $ident[$identity]['full_name'];
+    $from_mail = $ident[$identity]['email_address'];
+    $from_addr = '"'.$full_name.'" <'.$from_mail.'>';
+    $reply_to  = $ident[$identity]['reply_to'];
+
     if (!$from_addr) {
        $from_addr = "$popuser@$domain";
        $from_mail = $from_addr;
@@ -202,8 +196,8 @@ function SendMDN ( $mailbox, $passed_id, $sender, $message, $imapConnection) {
     $now = getLongDateString( time() );
     set_my_charset();
     $body = _("Your message") . "\r\n\r\n" .
-            "\t" . _("To:") . ' ' . decodeHeader($to,true,false) . "\r\n" .
-            "\t" . _("Subject:") . ' ' . decodeHeader($header->subject,true,false) . "\r\n" .
+            "\t" . _("To:") . ' ' . decodeHeader($to,false,false) . "\r\n" .
+            "\t" . _("Subject:") . ' ' . decodeHeader($header->subject,false,false) . "\r\n" .
             "\t" . _("Sent:") . ' ' . $senton . "\r\n" .
             "\r\n" .
             sprintf( _("Was displayed on %s"), $now );
@@ -398,7 +392,7 @@ function formatEnvheader($mailbox, $passed_id, $passed_ent_id, $message,
 
     $header = $message->rfc822_header;
     $env = array();
-    $env[_("Subject")] = decodeHeader($header->subject);
+    $env[_("Subject")] = str_replace("&nbsp;"," ",decodeHeader($header->subject));
     $from_name = $header->getAddr_s('from');
     if (!$from_name) {
         $from_name = $header->getAddr_s('sender');
@@ -421,7 +415,7 @@ function formatEnvheader($mailbox, $passed_id, $passed_ent_id, $message,
         if ($mdn_user_support) {
             if ($header->dnt) {
                 if ($message->is_mdnsent) {
-                    $env[_("Read receipt")] = _("send");
+                    $env[_("Read receipt")] = _("sent");
                 } else {
                     $env[_("Read receipt")] = _("requested"); 
                     if (!(handleAsSent($mailbox) || 
@@ -459,7 +453,7 @@ function formatEnvheader($mailbox, $passed_id, $passed_ent_id, $message,
         }
     }
     echo '<TABLE BGCOLOR="'.$color[9].'" WIDTH="100%" CELLPADDING="1"'.
-         ' CELLSPACING="0" BORDER="0" ALIIGN="center">'."\n";
+         ' CELLSPACING="0" BORDER="0" ALIGN="center">'."\n";
     echo '<TR><TD HEIGHT="5" COLSPAN="2" BGCOLOR="'.
           $color[4].'"></TD></TR><TR><TD align=center>'."\n";
     echo $s;
@@ -508,13 +502,14 @@ function formatMenubar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_resp
     $comp_uri = 'src/compose.php' .
                             '?passed_id=' . $passed_id .
                             '&amp;mailbox=' . $urlMailbox .
+                            '&amp;startMessage=' . $startMessage .
                             (isset($passed_ent_id)?'&amp;passed_ent_id='.$passed_ent_id:'');
 
     if (($mailbox == $draft_folder) && ($save_as_draft)) {
-        $comp_alt_uri = $comp_uri . '&amp;action=draft';
+        $comp_alt_uri = $comp_uri . '&amp;smaction=draft';
         $comp_alt_string = _("Resume Draft");
     } else if (handleAsSent($mailbox)) {
-        $comp_alt_uri = $comp_uri . '&amp;action=edit_as_new';
+        $comp_alt_uri = $comp_uri . '&amp;smaction=edit_as_new';
         $comp_alt_string = _("Edit Message as New");
     }
     if (isset($comp_alt_uri)) {
@@ -586,20 +581,20 @@ function formatMenubar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_resp
 
     $s .= '</small></td>' . "\n" . 
           html_tag( 'td', '', 'right', '', 'width="33%" nowrap' ) . '<small>';
-    $comp_action_uri = $comp_uri . '&amp;action=forward';
+    $comp_action_uri = $comp_uri . '&amp;smaction=forward';
     $s .= makeComposeLink($comp_action_uri, _("Forward"));
 
     if ($enable_forward_as_attachment) {
-        $comp_action_uri = $comp_uri . '&amp;action=forward_as_attachment';
+        $comp_action_uri = $comp_uri . '&amp;smaction=forward_as_attachment';
         $s .= $topbar_delimiter;
         $s .= makeComposeLink($comp_action_uri, _("Forward as Attachment"));
     }
 
-    $comp_action_uri = $comp_uri . '&amp;action=reply';
+    $comp_action_uri = $comp_uri . '&amp;smaction=reply';
     $s .= $topbar_delimiter;
     $s .= makeComposeLink($comp_action_uri, _("Reply"));
 
-    $comp_action_uri = $comp_uri . '&amp;action=reply_all';
+    $comp_action_uri = $comp_uri . '&amp;smaction=reply_all';
     $s .= $topbar_delimiter;
     $s .= makeComposeLink($comp_action_uri, _("Reply All"));
     $s .= '</small></td></tr></table>';