aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build/build.xml6
-rw-r--r--build/code_sniffer/phpbb/Sniffs/Namespaces/UnusedUseSniff.php25
-rwxr-xr-xbuild/package.php42
-rw-r--r--phpBB/adm/style/acp_ban.html35
-rw-r--r--phpBB/adm/style/auth_provider_ldap.html2
-rw-r--r--phpBB/adm/style/overall_header.html2
-rw-r--r--phpBB/adm/style/simple_header.html1
-rw-r--r--phpBB/assets/javascript/core.js14
-rwxr-xr-xphpBB/bin/phpbbcli.php40
-rw-r--r--phpBB/common.php19
-rw-r--r--phpBB/config/console.yml26
-rw-r--r--phpBB/config/services.yml8
-rw-r--r--phpBB/cron.php3
-rw-r--r--phpBB/docs/CHANGELOG.html130
-rw-r--r--phpBB/docs/CREDITS.txt2
-rw-r--r--phpBB/docs/events.md115
-rw-r--r--phpBB/download/file.php18
-rw-r--r--phpBB/includes/acp/acp_ban.php55
-rw-r--r--phpBB/includes/acp/acp_main.php10
-rw-r--r--phpBB/includes/acp/acp_styles.php4
-rw-r--r--phpBB/includes/constants.php2
-rw-r--r--phpBB/includes/functions.php64
-rw-r--r--phpBB/includes/functions_acp.php1
-rw-r--r--phpBB/includes/functions_container.php297
-rw-r--r--phpBB/includes/functions_display.php15
-rw-r--r--phpBB/includes/functions_install.php3
-rw-r--r--phpBB/includes/functions_module.php34
-rw-r--r--phpBB/includes/functions_posting.php61
-rw-r--r--phpBB/includes/functions_privmsgs.php2
-rw-r--r--phpBB/includes/mcp/mcp_logs.php4
-rw-r--r--phpBB/includes/mcp/mcp_post.php1
-rw-r--r--phpBB/includes/questionnaire/questionnaire.php7
-rw-r--r--phpBB/includes/ucp/ucp_prefs.php36
-rw-r--r--phpBB/install/convertors/convert_phpbb20.php7
-rw-r--r--phpBB/install/database_update.php56
-rw-r--r--phpBB/install/index.php25
-rw-r--r--phpBB/install/install_convert.php32
-rw-r--r--phpBB/install/install_install.php5
-rw-r--r--phpBB/install/install_update.php16
-rw-r--r--phpBB/install/schemas/schema_data.sql2
-rw-r--r--phpBB/language/en/acp/common.php10
-rw-r--r--phpBB/language/en/cli.php78
-rw-r--r--phpBB/language/en/common.php5
-rw-r--r--phpBB/language/en/install.php4
-rw-r--r--phpBB/language/en/memberlist.php2
-rw-r--r--phpBB/language/en/posting.php2
-rw-r--r--phpBB/language/en/ucp.php6
-rw-r--r--phpBB/phpbb/config_php_file.php175
-rw-r--r--phpBB/phpbb/console/application.php29
-rw-r--r--phpBB/phpbb/console/command/cache/purge.php12
-rw-r--r--phpBB/phpbb/console/command/command.php13
-rw-r--r--phpBB/phpbb/console/command/config/command.php4
-rw-r--r--phpBB/phpbb/console/command/config/delete.php8
-rw-r--r--phpBB/phpbb/console/command/config/get.php8
-rw-r--r--phpBB/phpbb/console/command/config/increment.php10
-rw-r--r--phpBB/phpbb/console/command/config/set.php10
-rw-r--r--phpBB/phpbb/console/command/config/set_atomic.php14
-rw-r--r--phpBB/phpbb/console/command/cron/cron_list.php10
-rw-r--r--phpBB/phpbb/console/command/cron/run.php10
-rw-r--r--phpBB/phpbb/console/command/db/migrate.php12
-rw-r--r--phpBB/phpbb/console/command/dev/migration_tips.php6
-rw-r--r--phpBB/phpbb/console/command/extension/command.php4
-rw-r--r--phpBB/phpbb/console/command/extension/disable.php8
-rw-r--r--phpBB/phpbb/console/command/extension/enable.php8
-rw-r--r--phpBB/phpbb/console/command/extension/purge.php8
-rw-r--r--phpBB/phpbb/console/command/extension/show.php4
-rw-r--r--phpBB/phpbb/console/command/fixup/recalculate_email_hash.php8
-rw-r--r--phpBB/phpbb/cron/task/core/tidy_search.php8
-rw-r--r--phpBB/phpbb/db/driver/postgres.php8
-rw-r--r--phpBB/phpbb/db/migration/data/v310/rc2.php31
-rw-r--r--phpBB/phpbb/db/migration/data/v310/search_type.php34
-rw-r--r--phpBB/phpbb/db/migration/profilefield_base_migration.php91
-rw-r--r--phpBB/phpbb/db/migrator.php24
-rw-r--r--phpBB/phpbb/db/tools.php37
-rw-r--r--phpBB/phpbb/di/container_builder.php402
-rw-r--r--phpBB/phpbb/di/extension/config.php27
-rw-r--r--phpBB/phpbb/extension/manager.php5
-rw-r--r--phpBB/phpbb/log/log.php4
-rw-r--r--phpBB/phpbb/plupload/plupload.php31
-rw-r--r--phpBB/phpbb/profilefields/manager.php2
-rw-r--r--phpBB/phpbb/profilefields/type/type_googleplus.php8
-rw-r--r--phpBB/phpbb/profilefields/type/type_string_common.php11
-rw-r--r--phpBB/phpbb/template/context.php78
-rw-r--r--phpBB/phpbb/viewonline_helper.php19
-rw-r--r--phpBB/styles/prosilver/style.cfg4
-rw-r--r--phpBB/styles/prosilver/template/ajax.js11
-rw-r--r--phpBB/styles/prosilver/template/mcp_ban.html37
-rw-r--r--phpBB/styles/prosilver/template/navbar_footer.html3
-rw-r--r--phpBB/styles/prosilver/template/navbar_header.html9
-rw-r--r--phpBB/styles/prosilver/template/overall_header.html2
-rw-r--r--phpBB/styles/prosilver/template/simple_header.html2
-rw-r--r--phpBB/styles/prosilver/template/ucp_pm_viewmessage.html2
-rw-r--r--phpBB/styles/prosilver/template/ucp_prefs_personal.html4
-rw-r--r--phpBB/styles/subsilver2/style.cfg4
-rw-r--r--phpBB/styles/subsilver2/template/breadcrumbs.html6
-rw-r--r--phpBB/styles/subsilver2/template/mcp_ban.html37
-rw-r--r--phpBB/styles/subsilver2/template/overall_header.html6
-rw-r--r--phpBB/styles/subsilver2/template/simple_header.html2
-rw-r--r--phpBB/styles/subsilver2/template/ucp_pm_viewmessage.html14
-rw-r--r--phpBB/styles/subsilver2/template/ucp_prefs_personal.html2
-rw-r--r--phpBB/viewforum.php4
-rw-r--r--phpBB/viewonline.php15
-rw-r--r--phpBB/viewtopic.php43
-rw-r--r--tests/config_php_file_test.php30
-rw-r--r--tests/console/cron/cron_list_test.php2
-rw-r--r--tests/console/cron/run_test.php2
-rw-r--r--tests/dbal/db_tools_test.php3
-rw-r--r--tests/di/create_container_test.php145
-rw-r--r--tests/di/fixtures/config/services.yml14
-rw-r--r--tests/di/fixtures/ext/vendor/available/config/services.yml2
-rw-r--r--tests/di/fixtures/ext/vendor/disabled/config/services.yml2
-rw-r--r--tests/di/fixtures/ext/vendor/enabled/config/services.yml2
-rw-r--r--tests/di/fixtures/other_config/services.yml14
-rw-r--r--tests/extension/manager_test.php2
-rw-r--r--tests/fixtures/config.php3
-rw-r--r--tests/fixtures/config_other.php3
-rw-r--r--tests/functional/mcp_test.php16
-rw-r--r--tests/functional/private_messages_test.php69
-rw-r--r--tests/functions/convert_30_dbms_to_31_test.php3
-rw-r--r--tests/mock/phpbb_di_container_builder.php20
-rw-r--r--tests/profilefields/type_string_test.php10
-rw-r--r--tests/test_framework/phpbb_functional_test_case.php92
-rw-r--r--tests/test_framework/phpbb_test_case_helpers.php19
-rw-r--r--tests/viewonline/helper_test.php14
124 files changed, 2290 insertions, 899 deletions
diff --git a/build/build.xml b/build/build.xml
index 7d0068bec9..3c1a3e4db4 100644
--- a/build/build.xml
+++ b/build/build.xml
@@ -2,9 +2,9 @@
<project name="phpBB" description="The phpBB forum software" default="all" basedir="../">
<!-- a few settings for the build -->
- <property name="newversion" value="3.1.0-RC2-dev" />
- <property name="prevversion" value="3.1.0-RC1" />
- <property name="olderversions" value="3.0.12, 3.1.0-a1, 3.1.0-a2, 3.1.0-a3, 3.1.0-b1, 3.1.0-b2, 3.1.0-b3, 3.1.0-b4" />
+ <property name="newversion" value="3.1.0-RC3-dev" />
+ <property name="prevversion" value="3.1.0-RC2" />
+ <property name="olderversions" value="3.0.12, 3.1.0-a1, 3.1.0-a2, 3.1.0-a3, 3.1.0-b1, 3.1.0-b2, 3.1.0-b3, 3.1.0-b4, 3.1.0-RC1" />
<!-- no configuration should be needed beyond this point -->
<property name="oldversions" value="${olderversions}, ${prevversion}" />
diff --git a/build/code_sniffer/phpbb/Sniffs/Namespaces/UnusedUseSniff.php b/build/code_sniffer/phpbb/Sniffs/Namespaces/UnusedUseSniff.php
index 16e3427bd9..f81ec46579 100644
--- a/build/code_sniffer/phpbb/Sniffs/Namespaces/UnusedUseSniff.php
+++ b/build/code_sniffer/phpbb/Sniffs/Namespaces/UnusedUseSniff.php
@@ -153,19 +153,24 @@ class phpbb_Sniffs_Namespaces_UnusedUseSniff implements PHP_CodeSniffer_Sniff
$start_argument = $phpcsFile->findPrevious(array(T_OPEN_PARENTHESIS, T_COMMA), $argument);
$argument_class_name_start = $phpcsFile->findNext(array(T_NS_SEPARATOR, T_STRING), ($start_argument + 1), $argument);
- $argument_class_name_end = $phpcsFile->findNext($find, ($argument_class_name_start + 1), null, true);
- $argument_class_name = $phpcsFile->getTokensAsString($argument_class_name_start, ($argument_class_name_end - $argument_class_name_start - 1));
-
- if ($argument_class_name === $class_name_full)
+ // Skip the parameter if no type is defined.
+ if ($argument_class_name_start !== false)
{
- $error = 'Either use statement or full name must be used.';
- $phpcsFile->addError($error, $function_declaration, 'FullName');
- }
+ $argument_class_name_end = $phpcsFile->findNext($find, ($argument_class_name_start + 1), null, true);
- if ($argument_class_name === $class_name_short)
- {
- $ok = true;
+ $argument_class_name = $phpcsFile->getTokensAsString($argument_class_name_start, ($argument_class_name_end - $argument_class_name_start - 1));
+
+ if ($argument_class_name === $class_name_full)
+ {
+ $error = 'Either use statement or full name must be used.';
+ $phpcsFile->addError($error, $function_declaration, 'FullName');
+ }
+
+ if ($argument_class_name === $class_name_short)
+ {
+ $ok = true;
+ }
}
}
}
diff --git a/build/package.php b/build/package.php
index d66238e471..c0db0c4011 100755
--- a/build/package.php
+++ b/build/package.php
@@ -195,12 +195,6 @@ if (sizeof($package->old_packages))
* referenced files from the same or subsequent directories.
*/
$copy_relative_directories = array(
- 'adm/style/admin.css' => array(
- 'copied' => false,
- 'copy' => array(
- 'adm/images/*' => 'adm/images',
- ),
- ),
'config/' => array(
'copied' => false,
'copy' => array(
@@ -269,6 +263,42 @@ if (sizeof($package->old_packages))
}
}
+ /**
+ * We need to always copy the template and asset files that we need in
+ * the update, to ensure that the page is displayed correctly.
+ */
+ $copy_update_files = array(
+ 'adm/images/*' => 'adm/images',
+ 'adm/style/admin.css' => 'adm/style',
+ 'adm/style/admin.js' => 'adm/style',
+ 'adm/style/ajax.js' => 'adm/style',
+ 'adm/style/install_*' => 'adm/style',
+ 'assets/javascript/*' => 'assets/javascript',
+ );
+
+ foreach ($copy_update_files as $source_files => $destination_dir)
+ {
+ // Create directories along the way?
+ $directories = explode('/', $destination_dir);
+
+ chdir($dest_filename_dir . '/install/update/new');
+ foreach ($directories as $dir)
+ {
+ $dir = trim($dir);
+ if ($dir)
+ {
+ if (!file_exists('./' . $dir))
+ {
+ $package->run_command('mkdir ' . $dir);
+ }
+ chdir('./' . $dir);
+ }
+ }
+ $source_dir_files = $package->locations['old_versions'] . $package->get('simple_name') . '/' . $source_files;
+ $destination_dir = $dest_filename_dir . '/install/update/new/' . $destination_dir;
+ $package->run_command('cp ' . $source_dir_files . ' ' . $destination_dir);
+ }
+
// Build index.php file for holding the file structure
$index_contents = '<?php
diff --git a/phpBB/adm/style/acp_ban.html b/phpBB/adm/style/acp_ban.html
index 71c737de70..9e9f05120a 100644
--- a/phpBB/adm/style/acp_ban.html
+++ b/phpBB/adm/style/acp_ban.html
@@ -13,27 +13,34 @@
var ban_length = new Array();
ban_length[-1] = '';
- <!-- BEGIN ban_length -->
- ban_length['{ban_length.BAN_ID}'] = '{ban_length.A_LENGTH}';
- <!-- END ban_length -->
-
var ban_reason = new Array();
ban_reason[-1] = '';
- <!-- BEGIN ban_reason -->
- ban_reason['{ban_reason.BAN_ID}'] = '{ban_reason.A_REASON}';
- <!-- END ban_reason -->
-
var ban_give_reason = new Array();
ban_give_reason[-1] = '';
- <!-- BEGIN ban_give_reason -->
- ban_give_reason['{ban_give_reason.BAN_ID}'] = '{ban_give_reason.A_REASON}';
- <!-- END ban_give_reason -->
+
+ <!-- BEGIN bans -->
+ ban_length['{bans.BAN_ID}'] = '{bans.A_LENGTH}';
+ <!-- IF bans.A_REASON -->
+ ban_reason['{bans.BAN_ID}'] = '{bans.A_REASON}';
+ <!-- ENDIF -->
+ <!-- IF bans.A_GIVE_REASON -->
+ ban_give_reason['{bans.BAN_ID}'] = '{bans.A_GIVE_REASON}';
+ <!-- ENDIF -->
+ <!-- END bans -->
function display_details(option)
{
- document.getElementById('acp_unban').unbangivereason.innerHTML = ban_give_reason[option];
- document.getElementById('acp_unban').unbanreason.innerHTML = ban_reason[option];
- document.getElementById('acp_unban').unbanlength.value = ban_length[option];
+ document.getElementById('unbanlength').value = ban_length[option];
+ if (option in ban_reason) {
+ document.getElementById('unbanreason').innerHTML = ban_reason[option];
+ } else {
+ document.getElementById('unbanreason').innerHTML = '';
+ }
+ if (option in ban_give_reason) {
+ document.getElementById('unbangivereason').innerHTML = ban_give_reason[option];
+ } else {
+ document.getElementById('unbangivereason').innerHTML = '';
+ }
}
// ]]>
diff --git a/phpBB/adm/style/auth_provider_ldap.html b/phpBB/adm/style/auth_provider_ldap.html
index 9e0567dfed..97684db396 100644
--- a/phpBB/adm/style/auth_provider_ldap.html
+++ b/phpBB/adm/style/auth_provider_ldap.html
@@ -22,7 +22,7 @@
</dl>
<dl>
<dt><label for="ldap_email">{L_LDAP_EMAIL}{L_COLON}</label><br /><span>{L_LDAP_EMAIL_EXPLAIN}</span></dt>
- <dd><input type="email" id="ldap_email" size="40" name="config[ldap_email]" value="{AUTH_LDAP_EMAIL}" /></dd>
+ <dd><input type="text" id="ldap_email" size="40" name="config[ldap_email]" value="{AUTH_LDAP_EMAIL}" /></dd>
</dl>
<dl>
<dt><label for="ldap_user">{L_LDAP_USER}{L_COLON}</label><br /><span>{L_LDAP_USER_EXPLAIN}</span></dt>
diff --git a/phpBB/adm/style/overall_header.html b/phpBB/adm/style/overall_header.html
index afd2b94924..f1f7eee282 100644
--- a/phpBB/adm/style/overall_header.html
+++ b/phpBB/adm/style/overall_header.html
@@ -89,6 +89,8 @@ function popup(url, width, height, name)
{$STYLESHEETS}
+<!-- EVENT acp_overall_header_stylesheets_after -->
+
</head>
<body class="{S_CONTENT_DIRECTION} {BODY_CLASS} nojs">
diff --git a/phpBB/adm/style/simple_header.html b/phpBB/adm/style/simple_header.html
index bf8f41cd7a..d0b9bf62ed 100644
--- a/phpBB/adm/style/simple_header.html
+++ b/phpBB/adm/style/simple_header.html
@@ -84,6 +84,7 @@ function find_username(url)
</script>
<!-- EVENT acp_simple_header_head_append -->
{$STYLESHEETS}
+<!-- EVENT acp_simple_header_stylesheets_after -->
</head>
<body class="{S_CONTENT_DIRECTION} {BODY_CLASS}">
diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js
index 2c35875dca..388f31698f 100644
--- a/phpBB/assets/javascript/core.js
+++ b/phpBB/assets/javascript/core.js
@@ -48,6 +48,18 @@ phpbb.clearLoadingTimeout = function() {
}
};
+
+/**
+* Close popup alert after a specified delay
+*
+* @param int Delay in ms until darkenwrapper's click event is triggered
+*/
+phpbb.closeDarkenWrapper = function(delay) {
+ phpbbAlertTimer = setTimeout(function() {
+ $('#darkenwrapper').trigger('click');
+ }, delay);
+};
+
/**
* Display a simple alert similar to JSs native alert().
*
@@ -272,7 +284,7 @@ phpbb.ajaxify = function(options) {
* Handler for AJAX errors
*/
function errorHandler(jqXHR, textStatus, errorThrown) {
- if (console && console.log) {
+ if (typeof console !== 'undefined' && console.log) {
console.log('AJAX error. status: ' + textStatus + ', message: ' + errorThrown);
}
phpbb.clearLoadingTimeout();
diff --git a/phpBB/bin/phpbbcli.php b/phpBB/bin/phpbbcli.php
index 8b8d8e43fd..ca425ad0c4 100755
--- a/phpBB/bin/phpbbcli.php
+++ b/phpBB/bin/phpbbcli.php
@@ -12,6 +12,8 @@
*
*/
+use Symfony\Component\Console\Input\ArgvInput;
+
if (php_sapi_name() != 'cli')
{
echo 'This program must be run from the command line.' . PHP_EOL;
@@ -22,26 +24,44 @@ define('IN_PHPBB', true);
$phpbb_root_path = __DIR__ . '/../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
require($phpbb_root_path . 'includes/startup.' . $phpEx);
-require($phpbb_root_path . 'config.' . $phpEx);
+require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx);
+
+$phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx);
+$phpbb_class_loader->register();
+
+$phpbb_config_php_file = new \phpbb\config_php_file($phpbb_root_path, $phpEx);
+extract($phpbb_config_php_file->get_all());
+
require($phpbb_root_path . 'includes/constants.' . $phpEx);
require($phpbb_root_path . 'includes/functions.' . $phpEx);
require($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
-require($phpbb_root_path . 'includes/functions_container.' . $phpEx);
require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
-require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx);
-$phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx);
-$phpbb_class_loader->register();
-$phpbb_class_loader_ext = new \phpbb\class_loader('\\', "{$phpbb_root_path}ext/", $phpEx);
-$phpbb_class_loader_ext->register();
+$phpbb_container_builder = new \phpbb\di\container_builder($phpbb_config_php_file, $phpbb_root_path, $phpEx);
+$phpbb_container_builder->set_dump_container(false);
+
+$input = new ArgvInput();
+
+if ($input->hasParameterOption(array('--safe-mode')))
+{
+ $phpbb_container_builder->set_use_extensions(false);
+ $phpbb_container_builder->set_dump_container(false);
+}
+else
+{
+ $phpbb_class_loader_ext = new \phpbb\class_loader('\\', "{$phpbb_root_path}ext/", $phpEx);
+ $phpbb_class_loader_ext->register();
+ phpbb_load_extensions_autoloaders($phpbb_root_path);
+}
-$phpbb_container = phpbb_create_update_container($phpbb_root_path, $phpEx, "$phpbb_root_path/config");
+$phpbb_container = $phpbb_container_builder->get_container();
$phpbb_container->get('request')->enable_super_globals();
require($phpbb_root_path . 'includes/compatibility_globals.' . $phpEx);
$user = $phpbb_container->get('user');
$user->add_lang('acp/common');
+$user->add_lang('cli');
$application = new \phpbb\console\application('phpBB Console', PHPBB_VERSION, $user);
-$application->register_container_commands($phpbb_container);
-$application->run();
+$application->register_container_commands($phpbb_container->get('console.command_collection'));
+$application->run($input);
diff --git a/phpBB/common.php b/phpBB/common.php
index e96a34938a..f6586c40fe 100644
--- a/phpBB/common.php
+++ b/phpBB/common.php
@@ -21,11 +21,13 @@ if (!defined('IN_PHPBB'))
}
require($phpbb_root_path . 'includes/startup.' . $phpEx);
+require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx);
-if (file_exists($phpbb_root_path . 'config.' . $phpEx))
-{
- require($phpbb_root_path . 'config.' . $phpEx);
-}
+$phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx);
+$phpbb_class_loader->register();
+
+$phpbb_config_php_file = new \phpbb\config_php_file($phpbb_root_path, $phpEx);
+extract($phpbb_config_php_file->get_all());
if (!defined('PHPBB_INSTALLED'))
{
@@ -76,11 +78,8 @@ $phpbb_adm_relative_path = (isset($phpbb_adm_relative_path)) ? $phpbb_adm_relati
$phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $phpbb_adm_relative_path;
// Include files
-require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx);
-
require($phpbb_root_path . 'includes/functions.' . $phpEx);
require($phpbb_root_path . 'includes/functions_content.' . $phpEx);
-require($phpbb_root_path . 'includes/functions_container.' . $phpEx);
include($phpbb_root_path . 'includes/functions_compatibility.' . $phpEx);
require($phpbb_root_path . 'includes/constants.' . $phpEx);
@@ -89,16 +88,14 @@ require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
// Set PHP error handler to ours
set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler');
-// Setup class loader first
-$phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx);
-$phpbb_class_loader->register();
$phpbb_class_loader_ext = new \phpbb\class_loader('\\', "{$phpbb_root_path}ext/", $phpEx);
$phpbb_class_loader_ext->register();
phpbb_load_extensions_autoloaders($phpbb_root_path);
// Set up container
-$phpbb_container = phpbb_create_default_container($phpbb_root_path, $phpEx);
+$phpbb_container_builder = new \phpbb\di\container_builder($phpbb_config_php_file, $phpbb_root_path, $phpEx);
+$phpbb_container = $phpbb_container_builder->get_container();
$phpbb_class_loader->set_cache($phpbb_container->get('cache.driver'));
$phpbb_class_loader_ext->set_cache($phpbb_container->get('cache.driver'));
diff --git a/phpBB/config/console.yml b/phpBB/config/console.yml
index 00b8f9cec0..540908164a 100644
--- a/phpBB/config/console.yml
+++ b/phpBB/config/console.yml
@@ -1,12 +1,19 @@
services:
+ console.command_collection:
+ class: phpbb\di\service_collection
+ arguments:
+ - @service_container
+ tags:
+ - { name: service_collection, tag: console.command }
+
console.command.cache.purge:
class: phpbb\console\command\cache\purge
arguments:
+ - @user
- @cache.driver
- @dbal.conn
- @auth
- @log
- - @user
- @config
tags:
- { name: console.command }
@@ -14,6 +21,7 @@ services:
console.command.config.delete:
class: phpbb\console\command\config\delete
arguments:
+ - @user
- @config
tags:
- { name: console.command }
@@ -21,6 +29,7 @@ services:
console.command.config.increment:
class: phpbb\console\command\config\increment
arguments:
+ - @user
- @config
tags:
- { name: console.command }
@@ -28,6 +37,7 @@ services:
console.command.config.get:
class: phpbb\console\command\config\get
arguments:
+ - @user
- @config
tags:
- { name: console.command }
@@ -35,6 +45,7 @@ services:
console.command.config.set:
class: phpbb\console\command\config\set
arguments:
+ - @user
- @config
tags:
- { name: console.command }
@@ -42,6 +53,7 @@ services:
console.command.config.set_atomic:
class: phpbb\console\command\config\set_atomic
arguments:
+ - @user
- @config
tags:
- { name: console.command }
@@ -49,35 +61,36 @@ services:
console.command.cron.list:
class: phpbb\console\command\cron\cron_list
arguments:
- - @cron.manager
- @user
+ - @cron.manager
tags:
- { name: console.command }
console.command.cron.run:
class: phpbb\console\command\cron\run
arguments:
+ - @user
- @cron.manager
- @cron.lock_db
- - @user
tags:
- { name: console.command }
console.command.db.migrate:
class: phpbb\console\command\db\migrate
arguments:
+ - @user
- @migrator
- @ext.manager
- @config
- @cache
- @log
- - @user
tags:
- { name: console.command }
console.command.dev.migration_tips:
class: phpbb\console\command\dev\migration_tips
arguments:
+ - @user
- @ext.manager
tags:
- { name: console.command }
@@ -85,6 +98,7 @@ services:
console.command.extension.disable:
class: phpbb\console\command\extension\disable
arguments:
+ - @user
- @ext.manager
- @log
tags:
@@ -93,6 +107,7 @@ services:
console.command.extension.enable:
class: phpbb\console\command\extension\enable
arguments:
+ - @user
- @ext.manager
- @log
tags:
@@ -101,6 +116,7 @@ services:
console.command.extension.purge:
class: phpbb\console\command\extension\purge
arguments:
+ - @user
- @ext.manager
- @log
tags:
@@ -109,6 +125,7 @@ services:
console.command.extension.show:
class: phpbb\console\command\extension\show
arguments:
+ - @user
- @ext.manager
- @log
tags:
@@ -117,6 +134,7 @@ services:
console.command.fixup.recalculate_email_hash:
class: phpbb\console\command\fixup\recalculate_email_hash
arguments:
+ - @user
- @dbal.conn
tags:
- { name: console.command }
diff --git a/phpBB/config/services.yml b/phpBB/config/services.yml
index a7e708d492..b4e387bd73 100644
--- a/phpBB/config/services.yml
+++ b/phpBB/config/services.yml
@@ -39,9 +39,6 @@ services:
cache.driver:
class: %cache.driver.class%
- cache.driver.install:
- class: phpbb\cache\driver\file
-
class_loader:
class: phpbb\class_loader
arguments:
@@ -69,6 +66,9 @@ services:
- @cache.driver
- %tables.config%
+ config.php:
+ synthetic: true
+
config_text:
class: phpbb\config\db_text
arguments:
@@ -364,3 +364,5 @@ services:
viewonline_helper:
class: phpbb\viewonline_helper
+ arguments:
+ - @filesystem
diff --git a/phpBB/cron.php b/phpBB/cron.php
index 8bb49bd5d2..3f022b1db8 100644
--- a/phpBB/cron.php
+++ b/phpBB/cron.php
@@ -62,8 +62,9 @@ if ($cron_lock->acquire())
if ($task->is_ready())
{
$task->run();
- garbage_collection();
}
}
$cron_lock->release();
}
+
+garbage_collection();
diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html
index 2a824fa9b7..71971108b1 100644
--- a/phpBB/docs/CHANGELOG.html
+++ b/phpBB/docs/CHANGELOG.html
@@ -46,6 +46,7 @@
<ol>
<li><a href="#changelog">Changelog</a>
<ol style="list-style-type: lower-roman;">
+ <li><a href="#v310b3">Changes since 3.1.0-RC1</a></li>
<li><a href="#v310b3">Changes since 3.1.0-b4</a></li>
<li><a href="#v310b3">Changes since 3.1.0-b3</a></li>
<li><a href="#v310b2">Changes since 3.1.0-b2</a></li>
@@ -94,7 +95,78 @@
<div class="content">
- <a name="v310b4"></a><h3>1.i. Changes since 3.1.0-b4</h3>
+ <a name="v310RC1"></a><h3>1.i. Changes since 3.1.0-RC1</h3>
+
+ <h4>Bug</h4>
+ <ul>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-9801">PHPBB3-9801</a>] - Users on custom pages outside the board directory are being displayed on Index page</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11392">PHPBB3-11392</a>] - &quot;Make normal&quot; in quickmod tool does not ajaxify correctly</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12325">PHPBB3-12325</a>] - Automatic update should notify about outdated files</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12420">PHPBB3-12420</a>] - Reduce config.php inclusions in DIC code</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12446">PHPBB3-12446</a>] - Unnecessary db connect - function phpbb_bootstrap_enabled_exts</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12462">PHPBB3-12462</a>] - Do not use string &quot;None&quot; for different avatar options</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12515">PHPBB3-12515</a>] - FULLTEXT_POSTGRES_TS_NOT_USABLE and FULLTEXT_POSTGRES_VERSION_CHECK_EXPLAIN redundant</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12605">PHPBB3-12605</a>] - Make dropdowns uniform</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12674">PHPBB3-12674</a>] - Last edited by in PMs doesn't show user colour</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12680">PHPBB3-12680</a>] - Contact icons in viewtopic are missing alternative text</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12695">PHPBB3-12695</a>] - Undefined index: MISSING_INLINE_ATTACHMENT notice given when viewing post details</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12716">PHPBB3-12716</a>] - Wrong method call in phpbb\auth\provider\oauth\token_storage</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12759">PHPBB3-12759</a>] - Profile fields lang value db queries can cause query flood</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12760">PHPBB3-12760</a>] - Post approval icon for wrong topics in Last Post column</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12764">PHPBB3-12764</a>] - Wrong error message on install if mysqli is selected and the credentials are wrong</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12766">PHPBB3-12766</a>] - Event exporter does not like RCx as version</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12768">PHPBB3-12768</a>] - 'NOTIFICATION_REPORT_CLOSED' entry has wrong indentation</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12771">PHPBB3-12771</a>] - Bug in \phpbb\db\migration\profilefield_base_migration when used in extensions</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12772">PHPBB3-12772</a>] - Fatal error when &quot;Email topic&quot; is used in topic tools</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12773">PHPBB3-12773</a>] - Fix language variable name in cli extension enable command</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12774">PHPBB3-12774</a>] - Undefined variable $phpbb_adm_relative_path in phpbb_create_install_container()</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12781">PHPBB3-12781</a>] - Template regex for DEFINE has problems when enclosed by other template conditionals</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12783">PHPBB3-12783</a>] - Remove require: phpbb/phpbb from Extensions composer.json files</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12787">PHPBB3-12787</a>] - Incorrect generated url when using ajax and routing</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12788">PHPBB3-12788</a>] - Update Symfony suite from 2.3.12 to 2.3.16</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12790">PHPBB3-12790</a>] - Always use the interface when available (and not directly the class)</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12802">PHPBB3-12802</a>] - Properly handle connection errors in SQLite3</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12808">PHPBB3-12808</a>] - Small gap between username and drop-down arrow</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12810">PHPBB3-12810</a>] - In acp_forums the displayed value for prune_shadow_freq is the value of prune_freq</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12811">PHPBB3-12811</a>] - Margin Bottom not taking effect in Safari with 101% height on same element</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12815">PHPBB3-12815</a>] - Members list link hidden from guests who have permission to view members list page</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12816">PHPBB3-12816</a>] - Fix comment about logs in user_ban function</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12818">PHPBB3-12818</a>] - Deleting a log entry in MCP produces a General error</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12819">PHPBB3-12819</a>] - Wrong text on hover over &quot;Jump to page&quot; field</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12825">PHPBB3-12825</a>] - Allow the extensions to be tested with the sniffer and skip the vendors</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12830">PHPBB3-12830</a>] - .postlink is in colours.css doubled, one should be deleted</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12834">PHPBB3-12834</a>] - Viewonline only matches routes</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12839">PHPBB3-12839</a>] - Missing stylesheet when it is not updated</li>
+ </ul>
+ <h4>Improvement</h4>
+ <ul>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12013">PHPBB3-12013</a>] - Quickmod tools and jumpbox should use new dropdown</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12099">PHPBB3-12099</a>] - path_helper returns wrong web root path for ajax requests</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12196">PHPBB3-12196</a>] - Referer vs Referrer in language files</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12197">PHPBB3-12197</a>] - Fix misleading FAQ entries</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12334">PHPBB3-12334</a>] - Add raw values of profile fields to template</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12562">PHPBB3-12562</a>] - Prosilver has no max-width</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12645">PHPBB3-12645</a>] - Update support links to 3.1 forums</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12662">PHPBB3-12662</a>] - Reorganize and modernize the header navbar</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12735">PHPBB3-12735</a>] - Remove all :link, :visited, :active link states</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12777">PHPBB3-12777</a>] - Rename extension status functions and add is_configured()</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12779">PHPBB3-12779</a>] - Change order of file lists on automatic update</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12782">PHPBB3-12782</a>] - Use an interface for the phpbb event_dispatcher</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12784">PHPBB3-12784</a>] - Allow the extensions to add a custom auto loader</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12786">PHPBB3-12786</a>] - Extend profilefield_base_migration.php class</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12812">PHPBB3-12812</a>] - Add a migrator tool for config_text database changes</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12813">PHPBB3-12813</a>] - Improve responsive pagination location and fix page-jump title</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12823">PHPBB3-12823</a>] - Remove trailing whitespace from CSS files</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12824">PHPBB3-12824</a>] - Move ACP &amp; MCP links in the header to the end of the link list</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12827">PHPBB3-12827</a>] - Reorder quick-links</li>
+ </ul>
+ <h4>Task</h4>
+ <ul>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12775">PHPBB3-12775</a>] - Refactor functions_container into class container_builder</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12829">PHPBB3-12829</a>] - Remove check for pgsql 8.3/8.2</li>
+ </ul>
+
+ <a name="v310b4"></a><h3>1.ii. Changes since 3.1.0-b4</h3>
<h4>Bug</h4>
<ul>
@@ -214,7 +286,7 @@
</ul>
- <a name="v310b3"></a><h3>1.ii. Changes since 3.1.0-b3</h3>
+ <a name="v310b3"></a><h3>1.iii. Changes since 3.1.0-b3</h3>
<h4>Bug</h4>
<ul>
@@ -321,7 +393,7 @@
</ul>
- <a name="v310b2"></a><h3>1.iii. Changes since 3.1.0-b2</h3>
+ <a name="v310b2"></a><h3>1.iv. Changes since 3.1.0-b2</h3>
<h4>Bug</h4>
<ul>
@@ -486,7 +558,7 @@
</ul>
- <a name="v310b1"></a><h3>1.iv. Changes since 3.1.0-b1</h3>
+ <a name="v310b1"></a><h3>1.v. Changes since 3.1.0-b1</h3>
<h4>Bug</h4>
<ul>
@@ -554,7 +626,7 @@
<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12302">PHPBB3-12302</a>] - Upgrade composer.phar to 1.0.0-alpha8</li>
</ul>
- <a name="v310a3"></a><h3>1.v. Changes since 3.1.0-a3</h3>
+ <a name="v310a3"></a><h3>1.vi. Changes since 3.1.0-a3</h3>
<h4>Bug</h4>
<ul>
@@ -701,7 +773,7 @@
</ul>
- <a name="v310a2"></a><h3>1.vi. Changes since 3.1.0-a2</h3>
+ <a name="v310a2"></a><h3>1.vii. Changes since 3.1.0-a2</h3>
<h4>Bug</h4>
<ul>
@@ -809,7 +881,7 @@
<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12147">PHPBB3-12147</a>] - Remove Travis CI notification configuration</li>
</ul>
- <a name="v310a1"></a><h3>1.vii. Changes since 3.1.0-a1</h3>
+ <a name="v310a1"></a><h3>1.viii. Changes since 3.1.0-a1</h3>
<h4>Bug</h4>
<ul>
@@ -885,7 +957,7 @@
<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11998">PHPBB3-11998</a>] - Add console / command line client environment </li>
</ul>
- <a name="v30x"></a><h3>1.viii. Changes since 3.0.x</h3>
+ <a name="v30x"></a><h3>1.ix. Changes since 3.0.x</h3>
<h4>Bug</h4>
<ul>
@@ -1566,7 +1638,7 @@
<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11913">PHPBB3-11913</a>] - Apply reorganisation of download.phpbb.com to build_announcement.php</li>
</ul>
- <a name="v3011"></a><h3>1.ix. Changes since 3.0.11</h3>
+ <a name="v3011"></a><h3>1.x. Changes since 3.0.11</h3>
<h4>Bug</h4>
<ul>
@@ -1721,7 +1793,7 @@
<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11753">PHPBB3-11753</a>] - Upgrade mysql_upgrader.php schema data.</li>
</ul>
- <a name="v3010"></a><h3>1.x. Changes since 3.0.10</h3>
+ <a name="v3010"></a><h3>1.xi. Changes since 3.0.10</h3>
<h4>Bug</h4>
<ul>
@@ -1846,7 +1918,7 @@
<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10909">PHPBB3-10909</a>] - Update Travis Test Configuration: Travis no longer supports PHP 5.3.2</li>
</ul>
- <a name="v309"></a><h3>1.xi. Changes since 3.0.9</h3>
+ <a name="v309"></a><h3>1.xii. Changes since 3.0.9</h3>
<h4>Bug</h4>
<ul>
@@ -1982,7 +2054,7 @@
<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10480">PHPBB3-10480</a>] - Automate changelog building</li>
</ul>
- <a name="v308"></a><h3>1.xii. Changes since 3.0.8</h3>
+ <a name="v308"></a><h3>1.xiii. Changes since 3.0.8</h3>
<h4> Bug
</h4>
@@ -2350,7 +2422,7 @@
</ul>
- <a name="v307-PL1"></a><h3>1.xiii. Changes since 3.0.7-PL1</h3>
+ <a name="v307-PL1"></a><h3>1.xiv. Changes since 3.0.7-PL1</h3>
<h4> Security
</h4>
<ul>
@@ -2808,13 +2880,13 @@
</ul>
- <a name="v307"></a><h3>1.xiv. Changes since 3.0.7</h3>
+ <a name="v307"></a><h3>1.xv. Changes since 3.0.7</h3>
<ul>
<li>[Sec] Do not expose forum content of forums with ACL entries but no actual permission in ATOM Feeds. (Bug #58595)</li>
</ul>
- <a name="v306"></a><h3>1.xv. Changes since 3.0.6</h3>
+ <a name="v306"></a><h3>1.xvi. Changes since 3.0.6</h3>
<ul>
<li>[Fix] Allow ban reason and length to be selected and copied in ACP and subsilver2 MCP. (Bug #51095)</li>
@@ -2918,7 +2990,7 @@
</ul>
- <a name="v305"></a><h3>1.xvi. Changes since 3.0.5</h3>
+ <a name="v305"></a><h3>1.xvii. Changes since 3.0.5</h3>
<ul>
<li>[Fix] Allow whitespaces in avatar gallery names. (Bug #44955)</li>
@@ -3140,7 +3212,7 @@
<li>[Feature] Send anonymous statistical information to phpBB on installation and update (optional).</li>
</ul>
- <a name="v304"></a><h3>1.xvii. Changes since 3.0.4</h3>
+ <a name="v304"></a><h3>1.xviii. Changes since 3.0.4</h3>
<ul>
<li>[Fix] Delete user entry from ban list table upon user deletion (Bug #40015 - Patch by TerraFrost)</li>
@@ -3229,7 +3301,7 @@
<li>[Sec] Only use forum id supplied for posting if global announcement detected. (Reported by nickvergessen)</li>
</ul>
- <a name="v303"></a><h3>1.xviii. Changes since 3.0.3</h3>
+ <a name="v303"></a><h3>1.xix. Changes since 3.0.3</h3>
<ul>
<li>[Fix] Allow mixed-case template directories to be inherited (Bug #36725)</li>
@@ -3261,7 +3333,7 @@
<li>[Sec] Ask for forum password if post within passworded forum quoted in private message. (Reported by nickvergessen)</li>
</ul>
- <a name="v302"></a><h3>1.xix. Changes since 3.0.2</h3>
+ <a name="v302"></a><h3>1.xx. Changes since 3.0.2</h3>
<ul>
<li>[Fix] Correctly set topic starter if first post in topic removed (Bug #30575 - Patch by blueray2048)</li>
@@ -3360,7 +3432,7 @@
<li>[Sec Precaution] Stricter validation of the HTTP_HOST header (Thanks to Techie-Micheal et al for pointing out possible issues in derived code)</li>
</ul>
- <a name="v301"></a><h3>1.xx. Changes since 3.0.1</h3>
+ <a name="v301"></a><h3>1.xxi. Changes since 3.0.1</h3>
<ul>
<li>[Fix] Ability to set permissions on non-mysql dbms (Bug #24955)</li>
@@ -3408,7 +3480,7 @@
<li>[Sec] Only allow urls gone through redirect() being used within login_box(). (thanks nookieman)</li>
</ul>
- <a name="v300"></a><h3>1.xxi. Changes since 3.0.0</h3>
+ <a name="v300"></a><h3>1.xxii. Changes since 3.0.0</h3>
<ul>
<li>[Change] Validate birthdays (Bug #15004)</li>
@@ -3479,7 +3551,7 @@
<li>[Fix] Find and display colliding usernames correctly when converting from one database to another (Bug #23925)</li>
</ul>
- <a name="v30rc8"></a><h3>1.xxii. Changes since 3.0.RC8</h3>
+ <a name="v30rc8"></a><h3>1.xxiii. Changes since 3.0.RC8</h3>
<ul>
<li>[Fix] Cleaned usernames contain only single spaces, so &quot;a_name&quot; and &quot;a__name&quot; are treated as the same name (Bug #15634)</li>
@@ -3488,7 +3560,7 @@
<li>[Fix] Call garbage_collection() within database updater to correctly close connections (affects Oracle for example)</li>
</ul>
- <a name="v30rc7"></a><h3>1.xxiii. Changes since 3.0.RC7</h3>
+ <a name="v30rc7"></a><h3>1.xxiv. Changes since 3.0.RC7</h3>
<ul>
<li>[Fix] Fixed MSSQL related bug in the update system</li>
@@ -3523,7 +3595,7 @@
<li>[Fix] No duplication of active topics (Bug #15474)</li>
</ul>
- <a name="v30rc6"></a><h3>1.xxiv. Changes since 3.0.RC6</h3>
+ <a name="v30rc6"></a><h3>1.xxv. Changes since 3.0.RC6</h3>
<ul>
<li>[Fix] Submitting language changes using acp_language (Bug #14736)</li>
@@ -3533,7 +3605,7 @@
<li>[Fix] Able to request new password (Bug #14743)</li>
</ul>
- <a name="v30rc5"></a><h3>1.xxv. Changes since 3.0.RC5</h3>
+ <a name="v30rc5"></a><h3>1.xxvi. Changes since 3.0.RC5</h3>
<ul>
<li>[Feature] Removing constant PHPBB_EMBEDDED in favor of using an exit_handler(); the constant was meant to achive this more or less.</li>
@@ -3596,7 +3668,7 @@
<li>[Sec] New password hashing mechanism for storing passwords (#i42)</li>
</ul>
- <a name="v30rc4"></a><h3>1.xxvi. Changes since 3.0.RC4</h3>
+ <a name="v30rc4"></a><h3>1.xxvii. Changes since 3.0.RC4</h3>
<ul>
<li>[Fix] MySQL, PostgreSQL and SQLite related database fixes (Bug #13862)</li>
@@ -3647,7 +3719,7 @@
<li>[Fix] odbc_autocommit causing existing result sets to be dropped (Bug #14182)</li>
</ul>
- <a name="v30rc3"></a><h3>1.xxvii. Changes since 3.0.RC3</h3>
+ <a name="v30rc3"></a><h3>1.xxviii. Changes since 3.0.RC3</h3>
<ul>
<li>[Fix] Fixing some subsilver2 and prosilver style issues</li>
@@ -3756,7 +3828,7 @@
</ul>
- <a name="v30rc2"></a><h3>1.xxviii. Changes since 3.0.RC2</h3>
+ <a name="v30rc2"></a><h3>1.xxix. Changes since 3.0.RC2</h3>
<ul>
<li>[Fix] Re-allow searching within the memberlist</li>
@@ -3802,7 +3874,7 @@
</ul>
- <a name="v30rc1"></a><h3>1.xxix. Changes since 3.0.RC1</h3>
+ <a name="v30rc1"></a><h3>1.xxx. Changes since 3.0.RC1</h3>
<ul>
<li>[Fix] (X)HTML issues within the templates (Bug #11255, #11255)</li>
diff --git a/phpBB/docs/CREDITS.txt b/phpBB/docs/CREDITS.txt
index edb6361b2a..c0b1d4dbe2 100644
--- a/phpBB/docs/CREDITS.txt
+++ b/phpBB/docs/CREDITS.txt
@@ -25,7 +25,6 @@ phpBB Lead Developer: naderman (Nils Adermann)
phpBB Developers: bantu (Andreas Fischer)
dhruv.goel92 (Dhruv Goel)
EXreaction (Nathan Guse)
- imkingdavid (David King)
marc1706 (Marc Alexander)
nickvergessen (Joas Schilling)
nicofuma (Tristan Darricau)
@@ -56,6 +55,7 @@ phpBB Developers: A_Jelly_Doughnut (Josh Woody) [01/2010 - 11/2010]
dhn (Dominik Dröscher) [05/2007 - 01/2011]
GrahamJE (Graham Eames) [09/2005 - 11/2006]
igorw (Igor Wiedler) [08/2010 - 02/2013]
+ imkingdavid (David King) [11/2012 - 06/2014]
kellanved (Henry Sudhof) [04/2007 - 03/2011]
Oleg (Oleg Pudeyev) [01/2011 - 05/2013]
rxu (Ruslan Uzdenov) [04/2010 - 12/2012]
diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md
index f1c03672c3..c537504d54 100644
--- a/phpBB/docs/events.md
+++ b/phpBB/docs/events.md
@@ -64,6 +64,13 @@ acp_overall_header_head_append
* Since: 3.1.0-a1
* Purpose: Add assets within the `<head>` tags in the ACP
+acp_overall_header_stylesheets_after
+===
+* Location: adm/style/overall_header.html
+* Since: 3.1.0-RC3
+* Purpose: Add assets after stylesheets within the `<head>` tags in the ACP.
+Note that INCLUDECSS will not work with this event.
+
acp_posting_buttons_after
===
* Locations:
@@ -96,6 +103,13 @@ acp_simple_header_head_append
* Since: 3.1.0-a1
* Purpose: Add assets within the `<head>` tags in the simple header of the ACP
+acp_simple_header_stylesheets_after
+===
+* Location: adm/style/simple_header.html
+* Since: 3.1.0-RC3
+* Purpose: Add assets after stylesheets within the `<head>` tags in the simple header
+of the ACP. Note that INCLUDECSS will not work with this event.
+
acp_users_overview_options_append
===
* Location: adm/style/acp_users_overview.html
@@ -278,6 +292,38 @@ index_body_stat_blocks_before
* Since: 3.1.0-a1
* Purpose: Add new statistic blocks above the Who Is Online and Board Statistics blocks
+mcp_ban_fields_after
+===
+* Locations:
+ + styles/prosilver/template/mcp_ban.html
+ + styles/subsilver2/template/mcp_ban.html
+* Since: 3.1.0-RC3
+* Purpose: Add additional fields to the ban form in MCP
+
+mcp_ban_fields_before
+===
+* Locations:
+ + styles/prosilver/template/mcp_ban.html
+ + styles/subsilver2/template/mcp_ban.html
+* Since: 3.1.0-RC3
+* Purpose: Add additional fields to the ban form in MCP
+
+mcp_ban_unban_after
+===
+* Locations:
+ + styles/prosilver/template/mcp_ban.html
+ + styles/subsilver2/template/mcp_ban.html
+* Since: 3.1.0-RC3
+* Purpose: Add additional fields to the unban form in MCP
+
+mcp_ban_unban_before
+===
+* Locations:
+ + styles/prosilver/template/mcp_ban.html
+ + styles/subsilver2/template/mcp_ban.html
+* Since: 3.1.0-RC3
+* Purpose: Add additional fields to the unban form in MCP
+
memberlist_body_username_append
===
* Locations:
@@ -405,9 +451,18 @@ overall_footer_breadcrumb_append
===
* Locations:
+ styles/prosilver/template/navbar_footer.html
+ + styles/subsilver2/template/breadcrumbs.html
* Since: 3.1.0-a1
* Purpose: Add links to the list of breadcrumbs in the footer
+overall_footer_breadcrumb_prepend
+===
+* Locations:
+ + styles/prosilver/template/navbar_footer.html
+ + styles/subsilver2/template/breadcrumbs.html
+* Since: 3.1.0-RC3
+* Purpose: Add links to the list of breadcrumbs in the footer (after site-home, but before board-index)
+
overall_footer_content_after
===
* Locations:
@@ -488,6 +543,30 @@ overall_header_breadcrumb_append
* Since: 3.1.0-a1
* Purpose: Add links to the list of breadcrumbs in the header
+overall_header_breadcrumb_prepend
+===
+* Locations:
+ + styles/prosilver/template/navbar_header.html
+ + styles/subsilver2/template/breadcrumbs.html
+* Since: 3.1.0-RC3
+* Purpose: Add links to the list of breadcrumbs in the header (after site-home, but before board-index)
+
+overall_header_breadcrumbs_after
+===
+* Locations:
+ + styles/prosilver/template/navbar_header.html
+ + styles/subsilver2/template/breadcrumbs.html
+* Since: 3.1.0-RC3
+* Purpose: Add content after the breadcrumbs (outside of the breadcrumbs container)
+
+overall_header_breadcrumbs_before
+===
+* Locations:
+ + styles/prosilver/template/navbar_header.html
+ + styles/subsilver2/template/breadcrumbs.html
+* Since: 3.1.0-RC3
+* Purpose: Add content before the breadcrumbs (outside of the breadcrumbs container)
+
overall_header_content_before
===
* Locations:
@@ -544,6 +623,15 @@ overall_header_page_body_before
* Since: 3.1.0-b3
* Purpose: Add content after the page-header, but before the page-body
+overall_header_stylesheets_after
+===
+* Locations:
+ + styles/prosilver/template/overall_header.html
+ + styles/subsilver2/template/overall_header.html
+* Since: 3.1.0-RC3
+* Purpose: Add asset calls after stylesheets within the `</head>` tag.
+Note that INCLUDECSS will not work with this event.
+
posting_editor_buttons_after
===
* Locations:
@@ -702,6 +790,15 @@ simple_header_head_append
* Since: 3.1.0-b4
* Purpose: Add asset calls directly before the `</head>` tag
+simple_header_stylesheets_after
+===
+* Locations:
+ + styles/prosilver/template/simple_header.html
+ + styles/subsilver2/template/simple_header.html
+* Since: 3.1.0-RC3
+* Purpose: Add asset calls after stylesheets within the `</head>` tag.
+Note that INCLUDECSS will not work with this event.
+
topiclist_row_prepend
===
* Locations:
@@ -770,6 +867,24 @@ ucp_pm_viewmessage_custom_fields_before
* Purpose: Add data before the custom fields on the user profile when viewing
a private message
+ucp_pm_viewmessage_post_buttons_after
+===
+* Locations:
+ + styles/prosilver/template/ucp_pm_viewmessage.html
+ + styles/subsilver2/template/ucp_pm_viewmessage.html
+* Since: 3.1.0-RC3
+* Purpose: Add post button to private messages (next to edit, quote etc), at
+the end of the list.
+
+ucp_pm_viewmessage_post_buttons_before
+===
+* Locations:
+ + styles/prosilver/template/ucp_pm_viewmessage.html
+ + styles/subsilver2/template/ucp_pm_viewmessage.html
+* Since: 3.1.0-RC3
+* Purpose: Add post button to private messages (next to edit, quote etc), at
+the start of the list.
+
ucp_pm_viewmessage_print_head_append
===
* Locations:
diff --git a/phpBB/download/file.php b/phpBB/download/file.php
index abafeee667..d4e0f04d2b 100644
--- a/phpBB/download/file.php
+++ b/phpBB/download/file.php
@@ -38,31 +38,31 @@ else if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'
if (isset($_GET['avatar']))
{
require($phpbb_root_path . 'includes/startup.' . $phpEx);
- require($phpbb_root_path . 'config.' . $phpEx);
+
+ require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx);
+ $phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx);
+ $phpbb_class_loader->register();
+
+ $phpbb_config_php_file = new \phpbb\config_php_file($phpbb_root_path, $phpEx);
+ extract($phpbb_config_php_file->get_all());
if (!defined('PHPBB_INSTALLED') || empty($dbms) || empty($acm_type))
{
exit;
}
- require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx);
-
require($phpbb_root_path . 'includes/constants.' . $phpEx);
require($phpbb_root_path . 'includes/functions.' . $phpEx);
- require($phpbb_root_path . 'includes/functions_container.' . $phpEx);
require($phpbb_root_path . 'includes/functions_download' . '.' . $phpEx);
require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
// Setup class loader first
- $phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx);
- $phpbb_class_loader->register();
$phpbb_class_loader_ext = new \phpbb\class_loader('\\', "{$phpbb_root_path}ext/", $phpEx);
$phpbb_class_loader_ext->register();
- phpbb_load_extensions_autoloaders($phpbb_root_path);
-
// Set up container
- $phpbb_container = phpbb_create_default_container($phpbb_root_path, $phpEx);
+ $phpbb_container_builder = new \phpbb\di\container_builder($phpbb_config_php_file, $phpbb_root_path, $phpEx);
+ $phpbb_container = $phpbb_container_builder->get_container();
$phpbb_class_loader->set_cache($phpbb_container->get('cache.driver'));
$phpbb_class_loader_ext->set_cache($phpbb_container->get('cache.driver'));
diff --git a/phpBB/includes/acp/acp_ban.php b/phpBB/includes/acp/acp_ban.php
index 7cc6741e23..361ef2666c 100644
--- a/phpBB/includes/acp/acp_ban.php
+++ b/phpBB/includes/acp/acp_ban.php
@@ -176,8 +176,6 @@ class acp_ban
$result = $db->sql_query($sql);
$banned_options = $excluded_options = array();
- $ban_length = $ban_reasons = $ban_give_reasons = array();
-
while ($row = $db->sql_fetchrow($result))
{
$option = '<option value="' . $row['ban_id'] . '">' . $row[$field] . '</option>';
@@ -196,60 +194,31 @@ class acp_ban
if ($time_length == 0)
{
// Banned permanently
- $ban_length[$row['ban_id']] = $user->lang['PERMANENT'];
+ $ban_length = $user->lang['PERMANENT'];
}
else if (isset($ban_end_text[$time_length]))
{
// Banned for a given duration
- $ban_length[$row['ban_id']] = sprintf($user->lang['BANNED_UNTIL_DURATION'], $ban_end_text[$time_length], $user->format_date($row['ban_end'], false, true));
+ $ban_length = $user->lang('BANNED_UNTIL_DURATION', $ban_end_text[$time_length], $user->format_date($row['ban_end'], false, true));
}
else
{
// Banned until given date
- $ban_length[$row['ban_id']] = sprintf($user->lang['BANNED_UNTIL_DATE'], $user->format_date($row['ban_end'], false, true));
+ $ban_length = $user->lang('BANNED_UNTIL_DATE', $user->format_date($row['ban_end'], false, true));
}
- $ban_reasons[$row['ban_id']] = $row['ban_reason'];
- $ban_give_reasons[$row['ban_id']] = $row['ban_give_reason'];
+ $template->assign_block_vars('bans', array(
+ 'BAN_ID' => (int) $row['ban_id'],
+ 'LENGTH' => $ban_length,
+ 'A_LENGTH' => addslashes($ban_length),
+ 'REASON' => $row['ban_reason'],
+ 'A_REASON' => addslashes($row['ban_reason']),
+ 'GIVE_REASON' => $row['ban_give_reason'],
+ 'A_GIVE_REASON' => addslashes($row['ban_give_reason']),
+ ));
}
$db->sql_freeresult($result);
- if (sizeof($ban_length))
- {
- foreach ($ban_length as $ban_id => $length)
- {
- $template->assign_block_vars('ban_length', array(
- 'BAN_ID' => (int) $ban_id,
- 'LENGTH' => $length,
- 'A_LENGTH' => addslashes($length),
- ));
- }
- }
-
- if (sizeof($ban_reasons))
- {
- foreach ($ban_reasons as $ban_id => $reason)
- {
- $template->assign_block_vars('ban_reason', array(
- 'BAN_ID' => $ban_id,
- 'REASON' => $reason,
- 'A_REASON' => addslashes($reason),
- ));
- }
- }
-
- if (sizeof($ban_give_reasons))
- {
- foreach ($ban_give_reasons as $ban_id => $reason)
- {
- $template->assign_block_vars('ban_give_reason', array(
- 'BAN_ID' => $ban_id,
- 'REASON' => $reason,
- 'A_REASON' => addslashes($reason),
- ));
- }
- }
-
$options = '';
if ($excluded_options)
{
diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php
index 0d0d49774c..2a28226d6c 100644
--- a/phpBB/includes/acp/acp_main.php
+++ b/phpBB/includes/acp/acp_main.php
@@ -26,7 +26,7 @@ class acp_main
function main($id, $mode)
{
global $config, $db, $cache, $user, $auth, $template, $request;
- global $phpbb_root_path, $phpbb_admin_path, $phpEx, $phpbb_container;
+ global $phpbb_root_path, $phpbb_admin_path, $phpEx, $phpbb_container, $phpbb_dispatcher;
// Show restore permissions notice
if ($user->data['user_perm_from'] && $auth->acl_get('a_switchperm'))
@@ -445,6 +445,14 @@ class acp_main
));
}
+ /**
+ * Notice admin
+ *
+ * @event core.acp_main_notice
+ * @since 3.1.0-RC3
+ */
+ $phpbb_dispatcher->dispatch('core.acp_main_notice');
+
// Get forum statistics
$total_posts = $config['num_posts'];
$total_topics = $config['num_topics'];
diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php
index 4cc93e5670..2a02e3e845 100644
--- a/phpBB/includes/acp/acp_styles.php
+++ b/phpBB/includes/acp/acp_styles.php
@@ -804,7 +804,7 @@ class acp_styles
*
* @param array $styles Styles list, passed as reference
* @param string $name Name of parent style
- * @param string $level Styles tree level
+ * @param int $level Styles tree level
*/
protected function show_available_child_styles(&$styles, $name, $level)
{
@@ -888,7 +888,7 @@ class acp_styles
* Show item in styles list
*
* @param array $style style row
- * @param array $level style inheritance level
+ * @param int $level style inheritance level
*/
protected function list_style(&$style, $level)
{
diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php
index 2287639aee..cd4e19bf1d 100644
--- a/phpBB/includes/constants.php
+++ b/phpBB/includes/constants.php
@@ -28,7 +28,7 @@ if (!defined('IN_PHPBB'))
*/
// phpBB Version
-define('PHPBB_VERSION', '3.1.0-RC2-dev');
+define('PHPBB_VERSION', '3.1.0-RC3-dev');
// QA-related
// define('PHPBB_QA', 1);
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index df1a9a58b9..d7b1b56532 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -1067,7 +1067,7 @@ function phpbb_timezone_select($user, $default = '', $truncate = false)
$offset_string = phpbb_format_timezone_offset($offset);
$timezones['GMT' . $offset_string . ' - ' . $timezone] = array(
'tz' => $timezone,
- 'offest' => 'GMT' . $offset_string,
+ 'offset' => 'GMT' . $offset_string,
'current' => $current_time,
);
if ($timezone === $default)
@@ -1084,14 +1084,14 @@ function phpbb_timezone_select($user, $default = '', $truncate = false)
foreach ($timezones as $timezone)
{
- if ($opt_group != $timezone['offest'])
+ if ($opt_group != $timezone['offset'])
{
$tz_select .= ($opt_group) ? '</optgroup>' : '';
- $tz_select .= '<optgroup label="' . $timezone['offest'] . ' - ' . $timezone['current'] . '">';
- $opt_group = $timezone['offest'];
+ $tz_select .= '<optgroup label="' . $timezone['offset'] . ' - ' . $timezone['current'] . '">';
+ $opt_group = $timezone['offset'];
- $selected = ($default_offset == $timezone['offest']) ? ' selected="selected"' : '';
- $tz_dates .= '<option value="' . $timezone['offest'] . ' - ' . $timezone['current'] . '"' . $selected . '>' . $timezone['offest'] . ' - ' . $timezone['current'] . '</option>';
+ $selected = ($default_offset == $timezone['offset']) ? ' selected="selected"' : '';
+ $tz_dates .= '<option value="' . $timezone['offset'] . ' - ' . $timezone['current'] . '"' . $selected . '>' . $timezone['offset'] . ' - ' . $timezone['current'] . '</option>';
}
$label = $timezone['tz'];
@@ -1099,7 +1099,7 @@ function phpbb_timezone_select($user, $default = '', $truncate = false)
{
$label = $user->lang['timezones'][$label];
}
- $title = $timezone['offest'] . ' - ' . $label;
+ $title = $timezone['offset'] . ' - ' . $label;
if ($truncate)
{
@@ -4966,7 +4966,7 @@ function page_header($page_title = '', $display_online_list = false, $item_id =
'U_SEARCH_UNREAD' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=unreadposts'),
'U_SEARCH_ACTIVE_TOPICS'=> append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=active_topics'),
'U_DELETE_COOKIES' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=delete_cookies'),
- 'U_CONTACT_US' => ($config['contact_admin_form_enable']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contactadmin') : '',
+ 'U_CONTACT_US' => ($config['contact_admin_form_enable'] && $config['email_enable']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contactadmin') : '',
'U_TEAM' => ($user->data['user_id'] != ANONYMOUS && !$auth->acl_get('u_viewprofile')) ? '' : append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=team'),
'U_TERMS_USE' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=terms'),
'U_PRIVACY' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=privacy'),
@@ -5338,52 +5338,6 @@ function phpbb_to_numeric($input)
}
/**
-* Convert either 3.0 dbms or 3.1 db driver class name to 3.1 db driver class name.
-*
-* If $dbms is a valid 3.1 db driver class name, returns it unchanged.
-* Otherwise prepends phpbb\db\driver\ to the dbms to convert a 3.0 dbms
-* to 3.1 db driver class name.
-*
-* @param string $dbms dbms parameter
-* @return db driver class
-*/
-function phpbb_convert_30_dbms_to_31($dbms)
-{
- // Note: this check is done first because mysqli extension
- // supplies a mysqli class, and class_exists($dbms) would return
- // true for mysqli class.
- // However, per the docblock any valid 3.1 driver name should be
- // recognized by this function, and have priority over 3.0 dbms.
- if (strpos($dbms, 'phpbb\db\driver') === false && class_exists('phpbb\db\driver\\' . $dbms))
- {
- return 'phpbb\db\driver\\' . $dbms;
- }
-
- if (class_exists($dbms))
- {
- // Additionally we could check that $dbms extends phpbb\db\driver\driver.
- // http://php.net/manual/en/class.reflectionclass.php
- // Beware of possible performance issues:
- // http://stackoverflow.com/questions/294582/php-5-reflection-api-performance
- // We could check for interface implementation in all paths or
- // only when we do not prepend phpbb\db\driver\.
-
- /*
- $reflection = new \ReflectionClass($dbms);
-
- if ($reflection->isSubclassOf('phpbb\db\driver\driver'))
- {
- return $dbms;
- }
- */
-
- return $dbms;
- }
-
- throw new \RuntimeException("You have specified an invalid dbms driver: $dbms");
-}
-
-/**
* Get the board contact details (e.g. for emails)
*
* @param \phpbb\config\config $config
@@ -5412,7 +5366,7 @@ function phpbb_get_board_contact(\phpbb\config\config $config, $phpEx)
*/
function phpbb_get_board_contact_link(\phpbb\config\config $config, $phpbb_root_path, $phpEx)
{
- if ($config['contact_admin_form_enable'])
+ if ($config['contact_admin_form_enable'] && $config['email_enable'])
{
return append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contactadmin');
}
diff --git a/phpBB/includes/functions_acp.php b/phpBB/includes/functions_acp.php
index 8453da6e6e..ad5a359710 100644
--- a/phpBB/includes/functions_acp.php
+++ b/phpBB/includes/functions_acp.php
@@ -240,7 +240,6 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars)
case 'range':
case 'search':
case 'tel':
- case 'url':
case 'week':
$size = (int) $tpl_type[1];
$maxlength = (int) $tpl_type[2];
diff --git a/phpBB/includes/functions_container.php b/phpBB/includes/functions_container.php
deleted file mode 100644
index a00613c26b..0000000000
--- a/phpBB/includes/functions_container.php
+++ /dev/null
@@ -1,297 +0,0 @@
-<?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.
-*
-*/
-
-use Symfony\Component\Config\FileLocator;
-use Symfony\Component\DependencyInjection\ContainerBuilder;
-use Symfony\Component\DependencyInjection\Dumper\PhpDumper;
-use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
-
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
-
-/**
-* Get DB connection from config.php.
-*
-* Used to bootstrap the container.
-*
-* @param string $config_file
-* @return \phpbb\db\driver\driver_interface
-*/
-function phpbb_bootstrap_db_connection($config_file)
-{
- require($config_file);
- $dbal_driver_class = phpbb_convert_30_dbms_to_31($dbms);
-
- $db = new $dbal_driver_class();
- $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, defined('PHPBB_DB_NEW_LINK'));
-
- return $db;
-}
-
-/**
-* Get table prefix from config.php.
-*
-* Used to bootstrap the container.
-*
-* @param string $config_file
-* @return string table prefix
-*/
-function phpbb_bootstrap_table_prefix($config_file)
-{
- require($config_file);
- return $table_prefix;
-}
-
-/**
-* Get enabled extensions.
-*
-* Used to bootstrap the container.
-*
-* @param string $config_file
-* @param string $phpbb_root_path
-* @param \phpbb\db\driver\driver_interface $db The generated connection
-* @return array enabled extensions
-*/
-function phpbb_bootstrap_enabled_exts($config_file, $phpbb_root_path, &$db)
-{
- $db = phpbb_bootstrap_db_connection($config_file);
- $table_prefix = phpbb_bootstrap_table_prefix($config_file);
- $extension_table = $table_prefix.'ext';
-
- $sql = 'SELECT *
- FROM ' . $extension_table . '
- WHERE ext_active = 1';
-
- $result = $db->sql_query($sql);
- $rows = $db->sql_fetchrowset($result);
- $db->sql_freeresult($result);
-
- $exts = array();
- foreach ($rows as $row)
- {
- $exts[$row['ext_name']] = $phpbb_root_path . 'ext/' . $row['ext_name'] . '/';
- }
-
- return $exts;
-}
-
-/**
-* Create the ContainerBuilder object
-*
-* @param array $extensions Array of Container extension objects
-* @param string $phpbb_root_path Root path
-* @param string $php_ext PHP Extension
-* @return ContainerBuilder object
-*/
-function phpbb_create_container(array $extensions, $phpbb_root_path, $php_ext)
-{
- $container = new ContainerBuilder();
-
- foreach ($extensions as $extension)
- {
- $container->registerExtension($extension);
- $container->loadFromExtension($extension->getAlias());
- }
-
- $container->setParameter('core.root_path', $phpbb_root_path);
- $container->setParameter('core.php_ext', $php_ext);
-
- return $container;
-}
-
-/**
-* Create installer container
-*
-* @param string $phpbb_root_path Root path
-* @param string $php_ext PHP Extension
-* @return ContainerBuilder object
-*/
-function phpbb_create_install_container($phpbb_root_path, $php_ext)
-{
- $other_config_path = $phpbb_root_path . 'install/update/new/config/';
- $config_path = file_exists($other_config_path . 'services.yml') ? $other_config_path : $phpbb_root_path . 'config/';
-
- $core = new \phpbb\di\extension\core($config_path);
- $container = phpbb_create_container(array($core), $phpbb_root_path, $php_ext);
-
- $container->setParameter('core.root_path', $phpbb_root_path);
- $container->setParameter('core.adm_relative_path', $phpbb_adm_relative_path);
- $container->setParameter('core.php_ext', $php_ext);
- $container->setParameter('core.table_prefix', '');
-
- $container->register('dbal.conn.driver')->setSynthetic(true);
-
- $container->setAlias('cache.driver', 'cache.driver.install');
-
- $container->compile();
-
- return $container;
-}
-
-/**
-* Create updater container
-*
-* @param string $phpbb_root_path Root path
-* @param string $php_ext PHP Extension
-* @param array $config_path Path to config directory
-* @return ContainerBuilder object (compiled)
-*/
-function phpbb_create_update_container($phpbb_root_path, $php_ext, $config_path)
-{
- $config_file = $phpbb_root_path . 'config.' . $php_ext;
- return phpbb_create_compiled_container(
- $config_file,
- array(
- new phpbb\di\extension\config($config_file),
- new phpbb\di\extension\core($config_path),
- ),
- array(
- new phpbb\di\pass\collection_pass(),
- new phpbb\di\pass\kernel_pass(),
- ),
- $phpbb_root_path,
- $php_ext
- );
-}
-
-/**
-* Create a compiled ContainerBuilder object
-*
-* @param array $extensions Array of Container extension objects
-* @param array $passes Array of Compiler Pass objects
-* @param string $phpbb_root_path Root path
-* @param string $php_ext PHP Extension
-* @return ContainerBuilder object (compiled)
-*/
-function phpbb_create_compiled_container($config_file, array $extensions, array $passes, $phpbb_root_path, $php_ext)
-{
- // Create the final container to be compiled and cached
- $container = phpbb_create_container($extensions, $phpbb_root_path, $php_ext);
-
- // Compile the container
- foreach ($passes as $pass)
- {
- $container->addCompilerPass($pass);
- }
- $container->compile();
-
- return $container;
-}
-
-/**
-* Create a compiled and dumped ContainerBuilder object
-*
-* @param array $extensions Array of Container extension objects
-* @param array $passes Array of Compiler Pass objects
-* @param string $phpbb_root_path Root path
-* @param string $php_ext PHP Extension
-* @return ContainerBuilder object (compiled)
-*/
-function phpbb_create_dumped_container($config_file, array $extensions, array $passes, $phpbb_root_path, $php_ext)
-{
- // Check for our cached container; if it exists, use it
- $container_filename = phpbb_container_filename($phpbb_root_path, $php_ext);
- if (file_exists($container_filename))
- {
- require($container_filename);
- return new phpbb_cache_container();
- }
-
- $container = phpbb_create_compiled_container($config_file, $extensions, $passes, $phpbb_root_path, $php_ext);
-
- // Lastly, we create our cached container class
- $dumper = new PhpDumper($container);
- $cached_container_dump = $dumper->dump(array(
- 'class' => 'phpbb_cache_container',
- 'base_class' => 'Symfony\\Component\\DependencyInjection\\ContainerBuilder',
- ));
-
- file_put_contents($container_filename, $cached_container_dump);
-
- return $container;
-}
-
-/**
-* Create an environment-specific ContainerBuilder object
-*
-* If debug is enabled, the container is re-compiled every time.
-* This ensures that the latest changes will always be reflected
-* during development.
-*
-* Otherwise it will get the existing dumped container and use
-* that one instead.
-*
-* @param array $extensions Array of Container extension objects
-* @param array $passes Array of Compiler Pass objects
-* @param string $phpbb_root_path Root path
-* @param string $php_ext PHP Extension
-* @return ContainerBuilder object (compiled)
-*/
-function phpbb_create_dumped_container_unless_debug($config_file, array $extensions, array $passes, $phpbb_root_path, $php_ext)
-{
- $container_factory = defined('DEBUG_CONTAINER') ? 'phpbb_create_compiled_container' : 'phpbb_create_dumped_container';
- return $container_factory($config_file, $extensions, $passes, $phpbb_root_path, $php_ext);
-}
-
-/**
-* Create a default ContainerBuilder object
-*
-* Contains the default configuration of the phpBB container.
-*
-* @param array $extensions Array of Container extension objects
-* @param array $passes Array of Compiler Pass objects
-* @return ContainerBuilder object (compiled)
-*/
-function phpbb_create_default_container($phpbb_root_path, $php_ext)
-{
- $config_file = $phpbb_root_path . 'config.' . $php_ext;
- $db = null;
- $installed_exts = phpbb_bootstrap_enabled_exts($config_file, $phpbb_root_path, $db);
-
- $container = phpbb_create_dumped_container_unless_debug(
- $config_file,
- array(
- new \phpbb\di\extension\config($config_file),
- new \phpbb\di\extension\core($phpbb_root_path . 'config'),
- new \phpbb\di\extension\ext($installed_exts),
- ),
- array(
- new \phpbb\di\pass\collection_pass(),
- new \phpbb\di\pass\kernel_pass(),
- ),
- $phpbb_root_path,
- $php_ext
- );
-
- $container->get('dbal.conn')->set_driver($db);
-
- return $container;
-}
-
-/**
-* Get the filename under which the dumped container will be stored.
-*
-* @param string $phpbb_root_path Root path
-* @param string $php_ext PHP Extension
-* @return Path for dumped container
-*/
-function phpbb_container_filename($phpbb_root_path, $php_ext)
-{
- $filename = str_replace(array('/', '.'), array('slash', 'dot'), $phpbb_root_path);
- return $phpbb_root_path . 'cache/container_' . $filename . '.' . $php_ext;
-}
diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php
index 68b1356297..bfe9c0b055 100644
--- a/phpBB/includes/functions_display.php
+++ b/phpBB/includes/functions_display.php
@@ -1063,7 +1063,8 @@ function display_reasons($reason_id = 0)
function display_user_activity(&$userdata)
{
global $auth, $template, $db, $user;
- global $phpbb_root_path, $phpEx, $phpbb_container;
+ global $phpbb_root_path, $phpEx;
+ global $phpbb_container, $phpbb_dispatcher;
// Do not display user activity for users having more than 5000 posts...
if ($userdata['user_posts'] > 5000)
@@ -1134,6 +1135,18 @@ function display_user_activity(&$userdata)
}
}
+ /**
+ * Alter list of forums and topics to display as active
+ *
+ * @event core.display_user_activity_modify_actives
+ * @var array userdata User's data
+ * @var array active_f_row List of active forums
+ * @var array active_t_row List of active posts
+ * @since 3.1.0-RC3
+ */
+ $vars = array('userdata', 'active_f_row', 'active_t_row');
+ extract($phpbb_dispatcher->trigger_event('core.display_user_activity_modify_actives', compact($vars)));
+
$userdata['active_t_row'] = $active_t_row;
$userdata['active_f_row'] = $active_f_row;
diff --git a/phpBB/includes/functions_install.php b/phpBB/includes/functions_install.php
index 06f49e4b50..28cc603bdb 100644
--- a/phpBB/includes/functions_install.php
+++ b/phpBB/includes/functions_install.php
@@ -266,7 +266,7 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
if (is_array($db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true)))
{
$db_error = $db->sql_error();
- $error[] = $lang['INST_ERR_DB_CONNECT'] . '<br />' . (($db_error['message']) ? $db_error['message'] : $lang['INST_ERR_DB_NO_ERROR']);
+ $error[] = $lang['INST_ERR_DB_CONNECT'] . '<br />' . (($db_error['message']) ? utf8_convert_message($db_error['message']) : $lang['INST_ERR_DB_NO_ERROR']);
}
else
{
@@ -449,6 +449,7 @@ function phpbb_create_config_file_data($data, $dbms, $debug = false, $debug_cont
}
$config_data .= "\n@define('PHPBB_INSTALLED', true);\n";
+ $config_data .= "// @define('PHPBB_DISPLAY_LOAD_TIME', true);\n";
if ($debug)
{
diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php
index 86439ea03f..f17333edda 100644
--- a/phpBB/includes/functions_module.php
+++ b/phpBB/includes/functions_module.php
@@ -1040,19 +1040,45 @@ class p_master
*/
function add_mod_info($module_class)
{
- global $user, $phpEx;
-
- global $phpbb_extension_manager;
+ global $config, $user, $phpEx, $phpbb_extension_manager;
$finder = $phpbb_extension_manager->get_finder();
- $lang_files = $finder
+ // We grab the language files from the default, English and user's language.
+ // So we can fall back to the other files like we do when using add_lang()
+ $default_lang_files = $english_lang_files = $user_lang_files = array();
+
+ // Search for board default language if it's not the user language
+ if ($config['default_lang'] != $user->lang_name)
+ {
+ $default_lang_files = $finder
+ ->prefix('info_' . strtolower($module_class) . '_')
+ ->suffix(".$phpEx")
+ ->extension_directory('/language/' . basename($config['default_lang']))
+ ->core_path('language/' . basename($config['default_lang']) . '/mods/')
+ ->find();
+ }
+
+ // Search for english, if its not the default or user language
+ if ($config['default_lang'] != 'en' && $user->lang_name != 'en')
+ {
+ $english_lang_files = $finder
+ ->prefix('info_' . strtolower($module_class) . '_')
+ ->suffix(".$phpEx")
+ ->extension_directory('/language/en')
+ ->core_path('language/en/mods/')
+ ->find();
+ }
+
+ // Find files in the user's language
+ $user_lang_files = $finder
->prefix('info_' . strtolower($module_class) . '_')
->suffix(".$phpEx")
->extension_directory('/language/' . $user->lang_name)
->core_path('language/' . $user->lang_name . '/mods/')
->find();
+ $lang_files = array_unique(array_merge($user_lang_files, $english_lang_files, $default_lang_files));
foreach ($lang_files as $lang_file => $ext_name)
{
$user->add_lang_ext($ext_name, $lang_file);
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 0b37af0ee0..b3f164a84d 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -405,7 +405,7 @@ function posting_gen_topic_types($forum_id, $cur_topic_type = POST_NORMAL)
function upload_attachment($form_name, $forum_id, $local = false, $local_storage = '', $is_message = false, $local_filedata = false, \phpbb\plupload\plupload $plupload = null)
{
global $auth, $user, $config, $db, $cache;
- global $phpbb_root_path, $phpEx;
+ global $phpbb_root_path, $phpEx, $phpbb_dispatcher;
$filedata = array(
'error' => array()
@@ -506,6 +506,20 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage
$filedata['real_filename'] = $file->get('uploadname');
$filedata['filetime'] = time();
+ /**
+ * Event to modify uploaded file before submit to the post
+ *
+ * @event core.modify_uploaded_file
+ * @var array filedata Array containing uploaded file data
+ * @var bool is_image Flag indicating if the file is an image
+ * @since 3.1.0-RC3
+ */
+ $vars = array(
+ 'filedata',
+ 'is_image',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.modify_uploaded_file', compact($vars)));
+
// Check our complete quota
if ($config['attachment_quota'])
{
@@ -893,7 +907,7 @@ function posting_gen_attachment_entry($attachment_data, &$filename_data, $show_a
function load_drafts($topic_id = 0, $forum_id = 0, $id = 0, $pm_action = '', $msg_id = 0)
{
global $user, $db, $template, $auth;
- global $phpbb_root_path, $phpEx;
+ global $phpbb_root_path, $phpbb_dispatcher, $phpEx;
$topic_ids = $forum_ids = $draft_rows = array();
@@ -936,7 +950,7 @@ function load_drafts($topic_id = 0, $forum_id = 0, $id = 0, $pm_action = '', $ms
$topic_rows = array();
if (sizeof($topic_ids))
{
- $sql = 'SELECT topic_id, forum_id, topic_title
+ $sql = 'SELECT topic_id, forum_id, topic_title, topic_poster
FROM ' . TOPICS_TABLE . '
WHERE ' . $db->sql_in_set('topic_id', array_unique($topic_ids));
$result = $db->sql_query($sql);
@@ -947,6 +961,20 @@ function load_drafts($topic_id = 0, $forum_id = 0, $id = 0, $pm_action = '', $ms
}
$db->sql_freeresult($result);
}
+
+ /**
+ * Drafts found and their topics
+ * Edit $draft_rows in order to add or remove drafts loaded
+ *
+ * @event core.load_drafts_draft_list_result
+ * @var array draft_rows The drafts query result. Includes its forum id and everything about the draft
+ * @var array topic_ids The list of topics got from the topics table
+ * @var array topic_rows The topics that draft_rows references
+ * @since 3.1.0-RC3
+ */
+ $vars = array('draft_rows', 'topic_ids', 'topic_rows');
+ extract($phpbb_dispatcher->trigger_event('core.load_drafts_draft_list_result', compact($vars)));
+
unset($topic_ids);
$template->assign_var('S_SHOW_DRAFTS', true);
@@ -2373,12 +2401,31 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
* event is to modify the return URL ($url).
*
* @event core.submit_post_end
- * @var string url The "Return to topic" URL
- * @var array data Array of post data about the
- * submitted post
+ * @var string mode Variable containing posting mode value
+ * @var string subject Variable containing post subject value
+ * @var string username Variable containing post author name
+ * @var int topic_type Variable containing topic type value
+ * @var array poll Array with the poll data for the post
+ * @var array data Array with the data for the post
+ * @var bool update_message Flag indicating if the post will be updated
+ * @var bool update_search_index Flag indicating if the search index will be updated
+ * @var string url The "Return to topic" URL
+ *
* @since 3.1.0-a3
+ * @change 3.1.0-RC3 Added vars mode, subject, username, topic_type,
+ * poll, update_message, update_search_index
*/
- $vars = array('url', 'data');
+ $vars = array(
+ 'mode',
+ 'subject',
+ 'username',
+ 'topic_type',
+ 'poll',
+ 'data',
+ 'update_message',
+ 'update_search_index',
+ 'url',
+ );
extract($phpbb_dispatcher->trigger_event('core.submit_post_end', compact($vars)));
return $url;
diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php
index e60311f8ab..488f46a398 100644
--- a/phpBB/includes/functions_privmsgs.php
+++ b/phpBB/includes/functions_privmsgs.php
@@ -212,7 +212,7 @@ function get_folder($user_id, $folder_id = false)
);
}
- if ($folder_id !== false && !isset($folder[$folder_id]))
+ if ($folder_id !== false && $folder_id !== PRIVMSGS_HOLD_BOX && !isset($folder[$folder_id]))
{
trigger_error('UNKNOWN_FOLDER');
}
diff --git a/phpBB/includes/mcp/mcp_logs.php b/phpBB/includes/mcp/mcp_logs.php
index 2945e1ec8a..92dcdb5499 100644
--- a/phpBB/includes/mcp/mcp_logs.php
+++ b/phpBB/includes/mcp/mcp_logs.php
@@ -115,7 +115,7 @@ class mcp_logs
if ($deletemark && sizeof($marked))
{
$conditions = array(
- 'forum_id' => $forum_list,
+ 'forum_id' => array('IN' => $forum_list),
'log_id' => array('IN' => $marked),
);
@@ -126,7 +126,7 @@ class mcp_logs
$keywords = utf8_normalize_nfc(request_var('keywords', '', true));
$conditions = array(
- 'forum_id' => $forum_list,
+ 'forum_id' => array('IN' => $forum_list),
'keywords' => $keywords,
);
diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php
index e81abd0c8e..1687409198 100644
--- a/phpBB/includes/mcp/mcp_post.php
+++ b/phpBB/includes/mcp/mcp_post.php
@@ -151,6 +151,7 @@ function mcp_post_details($id, $mode, $action)
if (sizeof($attachments))
{
+ $user->add_lang('viewtopic');
$update_count = array();
parse_attachments($post_info['forum_id'], $message, $attachments, $update_count);
}
diff --git a/phpBB/includes/questionnaire/questionnaire.php b/phpBB/includes/questionnaire/questionnaire.php
index b4b01a74bf..63ea432863 100644
--- a/phpBB/includes/questionnaire/questionnaire.php
+++ b/phpBB/includes/questionnaire/questionnaire.php
@@ -257,11 +257,12 @@ class phpbb_questionnaire_phpbb_data_provider
*/
function get_data()
{
- global $phpbb_root_path, $phpEx;
- include("{$phpbb_root_path}config.$phpEx");
+ global $phpbb_root_path, $phpEx, $phpbb_config_php_file;
+
+ extract($phpbb_config_php_file->get_all());
unset($dbhost, $dbport, $dbname, $dbuser, $dbpasswd); // Just a precaution
- $dbms = phpbb_convert_30_dbms_to_31($dbms);
+ $dbms = $phpbb_config_php_file->convert_30_dbms_to_31($dbms);
// Only send certain config vars
$config_vars = array(
diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php
index 35bb844170..a8c8920a7d 100644
--- a/phpBB/includes/ucp/ucp_prefs.php
+++ b/phpBB/includes/ucp/ucp_prefs.php
@@ -43,7 +43,7 @@ class ucp_prefs
'notifymethod' => request_var('notifymethod', $user->data['user_notify_type']),
'dateformat' => request_var('dateformat', $user->data['user_dateformat'], true),
'lang' => basename(request_var('lang', $user->data['user_lang'])),
- 'style' => request_var('style', (int) $user->data['user_style']),
+ 'user_style' => request_var('user_style', (int) $user->data['user_style']),
'tz' => request_var('tz', $user->data['user_timezone']),
'viewemail' => request_var('viewemail', (bool) $user->data['user_allow_viewemail']),
@@ -76,11 +76,11 @@ class ucp_prefs
{
if ($config['override_user_style'])
{
- $data['style'] = (int) $config['default_style'];
+ $data['user_style'] = (int) $config['default_style'];
}
- else if (!phpbb_style_is_active($data['style']))
+ else if (!phpbb_style_is_active($data['user_style']))
{
- $data['style'] = (int) $user->data['user_style'];
+ $data['user_style'] = (int) $user->data['user_style'];
}
$error = validate_data($data, array(
@@ -107,7 +107,7 @@ class ucp_prefs
'user_dateformat' => $data['dateformat'],
'user_lang' => $data['lang'],
'user_timezone' => $data['tz'],
- 'user_style' => $data['style'],
+ 'user_style' => $data['user_style'],
);
/**
@@ -115,7 +115,7 @@ class ucp_prefs
*
* @event core.ucp_prefs_personal_update_data
* @var array data Submitted display options data
- * @var array sql_ary Display options data we udpate
+ * @var array sql_ary Display options data we update
* @since 3.1.0-a1
*/
$vars = array('data', 'sql_ary');
@@ -207,7 +207,7 @@ class ucp_prefs
'S_MORE_STYLES' => $s_more_styles,
'S_LANG_OPTIONS' => language_select($data['lang']),
- 'S_STYLE_OPTIONS' => ($config['override_user_style']) ? '' : style_select($data['style']),
+ 'S_STYLE_OPTIONS' => ($config['override_user_style']) ? '' : style_select($data['user_style']),
'S_TZ_OPTIONS' => $timezone_selects['tz_select'],
'S_TZ_DATE_OPTIONS' => $timezone_selects['tz_dates'],
'S_CAN_HIDE_ONLINE' => ($auth->acl_get('u_hideonline')) ? true : false,
@@ -294,7 +294,7 @@ class ucp_prefs
*
* @event core.ucp_prefs_view_update_data
* @var array data Submitted display options data
- * @var array sql_ary Display options data we udpate
+ * @var array sql_ary Display options data we update
* @since 3.1.0-a1
*/
$vars = array('data', 'sql_ary');
@@ -420,7 +420,7 @@ class ucp_prefs
*
* @event core.ucp_prefs_post_update_data
* @var array data Submitted display options data
- * @var array sql_ary Display options data we udpate
+ * @var array sql_ary Display options data we update
* @since 3.1.0-a1
*/
$vars = array('data', 'sql_ary');
@@ -451,6 +451,24 @@ class ucp_prefs
break;
}
+ /**
+ * Modify UCP preferences data before the page load
+ *
+ * @event core.ucp_prefs_modify_common
+ * @var array data Array with current/submitted UCP options data
+ * @var array error Errors data
+ * @var string mode UCP prefs operation mode
+ * @var string s_hidden_fields Hidden fields data
+ * @since 3.1.0-RC3
+ */
+ $vars = array(
+ 'data',
+ 'error',
+ 'mode',
+ 's_hidden_fields',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.ucp_prefs_modify_common', compact($vars)));
+
$template->assign_vars(array(
'L_TITLE' => $user->lang['UCP_PREFS_' . strtoupper($mode)],
diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php
index 6b6eabe57d..696075b07c 100644
--- a/phpBB/install/convertors/convert_phpbb20.php
+++ b/phpBB/install/convertors/convert_phpbb20.php
@@ -25,10 +25,11 @@ if (!defined('IN_PHPBB'))
exit;
}
-include($phpbb_root_path . 'config.' . $phpEx);
+$phpbb_config_php_file = new \phpbb\config_php_file($phpbb_root_path, $phpEx);
+extract($phpbb_config_php_file->get_all());
unset($dbpasswd);
-$dbms = phpbb_convert_30_dbms_to_31($dbms);
+$dbms = $phpbb_config_php_file->convert_30_dbms_to_31($dbms);
/**
* $convertor_data provides some basic information about this convertor which is
@@ -37,7 +38,7 @@ $dbms = phpbb_convert_30_dbms_to_31($dbms);
$convertor_data = array(
'forum_name' => 'phpBB 2.0.x',
'version' => '1.0.3',
- 'phpbb_version' => '3.1.0-RC1',
+ 'phpbb_version' => '3.1.0-RC2',
'author' => '<a href="https://www.phpbb.com/">phpBB Limited</a>',
'dbms' => $dbms,
'dbhost' => $dbhost,
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index 63e4e8f4ac..517143792a 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -56,8 +56,14 @@ function phpbb_end_update($cache, $config)
}
require($phpbb_root_path . 'includes/startup.' . $phpEx);
+require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx);
+
+$phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx);
+$phpbb_class_loader->register();
+
+$phpbb_config_php_file = new \phpbb\config_php_file($phpbb_root_path, $phpEx);
+extract($phpbb_config_php_file->get_all());
-include($phpbb_root_path . 'config.' . $phpEx);
if (!defined('PHPBB_INSTALLED') || empty($dbms) || empty($acm_type))
{
die("Please read: <a href='../docs/INSTALL.html'>INSTALL.html</a> before attempting to update.");
@@ -68,13 +74,9 @@ $phpbb_adm_relative_path = (isset($phpbb_adm_relative_path)) ? $phpbb_adm_relati
$phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $phpbb_adm_relative_path;
// Include files
-require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx);
-
require($phpbb_root_path . 'includes/functions.' . $phpEx);
require($phpbb_root_path . 'includes/functions_content.' . $phpEx);
-require($phpbb_root_path . 'includes/functions_container.' . $phpEx);
-require($phpbb_root_path . 'config.' . $phpEx);
require($phpbb_root_path . 'includes/constants.' . $phpEx);
include($phpbb_root_path . 'includes/utf/utf_normalizer.' . $phpEx);
require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
@@ -82,26 +84,12 @@ require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
// Set PHP error handler to ours
set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler');
-// Setup class loader first
-$phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx);
-$phpbb_class_loader->register();
-
// Set up container (must be done here because extensions table may not exist)
-$container_extensions = array(
- new \phpbb\di\extension\config($phpbb_root_path . 'config.' . $phpEx),
- new \phpbb\di\extension\core($phpbb_root_path . 'config/'),
-);
-$container_passes = array(
- new \phpbb\di\pass\collection_pass(),
-);
-$phpbb_container = phpbb_create_container($container_extensions, $phpbb_root_path, $phpEx);
-
-// Compile the container
-foreach ($container_passes as $pass)
-{
- $phpbb_container->addCompilerPass($pass);
-}
-$phpbb_container->compile();
+$phpbb_container_builder = new \phpbb\di\container_builder($phpbb_config_php_file, $phpbb_root_path, $phpEx);
+$phpbb_container_builder->set_use_extensions(false);
+$phpbb_container_builder->set_use_kernel_pass(false);
+$phpbb_container_builder->set_dump_container(false);
+$phpbb_container = $phpbb_container_builder->get_container();
// set up caching
$cache = $phpbb_container->get('cache');
@@ -189,25 +177,9 @@ define('IN_DB_UPDATE', true);
// End startup code
-// Make sure migrations have been installed.
-$db_tools = $phpbb_container->get('dbal.tools');
-if (!$db_tools->sql_table_exists($table_prefix . 'migrations'))
-{
- $db_tools->sql_create_table($table_prefix . 'migrations', array(
- 'COLUMNS' => array(
- 'migration_name' => array('VCHAR', ''),
- 'migration_depends_on' => array('TEXT', ''),
- 'migration_schema_done' => array('BOOL', 0),
- 'migration_data_done' => array('BOOL', 0),
- 'migration_data_state' => array('TEXT', ''),
- 'migration_start_time' => array('TIMESTAMP', 0),
- 'migration_end_time' => array('TIMESTAMP', 0),
- ),
- 'PRIMARY_KEY' => 'migration_name',
- ));
-}
-
$migrator = $phpbb_container->get('migrator');
+$migrator->create_migrations_table();
+
$phpbb_extension_manager = $phpbb_container->get('ext.manager');
$finder = $phpbb_extension_manager->get_finder();
diff --git a/phpBB/install/index.php b/phpBB/install/index.php
index c8a745825a..d443c537fa 100644
--- a/phpBB/install/index.php
+++ b/phpBB/install/index.php
@@ -102,7 +102,6 @@ $phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_ro
phpbb_require_updated('phpbb/class_loader.' . $phpEx);
phpbb_require_updated('includes/functions.' . $phpEx);
-phpbb_require_updated('includes/functions_container.' . $phpEx);
phpbb_require_updated('includes/functions_content.' . $phpEx, true);
@@ -120,7 +119,29 @@ $phpbb_class_loader_ext = new \phpbb\class_loader('\\', "{$phpbb_root_path}ext/"
$phpbb_class_loader_ext->register();
// Set up container
-$phpbb_container = phpbb_create_install_container($phpbb_root_path, $phpEx);
+$phpbb_config_php_file = new \phpbb\config_php_file($phpbb_root_path, $phpEx);
+$phpbb_container_builder = new \phpbb\di\container_builder($phpbb_config_php_file, $phpbb_root_path, $phpEx);
+$phpbb_container_builder->set_use_extensions(false);
+$phpbb_container_builder->set_dump_container(false);
+$phpbb_container_builder->set_use_custom_pass(false);
+$phpbb_container_builder->set_inject_config(false);
+$phpbb_container_builder->set_compile_container(false);
+
+$other_config_path = $phpbb_root_path . 'install/update/new/config/';
+$config_path = file_exists($other_config_path . 'services.yml') ? $other_config_path : $phpbb_root_path . 'config/';
+$phpbb_container_builder->set_config_path($config_path);
+
+$phpbb_container_builder->set_custom_parameters(array(
+ 'core.root_path' => $phpbb_root_path,
+ 'core.adm_relative_path' => $phpbb_adm_relative_path,
+ 'core.php_ext' => $phpEx,
+ 'core.table_prefix' => '',
+ 'cache.driver.class' => 'phpbb\cache\driver\file',
+));
+
+$phpbb_container = $phpbb_container_builder->get_container();
+$phpbb_container->register('dbal.conn.driver')->setSynthetic(true);
+$phpbb_container->compile();
$phpbb_class_loader->set_cache($phpbb_container->get('cache.driver'));
$phpbb_class_loader_ext->set_cache($phpbb_container->get('cache.driver'));
diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php
index 6109f5e28b..17161b5eae 100644
--- a/phpBB/install/install_convert.php
+++ b/phpBB/install/install_convert.php
@@ -107,7 +107,7 @@ class install_convert extends module
function main($mode, $sub)
{
global $lang, $template, $phpbb_root_path, $phpEx, $cache, $config, $language, $table_prefix;
- global $convert, $request, $phpbb_container;
+ global $convert, $request, $phpbb_container, $phpbb_config_php_file;
$this->tpl_name = 'install_convert';
$this->mode = $mode;
@@ -127,7 +127,8 @@ class install_convert extends module
// Enable super globals to prevent issues with the new \phpbb\request\request object
$request->enable_super_globals();
// Create a normal container now
- $phpbb_container = phpbb_create_default_container($phpbb_root_path, $phpEx);
+ $phpbb_container_builder = new \phpbb\di\container_builder($phpbb_config_php_file, $phpbb_root_path, $phpEx);
+ $phpbb_container = $phpbb_container_builder->get_container();
// Create cache
$cache = $phpbb_container->get('cache');
@@ -135,11 +136,12 @@ class install_convert extends module
switch ($sub)
{
case 'intro':
- require($phpbb_root_path . 'config.' . $phpEx);
+ extract($phpbb_config_php_file->get_all());
+
require($phpbb_root_path . 'includes/constants.' . $phpEx);
require($phpbb_root_path . 'includes/functions_convert.' . $phpEx);
- $dbms = phpbb_convert_30_dbms_to_31($dbms);
+ $dbms = $phpbb_config_php_file->convert_30_dbms_to_31($dbms);
$db = new $dbms();
$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true);
@@ -224,11 +226,12 @@ class install_convert extends module
// This is for making sure the session get not screwed due to the 3.0.x users table being completely new.
$cache->purge();
- require($phpbb_root_path . 'config.' . $phpEx);
+ extract($phpbb_config_php_file->get_all());
+
require($phpbb_root_path . 'includes/constants.' . $phpEx);
require($phpbb_root_path . 'includes/functions_convert.' . $phpEx);
- $dbms = phpbb_convert_30_dbms_to_31($dbms);
+ $dbms = $phpbb_config_php_file->convert_30_dbms_to_31($dbms);
$db = new $dbms();
$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true);
@@ -370,13 +373,14 @@ class install_convert extends module
*/
function get_convert_settings($sub)
{
- global $lang, $language, $template, $db, $phpbb_root_path, $phpEx, $config, $cache;
+ global $lang, $language, $template, $db, $phpbb_root_path, $phpEx, $config, $cache, $phpbb_config_php_file;
+
+ extract($phpbb_config_php_file->get_all());
- require($phpbb_root_path . 'config.' . $phpEx);
require($phpbb_root_path . 'includes/constants.' . $phpEx);
require($phpbb_root_path . 'includes/functions_convert.' . $phpEx);
- $dbms = phpbb_convert_30_dbms_to_31($dbms);
+ $dbms = $phpbb_config_php_file->convert_30_dbms_to_31($dbms);
$db = new $dbms();
$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true);
@@ -458,7 +462,8 @@ class install_convert extends module
{
$error[] = sprintf($lang['TABLE_PREFIX_SAME'], $src_table_prefix);
}
- $src_dbms = phpbb_convert_30_dbms_to_31($src_dbms);
+
+ $src_dbms = $phpbb_config_php_file->convert_30_dbms_to_31($src_dbms);
// Check table prefix
if (!sizeof($error))
@@ -614,13 +619,14 @@ class install_convert extends module
{
global $template, $user, $phpbb_root_path, $phpEx, $db, $lang, $config, $cache, $auth;
global $convert, $convert_row, $message_parser, $skip_rows, $language;
- global $request;
+ global $request, $phpbb_config_php_file;
+
+ extract($phpbb_config_php_file->get_all());
- require($phpbb_root_path . 'config.' . $phpEx);
require($phpbb_root_path . 'includes/constants.' . $phpEx);
require($phpbb_root_path . 'includes/functions_convert.' . $phpEx);
- $dbms = phpbb_convert_30_dbms_to_31($dbms);
+ $dbms = $phpbb_config_php_file->convert_30_dbms_to_31($dbms);
$db = new $dbms();
$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true);
diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php
index 43fd6eaf07..b82df84a00 100644
--- a/phpBB/install/install_install.php
+++ b/phpBB/install/install_install.php
@@ -51,7 +51,7 @@ class install_install extends module
function main($mode, $sub)
{
global $lang, $template, $language, $phpbb_root_path, $phpEx;
- global $phpbb_container, $cache, $phpbb_log, $request;
+ global $phpbb_container, $cache, $phpbb_log, $request, $phpbb_config_php_file;
switch ($sub)
{
@@ -104,7 +104,8 @@ class install_install extends module
$request->enable_super_globals();
// Create a normal container now
- $phpbb_container = phpbb_create_default_container($phpbb_root_path, $phpEx);
+ $phpbb_container_builder = new \phpbb\di\container_builder($phpbb_config_php_file, $phpbb_root_path, $phpEx);
+ $phpbb_container = $phpbb_container_builder->get_container();
// Sets the global variables
$cache = $phpbb_container->get('cache');
diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php
index c6f771a7d5..28777a8d24 100644
--- a/phpBB/install/install_update.php
+++ b/phpBB/install/install_update.php
@@ -66,7 +66,7 @@ class install_update extends module
function main($mode, $sub)
{
global $template, $phpEx, $phpbb_root_path, $user, $db, $config, $cache, $auth, $language;
- global $request, $phpbb_admin_path, $phpbb_adm_relative_path, $phpbb_container;
+ global $request, $phpbb_admin_path, $phpbb_adm_relative_path, $phpbb_container, $phpbb_config_php_file;
// We must enable super globals, otherwise creating a new instance of the request class,
// using the new container with a dbal connection will fail with the following PHP Notice:
@@ -74,14 +74,14 @@ class install_update extends module
$request->enable_super_globals();
// Create a normal container now
+ $phpbb_container_builder = new \phpbb\di\container_builder($phpbb_config_php_file, $phpbb_root_path, $phpEx);
+ $phpbb_container_builder->set_dump_container(false);
+ $phpbb_container_builder->set_use_extensions(false);
if (file_exists($phpbb_root_path . 'install/update/new/config'))
{
- $phpbb_container = phpbb_create_update_container($phpbb_root_path, $phpEx, $phpbb_root_path . 'install/update/new/config');
- }
- else
- {
- $phpbb_container = phpbb_create_update_container($phpbb_root_path, $phpEx, $phpbb_root_path . 'config');
+ $phpbb_container_builder->set_config_path($phpbb_root_path . 'install/update/new/config');
}
+ $phpbb_container = $phpbb_container_builder->get_container();
// Writes into global $cache
$cache = $phpbb_container->get('cache');
@@ -93,7 +93,7 @@ class install_update extends module
$this->new_location = $phpbb_root_path . 'install/update/new/';
// Init DB
- require($phpbb_root_path . 'config.' . $phpEx);
+ extract($phpbb_config_php_file->get_all());
require($phpbb_root_path . 'includes/constants.' . $phpEx);
// Special options for conflicts/modified files
@@ -102,7 +102,7 @@ class install_update extends module
define('MERGE_NEW_FILE', 3);
define('MERGE_MOD_FILE', 4);
- $dbms = phpbb_convert_30_dbms_to_31($dbms);
+ $dbms = $phpbb_config_php_file->convert_30_dbms_to_31($dbms);
$db = new $dbms();
diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql
index 572720ff95..9cc151f728 100644
--- a/phpBB/install/schemas/schema_data.sql
+++ b/phpBB/install/schemas/schema_data.sql
@@ -273,7 +273,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('tpl_allow_php', '0
INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_icons_path', 'images/upload_icons');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_path', 'files');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('use_system_cron', '0');
-INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.1.0-RC2-dev');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.1.0-RC3-dev');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_expire_days', '90');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_gc', '14400');
diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php
index b374e39367..91fc1215fc 100644
--- a/phpBB/language/en/acp/common.php
+++ b/phpBB/language/en/acp/common.php
@@ -225,12 +225,6 @@ $lang = array_merge($lang, array(
'BACK' => 'Back',
- 'CLI_DESCRIPTION_CRON_LIST' => 'Prints a list of ready and unready cron jobs.',
- 'CLI_DESCRIPTION_CRON_RUN' => 'Runs all ready cron tasks.',
- 'CLI_DESCRIPTION_CRON_RUN_ARGUMENT_1' => 'Name of the task to be run',
-
- 'CLI_DESCRIPTION_OPTION_SHELL' => 'Launch the shell.',
-
'COLOUR_SWATCH' => 'Web-safe colour swatch',
'CONFIG_UPDATED' => 'Configuration updated successfully.',
'CRON_LOCK_ERROR' => 'Could not obtain cron lock.',
@@ -247,7 +241,7 @@ $lang = array_merge($lang, array(
'DOWNLOAD_AS' => 'Download as',
'DOWNLOAD_STORE' => 'Download or store file',
'DOWNLOAD_STORE_EXPLAIN' => 'You may directly download the file or save it in your <samp>store/</samp> folder.',
- 'DOWNLOADS' => 'Downloads',
+ 'DOWNLOADS' => 'Downloads',
'EDIT' => 'Edit',
'ENABLE' => 'Enable',
@@ -310,7 +304,7 @@ $lang = array_merge($lang, array(
'TASKS_NOT_READY' => 'Not ready tasks:',
'TASKS_READY' => 'Ready tasks:',
- 'TOTAL_SIZE' => 'Total size',
+ 'TOTAL_SIZE' => 'Total size',
'UCP' => 'User Control Panel',
'USERNAMES_EXPLAIN' => 'Place each username on a separate line.',
diff --git a/phpBB/language/en/cli.php b/phpBB/language/en/cli.php
new file mode 100644
index 0000000000..eb0f5bb357
--- /dev/null
+++ b/phpBB/language/en/cli.php
@@ -0,0 +1,78 @@
+<?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.
+*
+*/
+
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+/**
+* DO NOT CHANGE
+*/
+if (empty($lang) || !is_array($lang))
+{
+ $lang = array();
+}
+
+// DEVELOPERS PLEASE NOTE
+//
+// Placeholders can now contain order information, e.g. instead of
+// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows
+// translators to re-order the output of data while ensuring it remains correct
+//
+// You do not need this where single placeholders are used, e.g. 'Message %d' is fine
+// equally where a string contains only two placeholders which are used to wrap text
+// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
+
+$lang = array_merge($lang, array(
+ 'CLI_CONFIG_CANNOT_CACHED' => 'Set this option if the configuration option changes too frequently to be efficiently cached.',
+ 'CLI_CONFIG_CURRENT' => 'Current configuration value, use 0 and 1 to specify boolean values',
+ 'CLI_CONFIG_DELETE_SUCCESS' => 'Successfully deleted config %s.',
+ 'CLI_CONFIG_NEW' => 'New configuration value, use 0 and 1 to specify boolean values',
+ 'CLI_CONFIG_NOT_EXISTS' => 'Config %s does not exist',
+ 'CLI_CONFIG_OPTION_NAME' => 'The configuration option’s name',
+ 'CLI_CONFIG_PRINT_WITHOUT_NEWLINE' => 'Set this option if the value should be printed without a new line at the end.',
+ 'CLI_CONFIG_INCREMENT_BY' => 'Amount to increment by',
+ 'CLI_CONFIG_INCREMENT_SUCCESS' => 'Successfully incremented config %s',
+ 'CLI_CONFIG_SET_FAILURE' => 'Could not set config %s',
+ 'CLI_CONFIG_SET_SUCCESS' => 'Successfully set config %s',
+
+ 'CLI_DESCRIPTION_CRON_LIST' => 'Prints a list of ready and unready cron jobs.',
+ 'CLI_DESCRIPTION_CRON_RUN' => 'Runs all ready cron tasks.',
+ 'CLI_DESCRIPTION_CRON_RUN_ARGUMENT_1' => 'Name of the task to be run',
+ 'CLI_DESCRIPTION_DB_MIGRATE' => 'Updates the database by applying migrations.',
+ 'CLI_DESCRIPTION_DELETE_CONFIG' => 'Deletes a configuration option',
+ 'CLI_DESCRIPTION_DISABLE_EXTENSION' => 'Disables the specified extension.',
+ 'CLI_DESCRIPTION_ENABLE_EXTENSION' => 'Enables the specified extension.',
+ 'CLI_DESCRIPTION_FIND_MIGRATIONS' => 'Finds migrations that are not depended on.',
+ 'CLI_DESCRIPTION_GET_CONFIG' => 'Gets a configuration option’s value',
+ 'CLI_DESCRIPTION_INCREMENT_CONFIG' => 'Increments a configuration option’s value',
+ 'CLI_DESCRIPTION_LIST_EXTENSIONS' => 'Lists all extensions in the database and on the filesystem.',
+ 'CLI_DESCRIPTION_OPTION_SAFE_MODE' => 'Run in Safe Mode (without extensions).',
+ 'CLI_DESCRIPTION_OPTION_SHELL' => 'Launch the shell.',
+ 'CLI_DESCRIPTION_PURGE_EXTENSION' => 'Purges the specified extension.',
+ 'CLI_DESCRIPTION_RECALCULATE_EMAIL_HASH' => 'Recalculates the user_email_hash column of the users table.',
+ 'CLI_DESCRIPTION_SET_ATOMIC_CONFIG' => 'Sets a configuration option’s value only if the old matches the current value',
+ 'CLI_DESCRIPTION_SET_CONFIG' => 'Sets a configuration option’s value',
+
+ 'CLI_EXTENSION_DISABLE_FAILURE' => 'Could not disable extension %s',
+ 'CLI_EXTENSION_DISABLE_SUCCESS' => 'Successfully disabled extension %s',
+ 'CLI_EXTENSION_ENABLE_FAILURE' => 'Could not enable extension %s',
+ 'CLI_EXTENSION_ENABLE_SUCCESS' => 'Successfully enabled extension %s',
+ 'CLI_EXTENSION_NAME' => 'Name of the extension',
+ 'CLI_EXTENSION_PURGE_FAILURE' => 'Could not purge extension %s',
+ 'CLI_EXTENSION_PURGE_SUCCESS' => 'Successfully purged extension %s',
+ 'CLI_EXTENSION_NOT_FOUND' => 'No extensions were found.',
+
+ 'CLI_FIXUP_RECALCULATE_EMAIL_HASH_SUCCESS' => 'Successfully recalculated all email hashes.',
+));
diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php
index dbef16c5f2..a58aec43cd 100644
--- a/phpBB/language/en/common.php
+++ b/phpBB/language/en/common.php
@@ -299,7 +299,7 @@ $lang = array_merge($lang, array(
1 => 'There is %d guest user online',
2 => 'There are %d guest users online',
),
- 'GUEST_USERS_TOTAL' => array(
+ 'GUEST_USERS_TOTAL' => array(
1 => '%d guest',
2 => '%d guests',
),
@@ -462,7 +462,7 @@ $lang = array_merge($lang, array(
'NOTIFICATION_REASON' => '<em>Reason:</em> %1$s.',
'NOTIFICATION_REPORT_PM' => '<strong>Private Message reported</strong> by %1$s:',
'NOTIFICATION_REPORT_POST' => '<strong>Post reported</strong> by %1$s:',
- 'NOTIFICATION_REPORT_CLOSED' => '<strong>Report closed</strong> by %1$s for:',
+ 'NOTIFICATION_REPORT_CLOSED' => '<strong>Report closed</strong> by %1$s for:',
'NOTIFICATION_TOPIC' => '<strong>New topic</strong> by %1$s:',
'NOTIFICATION_TOPIC_APPROVED' => '<strong>Topic approved</strong>:',
'NOTIFICATION_TOPIC_DISAPPROVED' => '<strong>Topic disapproved</strong>:',
@@ -821,6 +821,7 @@ $lang = array_merge($lang, array(
1 => 'Viewed %d time',
2 => 'Viewed %d times',
),
+ 'VIEWING_CONTACT_ADMIN' => 'Viewing contact page',
'VIEWING_FAQ' => 'Viewing FAQ',
'VIEWING_MEMBERS' => 'Viewing member details',
'VIEWING_ONLINE' => 'Viewing who is online',
diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php
index 65448e3299..a2b27f0a60 100644
--- a/phpBB/language/en/install.php
+++ b/phpBB/language/en/install.php
@@ -291,8 +291,8 @@ $lang = array_merge($lang, array(
'PCRE_UTF_SUPPORT_EXPLAIN' => 'phpBB will <strong>not</strong> run if your PHP installation is not compiled with UTF-8 support in the PCRE extension.',
'PHP_GETIMAGESIZE_SUPPORT' => 'PHP function getimagesize() is available',
'PHP_GETIMAGESIZE_SUPPORT_EXPLAIN' => '<strong>Required</strong> - In order for phpBB to function correctly, the getimagesize function needs to be available.',
- 'PHP_JSON_SUPPORT' => 'PHP JSON support',
- 'PHP_JSON_SUPPORT_EXPLAIN' => '<strong>Required</strong> - In order for phpBB to function correctly, the PHP JSON extension needs to be available.',
+ 'PHP_JSON_SUPPORT' => 'PHP JSON support',
+ 'PHP_JSON_SUPPORT_EXPLAIN' => '<strong>Required</strong> - In order for phpBB to function correctly, the PHP JSON extension needs to be available.',
'PHP_OPTIONAL_MODULE' => 'Optional modules',
'PHP_OPTIONAL_MODULE_EXPLAIN' => '<strong>Optional</strong> - These modules or applications are optional. However, if they are available they will enable extra features.',
'PHP_SUPPORTED_DB' => 'Supported databases',
diff --git a/phpBB/language/en/memberlist.php b/phpBB/language/en/memberlist.php
index c1bb25e7fb..1a05975892 100644
--- a/phpBB/language/en/memberlist.php
+++ b/phpBB/language/en/memberlist.php
@@ -146,6 +146,6 @@ $lang = array_merge($lang, array(
'VIEW_FACEBOOK_PROFILE' => 'View Facebook Profile',
'VIEW_SKYPE_PROFILE' => 'View Skype Profile',
'VIEW_TWITTER_PROFILE' => 'View Twitter Profile',
- 'VIEW_YOUTUBE_CHANNEL' => 'View YouTube Channel',
+ 'VIEW_YOUTUBE_CHANNEL' => 'View YouTube Channel',
'VIEW_GOOGLEPLUS_PROFILE' => 'View Google+ Profile',
));
diff --git a/phpBB/language/en/posting.php b/phpBB/language/en/posting.php
index 31d49e8bdf..2cd6ec59cc 100644
--- a/phpBB/language/en/posting.php
+++ b/phpBB/language/en/posting.php
@@ -60,7 +60,7 @@ $lang = array_merge($lang, array(
'BBCODE_O_HELP' => 'Ordered list: e.g. [list=1][*]First point[/list] or [list=a][*]Point a[/list]',
'BBCODE_P_HELP' => 'Insert image: [img]http://image_url[/img]',
'BBCODE_Q_HELP' => 'Quote text: [quote]text[/quote]',
- 'BBCODE_S_HELP' => 'Font colour: [color=red]text[/color] Tip: you can also use color=#FF0000',
+ 'BBCODE_S_HELP' => 'Font colour: [color=red]text[/color] or [color=#FF0000]text[/color]',
'BBCODE_U_HELP' => 'Underline text: [u]text[/u]',
'BBCODE_W_HELP' => 'Insert URL: [url]http://url[/url] or [url=http://url]URL text[/url]',
'BBCODE_Y_HELP' => 'List: Add list element',
diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php
index c4328aa3a6..d692828bd7 100644
--- a/phpBB/language/en/ucp.php
+++ b/phpBB/language/en/ucp.php
@@ -40,7 +40,7 @@ if (empty($lang) || !is_array($lang))
$lang = array_merge($lang, array(
'TERMS_OF_USE_CONTENT' => 'By accessing “%1$s” (hereinafter “we”, “us”, “our”, “%1$s”, “%2$s”), you agree to be legally bound by the following terms. If you do not agree to be legally bound by all of the following terms then please do not access and/or use “%1$s”. We may change these at any time and we’ll do our utmost in informing you, though it would be prudent to review this regularly yourself as your continued usage of “%1$s” after changes mean you agree to be legally bound by these terms as they are updated and/or amended.<br />
<br />
- Our forums are powered by phpBB (hereinafter “they”, “them”, “their”, “phpBB software”, “www.phpbb.com”, “phpBB Limited”, “phpBB Teams”) which is a bulletin board solution released under the “<a href="http://opensource.org/licenses/gpl-2.0.php">GNU General Public License v2</a>” (hereinafter “GPL”) and can be downloaded from <a href="https://www.phpbb.com/">www.phpbb.com</a>. The phpBB software only facilitates internet based discussions, the phpBB Limited are not responsible for what we allow and/or disallow as permissible content and/or conduct. For further information about phpBB, please see: <a href="https://www.phpbb.com/">https://www.phpbb.com/</a>.<br />
+ Our forums are powered by phpBB (hereinafter “they”, “them”, “their”, “phpBB software”, “www.phpbb.com”, “phpBB Limited”, “phpBB Teams”) which is a bulletin board solution released under the “<a href="http://opensource.org/licenses/gpl-2.0.php">GNU General Public License v2</a>” (hereinafter “GPL”) and can be downloaded from <a href="https://www.phpbb.com/">www.phpbb.com</a>. The phpBB software only facilitates internet based discussions; phpBB Limited is not responsible for what we allow and/or disallow as permissible content and/or conduct. For further information about phpBB, please see: <a href="https://www.phpbb.com/">https://www.phpbb.com/</a>.<br />
<br />
You agree not to post any abusive, obscene, vulgar, slanderous, hateful, threatening, sexually-orientated or any other material that may violate any laws be it of your country, the country where “%1$s” is hosted or International Law. Doing so may lead to you being immediately and permanently banned, with notification of your Internet Service Provider if deemed required by us. The IP address of all posts are recorded to aid in enforcing these conditions. You agree that “%1$s” have the right to remove, edit, move or close any topic at any time should we see fit. As a user you agree to any information you have entered to being stored in a database. While this information will not be disclosed to any third party without your consent, neither “%1$s” nor phpBB shall be held responsible for any hacking attempt that may lead to the data being compromised.
',
@@ -328,12 +328,12 @@ $lang = array_merge($lang, array(
'NOTIFICATION_TYPE_BOOKMARK' => 'Someone replies to a topic you have bookmarked',
'NOTIFICATION_TYPE_GROUP_REQUEST' => 'Someone requests to join a group you lead',
'NOTIFICATION_TYPE_IN_MODERATION_QUEUE' => 'A post or topic needs approval',
- 'NOTIFICATION_TYPE_MODERATION_QUEUE' => 'Your topics/posts are approved or disapproved by a moderator',
+ 'NOTIFICATION_TYPE_MODERATION_QUEUE' => 'Your topics/posts are approved or disapproved by a moderator',
'NOTIFICATION_TYPE_PM' => 'Someone sends you a private message',
'NOTIFICATION_TYPE_POST' => 'Someone replies to a topic to which you are subscribed',
'NOTIFICATION_TYPE_QUOTE' => 'Someone quotes you in a post',
'NOTIFICATION_TYPE_REPORT' => 'Someone reports a post',
- 'NOTIFICATION_TYPE_TOPIC' => 'Someone creates a topic in a forum to which you are subscribed',
+ 'NOTIFICATION_TYPE_TOPIC' => 'Someone creates a topic in a forum to which you are subscribed',
'NOTIFICATION_TYPE_ADMIN_ACTIVATE_USER' => 'Newly registered user requiring activation',
'NOTIFY_METHOD' => 'Notification method',
diff --git a/phpBB/phpbb/config_php_file.php b/phpBB/phpbb/config_php_file.php
new file mode 100644
index 0000000000..1a562e470d
--- /dev/null
+++ b/phpBB/phpbb/config_php_file.php
@@ -0,0 +1,175 @@
+<?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;
+
+class config_php_file
+{
+ /** @var string phpBB Root Path */
+ protected $phpbb_root_path;
+
+ /** @var string php file extension */
+ protected $php_ext;
+
+ /**
+ * Indicates whether the php config file has been loaded.
+ *
+ * @var bool
+ */
+ protected $config_loaded = false;
+
+ /**
+ * The content of the php config file
+ *
+ * @var array
+ */
+ protected $config_data = array();
+
+ /**
+ * The path to the config file. (Default: $phpbb_root_path . 'config.' . $php_ext)
+ *
+ * @var string
+ */
+ protected $config_file;
+
+ private $defined_vars;
+
+ /**
+ * Constructor
+ *
+ * @param string $phpbb_root_path phpBB Root Path
+ * @param string $php_ext php file extension
+ */
+ function __construct($phpbb_root_path, $php_ext)
+ {
+ $this->phpbb_root_path = $phpbb_root_path;
+ $this->php_ext = $php_ext;
+ $this->config_file = $this->phpbb_root_path . 'config.' . $this->php_ext;
+ }
+
+ /**
+ * Set the path to the config file.
+ *
+ * @param string $config_file
+ */
+ public function set_config_file($config_file)
+ {
+ $this->config_file = $config_file;
+ $this->config_loaded = false;
+ }
+
+ /**
+ * Returns an associative array containing the variables defined by the config file.
+ *
+ * @return bool|array Return the content of the config file or false if the file does not exists.
+ */
+ public function get_all()
+ {
+ if (!$this->load_config_file())
+ {
+ return false;
+ }
+
+ return $this->config_data;
+ }
+
+ /**
+ * Return the value of a variable defined into the config.php file and false if the variable does not exist.
+ *
+ * @param string $variable The name of the variable
+ * @return mixed
+ */
+ public function get($variable)
+ {
+ if (!$this->load_config_file())
+ {
+ return false;
+ }
+
+ return isset($this->config_data[$variable]) ? $this->config_data[$variable] : false;
+ }
+
+ /**
+ * Load the config file and store the information.
+ *
+ * @return bool True if the file was correctly loaded, false otherwise.
+ */
+ protected function load_config_file()
+ {
+ if (!$this->config_loaded)
+ {
+ if (file_exists($this->config_file))
+ {
+ $this->defined_vars = get_defined_vars();
+
+ require($this->config_file);
+ $this->config_data = array_diff_key(get_defined_vars(), $this->defined_vars);
+
+ $this->config_loaded = true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * Convert either 3.0 dbms or 3.1 db driver class name to 3.1 db driver class name.
+ *
+ * If $dbms is a valid 3.1 db driver class name, returns it unchanged.
+ * Otherwise prepends phpbb\db\driver\ to the dbms to convert a 3.0 dbms
+ * to 3.1 db driver class name.
+ *
+ * @param string $dbms dbms parameter
+ * @return string driver class
+ * @throws \RuntimeException
+ */
+ public function convert_30_dbms_to_31($dbms)
+ {
+ // Note: this check is done first because mysqli extension
+ // supplies a mysqli class, and class_exists($dbms) would return
+ // true for mysqli class.
+ // However, per the docblock any valid 3.1 driver name should be
+ // recognized by this function, and have priority over 3.0 dbms.
+ if (strpos($dbms, 'phpbb\db\driver') === false && class_exists('phpbb\db\driver\\' . $dbms))
+ {
+ return 'phpbb\db\driver\\' . $dbms;
+ }
+
+ if (class_exists($dbms))
+ {
+ // Additionally we could check that $dbms extends phpbb\db\driver\driver.
+ // http://php.net/manual/en/class.reflectionclass.php
+ // Beware of possible performance issues:
+ // http://stackoverflow.com/questions/294582/php-5-reflection-api-performance
+ // We could check for interface implementation in all paths or
+ // only when we do not prepend phpbb\db\driver\.
+
+ /*
+ $reflection = new \ReflectionClass($dbms);
+
+ if ($reflection->isSubclassOf('phpbb\db\driver\driver'))
+ {
+ return $dbms;
+ }
+ */
+
+ return $dbms;
+ }
+
+ throw new \RuntimeException("You have specified an invalid dbms driver: $dbms");
+ }
+}
diff --git a/phpBB/phpbb/console/application.php b/phpBB/phpbb/console/application.php
index b1f0635913..bc4897af18 100644
--- a/phpBB/phpbb/console/application.php
+++ b/phpBB/phpbb/console/application.php
@@ -17,7 +17,6 @@ use Symfony\Component\Console\Shell;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
-use Symfony\Component\DependencyInjection\TaggedContainerInterface;
class application extends \Symfony\Component\Console\Application
{
@@ -38,9 +37,26 @@ class application extends \Symfony\Component\Console\Application
*/
public function __construct($name, $version, \phpbb\user $user)
{
+ $this->user = $user;
+
parent::__construct($name, $version);
+ }
- $this->user = $user;
+ /**
+ * {@inheritdoc}
+ */
+ protected function getDefaultInputDefinition()
+ {
+ $input_definition = parent::getDefaultInputDefinition();
+
+ $input_definition->addOption(new InputOption(
+ 'safe-mode',
+ null,
+ InputOption::VALUE_NONE,
+ $this->user->lang('CLI_DESCRIPTION_OPTION_SAFE_MODE')
+ ));
+
+ return $input_definition;
}
/**
@@ -73,14 +89,13 @@ class application extends \Symfony\Component\Console\Application
/**
* Register a set of commands from the container
*
- * @param TaggedContainerInterface $container The container
- * @param string $tag The tag used to register the commands
+ * @param \phpbb\di\service_collection $command_collection The console service collection
*/
- public function register_container_commands(TaggedContainerInterface $container, $tag = 'console.command')
+ public function register_container_commands(\phpbb\di\service_collection $command_collection)
{
- foreach($container->findTaggedServiceIds($tag) as $id => $void)
+ foreach ($command_collection as $service_command)
{
- $this->add($container->get($id));
+ $this->add($service_command);
}
}
diff --git a/phpBB/phpbb/console/command/cache/purge.php b/phpBB/phpbb/console/command/cache/purge.php
index 379d2aa1ca..ec8229200c 100644
--- a/phpBB/phpbb/console/command/cache/purge.php
+++ b/phpBB/phpbb/console/command/cache/purge.php
@@ -29,31 +29,27 @@ class purge extends \phpbb\console\command\command
/** @var \phpbb\log\log */
protected $log;
- /** @var \phpbb\user */
- protected $user;
-
/** @var \phpbb\config\config */
protected $config;
/**
* Constructor
*
+ * @param \phpbb\user $user User instance
* @param \phpbb\cache\driver\driver_interface $cache Cache instance
* @param \phpbb\db\driver\driver_interface $db Database connection
* @param \phpbb\auth\auth $auth Auth instance
* @param \phpbb\log\log $log Logger instance
- * @param \phpbb\user $user User instance
* @param \phpbb\config\config $config Config instance
*/
- public function __construct(\phpbb\cache\driver\driver_interface $cache, \phpbb\db\driver\driver_interface $db, \phpbb\auth\auth $auth, \phpbb\log\log $log, \phpbb\user $user, \phpbb\config\config $config)
+ public function __construct(\phpbb\user $user, \phpbb\cache\driver\driver_interface $cache, \phpbb\db\driver\driver_interface $db, \phpbb\auth\auth $auth, \phpbb\log\log $log, \phpbb\config\config $config)
{
$this->cache = $cache;
$this->db = $db;
$this->auth = $auth;
$this->log = $log;
- $this->user = $user;
$this->config = $config;
- parent::__construct();
+ parent::__construct($user);
}
/**
@@ -63,7 +59,7 @@ class purge extends \phpbb\console\command\command
{
$this
->setName('cache:purge')
- ->setDescription('Purge the cache.')
+ ->setDescription($this->user->lang('PURGE_CACHE'))
;
}
diff --git a/phpBB/phpbb/console/command/command.php b/phpBB/phpbb/console/command/command.php
index d3449c0c38..638c989da2 100644
--- a/phpBB/phpbb/console/command/command.php
+++ b/phpBB/phpbb/console/command/command.php
@@ -15,4 +15,17 @@ namespace phpbb\console\command;
abstract class command extends \Symfony\Component\Console\Command\Command
{
+ /** @var \phpbb\user */
+ protected $user;
+
+ /**
+ * Constructor
+ *
+ * @param \phpbb\user $user User instance (mostly for translation)
+ */
+ public function __construct(\phpbb\user $user)
+ {
+ $this->user = $user;
+ parent::__construct();
+ }
}
diff --git a/phpBB/phpbb/console/command/config/command.php b/phpBB/phpbb/console/command/config/command.php
index de3fbd7fa7..f0ad5d4d19 100644
--- a/phpBB/phpbb/console/command/config/command.php
+++ b/phpBB/phpbb/console/command/config/command.php
@@ -17,10 +17,10 @@ abstract class command extends \phpbb\console\command\command
/** @var \phpbb\config\config */
protected $config;
- function __construct(\phpbb\config\config $config)
+ function __construct(\phpbb\user $user, \phpbb\config\config $config)
{
$this->config = $config;
- parent::__construct();
+ parent::__construct($user);
}
}
diff --git a/phpBB/phpbb/console/command/config/delete.php b/phpBB/phpbb/console/command/config/delete.php
index 1310bb18b4..efd276d7e3 100644
--- a/phpBB/phpbb/console/command/config/delete.php
+++ b/phpBB/phpbb/console/command/config/delete.php
@@ -25,11 +25,11 @@ class delete extends command
{
$this
->setName('config:delete')
- ->setDescription('Deletes a configuration option')
+ ->setDescription($this->user->lang('CLI_DESCRIPTION_DELETE_CONFIG'))
->addArgument(
'key',
InputArgument::REQUIRED,
- "The configuration option's name"
+ $this->user->lang('CLI_CONFIG_OPTION_NAME')
)
;
}
@@ -53,11 +53,11 @@ class delete extends command
{
$this->config->delete($key);
- $output->writeln("<info>Successfully deleted config $key</info>");
+ $output->writeln('<info>' . $this->user->lang('CLI_CONFIG_DELETE_SUCCESS', $key) . '</info>');
}
else
{
- $output->writeln("<error>Config $key does not exist</error>");
+ $output->writeln('<error>' . $this->user->lang('CLI_CONFIG_NOT_EXISTS', $key) . '</error>');
}
}
}
diff --git a/phpBB/phpbb/console/command/config/get.php b/phpBB/phpbb/console/command/config/get.php
index ee8c65110e..9c03b49a3d 100644
--- a/phpBB/phpbb/console/command/config/get.php
+++ b/phpBB/phpbb/console/command/config/get.php
@@ -26,17 +26,17 @@ class get extends command
{
$this
->setName('config:get')
- ->setDescription("Gets a configuration option's value")
+ ->setDescription($this->user->lang('CLI_DESCRIPTION_GET_CONFIG'))
->addArgument(
'key',
InputArgument::REQUIRED,
- "The configuration option's name"
+ $this->user->lang('CLI_CONFIG_OPTION_NAME')
)
->addOption(
'no-newline',
null,
InputOption::VALUE_NONE,
- 'Set this option if the value should be printed without a new line at the end.'
+ $this->user->lang('CLI_CONFIG_PRINT_WITHOUT_NEWLINE')
)
;
}
@@ -66,7 +66,7 @@ class get extends command
}
else
{
- $output->writeln("<error>Could not get config $key</error>");
+ $output->writeln('<error>' . $this->user->lang('CLI_CONFIG_NOT_EXISTS', $key) . '</error>');
}
}
}
diff --git a/phpBB/phpbb/console/command/config/increment.php b/phpBB/phpbb/console/command/config/increment.php
index 21f0660e61..b4d7438b66 100644
--- a/phpBB/phpbb/console/command/config/increment.php
+++ b/phpBB/phpbb/console/command/config/increment.php
@@ -26,22 +26,22 @@ class increment extends command
{
$this
->setName('config:increment')
- ->setDescription("Increments a configuration option's value")
+ ->setDescription($this->user->lang('CLI_DESCRIPTION_INCREMENT_CONFIG'))
->addArgument(
'key',
InputArgument::REQUIRED,
- "The configuration option's name"
+ $this->user->lang('CLI_CONFIG_OPTION_NAME')
)
->addArgument(
'increment',
InputArgument::REQUIRED,
- 'Amount to increment by'
+ $this->user->lang('CLI_CONFIG_INCREMENT_BY')
)
->addOption(
'dynamic',
'd',
InputOption::VALUE_NONE,
- 'Set this option if the configuration option changes too frequently to be efficiently cached.'
+ $this->user->lang('CLI_CONFIG_CANNOT_CACHED')
)
;
}
@@ -65,6 +65,6 @@ class increment extends command
$this->config->increment($key, $increment, $use_cache);
- $output->writeln("<info>Successfully incremented config $key</info>");
+ $output->writeln('<info>' . $this->user->lang('CLI_CONFIG_INCREMENT_SUCCESS', $key) . '</info>');
}
}
diff --git a/phpBB/phpbb/console/command/config/set.php b/phpBB/phpbb/console/command/config/set.php
index 587b7fb0de..695de31013 100644
--- a/phpBB/phpbb/console/command/config/set.php
+++ b/phpBB/phpbb/console/command/config/set.php
@@ -26,22 +26,22 @@ class set extends command
{
$this
->setName('config:set')
- ->setDescription("Sets a configuration option's value")
+ ->setDescription($this->user->lang('CLI_DESCRIPTION_SET_CONFIG'))
->addArgument(
'key',
InputArgument::REQUIRED,
- "The configuration option's name"
+ $this->user->lang('CLI_CONFIG_OPTION_NAME')
)
->addArgument(
'value',
InputArgument::REQUIRED,
- 'New configuration value, use 0 and 1 to specify boolean values'
+ $this->user->lang('CLI_CONFIG_NEW')
)
->addOption(
'dynamic',
'd',
InputOption::VALUE_NONE,
- 'Set this option if the configuration option changes too frequently to be efficiently cached.'
+ $this->user->lang('CLI_CONFIG_CANNOT_CACHED')
)
;
}
@@ -65,6 +65,6 @@ class set extends command
$this->config->set($key, $value, $use_cache);
- $output->writeln("<info>Successfully set config $key</info>");
+ $output->writeln('<info>' . $this->user->lang('CLI_CONFIG_SET_SUCCESS', $key) . '</info>');
}
}
diff --git a/phpBB/phpbb/console/command/config/set_atomic.php b/phpBB/phpbb/console/command/config/set_atomic.php
index a7a52155f9..e8c69a0885 100644
--- a/phpBB/phpbb/console/command/config/set_atomic.php
+++ b/phpBB/phpbb/console/command/config/set_atomic.php
@@ -26,27 +26,27 @@ class set_atomic extends command
{
$this
->setName('config:set-atomic')
- ->setDescription("Sets a configuration option's value only if the old matches the current value.")
+ ->setDescription($this->user->lang('CLI_DESCRIPTION_SET_ATOMIC_CONFIG'))
->addArgument(
'key',
InputArgument::REQUIRED,
- "The configuration option's name"
+ $this->user->lang('CLI_CONFIG_OPTION_NAME')
)
->addArgument(
'old',
InputArgument::REQUIRED,
- 'Current configuration value, use 0 and 1 to specify boolean values'
+ $this->user->lang('CLI_CONFIG_CURRENT')
)
->addArgument(
'new',
InputArgument::REQUIRED,
- 'New configuration value, use 0 and 1 to specify boolean values'
+ $this->user->lang('CLI_CONFIG_NEW')
)
->addOption(
'dynamic',
'd',
InputOption::VALUE_NONE,
- 'Set this option if the configuration option changes too frequently to be efficiently cached.'
+ $this->user->lang('CLI_CONFIG_CANNOT_CACHED')
)
;
}
@@ -72,12 +72,12 @@ class set_atomic extends command
if ($this->config->set_atomic($key, $old_value, $new_value, $use_cache))
{
- $output->writeln("<info>Successfully set config $key</info>");
+ $output->writeln('<info>' . $this->user->lang('CLI_CONFIG_SET_SUCCESS', $key) . '</info>');
return 0;
}
else
{
- $output->writeln("<error>Could not set config $key</error>");
+ $output->writeln('<error>' . $this->user->lang('CLI_CONFIG_SET_FAILURE', $key) . '</error>');
return 1;
}
}
diff --git a/phpBB/phpbb/console/command/cron/cron_list.php b/phpBB/phpbb/console/command/cron/cron_list.php
index 4f4228d9b3..c515fd9e80 100644
--- a/phpBB/phpbb/console/command/cron/cron_list.php
+++ b/phpBB/phpbb/console/command/cron/cron_list.php
@@ -20,20 +20,16 @@ class cron_list extends \phpbb\console\command\command
/** @var \phpbb\cron\manager */
protected $cron_manager;
- /** @var \phpbb\user */
- protected $user;
-
/**
* Constructor
*
- * @param \phpbb\cron\manager $cron_manager Cron manager
* @param \phpbb\user $user User instance
+ * @param \phpbb\cron\manager $cron_manager Cron manager
*/
- public function __construct(\phpbb\cron\manager $cron_manager, \phpbb\user $user)
+ public function __construct(\phpbb\user $user, \phpbb\cron\manager $cron_manager)
{
$this->cron_manager = $cron_manager;
- $this->user = $user;
- parent::__construct();
+ parent::__construct($user);
}
/**
diff --git a/phpBB/phpbb/console/command/cron/run.php b/phpBB/phpbb/console/command/cron/run.php
index 0b365ece67..72ad1205ef 100644
--- a/phpBB/phpbb/console/command/cron/run.php
+++ b/phpBB/phpbb/console/command/cron/run.php
@@ -25,23 +25,19 @@ class run extends \phpbb\console\command\command
/** @var \phpbb\lock\db */
protected $lock_db;
- /** @var \phpbb\user */
- protected $user;
-
/**
* Construct method
*
+ * @param \phpbb\user $user The user object (used to get language information)
* @param \phpbb\cron\manager $cron_manager The cron manager containing
* the cron tasks to be executed.
* @param \phpbb\lock\db $lock_db The lock for accessing database.
- * @param \phpbb\user $user The user object (used to get language information)
*/
- public function __construct(\phpbb\cron\manager $cron_manager, \phpbb\lock\db $lock_db, \phpbb\user $user)
+ public function __construct(\phpbb\user $user, \phpbb\cron\manager $cron_manager, \phpbb\lock\db $lock_db)
{
$this->cron_manager = $cron_manager;
$this->lock_db = $lock_db;
- $this->user = $user;
- parent::__construct();
+ parent::__construct($user);
}
/**
diff --git a/phpBB/phpbb/console/command/db/migrate.php b/phpBB/phpbb/console/command/db/migrate.php
index 2abeaf5268..c3caae5f70 100644
--- a/phpBB/phpbb/console/command/db/migrate.php
+++ b/phpBB/phpbb/console/command/db/migrate.php
@@ -32,31 +32,29 @@ class migrate extends \phpbb\console\command\command
/** @var \phpbb\log\log */
protected $log;
- /** @var \phpbb\user */
- protected $user;
-
- function __construct(\phpbb\db\migrator $migrator, \phpbb\extension\manager $extension_manager, \phpbb\config\config $config, \phpbb\cache\service $cache, \phpbb\log\log $log, \phpbb\user $user)
+ function __construct(\phpbb\user $user, \phpbb\db\migrator $migrator, \phpbb\extension\manager $extension_manager, \phpbb\config\config $config, \phpbb\cache\service $cache, \phpbb\log\log $log)
{
$this->migrator = $migrator;
$this->extension_manager = $extension_manager;
$this->config = $config;
$this->cache = $cache;
$this->log = $log;
- $this->user = $user;
+ parent::__construct($user);
$this->user->add_lang(array('common', 'install', 'migrator'));
- parent::__construct();
}
protected function configure()
{
$this
->setName('db:migrate')
- ->setDescription('Updates the database by applying migrations.')
+ ->setDescription($this->user->lang('CLI_DESCRIPTION_DB_MIGRATE'))
;
}
protected function execute(InputInterface $input, OutputInterface $output)
{
+ $this->migrator->create_migrations_table();
+
$this->load_migrations();
$orig_version = $this->config['version'];
while (!$this->migrator->finished())
diff --git a/phpBB/phpbb/console/command/dev/migration_tips.php b/phpBB/phpbb/console/command/dev/migration_tips.php
index c2f61568ea..f9047bdac8 100644
--- a/phpBB/phpbb/console/command/dev/migration_tips.php
+++ b/phpBB/phpbb/console/command/dev/migration_tips.php
@@ -20,17 +20,17 @@ class migration_tips extends \phpbb\console\command\command
/** @var \phpbb\extension\manager */
protected $extension_manager;
- function __construct(\phpbb\extension\manager $extension_manager)
+ function __construct(\phpbb\user $user, \phpbb\extension\manager $extension_manager)
{
$this->extension_manager = $extension_manager;
- parent::__construct();
+ parent::__construct($user);
}
protected function configure()
{
$this
->setName('dev:migration-tips')
- ->setDescription('Finds migrations that are not depended on.')
+ ->setDescription($this->user->lang('CLI_DESCRIPTION_FIND_MIGRATIONS'))
;
}
diff --git a/phpBB/phpbb/console/command/extension/command.php b/phpBB/phpbb/console/command/extension/command.php
index 21bb640504..364d954082 100644
--- a/phpBB/phpbb/console/command/extension/command.php
+++ b/phpBB/phpbb/console/command/extension/command.php
@@ -20,11 +20,11 @@ abstract class command extends \phpbb\console\command\command
/** @var \phpbb\log\log */
protected $log;
- public function __construct(\phpbb\extension\manager $manager, \phpbb\log\log $log)
+ public function __construct(\phpbb\user $user, \phpbb\extension\manager $manager, \phpbb\log\log $log)
{
$this->manager = $manager;
$this->log = $log;
- parent::__construct();
+ parent::__construct($user);
}
}
diff --git a/phpBB/phpbb/console/command/extension/disable.php b/phpBB/phpbb/console/command/extension/disable.php
index c04848aa01..1eee16cbd9 100644
--- a/phpBB/phpbb/console/command/extension/disable.php
+++ b/phpBB/phpbb/console/command/extension/disable.php
@@ -22,11 +22,11 @@ class disable extends command
{
$this
->setName('extension:disable')
- ->setDescription('Disables the specified extension.')
+ ->setDescription($this->user->lang('CLI_DESCRIPTION_DISABLE_EXTENSION'))
->addArgument(
'extension-name',
InputArgument::REQUIRED,
- 'Name of the extension'
+ $this->user->lang('CLI_EXTENSION_NAME')
)
;
}
@@ -39,13 +39,13 @@ class disable extends command
if ($this->manager->is_enabled($name))
{
- $output->writeln("<error>Could not disable extension $name</error>");
+ $output->writeln('<error>' . $this->user->lang('CLI_EXTENSION_DISABLE_FAILURE', $name) . '</error>');
return 1;
}
else
{
$this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_DISABLE', time(), array($name));
- $output->writeln("<info>Successfully disabled extension $name</info>");
+ $output->writeln('<info>' . $this->user->lang('CLI_EXTENSION_DISABLE_SUCCESS', $name) . '</info>');
return 0;
}
}
diff --git a/phpBB/phpbb/console/command/extension/enable.php b/phpBB/phpbb/console/command/extension/enable.php
index 86a034cdf4..59ff11e9b7 100644
--- a/phpBB/phpbb/console/command/extension/enable.php
+++ b/phpBB/phpbb/console/command/extension/enable.php
@@ -22,11 +22,11 @@ class enable extends command
{
$this
->setName('extension:enable')
- ->setDescription('Enables the specified extension.')
+ ->setDescription($this->user->lang('CLI_DESCRIPTION_ENABLE_EXTENSION'))
->addArgument(
'extension-name',
InputArgument::REQUIRED,
- 'Name of the extension'
+ $this->user->lang('CLI_EXTENSION_NAME')
)
;
}
@@ -40,12 +40,12 @@ class enable extends command
if ($this->manager->is_enabled($name))
{
$this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_ENABLE', time(), array($name));
- $output->writeln("<info>Successfully enabled extension $name</info>");
+ $output->writeln('<info>' . $this->user->lang('CLI_EXTENSION_ENABLE_SUCCESS', $name) . '</info>');
return 0;
}
else
{
- $output->writeln("<error>Could not enable extension $name</error>");
+ $output->writeln('<error>' . $this->user->lang('CLI_EXTENSION_ENABLE_FAILURE', $name) . '</error>');
return 1;
}
}
diff --git a/phpBB/phpbb/console/command/extension/purge.php b/phpBB/phpbb/console/command/extension/purge.php
index 841598b90a..517e9a74c9 100644
--- a/phpBB/phpbb/console/command/extension/purge.php
+++ b/phpBB/phpbb/console/command/extension/purge.php
@@ -22,11 +22,11 @@ class purge extends command
{
$this
->setName('extension:purge')
- ->setDescription('Purges the specified extension.')
+ ->setDescription($this->user->lang('CLI_DESCRIPTION_PURGE_EXTENSION'))
->addArgument(
'extension-name',
InputArgument::REQUIRED,
- 'Name of the extension'
+ $this->user->lang('CLI_EXTENSION_NAME')
)
;
}
@@ -39,13 +39,13 @@ class purge extends command
if ($this->manager->is_enabled($name))
{
- $output->writeln("<error>Could not purge extension $name</error>");
+ $output->writeln('<error>' . $this->user->lang('CLI_EXTENSION_PURGE_FAILURE', $name) . '</error>');
return 1;
}
else
{
$this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_PURGE', time(), array($name));
- $output->writeln("<info>Successfully purge extension $name</info>");
+ $output->writeln('<info>' . $this->user->lang('CLI_EXTENSION_PURGE_SUCCESS', $name) . '</info>');
return 0;
}
}
diff --git a/phpBB/phpbb/console/command/extension/show.php b/phpBB/phpbb/console/command/extension/show.php
index 2db1c59e24..6ce9607098 100644
--- a/phpBB/phpbb/console/command/extension/show.php
+++ b/phpBB/phpbb/console/command/extension/show.php
@@ -21,7 +21,7 @@ class show extends command
{
$this
->setName('extension:show')
- ->setDescription('Lists all extensions in the database and on the filesystem.')
+ ->setDescription($this->user->lang('CLI_DESCRIPTION_LIST_EXTENSIONS'))
;
}
@@ -32,7 +32,7 @@ class show extends command
if (empty($all))
{
- $output->writeln('<comment>No extensions were found.</comment>');
+ $output->writeln('<comment>' . $this->user->lang('CLI_EXTENSION_NOT_FOUND') . '</comment>');
return 3;
}
diff --git a/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php b/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php
index ec04da4267..ec4e1b0ee7 100644
--- a/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php
+++ b/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php
@@ -20,18 +20,18 @@ class recalculate_email_hash extends \phpbb\console\command\command
/** @var \phpbb\db\driver\driver_interface */
protected $db;
- function __construct(\phpbb\db\driver\driver_interface $db)
+ function __construct(\phpbb\user $user, \phpbb\db\driver\driver_interface $db)
{
$this->db = $db;
- parent::__construct();
+ parent::__construct($user);
}
protected function configure()
{
$this
->setName('fixup:recalculate-email-hash')
- ->setDescription('Recalculates the user_email_hash column of the users table.')
+ ->setDescription($this->user->lang('CLI_DESCRIPTION_RECALCULATE_EMAIL_HASH'))
;
}
@@ -70,6 +70,6 @@ class recalculate_email_hash extends \phpbb\console\command\command
}
$this->db->sql_freeresult($result);
- $output->writeln('<info>Successfully recalculated all email hashes.</info>');
+ $output->writeln('<info>' . $this->user->lang('CLI_FIXUP_RECALCULATE_EMAIL_HASH_SUCCESS') . '</info>');
}
}
diff --git a/phpBB/phpbb/cron/task/core/tidy_search.php b/phpBB/phpbb/cron/task/core/tidy_search.php
index 2de744b7c1..2c30274dfa 100644
--- a/phpBB/phpbb/cron/task/core/tidy_search.php
+++ b/phpBB/phpbb/cron/task/core/tidy_search.php
@@ -54,8 +54,7 @@ class tidy_search extends \phpbb\cron\task\base
*/
public function run()
{
- // Select the search method
- $search_type = basename($this->config['search_type']);
+ $search_type = $this->config['search_type'];
// We do some additional checks in the module to ensure it can actually be utilised
$error = false;
@@ -78,10 +77,7 @@ class tidy_search extends \phpbb\cron\task\base
*/
public function is_runnable()
{
- // Select the search method
- $search_type = basename($this->config['search_type']);
-
- return class_exists($search_type);
+ return class_exists($this->config['search_type']);
}
/**
diff --git a/phpBB/phpbb/db/driver/postgres.php b/phpBB/phpbb/db/driver/postgres.php
index a67cd9f7c2..83e9fa51f6 100644
--- a/phpBB/phpbb/db/driver/postgres.php
+++ b/phpBB/phpbb/db/driver/postgres.php
@@ -15,10 +15,11 @@ namespace phpbb\db\driver;
/**
* PostgreSQL Database Abstraction Layer
-* Minimum Requirement is Version 7.3+
+* Minimum Requirement is Version 8.3+
*/
class postgres extends \phpbb\db\driver\driver
{
+ var $multi_insert = true;
var $last_query_text = '';
var $connect_error = '';
@@ -101,11 +102,6 @@ class postgres extends \phpbb\db\driver\driver
if ($this->db_connect_id)
{
- if (version_compare($this->sql_server_info(true), '8.2', '>='))
- {
- $this->multi_insert = true;
- }
-
if ($schema !== '')
{
@pg_query($this->db_connect_id, 'SET search_path TO ' . $schema);
diff --git a/phpBB/phpbb/db/migration/data/v310/rc2.php b/phpBB/phpbb/db/migration/data/v310/rc2.php
new file mode 100644
index 0000000000..e1323659da
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v310/rc2.php
@@ -0,0 +1,31 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+namespace phpbb\db\migration\data\v310;
+
+class rc2 extends \phpbb\db\migration\migration
+{
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v310\rc1',
+ );
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('config.update', array('version', '3.1.0-RC2')),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v310/search_type.php b/phpBB/phpbb/db/migration/data/v310/search_type.php
new file mode 100644
index 0000000000..f89456ae19
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v310/search_type.php
@@ -0,0 +1,34 @@
+<?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\v310;
+
+class search_type extends \phpbb\db\migration\migration
+{
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v310\dev',
+ );
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('if', array(
+ (is_file($this->phpbb_root_path . 'phpbb/search/' . $this->config['search_type'] . $this->php_ext)),
+ array('config.update', array('search_type', '\\phpbb\\search\\' . $this->config['search_type'])),
+ )),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/profilefield_base_migration.php b/phpBB/phpbb/db/migration/profilefield_base_migration.php
index d416a9b228..9000949a7d 100644
--- a/phpBB/phpbb/db/migration/profilefield_base_migration.php
+++ b/phpBB/phpbb/db/migration/profilefield_base_migration.php
@@ -21,6 +21,23 @@ abstract class profilefield_base_migration extends \phpbb\db\migration\migration
protected $profilefield_data;
+ /**
+ * Language data should be in array -> each language_data in separate key
+ * array(
+ * array(
+ * 'option_id' => value,
+ * 'field_type' => value,
+ * 'lang_value' => value,
+ * ),
+ * array(
+ * 'option_id' => value,
+ * 'field_type' => value,
+ * 'lang_value' => value,
+ * ),
+ * )
+ */
+ protected $profilefield_language_data;
+
protected $user_column_name;
public function effectively_installed()
@@ -58,6 +75,13 @@ abstract class profilefield_base_migration extends \phpbb\db\migration\migration
);
}
+ public function revert_data()
+ {
+ return array(
+ array('custom', array(array($this, 'delete_custom_profile_field_data'))),
+ );
+ }
+
public function create_custom_field()
{
$sql = 'SELECT MAX(field_order) as max_field_order
@@ -83,8 +107,8 @@ abstract class profilefield_base_migration extends \phpbb\db\migration\migration
while ($lang_id = (int) $this->db->sql_fetchfield('lang_id'))
{
$insert_buffer->insert(array(
- 'field_id' => $field_id,
- 'lang_id' => $lang_id,
+ 'field_id' => (int) $field_id,
+ 'lang_id' => (int) $lang_id,
'lang_name' => $lang_name,
'lang_explain' => '',
'lang_default_value' => '',
@@ -96,6 +120,69 @@ abstract class profilefield_base_migration extends \phpbb\db\migration\migration
}
/**
+ * Create Custom profile fields languguage entries
+ */
+ public function create_language_entries()
+ {
+ $field_id = $this->get_custom_profile_field_id();
+
+ $insert_buffer = new \phpbb\db\sql_insert_buffer($this->db, PROFILE_FIELDS_LANG_TABLE);
+
+ $sql = 'SELECT lang_id
+ FROM ' . LANG_TABLE;
+ $result = $this->db->sql_query($sql);
+ while ($lang_id = (int) $this->db->sql_fetchfield('lang_id'))
+ {
+ foreach ($this->profilefield_language_data as $language_data)
+ {
+ $insert_buffer->insert(array_merge(array(
+ 'field_id' => (int) $field_id,
+ 'lang_id' => (int) $lang_id,
+ ), $language_data));
+ }
+ }
+ $this->db->sql_freeresult($result);
+
+ $insert_buffer->flush();
+ }
+
+ /**
+ * Clean database when reverting the migration
+ */
+ public function delete_custom_profile_field_data()
+ {
+ $field_id = $this->get_custom_profile_field_id();
+
+ $sql = 'DELETE FROM ' . PROFILE_FIELDS_TABLE . '
+ WHERE field_id = ' . (int) $field_id;
+ $this->db->sql_query($sql);
+
+ $sql = 'DELETE FROM ' . PROFILE_LANG_TABLE . '
+ WHERE field_id = ' . (int) $field_id;
+ $this->db->sql_query($sql);
+
+ $sql = 'DELETE FROM ' . PROFILE_FIELDS_LANG_TABLE . '
+ WHERE field_id = ' . (int) $field_id;
+ $this->db->sql_query($sql);
+ }
+
+ /**
+ * Get custom profile field id
+ * @return int custom profile filed id
+ */
+ public function get_custom_profile_field_id()
+ {
+ $sql = 'SELECT field_id
+ FROM ' . PROFILE_FIELDS_TABLE . "
+ WHERE field_name = '" . $this->profilefield_name . "'";
+ $result = $this->db->sql_query($sql);
+ $field_id = (int) $this->db->sql_fetchfield('field_id');
+ $this->db->sql_freeresult($result);
+
+ return $field_id;
+ }
+
+ /**
* @param int $start Start of staggering step
* @return mixed int start of the next step, null if the end was reached
*/
diff --git a/phpBB/phpbb/db/migrator.php b/phpBB/phpbb/db/migrator.php
index 8b089a060f..8bc63e564a 100644
--- a/phpBB/phpbb/db/migrator.php
+++ b/phpBB/phpbb/db/migrator.php
@@ -767,4 +767,28 @@ class migrator
return $this->migrations;
}
+
+ /**
+ * Creates the migrations table if it does not exist.
+ * @return null
+ */
+ public function create_migrations_table()
+ {
+ // Make sure migrations have been installed.
+ if (!$this->db_tools->sql_table_exists($this->table_prefix . 'migrations'))
+ {
+ $this->db_tools->sql_create_table($this->table_prefix . 'migrations', array(
+ 'COLUMNS' => array(
+ 'migration_name' => array('VCHAR', ''),
+ 'migration_depends_on' => array('TEXT', ''),
+ 'migration_schema_done' => array('BOOL', 0),
+ 'migration_data_done' => array('BOOL', 0),
+ 'migration_data_state' => array('TEXT', ''),
+ 'migration_start_time' => array('TIMESTAMP', 0),
+ 'migration_end_time' => array('TIMESTAMP', 0),
+ ),
+ 'PRIMARY_KEY' => 'migration_name',
+ ));
+ }
+ }
}
diff --git a/phpBB/phpbb/db/tools.php b/phpBB/phpbb/db/tools.php
index 18defc4535..ae0c695aa2 100644
--- a/phpBB/phpbb/db/tools.php
+++ b/phpBB/phpbb/db/tools.php
@@ -1487,8 +1487,16 @@ class tools
$return_array['textimage'] = $column_type === '[text]';
- $sql .= 'NOT NULL';
- $sql_default .= 'NOT NULL';
+ if (!is_null($column_data[1]) || (isset($column_data[2]) && $column_data[2] == 'auto_increment'))
+ {
+ $sql .= 'NOT NULL';
+ $sql_default .= 'NOT NULL';
+ }
+ else
+ {
+ $sql .= 'NULL';
+ $sql_default .= 'NULL';
+ }
$return_array['column_type_sql_default'] = $sql_default;
@@ -1503,7 +1511,15 @@ class tools
{
$sql .= (strpos($column_data[1], '0x') === 0) ? "DEFAULT {$column_data[1]} " : "DEFAULT '{$column_data[1]}' ";
}
- $sql .= 'NOT NULL';
+
+ if (!is_null($column_data[1]))
+ {
+ $sql .= 'NOT NULL';
+ }
+ else
+ {
+ $sql .= 'NULL';
+ }
if (isset($column_data[2]))
{
@@ -1528,7 +1544,7 @@ class tools
// Oracle does not like setting NOT NULL on a column that is already NOT NULL (this happens only on number fields)
if (!preg_match('/number/i', $column_type))
{
- $sql .= ($column_data[1] === '') ? '' : 'NOT NULL';
+ $sql .= ($column_data[1] === '' || $column_data[1] === null) ? '' : 'NOT NULL';
}
$return_array['auto_increment'] = false;
@@ -1556,6 +1572,12 @@ class tools
$return_array['null'] = 'NOT NULL';
$sql .= 'NOT NULL ';
}
+ else
+ {
+ $default_val = "'" . $column_data[1] . "'";
+ $return_array['null'] = 'NULL';
+ $sql .= 'NULL ';
+ }
$return_array['default'] = $default_val;
@@ -1588,8 +1610,11 @@ class tools
$sql .= ' ' . $column_type;
}
- $sql .= ' NOT NULL ';
- $sql .= (!is_null($column_data[1])) ? "DEFAULT '{$column_data[1]}'" : '';
+ if (!is_null($column_data[1]))
+ {
+ $sql .= ' NOT NULL ';
+ $sql .= "DEFAULT '{$column_data[1]}'";
+ }
break;
}
diff --git a/phpBB/phpbb/di/container_builder.php b/phpBB/phpbb/di/container_builder.php
new file mode 100644
index 0000000000..553b723cc8
--- /dev/null
+++ b/phpBB/phpbb/di/container_builder.php
@@ -0,0 +1,402 @@
+<?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\di;
+
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\DependencyInjection\Dumper\PhpDumper;
+
+class container_builder
+{
+ /** @var string phpBB Root Path */
+ protected $phpbb_root_path;
+
+ /** @var string php file extension */
+ protected $php_ext;
+
+ /**
+ * The container under construction
+ *
+ * @var ContainerBuilder
+ */
+ protected $container;
+
+ /**
+ * @var \phpbb\db\driver\driver_interface
+ */
+ protected $dbal_connection = null;
+
+ /**
+ * @var array the installed extensions
+ */
+ protected $installed_exts = null;
+
+ /**
+ * Indicates whether the php config file should be injected into the container (default to true).
+ *
+ * @var bool
+ */
+ protected $inject_config = true;
+
+ /**
+ * Indicates whether extensions should be used (default to true).
+ *
+ * @var bool
+ */
+ protected $use_extensions = true;
+
+ /**
+ * Defines a custom path to find the configuration of the container (default to $this->phpbb_root_path . 'config')
+ *
+ * @var string
+ */
+ protected $config_path = null;
+
+ /**
+ * Indicates whether the phpBB compile pass should be used (default to true).
+ *
+ * @var bool
+ */
+ protected $use_custom_pass = true;
+
+ /**
+ * Indicates whether the kernel compile pass should be used (default to true).
+ *
+ * @var bool
+ */
+ protected $use_kernel_pass = true;
+
+ /**
+ * Indicates whether the container should be dumped to the filesystem (default to true).
+ *
+ * If DEBUG_CONTAINER is set this option is ignored and a new container is build.
+ *
+ * @var bool
+ */
+ protected $dump_container = true;
+
+ /**
+ * Indicates if the container should be compiled automatically (default to true).
+ *
+ * @var bool
+ */
+ protected $compile_container = true;
+
+ /**
+ * Custom parameters to inject into the container.
+ *
+ * Default to true:
+ * array(
+ * 'core.root_path', $this->phpbb_root_path,
+ * 'core.php_ext', $this->php_ext,
+ * );
+ *
+ * @var array
+ */
+ protected $custom_parameters = null;
+
+ /**
+ * @var \phpbb\config_php_file
+ */
+ protected $config_php_file;
+
+ /**
+ * Constructor
+ *
+ * @param \phpbb\config_php_file $config_php_file
+ * @param string $phpbb_root_path Path to the phpbb includes directory.
+ * @param string $php_ext php file extension
+ */
+ function __construct(\phpbb\config_php_file $config_php_file, $phpbb_root_path, $php_ext)
+ {
+ $this->config_php_file = $config_php_file;
+ $this->phpbb_root_path = $phpbb_root_path;
+ $this->php_ext = $php_ext;
+ }
+
+ /**
+ * Build and return a new Container respecting the current configuration
+ *
+ * @return \phpbb_cache_container|ContainerBuilder
+ */
+ public function get_container()
+ {
+ $container_filename = $this->get_container_filename();
+ if (!defined('DEBUG_CONTAINER') && $this->dump_container && file_exists($container_filename))
+ {
+ require($container_filename);
+ $this->container = new \phpbb_cache_container();
+ }
+ else
+ {
+ if ($this->config_path === null)
+ {
+ $this->config_path = $this->phpbb_root_path . 'config';
+ }
+ $container_extensions = array(new \phpbb\di\extension\core($this->config_path));
+
+ if ($this->use_extensions)
+ {
+ $installed_exts = $this->get_installed_extensions();
+ $container_extensions[] = new \phpbb\di\extension\ext($installed_exts);
+ }
+
+ if ($this->inject_config)
+ {
+ $container_extensions[] = new \phpbb\di\extension\config($this->config_php_file);
+ }
+
+ $this->container = $this->create_container($container_extensions);
+
+ if ($this->use_custom_pass)
+ {
+ $this->container->addCompilerPass(new \phpbb\di\pass\collection_pass());
+
+ if ($this->use_kernel_pass)
+ {
+ $this->container->addCompilerPass(new \phpbb\di\pass\kernel_pass());
+ }
+ }
+
+ $this->inject_custom_parameters();
+
+ if ($this->compile_container)
+ {
+ $this->container->compile();
+ }
+
+ if ($this->dump_container && !defined('DEBUG_CONTAINER'))
+ {
+ $this->dump_container($container_filename);
+ }
+ }
+
+ $this->container->set('config.php', $this->config_php_file);
+
+ if ($this->compile_container)
+ {
+ $this->inject_dbal();
+ }
+
+ return $this->container;
+ }
+
+ /**
+ * Set if the extensions should be used.
+ *
+ * @param bool $use_extensions
+ */
+ public function set_use_extensions($use_extensions)
+ {
+ $this->use_extensions = $use_extensions;
+ }
+
+ /**
+ * Set if the phpBB compile pass have to be used.
+ *
+ * @param bool $use_custom_pass
+ */
+ public function set_use_custom_pass($use_custom_pass)
+ {
+ $this->use_custom_pass = $use_custom_pass;
+ }
+
+ /**
+ * Set if the kernel compile pass have to be used.
+ *
+ * @param bool $use_kernel_pass
+ */
+ public function set_use_kernel_pass($use_kernel_pass)
+ {
+ $this->use_kernel_pass = $use_kernel_pass;
+ }
+
+ /**
+ * Set if the php config file should be injecting into the container.
+ *
+ * @param bool $inject_config
+ */
+ public function set_inject_config($inject_config)
+ {
+ $this->inject_config = $inject_config;
+ }
+
+ /**
+ * Set if a dump container should be used.
+ *
+ * If DEBUG_CONTAINER is set this option is ignored and a new container is build.
+ *
+ * @var bool $dump_container
+ */
+ public function set_dump_container($dump_container)
+ {
+ $this->dump_container = $dump_container;
+ }
+
+ /**
+ * Set if the container should be compiled automatically (default to true).
+ *
+ * @var bool $dump_container
+ */
+ public function set_compile_container($compile_container)
+ {
+ $this->compile_container = $compile_container;
+ }
+
+ /**
+ * Set a custom path to find the configuration of the container
+ *
+ * @param string $config_path
+ */
+ public function set_config_path($config_path)
+ {
+ $this->config_path = $config_path;
+ }
+
+ /**
+ * Set custom parameters to inject into the container.
+ *
+ * @param array $custom_parameters
+ */
+ public function set_custom_parameters($custom_parameters)
+ {
+ $this->custom_parameters = $custom_parameters;
+ }
+
+ /**
+ * Dump the container to the disk.
+ *
+ * @param string $container_filename The name of the file.
+ */
+ protected function dump_container($container_filename)
+ {
+ $dumper = new PhpDumper($this->container);
+ $cached_container_dump = $dumper->dump(array(
+ 'class' => 'phpbb_cache_container',
+ 'base_class' => 'Symfony\\Component\\DependencyInjection\\ContainerBuilder',
+ ));
+
+ file_put_contents($container_filename, $cached_container_dump);
+ }
+
+ /**
+ * Inject the connection into the container if one was opened.
+ */
+ protected function inject_dbal()
+ {
+ if ($this->dbal_connection !== null)
+ {
+ $this->container->get('dbal.conn')->set_driver($this->dbal_connection);
+ }
+ }
+
+ /**
+ * Get DB connection.
+ *
+ * @return \phpbb\db\driver\driver_interface
+ */
+ protected function get_dbal_connection()
+ {
+ if ($this->dbal_connection === null)
+ {
+ $dbal_driver_class = $this->config_php_file->convert_30_dbms_to_31($this->config_php_file->get('dbms'));
+ $this->dbal_connection = new $dbal_driver_class();
+ $this->dbal_connection->sql_connect(
+ $this->config_php_file->get('dbhost'),
+ $this->config_php_file->get('dbuser'),
+ $this->config_php_file->get('dbpasswd'),
+ $this->config_php_file->get('dbname'),
+ $this->config_php_file->get('dbport'),
+ defined('PHPBB_DB_NEW_LINK') && PHPBB_DB_NEW_LINK
+ );
+ }
+
+ return $this->dbal_connection;
+ }
+
+ /**
+ * Get enabled extensions.
+ *
+ * @return array enabled extensions
+ */
+ protected function get_installed_extensions()
+ {
+ $db = $this->get_dbal_connection();
+ $extension_table = $this->config_php_file->get('table_prefix') . 'ext';
+
+ $sql = 'SELECT *
+ FROM ' . $extension_table . '
+ WHERE ext_active = 1';
+
+ $result = $db->sql_query($sql);
+ $rows = $db->sql_fetchrowset($result);
+ $db->sql_freeresult($result);
+
+ $exts = array();
+ foreach ($rows as $row)
+ {
+ $exts[$row['ext_name']] = $this->phpbb_root_path . 'ext/' . $row['ext_name'] . '/';
+ }
+
+ return $exts;
+ }
+
+ /**
+ * Create the ContainerBuilder object
+ *
+ * @param array $extensions Array of Container extension objects
+ * @return ContainerBuilder object
+ */
+ protected function create_container(array $extensions)
+ {
+ $container = new ContainerBuilder();
+
+ foreach ($extensions as $extension)
+ {
+ $container->registerExtension($extension);
+ $container->loadFromExtension($extension->getAlias());
+ }
+
+ return $container;
+ }
+
+ /**
+ * Inject the customs parameters into the container
+ */
+ protected function inject_custom_parameters()
+ {
+ if ($this->custom_parameters === null)
+ {
+ $this->custom_parameters = array(
+ 'core.root_path' => $this->phpbb_root_path,
+ 'core.php_ext' => $this->php_ext,
+ );
+ }
+
+ foreach ($this->custom_parameters as $key => $value)
+ {
+ $this->container->setParameter($key, $value);
+ }
+ }
+
+ /**
+ * Get the filename under which the dumped container will be stored.
+ *
+ * @return string Path for dumped container
+ */
+ protected function get_container_filename()
+ {
+ $filename = str_replace(array('/', '.'), array('slash', 'dot'), $this->phpbb_root_path);
+ return $this->phpbb_root_path . 'cache/container_' . $filename . '.' . $this->php_ext;
+ }
+}
diff --git a/phpBB/phpbb/di/extension/config.php b/phpBB/phpbb/di/extension/config.php
index a7d7284f85..27ebc94bae 100644
--- a/phpBB/phpbb/di/extension/config.php
+++ b/phpBB/phpbb/di/extension/config.php
@@ -21,9 +21,12 @@ use Symfony\Component\HttpKernel\DependencyInjection\Extension;
*/
class config extends Extension
{
- public function __construct($config_file)
+ /** @var array */
+ protected $config_php;
+
+ public function __construct(\phpbb\config_php_file $config_php)
{
- $this->config_file = $config_file;
+ $this->config_php = $config_php;
}
/**
@@ -36,17 +39,15 @@ class config extends Extension
*/
public function load(array $config, ContainerBuilder $container)
{
- require($this->config_file);
-
- $container->setParameter('core.adm_relative_path', (isset($phpbb_adm_relative_path) ? $phpbb_adm_relative_path : 'adm/'));
- $container->setParameter('core.table_prefix', $table_prefix);
- $container->setParameter('cache.driver.class', $this->convert_30_acm_type($acm_type));
- $container->setParameter('dbal.driver.class', phpbb_convert_30_dbms_to_31($dbms));
- $container->setParameter('dbal.dbhost', $dbhost);
- $container->setParameter('dbal.dbuser', $dbuser);
- $container->setParameter('dbal.dbpasswd', $dbpasswd);
- $container->setParameter('dbal.dbname', $dbname);
- $container->setParameter('dbal.dbport', $dbport);
+ $container->setParameter('core.adm_relative_path', ($this->config_php->get('phpbb_adm_relative_path') ? $this->config_php->get('phpbb_adm_relative_path') : 'adm/'));
+ $container->setParameter('core.table_prefix', $this->config_php->get('table_prefix'));
+ $container->setParameter('cache.driver.class', $this->convert_30_acm_type($this->config_php->get('acm_type')));
+ $container->setParameter('dbal.driver.class', $this->config_php->convert_30_dbms_to_31($this->config_php->get('dbms')));
+ $container->setParameter('dbal.dbhost', $this->config_php->get('dbhost'));
+ $container->setParameter('dbal.dbuser', $this->config_php->get('dbuser'));
+ $container->setParameter('dbal.dbpasswd', $this->config_php->get('dbpasswd'));
+ $container->setParameter('dbal.dbname', $this->config_php->get('dbname'));
+ $container->setParameter('dbal.dbport', $this->config_php->get('dbport'));
$container->setParameter('dbal.new_link', defined('PHPBB_DB_NEW_LINK') && PHPBB_DB_NEW_LINK);
}
diff --git a/phpBB/phpbb/extension/manager.php b/phpBB/phpbb/extension/manager.php
index b19eb9f8a3..4a12e9ec8c 100644
--- a/phpBB/phpbb/extension/manager.php
+++ b/phpBB/phpbb/extension/manager.php
@@ -77,11 +77,12 @@ class manager
{
$this->extensions = array();
- // Do not try to load any extensions when installing or updating
+ // Do not try to load any extensions if the extension table
+ // does not exist or when installing or updating.
// Note: database updater invokes this code, and in 3.0
// there is no extension table therefore the rest of this function
// fails
- if (defined('IN_INSTALL'))
+ if (defined('IN_INSTALL') || version_compare($this->config['version'], '3.1.0-dev', '<'))
{
return;
}
diff --git a/phpBB/phpbb/log/log.php b/phpBB/phpbb/log/log.php
index c522c3273f..2af8b50b54 100644
--- a/phpBB/phpbb/log/log.php
+++ b/phpBB/phpbb/log/log.php
@@ -245,9 +245,9 @@ class log implements \phpbb\log\log_interface
break;
case 'mod':
- $forum_id = (int) $additional_data['forum_id'];
+ $forum_id = isset($additional_data['forum_id']) ? (int) $additional_data['forum_id'] : 0;
unset($additional_data['forum_id']);
- $topic_id = (int) $additional_data['topic_id'];
+ $topic_id = isset($additional_data['topic_id']) ? (int) $additional_data['topic_id'] : 0;
unset($additional_data['topic_id']);
$sql_ary += array(
'log_type' => LOG_MOD,
diff --git a/phpBB/phpbb/plupload/plupload.php b/phpBB/phpbb/plupload/plupload.php
index c610d49a63..3c686a552f 100644
--- a/phpBB/phpbb/plupload/plupload.php
+++ b/phpBB/phpbb/plupload/plupload.php
@@ -79,8 +79,7 @@ class plupload
$this->php_ini = $php_ini;
$this->mimetype_guesser = $mimetype_guesser;
- $this->upload_directory = $this->phpbb_root_path . $this->config['upload_path'];
- $this->temporary_directory = $this->upload_directory . '/plupload';
+ $this->set_default_directories();
}
/**
@@ -120,6 +119,9 @@ class plupload
{
rename("{$file_path}.part", $file_path);
+ // Reset upload directories to defaults once completed
+ $this->set_default_directories();
+
// Need to modify some of the $_FILES values to reflect the new file
return array(
'tmp_name' => $file_path,
@@ -372,4 +374,29 @@ class plupload
);
}
}
+
+ /**
+ * Sets the default directories for uploads
+ *
+ * @return null
+ */
+ protected function set_default_directories()
+ {
+ $this->upload_directory = $this->phpbb_root_path . $this->config['upload_path'];
+ $this->temporary_directory = $this->upload_directory . '/plupload';
+ }
+
+ /**
+ * Sets the upload directories to the specified paths
+ *
+ * @param string $upload_directory Upload directory
+ * @param string $temporary_directory Temporary directory
+ *
+ * @return null
+ */
+ public function set_upload_directories($upload_directory, $temporary_directory)
+ {
+ $this->upload_directory = $upload_directory;
+ $this->temporary_directory = $temporary_directory;
+ }
}
diff --git a/phpBB/phpbb/profilefields/manager.php b/phpBB/phpbb/profilefields/manager.php
index f3b1676799..98802d2209 100644
--- a/phpBB/phpbb/profilefields/manager.php
+++ b/phpBB/phpbb/profilefields/manager.php
@@ -397,7 +397,7 @@ class manager
}
$field_desc = $contact_url = '';
- if ($use_contact_fields)
+ if ($use_contact_fields && $ident_ary['data']['field_is_contact'])
{
$value = $profile_field->get_profile_contact_value($ident_ary['value'], $ident_ary['data']);
$field_desc = $this->user->lang($ident_ary['data']['field_contact_desc']);
diff --git a/phpBB/phpbb/profilefields/type/type_googleplus.php b/phpBB/phpbb/profilefields/type/type_googleplus.php
index df1bcc7f4b..887baa3de1 100644
--- a/phpBB/phpbb/profilefields/type/type_googleplus.php
+++ b/phpBB/phpbb/profilefields/type/type_googleplus.php
@@ -18,6 +18,14 @@ class type_googleplus extends type_string
/**
* {@inheritDoc}
*/
+ public function get_name()
+ {
+ return $this->user->lang('FIELD_GOOGLEPLUS');
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public function get_service_name()
{
return 'profilefields.type.googleplus';
diff --git a/phpBB/phpbb/profilefields/type/type_string_common.php b/phpBB/phpbb/profilefields/type/type_string_common.php
index c2b951b6c9..0eaf7e527d 100644
--- a/phpBB/phpbb/profilefields/type/type_string_common.php
+++ b/phpBB/phpbb/profilefields/type/type_string_common.php
@@ -98,7 +98,7 @@ abstract class type_string_common extends type_base
*/
public function get_profile_value($field_value, $field_data)
{
- if (!$field_value && !$field_data['field_show_novalue'])
+ if (($field_value === null || $field_value === '') && !$field_data['field_show_novalue'])
{
return null;
}
@@ -114,7 +114,7 @@ abstract class type_string_common extends type_base
*/
public function get_profile_value_raw($field_value, $field_data)
{
- if (!$field_value && !$field_data['field_show_novalue'])
+ if (($field_value === null || $field_value === '') && !$field_data['field_show_novalue'])
{
return null;
}
@@ -127,12 +127,7 @@ abstract class type_string_common extends type_base
*/
public function get_profile_contact_value($field_value, $field_data)
{
- if (!$field_value && !$field_data['field_show_novalue'])
- {
- return null;
- }
-
- return $field_value;
+ return $this->get_profile_value_raw($field_value, $field_data);
}
/**
diff --git a/phpBB/phpbb/template/context.php b/phpBB/phpbb/template/context.php
index 0a32879943..4ee48205c8 100644
--- a/phpBB/phpbb/template/context.php
+++ b/phpBB/phpbb/template/context.php
@@ -34,6 +34,11 @@ class context
*/
private $rootref;
+ /**
+ * @var bool
+ */
+ private $num_rows_is_set;
+
public function __construct()
{
$this->clear();
@@ -46,6 +51,7 @@ class context
{
$this->tpldata = array('.' => array(0 => array()));
$this->rootref = &$this->tpldata['.'][0];
+ $this->num_rows_is_set = false;
}
/**
@@ -95,10 +101,59 @@ class context
// returning a reference directly is not
// something php is capable of doing
$ref = &$this->tpldata;
+
+ if (!$this->num_rows_is_set)
+ {
+ /*
+ * We do not set S_NUM_ROWS while adding a row, to reduce the complexity
+ * If we would set it on adding, each subsequent adding would cause
+ * n modifications, resulting in a O(n!) complexity, rather then O(n)
+ */
+ foreach ($ref as $loop_name => &$loop_data)
+ {
+ if ($loop_name === '.')
+ {
+ continue;
+ }
+
+ $this->set_num_rows($loop_data);
+ }
+ $this->num_rows_is_set = true;
+ }
+
return $ref;
}
/**
+ * Set S_NUM_ROWS for each row in this template block
+ *
+ * @param array $loop_data
+ */
+ protected function set_num_rows(&$loop_data)
+ {
+ $s_num_rows = sizeof($loop_data);
+ foreach ($loop_data as &$mod_block)
+ {
+ foreach ($mod_block as $sub_block_name => &$sub_block)
+ {
+ // If the key name is lowercase and the data is an array,
+ // it could be a template loop. So we set the S_NUM_ROWS there
+ // aswell.
+ if ($sub_block_name === strtolower($sub_block_name) && is_array($sub_block))
+ {
+ $this->set_num_rows($sub_block);
+ }
+ }
+
+ // Check whether we are inside a block before setting the variable
+ if (isset($mod_block['S_BLOCK_NAME']))
+ {
+ $mod_block['S_NUM_ROWS'] = $s_num_rows;
+ }
+ }
+ }
+
+ /**
* Returns a reference to template root scope.
*
* This function is public so that template renderer may invoke it.
@@ -123,6 +178,7 @@ class context
*/
public function assign_block_vars($blockname, array $vararray)
{
+ $this->num_rows_is_set = false;
if (strpos($blockname, '.') !== false)
{
// Nested block.
@@ -160,13 +216,6 @@ class context
// We're adding a new iteration to this block with the given
// variable assignments.
$str[$blocks[$blockcount]][] = $vararray;
- $s_num_rows = sizeof($str[$blocks[$blockcount]]);
-
- // Set S_NUM_ROWS
- foreach ($str[$blocks[$blockcount]] as &$mod_block)
- {
- $mod_block['S_NUM_ROWS'] = $s_num_rows;
- }
}
else
{
@@ -192,13 +241,6 @@ class context
// Add a new iteration to this block with the variable assignments we were given.
$this->tpldata[$blockname][] = $vararray;
- $s_num_rows = sizeof($this->tpldata[$blockname]);
-
- // Set S_NUM_ROWS
- foreach ($this->tpldata[$blockname] as &$mod_block)
- {
- $mod_block['S_NUM_ROWS'] = $s_num_rows;
- }
}
return true;
@@ -250,6 +292,7 @@ class context
*/
public function alter_block_array($blockname, array $vararray, $key = false, $mode = 'insert')
{
+ $this->num_rows_is_set = false;
if (strpos($blockname, '.') !== false)
{
// Nested block.
@@ -349,12 +392,6 @@ class context
$block[$key] = $vararray;
$block[$key]['S_ROW_COUNT'] = $block[$key]['S_ROW_NUM'] = $key;
- // Set S_NUM_ROWS
- foreach ($this->tpldata[$blockname] as &$mod_block)
- {
- $mod_block['S_NUM_ROWS'] = sizeof($this->tpldata[$blockname]);
- }
-
return true;
}
@@ -382,6 +419,7 @@ class context
*/
public function destroy_block_vars($blockname)
{
+ $this->num_rows_is_set = false;
if (strpos($blockname, '.') !== false)
{
// Nested block.
diff --git a/phpBB/phpbb/viewonline_helper.php b/phpBB/phpbb/viewonline_helper.php
index 3fc33119a3..b722f9d911 100644
--- a/phpBB/phpbb/viewonline_helper.php
+++ b/phpBB/phpbb/viewonline_helper.php
@@ -18,6 +18,17 @@ namespace phpbb;
*/
class viewonline_helper
{
+ /** @var \phpbb\filesystem */
+ protected $filesystem;
+
+ /**
+ * @param \phpbb\filesystem $filesystem
+ */
+ public function __construct(\phpbb\filesystem $filesystem)
+ {
+ $this->filesystem = $filesystem;
+ }
+
/**
* Get user page
*
@@ -26,7 +37,13 @@ class viewonline_helper
*/
public function get_user_page($session_page)
{
- preg_match('#^([./\\]*+[a-z0-9/_-]+)#i', $session_page, $on_page);
+ $session_page = $this->filesystem->clean_path($session_page);
+ if (strpos($session_page, './') === 0)
+ {
+ $session_page = substr($session_page, 2);
+ }
+
+ preg_match('#^((\.\./)*([a-z0-9/_-]+))#i', $session_page, $on_page);
if (empty($on_page))
{
$on_page[1] = '';
diff --git a/phpBB/styles/prosilver/style.cfg b/phpBB/styles/prosilver/style.cfg
index b75207bd70..520b1f0e98 100644
--- a/phpBB/styles/prosilver/style.cfg
+++ b/phpBB/styles/prosilver/style.cfg
@@ -21,8 +21,8 @@
# General Information about this style
name = prosilver
copyright = © phpBB Limited, 2007
-style_version = 3.1.0-RC1
-phpbb_version = 3.1.0-RC1
+style_version = 3.1.0-RC2
+phpbb_version = 3.1.0-RC2
# Defining a different template bitfield
# template_bitfield = lNg=
diff --git a/phpBB/styles/prosilver/template/ajax.js b/phpBB/styles/prosilver/template/ajax.js
index 70bc703582..649a384418 100644
--- a/phpBB/styles/prosilver/template/ajax.js
+++ b/phpBB/styles/prosilver/template/ajax.js
@@ -2,17 +2,6 @@
"use strict";
-/**
-* Close popup alert after a specified delay
-*
-* @param int Delay in ms until darkenwrapper's click event is triggered
-*/
-phpbb.closeDarkenWrapper = function(delay) {
- phpbbAlertTimer = setTimeout(function() {
- $('#darkenwrapper').trigger('click');
- }, delay);
-};
-
// This callback will mark all forum icons read
phpbb.addAjaxCallback('mark_forums_read', function(res) {
var readTitle = res.NO_UNREAD_POSTS;
diff --git a/phpBB/styles/prosilver/template/mcp_ban.html b/phpBB/styles/prosilver/template/mcp_ban.html
index 591dbf8076..5a7eaa7840 100644
--- a/phpBB/styles/prosilver/template/mcp_ban.html
+++ b/phpBB/styles/prosilver/template/mcp_ban.html
@@ -5,27 +5,34 @@
var ban_length = new Array();
ban_length[-1] = '';
- <!-- BEGIN ban_length -->
- ban_length['{ban_length.BAN_ID}'] = '{ban_length.A_LENGTH}';
- <!-- END ban_length -->
-
var ban_reason = new Array();
ban_reason[-1] = '';
- <!-- BEGIN ban_reason -->
- ban_reason['{ban_reason.BAN_ID}'] = '{ban_reason.A_REASON}';
- <!-- END ban_reason -->
-
var ban_give_reason = new Array();
ban_give_reason[-1] = '';
- <!-- BEGIN ban_give_reason -->
- ban_give_reason['{ban_give_reason.BAN_ID}'] = '{ban_give_reason.A_REASON}';
- <!-- END ban_give_reason -->
+
+ <!-- BEGIN bans -->
+ ban_length['{bans.BAN_ID}'] = '{bans.A_LENGTH}';
+ <!-- IF bans.A_REASON -->
+ ban_reason['{bans.BAN_ID}'] = '{bans.A_REASON}';
+ <!-- ENDIF -->
+ <!-- IF bans.A_GIVE_REASON -->
+ ban_give_reason['{bans.BAN_ID}'] = '{bans.A_GIVE_REASON}';
+ <!-- ENDIF -->
+ <!-- END bans -->
function display_details(option)
{
- document.getElementById('unbangivereason').innerHTML = ban_give_reason[option];
- document.getElementById('unbanreason').innerHTML = ban_reason[option];
document.getElementById('unbanlength').innerHTML = ban_length[option];
+ if (option in ban_reason) {
+ document.getElementById('unbanreason').innerHTML = ban_reason[option];
+ } else {
+ document.getElementById('unbanreason').innerHTML = '';
+ }
+ if (option in ban_give_reason) {
+ document.getElementById('unbangivereason').innerHTML = ban_give_reason[option];
+ } else {
+ document.getElementById('unbangivereason').innerHTML = '';
+ }
}
// ]]>
@@ -42,6 +49,7 @@
<p>{L_EXPLAIN}</p>
<fieldset>
+ <!-- EVENT mcp_ban_fields_before -->
<dl>
<dt><label for="ban">{L_BAN_CELL}{L_COLON}</label></dt>
<dd><label for="ban"><textarea name="ban" id="ban" class="inputbox" cols="40" rows="3">{BAN_QUANTIFIER}</textarea></label></dd>
@@ -70,6 +78,7 @@
<label for="banexclude0"><input type="radio" name="banexclude" id="banexclude0" value="0" checked="checked" /> {L_NO}</label>
</dd>
</dl>
+ <!-- EVENT mcp_ban_fields_after -->
</fieldset>
</div>
@@ -89,6 +98,7 @@
<!-- IF S_BANNED_OPTIONS -->
<fieldset>
+ <!-- EVENT mcp_ban_unban_before -->
<dl>
<dt><label for="unban">{L_BAN_CELL}{L_COLON}</label></dt>
<dd><select name="unban[]" id="unban" multiple="multiple" size="5" onchange="if (this.selectedIndex != -1) {display_details(this.options[this.selectedIndex].value);}">{BANNED_OPTIONS}</select></dd>
@@ -105,6 +115,7 @@
<dt>{L_BAN_GIVE_REASON}{L_COLON}</dt>
<dd><strong id="unbangivereason"></strong></dd>
</dl>
+ <!-- EVENT mcp_ban_unban_after -->
</fieldset>
</div>
diff --git a/phpBB/styles/prosilver/template/navbar_footer.html b/phpBB/styles/prosilver/template/navbar_footer.html
index 675322c56c..4a9275c898 100644
--- a/phpBB/styles/prosilver/template/navbar_footer.html
+++ b/phpBB/styles/prosilver/template/navbar_footer.html
@@ -2,8 +2,9 @@
<div class="inner">
<ul id="nav-footer" class="linklist bulletin" role="menubar">
- <li class="small-icon icon-home breadcrumbs" role="navigation">
+ <li class="small-icon icon-home breadcrumbs">
<!-- IF U_SITE_HOME --><span class="crumb"><a href="{U_SITE_HOME}" data-navbar-reference="home">{L_SITE_HOME}</a></span><!-- ENDIF -->
+ <!-- EVENT overall_footer_breadcrumb_prepend -->
<span class="crumb"><a href="{U_INDEX}" data-navbar-reference="index">{L_INDEX}</a></span>
<!-- EVENT overall_footer_breadcrumb_append -->
</li>
diff --git a/phpBB/styles/prosilver/template/navbar_header.html b/phpBB/styles/prosilver/template/navbar_header.html
index cb646f25e4..b40be089d2 100644
--- a/phpBB/styles/prosilver/template/navbar_header.html
+++ b/phpBB/styles/prosilver/template/navbar_header.html
@@ -32,9 +32,9 @@
</li>
<!-- EVENT overall_header_navigation_prepend -->
- <li class="small-icon icon-faq" <!-- IF not S_USER_LOGGED_IN -->data-skip-responsive="true"<!-- ELSE -->data-last-responsive="true"<!-- ENDIF -->><a href="{U_FAQ}" title="{L_FAQ_EXPLAIN}" role="menuitem">{L_FAQ}</a></li>
+ <li class="small-icon icon-faq" <!-- IF not S_USER_LOGGED_IN -->data-skip-responsive="true"<!-- ELSE -->data-last-responsive="true"<!-- ENDIF -->><a href="{U_FAQ}" rel="help" title="{L_FAQ_EXPLAIN}" role="menuitem">{L_FAQ}</a></li>
<!-- EVENT overall_header_navigation_append -->
- <!-- IF U_ACP --><li class="small-icon icon-acp" data-skip-responsive="true"><a href="{U_ACP}" title="{L_ACP}" role="menuitem">{L_ACP_SHORT}</a></li><!-- ENDIF -->
+ <!-- IF U_ACP --><li class="small-icon icon-acp" data-last-responsive="true"><a href="{U_ACP}" title="{L_ACP}" role="menuitem">{L_ACP_SHORT}</a></li><!-- ENDIF -->
<!-- IF U_MCP --><li class="small-icon icon-mcp" data-skip-responsive="true"><a href="{U_MCP}" title="{L_MCP}" role="menuitem">{L_MCP_SHORT}</a></li><!-- ENDIF -->
<!-- IF S_REGISTERED_USER -->
@@ -83,8 +83,10 @@
<ul id="nav-breadcrumbs" class="linklist navlinks" role="menubar">
<!-- DEFINE $MICRODATA = ' itemtype="http://data-vocabulary.org/Breadcrumb" itemscope=""' -->
- <li class="small-icon icon-home breadcrumbs" role="navigation">
+ <!-- EVENT overall_header_breadcrumbs_before -->
+ <li class="small-icon icon-home breadcrumbs">
<!-- IF U_SITE_HOME --><span class="crumb"><a href="{U_SITE_HOME}"{$MICRODATA} data-navbar-reference="home">{L_SITE_HOME}</a></span><!-- ENDIF -->
+ <!-- EVENT overall_header_breadcrumb_prepend -->
<span class="crumb"><a href="{U_INDEX}" accesskey="h"{$MICRODATA} data-navbar-reference="index">{L_INDEX}</a></span>
<!-- BEGIN navlinks -->
<!-- EVENT overall_header_navlink_prepend -->
@@ -93,6 +95,7 @@
<!-- END navlinks -->
<!-- EVENT overall_header_breadcrumb_append -->
</li>
+ <!-- EVENT overall_header_breadcrumbs_after -->
<!-- IF S_DISPLAY_SEARCH and not S_IN_SEARCH -->
<li class="rightside responsive-search" style="display: none;"><a href="{U_SEARCH}" title="{L_SEARCH_ADV_EXPLAIN}" role="menuitem">{L_SEARCH}</a></li>
diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html
index df09fc6a30..076a3160f0 100644
--- a/phpBB/styles/prosilver/template/overall_header.html
+++ b/phpBB/styles/prosilver/template/overall_header.html
@@ -51,6 +51,8 @@
{$STYLESHEETS}
+<!-- EVENT overall_header_stylesheets_after -->
+
</head>
<body id="phpbb" class="nojs notouch section-{SCRIPT_NAME} {S_CONTENT_DIRECTION} {BODY_CLASS}">
diff --git a/phpBB/styles/prosilver/template/simple_header.html b/phpBB/styles/prosilver/template/simple_header.html
index d31dd32cf6..0831d5f9dc 100644
--- a/phpBB/styles/prosilver/template/simple_header.html
+++ b/phpBB/styles/prosilver/template/simple_header.html
@@ -28,6 +28,8 @@
{$STYLESHEETS}
+<!-- EVENT simple_header_stylesheets_after -->
+
</head>
<body id="phpbb" class="nojs {S_CONTENT_DIRECTION} {BODY_CLASS}">
diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html
index 9f33bc04f7..489c1c901a 100644
--- a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html
+++ b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html
@@ -67,6 +67,7 @@
<!-- IF U_DELETE or U_EDIT or U_QUOTE or U_REPORT -->
<ul class="post-buttons">
+ <!-- EVENT ucp_pm_viewmessage_post_buttons_before -->
<!-- IF U_EDIT -->
<li>
<a href="{U_EDIT}" title="{L_POST_EDIT_PM}" class="button icon-button edit-icon"><span>{L_POST_EDIT_PM}</span></a>
@@ -87,6 +88,7 @@
<a href="{U_QUOTE}" title="{L_POST_QUOTE_PM}" class="button icon-button quote-icon"><span>{L_POST_QUOTE_PM}</span></a>
</li>
<!-- ENDIF -->
+ <!-- EVENT ucp_pm_viewmessage_post_buttons_after -->
</ul>
<!-- ENDIF -->
diff --git a/phpBB/styles/prosilver/template/ucp_prefs_personal.html b/phpBB/styles/prosilver/template/ucp_prefs_personal.html
index d07aab1a89..c8b028f83a 100644
--- a/phpBB/styles/prosilver/template/ucp_prefs_personal.html
+++ b/phpBB/styles/prosilver/template/ucp_prefs_personal.html
@@ -58,8 +58,8 @@
<!-- ENDIF -->
<!-- IF S_STYLE_OPTIONS and S_MORE_STYLES -->
<dl>
- <dt><label for="style">{L_BOARD_STYLE}{L_COLON}</label></dt>
- <dd><select name="style" id="style">{S_STYLE_OPTIONS}</select></dd>
+ <dt><label for="user_style">{L_BOARD_STYLE}{L_COLON}</label></dt>
+ <dd><select name="user_style" id="user_style">{S_STYLE_OPTIONS}</select></dd>
</dl>
<!-- ENDIF -->
<!-- INCLUDE timezone_option.html -->
diff --git a/phpBB/styles/subsilver2/style.cfg b/phpBB/styles/subsilver2/style.cfg
index 9a0c77b627..633acf66e0 100644
--- a/phpBB/styles/subsilver2/style.cfg
+++ b/phpBB/styles/subsilver2/style.cfg
@@ -21,8 +21,8 @@
# General Information about this style
name = subsilver2
copyright = © 2005 phpBB Limited
-style_version = 3.1.0-RC1
-phpbb_version = 3.1.0-RC1
+style_version = 3.1.0-RC2
+phpbb_version = 3.1.0-RC2
# Defining a different template bitfield
# template_bitfield = lNg=
diff --git a/phpBB/styles/subsilver2/template/breadcrumbs.html b/phpBB/styles/subsilver2/template/breadcrumbs.html
index 3aa05bc0eb..25387da832 100644
--- a/phpBB/styles/subsilver2/template/breadcrumbs.html
+++ b/phpBB/styles/subsilver2/template/breadcrumbs.html
@@ -2,8 +2,10 @@
<table class="tablebg" width="100%" cellspacing="1" cellpadding="0" style="margin-top: 5px;">
<tr>
<td class="row1">
- <p class="breadcrumbs"><!-- IF U_SITE_HOME --><a href="{U_SITE_HOME}"{$MICRODATA} data-navbar-reference="home">{L_SITE_HOME}</a> <strong>&#187;</strong> <!-- ENDIF --><a href="{U_INDEX}"{$MICRODATA} data-navbar-reference="index">{L_INDEX}</a><!-- BEGIN navlinks --><!-- EVENT overall_header_navlink_prepend --> &#187; <a href="{navlinks.U_VIEW_FORUM}"{$MICRODATA}<!-- IF navlinks.MICRODATA --> {navlinks.MICRODATA}<!-- ENDIF -->>{navlinks.FORUM_NAME}</a><!-- EVENT overall_header_navlink_append --><!-- END navlinks -->
- <!-- EVENT overall_header_breadcrumb_append --></p>
+ <!-- EVENT overall_header_breadcrumbs_before -->
+ <p class="breadcrumbs"><!-- IF U_SITE_HOME --><a href="{U_SITE_HOME}"{$MICRODATA} data-navbar-reference="home">{L_SITE_HOME}</a> <strong>&#187;</strong> <!-- ENDIF --><!-- IF $OVERALL_HEADER_BREADCRUMBS --><!-- EVENT overall_header_breadcrumb_prepend --><!-- ELSE --><!-- EVENT overall_footer_breadcrumb_prepend --><!-- ENDIF --><a href="{U_INDEX}"{$MICRODATA} data-navbar-reference="index">{L_INDEX}</a><!-- BEGIN navlinks --><!-- EVENT overall_header_navlink_prepend --> &#187; <a href="{navlinks.U_VIEW_FORUM}"{$MICRODATA}<!-- IF navlinks.MICRODATA --> {navlinks.MICRODATA}<!-- ENDIF -->>{navlinks.FORUM_NAME}</a><!-- EVENT overall_header_navlink_append --><!-- END navlinks -->
+ <!-- IF $OVERALL_HEADER_BREADCRUMBS --><!-- EVENT overall_header_breadcrumb_append --><!-- ELSE --><!-- EVENT overall_footer_breadcrumb_append --><!-- ENDIF --></p>
+ <!-- EVENT overall_header_breadcrumbs_after -->
<!-- EVENT overall_footer_timezone_before -->
<p class="datetime">{S_TIMEZONE}</p>
<!-- EVENT overall_footer_timezone_after -->
diff --git a/phpBB/styles/subsilver2/template/mcp_ban.html b/phpBB/styles/subsilver2/template/mcp_ban.html
index edf81c6d76..cc24d21d73 100644
--- a/phpBB/styles/subsilver2/template/mcp_ban.html
+++ b/phpBB/styles/subsilver2/template/mcp_ban.html
@@ -5,27 +5,34 @@
var ban_length = new Array();
ban_length[-1] = '';
- <!-- BEGIN ban_length -->
- ban_length['{ban_length.BAN_ID}'] = '{ban_length.A_LENGTH}';
- <!-- END ban_length -->
-
var ban_reason = new Array();
ban_reason[-1] = '';
- <!-- BEGIN ban_reason -->
- ban_reason['{ban_reason.BAN_ID}'] = '{ban_reason.A_REASON}';
- <!-- END ban_reason -->
-
var ban_give_reason = new Array();
ban_give_reason[-1] = '';
- <!-- BEGIN ban_give_reason -->
- ban_give_reason['{ban_give_reason.BAN_ID}'] = '{ban_give_reason.A_REASON}';
- <!-- END ban_give_reason -->
+
+ <!-- BEGIN bans -->
+ ban_length['{bans.BAN_ID}'] = '{bans.A_LENGTH}';
+ <!-- IF bans.A_REASON -->
+ ban_reason['{bans.BAN_ID}'] = '{bans.A_REASON}';
+ <!-- ENDIF -->
+ <!-- IF bans.A_GIVE_REASON -->
+ ban_give_reason['{bans.BAN_ID}'] = '{bans.A_GIVE_REASON}';
+ <!-- ENDIF -->
+ <!-- END bans -->
function display_details(option)
{
- document.getElementById('mcp_ban').unbangivereason.value = ban_give_reason[option];
- document.getElementById('mcp_ban').unbanreason.value = ban_reason[option];
document.getElementById('mcp_ban').unbanlength.value = ban_length[option];
+ if (option in ban_reason) {
+ document.getElementById('mcp_ban').unbanreason.value = ban_reason[option];
+ } else {
+ document.getElementById('mcp_ban').unbanreason.value = '';
+ }
+ if (option in ban_give_reason) {
+ document.getElementById('mcp_ban').unbangivereason.value = ban_give_reason[option];
+ } else {
+ document.getElementById('mcp_ban').unbangivereason.value = '';
+ }
}
// ]]>
@@ -40,6 +47,7 @@
<tr>
<td class="row3" colspan="2">{L_EXPLAIN}</td>
</tr>
+<!-- EVENT mcp_ban_fields_before -->
<tr>
<td class="row1" width="45%" valign="top"><b>{L_BAN_CELL}{L_COLON}</b></td>
<td class="row2">
@@ -63,6 +71,7 @@
<td class="row1" valign="top"><b>{L_BAN_GIVE_REASON}{L_COLON}</b></td>
<td class="row2"><input name="bangivereason" type="text" class="post" maxlength="255" /></td>
</tr>
+<!-- EVENT mcp_ban_fields_after -->
<tr>
<td class="cat" colspan="2" align="center"><input type="submit" name="bansubmit" value="{L_SUBMIT}" class="btnmain" />&nbsp; <input type="reset" value="{L_RESET}" class="btnlite" />&nbsp;</td>
</tr>
@@ -78,6 +87,7 @@
<td class="row3" colspan="2">{L_UNBAN_EXPLAIN}</td>
</tr>
<!-- IF S_BANNED_OPTIONS -->
+ <!-- EVENT mcp_ban_unban_before -->
<tr>
<td class="row1" valign="top" width="45%"><b>{L_BAN_CELL}{L_COLON}</b></td>
<td class="row2"><select name="unban[]" multiple="multiple" size="10" style="width: 50%" onchange="if (this.selectedIndex > -1) display_details(this.options[this.selectedIndex].value); else display_details(-1);">{BANNED_OPTIONS}</select></td>
@@ -94,6 +104,7 @@
<td class="row1" valign="top"><b>{L_BAN_GIVE_REASON}{L_COLON}</b></td>
<td class="row2"><textarea style="border: 0; width: 100%" name="unbangivereason" readonly="readonly" rows="5" cols="80">&nbsp;</textarea></td>
</tr>
+ <!-- EVENT mcp_ban_unban_after -->
<tr>
<td class="cat" colspan="2" align="center"><input type="submit" name="unbansubmit" value="{L_SUBMIT}" class="btnmain" />&nbsp; <input type="reset" value="{L_RESET}" class="btnlite" />&nbsp;</td>
</tr>
diff --git a/phpBB/styles/subsilver2/template/overall_header.html b/phpBB/styles/subsilver2/template/overall_header.html
index 711ce66362..ebb7b3be4d 100644
--- a/phpBB/styles/subsilver2/template/overall_header.html
+++ b/phpBB/styles/subsilver2/template/overall_header.html
@@ -135,6 +135,8 @@ function marklist(id, name, state)
{$STYLESHEETS}
+<!-- EVENT overall_header_stylesheets_after -->
+
</head>
<body class="{S_CONTENT_DIRECTION} {BODY_CLASS}">
@@ -212,7 +214,7 @@ function marklist(id, name, state)
</td>
<td class="genmed" align="{S_CONTENT_FLOW_END}">
<!-- EVENT overall_header_navigation_prepend -->
- <a href="{U_FAQ}"><img src="{T_THEME_PATH}/images/icon_mini_faq.gif" width="12" height="13" alt="*" /> {L_FAQ}</a>
+ <a href="{U_FAQ}" rel="help"><img src="{T_THEME_PATH}/images/icon_mini_faq.gif" width="12" height="13" alt="*" /> {L_FAQ}</a>
<!-- IF S_DISPLAY_SEARCH -->&nbsp; &nbsp;<a href="{U_SEARCH}"><img src="{T_THEME_PATH}/images/icon_mini_search.gif" width="12" height="13" alt="*" /> {L_SEARCH}</a><!-- ENDIF -->
<!-- IF not S_IS_BOT -->
<!-- IF S_DISPLAY_MEMBERLIST -->&nbsp; &nbsp;<a href="{U_MEMBERLIST}"><img src="{T_THEME_PATH}/images/icon_mini_members.gif" width="12" height="13" alt="*" /> {L_MEMBERLIST}</a><!-- ENDIF -->
@@ -251,7 +253,9 @@ function marklist(id, name, state)
<br style="clear: both;" />
<!-- DEFINE $S_MICRODATA = 1 -->
+ <!-- DEFINE $OVERALL_HEADER_BREADCRUMBS = 1 -->
<!-- INCLUDE breadcrumbs.html -->
+ <!-- UNDEFINE $OVERALL_HEADER_BREADCRUMBS -->
<!-- DEFINE $S_MICRODATA = 0 -->
<br />
diff --git a/phpBB/styles/subsilver2/template/simple_header.html b/phpBB/styles/subsilver2/template/simple_header.html
index faeeaea3d5..0c3dff4a05 100644
--- a/phpBB/styles/subsilver2/template/simple_header.html
+++ b/phpBB/styles/subsilver2/template/simple_header.html
@@ -14,6 +14,8 @@
{$STYLESHEETS}
+<!-- EVENT simple_header_stylesheets_after -->
+
</head>
<body class="{S_CONTENT_DIRECTION} {BODY_CLASS}">
diff --git a/phpBB/styles/subsilver2/template/ucp_pm_viewmessage.html b/phpBB/styles/subsilver2/template/ucp_pm_viewmessage.html
index be1e27c5f3..9536b1f8c5 100644
--- a/phpBB/styles/subsilver2/template/ucp_pm_viewmessage.html
+++ b/phpBB/styles/subsilver2/template/ucp_pm_viewmessage.html
@@ -104,7 +104,19 @@
</tr>
<tr class="row1">
- <td><div class="gensmall" style="float: {S_CONTENT_FLOW_BEGIN};">&nbsp;<!-- IF U_MESSAGE_AUTHOR --><a href="{U_MESSAGE_AUTHOR}" class="imageset">{PROFILE_IMG}</a> <!-- ENDIF --> <!-- IF U_EMAIL --><a href="{U_EMAIL}" class="imageset">{EMAIL_IMG}</a> <!-- ENDIF -->&nbsp;</div> <div class="gensmall" style="float: {S_CONTENT_FLOW_END};"><!-- IF U_EDIT --><a href="{U_EDIT}" class="imageset">{EDIT_IMG}</a> <!-- ENDIF --> <!-- IF U_QUOTE --><a href="{U_QUOTE}" class="imageset">{QUOTE_IMG}</a> <!-- ENDIF --> <!-- IF U_POST_REPLY_PM --><a href="{U_POST_REPLY_PM}" class="imageset">{REPLY_IMG}</a><!-- ENDIF -->&nbsp;</div></td>
+ <td>
+ <div class="gensmall" style="float: {S_CONTENT_FLOW_BEGIN};">
+ &nbsp;<!-- IF U_MESSAGE_AUTHOR --><a href="{U_MESSAGE_AUTHOR}" class="imageset">{PROFILE_IMG}</a> <!-- ENDIF -->
+ <!-- IF U_EMAIL --><a href="{U_EMAIL}" class="imageset">{EMAIL_IMG}</a> <!-- ENDIF -->
+ &nbsp;</div>
+ <div class="gensmall" style="float: {S_CONTENT_FLOW_END};">
+ <!-- EVENT ucp_pm_viewmessage_post_buttons_before -->
+ <!-- IF U_EDIT --><a href="{U_EDIT}" class="imageset">{EDIT_IMG}</a> <!-- ENDIF -->
+ <!-- IF U_QUOTE --><a href="{U_QUOTE}" class="imageset">{QUOTE_IMG}</a> <!-- ENDIF -->
+ <!-- IF U_POST_REPLY_PM --><a href="{U_POST_REPLY_PM}" class="imageset">{REPLY_IMG}</a><!-- ENDIF -->
+ <!-- EVENT ucp_pm_viewmessage_post_buttons_after -->
+ &nbsp;</div>
+ </td>
</tr>
<tr>
diff --git a/phpBB/styles/subsilver2/template/ucp_prefs_personal.html b/phpBB/styles/subsilver2/template/ucp_prefs_personal.html
index 93fcfac5b1..1c76e3226d 100644
--- a/phpBB/styles/subsilver2/template/ucp_prefs_personal.html
+++ b/phpBB/styles/subsilver2/template/ucp_prefs_personal.html
@@ -49,7 +49,7 @@
<!-- IF S_STYLE_OPTIONS and S_MORE_STYLES -->
<tr>
<td class="row1" width="50%"><b class="genmed">{L_BOARD_STYLE}{L_COLON}</b></td>
- <td class="row2"><select name="style">{S_STYLE_OPTIONS}</select></td>
+ <td class="row2"><select name="user_style">{S_STYLE_OPTIONS}</select></td>
</tr>
<!-- ENDIF -->
<!-- INCLUDE timezone_option.html -->
diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php
index c9623293c6..9086feb390 100644
--- a/phpBB/viewforum.php
+++ b/phpBB/viewforum.php
@@ -469,11 +469,11 @@ if ($forum_data['forum_type'] == FORUM_POST)
$forum_tracking_info = array();
-if ($user->data['is_registered'])
+if ($user->data['is_registered'] && $config['load_db_lastread'])
{
$forum_tracking_info[$forum_id] = $forum_data['mark_time'];
- if (!empty($global_announce_forums) && $config['load_db_lastread'])
+ if (!empty($global_announce_forums))
{
$sql = 'SELECT forum_id, mark_time
FROM ' . FORUMS_TRACK_TABLE . '
diff --git a/phpBB/viewonline.php b/phpBB/viewonline.php
index 4c897c58aa..a03a81a15e 100644
--- a/phpBB/viewonline.php
+++ b/phpBB/viewonline.php
@@ -295,8 +295,21 @@ while ($row = $db->sql_fetchrow($result))
break;
case 'memberlist':
- $location = (strpos($row['session_page'], 'mode=viewprofile') !== false) ? $user->lang['VIEWING_MEMBER_PROFILE'] : $user->lang['VIEWING_MEMBERS'];
$location_url = append_sid("{$phpbb_root_path}memberlist.$phpEx");
+
+ if (strpos($row['session_page'], 'mode=viewprofile') !== false)
+ {
+ $location = $user->lang['VIEWING_MEMBER_PROFILE'];
+ }
+ else if (strpos($row['session_page'], 'mode=contactadmin') !== false)
+ {
+ $location = $user->lang['VIEWING_CONTACT_ADMIN'];
+ $location_url = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contactadmin');
+ }
+ else
+ {
+ $location = $user->lang['VIEWING_MEMBERS'];
+ }
break;
case 'mcp':
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index 23f2fe8e3d..1fdce5a6c3 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -1423,6 +1423,46 @@ $template->assign_vars(array(
'S_NUM_POSTS' => sizeof($post_list))
);
+/**
+* Event to modify the post, poster and attachment data before assigning the posts
+*
+* @event core.viewtopic_modify_post_data
+* @var int forum_id Forum ID
+* @var int topic_id Topic ID
+* @var array topic_data Array with topic data
+* @var array post_list Array with post_ids we are going to display
+* @var array rowset Array with post_id => post data
+* @var array user_cache Array with prepared user data
+* @var int start Pagination information
+* @var int sort_days Display posts of previous x days
+* @var string sort_key Key the posts are sorted by
+* @var string sort_dir Direction the posts are sorted by
+* @var bool display_notice Shall we display a notice instead of attachments
+* @var bool has_approved_attachments Does the topic have approved attachments
+* @var array attachments List of attachments post_id => array of attachments
+* @var array permanently_banned_users List of permanently banned users
+* @var array can_receive_pm_list Array with posters that can receive pms
+* @since 3.1.0-RC3
+*/
+$vars = array(
+ 'forum_id',
+ 'topic_id',
+ 'topic_data',
+ 'post_list',
+ 'rowset',
+ 'user_cache',
+ 'sort_days',
+ 'sort_key',
+ 'sort_dir',
+ 'start',
+ 'permanently_banned_users',
+ 'can_receive_pm_list',
+ 'display_notice',
+ 'has_approved_attachments',
+ 'attachments',
+);
+extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_post_data', compact($vars)));
+
// Output the posts
$first_unread = $post_unread = false;
for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
@@ -1789,6 +1829,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
* @var int current_row_number Number of the post on this page
* @var int end Number of posts on this page
* @var int total_posts Total posts count
+ * @var int poster_id Post author id
* @var array row Array with original post and user data
* @var array cp_row Custom profile field data of the poster
* @var array attachments List of attachments
@@ -1798,12 +1839,14 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
* @since 3.1.0-a1
* @change 3.1.0-a3 Added vars start, current_row_number, end, attachments
* @change 3.1.0-b3 Added topic_data array, total_posts
+ * @change 3.1.0-RC3 Added poster_id
*/
$vars = array(
'start',
'current_row_number',
'end',
'total_posts',
+ 'poster_id',
'row',
'cp_row',
'attachments',
diff --git a/tests/config_php_file_test.php b/tests/config_php_file_test.php
new file mode 100644
index 0000000000..c2e4eb21c7
--- /dev/null
+++ b/tests/config_php_file_test.php
@@ -0,0 +1,30 @@
+<?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.
+*
+*/
+
+class phpbb_config_php_file_test extends phpbb_test_case
+{
+ public function test_default()
+ {
+ $config_php = new \phpbb\config_php_file(dirname( __FILE__ ) . '/fixtures/', 'php');
+ $this->assertSame('bar', $config_php->get('foo'));
+ $this->assertSame(array('foo' => 'bar', 'foo_foo' => 'bar bar'), $config_php->get_all());
+ }
+
+ public function test_set_config_file()
+ {
+ $config_php = new \phpbb\config_php_file(dirname( __FILE__ ) . '/fixtures/', 'php');
+ $config_php->set_config_file(dirname( __FILE__ ) . '/fixtures/config_other.php');
+ $this->assertSame('foo', $config_php->get('bar'));
+ $this->assertSame(array('bar' => 'foo', 'bar_bar' => 'foo foo'), $config_php->get_all());
+ }
+}
diff --git a/tests/console/cron/cron_list_test.php b/tests/console/cron/cron_list_test.php
index f04c14e847..1059a3f221 100644
--- a/tests/console/cron/cron_list_test.php
+++ b/tests/console/cron/cron_list_test.php
@@ -75,7 +75,7 @@ class phpbb_console_command_cron_list_test extends phpbb_test_case
public function get_command_tester()
{
$application = new Application();
- $application->add(new cron_list($this->cron_manager, $this->user));
+ $application->add(new cron_list($this->user, $this->cron_manager));
$command = $application->find('cron:list');
$this->command_name = $command->getName();
diff --git a/tests/console/cron/run_test.php b/tests/console/cron/run_test.php
index ff251cff3c..60bd74e1f0 100644
--- a/tests/console/cron/run_test.php
+++ b/tests/console/cron/run_test.php
@@ -148,7 +148,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
public function get_command_tester()
{
$application = new Application();
- $application->add(new run($this->cron_manager, $this->lock, $this->user));
+ $application->add(new run($this->user, $this->cron_manager, $this->lock));
$command = $application->find('cron:run');
$this->command_name = $command->getName();
diff --git a/tests/dbal/db_tools_test.php b/tests/dbal/db_tools_test.php
index f3c6888c8d..6cc2f8ec0f 100644
--- a/tests/dbal/db_tools_test.php
+++ b/tests/dbal/db_tools_test.php
@@ -46,6 +46,7 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case
'c_bool' => array('BOOL', 1),
'c_vchar' => array('VCHAR', 'foo'),
'c_vchar_size' => array('VCHAR:4', 'foo'),
+ 'c_vchar_null' => array('VCHAR', null),
'c_char_size' => array('CHAR:4', 'foo'),
'c_xstext' => array('XSTEXT', 'foo'),
'c_stext' => array('STEXT', 'foo'),
@@ -111,6 +112,7 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case
'c_bool' => 0,
'c_vchar' => '',
'c_vchar_size' => '',
+ 'c_vchar_null' => null,
'c_char_size' => 'abcd',
'c_xstext' => '',
'c_stext' => '',
@@ -144,6 +146,7 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case
array('c_bool', 0),
array('c_vchar', str_repeat('a', 255)),
array('c_vchar_size', str_repeat('a', 4)),
+ array('c_vchar_null', str_repeat('a', 4)),
array('c_char_size', str_repeat('a', 4)),
array('c_xstext', str_repeat('a', 1000)),
array('c_stext', str_repeat('a', 3000)),
diff --git a/tests/di/create_container_test.php b/tests/di/create_container_test.php
index 8bf9f636fa..559c0b122c 100644
--- a/tests/di/create_container_test.php
+++ b/tests/di/create_container_test.php
@@ -14,47 +14,135 @@
namespace
{
require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
- require_once dirname(__FILE__) . '/../../phpBB/includes/functions_container.php';
- class phpbb_di_container_test extends phpbb_test_case
+ class phpbb_di_container_test extends \phpbb_test_case
{
- public function test_phpbb_create_container()
+ protected $config_php;
+
+ /**
+ * @var \phpbb\di\container_builder
+ */
+ protected $builder;
+ protected $phpbb_root_path;
+ protected $filename;
+
+ public function setUp()
{
- $phpbb_root_path = __DIR__ . '/../../phpBB/';
- $extensions = array(
- new \phpbb\di\extension\config(__DIR__ . '/fixtures/config.php'),
- new \phpbb\di\extension\core($phpbb_root_path . 'config'),
- );
- $container = phpbb_create_container($extensions, $phpbb_root_path, 'php');
+ $this->phpbb_root_path = dirname(__FILE__) . '/';
+ $this->config_php = new \phpbb\config_php_file($this->phpbb_root_path . 'fixtures/', 'php');
+ $this->builder = new phpbb_mock_phpbb_di_container_builder($this->config_php, $this->phpbb_root_path . 'fixtures/', 'php');
+
+ $this->filename = $this->phpbb_root_path . '../tmp/container.php';
+ if (is_file($this->filename))
+ {
+ unlink($this->filename);
+ }
+
+ parent::setUp();
+ }
+ public function test_default_container()
+ {
+ $container = $this->builder->get_container();
$this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerBuilder', $container);
+
+ // Checks the core services
+ $this->assertTrue($container->hasParameter('core'));
+
+ // Checks compile_container
+ $this->assertTrue($container->isFrozen());
+
+ // Checks inject_config
+ $this->assertTrue($container->hasParameter('dbal.dbhost'));
+
+ // Checks use_extensions
+ $this->assertTrue($container->hasParameter('enabled'));
+ $this->assertFalse($container->hasParameter('disabled'));
+ $this->assertFalse($container->hasParameter('available'));
+
+ // Checks set_custom_parameters
+ $this->assertTrue($container->hasParameter('core.root_path'));
+
+ // Checks dump_container
+ $this->assertTrue(is_file($this->filename));
+
+ // Checks the construction of a dumped container
+ $container = $this->builder->get_container();
+ $this->assertInstanceOf('phpbb_cache_container', $container);
+ $this->assertFalse($container->isFrozen());
+ $container->getParameterBag(); // needed, otherwise the container is not marked as frozen
+ $this->assertTrue($container->isFrozen());
}
- public function test_phpbb_create_install_container()
+ public function test_dump_container()
{
- $phpbb_root_path = __DIR__ . '/../../phpBB/';
- $extensions = array(
- new \phpbb\di\extension\config(__DIR__ . '/fixtures/config.php'),
- new \phpbb\di\extension\core($phpbb_root_path . 'config'),
- );
- $container = phpbb_create_install_container($phpbb_root_path, 'php');
+ $this->builder->set_dump_container(false);
+ $container = $this->builder->get_container();
+ $this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerBuilder', $container);
+ // Checks dump_container
+ $this->assertFalse(is_file($this->filename));
+
+ // Checks the construction of a dumped container
+ $container = $this->builder->get_container();
+ $this->assertNotInstanceOf('phpbb_cache_container', $container);
$this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerBuilder', $container);
$this->assertTrue($container->isFrozen());
}
- public function test_phpbb_create_compiled_container()
+ public function test_use_extensions()
{
- $phpbb_root_path = __DIR__ . '/../../phpBB/';
- $config_file = __DIR__ . '/fixtures/config.php';
- $extensions = array(
- new \phpbb\di\extension\config(__DIR__ . '/fixtures/config.php'),
- new \phpbb\di\extension\core($phpbb_root_path . 'config'),
- );
- $container = phpbb_create_compiled_container($config_file, $extensions, array(), $phpbb_root_path, 'php');
+ $this->builder->set_use_extensions(false);
+ $container = $this->builder->get_container();
+ $this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerBuilder', $container);
+
+ // Checks the core services
+ $this->assertTrue($container->hasParameter('core'));
+
+ // Checks use_extensions
+ $this->assertFalse($container->hasParameter('enabled'));
+ $this->assertFalse($container->hasParameter('disabled'));
+ $this->assertFalse($container->hasParameter('available'));
+ }
+ public function test_compile_container()
+ {
+ $this->builder->set_compile_container(false);
+ $container = $this->builder->get_container();
$this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerBuilder', $container);
- $this->assertTrue($container->isFrozen());
+
+ // Checks compile_container
+ $this->assertFalse($container->isFrozen());
+ }
+
+ public function test_inject_config()
+ {
+ $this->builder->set_inject_config(false);
+ $container = $this->builder->get_container();
+ $this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerBuilder', $container);
+
+ // Checks inject_config
+ $this->assertFalse($container->hasParameter('dbal.dbhost'));
+ }
+
+ public function test_set_config_path()
+ {
+ $this->builder->set_config_path($this->phpbb_root_path . 'fixtures/other_config/');
+ $container = $this->builder->get_container();
+ $this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerBuilder', $container);
+
+ $this->assertTrue($container->hasParameter('other_config'));
+ $this->assertFalse($container->hasParameter('core'));
+ }
+
+ public function test_set_custom_parameters()
+ {
+ $this->builder->set_custom_parameters(array('my_parameter' => true));
+ $container = $this->builder->get_container();
+ $this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerBuilder', $container);
+
+ $this->assertTrue($container->hasParameter('my_parameter'));
+ $this->assertFalse($container->hasParameter('core.root_path'));
}
}
}
@@ -102,5 +190,12 @@ namespace phpbb\db\driver
function sql_like_expression($expression)
{
}
+
+ function sql_fetchrowset($query_id = false)
+ {
+ return array(
+ array('ext_name' => 'vendor/enabled'),
+ );
+ }
}
}
diff --git a/tests/di/fixtures/config/services.yml b/tests/di/fixtures/config/services.yml
new file mode 100644
index 0000000000..f2a22ae109
--- /dev/null
+++ b/tests/di/fixtures/config/services.yml
@@ -0,0 +1,14 @@
+parameters:
+ core: true
+
+services:
+ config.php:
+ synthetic: true
+
+ dbal.conn:
+ class: phpbb\db\driver\factory
+ arguments:
+ - @service_container
+
+ dispatcher:
+ class: phpbb\db\driver\container_mock
diff --git a/tests/di/fixtures/ext/vendor/available/config/services.yml b/tests/di/fixtures/ext/vendor/available/config/services.yml
new file mode 100644
index 0000000000..2ced431f5a
--- /dev/null
+++ b/tests/di/fixtures/ext/vendor/available/config/services.yml
@@ -0,0 +1,2 @@
+parameters:
+ available: true
diff --git a/tests/di/fixtures/ext/vendor/disabled/config/services.yml b/tests/di/fixtures/ext/vendor/disabled/config/services.yml
new file mode 100644
index 0000000000..31ada384bf
--- /dev/null
+++ b/tests/di/fixtures/ext/vendor/disabled/config/services.yml
@@ -0,0 +1,2 @@
+parameters:
+ disabled: true
diff --git a/tests/di/fixtures/ext/vendor/enabled/config/services.yml b/tests/di/fixtures/ext/vendor/enabled/config/services.yml
new file mode 100644
index 0000000000..88a7919ed1
--- /dev/null
+++ b/tests/di/fixtures/ext/vendor/enabled/config/services.yml
@@ -0,0 +1,2 @@
+parameters:
+ enabled: true
diff --git a/tests/di/fixtures/other_config/services.yml b/tests/di/fixtures/other_config/services.yml
new file mode 100644
index 0000000000..c299bfc648
--- /dev/null
+++ b/tests/di/fixtures/other_config/services.yml
@@ -0,0 +1,14 @@
+parameters:
+ other_config: true
+
+services:
+ config.php:
+ synthetic: true
+
+ dbal.conn:
+ class: phpbb\db\driver\factory
+ arguments:
+ - @service_container
+
+ dispatcher:
+ class: phpbb\db\driver\container_mock
diff --git a/tests/extension/manager_test.php b/tests/extension/manager_test.php
index 230c90c7c7..067fd62581 100644
--- a/tests/extension/manager_test.php
+++ b/tests/extension/manager_test.php
@@ -135,7 +135,7 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
protected function create_extension_manager($with_cache = true)
{
- $config = new \phpbb\config\config(array());
+ $config = new \phpbb\config\config(array('version' => PHPBB_VERSION));
$db = $this->new_dbal();
$db_tools = new \phpbb\db\tools($db);
$phpbb_root_path = __DIR__ . './../../phpBB/';
diff --git a/tests/fixtures/config.php b/tests/fixtures/config.php
new file mode 100644
index 0000000000..ae9e8c22de
--- /dev/null
+++ b/tests/fixtures/config.php
@@ -0,0 +1,3 @@
+<?php
+$foo = 'bar';
+$foo_foo = 'bar bar';
diff --git a/tests/fixtures/config_other.php b/tests/fixtures/config_other.php
new file mode 100644
index 0000000000..e0ecc17bb9
--- /dev/null
+++ b/tests/fixtures/config_other.php
@@ -0,0 +1,3 @@
+<?php
+$bar = 'foo';
+$bar_bar = 'foo foo';
diff --git a/tests/functional/mcp_test.php b/tests/functional/mcp_test.php
index 31d835f4fa..40615d66a5 100644
--- a/tests/functional/mcp_test.php
+++ b/tests/functional/mcp_test.php
@@ -64,4 +64,20 @@ class phpbb_functional_mcp_test extends phpbb_functional_test_case
$crawler = self::submit($form);
$this->assertContains($this->lang('POSTS_MERGED_SUCCESS'), $crawler->text());
}
+
+ public function test_delete_logs()
+ {
+ $this->login();
+ $crawler = self::request('GET', "mcp.php?i=mcp_logs&mode=front&sid={$this->sid}");
+ $this->assertGreaterThanOrEqual(1, $crawler->filter('input[type=checkbox]')->count());
+
+ $this->add_lang('mcp');
+ $form = $crawler->selectButton($this->lang('DELETE_ALL'))->form();
+ $crawler = self::submit($form);
+
+ $form = $crawler->selectButton('Yes')->form();
+ $crawler = self::submit($form);
+
+ $this->assertCount(0, $crawler->filter('input[type=checkbox]'));
+ }
}
diff --git a/tests/functional/private_messages_test.php b/tests/functional/private_messages_test.php
new file mode 100644
index 0000000000..1f6dc3a979
--- /dev/null
+++ b/tests/functional/private_messages_test.php
@@ -0,0 +1,69 @@
+<?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.
+*
+*/
+
+/**
+* @group functional
+*/
+class phpbb_functional_private_messages_test extends phpbb_functional_test_case
+{
+ public function test_setup_config()
+ {
+ $this->login();
+ $this->admin_login();
+
+ $crawler = self::request('GET', "adm/index.php?sid={$this->sid}&i=board&mode=message");
+
+ $form = $crawler->selectButton('Submit')->form();
+ $values = $form->getValues();
+
+ // Set the maximum number of private messages per folder to 1
+ $values['config[pm_max_msgs]'] = 1;
+
+ $form->setValues($values);
+
+ $crawler = self::submit($form);
+ $this->assertContains($this->lang('CONFIG_UPDATED'), $crawler->filter('.successbox')->text());
+ }
+
+ public function test_inbox_full()
+ {
+ $this->login();
+ $message_id = $this->create_private_message('Test private message #1', 'This is a test private message sent by the testing framework.', array(2));
+
+ $crawler = self::request('GET', "ucp.php?i=pm&mode=view&sid{$this->sid}&p={$message_id}");
+ $this->assertContains($this->lang('UCP_PM_VIEW'), $crawler->filter('html')->text());
+
+ $message_id = $this->create_private_message('Test private message #2', 'This is a test private message sent by the testing framework.', array(2));
+
+ $crawler = self::request('GET', "ucp.php?i=pm&mode=view&sid{$this->sid}&p={$message_id}");
+ $this->assertContains($this->lang('NO_AUTH_READ_HOLD_MESSAGE'), $crawler->filter('html')->text());
+ }
+
+ public function test_restore_config()
+ {
+ $this->login();
+ $this->admin_login();
+
+ $crawler = self::request('GET', "adm/index.php?sid={$this->sid}&i=board&mode=message");
+
+ $form = $crawler->selectButton('Submit')->form();
+ $values = $form->getValues();
+
+ $values['config[pm_max_msgs]'] = 50;
+
+ $form->setValues($values);
+
+ $crawler = self::submit($form);
+ $this->assertContains($this->lang('CONFIG_UPDATED'), $crawler->filter('.successbox')->text());
+ }
+}
diff --git a/tests/functions/convert_30_dbms_to_31_test.php b/tests/functions/convert_30_dbms_to_31_test.php
index a3992aef5c..729c0a82f0 100644
--- a/tests/functions/convert_30_dbms_to_31_test.php
+++ b/tests/functions/convert_30_dbms_to_31_test.php
@@ -36,7 +36,8 @@ class phpbb_convert_30_dbms_to_31_test extends phpbb_test_case
{
$expected = "phpbb\\db\\driver\\$input";
- $output = phpbb_convert_30_dbms_to_31($input);
+ $config_php_file = new \phpbb\config_php_file('', '');
+ $output = $config_php_file->convert_30_dbms_to_31($input);
$this->assertEquals($expected, $output);
}
diff --git a/tests/mock/phpbb_di_container_builder.php b/tests/mock/phpbb_di_container_builder.php
new file mode 100644
index 0000000000..59cdf0bb2b
--- /dev/null
+++ b/tests/mock/phpbb_di_container_builder.php
@@ -0,0 +1,20 @@
+<?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.
+*
+*/
+
+class phpbb_mock_phpbb_di_container_builder extends \phpbb\di\container_builder
+{
+ protected function get_container_filename()
+ {
+ return $this->phpbb_root_path . '../../tmp/container.' . $this->php_ext;
+ }
+}
diff --git a/tests/profilefields/type_string_test.php b/tests/profilefields/type_string_test.php
index f6c14ee38b..2277526758 100644
--- a/tests/profilefields/type_string_test.php
+++ b/tests/profilefields/type_string_test.php
@@ -249,8 +249,14 @@ class phpbb_profilefield_type_string_test extends phpbb_test_case
array(
0,
array('field_show_novalue' => false),
- null,
- 'Field should return null for empty integer without show_novalue',
+ 0,
+ 'Field should return value of integer 0 without show_novalue',
+ ),
+ array(
+ '0',
+ array('field_show_novalue' => false),
+ '0',
+ 'Field should return string 0',
),
array(
0,
diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php
index 07ef826abf..9bb4d69bf4 100644
--- a/tests/test_framework/phpbb_functional_test_case.php
+++ b/tests/test_framework/phpbb_functional_test_case.php
@@ -897,6 +897,76 @@ class phpbb_functional_test_case extends phpbb_mink_test_case
{
$this->add_lang('posting');
+ $crawler = $this->submit_message($posting_url, $posting_contains, $form_data);
+
+ if ($expected !== '')
+ {
+ if (isset($this->lang[$expected]))
+ {
+ $this->assertContainsLang($expected, $crawler->filter('html')->text());
+ }
+ else
+ {
+ $this->assertContains($expected, $crawler->filter('html')->text());
+ }
+ return null;
+ }
+
+ $url = $crawler->selectLink($form_data['subject'])->link()->getUri();
+
+ return array(
+ 'topic_id' => $this->get_parameter_from_link($url, 't'),
+ 'post_id' => $this->get_parameter_from_link($url, 'p'),
+ );
+ }
+
+ /**
+ * Creates a private message
+ *
+ * Be sure to login before creating
+ *
+ * @param string $subject
+ * @param string $message
+ * @param array $to
+ * @param array $additional_form_data Any additional form data to be sent in the request
+ * @return int private_message_id
+ */
+ public function create_private_message($subject, $message, $to, $additional_form_data = array())
+ {
+ $this->add_lang(array('ucp', 'posting'));
+
+ $posting_url = "ucp.php?i=pm&mode=compose&sid={$this->sid}";
+
+ $form_data = array_merge(array(
+ 'subject' => $subject,
+ 'message' => $message,
+ 'post' => true,
+ ), $additional_form_data);
+
+ foreach ($to as $user_id)
+ {
+ $form_data['address_list[u][' . $user_id . ']'] = 'to';
+ }
+
+ $crawler = self::submit_message($posting_url, 'POST_NEW_PM', $form_data);
+
+ $this->assertContains($this->lang('MESSAGE_STORED'), $crawler->filter('html')->text());
+ $url = $crawler->selectLink($this->lang('VIEW_PRIVATE_MESSAGE', '', ''))->link()->getUri();
+
+ return $this->get_parameter_from_link($url, 'p');
+ }
+
+ /**
+ * Helper for submitting a message (post or private message)
+ *
+ * @param string $posting_url
+ * @param string $posting_contains
+ * @param array $form_data
+ * @return \Symfony\Component\DomCrawler\Crawler the crawler object
+ */
+ protected function submit_message($posting_url, $posting_contains, $form_data)
+ {
+
$crawler = self::request('GET', $posting_url);
$this->assertContains($this->lang($posting_contains), $crawler->filter('html')->text());
@@ -938,27 +1008,7 @@ class phpbb_functional_test_case extends phpbb_mink_test_case
// I use a request because the form submission method does not allow you to send data that is not
// contained in one of the actual form fields that the browser sees (i.e. it ignores "hidden" inputs)
// Instead, I send it as a request with the submit button "post" set to true.
- $crawler = self::request('POST', $posting_url, $form_data);
-
- if ($expected !== '')
- {
- if (isset($this->lang[$expected]))
- {
- $this->assertContainsLang($expected, $crawler->filter('html')->text());
- }
- else
- {
- $this->assertContains($expected, $crawler->filter('html')->text());
- }
- return null;
- }
-
- $url = $crawler->selectLink($form_data['subject'])->link()->getUri();
-
- return array(
- 'topic_id' => $this->get_parameter_from_link($url, 't'),
- 'post_id' => $this->get_parameter_from_link($url, 'p'),
- );
+ return self::request('POST', $posting_url, $form_data);
}
/**
diff --git a/tests/test_framework/phpbb_test_case_helpers.php b/tests/test_framework/phpbb_test_case_helpers.php
index a29b6e1955..dee70ad016 100644
--- a/tests/test_framework/phpbb_test_case_helpers.php
+++ b/tests/test_framework/phpbb_test_case_helpers.php
@@ -142,17 +142,15 @@ class phpbb_test_case_helpers
$test_config = dirname(__FILE__) . '/../test_config.php';
}
+ $config_php_file = new \phpbb\config_php_file('', '');
+
if (file_exists($test_config))
{
- include($test_config);
-
- if (!function_exists('phpbb_convert_30_dbms_to_31'))
- {
- require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
- }
+ $config_php_file->set_config_file($test_config);
+ extract($config_php_file->get_all());
$config = array_merge($config, array(
- 'dbms' => phpbb_convert_30_dbms_to_31($dbms),
+ 'dbms' => $config_php_file->convert_30_dbms_to_31($dbms),
'dbhost' => $dbhost,
'dbport' => $dbport,
'dbname' => $dbname,
@@ -183,13 +181,8 @@ class phpbb_test_case_helpers
if (isset($_SERVER['PHPBB_TEST_DBMS']))
{
- if (!function_exists('phpbb_convert_30_dbms_to_31'))
- {
- require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
- }
-
$config = array_merge($config, array(
- 'dbms' => isset($_SERVER['PHPBB_TEST_DBMS']) ? phpbb_convert_30_dbms_to_31($_SERVER['PHPBB_TEST_DBMS']) : '',
+ 'dbms' => isset($_SERVER['PHPBB_TEST_DBMS']) ? $config_php_file->convert_30_dbms_to_31($_SERVER['PHPBB_TEST_DBMS']) : '',
'dbhost' => isset($_SERVER['PHPBB_TEST_DBHOST']) ? $_SERVER['PHPBB_TEST_DBHOST'] : '',
'dbport' => isset($_SERVER['PHPBB_TEST_DBPORT']) ? $_SERVER['PHPBB_TEST_DBPORT'] : '',
'dbname' => isset($_SERVER['PHPBB_TEST_DBNAME']) ? $_SERVER['PHPBB_TEST_DBNAME'] : '',
diff --git a/tests/viewonline/helper_test.php b/tests/viewonline/helper_test.php
index e4950bb51a..bbbed59de7 100644
--- a/tests/viewonline/helper_test.php
+++ b/tests/viewonline/helper_test.php
@@ -17,23 +17,27 @@ class phpbb_viewonline_helper_test extends phpbb_test_case
{
parent::setUp();
- $this->viewonline_helper = new \phpbb\viewonline_helper();
+ $this->viewonline_helper = new \phpbb\viewonline_helper(new \phpbb\filesystem());
}
public function session_pages_data()
{
return array(
- array('index.php', 'index.php'),
- array('foobar/test.php', 'foobar/test.php'),
+ array('index.php', 'index'),
+ array('foobar/test.php', 'foobar/test'),
array('', ''),
- array('../index.php', '../index.php'),
+ array('./../../index.php', '../../index'),
+ array('../subdir/index.php', '../subdir/index'),
+ array('../index.php', '../index'),
+ array('././index.php', 'index'),
+ array('./index.php', 'index'),
);
}
/**
* @dataProvider session_pages_data
*/
- public function test_get_user_page($expected, $session_page)
+ public function test_get_user_page($session_page, $expected)
{
$on_page = $this->viewonline_helper->get_user_page($session_page);
$this->assertArrayHasKey(1, $on_page);