mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 10:24:26 +02:00
fixed problem with using assigned var with include_php filepath
This commit is contained in:
2
NEWS
2
NEWS
@@ -1,3 +1,5 @@
|
||||
- fixed problem with using assigned vars with {include_php ...} filepath
|
||||
(Monte)
|
||||
Version 1.5.2
|
||||
-------------
|
||||
- added Smarty object as fifth argument for template resource functions
|
||||
|
@@ -1120,10 +1120,10 @@ function _is_trusted($resource_type, $resource_name)
|
||||
$this->_parse_file_path($this->trusted_dir, $this->_dequote($args['script']), $resource_type, $resource_name);
|
||||
if ($this->security) {
|
||||
if( $resource_type != 'file' || !@is_file($resource_name)) {
|
||||
$this->_syntax_error("include_php: $resource_type: $resource_name is not readable"); return false;
|
||||
$this->_syntax_error("insert: $resource_type: $resource_name is not readable"); return false;
|
||||
}
|
||||
if (!$this->_is_trusted($resource_type, $resource_name)) {
|
||||
$this->_syntax_error("include_php: $resource_type: $resource_name is not trusted");
|
||||
$this->_syntax_error("insert: $resource_type: $resource_name is not trusted");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1166,10 +1166,10 @@ function _run_insert_handler($args)
|
||||
$this->_parse_file_path($this->trusted_dir, $this->_dequote($args['script']), $resource_type, $resource_name);
|
||||
if ($this->security) {
|
||||
if( $resource_type != 'file' || !@is_file($resource_name)) {
|
||||
$this->_syntax_error("include_php: $resource_type: $resource_name is not readable"); return false;
|
||||
$this->_syntax_error("insert: $resource_type: $resource_name is not readable"); return false;
|
||||
}
|
||||
if (!$this->_is_trusted($resource_type, $resource_name)) {
|
||||
$this->_syntax_error("include_php: $resource_type: $resource_name is not trusted");
|
||||
$this->_syntax_error("insert: $resource_type: $resource_name is not trusted");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@@ -489,10 +489,10 @@ class Smarty_Compiler extends Smarty {
|
||||
|
||||
if (!empty($attrs['assign'])) {
|
||||
$output = "<?php ob_start();\n";
|
||||
$output .= "include('" . $resource_name . "');\n";
|
||||
$output .= 'include("' . $resource_name . '");'."\n";
|
||||
$output .= "\$this->assign(" . $this->_dequote($attrs['assign']).", ob_get_contents()); ob_end_clean();\n?>";
|
||||
} else {
|
||||
$output = "<?php include('" . $resource_name . "'); ?>";
|
||||
$output = '<?php include("' . $resource_name . '"); ?>';
|
||||
}
|
||||
|
||||
return $output;
|
||||
|
@@ -1120,10 +1120,10 @@ function _is_trusted($resource_type, $resource_name)
|
||||
$this->_parse_file_path($this->trusted_dir, $this->_dequote($args['script']), $resource_type, $resource_name);
|
||||
if ($this->security) {
|
||||
if( $resource_type != 'file' || !@is_file($resource_name)) {
|
||||
$this->_syntax_error("include_php: $resource_type: $resource_name is not readable"); return false;
|
||||
$this->_syntax_error("insert: $resource_type: $resource_name is not readable"); return false;
|
||||
}
|
||||
if (!$this->_is_trusted($resource_type, $resource_name)) {
|
||||
$this->_syntax_error("include_php: $resource_type: $resource_name is not trusted");
|
||||
$this->_syntax_error("insert: $resource_type: $resource_name is not trusted");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1166,10 +1166,10 @@ function _run_insert_handler($args)
|
||||
$this->_parse_file_path($this->trusted_dir, $this->_dequote($args['script']), $resource_type, $resource_name);
|
||||
if ($this->security) {
|
||||
if( $resource_type != 'file' || !@is_file($resource_name)) {
|
||||
$this->_syntax_error("include_php: $resource_type: $resource_name is not readable"); return false;
|
||||
$this->_syntax_error("insert: $resource_type: $resource_name is not readable"); return false;
|
||||
}
|
||||
if (!$this->_is_trusted($resource_type, $resource_name)) {
|
||||
$this->_syntax_error("include_php: $resource_type: $resource_name is not trusted");
|
||||
$this->_syntax_error("insert: $resource_type: $resource_name is not trusted");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@@ -489,10 +489,10 @@ class Smarty_Compiler extends Smarty {
|
||||
|
||||
if (!empty($attrs['assign'])) {
|
||||
$output = "<?php ob_start();\n";
|
||||
$output .= "include('" . $resource_name . "');\n";
|
||||
$output .= 'include("' . $resource_name . '");'."\n";
|
||||
$output .= "\$this->assign(" . $this->_dequote($attrs['assign']).", ob_get_contents()); ob_end_clean();\n?>";
|
||||
} else {
|
||||
$output = "<?php include('" . $resource_name . "'); ?>";
|
||||
$output = '<?php include("' . $resource_name . '"); ?>';
|
||||
}
|
||||
|
||||
return $output;
|
||||
|
Reference in New Issue
Block a user