miniBB ® miniBB®
miniBB Support Forums
 | Forums | Register | Reply | Search | Statistics | Manual |
Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications /   

Enabling moderators to use color BB codes / color tags

Page  Page 1 of 3:  1  2  3  Next »  
Author Anonymous
Guest
#1 | Posted: 14 Apr 2005 11:06 
Kinda as a follow up on this while the topic is here,
Is it possible to give moderators rights to use colours in posts?
Reading from the manual only admins can do this.

Author Team
8-)
#2 | Posted: 14 Apr 2005 11:15 
Look at the following statement in bb_codes.php:

if($admin==1) {
$pattern[]="/\[font(#[A-F0-9]{6})\](.+?)\[\/font\]/is";
$replacement[]='<font color="\\1">\\2</font>';
}

you may edit it like:

if($admin==1 or $GLOBALS['isMod']==1) {
$pattern[]="/\[font(#[A-F0-9]{6})\](.+?)\[\/font\]/is";
$replacement[]='<font color="\\1">\\2</font>';
}

and it should work.

Author Anonymous
Guest
#3 | Posted: 14 Apr 2005 12:09 
Thanks alot for your quick reply :)
Worked like a dream

- Amund

Author _Marco
Registered
#4 | Posted: 24 Nov 2005 00:40 
Not too hard to make your own colortags .... :-)

$pattern[]="/\[red\](.+?)\[\/red\]/is";
$replacement[]='<font color=\"#FF0000\">\\1</font>';

put this in bb_codes.php and see what effect [red]test[/red] brings you.

I leave it to your own creativity to make other colors and find out how to de-code these tags (for editing!)

_Marco

Author lutz
Guest
#5 | Posted: 13 Feb 2006 20:00 
Ok, so I already put this in bb_codes.php under encode:

$pattern[]="/[color=black](.+?)[/color]/i";
$replacement[]='<font color="#000000">\1</font>';

$pattern[]="/[color=white](.+?)[/color]/i";
$replacement[]='<font color="#FFFFFF">\1</font>';

$pattern[]="/[color=red](.+?)[/color]/i";
$replacement[]='<font color="#FF0000">\1</font>';

$pattern[]="/[color=blue](.+?)[/color]/i";
$replacement[]='<font color="#0000FF">\1</font>';

$pattern[]="/[color=brown](.+?)[/color]/i";
$replacement[]='<font color="#993300">\1</font>';

$pattern[]="/[color=cyan](.+?)[/color]/i";
$replacement[]='<font color="#00FFFF">\1</font>';

$pattern[]="/[color=darkblue](.+?)[/color]/i";
$replacement[]='<font color="#000099">\1</font>';

$pattern[]="/[color=darkred](.+?)[/color]/i";
$replacement[]='<font color="#990000">\1</font>';

$pattern[]="/[color=green](.+?)[/color]/i";
$replacement[]='<font color="#009900">\1</font>';

$pattern[]="/[color=grey](.+?)[/color]/i";
$replacement[]='<font color="#999999">\1</font>';

$pattern[]="/[color=olive](.+?)[/color]/i";
$replacement[]='<font color="#999900">\1</font>';

$pattern[]="/[color=orange](.+?)[/color]/i";
$replacement[]='<font color="#FF9900">\1</font>';

$pattern[]="/[color=pink](.+?)[/color]/i";
$replacement[]='<font color="#FF33FF">\1</font>';

$pattern[]="/[color=purple](.+?)[/color]/i";
$replacement[]='<font color="#9900FF">\1</font>';

$pattern[]="/[color=yellow](.+?)[/color]/i";
$replacement[]='<font color="#FFFF00">\1</font>';

And it works ok, but what I don't get is why does it work without corresponding DEcode definitions?
Is this invisibly damaging in some way or should it be fine?

Author _Marco
Registered
#6 | Posted: 13 Feb 2006 21:40 
This works, allright, no problemo. You don't need a decode definition corresponding with an encode definition.

But .... what do you see when you edit your message?

That's why you need the decode definitions:-)

_Marco

Author lutz
Guest
#7 | Posted: 16 Feb 2006 22:33 
Oh yeah, I made up some decoding definitions, so thats probably why... lol

Author shedrock
Registered
#8 | Posted: 24 May 2006 12:52 
I have added the following to the function EncodeBB:

$pattern[]="/[color=(black|white|skyblue|royalblue|blue|darkblue|purp le|orange|yellow|gold|tomato|coral|orangered|crimson|red|firebrick|dar kred|green|limegreen|seagreen|deeppink|purple|indigo|burlywood|sandybr own|sienna|chocolate|teal|silver|gray)](.+?)[/color]/i";
$replacement[]='<span style="color:1">2</span>';

My problem is, I don't know how to add it to the DecodeBB($msg) area. I added this but I am not too sure if it is correct.

$pattern[]="/<span style="color:1">(.+?)</span>/is";
$replacement[]="[color=(black|white|skyblue|royalblue|blue|darkblue|pu rple|orange|yellow|gold|tomato|coral|orangered|crimson|red|firebrick|d arkred|green|limegreen|seagreen|deeppink|purple|indigo|burlywood|sandy brown|sienna|chocolate|teal|silver|gray)]\2[/color]";


Thank for anyhelp here.

Author Team
8-)
#9 | Posted: 24 May 2006 19:27 | Edited by: Team 
it should be:


$pattern[]="/<span style=\"color:(black|white|skyblue|royalblue|blue|darkblue|pu rple|orange|yellow|gold|tomato|coral|orangered|crimson|red|firebrick|d arkred|green|limegreen|seagreen|deeppink|purple|indigo|burlywood|sandy brown|sienna|chocolate|teal|silver|gray)\">(.+?)</span>/is";
$replacement[]="[color=\\1]\\2[/color]";


the encodeBB code seems to be incorrect as well(maybe cause there was a bug with slashes on this server should be fixed now).. it should be something like:

$pattern[]="/[color=(black|white|skyblue|royalblue|blue|darkblue|purp le|orange|yellow|gold|tomato|coral|orangered|crimson|red|firebrick|dar kred|green|limegreen|seagreen|deeppink|purple|indigo|burlywood|sandybr own|sienna|chocolate|teal|silver|gray)](.+?)[/color]/i";
$replacement[]="<span style=\"color:\\1\">\\2</span>";

Author shedrock
Registered
#10 | Posted: 25 May 2006 01:14 
After making some changes to it I got it to work. The problem though is this. My colors work great but I went into the message to edit it, I thne get the following: eg:- <span style="color:red">Test RED</span>. Then once I finish editing the message and save it I get that example as the output. Is there any way around this?

Thanks for all your help.
Shedrock

Author Team
8-)
#11 | Posted: 25 May 2006 17:09 
and the decodeBB pattern is set like in my post above?

try this decodeBB pattern:

$pattern[]="/<span style=\"color:(black|white|skyblue|royalblue|blue|darkblue|pu rple|orange|yellow|gold|tomato|coral|orangered|crimson|red|firebrick|d arkred|green|limegreen|seagreen|deeppink|purple|indigo|burlywood|sandy brown|sienna|chocolate|teal|silver|gray)\">([^<]+?)<\/span>/ims";
$replacement[]="[color=\\1]\\2[/color]";


make sure there're no end of line signs in it when you paste it all words should run together in each line..

Author shedrock
Registered
#12 | Posted: 25 May 2006 17:24 
Thank you very much. This works great now.

Cheers!
Shedrock

Author Team
8-)
#13 | Posted: 25 May 2006 19:21 
you're welcome :)

Author shedrock
Registered
#14 | Posted: 26 May 2006 01:21 | Edited by: shedrock 
I am back again. I seem to still be having problems with this. I have tested it over and over and it appears that sometimes I get the following. Although it does work sometimes with less content in the post.

The below is just an example of what happens.

<span style="color:green">It's now become quite obvious that the current messages.php has more holes than I can fix. Therefore I am scrapping the entire script with a complete rewrite under way. For your site's protection I recommend that you remove messages.php from your server as hacking groups are targeting this scripts hole to hijack admin accounts. I am working as fast as possible and should have a newly coded messages.php script ready within 48 hours. The messages.php will work in all v6 installations. I apologise for any inconvenience caused by this issue.</span>

See? sometimes I still get the <span> when I edit the message. It seems to depend on the text used in the message. I am confused.

Shedrock

Author shedrock
Registered
#15 | Posted: 26 May 2006 01:32 | Edited by: shedrock 
after doing some more testing it appears that I can't use the [color] tag before the [b] tag. I must use it in this manner: ex.

[b][color=red]Shedrock[/color][ /b]

Why is this?

Thank for any help.
Shedrock

Page  Page 1 of 3:  1  2  3  Next » 
Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications / Enabling moderators to use color BB codes / color tags Top

Your Reply Click this icon to move up to the quoted message

 Short link for this topic:

 ?
Only registered users are allowed to post here. Please, enter your username/password details upon posting a message, or register first.


Before posting, make sure your message is compliant with our forum posting rules. If not, it may be locked or deleted with no explanation.
 
 
miniBB Support Forums Powered by Forum Software miniBB ® Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contacts
Check out the Captcha add-on: protect your miniBB-forums from the automated spam and flood.
Captcha Addon for miniBB