zhangjingyu
lib/getinfo.class.php文件里有相关代码,不过,应该不是重点,放上来也备份下吧(用处似乎应该是读取主题相关信息的)。
function hotfavor($fid = 0, $num = 0) {
global $timestamp;
!$fid && $fid = getCommonFid();
$num = intval($num) ? intval($num) : $this->cachenum;
$sqladd = '';
$fid && $sqladd .= " AND fid IN ($fid) ";
$hotfavor = array();
$query = $this->db->query("SELECT tid as id,fid as mark,favors as value FROM pw_threads WHERE favors>0 AND postdate >=" . S::sqlEscape($timestamp - 360 * 24 * 3600) . " $sqladd ORDER BY favors DESC " . S::sqlLimit($num));
while ($rt = $this->db->fetch_array($query)) {
$hotfavor[] = $rt;
}
return $hotfavor;
}
function gethotfavor($fid = 0, $num = 0) {
global $timestamp, $forum;
!$fid && $fid = getCommonFid();
$num = intval($num) ? intval($num) : $this->cachenum;
$sqladd = '';
$fid && $sqladd .= " AND fid IN ($fid) ";
//* isset($forum) || include pwCache::getPath(D_P . 'data/bbscache/forum_cache.php');
isset($forum) || extract(pwCache::getData(D_P . 'data/bbscache/forum_cache.php', false));
$favors = array();
$query = $this->db->query("SELECT tid,fid,author,authorid,subject,postdate,hits,replies,favors FROM pw_threads WHERE favors>0 AND postdate >=" . S::sqlEscape($timestamp - 360 * 24 * 3600) . " $sqladd ORDER BY favors DESC " . S::sqlLimit($num));
while ($rt = $this->db->fetch_array($query)) {
$favor = array();
$favor['url'] = 'read.php?tid=' . $rt['tid'];
$favor['title'] = $rt['subject'];
$favor['value'] = $rt['favors'];
$favor['posttime'] = get_date($rt['postdate']);
$favor['forum'] = $forum[$rt['fid']]['name'];
$favor['image'] = '';
$favor['addition'] = $rt;
$favors[] = $favor;
}
return $favors;
}