From 8788aa450c79669ad76d0520b73433d06a606e5d Mon Sep 17 00:00:00 2001 From: rwxsu <37944358+rwxsu@users.noreply.github.com> Date: Mon, 6 Aug 2018 01:51:37 -0700 Subject: [PATCH] Prefix http or https if user hasn't explicitly set (#327) * Prefix http or https if user hasn't explicitly set Adding this because href prefixes the server's url if http:// or https:// is not provided. * Fixed whitespace --- forum.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/forum.php b/forum.php index c1748d9..772e07b 100644 --- a/forum.php +++ b/forum.php @@ -25,6 +25,7 @@ function TransformToBBCode($string) { '[img]{$1}[/img]' => 'image', '[link]{$1}[/link]' => '$1', '[link={$1}]{$2}[/link]' => '$2', + '[url={$1}]{$2}[/url]' => '$2', '[color={$1}]{$2}[/color]' => '$2', '[*]{$1}[/*]' => '
  • $1
  • ', '[youtube]{$1}[/youtube]' => '
    ', @@ -33,6 +34,11 @@ function TransformToBBCode($string) { foreach ($tags as $tag => $value) { $code = preg_replace('/placeholder([0-9]+)/', '(.*?)', preg_quote(preg_replace('/\{\$([0-9]+)\}/', 'placeholder$1', $tag), '/')); $string = preg_replace('/'.$code.'/i', $value, $string); + if (strpos($string, "