summaryrefslogtreecommitdiff
path: root/roundcubemail/program/steps/mail
diff options
context:
space:
mode:
authorthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2008-09-16 13:02:53 +0000
committerthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2008-09-16 13:02:53 +0000
commitef7b30a642aa3afd3e42b8aa819903dddb32e9c5 (patch)
tree1894ddf9e51921cc45032a97cb9a70122ae7af8f /roundcubemail/program/steps/mail
parentb8de530e9f6bafc14badb7301a0be6e0880ec1e6 (diff)
Fix typos + only add callback for style tags when safe-flag is set
git-svn-id: https://svn.roundcube.net/trunk@1804 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/steps/mail')
-rw-r--r--roundcubemail/program/steps/mail/func.inc17
1 files changed, 8 insertions, 9 deletions
diff --git a/roundcubemail/program/steps/mail/func.inc b/roundcubemail/program/steps/mail/func.inc
index 6d23b6f8e..02bc4dce2 100644
--- a/roundcubemail/program/steps/mail/func.inc
+++ b/roundcubemail/program/steps/mail/func.inc
@@ -611,14 +611,13 @@ function rcmail_print_body($part, $p = array())
$wash_opts['html_elements'] = array('html','head','title','body');
}
- // allow CSS styles, will be sanitized by rcmail_washtml_callback()
- if ($p['safe']) {
- $wash_opts['html_elements'][] = 'style';
- }
-
$washer = new washtml($wash_opts);
$washer->add_callback('form', 'rcmail_washtml_callback');
- $washer->add_callback('style', 'rcmail_washtml_callback');
+
+ if ($p['safe']) { // allow CSS styles, will be sanitized by rcmail_washtml_callback()
+ $washer->add_callback('style', 'rcmail_washtml_callback');
+ }
+
$body = $washer->wash($html);
$REMOTE_OBJECTS = $washer->extlinks;
@@ -708,10 +707,10 @@ function rcmail_washtml_callback($tagname, $attrib, $content)
case 'style':
// decode all escaped entities and reduce to ascii strings
- $stripped = preg_replace('/[^a-zA-Z\(:]/', '', rcmail_xss_entitiy_decode($source));
+ $stripped = preg_replace('/[^a-zA-Z\(:]/', '', rcmail_xss_entitiy_decode($content));
- // now check for evli strings like expression, behavior or url()
- if (!preg_match('/expression|behavior|url\(|import/', $css)) {
+ // now check for evil strings like expression, behavior or url()
+ if (!preg_match('/expression|behavior|url\(|import/', $stripped)) {
$out = html::tag('style', array('type' => 'text/css'), $content);
break;
}