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:
|
<?php
// ************************************************************************************//
// * WoltLab Burning Board 2
// ************************************************************************************//
// * Copyright (c) 2001-2004 WoltLab GmbH
// * Web http://www.woltlab.de/
// * License http://www.woltlab.de/products/burning_board/license_en.php
// * http://www.woltlab.de/products/burning_board/license.php
// ************************************************************************************//
// * WoltLab Burning Board 2 is NOT free software.
// * You may not redistribute this package or any of it's files.
// ************************************************************************************//
// * $Date: 2006-01-04 11:43:47 +0100 (Wed, 04 Jan 2006) $
// * $Author: Burntime $
// * $Rev: 1681 $
// ************************************************************************************//
class WIW extends useronline {
var $useronlinecache = array();
var $boardids = "";
var $threadids = "";
var $userids = "";
var $eventids = "";
var $postids = "";
var $boardcache = array();
var $threadcache = array();
var $usercache = array();
var $eventcache = array();
var $postcache = array();
var $counter = -1;
function insert($data) {
list($script, $querystring, ) = explode("?", $data['request_uri']);
if ($script == "attachment.php") $script = "thread.php";
if ($script == "attachmentedit.php") $script = "board.php";
$data['script'] = $script;
if ($script == "board.php" || $script == "board.html" || $script == "newthread.php") $this->boardids .= ",".$data['boardid'];
elseif ($script == "thread.php" || $script == "thread.html" || $script == "addreply.php") $this->threadids .= ",".$data['threadid'];
elseif ($script == "profile.php") {
$a_querystring = explode("&", $querystring);
for ($i = 0; $i < count($a_querystring); $i++) {
list($varname, $value, ) = explode("=", $a_querystring[$i]);
if ($varname == "userid") {
$value = intval($value);
if ($value != 0) {
$this->userids .= ",".$value;
$data['profile_userid'] = $value;
}
}
}
}
elseif ($script == "calendar.php") {
$calendar_action = '';
$eventid = 0;
$a_querystring = explode("&", $querystring);
for ($i = 0; $i < count($a_querystring); $i++) {
list($varname, $value, ) = explode("=", $a_querystring[$i]);
if ($varname == "id") $eventid = intval($value);
if ($varname == "action") $calendar_action = $value;
}
if ($calendar_action == "viewevent" && $eventid != 0) {
$this->eventids .= ",".$eventid;
$data['eventid'] = $eventid;
}
}
elseif ($script == "editpost.php") {
$a_querystring = explode("&", $querystring);
for ($i = 0; $i < count($a_querystring); $i++) {
list($varname, $value, ) = explode("=", $a_querystring[$i]);
if ($varname == "postid") {
$value = intval($value);
if ($value != 0) {
$this->postids .= ",".$value;
$data['postid'] = $value;
}
}
}
}
$this->useronlinecache[] = $data;
}
function cache() {
global $permissioncache, $wbbuserdata, $n, $db, $lang;
if ($this->boardids != '' || $this->threadids != '' || $this->postids != '') {
if (!isset($permissioncache)) $permissioncache = getPermissions();
$global_boardids1 = '';
$global_boardids2 = '';
$result = $db->unbuffered_query("SELECT boardid FROM bb".$n."_boards WHERE password='' AND invisible<>2");
while ($row = $db->fetch_array($result)) {
if (!isset($permissioncache[$row['boardid']]['can_enter_board']) || $permissioncache[$row['boardid']]['can_enter_board'] == -1) $permissioncache[$row['boardid']]['can_enter_board'] = $wbbuserdata['can_enter_board'];
if (!isset($permissioncache[$row['boardid']]['can_view_board']) || $permissioncache[$row['boardid']]['can_view_board'] == -1) $permissioncache[$row['boardid']]['can_view_board'] = $wbbuserdata['can_view_board'];
if ($permissioncache[$row['boardid']]['can_view_board'] == 1) $global_boardids1 .= ",".$row['boardid'];
if ($permissioncache[$row['boardid']]['can_enter_board'] == 1) $global_boardids2 .= ",".$row['boardid'];
}
if ($this->boardids != '' && $global_boardids1 != '') {
$result = $db->unbuffered_query("SELECT boardid, title FROM bb".$n."_boards WHERE boardid IN (0".$this->boardids.") AND boardid IN (0".$global_boardids1.")");
while ($row = $db->fetch_array($result)) $this->boardcache[$row['boardid']] = getlangvar($row['title'], $lang);
}
if ($this->threadids != '' && $global_boardids2 != '') {
$result = $db->unbuffered_query("SELECT threadid, topic FROM bb".$n."_threads WHERE threadid IN (0".$this->threadids.") AND boardid IN (0".$global_boardids2.")");
while ($row = $db->fetch_array($result)) $this->threadcache[$row['threadid']] = htmlconverter(textwrap($row['topic']));
}
if ($this->postids != '' && $global_boardids2 != '') {
$result = $db->unbuffered_query("SELECT p.postid, p.posttopic, p.message FROM bb".$n."_posts p, bb".$n."_threads t WHERE p.threadid=t.threadid AND p.postid IN (0".$this->postids.") AND t.boardid IN (0".$global_boardids2.")");
while ($row = $db->fetch_array($result)) $this->postcache[$row['postid']] = htmlconverter(textwrap( (($row['posttopic'] != '') ? ($row['posttopic']) : (wbb_substr($row['message'], 0, 100))) ));
}
}
if ($this->userids != '') {
$result = $db->unbuffered_query("SELECT userid, username FROM bb".$n."_users WHERE userid IN (0".$this->userids.")");
while ($row = $db->fetch_array($result)) $this->usercache[$row['userid']] = htmlconverter($row['username']);
}
if ($this->eventids != '' && $wbbuserdata['can_view_calendar']) {
$result = $db->unbuffered_query("SELECT eventid, subject FROM bb".$n."_events WHERE eventid IN (0".$this->eventids.") AND (public=2 OR (public=1 AND groupid = '$wbbuserdata[groupid]') OR (public=0 AND userid = '$wbbuserdata[userid]'))");
while ($row = $db->fetch_array($result)) $this->eventcache[$row['eventid']] = htmlconverter($row['subject']);
}
}
function get() {
global $lang, $session, $SID_ARG_1ST, $SID_ARG_2ND, $SID_ARG_2ND_UN;
$this->counter++;
if (isset($this->useronlinecache[$this->counter])) {
if (!$this->useronlinecache[$this->counter]['invisible'] || $this->can_view_ghosts == 1) {
switch ($this->useronlinecache[$this->counter]['script']) {
case "index.php":
$location = $lang->get("LANG_WIW_FILE_INDEX", array('$SID_ARG_1ST' => $SID_ARG_1ST));
break;
case "wiw.php":
$location = $lang->get("LANG_WIW_FILE_WIW", array('$SID_ARG_1ST' => $SID_ARG_1ST));
break;
case "register.php":
case "regimage.php":
$location = $lang->get("LANG_WIW_FILE_REGISTER", array('$SID_ARG_1ST' => $SID_ARG_1ST));
break;
case "usercp.php":
$location = $lang->get("LANG_WIW_FILE_USERCP", array('$SID_ARG_1ST' => $SID_ARG_1ST));
break;
case "login.php":
$location = $lang->get("LANG_WIW_FILE_LOGIN");
break;
case "game_start.php?action=start":
$location = $lang->get("LANG_WIW_FILE_GAME_START");
break;
case "techtree.php?tech=techtree":
$location = $lang->get("LANG_WIW_FILE_GAME_TECHTREE");
break;
case "game_start.php?game=computer":
$location = $lang->get("LANG_WIW_FILE_GAME_COMPUTER");
break;
case "game_start.php?game=ranklist":
$location = $lang->get("LANG_WIW_FILE_GAME_RANKLIST");
break;
case "game_start.php?game=computer_hardware":
$location = $lang->get("LANG_WIW_FILE_GAME_HARDWARE");
break;
case "game_start.php?game=computer_software":
$location = $lang->get("LANG_WIW_FILE_GAME_SOFTWARE");
break;
case "game_start.php?game=computer_edit":
$location = $lang->get("LANG_WIW_FILE_GAME_COMPUTER_EDIT");
break;
case "game_start.php?game=computer_all":
$location = $lang->get("LANG_WIW_FILE_GAME_COMPUTER_ALL");
break;
case "profile.php":
if (isset($this->useronlinecache[$this->counter]['profile_userid']) && isset($this->usercache[$this->useronlinecache[$this->counter]['profile_userid']])) {
$userid = $this->useronlinecache[$this->counter]['profile_userid'];
$username = $this->usercache[$userid];
$location = $lang->get("LANG_WIW_FILE_PROFILE", array('$userid' => $userid, '$SID_ARG_2ND' => $SID_ARG_2ND, '$username' => $username));
}
else $location = $lang->get("LANG_WIW_FILE_UNKNOWN");
break;
case "logout.php":
$location = $lang->get("LANG_WIW_FILE_LOGOUT");
break;
case "memberslist.php":
$location = $lang->get("LANG_WIW_FILE_MEMBERSLIST", array('$SID_ARG_1ST' => $SID_ARG_1ST));
break;
case "search.php":
$location = $lang->get("LANG_WIW_FILE_SEARCH", array('$SID_ARG_1ST' => $SID_ARG_1ST));
break;
case "calendar.php":
if (isset($this->useronlinecache[$this->counter]['eventid']) && isset($this->eventcache[$this->useronlinecache[$this->counter]['eventid']])) {
$eventid = $this->useronlinecache[$this->counter]['eventid'];
$subject = $this->eventcache[$eventid];
$location = $lang->get("LANG_WIW_FILE_CALENDAR_VIEWEVENT", array('$eventid' => $eventid, '$SID_ARG_2ND' => $SID_ARG_2ND, '$subject' => $subject));
}
else $location = $lang->get("LANG_WIW_FILE_CALENDAR", array('$SID_ARG_1ST' => $SID_ARG_1ST));
break;
case "team.php":
$location = $lang->get("LANG_WIW_FILE_TEAM", array('$SID_ARG_1ST' => $SID_ARG_1ST));
break;
case "pms.php":
$location = $lang->get("LANG_WIW_FILE_PMS", array('$SID_ARG_1ST' => $SID_ARG_1ST));
break;
case "modcp.php":
$location = $lang->get("LANG_WIW_FILE_MODCP");
break;
case "editpost.php":
if (isset($this->useronlinecache[$this->counter]['postid']) && isset($this->postcache[$this->useronlinecache[$this->counter]['postid']])) {
$postid = $this->useronlinecache[$this->counter]['postid'];
$topic = $this->postcache[$postid];
$location = $lang->get("LANG_WIW_FILE_EDITPOST", array('$postid' => $postid, '$SID_ARG_2ND' => $SID_ARG_2ND, '$topic' => $topic));
}
else $location = $lang->get("LANG_WIW_FILE_UNKNOWN");
break;
case "board.php":
if (isset($this->useronlinecache[$this->counter]['boardid']) && isset($this->boardcache[$this->useronlinecache[$this->counter]['boardid']])) {
$boardid = $this->useronlinecache[$this->counter]['boardid'];
$title = $this->boardcache[$boardid];
$location = $lang->get("LANG_WIW_FILE_BOARD", array('$boardid' => $boardid, '$SID_ARG_2ND' => $SID_ARG_2ND, '$title' => $title));
}
else $location = $lang->get("LANG_WIW_FILE_UNKNOWN");
break;
case "newthread.php":
if (isset($this->useronlinecache[$this->counter]['boardid']) && isset($this->boardcache[$this->useronlinecache[$this->counter]['boardid']])) {
$boardid = $this->useronlinecache[$this->counter]['boardid'];
$title = $this->boardcache[$boardid];
$location = $lang->get("LANG_WIW_FILE_NEWTHREAD", array('$boardid' => $boardid, '$SID_ARG_2ND' => $SID_ARG_2ND, '$title' => $title));
}
else $location = $lang->get("LANG_WIW_FILE_UNKNOWN");
break;
case "thread.php":
if (isset($this->useronlinecache[$this->counter]['threadid']) && isset($this->threadcache[$this->useronlinecache[$this->counter]['threadid']])) {
$threadid = $this->useronlinecache[$this->counter]['threadid'];
$topic = $this->threadcache[$threadid];
$location = $lang->get("LANG_WIW_FILE_THREAD", array('$threadid' => $threadid, '$SID_ARG_2ND' => $SID_ARG_2ND, '$topic' => $topic));
}
else $location = $lang->get("LANG_WIW_FILE_UNKNOWN");
break;
case "addreply.php":
if (isset($this->useronlinecache[$this->counter]['threadid']) && isset($this->threadcache[$this->useronlinecache[$this->counter]['threadid']])) {
$threadid = $this->useronlinecache[$this->counter]['threadid'];
$topic = $this->threadcache[$threadid];
$location = $lang->get("LANG_WIW_FILE_ADDREPLY", array('$threadid' => $threadid, '$SID_ARG_2ND' => $SID_ARG_2ND, '$topic' => $topic));
}
else $location = $lang->get("LANG_WIW_FILE_UNKNOWN");
break;
case "usergroups.php":
$location = $lang->get("LANG_WIW_FILE_USERGROUPS");
break;
case "index.html":
$location = $lang->get("LANG_WIW_FILE_ARCHIVE_INDEX", array('$SID_ARG_1ST' => $SID_ARG_1ST));
break;
case "board.html":
if (isset($this->useronlinecache[$this->counter]['boardid']) && isset($this->boardcache[$this->useronlinecache[$this->counter]['boardid']])) {
$boardid = $this->useronlinecache[$this->counter]['boardid'];
$title = $this->boardcache[$boardid];
$location = $lang->get("LANG_WIW_FILE_ARCHIVE_BOARD", array('$boardid' => $boardid, '$SID_ARG_2ND' => $SID_ARG_2ND, '$title' => $title));
}
else $location = $lang->get("LANG_WIW_FILE_UNKNOWN");
break;
case "thread.html":
if (isset($this->useronlinecache[$this->counter]['threadid']) && isset($this->threadcache[$this->useronlinecache[$this->counter]['threadid']])) {
$threadid = $this->useronlinecache[$this->counter]['threadid'];
$topic = $this->threadcache[$threadid];
$location = $lang->get("LANG_WIW_FILE_ARCHIVE_THREAD", array('$threadid' => $threadid, '$SID_ARG_2ND' => $SID_ARG_2ND, '$topic' => $topic));
}
else $location = $lang->get("LANG_WIW_FILE_UNKNOWN");
break;
default:
$location = $lang->get("LANG_WIW_FILE_UNKNOWN");
}
$this->useronlinecache[$this->counter]['location'] = $location;
return $this->useronlinecache[$this->counter];
}
else return $this->get();
}
else return ;
}
}
?>
|