From be6f3a9d283198d6c6abb98fb540ab188b445f52 Mon Sep 17 00:00:00 2001 From: alecpl Date: Wed, 23 Jun 2010 06:57:45 +0000 Subject: - Improve parsing of styled empty tags in HTML messages (#1486812) --- CHANGELOG | 1 + program/lib/washtml.php | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index c87ef05a4..9859d34ef 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ CHANGELOG RoundCube Webmail =========================== +- Improve parsing of styled empty tags in HTML messages (#1486812) - Add %dc variable support in base_dn/bind_dn config (#1486779) - Add button to hide/unhide the preview pane (#1484215) - Fix no-cache headers on https to prevent content caching by proxies (#1486798) diff --git a/program/lib/washtml.php b/program/lib/washtml.php index fcd28395e..bccbd3df3 100644 --- a/program/lib/washtml.php +++ b/program/lib/washtml.php @@ -89,7 +89,7 @@ class washtml static $html_attribs = array('name', 'class', 'title', 'alt', 'width', 'height', 'align', 'nowrap', 'col', 'row', 'id', 'rowspan', 'colspan', 'cellspacing', 'cellpadding', 'valign', 'bgcolor', 'color', 'border', 'bordercolorlight', 'bordercolordark', 'face', 'marginwidth', 'marginheight', 'axis', 'border', 'abbr', 'char', 'charoff', 'clear', 'compact', 'coords', 'vspace', 'hspace', 'cellborder', 'size', 'lang', 'dir'); /* Block elements which could be empty but cannot be returned in short form () */ - static $block_elements = array('div', 'p', 'pre', 'blockquote', 'a', 'font'); + static $block_elements = array('div', 'p', 'pre', 'blockquote', 'a', 'font', 'center', 'table', 'ul', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'ol', 'dl'); /* State for linked objects in HTML */ public $extlinks = false; @@ -226,7 +226,9 @@ class washtml else if (isset($this->_html_elements[$tagName])) { $content = $this->dumpHtml($node); $dump .= '<' . $tagName . $this->wash_attribs($node) . - ($content != '' || isset($this->_block_elements[$tagName]) ? ">$content" : ' />'); + // create closing tag for block elements, but also for elements + // with content or with some attributes (eg. style, class) (#1486812) + ($content != '' || $node->hasAttributes() || isset($this->_block_elements[$tagName]) ? ">$content" : ' />'); } else if (isset($this->_ignore_elements[$tagName])) { $dump .= ''; -- cgit v1.2.3