From 26c465ad0c1d5b6801507ed190430f44ac92c672 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sun, 6 Dec 2015 21:09:58 +0100 Subject: update smarty to 3.1.28-dev which fixes a bug where changes in a template are only visible on the second pageload which is annoying for developing --- .../smarty_internal_compile_include_php.php | 28 ++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'library/Smarty/libs/sysplugins/smarty_internal_compile_include_php.php') diff --git a/library/Smarty/libs/sysplugins/smarty_internal_compile_include_php.php b/library/Smarty/libs/sysplugins/smarty_internal_compile_include_php.php index 76f506c52..e7e62997c 100644 --- a/library/Smarty/libs/sysplugins/smarty_internal_compile_include_php.php +++ b/library/Smarty/libs/sysplugins/smarty_internal_compile_include_php.php @@ -23,6 +23,7 @@ class Smarty_Internal_Compile_Include_Php extends Smarty_Internal_CompileBase * @see Smarty_Internal_CompileBase */ public $required_attributes = array('file'); + /** * Attribute definition: Overwrites base class. * @@ -30,6 +31,7 @@ class Smarty_Internal_Compile_Include_Php extends Smarty_Internal_CompileBase * @see Smarty_Internal_CompileBase */ public $shorttag_order = array('file'); + /** * Attribute definition: Overwrites base class. * @@ -41,13 +43,14 @@ class Smarty_Internal_Compile_Include_Php extends Smarty_Internal_CompileBase /** * Compiles code for the {include_php} tag * - * @param array $args array with attributes from parser - * @param object $compiler compiler object + * @param array $args array with attributes from parser + * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * - * @throws SmartyException - * @return string compiled code + * @return string + * @throws \SmartyCompilerException + * @throws \SmartyException */ - public function compile($args, $compiler) + public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) { if (!($compiler->smarty instanceof SmartyBC)) { throw new SmartyException("{include_php} is deprecated, use SmartyBC class to enable"); @@ -60,9 +63,10 @@ class Smarty_Internal_Compile_Include_Php extends Smarty_Internal_CompileBase */ $_smarty_tpl = $compiler->template; $_filepath = false; - eval('$_file = ' . $_attr['file'] . ';'); + $_file = null; + eval('$_file = @' . $_attr['file'] . ';'); if (!isset($compiler->smarty->security_policy) && file_exists($_file)) { - $_filepath = $_file; + $_filepath = $compiler->smarty->_realpath($_file, true); } else { if (isset($compiler->smarty->security_policy)) { $_dir = $compiler->smarty->security_policy->trusted_dir; @@ -71,16 +75,16 @@ class Smarty_Internal_Compile_Include_Php extends Smarty_Internal_CompileBase } if (!empty($_dir)) { foreach ((array) $_dir as $_script_dir) { - $_script_dir = rtrim($_script_dir, '/\\') . DS; - if (file_exists($_script_dir . $_file)) { - $_filepath = $_script_dir . $_file; + $_path = $compiler->smarty->_realpath($_script_dir . DS . $_file, true); + if (file_exists($_path)) { + $_filepath = $_path; break; } } } } if ($_filepath == false) { - $compiler->trigger_template_error("{include_php} file '{$_file}' is not readable", $compiler->lex->taglineno); + $compiler->trigger_template_error("{include_php} file '{$_file}' is not readable", null, true); } if (isset($compiler->smarty->security_policy)) { @@ -99,7 +103,7 @@ class Smarty_Internal_Compile_Include_Php extends Smarty_Internal_CompileBase } if (isset($_assign)) { - return "assign({$_assign},ob_get_contents()); ob_end_clean();?>"; + return "assign({$_assign},ob_get_clean());\n?>"; } else { return "\n"; } -- cgit v1.2.3