From 1dbb5702847833653128e829d8bcfb79968067be Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Mon, 8 Jul 2019 09:00:30 +0200 Subject: [PATCH 1/2] [ticket/16097] Add core.viewtopic_gen_sort_selects_before PHPBB3-16097 --- phpBB/viewtopic.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index eb2d52cf61..57c9bc9f6a 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -453,6 +453,38 @@ $join_user_sql = array('a' => true, 't' => false, 's' => false); $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; +/** +* Event to add new sorting options +* +* @event core.viewtopic_gen_sort_selects_before +* @var array limit_days Limit results by time +* @var array sort_by_text Language strings for sorting options +* @var array sort_by_sql SQL conditions for sorting options +* @var array join_user_sql SQL joins required for sorting options +* @var string sort_days User selected sort days +* @var string sort_key User selected sort key +* @var string sort_dir User selected sort direction +* @var string s_limit_days Initial value of limit days selectbox +* @var string s_sort_key Initial value of sort key selectbox +* @var string s_sort_dir Initial value of sort direction selectbox +* @var string u_sort_param Initial value of sorting form action +* @since 3.2.8-RC1 +*/ +$vars = array( + 'limit_days', + 'sort_by_text', + 'sort_by_sql', + 'join_user_sql', + 'sort_days', + 'sort_key', + 'sort_dir', + 's_limit_days', + 's_sort_key', + 's_sort_dir', + 'u_sort_param', +); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_gen_sort_selects_before', compact($vars))); + gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param, $default_sort_days, $default_sort_key, $default_sort_dir); // Obtain correct post count and ordering SQL if user has From cd6a0026d51f9f862228e45765c84fc151607125 Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Mon, 29 Jul 2019 08:22:19 +0200 Subject: [PATCH 2/2] [ticket/16097] Correctly classify sort_days as int PHPBB3-16097 --- phpBB/viewtopic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 57c9bc9f6a..0c2be8c52e 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -461,7 +461,7 @@ $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; * @var array sort_by_text Language strings for sorting options * @var array sort_by_sql SQL conditions for sorting options * @var array join_user_sql SQL joins required for sorting options -* @var string sort_days User selected sort days +* @var int sort_days User selected sort days * @var string sort_key User selected sort key * @var string sort_dir User selected sort direction * @var string s_limit_days Initial value of limit days selectbox