From 144f2e8d73bf6b0650c9b9e9e7c242bfab604d64 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 8 Jul 2009 20:36:57 +0000 Subject: [PATCH] Fix bug #47685 - Wrong count of posts awaiting approval in MCP Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9739 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/mcp.php | 15 ++++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 90bd9d7d34..f56b7e28c8 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -145,6 +145,7 @@
  • [Fix] Color bbcode now supports three-digit hex notation. (Bug #39965 - Patch by m0rpha)
  • [Fix] Search by authorname does not display posts of guests and deleted or deactivated users (Bug #36565, #47765 - Patch by nickvergessen)
  • [Fix] View end of ban in MCP and ACP when user is banned by duration (Bug #47815 - Patch by Pyramide)
  • +
  • [Fix] Wrong count of posts awaiting approval in MCP. (Bug #47685 - Patch by nickvergessen)
  • [Fix] Display user's posts count in private message when it is equal to 0 (prosilver). (Bug #40155 - Patch by rxu)
  • [Fix] Disable word-censor option in UCP lacks the config-setting (Bug #47575 - Patch by 00mohgta7)
  • [Fix] Fix database updater and db tools to support multiple column changes/additions/removals with SQLite
  • diff --git a/phpBB/mcp.php b/phpBB/mcp.php index 17e2f7f115..f5be1f1e9c 100644 --- a/phpBB/mcp.php +++ b/phpBB/mcp.php @@ -569,6 +569,9 @@ function get_forum_data($forum_id, $acl_list = 'f_list', $read_tracking = false) * sorting in mcp * * @param string $where_sql should either be WHERE (default if ommited) or end with AND or OR +* +* $mode reports and reports_closed: the $where parameters uses aliases p for posts table and r for report table +* $mode unapproved_posts: the $where parameters uses aliases p for posts table and t for topic table */ function mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql, &$sort_order_sql, &$total, $forum_id = 0, $topic_id = 0, $where_sql = 'WHERE') { @@ -616,12 +619,14 @@ function mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql, $type = 'posts'; $default_key = 't'; $default_dir = 'd'; - $where_sql .= ($topic_id) ? ' topic_id = ' . $topic_id . ' AND' : ''; + $where_sql .= ($topic_id) ? ' p.topic_id = ' . $topic_id . ' AND' : ''; - $sql = 'SELECT COUNT(post_id) AS total - FROM ' . POSTS_TABLE . " - $where_sql " . $db->sql_in_set('forum_id', ($forum_id) ? array($forum_id) : array_intersect(get_forum_list('f_read'), get_forum_list('m_approve'))) . ' - AND post_approved = 0'; + $sql = 'SELECT COUNT(p.post_id) AS total + FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . " t + $where_sql " . $db->sql_in_set('p.forum_id', ($forum_id) ? array($forum_id) : array_intersect(get_forum_list('f_read'), get_forum_list('m_approve'))) . ' + AND p.post_approved = 0 + AND t.topic_id = p.topic_id + AND t.topic_first_post_id <> p.post_id'; if ($min_time) {