Fix for incorrect header in case of message/rfc822 attachments.
[squirrelmail.git] / src / printer_friendly_bottom.php
index 9f5a0978855b6a4d7f9f38dcdc04223aba52b0ab..0ff5dd9d5219ff769ad46486a2f4c6241c24a85a 100644 (file)
@@ -27,30 +27,30 @@ $mailbox = urldecode($mailbox);
 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
 sqimap_mailbox_select($imapConnection, $mailbox);
 $message = sqimap_get_message($imapConnection, $passed_id, $mailbox);
 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
 sqimap_mailbox_select($imapConnection, $mailbox);
 $message = sqimap_get_message($imapConnection, $passed_id, $mailbox);
+$id = $passed_id;
+if (isset($passed_ent_id)) {
+   $message = $message->getEntity($passed_ent_id);
+}
+
 
 /* --start display setup-- */
 
 
 /* --start display setup-- */
 
+
 /* From and Date are usually fine as they are... */
 $from = decodeHeader($message->header->getAddr_s('from'));
 $date = getLongDateString($message->header->date);
 /* From and Date are usually fine as they are... */
 $from = decodeHeader($message->header->getAddr_s('from'));
 $date = getLongDateString($message->header->date);
+$subject = trim(decodeHeader($message->header->subject));
 
 /* we can clean these up if the list is too long... */
 $cc = decodeHeader($message->header->getAddr_s('cc'));
 $to = decodeHeader($message->header->getAddr_s('to'));
 
 /* we can clean these up if the list is too long... */
 $cc = decodeHeader($message->header->getAddr_s('cc'));
 $to = decodeHeader($message->header->getAddr_s('to'));
-//$cc = decodeHeader(getLineOfAddrs($message->header->cc));
-//$to = decodeHeader(getLineOfAddrs($message->header->to));
 
 
-/* and Body and Subject could easily stream off the page... */
-$id = $passed_id;
-if (isset($passed_ent_id)) {
-   $message = $message->getEntity($passed_ent_id);
-}
 $ent_ar = $message->findDisplayEntity();
 $ent_ar = $message->findDisplayEntity();
-//$ent_num = $ent_ar[0];
 $body = '';
 if ($ent_ar[0] != '') {
   for ($i = 0; $i < count($ent_ar); $i++) {
      $body .= formatBody($imapConnection, $message, $color, $wrap_at, $ent_ar[$i], $passed_id, $mailbox);
 $body = '';
 if ($ent_ar[0] != '') {
   for ($i = 0; $i < count($ent_ar); $i++) {
      $body .= formatBody($imapConnection, $message, $color, $wrap_at, $ent_ar[$i], $passed_id, $mailbox);
+     $body .= '<hr noshade size=1>';
   }
   $hookResults = do_hook('message_body', $body);
   $body = $hookResults[1];
   }
   $hookResults = do_hook('message_body', $body);
   $body = $hookResults[1];
@@ -58,8 +58,6 @@ if ($ent_ar[0] != '') {
   $body = _("Message not printable");
 }
 
   $body = _("Message not printable");
 }
 
-$subject = trim(decodeHeader($message->header->subject));
-
  /* now, if they choose to, we clean up the display a bit... */
  
 if ( empty($pf_cleandisplay) || $pf_cleandisplay != 'no' ) {
  /* now, if they choose to, we clean up the display a bit... */
  
 if ( empty($pf_cleandisplay) || $pf_cleandisplay != 'no' ) {
@@ -71,7 +69,9 @@ if ( empty($pf_cleandisplay) || $pf_cleandisplay != 'no' ) {
     $to = pf_clean_string(str_replace(',,', ',', $to), $num_leading_spaces);
 
      // the body should have no leading zeros
     $to = pf_clean_string(str_replace(',,', ',', $to), $num_leading_spaces);
 
      // the body should have no leading zeros
-    $body = pf_clean_string($body, 0);
+    // disabled because it destroys html mail
+
+//    $body = pf_clean_string($body, 0);
 
      // clean up everything else...
     $subject = pf_clean_string($subject, $num_leading_spaces);
 
      // clean up everything else...
     $subject = pf_clean_string($subject, $num_leading_spaces);