From dff1955cd5a01fee68e5ef321884bab9ff9d99bf Mon Sep 17 00:00:00 2001 From: "Stoll, Jonathan" Date: Fri, 19 Jun 2020 21:20:46 +0200 Subject: [PATCH 1/3] Update to HTML5-syntax in debug template * Replace deprecated tags * Use CSS3 selectors * Update html-frame * Remove deprecated syntax * Harmonize syntax in general --- libs/debug.tpl | 53 ++++++++++++++++++++++++++++++++------------------ 1 file changed, 34 insertions(+), 19 deletions(-) diff --git a/libs/debug.tpl b/libs/debug.tpl index edc7bef98..4f82a5820 100644 --- a/libs/debug.tpl +++ b/libs/debug.tpl @@ -1,9 +1,9 @@ {capture name='_smarty_debug' assign=debug_output} - - + + Smarty Debug Console - @@ -112,11 +115,11 @@

included templates & config files (load time in seconds)

{foreach $template_data as $template} - {$template.name} -
   + {$template.name} +
   (compile {$template['compile_time']|string_format:"%.5f"}) (render {$template['render_time']|string_format:"%.5f"}) (cache {$template['cache_time']|string_format:"%.5f"}) -
+
{/foreach}
{/if} @@ -125,13 +128,22 @@ {foreach $assigned_vars as $vars} - - + + + - - {/foreach}

${$vars@key}

- {if isset($vars['nocache'])}Nocache
{/if} - {if isset($vars['scope'])}Origin: {$vars['scope']|debug_print_var nofilter}{/if} +
+

${$vars@key}

+ {if isset($vars['nocache'])}Nocache
{/if} + {if isset($vars['scope'])}Origin: {$vars['scope']|debug_print_var nofilter}{/if} +
+

Value

+ {$vars['value']|debug_print_var:10:80 nofilter} +
+ {if isset($vars['attributes'])} +

Attributes

+ {$vars['attributes']|debug_print_var nofilter} + {/if}

Value

{$vars['value']|debug_print_var:10:80 nofilter}
{if isset($vars['attributes'])}

Attributes

{$vars['attributes']|debug_print_var nofilter} {/if}
@@ -139,11 +151,14 @@ {foreach $config_vars as $vars} - - + + - {/foreach} From 560475a2f20706c12c9b399186ee19fadd22a208 Mon Sep 17 00:00:00 2001 From: Simon Wisselink Date: Sun, 17 Jul 2022 00:13:57 +0200 Subject: [PATCH 2/3] Do not use obsolete smarty properties '_dir_perms', '_file_perms', 'plugin_search_order' in our own code. (#772) --- .../smarty_internal_runtime_writefile.php | 17 +++++------------ .../smarty_internal_templatecompilerbase.php | 3 --- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/libs/sysplugins/smarty_internal_runtime_writefile.php b/libs/sysplugins/smarty_internal_runtime_writefile.php index 4383e6f38..18c149459 100644 --- a/libs/sysplugins/smarty_internal_runtime_writefile.php +++ b/libs/sysplugins/smarty_internal_runtime_writefile.php @@ -29,12 +29,7 @@ public function writeFile($_filepath, $_contents, Smarty $smarty) { $_error_reporting = error_reporting(); error_reporting($_error_reporting & ~E_NOTICE & ~E_WARNING); - $_file_perms = property_exists($smarty, '_file_perms') ? $smarty->_file_perms : 0644; - $_dir_perms = - property_exists($smarty, '_dir_perms') ? (isset($smarty->_dir_perms) ? $smarty->_dir_perms : 0777) : 0771; - if ($_file_perms !== null) { - $old_umask = umask(0); - } + $old_umask = umask(0); $_dirpath = dirname($_filepath); // if subdirs, create dir structure if ($_dirpath !== '.') { @@ -42,7 +37,7 @@ public function writeFile($_filepath, $_contents, Smarty $smarty) // loop if concurrency problem occurs // see https://bugs.php.net/bug.php?id=35326 while (!is_dir($_dirpath)) { - if (@mkdir($_dirpath, $_dir_perms, true)) { + if (@mkdir($_dirpath, 0771, true)) { break; } clearstatcache(); @@ -89,11 +84,9 @@ public function writeFile($_filepath, $_contents, Smarty $smarty) error_reporting($_error_reporting); throw new SmartyException("unable to write file {$_filepath}"); } - if ($_file_perms !== null) { - // set file permissions - chmod($_filepath, $_file_perms); - umask($old_umask); - } + // set file permissions + chmod($_filepath, 0644); + umask($old_umask); error_reporting($_error_reporting); return true; } diff --git a/libs/sysplugins/smarty_internal_templatecompilerbase.php b/libs/sysplugins/smarty_internal_templatecompilerbase.php index bd500abe4..d6f86ac0a 100644 --- a/libs/sysplugins/smarty_internal_templatecompilerbase.php +++ b/libs/sysplugins/smarty_internal_templatecompilerbase.php @@ -422,9 +422,6 @@ public function compileTemplateSource( try { // save template object in compiler class $this->template = $template; - if (property_exists($this->template->smarty, 'plugin_search_order')) { - $this->plugin_search_order = $this->template->smarty->plugin_search_order; - } if ($this->smarty->debugging) { if (!isset($this->smarty->_debug)) { $this->smarty->_debug = new Smarty_Internal_Debug(); From cb9521667177de3fc820a55284f2674d058422b3 Mon Sep 17 00:00:00 2001 From: Simon Wisselink Date: Sun, 17 Jul 2022 00:54:20 +0200 Subject: [PATCH 3/3] Changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 680e9af40..3c8a50c22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed +- Updated HTML of the debug template [#599](https://github.com/smarty-php/smarty/pull/599) + ## [4.1.1] - 2022-05-17 ### Security

#{$vars@key}#

- {if isset($vars['scope'])}Origin: {$vars['scope']|debug_print_var nofilter}{/if} +
+

#{$vars@key}#

+ {if isset($vars['scope'])}Origin: {$vars['scope']|debug_print_var nofilter}{/if} +
+ {$vars['value']|debug_print_var:10:80 nofilter} {$vars['value']|debug_print_var:10:80 nofilter}