mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 12:07:23 +08:00
add settings of privacy protection forums (#135)
add settings of privacy protection forums Co-authored-by: kongrui <me@rey.ink>
This commit is contained in:
@@ -198,6 +198,7 @@ $lang_forums = array
|
|||||||
'text_topic_asc' => "发布时间升序",
|
'text_topic_asc' => "发布时间升序",
|
||||||
'text_post_asc' => "最近回复升序",
|
'text_post_asc' => "最近回复升序",
|
||||||
'text_post_desc' => "最近回复降序",
|
'text_post_desc' => "最近回复降序",
|
||||||
|
'text_post_protected' => "[size=3][b]--本版块为隐私保护版块---[/b]\n当前帖子内容仅楼主、回复作者、本版版主、管理员以上可见[/size]",
|
||||||
);
|
);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -796,6 +796,9 @@ $lang_settings = array
|
|||||||
'text_destroy_disabled_note_two' => "天不登录,将被从数据库彻底物理删除。默认'500',请设置一个大于上边任何一种导致封禁的值。设为'0'来禁止此规则。",
|
'text_destroy_disabled_note_two' => "天不登录,将被从数据库彻底物理删除。默认'500',请设置一个大于上边任何一种导致封禁的值。设为'0'来禁止此规则。",
|
||||||
'row_enable_global_search_system' => '启用全站搜索',
|
'row_enable_global_search_system' => '启用全站搜索',
|
||||||
'text_global_search_system_note' => "默认:'是'。若启用,当有多个分区时,主菜单右下角显示全站搜索入口。",
|
'text_global_search_system_note' => "默认:'是'。若启用,当有多个分区时,主菜单右下角显示全站搜索入口。",
|
||||||
|
'row_protected_forum' => '隐私保护论坛板块',
|
||||||
|
'text_protected_forum' => '输入开启隐私保护的论坛板块ID,该版块的回复仅楼主作者及管理员以上可见,使用逗号分割(如:1,2,3)',
|
||||||
|
'forum_format_error' => '论坛ID格式错误,请检查输入!',
|
||||||
);
|
);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -198,6 +198,7 @@ $lang_forums = array
|
|||||||
'text_topic_asc' => "發布時間升序",
|
'text_topic_asc' => "發布時間升序",
|
||||||
'text_post_asc' => "最近回覆升序",
|
'text_post_asc' => "最近回覆升序",
|
||||||
'text_post_desc' => "最近回覆降序",
|
'text_post_desc' => "最近回覆降序",
|
||||||
|
'text_post_protected' => "[size=3][b]--本版為隱私保護版---[/b]\n當前帖子內容僅樓主、回復作者、本版版主、管理員以上等級可查看[/size]",
|
||||||
);
|
);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -796,6 +796,9 @@ $lang_settings = array
|
|||||||
'text_destroy_disabled_note_two' => "天不登錄,將被從數據庫徹底物理刪除。默認'500',請設置一個大於上邊任何一種導致封禁的值。設為'0'來禁止此規則。",
|
'text_destroy_disabled_note_two' => "天不登錄,將被從數據庫徹底物理刪除。默認'500',請設置一個大於上邊任何一種導致封禁的值。設為'0'來禁止此規則。",
|
||||||
'row_enable_global_search_system' => '啟用全站搜索',
|
'row_enable_global_search_system' => '啟用全站搜索',
|
||||||
'text_global_search_system_note' => "默認:'是'。若啟用,當有多個分區時,主菜單右下角顯示全站搜索入口。",
|
'text_global_search_system_note' => "默認:'是'。若啟用,當有多個分區時,主菜單右下角顯示全站搜索入口。",
|
||||||
|
'row_protected_forum' => '隱私保護論壇板塊',
|
||||||
|
'text_protected_forum' => '輸入開啟隱私保護的論壇板塊ID,該版塊的回覆僅樓主作者及管理員以上可見,使用逗號分割(如:1,2,3)',
|
||||||
|
'forum_format_error' => '論壇ID格式錯誤,請核查校對!',
|
||||||
);
|
);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -198,6 +198,7 @@ $lang_forums = array
|
|||||||
'text_topic_asc' => "Topic Time Ascendant",
|
'text_topic_asc' => "Topic Time Ascendant",
|
||||||
'text_post_asc' => "Last Post Time Ascendant",
|
'text_post_asc' => "Last Post Time Ascendant",
|
||||||
'text_post_desc' => "Last Post Time Descendant",
|
'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]",
|
||||||
);
|
);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -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." ,
|
'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',
|
'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.",
|
'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!',
|
||||||
);
|
);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -539,6 +539,7 @@ if ($action == "viewtopic")
|
|||||||
$hlcolor = $arr['hlcolor'];
|
$hlcolor = $arr['hlcolor'];
|
||||||
$views = $arr['views'];
|
$views = $arr['views'];
|
||||||
$forumid = $arr["forumid"];
|
$forumid = $arr["forumid"];
|
||||||
|
$base_posterid = $arr['userid'];
|
||||||
|
|
||||||
$row = get_forum_row($forumid);
|
$row = get_forum_row($forumid);
|
||||||
//------ Get forum name, moderators
|
//------ Get forum name, moderators
|
||||||
@@ -672,6 +673,18 @@ if ($action == "viewtopic")
|
|||||||
$lpr = get_last_read_post_id($topicid);
|
$lpr = get_last_read_post_id($topicid);
|
||||||
if ($Advertisement->enable_ad())
|
if ($Advertisement->enable_ad())
|
||||||
$forumpostad=$Advertisement->get_ad('forumpost');
|
$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)
|
foreach ($allPosts as $arr)
|
||||||
{
|
{
|
||||||
if ($pn>=1)
|
if ($pn>=1)
|
||||||
@@ -739,6 +752,15 @@ if ($action == "viewtopic")
|
|||||||
|
|
||||||
print("<table class=\"main\" width=\"100%\" border=\"1\" cellspacing=\"0\" cellpadding=\"5\">\n");
|
print("<table class=\"main\" width=\"100%\" border=\"1\" cellspacing=\"0\" cellpadding=\"5\">\n");
|
||||||
|
|
||||||
|
//hidden content applied to second or higher floor post (for whose user class below Ad , not poster , not mods ,not reply's author)
|
||||||
|
if ($protected_enabled && $pn+$offset>1 && get_user_class()<UC_ADMINISTRATOR && $userid != $base_posterid && $posterid!=$userid && !$is_forummod){
|
||||||
|
//enable content protection
|
||||||
|
$bodyContent = format_comment($lang_forums["text_post_protected"]);
|
||||||
|
}else{
|
||||||
|
//display normal content
|
||||||
|
$bodyContent = format_comment($arr["body"]);
|
||||||
|
}
|
||||||
|
|
||||||
$body = "<div id=\"pid".$postid."body\">";
|
$body = "<div id=\"pid".$postid."body\">";
|
||||||
$bodyContent = format_comment($arr["body"]);
|
$bodyContent = format_comment($arr["body"]);
|
||||||
if ($highlight){
|
if ($highlight){
|
||||||
|
|||||||
+5
-1
@@ -288,9 +288,12 @@ elseif ($action == 'savesettings_advertisement') // save advertisement
|
|||||||
elseif ($action == 'savesettings_misc')
|
elseif ($action == 'savesettings_misc')
|
||||||
{
|
{
|
||||||
stdhead($lang_settings['row_misc_settings']);
|
stdhead($lang_settings['row_misc_settings']);
|
||||||
$validConfig = array('donation_custom', );
|
$validConfig = array('donation_custom', 'protected_forum',);
|
||||||
GetVar($validConfig);
|
GetVar($validConfig);
|
||||||
$data = [];
|
$data = [];
|
||||||
|
if (!empty($protected_forum) && !preg_match("/^[,\\d]*[\\d]+$/",$protected_forum)){
|
||||||
|
stderr($lang_settings['std_error'],$lang_settings['forum_format_error'].'<br>'.$lang_settings['std_click']."<a class=\"altlink\" href=\"settings.php\">".$lang_settings['std_here']."</a>".$lang_settings['std_to_go_back'],false,false);
|
||||||
|
}
|
||||||
foreach($validConfig as $config) {
|
foreach($validConfig as $config) {
|
||||||
$data[$config] = $$config ?? null;
|
$data[$config] = $$config ?? null;
|
||||||
}
|
}
|
||||||
@@ -923,6 +926,7 @@ elseif ($action == 'miscsettings')
|
|||||||
print ($notice);
|
print ($notice);
|
||||||
print ("<form method='post' action='".$_SERVER["SCRIPT_NAME"]."'><input type='hidden' name='action' value='savesettings_misc'>");
|
print ("<form method='post' action='".$_SERVER["SCRIPT_NAME"]."'><input type='hidden' name='action' value='savesettings_misc'>");
|
||||||
tr($lang_settings['row_misc_donation_custom'],"<textarea cols=\"100\" rows=\"10\" name='donation_custom'>".($misc['donation_custom'] ?? '')."</textarea><br/>".$lang_settings['text_donation_custom_note'], 1);
|
tr($lang_settings['row_misc_donation_custom'],"<textarea cols=\"100\" rows=\"10\" name='donation_custom'>".($misc['donation_custom'] ?? '')."</textarea><br/>".$lang_settings['text_donation_custom_note'], 1);
|
||||||
|
tr($lang_settings['row_protected_forum'], "<input type='text' style=\"width: 100px\" name='protected_forum' value='".($misc["protected_forum"] ??'')."'> ".$lang_settings['text_protected_forum'], 1);
|
||||||
tr($lang_settings['row_save_settings'],"<input type='submit' name='save' value='".$lang_settings['submit_save_settings']."'>", 1);
|
tr($lang_settings['row_save_settings'],"<input type='submit' name='save' value='".$lang_settings['submit_save_settings']."'>", 1);
|
||||||
print ("</form>");
|
print ("</form>");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user