zhangjingyu
帖内置顶相关代码
//帖内置顶相关处理
if ($topped_count) {
$topped_page_num = $db_readperpage;
$start_limit = (int)($page-1)*$db_readperpage - 1;
if ($start_limit < 0) {
$topped_page_num += $start_limit;
$start_limit = 0;
}
$topped_count - $start_limit < $db_readperpage && $topped_page_num = $topped_count - $start_limit;
$topped_page_num = $topped_page_num < 0 ? 0 : $topped_page_num;
if ($topped_count > $start_limit) {
$limit = S::sqlLimit($start_limit,$topped_page_num);
$query = $db->query("SELECT t.floor, p.* $fieldadd FROM pw_poststopped t
LEFT JOIN $pw_posts p ON t.pid = p.pid $tablaadd
WHERE t.tid = ".S::sqlEscape($tid)." AND t.fid = '0' AND t.pid != '0' AND p.ifcheck = '1' ORDER BY t.uptime desc $limit");
while ($rd = $db->fetch_array($query)) {
$_uids[$rd['authorid']] = 'UID_'.$rd['authorid'];
$rd['aid'] && $_pids[$rd['pid']] = $rd['pid'];
$rd['istop'] = "topped";
$_page = ceil(($rd['floor'] + 1 + $topped_count)/$db_readperpage);
$rd['jumpurl'] = "read.php?tid=$tid&page=$_page#".$rd['pid'];
//$rd['remindinfo'] = '';
$readdb[] = $rd;
$pids[] = $rd['pid'];
}
}
}
list($replies,$hits) = array(intval($read['replies']),intval($read['hits']));
置顶 (来自$read[floor]楼)
帖内置顶表 pw_poststopped
fid tid pid floor uptime overtime