- Fix incorrect word wrapping in outgoing plaintext multibyte messages (#1485714)
- Fix double footer in HTML message with embedded images
| | |
| | | CHANGELOG RoundCube Webmail |
| | | =========================== |
| | | |
| | | - Fix incorrect word wrapping in outgoing plaintext multibyte messages (#1485714) |
| | | - Fix double footer in HTML message with embedded images |
| | | - Fix TNEF implementation bug (#1485773) |
| | | - Fix incorrect row id parsing for LDAP contacts list (#1485784) |
| | | - Fix 'mode' parameter in sqlite DSN (#1485772) |
| | |
| | | return strrpos($haystack, $needle, $offset); |
| | | } |
| | | |
| | | /** |
| | | * Wrapper function for wordwrap |
| | | */ |
| | | function rc_wordwrap($string, $width=75, $break="\n", $cut=false) |
| | | { |
| | | if (!function_exists('mb_substr') || !function_exists('mb_strlen')) |
| | | return wordwrap($string, $width, $break, $cut); |
| | | |
| | | $para = explode($break, $string); |
| | | $string = ''; |
| | | while (count($para)) { |
| | | $list = explode(' ', array_shift($para)); |
| | | $len = 0; |
| | | while (count($list)) { |
| | | $line = array_shift($list); |
| | | $l = mb_strlen($line); |
| | | $newlen = $len + $l + ($len ? 1 : 0); |
| | | |
| | | if ($newlen <= $width) { |
| | | $string .= ($len ? ' ' : '').$line; |
| | | $len += ($len ? 1 : 0) + $l; |
| | | } else { |
| | | if ($l > $width) { |
| | | if ($cut) { |
| | | $start = 0; |
| | | while ($l) { |
| | | $str = mb_substr($line, $start, $width); |
| | | $strlen = mb_strlen($str); |
| | | $string .= ($len ? $break : '').$str; |
| | | $start += $strlen; |
| | | $l -= $strlen; |
| | | $len = $strlen; |
| | | } |
| | | } else { |
| | | $string .= ($len ? $break : '').$line; |
| | | if (count($list)) $string .= $break; |
| | | $len = 0; |
| | | } |
| | | } else { |
| | | $string .= $break.$line; |
| | | $len = $l; |
| | | } |
| | | } |
| | | } |
| | | if (count($para)) $string .= $break; |
| | | } |
| | | return $string; |
| | | } |
| | | |
| | | /** |
| | | * Read a specific HTTP request header |
| | |
| | | } |
| | | |
| | | // add title line(s) |
| | | $prefix = wordwrap(sprintf("On %s, %s wrote:\n", |
| | | $prefix = rc_wordwrap(sprintf("On %s, %s wrote:\n", |
| | | $MESSAGE->headers->date, |
| | | $MESSAGE->get_header('from')), 76); |
| | | |
| | |
| | | $prefix = substr($line, 0, $length); |
| | | |
| | | // Remove '> ' from the line, then wordwrap() the line |
| | | $line = wordwrap(substr($line, $length), $max - $length); |
| | | $line = rc_wordwrap(substr($line, $length), $max - $length); |
| | | |
| | | // Rebuild the line with '> ' at the beginning of each 'subline' |
| | | $newline = ''; |
| | |
| | | $line = rtrim($newline); |
| | | } |
| | | else { |
| | | $line = wordwrap($line, $max); |
| | | $line = rc_wordwrap($line, $max); |
| | | } |
| | | } |
| | | |
| | |
| | | "Disposition: manual-action/MDN-sent-manually; displayed\r\n"; |
| | | |
| | | $compose->headers($headers); |
| | | $compose->setTXTBody(wordwrap($body, 75, "\r\n")); |
| | | $compose->setTXTBody(rc_wordwrap($body, 75, "\r\n")); |
| | | $compose->addAttachment($report, 'message/disposition-notification', 'MDNPart2.txt', false, '7bit', 'inline'); |
| | | |
| | | $sent = rcmail_deliver_message($compose, $identity['email'], $mailto); |
| | |
| | | $MAIL_MIME->setHTMLBody($message_body . ($footer ? "\r\n<pre>".$footer.'</pre>' : '')); |
| | | |
| | | // add a plain text version of the e-mail as an alternative part. |
| | | $h2t = new html2text($message_body); |
| | | $plainTextPart = $h2t->get_text() . ($footer ? "\r\n".$footer : ''); |
| | | $h2t = new html2text($message_body, false, true, 0); |
| | | $plainTextPart = rc_wordwrap($h2t->get_text(), 75, "\r\n"). ($footer ? "\r\n".$footer : ''); |
| | | $plainTextPart = wordwrap($plainTextPart, 998, "\r\n", true); |
| | | if (!strlen($plainTextPart)) |
| | | if (!strlen($plainTextPart)) |
| | | { |
| | | // empty message body breaks attachment handling in drafts |
| | | $plainTextPart = "\r\n"; |
| | |
| | | } |
| | | else |
| | | { |
| | | $message_body = wordwrap($message_body, 75, "\r\n"); |
| | | $message_body = rc_wordwrap($message_body, 75, "\r\n"); |
| | | if ($footer) |
| | | $message_body .= "\r\n" . $footer; |
| | | $message_body = wordwrap($message_body, 998, "\r\n", true); |
| | |
| | | if ($isHtml && ($match > 0)) |
| | | { |
| | | $message_body = preg_replace($dispurl, ' src="'.$attachment['name'].'" ', $message_body); |
| | | $MAIL_MIME->setHTMLBody($message_body. ($footer ? "\r\n<pre>".$footer.'</pre>' : '')); |
| | | $MAIL_MIME->setHTMLBody($message_body); |
| | | $MAIL_MIME->addHTMLImage($attachment['path'], $attachment['mimetype'], $attachment['name']); |
| | | } |
| | | else |