Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases
FAQ Community Calendar Today's Posts Search

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
  #22  
Old 04-01-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

wcbryant, I understand what you're trying to do, but I don't think this hack serves the purpose. (unless my interpretation is wrong, and mudpyr8 is closer to your question)

Quote:
One control that might be necessary is the ability to prohibit the use of a particular code in a signature. BBCodes are normally allowed in signatures, but someone who puts [power] into their sig, or [roll]50d1000[/roll] could generate a lot of server activity. If this isn't possible, the admin will just have to watch for such sigs, but it is important to note that. 100 people with factorials in their sigs is gonna be bad.
In the case you have a server-extensive function, it would. If you have the feature for not calling a function every time upon page refresh (although there is a bug right now where you must post in the WYSIWYG editor for this to apply) then it wouldn't be that big of a deal.

I will look into disabling it for signatures, as well fixing that bug, over the weekend.
Reply With Quote
  #23  
Old 04-01-2004, 09:18 AM
wcbryant wcbryant is offline
 
Join Date: Dec 2003
Location: Florida
Posts: 90
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Velocd
wcbryant, I understand what you're trying to do, but I don't think this hack serves the purpose. (unless my interpretation is wrong, and mudpyr8 is closer to your question)
My explanation was convoluted at best, but despite that I think you both understood. I've looked at the hack some more, and while I think it walks a line very near to what I want to do -- may even be able to function loosely in that capacity in the manner mudpyr8 suggested -- it's probably not the 'right' approach. Which might be somehow just adding a 'no text copy' flag to the Additional Options field when posting.

You can turn off 'email to a friend' or 'printer friendly format' in threads, all I want to be able to do is turn off user's ability to copy and paste. Disable text highlighting (not that I think the JS I found does that), and disable right clicking. Again, I understand people can always just view source, but my goal is the prevention of accidental leaks, rather than intentional/malicious ones.

Anyway, thanks to you both for the responses.
Reply With Quote
  #24  
Old 04-13-2004, 03:08 PM
mudpyr8's Avatar
mudpyr8 mudpyr8 is offline
 
Join Date: Mar 2004
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

VeloCD, thanks. I got it working and it is superb. A couple of things:

1. In your install notes, steps 49 & 50 refer to 'allowsmilie". It should be 'allowsmilies'.

2. It reevaluates on edit of the message. It would be nice if this could be disabled. For my dice roller, I only want it to roll once. Not a big deal since when rolling dice it is a faux pas to edit your post anyway.

3. It only accepts one instance of the code (the last one). If I put two [roll] tags in one message, it only evaluates the last one.

Again, thanks a lot. This rocks.
Reply With Quote
  #25  
Old 04-13-2004, 04:15 PM
Velocd's Avatar
Velocd Velocd is offline
 
Join Date: Mar 2002
Location: CA University
Posts: 1,696
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

1. Thanks, will correct.

2. If you are using the WYSIWYG editor and have the update option disabled, it shouldn't do so, since the return value of the function is hard-coded into the post. But, I haven't had time to look into making the update work for non-WYSIWYG.

3. That's odd. I'll check this out, although it should evaluate all tags. If you place two custom BB Code function tags that aren't your roll function, say maybe [random], does this generate two random values?
Reply With Quote
  #26  
Old 06-21-2004, 12:38 PM
Sven Sven is offline
 
Join Date: Oct 2001
Location: Neuss, Germany
Posts: 59
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have installed this hack so far since I was looking for something that enables me to use php functions in bbcodes...
But I'm fiddling around and it's not working....
Here's the function to include:
PHP Code:
<?php
// ###################### Start fetch_countdown_timer ###################### 
// returns the time left untill $dateline 
function fetch_countdown_timer($dateline) { 

    global 
$vboptions

    
$diff $dateline - (time() - $vboptions['hourdiff']); 

    
$days = ($diff - ($diff 86400)) / 86400
    
$diff $diff - ($days 86400); 
    
$hours = ($diff - ($diff 3600)) / 3600
    
$diff $diff - ($hours 3600); 
    
$minutes = ($diff - ($diff 60)) / 60
    
$diff $diff - ($minutes 60); 
    
$seconds = ($diff - ($diff 1)) / 1

    return 
iif($days 0$days.'d ''').iif("$hours > 0 && $days != 0"$hours.'h ''').$minutes.'m'


?>
Now I added a function like this:
Title: countdown
Handle: fetch_countdown_timer
Include File: countdown.php (containing above code)

Also I added a bbcode 'countdown' and have choosen the function in there....
It's just not working, what am I doing wrong?
As an example I used
[countdown]03, July 2004[/countdown] and the function returns something like -13h -40m instead of 11d and something....

How do I pass the date of interest to the function?
Reply With Quote
  #27  
Old 06-22-2004, 08:40 AM
Sven Sven is offline
 
Join Date: Oct 2001
Location: Neuss, Germany
Posts: 59
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

sorry for double posting but I didn't want to edit in case someone read my previous posting and wouldn't recognize this posting then.

I think I found out what's going wrong, it's because If I'm trying to pass a date it will be passed as Unix Timestamp.

Is there any way to pass the variable to the function as formatted date?
Reply With Quote
  #28  
Old 06-25-2004, 08:24 AM
Sven Sven is offline
 
Join Date: Oct 2001
Location: Neuss, Germany
Posts: 59
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

^bump^
Reply With Quote
  #29  
Old 07-15-2004, 03:36 AM
Wasser Wasser is offline
 
Join Date: Feb 2003
Location: yuba city, ca
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

it would be perfect to have a countdown timer intergrated with the calendar. =)
Reply With Quote
  #30  
Old 08-03-2004, 08:29 PM
KW802's Avatar
KW802 KW802 is offline
 
Join Date: Jul 2003
Location: A galaxy far, far away...
Posts: 1,450
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, I'm those of those guys that hated math classes in school.... besides the mathematical functions, what are some other uses that you guys have come up with?
Reply With Quote
  #31  
Old 09-12-2004, 07:40 PM
Borisch Borisch is offline
 
Join Date: Mar 2002
Location: Sweden
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

From the description...this hack is the King!
Installing and testing tomorrow.
Reply With Quote
Reply


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:30 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.04563 seconds
  • Memory Usage 2,324KB
  • Queries Executed 25 (?)
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
  • (2)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
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)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