[Scummvm-cvs-logs] SF.net SVN: scummvm:[40926] web/trunk/include/smarty

fredrik_w at users.sourceforge.net fredrik_w at users.sourceforge.net
Tue May 26 23:12:21 CEST 2009


Revision: 40926
          http://scummvm.svn.sourceforge.net/scummvm/?rev=40926&view=rev
Author:   fredrik_w
Date:     2009-05-26 21:12:21 +0000 (Tue, 26 May 2009)

Log Message:
-----------
Update Smarty; 2.6.22 -> 2.6.25.

Modified Paths:
--------------
    web/trunk/include/smarty/Config_File.class.php
    web/trunk/include/smarty/Smarty.class.php
    web/trunk/include/smarty/Smarty_Compiler.class.php
    web/trunk/include/smarty/plugins/function.math.php

Modified: web/trunk/include/smarty/Config_File.class.php
===================================================================
--- web/trunk/include/smarty/Config_File.class.php	2009-05-26 20:30:16 UTC (rev 40925)
+++ web/trunk/include/smarty/Config_File.class.php	2009-05-26 21:12:21 UTC (rev 40926)
@@ -22,7 +22,7 @@
  * smarty-discussion-subscribe at googlegroups.com 
  *
  * @link http://www.smarty.net/
- * @version 2.6.22
+ * @version 2.6.25
  * @copyright Copyright: 2001-2005 New Digital Group, Inc.
  * @author Andrei Zmievski <andrei at php.net>
  * @access public

Modified: web/trunk/include/smarty/Smarty.class.php
===================================================================
--- web/trunk/include/smarty/Smarty.class.php	2009-05-26 20:30:16 UTC (rev 40925)
+++ web/trunk/include/smarty/Smarty.class.php	2009-05-26 21:12:21 UTC (rev 40926)
@@ -27,7 +27,7 @@
  * @author Monte Ohrt <monte at ohrt dot com>
  * @author Andrei Zmievski <andrei at php.net>
  * @package Smarty
- * @version 2.6.22
+ * @version 2.6.25
  */
 
 /* $Id$ */
@@ -107,7 +107,7 @@
     /**
      * When set, smarty does uses this value as error_reporting-level.
      *
-     * @var boolean
+     * @var integer
      */
     var $error_reporting  =  null;
 
@@ -236,7 +236,8 @@
                                     'INCLUDE_ANY'     => false,
                                     'PHP_TAGS'        => false,
                                     'MODIFIER_FUNCS'  => array('count'),
-                                    'ALLOW_CONSTANTS'  => false
+                                    'ALLOW_CONSTANTS'  => false,
+                                    'ALLOW_SUPER_GLOBALS' => true
                                    );
 
     /**
@@ -464,7 +465,7 @@
      *
      * @var string
      */
-    var $_version              = '2.6.22';
+    var $_version              = '2.6.25';
 
     /**
      * current template inclusion depth
@@ -561,6 +562,14 @@
      */
     var $_cache_including = false;
 
+    /**
+     * array of super globals internally
+     *
+     * @var array
+     */
+    var $_supers = array();
+
+
     /**#@-*/
     /**
      * The class constructor.
@@ -569,6 +578,18 @@
     {
       $this->assign('SCRIPT_NAME', isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME']
                     : @$GLOBALS['HTTP_SERVER_VARS']['SCRIPT_NAME']);
+                    
+      $this->_supers['get'] = $this->request_use_auto_globals ? $_GET : $GLOBALS['HTTP_GET_VARS'];
+      $this->_supers['post'] = $this->request_use_auto_globals ? $_POST : $GLOBALS['HTTP_POST_VARS'];
+      $this->_supers['server'] = $this->request_use_auto_globals ? $_SERVER : $GLOBALS['HTTP_SERVER_VARS'];
+      if(isset($_SESSION))
+        $this->_supers['session'] = $this->request_use_auto_globals ? $_SESSION : $GLOBALS['HTTP_SESSION_VARS'];
+      else
+        $this->_supers['session'] = array();
+      $this->_supers['request'] = $this->request_use_auto_globals ? $_REQUEST : $GLOBALS['HTTP_REQUEST_VARS'];
+      $this->_supers['cookies'] = $this->request_use_auto_globals ? $_COOKIE : $GLOBALS['HTTP_COOKIE_VARS'];
+      $this->_supers['env'] = $this->request_use_auto_globals ? $_ENV : $GLOBALS['HTTP_ENV_VARS'];
+                    
     }
 
     /**
@@ -1548,7 +1569,7 @@
                         $params['source_content'] = $this->_read_file($_resource_name);
                     }
                     $params['resource_timestamp'] = filemtime($_resource_name);
-                    $_return = is_file($_resource_name);
+                    $_return = is_file($_resource_name) && is_readable($_resource_name);
                     break;
 
                 default:
@@ -1711,7 +1732,7 @@
      */
     function _read_file($filename)
     {
-        if ( file_exists($filename) && ($fd = @fopen($filename, 'rb')) ) {
+        if ( file_exists($filename) && is_readable($filename) && ($fd = @fopen($filename, 'rb')) ) {
             $contents = '';
             while (!feof($fd)) {
                 $contents .= fread($fd, 8192);
@@ -1950,7 +1971,7 @@
 			return $function;
 		}
 	}
-    
+  
     /**#@-*/
 
 }

Modified: web/trunk/include/smarty/Smarty_Compiler.class.php
===================================================================
--- web/trunk/include/smarty/Smarty_Compiler.class.php	2009-05-26 20:30:16 UTC (rev 40925)
+++ web/trunk/include/smarty/Smarty_Compiler.class.php	2009-05-26 21:12:21 UTC (rev 40926)
@@ -18,10 +18,10 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * @link http://www.smarty.net/
+ * @link http://smarty.php.net/
  * @author Monte Ohrt <monte at ohrt dot com>
  * @author Andrei Zmievski <andrei at php.net>
- * @version 2.6.22
+ * @version 2.6.25
  * @copyright 2001-2005 New Digital Group, Inc.
  * @package Smarty
  */
@@ -73,18 +73,13 @@
 
     var $_strip_depth           =   0;
     var $_additional_newline    =   "\n";
-    
-    var $_phpversion            =   0;
 
-
     /**#@-*/
     /**
      * The class constructor.
      */
     function Smarty_Compiler()
     {
-        $this->_phpversion = substr(phpversion(),0,1);
-
         // matches double quoted strings:
         // "foobar"
         // "foo\"bar"
@@ -157,20 +152,16 @@
         // $foo->bar($foo->bar)
         // $foo->bar($foo->bar())
         // $foo->bar($foo->bar($blah,$foo,44,"foo",$foo[0].bar))
-        // $foo->getBar()->getFoo()
-        // $foo->getBar()->foo
         $this->_obj_ext_regexp = '\->(?:\$?' . $this->_dvar_guts_regexp . ')';
         $this->_obj_restricted_param_regexp = '(?:'
-             . '(?:' . $this->_var_regexp . '|' . $this->_num_const_regexp . ')(?:' . $this->_obj_ext_regexp . '(?:\((?:(?:' . $this->_var_regexp . '|' . $this->_num_const_regexp . ')'
-             . '(?:\s*,\s*(?:' . $this->_var_regexp . '|' . $this->_num_const_regexp . '))*)?\))?)*)';
-
-       $this->_obj_single_param_regexp = '(?:\w+|' . $this->_obj_restricted_param_regexp . '(?:\s*,\s*(?:(?:\w+|'
+                . '(?:' . $this->_var_regexp . '|' . $this->_num_const_regexp . ')(?:' . $this->_obj_ext_regexp . '(?:\((?:(?:' . $this->_var_regexp . '|' . $this->_num_const_regexp . ')'
+                . '(?:\s*,\s*(?:' . $this->_var_regexp . '|' . $this->_num_const_regexp . '))*)?\))?)*)';
+        $this->_obj_single_param_regexp = '(?:\w+|' . $this->_obj_restricted_param_regexp . '(?:\s*,\s*(?:(?:\w+|'
                 . $this->_var_regexp . $this->_obj_restricted_param_regexp . ')))*)';
-
-       $this->_obj_params_regexp = '\((?:' . $this->_obj_single_param_regexp
+        $this->_obj_params_regexp = '\((?:' . $this->_obj_single_param_regexp
                 . '(?:\s*,\s*' . $this->_obj_single_param_regexp . ')*)?\)';
-       $this->_obj_start_regexp = '(?:' . $this->_dvar_regexp . '(?:' . $this->_obj_ext_regexp . ')+)';
-       $this->_obj_call_regexp = '(?:' . $this->_obj_start_regexp . '(?:' . $this->_obj_params_regexp . ')?(?:' . $this->_dvar_math_regexp . '(?:' . $this->_num_const_regexp . '|' . $this->_dvar_math_var_regexp . ')*)?)';
+        $this->_obj_start_regexp = '(?:' . $this->_dvar_regexp . '(?:' . $this->_obj_ext_regexp . ')+)';
+        $this->_obj_call_regexp = '(?:' . $this->_obj_start_regexp . '(?:' . $this->_obj_params_regexp . ')?(?:' . $this->_dvar_math_regexp . '(?:' . $this->_num_const_regexp . '|' . $this->_dvar_math_var_regexp . ')*)?)';
         
         // matches valid modifier syntax:
         // |foo
@@ -1705,8 +1696,6 @@
         }
         // replace double quoted literal string with single quotes
         $_return = preg_replace('~^"([\s\w]+)"$~',"'\\1'",$_return);
-        // escape dollar sign if not printing a var
-        $_return = preg_replace('~\$(\W)~',"\\\\\$\\1",$_return);
         return $_return;
     }
 
@@ -1720,7 +1709,6 @@
     function _parse_var($var_expr)
     {
         $_has_math = false;
-        $_has_php4_method_chaining = false;
         $_math_vars = preg_split('~('.$this->_dvar_math_regexp.'|'.$this->_qstr_regexp.')~', $var_expr, -1, PREG_SPLIT_DELIM_CAPTURE);
 
         if(count($_math_vars) > 1) {
@@ -1833,10 +1821,6 @@
                             $_output .= '->{(($_var=$this->_tpl_vars[\''.substr($_index,3).'\']) && substr($_var,0,2)!=\'__\') ? $_var : $this->trigger_error("cannot access property \\"$_var\\"")}';
                         }
                     } else {
-                       if ($this->_phpversion < 5) {
-                         $_has_php4_method_chaining = true;
-                         $_output .= "; \$_foo = \$_foo";
-                       }
                         $_output .= $_index;
                     }
                 } elseif (substr($_index, 0, 1) == '(') {
@@ -1848,12 +1832,7 @@
             }
         }
 
-        if ($_has_php4_method_chaining) {
-           $_tmp = str_replace("'","\'",'$_foo = '.$_output.'; return $_foo;');
-           return "eval('".$_tmp."')";
-        } else {
-           return $_output; 
-        }
+        return $_output;
     }
 
     /**
@@ -2068,27 +2047,27 @@
                 break;
 
             case 'get':
-                $compiled_ref = ($this->request_use_auto_globals) ? '$_GET' : "\$GLOBALS['HTTP_GET_VARS']";
+                $compiled_ref = "\$this->_supers['get']";
                 break;
 
             case 'post':
-                $compiled_ref = ($this->request_use_auto_globals) ? '$_POST' : "\$GLOBALS['HTTP_POST_VARS']";
+                $compiled_ref = "\$this->_supers['post']";
                 break;
 
             case 'cookies':
-                $compiled_ref = ($this->request_use_auto_globals) ? '$_COOKIE' : "\$GLOBALS['HTTP_COOKIE_VARS']";
+                $compiled_ref = "\$this->_supers['cookies']";
                 break;
 
             case 'env':
-                $compiled_ref = ($this->request_use_auto_globals) ? '$_ENV' : "\$GLOBALS['HTTP_ENV_VARS']";
+                $compiled_ref = "\$this->_supers['env']";
                 break;
 
             case 'server':
-                $compiled_ref = ($this->request_use_auto_globals) ? '$_SERVER' : "\$GLOBALS['HTTP_SERVER_VARS']";
+                $compiled_ref = "\$this->_supers['server']";
                 break;
 
             case 'session':
-                $compiled_ref = ($this->request_use_auto_globals) ? '$_SESSION' : "\$GLOBALS['HTTP_SESSION_VARS']";
+                $compiled_ref = "\$this->_supers['session']";
                 break;
 
             /*
@@ -2097,7 +2076,7 @@
              */
             case 'request':
                 if ($this->request_use_auto_globals) {
-                    $compiled_ref = '$_REQUEST';
+                    $compiled_ref = "\$this->_supers['request']";
                     break;
                 } else {
                     $this->_init_smarty_vars = true;

Modified: web/trunk/include/smarty/plugins/function.math.php
===================================================================
--- web/trunk/include/smarty/plugins/function.math.php	2009-05-26 20:30:16 UTC (rev 40925)
+++ web/trunk/include/smarty/plugins/function.math.php	2009-05-26 21:12:21 UTC (rev 40926)
@@ -27,7 +27,8 @@
         return;
     }
 
-    $equation = $params['equation'];
+    // strip out backticks, not necessary for math
+    $equation = str_replace('`','',$params['equation']);
 
     // make sure parenthesis are balanced
     if (substr_count($equation,"(") != substr_count($equation,")")) {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list