diff options
Diffstat (limited to 'phpBB/phpbb')
22 files changed, 158 insertions, 34 deletions
diff --git a/phpBB/phpbb/avatar/driver/local.php b/phpBB/phpbb/avatar/driver/local.php index 8b773017c5..4b84e4201c 100644 --- a/phpBB/phpbb/avatar/driver/local.php +++ b/phpBB/phpbb/avatar/driver/local.php @@ -158,7 +158,7 @@ class local extends \phpbb\avatar\driver\driver */ protected function get_avatar_list($user) { - $avatar_list = ($this->cache == null) ? false : $this->cache->get('_avatar_local_list'); + $avatar_list = ($this->cache == null) ? false : $this->cache->get('_avatar_local_list_' . $user->data['user_lang']); if ($avatar_list === false) { @@ -198,7 +198,7 @@ class local extends \phpbb\avatar\driver\driver if ($this->cache != null) { - $this->cache->put('_avatar_local_list', $avatar_list, 86400); + $this->cache->put('_avatar_local_list_' . $user->data['user_lang'], $avatar_list, 86400); } } diff --git a/phpBB/phpbb/cache/driver/apcu.php b/phpBB/phpbb/cache/driver/apcu.php index 40192e4026..c96cf0de57 100644 --- a/phpBB/phpbb/cache/driver/apcu.php +++ b/phpBB/phpbb/cache/driver/apcu.php @@ -25,7 +25,11 @@ class apcu extends \phpbb\cache\driver\memory */ function purge() { - apcu_clear_cache(); + /* + * Use an iterator to selectively delete our cache entries without disturbing + * any other cache users (e.g. other phpBB boards hosted on this server) + */ + apcu_delete(new \APCUIterator('#^' . $this->key_prefix . '#')); parent::purge(); } diff --git a/phpBB/phpbb/cache/driver/memory.php b/phpBB/phpbb/cache/driver/memory.php index 052f40c243..eba9549877 100644 --- a/phpBB/phpbb/cache/driver/memory.php +++ b/phpBB/phpbb/cache/driver/memory.php @@ -51,10 +51,11 @@ abstract class memory extends \phpbb\cache\driver\base function load() { // grab the global cache - $this->vars = $this->_read('global'); + $data = $this->_read('global'); - if ($this->vars !== false) + if ($data !== false) { + $this->vars = $data; return true; } diff --git a/phpBB/phpbb/db/driver/mssqlnative.php b/phpBB/phpbb/db/driver/mssqlnative.php index de81a6a0c8..a4dcac5966 100644 --- a/phpBB/phpbb/db/driver/mssqlnative.php +++ b/phpBB/phpbb/db/driver/mssqlnative.php @@ -268,7 +268,7 @@ class mssqlnative extends \phpbb\db\driver\mssql_base unset($row['line2'], $row['line3']); } } - return (count($row)) ? $row : false; + return ($row !== null) ? $row : false; } /** diff --git a/phpBB/phpbb/db/migration/data/v310/auth_provider_oauth.php b/phpBB/phpbb/db/migration/data/v310/auth_provider_oauth.php index 508a31fba9..1e2024a071 100644 --- a/phpBB/phpbb/db/migration/data/v310/auth_provider_oauth.php +++ b/phpBB/phpbb/db/migration/data/v310/auth_provider_oauth.php @@ -17,7 +17,12 @@ class auth_provider_oauth extends \phpbb\db\migration\migration { public function effectively_installed() { - return $this->db_tools->sql_table_exists($this->table_prefix . 'auth_provider_oauth'); + return $this->db_tools->sql_table_exists($this->table_prefix . 'oauth_tokens'); + } + + static public function depends_on() + { + return array('\phpbb\db\migration\data\v30x\release_3_0_0'); } public function update_schema() diff --git a/phpBB/phpbb/db/migration/data/v320/add_help_phpbb.php b/phpBB/phpbb/db/migration/data/v320/add_help_phpbb.php index a52067f484..804adc4490 100644 --- a/phpBB/phpbb/db/migration/data/v320/add_help_phpbb.php +++ b/phpBB/phpbb/db/migration/data/v320/add_help_phpbb.php @@ -32,10 +32,7 @@ class add_help_phpbb extends \phpbb\db\migration\migration return array( array('config.add', array('help_send_statistics', true)), array('config.add', array('help_send_statistics_time', 0)), - array('if', array( - array('module.exists', array('acp', false, 'ACP_SEND_STATISTICS')), - array('module.remove', array('acp', false, 'ACP_SEND_STATISTICS')), - )), + array('module.remove', array('acp', false, 'ACP_SEND_STATISTICS')), array('module.add', array( 'acp', 'ACP_SERVER_CONFIGURATION', diff --git a/phpBB/phpbb/db/migration/data/v320/remove_outdated_media.php b/phpBB/phpbb/db/migration/data/v320/remove_outdated_media.php index 98b1c2d039..88fe59ccc9 100644 --- a/phpBB/phpbb/db/migration/data/v320/remove_outdated_media.php +++ b/phpBB/phpbb/db/migration/data/v320/remove_outdated_media.php @@ -85,13 +85,11 @@ class remove_outdated_media extends \phpbb\db\migration\migration WHERE ' . $this->db->sql_in_set('group_id', $group_ids); } - $result = $this->db->sql_query($sql); - $this->db->sql_freeresult($result); + $this->db->sql_query($sql); // delete the now empty, outdated media extension groups $sql = 'DELETE FROM ' . EXTENSION_GROUPS_TABLE . ' WHERE ' . $this->db->sql_in_set('group_id', $group_ids); - $result = $this->db->sql_query($sql); - $this->db->sql_freeresult($result); + $this->db->sql_query($sql); } } diff --git a/phpBB/phpbb/db/migration/data/v32x/v323.php b/phpBB/phpbb/db/migration/data/v32x/v323.php new file mode 100644 index 0000000000..1ec28ceb37 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v32x/v323.php @@ -0,0 +1,37 @@ +<?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\v32x; + +class v323 extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.2.3', '>='); + } + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v32x\v323rc2', + ); + + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.2.3')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v32x/v323rc2.php b/phpBB/phpbb/db/migration/data/v32x/v323rc2.php new file mode 100644 index 0000000000..32235ee067 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v32x/v323rc2.php @@ -0,0 +1,36 @@ +<?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\v32x; + +class v323rc2 extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.2.3-RC2', '>='); + } + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v32x\v323rc1', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.2.3-RC2')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/tool/module.php b/phpBB/phpbb/db/migration/tool/module.php index 3893935723..e5133c8152 100644 --- a/phpBB/phpbb/db/migration/tool/module.php +++ b/phpBB/phpbb/db/migration/tool/module.php @@ -341,7 +341,7 @@ class module implements \phpbb\db\migration\tool\tool_interface } // Clear the Modules Cache - $this->cache->destroy("_modules_$class"); + $this->module_manager->remove_cache_file($class); } /** @@ -425,7 +425,7 @@ class module implements \phpbb\db\migration\tool\tool_interface $this->module_manager->delete_module($module_id, $class); } - $this->cache->destroy("_modules_$class"); + $this->module_manager->remove_cache_file($class); } } diff --git a/phpBB/phpbb/db/migrator.php b/phpBB/phpbb/db/migrator.php index a425df56e8..2b0c66fc58 100644 --- a/phpBB/phpbb/db/migrator.php +++ b/phpBB/phpbb/db/migrator.php @@ -760,7 +760,7 @@ class migrator $condition = $parameters[0]; - if (!$condition) + if (!$condition || (is_array($condition) && !$this->run_step($condition, $last_result, $reverse))) { return false; } diff --git a/phpBB/phpbb/di/container_builder.php b/phpBB/phpbb/di/container_builder.php index ac1a1a1733..8c1ce8bde2 100644 --- a/phpBB/phpbb/di/container_builder.php +++ b/phpBB/phpbb/di/container_builder.php @@ -143,6 +143,13 @@ class container_builder { if ($this->use_extensions) { + $autoload_cache = new ConfigCache($this->get_autoload_filename(), defined('DEBUG')); + if (!$autoload_cache->isFresh()) + { + // autoload cache should be refreshed + $this->load_extensions(); + } + require($this->get_autoload_filename()); } diff --git a/phpBB/phpbb/event/php_exporter.php b/phpBB/phpbb/event/php_exporter.php index 64d1e429b7..71c94a681d 100644 --- a/phpBB/phpbb/event/php_exporter.php +++ b/phpBB/phpbb/event/php_exporter.php @@ -264,7 +264,30 @@ class php_exporter // Find event description line $description_line_num = $this->find_description(); - $description = substr(trim($this->file_lines[$description_line_num]), strlen('* ')); + $description_lines = array(); + + while (true) + { + $description_line = substr(trim($this->file_lines[$description_line_num]), strlen('*')); + $description_line = trim(str_replace("\t", " ", $description_line)); + + // Reached end of description if line is a tag + if (strlen($description_line) && $description_line[0] == '@') + { + break; + } + + $description_lines[] = $description_line; + $description_line_num++; + } + + // If there is an empty line between description and first tag, remove it + if (!strlen(end($description_lines))) + { + array_pop($description_lines); + } + + $description = trim(implode('<br/>', $description_lines)); if (isset($this->events[$this->current_event])) { diff --git a/phpBB/phpbb/filesystem/filesystem.php b/phpBB/phpbb/filesystem/filesystem.php index 3f39448f05..bfafdf5ddd 100644 --- a/phpBB/phpbb/filesystem/filesystem.php +++ b/phpBB/phpbb/filesystem/filesystem.php @@ -367,7 +367,7 @@ class filesystem implements filesystem_interface $common_php_group = @filegroup(__FILE__); // And the owner and the groups PHP is running under. - $php_uid = (function_exists('posic_getuid')) ? @posix_getuid() : false; + $php_uid = (function_exists('posix_getuid')) ? @posix_getuid() : false; $php_gids = (function_exists('posix_getgroups')) ? @posix_getgroups() : false; // If we are unable to get owner/group, then do not try to set them by guessing diff --git a/phpBB/phpbb/install/module/requirements/task/check_update.php b/phpBB/phpbb/install/module/requirements/task/check_update.php index cd66ffc8f9..4eb2c6d75e 100644 --- a/phpBB/phpbb/install/module/requirements/task/check_update.php +++ b/phpBB/phpbb/install/module/requirements/task/check_update.php @@ -122,8 +122,11 @@ class check_update extends task_base // Check for a valid update directory if (!$this->filesystem->exists($update_files) || !$this->filesystem->is_readable($update_files)) { - $this->iohandler->add_warning_message('UPDATE_FILES_NOT_FOUND'); - $this->set_test_passed(false); + if ($this->iohandler->get_input('update_type', 'all') === 'all') + { + $this->iohandler->add_warning_message('UPDATE_FILES_NOT_FOUND'); + $this->set_test_passed(false); + } // If there are no update files, we can't check the version etc // However, we can let the users run migrations if they really want to... diff --git a/phpBB/phpbb/notification/method/messenger_base.php b/phpBB/phpbb/notification/method/messenger_base.php index 32e79aa936..f82017b70e 100644 --- a/phpBB/phpbb/notification/method/messenger_base.php +++ b/phpBB/phpbb/notification/method/messenger_base.php @@ -87,7 +87,7 @@ abstract class messenger_base extends \phpbb\notification\method\base $banned_users = phpbb_get_banned_user_ids($user_ids); // Load all the users we need - $this->user_loader->load_users($user_ids); + $this->user_loader->load_users(array_diff($user_ids, $banned_users), array(USER_IGNORE)); // Load the messenger if (!class_exists('messenger')) @@ -107,7 +107,7 @@ abstract class messenger_base extends \phpbb\notification\method\base $user = $this->user_loader->get_user($notification->user_id); - if ($user['user_type'] == USER_IGNORE || ($user['user_type'] == USER_INACTIVE && $user['user_inactive_reason'] == INACTIVE_MANUAL) || in_array($notification->user_id, $banned_users)) + if ($user['user_type'] == USER_INACTIVE && $user['user_inactive_reason'] == INACTIVE_MANUAL) { continue; } diff --git a/phpBB/phpbb/search/fulltext_sphinx.php b/phpBB/phpbb/search/fulltext_sphinx.php index e2eeb5f7f3..d780442f89 100644 --- a/phpBB/phpbb/search/fulltext_sphinx.php +++ b/phpBB/phpbb/search/fulltext_sphinx.php @@ -292,7 +292,6 @@ class fulltext_sphinx AND p.post_id >= $start AND p.post_id <= $end'), array('sql_query_post', ''), array('sql_query_post_index', 'UPDATE ' . SPHINX_TABLE . ' SET max_doc_id = $maxid WHERE counter_id = 1'), - array('sql_query_info', 'SELECT * FROM ' . POSTS_TABLE . ' WHERE post_id = $id'), array('sql_attr_uint', 'forum_id'), array('sql_attr_uint', 'topic_id'), array('sql_attr_uint', 'poster_id'), @@ -333,7 +332,6 @@ class fulltext_sphinx array('morphology', 'none'), array('stopwords', ''), array('min_word_len', '2'), - array('charset_type', 'utf-8'), array('charset_table', 'U+FF10..U+FF19->0..9, 0..9, U+FF41..U+FF5A->a..z, U+FF21..U+FF3A->a..z, A..Z->a..z, a..z, U+0149, U+017F, U+0138, U+00DF, U+00FF, U+00C0..U+00D6->U+00E0..U+00F6, U+00E0..U+00F6, U+00D8..U+00DE->U+00F8..U+00FE, U+00F8..U+00FE, U+0100->U+0101, U+0101, U+0102->U+0103, U+0103, U+0104->U+0105, U+0105, U+0106->U+0107, U+0107, U+0108->U+0109, U+0109, U+010A->U+010B, U+010B, U+010C->U+010D, U+010D, U+010E->U+010F, U+010F, U+0110->U+0111, U+0111, U+0112->U+0113, U+0113, U+0114->U+0115, U+0115, U+0116->U+0117, U+0117, U+0118->U+0119, U+0119, U+011A->U+011B, U+011B, U+011C->U+011D, U+011D, U+011E->U+011F, U+011F, U+0130->U+0131, U+0131, U+0132->U+0133, U+0133, U+0134->U+0135, U+0135, U+0136->U+0137, U+0137, U+0139->U+013A, U+013A, U+013B->U+013C, U+013C, U+013D->U+013E, U+013E, U+013F->U+0140, U+0140, U+0141->U+0142, U+0142, U+0143->U+0144, U+0144, U+0145->U+0146, U+0146, U+0147->U+0148, U+0148, U+014A->U+014B, U+014B, U+014C->U+014D, U+014D, U+014E->U+014F, U+014F, U+0150->U+0151, U+0151, U+0152->U+0153, U+0153, U+0154->U+0155, U+0155, U+0156->U+0157, U+0157, U+0158->U+0159, U+0159, U+015A->U+015B, U+015B, U+015C->U+015D, U+015D, U+015E->U+015F, U+015F, U+0160->U+0161, U+0161, U+0162->U+0163, U+0163, U+0164->U+0165, U+0165, U+0166->U+0167, U+0167, U+0168->U+0169, U+0169, U+016A->U+016B, U+016B, U+016C->U+016D, U+016D, U+016E->U+016F, U+016F, U+0170->U+0171, U+0171, U+0172->U+0173, U+0173, U+0174->U+0175, U+0175, U+0176->U+0177, U+0177, U+0178->U+00FF, U+00FF, U+0179->U+017A, U+017A, U+017B->U+017C, U+017C, U+017D->U+017E, U+017E, U+0410..U+042F->U+0430..U+044F, U+0430..U+044F, U+4E00..U+9FFF'), array('min_prefix_len', '0'), array('min_infix_len', '0'), @@ -346,14 +344,12 @@ class fulltext_sphinx array('mem_limit', $this->config['fulltext_sphinx_indexer_mem_limit'] . 'M'), ), 'searchd' => array( - array('compat_sphinxql_magics' , '0'), array('listen' , ($this->config['fulltext_sphinx_host'] ? $this->config['fulltext_sphinx_host'] : 'localhost') . ':' . ($this->config['fulltext_sphinx_port'] ? $this->config['fulltext_sphinx_port'] : '9312')), array('log', $this->config['fulltext_sphinx_data_path'] . 'log/searchd.log'), array('query_log', $this->config['fulltext_sphinx_data_path'] . 'log/sphinx-query.log'), array('read_timeout', '5'), array('max_children', '30'), array('pid_file', $this->config['fulltext_sphinx_data_path'] . 'searchd.pid'), - array('max_matches', (string) SPHINX_MAX_MATCHES), array('binlog_path', $this->config['fulltext_sphinx_data_path']), ), ); diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php index de9345ca85..80934dc411 100644 --- a/phpBB/phpbb/session.php +++ b/phpBB/phpbb/session.php @@ -1614,13 +1614,15 @@ class session return; } + // Do not update the session page for ajax requests, so the view online still works as intended + $page_changed = $this->update_session_page && $this->data['session_page'] != $this->page['page'] && !$request->is_ajax(); + // Only update session DB a minute or so after last update or if page changes - if ($this->time_now - ((isset($this->data['session_time'])) ? $this->data['session_time'] : 0) > 60 || ($this->update_session_page && $this->data['session_page'] != $this->page['page'])) + if ($this->time_now - (isset($this->data['session_time']) ? $this->data['session_time'] : 0) > 60 || $page_changed) { $sql_ary = array('session_time' => $this->time_now); - // Do not update the session page for ajax requests, so the view online still works as intended - if ($this->update_session_page && !$request->is_ajax()) + if ($page_changed) { $sql_ary['session_page'] = substr($this->page['page'], 0, 199); $sql_ary['session_forum_id'] = $this->page['forum']; diff --git a/phpBB/phpbb/template/context.php b/phpBB/phpbb/template/context.php index de583d3224..2ba6d185ad 100644 --- a/phpBB/phpbb/template/context.php +++ b/phpBB/phpbb/template/context.php @@ -274,6 +274,11 @@ class context { $name = substr($blocks[$i], 0, $pos); + if (empty($block[$name])) + { + return array(); + } + if (strpos($blocks[$i], '[]') === $pos) { $index = count($block[$name]) - 1; @@ -286,6 +291,11 @@ class context else { $name = $blocks[$i]; + if (empty($block[$name])) + { + return array(); + } + $index = count($block[$name]) - 1; } $block = $block[$name]; diff --git a/phpBB/phpbb/template/twig/extension.php b/phpBB/phpbb/template/twig/extension.php index 1aa7717470..f6f8e03ca2 100644 --- a/phpBB/phpbb/template/twig/extension.php +++ b/phpBB/phpbb/template/twig/extension.php @@ -172,7 +172,7 @@ class extension extends \Twig_Extension $context_vars = $this->context->get_root_ref(); - if (isset($context_vars['L_' . $key])) + if (is_string($key) && isset($context_vars['L_' . $key])) { return $context_vars['L_' . $key]; } diff --git a/phpBB/phpbb/user.php b/phpBB/phpbb/user.php index 5899dff2f5..ca0e5872e4 100644 --- a/phpBB/phpbb/user.php +++ b/phpBB/phpbb/user.php @@ -189,6 +189,9 @@ class user extends \phpbb\session /** * Event to load language files and modify user data on every page * + * Note: To load language file with this event, see description + * of lang_set_ext variable. + * * @event core.user_setup * @var array user_data Array with user's data row * @var string user_lang_name Basename of the user's langauge diff --git a/phpBB/phpbb/user_loader.php b/phpBB/phpbb/user_loader.php index 294f5208d5..9297450f3e 100644 --- a/phpBB/phpbb/user_loader.php +++ b/phpBB/phpbb/user_loader.php @@ -64,8 +64,9 @@ class user_loader * Load user helper * * @param array $user_ids + * @param array $ignore_types user types to ignore */ - public function load_users(array $user_ids) + public function load_users(array $user_ids, array $ignore_types = array()) { $user_ids[] = ANONYMOUS; @@ -79,7 +80,8 @@ class user_loader { $sql = 'SELECT * FROM ' . $this->users_table . ' - WHERE ' . $this->db->sql_in_set('user_id', $user_ids); + WHERE ' . $this->db->sql_in_set('user_id', $user_ids) . ' + AND ' . $this->db->sql_in_set('user_type', $ignore_types, true, true); $result = $this->db->sql_query($sql); while ($row = $this->db->sql_fetchrow($result)) |