From 19b1648e87332b2a1aff179a0494006bba405786 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=81=E5=91=A8=E9=83=A8=E8=90=BD?= Date: Wed, 18 Aug 2021 13:18:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=E5=85=81=E8=AE=B8?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=8B=92=E7=BB=9D=E8=A2=AB=E6=94=B6=E5=90=AC?= =?UTF-8?q?=E3=80=81=E5=8A=A0=E5=A5=BD=E5=8F=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- upload/install/data/install.sql | 2 ++ upload/source/admincp/admincp_usergroups.php | 2 +- .../source/include/spacecp/spacecp_follow.php | 8 +++++ .../source/include/spacecp/spacecp_friend.php | 6 ++++ .../include/spacecp/spacecp_privacy.php | 27 +++++++++++++- upload/source/language/home/lang_template.php | 4 +++ .../template/default/home/spacecp_privacy.htm | 35 +++++++++++++++++++ 7 files changed, 82 insertions(+), 2 deletions(-) diff --git a/upload/install/data/install.sql b/upload/install/data/install.sql index 76065be14..64cf0f487 100644 --- a/upload/install/data/install.sql +++ b/upload/install/data/install.sql @@ -804,6 +804,8 @@ CREATE TABLE pre_common_member_field_home ( domain char(15) NOT NULL DEFAULT '', addsize int(10) unsigned NOT NULL DEFAULT '0', addfriend smallint(6) unsigned NOT NULL DEFAULT '0', + allowasfriend tinyint(1) NOT NULL DEFAULT '1', + allowasfollow tinyint(1) NOT NULL DEFAULT '1', menunum smallint(6) unsigned NOT NULL DEFAULT '0', theme varchar(20) NOT NULL DEFAULT '', spacecss text NOT NULL, diff --git a/upload/source/admincp/admincp_usergroups.php b/upload/source/admincp/admincp_usergroups.php index 9a9df39d0..9515c4b16 100644 --- a/upload/source/admincp/admincp_usergroups.php +++ b/upload/source/admincp/admincp_usergroups.php @@ -579,7 +579,7 @@ EOT; showsetting('usergroups_edit_basic_domain_length', 'domainlengthnew', $group['domainlength'], 'text'); showsetting('usergroups_edit_basic_invisible', 'allowinvisiblenew', $group['allowinvisible'], 'radio'); showsetting('usergroups_edit_basic_allowtransfer', 'allowtransfernew', $group['allowtransfer'], 'radio'); - showsetting('usergroups_edit_basic_allowfollow', 'allowfollownew', $group['allowfollow'], 'radio', 0, 1); + showsetting('usergroups_edit_basic_allowfollow', 'allowfollownew', $group['allowfollow'], 'radio'); showsetting('usergroups_edit_basic_allowsendpm', 'allowsendpmnew', $group['allowsendpm'], 'radio', 0, 1); showsetting('usergroups_edit_pm_sendpmmaxnum', 'allowsendpmmaxnumnew', $group['allowsendpmmaxnum'], 'text'); showsetting('usergroups_edit_pm_sendallpm', 'allowsendallpmnew', $group['allowsendallpm'], 'radio'); diff --git a/upload/source/include/spacecp/spacecp_follow.php b/upload/source/include/spacecp/spacecp_follow.php index 361193a4c..deefefea7 100644 --- a/upload/source/include/spacecp/spacecp_follow.php +++ b/upload/source/include/spacecp/spacecp_follow.php @@ -31,6 +31,14 @@ if($op == 'add') { } $special = intval($_GET['special']) ? intval($_GET['special']) : 0; $followuser = getuserbyuid($followuid); + if(empty($followuser)) { + showmessage('space_does_not_exist'); + } + // 允许单个用户屏蔽所有人收听 Ta + $fields = C::t('common_member_field_home')->fetch($followuid); + if(!$fields['allowasfollow']) { + showmessage('follow_other_unfollow'); + } $mutual = 0; $followed = C::t('home_follow')->fetch_by_uid_followuid($followuid, $_G['uid']); if(!empty($followed)) { diff --git a/upload/source/include/spacecp/spacecp_friend.php b/upload/source/include/spacecp/spacecp_friend.php index 6e83b245e..0e6a1cc94 100644 --- a/upload/source/include/spacecp/spacecp_friend.php +++ b/upload/source/include/spacecp/spacecp_friend.php @@ -44,6 +44,12 @@ if($op == 'add') { showmessage('space_does_not_exist'); } + // 允许单个用户屏蔽所有人加 Ta 为好友 + $fields = C::t('common_member_field_home')->fetch($uid); + if(!$fields['allowasfriend']) { + showmessage('is_blacklist'); + } + if(isblacklist($tospace['uid'])) { showmessage('is_blacklist'); } diff --git a/upload/source/include/spacecp/spacecp_privacy.php b/upload/source/include/spacecp/spacecp_privacy.php index 23f6a87cb..ca6d5bb5c 100644 --- a/upload/source/include/spacecp/spacecp_privacy.php +++ b/upload/source/include/spacecp/spacecp_privacy.php @@ -12,7 +12,7 @@ if(!defined('IN_DISCUZ')) { } space_merge($space, 'field_home'); -$operation = in_array(getgpc('op'), array('base', 'feed', 'filter', 'getgroup')) ? trim($_GET['op']) : 'base'; +$operation = in_array(getgpc('op'), array('base', 'feed', 'filter', 'other', 'getgroup')) ? trim($_GET['op']) : 'base'; if(submitcheck('privacysubmit')) { @@ -63,6 +63,22 @@ if(submitcheck('privacysubmit')) { require_once libfile('function/friend'); friend_cache($_G['uid']); + showmessage('do_success', 'home.php?mod=spacecp&ac=privacy&op='.$operation); + +} elseif(submitcheck('privacy3submit')) { + + $arr = array(); + + if(isset($_POST['allowasfriend'])) { + $arr['allowasfriend'] = (int)$_POST['allowasfriend']; + } + + if(isset($_POST['allowasfollow'])) { + $arr['allowasfollow'] = (int)$_POST['allowasfollow']; + } + + C::t('common_member_field_home')->update($_G['uid'], $arr); + showmessage('do_success', 'home.php?mod=spacecp&ac=privacy&op='.$operation); } @@ -89,6 +105,15 @@ if($operation == 'filter') { } } +} elseif ($operation == 'other') { + + $arr = array(); + + $fields = C::t('common_member_field_home')->fetch($_G['uid']); + + $arr['allowasfriend'][$fields['allowasfriend']] = ' selected="selected"'; + $arr['allowasfollow'][$fields['allowasfollow']] = ' selected="selected"'; + } elseif ($operation == 'getgroup') { $gid = empty($_GET['gid'])?0:intval($_GET['gid']); diff --git a/upload/source/language/home/lang_template.php b/upload/source/language/home/lang_template.php index e1ab52e9e..1af92ca1f 100644 --- a/upload/source/language/home/lang_template.php +++ b/upload/source/language/home/lang_template.php @@ -435,6 +435,8 @@ $lang = array ( 'friend_list' => '好友列表', 'friend_message' => '按照好友热度排序', 'friends' => '好友', + 'add_friends' => '添加好友', + 'add_follow' => '添加收听', 'ignore_group_feed' => '屏蔽用户组动态', 'interactive' => '互动', 'manage' => '管理', @@ -1326,6 +1328,7 @@ $lang = array ( 'open_privacy' => '公开', 'personal_feed' => '动态', 'personal_feed_settings' => '个人动态发布设置', + 'personal_other_settings' => '平台用户间互动设置', 'personal_main_page' => '个人主页', 'personal_privacy_settings' => '个人隐私设置', 'pic_blog_position' => '对日志/图片表态', @@ -1349,6 +1352,7 @@ $lang = array ( 'view_right_setting_effective' => '相关浏览权限需要在发表时单独设置方可完全生效', 'write_blog' => '撰写日志', 'you_control_see_content' => '您可以完全控制哪些人可以看到您的主页上面的内容', + 'you_control_other_operation' => '您可以完全控制其他用户是否可以和您进行互动', 'check_date_item' => '请检查该资料项', 'current_time' => '当前时间', 'email' => 'Email', diff --git a/upload/template/default/home/spacecp_privacy.htm b/upload/template/default/home/spacecp_privacy.htm index 314c8f890..59c58ba04 100644 --- a/upload/template/default/home/spacecp_privacy.htm +++ b/upload/template/default/home/spacecp_privacy.htm @@ -7,6 +7,9 @@ {lang personal_feed_settings} {lang feed_filter} + + {lang personal_other_settings} +
@@ -140,6 +143,38 @@ + +

{lang you_control_other_operation}

+ + + + + + + + + + + + + + + + + + +
{lang add_friends} + +
{lang add_follow} + +
 
+ {eval -- Gitee