replacing urlencode with rawurlencode. It is possible that I've missed space
[squirrelmail.git] / functions / mime.php
index bdbff6bd121bb8f615f99a381d8c43f56d998b37..09fc552c27b548e64a306f19efd3afe2a1949bcc 100644 (file)
@@ -3,7 +3,7 @@
 /**
  * mime.php
  *
- * Copyright (c) 1999-2004 The SquirrelMail Project Team
+ * Copyright (c) 1999-2005 The SquirrelMail Project Team
  * Licensed under the GNU GPL. For full terms see the file COPYING.
  *
  * This contains the functions necessary to detect and decode MIME
@@ -331,12 +331,14 @@ function translateText(&$body, $wrap_at, $charset) {
     $body = '<pre>' . implode("\n", $body_ary) . '</pre>';
 }
 
-/* This returns a parsed string called $body. That string can then
+/**
+ * This returns a parsed string called $body. That string can then
  * be displayed as the actual message in the HTML. It contains
  * everything needed, including HTML Tags, Attachments at the
  * bottom, etc.
+ * @param clean Do not output stuff that's irrelevant for the printable version.
  */
-function formatBody($imap_stream, $message, $color, $wrap_at, $ent_num, $id, $mailbox='INBOX') {
+function formatBody($imap_stream, $message, $color, $wrap_at, $ent_num, $id, $mailbox='INBOX', $clean=FALSE) {
     /* This if statement checks for the entity to show as the
      * primary message. To add more of them, just put them in the
      * order that is their priority.
@@ -392,6 +394,12 @@ function formatBody($imap_stream, $message, $color, $wrap_at, $ent_num, $id, $ma
             translateText($body, $wrap_at,
                           $body_message->header->getParameter('charset'));
         }
+
+        // if this is the clean display (i.e. printer friendly), stop here.
+        if ( $clean ) {
+            return $body;
+        }
+
         $link = 'passed_id=' . $id . '&amp;ent_id='.$ent_num.
                 '&amp;mailbox=' . $urlmailbox .'&amp;sort=' . $sort .
                 '&amp;startMessage=' . $startMessage . '&amp;show_more=0';
@@ -1482,7 +1490,7 @@ function sq_fixatts($tagname,
 
 /**
  * This function edits the style definition to make them friendly and
- * usable in squirrelmail.
+ * usable in SquirrelMail.
  *
  * @param  $message  the message object
  * @param  $id       the message id
@@ -2009,7 +2017,7 @@ function magicHTML($body, $id, $message, $mailbox = 'INBOX') {
      // version
      //set all the Cache Control Headers for IE
      if ($isIE) {
-         $filename=urlencode($filename);
+         $filename=rawurlencode($filename);
          header ("Pragma: public");
          header ("Cache-Control: no-store, max-age=0, no-cache, must-revalidate"); # HTTP/1.1
          header ("Cache-Control: post-check=0, pre-check=0", false);