|
lib/element.class.php - /**
- * 获取热门收藏
- *
- * @param string $type :无用参数
- * @param string $fid
- * @param int $num
- * @return array
- */
- function hotFavorsort($type=false,$fid='',$num=0){
- global $forum;
- $num = intval($num) ? intval($num) : $this->defaultnum;
- $sqladd = '';
- $favors = array();
- !$fid && $fid = getCommonFid();
- //* 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));
- if ($this->ifpwcache & 1024) {
- $fid && $sqladd .= " AND e.mark IN ($fid) ";
- $query = $this->db->query("SELECT t.tid,t.fid,t.author,t.authorid,t.subject,t.postdate,t.hits,t.replies,t.favors,t.lastpost FROM pw_elements e LEFT JOIN pw_threads t ON e.id=t.tid WHERE e.type='hotfavor' $sqladd ORDER BY e.value 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;
- }
- } else {
- $info = $this->singLeton(true,$num);
- $favors = $info->gethotfavor($fid,$info->cachenum);
- }
- return $favors;
- }
- /**
- * 获取最新收藏
- *
- * @param string $type :无用参数
- * @param string $fid
- * @param int $num
- * @return array
- */
- function newFavorsort($type=false,$fid='',$num=0){
- global $forum;
- $num = intval($num) ? intval($num) : $this->defaultnum;
- $sqladd = '';
- $favors = array();
- !$fid && $fid = getCommonFid();
- //* 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));
- $fid && $sqladd .= " AND e.mark IN ($fid) ";
- $query = $this->db->query("SELECT t.tid,t.fid,t.author,t.authorid,t.subject,t.hits,t.replies,t.postdate,t.hits,t.replies,t.favors,t.lastpost,e.addition,e.time,t.replies,t.hits FROM pw_elements e LEFT JOIN pw_threads t ON e.id=t.tid WHERE e.type='newfavor' $sqladd AND t.ifshield != 1 AND t.locked != 2 ORDER BY e.value 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'] = $rt['postdate'];
- $favor['favortime'] = get_date($rt['time']);
- $favor['forum'] = $forum[$rt['fid']]['name'];
- list($favor['favorid'],$favor['favorer']) = explode('|',$rt['addition']);
- unset($rt['addition']);
- $favor['image'] = '';
- $favor['replies'] = $rt['replies'];
- $favor['hits'] = $rt['hits'];
- $favor['addition'] = $rt;
- $favors[] = $favor;
- }
- return $favors;
- }
|