diff options
Diffstat (limited to 'phpBB/phpbb')
56 files changed, 440 insertions, 61 deletions
diff --git a/phpBB/phpbb/auth/provider/oauth/oauth.php b/phpBB/phpbb/auth/provider/oauth/oauth.php index be0fbf5831..9f6345fbba 100644 --- a/phpBB/phpbb/auth/provider/oauth/oauth.php +++ b/phpBB/phpbb/auth/provider/oauth/oauth.php @@ -271,7 +271,13 @@ class oauth extends \phpbb\auth\provider\base } $uri_factory = new \OAuth\Common\Http\Uri\UriFactory(); - $current_uri = $uri_factory->createFromSuperGlobalArray($this->request->get_super_global(\phpbb\request\request_interface::SERVER)); + $super_globals = $this->request->get_super_global(\phpbb\request\request_interface::SERVER); + if (!empty($super_globals['HTTP_X_FORWARDED_PROTO']) && $super_globals['HTTP_X_FORWARDED_PROTO'] === 'https') + { + $super_globals['HTTPS'] = 'on'; + $super_globals['SERVER_PORT'] = 443; + } + $current_uri = $uri_factory->createFromSuperGlobalArray($super_globals); $current_uri->setQuery($query); $this->current_uri = $current_uri; diff --git a/phpBB/phpbb/avatar/driver/upload.php b/phpBB/phpbb/avatar/driver/upload.php index e44157294c..cb8dfcad4f 100644 --- a/phpBB/phpbb/avatar/driver/upload.php +++ b/phpBB/phpbb/avatar/driver/upload.php @@ -167,17 +167,29 @@ class upload extends \phpbb\avatar\driver\driver $destination = ''; } + $filedata = array( + 'filename' => $file->get('filename'), + 'filesize' => $file->get('filesize'), + 'mimetype' => $file->get('mimetype'), + 'extension' => $file->get('extension'), + 'physical_filename' => $file->get('realname'), + 'real_filename' => $file->get('uploadname'), + ); + /** * Before moving new file in place (and eventually overwriting the existing avatar with the newly uploaded avatar) * * @event core.avatar_driver_upload_move_file_before + * @var array filedata Array containing uploaded file data * @var string destination Destination directory where the file is going to be moved * @var string prefix Prefix for the avatar filename * @var array row Array with avatar row data * @var array error Array of errors, if filled in by this event file will not be moved * @since 3.1.6-RC1 + * @changed 3.1.9-RC1 Added filedata */ $vars = array( + 'filedata', 'destination', 'prefix', 'row', @@ -185,6 +197,8 @@ class upload extends \phpbb\avatar\driver\driver ); extract($this->dispatcher->trigger_event('core.avatar_driver_upload_move_file_before', compact($vars))); + unset($filedata); + if (!sizeof($error)) { // Move file and overwrite any existing image 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/captcha/plugins/qa.php b/phpBB/phpbb/captcha/plugins/qa.php index 2771369e57..a9d133d8f2 100644 --- a/phpBB/phpbb/captcha/plugins/qa.php +++ b/phpBB/phpbb/captcha/plugins/qa.php @@ -100,6 +100,28 @@ class qa $db->sql_freeresult($result); } + // final fallback to any language + if (!sizeof($this->question_ids)) + { + $this->question_lang = ''; + + $sql = 'SELECT q.question_id, q.lang_iso + FROM ' . $this->table_captcha_questions . ' q, ' . $this->table_captcha_answers . ' a + WHERE q.question_id = a.question_id + GROUP BY lang_iso'; + $result = $db->sql_query($sql, 7200); + + while ($row = $db->sql_fetchrow($result)) + { + if (empty($this->question_lang)) + { + $this->question_lang = $row['lang_iso']; + } + $this->question_ids[$row['question_id']] = $row['question_id']; + } + $db->sql_freeresult($result); + } + // okay, if there is a confirm_id, we try to load that confirm's state. If not, we try to find one if (!$this->load_answer() && (!$this->load_confirm_id() || !$this->load_answer())) { @@ -198,19 +220,25 @@ class qa */ function get_template() { - global $template; + global $phpbb_log, $template, $user; if ($this->is_solved()) { return false; } + else if (empty($this->question_text) || !count($this->question_ids)) + { + /** @var \phpbb\log\log_interface $phpbb_log */ + $phpbb_log->add('critical', $user->data['user_id'], $user->ip, 'LOG_ERROR_CAPTCHA', time(), array($user->lang('CONFIRM_QUESTION_MISSING'))); + return false; + } else { $template->assign_vars(array( - 'QA_CONFIRM_QUESTION' => $this->question_text, - 'QA_CONFIRM_ID' => $this->confirm_id, - 'S_CONFIRM_CODE' => true, - 'S_TYPE' => $this->type, + 'QA_CONFIRM_QUESTION' => $this->question_text, + 'QA_CONFIRM_ID' => $this->confirm_id, + 'S_CONFIRM_CODE' => true, + 'S_TYPE' => $this->type, )); return 'captcha_qa.html'; @@ -364,13 +392,15 @@ class qa */ function validate() { - global $user; + global $phpbb_log, $user; $error = ''; if (!sizeof($this->question_ids)) { - return false; + /** @var \phpbb\log\log_interface $phpbb_log */ + $phpbb_log->add('critical', $user->data['user_id'], $user->ip, 'LOG_ERROR_CAPTCHA', time(), array($user->lang('CONFIRM_QUESTION_MISSING'))); + return $user->lang('CONFIRM_QUESTION_MISSING'); } if (!$this->confirm_id) diff --git a/phpBB/phpbb/controller/helper.php b/phpBB/phpbb/controller/helper.php index 79378c2434..ce6bfba981 100644 --- a/phpBB/phpbb/controller/helper.php +++ b/phpBB/phpbb/controller/helper.php @@ -71,7 +71,8 @@ class helper * @param \phpbb\template\template $template Template object * @param \phpbb\user $user User object * @param \phpbb\config\config $config Config object - * @param \phpbb\controller\provider $provider Path provider + * + * @param \phpbb\controller\provider $provider Path provider * @param \phpbb\extension\manager $manager Extension manager object * @param \phpbb\symfony_request $symfony_request Symfony Request object * @param \phpbb\request\request_interface $request phpBB request object @@ -102,12 +103,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 +117,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); } /** @@ -140,6 +144,15 @@ class helper $context = new RequestContext(); $context->fromRequest($this->symfony_request); + if ($this->config['force_server_vars']) + { + $context->setHost($this->config['server_name']); + $context->setScheme(substr($this->config['server_protocol'], 0, -3)); + $context->setHttpPort($this->config['server_port']); + $context->setHttpsPort($this->config['server_port']); + $context->setBaseUrl(rtrim($this->config['script_path'], '/')); + } + $script_name = $this->symfony_request->getScriptName(); $page_name = substr($script_name, -1, 1) == '/' ? '' : utf8_basename($script_name); @@ -155,7 +168,7 @@ class helper $base_url = str_replace('/' . $page_name, empty($this->config['enable_mod_rewrite']) ? '/app.' . $this->php_ext : '', $base_url); // We need to update the base url to move to the directory of the app.php file if the current script is not app.php - if ($page_name !== 'app.php') + if ($page_name !== 'app.php' && !$this->config['force_server_vars']) { if (empty($this->config['enable_mod_rewrite'])) { diff --git a/phpBB/phpbb/db/driver/driver.php b/phpBB/phpbb/db/driver/driver.php index 1b49775b32..01dd66cd6e 100644 --- a/phpBB/phpbb/db/driver/driver.php +++ b/phpBB/phpbb/db/driver/driver.php @@ -897,6 +897,7 @@ abstract class driver implements driver_interface <html dir="ltr"> <head> <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>SQL Report</title> <link href="' . htmlspecialchars($phpbb_path_helper->update_web_root_path($phpbb_root_path) . $phpbb_path_helper->get_adm_relative_path()) . 'style/admin.css" rel="stylesheet" type="text/css" media="screen" /> </head> diff --git a/phpBB/phpbb/db/migration/data/v310/alpha1.php b/phpBB/phpbb/db/migration/data/v310/alpha1.php index 1df85bc64c..4a48d2830a 100644 --- a/phpBB/phpbb/db/migration/data/v310/alpha1.php +++ b/phpBB/phpbb/db/migration/data/v310/alpha1.php @@ -15,6 +15,11 @@ namespace phpbb\db\migration\data\v310; class alpha1 extends \phpbb\db\migration\migration { + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.1.0-a1', '>='); + } + static public function depends_on() { return array( diff --git a/phpBB/phpbb/db/migration/data/v310/alpha2.php b/phpBB/phpbb/db/migration/data/v310/alpha2.php index 78bc755ec9..bfbcc4f6f5 100644 --- a/phpBB/phpbb/db/migration/data/v310/alpha2.php +++ b/phpBB/phpbb/db/migration/data/v310/alpha2.php @@ -15,6 +15,11 @@ namespace phpbb\db\migration\data\v310; class alpha2 extends \phpbb\db\migration\migration { + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.1.0-a2', '>='); + } + static public function depends_on() { return array( diff --git a/phpBB/phpbb/db/migration/data/v310/alpha3.php b/phpBB/phpbb/db/migration/data/v310/alpha3.php index 574d19d2f4..bb0f904fd4 100644 --- a/phpBB/phpbb/db/migration/data/v310/alpha3.php +++ b/phpBB/phpbb/db/migration/data/v310/alpha3.php @@ -15,6 +15,11 @@ namespace phpbb\db\migration\data\v310; class alpha3 extends \phpbb\db\migration\migration { + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.1.0-a3', '>='); + } + static public function depends_on() { return array( diff --git a/phpBB/phpbb/db/migration/data/v310/beta1.php b/phpBB/phpbb/db/migration/data/v310/beta1.php index 84887bd58e..9feba5235d 100644 --- a/phpBB/phpbb/db/migration/data/v310/beta1.php +++ b/phpBB/phpbb/db/migration/data/v310/beta1.php @@ -15,6 +15,11 @@ namespace phpbb\db\migration\data\v310; class beta1 extends \phpbb\db\migration\migration { + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.1.0-b1', '>='); + } + static public function depends_on() { return array( diff --git a/phpBB/phpbb/db/migration/data/v310/beta2.php b/phpBB/phpbb/db/migration/data/v310/beta2.php index 458e305c7b..d5e31ce4cb 100644 --- a/phpBB/phpbb/db/migration/data/v310/beta2.php +++ b/phpBB/phpbb/db/migration/data/v310/beta2.php @@ -15,6 +15,11 @@ namespace phpbb\db\migration\data\v310; class beta2 extends \phpbb\db\migration\migration { + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.1.0-b2', '>='); + } + static public function depends_on() { return array( diff --git a/phpBB/phpbb/db/migration/data/v310/beta3.php b/phpBB/phpbb/db/migration/data/v310/beta3.php index a6c62bf936..78c61e8e90 100644 --- a/phpBB/phpbb/db/migration/data/v310/beta3.php +++ b/phpBB/phpbb/db/migration/data/v310/beta3.php @@ -15,6 +15,11 @@ namespace phpbb\db\migration\data\v310; class beta3 extends \phpbb\db\migration\migration { + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.1.0-b3', '>='); + } + static public function depends_on() { return array( diff --git a/phpBB/phpbb/db/migration/data/v310/beta4.php b/phpBB/phpbb/db/migration/data/v310/beta4.php index 3e91d95178..e634785c38 100644 --- a/phpBB/phpbb/db/migration/data/v310/beta4.php +++ b/phpBB/phpbb/db/migration/data/v310/beta4.php @@ -15,6 +15,11 @@ namespace phpbb\db\migration\data\v310; class beta4 extends \phpbb\db\migration\migration { + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.1.0-b4', '>='); + } + static public function depends_on() { return array( diff --git a/phpBB/phpbb/db/migration/data/v310/gold.php b/phpBB/phpbb/db/migration/data/v310/gold.php index e84c7ee951..188851f87d 100644 --- a/phpBB/phpbb/db/migration/data/v310/gold.php +++ b/phpBB/phpbb/db/migration/data/v310/gold.php @@ -15,6 +15,11 @@ namespace phpbb\db\migration\data\v310; class gold extends \phpbb\db\migration\migration { + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.1.0', '>='); + } + static public function depends_on() { return array( 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/v310/rc1.php b/phpBB/phpbb/db/migration/data/v310/rc1.php index 10ba7fefff..751208c6ca 100644 --- a/phpBB/phpbb/db/migration/data/v310/rc1.php +++ b/phpBB/phpbb/db/migration/data/v310/rc1.php @@ -15,6 +15,11 @@ namespace phpbb\db\migration\data\v310; class rc1 extends \phpbb\db\migration\migration { + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.1.0-RC1', '>='); + } + static public function depends_on() { return array( diff --git a/phpBB/phpbb/db/migration/data/v310/rc2.php b/phpBB/phpbb/db/migration/data/v310/rc2.php index e1323659da..5cd0393a13 100644 --- a/phpBB/phpbb/db/migration/data/v310/rc2.php +++ b/phpBB/phpbb/db/migration/data/v310/rc2.php @@ -15,6 +15,11 @@ namespace phpbb\db\migration\data\v310; class rc2 extends \phpbb\db\migration\migration { + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.1.0-RC2', '>='); + } + static public function depends_on() { return array( diff --git a/phpBB/phpbb/db/migration/data/v310/rc3.php b/phpBB/phpbb/db/migration/data/v310/rc3.php index 0e6a452251..9fb483ef6a 100644 --- a/phpBB/phpbb/db/migration/data/v310/rc3.php +++ b/phpBB/phpbb/db/migration/data/v310/rc3.php @@ -15,6 +15,11 @@ namespace phpbb\db\migration\data\v310; class rc3 extends \phpbb\db\migration\migration { + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.1.0-RC3', '>='); + } + static public function depends_on() { return array( diff --git a/phpBB/phpbb/db/migration/data/v310/rc4.php b/phpBB/phpbb/db/migration/data/v310/rc4.php index 47de8291c1..0d756c762c 100644 --- a/phpBB/phpbb/db/migration/data/v310/rc4.php +++ b/phpBB/phpbb/db/migration/data/v310/rc4.php @@ -15,6 +15,11 @@ namespace phpbb\db\migration\data\v310; class rc4 extends \phpbb\db\migration\migration { + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.1.0-RC4', '>='); + } + static public function depends_on() { return array( diff --git a/phpBB/phpbb/db/migration/data/v310/rc5.php b/phpBB/phpbb/db/migration/data/v310/rc5.php index 5b6f70e32e..d92537d877 100644 --- a/phpBB/phpbb/db/migration/data/v310/rc5.php +++ b/phpBB/phpbb/db/migration/data/v310/rc5.php @@ -15,6 +15,11 @@ namespace phpbb\db\migration\data\v310; class rc5 extends \phpbb\db\migration\migration { + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.1.0-RC5', '>='); + } + static public function depends_on() { return array( diff --git a/phpBB/phpbb/db/migration/data/v310/rc6.php b/phpBB/phpbb/db/migration/data/v310/rc6.php index b84f2edcc9..1df502a1e4 100644 --- a/phpBB/phpbb/db/migration/data/v310/rc6.php +++ b/phpBB/phpbb/db/migration/data/v310/rc6.php @@ -15,6 +15,11 @@ namespace phpbb\db\migration\data\v310; class rc6 extends \phpbb\db\migration\migration { + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.1.0-RC6', '>='); + } + static public function depends_on() { return array( diff --git a/phpBB/phpbb/db/migration/data/v31x/v311.php b/phpBB/phpbb/db/migration/data/v31x/v311.php index 00844dd4c0..b9d6ed3053 100644 --- a/phpBB/phpbb/db/migration/data/v31x/v311.php +++ b/phpBB/phpbb/db/migration/data/v31x/v311.php @@ -15,6 +15,11 @@ namespace phpbb\db\migration\data\v31x; class v311 extends \phpbb\db\migration\migration { + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.1.1', '>='); + } + static public function depends_on() { return array( diff --git a/phpBB/phpbb/db/migration/data/v31x/v312.php b/phpBB/phpbb/db/migration/data/v31x/v312.php index bf49935f4d..114c2b959b 100644 --- a/phpBB/phpbb/db/migration/data/v31x/v312.php +++ b/phpBB/phpbb/db/migration/data/v31x/v312.php @@ -15,6 +15,11 @@ namespace phpbb\db\migration\data\v31x; class v312 extends \phpbb\db\migration\migration { + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.1.2', '>='); + } + static public function depends_on() { return array( diff --git a/phpBB/phpbb/db/migration/data/v31x/v312rc1.php b/phpBB/phpbb/db/migration/data/v31x/v312rc1.php index d4b133fc01..e2408d432b 100644 --- a/phpBB/phpbb/db/migration/data/v31x/v312rc1.php +++ b/phpBB/phpbb/db/migration/data/v31x/v312rc1.php @@ -15,6 +15,11 @@ namespace phpbb\db\migration\data\v31x; class v312rc1 extends \phpbb\db\migration\migration { + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.1.2-RC1', '>='); + } + static public function depends_on() { return array( diff --git a/phpBB/phpbb/db/migration/data/v31x/v313.php b/phpBB/phpbb/db/migration/data/v31x/v313.php index 5a4e21a9b7..b86788da16 100644 --- a/phpBB/phpbb/db/migration/data/v31x/v313.php +++ b/phpBB/phpbb/db/migration/data/v31x/v313.php @@ -15,6 +15,11 @@ namespace phpbb\db\migration\data\v31x; class v313 extends \phpbb\db\migration\migration { + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.1.3', '>='); + } + static public function depends_on() { return array( diff --git a/phpBB/phpbb/db/migration/data/v31x/v313rc1.php b/phpBB/phpbb/db/migration/data/v31x/v313rc1.php index e50754f805..b1dcc03364 100644 --- a/phpBB/phpbb/db/migration/data/v31x/v313rc1.php +++ b/phpBB/phpbb/db/migration/data/v31x/v313rc1.php @@ -15,6 +15,11 @@ namespace phpbb\db\migration\data\v31x; class v313rc1 extends \phpbb\db\migration\migration { + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.1.3-RC1', '>='); + } + static public function depends_on() { return array( diff --git a/phpBB/phpbb/db/migration/data/v31x/v313rc2.php b/phpBB/phpbb/db/migration/data/v31x/v313rc2.php index d832d6f502..b701dca5ed 100644 --- a/phpBB/phpbb/db/migration/data/v31x/v313rc2.php +++ b/phpBB/phpbb/db/migration/data/v31x/v313rc2.php @@ -15,6 +15,11 @@ namespace phpbb\db\migration\data\v31x; class v313rc2 extends \phpbb\db\migration\migration { + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.1.3-RC2', '>='); + } + static public function depends_on() { return array( diff --git a/phpBB/phpbb/db/migration/data/v31x/v314.php b/phpBB/phpbb/db/migration/data/v31x/v314.php index b7793ca569..82dbbf29c9 100644 --- a/phpBB/phpbb/db/migration/data/v31x/v314.php +++ b/phpBB/phpbb/db/migration/data/v31x/v314.php @@ -15,6 +15,11 @@ namespace phpbb\db\migration\data\v31x; class v314 extends \phpbb\db\migration\migration { + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.1.4', '>='); + } + static public function depends_on() { return array( diff --git a/phpBB/phpbb/db/migration/data/v31x/v314rc1.php b/phpBB/phpbb/db/migration/data/v31x/v314rc1.php index 10cdbe3f9c..e7baf0c2ce 100644 --- a/phpBB/phpbb/db/migration/data/v31x/v314rc1.php +++ b/phpBB/phpbb/db/migration/data/v31x/v314rc1.php @@ -15,6 +15,11 @@ namespace phpbb\db\migration\data\v31x; class v314rc1 extends \phpbb\db\migration\migration { + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.1.4-RC1', '>='); + } + static public function depends_on() { return array( diff --git a/phpBB/phpbb/db/migration/data/v31x/v314rc2.php b/phpBB/phpbb/db/migration/data/v31x/v314rc2.php index b75b7a9be8..3fc5bf2ad5 100644 --- a/phpBB/phpbb/db/migration/data/v31x/v314rc2.php +++ b/phpBB/phpbb/db/migration/data/v31x/v314rc2.php @@ -15,6 +15,11 @@ namespace phpbb\db\migration\data\v31x; class v314rc2 extends \phpbb\db\migration\migration { + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.1.4-RC2', '>='); + } + static public function depends_on() { return array( diff --git a/phpBB/phpbb/db/migration/data/v31x/v315.php b/phpBB/phpbb/db/migration/data/v31x/v315.php index 778cdf717e..d5eacf8dd3 100644 --- a/phpBB/phpbb/db/migration/data/v31x/v315.php +++ b/phpBB/phpbb/db/migration/data/v31x/v315.php @@ -15,6 +15,11 @@ namespace phpbb\db\migration\data\v31x; class v315 extends \phpbb\db\migration\migration { + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.1.5', '>='); + } + static public function depends_on() { return array( diff --git a/phpBB/phpbb/db/migration/data/v31x/v315rc1.php b/phpBB/phpbb/db/migration/data/v31x/v315rc1.php index 4cf4472aa7..a58b6a0f2a 100644 --- a/phpBB/phpbb/db/migration/data/v31x/v315rc1.php +++ b/phpBB/phpbb/db/migration/data/v31x/v315rc1.php @@ -15,6 +15,11 @@ namespace phpbb\db\migration\data\v31x; class v315rc1 extends \phpbb\db\migration\migration { + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.1.5-RC1', '>='); + } + static public function depends_on() { return array( diff --git a/phpBB/phpbb/db/migration/data/v31x/v316.php b/phpBB/phpbb/db/migration/data/v31x/v316.php index cec113eff2..b3e0060ced 100644 --- a/phpBB/phpbb/db/migration/data/v31x/v316.php +++ b/phpBB/phpbb/db/migration/data/v31x/v316.php @@ -15,6 +15,11 @@ namespace phpbb\db\migration\data\v31x; class v316 extends \phpbb\db\migration\migration { + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.1.6', '>='); + } + static public function depends_on() { return array( diff --git a/phpBB/phpbb/db/migration/data/v31x/v316rc1.php b/phpBB/phpbb/db/migration/data/v31x/v316rc1.php index 487cd05e5d..6badfb68d4 100644 --- a/phpBB/phpbb/db/migration/data/v31x/v316rc1.php +++ b/phpBB/phpbb/db/migration/data/v31x/v316rc1.php @@ -15,6 +15,11 @@ namespace phpbb\db\migration\data\v31x; class v316rc1 extends \phpbb\db\migration\migration { + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.1.6-RC1', '>='); + } + static public function depends_on() { return array( diff --git a/phpBB/phpbb/db/migration/data/v31x/v317.php b/phpBB/phpbb/db/migration/data/v31x/v317.php index 15ba2a1feb..d95be06ba6 100644 --- a/phpBB/phpbb/db/migration/data/v31x/v317.php +++ b/phpBB/phpbb/db/migration/data/v31x/v317.php @@ -15,6 +15,11 @@ namespace phpbb\db\migration\data\v31x; class v317 extends \phpbb\db\migration\migration { + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.1.7', '>='); + } + static public function depends_on() { return array( diff --git a/phpBB/phpbb/db/migration/data/v31x/v317pl1.php b/phpBB/phpbb/db/migration/data/v31x/v317pl1.php index 2e1b0e9b9d..1cb39b03f0 100644 --- a/phpBB/phpbb/db/migration/data/v31x/v317pl1.php +++ b/phpBB/phpbb/db/migration/data/v31x/v317pl1.php @@ -15,6 +15,11 @@ namespace phpbb\db\migration\data\v31x; class v317pl1 extends \phpbb\db\migration\migration { + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.1.7-pl1', '>='); + } + static public function depends_on() { return array( diff --git a/phpBB/phpbb/db/migration/data/v31x/v317rc1.php b/phpBB/phpbb/db/migration/data/v31x/v317rc1.php index fa24819094..77759daa66 100644 --- a/phpBB/phpbb/db/migration/data/v31x/v317rc1.php +++ b/phpBB/phpbb/db/migration/data/v31x/v317rc1.php @@ -15,6 +15,11 @@ namespace phpbb\db\migration\data\v31x; class v317rc1 extends \phpbb\db\migration\migration { + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.1.7-RC1', '>='); + } + static public function depends_on() { return array( 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..7663529d3a --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/v318.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\v31x; + +class v318 extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.1.8', '>='); + } + + 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..2cab5c96d4 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/v318rc1.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\v31x; + +class v318rc1 extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.1.8-RC1', '>='); + } + + 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/migration/data/v31x/v319.php b/phpBB/phpbb/db/migration/data/v31x/v319.php new file mode 100644 index 0000000000..f773814028 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/v319.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\v31x; + +class v319 extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.1.9', '>='); + } + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v31x\v319rc1', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.1.9')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v31x/v319rc1.php b/phpBB/phpbb/db/migration/data/v31x/v319rc1.php new file mode 100644 index 0000000000..9805b45572 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/v319rc1.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\v31x; + +class v319rc1 extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.1.9-RC1', '>='); + } + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v31x\v318', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.1.9-RC1')), + ); + } +} diff --git a/phpBB/phpbb/db/tools.php b/phpBB/phpbb/db/tools.php index e76e7b0e18..832a0c510c 100644 --- a/phpBB/phpbb/db/tools.php +++ b/phpBB/phpbb/db/tools.php @@ -2340,7 +2340,7 @@ class tools if (!empty($column_data['default'])) { // Add new default value constraint - $statements[] = 'ALTER TABLE [' . $table_name . '] ADD CONSTRAINT [DF_' . $table_name . '_' . $column_name . '_1] ' . $this->db->sql_escape($column_data['default']) . ' FOR [' . $column_name . ']'; + $statements[] = 'ALTER TABLE [' . $table_name . '] ADD CONSTRAINT [DF_' . $table_name . '_' . $column_name . '_1] ' . $column_data['default'] . ' FOR [' . $column_name . ']'; } if (!empty($indexes)) diff --git a/phpBB/phpbb/notification/manager.php b/phpBB/phpbb/notification/manager.php index db92170dd8..ecba8938f2 100644 --- a/phpBB/phpbb/notification/manager.php +++ b/phpBB/phpbb/notification/manager.php @@ -186,12 +186,13 @@ 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 FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . ' nt WHERE n.user_id = ' . (int) $options['user_id'] . - (($options['notification_id']) ? ((is_array($options['notification_id'])) ? ' AND ' . $this->db->sql_in_set('n.notification_id', $options['notification_id']) : ' AND n.notification_id = ' . (int) $options['notification_id']) : '') . ' + (($options['notification_id']) ? ' AND ' . $this->db->sql_in_set('n.notification_id', $options['notification_id']) : '') . ' AND nt.notification_type_id = n.notification_type_id AND nt.notification_type_enabled = 1 ORDER BY n.' . $this->db->sql_escape($options['order_by']) . ' ' . $this->db->sql_escape($options['order_dir']); @@ -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 @@ -273,10 +275,9 @@ class manager $sql = 'UPDATE ' . $this->notifications_table . " SET notification_read = 1 WHERE notification_time <= " . (int) $time . - (($notification_type_name !== false) ? ' AND ' . - (is_array($notification_type_name) ? $this->db->sql_in_set('notification_type_id', $this->get_notification_type_ids($notification_type_name)) : 'notification_type_id = ' . $this->get_notification_type_id($notification_type_name)) : '') . - (($user_id !== false) ? ' AND ' . (is_array($user_id) ? $this->db->sql_in_set('user_id', $user_id) : 'user_id = ' . (int) $user_id) : '') . - (($item_id !== false) ? ' AND ' . (is_array($item_id) ? $this->db->sql_in_set('item_id', $item_id) : 'item_id = ' . (int) $item_id) : ''); + (($notification_type_name !== false) ? ' AND ' . $this->db->sql_in_set('notification_type_id', $this->get_notification_type_ids($notification_type_name)) : '') . + (($user_id !== false) ? ' AND ' . $this->db->sql_in_set('user_id', $user_id) : '') . + (($item_id !== false) ? ' AND ' . $this->db->sql_in_set('item_id', $item_id) : ''); $this->db->sql_query($sql); } @@ -295,10 +296,9 @@ class manager $sql = 'UPDATE ' . $this->notifications_table . " SET notification_read = 1 WHERE notification_time <= " . (int) $time . - (($notification_type_name !== false) ? ' AND ' . - (is_array($notification_type_name) ? $this->db->sql_in_set('notification_type_id', $this->get_notification_type_ids($notification_type_name)) : 'notification_type_id = ' . $this->get_notification_type_id($notification_type_name)) : '') . - (($item_parent_id !== false) ? ' AND ' . (is_array($item_parent_id) ? $this->db->sql_in_set('item_parent_id', $item_parent_id, false, true) : 'item_parent_id = ' . (int) $item_parent_id) : '') . - (($user_id !== false) ? ' AND ' . (is_array($user_id) ? $this->db->sql_in_set('user_id', $user_id) : 'user_id = ' . (int) $user_id) : ''); + (($notification_type_name !== false) ? ' AND ' . $this->db->sql_in_set('notification_type_id', $this->get_notification_type_ids($notification_type_name)) : '') . + (($item_parent_id !== false) ? ' AND ' . $this->db->sql_in_set('item_parent_id', $item_parent_id, false, true) : '') . + (($user_id !== false) ? ' AND ' . $this->db->sql_in_set('user_id', $user_id) : ''); $this->db->sql_query($sql); } @@ -315,7 +315,7 @@ class manager $sql = 'UPDATE ' . $this->notifications_table . " SET notification_read = 1 WHERE notification_time <= " . (int) $time . ' - AND ' . ((is_array($notification_id)) ? $this->db->sql_in_set('notification_id', $notification_id) : 'notification_id = ' . (int) $notification_id); + AND ' . $this->db->sql_in_set('notification_id', $notification_id); $this->db->sql_query($sql); } @@ -540,8 +540,8 @@ class manager $sql = 'DELETE FROM ' . $this->notifications_table . ' WHERE notification_type_id = ' . (int) $notification_type_id . ' - AND ' . (is_array($item_id) ? $this->db->sql_in_set('item_id', $item_id) : 'item_id = ' . (int) $item_id) . - (($parent_id !== false) ? ' AND ' . ((is_array($parent_id) ? $this->db->sql_in_set('item_parent_id', $parent_id) : 'item_parent_id = ' . (int) $parent_id)) : ''); + AND ' . $this->db->sql_in_set('item_id', $item_id) . + (($parent_id !== false) ? ' AND ' . $this->db->sql_in_set('item_parent_id', $parent_id) : ''); $this->db->sql_query($sql); } @@ -923,6 +923,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,17 +959,24 @@ class manager $this->cache->put('notification_type_ids', $notification_type_ids); } + $this->db->sql_transaction('commit'); + return $notification_type_ids[$notification_type_name]; } /** * Get notification type ids (as an array) * - * @param array $notification_type_names Array of strings + * @param string|array $notification_type_names Notification type names * @return array Array of integers */ - public function get_notification_type_ids(array $notification_type_names) + public function get_notification_type_ids($notification_type_names) { + if (!is_array($notification_type_names)) + { + $notification_type_names = array($notification_type_names); + } + $notification_type_ids = array(); foreach ($notification_type_names as $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/profilefields/type/type_int.php b/phpBB/phpbb/profilefields/type/type_int.php index dd08df94c1..9dc0181cb8 100644 --- a/phpBB/phpbb/profilefields/type/type_int.php +++ b/phpBB/phpbb/profilefields/type/type_int.php @@ -61,9 +61,9 @@ class type_int extends type_base public function get_options($default_lang_id, $field_data) { $options = array( - 0 => array('TITLE' => $this->user->lang['FIELD_LENGTH'], 'FIELD' => '<input type="number" min="0" max="99999" name="field_length" size="5" value="' . $field_data['field_length'] . '" />'), - 1 => array('TITLE' => $this->user->lang['MIN_FIELD_NUMBER'], 'FIELD' => '<input type="number" min="0" max="99999" name="field_minlen" size="5" value="' . $field_data['field_minlen'] . '" />'), - 2 => array('TITLE' => $this->user->lang['MAX_FIELD_NUMBER'], 'FIELD' => '<input type="number" min="0" max="99999" name="field_maxlen" size="5" value="' . $field_data['field_maxlen'] . '" />'), + 0 => array('TITLE' => $this->user->lang['FIELD_LENGTH'], 'FIELD' => '<input type="number" min="0" max="99999" name="field_length" value="' . $field_data['field_length'] . '" />'), + 1 => array('TITLE' => $this->user->lang['MIN_FIELD_NUMBER'], 'FIELD' => '<input type="number" min="0" max="99999" name="field_minlen" value="' . $field_data['field_minlen'] . '" />'), + 2 => array('TITLE' => $this->user->lang['MAX_FIELD_NUMBER'], 'FIELD' => '<input type="number" min="0" max="99999" name="field_maxlen" value="' . $field_data['field_maxlen'] . '" />'), 3 => array('TITLE' => $this->user->lang['DEFAULT_VALUE'], 'FIELD' => '<input type="number" name="field_default_value" value="' . $field_data['field_default_value'] . '" />'), ); diff --git a/phpBB/phpbb/profilefields/type/type_string.php b/phpBB/phpbb/profilefields/type/type_string.php index 67befc457d..a8432eaae5 100644 --- a/phpBB/phpbb/profilefields/type/type_string.php +++ b/phpBB/phpbb/profilefields/type/type_string.php @@ -61,9 +61,9 @@ class type_string extends type_string_common public function get_options($default_lang_id, $field_data) { $options = array( - 0 => array('TITLE' => $this->user->lang['FIELD_LENGTH'], 'FIELD' => '<input type="number" min="0" name="field_length" size="5" value="' . $field_data['field_length'] . '" />'), - 1 => array('TITLE' => $this->user->lang['MIN_FIELD_CHARS'], 'FIELD' => '<input type="number" min="0" name="field_minlen" size="5" value="' . $field_data['field_minlen'] . '" />'), - 2 => array('TITLE' => $this->user->lang['MAX_FIELD_CHARS'], 'FIELD' => '<input type="number" min="0" name="field_maxlen" size="5" value="' . $field_data['field_maxlen'] . '" />'), + 0 => array('TITLE' => $this->user->lang['FIELD_LENGTH'], 'FIELD' => '<input type="number" min="0" max="99999" name="field_length" value="' . $field_data['field_length'] . '" />'), + 1 => array('TITLE' => $this->user->lang['MIN_FIELD_CHARS'], 'FIELD' => '<input type="number" min="0" max="99999" name="field_minlen" value="' . $field_data['field_minlen'] . '" />'), + 2 => array('TITLE' => $this->user->lang['MAX_FIELD_CHARS'], 'FIELD' => '<input type="number" min="0 max="99999"" name="field_maxlen" value="' . $field_data['field_maxlen'] . '" />'), 3 => array('TITLE' => $this->user->lang['FIELD_VALIDATION'], 'FIELD' => '<select name="field_validation">' . $this->validate_options($field_data) . '</select>'), ); diff --git a/phpBB/phpbb/profilefields/type/type_text.php b/phpBB/phpbb/profilefields/type/type_text.php index bacf60a213..79ee82351a 100644 --- a/phpBB/phpbb/profilefields/type/type_text.php +++ b/phpBB/phpbb/profilefields/type/type_text.php @@ -61,9 +61,9 @@ class type_text extends type_string_common public function get_options($default_lang_id, $field_data) { $options = array( - 0 => array('TITLE' => $this->user->lang['FIELD_LENGTH'], 'FIELD' => '<input type="number" min="0" max="99999" name="rows" size="5" value="' . $field_data['rows'] . '" /> ' . $this->user->lang['ROWS'] . '</dd><dd><input type="number" min="0" max="99999" name="columns" size="5" value="' . $field_data['columns'] . '" /> ' . $this->user->lang['COLUMNS'] . ' <input type="hidden" name="field_length" value="' . $field_data['field_length'] . '" />'), - 1 => array('TITLE' => $this->user->lang['MIN_FIELD_CHARS'], 'FIELD' => '<input type="number" min="0" max="9999999999" name="field_minlen" size="10" value="' . $field_data['field_minlen'] . '" />'), - 2 => array('TITLE' => $this->user->lang['MAX_FIELD_CHARS'], 'FIELD' => '<input type="number" min="0" max="9999999999" name="field_maxlen" size="10" value="' . $field_data['field_maxlen'] . '" />'), + 0 => array('TITLE' => $this->user->lang['FIELD_LENGTH'], 'FIELD' => '<input type="number" min="0" max="99999" name="rows" value="' . $field_data['rows'] . '" /> ' . $this->user->lang['ROWS'] . '</dd><dd><input type="number" min="0" max="99999" name="columns" value="' . $field_data['columns'] . '" /> ' . $this->user->lang['COLUMNS'] . ' <input type="hidden" name="field_length" value="' . $field_data['field_length'] . '" />'), + 1 => array('TITLE' => $this->user->lang['MIN_FIELD_CHARS'], 'FIELD' => '<input type="number" min="0" max="9999999999" name="field_minlen" value="' . $field_data['field_minlen'] . '" />'), + 2 => array('TITLE' => $this->user->lang['MAX_FIELD_CHARS'], 'FIELD' => '<input type="number" min="0" max="9999999999" name="field_maxlen" value="' . $field_data['field_maxlen'] . '" />'), 3 => array('TITLE' => $this->user->lang['FIELD_VALIDATION'], 'FIELD' => '<select name="field_validation">' . $this->validate_options($field_data) . '</select>'), ); diff --git a/phpBB/phpbb/profilefields/type/type_url.php b/phpBB/phpbb/profilefields/type/type_url.php index fe0bffd582..375cf5b19a 100644 --- a/phpBB/phpbb/profilefields/type/type_url.php +++ b/phpBB/phpbb/profilefields/type/type_url.php @@ -29,9 +29,9 @@ class type_url extends type_string public function get_options($default_lang_id, $field_data) { $options = array( - 0 => array('TITLE' => $this->user->lang['FIELD_LENGTH'], 'FIELD' => '<input type="number" min="0" name="field_length" size="5" value="' . $field_data['field_length'] . '" />'), - 1 => array('TITLE' => $this->user->lang['MIN_FIELD_CHARS'], 'FIELD' => '<input type="number" min="0" name="field_minlen" size="5" value="' . $field_data['field_minlen'] . '" />'), - 2 => array('TITLE' => $this->user->lang['MAX_FIELD_CHARS'], 'FIELD' => '<input type="number" min="0" name="field_maxlen" size="5" value="' . $field_data['field_maxlen'] . '" />'), + 0 => array('TITLE' => $this->user->lang['FIELD_LENGTH'], 'FIELD' => '<input type="number" min="0" max="99999" name="field_length" value="' . $field_data['field_length'] . '" />'), + 1 => array('TITLE' => $this->user->lang['MIN_FIELD_CHARS'], 'FIELD' => '<input type="number" min="0" max="99999" name="field_minlen" value="' . $field_data['field_minlen'] . '" />'), + 2 => array('TITLE' => $this->user->lang['MAX_FIELD_CHARS'], 'FIELD' => '<input type="number" min="0" max="99999" name="field_maxlen" value="' . $field_data['field_maxlen'] . '" />'), ); return $options; 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/request/request.php b/phpBB/phpbb/request/request.php index 56ce3999ed..4cac6fbaea 100644 --- a/phpBB/phpbb/request/request.php +++ b/phpBB/phpbb/request/request.php @@ -325,7 +325,9 @@ class request implements \phpbb\request\request_interface */ public function is_secure() { - return $this->server('HTTPS') == 'on'; + $https = $this->server('HTTPS'); + $https = $this->server('HTTP_X_FORWARDED_PROTO') === 'https' ? 'on' : $https; + return !empty($https) && $https !== 'off'; } /** diff --git a/phpBB/phpbb/search/fulltext_native.php b/phpBB/phpbb/search/fulltext_native.php index a02f889415..e2c02ffdab 100644 --- a/phpBB/phpbb/search/fulltext_native.php +++ b/phpBB/phpbb/search/fulltext_native.php @@ -1975,15 +1975,15 @@ class fulltext_native extends \phpbb\search\base </dl> <dl> <dt><label for="fulltext_native_min_chars">' . $this->user->lang['MIN_SEARCH_CHARS'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['MIN_SEARCH_CHARS_EXPLAIN'] . '</span></dt> - <dd><input id="fulltext_native_min_chars" type="number" size="3" maxlength="3" min="0" max="255" name="config[fulltext_native_min_chars]" value="' . (int) $this->config['fulltext_native_min_chars'] . '" /></dd> + <dd><input id="fulltext_native_min_chars" type="number" min="0" max="255" name="config[fulltext_native_min_chars]" value="' . (int) $this->config['fulltext_native_min_chars'] . '" /></dd> </dl> <dl> <dt><label for="fulltext_native_max_chars">' . $this->user->lang['MAX_SEARCH_CHARS'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['MAX_SEARCH_CHARS_EXPLAIN'] . '</span></dt> - <dd><input id="fulltext_native_max_chars" type="number" size="3" maxlength="3" min="0" max="255" name="config[fulltext_native_max_chars]" value="' . (int) $this->config['fulltext_native_max_chars'] . '" /></dd> + <dd><input id="fulltext_native_max_chars" type="number" min="0" max="255" name="config[fulltext_native_max_chars]" value="' . (int) $this->config['fulltext_native_max_chars'] . '" /></dd> </dl> <dl> <dt><label for="fulltext_native_common_thres">' . $this->user->lang['COMMON_WORD_THRESHOLD'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['COMMON_WORD_THRESHOLD_EXPLAIN'] . '</span></dt> - <dd><input id="fulltext_native_common_thres" type="text" size="3" maxlength="3" name="config[fulltext_native_common_thres]" value="' . (double) $this->config['fulltext_native_common_thres'] . '" /> %</dd> + <dd><input id="fulltext_native_common_thres" type="text" name="config[fulltext_native_common_thres]" value="' . (double) $this->config['fulltext_native_common_thres'] . '" /> %</dd> </dl> '; diff --git a/phpBB/phpbb/search/fulltext_postgres.php b/phpBB/phpbb/search/fulltext_postgres.php index c2186b0df3..04441e6226 100644 --- a/phpBB/phpbb/search/fulltext_postgres.php +++ b/phpBB/phpbb/search/fulltext_postgres.php @@ -1089,11 +1089,11 @@ class fulltext_postgres extends \phpbb\search\base </dl> <dl> <dt><label for="fulltext_postgres_min_word_len">' . $this->user->lang['FULLTEXT_POSTGRES_MIN_WORD_LEN'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['FULLTEXT_POSTGRES_MIN_WORD_LEN_EXPLAIN'] . '</span></dt> - <dd><input id="fulltext_postgres_min_word_len" type="number" size="3" maxlength="3" min="0" max="255" name="config[fulltext_postgres_min_word_len]" value="' . (int) $this->config['fulltext_postgres_min_word_len'] . '" /></dd> + <dd><input id="fulltext_postgres_min_word_len" type="number" min="0" max="255" name="config[fulltext_postgres_min_word_len]" value="' . (int) $this->config['fulltext_postgres_min_word_len'] . '" /></dd> </dl> <dl> <dt><label for="fulltext_postgres_max_word_len">' . $this->user->lang['FULLTEXT_POSTGRES_MAX_WORD_LEN'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['FULLTEXT_POSTGRES_MAX_WORD_LEN_EXPLAIN'] . '</span></dt> - <dd><input id="fulltext_postgres_max_word_len" type="number" size="3" maxlength="3" min="0" max="255" name="config[fulltext_postgres_max_word_len]" value="' . (int) $this->config['fulltext_postgres_max_word_len'] . '" /></dd> + <dd><input id="fulltext_postgres_max_word_len" type="number" min="0" max="255" name="config[fulltext_postgres_max_word_len]" value="' . (int) $this->config['fulltext_postgres_max_word_len'] . '" /></dd> </dl> '; diff --git a/phpBB/phpbb/search/fulltext_sphinx.php b/phpBB/phpbb/search/fulltext_sphinx.php index 612ef8f1f3..0dbc6e33df 100644 --- a/phpBB/phpbb/search/fulltext_sphinx.php +++ b/phpBB/phpbb/search/fulltext_sphinx.php @@ -952,11 +952,11 @@ class fulltext_sphinx </dl> <dl> <dt><label for="fulltext_sphinx_port">' . $this->user->lang['FULLTEXT_SPHINX_PORT'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['FULLTEXT_SPHINX_PORT_EXPLAIN'] . '</span></dt> - <dd><input id="fulltext_sphinx_port" type="number" size="4" maxlength="10" name="config[fulltext_sphinx_port]" value="' . $this->config['fulltext_sphinx_port'] . '" /></dd> + <dd><input id="fulltext_sphinx_port" type="number" min="0" max="9999999999" name="config[fulltext_sphinx_port]" value="' . $this->config['fulltext_sphinx_port'] . '" /></dd> </dl> <dl> <dt><label for="fulltext_sphinx_indexer_mem_limit">' . $this->user->lang['FULLTEXT_SPHINX_INDEXER_MEM_LIMIT'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['FULLTEXT_SPHINX_INDEXER_MEM_LIMIT_EXPLAIN'] . '</span></dt> - <dd><input id="fulltext_sphinx_indexer_mem_limit" type="number" size="4" maxlength="10" name="config[fulltext_sphinx_indexer_mem_limit]" value="' . $this->config['fulltext_sphinx_indexer_mem_limit'] . '" /> ' . $this->user->lang['MIB'] . '</dd> + <dd><input id="fulltext_sphinx_indexer_mem_limit" type="number" min="0" max="9999999999" name="config[fulltext_sphinx_indexer_mem_limit]" value="' . $this->config['fulltext_sphinx_indexer_mem_limit'] . '" /> ' . $this->user->lang['MIB'] . '</dd> </dl> <dl> <dt><label for="fulltext_sphinx_config_file">' . $this->user->lang['FULLTEXT_SPHINX_CONFIG_FILE'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['FULLTEXT_SPHINX_CONFIG_FILE_EXPLAIN'] . '</span></dt> diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php index 6cff75c62c..83e87b7704 100644 --- a/phpBB/phpbb/session.php +++ b/phpBB/phpbb/session.php @@ -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/user.php b/phpBB/phpbb/user.php index f5ad5096bb..faedd79703 100644 --- a/phpBB/phpbb/user.php +++ b/phpBB/phpbb/user.php @@ -725,7 +725,7 @@ class user extends \phpbb\session $utc = new \DateTimeZone('UTC'); } - $time = new $this->datetime($this, "@$gmepoch", $utc); + $time = new $this->datetime($this, '@' . (int) $gmepoch, $utc); $time->setTimezone($this->timezone); return $time->format($format, $forcedate); |