From c70698eeefbb1e9b69a71e010d6c829305db15e9 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 2 Sep 2015 11:37:37 -0700 Subject: [PATCH] Web: fix BBCode transform for [img] when using HTTPS URL --- html/inc/text_transform.inc | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/html/inc/text_transform.inc b/html/inc/text_transform.inc index be1547111c..e668e63c37 100644 --- a/html/inc/text_transform.inc +++ b/html/inc/text_transform.inc @@ -153,6 +153,22 @@ function replace_pre_code($text, $export) { function bb2html($text, $export=false) { $urlregex = "(?:\"?)(?:(http\:\/\/)?)([^\[\"<\ ]+)(?:\"?)"; + // NOTE: + // This matches https:// too; I don't understand why. + // sample results: + // Array + // ( + // [0] => [img]https://a.b.c[/img] + // [1] => + // [2] => https://a.b.c + // ) + // Array + // ( + // [0] => [img]http://a.b.c[/img] + // [1] => http:// + // [2] => a.b.c + // ) + $httpsregex = "(?:\"?)https\:\/\/([^\[\"<\ ]+)(?:\"?)"; // List of allowable tags $bbtags = array ( @@ -203,7 +219,7 @@ function bb2html($text, $export=false) { "
\\1
", "

", "

    \\1

", - " ", + " ", "\\2", "\\1

  • \\2\n\\3", "\\2", @@ -230,7 +246,7 @@ function bb2html($text, $export=false) { "
    \\1
    ", "

    ", "

      \\1

    ", - " ", + " ", "\\2", "\\1

  • \\2\n\\3", "\\2",