private function _getUserInfos($uid, $longitude, $latitude, $radius, $page, $pageSize) { $userInfos = array('count' => 0, 'list' => array()); $count = SurroundingInfo::getUserCountByUid($uid, $longitude, $latitude, $radius); $surroundUsers = SurroundingInfo::getAllUsersByUid($uid, $longitude, $latitude, $radius, $page, $pageSize); $list = array(); foreach ($surroundUsers as $user) { $userInfo = array(); $tmpUid = (int) $user['object_id']; $userInfo['uid'] = $tmpUid; $userInfo['distance'] = $user['distance']; $userInfo['location'] = $user['location']; $userInfo['nickname'] = UserUtils::getUserName($tmpUid); $userInfo['gender'] = UserUtils::getUserGender($tmpUid); $userInfo['status'] = UserUtils::getUserLoginStatus($tmpUid) == UserUtils::STATUS_ONLINE ? 1 : 0; $userInfo['icon'] = UserUtils::getUserAvatar($tmpUid); // $userInfo['is_friend'] = UserUtils::isFriend($uid, $tmpUid) ? 1 : 0; $userInfo['is_friend'] = UserUtils::isFollow($uid, $tmpUid) ? 1 : 0; $userInfo['is_black'] = UserUtils::isBlacklist($uid, $tmpUid) ? 1 : 0; $list[] = $userInfo; } $userInfos['count'] = $count; $userInfos['list'] = $list; return $userInfos; }
private function _transTopicList($topicList, $type) { $list = array(); global $_G; $forum = $_G['forum']; foreach ($topicList as $topic) { $tmpTopicInfo = ForumUtils::getTopicInfo((int) $topic); $topicSummary = ForumUtils::getTopicSummary((int) $topic); $topicInfo['board_id'] = (int) $tmpTopicInfo['fid']; $topicInfo['board_name'] = $fid != 0 ? $forum['name'] : ForumUtils::getForumName($tmpTopicInfo['fid']); $topicInfo['board_name'] = WebUtils::emptyHtml($topicInfo['board_name']); $topicInfo['topic_id'] = (int) $topic; $topicInfo['type_id'] = (int) $tmpTopicInfo['typeid']; $topicInfo['sort_id'] = (int) $tmpTopicInfo['sortid']; $topicInfo['title'] = WebUtils::emptyHtml($tmpTopicInfo['subject']); $topicSummary['msg'] = WebUtils::emptyReturnLine($topicSummary['msg'], ' '); $topicInfo['subject'] = $topicSummary['msg']; $topicInfo['user_id'] = (int) $tmpTopicInfo['authorid']; if ($type = 'favorite' && empty($tmpTopicInfo['author'])) { $dateline = UserTopicInfo::getUserfavorite($_G['uid'], $topic); $topicInfo['last_reply_date'] = $dateline . '000'; $topicInfo['user_nick_name'] = UserUtils::getUserName($dateline['uid']); } else { $topicInfo['last_reply_date'] = $tmpTopicInfo['dateline'] . '000'; $topicInfo['user_nick_name'] = (string) $tmpTopicInfo['author']; } $topicInfo['hits'] = (int) $tmpTopicInfo['views']; $topicInfo['replies'] = (int) $tmpTopicInfo['replies']; $topicInfo['top'] = (int) ForumUtils::isTopTopic($topic) ? 1 : 0; $topicInfo['status'] = (int) $tmpTopicInfo['status']; $topicInfo['essence'] = (int) $tmpTopicInfo['digest'] ? 1 : 0; $topicInfo['hot'] = (int) $tmpTopicInfo['highlight'] ? 1 : 0; $topicInfo['pic_path'] = ImageUtils::getThumbImage($topicSummary['image']); $list[] = $topicInfo; } return $list; }
private function _userBlackSetting($res, $blackUid) { global $_G; $uid = $_G['uid']; $blackName = UserUtils::getUserName($blackUid); require_once libfile('function/friend'); if (!($blackName = C::t('common_member')->fetch_by_username($blackName))) { $res = $this->makeErrorInfo($res, 'space_does_not_exist'); } elseif ($blackUid == $uid) { $res = $this->makeErrorInfo($res, 'unable_to_manage_self'); } else { friend_delete($blackUid); C::t('home_blacklist')->insert(array('uid' => $uid, 'buid' => $blackUid, 'dateline' => $_G['timestamp']), false, false, true); $params['noError'] = 1; $res = $this->makeErrorInfo($res, 'do_success', $params); } return $res; }
private function _transUserList($users, $viewUid, $longitude, $latitude, $radius, $page, $pageSize, $sortType) { loadcache('usergroups'); $list = array(); foreach ($users as $user) { if ($sortType == 'range') { $tmpUserInfo['distance'] = (string) $user['distance']; $tmpUserInfo['location'] = (string) WebUtils::t($user['location']); $uid = $user['uid']; } else { $tmpUserInfo['distance'] = ''; $tmpUserInfo['location'] = ''; $uid = $user; } $tmpUserInfo['is_friend'] = UserUtils::isFollow($viewUid, $uid) ? 1 : 0; $tmpUserInfo['isFriend'] = UserUtils::isFriend($viewUid, $uid) ? 1 : 0; $tmpUserInfo['isFollow'] = UserUtils::isFollow($viewUid, $uid) ? 1 : 0; $tmpUserInfo['uid'] = (int) $uid; $tmpUserInfo['name'] = UserUtils::getUserName($uid); $tmpUserInfo['name'] = WebUtils::emptyHtml($tmpUserInfo['name']); $tmpUserInfo['status'] = (int) UserUtils::getUserLoginStatus($uid); $tmpUserInfo['is_black'] = UserUtils::isBlacklist($viewUid, $uid) ? 1 : 0; $tmpUserInfo['gender'] = (int) UserUtils::getUserGender($uid); $tmpUserInfo['icon'] = UserUtils::getUserAvatar($uid); $tmpUserInfo['level'] = (int) DzCommonUserList::getUserLevel($uid); $lastLogin = WebUtils::t(DzCommonUserList::getUserLastVisit($uid)); $tmpUserInfo['lastLogin'] = $lastLogin . '000'; if ($sortType == 'regdate') { $lastRegdate = DzCommonUserList::getUserLastRegdate($uid); $tmpUserInfo['dateline'] = $lastRegdate . '000'; } else { $tmpUserInfo['dateline'] = $lastLogin . '000'; } $signature = WebUtils::emptyHtml(DzCommonUserList::getUserSightml($uid)); $tmpUserInfo['signature'] = WebUtils::t($signature); $userInfo = UserUtils::getUserInfo($uid); $tmpUserInfo['credits'] = (int) $userInfo['credits']; $list[] = $tmpUserInfo; } return $list; }