From bace95407046ead3495ae50da090d45af8170b37 Mon Sep 17 00:00:00 2001 From: Janos SUTO Date: Thu, 1 Jun 2023 17:20:45 +0200 Subject: [PATCH] Improved sanitizing the restored emails Signed-off-by: Janos SUTO --- webui/model/mail/mail.php | 6 ++++++ webui/model/search/message.php | 8 -------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/webui/model/mail/mail.php b/webui/model/mail/mail.php index c9bdb740..14673bd0 100644 --- a/webui/model/mail/mail.php +++ b/webui/model/mail/mail.php @@ -12,6 +12,8 @@ class ModelMailMail extends Model { if($to == "" || strlen($msg) < 30){ return $ok; } + $msg = $this->normalize_message($msg); + if(REWRITE_MESSAGE_ID == 1) { $msg = preg_replace("/Message-ID:([^\n]+)\n/i", "Message-ID: <" . generate_random_string(25) . '@' . SITE_NAME . ">\n", $msg); } @@ -165,4 +167,8 @@ class ModelMailMail extends Model { } + private function normalize_message($data = '') { + $a = preg_split("/\r?\n/", $data); + return implode("\r\n", $a); + } } diff --git a/webui/model/search/message.php b/webui/model/search/message.php index bd575e9e..395fbfd9 100644 --- a/webui/model/search/message.php +++ b/webui/model/search/message.php @@ -40,12 +40,6 @@ class ModelSearchMessage extends Model { } - private function normalize_message($data = '') { - $a = preg_split("/\r?\n/", $data); - return implode("\r\n", $a); - } - - public function get_raw_message($id = '') { $s = ''; @@ -71,8 +65,6 @@ class ModelSearchMessage extends Model { $this->verification = $this->verify_message($id, $s); } - $s = $this->normalize_message($s); - if(Registry::get('auditor_user') == 0 && HEADER_LINE_TO_HIDE) { $s = preg_replace("/" . HEADER_LINE_TO_HIDE . ".{1,}(\n(\ |\t){1,}.{1,}){0,}" . "\n/i", "", $s); }