summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrobin <robin@208e9e7b-5314-0410-a742-e7e81cd9613c>2006-12-29 10:11:25 +0000
committerrobin <robin@208e9e7b-5314-0410-a742-e7e81cd9613c>2006-12-29 10:11:25 +0000
commite1f33b8eb68fe666b426105c189fb8874a01ff5c (patch)
tree42c2aa5dc0ce072b4d1ec1f7d0944a157dbaf9fd
parentdc5a874cc39a652799755ae0baa99508d8134b3e (diff)
Fix HTML cleanup (fixes #1484183)
git-svn-id: https://svn.roundcube.net/trunk@438 208e9e7b-5314-0410-a742-e7e81cd9613c
-rw-r--r--roundcubemail/program/steps/mail/func.inc8
1 files changed, 6 insertions, 2 deletions
diff --git a/roundcubemail/program/steps/mail/func.inc b/roundcubemail/program/steps/mail/func.inc
index 257502e15..e12208d46 100644
--- a/roundcubemail/program/steps/mail/func.inc
+++ b/roundcubemail/program/steps/mail/func.inc
@@ -1210,8 +1210,12 @@ function rcmail_mod_html_body($body, $container_id)
}
// replace event handlers on any object
- $body = preg_replace('/\s(on[^=]+)=/im', ' __removed=', $body);
- $body = preg_replace('/\shref=["\']?(javascript:)/im', 'null:', $body);
+ while ($body != $prev_body)
+ {
+ $prev_body = $body;
+ $body = preg_replace('/(<[^!][^>]*?\s)(on\w+?)(=[^>]*?>)/im', '$1__removed=$3', $body);
+ $body = preg_replace('/(<[^!][^>]*?\shref=["\']?)(javascript:)([^>]*?>)/im', '$1null:$3', $body);
+ }
// resolve <base href>
$base_reg = '/(<base.*href=["\']?)([hftps]{3,5}:\/{2}[^"\'\s]+)([^<]*>)/i';