diff --git a/webui/model/search/message.php b/webui/model/search/message.php index 395fbfd..0a799d4 100644 --- a/webui/model/search/message.php +++ b/webui/model/search/message.php @@ -40,6 +40,12 @@ } + private function normalize_message($data = '') { + $a = preg_split("/\r?\n/", $data); + return implode("\r\n", $a); + } + + public function get_raw_message($id = '') { $s = ''; diff --git a/webui/system/helper/mime.php b/webui/system/helper/mime.php index 9e5d585..ff2b77b 100644 --- a/webui/system/helper/mime.php +++ b/webui/system/helper/mime.php @@ -53,7 +53,7 @@ $start = 0; $res = array(); - $body = self::remove_LF($body); + $body = self::remove_CR($body); // Extract the mime parts excluding the boundary itself @@ -96,7 +96,7 @@ $headers = []; $body = ''; - $message = self::remove_LF($message); + $message = self::remove_CR($message); // Find an empty line between headers and body, otherwise we got a header-only message @@ -144,22 +144,12 @@ public static function removeJournal(&$message, $EOL = "\n") { $has_journal = 0; - $crlfs = substr_count($message, "\r\n"); - self::splitMessageRaw($message, $headers, $journal, $body); if($journal) { $has_journal = 1; } - // If the message has >10 CRLF sequences, then we assume - // that we need to restore the removed LF characters - if($crlfs > 10) { - $headers = str_replace("\n", "\r\n", $headers); - $body = str_replace("\n", "\r\n", $body); - $EOL = "\r\n"; - } - $message = $headers . $EOL . $EOL . $body; return $has_journal; @@ -299,7 +289,7 @@ } - public static function remove_LF($message = '') { + public static function remove_CR($message = '') { return str_replace("\r", "", $message); //return preg_replace("/\r/", "", $message); }