-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgames.php
More file actions
599 lines (545 loc) · 23.7 KB
/
games.php
File metadata and controls
599 lines (545 loc) · 23.7 KB
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
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
<?php
/***************************************************************************
* games.php
* -------------------
* commencé le : Samedi,17 Mai, 2003
* Par : giefca - http://www.gf-phpbb.com
*
***************************************************************************/
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include( $phpbb_root_path . 'includes/functions_arcade.' . $phpEx);
include_once($phpbb_root_path . 'includes/arca_bbcode.'.$phpEx);
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_GAME);
init_userprefs($userdata);
//
// End session management
//
// Start auth check
//
if ( !$userdata['session_logged_in'] )
{
$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
header($header_location . append_sid("login.$phpEx?redirect=arcade.$phpEx", true));
exit;
}
//
// End of auth check
//
$arcade_config = array();
$arcade_config = read_arcade_config();
//début arcade favori
include_once($phpbb_root_path . 'arcade_favoris.'.$phpEx);
//fin arcade favori
# Censure
$orig_word = array();
$replacement_word = array();
obtain_word_list($orig_word, $replacement_word);
if($arcade_config['limit_by_posts'] && $userdata['user_level'] != ADMIN){
$secs = 86400;
$uid = $userdata['user_id'];
$days = $arcade_config['days_limit'];
$posts = $arcade_config['posts_needed'];
$current_time = time();
$old_time = $current_time - ($secs * $days);
if($arcade_config['limit_type']=='posts')
{
$sql = "SELECT * FROM " . POSTS_TABLE . " WHERE poster_id = $uid";
}
else
{
$sql = "SELECT * FROM " . POSTS_TABLE . " WHERE poster_id = $uid and post_time BETWEEN $old_time AND $current_time";
}
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain forums information', '', __LINE__, __FILE__, $sql);
}
$Amount_Of_Posts = $db->sql_numrows( $result );
if($Amount_Of_Posts < $posts)
{
$diff_posts = $posts - $Amount_Of_Posts;
if($arcade_config['limit_type']=='posts')
{
$message = "Vous avez besoin de $posts postes pour jouer l'arcade. < Br / > Vous avez encore besoin $diff_posts de plus de postes.";
}
else {
$message = "Vous avez besoin $posts postes en $days jours pour jouer l'arcade .<br/>il vous reste a postez $diff_posts poste pour jouer.";
}
message_die(GENERAL_MESSAGE, $message);
}
}
// Start addon points arcade
if ($arcade_config['use_points_mod'] && $arcade_config['use_points_pay_mod'])
{
$nbpoint = $userdata['user_points'];
$cost = $arcade_config['points_pay'];
if($nbpoint<$cost)
{
$page_title = $lang['arcade_game'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$message .='<br /><br /><table width="100%" cellpadding="3" cellspacing="1" border="0" class="forumline"><tr><td class="catHead" align="center" height="28"><span class="cattitle">Information</span></td></tr><tr><td class="row1" align="center"><span class="gen">'.sprintf($lang['Sorry_Arcade_Pay'], $arcade_config['points_pay'], $board_config['points_name']) . "<br /><br />" . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>').'</span></td></tr></table><br /><br />';
echo $message;
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
}
else
{
if (!empty($HTTP_POST_VARS['gid']) || !empty($HTTP_GET_VARS['gid']))
{
$gid = (!empty($HTTP_POST_VARS['gid'])) ? intval($HTTP_POST_VARS['gid']) : intval($HTTP_GET_VARS['gid']);
}
else
{
message_die(GENERAL_ERROR, "Aucun jeu n'est précisé");
}
$sql = "SELECT g.* , MAX(s.score_game) as highscore FROM " . GAMES_TABLE . " g left join " . SCORES_TABLE . " s on g.game_id = s.game_id WHERE g.game_id = $gid GROUP BY g.game_id,g.game_highscore" ;
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Impossible d'acceder à la tables des jeux", '', __LINE__, __FILE__, $sql);
}
if ( !( $row = $db->sql_fetchrow($result) ) )
{
message_die(GENERAL_ERROR, "Ce jeu n'existe pas", '', __LINE__, __FILE__, $sql);
}
$liste_cat_auth_play = get_arcade_categories($userdata['user_id'], $userdata['user_level'],'play');
$tbauth_play = array();
$tbauth_play = explode(',',$liste_cat_auth_play);
if( !in_array($row['arcade_catid'],$tbauth_play))
{
message_die(GENERAL_MESSAGE, $lang['game_forbidden']);
}
//chargement du template
$template->set_filenames(array(
'body' => 'games_body.tpl')
);
$sql = "DELETE FROM " . GAMEHASH_TABLE . " WHERE hash_date < " . (time() - 72000 ) ;
if( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Impossible de mettre à jour la table des hash game", '', __LINE__, __FILE__, $sql);
}
/* Le nombre de parties jouées ne sera mis à jour qu'après avoir soumis un score
$sql = "UPDATE " . GAMES_TABLE . " SET game_set = game_set+1 WHERE game_id = $gid";
if( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Impossible de mettre à jour la table des jeux", '', __LINE__, __FILE__, $sql);
}*/
if ( $row['game_type'] == 3 )
{
// Jeu type V2
$type_v2 = true ;
$template->assign_block_vars('game_type_V2',array());
$gamehash_id = md5(uniqid($user_ip)) ;
$sql = "INSERT INTO " . GAMEHASH_TABLE . " ( gamehash_id , game_id , user_id , hash_date ) VALUES ( '$gamehash_id' , '$gid' , '" . $userdata['user_id'] . "' , '" . time() . "')" ;
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Impossible de mettre à jour la table des hash game", '', __LINE__, __FILE__, $sql);
}
}
elseif ($row['game_type'] == 4)
{
$template->assign_block_vars('game_type_V2',array());
setcookie('gidstarted', '', time() - 3600);
setcookie('gidstarted',$gid);
setcookie('timestarted', '', time() - 3600);
setcookie('timestarted', time());
$gamehash_id = md5($user_ip);
$sql = "INSERT INTO " . GAMEHASH_TABLE . " (gamehash_id , game_id , user_id , hash_date) VALUES ('$gamehash_id' , '$gid' , '" . $userdata['user_id'] . "' , '" . time() . "')";
if (!($result = $db->sql_query($sql)))
{
//message_die(GENERAL_ERROR, "Couldn't update hashtable", '', __LINE__, __FILE__, $sql);
}
$sql = "UPDATE " . GAMES_TABLE . " SET game_set = game_set+1 WHERE game_id = '$gid'";
$db->sql_query($sql) ;
}
else
{
// Jeu type V1
$type_v2 = false ;
$template->assign_block_vars('game_type_V1',array());
$gamehash_id = md5(uniqid($user_ip)) ;
$sql = "INSERT INTO " . GAMEHASH_TABLE . " ( gamehash_id , game_id , user_id , hash_date ) VALUES ( '$gamehash_id' , '$gid' , '" . $userdata['user_id'] . "' , '" . time() . "')" ;
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Impossible de mettre à jour la table des hash game", '', __LINE__, __FILE__, $sql);
}
$sql = "UPDATE " . GAMES_TABLE . " SET game_set = game_set+1 WHERE game_id = '$gid'";
$db->sql_query($sql) ;
}
$scriptpath = substr($board_config['script_path'] , strlen( $board_config['script_path'] ) - 1 , 1 ) == '/' ? substr( $board_config['script_path'] , 0 , strlen( $board_config['script_path'] ) - 1 ) : $board_config['script_path'] ;
$scriptpath = "http://" . $board_config['server_name'] .$scriptpath ;
//début arcade favori
if($arcade_config['use_fav_category'])
{
$sql = "SELECT COUNT(*) AS nbfav from ".ARCADE_FAV_TABLE." where user_id= ".$userdata['user_id']." and game_id= ".$row['game_id'];
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Impossible d'accéder à la tables des favoris", '', __LINE__, __FILE__, $sql);
}
$rowf = $db->sql_fetchrow($result);
$nbfav = $rowf['nbfav'];
}
//fin arcade favori
$template->assign_vars(array(
'U_URL' => append_sid("" ),
'MAXSIZE_AVATAR' => intval($arcade_config['maxsize_avatar']),
'SWF_GAME' => $row['game_swf'] ,
'GAME_WIDTH' => $row['game_width'] ,
'GAME_HEIGHT' => $row['game_height'] ,
'L_GAME' => $row['game_name'] ,
'GID' => $gid ,
'UIP' => $user_ip ,
'BBTITLE' => str_replace('"','',$board_config['sitename']),
'SCRIPT_PATH' => $scriptpath ,
'SID' => ( $sid != '' ) ? "&sid=$sid" : "",
'GAMEHASH' => $gamehash_id,
'USER_NAME' => $userdata['username'],
'L_TOP' => $lang['best_scores'] ,
'HIGHSCORE' => $row['highscore'],
'SETTIME' => time(),
'NAV_DESC' => '><a class="nav" href="' . append_sid("arcade.$phpEx") . '">Arcade</a> ' ,
'URL_ARCADE' => '<nobr><a class="cattitle" href="' . append_sid("arcade.$phpEx") . '">' . $lang['lib_arcade'] . '</a></nobr> ',
'URL_BESTSCORES' => '<nobr><a class="cattitle" href="' . append_sid("toparcade.$phpEx") . '">' . $lang['best_scores'] . '</a></nobr> ',
//début arcade favori
'ADD_FAV' => ($arcade_config['use_fav_category'] and !$nbfav)?'<tr><td align="center" nowrap="nowrap" class="catHead"><span class="cattitle"><a href="' . append_sid("arcade.$phpEx?favori=" . $row['game_id'] ) .'" class="nav"><img src="' . append_sid("images/favs.gif").'" border=0 alt="'.$lang['add_fav'].'"> '.$lang['add_fav'].'</a></td></tr>':'',
//fin arcade favoris
'MANAGE_COMMENTS' => '<nobr><a class="cattitle" href="' . append_sid("comments_list.$phpEx") . '">' . $lang['comments'] . '</a></nobr> ',
'URL_SCOREBOARD' => '<nobr><a class="cattitle" href="' . append_sid("scoreboard.$phpEx?gid=$gid") . '">' . $lang['scoreboard'] . '</a></nobr> ')
);
//Les meilleurs scores
$sql = "SELECT s.* , u.username, u.user_avatar_type, u.user_allowavatar, u.user_avatar FROM " . SCORES_TABLE . " s left join " . USERS_TABLE . " u on s.user_id = u.user_id WHERE game_id = $gid ORDER BY s.score_game DESC, s.score_date ASC LIMIT 0,15 " ;
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Impossible d\acceder à la tables des jeux", '', __LINE__, __FILE__, $sql);
}
# Addon arcade by Oyo & JRSweets
$sql ='SELECT * FROM ' . COMMENTS_TABLE . ' WHERE game_id = '.$gid;
if( !($result_comment = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Error retrieving comment from comment table', '', __LINE__, __FILE__, $sql);
}
$row_comment = $db->sql_fetchrow($result_comment);
# Saut de ligne
$comment= str_replace("\n", "\n<br />\n", $row_comment['message']);
if( $comment)
{
# Smilies
if ( $board_config['allow_smilies'] )
{
$comment = smilies_pass2($comment);
}
# BBcode (fonction annexe créer par le fichier arca_bbcode.php)
$comment = bbencode_pass($comment);
# Evite les déformation
$comment = wordwrap($comment, 78, "\n", 1);
# Censure
if (count($orig_word))
{
$comment = str_replace('\"', '"', substr(preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $comment . '<'), 1, -1));
}
$comment = '<img src="templates/' . $theme['template_name'] . '/images/couronne.gif" align="absmiddle"> ' .$comment .'';
}
# Addon arcade by Oyo & JRSweets
$pos = 0 ;
$posreelle = 0;
$lastscore = 0;
while ( $row = $db->sql_fetchrow($result) )
{
$posreelle++ ;
if ( $posreelle == 1)
{
$user_avatar_type = $row['user_avatar_type'];
$user_allowavatar = $row['user_allowavatar'];
$user_avatar = $row['user_avatar'];
$best_user = $row['username'];
}
if ($lastscore!=$row['score_game'])$pos = $posreelle ;
$lastscore = $row['score_game'] ;
$template->assign_block_vars('scorerow', array(
'POS' => $pos ,
'USERNAME' => $row['username'] ,
'URL_STATS' => '<nobr><a class="cattitle" href="' . append_sid("statarcade.$phpEx?uid=" . $row['user_id'] ) . '">' . "<img src='templates/" . $theme['template_name'] . "/images/loupe.gif' align='absmiddle' border='0' alt='" . $lang['statuser'] . " " . $row['username'] . "'>" . '</a></nobr> ',
'GAMEDESC' => $row['game_desc'],
'SCORE' => $row['score_game'],
'DATEHIGH' => create_date( $board_config['default_dateformat'] , $row['score_date'] , $board_config['board_timezone'] )
));
}
$avatar_img = '';
if ( $user_avatar_type && $user_allowavatar )
{
switch( $user_avatar_type )
{
case USER_AVATAR_UPLOAD:
$avatar_img = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $user_avatar . '" alt="" border="0" hspace="20" align="center" valign="center" onload="resize_avatar(this)"/>' : '';
break;
case USER_AVATAR_REMOTE:
$avatar_img = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $user_avatar . '" alt="" border="0" hspace="20" align="center" valign="center" onload="resize_avatar(this)"/>' : '';
break;
case USER_AVATAR_GALLERY:
$avatar_img = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $user_avatar . '" alt="" border="0" hspace="20" align="center" valign="center" onload="resize_avatar(this)"/>' : '';
break;
}
}
IF ( empty($avatar_img) )
{
$avatar_img = '<img src="images/noavatar.gif" alt="Aucun Avatar" border="0" />';
}
if ($arcade_config['display_winner_avatar'])
{
if ($arcade_config['winner_avatar_position']=='right')
{
$template->assign_block_vars('avatar_best_player_right',array());
}
else
{
$template->assign_block_vars('avatar_best_player_left',array());
}
$template->assign_vars(array(
'L_ACTUAL_WINNER' => $lang['Actual_winner'],
'BEST_USER_NAME' => $best_user,
'COMMENTS' => $comment,
'FIRST_AVATAR' => $avatar_img)
);
}
if ($arcade_config['use_points_pay_charging'])
{
$nbpoint = $nbpoint-$cost;
$sql = "update " . USERS_TABLE . " set user_points = $nbpoint where user_id = " . $userdata['user_id'] ;
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Impossible de modifier les points du joueur.", '', __LINE__, __FILE__, $sql);
}
}
include($phpbb_root_path . 'whoisplaying.'.$phpEx);
include($phpbb_root_path . 'headingarcade.'.$phpEx);
include($phpbb_root_path . 'championnatarcade.'.$phpEx);
//
// Output page header
$page_title = $lang['arcade_game'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
include($phpbb_root_path . 'championnatarcade.'.$phpEx);
}
}
else
{
// End addon points arcade
if (!empty($HTTP_POST_VARS['gid']) || !empty($HTTP_GET_VARS['gid']))
{
$gid = (!empty($HTTP_POST_VARS['gid'])) ? intval($HTTP_POST_VARS['gid']) : intval($HTTP_GET_VARS['gid']);
}
else
{
message_die(GENERAL_ERROR, "Aucun jeu n'est précisé");
}
$sql = "SELECT g.* , MAX(s.score_game) as highscore FROM " . GAMES_TABLE . " g left join " . SCORES_TABLE . " s on g.game_id = s.game_id WHERE g.game_id = $gid GROUP BY g.game_id,g.game_highscore" ;
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Impossible d'acceder à la tables des jeux", '', __LINE__, __FILE__, $sql);
}
if ( !( $row = $db->sql_fetchrow($result) ) )
{
message_die(GENERAL_ERROR, "Ce jeu n'existe pas", '', __LINE__, __FILE__, $sql);
}
$liste_cat_auth_play = get_arcade_categories($userdata['user_id'], $userdata['user_level'],'play');
$tbauth_play = array();
$tbauth_play = explode(',',$liste_cat_auth_play);
if( !in_array($row['arcade_catid'],$tbauth_play))
{
message_die(GENERAL_MESSAGE, $lang['game_forbidden']);
}
//chargement du template
$template->set_filenames(array(
'body' => 'games_body.tpl')
);
$sql = "DELETE FROM " . GAMEHASH_TABLE . " WHERE hash_date < " . (time() - 72000 ) ;
if( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Impossible de mettre à jour la table des hash game", '', __LINE__, __FILE__, $sql);
}
/* Le nombre de parties jouées ne sera mis à jour qu'après avoir soumis un score
$sql = "UPDATE " . GAMES_TABLE . " SET game_set = game_set+1 WHERE game_id = $gid";
if( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Impossible de mettre à jour la table des jeux", '', __LINE__, __FILE__, $sql);
}*/
if ( $row['game_type'] == 3 )
{
// Jeu type V2
$type_v2 = true ;
$template->assign_block_vars('game_type_V2',array());
$gamehash_id = md5(uniqid($user_ip)) ;
$sql = "INSERT INTO " . GAMEHASH_TABLE . " ( gamehash_id , game_id , user_id , hash_date ) VALUES ( '$gamehash_id' , '$gid' , '" . $userdata['user_id'] . "' , '" . time() . "')" ;
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Impossible de mettre à jour la table des hash game", '', __LINE__, __FILE__, $sql);
}
}
elseif ($row['game_type'] == 4)
{
$template->assign_block_vars('game_type_V2',array());
setcookie('gidstarted', '', time() - 3600);
setcookie('gidstarted',$gid);
setcookie('timestarted', '', time() - 3600);
setcookie('timestarted', time());
$gamehash_id = md5($user_ip);
$sql = "INSERT INTO " . GAMEHASH_TABLE . " (gamehash_id , game_id , user_id , hash_date) VALUES ('$gamehash_id' , '$gid' , '" . $userdata['user_id'] . "' , '" . time() . "')";
if (!($result = $db->sql_query($sql)))
{
//message_die(GENERAL_ERROR, "Couldn't update hashtable", '', __LINE__, __FILE__, $sql);
}
$sql = "UPDATE " . GAMES_TABLE . " SET game_set = game_set+1 WHERE game_id = '$gid'";
$db->sql_query($sql) ;
}
else
{
// Jeu type V1
$type_v2 = false ;
$template->assign_block_vars('game_type_V1',array());
$gamehash_id = md5(uniqid($user_ip)) ;
$sql = "INSERT INTO " . GAMEHASH_TABLE . " ( gamehash_id , game_id , user_id , hash_date ) VALUES ( '$gamehash_id' , '$gid' , '" . $userdata['user_id'] . "' , '" . time() . "')" ;
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Impossible de mettre à jour la table des hash game", '', __LINE__, __FILE__, $sql);
}
$sql = "UPDATE " . GAMES_TABLE . " SET game_set = game_set+1 WHERE game_id = '$gid'";
$db->sql_query($sql) ;
}
$scriptpath = substr($board_config['script_path'] , strlen( $board_config['script_path'] ) - 1 , 1 ) == '/' ? substr( $board_config['script_path'] , 0 , strlen( $board_config['script_path'] ) - 1 ) : $board_config['script_path'] ;
$scriptpath = "http://" . $board_config['server_name'] .$scriptpath ;
$template->assign_vars(array(
'U_URL' => append_sid("" ),
'MAXSIZE_AVATAR' => intval($arcade_config['maxsize_avatar']),
'SWF_GAME' => $row['game_swf'] ,
'GAME_WIDTH' => $row['game_width'] ,
'GAME_HEIGHT' => $row['game_height'] ,
'L_GAME' => $row['game_name'] ,
'GID' => $gid ,
'UIP' => $user_ip ,
'BBTITLE' => str_replace('"','',$board_config['sitename']),
'SCRIPT_PATH' => $scriptpath ,
'SID' => ( $sid != '' ) ? "&sid=$sid" : "",
'GAMEHASH' => $gamehash_id,
'USER_NAME' => $userdata['username'],
'L_TOP' => $lang['best_scores'] ,
'HIGHSCORE' => $row['highscore'],
'SETTIME' => time(),
'URL_STATS' => '<a class="genmed" href="' . append_sid("statarcade.$phpEx?uid=" . $userdata['user_id'] ) . '">' . $lang['statuser'] . '</a> ',
'NAV_DESC' => '><a class="nav" href="' . append_sid("arcade.$phpEx") . '">Arcade</a> ' ,
'URL_ARCADE' => '<nobr><a class="cattitle" href="' . append_sid("arcade.$phpEx") . '">' . $lang['lib_arcade'] . '</a></nobr> ',
'URL_BESTSCORES' => '<nobr><a class="cattitle" href="' . append_sid("toparcade.$phpEx") . '">' . $lang['best_scores'] . '</a></nobr> ',
'MANAGE_COMMENTS' => '<nobr><a class="cattitle" href="' . append_sid("comments_list.$phpEx") . '">' . $lang['comments'] . '</a></nobr> ',
'URL_SCOREBOARD' => '<nobr><a class="cattitle" href="' . append_sid("scoreboard.$phpEx?gid=$gid") . '">' . $lang['scoreboard'] . '</a></nobr> ')
);
//Les meilleurs scores
$sql = "SELECT s.* , u.username, u.user_avatar_type, u.user_allowavatar, u.user_avatar FROM " . SCORES_TABLE . " s left join " . USERS_TABLE . " u on s.user_id = u.user_id WHERE game_id = $gid ORDER BY s.score_game DESC, s.score_date ASC LIMIT 0,15 " ;
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Impossible d\acceder à la tables des jeux", '', __LINE__, __FILE__, $sql);
}
# Addon arcade by Oyo & JRSweets
$sql ='SELECT * FROM ' . COMMENTS_TABLE . ' WHERE game_id = '.$gid;
if( !($result_comment = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Error retrieving comment from comment table', '', __LINE__, __FILE__, $sql);
}
$row_comment = $db->sql_fetchrow($result_comment);
# Saut de ligne
$comment= str_replace("\n", "\n<br />\n", $row_comment['message']);
if( $comment)
{
# Smilies
if ( $board_config['allow_smilies'] )
{
$comment = smilies_pass2($comment);
}
# BBcode (fonction annexe créer par le fichier arca_bbcode.php)
$comment = bbencode_pass($comment);
# Evite les déformation
$comment = wordwrap($comment, 78, "\n", 1);
# Censure
if (count($orig_word))
{
$comment = str_replace('\"', '"', substr(preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $comment . '<'), 1, -1));
}
$comment = '<img src="templates/' . $theme['template_name'] . '/images/couronne.gif" align="absmiddle"> ' .$comment .'';
}
# Addon arcade by Oyo & JRSweets
$pos = 0 ;
$posreelle = 0;
$lastscore = 0;
while ( $row = $db->sql_fetchrow($result) )
{
$posreelle++ ;
if ( $posreelle == 1)
{
$user_avatar_type = $row['user_avatar_type'];
$user_allowavatar = $row['user_allowavatar'];
$user_avatar = $row['user_avatar'];
$best_user = $row['username'];
}
if ($lastscore!=$row['score_game'])$pos = $posreelle ;
$lastscore = $row['score_game'] ;
$template->assign_block_vars('scorerow', array(
'POS' => $pos ,
'USERNAME' => $row['username'] ,
'URL_STATS' => '<nobr><a class="cattitle" href="' . append_sid("statarcade.$phpEx?uid=" . $row['user_id'] ) . '">' . "<img src='templates/" . $theme['template_name'] . "/images/loupe.gif' align='absmiddle' border='0' alt='" . $lang['statuser'] . " " . $row['username'] . "'>" . '</a></nobr> ',
'GAMEDESC' => $row['game_desc'],
'SCORE' => $row['score_game'],
'DATEHIGH' => create_date( $board_config['default_dateformat'] , $row['score_date'] , $board_config['board_timezone'] )
));
}
$avatar_img = '';
if ( $user_avatar_type && $user_allowavatar )
{
switch( $user_avatar_type )
{
case USER_AVATAR_UPLOAD:
$avatar_img = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $user_avatar . '" alt="" border="0" hspace="20" align="center" valign="center" onload="resize_avatar(this)"/>' : '';
break;
case USER_AVATAR_REMOTE:
$avatar_img = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $user_avatar . '" alt="" border="0" hspace="20" align="center" valign="center" onload="resize_avatar(this)"/>' : '';
break;
case USER_AVATAR_GALLERY:
$avatar_img = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $user_avatar . '" alt="" border="0" hspace="20" align="center" valign="center" onload="resize_avatar(this)"/>' : '';
break;
}
}
IF ( empty($avatar_img) )
{
$avatar_img = '<img src="images/noavatar.gif" alt="Aucun Avatar" border="0" />';
}
if ($arcade_config['display_winner_avatar'])
{
if ($arcade_config['winner_avatar_position']=='right')
{
$template->assign_block_vars('avatar_best_player_right',array());
}
else
{
$template->assign_block_vars('avatar_best_player_left',array());
}
$template->assign_vars(array(
'L_ACTUAL_WINNER' => $lang['Actual_winner'],
'BEST_USER_NAME' => $best_user,
'COMMENTS' => $comment,
'FIRST_AVATAR' => $avatar_img)
);
}
include($phpbb_root_path . 'whoisplaying.'.$phpEx);
include($phpbb_root_path . 'championnatarcade.'.$phpEx);
//
// Output page header
$page_title = $lang['arcade_game'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
include($phpbb_root_path . 'championnatarcade.'.$phpEx);
// Start addon points arcade
}
// End addon points arcade
?>