View Issue Details

IDProjectCategoryView StatusLast Update
0003491mantisbtfeaturepublic2018-03-30 05:53
Reporterchipux Assigned Tovboctor  
PrioritynormalSeverityfeatureReproducibilityalways
Status closedResolutionwon't fix 
Summary0003491: Add More BBCode for Mantis Output
Description
  • Adds another function to the string API todo BB Code Transformations.
  • Adds the 'g_html_allow_bb_code' configuration var
Additional Information

http://force-elite.com/~chip/patches/mantis/bbcode.patch

Tagsbbcode, patch
Attached Files
bbcode.patch (3,622 bytes)   
Index: core/string_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/string_api.php,v
retrieving revision 1.40
diff -u -r1.40 string_api.php
--- core/string_api.php	24 Aug 2003 02:59:56 -0000	1.40
+++ core/string_api.php	7 Jan 2004 06:54:34 -0000
@@ -38,7 +38,8 @@
 		$p_string = string_insert_hrefs( $p_string );
 		$p_string = string_process_bug_link( $p_string );
 		$p_string = string_process_cvs_link( $p_string );
-		
+		$p_string = string_convert_bb_code( $p_string );
+
 		return $p_string;
 	}
 
@@ -101,6 +102,45 @@
 							 $t_replace_with,
 							 $p_string );
 	}
+
+        # --------------------
+        # Process the $p_string and add BB Code HTML.
+        function string_convert_bb_code ( $p_string ){
+                $t_html_allow_bb_code = config_get( 'html_allow_bb_code' );
+
+                if( ON !== $t_html_allow_bb_code ) {
+                        return $p_string;
+                }
+
+                $t_regex = array(
+                        "/\[b\](.*)\[\/b\]/siU",
+                        "/\[i\](.*)\[\/i\]/siU",
+                        "/\[u\](.*)\[\/u\]/siU",
+                        "/\[s\](.*)\[\/s\]/siU",
+                        "/<a href=\"(.*)\.pdf\"(.*>.*<\/a>)/siU",
+                        "/<a href=\"(.*)\.doc\"(.*>.*<\/a>)/siU",
+                        "/<a href=\"(.*)\.xls\"(.*>.*<\/a>)/siU",
+                        "/<a href=\"(.*)\.avi\"(.*>.*<\/a>)/siU",
+                        "/<a href=\"(.*)\.zip\"(.*>.*<\/a>)/siU",
+                        "/<a href=\"(.*)\.ogg\"(.*>.*<\/a>)/siU",
+                        "/<a href=\"(.*)\.ppt\"(.*>.*<\/a>)/siU"
+                        );
+                $t_replace  = array(
+                        "<span class='bold'>$1</span>",
+                        "<span class='italic'>$1</span>",
+                        "<span class='underline'>$1</span>",
+                        "<span class='strike'>$1</span>",
+                        "<a href=\"$1.pdf\" $2<span style=\"font-size: xx-small\">[.pdf]</span>",
+                        "<a href=\"$1.doc\" $2<span style=\"font-size: xx-small\">[.doc]</span>",
+                        "<a href=\"$1.xls\" $2<span style=\"font-size: xx-small\">[.xls]</span>",
+                        "<a href=\"$1.avi\" $2<span style=\"font-size: xx-small\">[.avi]</span>",
+                        "<a href=\"$1.zip\" $2<span style=\"font-size: xx-small\">[.zip]</span>",
+                        "<a href=\"$1.ogg\" $2<span style=\"font-size: xx-small\">[.ogg]</span>",
+                        "<a href=\"$1.ppt\" $2<span style=\"font-size: xx-small\">[.ppt]</span>"
+                        );
+                return preg_replace($t_regex,$t_replace,$p_string);
+        }
+
 
 	# --------------------
 	# Process $p_string, looking for bug ID references and creating bug view
Index: config_defaults_inc.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/config_defaults_inc.php,v
retrieving revision 1.130
diff -u -r1.130 config_defaults_inc.php
--- config_defaults_inc.php	1 Sep 2003 14:06:57 -0000	1.130
+++ config_defaults_inc.php	7 Jan 2004 06:54:35 -0000
@@ -538,6 +543,9 @@
 	# Set this flag to automatically convert www URLs and
 	# email adresses into clickable links
 	$g_html_make_links		= ON;
+
+        # Set this flag to enable Simple BB Code Style Transformations
+        $g_html_allow_bb_code              = ON;
 
 	# do NOT include href or img tags here
 	# do NOT include tags that have parameters (eg. <font face="arial">)
bbcode.patch (3,622 bytes)   

Relationships

has duplicate 0004115 closedgrangeway Allow UBB code in bugnotes, description, etc 
has duplicate 0004482 closedvboctor Support for quoting 
has duplicate 0003658 closedgrangeway html-code in bug-note 

Activities

vboctor

vboctor

2004-03-17 17:05

manager   ~0005229

chipux, lets discuss the addition of bbcode on irc and if we decide to go with it, then we can add the feature to cvs.

joakimwg

joakimwg

2004-07-26 14:17

reporter   ~0006373

How did the irc discussion turn out? Is this a feature that will be added?

thraxisp

thraxisp

2004-07-29 11:38

reporter   ~0006442

duplicate resolved

grangeway

grangeway

2004-09-05 16:04

reporter   ~0007443

hmm, should this have been closed? - i.e. what's it a dupe of?

thraxisp

thraxisp

2004-09-05 17:08

reporter   ~0007446

Oops, 4115 was marked as a duplicate of this one about the same time as it was marked as a duplicate of this one.

This still needs to be done.

deboutv

deboutv

2007-06-17 11:35

reporter   ~0014770

I have written a plugin to allow BBCode (with an editor):
http://deboutv.free.fr/mantis/
http://deboutv.free.fr/mantis/plugin.php?plugin=bbcode

grangeway

grangeway

2008-07-13 11:23

reporter   ~0018429

Attachment from chip's url added to bug.

thehandyman

thehandyman

2010-10-03 23:47

reporter   ~0026937

As far as I can tell deboutv's plugins are not compatible with current release of Mantis (1.2.3). Is this a feature that is planned for future versions of Mantis built in?

thu.doan

thu.doan

2013-07-08 22:43

reporter   ~0037431

Hi

Is there any plugin BBcode for mantis 1.2.*

Thanks.

atrol

atrol

2013-07-09 03:09

developer   ~0037434

https://github.com/mantisbt-plugins/bbcode

thu.doan

thu.doan

2013-07-09 03:20

reporter   ~0037435

Hi,

I installed bbcode plugin already. I wanna ask you about "code" tag. When I use [code=php]...[/code], the code doesn't change the color. How can I make the code colorful? (follow some languages: java, php, C,...).

Thanks.

atrol

atrol

2013-07-09 04:25

developer   ~0037436

thu.doan, this is not the right place for such kind of questions.
bbcode is a 3rd party plugin, you have to contact the author of the plugin.

vboctor

vboctor

2018-03-18 23:38

manager   ~0059237

I suggest closing this as won't fix in favor of markdown support that was added for 2.x.