summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2008-09-17 07:47:32 +0000
committeralecpl <alec@alec.pl>2008-09-17 07:47:32 +0000
commit7f62581c10435b319806ffec786d3b8389126574 (patch)
tree0cf543c6db37f168d72813a7677304403b089a7e
parente11bc4aa9ee0e30d7283f8732992dfc3f9abfea1 (diff)
- Smart Tags and NOBR tag support in html messages (#1485363, #1485327)
-rw-r--r--CHANGELOG1
-rw-r--r--program/lib/washtml.php2
-rw-r--r--program/steps/mail/func.inc11
3 files changed, 13 insertions, 1 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 7e8bee0e7..35bda9716 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -9,6 +9,7 @@ CHANGELOG RoundCube Webmail
- Added icons for forwarded/forwarded+replied messages (#1485257)
- Added Reply-To to forwarded emails (#1485315)
- Display progress message for folders create/delete/rename (#1485357)
+- Smart Tags and NOBR tag support in html messages (#1485363, #1485327)
2008/09/15 (thomasb)
----------
diff --git a/program/lib/washtml.php b/program/lib/washtml.php
index 0cb4b2000..de3b55e3e 100644
--- a/program/lib/washtml.php
+++ b/program/lib/washtml.php
@@ -74,7 +74,7 @@
class washtml
{
/* Allowed HTML elements (default) */
- static $html_elements = array('a', 'abbr', 'acronym', 'address', 'area', 'b', 'basefont', 'bdo', 'big', 'blockquote', 'br', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'dd', 'del', 'dfn', 'dir', 'div', 'dl', 'dt', 'em', 'fieldset', 'font', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'i', 'ins', 'label', 'legend', 'li', 'map', 'menu', 'ol', 'p', 'pre', 'q', 's', 'samp', 'small', 'span', 'strike', 'strong', 'sub', 'sup', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'tr', 'tt', 'u', 'ul', 'var', 'img');
+ static $html_elements = array('a', 'abbr', 'acronym', 'address', 'area', 'b', 'basefont', 'bdo', 'big', 'blockquote', 'br', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'dd', 'del', 'dfn', 'dir', 'div', 'dl', 'dt', 'em', 'fieldset', 'font', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'i', 'ins', 'label', 'legend', 'li', 'map', 'menu', 'nobr', 'ol', 'p', 'pre', 'q', 's', 'samp', 'small', 'span', 'strike', 'strong', 'sub', 'sup', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'tr', 'tt', 'u', 'ul', 'var', 'img');
/* Ignore these HTML tags but process their content */
static $ignore_elements = array('html', 'head', 'body');
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 7e9f0fec3..3995bffe3 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -611,6 +611,17 @@ function rcmail_print_body($part, $p = array())
// PHP bug #32547 workaround: remove title tag
$html = preg_replace('/<title>.*<\/title>/', '', $html);
+ // special replacements (not properly handled by washtml class)
+ $html_search = array(
+ '/(<\/nobr>)(\s+)(<nobr>)/i', // space(s) between <NOBR>
+ '/(<[\/]*st1:[^>]+>)/i', // Microsoft's Smart Tags <ST1>
+ );
+ $html_replace = array(
+ '\\1'.' &nbsp; '.'\\3',
+ '',
+ );
+ $html = preg_replace($html_search, $html_replace, $html);
+
// clean HTML with washhtml by Frederic Motte
$wash_opts = array(
'show_washed' => false,