问题:使用discuz文本编辑器设置文字背景,搜索页面搜索出来的帖子内容里面带有
解决方法:
\source\function\function_post.php 的messagecutstr方法中添加|backcolor过滤,如下
function messagecutstr($str, $length = 0, $dot = ' ...') {
global $_G;
$str = messagesafeclear($str);
$sppos = strpos($str, chr(0).chr(0).chr(0));
if($sppos !== false) {
$str = substr($str, 0, $sppos);
}
$language = lang('forum/misc');
loadcache(array('bbcodes_display', 'bbcodes', 'smileycodes', 'smilies', 'smileytypes', 'domainwhitelist'));
$bbcodes = 'b|i|u|p|color|size|font|align|list|indent|float|backcolor';
$bbcodesclear = 'email|code|free|table|tr|td|img|swf|flash|attach|media|audio|groupid|payto'.($_G['cache']['bbcodes_display'][$_G['groupid']] ? '|'.implode('|', array_keys($_G['cache']['bbcodes_display'][$_G['groupid']])) : '');
$str = strip_tags(preg_replace(array(
"/\[hide=?\d*\](.*?)\[\/hide\]/is",
"/\[quote](.*?)\[\/quote]/si",
$language['post_edit_regexp'],
"/\[url=?.*?\](.+?)\[\/url\]/si",
"/\[($bbcodesclear)=?.*?\].+?\[\/\\1\]/si",
"/\[($bbcodes)=?.*?\]/i",
"/\[\/($bbcodes)\]/i",
), array(
"$language[post_hidden]",
'',
'',
'\\1',
'',
'',
'',
), $str));
if($length) {
$str = cutstr($str, $length, $dot);
}
$str = preg_replace($_G['cache']['smilies']['searcharray'], '', $str);
if($_G['setting']['plugins']['func'][HOOKTYPE]['discuzcode']) {
$_G['discuzcodemessage'] = & $str;
$param = func_get_args();
hookscript('discuzcode', 'global', 'funcs', array('param' => $param, 'caller' => 'messagecutstr'), 'discuzcode');
}
return trim($str);
}
|