diff options
author | friendica <info@friendica.com> | 2011-11-27 13:44:45 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2011-11-27 13:44:45 -0800 |
commit | 1055ef3eead49d5822b9f373fc7e39bb5016d4ba (patch) | |
tree | 627b674238c2077201c42029128e55a8b6585b2b /include/bbcode.php | |
parent | cf7568efd72e93f1807c8560b78cae2580667413 (diff) | |
download | volse-hubzilla-1055ef3eead49d5822b9f373fc7e39bb5016d4ba.tar.gz volse-hubzilla-1055ef3eead49d5822b9f373fc7e39bb5016d4ba.tar.bz2 volse-hubzilla-1055ef3eead49d5822b9f373fc7e39bb5016d4ba.zip |
more readable private image extraction for bypassing preg limits
Diffstat (limited to 'include/bbcode.php')
-rw-r--r-- | include/bbcode.php | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/include/bbcode.php b/include/bbcode.php index 71745de58..1ad81d26f 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -36,16 +36,15 @@ function bbcode($Text,$preserve_nl = false) { $saved_image = ''; $img_start = strpos($Text,'[img]data:'); - if($img_start !== false) { + $img_end = strpos($Text,'[/img]'); + + if($img_start !== false && $img_end !== false && $img_end > $img_start) { $start_fragment = substr($Text,0,$img_start); $img_start += strlen('[img]'); - $saved_image = substr($Text,$img_start); - $img_end = strpos($saved_image,'[/img]'); - $saved_image = substr($saved_image,0,$img_end); - logger('saved_image: ' . $saved_image); - $img_end += strlen('[/img]'); - $Text = $start_fragment . '[$#saved_image#$]' . substr($Text,strlen($start_fragment) + strlen('[img]') + $img_end); - + $saved_image = substr($Text,$img_start,strpos($Text,'[/img]')); + $end_fragment = substr($Text,$img_end + strlen('[/img]')); +// logger('saved_image: ' . $saved_image,LOGGER_DEBUG); + $Text = $start_fragment . '[$#saved_image#$]' . $end_fragment; } // If we find any event code, turn it into an event. |