From: Michael M Slusarz Date: Sat, 24 Jul 2010 18:47:22 +0000 (-0600) Subject: More HTML viewer tweaking X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=1e8a8e1c7d1168063a23c67f389678085a6d9881;p=horde.git More HTML viewer tweaking --- diff --git a/imp/lib/Mime/Viewer/Html.php b/imp/lib/Mime/Viewer/Html.php index 489b80749..81a0763bd 100644 --- a/imp/lib/Mime/Viewer/Html.php +++ b/imp/lib/Mime/Viewer/Html.php @@ -159,6 +159,7 @@ class IMP_Horde_Mime_Viewer_Html extends Horde_Mime_Viewer_Html 'noprefetch' => ($inline && ($_SESSION['imp']['view'] != 'mimp')), 'phishing' => $inline )); + $status = array(); if ($this->_phishWarn) { $status[] = array( @@ -326,11 +327,27 @@ class IMP_Horde_Mime_Viewer_Html extends Horde_Mime_Viewer_Html break; } - if ($this->_imptmp['img'] && $node->hasAttribute('style')) { - $this->_imptmp['node'] = $node; - $style = preg_replace_callback('/(background(?:-image)?:[^;\}]*(?:url\(["\']?))(.*?)((?:["\']?\)))/i', array($this, '_styleCallback'), $node->getAttribute('style'), -1, $matches); - if ($matches) { - $node->setAttribute('style', $style); + + if (!is_null($this->_imptmp)) { + $remove = array(); + foreach ($node->attributes as $val) { + /* Catch random mailto: strings in attributes that will + * cause problems with e-mail linking. */ + if (stripos($val->value, 'mailto:') === 0) { + $remove[] = $val->name; + } + } + + foreach ($remove as $val) { + $node->removeAttribute($val); + } + + if ($this->_imptmp['img'] && $node->hasAttribute('style')) { + $this->_imptmp['node'] = $node; + $style = preg_replace_callback('/(background(?:-image)?:[^;\}]*(?:url\(["\']?))(.*?)((?:["\']?\)))/i', array($this, '_styleCallback'), $node->getAttribute('style'), -1, $matches); + if ($matches) { + $node->setAttribute('style', $style); + } } } }