From 2c45b9411573f0e80f37c91c42ef7b1922df9a2d Mon Sep 17 00:00:00 2001 From: "Janus B. Kristensen" Date: Mon, 15 Dec 2008 18:43:52 +0000 Subject: [PATCH] Fixed issue where BBCode inside code-tags was being interpreted svn path=/trunk/boinc/; revision=16690 --- html/inc/text_transform.inc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/html/inc/text_transform.inc b/html/inc/text_transform.inc index 36e923adbb..0ef5aede7f 100644 --- a/html/inc/text_transform.inc +++ b/html/inc/text_transform.inc @@ -110,6 +110,7 @@ function bb2html($text) { $httpsregex = "(?:\"?)https\:\/\/([^\[\"<\ ]+)(?:\"?)"; // List of allowable tags $bbtags = array ( + "@\[code\](.*?)\[/code\]@eis", "@\[b\](.*?)\[/b\]@is", "@\[i\](.*?)\[/i\]@is", "@\[u\](.*?)\[/u\]@is", @@ -128,7 +129,6 @@ function bb2html($text) { "@\[color=(?:\"?)(.{3,8})(?:\"?)\](.*?)\[/color\]@is", "@((?:
    |
|))@is", "@\[size=([1-9]|[0-2][0-9])\](.*?)\[/size\]@is", - "@\[code\](.*?)\[/code\]@is", "@\[mailto\](.*?)\[/mailto\]@is", "@\[email\](.*?)\[/email\]@is", "@\[trac\](?:\#|ticket:)(\d+)\[/trac\]@is", @@ -141,6 +141,7 @@ function bb2html($text) { // What the above tags are turned in to $htmltags = array ( + "'
'.stop_recursion('\\1').'
'", "\\1", "\\1", "\\1", @@ -159,7 +160,6 @@ function bb2html($text) { "\\2", "\\1
  • \\2\n\\3", "\\2", - "
    \\1
    ", "\\1", "\\1", "#\\1", @@ -179,8 +179,16 @@ function bb2html($text) { return $text; } -// Make links open in new windows. +/** + * Stops recursion of BBCode by escaping any [ in the given text + * @param $text The text to stop recursion in + * @return A text that no longer can cause recursion + **/ +function stop_recursion($text){ + return str_replace("[", "[", $text); +} +// Make links open in new windows. function externalize_links($text) { // TODO: Convert this to PCRE $i=0;$linkpos=true;