Deprecated: Function get_magic_quotes_gpc() is deprecated in /www/wwwroot/fxw15.cc/xiunophp/xiunophp.php on line 20
page = 1, $pagesize = 20, $order = 'lastpid') {
global $conf, $forumlist, $runtime;
$threadlist = thread__find_by_fid($fid, $page, $pagesize, $order);
// 查找置顶帖
if($order == $conf['order_default'] && $page == 1) {
$toplist3 = thread_top_find(0);
$toplist1 = thread_top_find($fid);
//$toplist = thread_top_find($fid);
$threadlist = $toplist3 + $toplist1 + $threadlist;
}
return $threadlist;
}
// 从多个版块获取列表数据
function thread_find_by_fids($fids, $page = 1, $pagesize = 20, $order = 'lastpid', $threads = FALSE) {
$threadlist = thread_find(array('fid'=>$fids), array($order=>-1), $page, $pagesize);
return $threadlist;
}
// 默认搜索标题
function thread_find_by_keyword($keyword) {
$threadlist = db_find('thread', array('subject'=>array('LIKE'=>$keyword)), array(), 1, 60);
$threadlist = arrlist_multisort($threadlist, 'tid', FALSE); // 用 PHP 排序,mysql 排序消耗太大。
if($threadlist) {
foreach ($threadlist as &$thread) {
thread_format($thread);
$thread['subject'] = post_highlight_keyword($thread['subject'], $keyword);
}
}
return $threadlist;
}
function thread_format(&$thread) {
global $conf, $forumlist;
if(empty($thread)) return;
$thread['create_date_fmt'] = humandate($thread['create_date']);
$thread['last_date_fmt'] = humandate($thread['last_date']);
$user = user_read_cache($thread['uid']);
$thread['username'] = $user['username'];
$thread['user_avatar_url'] = $user['avatar_url'];
$thread['user'] = $user;
$forum = isset($forumlist[$thread['fid']]) ? $forumlist[$thread['fid']] : array('name'=>'');
$thread['forumname'] = $forum['name'];
if($thread['last_date'] == $thread['create_date']) {
//$thread['last_date'] = 0;
$thread['last_date_fmt'] = '';
$thread['lastuid'] = 0;
$thread['lastusername'] = '';
} else {
$lastuser = $thread['lastuid'] ? user_read_cache($thread['lastuid']) : array();
$thread['lastusername'] = $thread['lastuid'] ? $lastuser['username'] : lang('guest');
}
$thread['url'] = "thread-$thread[tid].htm";
$thread['user_url'] = "user-$thread[uid]".($thread['uid'] ? '' : "-$thread[firstpid]").".htm";
$thread['top_class'] = $thread['top'] ? 'top_'.$thread['top'] : '';
$thread['pages'] = ceil($thread['posts'] / $conf['postlist_pagesize']);
$count_golds = fox_rewardlog_count_golds($thread['tid']);
$thread['reward'] = !empty($count_golds) ? $count_golds : 0;
unset($count_golds);
// todo
// 如果版块启用了主题分类,则查询。
global $time;
static $tag_update_time = 0;
if(empty($tag_update_time)) {
$tag_update_time = setting_get('tag_update_time');
}
$thread['taglist'] = array();
if(!empty($forum['tagcatelist'])) {
// 查询一下,此处应该有字段判断
// tagids
$tagidarr = array();
if($thread['tagids_time'] < $tag_update_time) {
$tagidarr = tag_thread_find_tagid_by_tid($thread['tid'], $forum['tagcatelist']);
$thread['tagids'] = implode(',', $tagidarr);
thread_update($thread['tid'], array('tagids'=>$thread['tagids'], 'tagids_time'=>$time));
} else {
$tagidarr = explode(',', $thread['tagids']);
}
foreach($tagidarr as $tagid) {
isset($forum['tagmap'][$tagid]) AND $thread['taglist'][] = $forum['tagmap'][$tagid];
}
}
}
function thread_format_last_date(&$thread) {
if($thread['last_date'] != $thread['create_date']) {
$thread['last_date_fmt'] = humandate($thread['last_date']);
} else {
$thread['create_date_fmt'] = humandate($thread['create_date']);
}
}
function thread_count($cond = array()) {
$n = db_count('thread', $cond);
return $n;
}
function thread_maxid() {
$n = db_maxid('thread', 'tid');
return $n;
}
function thread_safe_info($thread) {
unset($thread['userip']);
if(!empty($thread['user'])) {
$thread['user'] = user_safe_info($thread['user']);
}
return $thread;
}
function thread_get_level($n, $levelarr) {
foreach($levelarr as $k=>$level) {
if($n <= $level) return $k;
}
return $k;
}
// 对 $threadlist 权限过滤
function thread_list_access_filter(&$threadlist, $gid) {
global $conf, $forumlist;
if(empty($threadlist)) return;
foreach($threadlist as $tid=>$thread) {
if(empty($forumlist[$thread['fid']]['accesson'])) continue;
if($thread['top'] > 0) continue;
if(!forum_access_user($thread['fid'], $gid, 'allowread')) {
unset($threadlist[$tid]);
}
}
global $uid,$group;
$see_check = check_need_check($group,'see');
foreach($threadlist as $tid=>$thread)
if($thread['OK']!='1' && (!$see_check) && $uid!=$thread['uid'])
unset($threadlist[$tid]);
}
function thread_find_by_tids($tids, $order = array('lastpid'=>-1)) {
//$start = ($page - 1) * $pagesize;
//$tids = array_slice($tids, $start, $pagesize);
if(!$tids) return array();
$threadlist = db_find('thread', array('tid'=>$tids), $order, 1, 1000, 'tid');
if($threadlist) foreach($threadlist as &$thread) thread_format($thread);
return $threadlist;
}
// 查找 lastpid
function thread_find_lastpid($tid) {
$arr = db_find_one("post", array('tid'=>$tid), array('pid'=>-1), array('pid'));
$lastpid = empty($arr) ? 0 : $arr['pid'];
return $lastpid;
}
// 更新最后的 uid pid
function thread_update_last($tid) {
$lastpid = thread_find_lastpid($tid);
if(empty($lastpid)) return;
$lastpost = post__read($lastpid);
if(empty($lastpost)) return;
$r = thread__update($tid, array('lastpid'=>$lastpid, 'lastuid'=>$lastpost['uid'], 'last_date'=>$lastpost['create_date']));
return $r;
}
?>
Fatal error: Uncaught Error: Call to undefined function thread_read() in /www/wwwroot/fxw15.cc/tmp/route_thread.php:774
Stack trace:
#0 /www/wwwroot/fxw15.cc/tmp/index.inc.php(77): include()
#1 /www/wwwroot/fxw15.cc/index.php(52): include('/www/wwwroot/fx...')
#2 {main}
thrown in /www/wwwroot/fxw15.cc/tmp/route_thread.php on line 774