Пример #1
0
 private function _getUserInfo($res, $uid, $puid)
 {
     loadcache('usergroups');
     $space = UserUtils::getUserInfo($puid);
     if (empty($space)) {
         return WebUtils::makeErrorInfo_oldVersion($res, 'space_does_not_exist');
     }
     $spacePro = UserUtils::getUserProfile($puid);
     $spaceCount = DzUserInfo::getCommonMemberCount($puid);
     $space = array_merge($space, $spacePro, $spaceCount);
     $listCount = (int) DzUserInfo::getUserPhotosHomeAlbumCount($puid);
     $res['flag'] = $uid == $puid ? 1 : 0;
     $res['is_black'] = (int) UserUtils::isBlacklist($uid, $puid) ? 1 : 0;
     $res['is_follow'] = (int) UserUtils::isFollow($uid, $puid);
     $res['isFriend'] = (int) UserUtils::isFriend($uid, $puid) ? 1 : 0;
     $res['icon'] = UserUtils::getUserAvatar($puid, $spacePro);
     $res['level_url'] = '';
     $res['name'] = $space['username'];
     $res['email'] = $space['email'];
     $res['status'] = (int) UserUtils::getUserLoginStatus($puid);
     $res['gender'] = (int) UserUtils::getUserGender($puid, $spacePro);
     $res['email'] = $space['email'];
     $res['score'] = (int) $space['credits'];
     $res['credits'] = (int) $space['credits'];
     $res['gold_num'] = (int) $space['extcredits2'];
     $res['topic_num'] = (int) $this->_getHomeTopicNum($puid);
     $res['photo_num'] = (int) $listCount['nums'];
     $res['reply_posts_num'] = (int) DzUserInfo::getTopicsByUidWithPostCount($puid);
     $res['essence_num'] = (int) $space['digestposts'];
     $res['friend_num'] = (int) DzUserInfo::getFollowFriendsCount($puid);
     $res['follow_num'] = (int) DzUserInfo::getFollowedFriendsCount($puid);
     $res['level'] = (int) DzCommonUserList::getUserLevel($space['groupid']);
     $res['userTitle'] = UserUtils::getUserTitle($puid, $space);
     $repeatList = array();
     foreach (UserUtils::getRepeatList($uid) as $user) {
         $repeatList[] = array('userName' => $user);
     }
     $res['body']['repeatList'] = $repeatList;
     $res['body']['profileList'] = $this->_getPersonalDataInfo($puid, $space);
     $res['body']['creditList'] = $this->_getStatisticalInformation($uid, $space);
     $res['body']['creditShowList'] = $this->_getStatisticalInforSet($uid, $space);
     return $res;
 }
Пример #2
0
 private function _getPostInfos($res, $topic, $page, $pageSize, $order, $authorId, $params = array())
 {
     extract($params);
     $postInfos = array();
     $tid = (int) $topic['tid'];
     $postCount = ForumUtils::getPostCount($tid, array('authorId' => $authorId));
     if (!empty($topic)) {
         global $_G;
         $isOnlyAuthorTopic = ForumUtils::isOnlyAuthorTopic($topic);
         $postList = ForumUtils::getPostList($tid, $page, $pageSize, array('order' => $order ? 'dateline DESC' : 'dateline ASC', 'authorId' => $authorId));
         $position = $order ? $postCount + 1 - $pageSize * ($page - 1) : $pageSize * ($page - 1) + 2;
         if (MobcentDiscuz::getMobcentDiscuzVersion() > 'x25' && $_G['setting']['repliesrank'] && $postList) {
             if ($postList) {
                 $tempPids = array();
                 $tempPostRecommends = array();
                 foreach ($postList as $post) {
                     $tempPids[] = (int) $post['pid'];
                 }
                 foreach (C::t('forum_hotreply_number')->fetch_all_by_pids(array_values($tempPids)) as $pid => $post) {
                     $tempPostRecommends[$pid]['support'] = dintval($post['support']);
                     // $tempPostRecommends[$pid]['against'] = dintval($post['against']);
                 }
                 $isSupport = DzSupportInfo::getSupportPostsByUidAndTid($_G['uid'], $tid);
             }
         }
         foreach ($postList as $post) {
             $pid = (int) $post['pid'];
             $content = ForumUtils::getPostContent($tid, $pid, $post);
             $isOnlyAuthorPost = $isOnlyAuthorTopic && $_G['uid'] != $post['authorid'] && $_G['uid'] != $_G['forum_thread']['authorid'] && !$post['first'] && !$_G['forum']['ismoderator'];
             $postInfo['reply_id'] = ForumUtils::isAnonymousPost($tid, $post) ? 0 : (int) $post['authorid'];
             $postInfo['reply_content'] = $isOnlyAuthorPost ? $this->_filterContent(array(array('content' => WebUtils::t('此帖仅作者可见'), 'type' => 'text'))) : $this->_getPostContent($content);
             $postInfo['reply_type'] = 'normal';
             $this->_isComplexContent($postInfo['reply_content']) && ($postInfo['reply_type'] = 'normal_complex');
             $postInfo['reply_name'] = ForumUtils::isAnonymousPost($tid, $post) ? $this->_getAnonymoustext() : $post['author'];
             $postInfo['reply_posts_id'] = $pid;
             // 抢楼帖时采用原楼层
             if (getstatus($topic['status'], 3)) {
                 $postInfo['position'] = $post['position'];
             } else {
                 $postInfo['position'] = $order ? $position-- : $position++;
             }
             $postInfo['posts_date'] = $post['dateline'] . '000';
             $postInfo['icon'] = UserUtils::getUserAvatar($postInfo['reply_id']);
             $postInfo['level'] = $this->_getUserLevel($postInfo['reply_id']);
             $postInfo['userTitle'] = UserUtils::getUserTitle($postInfo['reply_id']);
             $postInfo['location'] = ForumUtils::getPostLocation($pid);
             $postInfo['mobileSign'] = ForumUtils::getMobileSign($post['status']);
             // if(empty($post['author']) && isset($post['authorid']) && !empty($post['authorid'])){
             //     $postInfo['reply_status'] = -1;
             // }elseif(empty($post ['author']) && empty($post ['authorid'])){
             //     $postInfo['reply_status'] = 0;
             // }else{
             //     $postInfo['reply_status'] = 1;
             // }
             $postInfo['reply_status'] = 1;
             $postInfo['status'] = 1;
             $postInfo['role_num'] = 1;
             $postInfo['title'] = '';
             $postInfo = array_merge($postInfo, $this->_getPostQuoteInfo($content, $isOnlyAuthorPost));
             // 回帖管理面板编辑 start
             $userMember = $this->_getUserInfoByAuthorid($post['authorid']);
             $userMember = array_merge($userMember, $post);
             $params = array('editPerm' => $editPerm, 'userMember' => $userMember);
             // end
             $manageItems = ForumUtils::getPostManagePanel($params);
             foreach ($manageItems['post'] as $key => $item) {
                 if ($item['action'] == 'edit') {
                     $item['action'] = WebUtils::getHttpFileName("forum.php?mod=post&action=edit&fid={$post['fid']}&tid={$post['tid']}&pid={$post['pid']}");
                 } else {
                     $item['action'] = WebUtils::createUrl_oldVersion('forum/topicadminview', array('fid' => $post['fid'], 'tid' => $tid, 'pid' => $post['pid'], 'act' => $item['action'], 'type' => 'post'));
                 }
                 $manageItems['post'][$key] = $item;
             }
             $count = mb_strlen($postInfo['reply_content'][0]['infor'], $_G['charset']);
             if ($count < $_G['setting']['threadfilternum']) {
                 $isWater = true;
             }
             $isWater = false;
             $count = mb_strlen($postInfo['reply_content'][0]['infor'], $_G['charset']);
             if ($_G['setting']['filterednovote'] && $count < $_G['setting']['threadfilternum']) {
                 $isWater = true;
             }
             $extraItems = array();
             $tempExtraItems = ForumUtils::getPostExtraPanel();
             foreach ($tempExtraItems['post'] as $key => $item) {
                 $item['extParams'] = array('beforeAction' => '');
                 $item['type'] = $item['action'];
                 $item['action'] = '';
                 if ($item['type'] == 'support' && !$isWater) {
                     $item['action'] = WebUtils::createUrl_oldVersion('forum/support', array('tid' => $tid, 'pid' => $post['pid'], 'type' => 'post'));
                     $item['extParams']['recommendAdd'] = (int) $tempPostRecommends[$post['pid']]['support'];
                     $isRecommendAdd = in_array($post['pid'], $isSupport) ? 1 : 0;
                     $item['extParams']['isHasRecommendAdd'] = (int) $isRecommendAdd;
                 }
                 if ($item['type'] != 'support' || !$isWater) {
                     $extraItems[] = $item;
                 }
             }
             $postInfo['managePanel'] = $manageItems['post'];
             $postInfo['extraPanel'] = $extraItems;
             $postInfos[] = $postInfo;
         }
     }
     $res = WebUtils::getWebApiArrayWithPage_oldVersion($page, $pageSize, $postCount, $res);
     $res['list'] = $postInfos;
     return $res;
 }