function ubb($text)
{
$text=htmlspecialchars($text);
$text=stripslashes($text);
$text=ereg_replace(\r\n,
,$text);
$text=ereg_replace(\r,
,$text);
$text=nl2br($text);
$text=preg_replace(/\\t/is, ,$text);
$text=ereg_replace( , ,$text);
$text=preg_replace(/\[h1\](.+?)\[\/h1\]/is,
\\1,$text);
$text=preg_replace(/\[h2\](.+?)\[\/h2\]/is,\\1,$text);
$text=preg_replace(/\[h3\](.+?)\[\/h3\]/is,\\1,$text);
$text=preg_replace(/\[h4\](.+?)\[\/h4\]/is,\\1,$text);
$text=preg_replace(/\[h5\](.+?)\[\/h5\]/is,\\1,$text);
$text=preg_replace(/\[h6\](.+?)\[\/h6\]/is,\\1,$text);
$text=preg_replace(/\[center\](.+?)\[\/center\]/is,\\1,$text);
$text=preg_replace(/\[big\](.+?)\[\/big\]/is,\\1,$text);
$text=preg_replace(/\[small\](.+?)\[\/small\]/is,\\1,$text);
$text=preg_replace(/\[url\](http:\/\/.+?)\[\/url\]/is,\\1,$text);
$text=preg_replace(/\[url\](.+?)\[\/url\]/is,http://\\1,$text);
$text=preg_replace(/\[url=(http:\/\/.+?)\](.*)\[\/url\]/is,\\2,$text);
$text=preg_replace(/\[url=(.+?)\](.*)\[\/url\]/is,\\2,$text);
$text=preg_replace(/\[img\](.+?)\[\/img\]/is,,$text);
$text=preg_replace(/\[color=(.+?)\](.+?)\[\/color\]/is,\\2,$text);
$text=preg_replace(/\[size=(.+?)\](.+?)\[\/size\]/is,\\2,$text);
$text=preg_replace(/\[sup\](.+?)\[\/sup\]/is,\\1,$text);
$text=preg_replace(/\[sub\](.+?)\[\/sub\]/is,\\1,$text);
$text=preg_replace(/\[pre\](.+?)\[\/pre\]/is,\\1
,$text);
$text=preg_replace(/\[email\](.+?)\[\/email\]/is,\\1,$text);
$text=preg_replace(/\[i\](.+?)\[\/i\]/is,\\1,$text);
$text=preg_replace(/\[b\](.+?)\[\/b\]/is,\\1,$text);
$text=preg_replace(/\[quote\](.+?)\[\/quote\]/is,quote:\\1, $text);
$pattern = /(\[uploadimage\])(\d+),(.*)(\[\/uploadimage\])/u;
$replacement = ;
$text =@preg_replace($pattern, $replacement, $text);
$str = $text;
$pattern='#\[flash=(\d+),(\d+)\](.+)\[/flash\]#';
$last =
[全屏欣赏 提醒:flash中可能包含不安全内容]
;
$text= preg_replace($pattern, $last, $str);
$mpg =
;
$text =preg_replace('#\[mp=(\d+),(\d+)\](.+)\[/mp\]#', $mpg, $text);
return @iconv('utf-8','gbk',@iconv('gbk','utf-8',$text));
}
