--- this is a major update with a couple of internal changes ---

- new config file lexer/parser (thanks to Thue Jnaus Kristensen)
- template lexer/parser fixes for PHP and {literal} handing (thanks to Thue Jnaus Kristensen)
- fix on registered plugins with different type but same name
- rewrite of plugin handling (optimized execution speed)
- closed a security hole regarding PHP code injection into cache files
- fixed bug in clear cache handling
- Renamed a couple of internal classes
- code cleanup for merging compiled templates
- couple of runtime optimizations (still not all done)
This commit is contained in:
Uwe.Tews
2009-12-27 15:06:49 +00:00
parent 5f02276a2a
commit 44dd7830dd
45 changed files with 3015 additions and 2784 deletions

View File

@@ -29,6 +29,7 @@ class Smarty_Internal_Compile_Function extends Smarty_Internal_CompileBase {
$save = array($_attr, $compiler->template->extracted_compiled_code, $compiler->template->extract_code);
$this->_open_tag('function', $save);
$_name = trim($_attr['name'], "'");
unset($_attr['name']);
foreach ($_attr as $_key => $_data) {
$compiler->template->properties['function'][$_name]['parameter'][$_key] = $_data;
}
@@ -56,20 +57,13 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase
{
$this->compiler = $compiler;
$this->compiler->has_code = false;
// turn off block code extraction
$compiler->template->extract_code = false;
// check and get attributes
$this->optional_attributes = array('name');
$_attr = $this->_get_attributes($args);
$saved_data = $this->_close_tag(array('function'));
// if name does match to opening tag
if (isset($_attr['name']) && $saved_data[0]['name'] != $_attr['name']) {
$this->compiler->trigger_template_error('mismatching name attributes "' . $saved_data[0]['name'] . '" and "' . $_attr['name'] . '"');
}
$_name = trim($saved_data[0]['name'], "'");
$compiler->template->properties['function'][$_name]['compiled'] = str_replace("\n",'_%n',$compiler->template->extracted_compiled_code);
$compiler->template->properties['function'][$_name]['compiled'] = $compiler->template->extracted_compiled_code;
$this->compiler->smarty->template_functions[$_name]['compiled'] = $compiler->template->extracted_compiled_code;
$this->compiler->smarty->template_functions[$_name]['parameter'] = $compiler->template->properties['function'][$_name]['parameter'];
// restore old code extraction status
$compiler->template->extracted_compiled_code = $saved_data[1];
$compiler->template->extract_code = $saved_data[2];
return true;