Upgraded to latest version of Smarty 2.6.9

This commit is contained in:
thepurpleblob
2005-04-19 09:52:16 +00:00
parent f55a672eea
commit c38950b11b
49 changed files with 678 additions and 510 deletions

View File

@ -9,9 +9,9 @@
/**
* Smarty {math} function plugin
*
* Type: function<br />
* Name: math<br />
* Purpose: handle math computations in template<br />
* Type: function<br>
* Name: math<br>
* Purpose: handle math computations in template<br>
* @link http://smarty.php.net/manual/en/language.function.math.php {math}
* (Smarty online manual)
* @param array
@ -35,12 +35,13 @@ function smarty_function_math($params, &$smarty)
}
// match all vars in equation, make sure all are passed
preg_match_all("!\!(0x)([a-zA-Z][a-zA-Z0-9_]*)!",$equation, $match);
preg_match_all("!(?:0x[a-fA-F0-9]+)|([a-zA-Z][a-zA-Z0-9_]+)!",$equation, $match);
$allowed_funcs = array('int','abs','ceil','cos','exp','floor','log','log10',
'max','min','pi','pow','rand','round','sin','sqrt','srand','tan');
foreach($match[2] as $curr_var) {
if (!in_array($curr_var,array_keys($params)) && !in_array($curr_var, $allowed_funcs)) {
$smarty->trigger_error("math: parameter $curr_var not passed as argument");
foreach($match[1] as $curr_var) {
if ($curr_var && !in_array($curr_var, array_keys($params)) && !in_array($curr_var, $allowed_funcs)) {
$smarty->trigger_error("math: function call $curr_var not allowed");
return;
}
}