From 5ad69bbecf49522734c340356f5d9e8303720a9c Mon Sep 17 00:00:00 2001 From: brunoais Date: Sun, 1 Mar 2015 19:55:43 +0000 Subject: [ticket/13664] From string query in mcp_front unapproved posts to built query PHPBB3-13664 --- phpBB/includes/mcp/mcp_front.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'phpBB/includes/mcp/mcp_front.php') diff --git a/phpBB/includes/mcp/mcp_front.php b/phpBB/includes/mcp/mcp_front.php index 500db55456..81960e5cd2 100644 --- a/phpBB/includes/mcp/mcp_front.php +++ b/phpBB/includes/mcp/mcp_front.php @@ -41,10 +41,15 @@ function mcp_front_view($id, $mode, $action) if (!empty($forum_list)) { - $sql = 'SELECT COUNT(post_id) AS total - FROM ' . POSTS_TABLE . ' - WHERE ' . $db->sql_in_set('forum_id', $forum_list) . ' - AND ' . $db->sql_in_set('post_visibility', array(ITEM_UNAPPROVED, ITEM_REAPPROVE)); + $sql_ary = array( + 'SELECT' => 'COUNT(post_id) AS total', + 'FROM' => array( + POSTS_TABLE => '', + ), + 'WHERE' => $db->sql_in_set('forum_id', $forum_list) . ' + AND ' . $db->sql_in_set('post_visibility', array(ITEM_UNAPPROVED, ITEM_REAPPROVE)) + ); + $sql = $db->sql_build_query('SELECT', $sql_ary); $result = $db->sql_query($sql); $total = (int) $db->sql_fetchfield('total'); $db->sql_freeresult($result); -- cgit v1.2.1 From 5fa6871ebf486eb70052c2e5a07b96d6b23d88c0 Mon Sep 17 00:00:00 2001 From: brunoais Date: Sun, 1 Mar 2015 19:56:50 +0000 Subject: [ticket/13664] Add event to allow changing number of unapproved posts listed PHPBB3-13664 --- phpBB/includes/mcp/mcp_front.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'phpBB/includes/mcp/mcp_front.php') diff --git a/phpBB/includes/mcp/mcp_front.php b/phpBB/includes/mcp/mcp_front.php index 81960e5cd2..41953a71e6 100644 --- a/phpBB/includes/mcp/mcp_front.php +++ b/phpBB/includes/mcp/mcp_front.php @@ -49,6 +49,18 @@ function mcp_front_view($id, $mode, $action) 'WHERE' => $db->sql_in_set('forum_id', $forum_list) . ' AND ' . $db->sql_in_set('post_visibility', array(ITEM_UNAPPROVED, ITEM_REAPPROVE)) ); + + /** + * Allow altering the query to get the number of unapproved posts + * + * @event core.mcp_front_queue_unapproved_total_before + * @var int sql_ary Query to get the total number of unapproved posts + * @var array forum_list List of forums to look for unapproved posts + * @since 3.1.4-RC1 + */ + $vars = array('sql_ary', 'forum_list'); + extract($phpbb_dispatcher->trigger_event('core.mcp_front_queue_unapproved_total_before', compact($vars))); + $sql = $db->sql_build_query('SELECT', $sql_ary); $result = $db->sql_query($sql); $total = (int) $db->sql_fetchfield('total'); -- cgit v1.2.1 From 21cc1fda8562dcb20f0d850da232d69281d6df51 Mon Sep 17 00:00:00 2001 From: brunoais Date: Sun, 1 Mar 2015 20:57:06 +0000 Subject: [ticket/13664] Added alias to table to make modding easier. PHPBB3-13664 --- phpBB/includes/mcp/mcp_front.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/includes/mcp/mcp_front.php') diff --git a/phpBB/includes/mcp/mcp_front.php b/phpBB/includes/mcp/mcp_front.php index 41953a71e6..4278511c01 100644 --- a/phpBB/includes/mcp/mcp_front.php +++ b/phpBB/includes/mcp/mcp_front.php @@ -44,10 +44,10 @@ function mcp_front_view($id, $mode, $action) $sql_ary = array( 'SELECT' => 'COUNT(post_id) AS total', 'FROM' => array( - POSTS_TABLE => '', + POSTS_TABLE => 'p', ), - 'WHERE' => $db->sql_in_set('forum_id', $forum_list) . ' - AND ' . $db->sql_in_set('post_visibility', array(ITEM_UNAPPROVED, ITEM_REAPPROVE)) + 'WHERE' => $db->sql_in_set('p.forum_id', $forum_list) . ' + AND ' . $db->sql_in_set('p.post_visibility', array(ITEM_UNAPPROVED, ITEM_REAPPROVE)) ); /** -- cgit v1.2.1 From 70cbe671051820f41a28023e320546665e2272ba Mon Sep 17 00:00:00 2001 From: brunoais Date: Wed, 6 May 2015 22:55:30 +0100 Subject: [ticket/13664] BUMP version to 3.1.5-dev PHPBB3-13664 --- phpBB/includes/mcp/mcp_front.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/mcp/mcp_front.php') diff --git a/phpBB/includes/mcp/mcp_front.php b/phpBB/includes/mcp/mcp_front.php index 4278511c01..9316961d52 100644 --- a/phpBB/includes/mcp/mcp_front.php +++ b/phpBB/includes/mcp/mcp_front.php @@ -56,7 +56,7 @@ function mcp_front_view($id, $mode, $action) * @event core.mcp_front_queue_unapproved_total_before * @var int sql_ary Query to get the total number of unapproved posts * @var array forum_list List of forums to look for unapproved posts - * @since 3.1.4-RC1 + * @since 3.1.5-RC1 */ $vars = array('sql_ary', 'forum_list'); extract($phpbb_dispatcher->trigger_event('core.mcp_front_queue_unapproved_total_before', compact($vars))); -- cgit v1.2.1