Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorvipsoft <vipsoft@59fd770c-687e-43c8-a1e3-f5a4ff64c105>2009-05-21 20:29:52 +0400
committervipsoft <vipsoft@59fd770c-687e-43c8-a1e3-f5a4ff64c105>2009-05-21 20:29:52 +0400
commit98dbb5f4ceb01083b063bf2157a0e979feba6533 (patch)
treea263573f2ebc7a624534be264ef09bc6a1ca9659 /libs
parenta010d5f1e2524c808892bea22b7d1e4c12cb8e80 (diff)
fixes #721 - update to Smarty 2.6.24
Diffstat (limited to 'libs')
-rwxr-xr-xlibs/Smarty/Config_File.class.php2
-rwxr-xr-xlibs/Smarty/Smarty.class.php40
-rwxr-xr-xlibs/Smarty/Smarty_Compiler.class.php53
-rwxr-xr-xlibs/Smarty/debug.tpl2
-rwxr-xr-xlibs/Smarty/internals/core.write_file.php2
-rwxr-xr-xlibs/Smarty/plugins/function.math.php3
-rwxr-xr-xlibs/Smarty/plugins/modifier.escape.php3
7 files changed, 50 insertions, 55 deletions
diff --git a/libs/Smarty/Config_File.class.php b/libs/Smarty/Config_File.class.php
index 83c1708887..b8667209e9 100755
--- a/libs/Smarty/Config_File.class.php
+++ b/libs/Smarty/Config_File.class.php
@@ -22,7 +22,7 @@
* smarty-discussion-subscribe@googlegroups.com
*
* @link http://www.smarty.net/
- * @version 2.6.22
+ * @version 2.6.24
* @copyright Copyright: 2001-2005 New Digital Group, Inc.
* @author Andrei Zmievski <andrei@php.net>
* @access public
diff --git a/libs/Smarty/Smarty.class.php b/libs/Smarty/Smarty.class.php
index 4a3a7cde2c..6d3e3e7c13 100755
--- a/libs/Smarty/Smarty.class.php
+++ b/libs/Smarty/Smarty.class.php
@@ -27,7 +27,7 @@
* @author Monte Ohrt <monte at ohrt dot com>
* @author Andrei Zmievski <andrei@php.net>
* @package Smarty
- * @version 2.6.22
+ * @version 2.6.24
*/
/* $Id$ */
@@ -236,7 +236,8 @@ class Smarty
'INCLUDE_ANY' => false,
'PHP_TAGS' => false,
'MODIFIER_FUNCS' => array('count'),
- 'ALLOW_CONSTANTS' => false
+ 'ALLOW_CONSTANTS' => false,
+ 'ALLOW_SUPER_GLOBALS' => true
);
/**
@@ -464,7 +465,7 @@ class Smarty
*
* @var string
*/
- var $_version = '2.6.22';
+ var $_version = '2.6.24';
/**
* current template inclusion depth
@@ -561,6 +562,14 @@ class Smarty
*/
var $_cache_including = false;
+ /**
+ * array of super globals internally
+ *
+ * @var array
+ */
+ var $_supers = array();
+
+
/**#@-*/
/**
* The class constructor.
@@ -569,6 +578,15 @@ class Smarty
{
$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'];
+ $this->_supers['session'] = $this->request_use_auto_globals ? $_SESSION : $GLOBALS['HTTP_SESSION_VARS'];
+ $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'];
+
}
/**
@@ -1117,10 +1135,8 @@ class Smarty
{
static $_cache_info = array();
-/*begin piwik
$_smarty_old_error_level = $this->debugging ? error_reporting() : error_reporting(isset($this->error_reporting)
? $this->error_reporting : error_reporting() & ~E_NOTICE);
- end piwik*/
if (!$this->debugging && $this->debugging_ctrl == 'URL') {
$_query_string = $this->request_use_auto_globals ? $_SERVER['QUERY_STRING'] : $GLOBALS['HTTP_SERVER_VARS']['QUERY_STRING'];
@@ -1217,12 +1233,12 @@ class Smarty
} else {
echo $_smarty_results;
}
-// error_reporting($_smarty_old_error_level); // piwik
+ error_reporting($_smarty_old_error_level);
// restore initial cache_info
$this->_cache_info = array_pop($_cache_info);
return true;
} else {
-// error_reporting($_smarty_old_error_level); // piwik
+ error_reporting($_smarty_old_error_level);
// restore initial cache_info
$this->_cache_info = array_pop($_cache_info);
return $_smarty_results;
@@ -1302,10 +1318,10 @@ class Smarty
require_once(SMARTY_CORE_DIR . 'core.display_debug_console.php');
echo smarty_core_display_debug_console($_params, $this);
}
-// error_reporting($_smarty_old_error_level); // piwik
+ error_reporting($_smarty_old_error_level);
return;
} else {
-// error_reporting($_smarty_old_error_level); // piwik
+ error_reporting($_smarty_old_error_level);
if (isset($_smarty_results)) { return $_smarty_results; }
}
}
@@ -1550,7 +1566,7 @@ class Smarty
$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:
@@ -1713,7 +1729,7 @@ class Smarty
*/
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);
@@ -1952,7 +1968,7 @@ class Smarty
return $function;
}
}
-
+
/**#@-*/
}
diff --git a/libs/Smarty/Smarty_Compiler.class.php b/libs/Smarty/Smarty_Compiler.class.php
index 408f294ade..44fbb73f1c 100755
--- a/libs/Smarty/Smarty_Compiler.class.php
+++ b/libs/Smarty/Smarty_Compiler.class.php
@@ -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@php.net>
- * @version 2.6.22
+ * @version 2.6.24
* @copyright 2001-2005 New Digital Group, Inc.
* @package Smarty
*/
@@ -73,9 +73,6 @@ class Smarty_Compiler extends Smarty {
var $_strip_depth = 0;
var $_additional_newline = "\n";
-
- var $_phpversion = 0;
-
/**#@-*/
/**
@@ -83,8 +80,6 @@ class Smarty_Compiler extends Smarty {
*/
function Smarty_Compiler()
{
- $this->_phpversion = substr(phpversion(),0,1);
-
// matches double quoted strings:
// "foobar"
// "foo\"bar"
@@ -157,20 +152,16 @@ class Smarty_Compiler extends Smarty {
// $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 @@ class Smarty_Compiler extends Smarty {
}
// 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 @@ class Smarty_Compiler extends Smarty {
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 @@ class Smarty_Compiler extends Smarty {
$_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 @@ class Smarty_Compiler extends Smarty {
}
}
- if ($_has_php4_method_chaining) {
- $_tmp = str_replace("'","\'",'$_foo = '.$_output.'; return $_foo;');
- return "eval('".$_tmp."')";
- } else {
- return $_output;
- }
+ return $_output;
}
/**
@@ -2068,27 +2047,27 @@ class Smarty_Compiler extends Smarty {
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 @@ class Smarty_Compiler extends Smarty {
*/
case 'request':
if ($this->request_use_auto_globals) {
- $compiled_ref = '$_REQUEST';
+ $compiled_ref = "\$this->_supers['request']";
break;
} else {
$this->_init_smarty_vars = true;
diff --git a/libs/Smarty/debug.tpl b/libs/Smarty/debug.tpl
index 06c88e7964..c05ef5d0b5 100755
--- a/libs/Smarty/debug.tpl
+++ b/libs/Smarty/debug.tpl
@@ -154,4 +154,4 @@ td {
_smarty_console.document.close();
// ]]>
</script>
-{/if}
+{/if} \ No newline at end of file
diff --git a/libs/Smarty/internals/core.write_file.php b/libs/Smarty/internals/core.write_file.php
index 2a5f24fd87..8a3a3b3984 100755
--- a/libs/Smarty/internals/core.write_file.php
+++ b/libs/Smarty/internals/core.write_file.php
@@ -51,4 +51,4 @@ function smarty_core_write_file($params, &$smarty)
/* vim: set expandtab: */
-?>
+?> \ No newline at end of file
diff --git a/libs/Smarty/plugins/function.math.php b/libs/Smarty/plugins/function.math.php
index 71672fea41..bb78dac22c 100755
--- a/libs/Smarty/plugins/function.math.php
+++ b/libs/Smarty/plugins/function.math.php
@@ -27,7 +27,8 @@ function smarty_function_math($params, &$smarty)
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,")")) {
diff --git a/libs/Smarty/plugins/modifier.escape.php b/libs/Smarty/plugins/modifier.escape.php
index 9108ef6612..a2f52b232c 100755
--- a/libs/Smarty/plugins/modifier.escape.php
+++ b/libs/Smarty/plugins/modifier.escape.php
@@ -62,8 +62,7 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = 'ISO-88
case 'javascript':
// escape quotes and backslashes, newlines, etc.
-// return strtr($string, array('\\'=>'\\\\',"'"=>"\\'",'"'=>'\\"',"\r"=>'\\r',"\n"=>'\\n','</'=>'<\/'));
- return strtr($string, array('\\'=>'\\\\',"'"=>"\\'",'"'=>'\\"',"\r"=>'\\r',"\n"=>'\\n','</'=>'<\/','script'=>"sc'+'ript")); // piwik
+ return strtr($string, array('\\'=>'\\\\',"'"=>"\\'",'"'=>'\\"',"\r"=>'\\r',"\n"=>'\\n','</'=>'<\/'));
case 'mail':
// safe way to display e-mail address on a web page