$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']); // 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 sess_start() in /www/web/170.178.185.139/tmp/index.inc.php:7 Stack trace: #0 /www/web/170.178.185.139/index.php(52): include() #1 {main} thrown in /www/web/170.178.185.139/tmp/index.inc.php on line 7