stekkel %!s(int64=22) %!d(string=hai) anos
pai
achega
ecba9561b9
Modificáronse 2 ficheiros con 26 adicións e 6 borrados
  1. 15 1
      functions/mime.php
  2. 11 5
      src/compose.php

+ 15 - 1
functions/mime.php

@@ -547,7 +547,7 @@ function decodeBody($body, $encoding) {
  * Patched by Christian Schmidt <christian@ostenfeld.dk>  23/03/2002
  */
 function decodeHeader ($string, $utfencode=true,$htmlsave=true) {
-    global $languages, $squirrelmail_language;
+    global $default_charset, $languages, $squirrelmail_language;
     if (is_array($string)) {
         $string = implode("\n", $string);
     }
@@ -561,6 +561,11 @@ function decodeHeader ($string, $utfencode=true,$htmlsave=true) {
     $i = 0;
     $iLastMatch = -2;
     $encoded = false;
+
+    if (strtolower($default_charset) == 'iso-8859-1') {
+        $string = str_replace("\240",' ',$string);
+    }
+
     $aString = explode(' ',$string);
     $ret = '';
     foreach ($aString as $chunk) {
@@ -629,6 +634,15 @@ function decodeHeader ($string, $utfencode=true,$htmlsave=true) {
         }
         ++$i;
     }
+    /* remove the first added space */
+    if ($ret) {
+        if ($htmlsave) {
+            $ret = substr($ret,6);
+        } else {
+            $ret = substr($ret,1);
+        }
+    }
+    
     return $ret;
 }
 

+ 11 - 5
src/compose.php

@@ -361,7 +361,9 @@ if ($send) {
             } else {
                 sqWordWrap($line, $editor_size);
                 $newBody .= $line . "\n";
+	
             }
+	    
         }
         $body = $newBody;
         do_hook('compose_send');
@@ -655,10 +657,14 @@ function newMail ($mailbox='', $passed_id='', $passed_ent_id='', $action='', $se
         switch ($action) {
         case ('draft'):
             $use_signature = FALSE;
+            $composeMessage->rfc822_header = $orig_header;
             $send_to = decodeHeader($orig_header->getAddr_s('to'),false,true);
             $send_to_cc = decodeHeader($orig_header->getAddr_s('cc'),false,true);
             $send_to_bcc = decodeHeader($orig_header->getAddr_s('bcc'),false,true);            
             $subject = decodeHeader($orig_header->subject,false,true);
+//            /* remember the references and in-reply-to headers in case of an reply */
+//            $composeMessage->rfc822_header->more_headers['References'] = $orig_header->references;
+//            $composeMessage->rfc822_header->more_headers['In-Reply-To'] = $orig_header->in_reply_to;
             $body_ary = explode("\n", $body);
             $cnt = count($body_ary) ;
             $body = '';
@@ -1022,21 +1028,21 @@ function showInputForm ($session, $values=false) {
             if ($default_charset == 'iso-2022-jp') {
                 echo "\n\n".($prefix_sig==true? "-- \n":'').mb_convert_encoding($signature, 'EUC-JP');
             } else {
-            echo "\n\n".($prefix_sig==true? "-- \n":'').decodeHeader($signature,false);
+            echo "\n\n".($prefix_sig==true? "-- \n":'').decodeHeader($signature,false,false);
             }
-            echo "\n\n".decodeHeader($body,false,true);
+            echo "\n\n".decodeHeader($body,false,false);
         }
         else {
-            echo "\n\n".decodeHeader($body,false,true);
+            echo "\n\n".decodeHeader($body,false,false);
             if ($default_charset == 'iso-2022-jp') {
                 echo "\n\n".($prefix_sig==true? "-- \n":'').mb_convert_encoding($signature, 'EUC-JP');
             }else{
-            echo "\n\n".($prefix_sig==true? "-- \n":'').decodeHeader($signature,false,true);
+            echo "\n\n".($prefix_sig==true? "-- \n":'').decodeHeader($signature,false,false);
         }
     }
     }
     else {
-       echo decodeHeader($body,false,true);
+       echo decodeHeader($body,false,false);
     }
     echo '</textarea><br />' . "\n" .
          '      </td>' . "\n" .