public static function getRecommendAdd($tid) { return DzSupportInfo::getSupportTopicCount($tid); }
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; }