update('profile:'.$_GET['id']);
//
// Include the page header
//
require(ROOT_PATH.'sources/page_head.php');
if ( !$functions->get_config('guests_can_view_profiles') && $session->sess_info['user_id'] == LEVEL_GUEST ) {
$functions->redir_to_login();
} else {
//
// Get the user information
//
if ( $_GET['id'] == $session->sess_info['user_id'] ) {
//
// This user is viewing his own profile, so we don't need a new query
//
$own_profile = true;
} else {
//
// This user is not viewing his own profile, so we need a new query
//
$own_profile = false;
$result = $db->query("SELECT * FROM ".TABLE_PREFIX."members WHERE id = ".$_GET['id']);
$profiledata = $db->fetch_result($result);
}
if ( $own_profile || $profiledata['id'] ) {
//
// The user exists, show its profile
//
if ( $own_profile ) {
$profiledata = $session->sess_info['user_info'];
$template->add_breadcrumb($lang['YourPanel'], array('panel.php'));
$template->add_breadcrumb($lang['ViewProfile']);
//
// View the panel menu if the user is viewing his own profile
//
$template->parse('menu', 'panel', array(
'panel_home' => ''.$lang['PanelHome'].'',
'panel_subscriptions' => ''.$lang['Subscriptions'].'',
'view_profile' => ''.$lang['ViewProfile'].'',
'panel_profile' => ''.$lang['EditProfile'].'',
'panel_options' => ''.$lang['EditOptions'].'',
'panel_passwd' => ''.$lang['EditPasswd'].'',
));
} else {
$template->add_breadcrumb(sprintf($lang['Profile'], unhtml(stripslashes($profiledata['displayed_name']))));
}
$username = unhtml(stripslashes($profiledata['displayed_name']));
if ( $functions->get_user_level() == LEVEL_ADMIN || $own_profile )
$username .= ' ('.unhtml(stripslashes($profiledata['name'])).')';
if ( !$own_profile && $functions->antispam_is_potential_spammer($profiledata) )
$username .= $template->get_config('item_delimiter').''.$lang['PotentialSpammer'].'';
if ( $functions->get_user_level() == LEVEL_ADMIN && !$own_profile ) {
$username .= $template->get_config('item_delimiter').''.$lang['EditThisMember'].'';
$username .= $template->get_config('item_delimiter').''.$lang['Delete'].'';
}
switch ( $profiledata['level'] ) {
case 3:
$level = $lang['Administrator'];
break;
case 2:
$level = $lang['Moderator'];
break;
case 1:
$level = $lang['Member'];
break;
}
if ( $profiledata['last_login_show'] || $own_profile || $functions->get_user_level() == LEVEL_ADMIN )
$last_login = ( $profiledata['last_login'] != 0 ) ? $functions->make_date($profiledata['last_login']) : $lang['Never'];
else
$last_login = $lang['Hidden'];
if ( !$profiledata['avatar_type'] ) {
$avatar = '';
} else {
$avatar = '';
$avatars_force_width = (int)$functions->get_config('avatars_force_width');
$avatars_force_height = (int)$functions->get_config('avatars_force_height');
if ( $avatars_force_width > 0 || $avatars_force_height > 0 )
$template->set_js_onload('resize_avatars('.$avatars_force_width.','.$avatars_force_height.')');
}
$days_since_registration = ( ( time() - $profiledata['regdate'] ) / 86400 );
if ( $days_since_registration <= 1 )
$posts_per_day = $profiledata['posts'];
else
$posts_per_day = round($profiledata['posts'] / $days_since_registration, 2);
$birthday = $profiledata['birthday'];
if ( $birthday )
$age = $functions->calculate_age($birthday);
else
$age = '';
$target_blank = ( $functions->get_config('target_blank') ) ? ' rel="external"' : '';
if ( $functions->get_user_level() == LEVEL_GUEST && !$functions->get_config('guests_can_see_contact_info') ) {
//
// Hide contact info for guests
//
$email_v = $lang['Hidden'];
$msnm_v = $yahoom_v = $aim_v = $icq_v = $jabber_v = $skype_v = '';
} else {
$email_v = $functions->show_email($profiledata);
$msnm_v = ( preg_match(EMAIL_PREG, $profiledata['msnm']) ) ? ''.$profiledata['msnm'].'' : unhtml(stripslashes($profiledata['msnm']));
$yahoom_v = ( !empty($profiledata['yahoom']) ) ? ''.unhtml(stripslashes($profiledata['yahoom'])).'' : '';
$aim_v = ( !empty($profiledata['aim']) ) ? ''.unhtml(stripslashes($profiledata['aim'])).'' : '';
$icq_v = ( valid_int($profiledata['icq']) ) ? ''.intval($profiledata['icq']).'' : unhtml(stripslashes($profiledata['icq']));
$jabber_v = ( preg_match(EMAIL_PREG, $profiledata['jabber']) ) ? ''.$profiledata['jabber'].'' : unhtml(stripslashes($profiledata['jabber']));
$skype_v = ( !empty($profiledata['skype']) ) ? ''.unhtml(stripslashes($profiledata['skype'])).'' : '';
}
$can_add_profile_links = $functions->antispam_can_add_profile_links($profiledata);
$template->parse('profile', 'various', array(
'title' => sprintf($lang['Profile'], unhtml(stripslashes($profiledata['displayed_name']))),
'username_v' => $username,
'userid_v' => $_GET['id'],
'real_name_v' => unhtml(stripslashes($profiledata['real_name'])),
'level_v' => $level,
'rank_v' => stripslashes($profiledata['rank']),
'avatar_v' => $avatar,
'regdate_v' => $functions->make_date($profiledata['regdate']),
'posts_v' => $profiledata['posts'],
'postsperday_v' => $posts_per_day,
'searchposts' => ''.$lang['SearchMembersPosts'].'',
'lastlogin_v' => $last_login,
'age_v' => $age,
'location_v' => unhtml(stripslashes($profiledata['location'])),
'website_v' => ( !empty($profiledata['website']) ) ? ''.unhtml(stripslashes($profiledata['website'])).'' : '',
'occupation_v' => unhtml(stripslashes($profiledata['occupation'])),
'interests_v' => unhtml(stripslashes($profiledata['interests'])),
'signature_v' => $functions->markup($functions->replace_badwords(stripslashes($profiledata['signature'])), $functions->get_config('sig_allow_bbcode'), $functions->get_config('sig_allow_smilies'), NULL, NULL, $can_add_profile_links),
'email_v' => $email_v,
'msnm_v' => $msnm_v,
'yahoom_v' => $yahoom_v,
'aim_v' => $aim_v,
'icq_v' => $icq_v,
'icq_status' => '', // Removed March 2010
'jabber_v' => $jabber_v,
'skype_v' => $skype_v
));
} else {
//
// This user does not exist, show an error
//
header(HEADER_404);
$template->add_breadcrumb($lang['Error']);
$template->parse('msgbox', 'global', array(
'box_title' => $lang['Error'],
'content' => sprintf($lang['NoSuchMember'], 'ID '.$_GET['id'])
));
}
}
//
// Include the page footer
//
require(ROOT_PATH.'sources/page_foot.php');
} else {
//
// There's no user ID! Get us back to the index...
//
$functions->redirect('index.php');
}
?>