From c2836725f9692e907d77edce7c609142661af6c1 Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Sun, 20 Nov 2016 17:58:59 +0100 Subject: [PATCH 01/17] [ticket/13429] Replace @changed with @change in event docblocks PHPBB3-13429 --- phpBB/includes/functions.php | 6 +++--- phpBB/includes/functions_admin.php | 2 +- phpBB/includes/mcp/mcp_post.php | 2 +- phpBB/includes/ucp/ucp_pm_viewmessage.php | 2 +- phpBB/includes/ucp/ucp_prefs.php | 2 +- phpBB/memberlist.php | 4 ++-- phpBB/phpbb/avatar/driver/upload.php | 2 +- phpBB/phpbb/event/php_exporter.php | 10 +++++----- phpBB/posting.php | 6 +++--- phpBB/search.php | 16 ++++++++-------- phpBB/viewforum.php | 4 ++-- tests/event/php_exporter_test.php | 16 ++++++++-------- 12 files changed, 36 insertions(+), 36 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index a152d9b620..e5e54e28d7 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2636,7 +2636,7 @@ function add_form_key($form_name, $template_variable_suffix = '') * @var string template_variable_suffix The string that is appended to template variable name * * @since 3.1.0-RC3 - * @changed 3.1.11-RC1 Added template_variable_suffix + * @change 3.1.11-RC1 Added template_variable_suffix */ $vars = array( 'form_name', @@ -2928,7 +2928,7 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa * @var string redirect Redirect string * @var bool admin Is admin? * @since 3.1.0-RC5 - * @changed 3.1.9-RC1 Removed undefined return variable + * @change 3.1.9-RC1 Removed undefined return variable */ $vars = array('redirect', 'admin'); extract($phpbb_dispatcher->trigger_event('core.login_box_redirect', compact($vars))); @@ -4310,7 +4310,7 @@ function obtain_users_online_string($online_users, $item_id = 0, $item = 'forum' * session_forum_id * @var array sql_ary SQL query array to obtain users online data * @since 3.1.4-RC1 - * @changed 3.1.7-RC1 Change sql query into array and adjust var accordingly. Allows extension authors the ability to adjust the sql_ary. + * @change 3.1.7-RC1 Change sql query into array and adjust var accordingly. Allows extension authors the ability to adjust the sql_ary. */ $vars = array('online_users', 'item_id', 'item', 'sql_ary'); extract($phpbb_dispatcher->trigger_event('core.obtain_users_online_string_sql', compact($vars))); diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 1dc246ec33..dabdd80bc6 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -2611,7 +2611,7 @@ function prune($forum_id, $prune_mode, $prune_date, $prune_flags = 0, $auto_sync * @var string sql_and SQL text appended to where clause * @var int prune_limit The prune limit * @since 3.1.3-RC1 - * @changed 3.1.10-RC1 Added prune_limit + * @change 3.1.10-RC1 Added prune_limit */ $vars = array( 'forum_id', diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php index 2dcfcd608b..45f48419a0 100644 --- a/phpBB/includes/mcp/mcp_post.php +++ b/phpBB/includes/mcp/mcp_post.php @@ -556,7 +556,7 @@ function change_poster(&$post_info, $userdata) * @var array userdata Information on a post's new poster * @var array post_info Information on the affected post * @since 3.1.6-RC1 - * @changed 3.1.7-RC1 Change location to prevent post_info from being set to the new post information + * @change 3.1.7-RC1 Change location to prevent post_info from being set to the new post information */ $vars = array('userdata', 'post_info'); extract($phpbb_dispatcher->trigger_event('core.mcp_change_poster_after', compact($vars))); diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php index d7b9b32dbf..09e793d965 100644 --- a/phpBB/includes/ucp/ucp_pm_viewmessage.php +++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php @@ -267,7 +267,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) * @var array msg_data Template array with message data * @var array user_info User data of the sender * @since 3.1.0-a1 - * @changed 3.1.6-RC1 Added user_info into event + * @change 3.1.6-RC1 Added user_info into event */ $vars = array( 'id', diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php index e63e9b4c08..6eed423363 100644 --- a/phpBB/includes/ucp/ucp_prefs.php +++ b/phpBB/includes/ucp/ucp_prefs.php @@ -69,7 +69,7 @@ class ucp_prefs * @var array data Array with current ucp options data * @var array error Array with list of errors * @since 3.1.0-a1 - * @changed 3.1.4-RC1 Added error variable to the event + * @change 3.1.4-RC1 Added error variable to the event */ $vars = array('submit', 'data', 'error'); extract($phpbb_dispatcher->trigger_event('core.ucp_prefs_personal_data', compact($vars))); diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index b93476b3bb..1f8dfc14c3 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -665,8 +665,8 @@ switch ($mode) * @var bool foe Is the user foe? * @var array profile_fields Array with user's profile field data * @since 3.1.0-a1 - * @changed 3.1.0-b2 Added friend and foe status - * @changed 3.1.0-b3 Added profile fields data + * @change 3.1.0-b2 Added friend and foe status + * @change 3.1.0-b3 Added profile fields data */ $vars = array( 'member', diff --git a/phpBB/phpbb/avatar/driver/upload.php b/phpBB/phpbb/avatar/driver/upload.php index cb8dfcad4f..9e3f208210 100644 --- a/phpBB/phpbb/avatar/driver/upload.php +++ b/phpBB/phpbb/avatar/driver/upload.php @@ -186,7 +186,7 @@ class upload extends \phpbb\avatar\driver\driver * @var array row Array with avatar row data * @var array error Array of errors, if filled in by this event file will not be moved * @since 3.1.6-RC1 - * @changed 3.1.9-RC1 Added filedata + * @change 3.1.9-RC1 Added filedata */ $vars = array( 'filedata', diff --git a/phpBB/phpbb/event/php_exporter.php b/phpBB/phpbb/event/php_exporter.php index d2ab0595c0..8923d35f6d 100644 --- a/phpBB/phpbb/event/php_exporter.php +++ b/phpBB/phpbb/event/php_exporter.php @@ -508,9 +508,9 @@ class php_exporter } /** - * Find the "@changed" Information lines + * Find the "@change" Information lines * - * @param string $tag_name Should be 'changed' or 'change' + * @param string $tag_name Should be 'change', not 'changed' * @return array Absolute line numbers * @throws \LogicException */ @@ -648,7 +648,7 @@ class php_exporter } /** - * Validate "@changed" Information + * Validate "@change" Information * * @param string $line * @return string @@ -658,10 +658,10 @@ class php_exporter { $match = array(); $line = str_replace("\t", ' ', ltrim($line, "\t ")); - preg_match('#^\* @change(d)? (\d+\.\d+\.\d+(?:-(?:a|b|RC|pl)\d+)?)( (?:.*))?$#', $line, $match); + preg_match('#^\* @change (\d+\.\d+\.\d+(?:-(?:a|b|RC|pl)\d+)?)( (?:.*))?$#', $line, $match); if (!isset($match[2])) { - throw new \LogicException("Invalid '@changed' information for event " + throw new \LogicException("Invalid '@change' information for event " . "'{$this->current_event}' in file '{$this->current_file}:{$this->current_event_line}'"); } diff --git a/phpBB/posting.php b/phpBB/posting.php index db580d926b..6f8225c198 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -373,7 +373,7 @@ switch ($mode) * @var bool is_authed Does the user have the required permissions? * @var array post_data All post data from database * @since 3.1.3-RC1 -* @changed 3.1.10-RC1 Added post_data +* @change 3.1.10-RC1 Added post_data */ $vars = array( 'post_id', @@ -1385,7 +1385,7 @@ if ($submit || $preview || $refresh) * @var bool update_subject Boolean if the post subject was changed * NOTE: Should be actual language strings, NOT language keys. * @since 3.1.0-RC5 - * @changed 3.1.6-RC1 remove submit and error from event Submit and Error are checked previously prior to running event + * @change 3.1.6-RC1 remove submit and error from event Submit and Error are checked previously prior to running event */ $vars = array( 'post_data', @@ -1424,7 +1424,7 @@ if ($submit || $preview || $refresh) * @var string redirect_url URL the user is going to be redirected to * NOTE: Should be actual language strings, NOT language keys. * @since 3.1.0-RC5 - * @changed 3.1.6-RC1 remove submit and error from event Submit and Error are checked previously prior to running event + * @change 3.1.6-RC1 remove submit and error from event Submit and Error are checked previously prior to running event */ $vars = array( 'post_data', diff --git a/phpBB/search.php b/phpBB/search.php index 27ec8e4dab..cbc6b0f55a 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -343,7 +343,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) * @var array id_ary Array of post or topic ids for search result * @var string show_results 'posts' or 'topics' type of ids * @since 3.1.3-RC1 - * @changed 3.1.10-RC1 Added id_ary, show_results + * @change 3.1.10-RC1 Added id_ary, show_results */ $vars = array( 'keywords', @@ -692,8 +692,8 @@ if ($keywords || $author || $author_id || $search_id || $submit) * @var int total_match_count The total number of search matches * @var array ex_fid_ary Array of excluded forum ids * @since 3.1.7-RC1 - * @changed 3.1.10-RC1 Added show_results, sql_where, total_match_count - * @changed 3.1.11-RC1 Added ex_fid_ary + * @change 3.1.10-RC1 Added show_results, sql_where, total_match_count + * @change 3.1.11-RC1 Added ex_fid_ary */ $vars = array( 'u_search', @@ -830,8 +830,8 @@ if ($keywords || $author || $author_id || $search_id || $submit) * @var string sort_key The sorting key * @var string sql_order_by The SQL ORDER BY string used by search to get topic data * @since 3.1.0-a1 - * @changed 3.1.0-RC5 Added total_match_count - * @changed 3.1.7-RC1 Added sort_by_sql, sort_dir, sort_key, sql_order_by + * @change 3.1.0-RC5 Added total_match_count + * @change 3.1.7-RC1 Added sort_by_sql, sort_dir, sort_key, sql_order_by */ $vars = array( 'sql_select', @@ -1021,7 +1021,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) * @var string view Search results view mode * @var array zebra Array with zebra data for the current user * @since 3.1.0-b4 - * @changed 3.1.0-b5 Added var show_results + * @change 3.1.0-b5 Added var show_results */ $vars = array( 'attachments', @@ -1198,7 +1198,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) * @var array zebra The zebra data of the current user * @var array attachments All the attachments of the search results * @since 3.1.0-a1 - * @changed 3.1.0-b3 Added vars show_results, topic_title, replies, + * @change 3.1.0-b3 Added vars show_results, topic_title, replies, * view_topic_url, folder_img, folder_alt, topic_type, unread_topic, * topic_unapproved, posts_unapproved, topic_deleted, u_mcp_queue, * zebra, attachments @@ -1302,7 +1302,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) * @var int total_match_count The count of search results * @var string keywords The search keywords * @since 3.1.0-RC4 - * @changed 3.1.6-RC1 Added total_match_count and keywords + * @change 3.1.6-RC1 Added total_match_count and keywords */ $vars = array( 'author_id', diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index e0cc9ba512..d93afc7bb7 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -631,7 +631,7 @@ $sql_ary = array( * * @since 3.1.0-RC4 * -* @changed 3.1.3 Added forum_data +* @change 3.1.3 Added forum_data */ $vars = array( 'forum_data', @@ -945,7 +945,7 @@ if (sizeof($topic_list)) * @var bool s_type_switch_test Flag indicating if the test topic type is [global] announcement * @since 3.1.0-a1 * - * @changed 3.1.10-RC1 Added s_type_switch, s_type_switch_test + * @change 3.1.10-RC1 Added s_type_switch, s_type_switch_test */ $vars = array('row', 'topic_row', 's_type_switch', 's_type_switch_test'); extract($phpbb_dispatcher->trigger_event('core.viewforum_modify_topicrow', compact($vars))); diff --git a/tests/event/php_exporter_test.php b/tests/event/php_exporter_test.php index 692a57f93c..a3d7f27ced 100644 --- a/tests/event/php_exporter_test.php +++ b/tests/event/php_exporter_test.php @@ -552,7 +552,7 @@ class phpbb_event_php_exporter_test extends phpbb_test_case '* @since 3.1.0-a1', '/**', '* @since 3.1.0-a1', - '* @changed 3.1.0-a2', + '* @change 3.1.0-a2', '*/', '$phpbb_dispatcher->dispatch(\'test\');', ), @@ -590,9 +590,9 @@ class phpbb_event_php_exporter_test extends phpbb_test_case array( array( '/**', - '* @changed 3.1.0-a1', - '* @changed 3.1.0-a2', - '* @changed 3.1.0-a3', + '* @change 3.1.0-a1', + '* @change 3.1.0-a2', + '* @change 3.1.0-a3', '*/', '$phpbb_dispatcher->dispatch(\'test\');', ), @@ -657,7 +657,7 @@ class phpbb_event_php_exporter_test extends phpbb_test_case ' * Hello Bertie!', ' *', ' * @since 3.1.0-a1', - ' * @changed 3.1.0-a2', + ' * @change 3.1.0-a2', ' */', ' $phpbb_dispatcher->dispatch(\'test\');', ), @@ -691,9 +691,9 @@ class phpbb_event_php_exporter_test extends phpbb_test_case array( array( '/**', - '* @changed 3.1.0-a1', - '* @changed 3.1.0-a2', - '* @changed 3.1.0-a3', + '* @change 3.1.0-a1', + '* @change 3.1.0-a2', + '* @change 3.1.0-a3', '*/', '$phpbb_dispatcher->dispatch(\'test\');', ), From 2f1d2e847e9bb08b22ed42e8dc06362d962d2efb Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Sun, 20 Nov 2016 18:47:19 +0100 Subject: [PATCH 02/17] [ticket/13429] Fix @change tags without description PHPBB3-13429 --- phpBB/includes/functions_user.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 0b39339c7f..f4c5c4b84c 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -276,7 +276,7 @@ function user_add($user_row, $cp_data = false, $notifications_data = null) * @var array cp_data Array of Custom profile fields submited to user_add * @var array sql_ary Array of data to be inserted when a user is added * @since 3.1.0-a1 - * @change 3.1.0-b5 + * @change 3.1.0-b5 Added user_row and cp_data */ $vars = array('user_row', 'cp_data', 'sql_ary'); extract($phpbb_dispatcher->trigger_event('core.user_add_modify_data', compact($vars))); From fbcbd79d79c5510d3943e0e1068801a8ea62146d Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Wed, 21 Dec 2016 14:41:53 +0100 Subject: [PATCH 03/17] [ticket/14929] Add error to core.posting_modify_message_text PHPBB3-14929 --- phpBB/posting.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/phpBB/posting.php b/phpBB/posting.php index db580d926b..90e52b3de8 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -941,7 +941,9 @@ if ($submit || $preview || $refresh) * is posting a new topic or editing a post) * @var bool refresh Whether or not to retain previously submitted data * @var object message_parser The message parser object + * @var array error Array of errors * @since 3.1.2-RC1 + * @changed 3.1.11-RC1 Added error */ $vars = array( 'post_data', @@ -956,6 +958,7 @@ if ($submit || $preview || $refresh) 'cancel', 'refresh', 'message_parser', + 'error', ); extract($phpbb_dispatcher->trigger_event('core.posting_modify_message_text', compact($vars))); From cff57f9076dd160b2185895f7298d4acbc5b5bb3 Mon Sep 17 00:00:00 2001 From: javiexin Date: Wed, 28 Dec 2016 12:55:26 +0100 Subject: [PATCH 04/17] [ticket/14944] Add possibility to search for template loop indexes by key Adds a new function to the template interface, and implements it in the context class. The function returns the ordinal index for a specified key, with the same structure that the key for alter_block_array. Reuses same code. PHPBB3-14944 --- phpBB/phpbb/template/base.php | 8 ++++ phpBB/phpbb/template/context.php | 71 +++++++++++++++++++++++++++++++ phpBB/phpbb/template/template.php | 17 ++++++++ 3 files changed, 96 insertions(+) diff --git a/phpBB/phpbb/template/base.php b/phpBB/phpbb/template/base.php index 9a40702ba8..bc0f022cc4 100644 --- a/phpBB/phpbb/template/base.php +++ b/phpBB/phpbb/template/base.php @@ -132,6 +132,14 @@ abstract class base implements template return $this->context->alter_block_array($blockname, $vararray, $key, $mode); } + /** + * {@inheritdoc} + */ + public function find_key_index($blockname, $key = false) + { + return $this->context->find_key_index($blockname, $key); + } + /** * Calls hook if any is defined. * diff --git a/phpBB/phpbb/template/context.php b/phpBB/phpbb/template/context.php index 4ee48205c8..e390c5a677 100644 --- a/phpBB/phpbb/template/context.php +++ b/phpBB/phpbb/template/context.php @@ -263,6 +263,77 @@ class context return true; } + /** + * Find the index for a specified key in the innermost specified block + * + * @param string $blockname the blockname, for example 'loop' + * @param mixed $key Key to search for + * + * array: KEY => VALUE [the key/value pair to search for within the loop to determine the correct position] + * + * int: Position [the position to search for] + * + * If key is false the position is set to 0 + * If key is true the position is set to the last entry + * + * @return mixed false if not found, index position otherwise; be sure to test with === + */ + public function find_key_index($blockname, $key = false) + { + // For nested block, $blockcount > 0, for top-level block, $blockcount == 0 + $blocks = explode('.', $blockname); + $blockcount = sizeof($blocks) - 1; + + $block = &$this->tpldata; + for ($i = 0; $i < $blockcount; $i++) + { + if (($pos = strpos($blocks[$i], '[')) !== false) + { + $name = substr($blocks[$i], 0, $pos); + + if (strpos($blocks[$i], '[]') === $pos) + { + $index = sizeof($block[$name]) - 1; + } + else + { + $index = min((int) substr($blocks[$i], $pos + 1, -1), sizeof($block[$name]) - 1); + } + } + else + { + $name = $blocks[$i]; + $index = sizeof($block[$name]) - 1; + } + $block = &$block[$name]; + $block = &$block[$index]; + } + + $block = &$block[$blocks[$i]]; // Traverse the last block + + // Change key to zero (change first position) if false and to last position if true + if ($key === false || $key === true) + { + return ($key === false) ? 0 : sizeof($block); + } + + // Get correct position if array given + if (is_array($key)) + { + // Search array to get correct position + list($search_key, $search_value) = @each($key); + foreach ($block as $i => $val_ary) + { + if ($val_ary[$search_key] === $search_value) + { + return $i; + } + } + } + + return false; + } + /** * Change already assigned key variable pair (one-dimensional - single loop entry) * diff --git a/phpBB/phpbb/template/template.php b/phpBB/phpbb/template/template.php index 041ecb12e4..b5a6ab32dc 100644 --- a/phpBB/phpbb/template/template.php +++ b/phpBB/phpbb/template/template.php @@ -172,6 +172,23 @@ interface template */ public function alter_block_array($blockname, array $vararray, $key = false, $mode = 'insert'); + /** + * Find the index for a specified key in the innermost specified block + * + * @param string $blockname the blockname, for example 'loop' + * @param mixed $key Key to search for + * + * array: KEY => VALUE [the key/value pair to search for within the loop to determine the correct position] + * + * int: Position [the position to search for] + * + * If key is false the position is set to 0 + * If key is true the position is set to the last entry + * + * @return mixed false if not found, index position otherwise; be sure to test with === + */ + public function find_key_index($blockname, $key = false); + /** * Get path to template for handle (required for BBCode parser) * From c656bd60ef99218a710882b6f640fea099e9c6e2 Mon Sep 17 00:00:00 2001 From: javiexin Date: Fri, 30 Dec 2016 18:03:09 +0100 Subject: [PATCH 05/17] [ticket/14944] Add possibility to search for template loop indexes by key Adds a new function to the template interface, and implements it in the context class. The function returns the ordinal index for a specified key, with the same structure that the key for alter_block_array. Reuses same code. Remove unneeded references, do nothing for int keys. PHPBB3-14944 --- phpBB/phpbb/template/context.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/phpBB/phpbb/template/context.php b/phpBB/phpbb/template/context.php index e390c5a677..1617ca3d19 100644 --- a/phpBB/phpbb/template/context.php +++ b/phpBB/phpbb/template/context.php @@ -284,7 +284,7 @@ class context $blocks = explode('.', $blockname); $blockcount = sizeof($blocks) - 1; - $block = &$this->tpldata; + $block = $this->tpldata; for ($i = 0; $i < $blockcount; $i++) { if (($pos = strpos($blocks[$i], '[')) !== false) @@ -305,11 +305,11 @@ class context $name = $blocks[$i]; $index = sizeof($block[$name]) - 1; } - $block = &$block[$name]; - $block = &$block[$index]; + $block = $block[$name]; + $block = $block[$index]; } - $block = &$block[$blocks[$i]]; // Traverse the last block + $block = $block[$blocks[$i]]; // Traverse the last block // Change key to zero (change first position) if false and to last position if true if ($key === false || $key === true) @@ -331,7 +331,7 @@ class context } } - return false; + return is_int($key) ? $key : false; } /** From 3e5e8fd0e3feb863bfb0d61b6c133216b100fdb8 Mon Sep 17 00:00:00 2001 From: rxu Date: Sun, 1 Jan 2017 23:38:01 +0700 Subject: [PATCH 06/17] [ticket/13344] Add core event to acp/info/acp_logs.php PHPBB3-13344 --- phpBB/includes/acp/info/acp_logs.php | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/phpBB/includes/acp/info/acp_logs.php b/phpBB/includes/acp/info/acp_logs.php index e9e6034cd4..559d5676a4 100644 --- a/phpBB/includes/acp/info/acp_logs.php +++ b/phpBB/includes/acp/info/acp_logs.php @@ -15,16 +15,30 @@ class acp_logs_info { function module() { + global $phpbb_dispatcher; + + $modes = array( + 'admin' => array('title' => 'ACP_ADMIN_LOGS', 'auth' => 'acl_a_viewlogs', 'cat' => array('ACP_FORUM_LOGS')), + 'mod' => array('title' => 'ACP_MOD_LOGS', 'auth' => 'acl_a_viewlogs', 'cat' => array('ACP_FORUM_LOGS')), + 'users' => array('title' => 'ACP_USERS_LOGS', 'auth' => 'acl_a_viewlogs', 'cat' => array('ACP_FORUM_LOGS')), + 'critical' => array('title' => 'ACP_CRITICAL_LOGS', 'auth' => 'acl_a_viewlogs', 'cat' => array('ACP_FORUM_LOGS')), + ); + + /** + * Event to add or modify ACP log modulemodes + * + * @event core.acp_logs_info_modify_modes + * @var array modes Array with modes info + * @since 3.1.11-RC1 + */ + $vars = array('modes'); + extract($phpbb_dispatcher->trigger_event('core.acp_logs_info_modify_modes', compact($vars))); + return array( 'filename' => 'acp_logs', 'title' => 'ACP_LOGGING', 'version' => '1.0.0', - 'modes' => array( - 'admin' => array('title' => 'ACP_ADMIN_LOGS', 'auth' => 'acl_a_viewlogs', 'cat' => array('ACP_FORUM_LOGS')), - 'mod' => array('title' => 'ACP_MOD_LOGS', 'auth' => 'acl_a_viewlogs', 'cat' => array('ACP_FORUM_LOGS')), - 'users' => array('title' => 'ACP_USERS_LOGS', 'auth' => 'acl_a_viewlogs', 'cat' => array('ACP_FORUM_LOGS')), - 'critical' => array('title' => 'ACP_CRITICAL_LOGS', 'auth' => 'acl_a_viewlogs', 'cat' => array('ACP_FORUM_LOGS')), - ), + 'modes' => $modes, ); } From 45ea013b111547ef684cc7c64dd91a6217935ab1 Mon Sep 17 00:00:00 2001 From: javiexin Date: Sun, 1 Jan 2017 21:22:29 +0100 Subject: [PATCH 07/17] [ticket/14943] Fix template loop access by index Allows inserting elements in a loop specified as 'outer[3].inner'. This was coded, but malfunctioning. Name incorrectly set on insert. PHPBB3-14943 --- phpBB/phpbb/template/context.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/phpBB/phpbb/template/context.php b/phpBB/phpbb/template/context.php index 8bf6c10e2d..f0bc4c859a 100644 --- a/phpBB/phpbb/template/context.php +++ b/phpBB/phpbb/template/context.php @@ -325,11 +325,13 @@ class context } $block = &$block[$blocks[$i]]; // Traverse the last block + $name = $blocks[$i]; } else { // Top-level block. $block = &$this->tpldata[$blockname]; + $name = $blockname; } // Change key to zero (change first position) if false and to last position if true @@ -378,7 +380,7 @@ class context } // Assign S_BLOCK_NAME - $vararray['S_BLOCK_NAME'] = $blockname; + $vararray['S_BLOCK_NAME'] = $name; // Re-position template blocks for ($i = sizeof($block); $i > $key; $i--) From c40642b8274c9afa39af6b34cd831bed8b960b83 Mon Sep 17 00:00:00 2001 From: javiexin Date: Sat, 7 Jan 2017 19:57:22 +0100 Subject: [PATCH 08/17] [ticket/14943] Fix template loop access by index Allows inserting elements in a loop specified as 'outer[3].inner'. This was coded, but malfunctioning. Name incorrectly set on insert. Added tests. PHPBB3-14943 --- tests/template/template_test.php | 123 ++++++++++++++++++++++++++++++- 1 file changed, 120 insertions(+), 3 deletions(-) diff --git a/tests/template/template_test.php b/tests/template/template_test.php index 0bbfe3848d..92de5d3fac 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -528,11 +528,11 @@ EOT ), array( 'outer', - array('VARIABLE' => 'pos #1'), + array('VARIABLE' => 'changed'), 0, 'change', << 'changed'), + array('S_ROW_NUM' => 2), + 'change', + << 'before'), + false, + 'insert', + << 'after'), + true, + 'insert', + << 'pos #1'), + 1, + 'insert', + << 'changed'), + 0, + 'change', + << 'changed'), + array('S_ROW_NUM' => 1), + 'change', + << Date: Sat, 7 Jan 2017 20:12:32 +0100 Subject: [PATCH 09/17] [ticket/14943] Fix template loop access by index Allows inserting elements in a loop specified as 'outer[3].inner'. This was coded, but malfunctioning. Name incorrectly set on insert. Added more tests. PHPBB3-14943 --- tests/template/template_test.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/template/template_test.php b/tests/template/template_test.php index 92de5d3fac..7231f71511 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -718,6 +718,16 @@ EOT $expect = 'outer - 0[outer|4]outer - 1[outer|4]middle - 0[middle|1]outer - 2 - test[outer|4]middle - 0[middle|2]middle - 1[middle|2]outer - 3[outer|4]middle - 0[middle|3]middle - 1[middle|3]middle - 2[middle|3]'; $this->assertEquals($expect, str_replace(array("\n", "\r", "\t"), '', $this->display('test')), 'Ensuring S_NUM_ROWS is correct after modification'); + + $this->template->alter_block_array('outer.middle', array()); + + $expect = 'outer - 0[outer|4]outer - 1[outer|4]middle - 0[middle|1]outer - 2 - test[outer|4]middle - 0[middle|2]middle - 1[middle|2]outer - 3[outer|4]middle - 0[middle|4]middle - 1[middle|4]middle - 2[middle|4]middle - 3[middle|4]'; + $this->assertEquals($expect, str_replace(array("\n", "\r", "\t"), '', $this->display('test')), 'Ensuring S_NUM_ROWS is correct after insertion at middle level'); + + $this->template->alter_block_array('outer.middle', array('VARIABLE' => 'test'), 2, 'change'); + + $expect = 'outer - 0[outer|4]outer - 1[outer|4]middle - 0[middle|1]outer - 2 - test[outer|4]middle - 0[middle|2]middle - 1[middle|2]outer - 3[outer|4]middle - 0[middle|4]middle - 1[middle|4]middle - 2 - test[middle|4]middle - 3[middle|4]'; + $this->assertEquals($expect, str_replace(array("\n", "\r", "\t"), '', $this->display('test')), 'Ensuring S_NUM_ROWS is correct after modification at middle level'); } public function assign_block_vars_array_data() From 20c03cccdde2302412d1e14adda370e7eb57b8e8 Mon Sep 17 00:00:00 2001 From: javiexin Date: Sun, 8 Jan 2017 00:00:47 +0100 Subject: [PATCH 10/17] [ticket/14944] Add possibility to search for template loop indexes by key Adds a new function to the template interface, and implements it in the context class. The function returns the ordinal index for a specified key, with the same structure that the key for alter_block_array. Reuses same code. Remove unneeded references, do nothing for int keys. Check out of bounds or wrong blockname errors. Added tests. PHPBB3-14944 --- phpBB/phpbb/template/context.php | 16 ++++++++++++-- tests/template/template_test.php | 37 ++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/phpBB/phpbb/template/context.php b/phpBB/phpbb/template/context.php index 1617ca3d19..8bfbd73f1a 100644 --- a/phpBB/phpbb/template/context.php +++ b/phpBB/phpbb/template/context.php @@ -305,16 +305,28 @@ class context $name = $blocks[$i]; $index = sizeof($block[$name]) - 1; } + if (!isset($block[$name])) + { + return false; + } $block = $block[$name]; + if (!isset($block[$index])) + { + return false; + } $block = $block[$index]; } + if (!isset($block[$blocks[$i]])) + { + return false; + } $block = $block[$blocks[$i]]; // Traverse the last block // Change key to zero (change first position) if false and to last position if true if ($key === false || $key === true) { - return ($key === false) ? 0 : sizeof($block); + return ($key === false) ? 0 : sizeof($block) - 1; } // Get correct position if array given @@ -331,7 +343,7 @@ class context } } - return is_int($key) ? $key : false; + return (is_int($key) && ((0 <= $key) && ($key < sizeof($block)))) ? $key : false; } /** diff --git a/tests/template/template_test.php b/tests/template/template_test.php index 0bbfe3848d..33fa4b63a0 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -603,6 +603,43 @@ EOT $this->assertEquals($expect, str_replace(array("\n", "\r", "\t"), '', $this->display('test')), 'Ensuring S_NUM_ROWS is correct after modification'); } + public function test_find_key_index() + { + $this->template->set_filenames(array('test' => 'loop_nested.html')); + + $this->template->assign_var('TEST_MORE', true); + + // @todo Change this + $this->template->assign_block_vars('outer', array('VARIABLE' => 'zero')); + $this->template->assign_block_vars('outer', array('VARIABLE' => 'one')); + $this->template->assign_block_vars('outer.middle', array('VARIABLE' => '1A')); + $this->template->assign_block_vars('outer', array('VARIABLE' => 'two')); + $this->template->assign_block_vars('outer.middle', array('VARIABLE' => '2A')); + $this->template->assign_block_vars('outer.middle', array('VARIABLE' => '2B')); + $this->template->assign_block_vars('outer', array('VARIABLE' => 'three')); + $this->template->assign_block_vars('outer.middle', array('VARIABLE' => '3A')); + $this->template->assign_block_vars('outer.middle', array('VARIABLE' => '3B')); + $this->template->assign_block_vars('outer.middle', array('VARIABLE' => '3C')); + + $expect = 'outer - 0 - zero[outer|4]outer - 1 - one[outer|4]middle - 0 - 1A[middle|1]outer - 2 - two[outer|4]middle - 0 - 2A[middle|2]middle - 1 - 2B[middle|2]outer - 3 - three[outer|4]middle - 0 - 3A[middle|3]middle - 1 - 3B[middle|3]middle - 2 - 3C[middle|3]'; + $this->assertEquals($expect, str_replace(array("\n", "\r", "\t"), '', $this->display('test')), 'Ensuring template is built correctly before modification'); + + $this->template->find_key_index('outer', false); + + $this->assertEquals(0, $this->template->find_key_index('outer', false), 'Find index at the beginning of outer loop'); + $this->assertEquals(1, $this->template->find_key_index('outer', 1), 'Find index by index in outer loop'); + $this->assertEquals(2, $this->template->find_key_index('outer', array('VARIABLE' => 'two')), 'Find index by key in outer loop'); + $this->assertEquals(3, $this->template->find_key_index('outer', true), 'Find index at the end of outer loop'); + $this->assertEquals(false, $this->template->find_key_index('outer', 7), 'Find index out of bounds of outer loop'); + + $this->assertEquals(false, $this->template->find_key_index('outer[0].middle', false), 'Find index at the beginning of middle loop, no middle block'); + $this->assertEquals(false, $this->template->find_key_index('outer[1].middle', 1), 'Find index by index in inner loop, out of bounds'); + $this->assertEquals(1, $this->template->find_key_index('outer[2].middle', array('VARIABLE' => '2B')), 'Find index by key in middle loop'); + $this->assertEquals(2, $this->template->find_key_index('outer.middle', true), 'Find index at the end of middle loop'); + + $this->assertEquals(false, $this->template->find_key_index('outer.wrong'), 'Wrong middle block name'); + $this->assertEquals(false, $this->template->find_key_index('wrong.middle'), 'Wrong outer block name'); + } public function assign_block_vars_array_data() { return array( From d2ad751851c955c19d1688cbe511925489212121 Mon Sep 17 00:00:00 2001 From: javiexin Date: Thu, 12 Jan 2017 21:25:39 +0100 Subject: [PATCH 11/17] [ticket/14943] Fix template loop access by index Allows inserting elements in a loop specified as 'outer[3].inner'. This was coded, but malfunctioning. Name incorrectly set on insert. If block was empty, the insertion process should create it. Checking for out of bounds indexes. PHPBB3-14943 --- phpBB/phpbb/template/context.php | 69 ++++++++++++++++++-------------- 1 file changed, 39 insertions(+), 30 deletions(-) diff --git a/phpBB/phpbb/template/context.php b/phpBB/phpbb/template/context.php index f0bc4c859a..4235a8543e 100644 --- a/phpBB/phpbb/template/context.php +++ b/phpBB/phpbb/template/context.php @@ -293,47 +293,49 @@ class context public function alter_block_array($blockname, array $vararray, $key = false, $mode = 'insert') { $this->num_rows_is_set = false; - if (strpos($blockname, '.') !== false) + + // For nested block, $blockcount > 0, for top-level block, $blockcount == 0 + $blocks = explode('.', $blockname); + $blockcount = sizeof($blocks) - 1; + + $block = &$this->tpldata; + for ($i = 0; $i < $blockcount; $i++) { - // Nested block. - $blocks = explode('.', $blockname); - $blockcount = sizeof($blocks) - 1; - - $block = &$this->tpldata; - for ($i = 0; $i < $blockcount; $i++) + if (($pos = strpos($blocks[$i], '[')) !== false) { - if (($pos = strpos($blocks[$i], '[')) !== false) - { - $name = substr($blocks[$i], 0, $pos); + $name = substr($blocks[$i], 0, $pos); - if (strpos($blocks[$i], '[]') === $pos) - { - $index = sizeof($block[$name]) - 1; - } - else - { - $index = min((int) substr($blocks[$i], $pos + 1, -1), sizeof($block[$name]) - 1); - } + if (strpos($blocks[$i], '[]') === $pos) + { + $index = sizeof($block[$name]) - 1; } else { - $name = $blocks[$i]; - $index = sizeof($block[$name]) - 1; + $index = min((int) substr($blocks[$i], $pos + 1, -1), sizeof($block[$name]) - 1); } - $block = &$block[$name]; - $block = &$block[$index]; } + else + { + $name = $blocks[$i]; + $index = sizeof($block[$name]) - 1; + } + $block = &$block[$name]; + $block = &$block[$index]; + } + $name = $blocks[$i]; - $block = &$block[$blocks[$i]]; // Traverse the last block - $name = $blocks[$i]; - } - else + // If last block does not exist and we are inserting, and not searching for key, we create it empty; otherwise, nothing to do + if (!isset($block[$name])) { - // Top-level block. - $block = &$this->tpldata[$blockname]; - $name = $blockname; + if ($mode != 'insert' || is_array($key)) + { + return false; + } + $block[$name] = array(); } + $block = &$block[$name]; // Now we can traverse the last block + // Change key to zero (change first position) if false and to last position if true if ($key === false || $key === true) { @@ -373,8 +375,9 @@ class context unset($block[($key - 1)]['S_LAST_ROW']); $vararray['S_LAST_ROW'] = true; } - else if ($key === 0) + if ($key <= 0) { + $key = 0; unset($block[0]['S_FIRST_ROW']); $vararray['S_FIRST_ROW'] = true; } @@ -400,6 +403,12 @@ class context // Which block to change? if ($mode == 'change') { + // If key is out of bounds, do not change anything + if ($key > sizeof($block) || $key < 0) + { + return false; + } + if ($key == sizeof($block)) { $key--; From 74f723e4ec0858235729f1d4e3daec53d9e88c84 Mon Sep 17 00:00:00 2001 From: javiexin Date: Thu, 12 Jan 2017 22:26:56 +0100 Subject: [PATCH 12/17] [ticket/14995] Add ACP template events acp_ext_list_*_name_after PHPBB3-14995 --- phpBB/adm/style/acp_ext_list.html | 4 ++-- phpBB/docs/events.md | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/phpBB/adm/style/acp_ext_list.html b/phpBB/adm/style/acp_ext_list.html index ccc39ea76d..af9e00a614 100644 --- a/phpBB/adm/style/acp_ext_list.html +++ b/phpBB/adm/style/acp_ext_list.html @@ -48,7 +48,7 @@ - {enabled.META_DISPLAY_NAME} + {enabled.META_DISPLAY_NAME} style="color: #228822;"style="color: #BC2A4D;">{enabled.META_VERSION} @@ -73,7 +73,7 @@ - {disabled.META_DISPLAY_NAME} + {disabled.META_DISPLAY_NAME} style="color: #228822;"style="color: #BC2A4D;">{disabled.META_VERSION} diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md index 0ebaf8f3e0..2de2d7d8bc 100644 --- a/phpBB/docs/events.md +++ b/phpBB/docs/events.md @@ -46,6 +46,18 @@ acp_email_find_username_append * Since: 3.1.7-RC1 * Purpose: Add content at the end of the fimd username link +acp_ext_list_disabled_name_after +=== +* Location: adm/style/acp_ext_list.html +* Since: 3.1.11-RC1 +* Purpose: Add content after the name of disabled extensions in the list + +acp_ext_list_enabled_name_after +=== +* Location: adm/style/acp_ext_list.html +* Since: 3.1.11-RC1 +* Purpose: Add content after the name of enabled extensions in the list + acp_email_find_username_prepend === * Location: adm/style/acp_email.html From 779758f2195f87868da3694b5ffd00adee1be0b3 Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Sun, 4 Dec 2016 17:30:42 +0100 Subject: [PATCH 13/17] [ticket/13429] Replace @change with @changed PHPBB3-13429 --- phpBB/download/file.php | 2 +- phpBB/includes/functions.php | 6 +++--- phpBB/includes/functions_admin.php | 2 +- phpBB/includes/functions_display.php | 2 +- phpBB/includes/functions_posting.php | 2 +- phpBB/includes/functions_user.php | 2 +- phpBB/includes/mcp/mcp_main.php | 2 +- phpBB/includes/mcp/mcp_post.php | 2 +- phpBB/includes/message_parser.php | 2 +- phpBB/includes/ucp/ucp_pm_viewmessage.php | 2 +- phpBB/includes/ucp/ucp_prefs.php | 2 +- phpBB/memberlist.php | 4 ++-- phpBB/phpbb/avatar/driver/upload.php | 2 +- phpBB/phpbb/event/php_exporter.php | 8 ++++---- phpBB/posting.php | 18 +++++++++--------- phpBB/search.php | 16 ++++++++-------- phpBB/viewforum.php | 10 +++++----- phpBB/viewonline.php | 4 ++-- phpBB/viewtopic.php | 14 +++++++------- tests/event/fixtures/trigger_many_vars.test | 2 +- tests/event/php_exporter_test.php | 16 ++++++++-------- 21 files changed, 60 insertions(+), 60 deletions(-) diff --git a/phpBB/download/file.php b/phpBB/download/file.php index 56ea273d5c..e60ffad6b0 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -262,7 +262,7 @@ else * @var string mode Download mode * @var bool thumbnail Flag indicating if the file is a thumbnail * @since 3.1.6-RC1 - * @change 3.1.7-RC1 Fixing wrong name of a variable (replacing "extension" by "extensions") + * @changed 3.1.7-RC1 Fixing wrong name of a variable (replacing "extension" by "extensions") */ $vars = array( 'attach_id', diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index e5e54e28d7..a152d9b620 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2636,7 +2636,7 @@ function add_form_key($form_name, $template_variable_suffix = '') * @var string template_variable_suffix The string that is appended to template variable name * * @since 3.1.0-RC3 - * @change 3.1.11-RC1 Added template_variable_suffix + * @changed 3.1.11-RC1 Added template_variable_suffix */ $vars = array( 'form_name', @@ -2928,7 +2928,7 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa * @var string redirect Redirect string * @var bool admin Is admin? * @since 3.1.0-RC5 - * @change 3.1.9-RC1 Removed undefined return variable + * @changed 3.1.9-RC1 Removed undefined return variable */ $vars = array('redirect', 'admin'); extract($phpbb_dispatcher->trigger_event('core.login_box_redirect', compact($vars))); @@ -4310,7 +4310,7 @@ function obtain_users_online_string($online_users, $item_id = 0, $item = 'forum' * session_forum_id * @var array sql_ary SQL query array to obtain users online data * @since 3.1.4-RC1 - * @change 3.1.7-RC1 Change sql query into array and adjust var accordingly. Allows extension authors the ability to adjust the sql_ary. + * @changed 3.1.7-RC1 Change sql query into array and adjust var accordingly. Allows extension authors the ability to adjust the sql_ary. */ $vars = array('online_users', 'item_id', 'item', 'sql_ary'); extract($phpbb_dispatcher->trigger_event('core.obtain_users_online_string_sql', compact($vars))); diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index dabdd80bc6..1dc246ec33 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -2611,7 +2611,7 @@ function prune($forum_id, $prune_mode, $prune_date, $prune_flags = 0, $auto_sync * @var string sql_and SQL text appended to where clause * @var int prune_limit The prune limit * @since 3.1.3-RC1 - * @change 3.1.10-RC1 Added prune_limit + * @changed 3.1.10-RC1 Added prune_limit */ $vars = array( 'forum_id', diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 4881dde6f5..9d94b56e32 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -646,7 +646,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod * @var array row The data of the forum * @var array subforums_row Template data of subforums * @since 3.1.0-a1 - * @change 3.1.0-b5 Added var subforums_row + * @changed 3.1.0-b5 Added var subforums_row */ $vars = array('forum_row', 'row', 'subforums_row'); extract($phpbb_dispatcher->trigger_event('core.display_forums_modify_template_vars', compact($vars))); diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 30f5ba91ef..ba367e5eeb 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -2514,7 +2514,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u * @var string url The "Return to topic" URL * * @since 3.1.0-a3 - * @change 3.1.0-RC3 Added vars mode, subject, username, topic_type, + * @changed 3.1.0-RC3 Added vars mode, subject, username, topic_type, * poll, update_message, update_search_index */ $vars = array( diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index f4c5c4b84c..6972f94dcc 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -276,7 +276,7 @@ function user_add($user_row, $cp_data = false, $notifications_data = null) * @var array cp_data Array of Custom profile fields submited to user_add * @var array sql_ary Array of data to be inserted when a user is added * @since 3.1.0-a1 - * @change 3.1.0-b5 Added user_row and cp_data + * @changed 3.1.0-b5 Added user_row and cp_data */ $vars = array('user_row', 'cp_data', 'sql_ary'); extract($phpbb_dispatcher->trigger_event('core.user_add_modify_data', compact($vars))); diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index b2441aed1b..5182593d76 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -164,7 +164,7 @@ class mcp_main * @var string action Topic quick moderation action name * @var bool quickmod Flag indicating whether MCP is in quick moderation mode * @since 3.1.0-a4 - * @change 3.1.0-RC4 Added variables: action, quickmod + * @changed 3.1.0-RC4 Added variables: action, quickmod */ $vars = array('action', 'quickmod'); extract($phpbb_dispatcher->trigger_event('core.modify_quickmod_actions', compact($vars))); diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php index 45f48419a0..2dcfcd608b 100644 --- a/phpBB/includes/mcp/mcp_post.php +++ b/phpBB/includes/mcp/mcp_post.php @@ -556,7 +556,7 @@ function change_poster(&$post_info, $userdata) * @var array userdata Information on a post's new poster * @var array post_info Information on the affected post * @since 3.1.6-RC1 - * @change 3.1.7-RC1 Change location to prevent post_info from being set to the new post information + * @changed 3.1.7-RC1 Change location to prevent post_info from being set to the new post information */ $vars = array('userdata', 'post_info'); extract($phpbb_dispatcher->trigger_event('core.mcp_change_poster_after', compact($vars))); diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index 16b65fb83e..bbd5e84233 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -1171,7 +1171,7 @@ class parse_message extends bbcode_firstpass * @var bool return Do we return after the event is triggered if $warn_msg is not empty * @var array warn_msg Array of the warning messages * @since 3.1.2-RC1 - * @change 3.1.3-RC1 Added vars $bbcode_bitfield and $bbcode_uid + * @changed 3.1.3-RC1 Added vars $bbcode_bitfield and $bbcode_uid */ $message = $this->message; $warn_msg = $this->warn_msg; diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php index 09e793d965..d7b9b32dbf 100644 --- a/phpBB/includes/ucp/ucp_pm_viewmessage.php +++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php @@ -267,7 +267,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) * @var array msg_data Template array with message data * @var array user_info User data of the sender * @since 3.1.0-a1 - * @change 3.1.6-RC1 Added user_info into event + * @changed 3.1.6-RC1 Added user_info into event */ $vars = array( 'id', diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php index 6eed423363..e63e9b4c08 100644 --- a/phpBB/includes/ucp/ucp_prefs.php +++ b/phpBB/includes/ucp/ucp_prefs.php @@ -69,7 +69,7 @@ class ucp_prefs * @var array data Array with current ucp options data * @var array error Array with list of errors * @since 3.1.0-a1 - * @change 3.1.4-RC1 Added error variable to the event + * @changed 3.1.4-RC1 Added error variable to the event */ $vars = array('submit', 'data', 'error'); extract($phpbb_dispatcher->trigger_event('core.ucp_prefs_personal_data', compact($vars))); diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index 1f8dfc14c3..b93476b3bb 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -665,8 +665,8 @@ switch ($mode) * @var bool foe Is the user foe? * @var array profile_fields Array with user's profile field data * @since 3.1.0-a1 - * @change 3.1.0-b2 Added friend and foe status - * @change 3.1.0-b3 Added profile fields data + * @changed 3.1.0-b2 Added friend and foe status + * @changed 3.1.0-b3 Added profile fields data */ $vars = array( 'member', diff --git a/phpBB/phpbb/avatar/driver/upload.php b/phpBB/phpbb/avatar/driver/upload.php index 9e3f208210..cb8dfcad4f 100644 --- a/phpBB/phpbb/avatar/driver/upload.php +++ b/phpBB/phpbb/avatar/driver/upload.php @@ -186,7 +186,7 @@ class upload extends \phpbb\avatar\driver\driver * @var array row Array with avatar row data * @var array error Array of errors, if filled in by this event file will not be moved * @since 3.1.6-RC1 - * @change 3.1.9-RC1 Added filedata + * @changed 3.1.9-RC1 Added filedata */ $vars = array( 'filedata', diff --git a/phpBB/phpbb/event/php_exporter.php b/phpBB/phpbb/event/php_exporter.php index 8923d35f6d..ae3553c558 100644 --- a/phpBB/phpbb/event/php_exporter.php +++ b/phpBB/phpbb/event/php_exporter.php @@ -508,7 +508,7 @@ class php_exporter } /** - * Find the "@change" Information lines + * Find the "@changed" Information lines * * @param string $tag_name Should be 'change', not 'changed' * @return array Absolute line numbers @@ -648,7 +648,7 @@ class php_exporter } /** - * Validate "@change" Information + * Validate "@changed" Information * * @param string $line * @return string @@ -658,10 +658,10 @@ class php_exporter { $match = array(); $line = str_replace("\t", ' ', ltrim($line, "\t ")); - preg_match('#^\* @change (\d+\.\d+\.\d+(?:-(?:a|b|RC|pl)\d+)?)( (?:.*))?$#', $line, $match); + preg_match('#^\* @changed (\d+\.\d+\.\d+(?:-(?:a|b|RC|pl)\d+)?)( (?:.*))?$#', $line, $match); if (!isset($match[2])) { - throw new \LogicException("Invalid '@change' information for event " + throw new \LogicException("Invalid '@changed' information for event " . "'{$this->current_event}' in file '{$this->current_file}:{$this->current_event_line}'"); } diff --git a/phpBB/posting.php b/phpBB/posting.php index 6f8225c198..18d17b8006 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -84,7 +84,7 @@ $current_time = time(); * NOTE: Should be actual language strings, NOT * language keys. * @since 3.1.0-a1 -* @change 3.1.2-RC1 Removed 'delete' var as it does not exist +* @changed 3.1.2-RC1 Removed 'delete' var as it does not exist */ $vars = array( 'post_id', @@ -373,7 +373,7 @@ switch ($mode) * @var bool is_authed Does the user have the required permissions? * @var array post_data All post data from database * @since 3.1.3-RC1 -* @change 3.1.10-RC1 Added post_data +* @changed 3.1.10-RC1 Added post_data */ $vars = array( 'post_id', @@ -1261,7 +1261,7 @@ if ($submit || $preview || $refresh) * @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 - * @change 3.1.5-RC1 Added poll array to the event + * @changed 3.1.5-RC1 Added poll array to the event */ $vars = array( 'post_data', @@ -1385,7 +1385,7 @@ if ($submit || $preview || $refresh) * @var bool update_subject Boolean if the post subject was changed * NOTE: Should be actual language strings, NOT language keys. * @since 3.1.0-RC5 - * @change 3.1.6-RC1 remove submit and error from event Submit and Error are checked previously prior to running event + * @changed 3.1.6-RC1 remove submit and error from event Submit and Error are checked previously prior to running event */ $vars = array( 'post_data', @@ -1424,7 +1424,7 @@ if ($submit || $preview || $refresh) * @var string redirect_url URL the user is going to be redirected to * NOTE: Should be actual language strings, NOT language keys. * @since 3.1.0-RC5 - * @change 3.1.6-RC1 remove submit and error from event Submit and Error are checked previously prior to running event + * @changed 3.1.6-RC1 remove submit and error from event Submit and Error are checked previously prior to running event */ $vars = array( 'post_data', @@ -1869,13 +1869,13 @@ if (($mode == 'post' || ($mode == 'edit' && $post_id == $post_data['topic_first_ * posting page via $template->assign_vars() * @var object message_parser The message parser object * @since 3.1.0-a1 -* @change 3.1.0-b3 Added vars post_data, moderators, mode, page_title, +* @changed 3.1.0-b3 Added vars post_data, moderators, mode, page_title, * s_topic_icons, form_enctype, s_action, s_hidden_fields, * post_id, topic_id, forum_id, submit, preview, save, load, * delete, cancel, refresh, error, page_data, message_parser -* @change 3.1.2-RC1 Removed 'delete' var as it does not exist -* @change 3.1.5-RC1 Added poll variables to the page_data array -* @change 3.1.6-RC1 Added 'draft_id' var +* @changed 3.1.2-RC1 Removed 'delete' var as it does not exist +* @changed 3.1.5-RC1 Added poll variables to the page_data array +* @changed 3.1.6-RC1 Added 'draft_id' var */ $vars = array( 'post_data', diff --git a/phpBB/search.php b/phpBB/search.php index cbc6b0f55a..27ec8e4dab 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -343,7 +343,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) * @var array id_ary Array of post or topic ids for search result * @var string show_results 'posts' or 'topics' type of ids * @since 3.1.3-RC1 - * @change 3.1.10-RC1 Added id_ary, show_results + * @changed 3.1.10-RC1 Added id_ary, show_results */ $vars = array( 'keywords', @@ -692,8 +692,8 @@ if ($keywords || $author || $author_id || $search_id || $submit) * @var int total_match_count The total number of search matches * @var array ex_fid_ary Array of excluded forum ids * @since 3.1.7-RC1 - * @change 3.1.10-RC1 Added show_results, sql_where, total_match_count - * @change 3.1.11-RC1 Added ex_fid_ary + * @changed 3.1.10-RC1 Added show_results, sql_where, total_match_count + * @changed 3.1.11-RC1 Added ex_fid_ary */ $vars = array( 'u_search', @@ -830,8 +830,8 @@ if ($keywords || $author || $author_id || $search_id || $submit) * @var string sort_key The sorting key * @var string sql_order_by The SQL ORDER BY string used by search to get topic data * @since 3.1.0-a1 - * @change 3.1.0-RC5 Added total_match_count - * @change 3.1.7-RC1 Added sort_by_sql, sort_dir, sort_key, sql_order_by + * @changed 3.1.0-RC5 Added total_match_count + * @changed 3.1.7-RC1 Added sort_by_sql, sort_dir, sort_key, sql_order_by */ $vars = array( 'sql_select', @@ -1021,7 +1021,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) * @var string view Search results view mode * @var array zebra Array with zebra data for the current user * @since 3.1.0-b4 - * @change 3.1.0-b5 Added var show_results + * @changed 3.1.0-b5 Added var show_results */ $vars = array( 'attachments', @@ -1198,7 +1198,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) * @var array zebra The zebra data of the current user * @var array attachments All the attachments of the search results * @since 3.1.0-a1 - * @change 3.1.0-b3 Added vars show_results, topic_title, replies, + * @changed 3.1.0-b3 Added vars show_results, topic_title, replies, * view_topic_url, folder_img, folder_alt, topic_type, unread_topic, * topic_unapproved, posts_unapproved, topic_deleted, u_mcp_queue, * zebra, attachments @@ -1302,7 +1302,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) * @var int total_match_count The count of search results * @var string keywords The search keywords * @since 3.1.0-RC4 - * @change 3.1.6-RC1 Added total_match_count and keywords + * @changed 3.1.6-RC1 Added total_match_count and keywords */ $vars = array( 'author_id', diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index d93afc7bb7..f8913d3273 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -431,9 +431,9 @@ $sql_array = array( * Author, Post time, Replies, Subject, Views * @var string sort_dir Either "a" for ascending or "d" for descending * @since 3.1.0-a1 -* @change 3.1.0-RC4 Added forum_data var -* @change 3.1.4-RC1 Added forum_id, topics_count, sort_days, sort_key and sort_dir vars -* @change 3.1.9-RC1 Fix types of properties +* @changed 3.1.0-RC4 Added forum_data var +* @changed 3.1.4-RC1 Added forum_id, topics_count, sort_days, sort_key and sort_dir vars +* @changed 3.1.9-RC1 Fix types of properties */ $vars = array( 'forum_data', @@ -631,7 +631,7 @@ $sql_ary = array( * * @since 3.1.0-RC4 * -* @change 3.1.3 Added forum_data +* @changed 3.1.3 Added forum_data */ $vars = array( 'forum_data', @@ -945,7 +945,7 @@ if (sizeof($topic_list)) * @var bool s_type_switch_test Flag indicating if the test topic type is [global] announcement * @since 3.1.0-a1 * - * @change 3.1.10-RC1 Added s_type_switch, s_type_switch_test + * @changed 3.1.10-RC1 Added s_type_switch, s_type_switch_test */ $vars = array('row', 'topic_row', 's_type_switch', 's_type_switch_test'); extract($phpbb_dispatcher->trigger_event('core.viewforum_modify_topicrow', compact($vars))); diff --git a/phpBB/viewonline.php b/phpBB/viewonline.php index 8bfa422e26..5cb1175528 100644 --- a/phpBB/viewonline.php +++ b/phpBB/viewonline.php @@ -168,7 +168,7 @@ $sql_ary = array( * @var int guest_counter Number of guests displayed * @var array forum_data Array with forum data * @since 3.1.0-a1 -* @change 3.1.0-a2 Added vars guest_counter and forum_data +* @changed 3.1.0-a2 Added vars guest_counter and forum_data */ $vars = array('sql_ary', 'show_guests', 'guest_counter', 'forum_data'); extract($phpbb_dispatcher->trigger_event('core.viewonline_modify_sql', compact($vars))); @@ -385,7 +385,7 @@ while ($row = $db->sql_fetchrow($result)) * @var string location_url Page url to displayed in the list * @var array forum_data Array with forum data * @since 3.1.0-a1 - * @change 3.1.0-a2 Added var forum_data + * @changed 3.1.0-a2 Added var forum_data */ $vars = array('on_page', 'row', 'location', 'location_url', 'forum_data'); extract($phpbb_dispatcher->trigger_event('core.viewonline_overwrite_location', compact($vars))); diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 780e43e09b..d3a2085d82 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -678,7 +678,7 @@ $base_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t= * @var int total_posts Topic total posts count * @var string viewtopic_url URL to the topic page * @since 3.1.0-RC4 -* @change 3.1.2-RC1 Added viewtopic_url +* @changed 3.1.2-RC1 Added viewtopic_url */ $vars = array( 'base_url', @@ -1178,7 +1178,7 @@ $sql_ary = array( * @var int start Pagination information * @var array sql_ary The SQL array to get the data of posts and posters * @since 3.1.0-a1 -* @change 3.1.0-a2 Added vars forum_id, topic_id, topic_data, post_list, sort_days, sort_key, sort_dir, start +* @changed 3.1.0-a2 Added vars forum_id, topic_id, topic_data, post_list, sort_days, sort_key, sort_dir, start */ $vars = array( 'forum_id', @@ -1986,9 +1986,9 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) * @var array post_row Template block array of the post * @var array topic_data Array with topic data * @since 3.1.0-a1 - * @change 3.1.0-a3 Added vars start, current_row_number, end, attachments - * @change 3.1.0-b3 Added topic_data array, total_posts - * @change 3.1.0-RC3 Added poster_id + * @changed 3.1.0-a3 Added vars start, current_row_number, end, attachments + * @changed 3.1.0-b3 Added topic_data array, total_posts + * @changed 3.1.0-RC3 Added poster_id */ $vars = array( 'start', @@ -2086,7 +2086,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) * @var array post_row Template block array of the post * @var array topic_data Array with topic data * @since 3.1.0-a3 - * @change 3.1.0-b3 Added topic_data array, total_posts + * @changed 3.1.0-b3 Added topic_data array, total_posts */ $vars = array( 'start', @@ -2249,7 +2249,7 @@ $page_title = $topic_data['topic_title'] . ($start ? ' - ' . sprintf($user->lang * @var int start Start offset used to calculate the page * @var array post_list Array with post_ids we are going to display * @since 3.1.0-a1 -* @change 3.1.0-RC4 Added post_list var +* @changed 3.1.0-RC4 Added post_list var */ $vars = array('page_title', 'topic_data', 'forum_id', 'start', 'post_list'); extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_page_title', compact($vars))); diff --git a/tests/event/fixtures/trigger_many_vars.test b/tests/event/fixtures/trigger_many_vars.test index a624138588..5e0720d13b 100644 --- a/tests/event/fixtures/trigger_many_vars.test +++ b/tests/event/fixtures/trigger_many_vars.test @@ -34,7 +34,7 @@ * posting page via $template->assign_vars() * @var object message_parser The message parser object * @since 3.1.0-a1 - * @change 3.1.0-b3 Added vars post_data, moderators, mode, page_title, + * @changed 3.1.0-b3 Added vars post_data, moderators, mode, page_title, * s_topic_icons, form_enctype, s_action, s_hidden_fields, * post_id, topic_id, forum_id, submit, preview, save, load, * delete, cancel, refresh, error, page_data, message_parser diff --git a/tests/event/php_exporter_test.php b/tests/event/php_exporter_test.php index a3d7f27ced..692a57f93c 100644 --- a/tests/event/php_exporter_test.php +++ b/tests/event/php_exporter_test.php @@ -552,7 +552,7 @@ class phpbb_event_php_exporter_test extends phpbb_test_case '* @since 3.1.0-a1', '/**', '* @since 3.1.0-a1', - '* @change 3.1.0-a2', + '* @changed 3.1.0-a2', '*/', '$phpbb_dispatcher->dispatch(\'test\');', ), @@ -590,9 +590,9 @@ class phpbb_event_php_exporter_test extends phpbb_test_case array( array( '/**', - '* @change 3.1.0-a1', - '* @change 3.1.0-a2', - '* @change 3.1.0-a3', + '* @changed 3.1.0-a1', + '* @changed 3.1.0-a2', + '* @changed 3.1.0-a3', '*/', '$phpbb_dispatcher->dispatch(\'test\');', ), @@ -657,7 +657,7 @@ class phpbb_event_php_exporter_test extends phpbb_test_case ' * Hello Bertie!', ' *', ' * @since 3.1.0-a1', - ' * @change 3.1.0-a2', + ' * @changed 3.1.0-a2', ' */', ' $phpbb_dispatcher->dispatch(\'test\');', ), @@ -691,9 +691,9 @@ class phpbb_event_php_exporter_test extends phpbb_test_case array( array( '/**', - '* @change 3.1.0-a1', - '* @change 3.1.0-a2', - '* @change 3.1.0-a3', + '* @changed 3.1.0-a1', + '* @changed 3.1.0-a2', + '* @changed 3.1.0-a3', '*/', '$phpbb_dispatcher->dispatch(\'test\');', ), From 849fd9df7d9b2e449801e14ef54584fc8e063d43 Mon Sep 17 00:00:00 2001 From: javiexin Date: Sat, 28 Jan 2017 21:34:08 +0100 Subject: [PATCH 14/17] [ticket/14944] Add possibility to search for template loop indexes by key Adds a new function to the template interface, and implements it in the context class. The function returns the ordinal index for a specified key, with the same structure that the key for alter_block_array. Reuses same code. Remove unneeded references, do nothing for int keys. Check out of bounds or wrong blockname errors. Added tests. Remove default parameter value. PHPBB3-14944 --- phpBB/phpbb/template/base.php | 2 +- phpBB/phpbb/template/context.php | 2 +- phpBB/phpbb/template/template.php | 2 +- tests/template/template_test.php | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/phpBB/phpbb/template/base.php b/phpBB/phpbb/template/base.php index bc0f022cc4..41c0a01ba8 100644 --- a/phpBB/phpbb/template/base.php +++ b/phpBB/phpbb/template/base.php @@ -135,7 +135,7 @@ abstract class base implements template /** * {@inheritdoc} */ - public function find_key_index($blockname, $key = false) + public function find_key_index($blockname, $key) { return $this->context->find_key_index($blockname, $key); } diff --git a/phpBB/phpbb/template/context.php b/phpBB/phpbb/template/context.php index 8bfbd73f1a..e70d0574be 100644 --- a/phpBB/phpbb/template/context.php +++ b/phpBB/phpbb/template/context.php @@ -278,7 +278,7 @@ class context * * @return mixed false if not found, index position otherwise; be sure to test with === */ - public function find_key_index($blockname, $key = false) + public function find_key_index($blockname, $key) { // For nested block, $blockcount > 0, for top-level block, $blockcount == 0 $blocks = explode('.', $blockname); diff --git a/phpBB/phpbb/template/template.php b/phpBB/phpbb/template/template.php index b5a6ab32dc..9e3d658ca8 100644 --- a/phpBB/phpbb/template/template.php +++ b/phpBB/phpbb/template/template.php @@ -187,7 +187,7 @@ interface template * * @return mixed false if not found, index position otherwise; be sure to test with === */ - public function find_key_index($blockname, $key = false); + public function find_key_index($blockname, $key); /** * Get path to template for handle (required for BBCode parser) diff --git a/tests/template/template_test.php b/tests/template/template_test.php index 33fa4b63a0..997da80246 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -637,8 +637,8 @@ EOT $this->assertEquals(1, $this->template->find_key_index('outer[2].middle', array('VARIABLE' => '2B')), 'Find index by key in middle loop'); $this->assertEquals(2, $this->template->find_key_index('outer.middle', true), 'Find index at the end of middle loop'); - $this->assertEquals(false, $this->template->find_key_index('outer.wrong'), 'Wrong middle block name'); - $this->assertEquals(false, $this->template->find_key_index('wrong.middle'), 'Wrong outer block name'); + $this->assertEquals(false, $this->template->find_key_index('outer.wrong', true), 'Wrong middle block name'); + $this->assertEquals(false, $this->template->find_key_index('wrong.middle', false), 'Wrong outer block name'); } public function assign_block_vars_array_data() { From 1b46435734492f6d28456cf95ddb355d710c0f22 Mon Sep 17 00:00:00 2001 From: david63 Date: Mon, 19 Dec 2016 11:23:58 +0000 Subject: [PATCH 15/17] [ticket/14927] Add items to core.user_add_modify_data PHPBB3-14927 --- phpBB/includes/functions_user.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 2a421f532f..175998d51f 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -272,13 +272,19 @@ function user_add($user_row, $cp_data = false, $notifications_data = null) * Use this event to modify the values to be inserted when a user is added * * @event core.user_add_modify_data - * @var array user_row Array of user details submited to user_add - * @var array cp_data Array of Custom profile fields submited to user_add - * @var array sql_ary Array of data to be inserted when a user is added + * @var array user_row Array of user details submited to user_add + * @var array cp_data Array of Custom profile fields submited to user_add + * @var array sql_ary Array of data to be inserted when a user is added * @since 3.1.0-a1 * @changed 3.1.0-b5 Added user_row and cp_data + * @var array notifications_data Array of notification data to be inserted when a user is added + * @change 3.2.0 */ - $vars = array('user_row', 'cp_data', 'sql_ary'); + $vars = array( + 'user_row', + 'cp_data', + 'sql_ary', + 'notifications_data'); extract($phpbb_dispatcher->trigger_event('core.user_add_modify_data', compact($vars))); $sql = 'INSERT INTO ' . USERS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); From bac6dbda5e457ba5d1347b342616433be75b590d Mon Sep 17 00:00:00 2001 From: david63 Date: Wed, 21 Dec 2016 14:04:32 +0000 Subject: [PATCH 16/17] [ticket/14927] Corrected order in docblock of event & target version PHPBB3-14927 --- phpBB/includes/functions_user.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 175998d51f..f222f33eb2 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -275,10 +275,10 @@ function user_add($user_row, $cp_data = false, $notifications_data = null) * @var array user_row Array of user details submited to user_add * @var array cp_data Array of Custom profile fields submited to user_add * @var array sql_ary Array of data to be inserted when a user is added + * @var array notifications_data Array of notification data to be inserted when a user is added * @since 3.1.0-a1 * @changed 3.1.0-b5 Added user_row and cp_data - * @var array notifications_data Array of notification data to be inserted when a user is added - * @change 3.2.0 + * @changed 3.1.11-RC1 Added notifications_data */ $vars = array( 'user_row', From bc86210db82e4336a82389cb26e652a2ce63f7c7 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 21 Feb 2017 22:15:12 +0100 Subject: [PATCH 17/17] [ticket/14927] Put vars on one line PHPBB3-14927 --- phpBB/includes/functions_user.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index f222f33eb2..4aecbff6ba 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -280,11 +280,7 @@ function user_add($user_row, $cp_data = false, $notifications_data = null) * @changed 3.1.0-b5 Added user_row and cp_data * @changed 3.1.11-RC1 Added notifications_data */ - $vars = array( - 'user_row', - 'cp_data', - 'sql_ary', - 'notifications_data'); + $vars = array('user_row', 'cp_data', 'sql_ary', 'notifications_data'); extract($phpbb_dispatcher->trigger_event('core.user_add_modify_data', compact($vars))); $sql = 'INSERT INTO ' . USERS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);