php 禁词发布,如何为dedecms织梦模板发布文章添加禁用词语过滤功能

dedecms(本例为V57_UTF8_SP1)中在互动部分有词语过滤功能,但是文章部分没有添加此功能,我们自己手动添加下发布文章禁用词语过滤功能。

9c0fc271308f785e07e92a2e79b4715a.png

在/dede/article_add.php中的代码:

if(!TestPurview('a_Check,a_AccCheck,a_MyCheck'))

{

$arcrank = -1;

}

之前添加代码:

//词汇过滤检查

if( $cfg_notallowstr != '' )

{

if(preg_match("#".$cfg_notallowstr."#i", $title))

{

ShowMsg("title has not allow words!","-1");

exit();

}

if(preg_match("#".$cfg_notallowstr."#i", $shorttitle))

{

ShowMsg("shorttitle has not allow words!!","-1");

exit();

}

if(preg_match("#".$cfg_notallowstr."#i", $description))

{

ShowMsg("description has not allow words!","-1");

exit();

}

if(preg_match("#".$cfg_notallowstr."#i", $body))

{

ShowMsg("body has not allow words!","-1");

exit();

}

}

同时修改/dede/article_edit.php中对应代码部分就可以了。

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值