Hi,
i changed 'include/functions.inc.php' to use regular expression replace instead of string replace. The advantage is, that unclosed tags will not be processed.
Additionally i added some new bbcode tags.
Open 'include/functions.inc.php' and find:
function bb_decode($text)
{
Comment out:
// [b] and [/b] for bolding text.
$text = str_replace("[b]", '<b>', $text);
$text = str_replace("[/b]", '</b>', $text);
// [u] and [/u] for underlining text.
$text = str_replace("[u]", '<u>', $text);
$text = str_replace("[/u]", '</u>', $text);
// [i] and [/i] for italicizing text.
$text = str_replace("[i]", '<i>', $text);
$text = str_replace("[/i]", '</i>', $text);
// colours
$text = preg_replace("/\[color=(\#[0-9A-F]{6}|[a-z]+)\]/", '<span style="color:$1">', $text);
$text = str_replace("[/color]", '</span>', $text);
and add:
//preg_replace() instead of str_replace() to prevent unclosed tags
$text = preg_replace("/\[b\](.*)\[\/b\]/Usi", "<b>\\1</b>", $text);
$text = preg_replace("/\[u\](.*)\[\/u\]/Usi", "<u>\\1</u>", $text);
$text = preg_replace("/\[i\](.*)\[\/i\]/Usi", "<i>\\1</i>", $text);
$text = preg_replace("/\[color=(\#[0-9A-F]{6}|[a-z]+)\](.*)\[\/color\]/Usi", "<span style=\"color:\\1\">\\2</span>", $text);
//some new tags
$text = preg_replace("/\[s\](.*)\[\/s\]/Usi", "<span style=\"text-decoration: line-through\">\\1</span>", $text);
$text = preg_replace("/\[size=(.*)\](.*)\[\/size\]/Usi", "<span style=\"font-size:\\1ex\">\\2</span>", $text);
$text = preg_replace("/\[quote](.*)\[\/quote\]/Uis", "<div>Quote:</div><div style=\"border:solid 1px;\">\\1</div>", $text);
$text = preg_replace("/\[quote=(.*)](.*)\[\/quote\]/Uis", "<div>Quote from: \\1</div><div style=\"border:solid 1px;\">\\2</div>", $text);
Keep in mind, that the language of the quote tag is hard-coded yet.
-
muu