From 36d4169768693b318fdda0e7f6dee2a1df6ed355 Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Sun, 13 Nov 2016 17:48:53 +0100 Subject: [PATCH 01/58] [ticket/14759] Add core.mcp_main_modify_shadow_sql event PHPBB3-14759 --- phpBB/includes/mcp/mcp_main.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index b2441aed1b..1e4a0a8850 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -463,7 +463,7 @@ function change_topic_type($action, $topic_ids) */ function mcp_move_topic($topic_ids) { - global $auth, $user, $db, $template, $phpbb_log, $request; + global $auth, $user, $db, $template, $phpbb_log, $request, $phpbb_dispatcher; global $phpEx, $phpbb_root_path; // Here we limit the operation to one forum only @@ -625,6 +625,18 @@ function mcp_move_topic($topic_ids) 'poll_last_vote' => (int) $row['poll_last_vote'] ); + /** + * Perform actions before shadow topic is created. + * + * @event core.mcp_main_modify_shadow_sql + * @var array shadow SQL array to be used by $db->sql_build_array + * @since 3.1.11-RC1 + */ + $vars = array( + 'shadow', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_main_modify_shadow_sql', compact($vars))); + $db->sql_query('INSERT INTO ' . TOPICS_TABLE . $db->sql_build_array('INSERT', $shadow)); // Shadow topics only count on new "topics" and not posts... a shadow topic alone has 0 posts From 114cfe2c270117061d103dae26e20afd13a276a2 Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Sun, 13 Nov 2016 17:44:22 +0100 Subject: [PATCH 02/58] [ticket/14760] Add core.mcp_main_modify_fork_sql event PHPBB3-14760 --- phpBB/includes/mcp/mcp_main.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index b2441aed1b..4a80143695 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -1281,6 +1281,18 @@ function mcp_fork_topic($topic_ids) 'poll_vote_change' => (int) $topic_row['poll_vote_change'], ); + /** + * Perform actions before forked topic is created. + * + * @event core.mcp_main_modify_fork_sql + * @var array sql_ary SQL array to be used by $db->sql_build_array + * @since 3.1.11-RC1 + */ + $vars = array( + 'sql_ary', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_main_modify_fork_sql', compact($vars))); + $db->sql_query('INSERT INTO ' . TOPICS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); $new_topic_id = $db->sql_nextid(); $new_topic_id_list[$topic_id] = $new_topic_id; From 34cfa5f8855d66b81f3dd673537915e9d6b2b90f Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Sun, 20 Nov 2016 18:53:59 +0100 Subject: [PATCH 03/58] [ticket/14390] Add ucp_main_front_user_activity_append/prepend PHPBB3-14390 --- phpBB/docs/events.md | 16 ++++++++++++++++ .../prosilver/template/ucp_main_front.html | 2 ++ .../subsilver2/template/ucp_main_front.html | 2 ++ 3 files changed, 20 insertions(+) diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md index 0ebaf8f3e0..5600581092 100644 --- a/phpBB/docs/events.md +++ b/phpBB/docs/events.md @@ -2009,6 +2009,14 @@ ucp_main_front_user_activity_after * Since: 3.1.6-RC1 * Purpose: Add content right after the user activity info viewing UCP front page +ucp_main_front_user_activity_append +=== +* Locations: + + styles/prosilver/template/ucp_main_front.html + + styles/subsilver2/template/ucp_main_front.html +* Since: 3.1.11-RC1 +* Purpose: Add content after last user activity info viewing UCP front page + ucp_main_front_user_activity_before === * Locations: @@ -2017,6 +2025,14 @@ ucp_main_front_user_activity_before * Since: 3.1.6-RC1 * Purpose: Add content right before the user activity info viewing UCP front page +ucp_main_front_user_activity_prepend +=== +* Locations: + + styles/prosilver/template/ucp_main_front.html + + styles/subsilver2/template/ucp_main_front.html +* Since: 3.1.11-RC1 +* Purpose: Add content before first user activity info viewing UCP front page + ucp_pm_history_post_buttons_after === * Locations: diff --git a/phpBB/styles/prosilver/template/ucp_main_front.html b/phpBB/styles/prosilver/template/ucp_main_front.html index 7bc8d40078..056ea300d8 100644 --- a/phpBB/styles/prosilver/template/ucp_main_front.html +++ b/phpBB/styles/prosilver/template/ucp_main_front.html @@ -55,12 +55,14 @@
+
{L_JOINED}{L_COLON}
{JOINED}
{L_LAST_ACTIVE}{L_COLON}
{LAST_VISIT_YOU}
{L_TOTAL_POSTS}{L_COLON}
{POSTS} | {L_SEARCH_YOUR_POSTS}
({POSTS_DAY} / {POSTS_PCT}){POSTS}
{L_ACTIVE_IN_FORUM}{L_COLON}
{ACTIVE_FORUM}
({ACTIVE_FORUM_POSTS} / {ACTIVE_FORUM_PCT})
{L_ACTIVE_IN_TOPIC}{L_COLON}
{ACTIVE_TOPIC}
({ACTIVE_TOPIC_POSTS} / {ACTIVE_TOPIC_PCT})
{L_YOUR_WARNINGS}{L_COLON}
{WARNING_IMG} [{WARNINGS}]
+
diff --git a/phpBB/styles/subsilver2/template/ucp_main_front.html b/phpBB/styles/subsilver2/template/ucp_main_front.html index 7fc906a126..485a58b7ab 100644 --- a/phpBB/styles/subsilver2/template/ucp_main_front.html +++ b/phpBB/styles/subsilver2/template/ucp_main_front.html @@ -38,6 +38,7 @@ + @@ -62,6 +63,7 @@ +
{L_JOINED}{L_COLON} {JOINED}{WARNING_IMG} [ {WARNINGS} ]
From 8e3a38e80de93958b68e9c6d4137d99774434c9f Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Sun, 20 Nov 2016 19:02:06 +0100 Subject: [PATCH 04/58] [ticket/14520] Add ucp_pm_viewmessage_options_before PHPBB3-14520 --- phpBB/docs/events.md | 7 +++++++ phpBB/styles/prosilver/template/ucp_pm_viewmessage.html | 1 + 2 files changed, 8 insertions(+) diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md index 0ebaf8f3e0..dc423c7005 100644 --- a/phpBB/docs/events.md +++ b/phpBB/docs/events.md @@ -2113,6 +2113,13 @@ ucp_pm_viewmessage_custom_fields_before * Purpose: Add data before the custom fields on the user profile when viewing a private message +ucp_pm_viewmessage_options_before +=== +* Locations: + + styles/prosilver/template/ucp_pm_viewmessage.html +* Since: 3.1.11-RC1 +* Purpose: Add content right before display options + ucp_pm_viewmessage_post_buttons_after === * Locations: diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html index d92b90a045..009a9bf975 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html +++ b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html @@ -146,6 +146,7 @@ +
{L_VIEW_PREVIOUS_PM} From 619d323dd1a2fcb54ec76e654331244c140aa38f Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Mon, 21 Nov 2016 16:41:20 +0100 Subject: [PATCH 05/58] [ticket/14524] Add core.ucp_register_requests_after PHPBB3-14524 --- phpBB/includes/ucp/ucp_register.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index 3426af95d0..52ed410b04 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -45,6 +45,28 @@ class ucp_register $change_lang = request_var('change_lang', ''); $user_lang = request_var('lang', $user->lang_name); + /** + * Add UCP register data before they are assigned to the template or submitted + * + * To assign data to the template, use $template->assign_vars() + * + * @event core.ucp_register_requests_after + * @var bool coppa Is set coppa + * @var bool agreed Did user agree to coppa? + * @var bool submit Is set post submit? + * @var string change_lang Change language request + * @var string user_lang User language request + * @since 3.1.11-RC1 + */ + $vars = array( + 'coppa', + 'agreed', + 'submit', + 'change_lang', + 'user_lang', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_register_requests_after', compact($vars))); + if ($agreed) { add_form_key('ucp_register'); From 255368843cf626f21e12722dfda4b9d321a56ad7 Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Mon, 21 Nov 2016 16:45:56 +0100 Subject: [PATCH 06/58] [ticket/14522] Add ucp_register_buttons_before PHPBB3-14522 --- phpBB/docs/events.md | 8 ++++++++ phpBB/styles/prosilver/template/ucp_register.html | 4 ++-- phpBB/styles/subsilver2/template/ucp_register.html | 2 ++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md index 0ebaf8f3e0..4747476023 100644 --- a/phpBB/docs/events.md +++ b/phpBB/docs/events.md @@ -2271,6 +2271,14 @@ ucp_profile_register_details_after * Since: 3.1.4-RC1 * Purpose: Add options in profile page fieldset - after confirm password field. +ucp_register_buttons_before +=== +* Locations: + + styles/prosilver/template/ucp_register.html + + styles/subsilver2/template/ucp_register.html +* Since: 3.1.11-RC1 +* Purpose: Add content before buttons in registration form. + ucp_register_credentials_before === * Locations: diff --git a/phpBB/styles/prosilver/template/ucp_register.html b/phpBB/styles/prosilver/template/ucp_register.html index 655c0fc48c..38413addba 100644 --- a/phpBB/styles/prosilver/template/ucp_register.html +++ b/phpBB/styles/prosilver/template/ucp_register.html @@ -79,8 +79,6 @@ - -
@@ -91,6 +89,8 @@
+ +
diff --git a/phpBB/styles/subsilver2/template/ucp_register.html b/phpBB/styles/subsilver2/template/ucp_register.html index 9b9e164df4..db26f51ebd 100644 --- a/phpBB/styles/subsilver2/template/ucp_register.html +++ b/phpBB/styles/subsilver2/template/ucp_register.html @@ -91,6 +91,8 @@ + + {S_HIDDEN_FIELDS}   From 4dcd2351ea5dfb523fd7a516e819d3556915aa54 Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Mon, 21 Nov 2016 16:51:42 +0100 Subject: [PATCH 07/58] [ticket/14331] Add core.get_user_rank_after PHPBB3-14331 --- phpBB/includes/functions_display.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 4881dde6f5..b49a8b80c0 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -1554,6 +1554,23 @@ function phpbb_get_user_rank($user_data, $user_posts) } } + /** + * Modify a user's rank before displaying + * + * @event core.get_user_rank_after + * @var array user_data Array with user's data + * @var int user_posts User_posts to change + * @var array user_rank_data User rank data + * @since 3.1.11-RC1 + */ + + $vars = array( + 'user_data', + 'user_posts', + 'user_rank_data', + ); + extract($phpbb_dispatcher->trigger_event('core.get_user_rank_after', compact($vars))); + return $user_rank_data; } From e9d8425f15c571df3b4c8eb0a7044a3ecbd8e373 Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Mon, 21 Nov 2016 17:05:41 +0100 Subject: [PATCH 08/58] [ticket/13845] Add core.ucp_profile_avatar_sql PHPBB3-13845 --- phpBB/includes/ucp/ucp_profile.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index 0be1930f1a..4a3d8133b3 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -633,10 +633,19 @@ class ucp_profile 'user_avatar_height' => $result['avatar_height'], ); + /** + * Trigger events on successfull avatar change + * + * @event core.ucp_profile_avatar_sql + * @var array result Array with data to be stored in DB + * @since 3.1.11-RC1 + */ + $vars = array('result'); + extract($phpbb_dispatcher->trigger_event('core.ucp_profile_avatar_sql', compact($vars))); + $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $result) . ' WHERE user_id = ' . (int) $user->data['user_id']; - $db->sql_query($sql); meta_refresh(3, $this->u_action); From 78ff392b646e6dbac1934fe91440ab0a63d4e084 Mon Sep 17 00:00:00 2001 From: Daniel Sinn Date: Tue, 29 Nov 2016 13:34:28 -0500 Subject: [PATCH 09/58] [ticket/14882] Add core event to MCP after move post sync PHPBB3-14882 --- phpBB/includes/functions_admin.php | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 1dc246ec33..61535efcd6 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -642,7 +642,7 @@ function move_posts($post_ids, $topic_id, $auto_sync = true) * @event core.move_posts_before * @var array post_ids Array of post ids to move * @var string topic_id The topic id the posts are moved to - * @var bool auto_sync Whether or not to perform auto sync + * @var bool auto_sync Whether or not to perform auto sync * @var array forum_ids Array of the forum ids the posts are moved from * @var array topic_ids Array of the topic ids the posts are moved from * @var array forum_row Array with the forum id of the topic the posts are moved to @@ -674,7 +674,7 @@ function move_posts($post_ids, $topic_id, $auto_sync = true) * @event core.move_posts_after * @var array post_ids Array of the moved post ids * @var string topic_id The topic id the posts are moved to - * @var bool auto_sync Whether or not to perform auto sync + * @var bool auto_sync Whether or not to perform auto sync * @var array forum_ids Array of the forum ids the posts are moved from * @var array topic_ids Array of the topic ids the posts are moved from * @var array forum_row Array with the forum id of the topic the posts are moved to @@ -698,6 +698,28 @@ function move_posts($post_ids, $topic_id, $auto_sync = true) sync('topic_attachment', 'topic_id', $topic_ids); sync('topic', 'topic_id', $topic_ids, true); sync('forum', 'forum_id', $forum_ids, true, true); + + /** + * Perform additional actions after move post sync + * + * @event core.move_posts_sync_after + * @var array post_ids Array of the moved post ids + * @var string topic_id The topic id the posts are moved to + * @var bool auto_sync Whether or not to perform auto sync + * @var array forum_ids Array of the forum ids the posts are moved from + * @var array topic_ids Array of the topic ids the posts are moved from + * @var array forum_row Array with the forum id of the topic the posts are moved to + * @since 3.1.11-RC1 + */ + $vars = array( + 'post_ids', + 'topic_id', + 'auto_sync', + 'forum_ids', + 'topic_ids', + 'forum_row', + ); + extract($phpbb_dispatcher->trigger_event('core.move_posts_sync_after', compact($vars))); } // Update posted information From 839987fa19598d6ebb541ae71e3650f89b129dd9 Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Sun, 20 Nov 2016 17:22:39 +0100 Subject: [PATCH 10/58] [ticket/14868] Add mcp_forum_actions_options template event PHPBB3-14868 --- phpBB/docs/events.md | 8 ++++++++ phpBB/styles/prosilver/template/mcp_forum.html | 1 + phpBB/styles/subsilver2/template/mcp_forum.html | 1 + 3 files changed, 10 insertions(+) diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md index 0ebaf8f3e0..3c77773c67 100644 --- a/phpBB/docs/events.md +++ b/phpBB/docs/events.md @@ -814,6 +814,14 @@ mcp_forum_actions_after * Since: 3.1.11-RC1 * Purpose: Add some information after actions fieldset +mcp_forum_actions_append +=== +* Locations: + + styles/prosilver/template/mcp_forum.html + + styles/subsilver2/template/mcp_forum.html +* Since: 3.1.11-RC1 +* Purpose: Add additional options to actions select + mcp_forum_actions_before === * Locations: diff --git a/phpBB/styles/prosilver/template/mcp_forum.html b/phpBB/styles/prosilver/template/mcp_forum.html index 5858a2c801..4c037f56ae 100644 --- a/phpBB/styles/prosilver/template/mcp_forum.html +++ b/phpBB/styles/prosilver/template/mcp_forum.html @@ -138,6 +138,7 @@ + diff --git a/phpBB/styles/subsilver2/template/mcp_forum.html b/phpBB/styles/subsilver2/template/mcp_forum.html index d905910c22..12447b2b1e 100644 --- a/phpBB/styles/subsilver2/template/mcp_forum.html +++ b/phpBB/styles/subsilver2/template/mcp_forum.html @@ -77,6 +77,7 @@ + From 47e418e50e9d516e768bd675892c3c4f5dfa571e Mon Sep 17 00:00:00 2001 From: javiexin Date: Mon, 5 Dec 2016 01:07:43 +0100 Subject: [PATCH 11/58] [ticket/14889] Missing method in profile fields type interface Completes the profile fields type interface by defining a missing required method for all implementations of a type. PHPBB3-14889 --- phpBB/phpbb/profilefields/type/type_interface.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/phpBB/phpbb/profilefields/type/type_interface.php b/phpBB/phpbb/profilefields/type/type_interface.php index ec770f9467..93b9e4b893 100644 --- a/phpBB/phpbb/profilefields/type/type_interface.php +++ b/phpBB/phpbb/profilefields/type/type_interface.php @@ -133,6 +133,14 @@ interface type_interface */ public function get_field_ident($field_data); + /** + * Get the localized name of the field + * + * @param string $field_name Unlocalized name of this field + * @return string Localized name of the field + */ + public function get_field_name($field_name); + /** * Get the column type for the database * From 800411e514795d88bf947c81aa1617478043ef0a Mon Sep 17 00:00:00 2001 From: rxu Date: Tue, 6 Dec 2016 23:35:04 +0700 Subject: [PATCH 12/58] [ticket/14893] Fix undefined variable on reporting PM notification PHPBB3-14893 --- phpBB/phpbb/notification/type/report_pm.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/phpBB/phpbb/notification/type/report_pm.php b/phpBB/phpbb/notification/type/report_pm.php index cc32984ac6..fc39623c5c 100644 --- a/phpBB/phpbb/notification/type/report_pm.php +++ b/phpBB/phpbb/notification/type/report_pm.php @@ -141,6 +141,8 @@ class report_pm extends \phpbb\notification\type\pm */ public function get_email_template_variables() { + $user_data = $this->user_loader->get_user($this->get_data('reporter_id')); + return array( 'AUTHOR_NAME' => htmlspecialchars_decode($user_data['username']), 'SUBJECT' => htmlspecialchars_decode(censor_text($this->get_data('message_subject'))), From 76ffd288fe5378410d0d811c48e096f42d27622f Mon Sep 17 00:00:00 2001 From: javiexin Date: Thu, 8 Dec 2016 12:16:07 +0100 Subject: [PATCH 13/58] [ticket/14887] ACP profile step one lang specific event PHPBB3-14887 --- phpBB/adm/style/acp_profile.html | 1 + phpBB/docs/events.md | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/phpBB/adm/style/acp_profile.html b/phpBB/adm/style/acp_profile.html index 07718846cc..cebd2e9632 100644 --- a/phpBB/adm/style/acp_profile.html +++ b/phpBB/adm/style/acp_profile.html @@ -127,6 +127,7 @@ +
diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md index 0ebaf8f3e0..bc7a9655e2 100644 --- a/phpBB/docs/events.md +++ b/phpBB/docs/events.md @@ -369,6 +369,13 @@ acp_profile_contact_before * Since: 3.1.6-RC1 * Purpose: Add extra options to custom profile field configuration in the ACP +acp_profile_step_one_lang_after +=== +* Locations: + + adm/style/acp_profile.html +* Since: 3.1.11-RC1 +* Purpose: Add extra lang specific options to custom profile field step one configuration in the ACP + acp_prune_forums_append === * Locations: From 959e5fb79d0a5b3cf0cd77a97bb59f1798ada46d Mon Sep 17 00:00:00 2001 From: javiexin Date: Sat, 10 Dec 2016 00:51:41 +0100 Subject: [PATCH 14/58] [ticket/14855] Update notification and PM alert bubbles Alternative implementation without removing notification from the DOM, but changing the class. So that style designers might have more options (show/not show). PHPBB3-14855 --- phpBB/styles/prosilver/template/ajax.js | 5 +++-- phpBB/styles/prosilver/template/navbar_header.html | 4 ++-- phpBB/styles/prosilver/theme/common.css | 4 ++++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/phpBB/styles/prosilver/template/ajax.js b/phpBB/styles/prosilver/template/ajax.js index 311da92a95..ec9b53328f 100644 --- a/phpBB/styles/prosilver/template/ajax.js +++ b/phpBB/styles/prosilver/template/ajax.js @@ -132,9 +132,10 @@ phpbb.markNotifications = function($popup, unreadCount) { // Update the unread count. $('strong', '#notification_list_button').html(unreadCount); - // Remove the Mark all read link & notification count if there are no unread notifications. + // Remove the Mark all read link and hide notification count if there are no unread notifications. if (!unreadCount) { - $('#mark_all_notifications, #notification_list_button > strong').remove(); + $('#mark_all_notifications').remove(); + $('#notification_list_button > strong').addClass('hidden'); } // Update page title diff --git a/phpBB/styles/prosilver/template/navbar_header.html b/phpBB/styles/prosilver/template/navbar_header.html index e5f354a943..bdfb5fb87d 100644 --- a/phpBB/styles/prosilver/template/navbar_header.html +++ b/phpBB/styles/prosilver/template/navbar_header.html @@ -72,12 +72,12 @@
  • - {L_PRIVATE_MESSAGES} {PRIVATE_MESSAGE_COUNT} + {L_PRIVATE_MESSAGES} {PRIVATE_MESSAGE_COUNT}
  • diff --git a/phpBB/styles/prosilver/theme/common.css b/phpBB/styles/prosilver/theme/common.css index cf6d14e6ab..0ac7a45a23 100644 --- a/phpBB/styles/prosilver/theme/common.css +++ b/phpBB/styles/prosilver/theme/common.css @@ -1269,6 +1269,10 @@ ul.linklist:after, padding: 4px 6px; } +.badge.hidden { + display: none; +} + /* Navbar specific list items ----------------------------------------*/ From 41b3450f2f93158e6a8135657b21030eb5d6b3c9 Mon Sep 17 00:00:00 2001 From: javiexin Date: Sat, 10 Dec 2016 11:41:11 +0100 Subject: [PATCH 15/58] [ticket/14855] Update notification and PM alert bubbles Alternative implementation without removing notification from the DOM, but changing the class. So that style designers might have more options (show/not show). Fix tests. PHPBB3-14855 --- tests/functional/notification_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/functional/notification_test.php b/tests/functional/notification_test.php index d4c61cc062..da36387aa1 100644 --- a/tests/functional/notification_test.php +++ b/tests/functional/notification_test.php @@ -82,6 +82,6 @@ class phpbb_functional_notification_test extends phpbb_functional_test_case // Get form token $link = $crawler->selectLink($this->lang('NOTIFICATIONS_MARK_ALL_READ'))->link()->getUri(); $crawler = self::request('GET', substr($link, strpos($link, 'ucp.'))); - $this->assertCount(0, $crawler->filter('#notification_list_button strong')); + $this->assertEquals(0, $crawler->filter('#notification_list_button strong.badge.hidden')->text()); } } From daae2147c867335f8af0c64b78b4c9f674eb0d27 Mon Sep 17 00:00:00 2001 From: javiexin Date: Sat, 10 Dec 2016 18:09:31 +0100 Subject: [PATCH 16/58] [ticket/14855] Update notification and PM alert bubbles Alternative implementation without removing notification from the DOM, but changing the class. So that style designers might have more options (show/not show). Fix tests better. PHPBB3-14855 --- tests/functional/notification_test.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/functional/notification_test.php b/tests/functional/notification_test.php index da36387aa1..f21d73817a 100644 --- a/tests/functional/notification_test.php +++ b/tests/functional/notification_test.php @@ -82,6 +82,7 @@ class phpbb_functional_notification_test extends phpbb_functional_test_case // Get form token $link = $crawler->selectLink($this->lang('NOTIFICATIONS_MARK_ALL_READ'))->link()->getUri(); $crawler = self::request('GET', substr($link, strpos($link, 'ucp.'))); - $this->assertEquals(0, $crawler->filter('#notification_list_button strong.badge.hidden')->text()); + $this->assertCount(1, $crawler->filter('#notification_list_button strong.badge.hidden')); + $this->assertEquals("0", $crawler->filter('#notification_list_button strong.badge.hidden')->text()); } } From 7d5d5b0f067091136c4dcedc648dffccd91f1f7a Mon Sep 17 00:00:00 2001 From: rxu Date: Sun, 11 Dec 2016 00:52:32 +0700 Subject: [PATCH 17/58] [ticket/14906] Delete redundant sig key in user_cache_data array PHPBB3-14906 --- phpBB/viewtopic.php | 1 - 1 file changed, 1 deletion(-) diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 5c98a9c931..dc656b8fad 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1316,7 +1316,6 @@ while ($row = $db->sql_fetchrow($result)) 'rank_title' => '', 'rank_image' => '', 'rank_image_src' => '', - 'sig' => '', 'pm' => '', 'email' => '', 'jabber' => '', From 3a4f1bc0611d700e137ac9009946f15fa6fd7dbd Mon Sep 17 00:00:00 2001 From: Christian Schnegelberger Date: Sun, 11 Dec 2016 17:52:46 +0100 Subject: [PATCH 18/58] [ticket/14877] Replaces "mono" with "monospace" to avoid bad behaviour PHPBB3-14877 --- phpBB/styles/prosilver/theme/content.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/styles/prosilver/theme/content.css b/phpBB/styles/prosilver/theme/content.css index 92a7db81d9..e7c0e177a6 100644 --- a/phpBB/styles/prosilver/theme/content.css +++ b/phpBB/styles/prosilver/theme/content.css @@ -515,7 +515,7 @@ blockquote .codebox { max-height: 200px; white-space: normal; padding-top: 5px; - font: 0.9em Monaco, "Andale Mono","Courier New", Courier, mono; + font: 0.9em Monaco, "Andale Mono","Courier New", Courier, monospace; line-height: 1.3em; margin: 2px 0; } From 7e2d544016c1dd7d1f052520c582c629e1792f3a Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Wed, 23 Nov 2016 13:48:14 +0100 Subject: [PATCH 19/58] [ticket/14874] Increase size of emotion PHPBB3-14874 --- .../data/v31x/increase_size_of_emotion.php | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 phpBB/phpbb/db/migration/data/v31x/increase_size_of_emotion.php diff --git a/phpBB/phpbb/db/migration/data/v31x/increase_size_of_emotion.php b/phpBB/phpbb/db/migration/data/v31x/increase_size_of_emotion.php new file mode 100644 index 0000000000..7e486aca7c --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/increase_size_of_emotion.php @@ -0,0 +1,46 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v31x; + +class increase_size_of_emotion extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v31x\v3110', + ); + } + + public function update_schema() + { + return array( + 'change_columns' => array( + $this->table_prefix . 'smilies' => array( + 'emotion' => array('VCHAR_UNI', ''), + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'change_columns' => array( + $this->table_prefix . 'smilies' => array( + 'emotion' => array('VCHAR_UNI:50', ''), + ), + ), + ); + } +} From df96351244aad129fd8a45047831d69a54072af3 Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Sun, 20 Nov 2016 18:40:40 +0100 Subject: [PATCH 20/58] [ticket/14239] Add core.ucp_remind_modify_select_sql PHPBB3-14239 --- phpBB/includes/ucp/ucp_remind.php | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/phpBB/includes/ucp/ucp_remind.php b/phpBB/includes/ucp/ucp_remind.php index 415bf0e84d..29d4199528 100644 --- a/phpBB/includes/ucp/ucp_remind.php +++ b/phpBB/includes/ucp/ucp_remind.php @@ -30,7 +30,7 @@ class ucp_remind function main($id, $mode) { global $config, $phpbb_root_path, $phpEx; - global $db, $user, $auth, $template, $phpbb_container; + global $db, $user, $auth, $template, $phpbb_container, $phpbb_dispatcher; if (!$config['allow_password_reset']) { @@ -43,10 +43,30 @@ class ucp_remind if ($submit) { - $sql = 'SELECT user_id, username, user_permissions, user_email, user_jabber, user_notify_type, user_type, user_lang, user_inactive_reason - FROM ' . USERS_TABLE . " - WHERE user_email_hash = '" . $db->sql_escape(phpbb_email_hash($email)) . "' - AND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'"; + $sql_array = array( + 'SELECT' => 'user_id, username, user_permissions, user_email, user_jabber, user_notify_type, user_type, user_lang, user_inactive_reason', + 'FROM' => array(USERS_TABLE => 'u'), + 'WHERE' => "user_email_hash = '" . $db->sql_escape(phpbb_email_hash($email)) . "' + AND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'" + ); + + /** + * Change SQL query for fetching user data + * + * @event core.ucp_remind_modify_select_sql + * @var string email User's email from the form + * @var string username User's username from the form + * @var array sql_array Fully assembled SQL query with keys SELECT, FROM, WHERE + * @since 3.1.11-RC1 + */ + $vars = array( + 'email', + 'username', + 'sql_array', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_remind_modify_select_sql', compact($vars))); + + $sql = $db->sql_build_query('SELECT', $sql_array); $result = $db->sql_query($sql); $user_row = $db->sql_fetchrow($result); $db->sql_freeresult($result); From 90b7d1fbda7c91c35428c3ec027ca5db9de6cbdf Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Fri, 18 Nov 2016 15:59:00 +0100 Subject: [PATCH 21/58] [ticket/14870] Add events to ucp_pm_viewfolder:get_pm_from PHPBB3-14870 --- phpBB/includes/ucp/ucp_pm_viewfolder.php | 67 ++++++++++++++++++++---- 1 file changed, 58 insertions(+), 9 deletions(-) diff --git a/phpBB/includes/ucp/ucp_pm_viewfolder.php b/phpBB/includes/ucp/ucp_pm_viewfolder.php index 19acd9ecb9..3ae7876a72 100644 --- a/phpBB/includes/ucp/ucp_pm_viewfolder.php +++ b/phpBB/includes/ucp/ucp_pm_viewfolder.php @@ -397,7 +397,7 @@ function view_folder($id, $mode, $folder_id, $folder) */ function get_pm_from($folder_id, $folder, $user_id) { - global $user, $db, $template, $config, $auth, $phpbb_container, $phpbb_root_path, $phpEx; + global $user, $db, $template, $config, $auth, $phpbb_container, $phpbb_root_path, $phpEx, $phpbb_dispatcher; $start = request_var('start', 0); @@ -461,7 +461,7 @@ function get_pm_from($folder_id, $folder, $user_id) $start = $pagination->validate_start($start, $config['topics_per_page'], $pm_count); $pagination->generate_template_pagination($base_url, 'pagination', 'start', $pm_count, $config['topics_per_page'], $start); - $template->assign_vars(array( + $template_vars = array( 'TOTAL_MESSAGES' => $user->lang('VIEW_PM_MESSAGES', (int) $pm_count), 'POST_IMG' => (!$auth->acl_get('u_sendpm')) ? $user->img('button_topic_locked', 'POST_PM_LOCKED') : $user->img('button_pm_new', 'POST_NEW_PM'), @@ -475,7 +475,33 @@ function get_pm_from($folder_id, $folder, $user_id) 'U_POST_NEW_TOPIC' => ($auth->acl_get('u_sendpm')) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose') : '', 'S_PM_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&mode=view&action=view_folder&f=$folder_id" . (($start !== 0) ? "&start=$start" : '')), - )); + ); + + /** + * Modify template variables before they are assigned + * + * @event core.ucp_pm_view_folder_get_pm_from_template + * @var int folder_id Folder ID + * @var array folder Folder data + * @var int user_id User ID + * @var string base_url Pagination base URL + * @var int start Pagination start + * @var int pm_count Count of PMs + * @var array template_vars Template variables to be assigned + * @since 3.1.11-RC1 + */ + $vars = array( + 'folder_id', + 'folder', + 'user_id', + 'base_url', + 'start', + 'pm_count', + 'template_vars', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_pm_view_folder_get_pm_from_template', compact($vars))); + + $template->assign_vars($template_vars); // Grab all pm data $rowset = $pm_list = array(); @@ -509,15 +535,38 @@ function get_pm_from($folder_id, $folder, $user_id) $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . $direction; } - $sql = 'SELECT t.*, p.root_level, p.message_time, p.message_subject, p.icon_id, p.to_address, p.message_attachment, p.bcc_address, u.username, u.username_clean, u.user_colour, p.message_reported - FROM ' . PRIVMSGS_TO_TABLE . ' t, ' . PRIVMSGS_TABLE . ' p, ' . USERS_TABLE . " u - WHERE t.user_id = $user_id + $sql_ary = array( + 'SELECT' => 't.*, p.root_level, p.message_time, p.message_subject, p.icon_id, p.to_address, p.message_attachment, p.bcc_address, u.username, u.username_clean, u.user_colour, p.message_reported', + 'FROM' => array( + PRIVMSGS_TO_TABLE => 't', + PRIVMSGS_TABLE => 'p', + USERS_TABLE => 'u', + ), + 'WHERE' => "t.user_id = $user_id AND p.author_id = u.user_id AND $folder_sql AND t.msg_id = p.msg_id - $sql_limit_time - ORDER BY $sql_sort_order"; - $result = $db->sql_query_limit($sql, $sql_limit, $sql_start); + $sql_limit_time", + 'ORDER' => $sql_sort_order, + ); + + /** + * Modify SQL before it is executed + * + * @event core.ucp_pm_view_folder_get_pm_from_sql + * @var array sql_ary SQL array + * @var int sql_limit SQL limit + * @var int sql_start SQL start + * @since 3.1.11-RC1 + */ + $vars = array( + 'sql_ary', + 'sql_limit', + 'sql_start', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_pm_view_folder_get_pm_from_sql', compact($vars))); + + $result = $db->sql_query_limit($db->sql_build_query('SELECT', $sql_ary), $sql_limit, $sql_start); $pm_reported = array(); while ($row = $db->sql_fetchrow($result)) From fe79705e99f6bbef07a9423adf9a27b5ad41fb02 Mon Sep 17 00:00:00 2001 From: javiexin Date: Fri, 16 Dec 2016 13:46:42 +0100 Subject: [PATCH 22/58] [ticket/14918] Simplify access to extension version metadata information PHPBB3-14918 --- phpBB/phpbb/extension/metadata_manager.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/phpbb/extension/metadata_manager.php b/phpBB/phpbb/extension/metadata_manager.php index a64d88fe39..34e2910a33 100644 --- a/phpBB/phpbb/extension/metadata_manager.php +++ b/phpBB/phpbb/extension/metadata_manager.php @@ -118,8 +118,9 @@ class metadata_manager return $this->metadata; break; + case 'version': case 'name': - return ($this->validate('name')) ? $this->metadata['name'] : false; + return ($this->validate($element)) ? $this->metadata[$element] : false; break; case 'display-name': From a03cec5b8dcf34084fac52c38ac5673d20e951f5 Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Sun, 20 Nov 2016 18:35:26 +0100 Subject: [PATCH 23/58] [ticket/14119] Add core.user_unban PHPBB3-14119 --- phpBB/includes/functions_user.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 0b39339c7f..c78beaa6a5 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -1291,7 +1291,7 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas */ function user_unban($mode, $ban) { - global $db, $user, $auth, $cache; + global $db, $user, $auth, $cache, $phpbb_dispatcher; // Delete stale bans $sql = 'DELETE FROM ' . BANLIST_TABLE . ' @@ -1358,6 +1358,20 @@ function user_unban($mode, $ban) add_log('user', $user_id, 'LOG_UNBAN_' . strtoupper($mode), $l_unban_list); } } + + /** + * Use this event to perform actions after the unban has been performed + * + * @event core.user_unban + * @var string mode One of the following: user, ip, email + * @var array user_ids_ary Array with user_ids + * @since 3.1.11-RC1 + */ + $vars = array( + 'mode', + 'user_ids_ary', + ); + extract($phpbb_dispatcher->trigger_event('core.user_unban', compact($vars))); } $cache->destroy('sql', BANLIST_TABLE); From ea73920261411d2365d92a072af05ecd7cf4a0e7 Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Sun, 20 Nov 2016 18:57:11 +0100 Subject: [PATCH 24/58] [ticket/14468] Add forum_id to core.viewforum_modify_topics_data PHPBB3-14468 --- phpBB/viewforum.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index e0cc9ba512..69b480574e 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -782,9 +782,11 @@ $topic_tracking_info = $tracking_topics = array(); * @var array topic_list Array with current viewforum page topic ids * @var array rowset Array with topics data (in topic_id => topic_data format) * @var int total_topic_count Forum's total topic count +* @var int forum_id Forum identifier * @since 3.1.0-b3 +* @changed 3.1.11-RC1 Added forum_id */ -$vars = array('topic_list', 'rowset', 'total_topic_count'); +$vars = array('topic_list', 'rowset', 'total_topic_count', 'forum_id'); extract($phpbb_dispatcher->trigger_event('core.viewforum_modify_topics_data', compact($vars))); // Okay, lets dump out the page ... From 853362ddad3c3c137894da2357d2cfd0f1816049 Mon Sep 17 00:00:00 2001 From: Crizzo Date: Sun, 18 Dec 2016 14:12:03 +0100 Subject: [PATCH 25/58] [ticket/14770] Reduce plupload resize quality PHPBB3-14770 --- phpBB/phpbb/plupload/plupload.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/phpbb/plupload/plupload.php b/phpBB/phpbb/plupload/plupload.php index 7f6267ed32..4d02f4fa59 100644 --- a/phpBB/phpbb/plupload/plupload.php +++ b/phpBB/phpbb/plupload/plupload.php @@ -266,7 +266,7 @@ class plupload if ($this->config['img_max_height'] > 0 && $this->config['img_max_width'] > 0) { $resize = sprintf( - 'resize: {width: %d, height: %d, quality: 100},', + 'resize: {width: %d, height: %d, quality: 90},', (int) $this->config['img_max_width'], (int) $this->config['img_max_height'] ); From 573507e6a59767c216532b722e9fa07514c343b8 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 18 Dec 2016 15:18:52 +0100 Subject: [PATCH 26/58] [ticket/14922] Make sure to pass hidden input on ajax form submissions PHPBB3-14922 --- phpBB/adm/style/ajax.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/adm/style/ajax.js b/phpBB/adm/style/ajax.js index 7ddd2d3742..a7ecf8ff7b 100644 --- a/phpBB/adm/style/ajax.js +++ b/phpBB/adm/style/ajax.js @@ -175,7 +175,8 @@ function submitPermissions() { type: 'POST', data: formData + '&' + $submitAllButton.name + '=' + encodeURIComponent($submitAllButton.value) + '&creation_time=' + $form.find('input[type=hidden][name=creation_time]')[0].value + - '&form_token=' + $form.find('input[type=hidden][name=form_token]')[0].value, + '&form_token=' + $form.find('input[type=hidden][name=form_token]')[0].value + + '&' + $form.children('input[type=hidden]').serialize(), success: handlePermissionReturn, error: handlePermissionReturn }); From 71f82f2615302da12f00e925cd40522b9a010257 Mon Sep 17 00:00:00 2001 From: Crizzo Date: Sun, 18 Dec 2016 15:31:58 +0100 Subject: [PATCH 27/58] [ticket/14770] Decreases quality to 85, changes test to 85, too PHPBB3-14770 --- phpBB/phpbb/plupload/plupload.php | 2 +- tests/plupload/plupload_test.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/phpbb/plupload/plupload.php b/phpBB/phpbb/plupload/plupload.php index 4d02f4fa59..04d681cea6 100644 --- a/phpBB/phpbb/plupload/plupload.php +++ b/phpBB/phpbb/plupload/plupload.php @@ -266,7 +266,7 @@ class plupload if ($this->config['img_max_height'] > 0 && $this->config['img_max_width'] > 0) { $resize = sprintf( - 'resize: {width: %d, height: %d, quality: 90},', + 'resize: {width: %d, height: %d, quality: 85},', (int) $this->config['img_max_width'], (int) $this->config['img_max_height'] ); diff --git a/tests/plupload/plupload_test.php b/tests/plupload/plupload_test.php index 2f47bf2b39..c3fa2b9bad 100644 --- a/tests/plupload/plupload_test.php +++ b/tests/plupload/plupload_test.php @@ -24,7 +24,7 @@ class phpbb_plupload_test extends phpbb_test_case array( 130, 150, - 'resize: {width: 130, height: 150, quality: 100},' + 'resize: {width: 130, height: 150, quality: 85},' ), ); } From cc42c09a95adce35ebc7ed2826a2fc5401a2a536 Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Mon, 21 Nov 2016 16:35:33 +0100 Subject: [PATCH 28/58] [ticket/14662] Add memberlist_team_username_prepend/append PHPBB3-14662 --- phpBB/docs/events.md | 16 ++++++++++++++++ .../prosilver/template/memberlist_team.html | 2 +- .../subsilver2/template/memberlist_team.html | 2 +- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md index 0ebaf8f3e0..b007377e47 100644 --- a/phpBB/docs/events.md +++ b/phpBB/docs/events.md @@ -1042,6 +1042,22 @@ memberlist_search_sorting_options_before * Since: 3.1.2-RC1 * Purpose: Add information before the search sorting options field. +memberlist_team_username_append +=== +* Locations: + + styles/prosilver/template/memberlist_team.html + + styles/subsilver2/template/memberlist_team.html +* Since: 3.1.11-RC1 +* Purpose: Append information to username of team member + +memberlist_team_username_prepend +=== +* Locations: + + styles/prosilver/template/memberlist_team.html + + styles/subsilver2/template/memberlist_team.html +* Since: 3.1.11-RC1 +* Purpose: Add information before team user username + memberlist_view_contact_after === * Locations: diff --git a/phpBB/styles/prosilver/template/memberlist_team.html b/phpBB/styles/prosilver/template/memberlist_team.html index b7f2d66d94..327dde412e 100644 --- a/phpBB/styles/prosilver/template/memberlist_team.html +++ b/phpBB/styles/prosilver/template/memberlist_team.html @@ -19,7 +19,7 @@ - {group.user.RANK_IMG}{group.user.RANK_TITLE}{group.user.USERNAME_FULL} ({L_INACTIVE}) + {group.user.RANK_IMG}{group.user.RANK_TITLE}{group.user.USERNAME_FULL} ({L_INACTIVE}) style="font-weight: bold; color: #{group.user.GROUP_COLOR}" href="{group.user.U_GROUP}">{group.user.GROUP_NAME} diff --git a/phpBB/styles/subsilver2/template/memberlist_team.html b/phpBB/styles/subsilver2/template/memberlist_team.html index 18995b6e50..75fade184c 100644 --- a/phpBB/styles/subsilver2/template/memberlist_team.html +++ b/phpBB/styles/subsilver2/template/memberlist_team.html @@ -17,7 +17,7 @@ - {group.user.USERNAME_FULL} ({L_INACTIVE}) + {group.user.USERNAME_FULL} ({L_INACTIVE}) {group.user.FORUMS}-   From 5f6fa321efd5ee3761be28a8d3e77d1901fd504f Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Mon, 21 Nov 2016 16:29:28 +0100 Subject: [PATCH 29/58] [ticket/14817] Add core.send_file_to_browser_before PHPBB3-14817 --- phpBB/includes/functions_download.php | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/functions_download.php b/phpBB/includes/functions_download.php index c571de579e..15c414437a 100644 --- a/phpBB/includes/functions_download.php +++ b/phpBB/includes/functions_download.php @@ -124,7 +124,7 @@ function wrap_img_in_html($src, $title) */ function send_file_to_browser($attachment, $upload_dir, $category) { - global $user, $db, $config, $phpbb_root_path; + global $user, $db, $config, $phpbb_dispatcher, $phpbb_root_path; $filename = $phpbb_root_path . $upload_dir . '/' . $attachment['physical_filename']; @@ -149,6 +149,26 @@ function send_file_to_browser($attachment, $upload_dir, $category) // Now send the File Contents to the Browser $size = @filesize($filename); + /** + * Event to alter attachment before it is sent to browser. + * + * @event core.send_file_to_browser_before + * @var array attachment Attachment data + * @var string upload_dir Relative path of upload directory + * @var int category Attachment category + * @var string filename Path to file, including filename + * @var int size File size + * @since 3.1.11-RC1 + */ + $vars = array( + 'attachment', + 'upload_dir', + 'category', + 'filename', + 'size', + ); + extract($phpbb_dispatcher->trigger_event('core.send_file_to_browser_before', compact($vars))); + // To correctly display further errors we need to make sure we are using the correct headers for both (unsetting content-length may not work) // Check if headers already sent or not able to get the file contents. From aa84ea8e5d13ecec1421e9f90071f4705f72e739 Mon Sep 17 00:00:00 2001 From: Daniel Sinn Date: Tue, 20 Dec 2016 16:46:50 -0500 Subject: [PATCH 30/58] [ticket/14882] Correct type of topic_id for function_admin's move_posts events PHPBB3-14882 --- phpBB/includes/functions_admin.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 61535efcd6..4bac718999 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -641,7 +641,7 @@ function move_posts($post_ids, $topic_id, $auto_sync = true) * * @event core.move_posts_before * @var array post_ids Array of post ids to move - * @var string topic_id The topic id the posts are moved to + * @var int topic_id The topic id the posts are moved to * @var bool auto_sync Whether or not to perform auto sync * @var array forum_ids Array of the forum ids the posts are moved from * @var array topic_ids Array of the topic ids the posts are moved from @@ -673,7 +673,7 @@ function move_posts($post_ids, $topic_id, $auto_sync = true) * * @event core.move_posts_after * @var array post_ids Array of the moved post ids - * @var string topic_id The topic id the posts are moved to + * @var int topic_id The topic id the posts are moved to * @var bool auto_sync Whether or not to perform auto sync * @var array forum_ids Array of the forum ids the posts are moved from * @var array topic_ids Array of the topic ids the posts are moved from @@ -704,7 +704,7 @@ function move_posts($post_ids, $topic_id, $auto_sync = true) * * @event core.move_posts_sync_after * @var array post_ids Array of the moved post ids - * @var string topic_id The topic id the posts are moved to + * @var int topic_id The topic id the posts are moved to * @var bool auto_sync Whether or not to perform auto sync * @var array forum_ids Array of the forum ids the posts are moved from * @var array topic_ids Array of the topic ids the posts are moved from From 9e6207add3070a5d3a6b3c8f798ad54dd8fbf828 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 25 Dec 2016 10:19:33 +0100 Subject: [PATCH 31/58] [ticket/14923] Make sure start for queries is always set in migrations PHPBB3-14923 --- .../db/migration/data/v310/notification_options_reconvert.php | 1 + phpBB/phpbb/db/migration/profilefield_base_migration.php | 1 + 2 files changed, 2 insertions(+) diff --git a/phpBB/phpbb/db/migration/data/v310/notification_options_reconvert.php b/phpBB/phpbb/db/migration/data/v310/notification_options_reconvert.php index 2d4d26ae61..d43d432dd9 100644 --- a/phpBB/phpbb/db/migration/data/v310/notification_options_reconvert.php +++ b/phpBB/phpbb/db/migration/data/v310/notification_options_reconvert.php @@ -52,6 +52,7 @@ class notification_options_reconvert extends \phpbb\db\migration\migration { $limit = 250; $converted_users = 0; + $start = $start ?: 0; $sql = 'SELECT user_id, user_notify_type, user_notify_pm FROM ' . $this->table_prefix . 'users diff --git a/phpBB/phpbb/db/migration/profilefield_base_migration.php b/phpBB/phpbb/db/migration/profilefield_base_migration.php index da1a38e2fa..b20ca874be 100644 --- a/phpBB/phpbb/db/migration/profilefield_base_migration.php +++ b/phpBB/phpbb/db/migration/profilefield_base_migration.php @@ -191,6 +191,7 @@ abstract class profilefield_base_migration extends container_aware_migration $insert_buffer = new \phpbb\db\sql_insert_buffer($this->db, $this->table_prefix . 'profile_fields_data'); $limit = 250; $converted_users = 0; + $start = $start ?: 0; $sql = 'SELECT user_id, ' . $this->user_column_name . ' FROM ' . $this->table_prefix . 'users From 87f82c404ead9559d5eedd8ee759f860f91dd2c2 Mon Sep 17 00:00:00 2001 From: javiexin Date: Tue, 27 Dec 2016 02:07:46 +0100 Subject: [PATCH 32/58] [ticket/14940] Add ACP template event acp_ext_details_end PHPBB3-14940 --- phpBB/adm/style/acp_ext_details.html | 1 + phpBB/docs/events.md | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/phpBB/adm/style/acp_ext_details.html b/phpBB/adm/style/acp_ext_details.html index 830c2e3cb4..465a89e17a 100644 --- a/phpBB/adm/style/acp_ext_details.html +++ b/phpBB/adm/style/acp_ext_details.html @@ -136,4 +136,5 @@
    + diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md index 0ebaf8f3e0..1cc0ccbdb4 100644 --- a/phpBB/docs/events.md +++ b/phpBB/docs/events.md @@ -58,6 +58,12 @@ acp_email_options_after * Since: 3.1.2-RC1 * Purpose: Add settings to mass email form +acp_ext_details_end +=== +* Location: adm/style/acp_ext_details.html +* Since: 3.1.11-RC1 +* Purpose: Add more detailed information on extension after the available information. + acp_ext_list_disabled_title_after === * Location: adm/style/acp_ext_list.html From 0fc1de279eace08f26990756d933f55c77adec3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Col=C3=B3n?= Date: Tue, 27 Dec 2016 12:28:49 -0500 Subject: [PATCH 33/58] [ticket/14941] Apply changes individually for MySQL fulltext search --- phpBB/phpbb/search/fulltext_mysql.php | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/phpBB/phpbb/search/fulltext_mysql.php b/phpBB/phpbb/search/fulltext_mysql.php index 9faf5ca08b..f8bda9ae81 100644 --- a/phpBB/phpbb/search/fulltext_mysql.php +++ b/phpBB/phpbb/search/fulltext_mysql.php @@ -942,38 +942,45 @@ class fulltext_mysql extends \phpbb\search\base $this->get_stats(); } - $alter = array(); + $alter_list = array(); if (!isset($this->stats['post_subject'])) { + $alter_entry = array(); if ($this->db->get_sql_layer() == 'mysqli' || version_compare($this->db->sql_server_info(true), '4.1.3', '>=')) { - $alter[] = 'MODIFY post_subject varchar(255) COLLATE utf8_unicode_ci DEFAULT \'\' NOT NULL'; + $alter_entry[] = 'MODIFY post_subject varchar(255) COLLATE utf8_unicode_ci DEFAULT \'\' NOT NULL'; } else { - $alter[] = 'MODIFY post_subject text NOT NULL'; + $alter_entry[] = 'MODIFY post_subject text NOT NULL'; } - $alter[] = 'ADD FULLTEXT (post_subject)'; + $alter_entry[] = 'ADD FULLTEXT (post_subject)'; + $alter_list[] = $alter_entry; } if (!isset($this->stats['post_content'])) { + $alter_entry = array(); if ($this->db->get_sql_layer() == 'mysqli' || version_compare($this->db->sql_server_info(true), '4.1.3', '>=')) { - $alter[] = 'MODIFY post_text mediumtext COLLATE utf8_unicode_ci NOT NULL'; + $alter_entry[] = 'MODIFY post_text mediumtext COLLATE utf8_unicode_ci NOT NULL'; } else { - $alter[] = 'MODIFY post_text mediumtext NOT NULL'; + $alter_entry[] = 'MODIFY post_text mediumtext NOT NULL'; } - $alter[] = 'ADD FULLTEXT post_content (post_text, post_subject)'; + $alter_entry[] = 'ADD FULLTEXT post_content (post_text, post_subject)'; + $alter_list[] = $alter_entry; } - if (sizeof($alter)) + if (sizeof($alter_list)) { - $this->db->sql_query('ALTER TABLE ' . POSTS_TABLE . ' ' . implode(', ', $alter)); + foreach ($alter_list as $alter) + { + $this->db->sql_query('ALTER TABLE ' . POSTS_TABLE . ' ' . implode(', ', $alter)); + } } $this->db->sql_query('TRUNCATE TABLE ' . SEARCH_RESULTS_TABLE); From d9991bdaf1aa9685437c4f4c298fa54f0c0f33f0 Mon Sep 17 00:00:00 2001 From: javiexin Date: Wed, 28 Dec 2016 12:37:53 +0100 Subject: [PATCH 34/58] [ticket/14943] Fix template loop access by index Allows inserting elements in a loop specified as 'outer[3].inner'. This was coded, but malfunctioning. PHPBB3-14943 --- phpBB/phpbb/template/context.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/phpbb/template/context.php b/phpBB/phpbb/template/context.php index 4ee48205c8..8bf6c10e2d 100644 --- a/phpBB/phpbb/template/context.php +++ b/phpBB/phpbb/template/context.php @@ -365,15 +365,15 @@ class context if ($mode == 'insert') { // Make sure we are not exceeding the last iteration - if ($key >= sizeof($this->tpldata[$blockname])) + if ($key >= sizeof($block)) { - $key = sizeof($this->tpldata[$blockname]); - unset($this->tpldata[$blockname][($key - 1)]['S_LAST_ROW']); + $key = sizeof($block); + unset($block[($key - 1)]['S_LAST_ROW']); $vararray['S_LAST_ROW'] = true; } else if ($key === 0) { - unset($this->tpldata[$blockname][0]['S_FIRST_ROW']); + unset($block[0]['S_FIRST_ROW']); $vararray['S_FIRST_ROW'] = true; } From 40bc4ac484223f78902e7275085a53ebc5e05dba Mon Sep 17 00:00:00 2001 From: hubaishan Date: Thu, 29 Dec 2016 13:11:19 +0300 Subject: [PATCH 35/58] [ticket/14549] Correcting $redirect var to avoid the bug by this correct $redirect will go to clean mcp page after merge PHPBB3-14549 --- phpBB/includes/mcp/mcp_forum.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/mcp/mcp_forum.php b/phpBB/includes/mcp/mcp_forum.php index e4c0640ec7..3deb58b96a 100644 --- a/phpBB/includes/mcp/mcp_forum.php +++ b/phpBB/includes/mcp/mcp_forum.php @@ -458,7 +458,7 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id) return; } - $redirect = request_var('redirect', build_url(array('quickmod'))); + $redirect = request_var('redirect', "{$phpbb_root_path}mcp.$phpEx?f=$forum_id&i=main&mode=forum_view"); $s_hidden_fields = build_hidden_fields(array( 'i' => 'main', From 7df7cfff33628b6111a841b690e90e535cd426e2 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 2 Jan 2017 22:39:40 +0100 Subject: [PATCH 36/58] [ticket/14953] Use ORDER_BY instead of incorrect ORDER for sql query PHPBB3-14953 --- phpBB/includes/ucp/ucp_pm_viewfolder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/ucp/ucp_pm_viewfolder.php b/phpBB/includes/ucp/ucp_pm_viewfolder.php index 3ae7876a72..3364206680 100644 --- a/phpBB/includes/ucp/ucp_pm_viewfolder.php +++ b/phpBB/includes/ucp/ucp_pm_viewfolder.php @@ -547,7 +547,7 @@ function get_pm_from($folder_id, $folder, $user_id) AND $folder_sql AND t.msg_id = p.msg_id $sql_limit_time", - 'ORDER' => $sql_sort_order, + 'ORDER_BY' => $sql_sort_order, ); /** From 14fd750b087c7c9e31f9701bb08ced08db964d12 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 28 Dec 2016 18:15:17 +0100 Subject: [PATCH 37/58] [ticket/14957] Do not cache database config entries PHPBB3-14957 --- phpBB/config/db.yml | 4 +--- phpBB/phpbb/di/container_builder.php | 13 +++++++++++++ phpBB/phpbb/di/extension/config.php | 6 ------ tests/di/create_container_test.php | 2 +- tests/di/fixtures/config/services.yml | 3 +++ tests/di/fixtures/other_config/services.yml | 3 +++ 6 files changed, 21 insertions(+), 10 deletions(-) diff --git a/phpBB/config/db.yml b/phpBB/config/db.yml index d11669d8a3..4ab4401bbd 100644 --- a/phpBB/config/db.yml +++ b/phpBB/config/db.yml @@ -5,9 +5,7 @@ services: - @service_container dbal.conn.driver: - class: %dbal.driver.class% - calls: - - [sql_connect, [%dbal.dbhost%, %dbal.dbuser%, %dbal.dbpasswd%, %dbal.dbname%, %dbal.dbport%, false, %dbal.new_link%]] + synthetic: true dbal.tools: class: phpbb\db\tools diff --git a/phpBB/phpbb/di/container_builder.php b/phpBB/phpbb/di/container_builder.php index a214356ac3..9801b817d6 100644 --- a/phpBB/phpbb/di/container_builder.php +++ b/phpBB/phpbb/di/container_builder.php @@ -185,6 +185,7 @@ class container_builder } $this->container->set('config.php', $this->config_php_file); + $this->inject_dbal_driver(); if ($this->compile_container) { @@ -303,6 +304,17 @@ class container_builder } } + /** + * Inject the dbal connection driver into container + */ + protected function inject_dbal_driver() + { + if (!empty($this->config_php_file->get_all())) + { + $this->container->set('dbal.conn.driver', $this->get_dbal_connection()); + } + } + /** * Get DB connection. * @@ -320,6 +332,7 @@ class container_builder $this->config_php_file->get('dbpasswd'), $this->config_php_file->get('dbname'), $this->config_php_file->get('dbport'), + false, defined('PHPBB_DB_NEW_LINK') && PHPBB_DB_NEW_LINK ); } diff --git a/phpBB/phpbb/di/extension/config.php b/phpBB/phpbb/di/extension/config.php index 7984a783df..8c9de48823 100644 --- a/phpBB/phpbb/di/extension/config.php +++ b/phpBB/phpbb/di/extension/config.php @@ -43,12 +43,6 @@ class config extends Extension 'core.adm_relative_path' => $this->config_php->get('phpbb_adm_relative_path') ? $this->config_php->get('phpbb_adm_relative_path') : 'adm/', 'core.table_prefix' => $this->config_php->get('table_prefix'), 'cache.driver.class' => $this->convert_30_acm_type($this->config_php->get('acm_type')), - 'dbal.driver.class' => $this->config_php->convert_30_dbms_to_31($this->config_php->get('dbms')), - 'dbal.dbhost' => $this->config_php->get('dbhost'), - 'dbal.dbuser' => $this->config_php->get('dbuser'), - 'dbal.dbpasswd' => $this->config_php->get('dbpasswd'), - 'dbal.dbname' => $this->config_php->get('dbname'), - 'dbal.dbport' => $this->config_php->get('dbport'), 'dbal.new_link' => defined('PHPBB_DB_NEW_LINK') && PHPBB_DB_NEW_LINK, ); $parameter_bag = $container->getParameterBag(); diff --git a/tests/di/create_container_test.php b/tests/di/create_container_test.php index 4ae6017989..1a7eb4698c 100644 --- a/tests/di/create_container_test.php +++ b/tests/di/create_container_test.php @@ -53,7 +53,7 @@ namespace $this->assertTrue($container->isFrozen()); // Checks inject_config - $this->assertTrue($container->hasParameter('dbal.dbhost')); + $this->assertTrue($container->hasParameter('core.table_prefix')); // Checks use_extensions $this->assertTrue($container->hasParameter('enabled')); diff --git a/tests/di/fixtures/config/services.yml b/tests/di/fixtures/config/services.yml index f2a22ae109..913a2603c9 100644 --- a/tests/di/fixtures/config/services.yml +++ b/tests/di/fixtures/config/services.yml @@ -10,5 +10,8 @@ services: arguments: - @service_container + dbal.conn.driver: + synthetic: true + dispatcher: class: phpbb\db\driver\container_mock diff --git a/tests/di/fixtures/other_config/services.yml b/tests/di/fixtures/other_config/services.yml index c299bfc648..d6246d3bc0 100644 --- a/tests/di/fixtures/other_config/services.yml +++ b/tests/di/fixtures/other_config/services.yml @@ -10,5 +10,8 @@ services: arguments: - @service_container + dbal.conn.driver: + synthetic: true + dispatcher: class: phpbb\db\driver\container_mock From ff411ee81bc12574138577a5bb4b0cbc9004b00e Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 3 Jan 2017 21:53:14 +0100 Subject: [PATCH 38/58] [ticket/14957] Do not use method return in write context Fix for PHP 5.3.x compatibility. PHPBB3-14957 --- phpBB/phpbb/di/container_builder.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/phpbb/di/container_builder.php b/phpBB/phpbb/di/container_builder.php index 9801b817d6..5f3aa685bf 100644 --- a/phpBB/phpbb/di/container_builder.php +++ b/phpBB/phpbb/di/container_builder.php @@ -309,7 +309,8 @@ class container_builder */ protected function inject_dbal_driver() { - if (!empty($this->config_php_file->get_all())) + $config_data = $this->config_php_file->get_all(); + if (!empty($config_data)) { $this->container->set('dbal.conn.driver', $this->get_dbal_connection()); } From 7cad25e4cbed2efbf891001cd2664f825674d5a7 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 25 Dec 2016 17:54:11 +0100 Subject: [PATCH 39/58] [ticket/14838] Do not query full attachments table in feeds The fetch_attachments() will also now throw a runtime exception if a feed tries to do this nonetheless. PHPBB3-14838 --- phpBB/language/en/common.php | 1 + phpBB/phpbb/feed/attachments_base.php | 26 +++++++++++++++++++++++--- phpBB/phpbb/feed/forum.php | 2 ++ phpBB/phpbb/feed/news.php | 2 ++ phpBB/phpbb/feed/overall.php | 2 ++ phpBB/phpbb/feed/topic.php | 2 ++ phpBB/phpbb/feed/topics.php | 2 ++ phpBB/phpbb/feed/topics_active.php | 2 ++ 8 files changed, 36 insertions(+), 3 deletions(-) diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index a2cfd958aa..b4b328e90d 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -336,6 +336,7 @@ $lang = array_merge($lang, array( 'INTERESTS' => 'Interests', 'INVALID_DIGEST_CHALLENGE' => 'Invalid digest challenge.', 'INVALID_EMAIL_LOG' => '%s possibly an invalid email address?', + 'INVALID_FEED_ATTACHMENTS' => 'The selected feed tried fetching attachments with invalid constraints.', 'INVALID_PLURAL_RULE' => 'The chosen plural rule is invalid. Valid values are integers between 0 and 15.', 'IP' => 'IP', 'IP_BLACKLISTED' => 'Your IP %1$s has been blocked because it is blacklisted. For details please see %2$s.', diff --git a/phpBB/phpbb/feed/attachments_base.php b/phpBB/phpbb/feed/attachments_base.php index 04812f1570..f74560c787 100644 --- a/phpBB/phpbb/feed/attachments_base.php +++ b/phpBB/phpbb/feed/attachments_base.php @@ -25,8 +25,11 @@ abstract class attachments_base extends \phpbb\feed\base /** * Retrieve the list of attachments that may be displayed + * + * @param array $post_ids Specify for which post IDs to fetch the attachments (optional) + * @param array $topic_ids Specify for which topic IDs to fetch the attachments (optional) */ - protected function fetch_attachments() + protected function fetch_attachments($post_ids = array(), $topic_ids = array()) { $sql_array = array( 'SELECT' => 'a.*', @@ -37,7 +40,20 @@ abstract class attachments_base extends \phpbb\feed\base 'ORDER_BY' => 'a.filetime DESC, a.post_msg_id ASC', ); - if (isset($this->topic_id)) + if (!empty($post_ids)) + { + $sql_array['WHERE'] .= 'AND ' . $this->db->sql_in_set('a.post_msg_id', $post_ids); + } + else if (!empty($topic_ids)) + { + if (isset($this->topic_id)) + { + $topic_ids[] = $this->topic_id; + } + + $sql_array['WHERE'] .= 'AND ' . $this->db->sql_in_set('a.topic_id', $topic_ids); + } + else if (isset($this->topic_id)) { $sql_array['WHERE'] .= 'AND a.topic_id = ' . (int) $this->topic_id; } @@ -51,6 +67,11 @@ abstract class attachments_base extends \phpbb\feed\base ); $sql_array['WHERE'] .= 'AND t.forum_id = ' . (int) $this->forum_id; } + else + { + // Do not allow querying the full attachments table + throw new \RuntimeException($this->user->lang('INVALID_FEED_ATTACHMENTS')); + } $sql = $this->db->sql_build_query('SELECT', $sql_array); $result = $this->db->sql_query($sql); @@ -69,7 +90,6 @@ abstract class attachments_base extends \phpbb\feed\base public function open() { parent::open(); - $this->fetch_attachments(); } /** diff --git a/phpBB/phpbb/feed/forum.php b/phpBB/phpbb/feed/forum.php index 7a2087c1cd..6aba12a147 100644 --- a/phpBB/phpbb/feed/forum.php +++ b/phpBB/phpbb/feed/forum.php @@ -112,6 +112,8 @@ class forum extends \phpbb\feed\post_base return false; } + parent::fetch_attachments(array(), $topic_ids); + $this->sql = array( 'SELECT' => 'p.post_id, p.topic_id, p.post_time, p.post_edit_time, p.post_visibility, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, p.post_attachment, ' . 'u.username, u.user_id', diff --git a/phpBB/phpbb/feed/news.php b/phpBB/phpbb/feed/news.php index a02c199d85..5d4786518b 100644 --- a/phpBB/phpbb/feed/news.php +++ b/phpBB/phpbb/feed/news.php @@ -83,6 +83,8 @@ class news extends \phpbb\feed\topic_base return false; } + parent::fetch_attachments($post_ids); + $this->sql = array( 'SELECT' => 'f.forum_id, f.forum_name, t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_posts_approved, t.topic_posts_unapproved, t.topic_posts_softdeleted, t.topic_views, t.topic_time, t.topic_last_post_time, diff --git a/phpBB/phpbb/feed/overall.php b/phpBB/phpbb/feed/overall.php index ab452f5386..1176a9c182 100644 --- a/phpBB/phpbb/feed/overall.php +++ b/phpBB/phpbb/feed/overall.php @@ -52,6 +52,8 @@ class overall extends \phpbb\feed\post_base return false; } + parent::fetch_attachments(array(), $topic_ids); + // Get the actual data $this->sql = array( 'SELECT' => 'f.forum_id, f.forum_name, ' . diff --git a/phpBB/phpbb/feed/topic.php b/phpBB/phpbb/feed/topic.php index 66c49e55cf..295bf3f795 100644 --- a/phpBB/phpbb/feed/topic.php +++ b/phpBB/phpbb/feed/topic.php @@ -91,6 +91,8 @@ class topic extends \phpbb\feed\post_base function get_sql() { + parent::fetch_attachments(); + $this->sql = array( 'SELECT' => 'p.post_id, p.post_time, p.post_edit_time, p.post_visibility, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, p.post_attachment, ' . 'u.username, u.user_id', diff --git a/phpBB/phpbb/feed/topics.php b/phpBB/phpbb/feed/topics.php index 2b9cb3501a..e6416bc064 100644 --- a/phpBB/phpbb/feed/topics.php +++ b/phpBB/phpbb/feed/topics.php @@ -55,6 +55,8 @@ class topics extends \phpbb\feed\topic_base return false; } + parent::fetch_attachments($post_ids); + $this->sql = array( 'SELECT' => 'f.forum_id, f.forum_name, t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_posts_approved, t.topic_posts_unapproved, t.topic_posts_softdeleted, t.topic_views, t.topic_time, t.topic_last_post_time, diff --git a/phpBB/phpbb/feed/topics_active.php b/phpBB/phpbb/feed/topics_active.php index 6d5eddfc16..3b751f3233 100644 --- a/phpBB/phpbb/feed/topics_active.php +++ b/phpBB/phpbb/feed/topics_active.php @@ -71,6 +71,8 @@ class topics_active extends \phpbb\feed\topic_base return false; } + parent::fetch_attachments($post_ids); + $this->sql = array( 'SELECT' => 'f.forum_id, f.forum_name, t.topic_id, t.topic_title, t.topic_posts_approved, t.topic_posts_unapproved, t.topic_posts_softdeleted, t.topic_views, From c0882c1d34fd6add8327c12964e02f80cd181068 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 25 Dec 2016 23:43:49 +0100 Subject: [PATCH 40/58] [ticket/14838] Add simple test for fetch_attachments method PHPBB3-14838 --- tests/feed/attachments_base_test.php | 94 ++++++++++++++++++++++++++++ tests/feed/attachments_mock_feed.php | 31 +++++++++ 2 files changed, 125 insertions(+) create mode 100644 tests/feed/attachments_base_test.php create mode 100644 tests/feed/attachments_mock_feed.php diff --git a/tests/feed/attachments_base_test.php b/tests/feed/attachments_base_test.php new file mode 100644 index 0000000000..c980dfd3d7 --- /dev/null +++ b/tests/feed/attachments_base_test.php @@ -0,0 +1,94 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +require_once(dirname(__FILE__) . '/attachments_mock_feed.php'); + +class phpbb_feed_attachments_base_test extends phpbb_database_test_case +{ + protected $filesystem; + + /** @var \phpbb_feed_attachments_mock_feed */ + protected $attachments_mocks_feed; + + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__) . '/../extension/fixtures/extensions.xml'); + } + + public function setUp() + { + global $phpbb_root_path, $phpEx; + + $this->filesystem = new \phpbb\filesystem(); + $config = new \phpbb\config\config(array()); + $user = new \phpbb\user('\phpbb\datetime'); + $feed_helper = new \phpbb\feed\helper($config, $user, $phpbb_root_path, $phpEx); + $db = $this->new_dbal(); + $cache = new \phpbb_mock_cache(); + $auth = new \phpbb\auth\auth(); + $content_visibility = new \phpbb\content_visibility( + $auth, + $config, + new \phpbb_mock_event_dispatcher(), + $db, + $user, + $phpbb_root_path, + $phpEx, + FORUMS_TABLE, + POSTS_TABLE, + TOPICS_TABLE, + USERS_TABLE + ); + + $this->attachments_mocks_feed = new \phpbb_feed_attachments_mock_feed( + $feed_helper, + $config, + $db, + $cache, + $user, + $auth, + $content_visibility, + new \phpbb_mock_event_dispatcher(), + $phpEx + ); + } + + public function data_fetch_attachments() + { + return array( + array(array(0), array(0)), + array(array(), array(1)), + array(array(), array(), 'RuntimeException') + ); + } + + /** + * @dataProvider data_fetch_attachments + */ + public function test_fetch_attachments($post_ids, $topic_ids, $expected_exception = false) + { + $this->attachments_mocks_feed->post_ids = $post_ids; + $this->attachments_mocks_feed->topic_ids = $topic_ids; + + if ($expected_exception !== false) + { + $this->setExpectedException($expected_exception); + + $this->attachments_mocks_feed->get_sql(); + } + else + { + $this->assertTrue($this->attachments_mocks_feed->get_sql()); + } + } +} diff --git a/tests/feed/attachments_mock_feed.php b/tests/feed/attachments_mock_feed.php new file mode 100644 index 0000000000..0e623fed24 --- /dev/null +++ b/tests/feed/attachments_mock_feed.php @@ -0,0 +1,31 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +/** + * Board wide feed (aka overall feed) + * + * This will give you the newest {$this->num_items} posts + * from the whole board. + */ +class phpbb_feed_attachments_mock_feed extends \phpbb\feed\attachments_base +{ + public $topic_ids = array(); + public $post_ids = array(); + + function get_sql() + { + parent::fetch_attachments($this->post_ids, $this->topic_ids); + + return true; + } +} From dd89a369f3166ed4a3730ac8a2fb6eb5608ac284 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 4 Jan 2017 17:16:36 +0100 Subject: [PATCH 41/58] [ticket/14838] Remove obsolete overriding method PHPBB3-14838 --- phpBB/phpbb/feed/attachments_base.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/phpBB/phpbb/feed/attachments_base.php b/phpBB/phpbb/feed/attachments_base.php index f74560c787..df8f29a626 100644 --- a/phpBB/phpbb/feed/attachments_base.php +++ b/phpBB/phpbb/feed/attachments_base.php @@ -84,14 +84,6 @@ abstract class attachments_base extends \phpbb\feed\base $this->db->sql_freeresult($result); } - /** - * {@inheritDoc} - */ - public function open() - { - parent::open(); - } - /** * Get attachments related to a given post * From 49c19a267fbf00cf8eb339557d4cf921c558f4f1 Mon Sep 17 00:00:00 2001 From: rxu Date: Thu, 5 Jan 2017 00:42:27 +0700 Subject: [PATCH 42/58] [ticket/14958] Optimize Twig extension lang() function PHPBB3-14958 --- phpBB/phpbb/template/twig/extension.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/phpBB/phpbb/template/twig/extension.php b/phpBB/phpbb/template/twig/extension.php index 3a983491b9..d5b14129b5 100644 --- a/phpBB/phpbb/template/twig/extension.php +++ b/phpBB/phpbb/template/twig/extension.php @@ -169,8 +169,7 @@ class extension extends \Twig_Extension $args = func_get_args(); $key = $args[0]; - $context = $this->context->get_data_ref(); - $context_vars = $context['.'][0]; + $context_vars = $this->context->get_root_ref(); if (isset($context_vars['L_' . $key])) { From 366e8583c88b6a7719b39af43790ab0c55aeada7 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Fri, 13 Jan 2017 12:00:31 -0800 Subject: [PATCH 43/58] [ticket/15003] Do not check disabled checkboxes with marklist function PHPBB3-15003 --- phpBB/adm/style/overall_header.html | 2 +- phpBB/adm/style/simple_header.html | 2 +- phpBB/styles/prosilver/template/forum_fn.js | 2 +- phpBB/styles/subsilver2/template/memberlist_search.html | 2 +- phpBB/styles/subsilver2/template/overall_header.html | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/phpBB/adm/style/overall_header.html b/phpBB/adm/style/overall_header.html index d399c680ee..bd8caf1443 100644 --- a/phpBB/adm/style/overall_header.html +++ b/phpBB/adm/style/overall_header.html @@ -53,7 +53,7 @@ function marklist(id, name, state) for (var r = 0; r < rb.length; r++) { - if (rb[r].name.substr(0, name.length) == name) + if (rb[r].name.substr(0, name.length) == name && rb[r].disabled !== true) { rb[r].checked = state; } diff --git a/phpBB/adm/style/simple_header.html b/phpBB/adm/style/simple_header.html index 9f47b2052b..439645a211 100644 --- a/phpBB/adm/style/simple_header.html +++ b/phpBB/adm/style/simple_header.html @@ -66,7 +66,7 @@ function marklist(id, name, state) for (var r = 0; r < rb.length; r++) { - if (rb[r].name.substr(0, name.length) == name) + if (rb[r].name.substr(0, name.length) == name && rb[r].disabled !== true) { rb[r].checked = state; } diff --git a/phpBB/styles/prosilver/template/forum_fn.js b/phpBB/styles/prosilver/template/forum_fn.js index 99f3108fad..d779008f80 100644 --- a/phpBB/styles/prosilver/template/forum_fn.js +++ b/phpBB/styles/prosilver/template/forum_fn.js @@ -57,7 +57,7 @@ function marklist(id, name, state) { jQuery('#' + id + ' input[type=checkbox][name]').each(function() { var $this = jQuery(this); - if ($this.attr('name').substr(0, name.length) === name) { + if ($this.attr('name').substr(0, name.length) === name && !$this.prop('disabled')) { $this.prop('checked', state); } }); diff --git a/phpBB/styles/subsilver2/template/memberlist_search.html b/phpBB/styles/subsilver2/template/memberlist_search.html index 2096062607..5a4c430cd2 100644 --- a/phpBB/styles/subsilver2/template/memberlist_search.html +++ b/phpBB/styles/subsilver2/template/memberlist_search.html @@ -54,7 +54,7 @@ for (var r = 0; r < rb.length; r++) { - if (rb[r].name.substr(0, name.length) == name) + if (rb[r].name.substr(0, name.length) == name && rb[r].disabled !== true) { rb[r].checked = state; } diff --git a/phpBB/styles/subsilver2/template/overall_header.html b/phpBB/styles/subsilver2/template/overall_header.html index a4185785e3..ae3d48215e 100644 --- a/phpBB/styles/subsilver2/template/overall_header.html +++ b/phpBB/styles/subsilver2/template/overall_header.html @@ -83,7 +83,7 @@ function marklist(id, name, state) for (var r = 0; r < rb.length; r++) { - if (rb[r].name.substr(0, name.length) == name) + if (rb[r].name.substr(0, name.length) == name && rb[r].disabled !== true) { rb[r].checked = state; } From b9189ec325c20b6b058a2f4928152a253f04ae6c Mon Sep 17 00:00:00 2001 From: javiexin Date: Sat, 14 Jan 2017 18:08:23 +0100 Subject: [PATCH 44/58] [ticket/15011] Error not checked on metadata load failure PHPBB3-15011 --- phpBB/phpbb/extension/metadata_manager.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/phpBB/phpbb/extension/metadata_manager.php b/phpBB/phpbb/extension/metadata_manager.php index a64d88fe39..2919661114 100644 --- a/phpBB/phpbb/extension/metadata_manager.php +++ b/phpBB/phpbb/extension/metadata_manager.php @@ -229,7 +229,10 @@ class metadata_manager case 'all': $this->validate('display'); - $this->validate_enable(); + if (!$this->validate_enable()) + { + throw new \phpbb\extension\exception($this->user->lang('META_FIELD_NOT_SET', $name)); + } break; case 'display': From cb44dbc8cb428132df072cd1d9c36dbb5bad68be Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 15 Jan 2017 15:32:55 +0100 Subject: [PATCH 45/58] [ticket/11076] State current and minimum required versions in old PHP notice PHPBB3-11076 --- phpBB/includes/acp/acp_main.php | 4 ++-- phpBB/language/en/acp/common.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php index 848cafeb67..7630875f47 100644 --- a/phpBB/includes/acp/acp_main.php +++ b/phpBB/includes/acp/acp_main.php @@ -421,11 +421,11 @@ class acp_main // Version check $user->add_lang('install'); - if ($auth->acl_get('a_server') && version_compare(PHP_VERSION, '5.3.3', '<')) + if ($auth->acl_get('a_server') && version_compare(PHP_VERSION, '5.4.0', '<')) { $template->assign_vars(array( 'S_PHP_VERSION_OLD' => true, - 'L_PHP_VERSION_OLD' => sprintf($user->lang['PHP_VERSION_OLD'], '', ''), + 'L_PHP_VERSION_OLD' => sprintf($user->lang['PHP_VERSION_OLD'], PHP_VERSION, '5.4.0', '', ''), )); } diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index 88e60d00a3..562b446f8a 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -373,7 +373,7 @@ $lang = array_merge($lang, array( 'NUMBER_USERS' => 'Number of users', 'NUMBER_ORPHAN' => 'Orphan attachments', - 'PHP_VERSION_OLD' => 'The version of PHP on this server will no longer be supported by future versions of phpBB. %sDetails%s', + 'PHP_VERSION_OLD' => 'The version of PHP on this server (%1$s) will no longer be supported by future versions of phpBB. The minimum required version will be PHP %2$s. %3$sDetails%4$s', 'POSTS_PER_DAY' => 'Posts per day', From a0bd23b74728ab6aa2a3e37197e4cc34bfe3ff38 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 15 Jan 2017 17:56:12 +0100 Subject: [PATCH 46/58] [ticket/15011] Output meaningful errors when validating all metadata PHPBB3-15011 --- phpBB/phpbb/extension/metadata_manager.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/phpBB/phpbb/extension/metadata_manager.php b/phpBB/phpbb/extension/metadata_manager.php index 35a88d6991..107907609b 100644 --- a/phpBB/phpbb/extension/metadata_manager.php +++ b/phpBB/phpbb/extension/metadata_manager.php @@ -230,9 +230,19 @@ class metadata_manager case 'all': $this->validate('display'); - if (!$this->validate_enable()) + if (!$this->validate_dir()) { - throw new \phpbb\extension\exception($this->user->lang('META_FIELD_NOT_SET', $name)); + throw new \phpbb\extension\exception($this->user->lang('EXTENSION_DIR_INVALID')); + } + + if (!$this->validate_require_phpbb()) + { + throw new \phpbb\extension\exception($this->user->lang('META_FIELD_NOT_SET', 'soft-require')); + } + + if (!$this->validate_require_php()) + { + throw new \phpbb\extension\exception($this->user->lang('META_FIELD_NOT_SET', 'require php')); } break; From 0d17b32e25378abf97817e255f0d1cd82a560460 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 16 Jan 2017 20:57:06 +0100 Subject: [PATCH 47/58] [ticket/11611] Remove no longer used file for setting up git repository PHPBB3-11611 --- git-tools/setup_github_network.php | 292 ----------------------------- 1 file changed, 292 deletions(-) delete mode 100755 git-tools/setup_github_network.php diff --git a/git-tools/setup_github_network.php b/git-tools/setup_github_network.php deleted file mode 100755 index 100ac53b33..0000000000 --- a/git-tools/setup_github_network.php +++ /dev/null @@ -1,292 +0,0 @@ -#!/usr/bin/env php - -* @license GNU General Public License, version 2 (GPL-2.0) -* -* For full copyright and license information, please see -* the docs/CREDITS.txt file. -* -*/ - -function show_usage() -{ - $filename = basename(__FILE__); - - echo "$filename adds repositories of a github network as remotes to a local git repository.\n"; - echo "\n"; - - echo "Usage: [php] $filename -s collaborators|organisation|contributors|forks [OPTIONS]\n"; - echo "\n"; - - echo "Scopes:\n"; - echo " collaborators Repositories of people who have push access to the specified repository\n"; - echo " contributors Repositories of people who have contributed to the specified repository\n"; - echo " organisation Repositories of members of the organisation at github\n"; - echo " forks All repositories of the whole github network\n"; - echo "\n"; - - echo "Options:\n"; - echo " -s scope See description above (mandatory)\n"; - echo " -u github_username Overwrites the github username (optional)\n"; - echo " -r repository_name Overwrites the repository name (optional)\n"; - echo " -m your_github_username Sets up ssh:// instead of git:// for pushable repositories (optional)\n"; - echo " -d Outputs the commands instead of running them (optional)\n"; - echo " -h This help text\n"; - - exit(1); -} - -// Handle arguments -$opts = getopt('s:u:r:m:dh'); - -if (empty($opts) || isset($opts['h'])) -{ - show_usage(); -} - -$scope = get_arg($opts, 's', ''); -$username = get_arg($opts, 'u', 'phpbb'); -$repository = get_arg($opts, 'r', 'phpbb3'); -$developer = get_arg($opts, 'm', ''); -$dry_run = !get_arg($opts, 'd', true); -run(null, $dry_run); -exit(work($scope, $username, $repository, $developer)); - -function work($scope, $username, $repository, $developer) -{ - // Get some basic data - $forks = get_forks($username, $repository); - $collaborators = get_collaborators($username, $repository); - - if ($forks === false || $collaborators === false) - { - echo "Error: failed to retrieve forks or collaborators\n"; - return 1; - } - - switch ($scope) - { - case 'collaborators': - $remotes = array_intersect_key($forks, $collaborators); - break; - - case 'organisation': - $remotes = array_intersect_key($forks, get_organisation_members($username)); - break; - - case 'contributors': - $remotes = array_intersect_key($forks, get_contributors($username, $repository)); - break; - - case 'forks': - $remotes = $forks; - break; - - default: - show_usage(); - } - - if (file_exists('.git')) - { - add_remote($username, $repository, isset($collaborators[$developer])); - } - else - { - clone_repository($username, $repository, isset($collaborators[$developer])); - } - - // Add private security repository for developers - if ($username == 'phpbb' && $repository == 'phpbb3' && isset($collaborators[$developer])) - { - run("git remote add $username-security " . get_repository_url($username, "$repository-security", true)); - } - - // Skip blessed repository. - unset($remotes[$username]); - - foreach ($remotes as $remote) - { - add_remote($remote['username'], $remote['repository'], $remote['username'] == $developer); - } - - run('git remote update'); -} - -function clone_repository($username, $repository, $pushable = false) -{ - $url = get_repository_url($username, $repository, false); - run("git clone $url ./ --origin $username"); - - if ($pushable) - { - $ssh_url = get_repository_url($username, $repository, true); - run("git remote set-url --push $username $ssh_url"); - } -} - -function add_remote($username, $repository, $pushable = false) -{ - $url = get_repository_url($username, $repository, false); - run("git remote add $username $url"); - - if ($pushable) - { - $ssh_url = get_repository_url($username, $repository, true); - run("git remote set-url --push $username $ssh_url"); - } -} - -function get_repository_url($username, $repository, $ssh = false) -{ - $url_base = ($ssh) ? 'git@github.com:' : 'git://github.com/'; - - return $url_base . $username . '/' . $repository . '.git'; -} - -function api_request($query) -{ - return api_url_request("https://api.github.com/$query?per_page=100"); -} - -function api_url_request($url) -{ - $contents = file_get_contents($url, false, stream_context_create(array( - 'http' => array( - 'header' => "User-Agent: phpBB/1.0\r\n", - ), - ))); - - $sub_request_result = array(); - // Check headers for pagination links - if (!empty($http_response_header)) - { - foreach ($http_response_header as $header_element) - { - // Find Link Header which gives us a link to the next page - if (strpos($header_element, 'Link: ') === 0) - { - list($head, $header_content) = explode(': ', $header_element); - foreach (explode(', ', $header_content) as $links) - { - list($url, $rel) = explode('; ', $links); - if ($rel == 'rel="next"') - { - // Found a next link, follow it and merge the results - $sub_request_result = api_url_request(substr($url, 1, -1)); - } - } - } - } - } - - if ($contents === false) - { - return false; - } - $contents = json_decode($contents); - - if (isset($contents->message) && strpos($contents->message, 'API Rate Limit') === 0) - { - throw new RuntimeException('Reached github API Rate Limit. Please try again later' . "\n", 4); - } - - return ($sub_request_result) ? array_merge($sub_request_result, $contents) : $contents; -} - -function get_contributors($username, $repository) -{ - $request = api_request("repos/$username/$repository/stats/contributors"); - if ($request === false) - { - return false; - } - - $usernames = array(); - foreach ($request as $contribution) - { - $usernames[$contribution->author->login] = $contribution->author->login; - } - - return $usernames; -} - -function get_organisation_members($username) -{ - $request = api_request("orgs/$username/public_members"); - if ($request === false) - { - return false; - } - - $usernames = array(); - foreach ($request as $member) - { - $usernames[$member->login] = $member->login; - } - - return $usernames; -} - -function get_collaborators($username, $repository) -{ - $request = api_request("repos/$username/$repository/collaborators"); - if ($request === false) - { - return false; - } - - $usernames = array(); - foreach ($request as $collaborator) - { - $usernames[$collaborator->login] = $collaborator->login; - } - - return $usernames; -} - -function get_forks($username, $repository) -{ - $request = api_request("repos/$username/$repository/forks"); - if ($request === false) - { - return false; - } - - $usernames = array(); - foreach ($request as $fork) - { - $usernames[$fork->owner->login] = array( - 'username' => $fork->owner->login, - 'repository' => $fork->name, - ); - } - - return $usernames; -} - -function get_arg($array, $index, $default) -{ - return isset($array[$index]) ? $array[$index] : $default; -} - -function run($cmd, $dry = false) -{ - static $dry_run; - - if (is_null($cmd)) - { - $dry_run = $dry; - } - else if (!empty($dry_run)) - { - echo "$cmd\n"; - } - else - { - passthru(escapeshellcmd($cmd)); - } -} From 6c09910c105a3cb637ffc5fcadd225ba82f4cc2d Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 21 Jan 2017 11:21:38 +0100 Subject: [PATCH 48/58] [ticket/13250] Replace slashes in cache file names PHPBB3-13250 --- phpBB/phpbb/cache/driver/file.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/phpbb/cache/driver/file.php b/phpBB/phpbb/cache/driver/file.php index fae4614039..67c6b84b45 100644 --- a/phpBB/phpbb/cache/driver/file.php +++ b/phpBB/phpbb/cache/driver/file.php @@ -601,6 +601,6 @@ class file extends \phpbb\cache\driver\base */ protected function clean_varname($varname) { - return str_replace('/', '-', $varname); + return preg_replace('#[\\\\\\\/]#', '-', $varname); } } From 0572d6e33ad8f19f9f70d872421ee6ab268d6ae8 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 22 Jan 2017 16:09:51 +0100 Subject: [PATCH 49/58] [ticket/14968] Add method for retrieving updates on current branch PHPBB3-14968 --- phpBB/phpbb/version_helper.php | 39 +++++++ tests/version/version_test.php | 200 +++++++++++++++++++++++++++++++++ 2 files changed, 239 insertions(+) diff --git a/phpBB/phpbb/version_helper.php b/phpBB/phpbb/version_helper.php index a1e66ba8fe..b5f493de9d 100644 --- a/phpBB/phpbb/version_helper.php +++ b/phpBB/phpbb/version_helper.php @@ -200,6 +200,45 @@ class version_helper }); } + /** + * Gets the latest version for the current branch the user is on + * + * @param bool $force_update Ignores cached data. Defaults to false. + * @param bool $force_cache Force the use of the cache. Override $force_update. + * @return string + * @throws \RuntimeException + */ + public function get_update_on_branch($force_update = false, $force_cache = false) + { + $versions = $this->get_versions_matching_stability($force_update, $force_cache); + + $self = $this; + $current_version = $this->current_version; + + // Filter out any versions less than to the current version + $versions = array_filter($versions, function($data) use ($self, $current_version) { + return $self->compare($data['current'], $current_version, '>='); + }); + + // Get the lowest version from the previous list. + return array_reduce($versions, function($value, $data) use ($self, $current_version) { + if ($value === null && $self->compare($data['current'], $current_version, '>=')) + { + + if (!$data['eol'] && (!$data['security'] || $self->compare($data['security'], $data['current'], '<='))) + { + return ($self->compare($data['current'], $current_version, '>')) ? $data : array(); + } + else + { + return null; + } + } + + return $value; + }); + } + /** * Obtains the latest version information * diff --git a/tests/version/version_test.php b/tests/version/version_test.php index 528f1602d6..b9a6cf19ab 100644 --- a/tests/version/version_test.php +++ b/tests/version/version_test.php @@ -332,4 +332,204 @@ class phpbb_version_helper_test extends phpbb_test_case $this->assertSame($expected, $version_helper->get_latest_on_current_branch()); } + + public function get_update_on_branch_data() + { + return array( + array( + '1.0.0', + array( + '1.0' => array( + 'current' => '1.0.1', + ), + '1.1' => array( + 'current' => '1.1.1', + ), + ), + array( + 'current' => '1.0.1', + ), + ), + array( + '1.0.1', + array( + '1.0' => array( + 'current' => '1.0.1', + ), + '1.1' => array( + 'current' => '1.1.1', + ), + ), + array(), + ), + array( + '1.0.1-a1', + array( + '1.0' => array( + 'current' => '1.0.1-a2', + ), + '1.1' => array( + 'current' => '1.1.0', + ), + ), + array( + 'current' => '1.0.1-a2', + ), + ), + array( + '1.1.0', + array( + '1.0' => array( + 'current' => '1.0.1', + ), + '1.1' => array( + 'current' => '1.1.1', + ), + ), + array( + 'current' => '1.1.1', + ), + ), + array( + '1.1.1', + array( + '1.0' => array( + 'current' => '1.0.1', + ), + '1.1' => array( + 'current' => '1.1.1', + ), + ), + array(), + ), + array( + '1.1.0-a1', + array( + '1.0' => array( + 'current' => '1.0.1', + ), + '1.1' => array( + 'current' => '1.1.0-a2', + ), + ), + array( + 'current' => '1.1.0-a2', + ), + ), + array( + '1.1.0', + array(), + null, + ), + // Latest safe release is 1.0.1 + array( + '1.0.0', + array( + '1.0' => array( + 'current' => '1.0.1', + 'security' => '1.0.1', + ), + '1.1' => array( + 'current' => '1.1.1', + ), + ), + array( + 'current' => '1.0.1', + 'security' => '1.0.1', + ), + ), + // Latest safe release is 1.0.0 + array( + '1.0.0', + array( + '1.0' => array( + 'current' => '1.0.1', + 'security' => '1.0.1', + ), + '1.1' => array( + 'current' => '1.1.1', + ), + ), + array( + 'current' => '1.0.1', + 'security' => '1.0.1', + ), + ), + // Latest safe release is 1.1.0 + array( + '1.0.0', + array( + '1.0' => array( + 'current' => '1.0.1', + 'security' => '1.1.0', + ), + '1.1' => array( + 'current' => '1.1.1', + ), + ), + array( + 'current' => '1.1.1', + ), + ), + // Latest 1.0 release is EOL + array( + '1.0.0', + array( + '1.0' => array( + 'current' => '1.0.1', + 'eol' => true, + ), + '1.1' => array( + 'current' => '1.1.1', + ), + ), + array( + 'current' => '1.1.1', + ), + ), + // All are EOL -- somewhat undefined behavior + array( + '1.0.0', + array( + '1.0' => array( + 'current' => '1.0.1', + 'eol' => true, + ), + '1.1' => array( + 'current' => '1.1.1', + 'eol' => true, + ), + ), + null, + ), + ); + } + + /** + * @dataProvider get_update_on_branch_data + */ + public function test_get_update_on_branch($current_version, $versions, $expected) + { + $version_helper = $this + ->getMockBuilder('\phpbb\version_helper') + ->setMethods(array( + 'get_versions_matching_stability', + )) + ->setConstructorArgs(array( + $this->cache, + new \phpbb\config\config(array( + 'version' => $current_version, + )), + new \phpbb\file_downloader(), + new \phpbb\user('\phpbb\datetime'), + )) + ->getMock() + ; + + $version_helper->expects($this->any()) + ->method('get_versions_matching_stability') + ->will($this->returnValue($versions)); + + $this->assertSame($expected, $version_helper->get_update_on_branch()); + } } From a620ce0713f42daea8c5b0c4fdb70c63748af1f8 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 22 Jan 2017 16:37:20 +0100 Subject: [PATCH 50/58] [ticket/14968] Display possible upgrade on acp index and update page PHPBB3-14968 --- phpBB/adm/style/acp_main.html | 5 +++++ phpBB/adm/style/acp_update.html | 5 +++++ phpBB/includes/acp/acp_main.php | 14 ++++++++++++-- phpBB/includes/acp/acp_update.php | 9 ++++++++- phpBB/language/en/install.php | 1 + 5 files changed, 31 insertions(+), 3 deletions(-) diff --git a/phpBB/adm/style/acp_main.html b/phpBB/adm/style/acp_main.html index efcb25cb68..1bdb7b8d2a 100644 --- a/phpBB/adm/style/acp_main.html +++ b/phpBB/adm/style/acp_main.html @@ -30,6 +30,11 @@

    {L_VERSIONCHECK_FORCE_UPDATE} · {L_MORE_INFORMATION}

    + +
    +

    {UPGRADE_INSTRUCTIONS}

    +
    +
    diff --git a/phpBB/adm/style/acp_update.html b/phpBB/adm/style/acp_update.html index 351a3ba26c..5288833d05 100644 --- a/phpBB/adm/style/acp_update.html +++ b/phpBB/adm/style/acp_update.html @@ -20,6 +20,11 @@

    {L_VERSION_NOT_UP_TO_DATE_ACP} - {L_VERSIONCHECK_FORCE_UPDATE}

    + +
    +

    {UPGRADE_INSTRUCTIONS}

    +
    +
    diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php index 7630875f47..6e7bd91a86 100644 --- a/phpBB/includes/acp/acp_main.php +++ b/phpBB/includes/acp/acp_main.php @@ -431,13 +431,23 @@ class acp_main if ($auth->acl_get('a_board')) { + /** @var \phpbb\version_helper $version_helper */ $version_helper = $phpbb_container->get('version_helper'); try { $recheck = $request->variable('versioncheck_force', false); - $updates_available = $version_helper->get_suggested_updates($recheck); + $updates_available = $version_helper->get_update_on_branch($recheck); + $upgrades_available = $version_helper->get_suggested_updates(); + if (!empty($upgrades_available)) + { + $upgrades_available = array_pop($upgrades_available); + } - $template->assign_var('S_VERSION_UP_TO_DATE', empty($updates_available)); + $template->assign_vars(array( + 'S_VERSION_UP_TO_DATE' => empty($updates_available), + 'S_VERSION_UPGRADEABLE' => !empty($upgrades_available), + 'UPGRADE_INSTRUCTIONS' => !empty($upgrades_available) ? $user->lang('UPGRADE_INSTRUCTIONS', $upgrades_available['current'], $upgrades_available['announcement']) : false, + )); } catch (\RuntimeException $e) { diff --git a/phpBB/includes/acp/acp_update.php b/phpBB/includes/acp/acp_update.php index 529f0f2185..0f79d39ea2 100644 --- a/phpBB/includes/acp/acp_update.php +++ b/phpBB/includes/acp/acp_update.php @@ -37,7 +37,12 @@ class acp_update try { $recheck = $request->variable('versioncheck_force', false); - $updates_available = $version_helper->get_suggested_updates($recheck); + $updates_available = $version_helper->get_update_on_branch($recheck); + $upgrades_available = $version_helper->get_suggested_updates(); + if (!empty($upgrades_available)) + { + $upgrades_available = array_pop($upgrades_available); + } } catch (\RuntimeException $e) { @@ -61,6 +66,8 @@ class acp_update 'CURRENT_VERSION' => $config['version'], 'UPDATE_INSTRUCTIONS' => sprintf($user->lang['UPDATE_INSTRUCTIONS'], $update_link), + 'S_VERSION_UPGRADEABLE' => !empty($upgrades_available), + 'UPGRADE_INSTRUCTIONS' => !empty($upgrades_available) ? $user->lang('UPGRADE_INSTRUCTIONS', $upgrades_available['current'], $upgrades_available['announcement']) : false, )); // Incomplete update? diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index 6477a929e9..0460c0613e 100644 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -574,6 +574,7 @@ $lang = array_merge($lang, array( 'UPDATING_DATA' => 'Updating data', 'UPDATING_TO_LATEST_STABLE' => 'Updating database to latest stable release', 'UPDATED_VERSION' => 'Updated version', + 'UPGRADE_INSTRUCTIONS' => 'A new feature release %1$s is available. Please read the release announcement to learn about what it has to offer, and how to upgrade.', 'UPLOAD_METHOD' => 'Upload method', 'UPDATE_DB_SUCCESS' => 'Database update was successful.', From 20a4d095de449e4f72272e77da4e009033f2c1de Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 22 Jan 2017 16:56:14 +0100 Subject: [PATCH 51/58] [ticket/14968] Update docblock and ensure method returns array PHPBB3-14968 --- phpBB/phpbb/version_helper.php | 12 ++++++++---- tests/version/version_test.php | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/phpBB/phpbb/version_helper.php b/phpBB/phpbb/version_helper.php index b5f493de9d..135d390584 100644 --- a/phpBB/phpbb/version_helper.php +++ b/phpBB/phpbb/version_helper.php @@ -201,11 +201,14 @@ class version_helper } /** - * Gets the latest version for the current branch the user is on + * Gets the latest update for the current branch the user is on + * Will suggest versions from newer branches when EoL has been reached + * and/or version from newer branch is needed for having all known security + * issues fixed. * * @param bool $force_update Ignores cached data. Defaults to false. * @param bool $force_cache Force the use of the cache. Override $force_update. - * @return string + * @return array Version info or empty array if there are no updates * @throws \RuntimeException */ public function get_update_on_branch($force_update = false, $force_cache = false) @@ -221,10 +224,9 @@ class version_helper }); // Get the lowest version from the previous list. - return array_reduce($versions, function($value, $data) use ($self, $current_version) { + $update_info = array_reduce($versions, function($value, $data) use ($self, $current_version) { if ($value === null && $self->compare($data['current'], $current_version, '>=')) { - if (!$data['eol'] && (!$data['security'] || $self->compare($data['security'], $data['current'], '<='))) { return ($self->compare($data['current'], $current_version, '>')) ? $data : array(); @@ -237,6 +239,8 @@ class version_helper return $value; }); + + return $update_info === null ? array() : $update_info; } /** diff --git a/tests/version/version_test.php b/tests/version/version_test.php index b9a6cf19ab..1d47b0ab4a 100644 --- a/tests/version/version_test.php +++ b/tests/version/version_test.php @@ -419,7 +419,7 @@ class phpbb_version_helper_test extends phpbb_test_case array( '1.1.0', array(), - null, + array(), ), // Latest safe release is 1.0.1 array( @@ -500,7 +500,7 @@ class phpbb_version_helper_test extends phpbb_test_case 'eol' => true, ), ), - null, + array(), ), ); } From 38d0f2892e9d8f55c6e6af2d004da9621ee7f8f5 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 22 Jan 2017 17:01:12 +0100 Subject: [PATCH 52/58] [ticket/14968] Use earlier version as written in comment PHPBB3-14968 --- tests/version/version_test.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/version/version_test.php b/tests/version/version_test.php index 1d47b0ab4a..54237f2059 100644 --- a/tests/version/version_test.php +++ b/tests/version/version_test.php @@ -444,7 +444,7 @@ class phpbb_version_helper_test extends phpbb_test_case array( '1.0' => array( 'current' => '1.0.1', - 'security' => '1.0.1', + 'security' => '1.0.0', ), '1.1' => array( 'current' => '1.1.1', @@ -452,7 +452,7 @@ class phpbb_version_helper_test extends phpbb_test_case ), array( 'current' => '1.0.1', - 'security' => '1.0.1', + 'security' => '1.0.0', ), ), // Latest safe release is 1.1.0 From fbff3b77bdf483adbf88baababebbc1ddd2c3b83 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 22 Jan 2017 17:22:28 +0100 Subject: [PATCH 53/58] [ticket/13250] Use faster str_replace() instead of preg_replace() PHPBB3-13250 --- phpBB/phpbb/cache/driver/file.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/phpbb/cache/driver/file.php b/phpBB/phpbb/cache/driver/file.php index 67c6b84b45..1e9ee960dc 100644 --- a/phpBB/phpbb/cache/driver/file.php +++ b/phpBB/phpbb/cache/driver/file.php @@ -601,6 +601,6 @@ class file extends \phpbb\cache\driver\base */ protected function clean_varname($varname) { - return preg_replace('#[\\\\\\\/]#', '-', $varname); + return str_replace(array('/', '\\'), '-', $varname); } } From 612abf391f3df2bff5e64c2ea6267d33ab273e39 Mon Sep 17 00:00:00 2001 From: TarantinoMariachi Date: Thu, 12 Jan 2017 20:54:25 +0000 Subject: [PATCH 54/58] [ticket/14997] Fixing topiclist_row_topic_title_after position Fixing position as it is correctly on subsilver, or else it will appear some problems when using polls or on topics with page numbers. PHPBB3-14997 --- phpBB/styles/prosilver/template/search_results.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/styles/prosilver/template/search_results.html b/phpBB/styles/prosilver/template/search_results.html index b6c454bf05..4365482314 100644 --- a/phpBB/styles/prosilver/template/search_results.html +++ b/phpBB/styles/prosilver/template/search_results.html @@ -76,6 +76,7 @@ {searchresults.UNAPPROVED_IMG} {DELETED_IMG} {REPORTED_IMG}
    + {POLL_IMG} - {L_POST_BY_AUTHOR} {searchresults.TOPIC_AUTHOR_FULL} » {searchresults.FIRST_POST_TIME} » {L_IN} {searchresults.FORUM_TITLE} From 59027c94f25d66b8fc3322902477aae350b24f75 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 22 Jan 2017 19:20:18 +0100 Subject: [PATCH 55/58] [ticket/15006] Pass inherit settings to form and use correct button PHPBB3-15006 --- phpBB/adm/style/ajax.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/phpBB/adm/style/ajax.js b/phpBB/adm/style/ajax.js index a7ecf8ff7b..77fd28fbe6 100644 --- a/phpBB/adm/style/ajax.js +++ b/phpBB/adm/style/ajax.js @@ -173,10 +173,11 @@ function submitPermissions() { $.ajax({ url: $form.action, type: 'POST', - data: formData + '&' + $submitAllButton.name + '=' + encodeURIComponent($submitAllButton.value) + + data: formData + '&' + $submitButton.name + '=' + encodeURIComponent($submitButton.value) + '&creation_time=' + $form.find('input[type=hidden][name=creation_time]')[0].value + '&form_token=' + $form.find('input[type=hidden][name=form_token]')[0].value + - '&' + $form.children('input[type=hidden]').serialize(), + '&' + $form.children('input[type=hidden]').serialize() + + '&' + $form.find('input[type=checkbox][name^=inherit]').serialize(), success: handlePermissionReturn, error: handlePermissionReturn }); From d1df78604b36375ee563edd86af5a4025ee3f6e4 Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Mon, 23 Jan 2017 14:27:11 +0100 Subject: [PATCH 56/58] [ticket/13601] Add core.acl_clear_prefetch_after event PHPBB3-13601 --- phpBB/phpbb/auth/auth.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/phpBB/phpbb/auth/auth.php b/phpBB/phpbb/auth/auth.php index b7634e04ce..37d4352c10 100644 --- a/phpBB/phpbb/auth/auth.php +++ b/phpBB/phpbb/auth/auth.php @@ -514,7 +514,7 @@ class auth */ function acl_clear_prefetch($user_id = false) { - global $db, $cache; + global $db, $cache, $phpbb_dispatcher; // Rebuild options cache $cache->destroy('_role_cache'); @@ -553,6 +553,16 @@ class auth $where_sql"; $db->sql_query($sql); + /** + * Event is triggered after user(s) permission settings cache has been cleared + * + * @event core.acl_clear_prefetch_after + * @var mixed user_id User ID(s) + * @since 3.1.11-RC1 + */ + $vars = array('user_id'); + extract($phpbb_dispatcher->trigger_event('core.acl_clear_prefetch_after', compact($vars))); + return; } From d81df55963618878ed18c3958463b4654f396df3 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 28 Jan 2017 09:16:49 +0100 Subject: [PATCH 57/58] [ticket/14998] Point only to install dir from acp_update PHPBB3-14998 --- phpBB/includes/acp/acp_update.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/acp/acp_update.php b/phpBB/includes/acp/acp_update.php index 0f79d39ea2..51ff4870f2 100644 --- a/phpBB/includes/acp/acp_update.php +++ b/phpBB/includes/acp/acp_update.php @@ -56,7 +56,7 @@ class acp_update $template->assign_block_vars('updates_available', $version_data); } - $update_link = append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=update'); + $update_link = append_sid($phpbb_root_path . 'install/'); $template->assign_vars(array( 'S_UP_TO_DATE' => empty($updates_available), From 35b7e95098cecdb54345fa2b08e8d82aa4752cb2 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Mon, 30 Jan 2017 08:48:42 -0800 Subject: [PATCH 58/58] [ticket/15059] Preserve code line breaks and scroll overflow PHPBB3-15059 --- phpBB/styles/prosilver/theme/content.css | 2 ++ 1 file changed, 2 insertions(+) diff --git a/phpBB/styles/prosilver/theme/content.css b/phpBB/styles/prosilver/theme/content.css index e7c0e177a6..dfb91891fa 100644 --- a/phpBB/styles/prosilver/theme/content.css +++ b/phpBB/styles/prosilver/theme/content.css @@ -493,6 +493,8 @@ blockquote.uncited { padding: 3px; border: 1px solid transparent; font-size: 1em; + overflow-x: scroll; + word-wrap: normal; } .codebox p {