aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/adm/style/acp_ext_list.html6
-rw-r--r--phpBB/adm/style/admin.css8
-rw-r--r--phpBB/config/default/container/services_console.yml1
-rw-r--r--phpBB/includes/acp/acp_board.php2
-rw-r--r--phpBB/includes/acp/acp_styles.php4
-rw-r--r--phpBB/includes/acp/acp_users.php16
-rw-r--r--phpBB/includes/functions.php12
-rw-r--r--phpBB/includes/ucp/ucp_notifications.php2
-rw-r--r--phpBB/index.php6
-rw-r--r--phpBB/phpbb/cache/driver/file.php2
-rw-r--r--phpBB/phpbb/cache/driver/memcached.php2
-rw-r--r--phpBB/phpbb/console/exception_subscriber.php13
-rw-r--r--phpBB/phpbb/cron/task/text_reparser/reparser.php4
-rw-r--r--phpBB/phpbb/db/migration/data/v310/style_update_p1.php10
-rw-r--r--phpBB/phpbb/db/migration/data/v320/text_reparser.php15
-rw-r--r--phpBB/phpbb/db/migration/data/v32x/fix_user_styles.php50
-rw-r--r--phpBB/phpbb/db/migrator.php7
-rw-r--r--phpBB/phpbb/feed/topics_active.php2
-rw-r--r--phpBB/phpbb/search/fulltext_sphinx.php8
-rw-r--r--phpBB/phpbb/user.php18
-rw-r--r--phpBB/styles/prosilver/theme/content.css1
-rw-r--r--phpBB/styles/prosilver/theme/images/announce_read.gifbin2656 -> 3549 bytes
-rw-r--r--phpBB/styles/prosilver/theme/images/announce_read_locked.gifbin2718 -> 3558 bytes
-rw-r--r--phpBB/styles/prosilver/theme/images/announce_read_locked_mine.gifbin2191 -> 3558 bytes
-rw-r--r--phpBB/styles/prosilver/theme/images/announce_read_mine.gifbin2183 -> 3580 bytes
-rw-r--r--phpBB/styles/prosilver/theme/images/announce_unread.gifbin2652 -> 3531 bytes
-rw-r--r--phpBB/styles/prosilver/theme/images/announce_unread_locked.gifbin2715 -> 3534 bytes
-rw-r--r--phpBB/styles/prosilver/theme/images/announce_unread_locked_mine.gifbin2210 -> 3564 bytes
-rw-r--r--phpBB/styles/prosilver/theme/images/announce_unread_mine.gifbin2206 -> 3560 bytes
-rw-r--r--phpBB/styles/prosilver/theme/images/forum_link.gifbin2609 -> 3500 bytes
-rw-r--r--phpBB/styles/prosilver/theme/images/forum_read.gifbin2120 -> 3448 bytes
-rw-r--r--phpBB/styles/prosilver/theme/images/forum_read_locked.gifbin2637 -> 3444 bytes
-rw-r--r--phpBB/styles/prosilver/theme/images/forum_read_subforum.gifbin2873 -> 3641 bytes
-rw-r--r--phpBB/styles/prosilver/theme/images/forum_unread.gifbin2115 -> 3440 bytes
-rw-r--r--phpBB/styles/prosilver/theme/images/forum_unread_locked.gifbin2637 -> 3442 bytes
-rw-r--r--phpBB/styles/prosilver/theme/images/forum_unread_subforum.gifbin2869 -> 3637 bytes
-rw-r--r--phpBB/styles/prosilver/theme/images/sticky_read.gifbin2605 -> 3198 bytes
-rw-r--r--phpBB/styles/prosilver/theme/images/sticky_read_locked.gifbin1982 -> 3248 bytes
-rw-r--r--phpBB/styles/prosilver/theme/images/sticky_read_locked_mine.gifbin2049 -> 3295 bytes
-rw-r--r--phpBB/styles/prosilver/theme/images/sticky_read_mine.gifbin2016 -> 3241 bytes
-rw-r--r--phpBB/styles/prosilver/theme/images/sticky_unread.gifbin2589 -> 3191 bytes
-rw-r--r--phpBB/styles/prosilver/theme/images/sticky_unread_locked.gifbin2022 -> 3246 bytes
-rw-r--r--phpBB/styles/prosilver/theme/images/sticky_unread_locked_mine.gifbin2059 -> 3316 bytes
-rw-r--r--phpBB/styles/prosilver/theme/images/sticky_unread_mine.gifbin2006 -> 3275 bytes
-rw-r--r--phpBB/styles/prosilver/theme/images/topic_moved.gifbin2609 -> 3459 bytes
-rw-r--r--phpBB/styles/prosilver/theme/images/topic_read.gifbin2109 -> 3482 bytes
-rw-r--r--phpBB/styles/prosilver/theme/images/topic_read_hot.gifbin2683 -> 3548 bytes
-rw-r--r--phpBB/styles/prosilver/theme/images/topic_read_hot_mine.gifbin2223 -> 3570 bytes
-rw-r--r--phpBB/styles/prosilver/theme/images/topic_read_locked.gifbin2593 -> 3458 bytes
-rw-r--r--phpBB/styles/prosilver/theme/images/topic_read_locked_mine.gifbin2641 -> 3416 bytes
-rw-r--r--phpBB/styles/prosilver/theme/images/topic_read_mine.gifbin2640 -> 3492 bytes
-rw-r--r--phpBB/styles/prosilver/theme/images/topic_unread.gifbin2539 -> 3327 bytes
-rw-r--r--phpBB/styles/prosilver/theme/images/topic_unread_hot.gifbin2682 -> 3551 bytes
-rw-r--r--phpBB/styles/prosilver/theme/images/topic_unread_hot_mine.gifbin2192 -> 3582 bytes
-rw-r--r--phpBB/styles/prosilver/theme/images/topic_unread_locked.gifbin2601 -> 3349 bytes
-rw-r--r--phpBB/styles/prosilver/theme/images/topic_unread_locked_mine.gifbin2637 -> 3375 bytes
-rw-r--r--phpBB/styles/prosilver/theme/images/topic_unread_mine.gifbin2622 -> 3393 bytes
-rw-r--r--phpBB/viewtopic.php9
-rw-r--r--tests/bbcode/parser_test.php3
-rw-r--r--tests/bbcode/url_bbcode_test.php3
-rw-r--r--tests/dbal/migration/revert_table.php39
-rw-r--r--tests/dbal/migration/revert_table_with_dependency.php52
-rw-r--r--tests/dbal/migrator_test.php45
-rw-r--r--tests/functions/make_clickable_email_test.php5
-rw-r--r--tests/functions/make_clickable_test.php3
-rw-r--r--tests/test_framework/phpbb_functional_test_case.php3
-rw-r--r--tests/text_formatter/s9e/factory_test.php6
67 files changed, 277 insertions, 80 deletions
diff --git a/phpBB/adm/style/acp_ext_list.html b/phpBB/adm/style/acp_ext_list.html
index af9e00a614..7ab2608e13 100644
--- a/phpBB/adm/style/acp_ext_list.html
+++ b/phpBB/adm/style/acp_ext_list.html
@@ -51,7 +51,8 @@
<td><strong title="{enabled.NAME}">{enabled.META_DISPLAY_NAME}</strong><!-- EVENT acp_ext_list_enabled_name_after --></td>
<td style="text-align: center;">
<!-- IF enabled.S_VERSIONCHECK -->
- <strong <!-- IF enabled.S_UP_TO_DATE -->style="color: #228822;"<!-- ELSE -->style="color: #BC2A4D;"<!-- ENDIF -->>{enabled.META_VERSION}</strong>
+ <strong class="<!-- IF enabled.S_UP_TO_DATE -->current-ext<!-- ELSE -->outdated-ext<!-- ENDIF -->">{enabled.META_VERSION}</strong>
+ <!-- IF not enabled.S_UP_TO_DATE --><i class="fa fa-exclamation-circle outdated-ext" aria-hidden="true"></i><!-- ENDIF -->
<!-- ELSE -->
{enabled.META_VERSION}
<!-- ENDIF -->
@@ -76,7 +77,8 @@
<td><strong title="{disabled.NAME}">{disabled.META_DISPLAY_NAME}</strong><!-- EVENT acp_ext_list_disabled_name_after --></td>
<td style="text-align: center;">
<!-- IF disabled.S_VERSIONCHECK -->
- <strong <!-- IF disabled.S_UP_TO_DATE -->style="color: #228822;"<!-- ELSE -->style="color: #BC2A4D;"<!-- ENDIF -->>{disabled.META_VERSION}</strong>
+ <strong class="<!-- IF disabled.S_UP_TO_DATE -->current-ext<!-- ELSE -->outdated-ext<!-- ENDIF -->">{disabled.META_VERSION}</strong>
+ <!-- IF not disabled.S_UP_TO_DATE --><i class="fa fa-exclamation-circle outdated-ext" aria-hidden="true"></i><!-- ENDIF -->
<!-- ELSE -->
{disabled.META_VERSION}
<!-- ENDIF -->
diff --git a/phpBB/adm/style/admin.css b/phpBB/adm/style/admin.css
index 2322b3da88..41d0ae8d42 100644
--- a/phpBB/adm/style/admin.css
+++ b/phpBB/adm/style/admin.css
@@ -2506,6 +2506,14 @@ fieldset.permissions .padding {
/* Classes for additional tasks
---------------------------------------- */
+.current-ext {
+ color: #228822;
+}
+
+.outdated-ext {
+ color: #BC2A4D;
+}
+
.phpinfo {
overflow: auto;
width: 99%;
diff --git a/phpBB/config/default/container/services_console.yml b/phpBB/config/default/container/services_console.yml
index 697e147d85..a327b74ac4 100644
--- a/phpBB/config/default/container/services_console.yml
+++ b/phpBB/config/default/container/services_console.yml
@@ -3,7 +3,6 @@ services:
class: phpbb\console\exception_subscriber
arguments:
- '@language'
- - '%debug.exceptions%'
tags:
- { name: kernel.event_subscriber }
diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php
index e044384c9f..77e6133fe6 100644
--- a/phpBB/includes/acp/acp_board.php
+++ b/phpBB/includes/acp/acp_board.php
@@ -552,7 +552,7 @@ class acp_board
if ($config_name == 'allow_quick_reply' && isset($_POST['allow_quick_reply_enable']))
{
- enable_bitfield_column_flag(FORUMS_TABLE, 'forum_flags', log(FORUM_FLAG_QUICK_REPLY, 2));
+ enable_bitfield_column_flag(FORUMS_TABLE, 'forum_flags', round(log(FORUM_FLAG_QUICK_REPLY, 2)));
}
}
}
diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php
index b954f90451..5b31417b83 100644
--- a/phpBB/includes/acp/acp_styles.php
+++ b/phpBB/includes/acp/acp_styles.php
@@ -398,7 +398,7 @@ class acp_styles
// Reset default style for users who use selected styles
$sql = 'UPDATE ' . USERS_TABLE . '
- SET user_style = 0
+ SET user_style = ' . (int) $this->default_style . '
WHERE user_style IN (' . implode(', ', $ids) . ')';
$this->db->sql_query($sql);
@@ -1249,7 +1249,7 @@ class acp_styles
// Change default style for users
$sql = 'UPDATE ' . USERS_TABLE . '
- SET user_style = 0
+ SET user_style = ' . (int) $this->default_style . '
WHERE user_style = ' . $id;
$this->db->sql_query($sql);
diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php
index cf442bbc33..090cb32ebb 100644
--- a/phpBB/includes/acp/acp_users.php
+++ b/phpBB/includes/acp/acp_users.php
@@ -813,16 +813,22 @@ class acp_users
break;
default:
+ $u_action = $this->u_action;
+
/**
* Run custom quicktool code
*
* @event core.acp_users_overview_run_quicktool
- * @var array user_row Current user data
* @var string action Quick tool that should be run
+ * @var array user_row Current user data
+ * @var string u_action The u_action link
* @since 3.1.0-a1
+ * @changed 3.2.2-RC1 Added u_action
*/
- $vars = array('action', 'user_row');
+ $vars = array('action', 'user_row', 'u_action');
extract($phpbb_dispatcher->trigger_event('core.acp_users_overview_run_quicktool', compact($vars)));
+
+ unset($u_action);
break;
}
@@ -1485,12 +1491,14 @@ class acp_users
* Validate profile data in ACP before submitting to the database
*
* @event core.acp_users_profile_validate
- * @var bool submit Flag indicating if submit button has been pressed
* @var array data Array with user profile data
+ * @var int user_id The user id
+ * @var array user_row Array with the full user data
* @var array error Array with the form errors
* @since 3.1.4-RC1
+ * @changed 3.1.12-RC1 Removed submit, added user_id, user_row
*/
- $vars = array('submit', 'data', 'error');
+ $vars = array('data', 'user_id', 'user_row', 'error');
extract($phpbb_dispatcher->trigger_event('core.acp_users_profile_validate', compact($vars)));
if (!sizeof($error))
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 6a36210dca..2cd62d7bac 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -1644,7 +1644,7 @@ function append_sid($url, $params = false, $is_amp = true, $session_id = false,
*/
function generate_board_url($without_script_path = false)
{
- global $config, $user, $request;
+ global $config, $user, $request, $symfony_request;
$server_name = $user->host;
@@ -1661,7 +1661,8 @@ function generate_board_url($without_script_path = false)
}
else
{
- $server_port = $request->server('SERVER_PORT', 0);
+ $server_port = (int) $symfony_request->getPort();
+
$forwarded_proto = $request->server('HTTP_X_FORWARDED_PROTO');
if (!empty($forwarded_proto) && $forwarded_proto === 'https')
@@ -4069,11 +4070,6 @@ function phpbb_get_avatar($row, $alt, $ignore_config = false, $lazy = false)
if ($driver)
{
$html = $driver->get_custom_html($user, $row, $alt);
- if (!empty($html))
- {
- return $html;
- }
-
$avatar_data = $driver->get_data($row);
}
else
@@ -4081,7 +4077,7 @@ function phpbb_get_avatar($row, $alt, $ignore_config = false, $lazy = false)
$avatar_data['src'] = '';
}
- if (!empty($avatar_data['src']))
+ if (empty($html) && !empty($avatar_data['src']))
{
if ($lazy)
{
diff --git a/phpBB/includes/ucp/ucp_notifications.php b/phpBB/includes/ucp/ucp_notifications.php
index 835db44b90..029588bb23 100644
--- a/phpBB/includes/ucp/ucp_notifications.php
+++ b/phpBB/includes/ucp/ucp_notifications.php
@@ -205,7 +205,7 @@ class ucp_notifications
}
$template->assign_vars(array(
- strtoupper($block) . '_COLS' => sizeof($notification_methods) + 2,
+ strtoupper($block) . '_COLS' => sizeof($notification_methods) + 1,
));
}
diff --git a/phpBB/index.php b/phpBB/index.php
index 83535b50af..4e37782206 100644
--- a/phpBB/index.php
+++ b/phpBB/index.php
@@ -123,8 +123,10 @@ $db->sql_freeresult($result);
$legend = implode($user->lang['COMMA_SEPARATOR'], $legend);
// Generate birthday list if required ...
+$show_birthdays = ($config['load_birthdays'] && $config['allow_birthdays'] && $auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel'));
+
$birthdays = $birthday_list = array();
-if ($config['load_birthdays'] && $config['allow_birthdays'] && $auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel'))
+if ($show_birthdays)
{
$time = $user->create_datetime();
$now = phpbb_gmgetdate($time->getTimestamp() + $time->getOffset());
@@ -215,7 +217,7 @@ $template->assign_vars(array(
'S_LOGIN_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'),
'U_SEND_PASSWORD' => ($config['email_enable']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=sendpassword') : '',
- 'S_DISPLAY_BIRTHDAY_LIST' => ($config['load_birthdays']) ? true : false,
+ 'S_DISPLAY_BIRTHDAY_LIST' => $show_birthdays,
'S_INDEX' => true,
'U_MARK_FORUMS' => ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}index.$phpEx", 'hash=' . generate_link_hash('global') . '&amp;mark=forums&amp;mark_time=' . time()) : '',
diff --git a/phpBB/phpbb/cache/driver/file.php b/phpBB/phpbb/cache/driver/file.php
index 497f00c06b..e9d2ba8e04 100644
--- a/phpBB/phpbb/cache/driver/file.php
+++ b/phpBB/phpbb/cache/driver/file.php
@@ -576,7 +576,7 @@ class file extends \phpbb\cache\driver\base
if (function_exists('opcache_invalidate'))
{
- @opcache_invalidate($this->cache_file);
+ @opcache_invalidate($file);
}
try
diff --git a/phpBB/phpbb/cache/driver/memcached.php b/phpBB/phpbb/cache/driver/memcached.php
index 808e15afe8..7d66759ec2 100644
--- a/phpBB/phpbb/cache/driver/memcached.php
+++ b/phpBB/phpbb/cache/driver/memcached.php
@@ -65,7 +65,7 @@ class memcached extends \phpbb\cache\driver\memory
$this->memcached->setOption(\Memcached::OPT_COMPRESSION, false);
}
- foreach (explode(',', PHPBB_ACM_MEMCACHE) as $u)
+ foreach (explode(',', PHPBB_ACM_MEMCACHED) as $u)
{
preg_match('#(.*)/(\d+)#', $u, $parts);
$this->memcached->addServer(trim($parts[1]), (int) trim($parts[2]));
diff --git a/phpBB/phpbb/console/exception_subscriber.php b/phpBB/phpbb/console/exception_subscriber.php
index b920d4abae..b240993203 100644
--- a/phpBB/phpbb/console/exception_subscriber.php
+++ b/phpBB/phpbb/console/exception_subscriber.php
@@ -29,12 +29,10 @@ class exception_subscriber implements EventSubscriberInterface
* Construct method
*
* @param \phpbb\language\language $language Language object
- * @param bool $debug Debug mode
*/
- public function __construct(\phpbb\language\language $language, $debug = false)
+ public function __construct(\phpbb\language\language $language)
{
$this->language = $language;
- $this->debug = $debug;
}
/**
@@ -52,14 +50,7 @@ class exception_subscriber implements EventSubscriberInterface
$parameters = array_merge(array($original_exception->getMessage()), $original_exception->get_parameters());
$message = call_user_func_array(array($this->language, 'lang'), $parameters);
- if ($this->debug)
- {
- $exception = new \RuntimeException($message , $original_exception->getCode(), $original_exception);
- }
- else
- {
- $exception = new \RuntimeException($message , $original_exception->getCode());
- }
+ $exception = new \RuntimeException($message , $original_exception->getCode(), $original_exception);
$event->setException($exception);
}
diff --git a/phpBB/phpbb/cron/task/text_reparser/reparser.php b/phpBB/phpbb/cron/task/text_reparser/reparser.php
index 69392f5ac9..fa3bc67325 100644
--- a/phpBB/phpbb/cron/task/text_reparser/reparser.php
+++ b/phpBB/phpbb/cron/task/text_reparser/reparser.php
@@ -85,7 +85,7 @@ class reparser extends \phpbb\cron\task\base
if ($this->resume_data === null)
{
- $this->reparser_manager->get_resume_data($this->reparser_name);
+ $this->resume_data = $this->reparser_manager->get_resume_data($this->reparser_name);
}
}
@@ -96,7 +96,7 @@ class reparser extends \phpbb\cron\task\base
{
if ($this->resume_data === null)
{
- $this->reparser_manager->get_resume_data($this->reparser_name);
+ $this->resume_data = $this->reparser_manager->get_resume_data($this->reparser_name);
}
if (!isset($this->resume_data['range-max']) || $this->resume_data['range-max'] >= $this->resume_data['range-min'])
diff --git a/phpBB/phpbb/db/migration/data/v310/style_update_p1.php b/phpBB/phpbb/db/migration/data/v310/style_update_p1.php
index 2c7b7edf2e..f50ab33830 100644
--- a/phpBB/phpbb/db/migration/data/v310/style_update_p1.php
+++ b/phpBB/phpbb/db/migration/data/v310/style_update_p1.php
@@ -160,12 +160,12 @@ class style_update_p1 extends \phpbb\db\migration\migration
FROM ' . STYLES_TABLE . "
WHERE style_name = 'prosilver'";
$result = $this->sql_query($sql);
- $default_style = $this->db->sql_fetchfield('style_id');
+ $default_style = (int) $this->db->sql_fetchfield('style_id');
$this->db->sql_freeresult($result);
$this->config->set('default_style', $default_style);
- $sql = 'UPDATE ' . USERS_TABLE . ' SET user_style = 0';
+ $sql = 'UPDATE ' . USERS_TABLE . ' SET user_style = ' . (int) $default_style;
$this->sql_query($sql);
}
else
@@ -183,9 +183,9 @@ class style_update_p1 extends \phpbb\db\migration\migration
}
// Reset styles for users
- $this->sql_query('UPDATE ' . USERS_TABLE . '
- SET user_style = 0
- WHERE ' . $this->db->sql_in_set('user_style', $valid_styles, true));
+ $this->sql_query('UPDATE ' . USERS_TABLE . "
+ SET user_style = '" . (int) $valid_styles[0] . "'
+ WHERE " . $this->db->sql_in_set('user_style', $valid_styles, true));
}
}
}
diff --git a/phpBB/phpbb/db/migration/data/v320/text_reparser.php b/phpBB/phpbb/db/migration/data/v320/text_reparser.php
index 03c5d39fe4..6b8cf93cc9 100644
--- a/phpBB/phpbb/db/migration/data/v320/text_reparser.php
+++ b/phpBB/phpbb/db/migration/data/v320/text_reparser.php
@@ -54,13 +54,16 @@ class text_reparser extends \phpbb\db\migration\container_aware_migration
/** @var manager $reparser_manager */
$reparser_manager = $this->container->get('text_reparser.manager');
- /** @var reparser_interface[] $reparsers */
- $reparsers = $this->container->get('text_reparser_collection');
-
- // Initialize all reparsers
- foreach ($reparsers as $name => $reparser)
+ if (!is_array($resume_data))
{
- $reparser_manager->update_resume_data($name, 1, $reparser->get_max_id(), 100);
+ /** @var reparser_interface[] $reparsers */
+ $reparsers = $this->container->get('text_reparser_collection');
+
+ // Initialize all reparsers
+ foreach ($reparsers as $name => $reparser)
+ {
+ $reparser_manager->update_resume_data($name, 1, $reparser->get_max_id(), 100);
+ }
}
// Sometimes a cron job is too much
diff --git a/phpBB/phpbb/db/migration/data/v32x/fix_user_styles.php b/phpBB/phpbb/db/migration/data/v32x/fix_user_styles.php
new file mode 100644
index 0000000000..282c6bef2f
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v32x/fix_user_styles.php
@@ -0,0 +1,50 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+namespace phpbb\db\migration\data\v32x;
+
+class fix_user_styles extends \phpbb\db\migration\migration
+{
+
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v320\v320',
+ );
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('custom', array(array($this, 'styles_fix'))),
+ );
+ }
+
+ public function styles_fix()
+ {
+ $default_style = (int) $this->config['default_style'];
+
+ // Get enabled styles
+ $sql = 'SELECT style_id
+ FROM ' . STYLES_TABLE . '
+ WHERE style_active = 1';
+ $result = $this->db->sql_query($sql);
+ $enabled_styles = $result->fetch_array();
+ $this->db->sql_freeresult($result);
+
+ // Set the default style to users who have an invalid style
+ $this->sql_query('UPDATE ' . USERS_TABLE . '
+ SET user_style = ' . (int) $default_style . '
+ WHERE ' . $this->db->sql_in_set('user_style', $enabled_styles, true));
+ }
+}
diff --git a/phpBB/phpbb/db/migrator.php b/phpBB/phpbb/db/migrator.php
index d7d7f18d2b..6c026c3ae1 100644
--- a/phpBB/phpbb/db/migrator.php
+++ b/phpBB/phpbb/db/migrator.php
@@ -503,11 +503,14 @@ class migrator
return;
}
- foreach ($this->migration_state as $name => $state)
+ foreach ($this->migrations as $name)
{
- if (!empty($state['migration_depends_on']) && in_array($migration, $state['migration_depends_on']))
+ $state = $this->migration_state($name);
+
+ if ($state && in_array($migration, $state['migration_depends_on']) && ($state['migration_schema_done'] || $state['migration_data_done']))
{
$this->revert_do($name);
+ return;
}
}
diff --git a/phpBB/phpbb/feed/topics_active.php b/phpBB/phpbb/feed/topics_active.php
index 7ae0bde56b..ea9ee97b9d 100644
--- a/phpBB/phpbb/feed/topics_active.php
+++ b/phpBB/phpbb/feed/topics_active.php
@@ -119,7 +119,7 @@ class topics_active extends topic_base
FROM ' . FORUMS_TABLE . '
WHERE forum_type = ' . FORUM_POST . '
AND ' . $this->db->sql_bit_and('forum_options', FORUM_OPTION_FEED_EXCLUDE, '= 0') . '
- AND ' . $this->db->sql_bit_and('forum_flags', log(FORUM_FLAG_ACTIVE_TOPICS, 2), '<> 0');
+ AND ' . $this->db->sql_bit_and('forum_flags', round(log(FORUM_FLAG_ACTIVE_TOPICS, 2)), '<> 0');
$result = $this->db->sql_query($sql);
$forum_ids = array();
diff --git a/phpBB/phpbb/search/fulltext_sphinx.php b/phpBB/phpbb/search/fulltext_sphinx.php
index 89c615e087..59c3d55076 100644
--- a/phpBB/phpbb/search/fulltext_sphinx.php
+++ b/phpBB/phpbb/search/fulltext_sphinx.php
@@ -648,7 +648,7 @@ class fulltext_sphinx
$this->sphinx->SetFilter('deleted', array(0));
$this->sphinx->SetLimits($start, (int) $per_page, SPHINX_MAX_MATCHES);
- $result = $this->sphinx->Query($search_query_prefix . str_replace('&quot;', '"', $this->search_query), $this->indexes);
+ $result = $this->sphinx->Query($search_query_prefix . $this->sphinx->EscapeString(str_replace('&quot;', '"', $this->search_query)), $this->indexes);
// Could be connection to localhost:9312 failed (errno=111,
// msg=Connection refused) during rotate, retry if so
@@ -656,7 +656,7 @@ class fulltext_sphinx
while (!$result && (strpos($this->sphinx->GetLastError(), "errno=111,") !== false) && $retries--)
{
usleep(SPHINX_CONNECT_WAIT_TIME);
- $result = $this->sphinx->Query($search_query_prefix . str_replace('&quot;', '"', $this->search_query), $this->indexes);
+ $result = $this->sphinx->Query($search_query_prefix . $this->sphinx->EscapeString(str_replace('&quot;', '"', $this->search_query)), $this->indexes);
}
if ($this->sphinx->GetLastError())
@@ -679,7 +679,7 @@ class fulltext_sphinx
$start = floor(($result_count - 1) / $per_page) * $per_page;
$this->sphinx->SetLimits((int) $start, (int) $per_page, SPHINX_MAX_MATCHES);
- $result = $this->sphinx->Query($search_query_prefix . str_replace('&quot;', '"', $this->search_query), $this->indexes);
+ $result = $this->sphinx->Query($search_query_prefix . $this->sphinx->EscapeString(str_replace('&quot;', '"', $this->search_query)), $this->indexes);
// Could be connection to localhost:9312 failed (errno=111,
// msg=Connection refused) during rotate, retry if so
@@ -687,7 +687,7 @@ class fulltext_sphinx
while (!$result && (strpos($this->sphinx->GetLastError(), "errno=111,") !== false) && $retries--)
{
usleep(SPHINX_CONNECT_WAIT_TIME);
- $result = $this->sphinx->Query($search_query_prefix . str_replace('&quot;', '"', $this->search_query), $this->indexes);
+ $result = $this->sphinx->Query($search_query_prefix . $this->sphinx->EscapeString(str_replace('&quot;', '"', $this->search_query)), $this->indexes);
}
}
diff --git a/phpBB/phpbb/user.php b/phpBB/phpbb/user.php
index d4097f53ee..5899dff2f5 100644
--- a/phpBB/phpbb/user.php
+++ b/phpBB/phpbb/user.php
@@ -278,24 +278,6 @@ class user extends \phpbb\session
$db->sql_freeresult($result);
}
- // User has wrong style
- if (!$this->style && $style_id == $this->data['user_style'])
- {
- $style_id = $this->data['user_style'] = $config['default_style'];
-
- $sql = 'UPDATE ' . USERS_TABLE . "
- SET user_style = $style_id
- WHERE user_id = {$this->data['user_id']}";
- $db->sql_query($sql);
-
- $sql = 'SELECT *
- FROM ' . STYLES_TABLE . " s
- WHERE s.style_id = $style_id";
- $result = $db->sql_query($sql, 3600);
- $this->style = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
- }
-
if (!$this->style)
{
trigger_error('NO_STYLE_DATA', E_USER_ERROR);
diff --git a/phpBB/styles/prosilver/theme/content.css b/phpBB/styles/prosilver/theme/content.css
index 3040282b90..a071e63c69 100644
--- a/phpBB/styles/prosilver/theme/content.css
+++ b/phpBB/styles/prosilver/theme/content.css
@@ -137,7 +137,6 @@ dl.row-item {
background-position: 10px 50%; /* Position of folder icon */
background-repeat: no-repeat;
background-size: 32px;
- image-rendering: -webkit-optimize-contrast;
}
dl.row-item dt {
diff --git a/phpBB/styles/prosilver/theme/images/announce_read.gif b/phpBB/styles/prosilver/theme/images/announce_read.gif
index b61cc54140..a3b3d7b234 100644
--- a/phpBB/styles/prosilver/theme/images/announce_read.gif
+++ b/phpBB/styles/prosilver/theme/images/announce_read.gif
Binary files differ
diff --git a/phpBB/styles/prosilver/theme/images/announce_read_locked.gif b/phpBB/styles/prosilver/theme/images/announce_read_locked.gif
index 8c7393edf9..0a6cf64341 100644
--- a/phpBB/styles/prosilver/theme/images/announce_read_locked.gif
+++ b/phpBB/styles/prosilver/theme/images/announce_read_locked.gif
Binary files differ
diff --git a/phpBB/styles/prosilver/theme/images/announce_read_locked_mine.gif b/phpBB/styles/prosilver/theme/images/announce_read_locked_mine.gif
index e3f6e622a3..56af0ab071 100644
--- a/phpBB/styles/prosilver/theme/images/announce_read_locked_mine.gif
+++ b/phpBB/styles/prosilver/theme/images/announce_read_locked_mine.gif
Binary files differ
diff --git a/phpBB/styles/prosilver/theme/images/announce_read_mine.gif b/phpBB/styles/prosilver/theme/images/announce_read_mine.gif
index d57e5d04e5..c333e3b124 100644
--- a/phpBB/styles/prosilver/theme/images/announce_read_mine.gif
+++ b/phpBB/styles/prosilver/theme/images/announce_read_mine.gif
Binary files differ
diff --git a/phpBB/styles/prosilver/theme/images/announce_unread.gif b/phpBB/styles/prosilver/theme/images/announce_unread.gif
index eb9edd1520..9f75cc3e53 100644
--- a/phpBB/styles/prosilver/theme/images/announce_unread.gif
+++ b/phpBB/styles/prosilver/theme/images/announce_unread.gif
Binary files differ
diff --git a/phpBB/styles/prosilver/theme/images/announce_unread_locked.gif b/phpBB/styles/prosilver/theme/images/announce_unread_locked.gif
index 054b0ae38d..4ad85bb684 100644
--- a/phpBB/styles/prosilver/theme/images/announce_unread_locked.gif
+++ b/phpBB/styles/prosilver/theme/images/announce_unread_locked.gif
Binary files differ
diff --git a/phpBB/styles/prosilver/theme/images/announce_unread_locked_mine.gif b/phpBB/styles/prosilver/theme/images/announce_unread_locked_mine.gif
index a37b165b4f..30db89439e 100644
--- a/phpBB/styles/prosilver/theme/images/announce_unread_locked_mine.gif
+++ b/phpBB/styles/prosilver/theme/images/announce_unread_locked_mine.gif
Binary files differ
diff --git a/phpBB/styles/prosilver/theme/images/announce_unread_mine.gif b/phpBB/styles/prosilver/theme/images/announce_unread_mine.gif
index 55f649cc4b..3a2cbcac10 100644
--- a/phpBB/styles/prosilver/theme/images/announce_unread_mine.gif
+++ b/phpBB/styles/prosilver/theme/images/announce_unread_mine.gif
Binary files differ
diff --git a/phpBB/styles/prosilver/theme/images/forum_link.gif b/phpBB/styles/prosilver/theme/images/forum_link.gif
index 42d445838b..09f8dfa75a 100644
--- a/phpBB/styles/prosilver/theme/images/forum_link.gif
+++ b/phpBB/styles/prosilver/theme/images/forum_link.gif
Binary files differ
diff --git a/phpBB/styles/prosilver/theme/images/forum_read.gif b/phpBB/styles/prosilver/theme/images/forum_read.gif
index 79d605ad7c..891fa20c07 100644
--- a/phpBB/styles/prosilver/theme/images/forum_read.gif
+++ b/phpBB/styles/prosilver/theme/images/forum_read.gif
Binary files differ
diff --git a/phpBB/styles/prosilver/theme/images/forum_read_locked.gif b/phpBB/styles/prosilver/theme/images/forum_read_locked.gif
index 5eaf460a59..2348240638 100644
--- a/phpBB/styles/prosilver/theme/images/forum_read_locked.gif
+++ b/phpBB/styles/prosilver/theme/images/forum_read_locked.gif
Binary files differ
diff --git a/phpBB/styles/prosilver/theme/images/forum_read_subforum.gif b/phpBB/styles/prosilver/theme/images/forum_read_subforum.gif
index b7b8176e4e..5b4d30f7ec 100644
--- a/phpBB/styles/prosilver/theme/images/forum_read_subforum.gif
+++ b/phpBB/styles/prosilver/theme/images/forum_read_subforum.gif
Binary files differ
diff --git a/phpBB/styles/prosilver/theme/images/forum_unread.gif b/phpBB/styles/prosilver/theme/images/forum_unread.gif
index 8df11e7782..e925da82bd 100644
--- a/phpBB/styles/prosilver/theme/images/forum_unread.gif
+++ b/phpBB/styles/prosilver/theme/images/forum_unread.gif
Binary files differ
diff --git a/phpBB/styles/prosilver/theme/images/forum_unread_locked.gif b/phpBB/styles/prosilver/theme/images/forum_unread_locked.gif
index 63ac3fbedf..5ff59b7421 100644
--- a/phpBB/styles/prosilver/theme/images/forum_unread_locked.gif
+++ b/phpBB/styles/prosilver/theme/images/forum_unread_locked.gif
Binary files differ
diff --git a/phpBB/styles/prosilver/theme/images/forum_unread_subforum.gif b/phpBB/styles/prosilver/theme/images/forum_unread_subforum.gif
index c5a2da1e31..7d6ddb93be 100644
--- a/phpBB/styles/prosilver/theme/images/forum_unread_subforum.gif
+++ b/phpBB/styles/prosilver/theme/images/forum_unread_subforum.gif
Binary files differ
diff --git a/phpBB/styles/prosilver/theme/images/sticky_read.gif b/phpBB/styles/prosilver/theme/images/sticky_read.gif
index c56a3833f9..e8142ddb20 100644
--- a/phpBB/styles/prosilver/theme/images/sticky_read.gif
+++ b/phpBB/styles/prosilver/theme/images/sticky_read.gif
Binary files differ
diff --git a/phpBB/styles/prosilver/theme/images/sticky_read_locked.gif b/phpBB/styles/prosilver/theme/images/sticky_read_locked.gif
index 854a8f06de..fcd8b85e0b 100644
--- a/phpBB/styles/prosilver/theme/images/sticky_read_locked.gif
+++ b/phpBB/styles/prosilver/theme/images/sticky_read_locked.gif
Binary files differ
diff --git a/phpBB/styles/prosilver/theme/images/sticky_read_locked_mine.gif b/phpBB/styles/prosilver/theme/images/sticky_read_locked_mine.gif
index 0d559c0767..0a8dc2a6c1 100644
--- a/phpBB/styles/prosilver/theme/images/sticky_read_locked_mine.gif
+++ b/phpBB/styles/prosilver/theme/images/sticky_read_locked_mine.gif
Binary files differ
diff --git a/phpBB/styles/prosilver/theme/images/sticky_read_mine.gif b/phpBB/styles/prosilver/theme/images/sticky_read_mine.gif
index 3cd077355a..37c4ed01f6 100644
--- a/phpBB/styles/prosilver/theme/images/sticky_read_mine.gif
+++ b/phpBB/styles/prosilver/theme/images/sticky_read_mine.gif
Binary files differ
diff --git a/phpBB/styles/prosilver/theme/images/sticky_unread.gif b/phpBB/styles/prosilver/theme/images/sticky_unread.gif
index 0d201657e3..88a212d7c0 100644
--- a/phpBB/styles/prosilver/theme/images/sticky_unread.gif
+++ b/phpBB/styles/prosilver/theme/images/sticky_unread.gif
Binary files differ
diff --git a/phpBB/styles/prosilver/theme/images/sticky_unread_locked.gif b/phpBB/styles/prosilver/theme/images/sticky_unread_locked.gif
index 4535708752..0241da2ab5 100644
--- a/phpBB/styles/prosilver/theme/images/sticky_unread_locked.gif
+++ b/phpBB/styles/prosilver/theme/images/sticky_unread_locked.gif
Binary files differ
diff --git a/phpBB/styles/prosilver/theme/images/sticky_unread_locked_mine.gif b/phpBB/styles/prosilver/theme/images/sticky_unread_locked_mine.gif
index bb14033781..8d69b447b2 100644
--- a/phpBB/styles/prosilver/theme/images/sticky_unread_locked_mine.gif
+++ b/phpBB/styles/prosilver/theme/images/sticky_unread_locked_mine.gif
Binary files differ
diff --git a/phpBB/styles/prosilver/theme/images/sticky_unread_mine.gif b/phpBB/styles/prosilver/theme/images/sticky_unread_mine.gif
index c7ae656f02..6529102053 100644
--- a/phpBB/styles/prosilver/theme/images/sticky_unread_mine.gif
+++ b/phpBB/styles/prosilver/theme/images/sticky_unread_mine.gif
Binary files differ
diff --git a/phpBB/styles/prosilver/theme/images/topic_moved.gif b/phpBB/styles/prosilver/theme/images/topic_moved.gif
index 707b9f5d3d..8e9c1f41f6 100644
--- a/phpBB/styles/prosilver/theme/images/topic_moved.gif
+++ b/phpBB/styles/prosilver/theme/images/topic_moved.gif
Binary files differ
diff --git a/phpBB/styles/prosilver/theme/images/topic_read.gif b/phpBB/styles/prosilver/theme/images/topic_read.gif
index a3b706eb11..5ed739ee9b 100644
--- a/phpBB/styles/prosilver/theme/images/topic_read.gif
+++ b/phpBB/styles/prosilver/theme/images/topic_read.gif
Binary files differ
diff --git a/phpBB/styles/prosilver/theme/images/topic_read_hot.gif b/phpBB/styles/prosilver/theme/images/topic_read_hot.gif
index d118fdcc4f..81a42d0a67 100644
--- a/phpBB/styles/prosilver/theme/images/topic_read_hot.gif
+++ b/phpBB/styles/prosilver/theme/images/topic_read_hot.gif
Binary files differ
diff --git a/phpBB/styles/prosilver/theme/images/topic_read_hot_mine.gif b/phpBB/styles/prosilver/theme/images/topic_read_hot_mine.gif
index 2e16f96e33..b98808cadf 100644
--- a/phpBB/styles/prosilver/theme/images/topic_read_hot_mine.gif
+++ b/phpBB/styles/prosilver/theme/images/topic_read_hot_mine.gif
Binary files differ
diff --git a/phpBB/styles/prosilver/theme/images/topic_read_locked.gif b/phpBB/styles/prosilver/theme/images/topic_read_locked.gif
index 3154d38463..61bb1effa2 100644
--- a/phpBB/styles/prosilver/theme/images/topic_read_locked.gif
+++ b/phpBB/styles/prosilver/theme/images/topic_read_locked.gif
Binary files differ
diff --git a/phpBB/styles/prosilver/theme/images/topic_read_locked_mine.gif b/phpBB/styles/prosilver/theme/images/topic_read_locked_mine.gif
index ac0248c2be..dbe901919a 100644
--- a/phpBB/styles/prosilver/theme/images/topic_read_locked_mine.gif
+++ b/phpBB/styles/prosilver/theme/images/topic_read_locked_mine.gif
Binary files differ
diff --git a/phpBB/styles/prosilver/theme/images/topic_read_mine.gif b/phpBB/styles/prosilver/theme/images/topic_read_mine.gif
index b0e9455d0e..8fb165c46c 100644
--- a/phpBB/styles/prosilver/theme/images/topic_read_mine.gif
+++ b/phpBB/styles/prosilver/theme/images/topic_read_mine.gif
Binary files differ
diff --git a/phpBB/styles/prosilver/theme/images/topic_unread.gif b/phpBB/styles/prosilver/theme/images/topic_unread.gif
index de500726ec..43ea76b4de 100644
--- a/phpBB/styles/prosilver/theme/images/topic_unread.gif
+++ b/phpBB/styles/prosilver/theme/images/topic_unread.gif
Binary files differ
diff --git a/phpBB/styles/prosilver/theme/images/topic_unread_hot.gif b/phpBB/styles/prosilver/theme/images/topic_unread_hot.gif
index 1937164e08..a45bc4bc19 100644
--- a/phpBB/styles/prosilver/theme/images/topic_unread_hot.gif
+++ b/phpBB/styles/prosilver/theme/images/topic_unread_hot.gif
Binary files differ
diff --git a/phpBB/styles/prosilver/theme/images/topic_unread_hot_mine.gif b/phpBB/styles/prosilver/theme/images/topic_unread_hot_mine.gif
index 28fdd88f4b..dc673266be 100644
--- a/phpBB/styles/prosilver/theme/images/topic_unread_hot_mine.gif
+++ b/phpBB/styles/prosilver/theme/images/topic_unread_hot_mine.gif
Binary files differ
diff --git a/phpBB/styles/prosilver/theme/images/topic_unread_locked.gif b/phpBB/styles/prosilver/theme/images/topic_unread_locked.gif
index 177dae74f4..68dd3422d7 100644
--- a/phpBB/styles/prosilver/theme/images/topic_unread_locked.gif
+++ b/phpBB/styles/prosilver/theme/images/topic_unread_locked.gif
Binary files differ
diff --git a/phpBB/styles/prosilver/theme/images/topic_unread_locked_mine.gif b/phpBB/styles/prosilver/theme/images/topic_unread_locked_mine.gif
index 2b6b854e33..4f5a36efe9 100644
--- a/phpBB/styles/prosilver/theme/images/topic_unread_locked_mine.gif
+++ b/phpBB/styles/prosilver/theme/images/topic_unread_locked_mine.gif
Binary files differ
diff --git a/phpBB/styles/prosilver/theme/images/topic_unread_mine.gif b/phpBB/styles/prosilver/theme/images/topic_unread_mine.gif
index fd16eeedef..24e9817ce1 100644
--- a/phpBB/styles/prosilver/theme/images/topic_unread_mine.gif
+++ b/phpBB/styles/prosilver/theme/images/topic_unread_mine.gif
Binary files differ
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index d4bf5b2490..3f117eef6b 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -263,6 +263,10 @@ if (!$topic_data)
$forum_id = (int) $topic_data['forum_id'];
+// If the request is missing the f parameter, the forum id in the user session data is 0 at the moment.
+// Let's fix that now so that the user can't hide from the forum's Who Is Online list.
+$user->page['forum'] = $forum_id;
+
// Now we know the forum_id and can check the permissions
if ($topic_data['topic_visibility'] != ITEM_APPROVED && !$auth->acl_get('m_approve', $forum_id))
{
@@ -2017,10 +2021,13 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
* @var array user_poster_data Poster's data from user cache
* @var array post_row Template block array of the post
* @var array topic_data Array with topic data
+ * @var array user_cache Array with cached user data
+ * @var array post_edit_list Array with post edited list
* @since 3.1.0-a1
* @changed 3.1.0-a3 Added vars start, current_row_number, end, attachments
* @changed 3.1.0-b3 Added topic_data array, total_posts
* @changed 3.1.0-RC3 Added poster_id
+ * @changed 3.2.2-RC1 Added user_cache and post_edit_list
*/
$vars = array(
'start',
@@ -2034,6 +2041,8 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
'user_poster_data',
'post_row',
'topic_data',
+ 'user_cache',
+ 'post_edit_list',
);
extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_post_row', compact($vars)));
diff --git a/tests/bbcode/parser_test.php b/tests/bbcode/parser_test.php
index 4e85737c4f..b569d371f1 100644
--- a/tests/bbcode/parser_test.php
+++ b/tests/bbcode/parser_test.php
@@ -249,9 +249,10 @@ class phpbb_bbcode_parser_test extends \phpbb_test_case
$this->markTestIncomplete($incomplete);
}
- global $user, $request;
+ global $user, $request, $symfony_request;
$user = new phpbb_mock_user;
$request = new phpbb_mock_request;
+ $symfony_request = new \phpbb\symfony_request($request);
$bbcode = new bbcode_firstpass();
$bbcode->message = $message;
diff --git a/tests/bbcode/url_bbcode_test.php b/tests/bbcode/url_bbcode_test.php
index 3f8ad6022f..f95970a6bb 100644
--- a/tests/bbcode/url_bbcode_test.php
+++ b/tests/bbcode/url_bbcode_test.php
@@ -52,9 +52,10 @@ class phpbb_url_bbcode_test extends phpbb_test_case
*/
public function test_url($description, $message, $expected)
{
- global $user, $request;
+ global $user, $request, $symfony_request;
$user = new phpbb_mock_user;
$request = new phpbb_mock_request;
+ $symfony_request = new \phpbb\symfony_request($request);
$bbcode = new bbcode_firstpass();
$bbcode->message = $message;
diff --git a/tests/dbal/migration/revert_table.php b/tests/dbal/migration/revert_table.php
new file mode 100644
index 0000000000..162421be85
--- /dev/null
+++ b/tests/dbal/migration/revert_table.php
@@ -0,0 +1,39 @@
+<?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_dbal_migration_revert_table extends \phpbb\db\migration\migration
+{
+ function update_schema()
+ {
+ return array(
+ 'add_tables' => array(
+ 'phpbb_foobar' => array(
+ 'COLUMNS' => array(
+ 'module_id' => array('UINT:3', NULL, 'auto_increment'),
+ 'bar_column' => array('UINT', 1),
+ ),
+ 'PRIMARY_KEY' => 'module_id',
+ ),
+ ),
+ );
+ }
+
+ function revert_schema()
+ {
+ return array(
+ 'drop_tables' => array(
+ 'phpbb_foobar',
+ ),
+ );
+ }
+}
diff --git a/tests/dbal/migration/revert_table_with_dependency.php b/tests/dbal/migration/revert_table_with_dependency.php
new file mode 100644
index 0000000000..f26ad076e6
--- /dev/null
+++ b/tests/dbal/migration/revert_table_with_dependency.php
@@ -0,0 +1,52 @@
+<?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_dbal_migration_revert_table_with_dependency extends \phpbb\db\migration\migration
+{
+ static public function depends_on()
+ {
+ return array('phpbb_dbal_migration_revert_table');
+ }
+
+ function update_schema()
+ {
+ return array(
+ 'add_columns' => array(
+ 'phpbb_foobar' => array(
+ 'baz_column' => array('UINT', 1),
+ ),
+ ),
+ 'drop_columns' => array(
+ 'phpbb_foobar' => array(
+ 'bar_column',
+ ),
+ ),
+ );
+ }
+
+ function revert_schema()
+ {
+ return array(
+ 'add_columns' => array(
+ 'phpbb_foobar' => array(
+ 'bar_column' => array('UINT', 1),
+ ),
+ ),
+ 'drop_columns' => array(
+ 'phpbb_foobar' => array(
+ 'baz_column',
+ ),
+ ),
+ );
+ }
+}
diff --git a/tests/dbal/migrator_test.php b/tests/dbal/migrator_test.php
index f7275a4bbe..372b2dbe1e 100644
--- a/tests/dbal/migrator_test.php
+++ b/tests/dbal/migrator_test.php
@@ -17,16 +17,26 @@ require_once dirname(__FILE__) . '/migration/if.php';
require_once dirname(__FILE__) . '/migration/recall.php';
require_once dirname(__FILE__) . '/migration/revert.php';
require_once dirname(__FILE__) . '/migration/revert_with_dependency.php';
+require_once dirname(__FILE__) . '/migration/revert_table.php';
+require_once dirname(__FILE__) . '/migration/revert_table_with_dependency.php';
require_once dirname(__FILE__) . '/migration/fail.php';
require_once dirname(__FILE__) . '/migration/installed.php';
require_once dirname(__FILE__) . '/migration/schema.php';
class phpbb_dbal_migrator_test extends phpbb_database_test_case
{
+ /** @var \phpbb\db\driver\driver_interface */
protected $db;
+
+ /** @var \phpbb\db\tools\tools_interface */
protected $db_tools;
+
+ /** @var \phpbb\db\migrator */
protected $migrator;
+ /** @var \phpbb\config\config */
+ protected $config;
+
public function getDataSet()
{
return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/migrator.xml');
@@ -241,6 +251,41 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case
$this->assertEquals(1, $migrator_test_revert_counter, 'Revert did call custom function again');
}
+ public function test_revert_table()
+ {
+ // Make sure there are no other migrations in the db, this could cause issues
+ $this->db->sql_query("DELETE FROM phpbb_migrations");
+ $this->migrator->load_migration_state();
+
+ $this->migrator->set_migrations(array('phpbb_dbal_migration_revert_table', 'phpbb_dbal_migration_revert_table_with_dependency'));
+
+ $this->assertFalse($this->migrator->migration_state('phpbb_dbal_migration_revert_table'));
+ $this->assertFalse($this->migrator->migration_state('phpbb_dbal_migration_revert_table_with_dependency'));
+
+ // Install the migration first
+ while (!$this->migrator->finished())
+ {
+ $this->migrator->update();
+ }
+
+ $this->assertTrue($this->migrator->migration_state('phpbb_dbal_migration_revert_table') !== false);
+ $this->assertTrue($this->migrator->migration_state('phpbb_dbal_migration_revert_table_with_dependency') !== false);
+
+ $this->assertTrue($this->db_tools->sql_column_exists('phpbb_foobar', 'baz_column'));
+ $this->assertFalse($this->db_tools->sql_column_exists('phpbb_foobar', 'bar_column'));
+
+ // Revert migrations
+ while ($this->migrator->migration_state('phpbb_dbal_migration_revert_table') !== false)
+ {
+ $this->migrator->revert('phpbb_dbal_migration_revert_table');
+ }
+
+ $this->assertFalse($this->migrator->migration_state('phpbb_dbal_migration_revert_table'));
+ $this->assertFalse($this->migrator->migration_state('phpbb_dbal_migration_revert_table_with_dependency'));
+
+ $this->assertFalse($this->db_tools->sql_table_exists('phpbb_foobar'));
+ }
+
public function test_fail()
{
$this->migrator->set_migrations(array('phpbb_dbal_migration_fail'));
diff --git a/tests/functions/make_clickable_email_test.php b/tests/functions/make_clickable_email_test.php
index f32b4339a8..d481bde80d 100644
--- a/tests/functions/make_clickable_email_test.php
+++ b/tests/functions/make_clickable_email_test.php
@@ -17,9 +17,10 @@ class phpbb_functions_make_clickable_email_test extends phpbb_test_case
{
parent::setUp();
- global $config, $user, $request;
+ global $config, $user, $request, $symfony_request;
$user = new phpbb_mock_user();
$request = new phpbb_mock_request();
+ $symfony_request = new \phpbb\symfony_request($request);
}
/**
@@ -168,7 +169,7 @@ class phpbb_functions_make_clickable_email_test extends phpbb_test_case
array('abc,def@example.com'), // invalid character ,
array('abc<def@example.com'), // invalid character <
array('abc>def@example.com', 'abc><!-- e --><a href="mailto:def@example.com">def@example.com</a><!-- e -->'), // invalid character >
-
+
// http://fightingforalostcause.net/misc/2006/compare-email-regex.php
array('missingDomain@.com'),
array('@missingLocal.org'),
diff --git a/tests/functions/make_clickable_test.php b/tests/functions/make_clickable_test.php
index 48fc2c19fb..a351a6d527 100644
--- a/tests/functions/make_clickable_test.php
+++ b/tests/functions/make_clickable_test.php
@@ -146,9 +146,10 @@ class phpbb_functions_make_clickable_test extends phpbb_test_case
{
parent::setUp();
- global $config, $user, $request;
+ global $config, $user, $request, $symfony_request;
$user = new phpbb_mock_user();
$request = new phpbb_mock_request();
+ $symfony_request = new \phpbb\symfony_request($request);
}
/**
diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php
index eb56049515..c9943c4302 100644
--- a/tests/test_framework/phpbb_functional_test_case.php
+++ b/tests/test_framework/phpbb_functional_test_case.php
@@ -572,6 +572,9 @@ class phpbb_functional_test_case extends phpbb_test_case
$config['rand_seed'] = '';
$config['rand_seed_last_update'] = time() + 600;
+ // Prevent new user to have an invalid style
+ $config['default_style'] = 1;
+
// Required by user_add
global $db, $cache, $phpbb_dispatcher, $phpbb_container;
$db = $this->get_db();
diff --git a/tests/text_formatter/s9e/factory_test.php b/tests/text_formatter/s9e/factory_test.php
index 82b1b0043b..fd9b4e4c09 100644
--- a/tests/text_formatter/s9e/factory_test.php
+++ b/tests/text_formatter/s9e/factory_test.php
@@ -34,7 +34,7 @@ class phpbb_textformatter_s9e_factory_test extends phpbb_database_test_case
public function get_factory($styles_path = null)
{
- global $config, $phpbb_root_path, $request, $user;
+ global $config, $phpbb_root_path, $request, $symfony_request, $user;
if (!isset($styles_path))
{
@@ -69,6 +69,7 @@ class phpbb_textformatter_s9e_factory_test extends phpbb_database_test_case
'server_protocol' => 'http://',
));
$request = new phpbb_mock_request;
+ $symfony_request = new \phpbb\symfony_request($request);
$user = new phpbb_mock_user;
return $factory;
@@ -152,7 +153,7 @@ class phpbb_textformatter_s9e_factory_test extends phpbb_database_test_case
public function test_local_url()
{
- global $config, $user, $request;
+ global $config, $user, $request, $symfony_request;
$config = new \phpbb\config\config(array(
'force_server_vars' => true,
'server_protocol' => 'http://',
@@ -163,6 +164,7 @@ class phpbb_textformatter_s9e_factory_test extends phpbb_database_test_case
));
$user = new phpbb_mock_user;
$request = new phpbb_mock_request;
+ $symfony_request = new \phpbb\symfony_request($request);
$fixture = __DIR__ . '/fixtures/local_url.xml';
$renderer = $this->get_test_case_helpers()->set_s9e_services(null, $fixture)->get('text_formatter.renderer');