This commit is contained in:
haoouba 2021-02-16 20:26:00 +08:00
parent dc5f12ffa6
commit 64efe2a03f
5 changed files with 82 additions and 4 deletions

View File

@ -25,11 +25,11 @@ function themeInit($self)
Helper::options()->commentsAntiSpam = false; Helper::options()->commentsAntiSpam = false;
/* 强奸用户关闭检查来源URL */ /* 强奸用户关闭检查来源URL */
Helper::options()->commentsCheckReferer = false; Helper::options()->commentsCheckReferer = false;
/* 强奸用户强制要求填写邮箱 */ /* 强奸用户要求填写邮箱 */
Helper::options()->commentsRequireMail = true; Helper::options()->commentsRequireMail = true;
/* 强奸用户强制要求无需填写url */ /* 强奸用户要求无需填写url */
Helper::options()->commentsRequireURL = false; Helper::options()->commentsRequireURL = false;
/* 强制用户开启评论回复 */ /* 强制用户评论回复 */
Helper::options()->commentsThreaded = true; Helper::options()->commentsThreaded = true;
/* 强制显示一页12篇文章 */ /* 强制显示一页12篇文章 */
$self->parameter->pageSize = 12; $self->parameter->pageSize = 12;

View File

@ -1,5 +1,7 @@
<?php <?php
/* 加强后台编辑器功能 */
Typecho_Plugin::factory('admin/write-post.php')->bottom = array('Editor', 'edit'); Typecho_Plugin::factory('admin/write-post.php')->bottom = array('Editor', 'edit');
Typecho_Plugin::factory('admin/write-page.php')->bottom = array('Editor', 'edit'); Typecho_Plugin::factory('admin/write-page.php')->bottom = array('Editor', 'edit');
@ -12,3 +14,26 @@ class Editor
echo "<script src='" . Helper::options()->themeUrl . '/typecho/editor/joe.editor.js' . "'></script>"; echo "<script src='" . Helper::options()->themeUrl . '/typecho/editor/joe.editor.js' . "'></script>";
} }
} }
/* 加强评论拦截功能 */
Typecho_Plugin::factory('Widget_Feedback')->comment = array('Intercept', 'message');
class Intercept
{
public static function message($comment)
{
/* 判断评论内容是否包含敏感词 */
if (Helper::options()->JSensitiveWords) {
if (_checkSensitiveWords(Helper::options()->JSensitiveWords, $comment['text'])) {
throw new Typecho_Widget_Exception("评论内容包含敏感词汇!", 403);
}
}
/* 判断评论是否至少包含一个中文 */
if (Helper::options()->JLimitOneChinese === "on") {
if (!preg_match("/\{!\{.{0,}/", $comment['text']) && preg_match("/[\x{4e00}-\x{9fa5}]/u", $comment['text']) == 0) {
throw new Typecho_Widget_Exception("评论至少包含一个中文!", 403);
}
}
return $comment;
}
}

View File

@ -3,7 +3,7 @@
/* 获取主题当前版本号 */ /* 获取主题当前版本号 */
function _getVersion() function _getVersion()
{ {
return "5.0.8"; return "5.0.9";
}; };
/* 判断是否是手机 */ /* 判断是否是手机 */
@ -296,3 +296,18 @@ function _curl($url)
curl_close($ch); curl_close($ch);
return $result; return $result;
} }
/* 判断敏感词是否在字符串内 */
function _checkSensitiveWords($words_str, $str)
{
$words = explode("||", $words_str);
if (empty($words)) {
return false;
}
foreach ($words as $word) {
if (false !== strpos($str, trim($word))) {
return true;
}
}
return false;
}

View File

@ -711,6 +711,27 @@ function themeConfig($form)
$JCustomPlayer->setAttribute('class', 'joe_content joe_other'); $JCustomPlayer->setAttribute('class', 'joe_content joe_other');
$form->addInput($JCustomPlayer); $form->addInput($JCustomPlayer);
$JSensitiveWords = new Typecho_Widget_Helper_Form_Element_Textarea(
'JSensitiveWords',
NULL,
'你妈死了 || 傻逼 || 操你妈 || 射你妈一脸',
'评论敏感词(非必填)',
'介绍:用于设置评论敏感词汇,如果用户评论包含这些词汇,则将会禁止评论 <br />
例如:你妈死了 || 你妈炸了 || 我是你爹 || 你妈坟头冒烟 (多个使用 || 分隔开)'
);
$JSensitiveWords->setAttribute('class', 'joe_content joe_other');
$form->addInput($JSensitiveWords);
$JLimitOneChinese = new Typecho_Widget_Helper_Form_Element_Select(
'JLimitOneChinese',
array('off' => '关闭(默认)', 'on' => '开启'),
'off',
'是否开启评论至少包含一个中文',
'介绍:开启后如果评论内容未包含一个中文,则将会禁止评论 <br />
其他:用于屏蔽国外机器人刷的全英文垃圾广告信息'
);
$JLimitOneChinese->setAttribute('class', 'joe_content joe_other');
$form->addInput($JLimitOneChinese->multiMode());
$JBaiduToken = new Typecho_Widget_Helper_Form_Element_Text( $JBaiduToken = new Typecho_Widget_Helper_Form_Element_Text(
'JBaiduToken', 'JBaiduToken',

View File

@ -9,6 +9,23 @@
?> ?>
<!--
*
*
* Joe 主题牛逼, 使用 Joe 主题得永生。
* 观自在菩萨,行深般若波罗蜜多时,照见五蕴皆空,渡一切苦厄。
* 舍利子!色不异空,空不异色;色即是空,空即是色;受想行识,亦复如是。
* 舍利子!是诸法空相,不生不灭,不垢不净,不增不减。
* 是故空中无色,无受想行识,无眼耳鼻舌身意,无色声香味触法,无眼界,乃至无意识界。
* 无无明,亦无无明尽,乃至无老死,亦无老死尽,无苦集灭道。无智亦无得。
* 以无所得故,菩提萨埵,依般若波罗蜜多故,心无罣碍,无罣碍故,无有恐怖, 远离颠倒梦想,究竟涅槃。
* 三世诸佛,依般若波罗蜜多故,得阿耨多罗三藐三菩提。
* 故知般若波罗蜜多,是大神咒,是大明咒,是无上咒,是无等等咒,能除一切苦,真实不虚。
* 故说般若波罗蜜多咒,即说咒曰︰揭諦揭諦,波罗揭諦,波罗僧揭諦,菩提娑婆呵。
*
*
-->
<!DOCTYPE html> <!DOCTYPE html>
<html lang="zh-CN"> <html lang="zh-CN">