diff --git a/include/bbcode.php b/include/bbcode.php index e97a96f87..5ee3d5d5e 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -291,6 +291,12 @@ function bb_map_location($match) { return str_replace($match[0],'
' . generate_named_map($match[1]) . '
', $match[0]); } +function bbopentag($match) { + $rnd = mt_rand(); + return "
" . $match[1] . "
" . $match[2] . "
"; +} + + function bb_sanitize_style($input) { //whitelist property limits (0 = no limitation) @@ -672,9 +678,7 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) { $endlessloop = 0; while ((strpos($Text, "[/open]")!== false) and (strpos($Text, "[open=") !== false) and (++$endlessloop < 20)) { $rnd = mt_rand(); - $Text = preg_replace("/\[open=(.*?)\](.*?)\[\/open\]/ism", - "
$1
$2
", - $Text); + $Text = preg_replace_callback("/\[open=(.*?)\](.*?)\[\/open\]/ism",'bbopentag',$Text); }