diff options
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r-- | phpBB/phpbb/cache/driver/base.php | 5 | ||||
-rw-r--r-- | phpBB/phpbb/cache/driver/file.php | 5 | ||||
-rw-r--r-- | phpBB/phpbb/composer.json | 7 | ||||
-rw-r--r-- | phpBB/phpbb/controller/helper.php | 9 | ||||
-rw-r--r-- | phpBB/phpbb/db/migration/data/v310/passwords_convert_p1.php | 13 | ||||
-rw-r--r-- | phpBB/phpbb/db/migration/data/v31x/increase_size_of_dateformat.php | 35 | ||||
-rw-r--r-- | phpBB/phpbb/db/migration/data/v31x/v317pl1.php | 31 | ||||
-rw-r--r-- | phpBB/phpbb/db/migration/data/v31x/v318.php | 31 | ||||
-rw-r--r-- | phpBB/phpbb/db/migration/data/v31x/v318rc1.php | 32 | ||||
-rw-r--r-- | phpBB/phpbb/db/tools.php | 5 | ||||
-rw-r--r-- | phpBB/phpbb/file_downloader.php | 2 | ||||
-rw-r--r-- | phpBB/phpbb/log/log.php | 4 | ||||
-rw-r--r-- | phpBB/phpbb/notification/manager.php | 8 | ||||
-rw-r--r-- | phpBB/phpbb/notification/method/messenger_base.php | 4 | ||||
-rw-r--r-- | phpBB/phpbb/recursive_dot_prefix_filter_iterator.php | 2 | ||||
-rw-r--r-- | phpBB/phpbb/session.php | 4 | ||||
-rw-r--r-- | phpBB/phpbb/version_helper.php | 13 |
17 files changed, 187 insertions, 23 deletions
diff --git a/phpBB/phpbb/cache/driver/base.php b/phpBB/phpbb/cache/driver/base.php index 4c20ad916d..53c50eeda3 100644 --- a/phpBB/phpbb/cache/driver/base.php +++ b/phpBB/phpbb/cache/driver/base.php @@ -61,6 +61,11 @@ abstract class base implements \phpbb\cache\driver\driver_interface unset($this->sql_rowset); unset($this->sql_row_pointer); + if (function_exists('opcache_reset')) + { + @opcache_reset(); + } + $this->vars = array(); $this->sql_rowset = array(); $this->sql_row_pointer = array(); diff --git a/phpBB/phpbb/cache/driver/file.php b/phpBB/phpbb/cache/driver/file.php index 9a7c4aec7f..fae4614039 100644 --- a/phpBB/phpbb/cache/driver/file.php +++ b/phpBB/phpbb/cache/driver/file.php @@ -568,6 +568,11 @@ class file extends \phpbb\cache\driver\base fclose($handle); + if (function_exists('opcache_invalidate')) + { + @opcache_invalidate($file); + } + if (!function_exists('phpbb_chmod')) { global $phpbb_root_path; diff --git a/phpBB/phpbb/composer.json b/phpBB/phpbb/composer.json index 513d7e4559..6b3888ef64 100644 --- a/phpBB/phpbb/composer.json +++ b/phpBB/phpbb/composer.json @@ -23,5 +23,10 @@ }, "require": { "php": ">=5.3.3" - } + }, + "extra": { + "branch-alias": { + "dev-master": "3.1.x-dev" + } + } } diff --git a/phpBB/phpbb/controller/helper.php b/phpBB/phpbb/controller/helper.php index 79378c2434..08a63639b9 100644 --- a/phpBB/phpbb/controller/helper.php +++ b/phpBB/phpbb/controller/helper.php @@ -102,12 +102,13 @@ class helper * @param bool $display_online_list Do we display online users list * @param int $item_id Restrict online users to item id * @param string $item Restrict online users to a certain session item, e.g. forum for session_forum_id + * @param bool $send_headers Whether headers should be sent by page_header(). Defaults to false for controllers. * * @return Response object containing rendered page */ - public function render($template_file, $page_title = '', $status_code = 200, $display_online_list = false, $item_id = 0, $item = 'forum') + public function render($template_file, $page_title = '', $status_code = 200, $display_online_list = false, $item_id = 0, $item = 'forum', $send_headers = false) { - page_header($page_title, $display_online_list, $item_id, $item); + page_header($page_title, $display_online_list, $item_id, $item, $send_headers); $this->template->set_filenames(array( 'body' => $template_file, @@ -115,7 +116,9 @@ class helper page_footer(true, false, false); - return new Response($this->template->assign_display('body'), $status_code); + $headers = !empty($this->user->data['is_bot']) ? array('X-PHPBB-IS-BOT' => 'yes') : array(); + + return new Response($this->template->assign_display('body'), $status_code, $headers); } /** diff --git a/phpBB/phpbb/db/migration/data/v310/passwords_convert_p1.php b/phpBB/phpbb/db/migration/data/v310/passwords_convert_p1.php index aad8e44681..295f2d2a14 100644 --- a/phpBB/phpbb/db/migration/data/v310/passwords_convert_p1.php +++ b/phpBB/phpbb/db/migration/data/v310/passwords_convert_p1.php @@ -56,19 +56,16 @@ class passwords_convert_p1 extends \phpbb\db\migration\migration { // Use $CP$ prefix for passwords that need to // be converted and set pass convert to false. - $update_users[$user_id] = array( - 'user_password' => '$CP$' . $row['user_password'], - 'user_pass_convert' => 0, - ); + $update_users[$user_id] = '$CP$' . $row['user_password']; } } $this->db->sql_freeresult($result); - foreach ($update_users as $user_id => $user_data) + foreach ($update_users as $user_id => $user_password) { - $sql = 'UPDATE ' . $this->table_prefix . 'users - SET ' . $this->db->sql_build_array('UPDATE', $user_data) . ' - WHERE user_id = ' . $user_id; + $sql = 'UPDATE ' . $this->table_prefix . "users + SET user_password = '" . $this->db->sql_escape($user_password) . "' + WHERE user_id = $user_id"; $this->sql_query($sql); } diff --git a/phpBB/phpbb/db/migration/data/v31x/increase_size_of_dateformat.php b/phpBB/phpbb/db/migration/data/v31x/increase_size_of_dateformat.php new file mode 100644 index 0000000000..bdf83f3d62 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/increase_size_of_dateformat.php @@ -0,0 +1,35 @@ +<?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_dateformat extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v31x\v317', + ); + } + + public function update_schema() + { + return array( + 'change_columns' => array( + $this->table_prefix . 'users' => array( + 'user_dateformat' => array('VCHAR_UNI:64', 'd M Y H:i'), + ), + ), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v31x/v317pl1.php b/phpBB/phpbb/db/migration/data/v31x/v317pl1.php new file mode 100644 index 0000000000..2e1b0e9b9d --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/v317pl1.php @@ -0,0 +1,31 @@ +<?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 v317pl1 extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v31x\v317', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.1.7-pl1')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v31x/v318.php b/phpBB/phpbb/db/migration/data/v31x/v318.php new file mode 100644 index 0000000000..b254279a5d --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/v318.php @@ -0,0 +1,31 @@ +<?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 v318 extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v31x\v318rc1', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.1.8')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v31x/v318rc1.php b/phpBB/phpbb/db/migration/data/v31x/v318rc1.php new file mode 100644 index 0000000000..8bae95c7d6 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/v318rc1.php @@ -0,0 +1,32 @@ +<?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 v318rc1 extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v31x\increase_size_of_dateformat', + '\phpbb\db\migration\data\v31x\v317pl1', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.1.8-RC1')), + ); + } +} diff --git a/phpBB/phpbb/db/tools.php b/phpBB/phpbb/db/tools.php index 775deccc30..e76e7b0e18 100644 --- a/phpBB/phpbb/db/tools.php +++ b/phpBB/phpbb/db/tools.php @@ -1533,6 +1533,11 @@ class tools } } + if (isset($column_data['after'])) + { + $return_array['after'] = $column_data['after']; + } + break; case 'oracle': diff --git a/phpBB/phpbb/file_downloader.php b/phpBB/phpbb/file_downloader.php index 462b87ca51..ab9505a14c 100644 --- a/phpBB/phpbb/file_downloader.php +++ b/phpBB/phpbb/file_downloader.php @@ -42,7 +42,7 @@ class file_downloader $this->error_number = 0; $this->error_string = ''; - if ($socket = @fsockopen($host, $port, $this->error_number, $this->error_string, $timeout)) + if ($socket = @fsockopen(($port == 443 ? 'tls://' : '') . $host, $port, $this->error_number, $this->error_string, $timeout)) { @fputs($socket, "GET $directory/$filename HTTP/1.0\r\n"); @fputs($socket, "HOST: $host\r\n"); diff --git a/phpBB/phpbb/log/log.php b/phpBB/phpbb/log/log.php index 3d995b4e4a..d46e3d1f3f 100644 --- a/phpBB/phpbb/log/log.php +++ b/phpBB/phpbb/log/log.php @@ -229,8 +229,8 @@ class log implements \phpbb\log\log_interface } $sql_ary = array( - 'user_id' => $user_id, - 'log_ip' => $log_ip, + 'user_id' => !empty($user_id) ? $user_id : ANONYMOUS, + 'log_ip' => !empty($log_ip) ? $log_ip : '', 'log_time' => $log_time, 'log_operation' => $log_operation, ); diff --git a/phpBB/phpbb/notification/manager.php b/phpBB/phpbb/notification/manager.php index db92170dd8..222d9fe9e6 100644 --- a/phpBB/phpbb/notification/manager.php +++ b/phpBB/phpbb/notification/manager.php @@ -186,6 +186,7 @@ class manager if (!$options['count_total'] || $total_count) { $rowset = array(); + $selected_unread_count = 0; // Get the main notifications $sql = 'SELECT n.*, nt.notification_type_name @@ -200,11 +201,12 @@ class manager while ($row = $this->db->sql_fetchrow($result)) { $rowset[$row['notification_id']] = $row; + $selected_unread_count += (int) !$row['notification_read']; } $this->db->sql_freeresult($result); // Get all unread notifications - if ($unread_count && $options['all_unread'] && !empty($rowset)) + if ($selected_unread_count < $unread_count && $options['all_unread'] && !empty($rowset)) { $sql = 'SELECT n.*, nt.notification_type_name FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . ' nt @@ -923,6 +925,8 @@ class manager { $notification_type_ids = $this->cache->get('notification_type_ids'); + $this->db->sql_transaction('begin'); + if ($notification_type_ids === false) { $notification_type_ids = array(); @@ -957,6 +961,8 @@ class manager $this->cache->put('notification_type_ids', $notification_type_ids); } + $this->db->sql_transaction('commit'); + return $notification_type_ids[$notification_type_name]; } diff --git a/phpBB/phpbb/notification/method/messenger_base.php b/phpBB/phpbb/notification/method/messenger_base.php index c3aee088f9..3c6d617c66 100644 --- a/phpBB/phpbb/notification/method/messenger_base.php +++ b/phpBB/phpbb/notification/method/messenger_base.php @@ -74,14 +74,14 @@ abstract class messenger_base extends \phpbb\notification\method\base continue; } - $messenger->template($template_dir_prefix . $notification->get_email_template(), $user['user_lang']); + $messenger->template($notification->get_email_template(), $user['user_lang'], '', $template_dir_prefix); $messenger->set_addresses($user); $messenger->assign_vars(array_merge(array( 'USERNAME' => $user['username'], - 'U_NOTIFICATION_SETTINGS' => generate_board_url() . '/ucp.' . $this->php_ext . '?i=ucp_notifications', + 'U_NOTIFICATION_SETTINGS' => generate_board_url() . '/ucp.' . $this->php_ext . '?i=ucp_notifications&mode=notification_options', ), $notification->get_email_template_variables())); $messenger->send($notify_method); diff --git a/phpBB/phpbb/recursive_dot_prefix_filter_iterator.php b/phpBB/phpbb/recursive_dot_prefix_filter_iterator.php index 2500ba0cf8..1446551b8b 100644 --- a/phpBB/phpbb/recursive_dot_prefix_filter_iterator.php +++ b/phpBB/phpbb/recursive_dot_prefix_filter_iterator.php @@ -25,6 +25,6 @@ class recursive_dot_prefix_filter_iterator extends \RecursiveFilterIterator public function accept() { $filename = $this->current()->getFilename(); - return !$this->current()->isDir() || $filename[0] !== '.'; + return $filename[0] !== '.' || !$this->current()->isDir(); } } diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php index 999d9e58ad..83e87b7704 100644 --- a/phpBB/phpbb/session.php +++ b/phpBB/phpbb/session.php @@ -1557,7 +1557,7 @@ class session public function update_session_infos() { - global $db, $request; + global $config, $db, $request; // No need to update if it's a new session. Informations are already inserted by session_create() if (isset($this->data['session_created']) && $this->data['session_created']) @@ -1583,6 +1583,8 @@ class session $db->sql_return_on_error(false); + $this->data = array_merge($this->data, $sql_ary); + if ($this->data['user_id'] != ANONYMOUS && !empty($config['new_member_post_limit']) && $this->data['user_new'] && $config['new_member_post_limit'] <= $this->data['user_posts']) { $this->leave_newly_registered(); diff --git a/phpBB/phpbb/version_helper.php b/phpBB/phpbb/version_helper.php index e4f68f5aab..a1e66ba8fe 100644 --- a/phpBB/phpbb/version_helper.php +++ b/phpBB/phpbb/version_helper.php @@ -34,6 +34,11 @@ class version_helper protected $file = 'versions.json'; /** + * @var bool Use SSL or not + */ + protected $use_ssl = false; + + /** * @var string Current version installed */ protected $current_version; @@ -85,13 +90,15 @@ class version_helper * @param string $host Host (e.g. version.phpbb.com) * @param string $path Path to file (e.g. /phpbb) * @param string $file File name (Default: versions.json) + * @param bool $use_ssl Use SSL or not (Default: false) * @return version_helper */ - public function set_file_location($host, $path, $file = 'versions.json') + public function set_file_location($host, $path, $file = 'versions.json', $use_ssl = false) { $this->host = $host; $this->path = $path; $this->file = $file; + $this->use_ssl = $use_ssl; return $this; } @@ -244,7 +251,7 @@ class version_helper */ public function get_versions($force_update = false, $force_cache = false) { - $cache_file = '_versioncheck_' . $this->host . $this->path . $this->file; + $cache_file = '_versioncheck_' . $this->host . $this->path . $this->file . $this->use_ssl; $info = $this->cache->get($cache_file); @@ -255,7 +262,7 @@ class version_helper else if ($info === false || $force_update) { try { - $info = $this->file_downloader->get($this->host, $this->path, $this->file); + $info = $this->file_downloader->get($this->host, $this->path, $this->file, $this->use_ssl ? 443 : 80); } catch (\phpbb\exception\runtime_exception $exception) { |