This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathbbs.php
400 lines (384 loc) · 12.6 KB
/
bbs.php
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
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
<?
require("include/top.php");
function goodfleche($wanted,$current) {
if($wanted==$current) {
$fleche="fleche1a";
} else {
$fleche="fleche1b";
}
return $fleche;
}
function htmlcleanonerow($inhtml){
$inhtml= str_replace( "<", "&" . "lt;", $inhtml);
$inhtml= str_replace( ">", "&" . "gt;", $inhtml);
$inhtml= str_replace( "\"", "&" . "quot;", $inhtml);
$inhtml= str_replace( "\n", " ", $inhtml);
return $inhtml;
}
$topics_per_page=$user["bbsbbstopics"];
if(($page<=0)||(!$page)) {
$page=1;
}
$query="SELECT count(0) FROM bbs_topics";
if ($_GET["categoryfilter"])
$query.= sprintf(" where bbs_topics.category = %d",$_GET["categoryfilter"]);
$result=mysql_query($query);
$nb_topics=mysql_result($result,0);
$query="SELECT bbs_topics.id, bbs_topics.topic, bbs_topics.firstpost, bbs_topics.lastpost, bbs_topics.userfirstpost, bbs_topics.userlastpost, bbs_topics.count, bbs_topics.category, users1.nickname as nickname_1, users1.avatar as avatar_1, users2.nickname as nickname_2, users2.avatar as avatar_2 FROM bbs_topics LEFT JOIN users as users2 on users2.id=bbs_topics.userfirstpost LEFT JOIN users as users1 on users1.id=bbs_topics.userlastpost";
if ($_GET["categoryfilter"])
$query.= sprintf(" where bbs_topics.category = %d",$_GET["categoryfilter"]);
switch($order) {
case "userfirstpost": $query.=" ORDER BY nickname_2, avatar_2, bbs_topics.lastpost DESC"; break;
case "firstpost": $query.=" ORDER BY firstpost DESC"; break;
case "userlastpost": $query.=" ORDER BY nickname_1, avatar_1, bbs_topics.lastpost DESC"; break;
case "lastpost": $query.=" ORDER BY bbs_topics.lastpost DESC"; break;
case "count": $query.=" ORDER BY bbs_topics.count DESC"; break;
case "topic": $query.=" ORDER BY bbs_topics.topic"; break;
case "category": $query.=" ORDER BY bbs_topics.category"; break;
default: $query.=" ORDER BY bbs_topics.lastpost DESC"; break;
}
$query.=" LIMIT ".(($page-1)*$topics_per_page).",".$topics_per_page;
$result=mysql_query($query);
while($tmp=mysql_fetch_assoc($result)) {
$topics[]=$tmp;
}
$sortlink ="bbs.php?";
if ($_GET["categoryfilter"])
$sortlink ="categoryfilter=".$_GET["categoryfilter"]."&";
$sortlink.="order=";
$pagelink = "bbs.php?order=".$order;
if ($_GET["categoryfilter"])
$pagelink .= "&categoryfilter=".$_GET["categoryfilter"]."";
$row = 6;
if (canSeeBBSCategories()) {
$row = 7;
}
?>
<br />
<table bgcolor="#000000" cellspacing="1" cellpadding="0">
<tr>
<td>
<table bgcolor="#000000" cellspacing="1" cellpadding="2">
<tr>
<td bgcolor="#224488" colspan="<?=$row?>" align="center">
<b>the oldskool pouët.net bbs</b><br />
</td>
</tr>
<tr>
<th bgcolor="#224488">
<table><tr>
<td>
<a href="<? print($sortlink); ?>firstpost"><img src="gfx/<? print(goodfleche("firstpost",$order)); ?>.gif" width="13" height="12" border="0"></a><br />
</td>
<td>
<a href="<? print($sortlink); ?>firstpost"><b>started</b></a>
</td>
</tr></table>
</th>
<th bgcolor="#224488">
<table><tr>
<td>
<a href="<? print($sortlink); ?>userfirstpost"><img src="gfx/<? print(goodfleche("userfirstpost",$order)); ?>.gif" width="13" height="12" border="0"></a><br />
</td>
<td>
<a href="<? print($sortlink); ?>userfirstpost"><b>by</b></a>
</td>
</tr></table>
</th>
<?
if (canSeeBBSCategories()) {
?>
<th bgcolor="#224488">
<table><tr>
<td>
<a href="<? print($sortlink); ?>category"><img src="gfx/<? print(goodfleche("category",$order)); ?>.gif" width="13" height="12" border="0"></a><br />
</td>
<td>
<a href="<? print($sortlink); ?>category"><b>category</b></a>
</td>
</tr></table>
</th>
<?
}
?>
<th bgcolor="#224488">
<table><tr>
<td>
<a href="<? print($sortlink); ?>topic"><img src="gfx/<? print(goodfleche("topic",$order)); ?>.gif" width="13" height="12" border="0"></a><br />
</td>
<td>
<a href="<? print($sortlink); ?>topic"><b>bbs topic</b></a>
</td>
</tr></table>
</th>
<th bgcolor="#224488">
<table><tr>
<td>
<a href="<? print($sortlink); ?>count"><img src="gfx/<? print(goodfleche("count",$order)); ?>.gif" width="13" height="12" border="0"></a><br />
</td>
<td>
<a href="<? print($sortlink); ?>count"><b>replies</b></a>
</td>
</tr></table>
</th>
<th bgcolor="#224488">
<table><tr>
<td>
<a href="<? print($sortlink); ?>lastpost"><img src="gfx/<? print(goodfleche("lastpost",$order)); ?>.gif" width="13" height="12" border="0"></a><br />
</td>
<td>
<a href="<? print($sortlink); ?>lastpost"><b>last post</b></a>
</td>
</tr></table>
</th>
<th bgcolor="#224488">
<table><tr>
<td>
<a href="<? print($sortlink); ?>userlastpost"><img src="gfx/<? print(goodfleche("userlastpost",$order)); ?>.gif" width="13" height="12" border="0"></a><br />
</td>
<td>
<a href="<? print($sortlink); ?>userlastpost"><b>by</b></a>
</td>
</tr></table>
</th>
</tr>
<? for($i=0;$i<count($topics);$i++): ?>
<? $tdcolor=($i%2)?"#557799":"#446688"; ?>
<tr class="cite-<?=$topics[$i]["userfirstpost"]?>">
<td bgcolor="<?=$tdcolor?>">
<?=substr($topics[$i]["firstpost"],0,10)?><br />
</td>
<td bgcolor="<?=$tdcolor?>">
<table cellspacing="0" cellpadding="0">
<tr>
<td>
<a href="user.php?who=<?=$topics[$i]["userfirstpost"]?>">
<img src="avatars/<?=$topics[$i]["avatar_2"]?>" width="16" height="16" border="0" title="<?=$topics[$i]["nickname_2"]?>"><br />
</a>
</td>
<td>
<img src="gfx/z.gif" width="3" height="1"><br />
</td>
<td>
<a href="user.php?who=<?=$topics[$i]["userfirstpost"]?>">
<?=$topics[$i]["nickname_2"]?><br />
</a>
</td>
</tr>
</table>
</td>
<?
if (canSeeBBSCategories()) {
?>
<td bgcolor="<?=$tdcolor?>">
<?=$thread_categories[$topics[$i]["category"]]?>
<?
if (canEditBBSCategories()) {
?>
[<a href="edit_topic_category.php?which=<?=$topics[$i]["id"]?>">edit</a>]
<?
}
?>
</td>
<?
}
?>
<td bgcolor="<?=$tdcolor?>">
<a href="topic.php?which=<?=$topics[$i]["id"]?>"><b>
<? if (strlen($topics[$i]["topic"])>70) print(htmlcleanonerow(substr($topics[$i]["topic"],0,70)."...")); else print(htmlcleanonerow($topics[$i]["topic"])); ?></b></a><br />
</td>
<td bgcolor="<?=$tdcolor?>" align="right">
<?=$topics[$i]["count"]?><br />
</td>
<td bgcolor="<?=$tdcolor?>">
<?=$topics[$i]["lastpost"]?><br />
</td>
<td bgcolor="<?=$tdcolor?>">
<table cellspacing="0" cellpadding="0">
<tr>
<td>
<a href="user.php?who=<?=$topics[$i]["userlastpost"]?>">
<img src="avatars/<?=$topics[$i]["avatar_1"]?>" width="16" height="16" border="0" title="<?=$topics[$i]["nickname_1"]?>"><br />
</a>
</td>
<td>
<img src="gfx/z.gif" width="3" height="1"><br />
</td>
<td>
<a href="user.php?who=<?=$topics[$i]["userlastpost"]?>">
<?=$topics[$i]["nickname_1"]?><br />
</a>
</td>
</tr>
</table>
</td>
</tr>
<? endfor; ?>
</tr>
<tr bgcolor="#224488">
<td colspan="<?=$row?>">
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<? if($page>=2): ?>
<td>
<a href="<?=($pagelink)?>&page=<?=($page-1)?>">
<img src="gfx/flecheg.gif" border="0"><br />
</a>
</td>
<td> </td>
<td nowrap>
<a href="<?=($pagelink)?>&page=<?=($page-1)?>">
<b>previous page</b><br />
</a>
</td>
<? endif; ?>
<form action="bbs.php">
<td width="50%" align="right">
<input type="hidden" name="order" value="<? print($order); ?>">
<?if($_GET["categoryfilter"]){?> <input type="hidden" name="categoryfilter" value="<? print($_GET["categoryfilter"]); ?>"><?}?>
<select name="page">
<? for($i=1;($i-1)<=($nb_topics/$topics_per_page);$i++): ?>
<? if($i==$page): ?>
<option value="<? print($i); ?>" selected><? print($i); ?></option>
<? else: ?>
<option value="<? print($i); ?>"><? print($i); ?></option>
<? endif; ?>
<? endfor; ?>
</select><br />
</td>
<td> </td>
<td width="50%">
<input type="image" src="gfx/submit.gif" border="0"><br />
</td>
</form>
<? if(($page*$topics_per_page)<=$nb_topics): ?>
<td nowrap>
<a href="<?=($pagelink)?>&page=<?=($page+1)?>">
<b>next page</b><br />
</a>
</td>
<td> </td>
<td>
<a href="<?=($pagelink)?>&page=<?=($page+1)?>">
<img src="gfx/fleched.gif" border="0"><br />
</a>
</td>
<? endif; ?>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br />
<table bgcolor="#000000" cellspacing="1" cellpadding="0" width="50%">
<tr>
<td>
<table bgcolor="#000000" cellspacing="1" cellpadding="2">
<tr>
<th bgcolor="#224488" colspan="4">
Disclaimer<br />
</th>
</tr>
<tr>
<td bgcolor="#446688" colspan="4" align="left">
The oldskool pouët BBS is not the demoscene, please visit a <a href="http://www.demoparty.net/">demoparty</a>. This is merely a forum for sceners, with obviously too much free time, to release their frustrations and request salted communitary feedback, as opposed to polluting the prod comments section.<br />
<br />
New users: please take your vaccines before entering, don't expect instant praise, and try not to feel easily insulted.<br />
Old users: please don't feed the trolls. Reoccuring annoying behavior will result in a heavily subjective ban. Just try not to piss off 90% of our active users with childish and/or idiotic behaviour and you should be safe.<br />
<br />
<a href="http://i.imgur.com/QBxVc.jpg">You have been warned.</a><br />
<br />
Also, <b>copycat threads are the equivalent of putting glow and ribbons in your demo.</b><br />
</td>
</tr>
</table>
</td>
</tr>
</table>
<br />
<? if($_SESSION["SCENEID_ID"]): ?>
<form action="add.php" method="post">
<input type="hidden" name="type" value="topic">
<table bgcolor="#000000" cellspacing="1" cellpadding="0">
<tr>
<td>
<table bgcolor="#000000" cellspacing="1" cellpadding="2">
<tr>
<th bgcolor="#224488" colspan="4">
post a new topic<br />
</th>
</tr>
<tr>
<td bgcolor="#446688" colspan="4" align="center">
<table>
<tr>
<td>
topic:<br />
<input type="text" name="topic" size="80" value="<?=$topic?>"><br />
<?
if (canSeeBBSCategories()) {
?>
category:<br />
<select name='category'>
<?
foreach ($thread_categories as $k=>$v)
printf("<option value='%d'%s>%s</option>\n",$k,0==$k?' selected="selected"':"",htmlspecialchars($v));
?>
</select>
<br />
<?
}
?>
message:<br />
<textarea cols="80" rows="10" name="message"><?=$message?></textarea><br />
<div align="right"><a href="faq.php#BB Code"><b>BB Code</b></a> is allowed here</div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td bgcolor="#224488" colspan="4" align="right">
<script language="JavaScript" type="text/javascript">
<!--
document.write('<input type="image" src="gfx/previewdxm.gif" onclick=\'return preview(this.form,"topic")\' border="0">');
//-->
</script>
<input type="image" src="gfx/submit.gif" border="0"><br />
</th>
</tr>
</table>
</td>
</tr>
</table>
</form>
<? else: ?>
<form action="login.php" method="post">
<table bgcolor="#000000" cellspacing="1" cellpadding="0">
<tr>
<td>
<table bgcolor="#000000" cellspacing="1" cellpadding="2">
<tr><th>post a new topic</th></tr>
<tr bgcolor="#446688">
<td nowrap align="center">
You need to be logged in to post a new topic :: <a href="account.php">register here</a><br />
<input type="text" name="login" value="SceneID" size="15" maxlength="16" onfocus="this.value=''">
<input type="password" name="password" value="password" size="15" onfocus="javascript:if(this.value=='password') this.value='';"><br />
</td>
</tr>
<tr>
<td bgcolor="#6688AA" align="right">
<input type="image" src="gfx/submit.gif">
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<? endif; ?>
<br />
<? require("include/bottom.php"); ?>