Fix undefined offset notices in Protocol\Email

This commit is contained in:
Hypolite Petovan 2019-01-14 00:05:51 -05:00
parent 2f427e9daa
commit 795268eb7a

View file

@ -514,7 +514,7 @@ class Email
preg_match($pattern, $message, $result); preg_match($pattern, $message, $result);
if (($result[1] != '') && ($result[2] != '')) { if (!empty($result[1]) && !empty($result[2])) {
$cleaned = trim($result[1])."\n"; $cleaned = trim($result[1])."\n";
$sig = trim($result[2]); $sig = trim($result[2]);
} else { } else {
@ -545,7 +545,7 @@ class Email
} }
$quotelevel = 0; $quotelevel = 0;
$nextline = trim($arrbody[$i+1]); $nextline = trim(defaults($arrbody, $i + 1, ''));
while ((strlen($nextline)>0) && ((substr($nextline, 0, 1) == '>') while ((strlen($nextline)>0) && ((substr($nextline, 0, 1) == '>')
|| (substr($nextline, 0, 1) == ' '))) { || (substr($nextline, 0, 1) == ' '))) {
if (substr($nextline, 0, 1) == '>') { if (substr($nextline, 0, 1) == '>') {
@ -575,7 +575,7 @@ class Email
(substr(rtrim($line), -7) == '[/size]')); (substr(rtrim($line), -7) == '[/size]'));
} }
if ($lines[$lineno] != '') { if (!empty($lines[$lineno])) {
if (substr($lines[$lineno], -1) != ' ') { if (substr($lines[$lineno], -1) != ' ') {
$lines[$lineno] .= ' '; $lines[$lineno] .= ' ';
} }
@ -585,6 +585,8 @@ class Email
$line = ltrim(substr($line, 1)); $line = ltrim(substr($line, 1));
} }
} else {
$lines[$lineno] = '';
} }
$lines[$lineno] .= $line; $lines[$lineno] .= $line;