public static function isHasRecommendAdd($tid) { global $_G; $recommendAdd = DzSupportInfo::getSupportTopicByUidAndTid($_G['uid'], $tid); return !empty($recommendAdd) ? 1 : 0; }
private function _getTopicInfo($topic, $params = array()) { extract($params); $topicInfo = array(); $tid = (int) $topic['tid']; if (!empty($topic)) { $post = ForumUtils::getTopicPostInfo($tid); if (!empty($post)) { $content = ForumUtils::getTopicContent($tid, $post); $sort = $this->_getSortInfo($topic); global $_G; $typeTitle = $sortTitle = ''; if ($_G['forum_thread']['typeid'] && $_G['forum']['threadtypes']['types'][$_G['forum_thread']['typeid']]) { if (!IS_ROBOT && ($_G['forum']['threadtypes']['listable'] || $_G['forum']['status'] == 3)) { $typeTitle = "[{$_G['forum']['threadtypes']['types'][$_G['forum_thread']['typeid']]}]"; } else { $typeTitle = "[{$_G['forum']['threadtypes']['types'][$_G['forum_thread']['typeid']]}]"; } } if (!empty($sort['title'])) { $sortTitle = "[{$sort['title']}]"; } $topicInfo['topic_id'] = $tid; $topicInfo['title'] = $typeTitle . $sortTitle . $topic['subject']; $topicInfo['title'] = WebUtils::emptyHtml($topicInfo['title']); // 修正帖子查看数 if (isset($_G['forum_thread']['views']) && $_G['forum_thread']['tid'] == $topic['tid'] && $_G['forum_thread']['views'] > $topic['views']) { $topic['views'] = $_G['forum_thread']['views']; } $topicInfo['type'] = ForumUtils::getTopicType($topic); $topicInfo['sortId'] = (int) $topic['sortid']; $topicInfo['user_id'] = ForumUtils::isAnonymousPost($tid, $post) ? 0 : (int) $topic['authorid']; $topicInfo['user_nick_name'] = ForumUtils::isAnonymousPost($tid, $post) ? $this->_getAnonymoustext() : $topic['author']; $topicInfo['replies'] = (int) $topic['replies']; $topicInfo['hits'] = (int) ($topic['replies'] > $topic['views'] ? $topic['replies'] : $topic['views']); $topicInfo['essence'] = ForumUtils::isMarrowTopic($topic) ? 1 : 0; $topicInfo['vote'] = ForumUtils::isVoteTopic($topic) ? 1 : 0; $topicInfo['hot'] = ForumUtils::isHotTopic($topic) ? 1 : 0; $topicInfo['top'] = ForumUtils::isTopTopic($topic) ? 1 : 0; $topicInfo['is_favor'] = ForumUtils::isFavoriteTopic($_G['uid'], $tid) ? 1 : 0; $topicInfo['create_date'] = $topic['dateline'] . '000'; $topicInfo['icon'] = UserUtils::getUserAvatar($topicInfo['user_id']); $topicInfo['level'] = $this->_getUserLevel($topicInfo['user_id']); $topicInfo['userTitle'] = UserUtils::getUserTitle($topicInfo['user_id']); $postContent = $this->_getPostContent($content); if (!empty($sort['summary'])) { array_unshift($postContent, $this->_transSortInfo($sort)); } $topicInfo['content'] = $postContent; if ($topicInfo['type'] == 'normal') { $this->_isComplexContent($topicInfo['content']) && ($topicInfo['type'] = 'normal_complex'); } $topicInfo['poll_info'] = ForumUtils::isVoteTopic($topic) ? $this->_getVoteInfo($topic) : WebUtils::getWebApiResPadding(); $topicInfo['activityInfo'] = ForumUtils::isActivityTopic($topic) ? TopicUtils::getActivityInfo($topic) : WebUtils::getWebApiResPadding(); $topicInfo['location'] = ForumUtils::getTopicLocation($tid); // 主题管理面板编辑 start $userMember = $this->_getUserInfoByAuthorid($post['authorid']); $userMember = array_merge($userMember, $post); $params = array('editPerm' => $editPerm, 'userMember' => $userMember); // end $manageItems = ForumUtils::getPostManagePanel($params); foreach ($manageItems['topic'] as $key => $item) { $item['type'] = $item['action']; if ($item['action'] == 'edit') { $item['action'] = WebUtils::getHttpFileName("forum.php?mod=post&action=edit&fid={$post['fid']}&tid={$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' => 'topic')); } $manageItems['topic'][$key] = $item; } $extraItems = ForumUtils::getPostExtraPanel(); foreach ($extraItems['topic'] as $key => $item) { $item['extParams'] = array('beforeAction' => ''); $item['type'] = $item['action']; $item['action'] = ''; if ($item['type'] == 'rate') { $item['action'] = WebUtils::createUrl_oldVersion('forum/topicrate', array('tid' => $tid, 'pid' => $post['pid'], 'type' => 'view')); $item['extParams']['beforeAction'] = WebUtils::createUrl_oldVersion('forum/topicrate', array('tid' => $tid, 'pid' => $post['pid'], 'type' => 'check')); } elseif ($item['type'] == 'support') { $item['action'] = WebUtils::createUrl_oldVersion('forum/support', array('tid' => $tid, 'pid' => $post['pid'], 'type' => 'thread')); $item['extParams']['recommendAdd'] = (int) $_G['thread']['recommend_add']; $recommendAdd = DzSupportInfo::getSupportTopicByUidAndTid($_G['uid'], $tid); $item['extParams']['isHasRecommendAdd'] = !empty($recommendAdd) ? 1 : 0; } $extraItems['topic'][$key] = $item; } $topicInfo['managePanel'] = $manageItems['topic']; $topicInfo['extraPanel'] = $extraItems['topic']; $topicInfo['mobileSign'] = ForumUtils::getMobileSign($post['status']); // if (empty($topic['author']) && !empty($topic['authorid'])){ // $topicInfo['reply_status'] = -1; // } else if(empty($topic['author']) && empty($topic['authorid'])){ // $topicInfo['reply_status'] = 0; // } else { // $topicInfo['reply_status'] = 1; // } $topicInfo['status'] = 1; $topicInfo['reply_status'] = 1; $topicInfo['flag'] = 0; $topicInfo['gender'] = 1; $topicInfo['reply_posts_id'] = (int) $post['pid']; $topicInfo['rateList'] = ForumUtils::topicRateList($post['pid']); } } return $topicInfo; }