diff --git a/core/factory.php b/core/factory.php
index f8f0430..c26f73d 100644
--- a/core/factory.php
+++ b/core/factory.php
@@ -5,23 +5,29 @@ class Intercept
{
public static function message($comment)
{
- /* 如果用户输入内容画图模式 */
+ /* 用户输入内容画图模式 */
if (preg_match('/\{!\{(.*)\}!\}/', $comment['text'], $matches)) {
/* 如果判断是否有双引号,如果有双引号,则禁止评论 */
if (strpos($matches[1], '"') !== false || _checkXSS($matches[1])) {
$comment['status'] = 'waiting';
}
+ /* 普通评论 */
} else {
- /* 判断评论内容是否包含敏感词 */
- if (Helper::options()->JSensitiveWords) {
- if (_checkSensitiveWords(Helper::options()->JSensitiveWords, $comment['text'])) {
- $comment['status'] = 'waiting';
+ /* 判断用户输入是否大于字符 */
+ if (Helper::options()->JTextLimit && strlen($comment['text']) > Helper::options()->JTextLimit) {
+ $comment['status'] = 'waiting';
+ } else {
+ /* 判断评论内容是否包含敏感词 */
+ if (Helper::options()->JSensitiveWords) {
+ if (_checkSensitiveWords(Helper::options()->JSensitiveWords, $comment['text'])) {
+ $comment['status'] = 'waiting';
+ }
}
- }
- /* 判断评论是否至少包含一个中文 */
- if (Helper::options()->JLimitOneChinese === "on") {
- if (preg_match("/[\x{4e00}-\x{9fa5}]/u", $comment['text']) == 0) {
- $comment['status'] = 'waiting';
+ /* 判断评论是否至少包含一个中文 */
+ if (Helper::options()->JLimitOneChinese === "on") {
+ if (preg_match("/[\x{4e00}-\x{9fa5}]/u", $comment['text']) == 0) {
+ $comment['status'] = 'waiting';
+ }
}
}
}
@@ -55,7 +61,7 @@ class Editor
themeURL: 'themeUrl(); ?>'
}
-
+
diff --git a/core/function.php b/core/function.php
index abca2ed..995d487 100644
--- a/core/function.php
+++ b/core/function.php
@@ -2,7 +2,7 @@
/* 获取主题当前版本号 */
function _getVersion()
{
- return "6.4.7";
+ return "6.4.8";
};
/* 判断是否是手机 */
diff --git a/functions.php b/functions.php
index 10897c6..3b60839 100644
--- a/functions.php
+++ b/functions.php
@@ -864,6 +864,17 @@ function themeConfig($form)
$JLimitOneChinese->setAttribute('class', 'joe_content joe_other');
$form->addInput($JLimitOneChinese->multiMode());
+ $JTextLimit = new Typecho_Widget_Helper_Form_Element_Text(
+ 'JTextLimit',
+ NULL,
+ NULL,
+ '限制用户评论最大字符',
+ '介绍:如果用户评论的内容超出字符限制,则将会把评论置为审核状态
+ 其他:请输入数字格式,不填写则不限制'
+ );
+ $JTextLimit->setAttribute('class', 'joe_content joe_other');
+ $form->addInput($JTextLimit->multiMode());
+
$JSiteMap = new Typecho_Widget_Helper_Form_Element_Select(
'JSiteMap',
array(
diff --git a/package.json b/package.json
index c5946de..db1ffe9 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "typecho-joe-next",
- "version": "6.4.7",
+ "version": "6.4.8",
"description": "A Theme Of Typecho",
"main": "index.php",
"keywords": [