From aede1f9ab41e8dfc5272a149b1e88a464ce12f89 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Mon, 4 Jun 2012 14:15:30 +0200 Subject: Fix possible PHP warning: strpos(): Offset not contained in string --- program/steps/mail/func.inc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'program/steps') diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index 33041d43d..1e5dbda19 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -1193,14 +1193,15 @@ function rcmail_html4inline($body, $container_id, $body_id='', &$attributes=null // find STYLE tags while (($pos = stripos($body, '', $pos))) { - $pos = strpos($body, '>', $pos)+1; + $pos = strpos($body, '>', $pos) + 1; + $len = $pos2 - $pos; // replace all css definitions with #container [def] - $styles = rcmail_mod_css_styles( - substr($body, $pos, $pos2-$pos), $cont_id, $allow_remote); + $styles = substr($body, $pos, $len); + $styles = rcmail_mod_css_styles($styles, $cont_id, $allow_remote); - $body = substr_replace($body, $styles, $pos, $pos2-$pos); - $last_style_pos = $pos2; + $body = substr_replace($body, $styles, $pos, $len); + $last_style_pos = $pos2 + strlen($styles) - $len; } // modify HTML links to open a new window if clicked -- cgit v1.2.3