aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r--phpBB/phpbb/avatar/driver/upload.php14
-rw-r--r--phpBB/phpbb/cache/driver/file.php4
-rw-r--r--phpBB/phpbb/cache/driver/memory.php4
-rw-r--r--phpBB/phpbb/captcha/plugins/qa.php34
-rw-r--r--phpBB/phpbb/composer.json2
-rw-r--r--phpBB/phpbb/controller/helper.php9
-rw-r--r--phpBB/phpbb/cron/task/core/queue.php19
-rw-r--r--phpBB/phpbb/db/driver/driver.php1
-rw-r--r--phpBB/phpbb/db/migration/data/v310/passwords_convert_p1.php13
-rw-r--r--phpBB/phpbb/db/migration/data/v320/notifications_board.php2
-rw-r--r--phpBB/phpbb/di/container_builder.php1
-rw-r--r--phpBB/phpbb/install/console/command/install/config/show.php12
-rw-r--r--phpBB/phpbb/install/console/command/install/config/validate.php10
-rw-r--r--phpBB/phpbb/install/console/command/install/install.php2
-rw-r--r--phpBB/phpbb/install/console/command/update/config/show.php123
-rw-r--r--phpBB/phpbb/install/console/command/update/config/validate.php124
-rw-r--r--phpBB/phpbb/install/console/command/update/update.php179
-rw-r--r--phpBB/phpbb/install/controller/timeout_check.php80
-rw-r--r--phpBB/phpbb/install/event/kernel_exception_subscriber.php1
-rw-r--r--phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php41
-rw-r--r--phpBB/phpbb/install/installer.php22
-rw-r--r--phpBB/phpbb/install/module/install_data/task/add_bots.php1
-rw-r--r--phpBB/phpbb/install/module/obtain_data/task/obtain_update_settings.php8
-rw-r--r--phpBB/phpbb/install/module/requirements/task/check_update.php2
-rw-r--r--phpBB/phpbb/install/updater_configuration.php40
-rw-r--r--phpBB/phpbb/notification/manager.php4
-rw-r--r--phpBB/phpbb/notification/method/messenger_base.php2
-rw-r--r--phpBB/phpbb/recursive_dot_prefix_filter_iterator.php2
-rw-r--r--phpBB/phpbb/routing/router.php31
-rw-r--r--phpBB/phpbb/textreparser/base.php3
-rw-r--r--phpBB/phpbb/user.php2
31 files changed, 715 insertions, 77 deletions
diff --git a/phpBB/phpbb/avatar/driver/upload.php b/phpBB/phpbb/avatar/driver/upload.php
index a0c23cb624..2640e1ad1e 100644
--- a/phpBB/phpbb/avatar/driver/upload.php
+++ b/phpBB/phpbb/avatar/driver/upload.php
@@ -179,17 +179,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',
@@ -197,6 +209,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/file.php b/phpBB/phpbb/cache/driver/file.php
index d994394249..a210d877f0 100644
--- a/phpBB/phpbb/cache/driver/file.php
+++ b/phpBB/phpbb/cache/driver/file.php
@@ -32,9 +32,9 @@ class file extends \phpbb\cache\driver\base
*/
function __construct($cache_dir = null)
{
- global $phpbb_root_path, $phpbb_container;
+ global $phpbb_container;
- $this->cache_dir = !is_null($cache_dir) ? $cache_dir : $phpbb_root_path . 'cache/' . $phpbb_container->getParameter('core.environment') . '/';
+ $this->cache_dir = !is_null($cache_dir) ? $cache_dir : $phpbb_container->getParameter('core.cache_dir');
$this->filesystem = new \phpbb\filesystem\filesystem();
if (!is_dir($this->cache_dir))
diff --git a/phpBB/phpbb/cache/driver/memory.php b/phpBB/phpbb/cache/driver/memory.php
index baae22d809..cc03804705 100644
--- a/phpBB/phpbb/cache/driver/memory.php
+++ b/phpBB/phpbb/cache/driver/memory.php
@@ -25,9 +25,9 @@ abstract class memory extends \phpbb\cache\driver\base
*/
function __construct()
{
- global $phpbb_root_path, $dbname, $table_prefix;
+ global $phpbb_root_path, $dbname, $table_prefix, $phpbb_container;
- $this->cache_dir = $phpbb_root_path . 'cache/';
+ $this->cache_dir = $phpbb_container->getParameter('core.cache_dir');
$this->key_prefix = substr(md5($dbname . $table_prefix), 0, 8) . '_';
if (!isset($this->extension) || !extension_loaded($this->extension))
diff --git a/phpBB/phpbb/captcha/plugins/qa.php b/phpBB/phpbb/captcha/plugins/qa.php
index 4df8a86432..7f804850a4 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,10 +220,12 @@ class qa
*/
function get_template()
{
- global $template;
+ global $phpbb_log, $template, $user;
- if ($this->is_solved())
+ if ($this->is_solved() || 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
@@ -363,13 +387,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/composer.json b/phpBB/phpbb/composer.json
index 758125234f..0b6299d6bc 100644
--- a/phpBB/phpbb/composer.json
+++ b/phpBB/phpbb/composer.json
@@ -26,7 +26,7 @@
},
"extra": {
"branch-alias": {
- "dev-master": "3.2.x-dev"
+ "dev-master": "3.3.x-dev"
}
}
}
diff --git a/phpBB/phpbb/controller/helper.php b/phpBB/phpbb/controller/helper.php
index e98de0e771..9dbc3737f7 100644
--- a/phpBB/phpbb/controller/helper.php
+++ b/phpBB/phpbb/controller/helper.php
@@ -80,12 +80,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,
@@ -93,7 +94,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/cron/task/core/queue.php b/phpBB/phpbb/cron/task/core/queue.php
index a9345a44df..eca69a5041 100644
--- a/phpBB/phpbb/cron/task/core/queue.php
+++ b/phpBB/phpbb/cron/task/core/queue.php
@@ -20,20 +20,23 @@ class queue extends \phpbb\cron\task\base
{
protected $phpbb_root_path;
protected $php_ext;
+ protected $cache_dir;
protected $config;
/**
- * Constructor.
- *
- * @param string $phpbb_root_path The root path
- * @param string $php_ext PHP file extension
- * @param \phpbb\config\config $config The config
- */
- public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config)
+ * Constructor.
+ *
+ * @param string $phpbb_root_path The root path
+ * @param string $php_ext PHP file extension
+ * @param \phpbb\config\config $config The config
+ * @param string $cache_dir phpBB cache directory
+ */
+ public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config, $cache_dir)
{
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
$this->config = $config;
+ $this->cache_dir = $cache_dir;
}
/**
@@ -60,7 +63,7 @@ class queue extends \phpbb\cron\task\base
*/
public function is_runnable()
{
- return file_exists($this->phpbb_root_path . 'cache/queue.' . $this->php_ext);
+ return file_exists($this->cache_dir . 'queue.' . $this->php_ext);
}
/**
diff --git a/phpBB/phpbb/db/driver/driver.php b/phpBB/phpbb/db/driver/driver.php
index 30cb667344..214c5590e7 100644
--- a/phpBB/phpbb/db/driver/driver.php
+++ b/phpBB/phpbb/db/driver/driver.php
@@ -1041,6 +1041,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/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/v320/notifications_board.php b/phpBB/phpbb/db/migration/data/v320/notifications_board.php
index 8a76ebab58..ac1b3a0f2c 100644
--- a/phpBB/phpbb/db/migration/data/v320/notifications_board.php
+++ b/phpBB/phpbb/db/migration/data/v320/notifications_board.php
@@ -34,7 +34,7 @@ class notifications_board extends \phpbb\db\migration\migration
public function update_module()
{
$sql = 'UPDATE ' . MODULES_TABLE . "
- SET auth = 'cfg_allow_board_notifications'
+ SET module_auth = 'cfg_allow_board_notifications'
WHERE module_basename = 'ucp_notifications'
AND module_mode = 'notification_list'";
$this->sql_query($sql);
diff --git a/phpBB/phpbb/di/container_builder.php b/phpBB/phpbb/di/container_builder.php
index 2fb248082f..7bfe1bbb87 100644
--- a/phpBB/phpbb/di/container_builder.php
+++ b/phpBB/phpbb/di/container_builder.php
@@ -522,6 +522,7 @@ class container_builder
'core.php_ext' => $this->php_ext,
'core.environment' => $this->get_environment(),
'core.debug' => defined('DEBUG') ? DEBUG : false,
+ 'core.cache_dir' => $this->get_cache_dir(),
),
$this->get_env_parameters()
);
diff --git a/phpBB/phpbb/install/console/command/install/config/show.php b/phpBB/phpbb/install/console/command/install/config/show.php
index 5d82d8d1ef..b6c11956fe 100644
--- a/phpBB/phpbb/install/console/command/install/config/show.php
+++ b/phpBB/phpbb/install/console/command/install/config/show.php
@@ -14,7 +14,6 @@
namespace phpbb\install\console\command\install\config;
use phpbb\install\helper\iohandler\factory;
-use phpbb\install\installer;
use phpbb\install\installer_configuration;
use phpbb\language\language;
use Symfony\Component\Config\Definition\Exception\Exception;
@@ -34,11 +33,6 @@ class show extends \phpbb\console\command\command
protected $iohandler_factory;
/**
- * @var installer
- */
- protected $installer;
-
- /**
* @var language
*/
protected $language;
@@ -48,12 +42,10 @@ class show extends \phpbb\console\command\command
*
* @param language $language
* @param factory $factory
- * @param installer $installer
*/
- public function __construct(language $language, factory $factory, installer $installer)
+ public function __construct(language $language, factory $factory)
{
$this->iohandler_factory = $factory;
- $this->installer = $installer;
$this->language = $language;
parent::__construct(new \phpbb\user($language, 'datetime'));
@@ -126,6 +118,6 @@ class show extends \phpbb\console\command\command
return;
}
- $iohandler->add_log_message(Yaml::dump(array('installer' => $config), 10, 4, true, false));
+ $style->block(Yaml::dump(array('installer' => $config), 10, 4, true, false));
}
}
diff --git a/phpBB/phpbb/install/console/command/install/config/validate.php b/phpBB/phpbb/install/console/command/install/config/validate.php
index 3bbbc23e34..b48a1acbd4 100644
--- a/phpBB/phpbb/install/console/command/install/config/validate.php
+++ b/phpBB/phpbb/install/console/command/install/config/validate.php
@@ -14,7 +14,6 @@
namespace phpbb\install\console\command\install\config;
use phpbb\install\helper\iohandler\factory;
-use phpbb\install\installer;
use phpbb\install\installer_configuration;
use phpbb\language\language;
use Symfony\Component\Config\Definition\Exception\Exception;
@@ -34,11 +33,6 @@ class validate extends \phpbb\console\command\command
protected $iohandler_factory;
/**
- * @var installer
- */
- protected $installer;
-
- /**
* @var language
*/
protected $language;
@@ -48,12 +42,10 @@ class validate extends \phpbb\console\command\command
*
* @param language $language
* @param factory $factory
- * @param installer $installer
*/
- public function __construct(language $language, factory $factory, installer $installer)
+ public function __construct(language $language, factory $factory)
{
$this->iohandler_factory = $factory;
- $this->installer = $installer;
$this->language = $language;
parent::__construct(new \phpbb\user($language, 'datetime'));
diff --git a/phpBB/phpbb/install/console/command/install/install.php b/phpBB/phpbb/install/console/command/install/install.php
index d76182af92..50c23f6877 100644
--- a/phpBB/phpbb/install/console/command/install/install.php
+++ b/phpBB/phpbb/install/console/command/install/install.php
@@ -109,7 +109,7 @@ class install extends \phpbb\console\command\command
if ($this->install_helper->is_phpbb_installed())
{
- $iohandler->add_error_message('PHPBB_ALREADY_INSTALLED');
+ $iohandler->add_error_message('INSTALL_PHPBB_INSTALLED');
return 1;
}
diff --git a/phpBB/phpbb/install/console/command/update/config/show.php b/phpBB/phpbb/install/console/command/update/config/show.php
new file mode 100644
index 0000000000..e462763b5d
--- /dev/null
+++ b/phpBB/phpbb/install/console/command/update/config/show.php
@@ -0,0 +1,123 @@
+<?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\install\console\command\update\config;
+
+use phpbb\install\helper\iohandler\factory;
+use phpbb\install\updater_configuration;
+use phpbb\language\language;
+use Symfony\Component\Config\Definition\Exception\Exception;
+use Symfony\Component\Config\Definition\Processor;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Console\Style\SymfonyStyle;
+use Symfony\Component\Yaml\Exception\ParseException;
+use Symfony\Component\Yaml\Yaml;
+
+class show extends \phpbb\console\command\command
+{
+ /**
+ * @var factory
+ */
+ protected $iohandler_factory;
+
+ /**
+ * @var language
+ */
+ protected $language;
+
+ /**
+ * Constructor
+ *
+ * @param language $language
+ * @param factory $factory
+ */
+ public function __construct(language $language, factory $factory)
+ {
+ $this->iohandler_factory = $factory;
+ $this->language = $language;
+
+ parent::__construct(new \phpbb\user($language, 'datetime'));
+ }
+
+ /**
+ *
+ * {@inheritdoc}
+ */
+ protected function configure()
+ {
+ $this
+ ->setName('update:config:show')
+ ->addArgument(
+ 'config-file',
+ InputArgument::REQUIRED,
+ $this->language->lang('CLI_CONFIG_FILE'))
+ ->setDescription($this->language->lang('CLI_INSTALL_SHOW_CONFIG'))
+ ;
+ }
+
+ /**
+ * Show the validated configuration
+ *
+ * @param InputInterface $input An InputInterface instance
+ * @param OutputInterface $output An OutputInterface instance
+ *
+ * @return null
+ */
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ $this->iohandler_factory->set_environment('cli');
+
+ /** @var \phpbb\install\helper\iohandler\cli_iohandler $iohandler */
+ $iohandler = $this->iohandler_factory->get();
+ $style = new SymfonyStyle($input, $output);
+ $iohandler->set_style($style, $output);
+
+ $config_file = $input->getArgument('config-file');
+
+ if (!is_file($config_file))
+ {
+ $iohandler->add_error_message(array('MISSING_FILE', $config_file));
+
+ return;
+ }
+
+ try
+ {
+ $config = Yaml::parse(file_get_contents($config_file), true, false);
+ }
+ catch (ParseException $e)
+ {
+ $iohandler->add_error_message('INVALID_YAML_FILE');
+
+ return;
+ }
+
+ $processor = new Processor();
+ $configuration = new updater_configuration();
+
+ try
+ {
+ $config = $processor->processConfiguration($configuration, $config);
+ }
+ catch (Exception $e)
+ {
+ $iohandler->add_error_message('INVALID_CONFIGURATION', $e->getMessage());
+
+ return;
+ }
+
+ $style->block(Yaml::dump(array('updater' => $config), 10, 4, true, false));
+ }
+}
diff --git a/phpBB/phpbb/install/console/command/update/config/validate.php b/phpBB/phpbb/install/console/command/update/config/validate.php
new file mode 100644
index 0000000000..18de5eab46
--- /dev/null
+++ b/phpBB/phpbb/install/console/command/update/config/validate.php
@@ -0,0 +1,124 @@
+<?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\install\console\command\update\config;
+
+use phpbb\install\helper\iohandler\factory;
+use phpbb\install\updater_configuration;
+use phpbb\language\language;
+use Symfony\Component\Config\Definition\Exception\Exception;
+use Symfony\Component\Config\Definition\Processor;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Console\Style\SymfonyStyle;
+use Symfony\Component\Yaml\Exception\ParseException;
+use Symfony\Component\Yaml\Yaml;
+
+class validate extends \phpbb\console\command\command
+{
+ /**
+ * @var factory
+ */
+ protected $iohandler_factory;
+
+ /**
+ * @var language
+ */
+ protected $language;
+
+ /**
+ * Constructor
+ *
+ * @param language $language
+ * @param factory $factory
+ */
+ public function __construct(language $language, factory $factory)
+ {
+ $this->iohandler_factory = $factory;
+ $this->language = $language;
+
+ parent::__construct(new \phpbb\user($language, 'datetime'));
+ }
+
+ /**
+ *
+ * {@inheritdoc}
+ */
+ protected function configure()
+ {
+ $this
+ ->setName('update:config:validate')
+ ->addArgument(
+ 'config-file',
+ InputArgument::REQUIRED,
+ $this->language->lang('CLI_CONFIG_FILE'))
+ ->setDescription($this->language->lang('CLI_INSTALL_VALIDATE_CONFIG'))
+ ;
+ }
+
+ /**
+ * Validate the configuration file
+ *
+ * @param InputInterface $input An InputInterface instance
+ * @param OutputInterface $output An OutputInterface instance
+ *
+ * @return null
+ */
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ $this->iohandler_factory->set_environment('cli');
+
+ /** @var \phpbb\install\helper\iohandler\cli_iohandler $iohandler */
+ $iohandler = $this->iohandler_factory->get();
+ $style = new SymfonyStyle($input, $output);
+ $iohandler->set_style($style, $output);
+
+ $config_file = $input->getArgument('config-file');
+
+ if (!is_file($config_file))
+ {
+ $iohandler->add_error_message(array('MISSING_FILE', array($config_file)));
+
+ return 1;
+ }
+
+ try
+ {
+ $config = Yaml::parse(file_get_contents($config_file), true, false);
+ }
+ catch (ParseException $e)
+ {
+ $iohandler->add_error_message('INVALID_YAML_FILE');
+
+ return 1;
+ }
+
+ $processor = new Processor();
+ $configuration = new updater_configuration();
+
+ try
+ {
+ $processor->processConfiguration($configuration, $config);
+ }
+ catch (Exception $e)
+ {
+ $iohandler->add_error_message('INVALID_CONFIGURATION', $e->getMessage());
+
+ return 1;
+ }
+
+ $iohandler->add_success_message('CONFIGURATION_VALID');
+ return 0;
+ }
+}
diff --git a/phpBB/phpbb/install/console/command/update/update.php b/phpBB/phpbb/install/console/command/update/update.php
new file mode 100644
index 0000000000..116f42f758
--- /dev/null
+++ b/phpBB/phpbb/install/console/command/update/update.php
@@ -0,0 +1,179 @@
+<?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\install\console\command\update;
+
+use phpbb\install\exception\installer_exception;
+use phpbb\install\helper\install_helper;
+use phpbb\install\helper\iohandler\cli_iohandler;
+use phpbb\install\helper\iohandler\factory;
+use phpbb\install\installer;
+use phpbb\install\updater_configuration;
+use phpbb\language\language;
+use Symfony\Component\Config\Definition\Exception\Exception;
+use Symfony\Component\Config\Definition\Processor;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Console\Style\SymfonyStyle;
+use Symfony\Component\Yaml\Exception\ParseException;
+use Symfony\Component\Yaml\Yaml;
+
+class update extends \phpbb\console\command\command
+{
+ /**
+ * @var factory
+ */
+ protected $iohandler_factory;
+
+ /**
+ * @var installer
+ */
+ protected $installer;
+
+ /**
+ * @var install_helper
+ */
+ protected $install_helper;
+
+ /**
+ * @var language
+ */
+ protected $language;
+
+ /**
+ * Constructor
+ *
+ * @param language $language
+ * @param factory $factory
+ * @param installer $installer
+ * @param install_helper $install_helper
+ */
+ public function __construct(language $language, factory $factory, installer $installer, install_helper $install_helper)
+ {
+ $this->iohandler_factory = $factory;
+ $this->installer = $installer;
+ $this->language = $language;
+ $this->install_helper = $install_helper;
+
+ parent::__construct(new \phpbb\user($language, 'datetime'));
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function configure()
+ {
+ $this
+ ->setName('update')
+ ->addArgument(
+ 'config-file',
+ InputArgument::REQUIRED,
+ $this->language->lang('CLI_CONFIG_FILE'))
+ ->setDescription($this->language->lang('CLI_UPDATE_BOARD'))
+ ;
+ }
+
+ /**
+ * Executes the command update.
+ *
+ * Update the board
+ *
+ * @param InputInterface $input An InputInterface instance
+ * @param OutputInterface $output An OutputInterface instance
+ *
+ * @return int
+ */
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ $this->iohandler_factory->set_environment('cli');
+
+ /** @var \phpbb\install\helper\iohandler\cli_iohandler $iohandler */
+ $iohandler = $this->iohandler_factory->get();
+ $style = new SymfonyStyle($input, $output);
+ $iohandler->set_style($style, $output);
+
+ $this->installer->set_iohandler($iohandler);
+
+ $config_file = $input->getArgument('config-file');
+
+ if (!$this->install_helper->is_phpbb_installed())
+ {
+ $iohandler->add_error_message('INSTALL_PHPBB_NOT_INSTALLED');
+
+ return 1;
+ }
+
+ if (!is_file($config_file))
+ {
+ $iohandler->add_error_message(array('MISSING_FILE', $config_file));
+
+ return 1;
+ }
+
+ try
+ {
+ $config = Yaml::parse(file_get_contents($config_file), true, false);
+ }
+ catch (ParseException $e)
+ {
+ $iohandler->add_error_message(array('INVALID_YAML_FILE', $config_file));
+
+ return 1;
+ }
+
+ $processor = new Processor();
+ $configuration = new updater_configuration();
+
+ try
+ {
+ $config = $processor->processConfiguration($configuration, $config);
+ }
+ catch (Exception $e)
+ {
+ $iohandler->add_error_message('INVALID_CONFIGURATION', $e->getMessage());
+
+ return 1;
+ }
+
+ $this->register_configuration($iohandler, $config);
+
+ try
+ {
+ $this->installer->run();
+ }
+ catch (installer_exception $e)
+ {
+ $iohandler->add_error_message($e->getMessage());
+ return 1;
+ }
+ }
+
+ /**
+ * Register the configuration to simulate the forms.
+ *
+ * @param cli_iohandler $iohandler
+ * @param array $config
+ */
+ private function register_configuration(cli_iohandler $iohandler, $config)
+ {
+ $iohandler->set_input('update_type', $config['type']);
+ $iohandler->set_input('submit_update', 'submit');
+
+ $iohandler->set_input('compression_method', '.tar');
+ $iohandler->set_input('method', 'direct_file');
+ $iohandler->set_input('submit_update_file', 'submit');
+
+ $iohandler->set_input('submit_continue_file_update', 'submit');
+ }
+}
diff --git a/phpBB/phpbb/install/controller/timeout_check.php b/phpBB/phpbb/install/controller/timeout_check.php
new file mode 100644
index 0000000000..1c90e3caf3
--- /dev/null
+++ b/phpBB/phpbb/install/controller/timeout_check.php
@@ -0,0 +1,80 @@
+<?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\install\controller;
+
+use Symfony\Component\HttpFoundation\JsonResponse;
+
+class timeout_check
+{
+ /**
+ * @var helper
+ */
+ protected $helper;
+
+ /**
+ * @var string
+ */
+ protected $phpbb_root_path;
+
+ /**
+ * Constructor
+ *
+ * @param helper $helper
+ * @param string $phpbb_root_path
+ */
+ public function __construct(helper $helper, $phpbb_root_path)
+ {
+ $this->helper = $helper;
+ $this->phpbb_root_path = $phpbb_root_path;
+ }
+
+ /**
+ * Controller for querying installer status
+ */
+ public function status()
+ {
+ $lock_file = $this->phpbb_root_path . 'store/io_lock.lock';
+ $response = new JsonResponse();
+
+ if (!file_exists($lock_file))
+ {
+ $response->setData(array(
+ 'status' => 'fail',
+ ));
+ }
+ else
+ {
+ $fp = @fopen($lock_file, 'r');
+
+ if ($fp && flock($fp, LOCK_EX | LOCK_NB))
+ {
+ $status = (filesize($lock_file) >= 2 && fread($fp, 2) === 'ok') ? 'continue' : 'fail';
+
+ $response->setData(array(
+ 'status' => $status,
+ ));
+ flock($fp, LOCK_UN);
+ fclose($fp);
+ }
+ else
+ {
+ $response->setData(array(
+ 'status' => 'running',
+ ));
+ }
+ }
+
+ return $response;
+ }
+}
diff --git a/phpBB/phpbb/install/event/kernel_exception_subscriber.php b/phpBB/phpbb/install/event/kernel_exception_subscriber.php
index c2960cb13c..60b7d9a400 100644
--- a/phpBB/phpbb/install/event/kernel_exception_subscriber.php
+++ b/phpBB/phpbb/install/event/kernel_exception_subscriber.php
@@ -21,6 +21,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
+use Symfony\Component\HttpFoundation\JsonResponse;
/**
* Exception handler for the installer
diff --git a/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php b/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php
index 8c62ec7bd0..c168d26425 100644
--- a/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php
+++ b/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php
@@ -44,6 +44,11 @@ class ajax_iohandler extends iohandler_base
/**
* @var string
*/
+ protected $phpbb_root_path;
+
+ /**
+ * @var string
+ */
protected $file_status;
/**
@@ -77,14 +82,20 @@ class ajax_iohandler extends iohandler_base
protected $redirect_url;
/**
+ * @var resource
+ */
+ protected $file_lock_pointer;
+
+ /**
* Constructor
*
* @param path_helper $path_helper
* @param \phpbb\request\request_interface $request HTTP request interface
* @param \phpbb\template\template $template Template engine
* @param router $router Router
+ * @param string $root_path Path to phpBB's root
*/
- public function __construct(path_helper $path_helper, \phpbb\request\request_interface $request, \phpbb\template\template $template, router $router)
+ public function __construct(path_helper $path_helper, \phpbb\request\request_interface $request, \phpbb\template\template $template, router $router, $root_path)
{
$this->path_helper = $path_helper;
$this->request = $request;
@@ -96,6 +107,7 @@ class ajax_iohandler extends iohandler_base
$this->download = array();
$this->redirect_url = array();
$this->file_status = '';
+ $this->phpbb_root_path = $root_path;
parent::__construct();
}
@@ -433,6 +445,33 @@ class ajax_iohandler extends iohandler_base
}
/**
+ * Acquires a file lock
+ */
+ public function acquire_lock()
+ {
+ $lock_file = $this->phpbb_root_path . 'store/io_lock.lock';
+ $this->file_lock_pointer = @fopen($lock_file, 'w+');
+
+ if ($this->file_lock_pointer)
+ {
+ flock($this->file_lock_pointer, LOCK_EX);
+ }
+ }
+
+ /**
+ * Release file lock
+ */
+ public function release_lock()
+ {
+ if ($this->file_lock_pointer)
+ {
+ fwrite($this->file_lock_pointer, 'ok');
+ flock($this->file_lock_pointer, LOCK_UN);
+ fclose($this->file_lock_pointer);
+ }
+ }
+
+ /**
* Callback function for language replacing
*
* @param array $matches
diff --git a/phpBB/phpbb/install/installer.php b/phpBB/phpbb/install/installer.php
index b5709e96c7..240423ae78 100644
--- a/phpBB/phpbb/install/installer.php
+++ b/phpBB/phpbb/install/installer.php
@@ -22,6 +22,7 @@ use phpbb\install\exception\resource_limit_reached_exception;
use phpbb\install\exception\user_interaction_required_exception;
use phpbb\install\helper\config;
use phpbb\install\helper\container_factory;
+use phpbb\install\helper\iohandler\ajax_iohandler;
use phpbb\install\helper\iohandler\cli_iohandler;
use phpbb\install\helper\iohandler\iohandler_interface;
use phpbb\path_helper;
@@ -126,6 +127,11 @@ class installer
*/
public function run()
{
+ if ($this->iohandler instanceof ajax_iohandler)
+ {
+ $this->iohandler->acquire_lock();
+ }
+
// Load install progress
$this->install_config->load_config();
@@ -174,7 +180,16 @@ class installer
try
{
$iterator = $this->installer_modules->getIterator();
- $iterator->seek($module_index);
+
+ if ($module_index < $iterator->count())
+ {
+ $iterator->seek($module_index);
+ }
+ else
+ {
+ $iterator->seek($module_index - 1);
+ $iterator->next();
+ }
while ($iterator->valid())
{
@@ -256,6 +271,11 @@ class installer
$fail_cleanup = true;
}
+ if ($this->iohandler instanceof ajax_iohandler)
+ {
+ $this->iohandler->release_lock();
+ }
+
if ($install_finished)
{
// Send install finished message
diff --git a/phpBB/phpbb/install/module/install_data/task/add_bots.php b/phpBB/phpbb/install/module/install_data/task/add_bots.php
index d45a6839a0..1f1cecceb2 100644
--- a/phpBB/phpbb/install/module/install_data/task/add_bots.php
+++ b/phpBB/phpbb/install/module/install_data/task/add_bots.php
@@ -214,6 +214,7 @@ class add_bots extends \phpbb\install\task_base
// If we can't insert this user then continue to the next one to avoid inconsistent data
$this->io_handler->add_error_message('CONV_ERROR_INSERT_BOT');
+ $i++;
continue;
}
diff --git a/phpBB/phpbb/install/module/obtain_data/task/obtain_update_settings.php b/phpBB/phpbb/install/module/obtain_data/task/obtain_update_settings.php
index c139b70fa4..3b24e8ba40 100644
--- a/phpBB/phpbb/install/module/obtain_data/task/obtain_update_settings.php
+++ b/phpBB/phpbb/install/module/obtain_data/task/obtain_update_settings.php
@@ -53,6 +53,14 @@ class obtain_update_settings extends task_base
if ($this->iohandler->get_input('submit_update', false))
{
$update_files = $this->iohandler->get_input('update_type', 'all') === 'all';
+
+ if ($this->installer_config->get('disable_filesystem_update', false) && $update_files)
+ {
+ $this->iohandler->add_error_message('UPDATE_FILES_NOT_FOUND');
+
+ throw new user_interaction_required_exception();
+ }
+
$this->installer_config->set('do_update_files', $update_files);
}
else
diff --git a/phpBB/phpbb/install/module/requirements/task/check_update.php b/phpBB/phpbb/install/module/requirements/task/check_update.php
index 4e9124ff47..cd66ffc8f9 100644
--- a/phpBB/phpbb/install/module/requirements/task/check_update.php
+++ b/phpBB/phpbb/install/module/requirements/task/check_update.php
@@ -122,7 +122,7 @@ 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_error_message('UPDATE_FILES_NOT_FOUND');
+ $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
diff --git a/phpBB/phpbb/install/updater_configuration.php b/phpBB/phpbb/install/updater_configuration.php
new file mode 100644
index 0000000000..e992356290
--- /dev/null
+++ b/phpBB/phpbb/install/updater_configuration.php
@@ -0,0 +1,40 @@
+<?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\install;
+
+use Symfony\Component\Config\Definition\Builder\TreeBuilder;
+use Symfony\Component\Config\Definition\ConfigurationInterface;
+
+class updater_configuration implements ConfigurationInterface
+{
+
+ /**
+ * Generates the configuration tree builder.
+ *
+ * @return \Symfony\Component\Config\Definition\Builder\TreeBuilder The tree builder
+ */
+ public function getConfigTreeBuilder()
+ {
+ $treeBuilder = new TreeBuilder();
+ $rootNode = $treeBuilder->root('updater');
+ $rootNode
+ ->addDefaultsIfNotSet()
+ ->children()
+ ->enumNode('type')->values(['all','db_only'])->defaultValue('all')->end()
+ ->end()
+ ;
+
+ return $treeBuilder;
+ }
+}
diff --git a/phpBB/phpbb/notification/manager.php b/phpBB/phpbb/notification/manager.php
index ea1b800dc5..3265bcb629 100644
--- a/phpBB/phpbb/notification/manager.php
+++ b/phpBB/phpbb/notification/manager.php
@@ -899,6 +899,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();
@@ -933,6 +935,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 97bad524e1..812cd6a911 100644
--- a/phpBB/phpbb/notification/method/messenger_base.php
+++ b/phpBB/phpbb/notification/method/messenger_base.php
@@ -104,7 +104,7 @@ abstract class messenger_base extends \phpbb\notification\method\base
$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&amp;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/routing/router.php b/phpBB/phpbb/routing/router.php
index 5d237b6433..f19886fb0b 100644
--- a/phpBB/phpbb/routing/router.php
+++ b/phpBB/phpbb/routing/router.php
@@ -49,13 +49,6 @@ class router implements RouterInterface
protected $loader;
/**
- * phpBB root path
- *
- * @var string
- */
- protected $phpbb_root_path;
-
- /**
* PHP file extensions
*
* @var string
@@ -63,13 +56,6 @@ class router implements RouterInterface
protected $php_ext;
/**
- * Name of the current environment
- *
- * @var string
- */
- protected $environment;
-
- /**
* @var \Symfony\Component\Routing\Matcher\UrlMatcherInterface|null
*/
protected $matcher;
@@ -90,24 +76,27 @@ class router implements RouterInterface
protected $route_collection;
/**
+ * @var string
+ */
+ protected $cache_dir;
+
+ /**
* Construct method
*
* @param ContainerInterface $container DI container
* @param resources_locator_interface $resources_locator Resources locator
* @param LoaderInterface $loader Resources loader
- * @param string $phpbb_root_path phpBB root path
* @param string $php_ext PHP file extension
- * @param string $environment Name of the current environment
+ * @param string $cache_dir phpBB cache directory
*/
- public function __construct(ContainerInterface $container, resources_locator_interface $resources_locator, LoaderInterface $loader, $phpbb_root_path, $php_ext, $environment)
+ public function __construct(ContainerInterface $container, resources_locator_interface $resources_locator, LoaderInterface $loader, $php_ext, $cache_dir)
{
$this->container = $container;
$this->resources_locator = $resources_locator;
$this->loader = $loader;
- $this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
- $this->environment = $environment;
$this->context = new RequestContext();
+ $this->cache_dir = $cache_dir;
}
/**
@@ -211,7 +200,7 @@ class router implements RouterInterface
{
try
{
- $cache = new ConfigCache("{$this->phpbb_root_path}cache/{$this->environment}/url_matcher.{$this->php_ext}", defined('DEBUG'));
+ $cache = new ConfigCache("{$this->cache_dir}url_matcher.{$this->php_ext}", defined('DEBUG'));
if (!$cache->isFresh())
{
$dumper = new PhpMatcherDumper($this->get_routes());
@@ -266,7 +255,7 @@ class router implements RouterInterface
{
try
{
- $cache = new ConfigCache("{$this->phpbb_root_path}cache/{$this->environment}/url_generator.{$this->php_ext}", defined('DEBUG'));
+ $cache = new ConfigCache("{$this->cache_dir}url_generator.{$this->php_ext}", defined('DEBUG'));
if (!$cache->isFresh())
{
$dumper = new PhpGeneratorDumper($this->get_routes());
diff --git a/phpBB/phpbb/textreparser/base.php b/phpBB/phpbb/textreparser/base.php
index 3e5ee248a1..afa5ccacad 100644
--- a/phpBB/phpbb/textreparser/base.php
+++ b/phpBB/phpbb/textreparser/base.php
@@ -230,7 +230,8 @@ abstract class base implements reparser_interface
$unparsed['enable_img_bbcode'],
$unparsed['enable_flash_bbcode'],
$unparsed['enable_quote_bbcode'],
- $unparsed['enable_url_bbcode']
+ $unparsed['enable_url_bbcode'],
+ 'reparse'
);
// Save the new text if it has changed and it's not a dry run
diff --git a/phpBB/phpbb/user.php b/phpBB/phpbb/user.php
index 5262e10e87..305510851c 100644
--- a/phpBB/phpbb/user.php
+++ b/phpBB/phpbb/user.php
@@ -595,7 +595,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);