From ff518666cf0f6315560d118caec19bdb7cd145d9 Mon Sep 17 00:00:00 2001 From: x2003bruneau Date: Fri, 2 Feb 2007 21:23:18 +0000 Subject: [PATCH] Fix HMTL attribute value catcher git-svn-id: svn+ssh://murphy/home/svn/banana/trunk@193 9869982d-c50d-0410-be91-f2a2ec7c7c7b --- banana/message.func.inc.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/banana/message.func.inc.php b/banana/message.func.inc.php index e50023e..be686ec 100644 --- a/banana/message.func.inc.php +++ b/banana/message.func.inc.php @@ -284,10 +284,10 @@ function banana_cleanStyles($tag, $attributes) $attributes = str_replace("\n", ' ', stripslashes($attributes)); $attributes = str_replace('= "', '="', $attributes); foreach ($conv as $att=>$stl) { - $pattern = '/\b' . preg_quote($att, '/') . '="(.+?)"/i'; + $pattern = '/\b' . preg_quote($att, '/') . '=([\'"])?(.+?)(?(1)\1|(?:$| ))/i'; if (preg_match($pattern, $attributes, $matches)) { $attributes = preg_replace($pattern, '', $attributes); - $val = $matches[1]; + $val = $matches[2]; if ($att == 'cellspacing' && strpos($style, 'border-collapse') === false) { $style .= "border-collapse: separate; border-spacing: $val $val; "; } elseif ($att == 'cellpadding' && $tag == 'table') { @@ -381,7 +381,7 @@ function banana_cleanHtml($source, $to_xhtml = false) // Use inlined style instead of old html attributes if ($to_xhtml) { - $source = preg_replace('/<(\/?\w+)(.*?)(\/?>)/ise', "'<\\1' . banana_cleanStyles('\\1', '\\2') . '\\3'", $source); + $source = preg_replace('/<(\/?\w+)(.*?)(\/?>)/uise', "'<\\1' . banana_cleanStyles('\\1', '\\2') . '\\3'", $source); } return preg_replace('/<(.*?)>/ie', "'<'.banana_removeEvilAttributes('\\1').'>'", $source); } -- 2.1.4