[ Index ] |
|
Code source de PHP NUKE 7.9 |
1 <?php 2 /*************************************************************************** 3 * usercp_viewprofile.php 4 * ------------------- 5 * begin : Saturday, Feb 13, 2001 6 * copyright : (C) 2001 The phpBB Group 7 * email : support@phpbb.com 8 * 9 * Id: usercp_viewprofile.php,v 1.5.2.5 2005/07/19 20:01:16 acydburn Exp 10 * 11 * 12 ***************************************************************************/ 13 14 /*************************************************************************** 15 * 16 * This program is free software; you can redistribute it and/or modify 17 * it under the terms of the GNU General Public License as published by 18 * the Free Software Foundation; either version 2 of the License, or 19 * (at your option) any later version. 20 * 21 * 22 ***************************************************************************/ 23 24 if ( !defined('IN_PHPBB') ) 25 { 26 die("Hacking attempt"); 27 exit; 28 } 29 30 if ( empty($HTTP_GET_VARS[POST_USERS_URL]) || $HTTP_GET_VARS[POST_USERS_URL] == ANONYMOUS ) 31 { 32 message_die(GENERAL_MESSAGE, $lang['No_user_id_specified']); 33 } 34 $profiledata = get_userdata($HTTP_GET_VARS[POST_USERS_URL]); 35 if (!$profiledata) 36 { 37 message_die(GENERAL_MESSAGE, $lang['No_user_id_specified']); 38 } 39 40 $sql = "SELECT * 41 FROM " . RANKS_TABLE . " 42 ORDER BY rank_special, rank_min"; 43 if ( !($result = $db->sql_query($sql)) ) 44 { 45 message_die(GENERAL_ERROR, 'Could not obtain ranks information', '', __LINE__, __FILE__, $sql); 46 } 47 48 $ranksrow = array(); 49 while ( $row = $db->sql_fetchrow($result) ) 50 { 51 $ranksrow[] = $row; 52 } 53 $db->sql_freeresult($result); 54 55 // 56 // Output page header and profile_view template 57 // 58 $template->set_filenames(array( 59 'body' => 'profile_view_body.tpl') 60 ); 61 if (is_active("Forums")) { 62 make_jumpbox('viewforum.'.$phpEx); 63 } 64 // 65 // Calculate the number of days this user has been a member ($memberdays) 66 // Then calculate their posts per day 67 // 68 $regdate = $profiledata['user_regdate']; 69 $nukedate = strtotime($regdate); 70 $memberdays = max(1, round( ( time() - $nukedate ) / 86400 )); 71 $posts_per_day = $profiledata['user_posts'] / $memberdays; 72 73 // Get the users percentage of total posts 74 if ( $profiledata['user_posts'] != 0 ) 75 { 76 $total_posts = get_db_stat('postcount'); 77 $percentage = ( $total_posts ) ? min(100, ($profiledata['user_posts'] / $total_posts) * 100) : 0; 78 } 79 else 80 { 81 $percentage = 0; 82 } 83 84 $avatar_img = ''; 85 if ( $profiledata['user_avatar_type'] && $profiledata['user_allowavatar'] ) 86 { 87 switch( $profiledata['user_avatar_type'] ) 88 { 89 case USER_AVATAR_UPLOAD: 90 $avatar_img = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $profiledata['user_avatar'] . '" alt="" border="0" />' : ''; 91 break; 92 case USER_AVATAR_REMOTE: 93 $avatar_img = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $profiledata['user_avatar'] . '" alt="" border="0" />' : ''; 94 break; 95 case USER_AVATAR_GALLERY: 96 $avatar_img = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $profiledata['user_avatar'] . '" alt="" border="0" />' : ''; 97 break; 98 } 99 } 100 101 $poster_rank = ''; 102 $rank_image = ''; 103 if ( $profiledata['user_rank'] ) 104 { 105 for($i = 0; $i < count($ranksrow); $i++) 106 { 107 if ( $profiledata['user_rank'] == $ranksrow[$i]['rank_id'] && $ranksrow[$i]['rank_special'] ) 108 { 109 $poster_rank = $ranksrow[$i]['rank_title']; 110 $rank_image = ( $ranksrow[$i]['rank_image'] ) ? '<img src="' . $ranksrow[$i]['rank_image'] . '" alt="' . $poster_rank . '" title="' . $poster_rank . '" border="0" /><br />' : ''; 111 } 112 } 113 } 114 else 115 { 116 for($i = 0; $i < count($ranksrow); $i++) 117 { 118 if ( $profiledata['user_posts'] >= $ranksrow[$i]['rank_min'] && !$ranksrow[$i]['rank_special'] ) 119 { 120 $poster_rank = $ranksrow[$i]['rank_title']; 121 $rank_image = ( $ranksrow[$i]['rank_image'] ) ? '<img src="' . $ranksrow[$i]['rank_image'] . '" alt="' . $poster_rank . '" title="' . $poster_rank . '" border="0" /><br />' : ''; 122 } 123 } 124 } 125 126 $temp_url = append_sid("privmsg.$phpEx?mode=post&" . POST_USERS_URL . "=" . $profiledata['user_id']); 127 if (is_active("Private_Messages")) { 128 $pm_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_pm'] . '" alt="' . $lang['Send_private_message'] . '" title="' . $lang['Send_private_message'] . '" border="0" /></a>'; 129 $pm = '<a href="' . $temp_url . '">' . $lang['Send_private_message'] . '</a>'; 130 } 131 132 if ( !empty($profiledata['user_viewemail']) || $userdata['user_level'] == ADMIN ) 133 { 134 $email_uri = ( $board_config['board_email_form'] ) ? append_sid("profile.$phpEx?mode=email&" . POST_USERS_URL .'=' . $profiledata['user_id']) : 'mailto:' . $profiledata['user_email']; 135 136 $email_img = '<a href="' . $email_uri . '"><img src="' . $images['icon_email'] . '" alt="' . $lang['Send_email'] . '" title="' . $lang['Send_email'] . '" border="0" /></a>'; 137 $email = '<a href="' . $email_uri . '">' . $lang['Send_email'] . '</a>'; 138 } 139 else 140 { 141 $email_img = ' '; 142 $email = ' '; 143 } 144 if (( $profiledata['user-website'] == "http:///") || ( $profiledata['user_website'] == "http://")){ 145 $profiledata['user_website'] = ""; 146 } 147 if (($profiledata['user_website'] != "" ) && (substr($profiledata['user_website'],0, 7) != "http://")) { 148 $profiledata['user_website'] = "http://".$profiledata['user_website']; 149 } 150 151 $www_img = ( $profiledata['user_website'] ) ? '<a href="' . $profiledata['user_website'] . '" target="_userwww"><img src="' . $images['icon_www'] . '" alt="' . $lang['Visit_website'] . '" title="' . $lang['Visit_website'] . '" border="0" /></a>' : ' '; 152 $www = ( $profiledata['user_website'] ) ? '<a href="' . $profiledata['user_website'] . '" target="_userwww">' . $profiledata['user_website'] . '</a>' : ' '; 153 154 if ( !empty($profiledata['user_icq']) ) 155 { 156 $icq_status_img = '<a href="http://wwp.icq.com/' . $profiledata['user_icq'] . '#pager"><img src="http://web.icq.com/whitepages/online?icq=' . $profiledata['user_icq'] . '&img=5" width="18" height="18" border="0" /></a>'; 157 $icq_img = '<a href="http://wwp.icq.com/scripts/search.dll?to=' . $profiledata['user_icq'] . '"><img src="' . $images['icon_icq'] . '" alt="' . $lang['ICQ'] . '" title="' . $lang['ICQ'] . '" border="0" /></a>'; 158 $icq = '<a href="http://wwp.icq.com/scripts/search.dll?to=' . $profiledata['user_icq'] . '">' . $lang['ICQ'] . '</a>'; 159 } 160 else 161 { 162 $icq_status_img = ' '; 163 $icq_img = ' '; 164 $icq = ' '; 165 } 166 167 $aim_img = ( $profiledata['user_aim'] ) ? '<a href="aim:goim?screenname=' . $profiledata['user_aim'] . '&message=Hello+Are+you+there?"><img src="' . $images['icon_aim'] . '" alt="' . $lang['AIM'] . '" title="' . $lang['AIM'] . '" border="0" /></a>' : ' '; 168 $aim = ( $profiledata['user_aim'] ) ? '<a href="aim:goim?screenname=' . $profiledata['user_aim'] . '&message=Hello+Are+you+there?">' . $lang['AIM'] . '</a>' : ' '; 169 170 $msn_img = ( $profiledata['user_msnm'] ) ? $profiledata['user_msnm'] : ' '; 171 $msn = $msn_img; 172 173 $yim_img = ( $profiledata['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $profiledata['user_yim'] . '&.src=pg"><img src="' . $images['icon_yim'] . '" alt="' . $lang['YIM'] . '" title="' . $lang['YIM'] . '" border="0" /></a>' : ''; 174 $yim = ( $profiledata['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $profiledata['user_yim'] . '&.src=pg">' . $lang['YIM'] . '</a>' : ''; 175 176 $temp_url = append_sid("search.$phpEx?search_author=" . urlencode($profiledata['username']) . "&showresults=posts"); 177 $search_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_search'] . '" alt="' . $lang['Search_user_posts'] . '" title="' . sprintf($lang['Search_user_posts'], $profiledata['username']) . '" border="0" /></a>'; 178 $search = '<a href="' . $temp_url . '">' . sprintf($lang['Search_user_posts'], $profiledata['username']) . '</a>'; 179 180 // 181 // Generate page 182 // 183 $page_title = $lang['Viewing_profile']; 184 include ("includes/page_header.php"); 185 $profiledata['user_from'] = str_replace(".gif", "", $profiledata['user_from']); 186 if (function_exists('get_html_translation_table')) 187 { 188 $u_search_author = urlencode(strtr($profiledata['username'], array_flip(get_html_translation_table(HTML_ENTITIES)))); 189 } 190 else 191 { 192 $u_search_author = urlencode(str_replace(array('&', ''', '"', '<', '>'), array('&', "'", '"', '<', '>'), $profiledata['username'])); 193 } 194 195 $template->assign_vars(array( 196 'USERNAME' => $profiledata['username'], 197 'JOINED' => $profiledata['user_regdate'], 198 'POSTER_RANK' => $poster_rank, 199 'RANK_IMAGE' => $rank_image, 200 'POSTS_PER_DAY' => $posts_per_day, 201 'POSTS' => $profiledata['user_posts'], 202 'PERCENTAGE' => $percentage . '%', 203 'POST_DAY_STATS' => sprintf($lang['User_post_day_stats'], $posts_per_day), 204 'POST_PERCENT_STATS' => sprintf($lang['User_post_pct_stats'], $percentage), 205 206 'SEARCH_IMG' => $search_img, 207 'SEARCH' => $search, 208 'PM_IMG' => $pm_img, 209 'PM' => $pm, 210 'EMAIL_IMG' => $email_img, 211 'EMAIL' => $email, 212 'WWW_IMG' => $www_img, 213 'WWW' => $www, 214 'ICQ_STATUS_IMG' => $icq_status_img, 215 'ICQ_IMG' => $icq_img, 216 'ICQ' => $icq, 217 'AIM_IMG' => $aim_img, 218 'AIM' => $aim, 219 'MSN_IMG' => $msn_img, 220 'MSN' => $msn, 221 'YIM_IMG' => $yim_img, 222 'YIM' => $yim, 223 224 'LOCATION' => ( $profiledata['user_from'] ) ? $profiledata['user_from'] : ' ', 225 'OCCUPATION' => ( $profiledata['user_occ'] ) ? $profiledata['user_occ'] : ' ', 226 'INTERESTS' => ( $profiledata['user_interests'] ) ? $profiledata['user_interests'] : ' ', 227 'AVATAR_IMG' => $avatar_img, 228 229 'L_VIEWING_PROFILE' => sprintf($lang['Viewing_user_profile'], $profiledata['username']), 230 'L_ABOUT_USER' => sprintf($lang['About_user'], $profiledata['username']), 231 'L_AVATAR' => $lang['Avatar'], 232 'L_POSTER_RANK' => $lang['Poster_rank'], 233 'L_JOINED' => $lang['Joined'], 234 'L_TOTAL_POSTS' => $lang['Total_posts'], 235 'L_SEARCH_USER_POSTS' => sprintf($lang['Search_user_posts'], $profiledata['username']), 236 'L_CONTACT' => $lang['Contact'], 237 'L_EMAIL_ADDRESS' => $lang['Email_address'], 238 'L_EMAIL' => $lang['Email'], 239 'L_PM' => $lang['Private_Message'], 240 'L_ICQ_NUMBER' => $lang['ICQ'], 241 'L_YAHOO' => $lang['YIM'], 242 'L_AIM' => $lang['AIM'], 243 'L_MESSENGER' => $lang['MSNM'], 244 'L_WEBSITE' => $lang['Website'], 245 'L_LOCATION' => $lang['Location'], 246 'L_OCCUPATION' => $lang['Occupation'], 247 'L_INTERESTS' => $lang['Interests'], 248 249 'U_SEARCH_USER' => append_sid("search.$phpEx?search_author=" . $u_search_author), 250 251 'S_PROFILE_ACTION' => append_sid("profile.$phpEx")) 252 ); 253 254 $template->pparse('body'); 255 256 include ("includes/page_tail.php"); 257 258 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Apr 1 11:11:59 2007 | par Balluche grâce à PHPXref 0.7 |