commit 3.1 into the trunk

This commit is contained in:
monte.ohrt
2011-09-16 14:19:56 +00:00
parent 5693de91f5
commit 8842e79107
136 changed files with 14349 additions and 7805 deletions

View File

@@ -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);