Added error message in case the bodystructure couldn't processed.
[squirrelmail.git] / src / download.php
index 34ed8fd0d733c706a538e5db768b6393ff49a717..e630d95b0928c615d4991c6bcd237afb884c9d1c 100644 (file)
@@ -151,7 +151,7 @@ mime_print_body_lines ($imapConnection, $passed_id, $ent_id, $encoding);
  * version of IE.  I don't know if it works with Opera, but it should now.
  */
 function DumpHeaders($type0, $type1, $filename, $force) {
-    global $HTTP_USER_AGENT;
+    global $HTTP_USER_AGENT, $languages, $squirrelmail_language;
     $isIE = 0;
 
     if (strstr($HTTP_USER_AGENT, 'compatible; MSIE ') !== false &&
@@ -164,7 +164,13 @@ function DumpHeaders($type0, $type1, $filename, $force) {
         $isIE6 = 1;
     }
 
-    $filename = ereg_replace('[^-a-zA-Z0-9\.]', '_', $filename);
+    if (isset($languages[$squirrelmail_language]['XTRA_CODE']) &&
+        function_exists($languages[$squirrelmail_language]['XTRA_CODE'])) {
+        $filename = 
+            $languages[$squirrelmail_language]['XTRA_CODE']('downloadfilename', $filename, $HTTP_USER_AGENT);
+    } else {
+       $filename = ereg_replace('[^-a-zA-Z0-9\.]', '_', $filename);
+    }
 
     // A Pox on Microsoft and it's Office!
     if (! $force) {