diff options
author | Marc Alexander <admin@m-a-styles.de> | 2019-12-12 18:17:00 +0100 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2019-12-12 18:17:00 +0100 |
commit | b7492a7b6f5215ae8d54c9ffc16455384a1d870e (patch) | |
tree | 872a6002962de6aa1bf78d39a53b7823362a39c8 /phpBB | |
parent | 5be4cca4083e3f2611f7725058afa127ef701ef1 (diff) | |
parent | 4a950750f4735a410b057f09462ce770697d0301 (diff) | |
download | forums-b7492a7b6f5215ae8d54c9ffc16455384a1d870e.tar forums-b7492a7b6f5215ae8d54c9ffc16455384a1d870e.tar.gz forums-b7492a7b6f5215ae8d54c9ffc16455384a1d870e.tar.bz2 forums-b7492a7b6f5215ae8d54c9ffc16455384a1d870e.tar.xz forums-b7492a7b6f5215ae8d54c9ffc16455384a1d870e.zip |
Merge branch '3.2.x' into 3.3.x
Diffstat (limited to 'phpBB')
-rw-r--r-- | phpBB/phpbb/textformatter/s9e/parser.php | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/phpBB/phpbb/textformatter/s9e/parser.php b/phpBB/phpbb/textformatter/s9e/parser.php index a36fc63141..f7e4668980 100644 --- a/phpBB/phpbb/textformatter/s9e/parser.php +++ b/phpBB/phpbb/textformatter/s9e/parser.php @@ -15,6 +15,7 @@ namespace phpbb\textformatter\s9e; use s9e\TextFormatter\Parser\AttributeFilters\UrlFilter; use s9e\TextFormatter\Parser\Logger; +use s9e\TextFormatter\Parser\Tag; /** * s9e\TextFormatter\Parser adapter @@ -219,7 +220,7 @@ class parser implements \phpbb\textformatter\parser_interface { $errors[] = array($msg, $context['max_' . strtolower($m[1])]); } - else if ($msg === 'Tag is disabled') + else if ($msg === 'Tag is disabled' && $this->is_a_bbcode($context['tag'])) { $name = strtolower($context['tag']->getName()); $errors[] = array('UNAUTHORISED_BBCODE', '[' . $name . ']'); @@ -396,4 +397,21 @@ class parser implements \phpbb\textformatter\parser_interface return $url; } + + /** + * Test whether given tag consumes text that looks like BBCode-styled markup + * + * @param Tag $tag Original tag + * @return bool + */ + protected function is_a_bbcode(Tag $tag) + { + if ($tag->getLen() < 3) + { + return false; + } + $markup = substr($this->parser->getText(), $tag->getPos(), $tag->getLen()); + + return (bool) preg_match('(^\\[\\w++.*?\\]$)s', $markup); + } } |