$tblstart$tccell1>\"$t[title]\" has been added to your favorites.
".redirect("forum.php?id=$t[forum]",'return to the forum',0).$tblend.$footer;
printtimedif($startingtime);
die();
} elseif($act=='rem') {
$t=mysql_fetch_array(mysql_query("SELECT title,forum FROM threads WHERE id=$thread"));
mysql_query("DELETE FROM favorites WHERE user=$loguserid AND thread=$thread");
print "$header
$tblstart$tccell1>\"$t[title]\" has been removed from your favorites.
".redirect("forum.php?id=$t[forum]",'return to the forum',0).$tblend.$footer;
printtimedif($startingtime);
die();
}
if($id) $fonline=fonlineusers($id);
$hotcount=mysql_result(mysql_query('SELECT hotcount FROM misc'),0,0);
if($log && $id){
$headlinks.=" - Mark forum read";
}
$header=makeheader($header1,$headlinks,$header2 ." $tblstart$tccell1s>$fonline$tblend");
if(!$ppp) $ppp=(!$log?20:$loguser[postsperpage]);
if(!$tpp) $tpp=(!$log?50:$loguser[threadsperpage]);
if($id) {
if (!$forum['nopolls']) {
$newpollx = "$newpollpic - ";
} else {
$newpollx = "
- ";
}
$newpost="
$newpollx$newthreadpic";
}
print "
$header
$tblstart
";
if($forum[minpower]>0 and ($log and $power<$forum[minpower]))
print "
$tccell1>Couldn't enter this restricted forum, as you don't have access to it.
".redirect('index.php','return to the board',0);
elseif($forum[minpower]>0 and !$log)
print "
$tccell1>Couldn't enter this restricted forum, as you are not logged in.
".redirect('login.php','log in (then try again)',0);
else{
if($id){
$anncs=mysql_query('SELECT announcements.id,user,date,announcements.title,name,sex,powerlevel FROM announcements,users WHERE forum=0 AND user=users.id ORDER BY date DESC LIMIT 1');
if($annc=mysql_fetch_array($anncs)){
$namecolor=getnamecolor($annc[sex],$annc[powerlevel]);
print "
| Announcements |
". ($loguser['lastannouncement'] < $annc['id'] && $loguser['id'] ? $newpic : " ") ." |
$annc[title] -- Posted by $annc[name] on ".date($dateformat,$annc[date]+$tzoff)." |
";
}
$anncs=mysql_query("SELECT user,date,announcements.title,name,sex,powerlevel FROM announcements,users WHERE forum=$id AND user=users.id ORDER BY date DESC LIMIT 1");
if($annc=mysql_fetch_array($anncs)){
$namecolor=getnamecolor($annc[sex],$annc[powerlevel]);
print "
$tccellhs colspan=7>Forum announcements
$tccell1l colspan=7>$annc[title] -- Posted by $annc[name] on ".date($dateformat,$annc[date]+$tzoff)."
";
}
}
print "
$tccellh width=30>
$tccellh colspan=2> Thread
$tccellh>Started by
$tccellh width=60> Replies
$tccellh width=60> Views
$tccellh width=150> Last post
";
$min=$page*$tpp;
if($id) $threads=mysql_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". ($log ? ", r.read AS tread, r.time as treadtime " : " ")
."FROM threads t "
.($log ? "LEFT JOIN threadsread r ON (t.id=r.tid AND r.uid=$loguser[id]) " : "")
.",users u1,users u2 "
."WHERE forum=$id "
."AND u1.id=t.user "
."AND u2.id=t.lastposter "
."ORDER BY sticky DESC,lastpostdate DESC "
# ."ORDER BY lastpostdate DESC "
."LIMIT $min,$tpp") or print mysql_error();
// if($id) $threads=mysql_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 FROM threads t,users u1,users u2 WHERE forum=$id AND u1.id=t.user AND u2.id=t.lastposter ORDER BY sticky DESC,lastpostdate DESC LIMIT $min,$tpp");
elseif($user){
$threadcount=mysql_result(mysql_query("SELECT COUNT(*) FROM threads where user=$user"),0,0);
$threads=mysql_query("SELECT threads.*,'".addslashes($user1[name])."' AS name1,$user1[sex] AS sex1,$user1[powerlevel] AS power1,name AS name2,sex AS sex2,powerlevel AS power2,minpower FROM threads,users,forums WHERE user=$user AND users.id=threads.lastposter AND forums.id=forum ORDER BY sticky DESC,lastpostdate DESC LIMIT $min,$tpp");
}elseif($fav){
if(!$u or !$isadmin) $u=$loguserid;
$threadcount=mysql_result(mysql_query("SELECT COUNT(*) FROM favorites where user=$u"),0,0);
$threads=mysql_query("SELECT threads.*,u1.name AS name1,u1.sex AS sex1,u1.powerlevel AS power1,u2.name AS name2,u2.sex AS sex2,u2.powerlevel AS power2,minpower FROM threads,users AS u1,users AS u2,forums,favorites WHERE u1.id=threads.user AND u2.id=threads.lastposter AND favorites.thread=threads.id AND favorites.user=$u AND forums.id=forum ORDER BY sticky DESC,lastpostdate DESC LIMIT $min,$tpp");
}
if($threadcount>$tpp){
$query=($id?"id=$id":"user=$user");
$pagelinks2=$smallfont."Pages:";
for($k=0;$k<($threadcount/$tpp);$k++)
$pagelinks2.=($k!=$page?" ".($k+1).'':' '.($k+1));
}
$sticklast=0;
for($i=1;$thread=@mysql_fetch_array($threads, MYSQL_ASSOC);$i++){
if($sticklast and !$thread[sticky]) print "
$tccellh colspan=7>
";
$sticklast=$thread[sticky];
# $thread['sticky'] = 0;
$new = " ";
$newpost = false;
$threadstatus = "";
if((($thread[lastpostdate]>$postread[$id] && !$thread['tread']) and $log and $id) or ($thread[lastpostdate]>ctime()-3600 and (!$log or !$id))){
$threadstatus .= "new";
$newpost = true;
$newpostt = ($log ? ($thread['treadtime'] ? $thread['treadtime'] : $postread[$id]) : ctime() - 3600);
}
if ($thread['replies'] >= $hotcount and $hotcount) $threadstatus .= "hot";
if ($thread['closed']) $threadstatus .= "off";
if ($threadstatus) $new = $statusicons[$threadstatus];
$posticon="
";
$pagelinks='';
if($thread[replies]>=$ppp){
// $pagelinks=$smallfont.'(Pages:';
// for($k=0;$k<(($thread[replies]+1)/$ppp);$k++) $pagelinks.=" ".($k+1).'';
// $pagelinks.=')';
if ($loguser['pagestyle']) {
$pagelinks = "
Page:";
$totalpages = (($thread[replies]+1)/$ppp);
$xxx = false;
for($k=0; $k < $totalpages; $k++) {
if ($totalpages >= 30) {
if ($k <= 9 || $k >= ($totalpages - 20))
$pagelinks.=" ".($k+1).'';
elseif (!$xxx) {
$pagelinks .= " ...";
$xxx = true;
}
} else {
$pagelinks.=" ".($k+1).'';
}
}
$pagelinks.="";
} else {
$pagelinks=$smallfont.'(Pages:';
$totalpages = (($thread[replies]+1)/$ppp);
$xxx = false;
for($k=0; $k < $totalpages; $k++) {
if ($totalpages >= 20) {
if ($k <= 4 || $k >= ($totalpages - 10))
$pagelinks.=" ".($k+1).'';
elseif (!$xxx) {
$pagelinks .= " ...";
$xxx = true;
}
} else {
$pagelinks.=" ".($k+1).'';
}
}
$pagelinks.=')';
}
}
/*
$thread[title]=str_replace('&','&',$thread[title]);
$thread[title]=str_replace('<','<',$thread[title]);
$thread[title]=str_replace('>','>',$thread[title]);
$thread[title]=str_replace("\t","DUMB FUCKING BLANK THREAD (trollface.jpg)",$thread[title]);
*/
if (trim($thread['title']) == "") {
$thread['title'] = "hurr durr i'm an idiot who made a blank thread";
}
$threadtitle = "$thread[title]";
$sicon = "";
if ($thread['sticky']) {
$threadtitle = "". $threadtitle ."";
$sicon .= "sticky";
}
if ($thread['poll']) $sicon .= "poll";
if ($sicon) {
$threadtitle = $statusicons[$sicon] ." ". $threadtitle;
}
/*
$threadtitle =
($thread[sticky]?'Sticky'.($thread[poll]?' poll':'').': ':($thread[poll]?'Poll: ':''))
.(($thread[sticky] or $thread[poll])?"$threadtitle":$threadtitle);
*/
if(!$thread[icon]) $posticon=' ';
if($i>1) print '
';
$namecolor1=getnamecolor($thread[sex1],$thread[power1]);
$namecolor2=getnamecolor($thread[sex2],$thread[power2]);
if ($hp_hacks['prefix_disable'] == false) {
$thread[name1] = pick_any($hp_hacks['prefix']) . " " . $thread[name1];
$thread[name2] = pick_any($hp_hacks['prefix']) . " " . $thread[name2];
}
if((($user or $fav) && ($thread[minpower]<1 or $thread[minpower]<=$power)) or $id){
print "
$tccell1>$new
$tccell2>$posticon
$tccell2l>". ($newpost ? "". $statusicons['getnew'] ." " : "") ."$threadtitle $pagelinks
$tccell2>$thread[name1]
$tccell1>$thread[replies]
$tccell1>". ($thread['views'] < 65535 ? $thread['views'] : $thread['views']) ."
$tccell2>".date($dateformat,$thread[lastpostdate]+$tzoff)."
by
$thread[name2] ";
} else print "$tccell2s colspan=7>(restricted)";
}
}
print "$tblend$pagelinks2
".doforumlist($id).$footer;
printtimedif($startingtime);
?>