//首页帖子主列表
tnum=35;lasttime = strtotime("-7 month");
begin=(_G['page']-1)tnum;manylist=array();
require_once libfile('function/post');
if (order=="heats"){
rs=DB::query("SELECT t.,p.pid,f.name,i.viewperm,i.extra from ".DB::table("forum_thread")." t LEFT JOIN ".DB::table("forum_post")." p on p.tid=t.tid LEFT JOIN ".DB::table("forum_forum")." f on f.fid=t.fid LEFT JOIN ".DB::table("forum_ratelog")." r on r.pid=p.pid LEFT JOIN ".DB::table("forum_forumfield")." i on i.fid=t.fid WHERE lasttime and r.extcredits=1 dp begin , rs=DB::query("SELECT t.*,p.pid,f.name,i.viewperm,i.extra from ".DB::table("forum_thread")." t LEFT JOIN ".DB::table("forum_post")." p on p.tid=t.tid LEFT JOIN ".DB::table("forum_forum")." f on f.fid=t.fid LEFT JOIN ".DB::table("forum_forumfield")." i on i.fid=t.fid WHERE lasttime and p.first=1 and f.status=1 dp begin , usergroup=user_group(userextgroupids=explode(",",preg_replace("/\s+/", ",", allauthids=array();
while (rs)) {
if (rw['readperm']>viewperms = trim(viewperms_a = explode(",",preg_replace("/\s+/", ",", $viewperms));
if (order=="heats"){
allnum=DB::result_first("select count() from ".DB::table("forum_thread")." t LEFT JOIN ".DB::table("forum_post")." p on p.tid=t.tid LEFT JOIN ".DB::table("forum_forum")." f on f.fid=t.fid LEFT JOIN ".DB::table("forum_ratelog")." r on r.pid=p.pid LEFT JOIN ".DB::table("forum_forumfield")." i on i.fid=t.fid WHERE fromt.displayorder>=0andt.dateline>lasttime and r.extcredits=1 type");
}else{
allnum=DB::result_first("select count() from ".DB::table("forum_thread")." t left join ".DB::table("forum_post")." p on p.tid=t.tid left join ".DB::table("forum_forum")." f on f.fid=t.fid left join ".DB::table("forum_forumfield")." i on i.fid=t.fid where fromt.displayorder>=0andt.dateline>lasttime and p.first=1 and f.status=1 type");
}
if(_GET['from']){
fm="from=_GET[from]&";
}
if(_GET['type']){
tp="type=_GET[type]&";
}
pagenav=multi(allnum,tnum,_G['page'],"portal.php?{fm}{tp}order=order");
ntpage=_G['page']+1;
fynum=ceil(allnum/$tnum);
//Homepage post main list
tnum=35;lasttime = strtotime("-7 months"); //Sets the time limit to seven months ago
begin=(_G['page']-1)tnum;manylist=array();
require_once libfile('function/post'); //Requires function files for forum posts
if (order=="heats"){
rs=DB::query("SELECT t.,p.pid,f.name,i.viewperm,i.extra from ".DB::table("forum_thread")." t LEFT JOIN ".DB::table("forum_post")." p on p.tid=t.tid LEFT JOIN ".DB::table("forum_forum")." f on f.fid=t.fid LEFT JOIN ".DB::table("forum_ratelog")." r on r.pid=p.pid LEFT JOIN ".DB::table("forum_forumfield")." i on i.fid=t.fid WHERE fromt.displayorder>=0andt.dateline>lasttime and r.extcredits=1 typegroupbyt.tidORDERBYdp orderbyLIMITbegin , tnum");
//Selects forum threads that fit certain criteria, including being posted within the last seven months and having a certain number of views
}else{
rs=DB::query("SELECT t.*,p.pid,f.name,i.viewperm,i.extra from ".DB::table("forum_thread")." t LEFT JOIN ".DB::table("forum_post")." p on p.tid=t.tid LEFT JOIN ".DB::table("forum_forum")." f on f.fid=t.fid LEFT JOIN ".DB::table("forum_forumfield")." i on i.fid=t.fid WHERE fromt.displayorder>=0andt.dateline>lasttime and p.first=1 and f.status=1 typegroupbyt.tidORDERBYdp orderbyLIMITbegin , tnum");
//Selects the first posts of threads in forums that are active
}
usergroup=user_group(G[′uid′]);userextgroupids=explode(",",preg_replace("/\s+/", ",", usergroup["extgroupids"]));allauthids=array();
while (rw=DB::fetch(rs)) {
if (rw['readperm'] && rw['readperm']>usergroup[viewperms = trim(rw["viewperm"]);viewperms_a = explode(",",preg_replace("/\s+/", ",", $viewperms));
code
if ($usergroup['groupid']=="1" || empty($viewperms_a)){
//All users can view
}else if (!in_array($usergroup['groupid'],$viewperms_a) && empty(array_intersect($userextgroupids, $viewperms_a))){
continue;
}
$rw['lastposterenc']=urlencode($rw['lastposter']);
$rw['lastposterid']=DB::result_first("select authorid from ".DB::table("forum_post")." where tid='$rw[tid]' and first=0 ORDER BY pid desc");
$rw['extra'] = unserialize(stripslashes($rw['extra']));
//Sets the format of the extra column to display forum color
//$rw['dateline'] = dgmdate($rw['dateline'], 'u', '9999', getglobal('setting/dateformat')); //$rw['dateline'] = dgmdate($rw['dateline'],'Y-m-d H:i');
$rw['rushreply'] = getstatus($rw['status'], 3);
//Checks whether thread is a rushreply
if($rw['highlight']) {
$colorarray = array('', '#EE1B2E', '#EE5023', '#996600', '#3C9D40', '#2897C5', '#2B65B7', '#8F2A90', '#EC1282');
$string = sprintf('%02d', $rw['highlight']);
$stylestr = sprintf('%03b', $string[0]);
$rw['highlight'] = 'style="';
$rw['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
$rw['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
$rw['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
$rw['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
$rw['highlight'] .= '"';
} else {
$rw['highlight'] = '';
}
$manylist[]=$rw;
$allauthids[]=$rw['authorid'];
}
loadcache('stamps');
if (order=="heats"){
allnum=DB::result_first("select count() from ".DB::table("forum_thread")." t LEFT JOIN ".DB::table("forum_post")." p on p.tid=t.tid LEFT JOIN ".DB::table("forum_forum")." f on f.fid=t.fid LEFT JOIN ".DB::table("forum_ratelog")." r on r.pid=p.pid LEFT JOIN ".DB::table("forum_forumfield")." i on i.fid=t.fid WHERE fromt.displayorder>=0andt.dalasttime and r.extcredits=1 allnum=DB::result_first("select count() from ".DB::table("forum_thread")." t left join ".DB::table("forum_post")." p on p.tid=t.tid left join ".DB::table("forum_forum")." f on f.fid=t.fid left join ".DB::table("forum_forumfield")." i on i.fid=t.fid where lasttime and p.first=1 and f.status=1 _GET['from']){
_GET[from]&";
}
if(tp="type=pagenav=multi(tnum,fm}{order");
_G['page']+1;
allnum/$tnum);//Sets the format of the page navigation for the main thread list of the homepage.