aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-09-17 20:02:19 +0200
committerJoas Schilling <nickvergessen@gmx.de>2014-09-17 20:02:19 +0200
commitd2e1c5c86607f4a07942512d55cceb2b37500a55 (patch)
tree1ae61af15190a82e56ab8bd6577e67078f789fd9
parentbf6ecccd250d4f1247c895153c7604826610dc72 (diff)
parent676f453cbde62e49c31888aebc02219958c131e4 (diff)
downloadforums-d2e1c5c86607f4a07942512d55cceb2b37500a55.tar
forums-d2e1c5c86607f4a07942512d55cceb2b37500a55.tar.gz
forums-d2e1c5c86607f4a07942512d55cceb2b37500a55.tar.bz2
forums-d2e1c5c86607f4a07942512d55cceb2b37500a55.tar.xz
forums-d2e1c5c86607f4a07942512d55cceb2b37500a55.zip
Merge branch 'develop-ascraeus' into develop
* develop-ascraeus: [ticket/13062] Add viewforum.php core event to modify topic ids sql query
-rw-r--r--phpBB/viewforum.php43
1 files changed, 38 insertions, 5 deletions
diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php
index d186d468df..a1e8c9814b 100644
--- a/phpBB/viewforum.php
+++ b/phpBB/viewforum.php
@@ -538,13 +538,46 @@ else
}
// Grab just the sorted topic ids
-$sql = 'SELECT t.topic_id
- FROM ' . TOPICS_TABLE . " t
- WHERE $sql_where
+$sql_ary = array(
+ 'SELECT' => 't.topic_id',
+ 'FROM' => array(
+ TOPICS_TABLE => 't',
+ ),
+ 'WHERE' => "$sql_where
AND t.topic_type IN (" . POST_NORMAL . ', ' . POST_STICKY . ")
$sql_approved
- $sql_limit_time
- ORDER BY t.topic_type " . ((!$store_reverse) ? 'DESC' : 'ASC') . ', ' . $sql_sort_order;
+ $sql_limit_time",
+ 'ORDER BY' => 't.topic_type ' . ((!$store_reverse) ? 'DESC' : 'ASC') . ', ' . $sql_sort_order,
+);
+
+/**
+* Event to modify the SQL query before the topic ids data is retrieved
+*
+* @event core.viewforum_get_topic_ids_data
+* @var array sql_ary SQL query array to get the topic ids data
+* @var string sql_approved Topic visibility SQL string
+* @var int sql_limit Number of records to select
+* @var string sql_limit_time SQL string to limit topic_last_post_time data
+* @var array sql_sort_order SQL sorting string
+* @var int sql_start Offset point to start selection from
+* @var string sql_where SQL WHERE clause string
+* @var bool store_reverse Flag indicating if we select from the late pages
+*
+* @since 3.1.0-RC4
+*/
+$vars = array(
+ 'sql_ary',
+ 'sql_approved',
+ 'sql_limit',
+ 'sql_limit_time',
+ 'sql_sort_order',
+ 'sql_start',
+ 'sql_where',
+ 'store_reverse',
+);
+extract($phpbb_dispatcher->trigger_event('core.viewforum_get_topic_ids_data', compact($vars)));
+
+$sql = $db->sql_build_query('SELECT', $sql_ary);
$result = $db->sql_query_limit($sql, $sql_limit, $sql_start);
while ($row = $db->sql_fetchrow($result))