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,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: '<?php Helper::options()->themeUrl(); ?>'
}
</script>
<script src="https://cdn.jsdelivr.net/npm/typecho-joe-next@6.2.4/plugin/prism/prism.min.js"></script>
<script src="<?php Helper::options()->themeUrl('typecho/write/js/joe.parse.min.js?v=202104191518') ?>"></script>
<script src="<?php Helper::options()->themeUrl('typecho/write/js/joe.write.chunk.js?v=202104191518') ?>"></script>

View File

@ -2,7 +2,7 @@
/* 获取主题当前版本号 */
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');
$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',
array(

View File

@ -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": [