mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 10:54:27 +02:00
- reactivated $error_reporting property handling
- fixed typo in compile_continue - fixed security in {fetch} plugin - changed back plugin parameters to two. second is template object with transparent access to Smarty object - fixed {config_load} scoping form compile time to run time
This commit is contained in:
@@ -16,9 +16,9 @@
|
||||
* @param object $template template object
|
||||
* @return string content re-formatted
|
||||
*/
|
||||
function smarty_block_php($params, $content, $smarty, &$repeat, $template)
|
||||
function smarty_block_php($params, $content, $template, &$repeat)
|
||||
{
|
||||
if (!$smarty->allow_php_tag) {
|
||||
if (!$template->allow_php_tag) {
|
||||
throw new SmartyException("{php} is deprecated, set allow_php_tag = true to enable");
|
||||
}
|
||||
eval($content);
|
||||
|
@@ -32,7 +32,7 @@
|
||||
* @param object $template template object
|
||||
* @return string content re-formatted
|
||||
*/
|
||||
function smarty_block_textformat($params, $content, $smarty, &$repeat, $template)
|
||||
function smarty_block_textformat($params, $content, $template, &$repeat)
|
||||
{
|
||||
if (is_null($content)) {
|
||||
return;
|
||||
|
@@ -19,7 +19,7 @@
|
||||
* @param object $template template object
|
||||
* @return string|null
|
||||
*/
|
||||
function smarty_function_counter($params, $smarty, $template)
|
||||
function smarty_function_counter($params, $template)
|
||||
{
|
||||
static $counters = array();
|
||||
|
||||
|
@@ -44,7 +44,7 @@
|
||||
* @return string|null
|
||||
*/
|
||||
|
||||
function smarty_function_cycle($params, $smarty, $template)
|
||||
function smarty_function_cycle($params, $template)
|
||||
{
|
||||
static $cycle_vars;
|
||||
|
||||
|
@@ -21,7 +21,7 @@
|
||||
* @return string|null if the assign parameter is passed, Smarty assigns the
|
||||
* result to a template variable
|
||||
*/
|
||||
function smarty_function_fetch($params, $smarty, $template)
|
||||
function smarty_function_fetch($params, $template)
|
||||
{
|
||||
if (empty($params['file'])) {
|
||||
trigger_error("[plugin] fetch parameter 'file' cannot be empty",E_USER_NOTICE);
|
||||
@@ -29,8 +29,8 @@ function smarty_function_fetch($params, $smarty, $template)
|
||||
}
|
||||
|
||||
$content = '';
|
||||
if ($template->security && !preg_match('!^(http|ftp)://!i', $params['file'])) {
|
||||
if(!$smarty->security_handler->isTrustedResourceDir($params['file'])) {
|
||||
if (isset($template->security_policy) && !preg_match('!^(http|ftp)://!i', $params['file'])) {
|
||||
if(!$template->security_policy->isTrustedResourceDir($params['file'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -39,7 +39,7 @@
|
||||
* @return string
|
||||
* @uses smarty_function_escape_special_chars()
|
||||
*/
|
||||
function smarty_function_html_checkboxes($params, $smarty, $template)
|
||||
function smarty_function_html_checkboxes($params, $template)
|
||||
{
|
||||
require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
|
||||
//$smarty->loadPlugin('Smarty_shared_escape_special_chars');
|
||||
|
@@ -34,7 +34,7 @@
|
||||
* @return string
|
||||
* @uses smarty_function_escape_special_chars()
|
||||
*/
|
||||
function smarty_function_html_image($params, $smarty, $template)
|
||||
function smarty_function_html_image($params, $template)
|
||||
{
|
||||
require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
|
||||
//$smarty->loadPlugin('Smarty_shared_escape_special_chars');
|
||||
@@ -47,7 +47,7 @@ function smarty_function_html_image($params, $smarty, $template)
|
||||
$prefix = '';
|
||||
$suffix = '';
|
||||
$path_prefix = '';
|
||||
$server_vars = ($smarty->request_use_auto_globals) ? $_SERVER : $GLOBALS['HTTP_SERVER_VARS'];
|
||||
$server_vars = ($template->request_use_auto_globals) ? $_SERVER : $GLOBALS['HTTP_SERVER_VARS'];
|
||||
$basedir = isset($server_vars['DOCUMENT_ROOT']) ? $server_vars['DOCUMENT_ROOT'] : '';
|
||||
foreach($params as $_key => $_val) {
|
||||
switch ($_key) {
|
||||
@@ -108,8 +108,8 @@ function smarty_function_html_image($params, $smarty, $template)
|
||||
return;
|
||||
}
|
||||
}
|
||||
if ($template->security) {
|
||||
if (!$smarty->security_handler->isTrustedResourceDir($_image_path)) {
|
||||
if (isset($template->security_policy)) {
|
||||
if (!$template->security_policy->isTrustedResourceDir($_image_path)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@@ -29,7 +29,7 @@
|
||||
* @return string
|
||||
* @uses smarty_function_escape_special_chars()
|
||||
*/
|
||||
function smarty_function_html_options($params, $smarty, $template)
|
||||
function smarty_function_html_options($params, $template)
|
||||
{
|
||||
require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
|
||||
//$smarty->loadPlugin('Smarty_shared_escape_special_chars');
|
||||
|
@@ -40,7 +40,7 @@
|
||||
* @return string
|
||||
* @uses smarty_function_escape_special_chars()
|
||||
*/
|
||||
function smarty_function_html_radios($params, $smarty, $template)
|
||||
function smarty_function_html_radios($params, $template)
|
||||
{
|
||||
require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
|
||||
//$smarty->loadPlugin('Smarty_shared_escape_special_chars');
|
||||
|
@@ -38,7 +38,7 @@
|
||||
* @param object $template template object
|
||||
* @return string
|
||||
*/
|
||||
function smarty_function_html_select_date($params, $smarty, $template)
|
||||
function smarty_function_html_select_date($params, $template)
|
||||
{
|
||||
require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
|
||||
require_once(SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php');
|
||||
|
@@ -23,7 +23,7 @@
|
||||
* @return string
|
||||
* @uses smarty_make_timestamp()
|
||||
*/
|
||||
function smarty_function_html_select_time($params, $smarty, $template)
|
||||
function smarty_function_html_select_time($params, $template)
|
||||
{
|
||||
require_once(SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php');
|
||||
require_once(SMARTY_PLUGINS_DIR . 'function.html_options.php');
|
||||
|
@@ -48,7 +48,7 @@
|
||||
* @param object $template template object
|
||||
* @return string
|
||||
*/
|
||||
function smarty_function_html_table($params, $smarty, $template)
|
||||
function smarty_function_html_table($params, $template)
|
||||
{
|
||||
$table_attr = 'border="1"';
|
||||
$tr_attr = '';
|
||||
|
@@ -49,7 +49,7 @@
|
||||
* @param object $template template object
|
||||
* @return string
|
||||
*/
|
||||
function smarty_function_mailto($params, $smarty, $template)
|
||||
function smarty_function_mailto($params, $template)
|
||||
{
|
||||
$extra = '';
|
||||
|
||||
|
@@ -21,7 +21,7 @@
|
||||
* @param object $template template object
|
||||
* @return string|null
|
||||
*/
|
||||
function smarty_function_math($params, $smarty, $template)
|
||||
function smarty_function_math($params, $template)
|
||||
{
|
||||
// be sure equation parameter is present
|
||||
if (empty($params['equation'])) {
|
||||
|
@@ -20,7 +20,7 @@
|
||||
* @param object $template template object
|
||||
* @return string
|
||||
*/
|
||||
function smarty_function_popup($params, $smarty, $template)
|
||||
function smarty_function_popup($params, $template)
|
||||
{
|
||||
$append = '';
|
||||
foreach ($params as $_key=>$_value) {
|
||||
|
@@ -21,7 +21,7 @@
|
||||
* @return string
|
||||
*/
|
||||
|
||||
function smarty_function_popup_init($params, $smarty, $template)
|
||||
function smarty_function_popup_init($params, $template)
|
||||
{
|
||||
$zindex = 1000;
|
||||
|
||||
|
@@ -44,23 +44,19 @@ class Smarty_Internal_Compile_Config_Load extends Smarty_Internal_CompileBase {
|
||||
} else {
|
||||
$section = 'null';
|
||||
}
|
||||
$scope = '$_smarty_tpl';
|
||||
$scope = 'local';
|
||||
// scope setup
|
||||
if (isset($_attr['scope'])) {
|
||||
$_attr['scope'] = trim($_attr['scope'], "'\"");
|
||||
if ($_attr['scope'] == 'parent') {
|
||||
$scope = '$_smarty_tpl->parent';
|
||||
} elseif ($_attr['scope'] == 'local') {
|
||||
$scope = '$_smarty_tpl';
|
||||
} elseif ($_attr['scope'] == 'global') {
|
||||
$scope = '$_smarty_tpl->smarty';
|
||||
if (in_array($_attr['scope'],array('local','parent','root','global'))) {
|
||||
$scope = $_attr['scope'];
|
||||
} else {
|
||||
$this->compiler->trigger_template_error('illegal value for "scope" attribute', $this->compiler->lex->taglineno);
|
||||
}
|
||||
}
|
||||
}
|
||||
// create config object
|
||||
$_output = "<?php \$_config = new Smarty_Internal_Config($conf_file, \$_smarty_tpl->smarty, \$_smarty_tpl);";
|
||||
$_output .= "\$_config->loadConfigVars($section, $scope); ?>";
|
||||
$_output .= "\$_config->loadConfigVars($section, '$scope'); ?>";
|
||||
return $_output;
|
||||
}
|
||||
}
|
||||
|
@@ -26,7 +26,7 @@ class Smarty_Internal_Compile_Continue extends Smarty_Internal_CompileBase {
|
||||
* @return string compiled code
|
||||
*/
|
||||
public function compile($args, $compiler, $parameter)
|
||||
{ {
|
||||
{
|
||||
$this->compiler = $compiler;
|
||||
$this->smarty = $compiler->smarty;
|
||||
// check and get attributes
|
||||
|
@@ -106,14 +106,14 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase {
|
||||
if ($_smarty_tpl->caching) {
|
||||
$_output .= "echo Smarty_Internal_Nocache_Insert::compile ('{$_function}',{$_params}, \$_smarty_tpl, '{$_filepath}',{$_assign});?>";
|
||||
} else {
|
||||
$_output .= "\$_smarty_tpl->assign({$_assign} , {$_function} ({$_params},\$_smarty_tpl->smarty,\$_smarty_tpl), true);?>";
|
||||
$_output .= "\$_smarty_tpl->assign({$_assign} , {$_function} ({$_params},\$_smarty_tpl), true);?>";
|
||||
}
|
||||
} else {
|
||||
$this->compiler->has_output = true;
|
||||
if ($_smarty_tpl->caching) {
|
||||
$_output .= "echo Smarty_Internal_Nocache_Insert::compile ('{$_function}',{$_params}, \$_smarty_tpl, '{$_filepath}');?>";
|
||||
} else {
|
||||
$_output .= "echo {$_function}({$_params},\$_smarty_tpl->smarty,\$_smarty_tpl);?>";
|
||||
$_output .= "echo {$_function}({$_params},\$_smarty_tpl);?>";
|
||||
}
|
||||
}
|
||||
return $_output;
|
||||
|
@@ -52,7 +52,7 @@ class Smarty_Internal_Compile_Private_Block_Plugin extends Smarty_Internal_Compi
|
||||
// maybe nocache because of nocache variables or nocache plugin
|
||||
$this->compiler->nocache = $this->compiler->nocache | $this->compiler->tag_nocache;
|
||||
// compile code
|
||||
$output = "<?php \$_smarty_tpl->smarty->_tag_stack[] = array('{$tag}', {$_params}); \$_block_repeat=true; {$function}({$_params}, null, \$_smarty_tpl->smarty, \$_block_repeat, \$_smarty_tpl);while (\$_block_repeat) { ob_start();?>";
|
||||
$output = "<?php \$_smarty_tpl->smarty->_tag_stack[] = array('{$tag}', {$_params}); \$_block_repeat=true; {$function}({$_params}, null, \$_smarty_tpl, \$_block_repeat);while (\$_block_repeat) { ob_start();?>";
|
||||
} else {
|
||||
// must endblock be nocache?
|
||||
if ($this->compiler->nocache) {
|
||||
@@ -63,7 +63,7 @@ class Smarty_Internal_Compile_Private_Block_Plugin extends Smarty_Internal_Compi
|
||||
// This tag does create output
|
||||
$this->compiler->has_output = true;
|
||||
// compile code
|
||||
$output = "<?php \$_block_content = ob_get_clean(); \$_block_repeat=false; echo {$function}({$_params}, \$_block_content, \$_smarty_tpl->smarty, \$_block_repeat, \$_smarty_tpl); } array_pop(\$_smarty_tpl->smarty->_tag_stack);?>";
|
||||
$output = "<?php \$_block_content = ob_get_clean(); \$_block_repeat=false; echo {$function}({$_params}, \$_block_content, \$_smarty_tpl, \$_block_repeat); } array_pop(\$_smarty_tpl->smarty->_tag_stack);?>";
|
||||
}
|
||||
return $output . "\n";
|
||||
}
|
||||
|
@@ -50,7 +50,7 @@ class Smarty_Internal_Compile_Private_Function_Plugin extends Smarty_Internal_Co
|
||||
}
|
||||
$_params = 'array(' . implode(",", $_paramsArray) . ')';
|
||||
// compile code
|
||||
$output = "<?php echo {$function}({$_params},\$_smarty_tpl->smarty,\$_smarty_tpl);?>\n";
|
||||
$output = "<?php echo {$function}({$_params},\$_smarty_tpl);?>\n";
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
@@ -53,7 +53,7 @@ class Smarty_Internal_Compile_Private_Object_Block_Function extends Smarty_Inter
|
||||
// maybe nocache because of nocache variables or nocache plugin
|
||||
$this->compiler->nocache = $this->compiler->nocache | $this->compiler->tag_nocache;
|
||||
// compile code
|
||||
$output = "<?php \$_smarty_tpl->smarty->_tag_stack[] = array('{$tag}->{$methode}', {$_params}); \$_block_repeat=true; \$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$methode}({$_params}, null, \$_smarty_tpl->smarty, \$_block_repeat, \$_smarty_tpl);while (\$_block_repeat) { ob_start();?>";
|
||||
$output = "<?php \$_smarty_tpl->smarty->_tag_stack[] = array('{$tag}->{$methode}', {$_params}); \$_block_repeat=true; \$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$methode}({$_params}, null, \$_smarty_tpl, \$_block_repeat);while (\$_block_repeat) { ob_start();?>";
|
||||
} else {
|
||||
$base_tag = substr($tag, 0, -5);
|
||||
// must endblock be nocache?
|
||||
|
@@ -52,7 +52,7 @@ class Smarty_Internal_Compile_Private_Object_Function extends Smarty_Internal_Co
|
||||
}
|
||||
}
|
||||
$_params = 'array(' . implode(",", $_paramsArray) . ')';
|
||||
$return = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$methode}({$_params},\$_smarty_tpl->smarty,\$_smarty_tpl)";
|
||||
$return = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$methode}({$_params},\$_smarty_tpl)";
|
||||
} else {
|
||||
$_params = implode(",", $_attr);
|
||||
$return = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$methode}({$_params})";
|
||||
|
@@ -53,11 +53,11 @@ class Smarty_Internal_Compile_Private_Registered_Block extends Smarty_Internal_C
|
||||
$function = $compiler->smarty->registered_plugins[Smarty::PLUGIN_BLOCK][$tag][0];
|
||||
// compile code
|
||||
if (!is_array($function)) {
|
||||
$output = "<?php \$_smarty_tpl->smarty->_tag_stack[] = array('{$tag}', {$_params}); \$_block_repeat=true; {$function}({$_params}, null, \$_smarty_tpl->smarty, \$_block_repeat, \$_smarty_tpl);while (\$_block_repeat) { ob_start();?>";
|
||||
$output = "<?php \$_smarty_tpl->smarty->_tag_stack[] = array('{$tag}', {$_params}); \$_block_repeat=true; {$function}({$_params}, null, \$_smarty_tpl, \$_block_repeat);while (\$_block_repeat) { ob_start();?>";
|
||||
} else if (is_object($function[0])) {
|
||||
$output = "<?php \$_smarty_tpl->smarty->_tag_stack[] = array('{$tag}', {$_params}); \$_block_repeat=true; \$_smarty_tpl->smarty->registered_plugins['block']['{$tag}'][0][0]->{$function[1]}({$_params}, null, \$_smarty_tpl->smarty, \$_block_repeat, \$_smarty_tpl);while (\$_block_repeat) { ob_start();?>";
|
||||
$output = "<?php \$_smarty_tpl->smarty->_tag_stack[] = array('{$tag}', {$_params}); \$_block_repeat=true; \$_smarty_tpl->smarty->registered_plugins['block']['{$tag}'][0][0]->{$function[1]}({$_params}, null, \$_smarty_tpl, \$_block_repeat);while (\$_block_repeat) { ob_start();?>";
|
||||
} else {
|
||||
$output = "<?php \$_smarty_tpl->smarty->_tag_stack[] = array('{$tag}', {$_params}); \$_block_repeat=true; {$function[0]}::{$function[1]}({$_params}, null, \$_smarty_tpl->smarty, \$_block_repeat, \$_smarty_tpl);while (\$_block_repeat) { ob_start();?>";
|
||||
$output = "<?php \$_smarty_tpl->smarty->_tag_stack[] = array('{$tag}', {$_params}); \$_block_repeat=true; {$function[0]}::{$function[1]}({$_params}, null, \$_smarty_tpl, \$_block_repeat);while (\$_block_repeat) { ob_start();?>";
|
||||
}
|
||||
} else {
|
||||
// must endblock be nocache?
|
||||
@@ -72,11 +72,11 @@ class Smarty_Internal_Compile_Private_Registered_Block extends Smarty_Internal_C
|
||||
$function = $compiler->smarty->registered_plugins[Smarty::PLUGIN_BLOCK][$base_tag][0];
|
||||
// compile code
|
||||
if (!is_array($function)) {
|
||||
$output = "<?php \$_block_content = ob_get_clean(); \$_block_repeat=false; echo {$function}({$_params}, \$_block_content, \$_smarty_tpl->smarty, \$_block_repeat, \$_smarty_tpl); } array_pop(\$_smarty_tpl->smarty->_tag_stack);?>";
|
||||
$output = "<?php \$_block_content = ob_get_clean(); \$_block_repeat=false; echo {$function}({$_params}, \$_block_content, \$_smarty_tpl, \$_block_repeat); } array_pop(\$_smarty_tpl->smarty->_tag_stack);?>";
|
||||
} else if (is_object($function[0])) {
|
||||
$output = "<?php \$_block_content = ob_get_clean(); \$_block_repeat=false; echo \$_smarty_tpl->smarty->registered_plugins['block']['{$base_tag}'][0][0]->{$function[1]}({$_params}, \$_block_content, \$_smarty_tpl->smarty, \$_block_repeat, \$_smarty_tpl); } array_pop(\$_smarty_tpl->smarty->_tag_stack);?>";
|
||||
$output = "<?php \$_block_content = ob_get_clean(); \$_block_repeat=false; echo \$_smarty_tpl->smarty->registered_plugins['block']['{$base_tag}'][0][0]->{$function[1]}({$_params}, \$_block_content, \$_smarty_tpl, \$_block_repeat); } array_pop(\$_smarty_tpl->smarty->_tag_stack);?>";
|
||||
} else {
|
||||
$output = "<?php \$_block_content = ob_get_clean(); \$_block_repeat=false; echo {$function[0]}::{$function[1]}({$_params}, \$_block_content, \$_smarty_tpl->smarty, \$_block_repeat, \$_smarty_tpl); } array_pop(\$_smarty_tpl->smarty->_tag_stack);?>";
|
||||
$output = "<?php \$_block_content = ob_get_clean(); \$_block_repeat=false; echo {$function[0]}::{$function[1]}({$_params}, \$_block_content, \$_smarty_tpl, \$_block_repeat); } array_pop(\$_smarty_tpl->smarty->_tag_stack);?>";
|
||||
}
|
||||
}
|
||||
return $output."\n";
|
||||
|
@@ -51,11 +51,11 @@ class Smarty_Internal_Compile_Private_Registered_Function extends Smarty_Interna
|
||||
$function = $compiler->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION][$tag][0];
|
||||
// compile code
|
||||
if (!is_array($function)) {
|
||||
$output = "<?php echo {$function}({$_params},\$_smarty_tpl->smarty,\$_smarty_tpl);?>\n";
|
||||
$output = "<?php echo {$function}({$_params},\$_smarty_tpl);?>\n";
|
||||
} else if (is_object($function[0])) {
|
||||
$output = "<?php echo \$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['{$tag}'][0][0]->{$function[1]}({$_params},\$_smarty_tpl->smarty,\$_smarty_tpl);?>\n";
|
||||
$output = "<?php echo \$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['{$tag}'][0][0]->{$function[1]}({$_params},\$_smarty_tpl);?>\n";
|
||||
} else {
|
||||
$output = "<?php echo {$function[0]}::{$function[1]}({$_params},\$_smarty_tpl->smarty,\$_smarty_tpl);?>\n";
|
||||
$output = "<?php echo {$function[0]}::{$function[1]}({$_params},\$_smarty_tpl);?>\n";
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
@@ -12,9 +12,9 @@
|
||||
class Smarty_Internal_Config {
|
||||
static $config_objects = array();
|
||||
|
||||
public function __construct($config_resource, $smarty, $template = null)
|
||||
public function __construct($config_resource, $smarty, $data = null)
|
||||
{
|
||||
$this->template = $template;
|
||||
$this->data = $data;
|
||||
$this->smarty = $smarty;
|
||||
$this->config_resource = $config_resource;
|
||||
$this->config_resource_type = null;
|
||||
@@ -238,39 +238,52 @@ class Smarty_Internal_Config {
|
||||
* @param mixed $sections array of section names, single section or null
|
||||
* @param object $scope global,parent or local
|
||||
*/
|
||||
public function loadConfigVars ($sections = null, $scope)
|
||||
public function loadConfigVars ($sections = null, $scope = 'local')
|
||||
{
|
||||
if (isset($this->template)) {
|
||||
$this->template->properties['file_dependency'][sha1($this->getConfigFilepath())] = array($this->getConfigFilepath(), $this->getTimestamp(),'file');
|
||||
} else {
|
||||
$this->smarty->properties['file_dependency'][sha1($this->getConfigFilepath())] = array($this->getConfigFilepath(), $this->getTimestamp(),'file');
|
||||
if ($this->data instanceof Smarty_Internal_Template) {
|
||||
$this->data->properties['file_dependency'][sha1($this->getConfigFilepath())] = array($this->getConfigFilepath(), $this->getTimestamp(),'file');
|
||||
}
|
||||
if ($this->mustCompile()) {
|
||||
$this->compileConfigSource();
|
||||
}
|
||||
}
|
||||
// pointer to scope
|
||||
if ($scope == 'local') {
|
||||
$scope_ptr = $this->data;
|
||||
} elseif ($scope == 'parent') {
|
||||
if (isset($this->data->parent)) {
|
||||
$scope_ptr = $this->data->parent;
|
||||
} else {
|
||||
$scope_ptr = $this->data;
|
||||
}
|
||||
} elseif ($scope == 'root' || $scope == 'global') {
|
||||
$scope_ptr = $this->data;
|
||||
while (isset($scope_ptr->parent)) {
|
||||
$scope_ptr = $scope_ptr->parent;
|
||||
}
|
||||
}
|
||||
$_config_vars = array();
|
||||
include($this->getCompiledFilepath ());
|
||||
include($this->getCompiledFilepath ());
|
||||
// copy global config vars
|
||||
foreach ($_config_vars['vars'] as $variable => $value) {
|
||||
if ($this->smarty->config_overwrite || !isset($scope->config_vars[$variable])) {
|
||||
if ($this->smarty->config_overwrite || !isset($scope_ptr->config_vars[$variable])) {
|
||||
$scope->config_vars[$variable] = $value;
|
||||
$scope_ptr->config_vars[$variable] = $value;
|
||||
} else {
|
||||
$scope->config_vars[$variable] = array_merge((array)$scope->config_vars[$variable], (array)$value);
|
||||
$scope_ptr->config_vars[$variable] = array_merge((array)$scope_ptr->config_vars[$variable], (array)$value);
|
||||
}
|
||||
}
|
||||
// scan sections
|
||||
foreach ($_config_vars['sections'] as $this_section => $dummy) {
|
||||
if ($sections == null || in_array($this_section, (array)$sections)) {
|
||||
foreach ($_config_vars['sections'][$this_section]['vars'] as $variable => $value) {
|
||||
if ($this->smarty->config_overwrite || !isset($scope->config_vars[$variable])) {
|
||||
$scope->config_vars[$variable] = $value;
|
||||
if ($this->smarty->config_overwrite || !isset($scope_ptr->config_vars[$variable])) {
|
||||
$scope_ptr->config_vars[$variable] = $value;
|
||||
} else {
|
||||
$scope->config_vars[$variable] = array_merge((array)$scope->config_vars[$variable], (array)$value);
|
||||
$scope_ptr->config_vars[$variable] = array_merge((array)$scope_ptr->config_vars[$variable], (array)$value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@@ -247,8 +247,8 @@ class Smarty_Internal_Data {
|
||||
public function configLoad($config_file, $sections = null)
|
||||
{
|
||||
// load Config class
|
||||
$config = new Smarty_Internal_Config($config_file, $this->smarty);
|
||||
$config->loadConfigVars($sections, $this);
|
||||
$config = new Smarty_Internal_Config($config_file, $this->smarty, $this);
|
||||
$config->loadConfigVars($sections);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -34,9 +34,9 @@ class Smarty_Internal_Nocache_Insert {
|
||||
}
|
||||
// call insert
|
||||
if (isset($_assign)) {
|
||||
$_output .= "\$_smarty_tpl->assign('{$_assign}' , {$_function} (" . var_export($_attr, true) . ",\$_smarty_tpl->smarty,\$_smarty_tpl), true);?>";
|
||||
$_output .= "\$_smarty_tpl->assign('{$_assign}' , {$_function} (" . var_export($_attr, true) . ",\$_smarty_tpl), true);?>";
|
||||
} else {
|
||||
$_output .= "echo {$_function}(" . var_export($_attr, true) . ",\$_smarty_tpl->smarty,\$_smarty_tpl);?>";
|
||||
$_output .= "echo {$_function}(" . var_export($_attr, true) . ",\$_smarty_tpl);?>";
|
||||
}
|
||||
$_tpl = $_template;
|
||||
while ($_tpl->parent instanceof Smarty_Internal_Template) {
|
||||
|
Reference in New Issue
Block a user