aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.travis.yml1
-rw-r--r--phpBB/composer.json2
-rw-r--r--phpBB/composer.lock67
-rw-r--r--phpBB/includes/acp/acp_attachments.php6
-rw-r--r--phpBB/includes/acp/acp_update.php16
-rw-r--r--phpBB/includes/ucp/ucp_attachments.php30
-rw-r--r--phpBB/language/en/ucp.php1
-rw-r--r--phpBB/phpbb/textformatter/s9e/bbcode_merger.php6
-rw-r--r--phpBB/styles/prosilver/template/ucp_agreement.html2
-rw-r--r--phpBB/styles/prosilver/template/ucp_attachments.html2
-rw-r--r--tests/text_processing/tickets_data/PHPBB3-16053.html1
-rw-r--r--tests/text_processing/tickets_data/PHPBB3-16053.txt1
-rw-r--r--tests/text_processing/tickets_data/PHPBB3-16053.xml28
-rwxr-xr-xvagrant/after.sh23
-rw-r--r--vagrant/bootstrap.yaml6
15 files changed, 135 insertions, 57 deletions
diff --git a/.travis.yml b/.travis.yml
index a33cc03aea..e3eab8ba6e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,4 +1,5 @@
language: php
+dist: trusty
matrix:
include:
diff --git a/phpBB/composer.json b/phpBB/composer.json
index f42b6f268d..caedd8226e 100644
--- a/phpBB/composer.json
+++ b/phpBB/composer.json
@@ -34,7 +34,7 @@
"marc1706/fast-image-size": "^1.1",
"paragonie/random_compat": "^1.4",
"patchwork/utf8": "^1.1",
- "s9e/text-formatter": "^1.3",
+ "s9e/text-formatter": "^2.0",
"symfony/config": "~3.4",
"symfony/console": "~3.4",
"symfony/debug": "~3.4",
diff --git a/phpBB/composer.lock b/phpBB/composer.lock
index 1759288199..b0d579132d 100644
--- a/phpBB/composer.lock
+++ b/phpBB/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "c098125fbe2261605adf47a875fe439b",
+ "content-hash": "437a262e2dc4d5d92873b9fd7fec3427",
"packages": [
{
"name": "bantu/ini-get-wrapper",
@@ -331,7 +331,7 @@
"oauth",
"security"
],
- "time": "2016-07-12T22:15:00+00:00"
+ "time": "2018-02-14T22:37:14+00:00"
},
{
"name": "marc1706/fast-image-size",
@@ -550,7 +550,7 @@
"pseudorandom",
"random"
],
- "time": "2017-03-13T16:22:52+00:00"
+ "time": "2018-04-04T21:48:54+00:00"
},
{
"name": "patchwork/utf8",
@@ -798,29 +798,67 @@
"time": "2016-02-11T07:05:27+00:00"
},
{
- "name": "s9e/text-formatter",
+ "name": "s9e/regexp-builder",
"version": "1.4.3",
"source": {
"type": "git",
+ "url": "https://github.com/s9e/RegexpBuilder.git",
+ "reference": "59d0167a909659d718f53964f7653d2c83a5f8fe"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/s9e/RegexpBuilder/zipball/59d0167a909659d718f53964f7653d2c83a5f8fe",
+ "reference": "59d0167a909659d718f53964f7653d2c83a5f8fe",
+ "shasum": ""
+ },
+ "require": {
+ "lib-pcre": ">=7.2",
+ "php": ">=5.5.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "<5.8"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "s9e\\RegexpBuilder\\": "src"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "description": "Single-purpose library that generates regular expressions that match a list of strings.",
+ "homepage": "https://github.com/s9e/RegexpBuilder/",
+ "keywords": [
+ "regexp"
+ ],
+ "time": "2019-04-26T17:55:23+00:00"
+ },
+ {
+ "name": "s9e/text-formatter",
+ "version": "2.0.0",
+ "source": {
+ "type": "git",
"url": "https://github.com/s9e/TextFormatter.git",
- "reference": "76138c98161b2a063ecb28f5a46f9212a04aad1a"
+ "reference": "f15541ce19e9af7eeb48b8b91b3ee93bec5f2f9b"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/s9e/TextFormatter/zipball/76138c98161b2a063ecb28f5a46f9212a04aad1a",
- "reference": "76138c98161b2a063ecb28f5a46f9212a04aad1a",
+ "url": "https://api.github.com/repos/s9e/TextFormatter/zipball/f15541ce19e9af7eeb48b8b91b3ee93bec5f2f9b",
+ "reference": "f15541ce19e9af7eeb48b8b91b3ee93bec5f2f9b",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-filter": "*",
- "lib-pcre": ">=7.2",
- "php": ">=5.4.7"
+ "lib-pcre": ">=8.13",
+ "php": ">=7.1",
+ "s9e/regexp-builder": "^1.4"
},
"require-dev": {
"matthiasmullie/minify": "*",
- "php-coveralls/php-coveralls": "*",
- "s9e/regexp-builder": "1.*"
+ "phpunit/phpunit": "^7"
},
"suggest": {
"ext-curl": "Improves the performance of the MediaEmbed plugin and some JavaScript minifiers",
@@ -832,6 +870,9 @@
"ext-zlib": "Enables gzip compression when scraping content via the MediaEmbed plugin"
},
"type": "library",
+ "extra": {
+ "version": "2.0.0"
+ },
"autoload": {
"psr-4": {
"s9e\\TextFormatter\\": "src"
@@ -860,7 +901,7 @@
"parser",
"shortcodes"
],
- "time": "2019-04-26T12:32:18+00:00"
+ "time": "2019-05-31T17:56:58+00:00"
},
{
"name": "symfony/config",
@@ -1475,7 +1516,7 @@
},
{
"name": "Gert de Pagter",
- "email": "BackEndTea@gmail.com"
+ "email": "backendtea@gmail.com"
}
],
"description": "Symfony polyfill for ctype functions",
diff --git a/phpBB/includes/acp/acp_attachments.php b/phpBB/includes/acp/acp_attachments.php
index 5557ecc835..274aa97122 100644
--- a/phpBB/includes/acp/acp_attachments.php
+++ b/phpBB/includes/acp/acp_attachments.php
@@ -1239,13 +1239,17 @@ class acp_attachments
$display_cat = isset($extensions[$row['extension']]['display_cat']) ? $extensions[$row['extension']]['display_cat'] : ATTACHMENT_CATEGORY_NONE;
$l_downloaded_viewed = ($display_cat == ATTACHMENT_CATEGORY_NONE) ? 'DOWNLOAD_COUNTS' : 'VIEWED_COUNTS';
+ // Capitalises the group name and checks if its key exists in the language file
+ $up_group_name = utf8_strtoupper($extensions[$row['extension']]['group_name']);
+ $ext_group_name = (!empty($up_group_name)) ? (isset($user->lang['EXT_GROUP_' . $up_group_name]) ? $user->lang['EXT_GROUP_' . $up_group_name] : '') : '';
+
$template->assign_block_vars('attachments', array(
'ATTACHMENT_POSTER' => get_username_string('full', (int) $row['poster_id'], (string) $row['username'], (string) $row['user_colour'], (string) $row['username']),
'FILESIZE' => get_formatted_filesize((int) $row['filesize']),
'FILETIME' => $user->format_date((int) $row['filetime']),
'REAL_FILENAME' => (!$row['in_message']) ? utf8_basename((string) $row['real_filename']) : '',
'PHYSICAL_FILENAME' => utf8_basename((string) $row['physical_filename']),
- 'EXT_GROUP_NAME' => (!empty($extensions[$row['extension']]['group_name'])) ? $user->lang['EXT_GROUP_' . $extensions[$row['extension']]['group_name']] : '',
+ 'EXT_GROUP_NAME' => $ext_group_name,
'COMMENT' => $comment,
'TOPIC_TITLE' => (!$row['in_message']) ? (string) $row['topic_title'] : '',
'ATTACH_ID' => (int) $row['attach_id'],
diff --git a/phpBB/includes/acp/acp_update.php b/phpBB/includes/acp/acp_update.php
index 9124a59ef2..fa3afa6ce3 100644
--- a/phpBB/includes/acp/acp_update.php
+++ b/phpBB/includes/acp/acp_update.php
@@ -59,17 +59,19 @@ class acp_update
$update_link = $phpbb_root_path . 'install/app.' . $phpEx;
- $template->assign_vars(array(
- 'S_UP_TO_DATE' => empty($updates_available),
- 'U_ACTION' => $this->u_action,
- 'U_VERSIONCHECK_FORCE' => append_sid($this->u_action . '&amp;versioncheck_force=1'),
+ $template_ary = [
+ 'S_UP_TO_DATE' => empty($updates_available),
+ 'U_ACTION' => $this->u_action,
+ 'U_VERSIONCHECK_FORCE' => append_sid($this->u_action . '&amp;versioncheck_force=1'),
- 'CURRENT_VERSION' => $config['version'],
+ 'CURRENT_VERSION' => $config['version'],
- 'UPDATE_INSTRUCTIONS' => sprintf($user->lang['UPDATE_INSTRUCTIONS'], $update_link),
+ 'UPDATE_INSTRUCTIONS' => $user->lang('UPDATE_INSTRUCTIONS', $update_link),
'S_VERSION_UPGRADEABLE' => !empty($upgrades_available),
'UPGRADE_INSTRUCTIONS' => !empty($upgrades_available) ? $user->lang('UPGRADE_INSTRUCTIONS', $upgrades_available['current'], $upgrades_available['announcement']) : false,
- ));
+ ];
+
+ $template->assign_vars($template_ary);
// Incomplete update?
if (phpbb_version_compare($config['version'], PHPBB_VERSION, '<'))
diff --git a/phpBB/includes/ucp/ucp_attachments.php b/phpBB/includes/ucp/ucp_attachments.php
index c1b623cd71..7808fed325 100644
--- a/phpBB/includes/ucp/ucp_attachments.php
+++ b/phpBB/includes/ucp/ucp_attachments.php
@@ -29,7 +29,7 @@ class ucp_attachments
function main($id, $mode)
{
- global $template, $user, $db, $config, $phpEx, $phpbb_root_path, $phpbb_container, $request;
+ global $template, $user, $db, $config, $phpEx, $phpbb_root_path, $phpbb_container, $request, $auth;
$start = $request->variable('start', 0);
$sort_key = $request->variable('sk', 'a');
@@ -41,16 +41,27 @@ class ucp_attachments
if ($delete && count($delete_ids))
{
// Validate $delete_ids...
- $sql = 'SELECT attach_id
- FROM ' . ATTACHMENTS_TABLE . '
- WHERE poster_id = ' . $user->data['user_id'] . '
- AND is_orphan = 0
- AND ' . $db->sql_in_set('attach_id', $delete_ids);
+ $sql = 'SELECT a.attach_id, p.post_edit_locked, t.topic_status, f.forum_id, f.forum_status
+ FROM ' . ATTACHMENTS_TABLE . ' a
+ LEFT JOIN ' . POSTS_TABLE . ' p
+ ON (a.post_msg_id = p.post_id AND a.in_message = 0)
+ LEFT JOIN ' . TOPICS_TABLE . ' t
+ ON (t.topic_id = p.topic_id AND a.in_message = 0)
+ LEFT JOIN ' . FORUMS_TABLE . ' f
+ ON (f.forum_id = t.forum_id AND a.in_message = 0)
+ WHERE a.poster_id = ' . $user->data['user_id'] . '
+ AND a.is_orphan = 0
+ AND ' . $db->sql_in_set('a.attach_id', $delete_ids);
$result = $db->sql_query($sql);
$delete_ids = array();
while ($row = $db->sql_fetchrow($result))
{
+ if (!$auth->acl_get('m_edit', $row['forum_id']) && ($row['forum_status'] == ITEM_LOCKED || $row['topic_status'] == ITEM_LOCKED || $row['post_edit_locked']))
+ {
+ continue;
+ }
+
$delete_ids[] = $row['attach_id'];
}
$db->sql_freeresult($result);
@@ -124,10 +135,12 @@ class ucp_attachments
$pagination = $phpbb_container->get('pagination');
$start = $pagination->validate_start($start, $config['topics_per_page'], $num_attachments);
- $sql = 'SELECT a.*, t.topic_title, p.message_subject as message_title
+ $sql = 'SELECT a.*, t.topic_title, pr.message_subject as message_title, p.post_edit_locked, t.topic_status, f.forum_id, f.forum_status
FROM ' . ATTACHMENTS_TABLE . ' a
+ LEFT JOIN ' . POSTS_TABLE . ' p ON (a.post_msg_id = p.post_id AND a.in_message = 0)
LEFT JOIN ' . TOPICS_TABLE . ' t ON (a.topic_id = t.topic_id AND a.in_message = 0)
- LEFT JOIN ' . PRIVMSGS_TABLE . ' p ON (a.post_msg_id = p.msg_id AND a.in_message = 1)
+ LEFT JOIN ' . FORUMS_TABLE . ' f ON (f.forum_id = t.forum_id AND a.in_message = 0)
+ LEFT JOIN ' . PRIVMSGS_TABLE . ' pr ON (a.post_msg_id = pr.msg_id AND a.in_message = 1)
WHERE a.poster_id = ' . $user->data['user_id'] . "
AND a.is_orphan = 0
ORDER BY $order_by";
@@ -164,6 +177,7 @@ class ucp_attachments
'TOPIC_ID' => $row['topic_id'],
'S_IN_MESSAGE' => $row['in_message'],
+ 'S_LOCKED' => !$row['in_message'] && !$auth->acl_get('m_edit', $row['forum_id']) && ($row['forum_status'] == ITEM_LOCKED || $row['topic_status'] == ITEM_LOCKED || $row['post_edit_locked']),
'U_VIEW_ATTACHMENT' => append_sid("{$phpbb_root_path}download/file.$phpEx", 'id=' . $row['attach_id']),
'U_VIEW_TOPIC' => $view_topic)
diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php
index 12b0bad182..b82759ae0e 100644
--- a/phpBB/language/en/ucp.php
+++ b/phpBB/language/en/ucp.php
@@ -89,6 +89,7 @@ $lang = array_merge($lang, array(
'ATTACHMENTS_EXPLAIN' => 'This is a list of attachments you have made in posts to this board.',
'ATTACHMENTS_DELETED' => 'Attachments successfully deleted.',
'ATTACHMENT_DELETED' => 'Attachment successfully deleted.',
+ 'ATTACHMENT_LOCKED' => 'This topic is locked, you cannot delete the attachment.',
'AUTOLOGIN_SESSION_KEYS_DELETED'=> 'The selected "Remember Me" login keys were successfully deleted.',
'AVATAR_CATEGORY' => 'Category',
'AVATAR_DRIVER_GRAVATAR_TITLE' => 'Gravatar',
diff --git a/phpBB/phpbb/textformatter/s9e/bbcode_merger.php b/phpBB/phpbb/textformatter/s9e/bbcode_merger.php
index a05ca3c2b8..af644192d8 100644
--- a/phpBB/phpbb/textformatter/s9e/bbcode_merger.php
+++ b/phpBB/phpbb/textformatter/s9e/bbcode_merger.php
@@ -14,7 +14,7 @@
namespace phpbb\textformatter\s9e;
use phpbb\textformatter\s9e\factory;
-use s9e\TextFormatter\Configurator\Helpers\TemplateHelper;
+use s9e\TextFormatter\Configurator\Helpers\TemplateLoader;
use s9e\TextFormatter\Configurator\Items\UnsafeTemplate;
class bbcode_merger
@@ -91,9 +91,9 @@ class bbcode_merger
*/
protected function indent_template($template)
{
- $dom = TemplateHelper::loadTemplate($template);
+ $dom = TemplateLoader::load($template);
$dom->formatOutput = true;
- $template = TemplateHelper::saveTemplate($dom);
+ $template = TemplateLoader::save($dom);
// Remove the first level of indentation if the template starts with whitespace
if (preg_match('(^\\n +)', $template, $m))
diff --git a/phpBB/styles/prosilver/template/ucp_agreement.html b/phpBB/styles/prosilver/template/ucp_agreement.html
index ace65254d7..d4fef9f0a5 100644
--- a/phpBB/styles/prosilver/template/ucp_agreement.html
+++ b/phpBB/styles/prosilver/template/ucp_agreement.html
@@ -62,8 +62,6 @@
<div class="content">
<h2 class="sitename-title">{SITENAME} - {AGREEMENT_TITLE}</h2>
<p>{AGREEMENT_TEXT}</p>
- <hr class="dashed" />
- <p><a href="{U_BACK}" class="button2">{L_BACK}</a></p>
</div>
</div>
</div>
diff --git a/phpBB/styles/prosilver/template/ucp_attachments.html b/phpBB/styles/prosilver/template/ucp_attachments.html
index 696f621116..cfdbf9c7ea 100644
--- a/phpBB/styles/prosilver/template/ucp_attachments.html
+++ b/phpBB/styles/prosilver/template/ucp_attachments.html
@@ -44,7 +44,7 @@
</dt>
<dd class="extra">{attachrow.DOWNLOAD_COUNT}</dd>
<dd class="time"><span>{attachrow.POST_TIME}</span></dd>
- <dd class="mark"><input type="checkbox" name="attachment[{attachrow.ATTACH_ID}]" value="1" /></dd>
+ <dd class="mark"><input type="checkbox" name="attachment[{attachrow.ATTACH_ID}]" value="1"{% if attachrow.S_LOCKED %} disabled title="{{ lang('ATTACHMENT_LOCKED') }}"{% endif %} /></dd>
</dl>
</li>
<!-- END attachrow -->
diff --git a/tests/text_processing/tickets_data/PHPBB3-16053.html b/tests/text_processing/tickets_data/PHPBB3-16053.html
new file mode 100644
index 0000000000..af70ddf7eb
--- /dev/null
+++ b/tests/text_processing/tickets_data/PHPBB3-16053.html
@@ -0,0 +1 @@
+<a href="http://ea117.com" alt="Test">Test</a> \ No newline at end of file
diff --git a/tests/text_processing/tickets_data/PHPBB3-16053.txt b/tests/text_processing/tickets_data/PHPBB3-16053.txt
new file mode 100644
index 0000000000..c786665eb9
--- /dev/null
+++ b/tests/text_processing/tickets_data/PHPBB3-16053.txt
@@ -0,0 +1 @@
+[test=http://ea117.com]Test[/test] \ No newline at end of file
diff --git a/tests/text_processing/tickets_data/PHPBB3-16053.xml b/tests/text_processing/tickets_data/PHPBB3-16053.xml
new file mode 100644
index 0000000000..25f7c9e34e
--- /dev/null
+++ b/tests/text_processing/tickets_data/PHPBB3-16053.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>test</value>
+ <value></value>
+ <value>1</value>
+ <value>[test={URL}]{TEXT}[/test]</value>
+ <value><![CDATA[<a href="{URL}" alt="{TEXT}">{TEXT}</a>]]></value>
+ <value>((?!))</value>
+ <value></value>
+ <value>((?!))</value>
+ <value></value>
+ </row>
+ </table>
+</dataset>
diff --git a/vagrant/after.sh b/vagrant/after.sh
index 3b56777a4e..cebbcd67d3 100755
--- a/vagrant/after.sh
+++ b/vagrant/after.sh
@@ -2,7 +2,6 @@
PHPBB_PATH="/home/vagrant/phpbb"
PHPBB_CONFIG="${PHPBB_PATH}/phpBB/config.php"
-PHPBB_SQLITE="/tmp/phpbb.sqlite3"
PHPBB_INSTALL="${PHPBB_PATH}/vagrant/phpbb-install-config.yml"
# Ensure composer deps are installed
@@ -16,21 +15,9 @@ then
rm -rf ${PHPBB_CONFIG}
fi
-# Delete any sqlite db
-if [ -e ${PHPBB_SQLITE} ]
-then
- rm -rf ${PHPBB_SQLITE}
-fi
-
# Install phpBB
php ${PHPBB_PATH}/phpBB/install/phpbbcli.php install ${PHPBB_INSTALL}
-# Update sqlite db file permissions
-if [ -e ${PHPBB_SQLITE} ]
-then
- sudo chown -R vagrant ${PHPBB_SQLITE}
-fi
-
# Add DEBUG mode to phpBB to remove annoying installer warnings
echo "@define('DEBUG', true);" >> ${PHPBB_CONFIG}
@@ -38,10 +25,12 @@ echo "@define('DEBUG', true);" >> ${PHPBB_CONFIG}
sed -i '/^.*PHPBB_ENVIRONMENT.*$/s/production/development/' ${PHPBB_CONFIG}
# Update the PHP memory limits (enough to allow phpunit tests to run)
-sed -i "s/memory_limit = .*/memory_limit = 1024M/" /etc/php/7.1/fpm/php.ini
+sed -i "s/memory_limit = .*/memory_limit = 1024M/" /etc/php/7.2/fpm/php.ini
+
+# Fix for urls with app.php
+sed -i "s/cgi.fix_pathinfo=.*/cgi.fix_pathinfo=1/" /etc/php/7.2/fpm/php.ini
-# Make routes work in vagrant (https://tracker.phpbb.com/browse/PHPBB3-15400)
-sed -i '/^.*try_files.*$/s/index/app/' /etc/nginx/sites-enabled/phpbb.app
-nginx -s reload
+# Restart php-fpm to apply php.ini changes
+systemctl restart php7.2-fpm.service
echo "Your board is ready at http://192.168.10.10/"
diff --git a/vagrant/bootstrap.yaml b/vagrant/bootstrap.yaml
index 1c2b265712..0877c506aa 100644
--- a/vagrant/bootstrap.yaml
+++ b/vagrant/bootstrap.yaml
@@ -14,18 +14,16 @@ keys:
folders:
- map: "."
to: "/home/vagrant/phpbb"
+ php: "7.2"
sites:
- map: phpbb.app
to: "/home/vagrant/phpbb/phpBB"
+ type: apache
databases:
- phpbb
-variables:
- - key: APP_ENV
- value: local
-
# blackfire:
# - id: foo
# token: bar