From ab7345d96d2bc7e96b2567867b815c4129b1d6f3 Mon Sep 17 00:00:00 2001 From: kasimi Date: Thu, 17 Oct 2019 12:49:30 +0200 Subject: [ticket/16182] Add core.generate_smilies_modify_rowset PHPBB3-16182 --- phpBB/includes/functions_posting.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'phpBB/includes/functions_posting.php') diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 2cce77e092..ed4b573cc2 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -114,6 +114,22 @@ function generate_smilies($mode, $forum_id) } $db->sql_freeresult($result); + /** + * Modify smilies before they are assigned to the template + * + * @event core.generate_smilies_modify_rowset + * @var string mode Smiley mode, either window or inline + * @var int forum_id Forum where smilies are generated + * @var array smilies Smiley rows fetched from the database + * @since 3.2.9-RC1 + */ + $vars = [ + 'mode', + 'forum_id', + 'smilies', + ]; + extract($phpbb_dispatcher->trigger_event('core.generate_smilies_modify_rowset', compact($vars))); + if (count($smilies)) { $root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $phpbb_path_helper->get_web_root_path(); -- cgit v1.2.1 From 84e0f5a2ebf8477a70c185c6496a02f0e2ed8918 Mon Sep 17 00:00:00 2001 From: kasimi Date: Thu, 17 Oct 2019 12:54:42 +0200 Subject: [ticket/16183] Add core.generate_smilies_count_sql_before PHPBB3-16183 --- phpBB/includes/functions_posting.php | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'phpBB/includes/functions_posting.php') diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 2cce77e092..0fb4ef2c49 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -52,9 +52,28 @@ function generate_smilies($mode, $forum_id) page_header($user->lang['SMILIES']); - $sql = 'SELECT COUNT(smiley_id) AS item_count - FROM ' . SMILIES_TABLE . ' - GROUP BY smiley_url'; + $sql_ary = [ + 'SELECT' => 'COUNT(s.smiley_id) AS item_count', + 'FROM' => [ + SMILIES_TABLE => 's', + ], + 'GROUP_BY' => 's.smiley_url', + ]; + + /** + * Modify SQL query that fetches the total number of smilies in window mode + * + * @event core.generate_smilies_count_sql_before + * @var int forum_id Forum where smilies are generated + * @var array sql_ary Array with the SQL query + * @since 3.2.9-RC1 + */ + $vars = [ + 'forum_id', + 'sql_ary', + ]; + extract($phpbb_dispatcher->trigger_event('core.generate_smilies_count_sql_before', compact($vars))); + $result = $db->sql_query($sql, 3600); $smiley_count = 0; -- cgit v1.2.1 From 6df8b7f3678ba242480a0c50b651b1653a0d2d6b Mon Sep 17 00:00:00 2001 From: kasimi Date: Sun, 20 Oct 2019 20:50:34 +0200 Subject: [ticket/16183] Generate SQL query from array PHPBB3-16183 --- phpBB/includes/functions_posting.php | 1 + 1 file changed, 1 insertion(+) (limited to 'phpBB/includes/functions_posting.php') diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 0fb4ef2c49..844481f1bd 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -74,6 +74,7 @@ function generate_smilies($mode, $forum_id) ]; extract($phpbb_dispatcher->trigger_event('core.generate_smilies_count_sql_before', compact($vars))); + $sql = $db->sql_build_query('SELECT', $sql_ary); $result = $db->sql_query($sql, 3600); $smiley_count = 0; -- cgit v1.2.1