From f866f04d66c0c60335f5871c8d6f143dfbabaece Mon Sep 17 00:00:00 2001 From: messju Date: Mon, 30 Jun 2003 15:41:25 +0000 Subject: [PATCH] libs/plugins/function.html_image.php --- libs/Smarty_Compiler.class.php | 15 +++++++++++---- libs/core/core.write_file.php | 2 +- libs/plugins/function.html_image.php | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/libs/Smarty_Compiler.class.php b/libs/Smarty_Compiler.class.php index 8058cb2e..e0f0cbdc 100644 --- a/libs/Smarty_Compiler.class.php +++ b/libs/Smarty_Compiler.class.php @@ -1606,7 +1606,7 @@ class Smarty_Compiler extends Smarty { } // get [foo] and .foo and ->foo and (...) pieces - preg_match_all('!(?:^\w+)|' . $this->_obj_params_regexp . '|(?:' . $this->_var_bracket_regexp . ')|->\w+|\.\$?\w+|\S+!', $_var_ref, $match); + preg_match_all('!(?:^\w+)|' . $this->_obj_params_regexp . '|(?:' . $this->_var_bracket_regexp . ')|->\$?\w+|\.\$?\w+|\S+!', $_var_ref, $match); $_indexes = $match[0]; $_var_name = array_shift($_indexes); @@ -1635,7 +1635,7 @@ class Smarty_Compiler extends Smarty { } else { $_output = "\$this->_tpl_vars['$_var_name']"; } - + foreach ($_indexes as $_index) { if ($_index{0} == '[') { $_index = substr($_index, 1, -1); @@ -1659,8 +1659,15 @@ class Smarty_Compiler extends Smarty { $this->_syntax_error('call to internal object members is not allowed', E_USER_ERROR, __FILE__, __LINE__); } elseif($this->security && substr($_index, 2, 1) == '_') { $this->_syntax_error('(secure) call to private object member is not allowed', E_USER_ERROR, __FILE__, __LINE__); - } - $_output .= $_index; + } elseif ($_index{2} == '$') { + if ($this->security) { + $this->_syntax_error('(secure) call to dynamic object member is not allowed', E_USER_ERROR, __FILE__, __LINE__); + } else { + $_output .= '->{$this->_tpl_vars[\''.substr($_index,3).'\']}'; + } + } else { + $_output .= $_index; + } } elseif ($_index{0} == '(') { $_index = $this->_parse_parenth_args($_index); $_output .= $_index; diff --git a/libs/core/core.write_file.php b/libs/core/core.write_file.php index 5ab3502c..0879e45a 100644 --- a/libs/core/core.write_file.php +++ b/libs/core/core.write_file.php @@ -38,7 +38,7 @@ function smarty_core_write_file($params, &$smarty) @unlink($params['filename']); } @rename($_tmp_file, $params['filename']); - chmod($params['filename'], $smarty->_file_perms); + @chmod($params['filename'], $smarty->_file_perms); return true; } diff --git a/libs/plugins/function.html_image.php b/libs/plugins/function.html_image.php index 575d6fdc..fc6c685e 100644 --- a/libs/plugins/function.html_image.php +++ b/libs/plugins/function.html_image.php @@ -94,7 +94,7 @@ function smarty_function_html_image($params, &$smarty) return; } - if(substr($file,0,1) == DIRECTORY_SEPARATOR) { + if (substr($file,0,1) == '/') { $_image_path = $basedir . $file; } else { $_image_path = $file;