mirror of
https://github.com/smarty-php/smarty.git
synced 2026-08-04 04:24:18 +02:00
Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0ecdd6c41d | |||
| a4ff415bfa | |||
| 9a36601dad | |||
| 1594e08924 | |||
| ad3e64b890 | |||
| 8bcad8125a | |||
| 4129665748 | |||
| bbe4890b89 | |||
| b67c7082a7 | |||
| 7dc58993ad | |||
| fc60543d80 | |||
| d88df01d7d | |||
| a2e69a04e7 | |||
| abf692eaf7 | |||
| 7d42f5efb9 | |||
| 5d2ed61c31 | |||
| 29fefe388c | |||
| 243531e4a3 | |||
| 443e36f1a8 | |||
| c1bf89849b | |||
| 4014a41c02 | |||
| 3bdad9eaeb | |||
| 42696fcc21 | |||
| 8189261d68 | |||
| 49e154a6f9 |
@@ -1,3 +1,21 @@
|
||||
2013-09-30
|
||||
|
||||
* Fixed old vulnerability bug https://bugs.gentoo.org/show_bug.cgi?id=356615
|
||||
|
||||
2013-07-16 Uwe Tews
|
||||
|
||||
* Fixed made Smarty_Compiler.class.php compatible with PHP 5.5
|
||||
|
||||
|
||||
2012-09-24 Uwe Tews
|
||||
|
||||
* Fixed escape Smarty error messages to avoid possible script execution
|
||||
|
||||
|
||||
2010-04-17 Uwe Tews
|
||||
|
||||
* Fixed security hole in {math} plugin
|
||||
|
||||
2007-09-27 TAKAGI Masahiro <matakagi@gmail.com>
|
||||
|
||||
* docs/ja/designers/language-custom-functions/language-function-html-checkboxes.xml:
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
- revert super global access changes, and instead rely on
|
||||
USE_SUPER_GLOBALS for security
|
||||
|
||||
Version 2.6.25 (May 19th, 2009)
|
||||
-------------------------------
|
||||
- fix E_NOTICE when sessions are disabled (mohrt)
|
||||
|
||||
+8
-27
@@ -20,7 +20,7 @@
|
||||
*
|
||||
* For questions, help, comments, discussion, etc., please join the
|
||||
* Smarty mailing list. Send a blank e-mail to
|
||||
* smarty-discussion-subscribe@googlegroups.com
|
||||
* smarty-discussion-subscribe@googlegroups.com
|
||||
*
|
||||
* @link http://www.smarty.net/
|
||||
* @copyright 2001-2005 New Digital Group, Inc.
|
||||
@@ -562,14 +562,6 @@ class Smarty
|
||||
*/
|
||||
var $_cache_including = false;
|
||||
|
||||
/**
|
||||
* array of super globals internally
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
var $_supers = array();
|
||||
|
||||
|
||||
/**#@-*/
|
||||
/**
|
||||
* The class constructor.
|
||||
@@ -578,18 +570,6 @@ 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'];
|
||||
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'];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1078,7 +1058,7 @@ class Smarty
|
||||
} else {
|
||||
// var non-existant, return valid reference
|
||||
$_tmp = null;
|
||||
return $_tmp;
|
||||
return $_tmp;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1110,7 +1090,8 @@ class Smarty
|
||||
*/
|
||||
function trigger_error($error_msg, $error_type = E_USER_WARNING)
|
||||
{
|
||||
trigger_error("Smarty error: $error_msg", $error_type);
|
||||
$msg = htmlentities($error_msg);
|
||||
trigger_error("Smarty error: $msg", $error_type);
|
||||
}
|
||||
|
||||
|
||||
@@ -1137,7 +1118,7 @@ class Smarty
|
||||
function fetch($resource_name, $cache_id = null, $compile_id = null, $display = false)
|
||||
{
|
||||
static $_cache_info = array();
|
||||
|
||||
|
||||
$_smarty_old_error_level = $this->debugging ? error_reporting() : error_reporting(isset($this->error_reporting)
|
||||
? $this->error_reporting : error_reporting() & ~E_NOTICE);
|
||||
|
||||
@@ -1953,10 +1934,10 @@ class Smarty
|
||||
{
|
||||
return eval($code);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Extracts the filter name from the given callback
|
||||
*
|
||||
*
|
||||
* @param callback $function
|
||||
* @return string
|
||||
*/
|
||||
@@ -1971,7 +1952,7 @@ class Smarty
|
||||
return $function;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**#@-*/
|
||||
|
||||
}
|
||||
|
||||
@@ -262,11 +262,11 @@ class Smarty_Compiler extends Smarty {
|
||||
reset($this->_folded_blocks);
|
||||
|
||||
/* replace special blocks by "{php}" */
|
||||
$source_content = preg_replace($search.'e', "'"
|
||||
$source_content = preg_replace_callback($search, create_function ('$matches', "return '"
|
||||
. $this->_quote_replace($this->left_delimiter) . 'php'
|
||||
. "' . str_repeat(\"\n\", substr_count('\\0', \"\n\")) .'"
|
||||
. "' . str_repeat(\"\n\", substr_count('\$matches[1]', \"\n\")) .'"
|
||||
. $this->_quote_replace($this->right_delimiter)
|
||||
. "'"
|
||||
. "';")
|
||||
, $source_content);
|
||||
|
||||
/* Gather all template tags. */
|
||||
@@ -2047,27 +2047,57 @@ class Smarty_Compiler extends Smarty {
|
||||
break;
|
||||
|
||||
case 'get':
|
||||
$compiled_ref = "\$this->_supers['get']";
|
||||
if ($this->security && !$this->security_settings['ALLOW_SUPER_GLOBALS']) {
|
||||
$this->_syntax_error("(secure mode) super global access not permitted",
|
||||
E_USER_WARNING, __FILE__, __LINE__);
|
||||
return;
|
||||
}
|
||||
$compiled_ref = "\$_GET";
|
||||
break;
|
||||
|
||||
case 'post':
|
||||
$compiled_ref = "\$this->_supers['post']";
|
||||
if ($this->security && !$this->security_settings['ALLOW_SUPER_GLOBALS']) {
|
||||
$this->_syntax_error("(secure mode) super global access not permitted",
|
||||
E_USER_WARNING, __FILE__, __LINE__);
|
||||
return;
|
||||
}
|
||||
$compiled_ref = "\$_POST";
|
||||
break;
|
||||
|
||||
case 'cookies':
|
||||
$compiled_ref = "\$this->_supers['cookies']";
|
||||
if ($this->security && !$this->security_settings['ALLOW_SUPER_GLOBALS']) {
|
||||
$this->_syntax_error("(secure mode) super global access not permitted",
|
||||
E_USER_WARNING, __FILE__, __LINE__);
|
||||
return;
|
||||
}
|
||||
$compiled_ref = "\$_COOKIE";
|
||||
break;
|
||||
|
||||
case 'env':
|
||||
$compiled_ref = "\$this->_supers['env']";
|
||||
if ($this->security && !$this->security_settings['ALLOW_SUPER_GLOBALS']) {
|
||||
$this->_syntax_error("(secure mode) super global access not permitted",
|
||||
E_USER_WARNING, __FILE__, __LINE__);
|
||||
return;
|
||||
}
|
||||
$compiled_ref = "\$_ENV";
|
||||
break;
|
||||
|
||||
case 'server':
|
||||
$compiled_ref = "\$this->_supers['server']";
|
||||
if ($this->security && !$this->security_settings['ALLOW_SUPER_GLOBALS']) {
|
||||
$this->_syntax_error("(secure mode) super global access not permitted",
|
||||
E_USER_WARNING, __FILE__, __LINE__);
|
||||
return;
|
||||
}
|
||||
$compiled_ref = "\$_SERVER";
|
||||
break;
|
||||
|
||||
case 'session':
|
||||
$compiled_ref = "\$this->_supers['session']";
|
||||
if ($this->security && !$this->security_settings['ALLOW_SUPER_GLOBALS']) {
|
||||
$this->_syntax_error("(secure mode) super global access not permitted",
|
||||
E_USER_WARNING, __FILE__, __LINE__);
|
||||
return;
|
||||
}
|
||||
$compiled_ref = "\$_SESSION";
|
||||
break;
|
||||
|
||||
/*
|
||||
@@ -2075,8 +2105,13 @@ class Smarty_Compiler extends Smarty {
|
||||
* compiler.
|
||||
*/
|
||||
case 'request':
|
||||
if ($this->security && !$this->security_settings['ALLOW_SUPER_GLOBALS']) {
|
||||
$this->_syntax_error("(secure mode) super global access not permitted",
|
||||
E_USER_WARNING, __FILE__, __LINE__);
|
||||
return;
|
||||
}
|
||||
if ($this->request_use_auto_globals) {
|
||||
$compiled_ref = "\$this->_supers['request']";
|
||||
$compiled_ref = "\$_REQUEST";
|
||||
break;
|
||||
} else {
|
||||
$this->_init_smarty_vars = true;
|
||||
@@ -2087,7 +2122,7 @@ class Smarty_Compiler extends Smarty {
|
||||
return null;
|
||||
|
||||
case 'template':
|
||||
$compiled_ref = "'$this->_current_file'";
|
||||
$compiled_ref = "'" . addslashes($this->_current_file) . "'";
|
||||
$_max_index = 1;
|
||||
break;
|
||||
|
||||
|
||||
@@ -63,7 +63,11 @@ function smarty_function_cycle($params, &$smarty)
|
||||
$cycle_vars[$name]['values'] = $params['values'];
|
||||
}
|
||||
|
||||
$cycle_vars[$name]['delimiter'] = (isset($params['delimiter'])) ? $params['delimiter'] : ',';
|
||||
if (isset($params['delimiter'])) {
|
||||
$cycle_vars[$name]['delimiter'] = $params['delimiter'];
|
||||
} elseif (!isset($cycle_vars[$name]['delimiter'])) {
|
||||
$cycle_vars[$name]['delimiter'] = ',';
|
||||
}
|
||||
|
||||
if(is_array($cycle_vars[$name]['values'])) {
|
||||
$cycle_array = $cycle_vars[$name]['values'];
|
||||
|
||||
@@ -181,12 +181,12 @@ function smarty_function_fetch($params, &$smarty)
|
||||
$content .= fgets($fp,4096);
|
||||
}
|
||||
fclose($fp);
|
||||
$csplit = split("\r\n\r\n",$content,2);
|
||||
$csplit = preg_split("!\r\n\r\n!",$content,2);
|
||||
|
||||
$content = $csplit[1];
|
||||
|
||||
if(!empty($params['assign_headers'])) {
|
||||
$smarty->assign($params['assign_headers'],split("\r\n",$csplit[0]));
|
||||
$smarty->assign($params['assign_headers'],preg_split("!\r\n!",$csplit[0]));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -37,7 +37,7 @@ function smarty_function_math($params, &$smarty)
|
||||
}
|
||||
|
||||
// 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');
|
||||
|
||||
@@ -82,4 +82,4 @@ function smarty_function_math($params, &$smarty)
|
||||
|
||||
/* vim: set expandtab: */
|
||||
|
||||
?>
|
||||
?>
|
||||
Reference in New Issue
Block a user