aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/usercp_viewprofile.php
diff options
context:
space:
mode:
authorPaul S. Owen <psotfx@users.sourceforge.net>2002-03-17 14:07:56 +0000
committerPaul S. Owen <psotfx@users.sourceforge.net>2002-03-17 14:07:56 +0000
commit9cc9bf0e9f389d829e1df4492a3f2cd3d3d90f2c (patch)
tree31823a8edd58570c0ab4e04903010a97c75a501e /phpBB/includes/usercp_viewprofile.php
parentb1a4782f9329f4028e1ee9a4aef81d88843d87b4 (diff)
downloadforums-9cc9bf0e9f389d829e1df4492a3f2cd3d3d90f2c.tar
forums-9cc9bf0e9f389d829e1df4492a3f2cd3d3d90f2c.tar.gz
forums-9cc9bf0e9f389d829e1df4492a3f2cd3d3d90f2c.tar.bz2
forums-9cc9bf0e9f389d829e1df4492a3f2cd3d3d90f2c.tar.xz
forums-9cc9bf0e9f389d829e1df4492a3f2cd3d3d90f2c.zip
First splits of profile
git-svn-id: file:///svn/phpbb/trunk@2302 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/usercp_viewprofile.php')
-rw-r--r--phpBB/includes/usercp_viewprofile.php233
1 files changed, 233 insertions, 0 deletions
diff --git a/phpBB/includes/usercp_viewprofile.php b/phpBB/includes/usercp_viewprofile.php
new file mode 100644
index 0000000000..0be6e5feef
--- /dev/null
+++ b/phpBB/includes/usercp_viewprofile.php
@@ -0,0 +1,233 @@
+<?php
+/***************************************************************************
+ * usercp_viewprofile.php
+ * -------------------
+ * begin : Saturday, Feb 13, 2001
+ * copyright : (C) 2001 The phpBB Group
+ * email : support@phpbb.com
+ *
+ * $Id$
+ *
+ *
+ ***************************************************************************/
+
+/***************************************************************************
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ *
+ ***************************************************************************/
+
+if ( !defined('IN_PROFILE') )
+{
+ header("Location: ../index.$phpEx");
+ exit;
+}
+
+if ( empty($HTTP_GET_VARS[POST_USERS_URL]) || $HTTP_GET_VARS[POST_USERS_URL] == ANONYMOUS )
+{
+ message_die(GENERAL_MESSAGE, $lang['No_user_id_specified']);
+}
+$profiledata = get_userdata(intval($HTTP_GET_VARS[POST_USERS_URL]));
+
+$sql = "SELECT *
+ FROM " . RANKS_TABLE . "
+ ORDER BY rank_special, rank_min";
+if ( !($result = $db->sql_query($sql)) )
+{
+ message_die(GENERAL_ERROR, 'Could not obtain ranks information', '', __LINE__, __FILE__, $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.tpl',
+ 'jumpbox' => 'jumpbox.tpl')
+);
+
+$jumpbox = make_jumpbox();
+$template->assign_vars(array(
+ 'L_GO' => $lang['Go'],
+ 'L_JUMP_TO' => $lang['Jump_to'],
+ 'L_SELECT_FORUM' => $lang['Select_forum'],
+
+ 'S_JUMPBOX_LIST' => $jumpbox,
+ 'S_JUMPBOX_ACTION' => append_sid("viewforum.$phpEx"))
+);
+$template->assign_var_from_handle('JUMPBOX', 'jumpbox');
+
+//
+// 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;
+}
+
+if ( !empty($profiledata['user_viewemail']) || $userdata['user_level'] == ADMIN )
+{
+ $email_uri = ( $board_config['board_email_form'] ) ? append_sid("profile.$phpEx?mode=email&amp;" . POST_USERS_URL . "=" . $profiledata['user_id']) : 'mailto:' . $profiledata['user_email'];
+
+ $email = '<a href="' . $email_uri . '">' . $lang['Send_email'] . '</a>';
+ $email_img = '<a href="' . $email_uri . '"><img src="' . $images['icon_email'] . '" alt="' . $lang['Send_email'] . '" border="0" /></a>';
+}
+else
+{
+ $email = '';
+ $email_img = '';
+}
+
+$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'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $profiledata['user_avatar'] . '" alt="" border="0" />' : '';
+ break;
+ case USER_AVATAR_REMOTE:
+ $avatar_img = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $profiledata['user_avatar'] . '" alt="" border="0" />' : '';
+ break;
+ case USER_AVATAR_GALLERY:
+ $avatar_img = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $profiledata['user_avatar'] . '" alt="" border="0" />' : '';
+ 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'] ) ? '<img src="' . $ranksrow[$i]['rank_image'] . '" alt="' . $poster_rank . '" title="' . $poster_rank . '" border="0" /><br />' : '';
+ }
+ }
+}
+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'] ) ? '<img src="' . $ranksrow[$i]['rank_image'] . '" alt="' . $poster_rank . '" title="' . $poster_rank . '" border="0" /><br />' : '';
+ }
+ }
+}
+
+if ( !empty($profiledata['user_icq']) )
+{
+ $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'] . '&amp;img=5" width="18" height="18" border="0" /></a>';
+ $icq_add_img = '<a href="http://wwp.icq.com/scripts/search.dll?to=' . $profiledata['user_icq'] . '"><img src="' . $images['icon_icq'] . '" alt="' . $lang['ICQ'] . '" border="0" /></a>';
+}
+else
+{
+ $icq_status_img = '&nbsp;';
+ $icq_add_img = '&nbsp;';
+}
+
+$aim_img = ( $profiledata['user_aim'] ) ? '<a href="aim:goim?screenname=' . $profiledata['user_aim'] . '&amp;message=Hello+Are+you+there?"><img src="' . $images['icon_aim'] . '" border="0" alt="' . $lang['AIM'] . '" /></a>' : '&nbsp;';
+
+$msnm_img = ( $profiledata['user_msnm'] ) ? '<img src="' . $images['icon_msnm'] . '" border="0" alt="' . $lang['MSNM'] . '" /> ' . $profiledata['user_msnm'] : '&nbsp;';
+
+$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'] . '" border="0" alt="' . $lang['YIM'] . '" /></a>' : '&nbsp;';
+
+$search_img = '<a href="' . append_sid("search.$phpEx?search_author=" . urlencode($profiledata['username']) . "&amp;showresults=posts") . '"><img src="' . $images['icon_search'] . '" border="0" alt="' . $lang['Search_user_posts'] . '" /></a>';
+$search = '<a href="' . append_sid("search.$phpEx?search_author=" . urlencode($profiledata['username']) . "&amp;showresults=posts") . '">' . $lang['Search_user_posts'] . '</a>';
+
+$www_img = ( $profiledata['user_website'] ) ? '<a href="' . $profiledata['user_website'] . '"><img src="' . $images['icon_www'] . '" alt="' . $lang['Visit_website'] . '" border="0" /></a>' : '&nbsp;';
+
+$pm_img = '<a href="' . append_sid("privmsg.$phpEx?mode=post&amp;" . POST_USERS_URL . "=" . $profiledata['user_id']) . '"><img src="' . $images['icon_pm'] . '" alt="' . $lang['Send_private_message'] . '" border="0" /></a>';
+
+//
+// Generate page
+//
+$page_title = $lang['Viewing_profile'];
+include($phpbb_root_path . 'includes/page_header.'.$phpEx);
+
+$template->assign_vars(array(
+ 'USERNAME' => $profiledata['username'],
+ 'JOINED' => create_date($lang['DATE_FORMAT'], $profiledata['user_regdate'], $board_config['board_timezone']),
+ 'POSTER_RANK' => $poster_rank,
+ 'RANK_IMAGE' => $rank_image,
+ 'POSTS_PER_DAY' => $posts_per_day,
+ 'POSTS' => $profiledata['user_posts'],
+ 'PERCENTAGE' => $percentage . '%',
+ 'POST_DAY_STATS' => sprintf($lang['User_post_day_stats'], $posts_per_day),
+ 'POST_PERCENT_STATS' => sprintf($lang['User_post_pct_stats'], $percentage),
+ 'EMAIL' => $email,
+ 'EMAIL_IMG' => $email_img,
+ 'PM_IMG' => $pm_img,
+ 'UL_SEARCH' => $search,
+ 'SEARCH_IMG' => $search_img,
+ 'ICQ' => ( $profiledata['user_icq'] ) ? $profiledata['user_icq'] : '&nbsp;',
+ 'ICQ_IMG' => ( $profiledata['user_icq'] ) ? $images['icon_icq'] : '&nbsp;',
+ 'ICQ_ADD_IMG' => $icq_add_img,
+ 'ICQ_STATUS_IMG' => $icq_status_img,
+ 'AIM' => ( $profiledata['user_aim'] ) ? '<a href="aim:goim?screenname=' . $profiledata['user_aim'] . '&amp;message=Hello+Are+you+there?">' . $profiledata['user_aim'] . '</a>' : '&nbsp;',
+ 'AIM_IMG' => $aim_img,
+ 'MSN' => ( $profiledata['user_msnm'] ) ? $profiledata['user_msnm'] : '&nbsp;',
+ 'MSN_IMG' => $msnm_img,
+ 'YIM' => ( $profiledata['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $profiledata['user_yim'] . '&amp;.src=pg">' . $profiledata['user_yim'] . '</a>' : '&nbsp;',
+ 'YIM_IMG' => $yim_img,
+ 'WEBSITE' => ( $profiledata['user_website'] ) ? '<a href="' . $profiledata['user_website'] . '" target="_phpbbwebsite">' . $profiledata['user_website'] . '</a>' : '&nbsp;',
+ 'WEBSITE_IMG' => $www_img,
+ 'LOCATION' => ( $profiledata['user_from'] ) ? $profiledata['user_from'] : '&nbsp;',
+ 'OCCUPATION' => ( $profiledata['user_occ'] ) ? $profiledata['user_occ'] : '&nbsp;',
+ 'INTERESTS' => ( $profiledata['user_interests'] ) ? $profiledata['user_interests'] : '&nbsp;',
+ 'AVATAR_IMG' => $avatar_img,
+
+ 'L_VIEWING_PROFILE' => sprintf($lang['Viewing_user_profile'], $profiledata['username']),
+ 'L_ABOUT_USER' => sprintf($lang['About_user'], $profiledata['username']),
+ 'L_AVATAR' => $lang['Avatar'],
+ 'L_POSTER_RANK' => $lang['Poster_rank'],
+ 'L_TOTAL_POSTS' => $lang['Total_posts'],
+ 'L_SEARCH_USER_POSTS' => sprintf($lang['Search_user_posts'], $profiledata['username']),
+ 'L_CONTACT' => $lang['Contact'],
+ 'L_EMAIL_ADDRESS' => $lang['Email_address'],
+ 'L_EMAIL' => $lang['Email'],
+ 'L_PM' => $lang['Private_Message'],
+ 'L_ICQ_NUMBER' => $lang['ICQ'],
+ 'L_YAHOO' => $lang['YIM'],
+ 'L_AIM' => $lang['AIM'],
+ 'L_MESSENGER' => $lang['MSNM'],
+ 'L_WEBSITE' => $lang['Website'],
+ 'L_LOCATION' => $lang['Location'],
+ 'L_OCCUPATION' => $lang['Occupation'],
+ 'L_INTERESTS' => $lang['Interests'],
+
+ 'U_SEARCH_USER' => append_sid("search.$phpEx?search_author=" . urlencode($profiledata['username'])),
+
+ 'S_PROFILE_ACTION' => append_sid("profile.$phpEx"))
+);
+
+$template->pparse('body');
+
+include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
+
+?> \ No newline at end of file