From 1ca4d3b8c39672236f963c7f22223098b2aa8259 Mon Sep 17 00:00:00 2001 From: Janos SUTO Date: Wed, 27 Sep 2023 18:51:26 +0200 Subject: [PATCH] Added error handling to $parts array iteration Signed-off-by: Janos SUTO --- webui/model/search/message.php | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/webui/model/search/message.php b/webui/model/search/message.php index 4d132ea8..1bd73450 100644 --- a/webui/model/search/message.php +++ b/webui/model/search/message.php @@ -180,17 +180,19 @@ class ModelSearchMessage extends Model { 'text/html' => '' ); - for($i=0; $imessage['text/html'] .= $purifier->purify($body); + if($parts[$i]['headers']['content-type']['type'] == 'text/html') { + $this->message['text/html'] .= $purifier->purify($body); + } + else { + $this->message['text/plain'] .= $body; + } } - else { - $this->message['text/plain'] .= $body; - } - + } else { + $this->message_array[CONST_TEXTPLAIN] = 'EMPTY_MESSAGE_BODY'; } return array('from' => $from,