cvs: smarty /libs/plugins function.math.php

"Messju Mohr" <[email protected]>
Newsgroups gmane.comp.php.cvs.smarty
Message-ID <cvsmessju1112218254@cvsserver>
messju		Wed Mar 30 16:30:54 2005 EDT

  Modified files:              
    /smarty/libs/plugins	function.math.php 
  Log:
  re-enabled hex-constant. i hope in a sane way this time.
  
  
  
http://cvs.php.net/diff.php/smarty/libs/plugins/function.math.php?r1=1.8&r2=1.9&ty=u
Index: smarty/libs/plugins/function.math.php
diff -u smarty/libs/plugins/function.math.php:1.8 smarty/libs/plugins/function.math.php:1.9
--- smarty/libs/plugins/function.math.php:1.8	Wed Mar 30 12:03:43 2005
+++ smarty/libs/plugins/function.math.php	Wed Mar 30 16:30:53 2005
@@ -35,12 +35,12 @@
     }
 
     // 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;
         }

-- 
Smarty CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.