privacy_update(); showmessage('do_success', $_POST['refer']); } } elseif ($op == 'groupignore') { $groups = getfriendgroup(); $group = intval($_GET['group']); if (!isset($groups[$group])) { showmessage('change_friend_groupname_error'); } if (submitcheck('groupignoresubmit')) { if (isset($space['privacy']['filter_gid'][$group])) { unset($space['privacy']['filter_gid'][$group]); } else { $space['privacy']['filter_gid'][$group] = $group; } privacy_update(); friend_cache($_SGLOBAL['supe_uid']); //缓存更新 showmessage('do_success', $_POST['refer'], 0); } } elseif ($op == 'blacklist') { if ($_GET['subop'] == 'delete') { $_GET['uid'] = intval($_GET['uid']); $_SGLOBAL['db']->query("DELETE FROM " . tname('blacklist') . " WHERE uid='{$space['uid']}' AND buid='{$_GET['uid']}'"); showmessage('do_success', "space.php?do=friend&view=blacklist&start={$_GET['start']}", 0); } if (submitcheck('blacklistsubmit')) { $_POST['username'] = trim($_POST['username']); $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('space') . " WHERE username='******'username']}'"); if (!($tospace = $_SGLOBAL['db']->fetch_array($query))) { showmessage('space_does_not_exist');
private function _adminUser($act, $uid) { global $_G; $errorMsg = ''; require_once libfile('function/spacecp'); require_once libfile('function/home'); require_once libfile('function/friend'); if (friend_request_check($uid) && $act == 'add') { $act = 'add2'; } if ($act == 'add' || $act == 'add2') { if ($uid == $_G['uid']) { $list = $this->makeErrorInfo($res, 'friend_self_error'); $this->_exitWithHtmlAlert($list['errcode']); } if (friend_check($uid)) { $list = $this->makeErrorInfo($res, 'you_have_friends'); $this->_exitWithHtmlAlert($list['errcode']); } $tospace = getuserbyuid($uid); if (empty($tospace)) { $list = $this->makeErrorInfo($res, 'space_does_not_exist'); $this->_exitWithHtmlAlert($list['errcode']); } if (isblacklist($tospace['uid'])) { $list = $this->makeErrorInfo($res, 'is_blacklist'); $this->_exitWithHtmlAlert($list['errcode']); } space_merge($space, 'count'); space_merge($space, 'field_home'); $maxfriendnum = checkperm('maxfriendnum'); if ($maxfriendnum && $space['friends'] >= $maxfriendnum + $space['addfriend']) { if ($_G['magic']['friendnum']) { $list = $this->makeErrorInfo($res, 'enough_of_the_number_of_friends_with_magic'); $this->_exitWithHtmlAlert($list['errcode']); } else { $list = $this->makeErrorInfo($res, 'enough_of_the_number_of_friends'); $this->_exitWithHtmlAlert($list['errcode']); } } if ($act == 'add') { if (!checkperm('allowfriend')) { $list = $this->makeErrorInfo($res, 'no_privilege_addfriend'); $this->_exitWithHtmlAlert($list['errcode']); } if (C::t('home_friend_request')->count_by_uid_fuid($uid, $_G['uid'])) { $list = $this->makeErrorInfo($res, 'waiting_for_the_other_test'); $this->_exitWithHtmlAlert($list['errcode']); } } } require_once libfile('function/friend'); require_once libfile('function/spacecp'); if (!empty($_POST)) { switch ($act) { case 'add': $note = $_GET['note']; if (!friend_request_check($uid)) { $_POST['gid'] = $gid; $_POST['note'] = censor(htmlspecialchars(cutstr($note, strtolower(CHARSET) == 'utf-8' ? 30 : 20, ''))); friend_add($uid, $_POST['gid'], $_POST['note']); $note = array('uid' => $_G['uid'], 'url' => 'home.php?mod=spacecp&ac=friend&op=add&uid=' . $_G['uid'] . '&from=notice', 'from_id' => $_G['uid'], 'from_idtype' => 'friendrequest', 'note' => !empty($_POST['note']) ? lang('spacecp', 'friend_request_note', array('note' => $_POST['note'])) : ''); notification_add($uid, 'friend', 'friend_request', $note); // ios push UserUtils::pushIOSMessage($uid, 'friend', $_G['username'] . WebUtils::t(' 请求加您为好友') . $note['note']); require_once libfile('function/mail'); $values = array('username' => $tospace['username'], 'url' => getsiteurl() . 'home.php?mod=spacecp&ac=friend&op=request'); sendmail_touser($uid, lang('spacecp', 'friend_subject', $values), '', 'friend_add'); $list = $this->makeErrorInfo($res, 'request_has_been_sent'); $this->_exitWithHtmlAlert($list['errcode']); } $this->_exitWithHtmlAlert($res['errcode']); case 'add2': global $_G; require_once libfile('function/home'); $_POST['gid'] = intval($gid); friend_add($uid, $uid); if (ckprivacy('friend', 'feed')) { require_once libfile('function/feed'); feed_add('friend', 'feed_friend_title', array('touser' => "<a href=\"home.php?mod=space&uid={$tospace['uid']}\">{$tospace['username']}</a>")); } notification_add($uid, 'friend', 'friend_add'); // showmessage('friends_add', dreferer(), array('username' => $tospace['username'], 'uid'=>$uid, 'from' => $_GET['from']), array('showdialog'=>1, 'showmsg' => true, 'closetime' => true)); $list = $this->makeErrorInfo($res, 'friends_add', array('{username}' => $tospace['username'])); $this->_exitWithHtmlAlert($list['errcode']); break; case 'ignore': global $_G; require_once libfile('function/friend'); friend_delete($uid); $params['noError'] = 1; $list = $this->makeErrorInfo($res, 'do_success', $params); $this->_exitWithHtmlAlert($list['errcode']); break; case 'shield': global $_G, $space; // $type = empty($_GET['type'])?'':preg_replace("/[^0-9a-zA-Z\_\-\.]/", '', $_GET['type']); // if(submitcheck('ignoresubmit')) { $authorid = empty($_POST['authorid']) ? 0 : intval($_POST['authorid']); $type = 'friend'; if ($type) { $type_uid = $type . '|' . $authorid; if (empty($space['privacy']['filter_note']) || !is_array($space['privacy']['filter_note'])) { $space['privacy']['filter_note'] = array(); } $space['privacy']['filter_note'][$type_uid] = $type_uid; privacy_update(); } $this->_exitWithHtmlAlert('do_success'); // showmessage('do_success', dreferer(), array(), array('showdialog'=>1, 'showmsg' => true, 'closetime' => true)); // } $formid = random(8); break; default: $errorMsg = '错误的动作参数'; break; } } else { if ($act == 'add') { require_once libfile('function/friend'); $groups = $this->_getFriendGroupList(); $tospace = getuserbyuid($uid); } elseif ($act == 'add2') { require_once libfile('function/friend'); $groups = $this->_getFriendGroupList(); $tospace = $this->_getFriendUserByUid($uid); } } $this->getController()->renderPartial('userAdmin', array('formUrl' => WebUtils::createUrl_oldVersion('user/useradminview', array('uid' => $uid, 'act' => $act, 'type' => $type)), 'errorMsg' => $errorMsg, 'action' => $act, '_G' => $_G, 'groups' => $groups, 'tospace' => $tospace)); }