diff options
author | Aleksander Machniak <alec@alec.pl> | 2012-06-04 14:15:30 +0200 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2012-06-04 14:15:30 +0200 |
commit | aede1f9ab41e8dfc5272a149b1e88a464ce12f89 (patch) | |
tree | d02344a81254482f98332cf9c3ab2aedd1d47e8b /program/steps | |
parent | ea3021cee38826832b154895903171704016c8b8 (diff) |
Fix possible PHP warning: strpos(): Offset not contained in string
Diffstat (limited to 'program/steps')
-rw-r--r-- | program/steps/mail/func.inc | 11 |
1 files changed, 6 insertions, 5 deletions
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, '<style', $last_style_pos)) && ($pos2 = stripos($body, '</style>', $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 |