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
Disable conditional function filters Details »»
Disable conditional function filters
Version: 1.00, by Brad Brad is offline
Developer Last Online: Nov 2023 Show Printable Version Email this Page

Version: 3.0.3 Rating:
Released: 08-02-2004 Last Update: Never Installs: 5
Re-useable Code Translations  
No support by the author.

This hack will allow you to by-pass the function filters built into the template conditional's. Currently you are restricted to the following functions:

PHP Code:
        $safe_functions = array(
            
// logical stuff
            
=> 'and',              // logical and
            
=> 'or',               // logical or
            
=> 'xor',              // logical xor

            // built-in variable checking functions
            
'in_array',              // used for checking
            
'is_array',              // used for checking
            
'is_numeric',            // used for checking
            
'isset',                 // used for checking
            
'empty',                 // used for checking
            
'defined',               // used for checking
            
'array',                 // used for checking

            // vBulletin-defined functions
            
'can_moderate',          // obvious one
            
'can_moderate_calendar'// another obvious one
            
'exec_switch_bg',        // harmless function that we use sometimes
            
'is_browser',            // function to detect browser and versions
            
'is_member_of',          // function to check if $user is member of $usergroupid
        
); 
With this hack installed you will be allowed to use ANY avaiable php or vBulletin defined function within your templates. I have also included a on/off switch that allows you to disable filtering via config.php.

PHP Code:
// filtering off
define('C_PASSTHRU'false);

// filtering on
define('C_PASSTHRU'true); 

This hack is ment to be used on test boards for functionality testing, do not run it in production enviroments.

Show Your Support

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

Comments
  #2  
Old 08-03-2004, 10:05 AM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

mm coolies

/me runs off to test
Reply With Quote
  #3  
Old 08-03-2004, 10:13 AM
nexialys
Guest
 
Posts: n/a
Default

i'm not sure to understand here... do you have a patent example before i put this in ?
Reply With Quote
  #4  
Old 08-03-2004, 10:15 AM
Brad Brad is offline
 
Join Date: Nov 2001
Posts: 4,765
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by nexialys
i'm not sure to understand here... do you have a patent example before i put this in ?
It just allows you to pass anything via the templates to be prased into php code, use it for some form of checking that you can not currently to with allowed functions. I use it to quickly do some dirty checking in the templates when I build hacks, later on I go back and put the logic into the php code.

This is just something to make it a little eaiser on developers, I found it to save some time while developing with vBulletin on local test copies.
Reply With Quote
  #5  
Old 08-03-2004, 10:17 AM
nexialys
Guest
 
Posts: n/a
Default

ok then... (i never code inside the templates, i prefer directly into files, so anyway...)
Reply With Quote
  #6  
Old 08-03-2004, 10:27 AM
Brad Brad is offline
 
Join Date: Nov 2001
Posts: 4,765
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Checking with the templates has its benifits in some cases, lets say I created some new functions to be used to display differing html inside forums depending on what the forumid is.

So lets asume I have two functions i've inserted into functions.php:

PHP Code:
// returns list of forumid's
fetch_forumids()
{
       
$forumids '1,2,3';
       return 
$forumids;
}

// Match current forumid to list of ids
match_forums($forumid)
{
    eval(
'$var = in_array($forumid, array(' fetch_forumids() . '));');
    return 
$var;

So with these functions I wan't to code my template like this:
HTML Code:
<if conditional="match_forums($forumid)">
// do special forum display here
<else />
// do normal forum display here
</if>
With filtering on I have to edit this block in adminfunctions_template.php everytime I want to use a new function in the templates:

PHP Code:
 $safe_functions = array(
            
// logical stuff
            
=> 'and',              // logical and
            
=> 'or',               // logical or
            
=> 'xor',              // logical xor

            // built-in variable checking functions
            
'in_array',              // used for checking
            
'is_array',              // used for checking
            
'is_numeric',            // used for checking
            
'isset',                 // used for checking
            
'empty',                 // used for checking
            
'defined',               // used for checking
            
'array',                 // used for checking

            // vBulletin-defined functions
            
'can_moderate',          // obvious one
            
'can_moderate_calendar'// another obvious one
            
'exec_switch_bg',        // harmless function that we use sometimes
            
'is_browser',            // function to detect browser and versions
            
'is_member_of',          // function to check if $user is member of $usergroupid
        
); 
If you are like me your code is changing all the time, keeping this block up to date in the development phase gets old fast
Reply With Quote
  #7  
Old 08-03-2004, 10:50 AM
CarCdr CarCdr is offline
 
Join Date: Apr 2004
Posts: 242
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nice.

Unless there are cases where the user can inject code, the default should be less restrictive. It is very handy to have more power on the template side.
Reply With Quote
  #8  
Old 08-03-2004, 11:01 AM
Natch's Avatar
Natch Natch is offline
 
Join Date: Nov 2002
Location: Australia
Posts: 851
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Excellent work - what a great thought!
Reply With Quote
  #9  
Old 08-03-2004, 12:21 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It's so simple and i didn't come across the idea myself. ^^
Reply With Quote
  #10  
Old 08-04-2004, 06:17 PM
Aurous Aurous is offline
 
Join Date: Apr 2004
Posts: 138
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Excellent stuff Brad!! Will be using it from now on.
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 07:38 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.05103 seconds
  • Memory Usage 2,316KB
  • 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_html
  • (4)bbcode_php
  • (1)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
  • (1)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
  • (8)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