aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_display.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2006-09-22 22:14:05 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2006-09-22 22:14:05 +0000
commit1d7e3e0fd95fb5baf92937d1f911649cb1a665e9 (patch)
treee452132555a321548f9c61043354a2bfb9481ca0 /phpBB/includes/functions_display.php
parent587ec3fa77d90819148cdeda2b490bbf82632114 (diff)
downloadforums-1d7e3e0fd95fb5baf92937d1f911649cb1a665e9.tar
forums-1d7e3e0fd95fb5baf92937d1f911649cb1a665e9.tar.gz
forums-1d7e3e0fd95fb5baf92937d1f911649cb1a665e9.tar.bz2
forums-1d7e3e0fd95fb5baf92937d1f911649cb1a665e9.tar.xz
forums-1d7e3e0fd95fb5baf92937d1f911649cb1a665e9.zip
some tiny fixes here and there
git-svn-id: file:///svn/phpbb/trunk@6383 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions_display.php')
-rw-r--r--phpBB/includes/functions_display.php78
1 files changed, 23 insertions, 55 deletions
diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php
index 217befd5fa..2c82fda5ed 100644
--- a/phpBB/includes/functions_display.php
+++ b/phpBB/includes/functions_display.php
@@ -1018,24 +1018,11 @@ function display_user_activity(&$userdata)
global $auth, $template, $db, $user;
global $phpbb_root_path, $phpEx;
- // Init new auth class if user is different
- if ($user->data['user_id'] != $userdata['user_id'])
- {
- $auth2 = new auth();
- $auth2->acl($userdata);
-
- $post_count_ary = $auth2->acl_getf('!f_postcount');
- }
- else
- {
- $post_count_ary = $auth->acl_getf('!f_postcount');
- }
-
- $forum_read_ary = $auth->acl_getf('!f_read');
-
$forum_ary = array();
// Do not include those forums the user is not having read access to...
+ $forum_read_ary = $auth->acl_getf('!f_read');
+
foreach ($forum_read_ary as $forum_id => $not_allowed)
{
if ($not_allowed['f_read'])
@@ -1044,40 +1031,27 @@ function display_user_activity(&$userdata)
}
}
- // Now do not include those forums where the posts do not count...
- foreach ($post_count_ary as $forum_id => $not_counted)
- {
- if ($not_counted['f_postcount'])
- {
- $forum_ary[] = (int) $forum_id;
- }
- }
-
$forum_ary = array_unique($forum_ary);
- $post_count_sql = (sizeof($forum_ary)) ? 'AND ' . $db->sql_in_set('f.forum_id', $forum_ary, true) : '';
+ $forum_sql = (sizeof($forum_ary)) ? 'AND ' . $db->sql_in_set('forum_id', $forum_ary, true) : '';
+
+ // Obtain active forum
+ $sql = 'SELECT forum_id, COUNT(post_id) AS num_posts
+ FROM ' . POSTS_TABLE . '
+ WHERE poster_id = ' . $userdata['user_id'] . "
+ AND post_postcount = 1
+ $forum_sql
+ GROUP BY forum_id";
// Firebird does not support ORDER BY on aliased columns
// MySQL does not support ORDER BY on functions
switch (SQL_LAYER)
{
case 'firebird':
- $sql = 'SELECT f.forum_id, COUNT(p.post_id) AS num_posts
- FROM ' . POSTS_TABLE . ' p, ' . FORUMS_TABLE . ' f
- WHERE p.poster_id = ' . $userdata['user_id'] . "
- AND f.forum_id = p.forum_id
- $post_count_sql
- GROUP BY f.forum_id
- ORDER BY COUNT(p.post_id) DESC";
+ $sql .= ' ORDER BY COUNT(post_id) DESC';
break;
default:
- $sql = 'SELECT f.forum_id, COUNT(p.post_id) AS num_posts
- FROM ' . POSTS_TABLE . ' p, ' . FORUMS_TABLE . ' f
- WHERE p.poster_id = ' . $userdata['user_id'] . "
- AND f.forum_id = p.forum_id
- $post_count_sql
- GROUP BY f.forum_id
- ORDER BY num_posts DESC";
+ $sql .= ' ORDER BY num_posts DESC';
break;
}
@@ -1095,30 +1069,24 @@ function display_user_activity(&$userdata)
$db->sql_freeresult($result);
}
+ // Obtain active topic
+ $sql = 'SELECT topic_id, COUNT(post_id) AS num_posts
+ FROM ' . POSTS_TABLE . '
+ WHERE poster_id = ' . $userdata['user_id'] . "
+ AND post_postcount = 1
+ $forum_sql
+ GROUP BY topic_id";
+
// Firebird does not support ORDER BY on aliased columns
// MySQL does not support ORDER BY on functions
switch (SQL_LAYER)
{
case 'firebird':
- $sql = 'SELECT t.topic_id, COUNT(p.post_id) AS num_posts
- FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . ' f
- WHERE p.poster_id = ' . $userdata['user_id'] . "
- AND t.topic_id = p.topic_id
- AND f.forum_id = t.forum_id
- $post_count_sql
- GROUP BY t.topic_id
- ORDER BY COUNT(p.post_id) DESC";
+ $sql .= ' ORDER BY COUNT(post_id) DESC';
break;
default:
- $sql = 'SELECT t.topic_id, COUNT(p.post_id) AS num_posts
- FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . ' f
- WHERE p.poster_id = ' . $userdata['user_id'] . "
- AND t.topic_id = p.topic_id
- AND f.forum_id = t.forum_id
- $post_count_sql
- GROUP BY t.topic_id
- ORDER BY num_posts DESC";
+ $sql .= ' ORDER BY num_posts DESC';
break;
}