dede发布内容限制违规词
DEDE限制违规词代码
//词汇过滤检查 if( $cfg_notallowstr != '' ) { if(preg_match("#".$cfg_notallowstr."#i", $title,$mc)) { foreach($mc as $k=>$v){ $i = $v; } ShowMsg("文章标题涉及违规词“".$i."”请删除","-1"); exit(); } if(preg_match("#".$cfg_notallowstr."#i", $shorttitle,$mc)) { foreach($mc as $k=>$v){ $i = $v; } ShowMsg("文章简略标题涉及违规词“".$i."”请删除","-1"); exit(); } if(preg_match("#".$cfg_notallowstr."#i", $description,$mc)) { foreach($mc as $k=>$v){ $i = $v; } ShowMsg("文章摘要涉及违规词“".$i."”请删除","-1"); exit(); } if(preg_match("#".$cfg_notallowstr."#i", $body,$mc)) { foreach($mc as $k=>$v){ $i = $v; } ShowMsg("文章内容涉及违规词“".$i."”请删除","-1"); exit(); } }
在/dede/article_edit.php
在/dede/article_add.php中的代码:大概在118行
if(!TestPurview('a_Check,a_AccCheck,a_MyCheck'))
{
$arcrank = -1;
}
之前添加代码:
在这里添加违规词
以下跟上面无关,纯留着自己看
//词汇过滤检查 if( $cfg_notallowstr != '' ){ if(preg_match("#".$cfg_notallowstr."#i", $title,$mc)){ $titlesql = "SELECT * FROM `#@__archives` WHERE senddate>1678464000 and title like '%$mc[0]%' "; $dsql->SetQuery($titlesql); $dsql->Execute(); $num = $dsql->GetTotalRow(); if($num>1){ ShowMsg("文章标题有关键词“".$mc[0]."”重复,不能发布,请修改!!!","-1"); exit(); } } }