This commit is contained in:
杜恒 2021-04-19 17:01:09 +08:00
parent 140760d820
commit 5f2fc632bb
4 changed files with 30 additions and 13 deletions

View File

@ -5,12 +5,17 @@ class Intercept
{ {
public static function message($comment) public static function message($comment)
{ {
/* 如果用户输入内容画图模式 */ /* 用户输入内容画图模式 */
if (preg_match('/\{!\{(.*)\}!\}/', $comment['text'], $matches)) { if (preg_match('/\{!\{(.*)\}!\}/', $comment['text'], $matches)) {
/* 如果判断是否有双引号,如果有双引号,则禁止评论 */ /* 如果判断是否有双引号,如果有双引号,则禁止评论 */
if (strpos($matches[1], '"') !== false || _checkXSS($matches[1])) { if (strpos($matches[1], '"') !== false || _checkXSS($matches[1])) {
$comment['status'] = 'waiting'; $comment['status'] = 'waiting';
} }
/* 普通评论 */
} else {
/* 判断用户输入是否大于字符 */
if (Helper::options()->JTextLimit && strlen($comment['text']) > Helper::options()->JTextLimit) {
$comment['status'] = 'waiting';
} else { } else {
/* 判断评论内容是否包含敏感词 */ /* 判断评论内容是否包含敏感词 */
if (Helper::options()->JSensitiveWords) { if (Helper::options()->JSensitiveWords) {
@ -25,6 +30,7 @@ class Intercept
} }
} }
} }
}
Typecho_Cookie::delete('__typecho_remember_text'); Typecho_Cookie::delete('__typecho_remember_text');
return $comment; return $comment;
} }

View File

@ -2,7 +2,7 @@
/* 获取主题当前版本号 */ /* 获取主题当前版本号 */
function _getVersion() function _getVersion()
{ {
return "6.4.7"; return "6.4.8";
}; };
/* 判断是否是手机 */ /* 判断是否是手机 */

View File

@ -864,6 +864,17 @@ function themeConfig($form)
$JLimitOneChinese->setAttribute('class', 'joe_content joe_other'); $JLimitOneChinese->setAttribute('class', 'joe_content joe_other');
$form->addInput($JLimitOneChinese->multiMode()); $form->addInput($JLimitOneChinese->multiMode());
$JTextLimit = new Typecho_Widget_Helper_Form_Element_Text(
'JTextLimit',
NULL,
NULL,
'限制用户评论最大字符',
'介绍:如果用户评论的内容超出字符限制,则将会把评论置为审核状态 <br />
其他:请输入数字格式,不填写则不限制'
);
$JTextLimit->setAttribute('class', 'joe_content joe_other');
$form->addInput($JTextLimit->multiMode());
$JSiteMap = new Typecho_Widget_Helper_Form_Element_Select( $JSiteMap = new Typecho_Widget_Helper_Form_Element_Select(
'JSiteMap', 'JSiteMap',
array( array(

View File

@ -1,6 +1,6 @@
{ {
"name": "typecho-joe-next", "name": "typecho-joe-next",
"version": "6.4.7", "version": "6.4.8",
"description": "A Theme Of Typecho", "description": "A Theme Of Typecho",
"main": "index.php", "main": "index.php",
"keywords": [ "keywords": [