set_filenames(array(
'body' => 'arcade_body.tpl')
);
$template->assign_vars(array(
'URL_ARCADE' => '' . $lang['lib_arcade'] . ' ',
'URL_BESTSCORES' => '' . $lang['best_scores'] . ' ',
'URL_SCOREBOARD' => '' . $lang['scoreboard'] . ' ',
'MANAGE_COMMENTS' => '' . $lang['comments'] . ' ',
'CATTITLE' => 'Games I haven\'t played',
'NAV_DESC' => '' . $lang['arcade'] . ' ' ,
'L_GAME' => $lang['games'],
'ARCADE_COL' => ($arcade_config['use_fav_category'])? 6:5,
'ARCADE_COL1' => ($arcade_config['use_fav_category'])? 2:1,
'FAV' => $lang['fav'],
'L_HIGHSCORE' => $lang['highscore'],
'L_YOURSCORE' => $lang['yourbestscore'],
'L_DESC' => $lang['desc_game'],
'L_ARCADE' => $lang['lib_arcade'])
);
$sql = "SELECT g.*, u.username, u.user_id, s.score_game, s.score_date FROM " . GAMES_TABLE . " g left join " . USERS_TABLE . " u on g.game_highuser = u.user_id left join " . SCORES_TABLE . " s on s.game_id = g.game_id and s.user_id = " . $userdata['user_id'] . " ORDER BY $order_by";
if( !($result = $db->sql_query($sql)) ) {
message_die(GENERAL_ERROR, "Unable to retrieve game and score data", '', __LINE__, __FILE__, $sql);
}
$total_match_count = 0;
while( $row = $db->sql_fetchrow($result) ) {
//Displays on the games that you have no score/haven't played
if($row['score_game'] == 0)
{
$total_match_count++;
$template->assign_block_vars('gamerow', array(
'GAMENAME' => $row['game_name'],
'GAMEPIC' => ( $row['game_pic'] != '' ) ? "" : '' ,
'GAMESET' => ( $row['game_set'] != 0 ) ? $lang['game_actual_nbset'] . $row['game_set'] : '',
'GAMEDESC' => $row['game_desc'],
'HIGHSCORE' => number_format($row['game_highscore']),
'YOURHIGHSCORE' => number_format($row['score_game']),
'CLICKPLAY' => 'Click to Play!',
'NORECORD' => ( $row['game_highscore'] == 0 ) ? $lang['no_record'] : '',
'HIGHUSER' => ( $row['game_highuser'] != 0 ) ? '(' . $row['username'] . ')' : '' ,
'URL_SCOREBOARD' => '' . "" . ' ',
'GAMEID' => $row['game_id'],
'DATEHIGH' => "" . create_date( $board_config['default_dateformat'] , $row['game_highdate'] , $board_config['board_timezone'] ) . "",
'YOURDATEHIGH' => "" . create_date( $board_config['default_dateformat'] , $row['score_date'] , $board_config['board_timezone'] ) . "",
'IMGFIRST' => ( $row['game_highuser'] == $userdata['user_id'] ) ? " " : "" ,
'ADD_FAV' => ($arcade_config['use_fav_category'])?'
| ':'',
'GAMEPOPUPLINK' => "New Window",
'GAMELINK' => '' . $row['game_name'] . ' ' )
);
if ( $row['game_highscore'] !=0 ) {
$template->assign_block_vars('gamerow.recordrow',array());
}
if ( $row['score_game'] !=0 ) {
$template->assign_block_vars('gamerow.yourrecordrow',array());
}
else
{
$template->assign_block_vars('gamerow.playrecordrow',array()) ;
}
}
}
//Sets the number of total search results to be displayed.
$l_search_matches = ( $total_match_count == 1 ) ? sprintf($lang['Found_search_match'], $total_match_count) : sprintf($lang['Found_search_matches'], $total_match_count);
$template->assign_block_vars('arcade_search', array(
'L_SEARCH_MATCHES' => $l_search_matches));
//
// Output page header
include($phpbb_root_path . 'headingarcade.'.$phpEx);
include($phpbb_root_path . 'whoisplaying.'.$phpEx);
$page_title = $lang['arcade'];
include('includes/page_header.'.$phpEx);
$template->pparse('body');
include('includes/page_tail.'.$phpEx);
}
//Newest Games
if($x == 2)
{
//Reads your ACP Arcade settings...
$arcade_config = array();
$arcade_config = read_arcade_config();
//Total number of Newest Games to display
$total_match_count = 25;
$template->set_filenames(array(
'body' => 'arcade_body.tpl')
);
$template->assign_vars(array(
'URL_ARCADE' => '' . $lang['lib_arcade'] . ' ',
'URL_BESTSCORES' => '' . $lang['best_scores'] . ' ',
'URL_SCOREBOARD' => '' . $lang['scoreboard'] . ' ',
'MANAGE_COMMENTS' => '' . $lang['comments'] . ' ',
'CATTITLE' => $total_match_count. ' Newest Games',
'NAV_DESC' => '' . $lang['arcade'] . ' ' ,
'L_GAME' => $lang['games'],
'ARCADE_COL' => ($arcade_config['use_fav_category'])? 6:5,
'ARCADE_COL1' => ($arcade_config['use_fav_category'])? 2:1,
'FAV' => $lang['fav'],
'L_HIGHSCORE' => $lang['highscore'],
'L_YOURSCORE' => $lang['yourbestscore'],
'L_DESC' => $lang['desc_game'],
'L_ARCADE' => $lang['lib_arcade'])
);
$sql = "SELECT g.*, u.username, u.user_id, s.score_game, s.score_date FROM " . GAMES_TABLE . " g left join " . USERS_TABLE . " u on g.game_highuser = u.user_id left join " . SCORES_TABLE . " s on s.game_id = g.game_id and s.user_id = " . $userdata['user_id'] . " ORDER BY g.game_order DESC LIMIT 0,$total_match_count";
if( !($result = $db->sql_query($sql)) ) {
message_die(GENERAL_ERROR, "Unable to retrieve game and score data", '', __LINE__, __FILE__, $sql);
}
while( $row = $db->sql_fetchrow($result) ) {
//Displays on the games that you have no score/haven't played
$template->assign_block_vars('gamerow', array(
'GAMENAME' => $row['game_name'],
'GAMEPIC' => ( $row['game_pic'] != '' ) ? "" : '' ,
'GAMESET' => ( $row['game_set'] != 0 ) ? $lang['game_actual_nbset'] . $row['game_set'] : '',
'GAMEDESC' => $row['game_desc'],
'HIGHSCORE' => number_format($row['game_highscore']),
'YOURHIGHSCORE' => number_format($row['score_game']),
'CLICKPLAY' => 'Click to Play!',
'NORECORD' => ( $row['game_highscore'] == 0 ) ? $lang['no_record'] : '',
'HIGHUSER' => ( $row['game_highuser'] != 0 ) ? '(' . $row['username'] . ')' : '' ,
'URL_SCOREBOARD' => '' . "" . ' ',
'GAMEID' => $row['game_id'],
'DATEHIGH' => "" . create_date( $board_config['default_dateformat'] , $row['game_highdate'] , $board_config['board_timezone'] ) . "",
'YOURDATEHIGH' => "" . create_date( $board_config['default_dateformat'] , $row['score_date'] , $board_config['board_timezone'] ) . "",
'IMGFIRST' => ( $row['game_highuser'] == $userdata['user_id'] ) ? " " : "" ,
'ADD_FAV' => ($arcade_config['use_fav_category'])?' | ':'',
'GAMEPOPUPLINK' => "New Window",
'GAMELINK' => '' . $row['game_name'] . ' ' )
);
if ( $row['game_highscore'] !=0 ) {
$template->assign_block_vars('gamerow.recordrow',array());
}
if ( $row['score_game'] !=0 ) {
$template->assign_block_vars('gamerow.yourrecordrow',array());
}
else
{
$template->assign_block_vars('gamerow.playrecordrow',array()) ;
}
}
//Sets the number of total search results to be displayed.
$l_search_matches = ( $total_match_count == 1 ) ? sprintf($lang['Found_search_match'], $total_match_count) : sprintf($lang['Found_search_matches'], $total_match_count);
$template->assign_block_vars('arcade_search', array(
'L_SEARCH_MATCHES' => $l_search_matches));
//
// Output page header
include($phpbb_root_path . 'headingarcade.'.$phpEx);
include($phpbb_root_path . 'whoisplaying.'.$phpEx);
$page_title = $lang['arcade'];
include('includes/page_header.'.$phpEx);
$template->pparse('body');
include('includes/page_tail.'.$phpEx);
}
//Arcade Search is called
//Return Search string and format it.
$srchstring = $HTTP_POST_VARS['srchstring'];
$srchstring="*".$srchstring."*";
if (trim($srchstring) <> "**")
{
// replace wildcards */? to use with mysql "LIKE"
$search = str_replace("_", "\\_", $srchstring);
$search = str_replace("%", "\\%", $search);
$search = str_replace("*", "%" , $search);
$search = str_replace("?", "_" , $search);
}
//Sets search by game name or description
$searchin = $HTTP_POST_VARS['searchin'];
if($searchin == 'name')
{
$where_search= "WHERE game_name LIKE '$search'";
}
elseif($searchin == 'desc')
{
$where_search= "WHERE game_desc LIKE '$search'";
}
//Reads your ACP Arcade settings...
$arcade_config = array();
$arcade_config = read_arcade_config();
//Gets total games from you search results and set the number of total search results.
$sql = "SELECT COUNT(*) as total_games FROM " . GAMES_TABLE . " $where_search";
if( !($result = $db->sql_query($sql)) ) {
message_die(GENERAL_ERROR, "Impossible d\acceder à la tables des jeux", '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$total_match_count = $row['total_games'];
$l_search_matches = ( $total_match_count == 1 ) ? sprintf($lang['Found_search_match'], $total_match_count) : sprintf($lang['Found_search_matches'], $total_match_count);
//Sets the order by for the games based on you ACP settings
$order_by = '';
switch ( $arcade_config['game_order']) {
case 'Alpha':
$order_by = ' game_name ASC ';
break;
case 'Popular':
$order_by = ' game_set DESC ';
break;
case 'Fixed':
$order_by = ' game_order ASC ';
break;
case 'Random':
$order_by = ' RAND() ';
break;
case 'News':
$order_by = ' game_id DESC ';
break;
default :
$order_by = ' game_order ASC ';
break;
}
$template->set_filenames(array(
'body' => 'arcade_body.tpl')
);
$template->assign_block_vars('arcade_search', array(
'L_SEARCH_MATCHES' => $l_search_matches));
$template->assign_vars(array(
'URL_ARCADE' => '' . $lang['lib_arcade'] . ' ',
'URL_BESTSCORES' => '' . $lang['best_scores'] . ' ',
'URL_SCOREBOARD' => '' . $lang['scoreboard'] . ' ',
'MANAGE_COMMENTS' => '' . $lang['comments'] . ' ',
'CATTITLE' => 'Arcade Search',
'NAV_DESC' => '' . $lang['arcade'] . ' ' ,
'L_GAME' => $lang['games'],
'ARCADE_COL' => ($arcade_config['use_fav_category'])? 6:5,
'ARCADE_COL1' => ($arcade_config['use_fav_category'])? 2:1,
'FAV' => $lang['fav'],
'L_HIGHSCORE' => $lang['highscore'],
'L_YOURSCORE' => $lang['yourbestscore'],
'L_DESC' => $lang['desc_game'],
'L_ARCADE' => $lang['lib_arcade'])
);
$sql = "SELECT g.*, u.username, u.user_id, s.score_game, s.score_date FROM " . GAMES_TABLE . " g left join " . USERS_TABLE . " u on g.game_highuser = u.user_id left join " . SCORES_TABLE . " s on s.game_id = g.game_id and s.user_id = " . $userdata['user_id'] . " $where_search ORDER BY $order_by";
if( !($result = $db->sql_query($sql)) ) {
message_die(GENERAL_ERROR, "Could not read from the games/users table", '', __LINE__, __FILE__, $sql);
}
while( $row = $db->sql_fetchrow($result) ) {
$template->assign_block_vars('gamerow', array(
'GAMENAME' => $row['game_name'],
'GAMEPIC' => ( $row['game_pic'] != '' ) ? "" : '' ,
'GAMESET' => ( $row['game_set'] != 0 ) ? $lang['game_actual_nbset'] . $row['game_set'] : '',
'GAMEDESC' => $row['game_desc'],
'HIGHSCORE' => number_format($row['game_highscore']),
'YOURHIGHSCORE' => number_format($row['score_game']),
'CLICKPLAY' => 'Click to Play!',
'NORECORD' => ( $row['game_highscore'] == 0 ) ? $lang['no_record'] : '',
'HIGHUSER' => ( $row['game_highuser'] != 0 ) ? '(' . $row['username'] . ')' : '' ,
'URL_SCOREBOARD' => '' . "" . ' ',
'GAMEID' => $row['game_id'],
'DATEHIGH' => "" . create_date( $board_config['default_dateformat'] , $row['game_highdate'] , $board_config['board_timezone'] ) . "",
'YOURDATEHIGH' => "" . create_date( $board_config['default_dateformat'] , $row['score_date'] , $board_config['board_timezone'] ) . "",
'IMGFIRST' => ( $row['game_highuser'] == $userdata['user_id'] ) ? " " : "" ,
'ADD_FAV' => ($arcade_config['use_fav_category'])?' | ':'',
'GAMEPOPUPLINK' => "New Window",
'GAMELINK' => '' . $row['game_name'] . ' ' )
);
if ( $row['game_highscore'] !=0 ) {
$template->assign_block_vars('gamerow.recordrow',array());
}
if ( $row['score_game'] !=0 ) {
$template->assign_block_vars('gamerow.yourrecordrow',array());
}
else
{
$template->assign_block_vars('gamerow.playrecordrow',array()) ;
}
}
//
// Output page header
include($phpbb_root_path . 'headingarcade.'.$phpEx);
include($phpbb_root_path . 'whoisplaying.'.$phpEx);
$page_title = $lang['arcade'];
include('includes/page_header.'.$phpEx);
$template->pparse('body');
include('includes/page_tail.'.$phpEx);
?>