Example #1
0
 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;
 }
Example #2
0
 /**
  * 获取最新收藏
  *
  * @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 D_P . 'data/bbscache/forum_cache.php');
     $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,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} ORDER BY e.value DESC " . pwLimit($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;
 }
Example #3
0
/**
 * 获取正常的fid
 * @param int $fid
 * @return string
 */
function getCookedCommonFid($fid)
{
    $commonForums = getCommonFid();
    if ($fid && is_numeric($fid) && strpos($commonForums, "'" . $fid . "'") !== false) {
        return $fid;
    }
    if (S::isArray($fid)) {
        foreach ($fid as $key => $value) {
            if (!$value || strpos($commonForums, "'" . $value . "'") === false) {
                unset($fid[$key]);
            }
        }
        if (S::isArray($fid)) {
            return S::sqlImplode($fid);
        }
    }
    return $commonForums;
}