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 pathdemoblog.php
470 lines (449 loc) · 17.2 KB
/
demoblog.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
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
<?php
require_once('include/top.php');
require_once('include/libbb.php');
require_once('lib/recaptcha/recaptchalib.php');
$who = (int)$_GET["who"];
if(!$who) {
$result = mysql_query("SELECT id FROM users");
while($tmp = mysql_fetch_row($result)) {
$ids[]=$tmp[0];
}
$who=$ids[mt_rand(0,count($ids)-1)];
}
$usercustom=$user;
if ($com) $linebypage=$com; else $linebypage=$com=25;
$query="SELECT count(0) FROM comments where comments.who=".$who;
$result=mysql_query($query);
$nbmsg=mysql_result($result,0);
if(!$page) $page=1;
$result = mysql_query_debug("SELECT * FROM users WHERE id=".$who);
$user = mysql_fetch_array($result);
$sceneIDData = array();
if (!$user["sceneIDData"] || (time() - strtotime($user["sceneIDLastRefresh"])) < 60 * 60)
{
$returnvalue = $xml->parseSceneIdData("getUserInfo", array("userID" => $who));
if(is_array($returnvalue["user"])&&is_array($user)) {
$r = $returnvalue["user"];
$sceneIDData = $r;
}
mysql_query("update users set sceneIDLastRefresh = now(), sceneIDData='".mysql_real_escape_string(serialize($returnvalue["user"]))."' where id=".$who);
} else {
$sceneIDData = unserialize( $user["sceneIDData"] );
}
unset( $sceneIDData["nickname"] );
$user = array_merge($user, $sceneIDData);
$query="SELECT prods.id,prods.name,prods.group1,prods.group2,prods.group3,prods.type,comments.who,comments.comment,comments.rating,comments.quand,users.nickname,users.avatar,UNIX_TIMESTAMP()-UNIX_TIMESTAMP(comments.quand) as difftime FROM prods JOIN comments JOIN users WHERE comments.which=prods.id AND comments.who=users.id AND comments.who=".$who;
if ($nothumbsdown) $query.=" AND comments.rating!=-1";
if ($nopiggies) $query.=" AND comments.rating!=0";
if ($nothumbsup) $query.=" AND comments.rating!=1";
$query.=" ORDER BY comments.quand DESC";
$query.=" LIMIT ".(($page-1)*$linebypage).",".$linebypage;
//if ($com) $query.=" LIMIT ".$com; else $query.=" LIMIT 12";
$result = mysql_query($query);
while($tmp = mysql_fetch_assoc($result)) {
$comments[] = $tmp;
}
for ($i=0; $i<count($comments); $i++):
if ($comments[$i]["group1"]):
$query="select name,acronym from groups where id='".$comments[$i]["group1"]."'";
$result=mysql_query($query);
while($tmp = mysql_fetch_array($result)) {
$comments[$i]["groupn1"]=$tmp["name"];
$comments[$i]["groupacron1"]=$tmp["acronym"];
}
endif;
if ($comments[$i]["group2"]):
$query="select name,acronym from groups where id='".$comments[$i]["group2"]."'";
$result=mysql_query($query);
while($tmp = mysql_fetch_array($result)) {
$comments[$i]["groupn2"]=$tmp["name"];
$comments[$i]["groupacron2"]=$tmp["acronym"];
}
endif;
if ($comments[$i]["group3"]):
$query="select name,acronym from groups where id='".$comments[$i]["group3"]."'";
$result=mysql_query($query);
while($tmp = mysql_fetch_array($result)) {
$comments[$i]["groupn3"]=$tmp["name"];
$comments[$i]["groupacron3"]=$tmp["acronym"];
}
endif;
if (strlen($comments[$i]["groupn1"].$comments[$i]["groupn2"].$comments[$i]["groupn3"])>27):
if (strlen($comments[$i]["groupn1"])>10 && $comments[$i]["groupacron1"]) $comments[$i]["groupn1"]=$comments[$i]["groupacron1"];
if (strlen($comments[$i]["groupn2"])>10 && $comments[$i]["groupacron1"]) $comments[$i]["groupn2"]=$comments[$i]["groupacron2"];
if (strlen($comments[$i]["groupn3"])>10 && $comments[$i]["groupacron1"]) $comments[$i]["groupn3"]=$comments[$i]["groupacron3"];
endif;
$query="select platforms.name from prods_platforms, platforms where prods_platforms.prod='".$comments[$i]["id"]."' and platforms.id=prods_platforms.platform";
$result=mysql_query($query);
$check=0;
$comments[$i]["platform"]="";
while($tmp = mysql_fetch_array($result)) {
if ($check>0) $comments[$i]["platform"].=",";
$check++;
$comments[$i]["platform"].=$tmp["name"];
}
endfor;
//print("<br />->".count($comments)."<-");
for($i=0;$i<count($comments);$i++) {
// trasformation secondes en lisible
$comments[$i]["t_hours"]=floor($comments[$i]["difftime"]/3600);
$comments[$i]["t_minutes"]=floor(($comments[$i]["difftime"]-3600*$comments[$i]["t_hours"])/60);
$comments[$i]["t_seconds"]=$comments[$i]["difftime"]-3600*$comments[$i]["t_hours"]-60*$comments[$i]["t_minutes"];
}
$query="SELECT prods.id,prods.name,prods.type,prods.group1,prods.group2,prods.group3 FROM users_cdcs, prods WHERE users_cdcs.cdc=prods.id and users_cdcs.user=".$who;
$result=mysql_query($query);
while($tmp=mysql_fetch_array($result)) {
$cdc[]=$tmp;
}
for ($i=0; $i<count($cdc); $i++):
if ($cdc[$i]["group1"]):
$query="select name,acronym from groups where id='".$cdc[$i]["group1"]."'";
$result=mysql_query($query);
while($tmp = mysql_fetch_array($result)) {
$cdc[$i]["groupname1"]=$tmp["name"];
$cdc[$i]["groupacron1"]=$tmp["acronym"];
}
endif;
if ($cdc[$i]["group2"]):
$query="select name,acronym from groups where id='".$cdc[$i]["group2"]."'";
$result=mysql_query($query);
while($tmp = mysql_fetch_array($result)) {
$cdc[$i]["groupname2"]=$tmp["name"];
$cdc[$i]["groupacron2"]=$tmp["acronym"];
}
endif;
if ($cdc[$i]["group3"]):
$query="select name,acronym from groups where id='".$cdc[$i]["group3"]."'";
$result=mysql_query($query);
while($tmp = mysql_fetch_array($result)) {
$cdc[$i]["groupname3"]=$tmp["name"];
$cdc[$i]["groupacron3"]=$tmp["acronym"];
}
endif;
if (strlen($cdc[$i]["groupname1"].$cdc[$i]["groupname2"].$cdc[$i]["groupname3"])>27):
if (strlen($cdc[$i]["groupname1"])>10) $cdc[$i]["groupname1"]=$cdc[$i]["groupacron1"];
if (strlen($cdc[$i]["groupname2"])>10) $cdc[$i]["groupname2"]=$cdc[$i]["groupacron2"];
if (strlen($cdc[$i]["groupname3"])>10) $cdc[$i]["groupname3"]=$cdc[$i]["groupacron3"];
endif;
/*$query="select platforms.name from prods_platforms, platforms where prods_platforms.prod='".$cdc[$i]["id"]."' and platforms.id=prods_platforms.platform";
$result=mysql_query($query);
$check=0;
$cdc[$i]["platform"]="";
while($tmp = mysql_fetch_array($result)) {
if ($check>0) $cdc[$i]["platform"].=", ";
$check++;
$cdc[$i]["platform"].=$tmp["name"];
}*/
endfor;
// average rating
$query="SELECT SUM(rating)/count(0) FROM comments WHERE who=".$user["id"];
$result=mysql_query($query);
$avg_rating=mysql_result($result,0);
?>
<br />
<? if ($user["level"]): ?>
<table bgcolor="#000000" cellspacing="1" cellpadding="0" border="0" width="75%">
<tr>
<td>
<table bgcolor="#000000" cellspacing="1" cellpadding="2" border="0" width="100%">
<tr bgcolor="#224488">
<td colspan="2">
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td>
<img src="avatars/<? print($user["avatar"]); ?>" width="16" height="16"><br>
</td>
<td> </td>
<td nowrap>
<? if(strlen(trim($user["nickname"]))): ?>
<b><? print($user["nickname"]); ?></b> information<br>
<? else: ?>
<b><? print($user["login"]); ?></b> information<br>
<? endif; ?>
</td>
<td width="100%" align="right">
<b><? print($user["glops"]); ?></b> <font color="#9999AA">glöps</font><br>
</td>
</tr>
</table>
</td>
</tr>
<tr bgcolor="#446688">
<td valign="top" nowrap>
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td>level:<br></td>
<td><? print($user["level"]); ?><br></td>
<? if(strlen($user["nickname"])): ?>
<tr>
<td>nickname:<br></td>
<td>
<? print($user["nickname"]); ?><br>
</td>
</tr>
<? endif; ?>
<? if(strlen($user["country"])): ?>
<tr>
<td>country:<br></td>
<td>
<? print($user["country"]); ?><br>
</td>
</tr>
<? endif; ?>
<? if(strlen($user["email"])): ?>
<tr>
<td>
email:<br>
</td>
<td>
<?
if(($returnvalue["user"]["emailhidden"]!="no") && !($SESSION_LEVEL=='administrator' || $SESSION_LEVEL=='moderator' || $SESSION_LEVEL=='gloperator')):
echo '<font color="#9999AA">hidden</font><br>';
else:
echo recaptcha_mailhide_html(RECAPTCHA_MAILHIDE_PUB_KEY, RECAPTCHA_MAILHIDE_PRIV_KEY, $user["email"]);
endif;
?>
</td>
</tr>
<? endif; ?>
<? if((strlen($user["url"])>0)&&($user["url"]!="http://")): ?>
<tr>
<td>
website:<br>
</td>
<td>
<a href="<? print($user["url"]); ?>"><? print($user["url"]); ?></a><br>
</td>
</tr>
<? endif; ?>
<? if($user["im_id"] && $user["im_type"]): ?>
<tr>
<td><?=$user["im_type"]?>:<br></td>
<td nowrap>
<? print($user["im_id"]."<br>"); ?>
</td>
</tr>
<? endif; ?>
<? /* if($user["uin"]): ?>
<tr>
<td>uin:<br></td>
<td nowrap>
<? print("<img src=\"http://wwp.icq.com/scripts/online.dll?icq=".$user["uin"]."&img=5\" width=\"16\" height=\"16\" border=\"0\" alt=\".\" align=\"left\"> ".$user["uin"]."<br>"); ?>
</td>
</tr>
<? endif; */ ?>
<? if($user["ojuice"]): ?>
<tr>
<td>ojuice:<br></td>
<td>
<? print("<a href=\"http://www.ojuice.net/".$user["ojuice"]."/nick.htm\" target=_blank>profile</a><br>"); ?>
</td>
</tr>
<? endif; ?>
<? if($user["slengpung"]): ?>
<tr>
<td>slengpung:<br></td>
<td>
<a href="http://www.slengpung.com/?userid=<?=$user["slengpung"]?>" target=_blank>pictures</a><br></td>
</td>
</tr>
<? endif; ?>
<? if ($user["csdb"]): ?>
<tr>
<td>csdb:<br></td>
<td>
<a href="http://noname.c64.org/csdb/scener/?id=<?=$user["csdb"]?>" target=_blank>profile</a><br></td>
</td>
</tr>
<? endif; ?>
<? if ($user["zxdemo"]): ?>
<tr>
<td>zxdemo:<br></td>
<td>
<a href="http://zxdemo.org/author.php?id=<?=$user["zxdemo"]?>" target=_blank>profile</a><br></td>
</td>
</tr>
<? endif; ?>
<? for($i=0;$i<count($cdc);$i++): ?>
<tr>
<td>
coup de coeur:<br>
</td>
<td nowrap>
<a href="prod.php?which=<? print($cdc[$i]["id"]."\">".stripslashes($cdc[$i]["name"])); ?></a>
<?
if ($cdc[$i]["groupname1"]) print(" by <a href=\"groups.php?which=".stripslashes($cdc[$i]["group1"])."\">".stripslashes($cdc[$i]["groupname1"])."</a>");
if ($cdc[$i]["groupname2"]) print(" and <a href=\"groups.php?which=".stripslashes($cdc[$i]["group2"])."\">".stripslashes($cdc[$i]["groupname2"])."</a>");
if ($cdc[$i]["groupname3"]) print(" and <a href=\"groups.php?which=".stripslashes($cdc[$i]["group3"])."\">".stripslashes($cdc[$i]["groupname3"])."</a>");
?><br>
</td>
</tr>
<? endfor; ?>
<tr>
<td>average rating:<br></td>
<td>
<?
if($avg_rating>0)
$thumbgfx="gfx/rulez.gif";
elseif($avg_rating==0)
$thumbgfx="gfx/isok.gif";
else
$thumbgfx="gfx/sucks.gif";
?>
<img src="<?=$thumbgfx?>" width="16" height="16" border="0" alt="." align="left"> <?=$avg_rating?><br>
</td>
</tr>
<tr>
<td><b>[</b><a href="user.php?who=<? print($who);?>">glopper view</a><b>]</b><br /></td><td><b>[</b><a href="demoblog.php?who=<? print($who);?>¬humbsdown=1&nopiggies=1">recommendations only</a><b>]</b> <b>[</b><a href="demoblog.php?who=<? print($who);?>¬humbsup=1&nopiggies=1">kaka taste</a><b>]</b> <b>[</b><a href="demoblog.php?who=<? print($who);?>¬humbsup=0&nopiggies=0¬humbsdown=0">all comments</a><b>]<br /></td>
</tr>
</table>
</td>
<td align="right" nowrap>
<img src="avatars/<? print($user["avatar"]); ?>" width="160" height="160" class='largeavatar'><br>
</td>
</tr>
</table>
</td>
</tr>
</table>
<? if (count($comments)>0): ?>
<br />
<table width="75%" bgcolor="#000000" cellspacing="1" cellpadding="0" border="0">
<tr>
<td>
<table bgcolor="#000000" cellspacing="1" cellpadding="2" border="0" width="100%">
<? for($i=0;$i<count($comments);$i++): ?>
<? $trcolor=($i%2)?"#446688":"#557799"; ?>
<tr bgcolor="#224488">
<td colspan="2">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td valign="top" nowrap>
<? $platformss = explode(",", $comments[$i]["platform"]);
for($kkk=0;$kkk<count($platformss);$kkk++) { ?><a href="prodlist.php?platform=<? print($platformss[$kkk]); ?>"><img src="gfx/os/<? print($os[$platformss[$kkk]]); ?>" width="16" height="16" border="0" title="<? print($platformss[$kkk]); ?>" alt="<? print($platformss[$kkk]); ?>"></a><? } ?><br />
</td>
<td valign="top"> </td>
<td valign="top" nowrap>
<? $typess = explode(",", $comments[$i]["type"]);
for($kkk=0;$kkk<count($typess);$kkk++) { ?><a href="prodlist.php?type=<? print($typess[$kkk]); ?>"><img src="gfx/types/<? print($types[$typess[$kkk]]); ?>" width="16" height="16" border="0" title="<? print($typess[$kkk]); ?>" alt="<? print($typess[$kkk]); ?>"></a><? } ?><br />
</td>
<td valign="top"> </td>
<td width="100%" valign="top">
<a href="prod.php?which=<? print($comments[$i]["id"]); ?>">
<? print(stripslashes($comments[$i]["name"])); ?></a>
<?
if ($comments[$i]["groupn1"]) print(" by <a href=\"groups.php?which=".stripslashes($comments[$i]["group1"])."\">".stripslashes($comments[$i]["groupn1"])."</a>");
if ($comments[$i]["groupn2"]) print(" :: <a href=\"groups.php?which=".stripslashes($comments[$i]["group2"])."\">".stripslashes($comments[$i]["groupn2"])."</a>");
if ($comments[$i]["groupn3"]) print(" :: <a href=\"groups.php?which=".stripslashes($comments[$i]["group3"])."\">".stripslashes($comments[$i]["groupn3"])."</a>");
?><br />
</td>
</tr>
</table>
</td>
</tr>
<tr bgcolor="#446688"><td align="left" colspan="6"><? print(parse_message($comments[$i]["comment"])); ?></td></tr>
<tr bgcolor="#557799">
<td colspan="2">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td valign="top" nowrap>
<?
switch((int)($comments[$i]["rating"]))
{
case 1: print("<img src=\"gfx/rulez.gif\">");
break;
case -1: print("<img src=\"gfx/sucks.gif\">");
break;
default: print("<img src=\"gfx/isok.gif\">");
}
?>
<? for($ii=0;$ii<count($cdc);$ii++){
//print("->".$comments[$i]["id"]."<->".$cdc[$ii]."|");
if ($cdc[$ii]["id"]==$comments[$i]["id"]) print("<img src=\"gfx/titles/coupdecoeur.gif\">");
}
?>
</td>
<td valign="top"> </td>
<td width="100%" valign="top"></td>
<td align="right" valign="top" nowrap>
<? print("added on the ".substr($comments[$i]["quand"],0,10)); ?><br />
</td>
</tr>
</table>
</td>
</tr>
<tr><td></td></tr>
<? endfor; ?>
<? $passedlink="demoblog.php?who=".$who;
if ($com) $passedlink.="&com=".$com;
if ($nothumbsup) $passedlink.="&nothumbsup=".$nothumbsup;
if ($nopiggies) $passedlink.="&nopiggies=".$nopiggies;
if ($nothumbsdown) $passedlink.="&nothumbsdown=".$nothumbsdown; ?>
<tr bgcolor="#224488">
<td>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<? if($page>=2): ?>
<td>
<a href="<? print($passedlink."&page=".($page-1)) ?>">
<img src="gfx/flecheg.gif" border="0"><br />
</a>
</td>
<td> </td>
<td nowrap>
<a href="<? print($passedlink."&page=".($page-1)) ?>">
<b>previous page</b><br />
</a>
</td>
<? endif; ?>
<form action="demoblog.php">
<input type="hidden" name="who" value="<? print($who); ?>">
<input type="hidden" name="com" value="<? print($com); ?>">
<input type="hidden" name="nothumbsup" value="<? print($nothumbsup); ?>">
<input type="hidden" name="nopiggies" value="<? print($nopiggies); ?>">
<input type="hidden" name="nothumbsdown" value="<? print($nothumbsdown); ?>">
<td width="50%" align="right">
<select name="page">
<? for($i=1;$i<=round($nbmsg/$linebypage);$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<round($nbmsg/$linebypage)): ?>
<td nowrap>
<a href="<? print($passedlink."&page=".($page+1)) ?>">
<b>next page</b><br />
</a>
</td>
<td> </td>
<td>
<a href="<? print($passedlink."&page=".($page+1)) ?>">
<img src="gfx/fleched.gif" border="0"><br />
</a>
</td>
<? endif; ?>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<? endif; ?>
<? else: ?>
<center><? print("aiiiiiiiiii cookiiieee\n la cuenta de este utilizador ha sido comida de una langosta ciega guapa<br />*clicki clicki clacki* (\/) - - (\/) *clacki clacki clicki*<br />ciega ciega ciega frikki!!"); ?></center>
<? endif; ?>
<br />
<?
$user["bottombar"]=$usercustom["bottombar"];
require("include/bottom.php"); ?>