query("SELECT p.*, t.title as threadname, u.name as uname, u.sex as usex, u.powerlevel as upowerlevel, f.id as fid, f.title as ftitle, f.minpower as mpl "
."FROM posts p "
."LEFT JOIN users u ON p.user = u.id "
."LEFT JOIN threads t ON p.thread = t.id "
."LEFT JOIN forums f ON t.forum = f.id "
."WHERE (p.id % $posts = 0 OR p.id = 1) "
."ORDER BY p.id ASC");
$poststable = "
$tccellh colspan=6 style=\"font-weight:bold;\">Post Milestones
$tccellh width=30>
$tccellh width=280>Forum
$tccellh width=*>In Thread
$tccellh width=200>User
$tccellh width=250>Time
";
$last = 0;
while ($ms = $sql->fetch($milestones)) {
$tmp2 = $ms['id'];
while (($tmp2 -= $posts) > $tmp1) {
$poststable .= "
$tccell1>$tmp2
$tccell2>(unknown)
$tccell2>(post deleted)
$tccell1>????
$tccell1>????
$smallfont(????)
";
}
$tmp1 = $ms['id'];
if ($ms['mpl'] && $ms['mpl'] > $loguser['powerlevel']) {
$forumlink = "(restricted forum)";
$threadlink = "(restricted)";
$userlink = "????";
}
else {
$forumlink = "$ms[ftitle]";
$threadlink = "$ms[threadname]";
$userlink = "$ms[uname]";
}
if ($last)
$timetaken = "
$smallfont(".timeunits($ms['date']-$last).")";
else
$timetaken = "
$smallfont(first post)";
$last = $ms['date'];
$timestamp = date($dateformat,$ms['date']+$tzoff).$timetaken;
$poststable .= "
$tccell1>$ms[id]
$tccell2>$forumlink
$tccell2>$threadlink
$tccell1>$userlink
$tccell1>$timestamp
";
}
$tmp1 = $tmp2 = 0;
$milestones = $sql->query("SELECT t.*,u1.name AS name1,u1.sex AS sex1,u1.powerlevel AS power1,u2.name AS name2,u2.sex AS sex2,u2.powerlevel AS power2, f.minpower as mpl, f.title as forumtitle "
."FROM threads t,forums f,users u1,users u2 "
."WHERE (t.id % $threads = 0 OR t.id = 1) "
."AND f.id=t.forum "
."AND u1.id=t.user "
."AND u2.id=t.lastposter "
."ORDER BY t.id ASC");
$threadstable = "
$tccellh colspan=7 style=\"font-weight:bold;\">Thread Milestones
$tccellh width=30>
$tccellh colspan=2> Thread
$tccellh width=20%>Started by
$tccellh width=60> Replies
$tccellh width=60> Views
$tccellh width=180> Last post
";
while ($ms = $sql->fetch($milestones)) {
$tmp2 = $ms['id'];
while (($tmp2 -= $threads) > $tmp1) {
$threadstable .= "
$tccell1>$tmp2
$tccell1 width=40px>
$tccell2l>(thread deleted)
$tccell2>????
$tccell1>????
$tccell1>????
$tccell1>????$smallfont
by ????
";
}
$tmp1 = $ms['id'];
if ($ms['mpl'] && $ms['mpl'] > $loguser['powerlevel']) {
$threadlink = "(restricted)";
$userlink = "????";
$tpic = " ";
$replies = "????";
$views = "????";
$lastpost = "????$smallfont
by ????";
}
else {
$threadlink = "$ms[title]";
$threadlink .= '
'
."In ".$ms['forumtitle'].""
.'';
$userlink = "$ms[name1]";
$lastpost = date($dateformat,$ms['lastpostdate']+$tzoff)."
$smallfont
by $ms[name2]
$statusicons[getlast]
";
$replies = $ms['replies'];
$views = $ms['views'];
$tpic = ($ms['icon']) ? "
" : " ";
}
$threadstable .= "
$tccell1>$ms[id]
$tccell1 width=40px style=\"max-width:40px;max-height:30px;overflow:hidden;\">$tpic
$tccell2l>$threadlink
$tccell2>$userlink
$tccell1>$replies
$tccell1>$views
$tccell1>$lastpost
";
}
print "
$header
$poststable
$tblend
$tblstart
$threadstable
$tblend
$footer";
printtimedif($startingtime);
?>