diff --git a/gosa-core/include/smarty/plugins/function.math.php b/gosa-core/include/smarty/plugins/function.math.php
index d7ac9f8f0e5faf96414819df601f59e479e49629..cd90020a43d0850363041444f9fa19e736fadc01 100644 (file)
* @subpackage PluginsFunction
*/
-
/**
* Smarty {math} function plugin
*
* (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
* @param array $params parameters
- * @param object $smarty Smarty object
* @param object $template template object
* @return string|null
*/
-function smarty_function_math($params, $smarty, $template)
+function smarty_function_math($params, $template)
{
// be sure equation parameter is present
if (empty($params['equation'])) {
}
// match all vars in equation, make sure all are passed
- preg_match_all("!(?:0x[a-fA-F0-9]+)|([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');
$equation = preg_replace("/\b$key\b/", " \$params['$key'] ", $equation);
}
}
-
+ $smarty_math_result = null;
eval("\$smarty_math_result = ".$equation.";");
if (empty($params['format'])) {
}
}
}
-?>
+
+?>
\ No newline at end of file