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 = "You need $posts posts to play the arcade.
You need $diff_posts more posts."; } else { $message = "You need $posts posts in the last $days days to play the arcade.
You need $diff_posts more posts."; } message_die(GENERAL_MESSAGE, $message); } } //End Limit Play mod 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, "No game is specified"); } $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, "Could not read games table", '', __LINE__, __FILE__, $sql); } if (!($row = $db->sql_fetchrow($result)) ) { message_die(GENERAL_ERROR, "This game does not exist", '', __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']); } $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, "Could not delete from game hash table", '', __LINE__, __FILE__, $sql); } // Type V2 Game Else Type V1 if ($row['game_type'] == 3) { $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, "Could not delete from game hash table", '', __LINE__, __FILE__, $sql); } } elseif ($row['game_type'] == 4 or $row['game_type'] == 5) { if ($row['game_type'] == 5) { $template->assign_block_vars('game_type_V5',array()); } else { $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); } } else { message_die(GENERAL_ERROR, "Game Type no longer supported, please contact the admin and have him/her delete it."); } setcookie('arcadepopup', '', time() - 3600); setcookie('arcadepopup', '0'); $sql = "SELECT arcade_cattitle FROM " . ARCADE_CATEGORIES_TABLE . " WHERE arcade_catid = " . $row['arcade_catid']; $result = $db->sql_query($sql); $ourrow = $db->sql_fetchrow($result); $cat_title = $ourrow['arcade_cattitle']; $template->assign_vars(array( 'MAXSIZE_AVATAR' => intval($arcade_config['maxsize_avatar']), 'CAT_TITLE' => '' . $cat_title . ' ' , 'NAV_DESC' => '' . $lang['arcade'] . ' ' , 'SWF_GAME' => $row['game_swf'] , 'GAME_WIDTH' => $row['game_width'] , 'GAME_HEIGHT' => $row['game_height'] , 'L_GAME' => $row['game_name'] , 'GAMEHASH' => $gamehash_id, 'L_TOP' => $lang['best_scores_game'] , 'HIGHSCORE' => number_format($row['highscore']), 'URL_ARCADE' => '' . $lang['lib_arcade'] . ' ', 'MANAGE_COMMENTS' => '' . $lang['comments'] . ' ', 'URL_BESTSCORES' => '' . $lang['best_scores'] . ' ', 'URL_SCOREBOARD' => '' . $lang['scoreboard'] . ' ') ); $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, "Could not read from scores table", '', __LINE__, __FILE__, $sql); } $sql = "SELECT comments_value 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); // // Define censored word matches // $orig_word = array(); $replacement_word = array(); obtain_word_list($orig_word, $replacement_word); if($row_comment['comments_value'] != '') { if ( count($orig_word) ) { $row_comment['comments_value'] = preg_replace($orig_word, $replacement_word, $row_comment['comments_value']); } $comment = '' .$row_comment['comments_value'] .''; } else { $comment=''; } $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']; $best_date = create_date( $board_config['default_dateformat'] , $row['score_date'] , $board_config['board_timezone'] ); $games_played = $row['score_set']; $best_time = sec2hms($row['score_time']); } if ($lastscore!=$row['score_game']) { $pos = $posreelle; } $lastscore = $row['score_game']; $template->assign_block_vars('scorerow', array( 'POS' => $pos , 'USERNAME' => $row['username'], 'URL_STATS' => '' . "" . $lang[" . ' ', 'GAMEDESC' => $row['game_desc'], 'SCORE' => number_format($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']) ? '' : ''; break; case USER_AVATAR_REMOTE: $avatar_img = ($board_config['allow_avatar_remote']) ? '' : ''; break; case USER_AVATAR_GALLERY: $avatar_img = ($board_config['allow_avatar_local']) ? '' : ''; break; } } 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, 'BEST_USER_DATE' => sprintf($lang['hi_score_on'], $best_date), 'BEST_TIME' => sprintf($lang['played_time_total'], $best_time), 'COMMENTS' => smilies_pass($comment), 'GAMES_PLAYED' => sprintf($lang['played_times'], $games_played), 'FIRST_AVATAR' => $avatar_img) ); } include($phpbb_root_path . 'whoisplaying.'.$phpEx); // Arcade Rate Hack by Rica - START $template->assign_block_vars('ratemod',array()); $sql="SELECT count(*) as numberrate,SUM(rate) as sumrate FROM ".$prefix."_bbgames_rate WHERE game_id=$gid"; $result=$db->sql_query($sql) or die("Cannot read games rating table"); $row=$db->sql_fetchrow($result) ; $template->assign_vars(array( 'NUMBERRATINGS' => $row["numberrate"], 'RATERESULT' => $row["numberrate"]>0?number_format($row["sumrate"]/$row["numberrate"],2):"-", 'U_RATEGAME'=>append_sid("arcade_rate"), 'GID'=>$gid ) ); // Arcade Rate Hack by Rica - END // // Output page header $page_title = $lang['arcade_game']; include('includes/page_header.'.$phpEx); $template->pparse('body'); include('includes/page_tail.'.$phpEx); ?>