function bb2($str)
{
if (preg_match('#\[(syntax)=\"(.+)\"\](.*)\[/syntax\]#isU', $str, $matches))
{
include_once('./system/application/libraries/geshi.php');
if ($matches[2] == 'es') {
$matches[2] = 'eventscripts';
}
$geshi =& new GeSHi($matches[3], $matches[2]);
$syntax = $geshi->parse_code();
} else {
$syntax = "";
}
$find = array('#\[ ?b *\](.+)\[ ?/b *\]#isU',
'#\[ ?i *\](.+)\[ ?/i *\]#isU',
'#\[ ?u *\](.+)\[ ?/u *\]#isU',
'#\[ ?s *\](.+)\[ ?/s *\]#isU',
'#\[(colou*r)=(.+)\](.*)\[\/\1\]#isU',
'#\[ ?quote *\](.+)\[ ?/quote *\]#isU',
'#\[ ?list *\](.+)\[ ?/list *\]#isU',
'#\[ ?\* *\](.+)\n#isU',
'#\[(size)=([0-9]*)\](.*)\[\/\1\]#isU',
'#\[(quote)=([a-z0-9]*)\](.*)\[\/\1\]#isU',
'#\[(syntax)=\"(.+)\"\](.*)\[/syntax\]#isU',
'#\[ ?code *\](.+)\[ ?/code *\]#isU',
'#\[ ?img *\](.+)\[ ?/img *\]#isU',
'#\[url=(https?:\/\/)([^\]]*)\](.*)\[\/url\]#isU',
'#\[url=([^\]]*)\](.*)\[\/url\]#isU',
'#\[url\](https?:\/\/)([^\[]*)\[\/url\]#isU',
'#\[url\]([^\[]*)\[\/url\]#isU',
'#\n#'
);
$replace = array('\1',
'\1',
'\1',
'\1',
'\3',
'
',
'',
'\1',
'\3',
'',
'',
'',
'
',
'\3',
'\2',
'\2',
'\1',
'
'
);
$str = preg_replace($find, $replace, $str);
return $str;
}