<?php
/********************************************************
 *	mod_tableaudechasse.php
 * 	par pitimarsu - www.lecanarddechaine.fr
 *	
 *********************************************************/
if ( !defined('IN_PHPBB') )
{
	die("Hacking attempt");
}
global $board_config, $userdata, $lang, $areabb;


//chargement du template
$template->set_filenames(array(
   'tableaudechasse' =>'areabb/mods/tableaudechasse/tpl/mod_tableaudechasse.tpl'
));

$sql = 'SELECT user_id, username, user_avatar_type, user_allowavatar, user_avatar, user_posts, user_regdate
	FROM '.USERS_TABLE.' 
	 WHERE user_id='.$areabb['chasse_id'];
if ( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not obtain forum information', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);



	// Avatar
	$avatar_img = '';
	if ( $row['user_avatar_type'] && $row['user_allowavatar'] )
	{
		switch( $row['user_avatar_type'] )
		{
			case USER_AVATAR_UPLOAD:
				$avatar_img = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $row['user_avatar'] . '" alt="'.$row['username'].'" title="'.$row['username'].'" border="0" />' : '';
				break;
			case USER_AVATAR_REMOTE:
				$avatar_img = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $row['user_avatar'] . '" alt="'.$row['username'].'" title="'.$row['username'].'" border="0" />' : '';
				break;
			case USER_AVATAR_GALLERY:
				$avatar_img = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $row['user_avatar'] . '" alt="'.$row['username'].'" title="'.$row['username'].'" border="0" />' : '';
				break;
		}
	}
	
	// Check For Anonymous User
	if ($row['user_id'] != '-1')
	{
		if ($row['user_avatar'] == '')
		{
			$avatar_img = '<img src="areabb/images/guest_avatar.gif" alt="'.$row['username'].'" title="'.$row['username'].'" border="0" />';
		}
	}


$template->assign_vars(array(
'USER'						=> areabb_profile($row['user_id'],$row['username']),
'AVATAR_IMG'				=> $avatar_img,
'POSTS'						=> $row['user_posts'],
'DATE'						=> create_date($board_config['default_dateformat'], $row['user_regdate'], $board_config['board_timezone']),
'TITRE'						=> $areabb['chasse_titre'],
'L_CHASSE'					=> $lang['L_CHASSE']
));

$template->assign_var_from_handle('tableaudechasse','tableaudechasse');

?>