aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r--phpBB/phpbb/db/migration/data/v310/notification_options_reconvert.php1
-rw-r--r--phpBB/phpbb/db/migration/profilefield_base_migration.php1
-rw-r--r--phpBB/phpbb/di/container_builder.php14
-rw-r--r--phpBB/phpbb/di/extension/config.php6
-rw-r--r--phpBB/phpbb/extension/metadata_manager.php15
-rw-r--r--phpBB/phpbb/feed/attachments_base.php34
-rw-r--r--phpBB/phpbb/feed/forum.php2
-rw-r--r--phpBB/phpbb/feed/news.php2
-rw-r--r--phpBB/phpbb/feed/overall.php2
-rw-r--r--phpBB/phpbb/feed/topic.php2
-rw-r--r--phpBB/phpbb/feed/topics.php2
-rw-r--r--phpBB/phpbb/feed/topics_active.php2
-rw-r--r--phpBB/phpbb/search/fulltext_mysql.php25
-rw-r--r--phpBB/phpbb/template/context.php8
-rw-r--r--phpBB/phpbb/template/twig/extension.php3
-rw-r--r--phpBB/phpbb/version_helper.php43
16 files changed, 129 insertions, 33 deletions
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
diff --git a/phpBB/phpbb/di/container_builder.php b/phpBB/phpbb/di/container_builder.php
index a214356ac3..5f3aa685bf 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)
{
@@ -304,6 +305,18 @@ class container_builder
}
/**
+ * Inject the dbal connection driver into container
+ */
+ protected function inject_dbal_driver()
+ {
+ $config_data = $this->config_php_file->get_all();
+ if (!empty($config_data))
+ {
+ $this->container->set('dbal.conn.driver', $this->get_dbal_connection());
+ }
+ }
+
+ /**
* Get DB connection.
*
* @return \phpbb\db\driver\driver_interface
@@ -320,6 +333,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/phpBB/phpbb/extension/metadata_manager.php b/phpBB/phpbb/extension/metadata_manager.php
index 34e2910a33..107907609b 100644
--- a/phpBB/phpbb/extension/metadata_manager.php
+++ b/phpBB/phpbb/extension/metadata_manager.php
@@ -230,7 +230,20 @@ class metadata_manager
case 'all':
$this->validate('display');
- $this->validate_enable();
+ if (!$this->validate_dir())
+ {
+ 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;
case 'display':
diff --git a/phpBB/phpbb/feed/attachments_base.php b/phpBB/phpbb/feed/attachments_base.php
index 04812f1570..df8f29a626 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);
@@ -64,15 +85,6 @@ abstract class attachments_base extends \phpbb\feed\base
}
/**
- * {@inheritDoc}
- */
- public function open()
- {
- parent::open();
- $this->fetch_attachments();
- }
-
- /**
* Get attachments related to a given post
*
* @param $post_id int Post id
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,
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);
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;
}
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]))
{
diff --git a/phpBB/phpbb/version_helper.php b/phpBB/phpbb/version_helper.php
index a1e66ba8fe..135d390584 100644
--- a/phpBB/phpbb/version_helper.php
+++ b/phpBB/phpbb/version_helper.php
@@ -201,6 +201,49 @@ class version_helper
}
/**
+ * 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 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)
+ {
+ $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.
+ $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();
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ return $value;
+ });
+
+ return $update_info === null ? array() : $update_info;
+ }
+
+ /**
* Obtains the latest version information
*
* @param bool $force_update Ignores cached data. Defaults to false.