diff options
Diffstat (limited to 'libs/plugins/function.math.php')
| -rw-r--r-- | libs/plugins/function.math.php | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/libs/plugins/function.math.php b/libs/plugins/function.math.php index cd90020a..cdbe6d61 100644 --- a/libs/plugins/function.math.php +++ b/libs/plugins/function.math.php @@ -12,12 +12,13 @@ * * 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} + * Purpose: handle math computations in template + * + * @link http://www.smarty.net/manual/en/language.function.math.php {math} * (Smarty online manual) * @author Monte Ohrt <monte at ohrt dot com> - * @param array $params parameters - * @param object $template template object + * @param array $params parameters + * @param Smarty_Internal_Template $template template object * @return string|null */ function smarty_function_math($params, $template) @@ -40,7 +41,7 @@ function smarty_function_math($params, $template) 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[1] as $curr_var) { if ($curr_var && !in_array($curr_var, array_keys($params)) && !in_array($curr_var, $allowed_funcs)) { trigger_error("math: function call $curr_var not allowed",E_USER_WARNING); |
