typo
[squirrelmail.git] / src / download.php
index a7286c9513a05d64b4e03ce215a5607d10c250b9..bdd2a23c3b45448b5bebc8d64ef4735eceb0715a 100644 (file)
@@ -3,17 +3,20 @@
 /**
  * download.php
  *
- * Copyright (c) 1999-2003 The SquirrelMail Project Team
+ * Copyright (c) 1999-2004 The SquirrelMail Project Team
  * Licensed under the GNU GPL. For full terms see the file COPYING.
  *
  * Handles attachment downloads to the users computer.
  * Also allows displaying of attachments when possible.
  *
- * $Id$
+ * @version $Id$
  * @package squirrelmail
  */
 
-/** Path for SquirrelMail required files. */
+/**
+ * Path for SquirrelMail required files. 
+ * @ignore
+ */
 define('SM_PATH','../');
 
 /* SquirrelMail required files. */
@@ -38,8 +41,6 @@ if ( sqgetGlobalVar('passed_id', $temp, SQ_GET) ) {
 
 /* end globals */
 
-global $uid_support;
-
 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
 $mbx_response =  sqimap_mailbox_select($imapConnection, $mailbox);
 
@@ -96,7 +97,8 @@ if (is_object($message->header->disposition)) {
 //$filename = decodeHeader($filename, false, false);   //Don't want html output nor utf8 because it will return html output
 $filename = decodeHeader($filename, true, false);   //Don't want html output
 if (strlen($filename) < 1) {
-    $filename = $subject;
+    //$filename = decodeHeader($subject, false, false);        //Don't want html output nor utf8 because it will return html output
+    $filename = decodeHeader($subject, true, false);   //Don't want html output
     if ($type1 == 'plain' && $type0 == 'text')
         $suffix = 'txt';
     else if ($type1 == 'richtext' && $type0 == 'text')
@@ -105,10 +107,11 @@ if (strlen($filename) < 1) {
         $suffix = 'ps';
     else if ($type1 == 'rfc822' && $type0 == 'message')
         $suffix = 'msg';
-    else {
-        $filename = 'untitled' . strip_tags($ent_id);
+    else
         $suffix = $type1;
-    }
+
+    if ($filename == '')
+        $filename = 'untitled' . strip_tags($ent_id);
     $filename = $filename . '.' . $suffix;
 }