lang['No_user_id_specified']);
}
$profiledata = get_userdata(intval($_GET['u']));
$sql = "SELECT *
FROM " . RANKS_TABLE . "
ORDER BY rank_special, rank_min";
$result = $db->sql_query($sql);
while ( $row = $db->sql_fetchrow($result) )
{
$ranksrow[] = $row;
}
$db->sql_freeresult($result);
//
// Output page header and profile_view template
//
$template->set_filenames(array(
'body' => 'profile_view_body.html')
);
make_jumpbox('viewforum.'.$phpEx);
//
// Calculate the number of days this user has been a member ($memberdays)
// Then calculate their posts per day
//
$regdate = $profiledata['user_regdate'];
$memberdays = max(1, round( ( time() - $regdate ) / 86400 ));
$posts_per_day = $profiledata['user_posts'] / $memberdays;
// Get the users percentage of total posts
if ( $profiledata['user_posts'] != 0 )
{
$total_posts = get_db_stat('postcount');
$percentage = ( $total_posts ) ? min(100, ($profiledata['user_posts'] / $total_posts) * 100) : 0;
}
else
{
$percentage = 0;
}
$avatar_img = '';
if ( $profiledata['user_avatar_type'] && $profiledata['user_allowavatar'] )
{
switch( $profiledata['user_avatar_type'] )
{
case USER_AVATAR_UPLOAD:
$avatar_img = ( $board_config['allow_avatar_upload'] ) ? '
' : '';
break;
case USER_AVATAR_REMOTE:
$avatar_img = ( $board_config['allow_avatar_remote'] ) ? '
' : '';
break;
case USER_AVATAR_GALLERY:
$avatar_img = ( $board_config['allow_avatar_local'] ) ? '
' : '';
break;
}
}
$poster_rank = '';
$rank_image = '';
if ( $profiledata['user_rank'] )
{
for($i = 0; $i < count($ranksrow); $i++)
{
if ( $profiledata['user_rank'] == $ranksrow[$i]['rank_id'] && $ranksrow[$i]['rank_special'] )
{
$poster_rank = $ranksrow[$i]['rank_title'];
$rank_image = ( $ranksrow[$i]['rank_image'] ) ? '
' : '';
}
}
}
else
{
for($i = 0; $i < count($ranksrow); $i++)
{
if ( $profiledata['user_posts'] >= $ranksrow[$i]['rank_min'] && !$ranksrow[$i]['rank_special'] )
{
$poster_rank = $ranksrow[$i]['rank_title'];
$rank_image = ( $ranksrow[$i]['rank_image'] ) ? '
' : '';
}
}
}
if ( $profiledata['user_viewemail'] || $auth->acl_get('a_') )
{
$email_uri = ( $board_config['board_email_form'] ) ? "profile.$phpEx$SID&mode=email&u=" . $profiledata['user_id'] : 'mailto:' . $profiledata['user_email'];
$email_img = '' . $user->img('icon_email', $user->lang['Send_email']) . '';
$email = '' . $user->lang['Send_email'] . '';
}
else
{
$email_img = ' ';
$email = ' ';
}
$temp_url = "profile.$phpEx$SID&mode=viewprofile&u=$user_id";
$profile_img = '' . $user->img('icon_profile', $user->lang['Read_profile']) . '';
$profile = '' . $user->lang['Read_profile'] . '';
$temp_url = "privmsg.$phpEx$SID&mode=post&u=$user_id";
$pm_img = '' . $user->img('icon_pm', $user->lang['Send_private_message']) . '';
$pm = '' . $user->lang['Send_private_message'] . '';
$www_img = ( $profiledata['user_website'] ) ? '' . $user->img('icon_www', $user->lang['Visit_website']) . '' : '';
$www = ( $profiledata['user_website'] ) ? '' . $user->lang['Visit_website'] . '' : '';
if ( !empty($profiledata['user_icq']) )
{
$icq_status_img = '
';
$icq_img = '' . $user->img('icon_icq', $user->lang['ICQ']) . '';
$icq = '' . $user->lang['ICQ'] . '';
}
else
{
$icq_status_img = '';
$icq_img = '';
$icq = '';
}
$aim_img = ( $profiledata['user_aim'] ) ? '' . $user->img('icon_aim', $user->lang['AIM']) . '' : '';
$aim = ( $profiledata['user_aim'] ) ? '' . $user->lang['AIM'] . '' : '';
$temp_url = "profile.$phpEx$SID&mode=viewprofile&u=$user_id";
$msn_img = ( $profiledata['user_msnm'] ) ? '' . $user->img('icon_msnm', $user->lang['MSNM']) . '' : '';
$msn = ( $profiledata['user_msnm'] ) ? '' . $user->lang['MSNM'] . '' : '';
$yim_img = ( $profiledata['user_yim'] ) ? '' . $user->img('icon_yim', $user->lang['YIM']) . '' : '';
$yim = ( $profiledata['user_yim'] ) ? '' . $user->lang['YIM'] . '' : '';
$temp_url = "search.$phpEx$SID&search_author=" . urlencode($profiledata['username']) . "&showresults=posts";
$search_img = '' . $user->img('icon_search', $user->lang['Search_user_posts']) . '';
$search = '' . $user->lang['Search_user_posts'] . '';
//
// Generate page
//
$page_title = $user->lang['Viewing_profile'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->assign_vars(array(
'USERNAME' => $profiledata['username'],
'JOINED' => $user->format_date($profiledata['user_regdate'], $user->lang['DATE_FORMAT']),
'POSTER_RANK' => $poster_rank,
'RANK_IMAGE' => $rank_image,
'POSTS_PER_DAY' => $posts_per_day,
'POSTS' => $profiledata['user_posts'],
'PERCENTAGE' => $percentage . '%',
'POST_DAY_STATS' => sprintf($user->lang['User_post_day_stats'], $posts_per_day),
'POST_PERCENT_STATS' => sprintf($user->lang['User_post_pct_stats'], $percentage),
'SEARCH_IMG' => $search_img,
'SEARCH' => $search,
'PM_IMG' => $pm_img,
'PM' => $pm,
'EMAIL_IMG' => $email_img,
'EMAIL' => $email,
'WWW_IMG' => $www_img,
'WWW' => $www,
'ICQ_STATUS_IMG' => $icq_status_img,
'ICQ_IMG' => $icq_img,
'ICQ' => $icq,
'AIM_IMG' => $aim_img,
'AIM' => $aim,
'MSN_IMG' => $msn_img,
'MSN' => $msn,
'YIM_IMG' => $yim_img,
'YIM' => $yim,
'LOCATION' => ( $profiledata['user_from'] ) ? $profiledata['user_from'] : ' ',
'OCCUPATION' => ( $profiledata['user_occ'] ) ? $profiledata['user_occ'] : ' ',
'INTERESTS' => ( $profiledata['user_interests'] ) ? $profiledata['user_interests'] : ' ',
'AVATAR_IMG' => $avatar_img,
'L_VIEWING_PROFILE' => sprintf($user->lang['Viewing_user_profile'], $profiledata['username']),
'L_ABOUT_USER' => sprintf($user->lang['About_user'], $profiledata['username']),
'L_AVATAR' => $user->lang['Avatar'],
'L_POSTER_RANK' => $user->lang['Poster_rank'],
'L_JOINED' => $user->lang['Joined'],
'L_TOTAL_POSTS' => $user->lang['Total_posts'],
'L_SEARCH_USER_POSTS' => sprintf($user->lang['Search_user_posts'], $profiledata['username']),
'L_CONTACT' => $user->lang['Contact'],
'L_EMAIL_ADDRESS' => $user->lang['Email_address'],
'L_EMAIL' => $user->lang['Email'],
'L_PM' => $user->lang['Private_Message'],
'L_ICQ_NUMBER' => $user->lang['ICQ'],
'L_YAHOO' => $user->lang['YIM'],
'L_AIM' => $user->lang['AIM'],
'L_MESSENGER' => $user->lang['MSNM'],
'L_WEBSITE' => $user->lang['Website'],
'L_LOCATION' => $user->lang['Location'],
'L_OCCUPATION' => $user->lang['Occupation'],
'L_INTERESTS' => $user->lang['Interests'],
'U_SEARCH_USER' => "search.$phpEx$SID&search_author=" . urlencode($profiledata['username']),
'S_PROFILE_ACTION' => "profile.$phpEx$SID")
);
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>