(file) Return to usercp_viewprofile.php CVS log (file) (dir) Up to [RizwankCVS] / geekymedia_web / phpBB2 / includes

  1 rizwank 1.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 2002/03/31 00:06:34 psotfx 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 rizwank 1.1  ***************************************************************************/
 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(intval($HTTP_GET_VARS[POST_USERS_URL]));
 35             
 36             $sql = "SELECT *
 37             	FROM " . RANKS_TABLE . "
 38             	ORDER BY rank_special, rank_min";
 39             if ( !($result = $db->sql_query($sql)) )
 40             {
 41             	message_die(GENERAL_ERROR, 'Could not obtain ranks information', '', __LINE__, __FILE__, $sql);
 42             }
 43 rizwank 1.1 
 44             while ( $row = $db->sql_fetchrow($result) )
 45             {
 46             	$ranksrow[] = $row;
 47             }
 48             $db->sql_freeresult($result);
 49             
 50             //
 51             // Output page header and profile_view template
 52             //
 53             $template->set_filenames(array(
 54             	'body' => 'profile_view_body.tpl')
 55             );
 56             make_jumpbox('viewforum.'.$phpEx);
 57             
 58             //
 59             // Calculate the number of days this user has been a member ($memberdays)
 60             // Then calculate their posts per day
 61             //
 62             $regdate = $profiledata['user_regdate'];
 63             $memberdays = max(1, round( ( time() - $regdate ) / 86400 ));
 64 rizwank 1.1 $posts_per_day = $profiledata['user_posts'] / $memberdays;
 65             
 66             // Get the users percentage of total posts
 67             if ( $profiledata['user_posts'] != 0  )
 68             {
 69             	$total_posts = get_db_stat('postcount');
 70             	$percentage = ( $total_posts ) ? min(100, ($profiledata['user_posts'] / $total_posts) * 100) : 0;
 71             }
 72             else
 73             {
 74             	$percentage = 0;
 75             }
 76             
 77             $avatar_img = '';
 78             if ( $profiledata['user_avatar_type'] && $profiledata['user_allowavatar'] )
 79             {
 80             	switch( $profiledata['user_avatar_type'] )
 81             	{
 82             		case USER_AVATAR_UPLOAD:
 83             			$avatar_img = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $profiledata['user_avatar'] . '" alt="" border="0" />' : '';
 84             			break;
 85 rizwank 1.1 		case USER_AVATAR_REMOTE:
 86             			$avatar_img = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $profiledata['user_avatar'] . '" alt="" border="0" />' : '';
 87             			break;
 88             		case USER_AVATAR_GALLERY:
 89             			$avatar_img = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $profiledata['user_avatar'] . '" alt="" border="0" />' : '';
 90             			break;
 91             	}
 92             }
 93             
 94             $poster_rank = '';
 95             $rank_image = '';
 96             if ( $profiledata['user_rank'] )
 97             {
 98             	for($i = 0; $i < count($ranksrow); $i++)
 99             	{
100             		if ( $profiledata['user_rank'] == $ranksrow[$i]['rank_id'] && $ranksrow[$i]['rank_special'] )
101             		{
102             			$poster_rank = $ranksrow[$i]['rank_title'];
103             			$rank_image = ( $ranksrow[$i]['rank_image'] ) ? '<img src="' . $ranksrow[$i]['rank_image'] . '" alt="' . $poster_rank . '" title="' . $poster_rank . '" border="0" /><br />' : '';
104             		}
105             	}
106 rizwank 1.1 }
107             else
108             {
109             	for($i = 0; $i < count($ranksrow); $i++)
110             	{
111             		if ( $profiledata['user_posts'] >= $ranksrow[$i]['rank_min'] && !$ranksrow[$i]['rank_special'] )
112             		{
113             			$poster_rank = $ranksrow[$i]['rank_title'];
114             			$rank_image = ( $ranksrow[$i]['rank_image'] ) ? '<img src="' . $ranksrow[$i]['rank_image'] . '" alt="' . $poster_rank . '" title="' . $poster_rank . '" border="0" /><br />' : '';
115             		}
116             	}
117             }
118             
119             $temp_url = append_sid("privmsg.$phpEx?mode=post&amp;" . POST_USERS_URL . "=" . $profiledata['user_id']);
120             $pm_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_pm'] . '" alt="' . $lang['Send_private_message'] . '" title="' . $lang['Send_private_message'] . '" border="0" /></a>';
121             $pm = '<a href="' . $temp_url . '">' . $lang['Send_private_message'] . '</a>';
122             
123             if ( !empty($profiledata['user_viewemail']) || $userdata['user_level'] == ADMIN )
124             {
125             	$email_uri = ( $board_config['board_email_form'] ) ? append_sid("profile.$phpEx?mode=email&amp;" . POST_USERS_URL .'=' . $profiledata['user_id']) : 'mailto:' . $profiledata['user_email'];
126             
127 rizwank 1.1 	$email_img = '<a href="' . $email_uri . '"><img src="' . $images['icon_email'] . '" alt="' . $lang['Send_email'] . '" title="' . $lang['Send_email'] . '" border="0" /></a>';
128             	$email = '<a href="' . $email_uri . '">' . $lang['Send_email'] . '</a>';
129             }
130             else
131             {
132             	$email_img = '&nbsp;';
133             	$email = '&nbsp;';
134             }
135             
136             $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>' : '&nbsp;';
137             $www = ( $profiledata['user_website'] ) ? '<a href="' . $profiledata['user_website'] . '" target="_userwww">' . $profiledata['user_website'] . '</a>' : '&nbsp;';
138             
139             if ( !empty($profiledata['user_icq']) )
140             {
141             	$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>';
142             	$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>';
143             	$icq =  '<a href="http://wwp.icq.com/scripts/search.dll?to=' . $profiledata['user_icq'] . '">' . $lang['ICQ'] . '</a>';
144             }
145             else
146             {
147             	$icq_status_img = '&nbsp;';
148 rizwank 1.1 	$icq_img = '&nbsp;';
149             	$icq = '&nbsp;';
150             }
151             
152             $aim_img = ( $profiledata['user_aim'] ) ? '<a href="aim:goim?screenname=' . $profiledata['user_aim'] . '&amp;message=Hello+Are+you+there?"><img src="' . $images['icon_aim'] . '" alt="' . $lang['AIM'] . '" title="' . $lang['AIM'] . '" border="0" /></a>' : '&nbsp;';
153             $aim = ( $profiledata['user_aim'] ) ? '<a href="aim:goim?screenname=' . $profiledata['user_aim'] . '&amp;message=Hello+Are+you+there?">' . $lang['AIM'] . '</a>' : '&nbsp;';
154             
155             $msn_img = ( $profiledata['user_msnm'] ) ? $profiledata['user_msnm'] : '&nbsp;';
156             $msn = $msn_img;
157             
158             $yim_img = ( $profiledata['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $profiledata['user_yim'] . '&amp;.src=pg"><img src="' . $images['icon_yim'] . '" alt="' . $lang['YIM'] . '" title="' . $lang['YIM'] . '" border="0" /></a>' : '';
159             $yim = ( $profiledata['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $profiledata['user_yim'] . '&amp;.src=pg">' . $lang['YIM'] . '</a>' : '';
160             
161             $temp_url = append_sid("search.$phpEx?search_author=" . urlencode($profiledata['username']) . "&amp;showresults=posts");
162             $search_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_search'] . '" alt="' . $lang['Search_user_posts'] . '" title="' . $lang['Search_user_posts'] . '" border="0" /></a>';
163             $search = '<a href="' . $temp_url . '">' . $lang['Search_user_posts'] . '</a>';
164             
165             //
166             // Generate page
167             //
168             $page_title = $lang['Viewing_profile'];
169 rizwank 1.1 include($phpbb_root_path . 'includes/page_header.'.$phpEx);
170             
171             $template->assign_vars(array(
172             	'USERNAME' => $profiledata['username'],
173             	'JOINED' => create_date($lang['DATE_FORMAT'], $profiledata['user_regdate'], $board_config['board_timezone']),
174             	'POSTER_RANK' => $poster_rank,
175             	'RANK_IMAGE' => $rank_image,
176             	'POSTS_PER_DAY' => $posts_per_day,
177             	'POSTS' => $profiledata['user_posts'],
178             	'PERCENTAGE' => $percentage . '%', 
179             	'POST_DAY_STATS' => sprintf($lang['User_post_day_stats'], $posts_per_day), 
180             	'POST_PERCENT_STATS' => sprintf($lang['User_post_pct_stats'], $percentage), 
181             
182             	'SEARCH_IMG' => $search_img,
183             	'SEARCH' => $search,
184             	'PM_IMG' => $pm_img,
185             	'PM' => $pm,
186             	'EMAIL_IMG' => $email_img,
187             	'EMAIL' => $email,
188             	'WWW_IMG' => $www_img,
189             	'WWW' => $www,
190 rizwank 1.1 	'ICQ_STATUS_IMG' => $icq_status_img,
191             	'ICQ_IMG' => $icq_img, 
192             	'ICQ' => $icq, 
193             	'AIM_IMG' => $aim_img,
194             	'AIM' => $aim,
195             	'MSN_IMG' => $msn_img,
196             	'MSN' => $msn,
197             	'YIM_IMG' => $yim_img,
198             	'YIM' => $yim,
199             
200             	'LOCATION' => ( $profiledata['user_from'] ) ? $profiledata['user_from'] : '&nbsp;',
201             	'OCCUPATION' => ( $profiledata['user_occ'] ) ? $profiledata['user_occ'] : '&nbsp;',
202             	'INTERESTS' => ( $profiledata['user_interests'] ) ? $profiledata['user_interests'] : '&nbsp;',
203             	'AVATAR_IMG' => $avatar_img,
204             
205             	'L_VIEWING_PROFILE' => sprintf($lang['Viewing_user_profile'], $profiledata['username']), 
206             	'L_ABOUT_USER' => sprintf($lang['About_user'], $profiledata['username']), 
207             	'L_AVATAR' => $lang['Avatar'], 
208             	'L_POSTER_RANK' => $lang['Poster_rank'], 
209             	'L_JOINED' => $lang['Joined'], 
210             	'L_TOTAL_POSTS' => $lang['Total_posts'], 
211 rizwank 1.1 	'L_SEARCH_USER_POSTS' => sprintf($lang['Search_user_posts'], $profiledata['username']), 
212             	'L_CONTACT' => $lang['Contact'],
213             	'L_EMAIL_ADDRESS' => $lang['Email_address'],
214             	'L_EMAIL' => $lang['Email'],
215             	'L_PM' => $lang['Private_Message'],
216             	'L_ICQ_NUMBER' => $lang['ICQ'],
217             	'L_YAHOO' => $lang['YIM'],
218             	'L_AIM' => $lang['AIM'],
219             	'L_MESSENGER' => $lang['MSNM'],
220             	'L_WEBSITE' => $lang['Website'],
221             	'L_LOCATION' => $lang['Location'],
222             	'L_OCCUPATION' => $lang['Occupation'],
223             	'L_INTERESTS' => $lang['Interests'],
224             
225             	'U_SEARCH_USER' => append_sid("search.$phpEx?search_author=" . urlencode($profiledata['username'])),
226             
227             	'S_PROFILE_ACTION' => append_sid("profile.$phpEx"))
228             );
229             
230             $template->pparse('body');
231             
232 rizwank 1.1 include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
233             
234             ?>

Rizwan Kassim
Powered by
ViewCVS 0.9.2