From 7ca31fe1c79584fa733fa9489676161ec9b58735 Mon Sep 17 00:00:00 2001 From: messju Date: Wed, 30 Mar 2005 21:30:53 +0000 Subject: [PATCH] re-enabled hex-constant. i hope in a sane way this time. --- libs/plugins/function.math.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/plugins/function.math.php b/libs/plugins/function.math.php index f3ac3d4b..04391077 100644 --- a/libs/plugins/function.math.php +++ b/libs/plugins/function.math.php @@ -35,12 +35,12 @@ function smarty_function_math($params, &$smarty) } // 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-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 (!in_array($curr_var,array_keys($params)) && !in_array($curr_var, $allowed_funcs)) { + 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; }