Version: 1.00, by Brad
Developer Last Online: Nov 2023
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:
// 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.
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.
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:
// 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
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.