fix for unsafe images links. Somehow the wrong were in de view unsafe images
authorstekkel <stekkel@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 27 Jan 2003 09:06:21 +0000 (09:06 +0000)
committerstekkel <stekkel@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 27 Jan 2003 09:06:21 +0000 (09:06 +0000)
link. passed_ent_id is used in case of attached message/rfc822 messages,
ent_id is used for specifying the mime-entity_id. If passed_ent_id is
available we know that the message with entity_id = passed_ent_id contains
a rfc822header.

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@4475 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/mime.php

index 9edb776da5a899d0fb430215e4b4e54fbe653986..320e67e5777cd0c18ee20d778df7c3877a84d376 100644 (file)
@@ -319,7 +319,7 @@ function formatBody($imap_stream, $message, $color, $wrap_at, $ent_num, $id, $ma
      * order that is their priority.
      */
     global $startMessage, $username, $key, $imapServerAddress, $imapPort,
-           $show_html_default, $sort, $has_unsafe_images;
+           $show_html_default, $sort, $has_unsafe_images, $passed_ent_id;
 
     if( !sqgetGlobalVar('view_unsafe_images', $view_unsafe_images, SQ_GET) ) {
         $view_unsafe_images = false;
@@ -360,21 +360,24 @@ function formatBody($imap_stream, $message, $color, $wrap_at, $ent_num, $id, $ma
             translateText($body, $wrap_at,
                           $body_message->header->getParameter('charset'));
         }
-
+       $link = 'read_body.php?passed_id=' . $id . '&amp;ent_id='.$ent_num.
+                 '&amp;mailbox=' . $urlmailbox .'&amp;sort=' . $sort .
+                '&amp;startMessage=' . $startMessage . '&amp;show_more=0'; 
+       if (isset($passed_ent_id)) {
+           $link .= '&amp;passed_ent_id='.$passed_ent_id;
+       }
         if ($view_unsafe_images) {
-            $untext = '">' . _("Hide Unsafe Images");
+            $text = _("Hide Unsafe Images");
         } else {
            if (isset($has_unsafe_images) && $has_unsafe_images) {
-               $untext = '&amp;view_unsafe_images=1">' . _("View Unsafe Images");
+               $link .= '&amp;view_unsafe_images=1';
+               $text = _("View Unsafe Images");
            } else {
-               $untext = '">';
+               $text = '';
            }
         }
-        $body .= '<center><small><a href="read_body.php?passed_id=' . $id .
-                 '&amp;passed_ent_id=' . $message->entity_id . '&amp;mailbox=' . $urlmailbox .
-                 '&amp;sort=' . $sort . '&amp;startMessage=' . $startMessage . '&amp;show_more=0' .
-                 $untext . '</a></small></center><br>' . "\n";
-        
+        $body .= '<center><small><a href="'.$link.'">'.$text.
+                '</a></small></center><br>' . "\n";
     }
     return $body;
 }