set_filenames(array( 'body' => 'toparcade_body.tpl') ); $template->assign_vars(array( 'L_TOPARCADE_FIVE' => $lang['toparcade_five'], 'L_ARCADE' => $lang['toparcade_players'], 'NAV_DESC' => '' . $lang['arcade'] . ' ' ) ); $nbcol = 3; $games_par_page = 12; $liste_cat_auth = get_arcade_categories($userdata['user_id'], $userdata['user_level'],'view'); if ($liste_cat_auth == '') { $liste_cat_auth = "''"; } $sql = "SELECT COUNT(*) AS nbtot FROM " . GAMES_TABLE . " WHERE arcade_catid IN ($liste_cat_auth)"; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, "Could not read the games table", '', __LINE__, __FILE__, $sql); } if ($row=$db->sql_fetchrow($result)) { $total_games = $row['nbtot']; } else { $total_games = 0; } $start = get_var_gf(array('name'=>'start', 'intval'=>true)); $limit_sql = " LIMIT $start," . $games_par_page; $sql = "SELECT distinct game_id , game_name FROM " . GAMES_TABLE . " WHERE arcade_catid IN ($liste_cat_auth) ORDER BY game_name ASC $limit_sql"; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, "Could not read the games table", '', __LINE__, __FILE__, $sql); } $fini = false; if (!$row = $db->sql_fetchrow($result)) { $fini=true; } while ((!$fini) ) { $template->assign_block_vars('blkligne', array()); for ($cg = 1; $cg <= $nbcol; $cg++) { $template->assign_block_vars('blkligne.blkcolonne', array()); if (!$fini) { $template->assign_block_vars('blkligne.blkcolonne.blkgame', array( 'GAMENAME' => '' . $row['game_name'] . ' ') ); $pos = 0; $posreelle = 0; $lastscore = 0; $sql2 = "SELECT s.* , u.username FROM " . SCORES_TABLE . " s left join " . USERS_TABLE . " u on u.user_id = s.user_id WHERE s.game_id = " . $row['game_id'] . " order by s.score_game DESC, s.score_date ASC LIMIT 0,5 "; if (!($result2 = $db->sql_query($sql2))) { message_die(GENERAL_ERROR, "Could not read from the scores/users tables", '', __LINE__, __FILE__, $sql); } while($row2 = $db->sql_fetchrow($result2)) { $posreelle++; if ($lastscore != $row2['score_game']) { $pos = $posreelle; } $lastscore = $row2['score_game']; $template->assign_block_vars('blkligne.blkcolonne.blkgame.blkscore', array( 'SCORE' => number_format($row2['score_game']), 'USERNAME' => $row2['username'], 'POS' => $pos) ); } if (!($row = $db->sql_fetchrow($result))) { $fini = true; } } } } $template->assign_vars(array( 'PAGINATION' => generate_pagination(append_sid("toparcade.$phpEx?uid=$uid"), $total_games, $games_par_page, $start), 'PAGE_NUMBER' => sprintf($lang['Page_of'], (floor($start / $games_par_page) + 1), ceil($total_games / $games_par_page))) ); include($phpbb_root_path . 'hall_of_fame.'.$phpEx); // // Output page header $page_title = $lang['toparcade']; include('includes/page_header.'.$phpEx); $template->pparse('body'); include('includes/page_tail.'.$phpEx); ?>