mirror of
https://github.com/smarty-php/smarty.git
synced 2026-08-04 12:34:33 +02:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bace28e2eb | |||
| 478f8a29b4 | |||
| f8717a6cf7 | |||
| 957f9ce43a | |||
| 4ab9757b49 | |||
| 23d29f2ea3 | |||
| 88cc17fe8e | |||
| 5fb8387027 |
+11
-7
@@ -1,7 +1,11 @@
|
||||
* text=auto !eol
|
||||
docs/chm/make_chm_spc.gif -text
|
||||
docs/fop/thryb.ttf -text
|
||||
docs/fop/thrybi.ttf -text
|
||||
docs/fop/thryi.ttf -text
|
||||
docs/fop/thryn.ttf -text
|
||||
misc/smarty_icon.gif -text
|
||||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
||||
|
||||
# exclude from git export
|
||||
/travis.ini export-ignore
|
||||
/myconfig.ini export-ignore
|
||||
/.travis.yml export-ignore
|
||||
/.gitignore export-ignore
|
||||
/.gitattributes export-ignore
|
||||
/lexer/ export-ignore
|
||||
/utilities/ export-ignore
|
||||
|
||||
+9
-19
@@ -1,19 +1,9 @@
|
||||
docs/*.cache
|
||||
docs/*.fot
|
||||
docs/Makefile
|
||||
docs/chm/*.chm
|
||||
docs/chm/*.hh?
|
||||
docs/chm/fancy
|
||||
docs/config.*
|
||||
docs/configure
|
||||
docs/diff
|
||||
docs/dsssl/html-common.dsl
|
||||
docs/entities/file-entities.ent
|
||||
docs/entities/version.ent
|
||||
docs/html
|
||||
docs/manual.pdf
|
||||
docs/manual.xml
|
||||
docs/phpweb
|
||||
docs/revcheck.html
|
||||
docs/scripts/file-entities.php
|
||||
/templates_c
|
||||
|
||||
.idea/
|
||||
# Smarty
|
||||
lexer/*.php
|
||||
lexer/*.php.bak
|
||||
lexer/*.out
|
||||
utilies/*.php
|
||||
/composer.lock
|
||||
/vendor
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
===== 2.6.31 ===
|
||||
2017-11-03
|
||||
* replace functions deprecated in PHP 7.2
|
||||
|
||||
|
||||
2016-09-11 Uwe Tews
|
||||
* {math} fix parameter checking order to avoid misleading message
|
||||
* {math} replace wrong versiom
|
||||
|
||||
2016-07-19 Uwe Tews
|
||||
* {math} shell injection vulnerability patch provided by Tim Weber
|
||||
|
||||
@@ -783,7 +792,7 @@
|
||||
docs/fr/programmers/plugins/plugins-inserts.xml:
|
||||
sync with EN
|
||||
|
||||
2006-10-14 Fernando Correa da Conceição <fernando_conceicao@yahoo.com.br>
|
||||
2006-10-14 Fernando Correa da Concei��o <fernando_conceicao@yahoo.com.br>
|
||||
|
||||
* docs/pt_BR/programmers/api-variables/variable-error-reporting.xml:
|
||||
New Translation
|
||||
@@ -4324,7 +4333,7 @@
|
||||
fixed bug in _run_mod_handler
|
||||
|
||||
* libs/Smarty_Compiler.class.php:
|
||||
fixed bug with autoload-handling of modifiers. thanks ándre.
|
||||
fixed bug with autoload-handling of modifiers. thanks �ndre.
|
||||
|
||||
2003-08-05 Messju Mohr <messju@lammfellpuschen.de>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#Smarty 2 template engine
|
||||
##Distribution repository
|
||||
# Smarty 2 template engine
|
||||
## Distribution repository
|
||||
Starting with Smarty 2.6.23 Composer has been configured to load the packages from github.
|
||||
|
||||
**NOTE: Because of this change you must clear your local composer cache with the "composer clearcache" command**
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
* @author Andrei Zmievski <andrei@php.net>
|
||||
* @package Smarty
|
||||
* @version 2.6.30
|
||||
* @version 2.6.31-dev
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
@@ -465,7 +465,7 @@ class Smarty
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
var $_version = '2.6.30';
|
||||
var $_version = '2.6.31';
|
||||
|
||||
/**
|
||||
* current template inclusion depth
|
||||
@@ -1208,7 +1208,7 @@ class Smarty
|
||||
$_server_vars = ($this->request_use_auto_globals) ? $_SERVER : $GLOBALS['HTTP_SERVER_VARS'];
|
||||
$_last_modified_date = @substr($_server_vars['HTTP_IF_MODIFIED_SINCE'], 0, strpos($_server_vars['HTTP_IF_MODIFIED_SINCE'], 'GMT') + 3);
|
||||
$_gmt_mtime = gmdate('D, d M Y H:i:s', $this->_cache_info['timestamp']).' GMT';
|
||||
if (@count($this->_cache_info['insert_tags']) == 0
|
||||
if (empty($this->_cache_info['insert_tags'])
|
||||
&& !$this->_cache_serials
|
||||
&& $_gmt_mtime == $_last_modified_date) {
|
||||
if (php_sapi_name()=='cgi')
|
||||
|
||||
@@ -259,14 +259,9 @@ class Smarty_Compiler extends Smarty {
|
||||
|
||||
preg_match_all($search, $source_content, $match, PREG_SET_ORDER);
|
||||
$this->_folded_blocks = $match;
|
||||
reset($this->_folded_blocks);
|
||||
|
||||
/* replace special blocks by "{php}" */
|
||||
$source_content = preg_replace_callback($search, create_function ('$matches', "return '"
|
||||
. $this->_quote_replace($this->left_delimiter) . 'php'
|
||||
. "' . str_repeat(\"\n\", substr_count('\$matches[1]', \"\n\")) .'"
|
||||
. $this->_quote_replace($this->right_delimiter)
|
||||
. "';")
|
||||
$source_content = preg_replace_callback($search, array($this,'_preg_callback')
|
||||
, $source_content);
|
||||
|
||||
/* Gather all template tags. */
|
||||
@@ -556,7 +551,7 @@ class Smarty_Compiler extends Smarty {
|
||||
|
||||
case 'php':
|
||||
/* handle folded tags replaced by {php} */
|
||||
list(, $block) = each($this->_folded_blocks);
|
||||
$block = array_shift($this->_folded_blocks);
|
||||
$this->_current_line_no += substr_count($block[0], "\n");
|
||||
/* the number of matched elements in the regexp in _compile_file()
|
||||
determins the type of folded tag that was found */
|
||||
@@ -754,7 +749,12 @@ class Smarty_Compiler extends Smarty {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function _preg_callback ($matches) {
|
||||
return $this->_quote_replace($this->left_delimiter)
|
||||
. 'php'
|
||||
. str_repeat("\n", substr_count($matches[1], "\n"))
|
||||
. $this->_quote_replace($this->right_delimiter);
|
||||
}
|
||||
/**
|
||||
* compile custom function tag
|
||||
*
|
||||
@@ -1192,7 +1192,7 @@ class Smarty_Compiler extends Smarty {
|
||||
}
|
||||
|
||||
$output = '<?php ';
|
||||
$output .= "\$_from = $from; if (!is_array(\$_from) && !is_object(\$_from)) { settype(\$_from, 'array'); }";
|
||||
$output .= "\$_from = $from; if ((\$_from instanceof StdClass) || (!is_array(\$_from) && !is_object(\$_from))) { settype(\$_from, 'array'); }";
|
||||
if (isset($name)) {
|
||||
$foreach_props = "\$this->_foreach[$name]";
|
||||
$output .= "{$foreach_props} = array('total' => count(\$_from), 'iteration' => 0);\n";
|
||||
|
||||
@@ -18,11 +18,11 @@
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
*
|
||||
* @param array $params parameters
|
||||
* @param Smarty_Internal_Template $template template object
|
||||
* @param Smarty
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
function smarty_function_math($params, $template)
|
||||
function smarty_function_math($params, &$smarty)
|
||||
{
|
||||
static $_allowed_funcs =
|
||||
array('int' => true, 'abs' => true, 'ceil' => true, 'cos' => true, 'exp' => true, 'floor' => true,
|
||||
@@ -58,12 +58,28 @@ function smarty_function_math($params, $template)
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($params as $key => $val) {
|
||||
if ($key != "equation" && $key != "format" && $key != "assign") {
|
||||
// make sure value is not empty
|
||||
if (strlen($val) == 0) {
|
||||
trigger_error("math: parameter '{$key}' is empty", E_USER_WARNING);
|
||||
|
||||
return;
|
||||
}
|
||||
if (!is_numeric($val)) {
|
||||
trigger_error("math: parameter '{$key}' is not numeric", E_USER_WARNING);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// match all vars in equation, make sure all are passed
|
||||
preg_match_all('!(?:0x[a-fA-F0-9]+)|([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)!', $equation, $match);
|
||||
|
||||
foreach ($match[ 1 ] as $curr_var) {
|
||||
if ($curr_var && !isset($params[ $curr_var ]) && !isset($_allowed_funcs[ $curr_var ])) {
|
||||
trigger_error("math: function call $curr_var not allowed", E_USER_WARNING);
|
||||
trigger_error("math: function call '{$curr_var}' not allowed, or missing parameter '{$curr_var}'", E_USER_WARNING);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -71,17 +87,6 @@ function smarty_function_math($params, $template)
|
||||
|
||||
foreach ($params as $key => $val) {
|
||||
if ($key != "equation" && $key != "format" && $key != "assign") {
|
||||
// make sure value is not empty
|
||||
if (strlen($val) == 0) {
|
||||
trigger_error("math: parameter $key is empty", E_USER_WARNING);
|
||||
|
||||
return;
|
||||
}
|
||||
if (!is_numeric($val)) {
|
||||
trigger_error("math: parameter $key: is not numeric", E_USER_WARNING);
|
||||
|
||||
return;
|
||||
}
|
||||
$equation = preg_replace("/\b$key\b/", " \$params['$key'] ", $equation);
|
||||
}
|
||||
}
|
||||
@@ -92,13 +97,13 @@ function smarty_function_math($params, $template)
|
||||
if (empty($params[ 'assign' ])) {
|
||||
return $smarty_math_result;
|
||||
} else {
|
||||
$template->assign($params[ 'assign' ], $smarty_math_result);
|
||||
$smarty->assign($params[ 'assign' ], $smarty_math_result);
|
||||
}
|
||||
} else {
|
||||
if (empty($params[ 'assign' ])) {
|
||||
printf($params[ 'format' ], $smarty_math_result);
|
||||
} else {
|
||||
$template->assign($params[ 'assign' ], sprintf($params[ 'format' ], $smarty_math_result));
|
||||
$smarty->assign($params[ 'assign' ], sprintf($params[ 'format' ], $smarty_math_result));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user