';
if ($part->ctype_secondary != 'plain')
- $out .= rcmail_sanitize_html($body, $attrib['id']);
+ $out .= rcmail_html4inline($body, $attrib['id']);
else
$out .= $body;
@@ -1068,12 +754,11 @@ function rcmail_message_body($attrib)
-// modify a HTML message that it can be displayed inside a HTML page
-function rcmail_sanitize_html($body, $container_id)
+/**
+ * modify a HTML message that it can be displayed inside a HTML page
+ */
+function rcmail_html4inline($body, $container_id)
{
- // remove any null-byte characters before parsing
- $body = preg_replace('/\x00/', '', $body);
-
$base_url = "";
$last_style_pos = 0;
$body_lc = strtolower($body);
@@ -1095,26 +780,6 @@ function rcmail_sanitize_html($body, $container_id)
$last_style_pos = $pos2;
}
-
- // remove SCRIPT tags
- foreach (array('script', 'applet', 'object', 'embed', 'iframe') as $tag)
- {
- while (($pos = strpos($body_lc, '<'.$tag)) && (($pos2 = strpos($body_lc, ''.$tag.'>', $pos)) || ($pos3 = strpos($body_lc, '>', $pos))))
- {
- $end = $pos2 ? $pos2 + strlen(''.$tag.'>') : $pos3 + 1;
- $body = substr($body, 0, $pos) . substr($body, $end, strlen($body)-$end);
- $body_lc = strtolower($body);
- }
- }
-
- // replace event handlers on any object
- while ($body != $prev_body)
- {
- $prev_body = $body;
- $body = preg_replace('/(<[^!][^>]*\s)on(?:load|unload|click|dblclick|mousedown|mouseup|mouseover|mousemove|mouseout|focus|blur|keypress|keydown|keyup|submit|reset|select|change)=([^>]+>)/im', '$1__removed=$2', $body);
- $body = preg_replace('/(<[^!][^>]*\shref=["\']?)(javascript:)([^>]*?>)/im', '$1null:$3', $body);
- }
-
// resolve
if ($base_url)
{
@@ -1138,14 +803,8 @@ function rcmail_sanitize_html($body, $container_id)
$body);
$out = preg_replace(
- array(
- '/]*)>/i',
- '/<\/body>/i',
- ),
- array(
- '
',
- '
',
- ),
+ array('/]*)>/i', '/<\/body>/i'),
+ array('
', '
'),
$out);
// quote of php and xml files that are specified as text/html
@@ -1155,7 +814,9 @@ function rcmail_sanitize_html($body, $container_id)
}
-// parse link attributes and set correct target
+/**
+ * parse link attributes and set correct target
+ */
function rcmail_alter_html_link($tag, $attrs, $container_id)
{
$attrib = parse_attrib_string($attrs);
@@ -1176,7 +837,9 @@ function rcmail_alter_html_link($tag, $attrs, $container_id)
}
-// decode address string and re-format it as HTML links
+/**
+ * decode address string and re-format it as HTML links
+ */
function rcmail_address_string($input, $max=NULL, $addicon=NULL)
{
global $IMAP, $PRINT_MODE, $CONFIG, $OUTPUT, $EMAIL_ADDRESS_PATTERN;
@@ -1277,7 +940,9 @@ function rcmail_message_part_frame($attrib)
}
-// clear message composing settings
+/**
+ * clear message composing settings
+ */
function rcmail_compose_cleanup()
{
if (!isset($_SESSION['compose']))