removed displaying attachments in case we are dealing with
[squirrelmail.git] / functions / mime.php
index e5b0e9fcd9d19ffda7ea41e4ebe23ebf877fcee9..61e345741c836eedaf62ebdb31d92f3345288819 100644 (file)
@@ -794,7 +794,7 @@ function formatBody($imap_stream, $message, $color, $wrap_at) {
                 $body = strip_tags( $body );
                 translateText($body, $wrap_at, $body_message->header->charset);
             } else {
-                $body = MagicHTML( $body, $id );
+                $body = MagicHTML( $body, $id, $message );
             }
         } else {
             translateText($body, $wrap_at, $body_message->header->charset);
@@ -811,7 +811,13 @@ function formatBody($imap_stream, $message, $color, $wrap_at) {
 
         /** Display the ATTACHMENTS: message if there's more than one part **/
         if (isset($message->entities[1])) {
-            $body .= formatAttachments ($message, $ent_num, $message->header->mailbox, $id);
+           /* Header-type alternative means we choose the best one to display 
+              so don't show the alternatives as attachment. Header-type related
+              means that the attachments are already part of the related message.
+           */   
+           if ($message->header->type1 !='related' && $message->header->type1 !='alternative') {
+               $body .= formatAttachments ($message, $ent_num, $message->header->mailbox, $id);
+           }
         }
     } else {
         $body = formatAttachments ($message, -1, $message->header->mailbox, $id);
@@ -1011,7 +1017,8 @@ function decodeBody($body, $encoding) {
 
   global $show_html_default;
 
-  if ($encoding == 'quoted-printable') {
+  if ($encoding == 'quoted-printable' ||
+      $encoding == 'quoted_printable') {
      $body = quoted_printable_decode($body);
 
 
@@ -1941,9 +1948,9 @@ function sq_sanitize($body,
  * @param  $id    the id of the message
  * @return        a string with html safe to display in the browser.
  */
-function magicHTML($body, $id){
+function magicHTML($body, $id, $message){
     global $attachment_common_show_images, $view_unsafe_images,
-        $has_unsafe_images, $message;
+        $has_unsafe_images;
     /**
      * Don't display attached images in HTML mode.
      */