aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/message_parser.php
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2011-06-09 22:40:26 +0200
committerNils Adermann <naderman@naderman.de>2011-06-09 22:40:26 +0200
commitd02d00e9512a1960bf7e9d507a9910b6ea849bf4 (patch)
treef83ded5655e37a320c7aaa4e3fed6c15564809e4 /phpBB/includes/message_parser.php
parent0942fca29927856731ed4fc1a79cc913a0d97e74 (diff)
parent928ee43881b30d6f15dc1a5b56aeae425ac47b4d (diff)
downloadforums-d02d00e9512a1960bf7e9d507a9910b6ea849bf4.tar
forums-d02d00e9512a1960bf7e9d507a9910b6ea849bf4.tar.gz
forums-d02d00e9512a1960bf7e9d507a9910b6ea849bf4.tar.bz2
forums-d02d00e9512a1960bf7e9d507a9910b6ea849bf4.tar.xz
forums-d02d00e9512a1960bf7e9d507a9910b6ea849bf4.zip
Merge branch 'develop-olympus' into develop
* develop-olympus: [ticket/217] Use positive assertions in tests. [ticket/217] Silence errors in tests, not code. [ticket/217] Use positive parameter statement for bbcode_init() [ticket/217] Adjust patch, add tests [ticket/217] Multiline [url] not converted
Diffstat (limited to 'phpBB/includes/message_parser.php')
-rw-r--r--phpBB/includes/message_parser.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php
index c6132d86d4..b3a48112ea 100644
--- a/phpBB/includes/message_parser.php
+++ b/phpBB/includes/message_parser.php
@@ -102,20 +102,22 @@ class bbcode_firstpass extends bbcode
/**
* Init bbcode data for later parsing
*/
- function bbcode_init()
+ function bbcode_init($allow_custom_bbcode = true)
{
static $rowset;
// This array holds all bbcode data. BBCodes will be processed in this
// order, so it is important to keep [code] in first position and
// [quote] in second position.
+ // To parse multiline URL we enable dotall option setting only for URL text
+ // but not for link itself, thus [url][/url] is not affected.
$this->bbcodes = array(
'code' => array('bbcode_id' => 8, 'regexp' => array('#\[code(?:=([a-z]+))?\](.+\[/code\])#uise' => "\$this->bbcode_code('\$1', '\$2')")),
'quote' => array('bbcode_id' => 0, 'regexp' => array('#\[quote(?:=&quot;(.*?)&quot;)?\](.+)\[/quote\]#uise' => "\$this->bbcode_quote('\$0')")),
'attachment' => array('bbcode_id' => 12, 'regexp' => array('#\[attachment=([0-9]+)\](.*?)\[/attachment\]#uise' => "\$this->bbcode_attachment('\$1', '\$2')")),
'b' => array('bbcode_id' => 1, 'regexp' => array('#\[b\](.*?)\[/b\]#uise' => "\$this->bbcode_strong('\$1')")),
'i' => array('bbcode_id' => 2, 'regexp' => array('#\[i\](.*?)\[/i\]#uise' => "\$this->bbcode_italic('\$1')")),
- 'url' => array('bbcode_id' => 3, 'regexp' => array('#\[url(=(.*))?\](.*)\[/url\]#uiUe' => "\$this->validate_url('\$2', '\$3')")),
+ 'url' => array('bbcode_id' => 3, 'regexp' => array('#\[url(=(.*))?\](?(1)((?s).*(?-s))|(.*))\[/url\]#uiUe' => "\$this->validate_url('\$2', ('\$3') ? '\$3' : '\$4')")),
'img' => array('bbcode_id' => 4, 'regexp' => array('#\[img\](.*)\[/img\]#uiUe' => "\$this->bbcode_img('\$1')")),
'size' => array('bbcode_id' => 5, 'regexp' => array('#\[size=([\-\+]?\d+)\](.*?)\[/size\]#uise' => "\$this->bbcode_size('\$1', '\$2')")),
'color' => array('bbcode_id' => 6, 'regexp' => array('!\[color=(#[0-9a-f]{3}|#[0-9a-f]{6}|[a-z\-]+)\](.*?)\[/color\]!uise' => "\$this->bbcode_color('\$1', '\$2')")),
@@ -133,6 +135,11 @@ class bbcode_firstpass extends bbcode
$this->parsed_items[$tag] = 0;
}
+ if (!$allow_custom_bbcode)
+ {
+ return;
+ }
+
if (!is_array($rowset))
{
global $db;