瀏覽代碼

html output will be cleaned by encoding function

tokul 21 年之前
父節點
當前提交
339d6bcf27
共有 1 個文件被更改,包括 9 次插入4 次删除
  1. 9 4
      src/download.php

+ 9 - 4
src/download.php

@@ -40,6 +40,9 @@ if ( sqgetGlobalVar('passed_id', $temp, SQ_GET) ) {
     $passed_id = (int) $temp;
     $passed_id = (int) $temp;
 }
 }
 
 
+global $default_charset;
+set_my_charset();
+
 /* end globals */
 /* end globals */
 
 
 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
@@ -105,11 +108,13 @@ if (is_object($message->header->disposition)) {
     $filename = $header->getParameter('name');
     $filename = $header->getParameter('name');
 }
 }
 
 
-//$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
+$filename = decodeHeader($filename,true,true);
+$filename = charset_encode($filename,$default_charset,false);
+
+// If name is not set, use subject of email
 if (strlen($filename) < 1) {
 if (strlen($filename) < 1) {
-    //$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
+    $filename = decodeHeader($subject, true, true);
+    $filename = charset_encode($filename,$default_charset,false);
     if ($type1 == 'plain' && $type0 == 'text')
     if ($type1 == 'plain' && $type0 == 'text')
         $suffix = 'txt';
         $suffix = 'txt';
     else if ($type1 == 'richtext' && $type0 == 'text')
     else if ($type1 == 'richtext' && $type0 == 'text')