summaryrefslogtreecommitdiff
path: root/roundcubemail/program/lib/washtml.php
diff options
context:
space:
mode:
authoralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2010-06-23 06:57:45 +0000
committeralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2010-06-23 06:57:45 +0000
commitc5d17bc98614cb09f7fc77b27482a7750f275171 (patch)
treecb33eba820467e06f04b81cd0b486618b20153b5 /roundcubemail/program/lib/washtml.php
parent630e543d76dd9d1eec9a0ef56afd103fe0999a69 (diff)
- Improve parsing of styled empty tags in HTML messages (#1486812)
git-svn-id: https://svn.roundcube.net/trunk@3778 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/lib/washtml.php')
-rw-r--r--roundcubemail/program/lib/washtml.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/roundcubemail/program/lib/washtml.php b/roundcubemail/program/lib/washtml.php
index fcd28395e..bccbd3df3 100644
--- a/roundcubemail/program/lib/washtml.php
+++ b/roundcubemail/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 (<tag />) */
- 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</$tagName>" : ' />');
+ // 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</$tagName>" : ' />');
}
else if (isset($this->_ignore_elements[$tagName])) {
$dump .= '<!-- ' . htmlspecialchars($tagName, ENT_QUOTES) . ' not allowed -->';