mirror of
https://github.com/smarty-php/smarty.git
synced 2025-10-07 17:54:38 +02:00
commit 3.1 into the trunk
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user