vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.6 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=194)
-   -   Administrative and Maintenance Tools - Advanced BBCode (Use conditionals in BBCodes) (https://vborg.vbsupport.ru/showthread.php?t=149107)

harmor19 06-06-2007 10:00 PM

Advanced BBCode (Use conditionals in BBCodes)
 
It kind of bothered me that you couldn't use vBulletin conditionals in the BBCodes. For example you couldn't use <if condition="$bbuserinfo[usergroupid] == {option}">{param}</if>.

With this small hack you can customize your BBCodes by using vBulletin's own conditionals.

Installing
Download the plugin XML. Go into to your ACP --> Plugins & Products --> Download / Upload Plugins. Scroll to the bottom of the page. Browse to vbulletin-plugins_adv_bbcodes.xml and click "Import".

View the screenshot for an example BBCode you can use.

harmor19 06-07-2007 05:03 AM

I hope you like this hack.

Subah 06-07-2007 08:27 AM

Thanks :)

Benj 06-07-2007 08:36 AM

sweet

harmor19 06-07-2007 06:32 PM

Thanks you two.

Muellmann 06-07-2007 08:50 PM

Superb! This opens much more possibilities - thanks. :up:

RMS-Chef 06-07-2007 09:14 PM

Great idea.
Anyway to set it to use an array for multiple groups?

Muellmann 06-07-2007 09:52 PM

Can you make it such, that it doesn't ignore the "<else />" statement?
Sometimes the "<else />" works one time and then not. This would be very helpful if you could fix that.

harmor19 06-07-2007 09:58 PM

What replacement code are you using?

harmor19 06-07-2007 10:01 PM

Quote:

Originally Posted by RMS-Chef (Post 1263639)
Great idea.
Anyway to set it to use an array for multiple groups?

I tried and couldn't get it to work.

Muellmann 06-07-2007 10:51 PM

For example:
Code:

<if condition="$bbuserinfo['userid']>0">{param}<else />This code is not visible for Guests</if>
or:
Code:

<if condition="$bbuserinfo['reputation']>=100">{param}<else />This code is only visible for reputation points.</if>
Other question security related:
I found out that it would parse vb variables directly in the post.
The question is if there is a security matter / issue or not?!
For example I can write in my post
Code:

$bbuserinfo[reputation]
and it would
directly in my post show my reputation value. So I am afraid it could be used by
members for malicious actions or is this impossible?

harmor19 06-07-2007 11:09 PM

The conditionals work for me.

It's not really a security risk but you may have data you don't want them to see.

Murty 06-07-2007 11:54 PM

Could you use this to specify the bbcode to only be used in a particular forum? If so, what code would you use?

AzzidReign 06-08-2007 02:01 AM

Hmmm, interesting. I'm going to click install for now and download and install this to my site later!

harmor19 06-08-2007 03:24 AM

There are a two problems with this mod. One is where a member can type $bbuserinfo[var] and it will output the value in the database but only for their userid. I used preg_replace to fix the problem.
Another is when someone types an array with either single or double quotes $var['foo'] or $var["foo"].
Can anybody help with the second problem?

mhmd1983 06-08-2007 08:10 AM

Great mod , even with the simple example you wrote it'll be much fun to use it

WAR 06-15-2007 04:42 PM

Did you include the fix for the first problem in the plugin yet?

For restricting multiple usergroups, can you use the is_member_of() function instead of the boolean operator? (I know that this works in templates, not sure about here)

Example:

<if condition="is_member_of($bbuserinfo,{option})">{pa ram}</if>

[bbcode_name=5,6]visible to mods and admins only[/bbcode_name]

or you might need quotes, depending on how things are parsed, and whether or not this is related to problem #2 above:

[bbcode_name='5,6']visible to mods and admins only[/bbcode_name]

I am concerned about the security risk, because I have a ton of private/hidden profile fields with personal information about my users that I wouldn't want people to have access to

raywjohnson 08-05-2007 12:52 AM

Quote:

Originally Posted by Muellmann (Post 1263692)
Other question security related:
I found out that it would parse vb variables directly in the post.
The question is if there is a security matter / issue or not?!
For example I can write in my post
Code:

$bbuserinfo[reputation]
and it would
directly in my post show my reputation value. So I am afraid it could be used by
members for malicious actions or is this impossible?


Installed and working great! But, is there any security/abuse concern here? Can this be exploited?

--RayJ

raywjohnson 08-05-2007 01:27 AM

Quote:

Originally Posted by harmor19 (Post 1263855)
There are a two problems with this mod. One is where a member can type $bbuserinfo[var] and it will output the value in the database but only for their userid. I used preg_replace to fix the problem.
Another is when someone types an array with either single or double quotes $var['foo'] or $var["foo"].
Can anybody help with the second problem?

I have some concern about this, could you give an example of the preg_replace regex and where to put it? I would guess it would go in the plugin, but before or after the
PHP Code:

eval('$text = "' compile_template($text) . '" ;'); 

?

Thanks for any info!

--RayJ

PS:
PHP Code:

My failed attempt: eval(preg_replace('/(\$)(show|stylevar|userinfo|vboptions|vbphrase)(\[.+\])/i',"$1 $2 $3",$text)); 


raywjohnson 08-05-2007 09:03 PM

It seems as if this only works on new/updates posts. It fails to function for bbcodes in the post-cache. Any info on how to fix this?

Thanx, RayJ

punchbowl 02-20-2008 02:08 PM

this could be* exactly what I'm looking for! I love this site!

Thanks

*or not

DragonBlade 10-17-2008 11:26 AM

When I created a post, it worked great!

After a few minutes, I guess the post-cache kicked in or something, and it displayed the <if> and <else> tags as regular HTML tags.

After disabling post-caching, it seems to work fine.

Any way I could have this AND have post-caching, or does it just not work that way?

mmoore5553 05-24-2009 05:32 PM

any updates on this and post caching ? any other security flaws ?

BirdOPrey5 10-08-2010 12:20 AM

Any chance of getting this fixed and working for 3.8?

Scanu 02-26-2011 06:45 PM

Please make a new version of this plugin for vb 4.1
Is fantastic. Please help me :)

dutchbb 02-17-2013 11:34 AM

Can someone make this work with post caching and <else /> statements in vb3.8 please, thanks.

Tyran1 03-08-2013 12:00 AM

,.......

ExcelFox 04-13-2013 02:34 PM

If you can have a look at this.. would be great

https://vborg.vbsupport.ru/showthread.php?p=2416099


All times are GMT. The time now is 06:38 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01284 seconds
  • Memory Usage 1,774KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (2)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (28)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete