<commit_before><?

if (isset($var['game_id'])) $game_id = $var['game_id'];
$base = array();

if (empty($game_id))
{
//	$base[] = 'Overall';
//	$base[] = 'Per Game, / games_joined';
	$topic = 'All Time Hall of Fame';

}
else
{
//	$base[] = 'Total';
	$db->query('SELECT * FROM game WHERE game_id = '.$game_id);
	if ($db->nextRecord())
	{
		$name = $db->getField('game_name');
		$topic = $name.' Hall of Fame';
	}
	else
		$topic = 'Somegame Hall of Fame';
	
}
$smarty->assign('PageTopic',$topic);
$PHP_OUTPUT.=('<div align=center>');

$PHP_OUTPUT.=('Welcome to the Hall of Fame ' . stripslashes($account->HoF_name) . '!<br />The Hall of Fame is a comprehensive ');
$PHP_OUTPUT.=('list of player accomplishments.  Here you can view how players rank in many different ');
$PHP_OUTPUT.=('aspects of the game rather than just kills, deaths, and experience with the rankings system.<br /><br />');

$db->query('SELECT DISTINCT type FROM player_hof');
$hofTypes = array();
while($db->nextRecord())
{
	$hof =& $hofTypes;
	$typeList = explode(':',$db->getField('type'));
	foreach($typeList as $type)
	{
		if(!isset($hof[$type]))
		{
			$hof[$type] = array();
		}
		$hof =& $hof[$type];
	}
	$hof = true;
}
$container = array();
$container['url'] = 'skeleton.php';
$container['body'] = 'hall_of_fame_new.php';
if (isset($var['game_id'])) $container['game_id'] = $var['game_id'];
$viewing= '<span style="font-weight:bold;">Currently viewing: </span>'.create_link($container,isset($var['game_id'])?'Current HoF':'Global HoF');
$typeList = array();
if(isset($var['type']))
{
	foreach($var['type'] as $type)
	{
		if(!is_array($hofTypes[$type]))
		{
			$var['type'] = $typeList;
			$var['view'] = $type;
			break;
		}
		else
			$typeList[] = $type;
		$viewing .= ' -&gt; ';
		$container = array();
		$container['url'] = 'skeleton.php';
		$container['body'] = 'hall_of_fame_new.php';
		$container['type'] = $typeList;
		if (isset($var['game_id'])) $container['game_id'] = $var['game_id'];
		$viewing.= create_link($container,$type);
		
		$hofTypes =& $hofTypes[$type];
	}
}
if(isset($var['view']))
{
	$viewing .= ' -&gt; ';
	if(is_array($hofTypes[$var['view']]))
	{
		$typeList[] = $var['view'];
		$var['type'] = $typeList;
	}
	$container = array();
	$container['url'] = 'skeleton.php';
	$container['body'] = 'hall_of_fame_new.php';
	$container['type'] = $typeList;
	if(isset($var['view'])) $container['view'] = $var['view'];
	if (isset($var['game_id'])) $container['game_id'] = $var['game_id'];
	$viewing .= create_link($container,$var['view']);
	
	if(is_array($hofTypes[$var['view']]))
	{
		$hofTypes =& $hofTypes[$var['view']];
		unset($var['view']);
	}
}
$viewing.= '<br /><br />';

$PHP_OUTPUT.= $viewing;
$PHP_OUTPUT.= create_table();


if(!isset($var['view']))
{
	$PHP_OUTPUT.=('<tr><th align=center>Category</th><th align=center width=60%>Subcategory</th></tr>');
	
	foreach($hofTypes as $type => $value)
	{
		$PHP_OUTPUT.=('<tr>');
		$PHP_OUTPUT.=('<td align=center>'.$type.'</td>');
		$container = array();
		$container['url'] = 'skeleton.php';
		$container['body'] = 'hall_of_fame_new.php';
		if (isset($var['type']))
			$container['type'] = $var['type'];
		else
			$container['type'] = array();
		$container['type'][] = $type;
		if (isset($var['game_id']))
			$container['game_id'] = $var['game_id'];
		$PHP_OUTPUT.=('<td align=center valign=middle>');
		$i=0;
		if(is_array($value))
		{
			foreach($value as $subType => $subTypeValue)
			{
				++$i;
				$container['view'] = $subType;
				$PHP_OUTPUT.=create_submit_link($container,$subType);
				$PHP_OUTPUT.=('&nbsp;');
				if ($i % 3 == 0) $PHP_OUTPUT.=('<br />');
			}
		}
		else
		{
			unset($container['view']);
			$PHP_OUTPUT.=create_submit_link($container,'View');
		}
		$PHP_OUTPUT.=('</td></tr>');
	}
}
else
{
	$PHP_OUTPUT.=('<tr><th align="center">Rank</th><th align="center">Player</th><th align="center">Total</th></tr>');
	
	$viewType = $var['type'];
	$viewType[] = $var['view'];
	
	$rank=1;
	$db->query('SELECT account_id,amount FROM player_hof WHERE type='.$db->escapeArray($viewType,true,':',false).' AND game_id=' . $var['game_id'] .' ORDER BY amount DESC LIMIT 25');
	while($db->nextRecord())
	{
		$hofAccount =& SmrAccount::getAccount($db->getField('account_id'));
		if ($hofAccount->account_id == $account->account_id) $bold = ' style="font-weight:bold;"';
		else $bold = '';
		$PHP_OUTPUT.=('<tr>');
		$PHP_OUTPUT.=('<td align=center'.$bold.'>' . $rank++ . '</td>');
		
		$container = array();
		$container['url'] = 'skeleton.php';
		$container['body'] = 'hall_of_fame_player_detail.php';
		$container['acc_id'] = $db->getField('account_id');
		
		if (isset($game_id))
		{
			$container['game_id'] = $game_id;
			$container['sending_page'] = 'current_hof';
		}
		else
		{
			$container['game_id'] = $player->getGameID();
			$container['sending_page'] = 'hof';
		}<commit_msg>Add Global HoF and always use same order for sub-category lists.<commit_after><?

if (isset($var['game_id'])) $game_id = $var['game_id'];
$base = array();

if (empty($game_id))
{
//	$base[] = 'Overall';
//	$base[] = 'Per Game, / games_joined';
	$topic = 'All Time Hall of Fame';

}
else
{
//	$base[] = 'Total';
	$db->query('SELECT * FROM game WHERE game_id = '.$game_id);
	if ($db->nextRecord())
	{
		$name = $db->getField('game_name');
		$topic = $name.' Hall of Fame';
	}
	else
		$topic = 'Somegame Hall of Fame';
	
}
$smarty->assign('PageTopic',$topic);
$PHP_OUTPUT.=('<div align=center>');

$PHP_OUTPUT.=('Welcome to the Hall of Fame ' . stripslashes($account->HoF_name) . '!<br />The Hall of Fame is a comprehensive ');
$PHP_OUTPUT.=('list of player accomplishments.  Here you can view how players rank in many different ');
$PHP_OUTPUT.=('aspects of the game rather than just kills, deaths, and experience with the rankings system.<br /><br />');

$db->query('SELECT DISTINCT type FROM player_hof' . (isset($var['game_id']) ? ' WHERE game_id='.$var['game_id'] : '').' ORDER BY type');
$hofTypes = array();
while($db->nextRecord())
{
	$hof =& $hofTypes;
	$typeList = explode(':',$db->getField('type'));
	foreach($typeList as $type)
	{
		if(!isset($hof[$type]))
		{
			$hof[$type] = array();
		}
		$hof =& $hof[$type];
	}
	$hof = true;
}
$container = array();
$container['url'] = 'skeleton.php';
$container['body'] = 'hall_of_fame_new.php';
if (isset($var['game_id'])) $container['game_id'] = $var['game_id'];
$viewing= '<span style="font-weight:bold;">Currently viewing: </span>'.create_link($container,isset($var['game_id'])?'Current HoF':'Global HoF');
$typeList = array();
if(isset($var['type']))
{
	foreach($var['type'] as $type)
	{
		if(!is_array($hofTypes[$type]))
		{
			$var['type'] = $typeList;
			$var['view'] = $type;
			break;
		}
		else
			$typeList[] = $type;
		$viewing .= ' -&gt; ';
		$container = array();
		$container['url'] = 'skeleton.php';
		$container['body'] = 'hall_of_fame_new.php';
		$container['type'] = $typeList;
		if (isset($var['game_id'])) $container['game_id'] = $var['game_id'];
		$viewing.= create_link($container,$type);
		
		$hofTypes =& $hofTypes[$type];
	}
}
if(isset($var['view']))
{
	$viewing .= ' -&gt; ';
	if(is_array($hofTypes[$var['view']]))
	{
		$typeList[] = $var['view'];
		$var['type'] = $typeList;
	}
	$container = array();
	$container['url'] = 'skeleton.php';
	$container['body'] = 'hall_of_fame_new.php';
	$container['type'] = $typeList;
	if(isset($var['view'])) $container['view'] = $var['view'];
	if (isset($var['game_id'])) $container['game_id'] = $var['game_id'];
	$viewing .= create_link($container,$var['view']);
	
	if(is_array($hofTypes[$var['view']]))
	{
		$hofTypes =& $hofTypes[$var['view']];
		unset($var['view']);
	}
}
$viewing.= '<br /><br />';

$PHP_OUTPUT.= $viewing;
$PHP_OUTPUT.= create_table();


if(!isset($var['view']))
{
	$PHP_OUTPUT.=('<tr><th align=center>Category</th><th align=center width=60%>Subcategory</th></tr>');
	
	foreach($hofTypes as $type => $value)
	{
		$PHP_OUTPUT.=('<tr>');
		$PHP_OUTPUT.=('<td align=center>'.$type.'</td>');
		$container = array();
		$container['url'] = 'skeleton.php';
		$container['body'] = 'hall_of_fame_new.php';
		if (isset($var['type']))
			$container['type'] = $var['type'];
		else
			$container['type'] = array();
		$container['type'][] = $type;
		if (isset($var['game_id']))
			$container['game_id'] = $var['game_id'];
		$PHP_OUTPUT.=('<td align=center valign=middle>');
		$i=0;
		if(is_array($value))
		{
			foreach($value as $subType => $subTypeValue)
			{
				++$i;
				$container['view'] = $subType;
				$PHP_OUTPUT.=create_submit_link($container,$subType);
				$PHP_OUTPUT.=('&nbsp;');
				if ($i % 3 == 0) $PHP_OUTPUT.=('<br />');
			}
		}
		else
		{
			unset($container['view']);
			$PHP_OUTPUT.=create_submit_link($container,'View');
		}
		$PHP_OUTPUT.=('</td></tr>');
	}
}
else
{
	$PHP_OUTPUT.=('<tr><th align="center">Rank</th><th align="center">Player</th><th align="center">Total</th></tr>');
	
	$viewType = $var['type'];
	$viewType[] = $var['view'];
	
	$rank=1;
	$db->query('SELECT account_id,amount FROM player_hof WHERE type='.$db->escapeArray($viewType,true,':',false).(isset($var['game_id']) ? ' AND game_id=' . $var['game_id'] : ' GROUP BY type') .' ORDER BY amount DESC LIMIT 25');
	while($db->nextRecord())
	{
		$hofAccount =& SmrAccount::getAccount($db->getField('account_id'));
		if ($hofAccount->account_id == $account->account_id) $bold = ' style="font-weight:bold;"';
		else $bold = '';
		$PHP_OUTPUT.=('<tr>');
		$PHP_OUTPUT.=('<td align=center'.$bold.'>' . $rank++ . '</td>');
		
		$container = array();
		$container['url'] = 'skeleton.php';
		$container['body'] = 'hall_of_fame_player_detail.php';
		$container['acc_id'] = $db->getField('account_id');
		
		if (isset($game_id))
		{
			$container['game_id'] = $game_id;
			$container['sending_page'] = 'current_hof';
		}
		else
		{
			$container['game_id'] = $player->getGameID();
			$container['sending_page'] = 'hof';
		}
{'fraction_non_alphanumeric': 0.2515206812652068, 'fraction_numerical': 0.0016220600162206002, 'mean_word_length': 5.112143742255267, 'pattern_counts': {'":': 0, '<': 69, '<?xml version=': 0, '>': 103, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6594790', 'n_tokens_mistral': 4027, 'n_tokens_neox': 3694, 'n_words': 647}