function getPost($tid, $sort, $offset, $limit) { global $db_postmin, $db_postmax, $foruminfo, $fid, $pwforum; list($tid, $offset, $limit) = array(intval($tid), intval($offset), intval($limit)); if ($tid < 1) { return $this->buildResponse(THREAD_INVALID_PARAMS); } $threadInfo = $GLOBALS['db']->get_one("SELECT * FROM pw_threads WHERE tid=" . S::sqlEscape($tid) . " AND ifcheck = 1 AND fid != 0"); if (!S::isArray($threadInfo)) { return $this->buildResponse(THREAD_NOT_EXIST); } $user = $this->getCurrentUser(); $user->init(array('reply')); $user->initRight(); $this->getCustomizedCommonService()->getReadRight($user); L::loadClass('forum', 'forum', false); $pwforum = new PwForum($threadInfo['fid']); if (!$pwforum->isForum(true)) { return $this->buildResponse(THREAD_FORUM_NOT_EXIST); } $fid = $pwforum->fid; $foruminfo = $pwforum->foruminfo; $pwforum->forumcheck($user->info, $user->groupid); $pwforum->creditcheck($user->info, $user->groupid); if (!$user->allowcheck($pwforum->foruminfo['allowread']) && !$pwforum->isBM($user->username)) { return $this->buildResponse(THREAD_ALLOW_READ); } if ($threadInfo['ifcheck'] == 0 && $user->username != $threadInfo['author'] && !$user->getSystemRight('viewcheck')) { return $this->buildResponse(THREAD_READ_CHECK); } if ($threadInfo['locked'] % 3 == 2 && !$user->getSystemRight('viewclose')) { return $this->buildResponse(THREAD_READ_LOCKED); } $return = $_pids = array(); $pw_posts = $this->getCustomizedCommonService()->getPtable($tid); $return['count'] = $GLOBALS['db']->get_value("SELECT count(*) FROM {$pw_posts} WHERE tid=" . S::sqlEscape($tid) . " AND ifcheck='1'"); $comments = $this->_getreplys($tid, $offset, $limit, $sort); foreach ($comments as $key => $value) { $value['aid'] && ($_pids[$value['pid']] = $value['pid']); } $_attachList = array(); if ($_pids) { $query = $GLOBALS['db']->query('SELECT * FROM pw_attachs WHERE tid=' . pwEscape($tid) . " AND pid IN (" . pwImplode($_pids) . ")"); while ($rt = $GLOBALS['db']->fetch_array($query)) { $_attachList[$rt['pid']][] = $rt; } } $return['posts'] = array(); foreach ($comments as $key => $value) { $value['content'] = $this->getCustomizedCommonService()->clearHtmlTag($value['content'], '<br>'); $value['content'] = $this->getCustomizedCommonService()->parseEmotionInContent($value['content']); $value['attachlist'] = array_merge($value['attachlist'], $this->getCustomizedCommonService()->getAttachWithThumblist($_attachList[$value['pid']])); $this->getCustomizedCommonService()->clearAttachSign($_attachList[$value['pid']], &$value['content']); $return['posts'][] = $value; } return $this->buildResponse(0, $return); }
if ($pwSystem && ($pwSystem['tpccheck'] || $pwSystem['digestadmin'] || $pwSystem['lockadmin'] || $pwSystem['pushadmin'] || $pwSystem['coloradmin'] || $pwSystem['downadmin'] || $pwSystem['delatc'] || $pwSystem['moveatc'] || $pwSystem['copyatc'] || $pwSystem['topped'] || $pwSystem['unite'] || $pwSystem['pingcp'] || $pwSystem['areapush'] || $pwSystem['split'])) { $managecheck = 1; } $pwPostHide = $pwSystem['posthide']; $pwSellHide = $pwSystem['sellhide']; $pwEncodeHide = $pwSystem['encodehide']; } else { $managecheck = $pwPostHide = $pwSellHide = $pwEncodeHide = 1; } } //版块查看权限 if ($foruminfo['allowread'] && !$admincheck && !allowcheck($foruminfo['allowread'], $groupid, $winddb['groups'])) { Showmsg('forum_read_right'); } if (!$admincheck) { $pwforum->creditcheck($winddb, $groupid); #积分限制浏览 $pwforum->sellcheck($winduid); #出售版块 } if ($read['ifcheck'] == 0 && !$isGM && $windid != $read['author'] && !$pwSystem['viewcheck']) { Showmsg('read_check'); } if ($read['locked'] % 3 == 2 && !$isGM && !$pwSystem['viewclose']) { Showmsg('read_locked'); } unset($S_sql, $J_sql, $foruminfo['forumset']); //来自群组的帖子 if ($colony && (!$colony['ifopen'] && !$admincheck && (!$colony['ifcyer'] || $colony['ifadmin'] == -1))) { Showmsg('该群组话题内容仅对成员开放!'); }