aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/config/services.yml1
-rw-r--r--phpBB/docs/events.md64
-rw-r--r--phpBB/includes/functions.php12
-rw-r--r--phpBB/includes/functions_content.php30
-rw-r--r--phpBB/includes/functions_display.php22
-rw-r--r--phpBB/includes/functions_download.php2
-rw-r--r--phpBB/includes/mcp/mcp_ban.php16
-rw-r--r--phpBB/includes/mcp/mcp_queue.php4
-rw-r--r--phpBB/includes/ucp/ucp_pm_compose.php73
-rw-r--r--phpBB/phpbb/console/command/db/migrate.php2
-rw-r--r--phpBB/phpbb/db/migration/data/v310/notifications_use_full_name.php78
-rw-r--r--phpBB/phpbb/pagination.php46
-rw-r--r--phpBB/posting.php106
-rw-r--r--phpBB/styles/prosilver/template/viewforum_body.html12
-rw-r--r--phpBB/styles/prosilver/template/viewtopic_body.html8
-rw-r--r--phpBB/styles/subsilver2/template/viewforum_body.html18
-rw-r--r--phpBB/styles/subsilver2/template/viewtopic_body.html8
-rw-r--r--tests/mock/event_dispatcher.php13
-rw-r--r--tests/pagination/pagination_test.php4
19 files changed, 493 insertions, 26 deletions
diff --git a/phpBB/config/services.yml b/phpBB/config/services.yml
index cca655263f..d32b665039 100644
--- a/phpBB/config/services.yml
+++ b/phpBB/config/services.yml
@@ -288,6 +288,7 @@ services:
- @template
- @user
- @controller.helper
+ - @dispatcher
path_helper:
class: phpbb\path_helper
diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md
index dae3bce977..c51bc72160 100644
--- a/phpBB/docs/events.md
+++ b/phpBB/docs/events.md
@@ -1155,6 +1155,70 @@ ucp_friend_list_after
* Since: 3.1.0-a4
* Purpose: Add optional elements after list of friends in UCP
+viewforum_buttons_bottom_before
+===
+* Locations:
+ + styles/prosilver/template/viewforum_body.html
+ + styles/subsilver2/template/viewforum_body.html
+* Since: 3.1.0-RC5
+* Purpose: Add buttons before New Topic button on the bottom of the topic's list
+
+viewforum_buttons_bottom_after
+===
+* Locations:
+ + styles/prosilver/template/viewforum_body.html
+ + styles/subsilver2/template/viewforum_body.html
+* Since: 3.1.0-RC5
+* Purpose: Add buttons after New Topic button on the bottom of the topic's list
+
+viewforum_buttons_top_before
+===
+* Locations:
+ + styles/prosilver/template/viewforum_body.html
+ + styles/subsilver2/template/viewforum_body.html
+* Since: 3.1.0-RC5
+* Purpose: Add buttons before New Topic button on the top of the topic's list
+
+viewforum_buttons_top_after
+===
+* Locations:
+ + styles/prosilver/template/viewforum_body.html
+ + styles/subsilver2/template/viewforum_body.html
+* Since: 3.1.0-RC5
+* Purpose: Add buttons after New Topic button on the top of the topic's list
+
+viewtopic_buttons_bottom_before
+===
+* Locations:
+ + styles/prosilver/template/viewtopic_body.html
+ + styles/subsilver2/template/viewtopic_body.html
+* Since: 3.1.0-RC5
+* Purpose: Add buttons before Post Reply button on the bottom of the posts's list
+
+viewtopic_buttons_bottom_after
+===
+* Locations:
+ + styles/prosilver/template/viewtopic_body.html
+ + styles/subsilver2/template/viewtopic_body.html
+* Since: 3.1.0-RC5
+* Purpose: Add buttons after Post Reply button on the bottom of the posts's list
+
+viewtopic_buttons_top_before
+===
+* Locations:
+ + styles/prosilver/template/viewtopic_body.html
+ + styles/subsilver2/template/viewtopic_body.html
+* Since: 3.1.0-RC5
+* Purpose: Add buttons before Post Reply button on the top of the posts's list
+
+viewtopic_buttons_top_after
+===
+* Locations:
+ + styles/prosilver/template/viewtopic_body.html
+ + styles/subsilver2/template/viewtopic_body.html
+* Since: 3.1.0-RC5
+* Purpose: Add buttons after Post Reply button on the top of the posts's list
+
viewforum_forum_name_append
===
* Locations:
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index a502314ded..7700dcfd27 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -5290,6 +5290,18 @@ function page_footer($run_cron = true, $display_template = true, $exit_handler =
}
}
+ /**
+ * Execute code and/or modify output before displaying the template.
+ *
+ * @event core.page_footer_after
+ * @var bool display_template Whether or not to display the template
+ * @var bool exit_handler Whether or not to run the exit_handler()
+ *
+ * @since 3.1.0-RC5
+ */
+ $vars = array('display_template', 'exit_handler');
+ extract($phpbb_dispatcher->trigger_event('core.page_footer_after', compact($vars)));
+
if ($display_template)
{
$template->display('body');
diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php
index f275ed1dd1..25ca50e8f1 100644
--- a/phpBB/includes/functions_content.php
+++ b/phpBB/includes/functions_content.php
@@ -912,7 +912,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,
return;
}
- global $template, $cache, $user;
+ global $template, $cache, $user, $phpbb_dispatcher;
global $extensions, $config, $phpbb_root_path, $phpEx;
//
@@ -1187,6 +1187,34 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,
);
}
+ /**
+ * Use this event to modify the attachment template data.
+ *
+ * This event is triggered once per attachment.
+ *
+ * @event core.parse_attachments_modify_template_data
+ * @var array attachment Array with attachment data
+ * @var array block_array Template data of the attachment
+ * @var int display_cat Attachment category data
+ * @var string download_link Attachment download link
+ * @var array extensions Array with attachment extensions data
+ * @var mixed forum_id The forum id the attachments are displayed in (false if in private message)
+ * @var bool preview Flag indicating if we are in post preview mode
+ * @var array update_count Array with attachment ids to update download count
+ * @since 3.1.0-RC5
+ */
+ $vars = array(
+ 'attachment',
+ 'block_array',
+ 'display_cat',
+ 'download_link',
+ 'extensions',
+ 'forum_id',
+ 'preview',
+ 'update_count',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.parse_attachments_modify_template_data', compact($vars)));
+
$template->assign_block_vars('_file', $block_array);
$compiled_attachments[] = $template->assign_display('attachment_tpl');
diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php
index 77447c62f6..745eb20c77 100644
--- a/phpBB/includes/functions_display.php
+++ b/phpBB/includes/functions_display.php
@@ -649,6 +649,28 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
'UNAPPROVED_POST_IMG' => $user->img('icon_topic_unapproved', 'POSTS_UNAPPROVED_FORUM'),
));
+ /**
+ * Event to perform additional actions after the forum list has been generated
+ *
+ * @event core.display_forums_after
+ * @var array active_forum_ary Array with forum data to display active topics
+ * @var bool display_moderators Flag indicating if we display forum moderators
+ * @var array forum_moderators Array with forum moderators list
+ * @var array forum_rows Data array of all forums we display
+ * @var bool return_moderators Flag indicating if moderators list should be returned
+ * @var array root_data Array with the root forum data
+ * @since 3.1.0-RC5
+ */
+ $vars = array(
+ 'active_forum_ary',
+ 'display_moderators',
+ 'forum_moderators',
+ 'forum_rows',
+ 'return_moderators',
+ 'root_data',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.display_forums_after', compact($vars)));
+
if ($return_moderators)
{
return array($active_forum_ary, $forum_moderators);
diff --git a/phpBB/includes/functions_download.php b/phpBB/includes/functions_download.php
index 704939b176..fbeae50f55 100644
--- a/phpBB/includes/functions_download.php
+++ b/phpBB/includes/functions_download.php
@@ -50,7 +50,7 @@ function send_avatar_to_browser($file, $browser)
$image_data = @getimagesize($file_path);
header('Content-Type: ' . image_type_to_mime_type($image_data[2]));
- if ((strpos(strtolower($user->browser), 'msie') !== false) && !phpbb_is_greater_ie_version($browser, 7))
+ if ((strpos(strtolower($browser), 'msie') !== false) && !phpbb_is_greater_ie_version($browser, 7))
{
header('Content-Disposition: attachment; ' . header_filename($file));
diff --git a/phpBB/includes/mcp/mcp_ban.php b/phpBB/includes/mcp/mcp_ban.php
index 1eb79ea29e..4d2151fded 100644
--- a/phpBB/includes/mcp/mcp_ban.php
+++ b/phpBB/includes/mcp/mcp_ban.php
@@ -39,6 +39,22 @@ class mcp_ban
$user->add_lang(array('acp/ban', 'acp/users'));
$this->tpl_name = 'mcp_ban';
+ /**
+ * Use this event to pass perform actions when a ban is issued or revoked
+ *
+ * @event core.mcp_ban_main
+ * @var bool bansubmit True if a ban is issued
+ * @var bool unbansubmit True if a ban is removed
+ * @var string mode Mode of the ban that is being worked on
+ * @since 3.1.0-RC5
+ */
+ $vars = array(
+ 'bansubmit',
+ 'unbansubmit',
+ 'mode',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.mcp_ban_main', compact($vars)));
+
// Ban submitted?
if ($bansubmit)
{
diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php
index bfd30a5be2..f9c00da3ec 100644
--- a/phpBB/includes/mcp/mcp_queue.php
+++ b/phpBB/includes/mcp/mcp_queue.php
@@ -745,11 +745,11 @@ class mcp_queue
if (!$post_data['topic_posts_approved'])
{
- $phpbb_notifications->add_notifications('notification.type.approve_post', $post_data);
+ $phpbb_notifications->add_notifications('notification.type.approve_topic', $post_data);
}
else
{
- $phpbb_notifications->add_notifications('notification.type.approve_topic', $post_data);
+ $phpbb_notifications->add_notifications('notification.type.approve_post', $post_data);
}
}
}
diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php
index 01c2041f42..f3b59186a6 100644
--- a/phpBB/includes/ucp/ucp_pm_compose.php
+++ b/phpBB/includes/ucp/ucp_pm_compose.php
@@ -27,8 +27,7 @@ function compose_pm($id, $mode, $action, $user_folders = array())
{
global $template, $db, $auth, $user, $cache;
global $phpbb_root_path, $phpEx, $config;
- global $request;
- global $phpbb_container;
+ global $request, $phpbb_dispatcher, $phpbb_container;
// Damn php and globals - i know, this is horrible
// Needed for handle_message_list_actions()
@@ -233,6 +232,42 @@ function compose_pm($id, $mode, $action, $user_folders = array())
if ($sql)
{
+ /**
+ * Alter sql query to get message for user to write the PM
+ *
+ * @event core.ucp_pm_compose_compose_pm_basic_info_query_before
+ * @var string sql String with the query to be executed
+ * @var array forum_list List of forums that contain the posts
+ * @var int visibility_const Integer with one of the possible ITEM_* constant values
+ * @var int msg_id topic_id in the page request
+ * @var int to_user_id The id of whom the message is to
+ * @var int to_group_id The id of the group whom the message is to
+ * @var bool submit Whether the user is sending the PM or not
+ * @var bool preview Whether the user is previewing the PM or not
+ * @var string action One of: post, reply, quote, forward, quotepost, edit, delete, smilies
+ * @var bool delete Whether the user is deleting the PM
+ * @var int reply_to_all Value of reply_to_all request variable.
+ * @var string limit_time_sql String with the SQL code to limit the time interval of the post (Note: May be empty string)
+ * @var string sort_order_sql String with the ORDER BY SQL code used in this query
+ * @since 3.1.0-RC5
+ */
+ $vars = array(
+ 'sql',
+ 'forum_list',
+ 'visibility_const',
+ 'msg_id',
+ 'to_user_id',
+ 'to_group_id',
+ 'submit',
+ 'preview',
+ 'action',
+ 'delete',
+ 'reply_to_all',
+ 'limit_time_sql',
+ 'sort_order_sql',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.ucp_pm_compose_compose_pm_basic_info_query_before', compact($vars)));
+
$result = $db->sql_query($sql);
$post = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
@@ -267,6 +302,40 @@ function compose_pm($id, $mode, $action, $user_folders = array())
trigger_error('NOT_AUTHORISED');
}
+ /**
+ * Get the result of querying for the post to be quoted in the pm message
+ *
+ * @event core.ucp_pm_compose_quotepost_query_after
+ * @var string sql The original SQL used in the query
+ * @var array post Associative array with the data of the quoted post
+ * @var array msg_id The post_id that was searched to get the message for quoting
+ * @var int visibility_const Visibility of the quoted post (one of the possible ITEM_* constant values)
+ * @var int topic_id Topic ID of the quoted post
+ * @var int to_user_id Users the message is sent to
+ * @var int to_group_id Groups the message is sent to
+ * @var bool submit Whether the user is sending the PM or not
+ * @var bool preview Whether the user is previewing the PM or not
+ * @var string action One of: post, reply, quote, forward, quotepost, edit, delete, smilies
+ * @var bool delete If deleting message
+ * @var int reply_to_all Value of reply_to_all request variable.
+ * @since 3.1.0-RC5
+ */
+ $vars = array(
+ 'sql',
+ 'post',
+ 'msg_id',
+ 'visibility_const',
+ 'topic_id',
+ 'to_user_id',
+ 'to_group_id',
+ 'submit',
+ 'preview',
+ 'action',
+ 'delete',
+ 'reply_to_all',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.ucp_pm_compose_quotepost_query_after', compact($vars)));
+
// Passworded forum?
if ($post['forum_id'])
{
diff --git a/phpBB/phpbb/console/command/db/migrate.php b/phpBB/phpbb/console/command/db/migrate.php
index 86545c237d..c760cde5b5 100644
--- a/phpBB/phpbb/console/command/db/migrate.php
+++ b/phpBB/phpbb/console/command/db/migrate.php
@@ -55,6 +55,8 @@ class migrate extends \phpbb\console\command\command
{
$this->migrator->create_migrations_table();
+ $this->cache->purge();
+
$this->load_migrations();
$orig_version = $this->config['version'];
while (!$this->migrator->finished())
diff --git a/phpBB/phpbb/db/migration/data/v310/notifications_use_full_name.php b/phpBB/phpbb/db/migration/data/v310/notifications_use_full_name.php
index f749b32119..112c1e85e8 100644
--- a/phpBB/phpbb/db/migration/data/v310/notifications_use_full_name.php
+++ b/phpBB/phpbb/db/migration/data/v310/notifications_use_full_name.php
@@ -92,10 +92,41 @@ class notifications_use_full_name extends \phpbb\db\migration\migration
foreach ($this->notification_types as $notification_type)
{
- $sql = 'UPDATE ' . NOTIFICATION_TYPES_TABLE . "
- SET notification_type_name = 'notification.type.{$notification_type}'
- WHERE notification_type_name = '{$notification_type}'";
- $this->db->sql_query($sql);
+ $sql = 'SELECT notification_type_id
+ FROM ' . NOTIFICATION_TYPES_TABLE . "
+ WHERE notification_type_name = 'notification.type.{$notification_type}'";
+ $result = $this->db->sql_query($sql);
+ $new_type_id = (int) $this->db->sql_fetchfield('notification_type_id');
+ $this->db->sql_freeresult($result);
+
+ if ($new_type_id)
+ {
+ // New type name already exists,
+ // so we delete the old type and update the type id of existing entries.
+ $sql = 'SELECT notification_type_id
+ FROM ' . NOTIFICATION_TYPES_TABLE . "
+ WHERE notification_type_name = '{$notification_type}'";
+ $result = $this->db->sql_query($sql);
+ $old_type_id = (int) $this->db->sql_fetchfield('notification_type_id');
+ $this->db->sql_freeresult($result);
+
+ $sql = 'UPDATE ' . NOTIFICATIONS_TABLE . '
+ SET notification_type_id = ' . (int) $new_type_id . '
+ WHERE notification_type_id = ' . (int) $old_type_id;
+ $this->db->sql_query($sql);
+
+ $sql = 'DELETE FROM ' . NOTIFICATION_TYPES_TABLE . "
+ WHERE notification_type_name = '{$notification_type}'";
+ $this->db->sql_query($sql);
+ }
+ else
+ {
+ // Otherwise we just update the name
+ $sql = 'UPDATE ' . NOTIFICATION_TYPES_TABLE . "
+ SET notification_type_name = 'notification.type.{$notification_type}'
+ WHERE notification_type_name = '{$notification_type}'";
+ $this->db->sql_query($sql);
+ }
$sql = 'UPDATE ' . USER_NOTIFICATIONS_TABLE . "
SET item_type = 'notification.type.{$notification_type}'
@@ -108,10 +139,41 @@ class notifications_use_full_name extends \phpbb\db\migration\migration
{
foreach ($this->notification_types as $notification_type)
{
- $sql = 'UPDATE ' . NOTIFICATION_TYPES_TABLE . "
- SET notification_type_name = '{$notification_type}'
- WHERE notification_type_name = 'notification.type.{$notification_type}'";
- $this->db->sql_query($sql);
+ $sql = 'SELECT notification_type_id
+ FROM ' . NOTIFICATION_TYPES_TABLE . "
+ WHERE notification_type_name = '{$notification_type}'";
+ $result = $this->db->sql_query($sql);
+ $new_type_id = (int) $this->db->sql_fetchfield('notification_type_id');
+ $this->db->sql_freeresult($result);
+
+ if ($new_type_id)
+ {
+ // New type name already exists,
+ // so we delete the old type and update the type id of existing entries.
+ $sql = 'SELECT notification_type_id
+ FROM ' . NOTIFICATION_TYPES_TABLE . "
+ WHERE notification_type_name = 'notification.type.{$notification_type}'";
+ $result = $this->db->sql_query($sql);
+ $old_type_id = (int) $this->db->sql_fetchfield('notification_type_id');
+ $this->db->sql_freeresult($result);
+
+ $sql = 'UPDATE ' . NOTIFICATIONS_TABLE . '
+ SET notification_type_id = ' . (int) $new_type_id . '
+ WHERE notification_type_id = ' . (int) $old_type_id;
+ $this->db->sql_query($sql);
+
+ $sql = 'DELETE FROM ' . NOTIFICATION_TYPES_TABLE . "
+ WHERE notification_type_name = 'notification.type.{$notification_type}'";
+ $this->db->sql_query($sql);
+ }
+ else
+ {
+ // Otherwise we just update the name
+ $sql = 'UPDATE ' . NOTIFICATION_TYPES_TABLE . "
+ SET notification_type_name = '{$notification_type}'
+ WHERE notification_type_name = 'notification.type.{$notification_type}'";
+ $this->db->sql_query($sql);
+ }
$sql = 'UPDATE ' . USER_NOTIFICATIONS_TABLE . "
SET item_type = '{$notification_type}'
diff --git a/phpBB/phpbb/pagination.php b/phpBB/phpbb/pagination.php
index 8aba41d651..7a81c25ad2 100644
--- a/phpBB/phpbb/pagination.php
+++ b/phpBB/phpbb/pagination.php
@@ -21,18 +21,26 @@ class pagination
/** @var \phpbb\user */
protected $user;
+ /** @var \phpbb\controller\helper */
+ protected $helper;
+
+ /** @var \phpbb\event\dispatcher_interface */
+ protected $phpbb_dispatcher;
+
/**
* Constructor
*
- * @param \phpbb\template\template $template
- * @param \phpbb\user $user
- * @param \phpbb\controller\helper $helper
+ * @param \phpbb\template\template $template
+ * @param \phpbb\user $user
+ * @param \phpbb\controller\helper $helper
+ * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher
*/
- public function __construct(\phpbb\template\template $template, \phpbb\user $user, \phpbb\controller\helper $helper)
+ public function __construct(\phpbb\template\template $template, \phpbb\user $user, \phpbb\controller\helper $helper, \phpbb\event\dispatcher_interface $phpbb_dispatcher)
{
$this->template = $template;
$this->user = $user;
$this->helper = $helper;
+ $this->phpbb_dispatcher = $phpbb_dispatcher;
}
/**
@@ -50,6 +58,36 @@ class pagination
*/
protected function generate_page_link($base_url, $on_page, $start_name, $per_page)
{
+ // A listener can set this variable to the new pagination URL
+ // to override the generate_page_link() function generated value
+ $generate_page_link_override = false;
+
+ /**
+ * Execute code and/or override generate_page_link()
+ *
+ * To override the generate_page_link() function generated value
+ * set $generate_page_link_override to the new URL value
+ *
+ * @event core.pagination_generate_page_link
+ * @var string base_url is url prepended to all links generated within the function
+ * If you use page numbers inside your controller route, base_url should contains a placeholder (%d)
+ * for the page. Also be sure to specify the pagination path information into the start_name argument
+ * @var string on_page is the page for which we want to generate the link
+ * @var string start_name is the name of the parameter containing the first item of the given page (example: start=20)
+ * If you use page numbers inside your controller route, start name should be the string
+ * that should be removed for the first page (example: /page/%d)
+ * @var int per_page the number of items, posts, etc. to display per page, used to determine the number of pages to produce
+ * @var bool|string generate_page_link_override Shall we return custom pagination link (string URL) or not (false)
+ * @since 3.1.0-RC5
+ */
+ $vars = array('base_url', 'on_page', 'start_name', 'per_page', 'generate_page_link_override');
+ extract($this->phpbb_dispatcher->trigger_event('core.pagination_generate_page_link', compact($vars)));
+
+ if ($generate_page_link_override)
+ {
+ return $generate_page_link_override;
+ }
+
if (!is_string($base_url))
{
if (is_array($base_url['routes']))
diff --git a/phpBB/posting.php b/phpBB/posting.php
index 18572a3a6c..764a16d386 100644
--- a/phpBB/posting.php
+++ b/phpBB/posting.php
@@ -1155,6 +1155,34 @@ if ($submit || $preview || $refresh)
}
}
+ /**
+ * This event allows you to define errors before the post action is performed
+ *
+ * @event core.posting_modify_submission_errors
+ * @var array post_data Array with post data
+ * @var string mode What action to take if the form is submitted
+ * post|reply|quote|edit|delete|bump|smilies|popup
+ * @var string page_title Title of the mode page
+ * @var int post_id ID of the post
+ * @var int topic_id ID of the topic
+ * @var int forum_id ID of the forum
+ * @var bool submit Whether or not the form has been submitted
+ * @var array error Any error strings; a non-empty array aborts form submission.
+ * NOTE: Should be actual language strings, NOT language keys.
+ * @since 3.1.0-RC5
+ */
+ $vars = array(
+ 'post_data',
+ 'mode',
+ 'page_title',
+ 'post_id',
+ 'topic_id',
+ 'forum_id',
+ 'submit',
+ 'error',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.posting_modify_submission_errors', compact($vars)));
+
// Store message, sync counters
if (!sizeof($error) && $submit)
{
@@ -1246,9 +1274,87 @@ if ($submit || $preview || $refresh)
// post's poster, not the poster of the current post). See: PHPBB3-11769 for more information.
$post_author_name = ((!$user->data['is_registered'] || $mode == 'edit') && $post_data['username'] !== '') ? $post_data['username'] : '';
+ /**
+ * This event allows you to define errors before the post action is performed
+ *
+ * @event core.posting_modify_submit_post_before
+ * @var array post_data Array with post data
+ * @var array poll Array with poll data
+ * @var array data Array with post data going to be stored in the database
+ * @var string mode What action to take if the form is submitted
+ * post|reply|quote|edit|delete
+ * @var string page_title Title of the mode page
+ * @var int post_id ID of the post
+ * @var int topic_id ID of the topic
+ * @var int forum_id ID of the forum
+ * @var string post_author_name Author name for guest posts
+ * @var bool update_message Boolean if the post message was changed
+ * @var bool update_subject Boolean if the post subject was changed
+ * @var bool submit Whether or not the form has been submitted
+ * @var array error Any error strings; a non-empty array aborts form submission.
+ * NOTE: Should be actual language strings, NOT language keys.
+ * @since 3.1.0-RC5
+ */
+ $vars = array(
+ 'post_data',
+ 'poll',
+ 'data',
+ 'mode',
+ 'page_title',
+ 'post_id',
+ 'topic_id',
+ 'forum_id',
+ 'post_author_name',
+ 'update_message',
+ 'update_subject',
+ 'submit',
+ 'error',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.posting_modify_submit_post_before', compact($vars)));
+
// The last parameter tells submit_post if search indexer has to be run
$redirect_url = submit_post($mode, $post_data['post_subject'], $post_author_name, $post_data['topic_type'], $poll, $data, $update_message, ($update_message || $update_subject) ? true : false);
+ /**
+ * This event allows you to define errors after the post action is performed
+ *
+ * @event core.posting_modify_submit_post_after
+ * @var array post_data Array with post data
+ * @var array poll Array with poll data
+ * @var array data Array with post data going to be stored in the database
+ * @var string mode What action to take if the form is submitted
+ * post|reply|quote|edit|delete
+ * @var string page_title Title of the mode page
+ * @var int post_id ID of the post
+ * @var int topic_id ID of the topic
+ * @var int forum_id ID of the forum
+ * @var string post_author_name Author name for guest posts
+ * @var bool update_message Boolean if the post message was changed
+ * @var bool update_subject Boolean if the post subject was changed
+ * @var string redirect_url URL the user is going to be redirected to
+ * @var bool submit Whether or not the form has been submitted
+ * @var array error Any error strings; a non-empty array aborts form submission.
+ * NOTE: Should be actual language strings, NOT language keys.
+ * @since 3.1.0-RC5
+ */
+ $vars = array(
+ 'post_data',
+ 'poll',
+ 'data',
+ 'mode',
+ 'page_title',
+ 'post_id',
+ 'topic_id',
+ 'forum_id',
+ 'post_author_name',
+ 'update_message',
+ 'update_subject',
+ 'redirect_url',
+ 'submit',
+ 'error',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.posting_modify_submit_post_after', compact($vars)));
+
if ($config['enable_post_confirm'] && !$user->data['is_registered'] && (isset($captcha) && $captcha->is_solved() === true) && ($mode == 'post' || $mode == 'reply' || $mode == 'quote'))
{
$captcha->reset();
diff --git a/phpBB/styles/prosilver/template/viewforum_body.html b/phpBB/styles/prosilver/template/viewforum_body.html
index 4362d50b37..43e994f1f9 100644
--- a/phpBB/styles/prosilver/template/viewforum_body.html
+++ b/phpBB/styles/prosilver/template/viewforum_body.html
@@ -39,9 +39,13 @@
<!-- IF not S_IS_BOT and S_DISPLAY_POST_INFO -->
<div class="buttons">
+ <!-- EVENT viewforum_buttons_top_before -->
+
<a href="{U_POST_NEW_TOPIC}" class="button icon-button <!-- IF S_IS_LOCKED -->locked-icon<!-- ELSE -->post-icon<!-- ENDIF -->" title="<!-- IF S_IS_LOCKED -->{L_FORUM_LOCKED}<!-- ELSE -->{L_POST_TOPIC}<!-- ENDIF -->">
<!-- IF S_IS_LOCKED -->{L_BUTTON_FORUM_LOCKED}<!-- ELSE -->{L_BUTTON_NEW_TOPIC}<!-- ENDIF -->
</a>
+
+ <!-- EVENT viewforum_buttons_top_after -->
</div>
<!-- ENDIF -->
@@ -60,7 +64,7 @@
<div class="pagination">
<!-- IF not S_IS_BOT and U_MARK_TOPICS and .topicrow --><a href="{U_MARK_TOPICS}" class="mark" accesskey="m" data-ajax="mark_topics_read">{L_MARK_TOPICS_READ}</a> &bull; <!-- ENDIF -->
- {TOTAL_TOPICS}
+ {TOTAL_TOPICS}
<!-- IF .pagination -->
<!-- INCLUDE pagination.html -->
<!-- ELSE -->
@@ -227,15 +231,19 @@
<div class="action-bar bottom">
<!-- IF not S_IS_BOT and S_DISPLAY_POST_INFO -->
<div class="buttons">
+ <!-- EVENT viewforum_buttons_bottom_before -->
+
<a href="{U_POST_NEW_TOPIC}" class="button icon-button <!-- IF S_IS_LOCKED -->locked-icon<!-- ELSE -->post-icon<!-- ENDIF -->" title="<!-- IF S_IS_LOCKED -->{L_FORUM_LOCKED}<!-- ELSE -->{L_POST_TOPIC}<!-- ENDIF -->">
<!-- IF S_IS_LOCKED -->{L_BUTTON_FORUM_LOCKED}<!-- ELSE -->{L_BUTTON_NEW_TOPIC}<!-- ENDIF -->
</a>
+
+ <!-- EVENT viewforum_buttons_bottom_after -->
</div>
<!-- ENDIF -->
<div class="pagination">
<!-- IF not S_IS_BOT and U_MARK_TOPICS and .topicrow --><a href="{U_MARK_TOPICS}" data-ajax="mark_topics_read">{L_MARK_TOPICS_READ}</a> &bull; <!-- ENDIF -->
- {TOTAL_TOPICS}
+ {TOTAL_TOPICS}
<!-- IF .pagination -->
<!-- INCLUDE pagination.html -->
<!-- ELSE -->
diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html
index 127a3ca1aa..621e2d6143 100644
--- a/phpBB/styles/prosilver/template/viewtopic_body.html
+++ b/phpBB/styles/prosilver/template/viewtopic_body.html
@@ -28,11 +28,15 @@
<div class="action-bar top">
<div class="buttons">
+ <!-- EVENT viewtopic_buttons_top_before -->
+
<!-- IF not S_IS_BOT and S_DISPLAY_REPLY_INFO -->
<a href="{U_POST_REPLY_TOPIC}" class="button icon-button <!-- IF S_IS_LOCKED -->locked-icon<!-- ELSE -->reply-icon<!-- ENDIF -->" title="<!-- IF S_IS_LOCKED -->{L_TOPIC_LOCKED}<!-- ELSE -->{L_POST_REPLY}<!-- ENDIF -->">
<!-- IF S_IS_LOCKED -->{L_BUTTON_TOPIC_LOCKED}<!-- ELSE -->{L_BUTTON_POST_REPLY}<!-- ENDIF -->
</a>
<!-- ENDIF -->
+
+ <!-- EVENT viewtopic_buttons_top_after -->
</div>
<!-- INCLUDE viewtopic_topic_tools.html -->
@@ -338,11 +342,15 @@
<!-- EVENT viewtopic_body_topic_actions_before -->
<div class="action-bar bottom">
<div class="buttons">
+ <!-- EVENT viewtopic_buttons_bottom_before -->
+
<!-- IF not S_IS_BOT and S_DISPLAY_REPLY_INFO -->
<a href="{U_POST_REPLY_TOPIC}" class="button icon-button <!-- IF S_IS_LOCKED -->locked-icon<!-- ELSE -->reply-icon<!-- ENDIF -->" title="<!-- IF S_IS_LOCKED -->{L_TOPIC_LOCKED}<!-- ELSE -->{L_POST_REPLY}<!-- ENDIF -->">
<!-- IF S_IS_LOCKED -->{L_BUTTON_TOPIC_LOCKED}<!-- ELSE -->{L_BUTTON_POST_REPLY}<!-- ENDIF -->
</a>
<!-- ENDIF -->
+
+ <!-- EVENT viewtopic_buttons_bottom_after -->
</div>
<!-- INCLUDE viewtopic_topic_tools.html -->
diff --git a/phpBB/styles/subsilver2/template/viewforum_body.html b/phpBB/styles/subsilver2/template/viewforum_body.html
index e34d1807e6..925581ffcd 100644
--- a/phpBB/styles/subsilver2/template/viewforum_body.html
+++ b/phpBB/styles/subsilver2/template/viewforum_body.html
@@ -150,9 +150,16 @@
<!-- IF S_DISPLAY_POST_INFO or TOTAL_TOPICS -->
<table width="100%" cellspacing="1">
<tr>
+ <td align="{S_CONTENT_FLOW_BEGIN}" valign="middle" nowrap="nowrap">
+ <!-- EVENT viewforum_buttons_top_before -->
+
<!-- IF S_DISPLAY_POST_INFO and not S_IS_BOT -->
- <td align="{S_CONTENT_FLOW_BEGIN}" valign="middle"><a href="{U_POST_NEW_TOPIC}" class="imageset">{POST_IMG}</a></td>
+ <a href="{U_POST_NEW_TOPIC}" class="imageset">{POST_IMG}</a>
<!-- ENDIF -->
+
+ <!-- EVENT viewforum_buttons_top_after -->
+ </td>
+
<!-- IF TOTAL_TOPICS -->
<td class="nav" valign="middle" nowrap="nowrap">&nbsp;{PAGE_NUMBER}<br /></td>
<td class="gensmall" nowrap="nowrap">&nbsp;[ {TOTAL_TOPICS} ]&nbsp;</td>
@@ -273,9 +280,16 @@
<!-- IF S_DISPLAY_POST_INFO or TOTAL_TOPICS -->
<table width="100%" cellspacing="1">
<tr>
+ <td align="{S_CONTENT_FLOW_BEGIN}" valign="middle" nowrap="nowrap">
+ <!-- EVENT viewforum_buttons_bottom_before -->
+
<!-- IF S_DISPLAY_POST_INFO and not S_IS_BOT -->
- <td align="{S_CONTENT_FLOW_BEGIN}" valign="middle"><a href="{U_POST_NEW_TOPIC}" class="imageset">{POST_IMG}</a></td>
+ <a href="{U_POST_NEW_TOPIC}" class="imageset">{POST_IMG}</a>
<!-- ENDIF -->
+
+ <!-- EVENT viewforum_buttons_bottom_after -->
+ </td>
+
<!-- IF TOTAL_TOPICS -->
<td class="nav" valign="middle" nowrap="nowrap">&nbsp;{PAGE_NUMBER}<br /></td>
<td class="gensmall" nowrap="nowrap">&nbsp;[ {TOTAL_TOPICS} ]&nbsp;</td>
diff --git a/phpBB/styles/subsilver2/template/viewtopic_body.html b/phpBB/styles/subsilver2/template/viewtopic_body.html
index 838f6c5f03..24a8c12be0 100644
--- a/phpBB/styles/subsilver2/template/viewtopic_body.html
+++ b/phpBB/styles/subsilver2/template/viewtopic_body.html
@@ -32,10 +32,14 @@
<table width="100%" cellspacing="1">
<tr>
<td align="{S_CONTENT_FLOW_BEGIN}" valign="middle" nowrap="nowrap">
+ <!-- EVENT viewtopic_buttons_top_before -->
+
<!-- IF not S_IS_BOT -->
<!-- IF S_DISPLAY_POST_INFO --><a href="{U_POST_NEW_TOPIC}" class="imageset">{POST_IMG}</a>&nbsp;<!-- ENDIF -->
<!-- IF S_DISPLAY_REPLY_INFO --><a href="{U_POST_REPLY_TOPIC}" class="imageset">{REPLY_IMG}</a><!-- ENDIF -->
<!-- ENDIF -->
+
+ <!-- EVENT viewtopic_buttons_top_after -->
</td>
<!-- IF TOTAL_POSTS -->
<td class="nav" valign="middle" nowrap="nowrap">&nbsp;{PAGE_NUMBER}<br /></td>
@@ -371,10 +375,14 @@
<table width="100%" cellspacing="1">
<tr>
<td align="{S_CONTENT_FLOW_BEGIN}" valign="middle" nowrap="nowrap">
+ <!-- EVENT viewtopic_buttons_bottom_before -->
+
<!-- IF not S_IS_BOT -->
<!-- IF S_DISPLAY_POST_INFO --><a href="{U_POST_NEW_TOPIC}" class="imageset">{POST_IMG}</a>&nbsp;<!-- ENDIF -->
<!-- IF S_DISPLAY_REPLY_INFO --><a href="{U_POST_REPLY_TOPIC}" class="imageset">{REPLY_IMG}</a><!-- ENDIF -->
<!-- ENDIF -->
+
+ <!-- EVENT viewtopic_buttons_bottom_after -->
</td>
<!-- IF TOTAL_POSTS -->
<td class="nav" valign="middle" nowrap="nowrap">&nbsp;{PAGE_NUMBER}<br /></td>
diff --git a/tests/mock/event_dispatcher.php b/tests/mock/event_dispatcher.php
index 613551bffd..fa8b4a1036 100644
--- a/tests/mock/event_dispatcher.php
+++ b/tests/mock/event_dispatcher.php
@@ -11,9 +11,18 @@
*
*/
-class phpbb_mock_event_dispatcher
+class phpbb_mock_event_dispatcher extends \phpbb\event\dispatcher
{
- public function trigger_event($eventName, $data)
+ /**
+ * Constructor.
+ *
+ * Overwrite the constructor to get rid of ContainerInterface param instance
+ */
+ public function __construct()
+ {
+ }
+
+ public function trigger_event($eventName, $data = array())
{
return array();
}
diff --git a/tests/pagination/pagination_test.php b/tests/pagination/pagination_test.php
index 95856dd07d..d36aa11a8a 100644
--- a/tests/pagination/pagination_test.php
+++ b/tests/pagination/pagination_test.php
@@ -28,7 +28,7 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case
global $phpbb_dispatcher;
- $phpbb_dispatcher = new phpbb_mock_event_dispatcher;
+ $phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$this->user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime'));
$this->user->expects($this->any())
->method('lang')
@@ -58,7 +58,7 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case
);
$this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $provider, $manager, $symfony_request, $filesystem, '', 'php', dirname(__FILE__) . '/');
- $this->pagination = new \phpbb\pagination($this->template, $this->user, $this->helper);
+ $this->pagination = new \phpbb\pagination($this->template, $this->user, $this->helper, $phpbb_dispatcher);
}
public function generate_template_pagination_data()