From 8e8fac17ff0cf9e07d5cf4aade37d85a1c767934 Mon Sep 17 00:00:00 2001 From: LaxSlash Date: Thu, 7 Jan 2016 15:36:10 -0500 Subject: [PATCH 1/7] [ticket/14395] Move call to phpbb_add_quickmod_option Moved the call to function phpbb_add_quickmod_option to being under the core event core.viewtopic_assign_template_vars_before so as to enable the modification of elements in the BEFORE they are assigned to the template, so that removed elements don't show up in a non-functional state. Allows the user to perform additional permissions checks on the items within the array. PHPBB3-14395 --- phpBB/viewtopic.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index fcc44abc33..6c762c58bb 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -588,14 +588,6 @@ $quickmod_array = array( 'topic_logs' => array('VIEW_TOPIC_LOGS', $auth->acl_get('m_', $forum_id)), ); -foreach ($quickmod_array as $option => $qm_ary) -{ - if (!empty($qm_ary[1])) - { - phpbb_add_quickmod_option($s_quickmod_action, $option, $qm_ary[0]); - } -} - // Navigation links generate_forum_nav($topic_data); @@ -667,6 +659,14 @@ $vars = array( ); extract($phpbb_dispatcher->trigger_event('core.viewtopic_assign_template_vars_before', compact($vars))); +foreach ($quickmod_array as $option => $qm_ary) +{ + if (!empty($qm_ary[1])) + { + phpbb_add_quickmod_option($s_quickmod_action, $option, $qm_ary[0]); + } +} + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_posts, $config['posts_per_page'], $start); // Send vars to template From e030f0ca0933957cc9c7156d43263d881ffc7895 Mon Sep 17 00:00:00 2001 From: LaxSlash Date: Fri, 8 Jan 2016 01:30:36 -0500 Subject: [PATCH 2/7] [ticket/14395] Add event core.viewtopic_add_quickmod_option_after Added an event before the function phpbb_add_quickmod_option is called in the viewtopic.php file. The function is run before any event can be called to modify ... meaning that any modifications done to this array will not affect the options displayed to the user on the viewtopic page itself. This event serves two purposes - one, it is easier to add new quickmod options, and two, it allows an extenstion developer to check additional permissions and apply further authentication for the display of the quickmod options. PHPBB3-14395 --- phpBB/viewtopic.php | 43 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 6c762c58bb..02e60fb8ff 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -588,6 +588,41 @@ $quickmod_array = array( 'topic_logs' => array('VIEW_TOPIC_LOGS', $auth->acl_get('m_', $forum_id)), ); +/** +* Event to modify data in the quickmod_array before it gets sent to the +* phpbb_add_quickmod_option function. +* +* @event core.viewtopic_add_quickmod_option_before +* @var int forum_id Forum ID +* @var int post_id Post ID +* @var array quickmod_array Array with quick moderation options data +* @var array topic_data Array with topic data +* @var int topic_id Topic ID +* @var array topic_tracking_info Array with topic tracking data +* @var string viewtopic_url URL to the topic page +* @var bool allow_change_type Topic change permissions check +* @since 3.1.8-RC1 +*/ +$vars = array( + 'forum_id', + 'post_id', + 'quickmod_array', + 'topic_data', + 'topic_id', + 'topic_tracking_info', + 'viewtopic_url', + 'allow_change_type', +); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_add_quickmod_option_after', compact($vars))); + +foreach ($quickmod_array as $option => $qm_ary) +{ + if (!empty($qm_ary[1])) + { + phpbb_add_quickmod_option($s_quickmod_action, $option, $qm_ary[0]); + } +} + // Navigation links generate_forum_nav($topic_data); @@ -659,14 +694,6 @@ $vars = array( ); extract($phpbb_dispatcher->trigger_event('core.viewtopic_assign_template_vars_before', compact($vars))); -foreach ($quickmod_array as $option => $qm_ary) -{ - if (!empty($qm_ary[1])) - { - phpbb_add_quickmod_option($s_quickmod_action, $option, $qm_ary[0]); - } -} - $pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_posts, $config['posts_per_page'], $start); // Send vars to template From 5f052ec8dced757047f9cdf40c85f9d92d698410 Mon Sep 17 00:00:00 2001 From: LaxSlash Date: Fri, 8 Jan 2016 02:17:41 -0500 Subject: [PATCH 3/7] [ticket/14395] Add event core.viewtopic_add_quickmod_option_after Added an event before the function phpbb_add_quickmod_option is called in the viewtopic.php file. The function is run before any event can be called to modify ... meaning that any modifications done to this array will not affect the options displayed to the user on the viewtopic page itself. This event serves two purposes - one, it is easier to add new quickmod options, and two, it allows an extenstion developer to check additional permissions and apply further authentication for the display of the quickmod options. PHPBB3-14395 --- phpBB/viewtopic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 02e60fb8ff..682ed91b36 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -592,7 +592,7 @@ $quickmod_array = array( * Event to modify data in the quickmod_array before it gets sent to the * phpbb_add_quickmod_option function. * -* @event core.viewtopic_add_quickmod_option_before +* @event core.viewtopic_add_quickmod_option_after * @var int forum_id Forum ID * @var int post_id Post ID * @var array quickmod_array Array with quick moderation options data From 575468931fa9e3cd9d6c7ad84167a628bff738c2 Mon Sep 17 00:00:00 2001 From: LaxSlash Date: Fri, 8 Jan 2016 02:44:58 -0500 Subject: [PATCH 4/7] [ticket/14395] Add event core.viewtopic_add_quickmod_option_after Added an event before the function phpbb_add_quickmod_option is called in the viewtopic.php file. The function is run before any event can be called to modify ... meaning that any modifications done to this array will not affect the options displayed to the user on the viewtopic page itself. This event serves two purposes - one, it is easier to add new quickmod options, and two, it allows an extenstion developer to check additional permissions and apply further authentication for the display of the quickmod options. PHPBB3-14395 --- phpBB/viewtopic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 682ed91b36..73c8e33b7f 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -611,7 +611,7 @@ $vars = array( 'topic_id', 'topic_tracking_info', 'viewtopic_url', - 'allow_change_type', + 'allow_change_type', ); extract($phpbb_dispatcher->trigger_event('core.viewtopic_add_quickmod_option_after', compact($vars))); From 8a8428d002eb91330b08e8531b2a9aac51374c32 Mon Sep 17 00:00:00 2001 From: LaxSlash Date: Tue, 22 Mar 2016 19:29:33 -0400 Subject: [PATCH 5/7] [ticket/14395] core.viewtopic_add_quickmod_option_before Added an event before the function phpbb_add_quickmod_option is called in the viewtopic.php file. This event serves two purposes - one, it is easier to add new quickmod options, and two, it allows an extenstion developer to check additional permissions and apply further authentication for the display of the quickmod options. PHPBB3-14395 --- phpBB/viewtopic.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 73c8e33b7f..757c158baa 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -592,7 +592,7 @@ $quickmod_array = array( * Event to modify data in the quickmod_array before it gets sent to the * phpbb_add_quickmod_option function. * -* @event core.viewtopic_add_quickmod_option_after +* @event core.viewtopic_add_quickmod_option_before * @var int forum_id Forum ID * @var int post_id Post ID * @var array quickmod_array Array with quick moderation options data @@ -601,7 +601,7 @@ $quickmod_array = array( * @var array topic_tracking_info Array with topic tracking data * @var string viewtopic_url URL to the topic page * @var bool allow_change_type Topic change permissions check -* @since 3.1.8-RC1 +* @since 3.1.9-RC1 */ $vars = array( 'forum_id', @@ -613,7 +613,7 @@ $vars = array( 'viewtopic_url', 'allow_change_type', ); -extract($phpbb_dispatcher->trigger_event('core.viewtopic_add_quickmod_option_after', compact($vars))); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_add_quickmod_option_before', compact($vars))); foreach ($quickmod_array as $option => $qm_ary) { From a18c59317f97ff8039250c745660b0df56830dbd Mon Sep 17 00:00:00 2001 From: LaxSlash Date: Wed, 23 Mar 2016 14:57:18 -0400 Subject: [PATCH 6/7] [ticket/14395] core.viewtopic_add_quickmod_option_before Added an event before the function phpbb_add_quickmod_option is called in the viewtopic.php file. This event serves two purposes - one, it is easier to add new quickmod options, and two, it allows an extenstion developer to check additional permissions and apply further authentication for the display of the quickmod options. PHPBB3-14395 --- phpBB/viewtopic.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 757c158baa..65aaaa7d87 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -593,14 +593,14 @@ $quickmod_array = array( * phpbb_add_quickmod_option function. * * @event core.viewtopic_add_quickmod_option_before -* @var int forum_id Forum ID -* @var int post_id Post ID -* @var array quickmod_array Array with quick moderation options data -* @var array topic_data Array with topic data -* @var int topic_id Topic ID -* @var array topic_tracking_info Array with topic tracking data -* @var string viewtopic_url URL to the topic page -* @var bool allow_change_type Topic change permissions check +* @var int forum_id Forum ID +* @var int post_id Post ID +* @var array quickmod_array Array with quick moderation options data +* @var array topic_data Array with topic data +* @var int topic_id Topic ID +* @var array topic_tracking_info Array with topic tracking data +* @var string viewtopic_url URL to the topic page +* @var bool allow_change_type Topic change permissions check * @since 3.1.9-RC1 */ $vars = array( From 8f396673fed76de9126bfbdd67a3b9bd02ef9449 Mon Sep 17 00:00:00 2001 From: LaxSlash Date: Wed, 23 Mar 2016 20:11:20 -0400 Subject: [PATCH 7/7] [ticket/14395] core.viewtopic_add_quickmod_option_before Added an event before the function phpbb_add_quickmod_option is called in the viewtopic.php file. This event serves two purposes - one, it is easier to add new quickmod options, and two, it allows an extenstion developer to check additional permissions and apply further authentication for the display of the quickmod options. PHPBB3-14395 --- phpBB/viewtopic.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 65aaaa7d87..eeb6444ceb 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -593,14 +593,14 @@ $quickmod_array = array( * phpbb_add_quickmod_option function. * * @event core.viewtopic_add_quickmod_option_before -* @var int forum_id Forum ID -* @var int post_id Post ID -* @var array quickmod_array Array with quick moderation options data -* @var array topic_data Array with topic data -* @var int topic_id Topic ID -* @var array topic_tracking_info Array with topic tracking data -* @var string viewtopic_url URL to the topic page -* @var bool allow_change_type Topic change permissions check +* @var int forum_id Forum ID +* @var int post_id Post ID +* @var array quickmod_array Array with quick moderation options data +* @var array topic_data Array with topic data +* @var int topic_id Topic ID +* @var array topic_tracking_info Array with topic tracking data +* @var string viewtopic_url URL to the topic page +* @var bool allow_change_type Topic change permissions check * @since 3.1.9-RC1 */ $vars = array(