1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
289:
290:
291:
292:
293:
294:
295:
296:
297:
298:
299:
300:
301:
302:
303:
304:
305:
306:
307:
308:
309:
310:
311:
312:
313:
314:
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
|
<?php
$filename="board.php";
require("./global.php");
require("./acp/lib/class_parse.php");
if(!isset($boardid)) eval("error(\"".$tpl->get("error_falselink")."\");");
if (isset($_REQUEST['action'])) $action = $_REQUEST['action'];
else $action = '';
/** settle/unsettle thread **/
if ($action == 'thread_settle') {
if (!$wbbuserdata['m_can_thread_settle']) access_error();
if (isset($_REQUEST['boardid'])) $boardid = intval($_REQUEST['boardid']);
else $boardid = 0;
if (isset($_REQUEST['threadid'])) $threadid = intval($_REQUEST['threadid']);
else $threadid = 0;
if (isset($_REQUEST['page'])) $page = intval($_REQUEST['page']);
else $page = 0;
$thread = $db->query_first("SELECT starterid, settled FROM bb".$n."_threads WHERE threadid = '$threadid'");
$isuser = 0;
if ($threadid != 0) {
if ($wbbuserdata['userid'] && $wbbuserdata['userid'] == $thread['starterid'] && ($wbbuserdata['can_settle_own_topic'] == 1)) $isuser = 1;
}
elseif ($isuser == 0 || $wbbuserdata['can_settle_own_topic'] == 0) eval("error(\"".$tpl->get("error_falselink")."\");");
$db->query("UPDATE bb".$n."_threads SET settled=1-'$thread[settled]' WHERE threadid='$threadid'");
header("Location: board.php?boardid=$boardid&page=$page&sid=$session[hash]");
exit();
}
if(isset($_COOKIE['hidecats'])) $hidecats=decode_cookie($_COOKIE['hidecats']);
else $hidecats=array();
if(isset($_COOKIE['boardvisit'])) $boardvisit=decode_cookie($_COOKIE['boardvisit']);
else $boardvisit=array();
if(isset($_COOKIE['threadvisit'])) $threadvisit=decode_cookie($_COOKIE['threadvisit']);
else $threadvisit=array();
$boardnavcache=array();
if($board['childlist']!="0") {
$boardcache=array();
$permissioncache=array();
$modcache=array();
$activtime=time()-60*$useronlinetimeout;
$result = $db->query("
SELECT
b.*".ifelse($showlastposttitle==1,", t.topic, i.*")."
FROM bb".$n."_boards b
".ifelse($showlastposttitle==1,"LEFT JOIN bb".$n."_threads t ON (t.threadid=b.lastthreadid)
LEFT JOIN bb".$n."_icons i USING (iconid)")."
ORDER by b.parentid ASC, b.boardorder ASC");
while ($row = $db->fetch_array($result)) {
$boardcache[$row['parentid']][$row['boardorder']][$row['boardid']] = $row;
$boardnavcache[$row['boardid']]=$row;
}
$result = $db->query("SELECT boardid, threadid, lastposttime FROM bb".$n."_threads WHERE visible = 1 AND lastposttime > '$wbbuserdata[lastvisit]' AND closed <> 3");
while($row=$db->fetch_array($result)) $visitcache[$row['boardid']][$row['threadid']]=$row['lastposttime'];
$result = $db->query("SELECT * FROM bb".$n."_permissions WHERE groupid = '$wbbuserdata[groupid]'");
while ($row = $db->fetch_array($result)) $permissioncache[$row['boardid']] = $row;
$result = $db->query("SELECT bb".$n."_moderators.*, username FROM bb".$n."_moderators LEFT JOIN bb".$n."_users USING (userid) ORDER BY username ASC");
while ($row = $db->fetch_array($result)) $modcache[$row['boardid']][] = $row;
$tempboardcache=$boardcache;
$temppermissioncache=$permissioncache;
$index_depth=$board_depth;
$temp_boardid=$boardid;
$boardbit = makeboardbit($boardid);
$boardcache=$tempboardcache;
$permissioncache=$temppermissioncache;
}
if($showboardjump==1) $boardjump=makeboardjump($boardid);
$navbar=getNavbar($board['parentlist']);
eval ("\$navbar .= \"".$tpl->get("navbar_boardend")."\";");
if(!$board['isboard']) {
eval("\$tpl->output(\"".$tpl->get("board_cat")."\");");
exit();
}
/********** board *********/
if(isset($boardbit) && $boardbit) eval ("\$subboards = \"".$tpl->get("board_subboards")."\";");
else $subboards="";
if($board['threadsperpage']) $threadsperpage=$board['threadsperpage'];
else $threadsperpage=$default_threadsperpage;
if($wbbuserdata['umaxposts']) $postsperpage=$wbbuserdata['umaxposts'];
elseif($board['postsperpage']) $postsperpage=$board['postsperpage'];
else $postsperpage=$default_postsperpage;
if($board['hotthread_reply']==0) $board['hotthread_reply']=$default_hotthread_reply;
if($board['hotthread_view']==0) $board['hotthread_view']=$default_hotthread_view;
if(isset($_GET['page'])) {
$page=intval($_GET['page']);
if($page==0) $page=1;
}
else $page=1;
$threadbit="";
unset($datecute);
if(isset($_GET['sortfield'])) $sortfield=$_GET['sortfield'];
else $sortfield="lastposttime";
switch ($sortfield) {
case "topic": break;
case "starttime": break;
case "replycount": break;
case "starter": break;
case "views": break;
case "vote": break;
case "lastposttime": break;
case "lastposter": break;
default: $sortfield = "lastposttime"; break;
}
$f_select['topic']="";
$f_select['starttime']="";
$f_select['replycount']="";
$f_select['starter']="";
$f_select['views']="";
$f_select['vote']="";
$f_select['lastposttime']="";
$f_select['lastposter']="";
$f_select[$sortfield]="selected";
if(isset($_GET['sortorder'])) $sortorder=$_GET['sortorder'];
else $sortorder="lastposttime";
switch ($sortorder) {
case "ASC": break;
case "DESC": break;
default: $sortorder = "DESC"; break;
}
$o_select['ASC']="";
$o_select['DESC']="";
$o_select[$sortorder]="selected";
if(isset($_GET['daysprune'])) $daysprune = intval($_GET['daysprune']);
elseif($wbbuserdata['daysprune']!=0) $daysprune = $wbbuserdata['daysprune'];
elseif($board['daysprune']!=0) $daysprune = $board['daysprune'];
else $daysprune = $default_daysprune;
$d_select[1500]="";
$d_select[1000]="";
$d_select[1]="";
$d_select[2]="";
$d_select[5]="";
$d_select[10]="";
$d_select[20]="";
$d_select[30]="";
$d_select[45]="";
$d_select[60]="";
$d_select[75]="";
$d_select[100]="";
$d_select[365]="";
$d_select[$daysprune]="selected";
if($daysprune!=1000) {
if($daysprune==1500) $datecute = " AND (important=1 OR lastposttime >= '".$wbbuserdata['lastvisit']."')";
else {
$tempdate=time()-($daysprune*86400);
$datecute = " AND (important=1 OR lastposttime >= '".$tempdate."')";
}
}
else $datecute="";
/** announcements threads **/
$announcecount=0;
$announceids="";
//$result = $db->query("SELECT threadid FROM bb".$n."_threads WHERE boardid='$boardid' AND important = 2 AND visible = 1");
$result = $db->query("SELECT threadid FROM bb".$n."_announcements WHERE boardid='$boardid'");
while($row = $db->fetch_array($result)) {
$announcecount++;
$announceids .= ",".$row['threadid'];
}
$ownuserid="";
$ownjoin="";
/** count total threads **/
$threadcount = $db->query_first("SELECT COUNT(threadid) FROM bb".$n."_threads WHERE boardid='$boardid' AND important < 2 AND visible = 1 $datecute");
$threadcount = $threadcount[0];
$pages = ceil($threadcount/$threadsperpage);
if($pages>1) $pagelink=makepagelink("board.php?boardid=$boardid&sid=$session[hash]&daysprune=$daysprune&sortfield=$sortfield&sortorder=$sortorder",$page,$pages,$showpagelinks-1);
else $pagelink="";
$threadids="";
$result = $db->query("SELECT threadid, IF(voted>0,votepoints/voted,0) AS vote FROM bb".$n."_threads WHERE boardid='$boardid' AND visible = 1 AND important < 2 $datecute ORDER BY important DESC, $sortfield $sortorder",$threadsperpage,$threadsperpage*($page-1));
while($row=$db->fetch_array($result)) $threadids .= ",".$row['threadid'];
$result = $db->query("SELECT
$ownuserid
bb".$n."_threads.*,
IF(voted>0,votepoints/voted,0) AS vote,
bb".$n."_icons.*
FROM bb".$n."_threads
LEFT JOIN bb".$n."_icons USING (iconid)
$ownjoin
WHERE bb".$n."_threads.threadid IN (0$announceids$threadids)
ORDER BY important DESC, $sortfield $sortorder");
if(isset($boardvisit[$boardid]) && $boardvisit[$boardid]>$wbbuserdata['lastvisit']) $wbbuserdata['lastvisit']=$boardvisit[$boardid];
while($threads=$db->fetch_array($result)) {
$firstnew="";
$multipages="";
$prefix="";
if(strlen($threads['topic'])>60) $threads['topic']=parse::textwrap($threads['topic'],60);
if($threads['starterid']!=0) eval ("\$threads['starter'] = \"".$tpl->get("board_threadbit_starter")."\";");
if($threads['lastposterid']!=0) eval ("\$threads['lastposter'] = \"".$tpl->get("board_threadbit_lastposter")."\";");
$description = $threads['descr'];
if($description != "") {
$description = stripslashes($description);
$descr = ' ('.$description.')';
}else{
$descr = "";
}
$lastpostdate=formatdate($dateformat,$threads['lastposttime'],1);
$lastposttime=formatdate($timeformat,$threads['lastposttime']);
if($threads['closed']==3) {
$threads['threadid']=$threads['pollid'];
$threadrating=" ";
eval ("\$prefix .= \"".$tpl->get("board_thread_moved")."\";");
$foldericon="moved";
if($wbbuserdata['lastvisit']<$threads['lastposttime'] && $threadvisit[$threads['threadid']]<$threads['lastposttime']) eval ("\$firstnew = \"".$tpl->get("board_threadbit_firstnew")."\";");
if($threads['iconid']) $threadicon=makeimgtag($threads['iconpath'],$threads['icontitle']);
else $threadicon=" ";
$threads['replycount']="-";
$threads['views']="-";
}
else {
if($threads['voted']) {
$avarage=number_format($threads['votepoints']/$threads['voted'],2);
eval ("\$threadrating = \"".$tpl->get("board_threadbit_rating")."\";");
$threadrating=str_repeat($threadrating, round($avarage));
}
else $threadrating=" ";
if($threads['important']==2) eval ("\$prefix .= \"".$tpl->get("board_thread_announce")."\";");
if($threads['important']==1) eval ("\$prefix .= \"".$tpl->get("board_thread_important")."\";");
if($threads['pollid']!=0) eval ("\$prefix .= \"".$tpl->get("board_thread_poll")."\";");
if($threads['important']==2) $foldericon="announce";
else $foldericon=ifelse($wbbuserdata['lastvisit']<$threads['lastposttime'] && $threadvisit[$threads['threadid']]<$threads['lastposttime'],"new").ifelse($threads['replycount']>=$board['hotthread_reply'] || $threads['views']>=$board['hotthread_view'],"hot").ifelse($threads['closed']!=0,"lock")."folder";
if($wbbuserdata['lastvisit']<$threads['lastposttime'] && $threadvisit[$threads['threadid']]<$threads['lastposttime']) eval ("\$firstnew = \"".$tpl->get("board_threadbit_firstnew")."\";");
if($threads['pollid']!=0) $threadicon=makeimgtag("{imagefolder}/poll.gif","");
elseif($threads['iconid']) $threadicon=makeimgtag($threads['iconpath'],$threads['icontitle']);
else $threadicon=" ";
if($threads['replycount']+1>$postsperpage && $showmultipages!=0) {
unset($multipage);
unset($multipages_lastpage);
$xpages=ceil(($threads['replycount']+1)/$postsperpage);
if($xpages>$showmultipages) {
eval ("\$multipages_lastpage = \"".$tpl->get("board_threadbit_multipages_lastpage")."\";");
$xpages=$showmultipages;
}
for($i=1;$i<=$xpages;$i++) {
$multipage.=" ".makehreftag("thread.php?threadid=$threads[threadid]&page=$i&sid=$session[hash]",$i);
}
eval ("\$multipages = \"".$tpl->get("board_threadbit_multipages")."\";");
}
}
if($board['canusesettle']) {
if($threads['settled']==1) $settled_img = "erledigt";
else $settled_img = "unerledigt";
if($wbbuserdata['m_can_thread_settle'] || ($wbbuserdata['can_settle_own_topic'] && $wbbuserdata['userid'] == $threads['starterid'])) {
eval ("\$threadsettled = \"".$tpl->get("board_threadbit_cansettle")."\";");
}
else eval ("\$threadsettled = \"".$tpl->get("board_threadbit_nosettle")."\";");
}
else $threadsettled ="";
eval ("\$threadbit .= \"".$tpl->get("board_threadbit")."\";");
}
$threadcount += $pages * $announcecount;
$l_threads = ($page-1) * ($threadsperpage + $announcecount) + 1;
$h_threads = $page * ($threadsperpage + $announcecount);
if($h_threads > $threadcount) $h_threads = $threadcount;
if($board['closed']==0) eval ("\$newthread = \"".$tpl->get("board_newthread")."\";");
if($showuseronlineonboard==1) {
include_once("./acp/lib/class_useronline.php");
$guestcount=0;
$boarduseronline = '';
$online = new useronline($wbbuserdata['canuseacp']);
$result = $db->query("SELECT bb".$n."_sessions.userid, username, groupid, invisible FROM bb".$n."_sessions LEFT JOIN bb".$n."_users USING (userid) WHERE bb".$n."_sessions.lastactivity >= '".(time()-60*$useronlinetimeout)."' AND boardid=$boardid ORDER BY username ASC");
while($row = $db->fetch_array($result)) {
if($row['userid']==0) $guestcount++;
else $online->user($row['userid'],htmlspecialchars($row['username']),$row['invisible']);
}
$boarduseronlinebit = $online->useronlinebit;
if($guestcount<>0) $guestcounter="$guestcount Besucher";
else $guestcounter="";
if($guestcount<>0 && $boarduseronlinebit!='') $konj=" und ";
else $konj="";
if($guestcount<>0 || $boarduseronlinebit!='') $boarduseronline="(Benutzer im Forum aktiv: $boarduseronlinebit$konj$guestcounter)";
}
if(!$threadbit) eval("\$tpl->output(\"".$tpl->get("board_nothreads")."\");");
else eval("\$tpl->output(\"".$tpl->get("board")."\");");
?>
|