mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-10 05:14:26 +02:00
- fixed variable filenames in {include_php} and {insert}
This commit is contained in:
@@ -1,3 +1,6 @@
|
|||||||
|
11/12/2009
|
||||||
|
- fixed variable filenames in {include_php} and {insert}
|
||||||
|
|
||||||
11/11/2009
|
11/11/2009
|
||||||
- fixed {foreachelse}, {forelse}, {sectionelse} compiled code at nocache variables
|
- fixed {foreachelse}, {forelse}, {sectionelse} compiled code at nocache variables
|
||||||
- removed checking for reserved variables
|
- removed checking for reserved variables
|
||||||
|
@@ -29,22 +29,23 @@ class Smarty_Internal_Compile_Include_Php extends Smarty_Internal_CompileBase {
|
|||||||
$_attr = $this->_get_attributes($args);
|
$_attr = $this->_get_attributes($args);
|
||||||
|
|
||||||
$_output = '<?php ';
|
$_output = '<?php ';
|
||||||
// save posible attributes
|
|
||||||
$_file = $_attr['file'];
|
|
||||||
$_file = realpath(trim($_file, "'"));
|
|
||||||
|
|
||||||
if ($this->smarty->security) {
|
$_smarty_tpl = $compiler->template;
|
||||||
$this->smarty->security_handler->isTrustedPHPDir($_file);
|
eval('$_file = ' . $_attr['file'] . ';');
|
||||||
|
|
||||||
|
$_file = realpath($_file);
|
||||||
|
|
||||||
|
if ($this->compiler->smarty->security) {
|
||||||
|
$this->compiler->smarty->security_handler->isTrustedPHPDir($_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_file === false) {
|
if ($_file === false) {
|
||||||
$this->compiler->trigger_template_error('include_php: file "' . $_attr['file'] . '" is not readable');
|
$this->compiler->trigger_template_error('include_php: file "' . $_attr['file'] . '" is not readable');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->smarty->security) {
|
if ($this->compiler->smarty->security) {
|
||||||
$this->smarty->security_handler->isTrustedPHPDir($_file);
|
$this->compiler->smarty->security_handler->isTrustedPHPDir($_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_attr['assign'])) {
|
if (isset($_attr['assign'])) {
|
||||||
// output will be stored in a smarty variable instead of being displayed
|
// output will be stored in a smarty variable instead of being displayed
|
||||||
$_assign = $_attr['assign'];
|
$_assign = $_attr['assign'];
|
||||||
@@ -60,7 +61,6 @@ class Smarty_Internal_Compile_Include_Php extends Smarty_Internal_CompileBase {
|
|||||||
if (isset($_assign)) {
|
if (isset($_assign)) {
|
||||||
$_output .= 'ob_start(); include' . $_once . ' (\'' . $_file . '\'); $_smarty_tpl->assign(' . $_assign . ',ob_get_contents()); ob_end_clean();?>';
|
$_output .= 'ob_start(); include' . $_once . ' (\'' . $_file . '\'); $_smarty_tpl->assign(' . $_assign . ',ob_get_contents()); ob_end_clean();?>';
|
||||||
} else {
|
} else {
|
||||||
$this->compiler->has_output = true;
|
|
||||||
$_output .= 'include' . $_once . ' (\'' . $_file . '\');?>';
|
$_output .= 'include' . $_once . ' (\'' . $_file . '\');?>';
|
||||||
}
|
}
|
||||||
return $_output;
|
return $_output;
|
||||||
|
@@ -41,7 +41,8 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase {
|
|||||||
}
|
}
|
||||||
if (isset($_attr['script'])) {
|
if (isset($_attr['script'])) {
|
||||||
// script which must be included
|
// script which must be included
|
||||||
$_script = $_attr['script'];
|
$_smarty_tpl = $compiler->template;
|
||||||
|
eval('$_script = ' . $_attr['script'] . ';');
|
||||||
if (!file_exists($_script)) {
|
if (!file_exists($_script)) {
|
||||||
$this->compiler->trigger_template_error('missing file "' . $_script . '"');
|
$this->compiler->trigger_template_error('missing file "' . $_script . '"');
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user