From 47e418e50e9d516e768bd675892c3c4f5dfa571e Mon Sep 17 00:00:00 2001 From: javiexin Date: Mon, 5 Dec 2016 01:07:43 +0100 Subject: [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(+) (limited to 'phpBB/phpbb') 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 * -- cgit v1.2.1 From 800411e514795d88bf947c81aa1617478043ef0a Mon Sep 17 00:00:00 2001 From: rxu Date: Tue, 6 Dec 2016 23:35:04 +0700 Subject: [ticket/14893] Fix undefined variable on reporting PM notification PHPBB3-14893 --- phpBB/phpbb/notification/type/report_pm.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'phpBB/phpbb') 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'))), -- cgit v1.2.1 From 7e2d544016c1dd7d1f052520c582c629e1792f3a Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Wed, 23 Nov 2016 13:48:14 +0100 Subject: [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 (limited to 'phpBB/phpbb') 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', ''), + ), + ), + ); + } +} -- cgit v1.2.1 From fe79705e99f6bbef07a9423adf9a27b5ad41fb02 Mon Sep 17 00:00:00 2001 From: javiexin Date: Fri, 16 Dec 2016 13:46:42 +0100 Subject: [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(-) (limited to 'phpBB/phpbb') 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': -- cgit v1.2.1 From 853362ddad3c3c137894da2357d2cfd0f1816049 Mon Sep 17 00:00:00 2001 From: Crizzo Date: Sun, 18 Dec 2016 14:12:03 +0100 Subject: [ticket/14770] Reduce plupload resize quality PHPBB3-14770 --- phpBB/phpbb/plupload/plupload.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb') 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'] ); -- cgit v1.2.1 From 71f82f2615302da12f00e925cd40522b9a010257 Mon Sep 17 00:00:00 2001 From: Crizzo Date: Sun, 18 Dec 2016 15:31:58 +0100 Subject: [ticket/14770] Decreases quality to 85, changes test to 85, too PHPBB3-14770 --- phpBB/phpbb/plupload/plupload.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb') 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'] ); -- cgit v1.2.1 From 9e6207add3070a5d3a6b3c8f798ad54dd8fbf828 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 25 Dec 2016 10:19:33 +0100 Subject: [ticket/14923] Make sure start for queries is always set in migrations PHPBB3-14923 --- phpBB/phpbb/db/migration/data/v310/notification_options_reconvert.php | 1 + phpBB/phpbb/db/migration/profilefield_base_migration.php | 1 + 2 files changed, 2 insertions(+) (limited to 'phpBB/phpbb') 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 -- cgit v1.2.1 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: [ticket/14941] Apply changes individually for MySQL fulltext search --- phpBB/phpbb/search/fulltext_mysql.php | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'phpBB/phpbb') 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); -- cgit v1.2.1 From d9991bdaf1aa9685437c4f4c298fa54f0c0f33f0 Mon Sep 17 00:00:00 2001 From: javiexin Date: Wed, 28 Dec 2016 12:37:53 +0100 Subject: [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(-) (limited to 'phpBB/phpbb') 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; } -- cgit v1.2.1 From 14fd750b087c7c9e31f9701bb08ced08db964d12 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 28 Dec 2016 18:15:17 +0100 Subject: [ticket/14957] Do not cache database config entries PHPBB3-14957 --- phpBB/phpbb/di/container_builder.php | 13 +++++++++++++ phpBB/phpbb/di/extension/config.php | 6 ------ 2 files changed, 13 insertions(+), 6 deletions(-) (limited to 'phpBB/phpbb') 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(); -- cgit v1.2.1 From ff411ee81bc12574138577a5bb4b0cbc9004b00e Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 3 Jan 2017 21:53:14 +0100 Subject: [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(-) (limited to 'phpBB/phpbb') 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()); } -- cgit v1.2.1 From 7cad25e4cbed2efbf891001cd2664f825674d5a7 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 25 Dec 2016 17:54:11 +0100 Subject: [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/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 ++ 7 files changed, 35 insertions(+), 3 deletions(-) (limited to 'phpBB/phpbb') 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, -- cgit v1.2.1 From dd89a369f3166ed4a3730ac8a2fb6eb5608ac284 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 4 Jan 2017 17:16:36 +0100 Subject: [ticket/14838] Remove obsolete overriding method PHPBB3-14838 --- phpBB/phpbb/feed/attachments_base.php | 8 -------- 1 file changed, 8 deletions(-) (limited to 'phpBB/phpbb') 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 * -- cgit v1.2.1 From 49c19a267fbf00cf8eb339557d4cf921c558f4f1 Mon Sep 17 00:00:00 2001 From: rxu Date: Thu, 5 Jan 2017 00:42:27 +0700 Subject: [ticket/14958] Optimize Twig extension lang() function PHPBB3-14958 --- phpBB/phpbb/template/twig/extension.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'phpBB/phpbb') 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])) { -- cgit v1.2.1 From b9189ec325c20b6b058a2f4928152a253f04ae6c Mon Sep 17 00:00:00 2001 From: javiexin Date: Sat, 14 Jan 2017 18:08:23 +0100 Subject: [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(-) (limited to 'phpBB/phpbb') 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': -- cgit v1.2.1 From a0bd23b74728ab6aa2a3e37197e4cc34bfe3ff38 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 15 Jan 2017 17:56:12 +0100 Subject: [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(-) (limited to 'phpBB/phpbb') 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; -- cgit v1.2.1 From 6c09910c105a3cb637ffc5fcadd225ba82f4cc2d Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 21 Jan 2017 11:21:38 +0100 Subject: [ticket/13250] Replace slashes in cache file names PHPBB3-13250 --- phpBB/phpbb/cache/driver/file.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb') 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); } } -- cgit v1.2.1 From 0572d6e33ad8f19f9f70d872421ee6ab268d6ae8 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 22 Jan 2017 16:09:51 +0100 Subject: [ticket/14968] Add method for retrieving updates on current branch PHPBB3-14968 --- phpBB/phpbb/version_helper.php | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'phpBB/phpbb') 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 * -- cgit v1.2.1 From 20a4d095de449e4f72272e77da4e009033f2c1de Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 22 Jan 2017 16:56:14 +0100 Subject: [ticket/14968] Update docblock and ensure method returns array PHPBB3-14968 --- phpBB/phpbb/version_helper.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'phpBB/phpbb') 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; } /** -- cgit v1.2.1 From fbff3b77bdf483adbf88baababebbc1ddd2c3b83 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 22 Jan 2017 17:22:28 +0100 Subject: [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(-) (limited to 'phpBB/phpbb') 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); } } -- cgit v1.2.1 From d1df78604b36375ee563edd86af5a4025ee3f6e4 Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Mon, 23 Jan 2017 14:27:11 +0100 Subject: [ticket/13601] Add core.acl_clear_prefetch_after event PHPBB3-13601 --- phpBB/phpbb/auth/auth.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'phpBB/phpbb') 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; } -- cgit v1.2.1