X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Fdownload.php;h=982c7e0f69d5d08579a334c42adc7f8d8b699a25;hb=c1e15177efc56cd1eb885787df0f4bcac53ea7dc;hp=56c57335546badc42cfc0ec05060e0098c88d34d;hpb=7085fa781edecb09839b682808e516796a60b6e5;p=squirrelmail.git
diff --git a/src/download.php b/src/download.php
index 56c57335..982c7e0f 100644
--- a/src/download.php
+++ b/src/download.php
@@ -1,31 +1,48 @@
-
- include("../config/config.php");
- include("../functions/strings.php");
- include("../functions/page_header.php");
- include("../functions/imap.php");
- include("../functions/mime.php");
- include("../functions/mailbox.php");
- include("../functions/date.php");
+
\n";
displayPageHeader($color, "None");
echo "
";
- echo "Viewing a plain text attachment";
+ echo "";
+ echo _("Viewing a plain text attachment");
+ echo "";
echo " |
";
$urlmailbox = urlencode($mailbox);
- echo "Download this as a file
";
- echo nl2br($body);
+ echo "";
+ echo _("Download this as a file");
+ echo "
";
+ if ($type1 == "html")
+ echo $body;
+ else
+ echo translateText($body, $wrap_at);
+
echo " |
";
}
- $imapConnection = loginToImapServer($username, $key, $imapServerAddress);
- selectMailbox($imapConnection, $mailbox, $numMessages);
+ $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
+ sqimap_mailbox_select($imapConnection, $mailbox);
// $message contains all information about the message
// including header and body
- $message = fetchMessage($imapConnection, $passed_id, $mailbox);
+ $message = sqimap_get_message($imapConnection, $passed_id, $mailbox);
$type0 = $message["ENTITIES"][$passed_ent_id]["TYPE0"];
$type1 = $message["ENTITIES"][$passed_ent_id]["TYPE1"];
@@ -39,13 +56,13 @@
switch($type0) {
case "text":
$body = decodeBody($message["ENTITIES"][$passed_ent_id]["BODY"], $message["ENTITIES"][$passed_ent_id]["ENCODING"]);
- header("Content-type: $type0/$type1");
+ header("Content-type: $type0/$type1; name=\"$filename\"");
header("Content-Disposition: attachment; filename=\"$filename\"");
- echo $body;
+ echo trim($body);
break;
default:
$body = decodeBody($message["ENTITIES"][$passed_ent_id]["BODY"], $message["ENTITIES"][$passed_ent_id]["ENCODING"]);
- header("Content-type: $type0/$type1");
+ header("Content-type: $type0/$type1; name=\"$filename\"");
header("Content-Disposition: attachment; filename=\"$filename\"");
echo $body;
break;
@@ -54,20 +71,20 @@
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"]);
- header("Content-type: $type0/$type1");
+ header("Content-type: $type0/$type1; name=\"$filename\"");
header("Content-Disposition: attachment; filename=\"$filename\"");
echo $body;
break;
}
}
- fputs($imapConnection, "1 logout\n");
+ sqimap_logout($imapConnection);
?>