fixed a couple of bugs in folder manipulation, in particular:
[squirrelmail.git] / src / download.php
index ce491fcf562112f29909b0489721ebfbdc9576af..552e88b65cb7bc69c0bc8b18b0d835b22286ded3 100644 (file)
@@ -1,7 +1,7 @@
 <?
    include("../config/config.php");
-   include("../functions/strings.php");
-   include("../functions/page_header.php");
+//   include("../functions/strings.php");
+//   include("../functions/page_header.php");
    include("../functions/imap.php");
    include("../functions/mime.php");
    include("../functions/mailbox.php");
@@ -9,20 +9,28 @@
 
    include("../src/load_prefs.php");
 
-   function viewText($color, $body, $id, $entid, $mailbox) {
+   function viewText($color, $body, $id, $entid, $mailbox, $type1, $wrap_at) {
       echo "<HTML><BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n";
       displayPageHeader($color, "None");
 
       echo "<BR><TABLE WIDTH=90% BORDER=0 CELLSPACING=0 CELLPADDING=2 ALIGN=CENTER><TR><TD BGCOLOR=\"$color[0]\">";
-      echo "<B><CENTER>Viewing a plain text attachment</CENTER></B>";
+      echo "<B><CENTER>";
+      echo _("Viewing a plain text attachment");
+      echo "</CENTER></B>";
       echo "</TD></TR><TR><TD BGCOLOR=\"$color[4]\">";
       $urlmailbox = urlencode($mailbox);
-      echo "<FONT FACE=\"Arial, Helvetica\"><CENTER><A HREF=\"../src/download.php?absolute_dl=true&passed_id=$id&passed_ent_id=$entid&mailbox=$urlmailbox\">Download this as a file</A></CENTER><BR><BR></FONT><TT>";
-      echo nl2br(trim($body));
+      echo "<FONT FACE=\"Arial, Helvetica\"><CENTER><A HREF=\"../src/download.php?absolute_dl=true&passed_id=$id&passed_ent_id=$entid&mailbox=$urlmailbox\">";
+      echo _("Download this as a file");
+      echo "</A></CENTER><BR><BR></FONT><TT>";
+      if ($type1 == "html")
+         echo $body;
+      else
+         echo translateText($body, $wrap_at);
+
       echo "</TT></TD></TR></TABLE>";
    }
 
-   $imapConnection = loginToImapServer($username, $key, $imapServerAddress);
+   $imapConnection = loginToImapServer($username, $key, $imapServerAddress, 0);
    selectMailbox($imapConnection, $mailbox, $numMessages);
 
    // $message contains all information about the message
       switch ($type0) {
          case "text":
             $body = decodeBody($message["ENTITIES"][$passed_ent_id]["BODY"], $message["ENTITIES"][$passed_ent_id]["ENCODING"]);
-            viewText($color, $body, $passed_id, $passed_ent_id, $mailbox);
+            viewText($color, $body, $passed_id, $passed_ent_id, $mailbox, $type1, $wrap_at);
             break;
          case "message":
             $body = decodeBody($message["ENTITIES"][$passed_ent_id]["BODY"], $message["ENTITIES"][$passed_ent_id]["ENCODING"]);
-            viewText($color, $body, $passed_id, $passed_ent_id, $mailbox);
+            viewText($color, $body, $passed_id, $passed_ent_id, $mailbox, $type1, $wrap_at);
             break;
          default:
             $body = decodeBody($message["ENTITIES"][$passed_ent_id]["BODY"], $message["ENTITIES"][$passed_ent_id]["ENCODING"]);