diff options
author | Tristan Darricau <tristan.darricau@sensiolabs.com> | 2015-08-05 12:59:55 +0200 |
---|---|---|
committer | Tristan Darricau <tristan.darricau@sensiolabs.com> | 2015-08-05 12:59:55 +0200 |
commit | cbe74844b01f72d2007376ceafdf979a6cc94d47 (patch) | |
tree | 558cc4463fdd8cf4b67f6a42197e2349560e690e /phpBB | |
parent | e70373a8202e0431a99f80b941e46ae0282a94d4 (diff) | |
parent | 88348e1ccc32e8ba731ee079383061792ab01a16 (diff) | |
download | forums-cbe74844b01f72d2007376ceafdf979a6cc94d47.tar forums-cbe74844b01f72d2007376ceafdf979a6cc94d47.tar.gz forums-cbe74844b01f72d2007376ceafdf979a6cc94d47.tar.bz2 forums-cbe74844b01f72d2007376ceafdf979a6cc94d47.tar.xz forums-cbe74844b01f72d2007376ceafdf979a6cc94d47.zip |
Merge pull request #3698 from s9e/ticket/13935
[ticket/13935] Allow more admin-configurable schemes in post links
* s9e/ticket/13935:
[ticket/13935] Removed cache invalidation from acp_board
[ticket/13935] Removed UI
[ticket/13935] Allow more admin-configurable schemes in post links
Diffstat (limited to 'phpBB')
-rw-r--r-- | phpBB/config/default/container/services_text_formatter.yml | 1 | ||||
-rw-r--r-- | phpBB/install/schemas/schema_data.sql | 1 | ||||
-rw-r--r-- | phpBB/phpbb/db/migration/data/v320/allowed_schemes_links.php | 24 | ||||
-rw-r--r-- | phpBB/phpbb/textformatter/s9e/factory.php | 19 |
4 files changed, 44 insertions, 1 deletions
diff --git a/phpBB/config/default/container/services_text_formatter.yml b/phpBB/config/default/container/services_text_formatter.yml index ae698af9e4..5a3307175f 100644 --- a/phpBB/config/default/container/services_text_formatter.yml +++ b/phpBB/config/default/container/services_text_formatter.yml @@ -32,6 +32,7 @@ services: - @text_formatter.data_access - @cache.driver - @dispatcher + - @config - %text_formatter.cache.dir% - %text_formatter.cache.parser.key% - %text_formatter.cache.renderer.key% diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 06626b4617..f02bca2985 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -41,6 +41,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig_pm', '1' INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig_smilies', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_smilies', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_topic_notify', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allowed_schemes_links', 'http,https,ftp'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('assets_version', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('attachment_quota', '52428800'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('auth_bbcode_pm', '1'); diff --git a/phpBB/phpbb/db/migration/data/v320/allowed_schemes_links.php b/phpBB/phpbb/db/migration/data/v320/allowed_schemes_links.php new file mode 100644 index 0000000000..de127e3745 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v320/allowed_schemes_links.php @@ -0,0 +1,24 @@ +<?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\v320; + +class allowed_schemes_links extends \phpbb\db\migration\migration +{ + public function update_data() + { + return array( + array('config.add', array('allowed_schemes_links', 'http,https,ftp')), + ); + } +} diff --git a/phpBB/phpbb/textformatter/s9e/factory.php b/phpBB/phpbb/textformatter/s9e/factory.php index 2aab97b667..4a04b34cd8 100644 --- a/phpBB/phpbb/textformatter/s9e/factory.php +++ b/phpBB/phpbb/textformatter/s9e/factory.php @@ -43,6 +43,11 @@ class factory implements \phpbb\textformatter\cache_interface protected $cache_key_renderer; /** + * @var \phpbb\config\config + */ + protected $config; + + /** * @var array Custom tokens used in bbcode.html and their corresponding token from the definition */ protected $custom_tokens = array( @@ -127,16 +132,18 @@ class factory implements \phpbb\textformatter\cache_interface * @param \phpbb\textformatter\data_access $data_access * @param \phpbb\cache\driver\driver_interface $cache * @param \phpbb\event\dispatcher_interface $dispatcher + * @param \phpbb\config\config $config * @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, $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, $cache_dir, $cache_key_parser, $cache_key_renderer) { $this->cache = $cache; $this->cache_dir = $cache_dir; $this->cache_key_parser = $cache_key_parser; $this->cache_key_renderer = $cache_key_renderer; + $this->config = $config; $this->data_access = $data_access; $this->dispatcher = $dispatcher; } @@ -190,6 +197,16 @@ class factory implements \phpbb\textformatter\cache_interface $vars = array('configurator'); extract($this->dispatcher->trigger_event('core.text_formatter_s9e_configure_before', compact($vars))); + // Reset the list of allowed schemes + foreach ($configurator->urlConfig->getAllowedSchemes() as $scheme) + { + $configurator->urlConfig->disallowScheme($scheme); + } + foreach (explode(',', $this->config['allowed_schemes_links']) as $scheme) + { + $configurator->urlConfig->allowScheme(trim($scheme)); + } + // Convert newlines to br elements by default $configurator->rootRules->enableAutoLineBreaks(); |