mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 22:10:45 +02:00
Merge branch '3.1.x' into ticket/15011
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
2
phpBB/phpbb/cache/driver/file.php
vendored
2
phpBB/phpbb/cache/driver/file.php
vendored
@@ -601,6 +601,6 @@ class file extends \phpbb\cache\driver\base
|
||||
*/
|
||||
protected function clean_varname($varname)
|
||||
{
|
||||
return str_replace('/', '-', $varname);
|
||||
return str_replace(array('/', '\\'), '-', $varname);
|
||||
}
|
||||
}
|
||||
|
@@ -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
|
||||
|
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
* @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', ''),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@@ -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
|
||||
|
@@ -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,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.
|
||||
*
|
||||
@@ -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
|
||||
);
|
||||
}
|
||||
|
@@ -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();
|
||||
|
@@ -510,7 +510,7 @@ class php_exporter
|
||||
/**
|
||||
* Find the "@changed" Information lines
|
||||
*
|
||||
* @param string $tag_name Should be 'changed' or 'change'
|
||||
* @param string $tag_name Should be 'change', not 'changed'
|
||||
* @return array Absolute line numbers
|
||||
* @throws \LogicException
|
||||
*/
|
||||
@@ -658,7 +658,7 @@ class php_exporter
|
||||
{
|
||||
$match = array();
|
||||
$line = str_replace("\t", ' ', ltrim($line, "\t "));
|
||||
preg_match('#^\* @change(d)? (\d+\.\d+\.\d+(?:-(?:a|b|RC|pl)\d+)?)( (?:.*))?$#', $line, $match);
|
||||
preg_match('#^\* @changed (\d+\.\d+\.\d+(?:-(?:a|b|RC|pl)\d+)?)( (?:.*))?$#', $line, $match);
|
||||
if (!isset($match[2]))
|
||||
{
|
||||
throw new \LogicException("Invalid '@changed' information for event "
|
||||
|
@@ -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);
|
||||
@@ -63,15 +84,6 @@ abstract class attachments_base extends \phpbb\feed\base
|
||||
$this->db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function open()
|
||||
{
|
||||
parent::open();
|
||||
$this->fetch_attachments();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get attachments related to a given post
|
||||
*
|
||||
|
@@ -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',
|
||||
|
@@ -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,
|
||||
|
@@ -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, ' .
|
||||
|
@@ -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',
|
||||
|
@@ -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,
|
||||
|
@@ -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,
|
||||
|
@@ -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'))),
|
||||
|
@@ -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: 85},',
|
||||
(int) $this->config['img_max_width'],
|
||||
(int) $this->config['img_max_height']
|
||||
);
|
||||
|
@@ -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
|
||||
*
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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]))
|
||||
{
|
||||
|
@@ -200,6 +200,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
|
||||
*
|
||||
|
Reference in New Issue
Block a user