diff options
author | Paul S. Owen <psotfx@users.sourceforge.net> | 2003-03-18 22:47:50 +0000 |
---|---|---|
committer | Paul S. Owen <psotfx@users.sourceforge.net> | 2003-03-18 22:47:50 +0000 |
commit | eff4e2e818024407bd3838c1754681641b617d48 (patch) | |
tree | 2c3a85f65c4c55a281ad76b27a279042240bac7a /phpBB/memberlist.php | |
parent | 286f95c29305f3ec71dd2133c7c1277306ed6255 (diff) | |
download | forums-eff4e2e818024407bd3838c1754681641b617d48.tar forums-eff4e2e818024407bd3838c1754681641b617d48.tar.gz forums-eff4e2e818024407bd3838c1754681641b617d48.tar.bz2 forums-eff4e2e818024407bd3838c1754681641b617d48.tar.xz forums-eff4e2e818024407bd3838c1754681641b617d48.zip |
Update following move of post count incrementation checks to permissions
git-svn-id: file:///svn/phpbb/trunk@3672 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/memberlist.php')
-rw-r--r-- | phpBB/memberlist.php | 56 |
1 files changed, 37 insertions, 19 deletions
diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index e7a7c4abed..3951a378ea 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -109,12 +109,44 @@ switch ($mode) { $group_options .= '<option value="' . $row['group_id'] . '">' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>'; } + + // We left join on the session table to see if the user is currently online + $sql = "SELECT username, user_id, user_permissions, 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); + // Which forums does this user have an enabled post count? + // Really auth should be handling this capability ... + $post_count_sql = array(); + $auth2 = new auth(); + $auth2->acl($row); + + foreach ($auth2->acl['local'] as $forum => $auth_string) + { + if ($auth_string{$acl_options['local']['f_postcount']}) + { + $post_count_sql[] = $forum; + } + } + $post_count_sql = (sizeof($post_count_sql)) ? 'AND f.forum_id IN (' . implode(', ', $post_count_sql) . ')' : ''; + unset($auth2); + + // Grab all the relevant data $sql = "SELECT COUNT(p.post_id) AS num_posts FROM " . POSTS_TABLE . " p, " . FORUMS_TABLE . " f WHERE p.poster_id = $user_id - AND f.forum_id = p.forum_id - AND f.enable_post_count = 1"; + AND f.forum_id = p.forum_id + $post_count_sql"; $result = $db->sql_query($sql); $num_real_posts = min($row['user_posts'], $db->sql_fetchfield('num_posts', 0, $result)); @@ -124,11 +156,12 @@ switch ($mode) FROM " . POSTS_TABLE . " p, " . FORUMS_TABLE . " f WHERE p.poster_id = $user_id AND f.forum_id = p.forum_id - AND f.enable_post_count = 1 + $post_count_sql GROUP BY f.forum_id, f.forum_name ORDER BY num_posts DESC LIMIT 1"; $result = $db->sql_query($sql); +// AND f.forum_id NOT IN () $active_f_row = $db->sql_fetchrow($result); $db->sql_freeresult($result); @@ -138,7 +171,7 @@ switch ($mode) WHERE p.poster_id = $user_id AND t.topic_id = p.topic_id AND f.forum_id = t.forum_id - AND f.enable_post_count = 1 + $post_count_sql GROUP BY t.topic_id, t.topic_title ORDER BY num_posts DESC LIMIT 1"; @@ -147,21 +180,6 @@ switch ($mode) $active_t_row = $db->sql_fetchrow($result); $db->sql_freeresult($result); - // We left join on the session table to see if the user is currently online - $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; |