return $ret;
}
- if (!$struc->parts) {
+ if (empty($struc->parts)) {
$ret['body'] = self::messageGetPart($mbox, $uid, $struc, 0, 'html');
$html = $ret['body'];
'[\r\n]\s*-----BEGIN PGP SIGNATURE-----\s*[\r\n].*'.
'[\r\n]\s*-----END PGP SIGNATURE-----(.*)/is';
- preg_match($pattern, $message, $result);
-
- $cleaned = trim($result[1].$result[2].$result[3]);
+ if (preg_match($pattern, $message, $result)) {
+ $cleaned = trim($result[1].$result[2].$result[3]);
- $cleaned = str_replace(["\n- --\n", "\n- -"], ["\n-- \n", "\n-"], $cleaned);
-
- if ($cleaned == '') {
+ $cleaned = str_replace(["\n- --\n", "\n- -"], ["\n-- \n", "\n-"], $cleaned);
+ } else {
$cleaned = $message;
}
preg_match($pattern, $message, $result);
- if (($result[1] != '') && ($result[2] != '')) {
+ if (!empty($result[1]) && !empty($result[2])) {
$cleaned = trim($result[1])."\n";
$sig = trim($result[2]);
} else {
}
$quotelevel = 0;
- $nextline = trim($arrbody[$i+1]);
+ $nextline = trim(defaults($arrbody, $i + 1, ''));
while ((strlen($nextline)>0) && ((substr($nextline, 0, 1) == '>')
|| (substr($nextline, 0, 1) == ' '))) {
if (substr($nextline, 0, 1) == '>') {
(substr(rtrim($line), -7) == '[/size]'));
}
- if ($lines[$lineno] != '') {
+ if (!empty($lines[$lineno])) {
if (substr($lines[$lineno], -1) != ' ') {
$lines[$lineno] .= ' ';
}
$line = ltrim(substr($line, 1));
}
+ } else {
+ $lines[$lineno] = '';
}
$lines[$lineno] .= $line;
if (((substr($line, -1, 1) != ' '))
|| ($quotelevel != $currquotelevel)) {
$lineno++;
- }
+ }
}
return implode("\n", $lines);
}