Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases

Reply
 
Thread Tools
BB Code Functions Details »»
BB Code Functions
Version: 1.00, by Velocd Velocd is offline
Developer Last Online: Nov 2023 Show Printable Version Email this Page

Version: 3.0.0 Rating:
Released: 03-28-2004 Last Update: Never Installs: 14
 
No support by the author.




As requested by mudpyr8:
https://vborg.vbsupport.ru/showthread.php?t=62933


Features
  • Manage BB Code functions from your AdminCP. These can be internal PHP functions, or custom (derived from a specified PHP file).
  • Apply a BB Code function to a custom BB Code tag, and you can use it (when the correct arguments are provided) in posts, etc.
  • You may choose for a function to be static, or update everytime upon page refresh. If it's static, the first time a function is called the value returned will be replaced with the tag in the post (hard-coded).

Known bugs
  • One must have posted in the WYSIWYG editor in order for function tags that are unchecked for "update upon page refresh" to work correctly. This is an annoying bug I discovered an hour from releasing this hack, and it will prevent functions tags from being replaced with their return values (hard-coded) in the post. It's only significant if you are using a function that returns a random/dynamic value, and wish not for the value to be updated upon page refresh, but stay unique. I will be looking into a solution when I have the time.
  • Know of another? Please PM me of it, or post it in the thread.

Notes
  • This script can only be maliciously taken advantage of if you provide functions that access your server. For example, don't create a custom function that queries your database and returns something. A user could place 100 of these tags into a post, and it would make 100 queries. Even worse, if the "update upon refresh" is enabled, it'll call 100 queries for every view of the page. Especially don't create functions that manipulate data on your server or in your database!

    Everything is at your risk, but I implore you to stick with simple functions.
  • More important notes inside install.html.

Screenshots
See attachments.

Enjoy. Remember to click install if you do use this hack.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 03-29-2004, 04:35 AM
Velocd's Avatar
Velocd Velocd is offline
 
Join Date: Mar 2002
Location: CA University
Posts: 1,696
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Have a custom function that is useful?

Just send me a link to a file with the function, or PM me the working code, and I'll display it in this post.


1. Evaluate mathematical expression
Here is a useful function that will take a mathematical expression and return the answer for it. Valid operators include plus + minus - multiply * divide / modulus % carrot/power ^ and parentheses ().

When used in BB Code, have one argument and it should function like so:

[math]5*6%3+((45/5)/4)[/math]

5*6%3 = 0
(45/5)/4 = 2.25
= 2.25

Here is the function:
PHP Code:
function arithmetic($expression)
{
    
$expression preg_replace('([^0-9\+\-*\/%\^\(\)])'''trim($expression));

    eval(
'$answer ='.$expression.';');
    
    return 
$answer;

Careful with parentheses. If you have (5/5)5 it will result in an error, and nothing will be returned.
Reply With Quote
  #3  
Old 03-29-2004, 05:27 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry to sound so deft here, but what does this actually do and how would we use it?

Also, I have to know. How did you do that with that screenshot at the top of the post? That is wild.
Reply With Quote
  #4  
Old 03-29-2004, 09:02 AM
xware's Avatar
xware xware is offline
 
Join Date: Nov 2001
Posts: 74
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry to sound so deft here, but what does this actually do and how would we use it?
Reply With Quote
  #5  
Old 03-29-2004, 09:15 AM
lasto lasto is offline
 
Join Date: Jan 2002
Posts: 1,514
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by xware
Sorry to sound so deft here, but what does this actually do and how would we use it?

ditto LOL im confused as well
Reply With Quote
  #6  
Old 03-29-2004, 09:29 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by xware
Sorry to sound so deft here, but what does this actually do and how would we use it?
Just curious here ... was there a reason you didn't quote the message instead of just repeating it?
Reply With Quote
  #7  
Old 03-29-2004, 10:41 AM
Charlie Argueta's Avatar
Charlie Argueta Charlie Argueta is offline
 
Join Date: Oct 2002
Location: Taiwan
Posts: 47
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is amazing, but some of them are too hardcored, may be I will use some of them.

See Ya
Reply With Quote
  #8  
Old 03-29-2004, 02:48 PM
Velocd's Avatar
Velocd Velocd is offline
 
Join Date: Mar 2002
Location: CA University
Posts: 1,696
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I thought the attached screenshots would be enough of an explanation.

This hack allows you to give bb code PHP functions (internal or custom).

For example, if I assigned the PHP function rand() to a tag called [rand], it would generate a random value.

[rand="0"]100[/rand]

Would generate a random value from 0 - 100.
Reply With Quote
  #9  
Old 03-29-2004, 03:13 PM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This looks great - could be used to resize an image right? And all sorts ....

Btw love that image at the top
Reply With Quote
  #10  
Old 03-29-2004, 04:00 PM
Bad Bunny's Avatar
Bad Bunny Bad Bunny is offline
 
Join Date: Apr 2002
Posts: 555
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Velocd
I thought the attached screenshots would be enough of an explanation.

This hack allows you to give bb code PHP functions (internal or custom).

For example, if I assigned the PHP function rand() to a tag called [rand], it would generate a random value.

[rand="0"]100[/rand]

Would generate a random value from 0 - 100.
Wow. So it is possibly to simulate dice with this (amongst many other things)?! That's pretty hardcore!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:27 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05448 seconds
  • Memory Usage 2,295KB
  • Queries Executed 23 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete