Reformat of html messages a bit cleaner
authorpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 19 Nov 2003 03:52:03 +0000 (03:52 +0000)
committerpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 19 Nov 2003 03:52:03 +0000 (03:52 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@6181 7612ce4b-ef26-0410-bec9-ea0150e637f0

src/compose.php

index 466bbfa1337289a113a9fe2645980cfd82a31a2c..a2b7399e039a65e8ad2cd633b963ee3e7ea0c8c8 100644 (file)
@@ -611,8 +611,11 @@ function newMail ($mailbox='', $passed_id='', $passed_ent_id='', $action='', $se
             $bodypart = decodeBody($unencoded_bodypart,
             $body_part_entity->header->encoding);
             if ($type1 == 'html') {
-                $bodypart = str_replace(array('&nbsp;','&gt;','&lt;'),array(' ','<','>'),$bodypart);
+                $bodypart = str_replace("\n", ' ', $bodypart);
+                $bodypart = preg_replace(array('/<p>/i','/<br\s*(\/)*>/i'), "\n", $bodypart);
+                $bodypart = str_replace(array('&nbsp;','&gt;','&lt;'),array(' ','>','<'),$bodypart);
                 $bodypart = strip_tags($bodypart);
+
             }
             if (isset($languages[$squirrelmail_language]['XTRA_CODE']) &&
                 function_exists($languages[$squirrelmail_language]['XTRA_CODE'])) {