Procházet zdrojové kódy

Right now decodeHeader will encode the non-ascii text into the HTML
entities. However, some places don't need that, for example the
compose form, otherwise the subject and other fields turn into the
#&NNNN;#&NNNN; stuff.

graf25 před 23 roky
rodič
revize
6499605d8c
2 změnil soubory, kde provedl 13 přidání a 10 odebrání
  1. 6 3
      functions/mime.php
  2. 7 7
      src/compose.php

+ 6 - 3
functions/mime.php

@@ -755,7 +755,7 @@ class msg_header {
 
    // This functions decode strings that is encoded according to
    // RFC1522 (MIME Part Two: Message Header Extensions for Non-ASCII Text).
-   function decodeHeader ($string) {
+   function decodeHeader ($string, $utfencode=true) {
       if (eregi('=\\?([^?]+)\\?(q|b)\\?([^?]+)\\?=',
                 $string, $res)) {
          if (ucfirst($res[2]) == "B") {
@@ -769,8 +769,11 @@ class msg_header {
         }
             $replace = quoted_printable_decode($replace);
          }
-
-         $replace = charset_decode ($res[1], $replace);
+         /* Only encode into entities by default. Some places
+            don't need the encoding, like the compose form. */
+         if ($utfencode){
+             $replace = charset_decode ($res[1], $replace);
+         }
 
          // Remove the name of the character set.
          $string = eregi_replace ('=\\?([^?]+)\\?(q|b)\\?([^?]+)\\?=',

+ 7 - 7
src/compose.php

@@ -237,9 +237,9 @@ function newMail () {
            $reply_id, $send_to, $send_to_cc, $mailbox, $send_to_bcc, $editor_size,
            $draft_id, $use_signature;
 
-    $send_to = decodeHeader($send_to);
-    $send_to_cc = decodeHeader($send_to_cc);
-    $send_to_bcc = decodeHeader($send_to_bcc);
+    $send_to = decodeHeader($send_to, false);
+    $send_to_cc = decodeHeader($send_to_cc, false);
+    $send_to_bcc = decodeHeader($send_to_bcc, false);
 
     if ($forward_id) {
         $id = $forward_id;
@@ -316,7 +316,7 @@ function newMail () {
             $body = $bodyTop . $body;
         }
         elseif ($reply_id) {
-            $orig_from = decodeHeader($orig_header->from);
+            $orig_from = decodeHeader($orig_header->from, false);
             $body = getReplyCitation($orig_from) . $body;
         }
 
@@ -421,9 +421,9 @@ function showInputForm () {
            $username, $data_dir, $identity, $draft_id, $delete_draft,
            $mailprio;
 
-    $subject = decodeHeader($subject);
-    $reply_subj = decodeHeader($reply_subj);
-    $forward_subj = decodeHeader($forward_subj);
+    $subject = decodeHeader($subject, false);
+    $reply_subj = decodeHeader($reply_subj, false);
+    $forward_subj = decodeHeader($forward_subj, false);
 
     if ($use_javascript_addr_book) {
         echo "\n". '<SCRIPT LANGUAGE=JavaScript><!--' . "\n" .