/portal/block/arcade.php
Code: Select all
<?php
/*
*
* @package phpBB3 Portal a.k.a canverPortal ( www.phpbb3portal.com )
* @version $Id: links.php,v 1.4 2008/02/09 08:18:14 angelside Exp $
* @copyright (c) Canver Software - www.canversoft.net
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
if (!defined('IN_PHPBB') or !defined('IN_PORTAL'))
{
die('Hacking attempt');
exit;
}
if (file_exists($phpbb_root_path . 'includes/arcade/arcade_class.' . $phpEx))
{
include($phpbb_root_path . 'includes/arcade/arcade_class.' . $phpEx);
$arcade = new arcade(false);
// Start of Top 3 Arcade Players
$real_leaders_count = sizeof($arcade->leaders);
$leaders_count = ($real_leaders_count > 3) ? 3 : $real_leaders_count;
$arcade_leaders_img = array();
$arcade_leaders_img[0] = '';
$arcade_leaders_img[1] = $phpbb_root_path . $arcade->config['image_path'] . '1st.gif';
$arcade_leaders_img[2] = $phpbb_root_path . $arcade->config['image_path'] . '2nd.gif';
$arcade_leaders_img[3] = $phpbb_root_path . $arcade->config['image_path'] . '3rd.gif';
$arcade_leaders_img_alt = array();
$arcade_leaders_img_alt[0] = '';
$arcade_leaders_img_alt[1] = $user->lang['ARCADE_FIRST'];
$arcade_leaders_img_alt[2] = $user->lang['ARCADE_SECOND'];
$arcade_leaders_img_alt[3] = $user->lang['ARCADE_THIRD'];
if ($leaders_count > 0)
{
$rank = 0;
$actual_rank = 0;
$previous_wins = 0;
for ($i = 0; $i < $leaders_count; $i++)
{
//This code is used to calculate the actual rank.
//For example if there are ties...
$actual_rank++;
if ($previous_wins != $arcade->leaders[$i]['total_wins'])
{
$rank = $actual_rank;
}
$previous_wins = $arcade->leaders[$i]['total_wins'];
$user_link = $arcade->format_username('full', $arcade->leaders[$i]['user_id'], $arcade->leaders[$i]['username'], $arcade->leaders[$i]['user_colour']);
$template->assign_block_vars('arcade_leaders', array(
'ARCADE_LEADERS_RANK' => $rank,
'ARCADE_LEADERS' => $user_link,
'ARCADE_LEADERS_IMAGE' => (isset($arcade_leaders_img[$rank])) ? $arcade_leaders_img[$rank] : '',
'ARCADE_LEADERS_IMAGE_ALT' => (isset($arcade_leaders_img_alt[$rank])) ? $arcade_leaders_img_alt[$rank] : '',
'VICTORIES' => $arcade->leaders[$i]['total_wins']
));
}
}
// End of Top 3 Arcade Players
//Newest Game
if (sizeof($arcade->newest_games))
{
$template->assign_vars(array(
'S_HAS_NEWEST_GAME' => true,
'U_NEWEST_GAME_PLAY' => append_sid("{$phpbb_root_path}arcade.$phpEx", 'mode=play&g=' . $arcade->newest_games[0]['game_id']),
'NEWEST_GAME_IMAGE' => ($arcade->newest_games[0]['game_image'] != '') ? $phpbb_root_path . "arcade.$phpEx?img=" . $arcade->newest_games[0]['game_image'] : '',
'NEWEST_GAME_NAME' => $arcade->newest_games[0]['game_name'],
));
}
//Newest Game
//Total Games, Time and Plays
$total_games = sizeof($arcade->games);
if ($total_games > 1)
{
$total_games = sprintf($user->lang['ARCADE_TOTAL_GAMES'], $total_games);
}
else if ($total_games == 1)
{
$total_games = sprintf($user->lang['ARCADE_TOTAL_GAME'], $total_games);
}
$template->assign_vars(array(
'S_DISPLAY_ARCADE' => true,
'TOTAL_GAMES_PLAYED' => ($arcade->totals['games_played']) ? sprintf($user->lang['ARCADE_TOTAL_PLAYED'], $arcade->totals['games_played'], $arcade->format_time($arcade->totals['games_time'])) : '',
'TOTAL_GAMES' => $total_games,
));
//Total Games
}
?>
Code: Select all
<?php
/*
*
* @package phpBB3 Portal a.k.a canverPortal ( www.phpbb3portal.com )
* @version $Id: links.php,v 1.4 2008/02/09 08:18:14 angelside Exp $
* @copyright (c) Canver Software - www.canversoft.net
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
if (!defined('IN_PHPBB') or !defined('IN_PORTAL'))
{
die('Hacking attempt');
exit;
}
if (file_exists($phpbb_root_path . 'includes/arcade/arcade_class.' . $phpEx))
{
include($phpbb_root_path . 'includes/arcade/arcade_class.' . $phpEx);
$arcade = new arcade(false);
// Start of Top 3 Arcade Players
$real_leaders_count = sizeof($arcade->leaders);
$leaders_count = ($real_leaders_count > 3) ? 3 : $real_leaders_count;
$arcade_leaders_img = array();
$arcade_leaders_img[0] = '';
$arcade_leaders_img[1] = $phpbb_root_path . $arcade->config['image_path'] . '1st.gif';
$arcade_leaders_img[2] = $phpbb_root_path . $arcade->config['image_path'] . '2nd.gif';
$arcade_leaders_img[3] = $phpbb_root_path . $arcade->config['image_path'] . '3rd.gif';
$arcade_leaders_img_alt = array();
$arcade_leaders_img_alt[0] = '';
$arcade_leaders_img_alt[1] = $user->lang['ARCADE_FIRST'];
$arcade_leaders_img_alt[2] = $user->lang['ARCADE_SECOND'];
$arcade_leaders_img_alt[3] = $user->lang['ARCADE_THIRD'];
if ($leaders_count > 0)
{
$rank = 0;
$actual_rank = 0;
$previous_wins = 0;
for ($i = 0; $i < $leaders_count; $i++)
{
//This code is used to calculate the actual rank.
//For example if there are ties...
$actual_rank++;
if ($previous_wins != $arcade->leaders[$i]['total_wins'])
{
$rank = $actual_rank;
}
$previous_wins = $arcade->leaders[$i]['total_wins'];
$user_link = $arcade->format_username('full', $arcade->leaders[$i]['user_id'], $arcade->leaders[$i]['username'], $arcade->leaders[$i]['user_colour']);
$template->assign_block_vars('arcade_leaders', array(
'ARCADE_LEADERS_RANK' => $rank,
'ARCADE_LEADERS' => $user_link,
'ARCADE_LEADERS_IMAGE' => (isset($arcade_leaders_img[$rank])) ? $arcade_leaders_img[$rank] : '',
'ARCADE_LEADERS_IMAGE_ALT' => (isset($arcade_leaders_img_alt[$rank])) ? $arcade_leaders_img_alt[$rank] : '',
'VICTORIES' => $arcade->leaders[$i]['total_wins']
));
}
}
// End of Top 3 Arcade Players
//Newest Game
if (sizeof($arcade->newest_games))
{
$template->assign_vars(array(
'S_HAS_NEWEST_GAME' => true,
'U_NEWEST_GAME_PLAY' => append_sid("{$phpbb_root_path}arcade.$phpEx", 'mode=play&g=' . $arcade->newest_games[0]['game_id']),
'NEWEST_GAME_IMAGE' => ($arcade->newest_games[0]['game_image'] != '') ? $phpbb_root_path . "arcade.$phpEx?img=" . $arcade->newest_games[0]['game_image'] : '',
'NEWEST_GAME_NAME' => $arcade->newest_games[0]['game_name'],
));
}
//Newest Game
//Total Games, Time and Plays
$total_games = sizeof($arcade->games);
if ($total_games > 1)
{
$total_games = sprintf($user->lang['ARCADE_TOTAL_GAMES'], $total_games);
}
else if ($total_games == 1)
{
$total_games = sprintf($user->lang['ARCADE_TOTAL_GAME'], $total_games);
}
$template->assign_vars(array(
'S_DISPLAY_ARCADE' => true,
'TOTAL_GAMES_PLAYED' => ($arcade->totals['games_played']) ? sprintf($user->lang['ARCADE_TOTAL_PLAYED'], $arcade->totals['games_played'], $arcade->format_time($arcade->totals['games_time'])) : '',
'TOTAL_GAMES' => $total_games,
));
//Total Games
}
?>
<!-- IF S_DISPLAY_ARCADE -->
<h3>Arcade Stats</h3>
<div class="panel">
<div class="inner"><span class="corners-top"><span></span></span>
<div class="content">
<!-- IF S_HAS_NEWEST_GAME -->
<p style="margin: 4px;"><!-- IF NEWEST_GAME_IMAGE --><a href="{U_NEWEST_GAME_PLAY}">Newest Game:<br /><img src="{NEWEST_GAME_IMAGE}" alt="{NEWEST_GAME_NAME}" width="20" height="20" style="vertical-align: middle;" /></a><!-- ENDIF --> {NEWEST_GAME_NAME}</p>
<!-- ENDIF -->
<!-- IF .arcade_leaders -->
<br />
<div>
<b>{L_ARCADE_LEADERS_HEADER}</b><br />
<!-- BEGIN arcade_leaders -->
<!-- IF arcade_leaders.S_ROW_COUNT > 0 --> <!-- ENDIF --><!-- IF arcade_leaders.ARCADE_LEADERS_IMAGE --><img src="{arcade_leaders.ARCADE_LEADERS_IMAGE}" alt="{arcade_leaders.ARCADE_LEADERS_IMAGE_ALT}" style="vertical-align: middle;" /><!-- ENDIF --> {arcade_leaders.ARCADE_LEADERS_RANK}: {arcade_leaders.ARCADE_LEADERS} ({arcade_leaders.VICTORIES})
<!-- END arcade_leaders -->
</div>
<!-- ENDIF -->
<!-- IF TOTAL_GAMES -->
<br />
<p style="font-size: 12px;">{TOTAL_GAMES}<br />{TOTAL_GAMES_PLAYED}</p>
<!-- ENDIF -->
</div>
<span class="corners-bottom"><span></span></span></div>
</div>
<!-- ENDIF -->
Code: Select all
<!-- IF S_DISPLAY_MINICAL -->
<!-- INCLUDE portal/block/mini_calendar.html -->
<!-- ENDIF -->
<!-- INCLUDE portal/block/arcade.html -->
<!-- IF S_DISPLAY_BIRTHDAY_LIST -->
<!-- INCLUDE portal/block/birthday_list.html -->
<!-- ENDIF -->