diff --git a/lang/chs/lang_forums.php b/lang/chs/lang_forums.php index b49a916d..9f4d771f 100644 --- a/lang/chs/lang_forums.php +++ b/lang/chs/lang_forums.php @@ -198,6 +198,7 @@ $lang_forums = array 'text_topic_asc' => "发布时间升序", 'text_post_asc' => "最近回复升序", 'text_post_desc' => "最近回复降序", + 'text_post_protected' => "[size=3][b]--本版块为隐私保护版块---[/b]\n当前帖子内容仅楼主、回复作者、本版版主、管理员以上可见[/size]", ); ?> diff --git a/lang/chs/lang_settings.php b/lang/chs/lang_settings.php index f1ea0152..e9b0d498 100644 --- a/lang/chs/lang_settings.php +++ b/lang/chs/lang_settings.php @@ -796,6 +796,9 @@ $lang_settings = array 'text_destroy_disabled_note_two' => "天不登录,将被从数据库彻底物理删除。默认'500',请设置一个大于上边任何一种导致封禁的值。设为'0'来禁止此规则。", 'row_enable_global_search_system' => '启用全站搜索', 'text_global_search_system_note' => "默认:'是'。若启用,当有多个分区时,主菜单右下角显示全站搜索入口。", + 'row_protected_forum' => '隐私保护论坛板块', + 'text_protected_forum' => '输入开启隐私保护的论坛板块ID,该版块的回复仅楼主作者及管理员以上可见,使用逗号分割(如:1,2,3)', + 'forum_format_error' => '论坛ID格式错误,请检查输入!', ); ?> diff --git a/lang/cht/lang_forums.php b/lang/cht/lang_forums.php index 0f8d3735..00f09c61 100644 --- a/lang/cht/lang_forums.php +++ b/lang/cht/lang_forums.php @@ -198,6 +198,7 @@ $lang_forums = array 'text_topic_asc' => "發布時間升序", 'text_post_asc' => "最近回覆升序", 'text_post_desc' => "最近回覆降序", + 'text_post_protected' => "[size=3][b]--本版為隱私保護版---[/b]\n當前帖子內容僅樓主、回復作者、本版版主、管理員以上等級可查看[/size]", ); ?> diff --git a/lang/cht/lang_settings.php b/lang/cht/lang_settings.php index b0fe01c7..5b7f8282 100644 --- a/lang/cht/lang_settings.php +++ b/lang/cht/lang_settings.php @@ -796,6 +796,9 @@ $lang_settings = array 'text_destroy_disabled_note_two' => "天不登錄,將被從數據庫徹底物理刪除。默認'500',請設置一個大於上邊任何一種導致封禁的值。設為'0'來禁止此規則。", 'row_enable_global_search_system' => '啟用全站搜索', 'text_global_search_system_note' => "默認:'是'。若啟用,當有多個分區時,主菜單右下角顯示全站搜索入口。", + 'row_protected_forum' => '隱私保護論壇板塊', + 'text_protected_forum' => '輸入開啟隱私保護的論壇板塊ID,該版塊的回覆僅樓主作者及管理員以上可見,使用逗號分割(如:1,2,3)', + 'forum_format_error' => '論壇ID格式錯誤,請核查校對!', ); ?> diff --git a/lang/en/lang_forums.php b/lang/en/lang_forums.php index f3948496..39b787a2 100644 --- a/lang/en/lang_forums.php +++ b/lang/en/lang_forums.php @@ -198,6 +198,7 @@ $lang_forums = array 'text_topic_asc' => "Topic Time Ascendant", 'text_post_asc' => "Last Post Time Ascendant", 'text_post_desc' => "Last Post Time Descendant", + 'text_post_protected' => "[size=3][b]--Privacy protection is enabled in this forum---[/b]\nOnly topic poster,mods,admins and reply's author can read the content.[/size]", ); ?> diff --git a/lang/en/lang_settings.php b/lang/en/lang_settings.php index 90e33587..452ad664 100644 --- a/lang/en/lang_settings.php +++ b/lang/en/lang_settings.php @@ -796,6 +796,9 @@ $lang_settings = array 'text_destroy_disabled_note_two' => "Days without logging in, will be physically deleted from the database completely. Default '500', please set a value greater than any of the above to cause disable. Set to '0' to disable this rule." , 'row_enable_global_search_system' => 'Enable global search', 'text_global_search_system_note' => "Default: 'Yes'. If enabled, when there are multiple sections, the global search portal is displayed in the bottom right corner of the main menu.", + 'row_protected_forum' => 'Privacy Protection Forums', + 'text_protected_forum' => 'The IDs of forums\' which enables privacy protection , seperated by commas(e.g. 1,2,3)', + 'forum_format_error' => 'The format of forums is wrong, please check it again!', ); ?> diff --git a/public/forums.php b/public/forums.php index d780d82b..ccabf959 100644 --- a/public/forums.php +++ b/public/forums.php @@ -542,6 +542,7 @@ if ($action == "viewtopic") $hlcolor = $arr['hlcolor']; $views = $arr['views']; $forumid = $arr["forumid"]; + $base_posterid = $arr['userid']; $row = get_forum_row($forumid); //------ Get forum name, moderators @@ -675,6 +676,18 @@ if ($action == "viewtopic") $lpr = get_last_read_post_id($topicid); if ($Advertisement->enable_ad()) $forumpostad=$Advertisement->get_ad('forumpost'); + + //check if privacy protection enabled in this forum + $protected_forums = Nexus\Database\NexusDB::remember("setting_protected_forum", 600, function () { + return \App\Models\Setting::getByName('misc.protected_forum'); + }); + + if ($protected_forums and in_array(strval($forumid),explode(",",$protected_forums))){ + $protected_enabled=true; + }else{ + $protected_enabled=false; + } + foreach ($allPosts as $arr) { if ($pn>=1) @@ -741,9 +754,16 @@ if ($action == "viewtopic") print("\n"); print("