Various additions and fixes

git-svn-id: file:///svn/phpbb/trunk@3628 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2003-03-10 17:48:08 +00:00
parent 12828d376e
commit c75d5d7bf3
6 changed files with 145 additions and 88 deletions

View file

@ -99,18 +99,25 @@ else
}
$sql = "SELECT group_name, group_colour
// Grab group details for legend display
$sql = "SELECT group_name, group_colour, group_type
FROM " . GROUPS_TABLE . "
WHERE group_colour <> ''";
$result = $db->sql_query($sql, 300);
WHERE group_colour <> ''
AND group_display = 1";
$result = $db->sql_query($sql, 120);
$legend = '';
while ($row = $db->sql_fetchrow($result))
{
$legend .= (($legend != '') ? ', ' : '') . '<span style="color:#' . $row['group_colour'] . '">' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</span>';
}
// Assign index specific vars
$template->assign_vars(array(
'TOTAL_POSTS' => sprintf($l_total_post_s, $total_posts),
'TOTAL_USERS' => sprintf($l_total_user_s, $total_users),
'NEWEST_USER' => sprintf($user->lang['Newest_user'], "<a href=\"memberlist.$phpEx$SID&amp;mode=viewprofile&amp;u=$newest_uid \">", $newest_user, '</a>'),
'TOTAL_POSTS' => sprintf($l_total_post_s, $total_posts),
'TOTAL_USERS' => sprintf($l_total_user_s, $total_users),
'NEWEST_USER' => sprintf($user->lang['Newest_user'], "<a href=\"memberlist.$phpEx$SID&amp;mode=viewprofile&amp;u=$newest_uid \">", $newest_user, '</a>'),
'LEGEND' => $legend,
'FORUM_IMG' => $user->img('forum', 'NO_NEW_POSTS'),
'FORUM_NEW_IMG' => $user->img('forum_new', 'NEW_POSTS'),
@ -119,7 +126,7 @@ $template->assign_vars(array(
'U_MARK_READ' => "index.$phpEx$SID&amp;mark=forums")
);
// Start output of page
// Output page
$page_title = $user->lang['Index'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);

View file

@ -156,7 +156,7 @@ $lang = array(
'You_new_pms' => 'New private messages are waiting for you in your Inbox',
'You_no_new_pm' => 'No new private messages are waiting for you',
'LEGEND' => 'Legend',
'RECORD_ONLINE_USERS' => 'Most users ever online was <b>%1$s</b> on %2$s',
'Registered_users' => 'Registered Users:',
'Browsing_forum_guest' => 'Users browsing this forum: %1$s and %2$d guest',
@ -193,6 +193,7 @@ $lang = array(
'NEW_POSTS_HOT' => 'New posts [ Popular ]',
'NO_NEW_POSTS_LOCKED' => 'No new posts [ Locked ]',
'NEW_POSTS_LOCKED' => 'New posts [ Locked ]',
'FORUM_LOCKED' => 'Forum Locked',
'POST_STICKY' => 'Sticky',
'POST_ANNOUNCEMENT' => 'Announcement',
@ -496,25 +497,6 @@ $lang = array(
'Savebox_size' => 'Your Savebox is %d%% full',
'Click_view_privmsg' => 'Click %sHere%s to visit your Inbox',
'NO_USER' => 'No user found',
'VIEWING_PROFILE' => 'Viewing profile of %s',
'ABOUT_USER' => 'Profile',
'CONTACT_USER' => 'Contact',
'USER_FORUM' => 'Forum statistics',
'USER_PRESENCE' => 'Forum presence',
'USER_POST' => '%d Post',
'USER_POSTS' => '%d Posts',
'POST_PCT' => '%.2f%% of all posts',
'POST_DAY' => '%.2f posts per day',
'TOTAL_POSTS' => 'Total posts',
'ACTIVE_IN_FORUM' => 'Most active forum',
'ACTIVE_IN_TOPIC' => 'Most active topic',
'SEARCH_USER_POSTS' => 'Search users posts',
'VISITED' => 'Last visited',
'Preferences' => 'Preferences',
'Items_required' => 'Items marked with a * are required unless stated otherwise',
'Registration_info' => 'Registration Information',
@ -627,40 +609,59 @@ $lang = array(
'Password_activated' => 'Your account has been re-activated. To logon please use the password supplied in the email you received',
'FIND_USERNAME' => 'Find a member',
'FIND_USERNAME_EXPLAIN' => 'Use this form to search for specific members. You do not need to fill out all fields, to partialy match data use * as a wildcard. When entering dates use the format yyyy-mm-dd, e.g. 2002-01-01. Click the username to automatically enter it into the form you are viewing (several usernames may be accepted depending on the form itself). Alternatively you can mark the users required and click the Insert Marked button.',
'NO_MEMBERS' => 'No members found for this search criteria',
'SEND_MESSAGE' => 'Message',
'POST_IP' => 'Posted from IP/domain',
'SELECT_SORT_METHOD' => 'Select sort method',
'SORT' => 'Sort',
'ORDER' => 'Order',
'SORT_JOINED' => 'Joined Date',
'SORT_USERNAME' => 'Username',
'SORT_LOCATION' => 'Location',
'SORT_POSTS' => 'Total posts',
'SORT_EMAIL' => 'Email',
'SORT_WEBSITE' => 'Website',
'SORT_ASCENDING' => 'Ascending',
'SORT_DESCENDING' => 'Descending',
'SORT_POST_COUNT' => 'Post count',
'SORT_LAST_ACTIVE' => 'Last active',
'LESS_THAN' => 'Less than',
'EQUAL_TO' => 'Equal to',
'MORE_THAN' => 'More than',
'BEFORE' => 'Before',
'AFTER' => 'After',
'NEVER' => 'Never',
'FIND_USERNAME' => 'Find a member',
'FIND_USERNAME_EXPLAIN' => 'Use this form to search for specific members. You do not need to fill out all fields. To match partial data use * as a wildcard. When entering dates use the format yyyy-mm-dd, e.g. 2002-01-01. Use the mark checkboxes to select one or more usernames (several usernames may be accepted depending on the form itself). Alternatively you can mark the users required and click the Insert Marked button.',
'NO_MEMBERS' => 'No members found for this search criteria',
'SEND_MESSAGE' => 'Message',
'POST_IP' => 'Posted from IP/domain',
'SELECT_SORT_METHOD'=> 'Select sort method',
'SORT' => 'Sort',
'ORDER' => 'Order',
'SORT_JOINED' => 'Joined Date',
'SORT_USERNAME' => 'Username',
'SORT_LOCATION' => 'Location',
'SORT_POSTS' => 'Total posts',
'SORT_EMAIL' => 'Email',
'SORT_WEBSITE' => 'Website',
'SORT_ASCENDING' => 'Ascending',
'SORT_DESCENDING' => 'Descending',
'SORT_POST_COUNT' => 'Post count',
'SORT_LAST_ACTIVE' => 'Last active',
'LESS_THAN' => 'Less than',
'EQUAL_TO' => 'Equal to',
'MORE_THAN' => 'More than',
'BEFORE' => 'Before',
'AFTER' => 'After',
'NEVER' => 'Never',
'SEND_EMAIL' => 'Send Email',
'NO_EMAIL' => 'You are not permitted to send email to this user.',
'CC_EMAIL' => 'Send a copy of this email to yourself',
'EMAIL_BODY_EXPLAIN' => 'This message will be sent as plain text, do not include any HTML or BBCode. The return address for this message will be set to your email address.',
'FLOOD_EMAIL_LIMIT' => 'You cannot send another email at this time. Please try again later.',
'RECIPIENT' => 'Recipient',
'EMAIL_SENT' => 'The email has been sent.',
'EMPTY_SUBJECT_EMAIL' => 'You must specify a subject for the email.',
'EMPTY_MESSAGE_EMAIL' => 'You must enter a message to be emailed.',
'SEND_EMAIL' => 'Send Email',
'NO_EMAIL' => 'You are not permitted to send email to this user.',
'CC_EMAIL' => 'Send a copy of this email to yourself',
'RECIPIENT' => 'Recipient',
'EMAIL_SENT' => 'The email has been sent.',
'EMAIL_BODY_EXPLAIN' => 'This message will be sent as plain text, do not include any HTML or BBCode. The return address for this message will be set to your email address.',
'FLOOD_EMAIL_LIMIT' => 'You cannot send another email at this time. Please try again later.',
'EMPTY_SUBJECT_EMAIL' => 'You must specify a subject for the email.',
'EMPTY_MESSAGE_EMAIL' => 'You must enter a message to be emailed.',
'NO_VIEW_USERS' => 'You are not authorised to view the member list or profiles.',
'VIEWING_PROFILE' => 'Viewing profile of %s',
'ABOUT_USER' => 'Profile',
'CONTACT_USER' => 'Contact',
'USER_FORUM' => 'Forum statistics',
'USER_PRESENCE' => 'Forum presence',
'VISITED' => 'Last visited',
'USER_POST' => '%d Post',
'USER_POSTS' => '%d Posts',
'POST_PCT' => '%.2f%% of all posts',
'POST_DAY' => '%.2f posts per day',
'TOTAL_POSTS' => 'Total posts',
'ACTIVE_IN_FORUM' => 'Most active forum',
'ACTIVE_IN_TOPIC' => 'Most active topic',
'SEARCH_USER_POSTS' => 'Search users posts',
'USER_ONLINE' => 'Online',
'USER_OFFLINE' => 'Offline',
'Group_Control_Panel' => 'Group Control Panel',

View file

@ -32,11 +32,10 @@ $user->setup();
$auth->acl($user->data);
// End session management
$redirect = $username = $password = '';
extract($_GET);
extract($_POST);
$redirect = (!empty($redirect)) ? $_SERVER['QUERY_STRING'] : '';
// Do the login/logout/form/whatever
if (isset($login) || isset($logout))
{
@ -72,12 +71,14 @@ if (isset($login) || isset($logout))
}
// Redirect to wherever we're supposed to go ...
$redirect_url = ($redirect) ? preg_replace('#^.*?redirect=(.*?)&(.*?)$#', '\1' . $SID . '&\2', $redirect) : 'index.'.$phpEx;
$redirect_url = (preg_match('#^redirect=(.*?)$#', $redirect)) ? preg_replace('#^redirect=(.*?)&(.*?)$#', '\1.' . $phpEx . $SID . '&\2', $redirect) : 'index.'.$phpEx . $SID;
redirect($redirect_url);
}
if ($user->data['user_id'] == ANONYMOUS)
{
$redirect = (!empty($_SERVER['QUERY_STRING'])) ? preg_replace('#^sid=[a-z0-9]*?&?(redirect=.*?)$#', '\1', $_SERVER['QUERY_STRING']) : '';
$template->assign_vars(array(
'U_SEND_PASSWORD' => "ucp.$phpEx$SID&amp;mode=sendpassword",
'U_TERMS_USE' => "ucp.$phpEx$SID&amp;mode=terms",

View file

@ -31,17 +31,21 @@ $auth->acl($user->data);
// End session management
// Can this user view profiles/memberslist?
if (!$auth->acl_gets('u_viewprofile', 'a_'))
{
trigger_error($user->lang['NO_VIEW']);
}
// Grab data
$mode = (isset($_REQUEST['mode'])) ? $_REQUEST['mode'] : '';
$user_id = (isset($_GET['u'])) ? intval($_GET['u']) : ANONYMOUS;
// Can this user view profiles/memberslist?
if (!$auth->acl_gets('u_viewprofile', 'a_'))
{
if ($user->data['user_id'] == ANONYMOUS)
{
redirect("login.$phpEx$SID&redirect=memberlist&mode=$mode&u=$user_id");
}
trigger_error($user->lang['NO_VIEW_USERS']);
}
$start = (isset($_GET['start'])) ? intval($_GET['start']) : 0;
$form = (!empty($_GET['form'])) ? $_GET['form'] : 0;
$field = (isset($_GET['field'])) ? $_GET['field'] : 'username';
@ -64,7 +68,6 @@ $active = (!empty($_REQUEST['active'])) ? explode('-', trim($_REQUEST['active'])
$count = (!empty($_REQUEST['count'])) ? intval($_REQUEST['count']) : '';
$ipdomain = (!empty($_REQUEST['ip'])) ? trim($_REQUEST['ip']) : '';
// Grab rank information for later
$sql = "SELECT *
FROM " . RANKS_TABLE . "
@ -92,17 +95,19 @@ switch ($mode)
}
// Do the SQL thang
$sql = "SELECT username, user_id, user_viewemail, user_posts, user_regdate, user_rank, user_from, user_occ, user_interests, user_website, user_email, user_icq, user_aim, user_yim, user_msnm, user_avatar, user_avatar_type, user_allowavatar, user_lastvisit
FROM " . USERS_TABLE . "
WHERE user_id = $user_id";
$sql = "SELECT g.group_id, g.group_name, g.group_type
FROM " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug
WHERE ug.user_id = $user_id
AND g.group_id = ug.group_id
ORDER BY group_type, group_name";
$result = $db->sql_query($sql);
if (!($row = $db->sql_fetchrow($result)))
$group_options = '';
while ($row = $db->sql_fetchrow($result))
{
trigger_error($user->lang['NO_USER']);
$group_options .= '<option value="' . $row['group_id'] . '">' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>';
}
$db->sql_freeresult($result);
$sql = "SELECT COUNT(p.post_id) AS num_posts
FROM " . POSTS_TABLE . " p, " . FORUMS_TABLE . " f
WHERE p.poster_id = $user_id
@ -140,6 +145,20 @@ switch ($mode)
$active_t_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$sql = "SELECT username, user_id, user_viewemail, user_posts, user_regdate, user_rank, user_from, user_occ, user_interests, user_website, user_email, user_icq, user_aim, user_yim, user_msnm, user_avatar, user_avatar_type, user_allowavatar, user_lastvisit, MAX(session_time) AS session_time
FROM " . USERS_TABLE . "
LEFT JOIN " . SESSIONS_TABLE . " ON session_user_id = user_id
WHERE user_id = $user_id
AND user_active = 1
GROUP BY username, user_id, user_viewemail, user_posts, user_regdate, user_rank, user_from, user_occ, user_interests, user_website, user_email, user_icq, user_aim, user_yim, user_msnm, user_avatar, user_avatar_type, user_allowavatar, user_lastvisit";
$result = $db->sql_query($sql);
if (!($row = $db->sql_fetchrow($result)))
{
trigger_error($user->lang['NO_USER']);
}
$db->sql_freeresult($result);
// Do the relevant calculations
$memberdays = max(1, round((time() - $row['user_regdate']) / 86400));
$posts_per_day = $row['user_posts'] / $memberdays;
@ -182,6 +201,9 @@ switch ($mode)
'OCCUPATION' => (!empty($row['user_occ'])) ? $row['user_occ'] : '',
'INTERESTS' => (!empty($row['user_interests'])) ? $row['user_interests'] : '',
'S_PROFILE_ACTION' => "groupcp.$phpEx$SID",
'S_GROUP_OPTIONS' => $group_options,
'U_ACTIVE_FORUM' => "viewforum.$phpEx$SID&amp;f=$active_f_id",
'U_ACTIVE_TOPIC' => "viewtopic.$phpEx$SID&amp;t=$active_t_id",)
);
@ -205,7 +227,8 @@ switch ($mode)
// Get the appropriate username, etc.
$sql = "SELECT username, user_email, user_viewemail, user_lang
FROM " . USERS_TABLE . "
WHERE user_id = $user_id";
WHERE user_id = $user_id
AND user_active = 1";
$result = $db->sql_query($sql);
if (!($row = $db->sql_fetchrow($result)))
@ -446,11 +469,25 @@ switch ($mode)
);
}
$sql = 'SELECT session_user_id, MAX(session_time) AS session_time
FROM ' . SESSIONS_TABLE . '
WHERE session_time >= ' . (time() - 300) . '
AND session_user_id <> ' . ANONYMOUS . '
GROUP BY session_user_id';
$result = $db->sql_query($sql);
$session_times = array();
while ($row = $db->sql_fetchrow($result))
{
$session_times[$row['session_user_id']] = $row['session_time'];
}
$db->sql_freeresult($result);
// Do the SQL thang
$sql = "SELECT username, user_id, user_viewemail, user_posts, user_regdate, user_rank, user_from, user_website, user_email, user_icq, user_aim, user_yim, user_msnm, user_avatar, user_avatar_type, user_allowavatar, user_lastvisit
FROM " . USERS_TABLE . "
WHERE user_id <> " . ANONYMOUS . "
ORDER BY $order_by
ORDER BY $order_by
LIMIT $start, " . $config['topics_per_page'];
$result = $db->sql_query($sql);
@ -459,6 +496,8 @@ switch ($mode)
$i = 0;
do
{
$row['session_time'] = (!empty($session_times[$row['user_id']])) ? $session_times[$row['user_id']] : '';
$template->assign_block_vars('memberrow', array_merge(show_profile($row), array(
'ROW_NUMBER' => $i + ($start + 1),
@ -610,7 +649,7 @@ function show_profile($data)
$template_vars = array(
'USERNAME' => $username,
'ONLINE_IMG' => ($data['user_lastvisit'] >= time() - 600) ? 'yes' : 'no',
'ONLINE_IMG' => (intval($data['session_time']) >= time() - 300) ? '' : '',
'AVATAR_IMG' => $poster_avatar,
'RANK_TITLE' => $rank_title,
@ -634,7 +673,9 @@ function show_profile($data)
'MSN_IMG' => $msn_img,
'MSN' => $msn,
'YIM_IMG' => $yim_img,
'YIM' => $yim
'YIM' => $yim,
'S_ONLINE' => (intval($data['session_time']) >= time() - 300) ? true : false
);
return $template_vars;

View file

@ -62,6 +62,11 @@
<td class="row1" width="46" rowspan="2" align="center" valign="middle"><img src="templates/subSilver/images/whosonline.gif" alt="{L_WHO_IS_ONLINE}" /></td>
<td class="row1" align="left"><span class="gensmall">{TOTAL_USERS_ONLINE}<br />{RECORD_USERS}<br /><br />{LOGGED_IN_USER_LIST}<br /><br />{L_ONLINE_EXPLAIN}</span></td>
</tr>
<!-- IF LEGEND neq '' -->
<tr>
<td class="row1"><b class="gensmall">{L_LEGEND} :: {LEGEND}</b></td>
</tr>
<!-- ENDIF -->
</table>
<!-- IF not S_USER_LOGGED_IN -->

View file

@ -1,6 +1,6 @@
<!-- INCLUDE overall_header.html -->
<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
<form method="post" action="{S_PROFILE_ACTION}"><table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
<tr>
<td align="left"><a class="nav" href="{U_INDEX}" class="nav">{L_INDEX}</a></td>
</tr>
@ -23,7 +23,7 @@
</tr>
<tr>
<td class="gen" align="right" valign="middle" nowrap="nowrap">{L_VISITED}: </td>
<td width="100%"><b class="gen">{VISITED}</b></td>
<td width="100%"><b class="gen">{VISITED} [ <!-- IF S_ONLINE --><span style="color:green">{L_USER_ONLINE}</span><!-- ELSE --><span style="color:red">{L_USER_OFFLINE}</span><!-- ENDIF --> ]</b></td>
</tr>
<tr>
<td class="gen" valign="top" align="right" nowrap="nowrap">{L_TOTAL_POSTS}: </td>
@ -78,6 +78,10 @@
</tr>
</table></td>
<td class="row1" valign="top"><table cellspacing="1" cellpadding="2" border="0">
<tr>
<td class="gen" valign="middle" align="right" nowrap="nowrap">{L_USERGROUPS}: </td>
<td><select name="g">{S_GROUP_OPTIONS}</select> <input class="liteoption" type="submit" name="submit" value="{L_GO}" /></td>
</tr>
<tr>
<td class="gen" valign="middle" align="right" nowrap="nowrap">{L_LOCATION}: </td>
<td><b class="gen">{LOCATION}</b></td>
@ -96,9 +100,7 @@
</tr>
</table></td>
</tr>
</table>
<br clear="all" />
</table></form>
<table width="100%" cellspacing="0" cellpadding="0" border="0" align="center">
<tr>