diff --git a/change_log.txt b/change_log.txt index 33178537..87cfb356 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,4 +1,10 @@ ===== SVN trunk ===== +31/12/2010 +- bugfix dynamic configuration of $debugging_crtl did not work +- bugfix default value of $config_read_hidden changed to false +- bugfix format of attribute array on compiler plugins +- bugfix getTemplateVars() could return value from wrong scope + 28/12/2010 - bugfix multiple {append} tags failed to compile. diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index e3e5aba5..04f49d3e 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -181,7 +181,7 @@ class Smarty extends Smarty_Internal_Data { // config var settings public $config_overwrite = true; //Controls whether variables with the same name overwrite each other. public $config_booleanize = true; //Controls whether config values of on/true/yes and off/false/no get converted to boolean - public $config_read_hidden = true; //Controls whether hidden config sections/vars are read from the file. + public $config_read_hidden = false; //Controls whether hidden config sections/vars are read from the file. // config vars public $config_vars = array(); // assigned tpl vars @@ -259,31 +259,6 @@ class Smarty extends Smarty_Internal_Data { $this->cache_dir = '.' . DS . 'cache' . DS; $this->config_dir = '.' . DS . 'configs' . DS; $this->debug_tpl = SMARTY_DIR . 'debug.tpl'; - if (!$this->debugging && $this->debugging_ctrl == 'URL') { - if (isset($_SERVER['QUERY_STRING'])) { - $_query_string = $_SERVER['QUERY_STRING']; - } else { - $_query_string = ''; - } - if (false !== strpos($_query_string, $this->smarty_debug_id)) { - if (false !== strpos($_query_string, $this->smarty_debug_id . '=on')) { - // enable debugging for this browser session - setcookie('SMARTY_DEBUG', true); - $this->debugging = true; - } elseif (false !== strpos($_query_string, $this->smarty_debug_id . '=off')) { - // disable debugging for this browser session - setcookie('SMARTY_DEBUG', false); - $this->debugging = false; - } else { - // enable debugging for this page - $this->debugging = true; - } - } else { - if (isset($_COOKIE['SMARTY_DEBUG'])) { - $this->debugging = true; - } - } - } if (isset($_SERVER['SCRIPT_NAME'])) { $this->assignGlobal('SCRIPT_NAME', $_SERVER['SCRIPT_NAME']); } @@ -321,6 +296,32 @@ class Smarty extends Smarty_Internal_Data { if (isset($this->error_reporting)) { $_smarty_old_error_level = error_reporting($this->error_reporting); } + // check URL debugging control + if (!$this->debugging && $this->debugging_ctrl == 'URL') { + if (isset($_SERVER['QUERY_STRING'])) { + $_query_string = $_SERVER['QUERY_STRING']; + } else { + $_query_string = ''; + } + if (false !== strpos($_query_string, $this->smarty_debug_id)) { + if (false !== strpos($_query_string, $this->smarty_debug_id . '=on')) { + // enable debugging for this browser session + setcookie('SMARTY_DEBUG', true); + $this->debugging = true; + } elseif (false !== strpos($_query_string, $this->smarty_debug_id . '=off')) { + // disable debugging for this browser session + setcookie('SMARTY_DEBUG', false); + $this->debugging = false; + } else { + // enable debugging for this page + $this->debugging = true; + } + } else { + if (isset($_COOKIE['SMARTY_DEBUG'])) { + $this->debugging = true; + } + } + } // obtain data for cache modified check if ($this->cache_modified_check && $this->caching && $display) { $_isCached = $_template->isCached() && !$_template->has_nocache_code; diff --git a/libs/sysplugins/smarty_internal_data.php b/libs/sysplugins/smarty_internal_data.php index 17818827..609376ec 100644 --- a/libs/sysplugins/smarty_internal_data.php +++ b/libs/sysplugins/smarty_internal_data.php @@ -196,7 +196,9 @@ class Smarty_Internal_Data { $_ptr = $this; } while ($_ptr !== null) { foreach ($_ptr->tpl_vars AS $key => $var) { - $_result[$key] = $var->value; + if (!array_key_exists($key, $_result)) { + $_result[$key] = $var->value; + } } // not found, try at parent if ($search_parents) { @@ -207,7 +209,9 @@ class Smarty_Internal_Data { } if ($search_parents && isset(Smarty::$global_tpl_vars)) { foreach (Smarty::$global_tpl_vars AS $key => $var) { - $_result[$key] = $var->value; + if (!array_key_exists($key, $_result)) { + $_result[$key] = $var->value; + } } } return $_result; diff --git a/libs/sysplugins/smarty_internal_templatecompilerbase.php b/libs/sysplugins/smarty_internal_templatecompilerbase.php index da53a0fa..77df3570 100644 --- a/libs/sysplugins/smarty_internal_templatecompilerbase.php +++ b/libs/sysplugins/smarty_internal_templatecompilerbase.php @@ -196,7 +196,12 @@ class Smarty_Internal_TemplateCompilerBase { if ($plugin_type == Smarty::PLUGIN_BLOCK && $this->smarty->loadPlugin('smarty_compiler_' . $tag)) { $plugin = 'smarty_compiler_' . $tag; if (is_callable($plugin)) { - return $plugin($args, $this->smarty); + // convert arguments format for old compiler plugins + $new_args = array(); + foreach ($args as $mixed) { + $new_args = array_merge($new_args, $mixed); + } + return $plugin($new_args, $this->smarty); } if (class_exists($plugin, false)) { $plugin_object = new $plugin;