mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
enabled hex-constants in function.math.php
This commit is contained in:
1
NEWS
1
NEWS
@@ -1,3 +1,4 @@
|
|||||||
|
- enabled hex-constants in function.math.php (messju)
|
||||||
- enabled hex-constants (0x...) as function-attributes, inside if-statements
|
- enabled hex-constants (0x...) as function-attributes, inside if-statements
|
||||||
and as modifier-parameters (messju)
|
and as modifier-parameters (messju)
|
||||||
- fixed bug with passing $smarty as reference in Smarty.compiler.class
|
- fixed bug with passing $smarty as reference in Smarty.compiler.class
|
||||||
|
@@ -25,11 +25,10 @@ function smarty_function_math($params, &$smarty)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// match all vars in equation, make sure all are passed
|
// match all vars in equation, make sure all are passed
|
||||||
preg_match_all("![a-zA-Z][a-zA-Z0-9_]*!",$equation, $match);
|
preg_match_all("!\!(0x)([a-zA-Z][a-zA-Z0-9_]*)!",$equation, $match);
|
||||||
$allowed_funcs = array('int','abs','ceil','cos','exp','floor','log','log10',
|
$allowed_funcs = array('int','abs','ceil','cos','exp','floor','log','log10',
|
||||||
'max','min','pi','pow','rand','round','sin','sqrt','srand','tan');
|
'max','min','pi','pow','rand','round','sin','sqrt','srand','tan');
|
||||||
|
foreach($match[2] as $curr_var) {
|
||||||
foreach($match[0] as $curr_var) {
|
|
||||||
if (!in_array($curr_var,array_keys($params)) && !in_array($curr_var, $allowed_funcs)) {
|
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");
|
$smarty->trigger_error("math: parameter $curr_var not passed as argument");
|
||||||
return;
|
return;
|
||||||
|
Reference in New Issue
Block a user