From 3204262e0fe3b3471d18953f11210e6d07fd563e Mon Sep 17 00:00:00 2001 From: "monte.ohrt" Date: Tue, 25 Sep 2012 19:03:40 +0000 Subject: [PATCH 01/13] update change log --- change_log.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/change_log.txt b/change_log.txt index 8b5df253..24689fa4 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,4 +1,5 @@ ===== trunk ===== +===== Smarty-3.1.12 ===== 14.09.2012 - bugfix template inheritance failed to compile with delimiters {/ and /} (Forum Topic 23008) From 642e021f4537d124c426b699b3792fe31f0268b8 Mon Sep 17 00:00:00 2001 From: rodneyrehm Date: Thu, 1 Nov 2012 10:10:10 +0000 Subject: [PATCH 02/13] Fixing Issue #118 - muteExpectedErrors would fail non-readable directories --- change_log.txt | 3 +++ libs/Smarty.class.php | 15 +++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/change_log.txt b/change_log.txt index 24689fa4..a7dc1a18 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,4 +1,7 @@ ===== trunk ===== +01.11.2012 +- bugfix muteExcpetedErrors() would screw up for non-readable paths (Issue #118) + ===== Smarty-3.1.12 ===== 14.09.2012 - bugfix template inheritance failed to compile with delimiters {/ and /} (Forum Topic 23008) diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index 54649927..ccececae 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -1392,10 +1392,12 @@ class Smarty extends Smarty_Internal_TemplateBase { // add the SMARTY_DIR to the list of muted directories if (!isset(Smarty::$_muted_directories[SMARTY_DIR])) { $smarty_dir = realpath(SMARTY_DIR); - Smarty::$_muted_directories[SMARTY_DIR] = array( - 'file' => $smarty_dir, - 'length' => strlen($smarty_dir), - ); + if ($smarty_dir !== false) { + Smarty::$_muted_directories[SMARTY_DIR] = array( + 'file' => $smarty_dir, + 'length' => strlen($smarty_dir), + ); + } } // walk the muted directories and test against $errfile @@ -1403,6 +1405,11 @@ class Smarty extends Smarty_Internal_TemplateBase { if (!$dir) { // resolve directory and length for speedy comparisons $file = realpath($key); + if ($file === false) { + // this directory does not exist, remove and skip it + unset(Smarty::$_muted_directories[$key]); + continue; + } $dir = array( 'file' => $file, 'length' => strlen($file), From b8f0d3bacb36dacfde8eca9ab1ed83e79ae427e2 Mon Sep 17 00:00:00 2001 From: rodneyrehm Date: Tue, 13 Nov 2012 18:31:48 +0000 Subject: [PATCH 03/13] - adding attribute "strict" to html_options, html_checkboxes, html_radios to only print disabled/readonly attributes if their values are true or "disabled"/"readonly" (Issue #120) --- change_log.txt | 3 +++ libs/plugins/function.html_checkboxes.php | 17 +++++++++++++++++ libs/plugins/function.html_options.php | 19 ++++++++++++++++++- libs/plugins/function.html_radios.php | 17 +++++++++++++++++ 4 files changed, 55 insertions(+), 1 deletion(-) diff --git a/change_log.txt b/change_log.txt index a7dc1a18..114a0476 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,4 +1,7 @@ ===== trunk ===== +13.11.2012 +- adding attribute "strict" to html_options, html_checkboxes, html_radios to only print disabled/readonly attributes if their values are true or "disabled"/"readonly" (Issue #120) + 01.11.2012 - bugfix muteExcpetedErrors() would screw up for non-readable paths (Issue #118) diff --git a/libs/plugins/function.html_checkboxes.php b/libs/plugins/function.html_checkboxes.php index fb9584bb..1866bc2f 100644 --- a/libs/plugins/function.html_checkboxes.php +++ b/libs/plugins/function.html_checkboxes.php @@ -116,6 +116,23 @@ function smarty_function_html_checkboxes($params, $template) case 'assign': break; + case 'strict': break; + + case 'disabled': + case 'readonly': + if (!empty($params['strict'])) { + if (!is_scalar($_val)) { + trigger_error("html_options: $_key attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute", E_USER_NOTICE); + } + + if ($_val === true || $_val === $_key) { + $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_key) . '"'; + } + + break; + } + // omit break; to fall through! + default: if(!is_array($_val)) { $extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"'; diff --git a/libs/plugins/function.html_options.php b/libs/plugins/function.html_options.php index 46330e89..68fa0524 100644 --- a/libs/plugins/function.html_options.php +++ b/libs/plugins/function.html_options.php @@ -90,7 +90,24 @@ function smarty_function_html_options($params, $template) $selected = smarty_function_escape_special_chars((string) $_val); } break; - + + case 'strict': break; + + case 'disabled': + case 'readonly': + if (!empty($params['strict'])) { + if (!is_scalar($_val)) { + trigger_error("html_options: $_key attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute", E_USER_NOTICE); + } + + if ($_val === true || $_val === $_key) { + $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_key) . '"'; + } + + break; + } + // omit break; to fall through! + default: if (!is_array($_val)) { $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"'; diff --git a/libs/plugins/function.html_radios.php b/libs/plugins/function.html_radios.php index 7c830724..a2741f68 100644 --- a/libs/plugins/function.html_radios.php +++ b/libs/plugins/function.html_radios.php @@ -102,6 +102,23 @@ function smarty_function_html_radios($params, $template) case 'assign': break; + case 'strict': break; + + case 'disabled': + case 'readonly': + if (!empty($params['strict'])) { + if (!is_scalar($_val)) { + trigger_error("html_options: $_key attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute", E_USER_NOTICE); + } + + if ($_val === true || $_val === $_key) { + $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_key) . '"'; + } + + break; + } + // omit break; to fall through! + default: if (!is_array($_val)) { $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"'; From 27be6508bdecb10ca3fbc27287d7b3c994c16a7a Mon Sep 17 00:00:00 2001 From: "uwe.tews@googlemail.com" Date: Tue, 20 Nov 2012 02:06:20 +0000 Subject: [PATCH 04/13] - bugfix assignGlobal() called from plugins did not work (Forum Topic 23771) --- change_log.txt | 3 +++ libs/sysplugins/smarty_internal_data.php | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/change_log.txt b/change_log.txt index 114a0476..cf4e5d65 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,4 +1,7 @@ ===== trunk ===== +20.11.2012 +- bugfix assignGlobal() called from plugins did not work (Forum Topic 23771) + 13.11.2012 - adding attribute "strict" to html_options, html_checkboxes, html_radios to only print disabled/readonly attributes if their values are true or "disabled"/"readonly" (Issue #120) diff --git a/libs/sysplugins/smarty_internal_data.php b/libs/sysplugins/smarty_internal_data.php index 5baf3b76..1d7b1d33 100644 --- a/libs/sysplugins/smarty_internal_data.php +++ b/libs/sysplugins/smarty_internal_data.php @@ -80,6 +80,11 @@ class Smarty_Internal_Data { { if ($varname != '') { Smarty::$global_tpl_vars[$varname] = new Smarty_variable($value, $nocache); + $ptr = $this; + while ($ptr instanceof Smarty_Internal_Template) { + $ptr->tpl_vars[$varname] = clone Smarty::$global_tpl_vars[$varname]; + $ptr = $ptr->parent; + } } return $this; From 9c6bda43d0899f6d660c8873b42167af7549f5a9 Mon Sep 17 00:00:00 2001 From: rodneyrehm Date: Sat, 24 Nov 2012 10:45:38 +0000 Subject: [PATCH 05/13] made SmartyBC loadable via composer (Issue #124) --- change_log.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/change_log.txt b/change_log.txt index cf4e5d65..4e60ae1f 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,4 +1,7 @@ ===== trunk ===== +24.11.2012 +- made SmartyBC loadable via composer (Issue #124) + 20.11.2012 - bugfix assignGlobal() called from plugins did not work (Forum Topic 23771) From 88693d327aa6b2761618775ffaa8c4c0ee0232b8 Mon Sep 17 00:00:00 2001 From: "uwe.tews@googlemail.com" Date: Mon, 26 Nov 2012 20:11:10 +0000 Subject: [PATCH 06/13] - bugfix global variable assigned within template function are not seen after template function exit (Forum Topic 23800) --- change_log.txt | 3 +++ libs/sysplugins/smarty_internal_compile_function.php | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/change_log.txt b/change_log.txt index 4e60ae1f..c90ca219 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,4 +1,7 @@ ===== trunk ===== +26.11.2012 +- bugfix global variable assigned within template function are not seen after template function exit (Forum Topic 23800) + 24.11.2012 - made SmartyBC loadable via composer (Issue #124) diff --git a/libs/sysplugins/smarty_internal_compile_function.php b/libs/sysplugins/smarty_internal_compile_function.php index 876b13de..7821d203 100644 --- a/libs/sysplugins/smarty_internal_compile_function.php +++ b/libs/sysplugins/smarty_internal_compile_function.php @@ -149,7 +149,8 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase $compiler->has_code = false; $output = true; } else { - $output = $plugins_string . $compiler->parser->current_buffer->to_smarty_php() . "tpl_vars = \$saved_tpl_vars;}}?>\n"; + $output = $plugins_string . $compiler->parser->current_buffer->to_smarty_php() . "tpl_vars = \$saved_tpl_vars; +foreach (Smarty::\$global_tpl_vars as \$key => \$value) if(!isset(\$_smarty_tpl->tpl_vars[\$key])) \$_smarty_tpl->tpl_vars[\$key] = \$value;}}?>\n"; } // reset flag that we are compiling a template function $compiler->compiles_template_function = false; From 6ebd099041dac412a4a3f0cca20d42973e514d06 Mon Sep 17 00:00:00 2001 From: "uwe.tews@googlemail.com" Date: Tue, 27 Nov 2012 13:37:35 +0000 Subject: [PATCH 07/13] - bugfix wrong variable usage in smarty_internal_utility.php (Issue #125) --- change_log.txt | 3 +++ libs/sysplugins/smarty_internal_utility.php | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/change_log.txt b/change_log.txt index c90ca219..ca757ccf 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,4 +1,7 @@ ===== trunk ===== +27.11.2012 +- bugfix wrong variable usage in smarty_internal_utility.php (Issue #125) + 26.11.2012 - bugfix global variable assigned within template function are not seen after template function exit (Forum Topic 23800) diff --git a/libs/sysplugins/smarty_internal_utility.php b/libs/sysplugins/smarty_internal_utility.php index e169653f..f19ca01f 100644 --- a/libs/sysplugins/smarty_internal_utility.php +++ b/libs/sysplugins/smarty_internal_utility.php @@ -72,8 +72,8 @@ class Smarty_Internal_Utility { $_compileDirs = new RecursiveDirectoryIterator($_dir); $_compile = new RecursiveIteratorIterator($_compileDirs); foreach ($_compile as $_fileinfo) { - if (substr(basename($_file->getPathname()),0,1) == '.' || strpos($_fileinfo, '.svn') !== false) continue; $_file = $_fileinfo->getFilename(); + if (substr(basename($_fileinfo->getPathname()),0,1) == '.' || strpos($_file, '.svn') !== false) continue; if (!substr_compare($_file, $extention, - strlen($extention)) == 0) continue; if ($_fileinfo->getPath() == substr($_dir, 0, -1)) { $_template_file = $_file; @@ -136,8 +136,8 @@ class Smarty_Internal_Utility { $_compileDirs = new RecursiveDirectoryIterator($_dir); $_compile = new RecursiveIteratorIterator($_compileDirs); foreach ($_compile as $_fileinfo) { - if (substr(basename($_fileinfo->getPathname()),0,1) == '.' || strpos($_fileinfo, '.svn') !== false) continue; $_file = $_fileinfo->getFilename(); + if (substr(basename($_fileinfo->getPathname()),0,1) == '.' || strpos($_file, '.svn') !== false) continue; if (!substr_compare($_file, $extention, - strlen($extention)) == 0) continue; if ($_fileinfo->getPath() == substr($_dir, 0, -1)) { $_config_file = $_file; From b24eada1473f25a1c99e9f549556ec9d22550f64 Mon Sep 17 00:00:00 2001 From: "uwe.tews@googlemail.com" Date: Sun, 6 Jan 2013 19:22:48 +0000 Subject: [PATCH 08/13] - Allow '://' URL syntax in template names of stream resources (Issue #129) --- change_log.txt | 3 + .../smarty_internal_resource_stream.php | 80 ++++++++++--------- 2 files changed, 44 insertions(+), 39 deletions(-) diff --git a/change_log.txt b/change_log.txt index ca757ccf..518bcaf0 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,4 +1,7 @@ ===== trunk ===== +06.01.2013 +- Allow '://' URL syntax in template names of stream resources (Issue #129) + 27.11.2012 - bugfix wrong variable usage in smarty_internal_utility.php (Issue #125) diff --git a/libs/sysplugins/smarty_internal_resource_stream.php b/libs/sysplugins/smarty_internal_resource_stream.php index 85698c23..58086c17 100644 --- a/libs/sysplugins/smarty_internal_resource_stream.php +++ b/libs/sysplugins/smarty_internal_resource_stream.php @@ -1,36 +1,40 @@ filepath = str_replace(':', '://', $source->resource); + if(strpos($source->resource, '://') !== false) { + $source->filepath = $source->resource; + } else { + $source->filepath = str_replace(':', '://', $source->resource); + } $source->uid = false; $source->content = $this->getContent($source); $source->timestamp = false; @@ -38,12 +42,12 @@ class Smarty_Internal_Resource_Stream extends Smarty_Resource_Recompiled { } /** - * Load template's source from stream into current template object - * - * @param Smarty_Template_Source $source source object - * @return string template source - * @throws SmartyException if source cannot be loaded - */ + * Load template's source from stream into current template object + * + * @param Smarty_Template_Source $source source object + * @return string template source + * @throws SmartyException if source cannot be loaded + */ public function getContent(Smarty_Template_Source $source) { $t = ''; @@ -59,18 +63,16 @@ class Smarty_Internal_Resource_Stream extends Smarty_Resource_Recompiled { return false; } } - + /** - * modify resource_name according to resource handlers specifications - * - * @param Smarty $smarty Smarty instance - * @param string $resource_name resource_name to make unique - * @return string unique resource name - */ + * modify resource_name according to resource handlers specifications + * + * @param Smarty $smarty Smarty instance + * @param string $resource_name resource_name to make unique + * @return string unique resource name + */ protected function buildUniqueResourceName(Smarty $smarty, $resource_name) { return get_class($this) . '#' . $resource_name; } } - -?> \ No newline at end of file From 2f83a70627986fbe1ed62a577c7e77ea3a6539d3 Mon Sep 17 00:00:00 2001 From: "uwe.tews@googlemail.com" Date: Wed, 9 Jan 2013 00:05:07 +0000 Subject: [PATCH 09/13] - bugfix compilation did fail when a prefilter did modify an {extends} tag (Forum Topic 23966) --- change_log.txt | 3 +++ libs/sysplugins/smarty_internal_compile_extends.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/change_log.txt b/change_log.txt index 518bcaf0..96e935a4 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,4 +1,7 @@ ===== trunk ===== +09.01.2013 +- bugfix compilation did fail when a prefilter did modify an {extends} tag (Forum Topic 23966) + 06.01.2013 - Allow '://' URL syntax in template names of stream resources (Issue #129) diff --git a/libs/sysplugins/smarty_internal_compile_extends.php b/libs/sysplugins/smarty_internal_compile_extends.php index b93139bf..fe14a408 100644 --- a/libs/sysplugins/smarty_internal_compile_extends.php +++ b/libs/sysplugins/smarty_internal_compile_extends.php @@ -82,7 +82,7 @@ class Smarty_Internal_Compile_Extends extends Smarty_Internal_CompileBase { $compiler->trigger_template_error("illegal recursive call of \"{$include_file}\"", $compiler->lex->line - 1); } $compiler->template->properties['file_dependency'][$template_sha1] = array($_template->source->filepath, $_template->source->timestamp, $_template->source->type); - $_content = ($this->mbstring_overload ? mb_substr($compiler->template->source->content, $compiler->lex->counter - 1, 20000000, 'latin1') : substr($compiler->template->source->content, $compiler->lex->counter - 1)); + $_content = ($this->mbstring_overload ? mb_substr($compiler->lex->data, $compiler->lex->counter - 1, 20000000, 'latin1') : substr($compiler->lex->data, $compiler->lex->counter - 1)); if (preg_match_all("!({$this->_ldl}{$al}block\s(.+?)\s*{$this->_rdl})!", $_content, $s) != preg_match_all("!({$this->_ldl}{$al}/block\s*{$this->_rdl})!", $_content, $c)) { $compiler->trigger_template_error('unmatched {block} {/block} pairs'); From 285a5353462f9e2e49be4a63755097b1cf5ba18e Mon Sep 17 00:00:00 2001 From: "uwe.tews@googlemail.com" Date: Wed, 9 Jan 2013 23:05:09 +0000 Subject: [PATCH 10/13] - bugfix template inheritance could fail if nested {block} tags in childs did contain {$smarty.block.child} (Issue #127) - bugfix template inheritance could fail if {block} tags in childs did have similar name as used plugins (Issue #128) --- change_log.txt | 2 ++ .../smarty_internal_compile_block.php | 17 +++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/change_log.txt b/change_log.txt index 96e935a4..61f236e4 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,6 +1,8 @@ ===== trunk ===== 09.01.2013 - bugfix compilation did fail when a prefilter did modify an {extends} tag (Forum Topic 23966) +- bugfix template inheritance could fail if nested {block} tags in childs did contain {$smarty.block.child} (Issue #127) +- bugfix template inheritance could fail if {block} tags in childs did have similar name as used plugins (Issue #128) 06.01.2013 - Allow '://' URL syntax in template names of stream resources (Issue #129) diff --git a/libs/sysplugins/smarty_internal_compile_block.php b/libs/sysplugins/smarty_internal_compile_block.php index 11a67998..f760e551 100644 --- a/libs/sysplugins/smarty_internal_compile_block.php +++ b/libs/sysplugins/smarty_internal_compile_block.php @@ -89,8 +89,8 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_CompileBase { } else { $_name = trim($_match[3], '\'"'); if ($_match[8] != 'hide' || isset($template->block_data[$_name])) { // replace {$smarty.block.child} - // do we have {$smart.block.child} in nested {block} tags? - if (0 != preg_match_all("!({$_ldl}{$al}block\s+)(name=)?(\w+|'.*'|\".*\")([\s\S]*?)(hide)?(\s*{$_rdl})([\s\S]*?)({$_ldl}{$al}\\\$smarty\.block\.child\s*{$_rdl})([\s\S]*?{$_ldl}{$al}/block\s*{$_rdl})!", $block_content, $_match2)) { + // get nested block tags + if (0 != preg_match_all("!({$_ldl}{$al}block\s+)(name=)?(\w+|'.*'|\".*\")([\s\S]*?)(hide)?(\s*{$_rdl})([\s\S]*?)(.*)?({$_ldl}{$al}/block\s*{$_rdl})!", $block_content, $_match2)) { foreach ($_match2[3] as $key => $name) { // get it's replacement $_name2 = trim($name, '\'"'); @@ -101,12 +101,17 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_CompileBase { $replacement = ''; } // replace {$smarty.block.child} tag - $search = array("!({$_ldl}{$al}block[\s\S]*?{$name}[\s\S]*?{$_rdl})([\s\S]*?)({$_ldl}{$al}\\\$smarty\.block\.child\s*{$_rdl})([\s\S]*?)({$_ldl}{$al}/block\s*{$_rdl})!", "/§§§child§§§/"); - $replace = array('\2§§§child§§§\4', $replacement); - $block_content = preg_replace($search, $replace, $block_content); + if (preg_match("!{$_ldl}{$al}\\\$smarty\.block\.child\s*{$_rdl}!",$_match2[7][$key])) { + $replacement = preg_replace("!({$_ldl}{$al}\\\$smarty\.block\.child\s*{$_rdl})!", $replacement, $_match2[7][$key]); + $block_content = preg_replace("!(({$_ldl}{$al}block)(.*)?{$name}(.*)?({$_rdl}[\s\S]*?{$_ldl}{$al}/block\s*{$_rdl}))!", $replacement, $block_content); + } + if (preg_match("!{$_ldl}{$al}\\\$smarty\.block\.child\s*{$_rdl}!",$_match2[8][$key])) { + $replacement = preg_replace("!{$_ldl}{$al}\\\$smarty\.block\.child\s*{$_rdl}!", $replacement, $_match2[8][$key]); + $block_content = preg_replace("!(({$_ldl}{$al}block)(.*)?{$name}(.*)?({$_rdl})(.*)?({$_ldl}{$al}/block\s*{$_rdl}))!", $replacement, $block_content); + } } else { // remove hidden blocks - $block_content = preg_replace("!({$_ldl}{$al}block[\s\S]*?{$name}[\s\S]*?{$_rdl}[\s\S]*?{$_ldl}{$al}/block\s*{$_rdl})!", '', $block_content); + $block_content = preg_replace("!(({$_ldl}{$al}block)(.*)?{$name}(.*)?({$_rdl}[\s\S]*?{$_ldl}{$al}/block\s*{$_rdl}))!", '', $block_content); } } } From 993a2eac70292094272e06e3d328109da6794697 Mon Sep 17 00:00:00 2001 From: "uwe.tews@googlemail.com" Date: Wed, 9 Jan 2013 23:35:40 +0000 Subject: [PATCH 11/13] - enhancement to allow variable constant names like {$smarty.const.{$foo}} (Forum Topic 23970) --- change_log.txt | 1 + .../smarty_internal_compile_private_special_variable.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/change_log.txt b/change_log.txt index 61f236e4..46188013 100644 --- a/change_log.txt +++ b/change_log.txt @@ -3,6 +3,7 @@ - bugfix compilation did fail when a prefilter did modify an {extends} tag (Forum Topic 23966) - bugfix template inheritance could fail if nested {block} tags in childs did contain {$smarty.block.child} (Issue #127) - bugfix template inheritance could fail if {block} tags in childs did have similar name as used plugins (Issue #128) +- enhancement to allow variable constant names like {$smarty.const.{$foo}} (Forum Topic 23970) 06.01.2013 - Allow '://' URL syntax in template names of stream resources (Issue #129) diff --git a/libs/sysplugins/smarty_internal_compile_private_special_variable.php b/libs/sysplugins/smarty_internal_compile_private_special_variable.php index 986a11c1..af8fcd37 100644 --- a/libs/sysplugins/smarty_internal_compile_private_special_variable.php +++ b/libs/sysplugins/smarty_internal_compile_private_special_variable.php @@ -77,7 +77,7 @@ class Smarty_Internal_Compile_Private_Special_Variable extends Smarty_Internal_C $compiler->trigger_template_error("(secure mode) constants not permitted"); break; } - return '@' . trim($_index[1], "'"); + return "@constant({$_index[1]})"; case 'config': if (isset($_index[2])) { From af4735193e519f12e291a3d4cd762dd4a816b293 Mon Sep 17 00:00:00 2001 From: "uwe.tews@googlemail.com" Date: Wed, 9 Jan 2013 23:54:31 +0000 Subject: [PATCH 12/13] - added abstract method declaration doCompile() in Smarty_Internal_TemplateCompilerBase (Forum Topic 23969) --- change_log.txt | 2 +- libs/sysplugins/smarty_internal_templatecompilerbase.php | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/change_log.txt b/change_log.txt index 46188013..a69b9654 100644 --- a/change_log.txt +++ b/change_log.txt @@ -3,7 +3,7 @@ - bugfix compilation did fail when a prefilter did modify an {extends} tag (Forum Topic 23966) - bugfix template inheritance could fail if nested {block} tags in childs did contain {$smarty.block.child} (Issue #127) - bugfix template inheritance could fail if {block} tags in childs did have similar name as used plugins (Issue #128) -- enhancement to allow variable constant names like {$smarty.const.{$foo}} (Forum Topic 23970) +- added abstract method declaration doCompile() in Smarty_Internal_TemplateCompilerBase (Forum Topic 23969) 06.01.2013 - Allow '://' URL syntax in template names of stream resources (Issue #129) diff --git a/libs/sysplugins/smarty_internal_templatecompilerbase.php b/libs/sysplugins/smarty_internal_templatecompilerbase.php index 5eeb8ef6..11fc2144 100644 --- a/libs/sysplugins/smarty_internal_templatecompilerbase.php +++ b/libs/sysplugins/smarty_internal_templatecompilerbase.php @@ -136,6 +136,14 @@ abstract class Smarty_Internal_TemplateCompilerBase { */ public $known_modifier_type = array(); + /** + * Methode to compile a Smarty template + * + * @param mixed $_content template source + * @return bool true if compiling succeeded, false if it failed + */ + abstract protected function doCompile($_content); + /** * Initialize compiler */ From 73c7b32c8381d30213440036c0ba1ef9aaa2ea3d Mon Sep 17 00:00:00 2001 From: "uwe.tews@googlemail.com" Date: Sun, 13 Jan 2013 21:13:14 +0000 Subject: [PATCH 13/13] 13.01.2013 - enhancement allow to disable exception message escaping by SmartyException::$escape = false; (Issue #130) --- change_log.txt | 3 +++ libs/Smarty.class.php | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/change_log.txt b/change_log.txt index a69b9654..8527ab45 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,4 +1,7 @@ ===== trunk ===== +13.01.2013 +- enhancement allow to disable exception message escaping by SmartyException::$escape = false; (Issue #130) + 09.01.2013 - bugfix compilation did fail when a prefilter did modify an {extends} tag (Forum Topic 23966) - bugfix template inheritance could fail if nested {block} tags in childs did contain {$smarty.block.child} (Issue #127) diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index ccececae..af99a23c 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -1488,8 +1488,9 @@ if (Smarty::$_CHARSET !== 'UTF-8') { * @package Smarty */ class SmartyException extends Exception { + public static $escape = true; public function __construct($message) { - $this->message = htmlentities($message); + $this->message = self::$escape ? htmlentities($message) : $message; } }