From 4c124167b02e1949d72c508b548b8761eebf84fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=81=E5=91=A8=E9=83=A8=E8=90=BD?= Date: Fri, 18 Jun 2021 23:35:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=E4=B8=89=E4=B8=AA?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E5=AE=89=E5=85=A8=E5=85=9C=E5=BA=95=E7=AD=96?= =?UTF-8?q?=E7=95=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- upload/install/data/install_data.sql | 3 +++ upload/search.php | 4 ++++ upload/source/admincp/admincp_setting.php | 6 ++++++ upload/source/class/helper/helper_form.php | 6 ++++-- upload/source/function/function_blog.php | 6 +++--- upload/source/function/function_comment.php | 2 +- upload/source/function/function_core.php | 4 ++-- upload/source/function/function_portalcp.php | 2 +- upload/source/function/function_space.php | 4 ++++ upload/source/function/function_spacecp.php | 4 ++-- upload/source/include/portalcp/portalcp_article.php | 8 ++++---- upload/source/include/portalcp/portalcp_comment.php | 2 +- upload/source/include/space/space_profile.php | 4 ++++ upload/source/include/spacecp/spacecp_album.php | 2 +- upload/source/include/spacecp/spacecp_comment.php | 2 +- upload/source/include/spacecp/spacecp_doing.php | 2 +- upload/source/include/spacecp/spacecp_index.php | 6 ++---- upload/source/include/spacecp/spacecp_share.php | 2 +- upload/source/language/lang_admincp.php | 8 ++++++++ upload/source/module/forum/forum_group.php | 8 ++++---- upload/source/module/forum/forum_post.php | 4 ++-- 21 files changed, 59 insertions(+), 30 deletions(-) diff --git a/upload/install/data/install_data.sql b/upload/install/data/install_data.sql index 89121d1fc..b8c148cb2 100644 --- a/upload/install/data/install_data.sql +++ b/upload/install/data/install_data.sql @@ -211,6 +211,9 @@ INSERT INTO pre_common_setting VALUES ('authoronleft','1'); INSERT INTO pre_common_setting VALUES ('uidlogin','0'); INSERT INTO pre_common_setting VALUES ('autoidselect','0'); INSERT INTO pre_common_setting VALUES ('avatarmethod','0'); +INSERT INTO pre_common_setting VALUES ('nsprofiles','1'); +INSERT INTO pre_common_setting VALUES ('modasban','1'); +INSERT INTO pre_common_setting VALUES ('srchcensor','1'); INSERT INTO pre_common_setting VALUES ('backupdir','f027b6'); INSERT INTO pre_common_setting VALUES ('bannedmessages','1'); INSERT INTO pre_common_setting VALUES ('bbclosed',''); diff --git a/upload/search.php b/upload/search.php index 5188ec8eb..8f6d4ef80 100644 --- a/upload/search.php +++ b/upload/search.php @@ -50,6 +50,10 @@ if($mod == 'curforum') { $_GET['srhfid'] = 0; } +if(!empty($_GET['srchtxt']) && getglobal('setting/srchcensor')) { + $_GET['srchtxt'] = censor($_GET['srchtxt']); +} + require DISCUZ_ROOT.'./source/module/search/search_'.$mod.'.php'; ?> \ No newline at end of file diff --git a/upload/source/admincp/admincp_setting.php b/upload/source/admincp/admincp_setting.php index 760f8f34c..d87b7e6cc 100644 --- a/upload/source/admincp/admincp_setting.php +++ b/upload/source/admincp/admincp_setting.php @@ -1403,6 +1403,8 @@ EOF; showsetting('setting_permissions_post_append', 'settingnew[postappend]', $setting['postappend'], 'radio'); showsetting('setting_permissions_maxpolloptions', 'settingnew[maxpolloptions]', $setting['maxpolloptions'], 'text'); showsetting('setting_permissions_editby', 'settingnew[editedby]', $setting['editedby'], 'radio'); + showsetting('setting_permissions_nsprofiles', 'settingnew[nsprofiles]', $setting['nsprofiles'], 'radio'); + showsetting('setting_permissions_modasban', 'settingnew[modasban]', $setting['modasban'], 'radio'); showtitle('nav_setting_rate'); showsetting('setting_permissions_karmaratelimit', 'settingnew[karmaratelimit]', $setting['karmaratelimit'], 'text'); @@ -2227,6 +2229,10 @@ EOT; showtablerow('', '', $search_collection); showtablefooter(); + showtableheader('setting_search_srchsetting'); + showsetting('setting_search_srchcensor', 'settingnew[srchcensor]', $setting['srchcensor'], 'radio'); + showtablefooter(); + showtableheader('setting_search_srchhotkeywords'); showsetting('setting_search_srchhotkeywords', 'settingnew[srchhotkeywords]', $setting['srchhotkeywords'], 'textarea'); diff --git a/upload/source/class/helper/helper_form.php b/upload/source/class/helper/helper_form.php index 4b03de8df..98d444502 100644 --- a/upload/source/class/helper/helper_form.php +++ b/upload/source/class/helper/helper_form.php @@ -36,11 +36,13 @@ class helper_form { } } - public static function censor($message, $modword = NULL, $return = FALSE) { + public static function censor($message, $modword = NULL, $return = FALSE, $modasban = TRUE) { global $_G; $censor = discuz_censor::instance(); $censor->check($message, $modword); - if($censor->modbanned() && empty($_G['group']['ignorecensor'])) { + // 新增对仅支持禁止关键词的模块在遇到审核关键词时禁止发布相关内容 + // $modasban 用于指示是否支持审核, 支持审核的模块需要设置为 FALSE + if(($censor->modbanned() && empty($_G['group']['ignorecensor'])) || (($modasban && !empty($_G['setting']['modasban'])) && $censor->modmoderated() && empty($_G['group']['ignorecensor']))) { $wordbanned = implode(', ', $censor->words_found); if($return) { return array('message' => lang('message', 'word_banned', array('wordbanned' => $wordbanned))); diff --git a/upload/source/function/function_blog.php b/upload/source/function/function_blog.php index 8cda8fe5b..63ed36738 100644 --- a/upload/source/function/function_blog.php +++ b/upload/source/function/function_blog.php @@ -33,7 +33,7 @@ function blog_post($POST, $olds=array()) { } $POST['subject'] = getstr(trim($POST['subject']), 80); - $POST['subject'] = censor($POST['subject']); + $POST['subject'] = censor($POST['subject'], NULL, FALSE, FALSE); if(strlen($POST['subject'])<1) $POST['subject'] = dgmdate($_G['timestamp'], 'Y-m-d'); $POST['friend'] = intval($POST['friend']); @@ -67,10 +67,10 @@ function blog_post($POST, $olds=array()) { $POST['message'] = checkhtml($POST['message']); if($_G['mobile']) { $POST['message'] = getstr($POST['message'], 0, 0, 0, 1); - $POST['message'] = censor($POST['message']); + $POST['message'] = censor($POST['message'], NULL, FALSE, FALSE); } else { $POST['message'] = getstr($POST['message'], 0, 0, 0, 0, 1); - $POST['message'] = censor($POST['message']); + $POST['message'] = censor($POST['message'], NULL, FALSE, FALSE); $POST['message'] = preg_replace("/\\<\/div\>/i", '', $POST['message']); $POST['message'] = preg_replace_callback("//is", 'blog_post_callback_blog_check_url_1', $POST['message']); } diff --git a/upload/source/function/function_comment.php b/upload/source/function/function_comment.php index 9e9fb0caf..0a4d9a25d 100644 --- a/upload/source/function/function_comment.php +++ b/upload/source/function/function_comment.php @@ -187,7 +187,7 @@ function add_comment($message, $id, $idtype, $cid = 0) { break; } - $message = censor($message); + $message = censor($message, NULL, FALSE, FALSE); if(censormod($message)) { $comment_status = 1; } else { diff --git a/upload/source/function/function_core.php b/upload/source/function/function_core.php index 0f40ebdcc..559570372 100644 --- a/upload/source/function/function_core.php +++ b/upload/source/function/function_core.php @@ -1446,8 +1446,8 @@ function simplepage($num, $perpage, $curpage, $mpurl) { return helper_page::simplepage($num, $perpage, $curpage, $mpurl); } -function censor($message, $modword = NULL, $return = FALSE) { - return helper_form::censor($message, $modword, $return); +function censor($message, $modword = NULL, $return = FALSE, $modasban = TRUE) { + return helper_form::censor($message, $modword, $return, $modasban); } function censormod($message) { diff --git a/upload/source/function/function_portalcp.php b/upload/source/function/function_portalcp.php index be816046c..ec28b88e2 100644 --- a/upload/source/function/function_portalcp.php +++ b/upload/source/function/function_portalcp.php @@ -1027,7 +1027,7 @@ function addportalarticlecomment($id, $message, $idtype = 'aid') { return 'comment_comment_notallowed'; } - $message = censor($message); + $message = censor($message, NULL, FALSE, FALSE); if(censormod($message)) { $comment_status = 1; } else { diff --git a/upload/source/function/function_space.php b/upload/source/function/function_space.php index aaf435055..fa077b9b5 100644 --- a/upload/source/function/function_space.php +++ b/upload/source/function/function_space.php @@ -39,6 +39,10 @@ function getblockhtml($blockname,$parameters = array()) { $privacy = $space['privacy']['profile'] ? $space['privacy']['profile'] : array(); foreach($_G['cache']['profilesetting'] as $fieldid=>$field) { + // 个人空间内不展现个人信息 + if($_G['setting']['nsprofiles']) { + break; + } if(!$field['available'] || in_array($fieldid, array('birthprovince', 'birthdist', 'birthcommunity', 'resideprovince', 'residedist', 'residecommunity'))) { continue; } diff --git a/upload/source/function/function_spacecp.php b/upload/source/function/function_spacecp.php index 0a2122b25..569b71b60 100644 --- a/upload/source/function/function_spacecp.php +++ b/upload/source/function/function_spacecp.php @@ -224,7 +224,7 @@ function pic_save($FILE, $albumid, $title, $iswatermark = true, $catid = 0) { } $title = getstr($title, 200); - $title = censor($title); + $title = censor($title, NULL, FALSE, FALSE); if(censormod($title) || $_G['group']['allowuploadmod']) { $pic_status = 1; } else { @@ -339,7 +339,7 @@ function stream_save($strdata, $albumid = 0, $fileext = 'jpg', $name='', $title= $filename = $name ? $name : substr(strrchr($filepath, '/'), 1); $title = getstr($title, 200); - $title = censor($title); + $title = censor($title, NULL, FALSE, FALSE); if(censormod($title) || $_G['group']['allowuploadmod']) { $pic_status = 1; } else { diff --git a/upload/source/include/portalcp/portalcp_article.php b/upload/source/include/portalcp/portalcp_article.php index 33fba63de..7013b602b 100644 --- a/upload/source/include/portalcp/portalcp_article.php +++ b/upload/source/include/portalcp/portalcp_article.php @@ -50,10 +50,10 @@ if(submitcheck("articlesubmit", 0, $seccodecheck, $secqaacheck)) { if(strlen($_POST['title']) < 1) { showmessage('title_not_too_little'); } - $_POST['title'] = censor($_POST['title']); + $_POST['title'] = censor($_POST['title'], NULL, FALSE, FALSE); $_POST['pagetitle'] = getstr(trim($_POST['pagetitle']), 60); - $_POST['pagetitle'] = censor($_POST['pagetitle']); + $_POST['pagetitle'] = censor($_POST['pagetitle'], NULL, FALSE, FALSE); $htmlname = basename(trim($_POST['htmlname'])); $highlight_style = $_GET['highlight_style']; @@ -61,7 +61,7 @@ if(submitcheck("articlesubmit", 0, $seccodecheck, $secqaacheck)) { $style = implode('|',$highlight_style); if(empty($_POST['summary'])) $_POST['summary'] = preg_replace("/(\s|\##########NextPage(\[title=.*?\])?##########\<\/strong\>)+/", ' ', $_POST['content']); $summary = portalcp_get_summary($_POST['summary']); - $summary = censor($summary); + $summary = censor($summary, NULL, FALSE, FALSE); $_GET['author'] = dhtmlspecialchars($_GET['author']); $_GET['url'] = str_replace('&', '&', dhtmlspecialchars($_GET['url'])); @@ -171,7 +171,7 @@ if(submitcheck("articlesubmit", 0, $seccodecheck, $secqaacheck)) { } $content = getstr($_POST['content'], 0, 0, 0, 0, 1); - $content = censor($content); + $content = censor($content, NULL, FALSE, FALSE); if(censormod($content) || $_G['group']['allowpostarticlemod']) { $article_status = 1; } else { diff --git a/upload/source/include/portalcp/portalcp_comment.php b/upload/source/include/portalcp/portalcp_comment.php index c3c3b55b4..c91f8988b 100644 --- a/upload/source/include/portalcp/portalcp_comment.php +++ b/upload/source/include/portalcp/portalcp_comment.php @@ -56,7 +56,7 @@ if($_GET['op'] == 'requote') { if(submitcheck('editsubmit')) { $message = getstr($_POST['message'], 0, 0, 0, 2); if(strlen($message) < 2) showmessage('content_is_too_short'); - $message = censor($message); + $message = censor($message, NULL, FALSE, FALSE); if(censormod($message)) { $comment_status = 1; } else { diff --git a/upload/source/include/space/space_profile.php b/upload/source/include/space/space_profile.php index 5ed29fda4..3b7cc8240 100644 --- a/upload/source/include/space/space_profile.php +++ b/upload/source/include/space/space_profile.php @@ -107,6 +107,10 @@ if($_G['setting']['verify']['enabled']) { space_merge($space, 'verify'); } foreach($_G['cache']['profilesetting'] as $fieldid => $field) { + // 个人空间内不展现个人信息 + if($_G['setting']['nsprofiles']) { + break; + } if(!$field['available'] || in_array($fieldid, array('birthprovince', 'birthdist', 'birthcommunity', 'resideprovince', 'residedist', 'residecommunity'))) { continue; } diff --git a/upload/source/include/spacecp/spacecp_album.php b/upload/source/include/spacecp/spacecp_album.php index 09d62468f..acaebf67c 100644 --- a/upload/source/include/spacecp/spacecp_album.php +++ b/upload/source/include/spacecp/spacecp_album.php @@ -180,7 +180,7 @@ if($_GET['op'] == 'edit') { continue; } $title = getstr($value, 150); - $title = censor($title); + $title = censor($title, NULL, FALSE, FALSE); if(censormod($title) || $_G['group']['allowuploadmod']) { $pic_status = 1; updatemoderate("picid", $picid); diff --git a/upload/source/include/spacecp/spacecp_comment.php b/upload/source/include/spacecp/spacecp_comment.php index 304eb9cb7..66cab3ca1 100644 --- a/upload/source/include/spacecp/spacecp_comment.php +++ b/upload/source/include/spacecp/spacecp_comment.php @@ -70,7 +70,7 @@ if($_GET['op'] == 'edit') { $message = getstr($_POST['message'], 0, 0, 0, 2); if(strlen($message) < 2) showmessage('content_is_too_short'); - $message = censor($message); + $message = censor($message, NULL, FALSE, FALSE); if(censormod($message)) { $comment_status = 1; } else { diff --git a/upload/source/include/spacecp/spacecp_doing.php b/upload/source/include/spacecp/spacecp_doing.php index efa40b732..4060691c2 100644 --- a/upload/source/include/spacecp/spacecp_doing.php +++ b/upload/source/include/spacecp/spacecp_doing.php @@ -33,7 +33,7 @@ if(helper_access::check_module('doing')) { showmessage('should_write_that'); } - $message = censor($message, NULL, TRUE); + $message = censor($message, NULL, TRUE, TRUE); if(is_array($message) && $message['message']) { showmessage('do_success', dreferer(), array('message'=>$message['message'])); } diff --git a/upload/source/include/spacecp/spacecp_index.php b/upload/source/include/spacecp/spacecp_index.php index d1a5fdd19..85207d1a6 100644 --- a/upload/source/include/spacecp/spacecp_index.php +++ b/upload/source/include/spacecp/spacecp_index.php @@ -226,11 +226,10 @@ if (submitcheck('musicsubmit')) { $mp3name = $_POST['mp3name']; $cdbj = $_POST['cdbj']; $mp3list = empty($blockdata['parameters']['music']['mp3list']) ? array() : $blockdata['parameters']['music']['mp3list']; - censor(implode('', $_POST['mp3name'])); foreach ($mp3url as $key => $value) { if (!empty($value)) { if(empty($mp3name[$key])) $mp3name[$key] = substr($value,strrpos($value,'/')+1,strlen($value)); - $mp3list[] = array('mp3url'=>$value, 'mp3name'=>$mp3name[$key], 'cdbj'=>$cdbj[$key]); + $mp3list[] = array('mp3url'=>$value, 'mp3name'=>censor($mp3name[$key]), 'cdbj'=>$cdbj[$key]); } } $blockdata['parameters']['music']['mp3list'] = $mp3list; @@ -240,11 +239,10 @@ if (submitcheck('musicsubmit')) { $mp3name = $_POST['mp3name']; $cdbj = $_POST['cdbj']; $mp3list = array(); - censor(implode('', $_POST['mp3name'])); foreach ($mp3url as $key => $value) { if (!empty($value)) { if(empty($mp3name[$key])) $mp3name[$key] = substr($value,strrpos($value,'/')+1,strlen($value)); - $mp3list[] = array('mp3url'=>$value, 'mp3name'=>$mp3name[$key], 'cdbj'=>$cdbj[$key]); + $mp3list[] = array('mp3url'=>$value, 'mp3name'=>censor($mp3name[$key]), 'cdbj'=>$cdbj[$key]); } } diff --git a/upload/source/include/spacecp/spacecp_share.php b/upload/source/include/spacecp/spacecp_share.php index 3ed50c86e..709f0af49 100644 --- a/upload/source/include/spacecp/spacecp_share.php +++ b/upload/source/include/spacecp/spacecp_share.php @@ -444,7 +444,7 @@ if($_GET['op'] == 'delete') { } $arr['body_general'] = getstr($_POST['general'], 150, 0, 0, 1); - $arr['body_general'] = censor($arr['body_general']); + $arr['body_general'] = censor($arr['body_general'], NULL, FALSE, FALSE); if(censormod($arr['body_general']) || $_G['group']['allowsharemod']) { $arr['status'] = 1; } else { diff --git a/upload/source/language/lang_admincp.php b/upload/source/language/lang_admincp.php index 8c3a5bd18..04d036985 100644 --- a/upload/source/language/lang_admincp.php +++ b/upload/source/language/lang_admincp.php @@ -1915,6 +1915,10 @@ $lang = array 'setting_permissions_editby_comment' => '在 60 秒后编辑帖子添加“本帖由 xxx 于 xxxx-xx-xx 编辑”字样。管理员编辑不受此限制', 'setting_permissions_post_append' => '启用帖子补充功能', 'setting_permissions_post_append_comment' => '启用后,当用户无法编辑自己的帖子时,可以补充内容', + 'setting_permissions_nsprofiles' => '个人空间内不展现个人信息', + 'setting_permissions_nsprofiles_comment' => '启用后个人空间内将不展现个人信息', + 'setting_permissions_modasban' => '不忽略审核关键词', + 'setting_permissions_modasban_comment' => '启用后在不支持审核关键词的模块内发现此类关键词将拒绝提交,关闭则允许提交', 'setting_credits' => '积分设置', 'setting_credits_base' => '基本设置', @@ -2473,6 +2477,10 @@ $lang = array 'setting_search_status_comment' => '勾选您要开启的搜索栏目', 'setting_search_onoff' => '开启', 'search_item_name' => '搜索项目', + + 'setting_search_srchsetting' => '搜索选项设置', + 'setting_search_srchcensor' => '搜索受词语过滤控制', + 'setting_search_srchhotkeywords' => '热门关键词', 'setting_search_srchhotkeywords_comment' => '每行一个', 'setting_search_srchhotkeywords_disabled' => '您已开启纵横搜索服务,搜索相关设置请到 云平台->纵横搜索 设置', diff --git a/upload/source/module/forum/forum_group.php b/upload/source/module/forum/forum_group.php index 3329fef1f..6217d10d7 100644 --- a/upload/source/module/forum/forum_group.php +++ b/upload/source/module/forum/forum_group.php @@ -308,7 +308,7 @@ if($action == 'index') { } else { $parentid = intval($_GET['parentid']); $fup = intval($_GET['fup']); - $name = censor(dhtmlspecialchars(cutstr(trim($_GET['name']), 20, ''))); + $name = censor(dhtmlspecialchars(cutstr(trim($_GET['name']), 20, '')), NULL, FALSE, FALSE); $censormod = censormod($name); if(empty($name)) { showmessage('group_name_empty'); @@ -328,7 +328,7 @@ if($action == 'index') { showmessage('group_name_exist'); } require_once libfile('function/discuzcode'); - $descriptionnew = discuzcode(dhtmlspecialchars(censor(trim($_GET['descriptionnew']))), 0, 0, 0, 0, 1, 1, 0, 0, 1); + $descriptionnew = discuzcode(dhtmlspecialchars(censor(trim($_GET['descriptionnew']), NULL, FALSE, FALSE)), 0, 0, 0, 0, 1, 1, 0, 0, 1); $censormod = censormod($descriptionnew); if($censormod) { showmessage('group_description_failed'); @@ -411,7 +411,7 @@ if($action == 'index') { $parentid = intval($_GET['parentid']); if(isset($_GET['name'])) { - $_GET['name'] = censor(dhtmlspecialchars(cutstr(trim($_GET['name']), 20, ''))); + $_GET['name'] = censor(dhtmlspecialchars(cutstr(trim($_GET['name']), 20, '')), NULL, FALSE, FALSE); if(empty($_GET['name'])) { showmessage('group_name_empty'); } @@ -466,7 +466,7 @@ if($action == 'index') { @unlink($_G['forum']['banner']); } require_once libfile('function/discuzcode'); - $_GET['descriptionnew'] = discuzcode(censor(trim($_GET['descriptionnew'])), 0, 0, 0, 0, 1, 1, 0, 0, 1); + $_GET['descriptionnew'] = discuzcode(censor(trim($_GET['descriptionnew']), NULL, FALSE, FALSE), 0, 0, 0, 0, 1, 1, 0, 0, 1); $censormod = censormod($_GET['descriptionnew']); if($censormod) { showmessage('group_description_failed'); diff --git a/upload/source/module/forum/forum_post.php b/upload/source/module/forum/forum_post.php index eed446ca3..ab70af613 100644 --- a/upload/source/module/forum/forum_post.php +++ b/upload/source/module/forum/forum_post.php @@ -203,9 +203,9 @@ $notifycheck = empty($emailnotify) ? '' : 'checked="checked"'; $stickcheck = empty($sticktopic) ? '' : 'checked="checked"'; $digestcheck = empty($addtodigest) ? '' : 'checked="checked"'; -$subject = isset($_GET['subject']) ? dhtmlspecialchars(censor(trim($_GET['subject']))) : ''; +$subject = isset($_GET['subject']) ? dhtmlspecialchars(censor(trim($_GET['subject']), NULL, FALSE, FALSE)) : ''; $subject = !empty($subject) ? str_replace("\t", ' ', $subject) : $subject; -$message = isset($_GET['message']) ? censor($_GET['message']) : ''; +$message = isset($_GET['message']) ? censor($_GET['message'], NULL, FALSE, FALSE) : ''; $polloptions = isset($polloptions) ? censor(trim($polloptions)) : ''; $readperm = isset($_GET['readperm']) ? intval($_GET['readperm']) : 0; $price = isset($_GET['price']) ? intval($_GET['price']) : 0; -- Gitee