From 378dbec981c9d1341295d2ab9bbed4ee1226bd6b Mon Sep 17 00:00:00 2001 From: mappu Date: Sun, 23 Apr 2017 18:42:01 +1200 Subject: [PATCH] bbcode: support [url] tags --- lib/util.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/util.php b/lib/util.php index 388d295..756eff6 100644 --- a/lib/util.php +++ b/lib/util.php @@ -133,7 +133,8 @@ function text2html($sz) { $base = hesc($sz); $base = preg_replace('~^=+(.+)=+~m', '\\1', $base); - $base = preg_replace('~(https?://[^ \\r\\n\\t]+)~i', '\\1', $base); + $base = preg_replace('~\\[url=([^\\]]+?)\\](.+?)\\[/url\\]~m', '\\2', $base); + $base = preg_replace('~([^="])(https?://[^ \\r\\n\\t]+)~i', '\\1\\2', $base); $base = preg_replace('~\\[b\\](.+?)\\[/b\\]~m', '\\1', $base); $base = preg_replace('~\\[i\\](.+?)\\[/i\\]~m', '\\1', $base); $base = preg_replace('~\\[spoiler\\](.+?)\\[/spoiler\\]~m', '\\1', $base);