aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.github/PULL_REQUEST_TEMPLATE.md6
-rw-r--r--phpBB/adm/style/acp_ext_list.html2
-rw-r--r--phpBB/adm/style/acp_groups.html2
-rw-r--r--phpBB/adm/style/acp_language.html2
-rw-r--r--phpBB/adm/style/acp_styles.html4
-rw-r--r--phpBB/adm/style/admin.css11
-rw-r--r--phpBB/adm/style/permission_mask.html2
-rw-r--r--phpBB/adm/style/tooltip.js15
-rw-r--r--phpBB/assets/javascript/core.js4
-rw-r--r--phpBB/composer.json2
-rw-r--r--phpBB/config/default/container/services_text_formatter.yml1
-rw-r--r--phpBB/includes/acp/acp_groups.php3
-rw-r--r--phpBB/includes/acp/acp_styles.php1
-rw-r--r--phpBB/includes/functions_messenger.php3
-rw-r--r--phpBB/language/en/acp/board.php2
-rw-r--r--phpBB/language/en/acp/common.php1
-rw-r--r--phpBB/language/en/acp/styles.php1
-rw-r--r--phpBB/language/en/install.php1
-rw-r--r--phpBB/phpbb/auth/provider/oauth/oauth.php16
-rw-r--r--phpBB/phpbb/avatar/driver/upload.php3
-rw-r--r--phpBB/phpbb/db/migration/data/v32x/merge_duplicate_bbcodes.php33
-rw-r--r--phpBB/phpbb/textformatter/s9e/bbcode_merger.php3
-rw-r--r--phpBB/phpbb/textformatter/s9e/factory.php43
-rw-r--r--phpBB/styles/prosilver/template/viewtopic_topic_tools.html2
-rw-r--r--phpBB/viewtopic.php1
-rw-r--r--tests/test_framework/phpbb_test_case_helpers.php7
-rw-r--r--tests/text_formatter/s9e/factory_test.php18
-rw-r--r--tests/text_formatter/s9e/fixtures/malformed_bbcode.xml28
28 files changed, 172 insertions, 45 deletions
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index 39eb83e454..cacfcf1118 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -1,9 +1,9 @@
Checklist:
-- [ ] Correct branch: master for new features; 3.2.x, 3.1.x for fixes
+- [ ] Correct branch: master for new features; 3.2.x for fixes
- [ ] Tests pass
-- [ ] Code follows coding guidelines: [master / 3.2.x](https://area51.phpbb.com/docs/master/coding-guidelines.html), [3.1.x](https://area51.phpbb.com/docs/31x/coding-guidelines.html)
-- [ ] Commit follows commit message [format](https://wiki.phpbb.com/Git#Commit_Messages)
+- [ ] Code follows coding guidelines: [master](https://area51.phpbb.com/docs/dev/master/development/coding_guidelines.html) and [3.2.x](https://area51.phpbb.com/docs/dev/3.2.x/development/coding_guidelines.html)
+- [ ] Commit follows commit message [format](https://area51.phpbb.com/docs/dev/3.2.x/development/git.html)
Tracker ticket (set the ticket ID to **your ticket ID**):
diff --git a/phpBB/adm/style/acp_ext_list.html b/phpBB/adm/style/acp_ext_list.html
index 7ab2608e13..8e2c7452a3 100644
--- a/phpBB/adm/style/acp_ext_list.html
+++ b/phpBB/adm/style/acp_ext_list.html
@@ -7,7 +7,7 @@
<p>{L_EXTENSIONS_EXPLAIN}</p>
<fieldset class="quick">
- <span class="small"><a href="https://www.phpbb.com/go/customise/extensions/3.1" target="_blank">{L_BROWSE_EXTENSIONS_DATABASE}</a> &bull; <a href="{U_VERSIONCHECK_FORCE}">{L_VERSIONCHECK_FORCE_UPDATE_ALL}</a> &bull; <a href="javascript:phpbb.toggleDisplay('version_check_settings');">{L_SETTINGS}</a></span>
+ <span class="small"><a href="https://www.phpbb.com/go/customise/extensions/3.2" target="_blank">{L_BROWSE_EXTENSIONS_DATABASE}</a> &bull; <a href="{U_VERSIONCHECK_FORCE}">{L_VERSIONCHECK_FORCE_UPDATE_ALL}</a> &bull; <a href="javascript:phpbb.toggleDisplay('version_check_settings');">{L_SETTINGS}</a></span>
</fieldset>
<form id="version_check_settings" method="post" action="{U_ACTION}" style="display:none">
diff --git a/phpBB/adm/style/acp_groups.html b/phpBB/adm/style/acp_groups.html
index 26d7030531..d0096370d9 100644
--- a/phpBB/adm/style/acp_groups.html
+++ b/phpBB/adm/style/acp_groups.html
@@ -316,7 +316,7 @@
<tbody>
<!-- ELSE -->
<tr>
- <td><strong>{groups.GROUP_NAME}</strong></td>
+ <td><strong<!-- IF groups.GROUP_COLOR --> style="color: #{groups.GROUP_COLOR}"<!-- ENDIF -->>{groups.GROUP_NAME}</strong></td>
<td style="text-align: center;">{groups.TOTAL_MEMBERS}</td>
<td style="text-align: center;">{groups.PENDING_MEMBERS}</td>
<td style="text-align: center;"><a href="{groups.U_EDIT}">{L_SETTINGS}</a></td>
diff --git a/phpBB/adm/style/acp_language.html b/phpBB/adm/style/acp_language.html
index f708eb1508..79fef94207 100644
--- a/phpBB/adm/style/acp_language.html
+++ b/phpBB/adm/style/acp_language.html
@@ -69,7 +69,7 @@
<p>{L_ACP_LANGUAGE_PACKS_EXPLAIN}</p>
<fieldset class="quick">
- <span class="small"><a href="https://www.phpbb.com/go/customise/language-packs/3.1" target="_blank">{L_BROWSE_LANGUAGE_PACKS_DATABASE}</a></span>
+ <span class="small"><a href="https://www.phpbb.com/go/customise/language-packs/3.2" target="_blank">{L_BROWSE_LANGUAGE_PACKS_DATABASE}</a></span>
</fieldset>
<table class="table1 zebra-table">
diff --git a/phpBB/adm/style/acp_styles.html b/phpBB/adm/style/acp_styles.html
index 43c2f96a65..38bec5a1e4 100644
--- a/phpBB/adm/style/acp_styles.html
+++ b/phpBB/adm/style/acp_styles.html
@@ -33,7 +33,7 @@
<!-- IF L_EXPLAIN --><p>{L_EXPLAIN}</p><!-- ENDIF -->
<fieldset class="quick">
- <span class="small"><a href="https://www.phpbb.com/go/customise/styles/3.1" target="_blank">{L_BROWSE_STYLES_DATABASE}</a></span>
+ <span class="small"><a href="https://www.phpbb.com/go/customise/styles/3.2" target="_blank">{L_BROWSE_STYLES_DATABASE}</a></span>
</fieldset>
<form id="acp_styles" method="post" action="{U_ACTION}">
@@ -96,6 +96,7 @@
<thead>
<tr>
<th>{L_STYLE_NAME}</th>
+ <th width="10%" style="white-space: nowrap; text-align: center;">{L_STYLE_PHPBB_VERSION}</th>
<!-- IF not STYLES_LIST_HIDE_COUNT --><th width="10%" style="white-space: nowrap; text-align: center;">{L_STYLE_USED_BY}</th><!-- ENDIF -->
<th width="25%" style="white-space: nowrap; text-align: center;">{L_ACTIONS}</th>
{STYLES_LIST_EXTRA}
@@ -129,6 +130,7 @@
<span class="style-path"><br />{L_STYLE_PATH}{L_COLON} {styles_list.STYLE_PATH_FULL}</span>
<!-- ENDIF -->
</td>
+ <td class="{$ROW_CLASS} users">{styles_list.STYLE_PHPBB_VERSION}</td>
<!-- IF not STYLES_LIST_HIDE_COUNT -->
<td class="{$ROW_CLASS} users">{styles_list.USERS}</td>
<!-- ENDIF -->
diff --git a/phpBB/adm/style/admin.css b/phpBB/adm/style/admin.css
index eafe11ee89..efdd6f1e22 100644
--- a/phpBB/adm/style/admin.css
+++ b/phpBB/adm/style/admin.css
@@ -2459,6 +2459,9 @@ fieldset.permissions .padding {
text-align: left;
}
+.rtl .dropdown li {
+ text-align: right;
+}
.wrap .dropdown li, .dropdown.wrap li {
white-space: normal;
}
@@ -2473,6 +2476,10 @@ fieldset.permissions .padding {
width: 250px;
}
+.rtl .roles-options > .dropdown {
+ right: auto;
+}
+
.roles-options {
-webkit-user-select: none;
-moz-user-select: none;
@@ -2491,6 +2498,10 @@ fieldset.permissions .padding {
background: url('../images/arrow_down.gif') no-repeat 245px .7em;
}
+.rtl .roles-options > span {
+ background: url('../images/arrow_down.gif') no-repeat 7px .7em;
+}
+
.roles-options li {
list-style: none;
}
diff --git a/phpBB/adm/style/permission_mask.html b/phpBB/adm/style/permission_mask.html
index 8b3121bfa0..c556664b8c 100644
--- a/phpBB/adm/style/permission_mask.html
+++ b/phpBB/adm/style/permission_mask.html
@@ -41,7 +41,7 @@
<dt style="width: 20%"><label for="role{p_mask.S_ROW_COUNT}{p_mask.f_mask.S_ROW_COUNT}">{L_ROLE}{L_COLON}</label></dt>
{% if p_mask.f_mask.role_options %}
<dd style="margin-{S_CONTENT_FLOW_BEGIN}{L_COLON} 20%">
- <div class="dropdown-container dropdown-right dropdown-button-control roles-options" data-alt-text="{LA_ROLE_DESCRIPTION}">
+ <div class="dropdown-container dropdown-{S_CONTENT_FLOW_END} dropdown-button-control roles-options" data-alt-text="{LA_ROLE_DESCRIPTION}">
<select id="role{p_mask.S_ROW_COUNT}{p_mask.f_mask.S_ROW_COUNT}" name="role[{p_mask.f_mask.UG_ID}][{p_mask.f_mask.FORUM_ID}]">{p_mask.f_mask.S_ROLE_OPTIONS}</select>
<span title="Roles" class="button icon-button tools-icon dropdown-trigger dropdown-select">{L_NO_ROLE_ASSIGNED}</span>
<div class="dropdown hidden">
diff --git a/phpBB/adm/style/tooltip.js b/phpBB/adm/style/tooltip.js
index 8781e2b509..7b7abb11e6 100644
--- a/phpBB/adm/style/tooltip.js
+++ b/phpBB/adm/style/tooltip.js
@@ -130,10 +130,17 @@ phpbb.positionTooltip = function ($element) {
$element = $element.parent();
offset = $element.offset();
- $('#_tooltip_container').css({
- top: offset.top + 30,
- left: offset.left - 205
- });
+ if ($('body').hasClass('rtl')) {
+ $('#_tooltip_container').css({
+ top: offset.top + 30,
+ left: offset.left + 255
+ });
+ } else {
+ $('#_tooltip_container').css({
+ top: offset.top + 30,
+ left: offset.left - 205
+ });
+ }
};
/**
diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js
index 069f9089c2..bd1925baf6 100644
--- a/phpBB/assets/javascript/core.js
+++ b/phpBB/assets/javascript/core.js
@@ -1331,6 +1331,8 @@ phpbb.toggleDropdown = function() {
$this.css({
marginLeft: 0,
left: 0,
+ marginRight: 0,
+ right: 0,
maxWidth: (windowWidth - 4) + 'px'
});
@@ -1654,7 +1656,7 @@ $(function() {
phpbb.registerPageDropdowns();
- $('#color_palette_placeholder').each(function() {
+ $('[data-orientation]').each(function() {
phpbb.registerPalette($(this));
});
diff --git a/phpBB/composer.json b/phpBB/composer.json
index 926fad5188..4f796a9dcb 100644
--- a/phpBB/composer.json
+++ b/phpBB/composer.json
@@ -4,7 +4,7 @@
"type": "project",
"keywords": ["phpbb", "forum"],
"homepage": "https://www.phpbb.com",
- "license": "GPL-2.0",
+ "license": "GPL-2.0-only",
"authors": [
{
"name": "phpBB Limited",
diff --git a/phpBB/config/default/container/services_text_formatter.yml b/phpBB/config/default/container/services_text_formatter.yml
index 74624ea4e4..07087cd4a9 100644
--- a/phpBB/config/default/container/services_text_formatter.yml
+++ b/phpBB/config/default/container/services_text_formatter.yml
@@ -39,6 +39,7 @@ services:
- '@dispatcher'
- '@config'
- '@text_formatter.s9e.link_helper'
+ - '@log'
- '%text_formatter.cache.dir%'
- '%text_formatter.cache.parser.key%'
- '%text_formatter.cache.renderer.key%'
diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php
index 70ae9876f4..0e058213e0 100644
--- a/phpBB/includes/acp/acp_groups.php
+++ b/phpBB/includes/acp/acp_groups.php
@@ -926,7 +926,7 @@ class acp_groups
);
// Get us all the groups
- $sql = 'SELECT g.group_id, g.group_name, g.group_type
+ $sql = 'SELECT g.group_id, g.group_name, g.group_type, g.group_colour
FROM ' . GROUPS_TABLE . ' g
ORDER BY g.group_type ASC, g.group_name';
$result = $db->sql_query($sql);
@@ -985,6 +985,7 @@ class acp_groups
'S_GROUP_SPECIAL' => ($row['group_type'] == GROUP_SPECIAL) ? true : false,
'GROUP_NAME' => $group_name,
+ 'GROUP_COLOR' => $row['group_colour'],
'TOTAL_MEMBERS' => $row['total_members'],
'PENDING_MEMBERS' => $row['pending_members']
));
diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php
index 4c390c5f0e..1bf5a3c6a8 100644
--- a/phpBB/includes/acp/acp_styles.php
+++ b/phpBB/includes/acp/acp_styles.php
@@ -952,6 +952,7 @@ class acp_styles
// Style data
'STYLE_ID' => $style['style_id'],
'STYLE_NAME' => htmlspecialchars($style['style_name']),
+ 'STYLE_PHPBB_VERSION' => $this->read_style_cfg($style['style_path'])['phpbb_version'],
'STYLE_PATH' => htmlspecialchars($style['style_path']),
'STYLE_COPYRIGHT' => strip_tags($style['style_copyright']),
'STYLE_ACTIVE' => $style['style_active'],
diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php
index b866e108c0..a85a3b67c5 100644
--- a/phpBB/includes/functions_messenger.php
+++ b/phpBB/includes/functions_messenger.php
@@ -24,8 +24,9 @@ if (!defined('IN_PHPBB'))
*/
class messenger
{
- var $msg, $extra_headers, $replyto, $from, $subject;
+ var $msg, $replyto, $from, $subject;
var $addresses = array();
+ var $extra_headers = array();
var $mail_priority = MAIL_NORMAL_PRIORITY;
var $use_queue = true;
diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php
index 25d70813f6..b050af070a 100644
--- a/phpBB/language/en/acp/board.php
+++ b/phpBB/language/en/acp/board.php
@@ -585,7 +585,7 @@ $lang = array_merge($lang, array(
'SMTP_POP_BEFORE_SMTP' => 'POP-BEFORE-SMTP',
'SMTP_PORT' => 'SMTP server port',
'SMTP_PORT_EXPLAIN' => 'Only change this if you know your SMTP server is on a different port.',
- 'SMTP_SERVER' => 'SMTP server address',
+ 'SMTP_SERVER' => 'SMTP server address and protocol',
'SMTP_SERVER_EXPLAIN' => 'Note that you have to provide the protocol that your server uses. If you are using SSL, this has to be "ssl://your.mailserver.com"',
'SMTP_SETTINGS' => 'SMTP settings',
'SMTP_USERNAME' => 'SMTP username',
diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php
index de5039f047..0d5f6fee25 100644
--- a/phpBB/language/en/acp/common.php
+++ b/phpBB/language/en/acp/common.php
@@ -552,6 +552,7 @@ $lang = array_merge($lang, array(
'LOG_BBCODE_ADD' => '<strong>Added new BBCode</strong><br />» %s',
'LOG_BBCODE_EDIT' => '<strong>Edited BBCode</strong><br />» %s',
'LOG_BBCODE_DELETE' => '<strong>Deleted BBCode</strong><br />» %s',
+ 'LOG_BBCODE_CONFIGURATION_ERROR' => '<strong>Error while configuring BBCode</strong>: %1$s<br />» %2$s',
'LOG_BOT_ADDED' => '<strong>New bot added</strong><br />» %s',
'LOG_BOT_DELETE' => '<strong>Deleted bot</strong><br />» %s',
diff --git a/phpBB/language/en/acp/styles.php b/phpBB/language/en/acp/styles.php
index 9293d67ecc..ab85d9d2f5 100644
--- a/phpBB/language/en/acp/styles.php
+++ b/phpBB/language/en/acp/styles.php
@@ -80,6 +80,7 @@ $lang = array_merge($lang, array(
'STYLE_UNINSTALL' => 'Uninstall',
'STYLE_UNINSTALL_DEPENDENT' => 'Style "%s" cannot be uninstalled because it has one or more child styles.',
'STYLE_UNINSTALLED' => 'Style "%s" uninstalled successfully.',
+ 'STYLE_PHPBB_VERSION' => 'phpBB Version',
'STYLE_USED_BY' => 'Used by (including robots)',
'STYLE_VERSION' => 'Style version',
diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php
index aa980a136b..af18339136 100644
--- a/phpBB/language/en/install.php
+++ b/phpBB/language/en/install.php
@@ -193,6 +193,7 @@ $lang = array_merge($lang, array(
'DB_OPTION_SQLITE3' => 'SQLite 3',
// Errors
+ 'INST_ERR_DB' => 'Database installation error',
'INST_ERR_NO_DB' => 'Cannot load the PHP module for the selected database type.',
'INST_ERR_DB_INVALID_PREFIX' => 'The prefix you entered is invalid. It must start with a letter and must only contain letters, numbers and underscores.',
'INST_ERR_PREFIX_TOO_LONG' => 'The table prefix you have specified is too long. The maximum length is %d characters.',
diff --git a/phpBB/phpbb/auth/provider/oauth/oauth.php b/phpBB/phpbb/auth/provider/oauth/oauth.php
index 5587e69d3c..8809a0c6b4 100644
--- a/phpBB/phpbb/auth/provider/oauth/oauth.php
+++ b/phpBB/phpbb/auth/provider/oauth/oauth.php
@@ -227,6 +227,22 @@ class oauth extends \phpbb\auth\provider\base
$row = $this->db->sql_fetchrow($result);
$this->db->sql_freeresult($result);
+ /**
+ * Event is triggered before check if provider is already associated with an account
+ *
+ * @event core.oauth_login_after_check_if_provider_id_has_match
+ * @var array row User row
+ * @var array data Provider data
+ * @var \OAuth\Common\Service\ServiceInterface service OAuth service
+ * @since 3.2.3-RC1
+ */
+ $vars = array(
+ 'row',
+ 'data',
+ 'service',
+ );
+ extract($this->dispatcher->trigger_event('core.oauth_login_after_check_if_provider_id_has_match', compact($vars)));
+
if (!$row)
{
// The user does not yet exist, ask to link or create profile
diff --git a/phpBB/phpbb/avatar/driver/upload.php b/phpBB/phpbb/avatar/driver/upload.php
index d765a27871..77b44754ac 100644
--- a/phpBB/phpbb/avatar/driver/upload.php
+++ b/phpBB/phpbb/avatar/driver/upload.php
@@ -203,15 +203,18 @@ class upload extends \phpbb\avatar\driver\driver
*
* @event core.avatar_driver_upload_move_file_before
* @var array filedata Array containing uploaded file data
+ * @var \phpbb\files\filespec file Instance of filespec class
* @var string destination Destination directory where the file is going to be moved
* @var string prefix Prefix for the avatar filename
* @var array row Array with avatar row data
* @var array error Array of errors, if filled in by this event file will not be moved
* @since 3.1.6-RC1
* @changed 3.1.9-RC1 Added filedata
+ * @changed 3.2.3-RC1 Added file
*/
$vars = array(
'filedata',
+ 'file',
'destination',
'prefix',
'row',
diff --git a/phpBB/phpbb/db/migration/data/v32x/merge_duplicate_bbcodes.php b/phpBB/phpbb/db/migration/data/v32x/merge_duplicate_bbcodes.php
index 08609b571b..71ee19e3dd 100644
--- a/phpBB/phpbb/db/migration/data/v32x/merge_duplicate_bbcodes.php
+++ b/phpBB/phpbb/db/migration/data/v32x/merge_duplicate_bbcodes.php
@@ -46,16 +46,25 @@ class merge_duplicate_bbcodes extends \phpbb\db\migration\container_aware_migrat
protected function merge_bbcodes(array $without, array $with)
{
- $merged = $this->container->get('text_formatter.s9e.bbcode_merger')->merge_bbcodes(
- [
- 'usage' => $without['bbcode_match'],
- 'template' => $without['bbcode_tpl']
- ],
- [
- 'usage' => $with['bbcode_match'],
- 'template' => $with['bbcode_tpl']
- ]
- );
+ try
+ {
+ $merged = $this->container->get('text_formatter.s9e.bbcode_merger')->merge_bbcodes(
+ [
+ 'usage' => $without['bbcode_match'],
+ 'template' => $without['bbcode_tpl']
+ ],
+ [
+ 'usage' => $with['bbcode_match'],
+ 'template' => $with['bbcode_tpl']
+ ]
+ );
+ }
+ catch (\Exception $e)
+ {
+ // Ignore the pair and move on. The BBCodes would have to be fixed manually
+ return;
+ }
+
$bbcode_data = [
'bbcode_tag' => $without['bbcode_tag'],
'bbcode_helpline' => $without['bbcode_helpline'] . ' | ' . $with['bbcode_helpline'],
@@ -65,11 +74,11 @@ class merge_duplicate_bbcodes extends \phpbb\db\migration\container_aware_migrat
$sql = 'UPDATE ' . BBCODES_TABLE . '
SET ' . $this->db->sql_build_array('UPDATE', $bbcode_data) . '
- WHERE bbcode_id = ' . $without['bbcode_id'];
+ WHERE bbcode_id = ' . (int) $without['bbcode_id'];
$this->sql_query($sql);
$sql = 'DELETE FROM ' . BBCODES_TABLE . '
- WHERE bbcode_id = ' . $with['bbcode_id'];
+ WHERE bbcode_id = ' . (int) $with['bbcode_id'];
$this->sql_query($sql);
}
}
diff --git a/phpBB/phpbb/textformatter/s9e/bbcode_merger.php b/phpBB/phpbb/textformatter/s9e/bbcode_merger.php
index 72b1473751..a05ca3c2b8 100644
--- a/phpBB/phpbb/textformatter/s9e/bbcode_merger.php
+++ b/phpBB/phpbb/textformatter/s9e/bbcode_merger.php
@@ -37,6 +37,9 @@ class bbcode_merger
*
* All of the arrays contain a "usage" element and a "template" element
*
+ * @throws InvalidArgumentException if a definition cannot be interpreted
+ * @throws RuntimeException if something unexpected occurs
+ *
* @param array $without BBCode definition without an attribute
* @param array $with BBCode definition with an attribute
* @return array Merged definition
diff --git a/phpBB/phpbb/textformatter/s9e/factory.php b/phpBB/phpbb/textformatter/s9e/factory.php
index 1e85856898..c0bbc7b0e8 100644
--- a/phpBB/phpbb/textformatter/s9e/factory.php
+++ b/phpBB/phpbb/textformatter/s9e/factory.php
@@ -132,6 +132,11 @@ class factory implements \phpbb\textformatter\cache_interface
protected $dispatcher;
/**
+ * @var \phpbb\log\log_interface
+ */
+ protected $log;
+
+ /**
* Constructor
*
* @param \phpbb\textformatter\data_access $data_access
@@ -139,11 +144,12 @@ class factory implements \phpbb\textformatter\cache_interface
* @param \phpbb\event\dispatcher_interface $dispatcher
* @param \phpbb\config\config $config
* @param \phpbb\textformatter\s9e\link_helper $link_helper
+ * @param \phpbb\log\log_interface $log
* @param string $cache_dir Path to the cache dir
* @param string $cache_key_parser Cache key used for the parser
* @param string $cache_key_renderer Cache key used for the renderer
*/
- public function __construct(\phpbb\textformatter\data_access $data_access, \phpbb\cache\driver\driver_interface $cache, \phpbb\event\dispatcher_interface $dispatcher, \phpbb\config\config $config, \phpbb\textformatter\s9e\link_helper $link_helper, $cache_dir, $cache_key_parser, $cache_key_renderer)
+ public function __construct(\phpbb\textformatter\data_access $data_access, \phpbb\cache\driver\driver_interface $cache, \phpbb\event\dispatcher_interface $dispatcher, \phpbb\config\config $config, \phpbb\textformatter\s9e\link_helper $link_helper, \phpbb\log\log_interface $log, $cache_dir, $cache_key_parser, $cache_key_renderer)
{
$this->link_helper = $link_helper;
$this->cache = $cache;
@@ -153,6 +159,7 @@ class factory implements \phpbb\textformatter\cache_interface
$this->config = $config;
$this->data_access = $data_access;
$this->dispatcher = $dispatcher;
+ $this->log = $log;
}
/**
@@ -272,7 +279,7 @@ class factory implements \phpbb\textformatter\cache_interface
// Add default BBCodes
foreach ($this->get_default_bbcodes($configurator) as $bbcode)
{
- $configurator->BBCodes->addCustom($bbcode['usage'], new UnsafeTemplate($bbcode['template']));
+ $this->add_bbcode($configurator, $bbcode['usage'], $bbcode['template']);
}
if (isset($configurator->tags['QUOTE']))
{
@@ -299,17 +306,7 @@ class factory implements \phpbb\textformatter\cache_interface
},
$row['bbcode_tpl']
);
-
- try
- {
- $configurator->BBCodes->addCustom($row['bbcode_match'], new UnsafeTemplate($tpl));
- }
- catch (\Exception $e)
- {
- /**
- * @todo log an error?
- */
- }
+ $this->add_bbcode($configurator, $row['bbcode_match'], $tpl);
}
// Load smilies
@@ -419,6 +416,26 @@ class factory implements \phpbb\textformatter\cache_interface
}
/**
+ * Add a BBCode to given configurator
+ *
+ * @param Configurator $configurator
+ * @param string $usage
+ * @param string $template
+ * @return void
+ */
+ protected function add_bbcode(Configurator $configurator, $usage, $template)
+ {
+ try
+ {
+ $configurator->BBCodes->addCustom($usage, new UnsafeTemplate($template));
+ }
+ catch (\Exception $e)
+ {
+ $this->log->add('critical', null, null, 'LOG_BBCODE_CONFIGURATION_ERROR', false, [$usage, $e->getMessage()]);
+ }
+ }
+
+ /**
* Configure the Autolink / Autoemail plugins used to linkify text
*
* @param \s9e\TextFormatter\Configurator $configurator
diff --git a/phpBB/styles/prosilver/template/viewtopic_topic_tools.html b/phpBB/styles/prosilver/template/viewtopic_topic_tools.html
index 397c807bb3..272a434f6a 100644
--- a/phpBB/styles/prosilver/template/viewtopic_topic_tools.html
+++ b/phpBB/styles/prosilver/template/viewtopic_topic_tools.html
@@ -11,7 +11,7 @@
<!-- IF U_WATCH_TOPIC -->
<li>
<a href="{U_WATCH_TOPIC}" class="watch-topic-link" title="{S_WATCH_TOPIC_TITLE}" data-ajax="toggle_link" data-toggle-class="icon <!-- IF S_WATCHING_TOPIC -->fa-check-square-o<!-- ELSE -->fa-square-o<!-- ENDIF --> fa-fw" data-toggle-text="{S_WATCH_TOPIC_TOGGLE}" data-toggle-url="{U_WATCH_TOPIC_TOGGLE}" data-update-all=".watch-topic-link">
- <i class="icon <!-- IF S_WATCHING_FORUM -->fa-square-o<!-- ELSE -->fa-check-square-o<!-- ENDIF --> fa-fw" aria-hidden="true"></i><span>{S_WATCH_TOPIC_TITLE}</span>
+ <i class="icon <!-- IF S_WATCHING_TOPIC -->fa-square-o<!-- ELSE -->fa-check-square-o<!-- ENDIF --> fa-fw" aria-hidden="true"></i><span>{S_WATCH_TOPIC_TITLE}</span>
</a>
</li>
<!-- ENDIF -->
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index 38eba32374..155dca7788 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -1994,6 +1994,7 @@ for ($i = 0, $end = count($post_list); $i < $end; ++$i)
'S_FIRST_UNREAD' => $s_first_unread,
'S_CUSTOM_FIELDS' => (isset($cp_row['row']) && count($cp_row['row'])) ? true : false,
'S_TOPIC_POSTER' => ($topic_data['topic_poster'] == $poster_id) ? true : false,
+ 'S_FIRST_POST' => ($topic_data['topic_first_post_id'] == $row['post_id']) ? true : false,
'S_IGNORE_POST' => ($row['foe']) ? true : false,
'L_IGNORE_POST' => ($row['foe']) ? sprintf($user->lang['POST_BY_FOE'], get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username'])) : '',
diff --git a/tests/test_framework/phpbb_test_case_helpers.php b/tests/test_framework/phpbb_test_case_helpers.php
index 7fb9a740b8..c792976b1e 100644
--- a/tests/test_framework/phpbb_test_case_helpers.php
+++ b/tests/test_framework/phpbb_test_case_helpers.php
@@ -385,7 +385,7 @@ class phpbb_test_case_helpers
$mb = $this->test_case->getMockBuilder('phpbb\\textformatter\\data_access');
$mb->setMethods(array('get_bbcodes', 'get_censored_words', 'get_smilies', 'get_styles'));
$mb->setConstructorArgs(array(
- $this->test_case->getMock('phpbb\\db\\driver\\driver'),
+ $this->test_case->getMockBuilder('phpbb\\db\\driver\\driver')->getMock(),
'phpbb_bbcodes',
'phpbb_smilies',
'phpbb_styles',
@@ -489,8 +489,11 @@ class phpbb_test_case_helpers
$request = new phpbb_mock_request;
}
+ // Get a log interface
+ $log = ($container->has('log')) ? $container->get('log') : $this->test_case->getMockBuilder('phpbb\\log\\log_interface')->getMock();
+
// Create and register the text_formatter.s9e.factory service
- $factory = new \phpbb\textformatter\s9e\factory($dal, $cache, $dispatcher, $config, new \phpbb\textformatter\s9e\link_helper, $cache_dir, $cache_key_parser, $cache_key_renderer);
+ $factory = new \phpbb\textformatter\s9e\factory($dal, $cache, $dispatcher, $config, new \phpbb\textformatter\s9e\link_helper, $log, $cache_dir, $cache_key_parser, $cache_key_renderer);
$container->set('text_formatter.s9e.factory', $factory);
// Create a user if none was provided, and add the common lang strings
diff --git a/tests/text_formatter/s9e/factory_test.php b/tests/text_formatter/s9e/factory_test.php
index d35330a975..0d780a19a9 100644
--- a/tests/text_formatter/s9e/factory_test.php
+++ b/tests/text_formatter/s9e/factory_test.php
@@ -56,6 +56,7 @@ class phpbb_textformatter_s9e_factory_test extends phpbb_database_test_case
$this->dispatcher,
new \phpbb\config\config(array('allowed_schemes_links' => 'http,https,ftp')),
new \phpbb\textformatter\s9e\link_helper,
+ $this->getMockBuilder('phpbb\\log\\log_interface')->getMock(),
$this->get_cache_dir(),
'_foo_parser',
'_foo_renderer'
@@ -264,6 +265,23 @@ class phpbb_textformatter_s9e_factory_test extends phpbb_database_test_case
}
/**
+ * @testdox Logs malformed BBCodes
+ */
+ public function test_malformed_bbcodes()
+ {
+ $log = $this->getMockBuilder('phpbb\\log\\log_interface')->getMock();
+ $log->expects($this->once())
+ ->method('add')
+ ->with('critical', null, null, 'LOG_BBCODE_CONFIGURATION_ERROR', false, ['[x !x]{TEXT}[/x]', 'Cannot interpret the BBCode definition']);
+
+ $container = new phpbb_mock_container_builder;
+ $container->set('log', $log);
+
+ $fixture = __DIR__ . '/fixtures/malformed_bbcode.xml';
+ $this->get_test_case_helpers()->set_s9e_services($container, $fixture);
+ }
+
+ /**
* @testdox get_configurator() triggers events before and after configuration
*/
public function test_configure_events()
diff --git a/tests/text_formatter/s9e/fixtures/malformed_bbcode.xml b/tests/text_formatter/s9e/fixtures/malformed_bbcode.xml
new file mode 100644
index 0000000000..7e7aa1a39c
--- /dev/null
+++ b/tests/text_formatter/s9e/fixtures/malformed_bbcode.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<dataset>
+ <table name="phpbb_bbcodes">
+ <column>bbcode_id</column>
+ <column>bbcode_tag</column>
+ <column>bbcode_helpline</column>
+ <column>display_on_posting</column>
+ <column>bbcode_match</column>
+ <column>bbcode_tpl</column>
+ <column>first_pass_match</column>
+ <column>first_pass_replace</column>
+ <column>second_pass_match</column>
+ <column>second_pass_replace</column>
+
+ <row>
+ <value>13</value>
+ <value>x</value>
+ <value></value>
+ <value>1</value>
+ <value>[x !x]{TEXT}[/x]</value>
+ <value>...</value>
+ <value/>
+ <value/>
+ <value/>
+ <value/>
+ </row>
+ </table>
+</dataset>