<?php
require "global.php";
require "board_jump.php";
#Çé¿öÅжÏ
//´íÎó3
if($boardid == -1) {
eval ("\$output = \"".gettemplate("error3")."\";");
eval("dooutput(\"".gettemplate("action_error")."\");");
exit;
}
//Ê×Ò³
if($boardid == "home") {
header("LOCATION: main.php$session2");
exit;
}
//¸öÈ˶ÌÏûÏ¢
if($boardid == "pm") {
header("LOCATION: pms.php$session2");
exit;
}
//ËÑË÷
if($boardid == "search") {
header("LOCATION: search.php$session2");
exit;
}
//¸öÈË×ÊÁÏ
if($boardid == "profil") {
header("LOCATION: profile.php$session2");
exit;
}
#$binfo ÌÖÂÛ°æÐÅÏ¢±äÁ¿
$recordset = &$conn->Execute("SELECT * FROM ".$prefix."_boards WHERE boardid='$boardid'");
$binfo=$recordset->fields;
$binfo[boardname] = editDBdata($binfo[boardname]);
#Éú³ÉÌÖÂÛ°æ½çÃæ
//Á¬½ÓÊý¾Ý¿â
$recordset = &$conn->Execute("
SELECT
".$prefix."_boards.*,
".$prefix."_posts.threadparentid,
".$prefix."_posts.userid,
".$prefix."_posts.posttime,
".$prefix."_threads.threadname,
".$prefix."_threads.topicicon,
".$prefix."_threads.boardparentid as parentid,
".$prefix."_user_table.username
FROM ".$prefix."_boards
LEFT JOIN ".$prefix."_posts ON (".$prefix."_posts.postid=".$prefix."_boards.lastpostid)
LEFT JOIN ".$prefix."_threads ON (".$prefix."_threads.threadid=".$prefix."_posts.threadparentid)
LEFT JOIN ".$prefix."_user_table ON (".$prefix."_user_table.userid=".$prefix."_posts.userid)
WHERE ".$prefix."_boards.boardparentid>0
ORDER by boardparentid ASC, sort ASC");
while (!$recordset->EOF) {
$row = $recordset->fields;
$boardcache[$row[boardparentid]][$row[sort]][$row[boardid]] = $row;
$recordset->MoveNext();
}
$recordset = &$conn->Execute("SELECT boardid FROM ".$prefix."_object2board WHERE objectid = '$user_group' AND boardpermission = 1");
while (!$recordset->EOF) {
$row = $recordset->fields;
$permissioncache[$row[boardid]] = 1;
$recordset->MoveNext();
}
$recordset = &$conn->Execute("SELECT userid, username, boardid FROM ".$prefix."_object2board LEFT JOIN ".$prefix."_user_table ON (".$prefix."_object2board.objectid = ".$prefix."_user_table.userid) WHERE mod = 1 ORDER BY username ASC");
while (!$recordset->EOF) {
$row = $recordset->fields;
$modcache[$row[boardid]][] = $row;
$recordset->MoveNext();
}
//´´½¨ÌÖÂ۰溯Êýmakeforumbit()
$board_boardbit = makeforumbit($boardid);
$recordset->close();
#Êä³ö
//×ÓÂÛ̳
if($board_boardbit) eval ("\$subboards .= \"".gettemplate("board_subboards")."\";");
//µ¼º½À¸
$navi_chain = makenavichain("board",$boardid);
//Èç¹ûÌÖÂÛ°æÊÇ·ÖÀ࣬Ôò»ñµÃÄ£°æboard_catÊä³ö
if(!$binfo[isboard]) {
eval("dooutput(\"".gettemplate("board_cat")."\");");
exit;
}
//µ±Ç°Ê±¼ä
$time = time()+$timeoffset*3600;
$recordset = &$conn->Execute("SELECT announcementid, topic, ".$prefix."_announcements.userid, username FROM ".$prefix."_announcements LEFT JOIN ".$prefix."_user_table ON (".$prefix."_user_table.userid=".$prefix."_announcements.userid) WHERE starttime <= '$time' AND endtime >= '$time' AND (boardid=0 OR boardid='$boardid') ORDER BY starttime DESC");
//Èç¹ûÓÐ֪ͨ£¬ÔòÊä³öËü
while(!$recordset->EOF) {
$row = $recordset->fields;
$row[topic] = editDBdata($row[topic]);
eval ("\$board_threadbit .= \"".gettemplate("announcementbit")."\";");
$recordset->MoveNext();
}
$recordset->close();
if(!$sortfield) $sortfield = "timelastreply";
if(!$sortorder) $sortorder = "DESC";
if(!$daysprune && !$prunedays) $daysprune = $default_daysprune;
if(!$daysprune && $prunedays) $daysprune = $prunedays;
if($daysprune!=1000) $date = time()-(86400*$daysprune);
$recordset = &$conn->Execute("SELECT COUNT(threadid)as anzahl FROM ".$prefix."_threads WHERE (boardparentid='$boardid' OR putoffid='$boardid') AND (timelastreply>='$date' OR important='1')");
$anzahl = $recordset->fields;
$anzahl = $anzahl[anzahl];
if(!$page) $page=1;
$pages=ceil($anzahl/$tproseite);
$recordset2 = &$conn->Execute("SELECT ".$prefix."_threads.*, ".$prefix."_user_table.username FROM ".$prefix."_threads LEFT JOIN ".$prefix."_user_table ON (".$prefix."_user_table.userid=".$prefix."_threads.authorid) WHERE (boardparentid='$boardid' OR putoffid='$boardid') AND (timelastreply>='$date' OR important='1') ORDER by important DESC, $sortfield $sortorder LIMIT ".($tproseite*($page-1)).",".($tproseite));
//Éú³ÉÌû×ÓÏÔʾ
while(!$recordset->EOF) {
$threads = $recordset2->fields;
unset($folder_image);
unset($thread_link);
unset($rate);
unset($anonymous_lp);
unset($anonymous);
unset($thread_starter);
unset($lastauthor);
$sthreadname = "sthread_".$threads[threadid];
if($boardid == $threads[putoffid]) $folder_image = "<img src=\"images/movedfolder.gif\">";
else {
if($old_time <= $threads[timelastreply] && $$sthreadname < $threads[timelastreply]) $folder_image .= "new";
if($threads[replies] > $hotthread_reply || $threads[views] > $hotthread_view) $folder_image .= "hot";
if($threads[flags]==1) $folder_image .= "lock";
$folder_image = "<img src=\"images/".$folder_image."folder.gif\">";
}
if($threads[topicicon]) $posticon = "<img src=\"$threads[topicicon]\">";
else $posticon = " ";
if($old_time <= $threads[timelastreply] && $$sthreadname < $threads[timelastreply]) eval ("\$thread_link .= \"".gettemplate("board_gofirstnew")."\";");
if ($threads[prime]==1) eval ("\$thread_link .= \"".gettemplate("board_prime")."\";");
$thread_link .= "<font face=\"{font}\">";
if($boardid == $threads[putoffid]) eval ("\$thread_link .= \"".gettemplate("board_moved")."\";");
elseif($threads[important]) eval ("\$thread_link .= \"".gettemplate("board_important")."\";");
if($threads[pquestion]) eval ("\$thread_link .= \"".gettemplate("board_poll")."\";");
if($threads[attachmentid]) eval ("\$thread_link .= \"".gettemplate("board_haveattach")."\";");
$thread_link .= "<a class=\"link\" href=\"thread.php?threadid=$threads[threadid]&boardid=$threads[boardparentid]&styleid=$styleid$session\">".prepare_topic($threads[threadname])."</a></b></font>";
if(($threads[replies]+1)/$eproseite > 1) $thread_link .= "<font face=\"$font\"> ( <img src=\"images/multipage.gif\"> <a class=\"link\" href=\"thread.php?threadid=$threads[threadid]&boardid=$threads[boardparentid]&styleid=$styleid$session&page=1\">1</a> <a class=\"link\" href=\"thread.php?threadid=$threads[threadid]&boardid=$threads[boardparentid]&styleid=$styleid$session&page=2\">2</a> ";
if(($threads[replies]+1)/$eproseite > 2) $thread_link .= "<a class=\"link\" href=\"thread.php?threadid=$threads[threadid]&boardid=$threads[boardparentid]&styleid=$styleid$session&page=3\">3</a> ";
if(($threads[replies]+1)/$eproseite > 3) $thread_link .= "<a class=\"link\" href=\"thread.php?threadid=".$threads[threadid]."&boardid=$threads[boardparentid]&styleid=$styleid$session&page=4\">4</a> ";
if(($threads[replies]+1)/$eproseite > 4) {
$pagesx=ceil(($threads[replies]+1)/$eproseite);
eval ("\$thread_link .= \"".gettemplate("board_lastpage")."\";");
}
if(($threads[replies]+1)/$eproseite > 1) $thread_link .= ")</font>";
$starttime = formatdate($threads[starttime],$longdateformat,1);
if($threads[authorid]) $thread_starter = $threads[username];
else eval ("\$anonymous = \"".gettemplate("lg_anonymous")."\";");
$lastposttime = formatdate($threads[timelastreply],$longdateformat,1);
$recordset = &$conn->Execute("SELECT userid FROM ".$prefix."_posts WHERE threadparentid='$threads[threadid]' ORDER by posttime DESC LIMIT 1");
$lastauthorid = $recordset->fields;
$lastauthorid = $lastauthorid[userid];
if($lastauthorid) $lastauthor = getUsername($lastauthorid);
else eval ("\$anonymous_lp = \"".gettemplate("lg_anonymous")."\";");
eval ("\$last_post = \"".gettemplate("board_lastpost")."\";");
if($threads[rated] && $threads[rate_points]) {
$j = round($threads[rate_points]/$threads[rated]);
for ($j; $j > 0; $j--) $rate .= "<img src=\"images/star.gif\" border=0>";
}
else $rate = " ";
eval ("\$board_threadbit .= \"".gettemplate("board_threadbit")."\";");
$recordset2->MoveNext();
}
$recordset2->close();
if($pages>1) $page_link = makepagelink("board.php?boardid=$boardid$session", $page, $pages);
if($mods = getMod($boardid)) eval ("\$mods = \"".gettemplate("board_moderate")."\";");
$l_threads = 1+($page-1)*$tproseite;
$h_threads = $page*$tproseite;
if($h_threads > $anzahl) $h_threads = $anzahl;
$all_threads = $anzahl;
if($sortfield == "threadname") $f_select[0] = "selected";
if($sortfield == "timelastreply") $f_select[1] = "selected";
if($sortfield == "replies") $f_select[2] = "selected";
if($sortfield == "views") $f_select[3] = "selected";
if($sortfield == "author") $f_select[4] = "selected";
if($sortfield == "starttime") $f_select[5] = "selected";
if($sortorder == "ASC") $o_select[0] = "selected";
if($sortorder == "DESC") $o_select[1] = "selected";
if($daysprune == "1") $d_select[0] = "selected";
if($daysprune == "2") $d_select[1] = "selected";
if($daysprune == "5") $d_select[2] = "selected";
if($daysprune == "10") $d_select[3] = "selected";
if($daysprune == "20") $d_select[4] = "selected";
if($daysprune == "30") $d_select[5] = "selected";
if($daysprune == "45") $d_select[6] = "selected";
if($daysprune == "60") $d_select[7] = "selected";
if($daysprune == "75") $d_select[8] = "selected";
if($daysprune == "100") $d_select[9] = "selected";
if($daysprune == "365") $d_select[10] = "selected";
if($daysprune == "1000") $d_select[11] = "selected";
if($board_threadbit) {
eval ("\$threads_order .= \"".gettemplate("board_threads_order")."\";");
eval("dooutput(\"".gettemplate("board")."\");");
}
else eval("dooutput(\"".gettemplate("board_no_threads")."\");");
?>