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:
326:
327:
328:
329:
330:
331:
332:
333:
334:
335:
336:
337:
338:
339:
340:
341:
342:
343:
344:
345:
346:
347:
348:
349:
|
<?php
$filename="index.php";
require("./global.php");
if(isset($_COOKIE['boardvisit'])) $boardvisit=decode_cookie($_COOKIE['boardvisit']);
else $boardvisit=array();
if(isset($_COOKIE['threadvisit'])) $threadvisit=decode_cookie($_COOKIE['threadvisit']);
else $threadvisit=array();
$boardcache=array();
$permissioncache=array();
$modcache=array();
$activtime=time()-60*$useronlinetimeout;
$result = $db->query("
SELECT
b.*".ifelse($showlastposttitle==1,", t.topic, t.prefix AS threadprefix, 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;
$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;
$boardbit = makeboardbit(0);
$index_pms="";
$quicklogin="";
$index_useronline="";
$index_stats="";
/* ############## STATS ############## */
if($showstats==1) {
$members=$db->query_first("SELECT COUNT(*) AS members, MAX(userid) AS userid FROM bb".$n."_users WHERE activation = 1");
$newestmember=$db->query_first("SELECT userid, username FROM bb".$n."_users WHERE userid = '$members[userid]'");
$posts=$db->query_first("SELECT COUNT(*) AS posts FROM bb".$n."_posts");
$threads=$db->query_first("SELECT COUNT(*) AS threads FROM bb".$n."_threads");
$installdays = (time() - $installdate) / 86400;
if ($installdays < 1) $postperday = $posts['posts'];
else $postperday = sprintf("%.2f",($posts['posts'] / $installdays));
eval ("\$index_stats = \"".$tpl->get("index_stats")."\";");
}
/* ############## USERONLINE ############## */
if($showuseronline==1) {
$guestcount=0;
$membercount=0;
$useronlinebit = '';
$result = $db->query("SELECT bb".$n."_sessions.userid, username, groupid, invisible, avatarid FROM bb".$n."_sessions LEFT JOIN bb".$n."_users USING (userid) WHERE bb".$n."_sessions.lastactivity >= '".(time()-60*$useronlinetimeout)."' ORDER BY username ASC");
while($row = $db->fetch_array($result)) {
if($row['userid']==0) {
$guestcount++;
continue;
}
$membercount++;
if(!$row['invisible']) {
###### Username-Style Hack ######
$uname = $row['username'];
$grp_id_query = $db->query_first("SELECT groupid FROM bb".$n."_users WHERE username LIKE '".$uname."'");
$grp_id = $grp_id_query['groupid'];
$group_style_query = $db->query_first("SELECT groupstyle FROM bb".$n."_groups WHERE groupid LIKE '".$grp_id."'");
$group_style = $group_style_query['groupstyle'];
$row['username'] = stripslashes(sprintf($group_style, $row['username']));
###### Username-Style Hack End ######
if(isset($useronlinebit) && $useronlinebit != '') $useronlinebit .= ', ';
/*UserOnline Hover-Ava*/
if($wbbuserdata['userid']!=0) {
$showava="";
$avaqry = $db->query_first("SELECT * FROM bb".$n."_avatars WHERE avatarid='$row[avatarid]'");
if($avaqry['avatarid'] && $showavatar==1 && $wbbuserdata['showavatars']==1) {
$showava=" onMouseOver=\"return overlib('<img src=images/avatars/avatar-$avaqry[avatarid].$avaqry[avatarextension]>',RIGHT,ol_fgcolor='{tabletitlecolor}',ol_bgcolor='{tableinbordercolor}',ol_width='$avaqry[width]');\" onMouseOut=\"return nd();\"";
} }
/*UserOnline Hover-Ava*/
eval ("\$useronlinebit .= \"".$tpl->get("index_useronline")."\";");
}
}
$totaluseronline = $membercount+$guestcount;
/* ############## Wer war da? (normale Darstellung) ############## */
if($show_wwhd_global){
if($wbbuserdata['canview_wwhd'] == 1) {
$wwhd_useron = $db->query_first("SELECT COUNT(*) FROM bb".$n."_sessions_day");
$wwhd_useron = $wwhd_useron[0];
$wwhd_ghosts = $db->query_first("SELECT COUNT(*) FROM bb".$n."_sessions_day WHERE invisible = '1'");
$wwhd_ghosts = $wwhd_ghosts[0];
if($wwhd_insert_current == '1') $fl = "letzte";
else $fl = "erste";
if($wwhd_useron[0] <> '1') $pl = "en";
else $pl = "";
if($wwhd_ghosts[0] <> '1') $gpl = "er";
else $gpl = "";
$result=$db->query("SELECT d.userid, d.time,u.* FROM bb".$n."_sessions_day d LEFT JOIN bb".$n."_users u USING(userid) ORDER BY $wwhd_order");
while($wwhd=$db->fetch_array($result)) {
$zeit = formatdate($timeformat,$wwhd['time']);
$werwarda1++;
$ghost = "";
if($wwhd['invisible'] == '0') $user = "<a href=\"profile.php?userid=$wwhd[userid]\">$wwhd[username]</a></b> ($zeit)";
elseif($wbbuserdata['canuseacp'] == '1') $user ="<a href=\"profile.php?userid=$wwhd[userid]\">$wwhd[username]</a></b> ($zeit, Geist)";
else $user = "(Geist)";
if(isset($wwhd_bit) && $wwhd_bit != '') $wwhd_bit .= ', ';
eval ("\$wwhd_bit .=\"".$tpl->get("index_wwhd")."\";");
}
eval ("\$index_wwhd .=\"".$tpl->get("index_wwhdi")."\";");
}
}
if($totaluseronline>$rekord) {
$rekord=$totaluseronline;
$rekordtime=time();
$db->unbuffered_query("UPDATE bb".$n."_options SET value='$rekord' WHERE varname='rekord'",1);
$db->unbuffered_query("UPDATE bb".$n."_options SET value='$rekordtime' WHERE varname='rekordtime'",1);
require ("./acp/lib/class_options.php");
$option=new options("acp/lib");
$option->write();
}
$rekorddate = formatdate($dateformat,$rekordtime);
$rekordtime = formatdate($timeformat,$rekordtime);
if($wiw_show>0 && $wbbuserdata['canviewwiw']==1) {
$wiwstart="";
$wiwend="";
if($wiw_show==1) {
$wiwstart="<a href=\"wiw.php?sid=$sid\">";
$wiwend="</a>";
}
else if($wiw_show==2) $wiwend=" <a href=\"#\" onclick=\"window.open('wiw.php?action=popup&sid=$sid','Wer ist wo online?','width=610,height=300,location=no,toolbar=no,menubar=no,scrollbars=yes,status=no,resizable=yes'); return false\">[Wer ist Wo?]</a>";
else {
$wiwstart="<a href=\"wiw.php?sid=$sid\">";
$wiwend="</a> <a href=\"#\" onclick=\"window.open('wiw.php?action=popup&sid=$sid','Wer ist wo online?','width=610,height=300,location=no,toolbar=no,menubar=no,scrollbars=yes,status=no,resizable=yes'); return false\">[Wer ist Wo?]</a>";
}
}
eval ("\$index_useronline = \"".$tpl->get("index_showuseronline")."\";");
}
if(!$wbbuserdata['userid']) {
eval ("\$welcome = \"".$tpl->get("index_welcome")."\";");
eval ("\$quicklogin = \"".$tpl->get("index_quicklogin")."\";");
}
else {
$currenttime=formatdate($timeformat,time());
$toffset=ifelse($default_timezoneoffset>=0,"+").$default_timezoneoffset;
$lastvisitdate = formatdate($dateformat,$wbbuserdata['lastvisit']);
$lastvisittime = formatdate($timeformat,$wbbuserdata['lastvisit']);
eval ("\$welcome = \"".$tpl->get("index_hello")."\";");
if($wbbuserdata['canusepms']==1 && $showpmonindex==1) {
$counttotal=0; $countunread=0; $countnew=0;
$result = $db->query("SELECT view, sendtime FROM bb".$n."_privatemessage WHERE deletepm <> 1 AND recipientid = '$wbbuserdata[userid]'");
while($row=$db->fetch_array($result)) {
$counttotal++;
if($row['view']==0) {
$countunread++;
if($row['sendtime']>$wbbuserdata['lastvisit']) $countnew++;
}
}
if($countnew>0) eval ("\$new_notnew = \"".$tpl->get("index_newpm")."\";");
else eval ("\$new_notnew = \"".$tpl->get("index_nonewpm")."\";");
$result=mysql_query("SELECT * FROM bb".$n."_users WHERE userid='$wbbuserdata[userid]' AND parentid != '0'") or die(mysql_error());
if(mysql_num_rows($result)>='1'){
$check_ca=mysql_fetch_array($result);
$parentid=$check_ca[parentid];
$result2=mysql_query("SELECT * FROM bb".$n."_privatemessage WHERE recipientid='$parentid' AND view = '0' AND deletepm='0'") or die(mysql_error());
$anzahl_pm=mysql_num_rows($result2);
if($anzahl_pm=='1'){
$result3=mysql_query("SELECT username FROM bb".$n."_users WHERE userid='$parentid'") or die(mysql_error());
$which_account=mysql_fetch_array($result3);
$mainaccount=$which_account[username];
$new_pm_info="Du hast auf dem Account von <b>$mainaccount</b> eine neue Nachricht!<br>";
eval ("\$new_pms_zm = \"".$tpl->get("index_pms_zm")."\";");
}
if($anzahl_pm>'1'){
$result3=mysql_query("SELECT username FROM bb".$n."_users WHERE userid='$parentid'") or die(mysql_error());
$which_account=mysql_fetch_array($result3);
$mainaccount=$which_account[username];
$new_pm_info="Du hast auf dem Account von <b>$mainaccount</b> $anzahl_pm neue Nachrichten!<br>";
eval ("\$new_pms_zm = \"".$tpl->get("index_pms_zm")."\";");
}
$result3=mysql_query("SELECT * FROM bb".$n."_users WHERE parentid='$parentid' ORDER BY username ASC") or die(mysql_error());
if(mysql_num_rows($result3)>'1'){
while($check_c2a=mysql_fetch_array($result3)){
$which_username=$check_c2a[username];
$which_userid=$check_c2a[userid];
if($which_userid != $wbbuserdata[userid]){
$result4=mysql_query("SELECT * FROM bb".$n."_privatemessage WHERE recipientid='$which_userid' AND view = '0' AND deletepm='0'") or die(mysql_error());
$anzahl_pm=mysql_num_rows($result4);
if($anzahl_pm=='1'){
$new_pm_info="Du hast auf dem Account von <b>$which_username</b> eine neue Nachricht!<br>";
}
elseif($anzahl_pm>'1'){
$new_pm_info="Du hast auf dem Account von <b>$which_username</b> $anzahl_pm neue Nachrichten!<br>";
}
else{
$new_pm_info='';
}
eval ("\$new_pms_zz .= \"".$tpl->get("index_pms_zz")."\";");
}
}
}
}
$result2=mysql_query("SELECT * FROM bb".$n."_users WHERE parentid='$wbbuserdata[userid]'") or die(mysql_error());
if(mysql_num_rows($result2)>='1'){
while($check_sa=$db->fetch_array($result2)){
$other_userid=$check_sa[userid];
$other_username=$check_sa[username];
$result3=mysql_query("SELECT * FROM bb".$n."_privatemessage WHERE recipientid='$other_userid' AND view = '0' AND deletepm='0'") or die(mysql_error());
$anzahl_pm=mysql_num_rows($result3);
if($anzahl_pm=='1'){
$new_pm_info="Du hast auf dem Account von <b>$other_username</b> eine neue Nachricht!<br>";
}
elseif($anzahl_pm>'1'){
$new_pm_info="Du hast auf dem Account von <b>$other_username</b> $anzahl_pm neue Nachrichten!<br>";
}
else{
$new_pm_info='';
}
eval ("\$new_pms_mz .= \"".$tpl->get("index_pms_mz")."\";");
}
}
eval ("\$index_pms = \"".$tpl->get("index_pms")."\";");
}
}
eval ("\$index_legende = \"".$tpl->get("index_legende")."\";");
$query = $db->query("SELECT styleid, stylename FROM bb".$n."_styles ORDER BY stylename ASC");
while($style = $db->fetch_array($query))
{
$sum = $db->fetch_array($db->query("SELECT COUNT(userid) as users FROM bb".$n."_users WHERE styleid = '".$style['styleid']."'"));
$option .= "<option value=\"".$style['styleid']."\">".$style['stylename']." [".$sum['users']."]</option>";
$wbbuserdata['styleid'] = intval($wbbuserdata['styleid']);
$db->unbuffered_query("UPDATE
bb".$n."_users
SET
styleid='".$wbbuserdata['styleid']."'
WHERE
userid = '".$wbbuserdata['userid']."'
");
}
$action=$_GET['action'];
if($action=="index_inplay") {
/** threads **/
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;
$ownuserid="";
$ownjoin="";
$threadids="";
$result = $db->query("SELECT t.threadid FROM bb".$n."_subscribethreads s LEFT JOIN bb".$n."_threads t USING(threadid) WHERE s.userid='$wbbuserdata[userid]' AND t.visible = 1 $datecute ORDER BY t.lastposttime DESC");
while($row=$db->fetch_array($result)) $threadids .= ",".$row['threadid'];
$result = $db->query("SELECT
$ownuserid
t.*,
IF(t.voted>0,t.votepoints/t.voted,0) AS vote,
i.*
FROM bb".$n."_threads t
LEFT JOIN bb".$n."_icons i USING (iconid)
$ownjoin
WHERE t.threadid IN (0$threadids)
ORDER BY t.lastposttime DESC");
$threadbit="";
while($threads=$db->fetch_array($result)) {
$firstnew="";
$multipages="";
$prefix="";
if($wbbuserdata['lastvisit']<$threads['lastposttime'] && $threadvisit[$threads['threadid']]<$threads['lastposttime']) eval ("\$firstnew = \"".$tpl->get("board_threadbit_firstnew")."\";");
if($threads['starterid']!=0) eval ("\$threads['starter'] = \"".$tpl->get("board_threadbit_starter")."\";");
if($threads['lastposterid']!=0) eval ("\$threads['lastposter'] = \"".$tpl->get("board_threadbit_lastposter")."\";");
if($threads['pollid']!=0) $foldericon="poll";
else $foldericon=ifelse($threads['userid'],"dot").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['iconid']) $threadicon=makeimgtag($threads['iconpath'],$threads['icontitle']);
else $threadicon=" ";
if($threads['starterid']!=0) eval ("\$threads['starter'] = \"".$tpl->get("board_threadbit_starter")."\";");
if($threads['lastposterid']!=0) eval ("\$threads['lastposter'] = \"".$tpl->get("board_threadbit_lastposter")."\";");
$lastpostdate=formatdate($dateformat,$threads['lastposttime'],1);
$lastposttime=formatdate($timeformat,$threads['lastposttime']);
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")."\";");
}
$result2 = $db->query("SELECT * FROM bb".$n."_subscribethreads WHERE userid='$wbbuserdata[userid]' AND threadid='$threads[threadid]'");
$row2=$db->fetch_array($result2);
$favindex = $row2['fav_index'];
if($favindex=='1'){
eval ("\$threadbit .= \"".$tpl->get("index_inplay_threadbit")."\";");
}
elseif($favindex==2 AND $threads['lastposterid']!=$wbbuserdata[userid]){
//
eval ("\$threadbit .= \"".$tpl->get("index_inplay_threadbit")."\";");
}
}
if($threadbit) eval ("\$threadheader = \"".$tpl->get("index_inplay_threadheader")."\";");
else eval ("\$threadheader = \"".$tpl->get("index_inplay_nothreads")."\";");
$inplayindex = $db->query("SELECT inplay_index FROM bb".$n."_users WHERE userid = '$wbbuserdata[userid]'");
if($wbbuserdata['inplay_index']==0) {
eval ("\$index_inplay = \"".$tpl->get("index_inplay")."\";");
}
else {
$index_inplay='';
}
eval("\$tpl->output(\"".$tpl->get("index_inplay_popup")."\");");
}else {
eval("\$tpl->output(\"".$tpl->get("index")."\");");
}
?>
|