From 549a69ba443af2d7a1287bf91155d44f0454fce9 Mon Sep 17 00:00:00 2001 From: boots Date: Sat, 29 Nov 2003 02:15:41 +0000 Subject: [PATCH] really make the fixes the last patch was supposed to do --- libs/plugins/function.config_load.php | 78 +++++++++++++-------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/libs/plugins/function.config_load.php b/libs/plugins/function.config_load.php index e92f7087..ccef07ac 100644 --- a/libs/plugins/function.config_load.php +++ b/libs/plugins/function.config_load.php @@ -25,15 +25,15 @@ function smarty_function_config_load($params, &$smarty) { if ($smarty->debugging) { - $_params = array(); + $_params = array(); require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.get_microtime.php'); $_debug_start_time = smarty_core_get_microtime($_params, $smarty); } - $_file = isset($params['file']) ? $smarty->_dequote($params['file']) : null; - $_section = isset($params['section']) ? $smarty->_dequote($params['section']) : null; - $_scope = isset($params['scope']) ? $smarty->_dequote($params['scope']) : 'global'; - $_global = isset($params['global']) ? $smarty->_dequote($params['global']) : false; + $_file = isset($params['file']) ? $smarty->_dequote($params['file']) : null; + $_section = isset($params['section']) ? $smarty->_dequote($params['section']) : null; + $_scope = isset($params['scope']) ? $smarty->_dequote($params['scope']) : 'global'; + $_global = isset($params['global']) ? $smarty->_dequote($params['global']) : false; if (!isset($_file) || strlen($_file) == 0) { $smarty->trigger_error("missing 'file' attribute in config_load tag", E_USER_ERROR, __FILE__, __LINE__); @@ -48,54 +48,54 @@ function smarty_function_config_load($params, &$smarty) } else { if ($_global) { $_scope = 'parent'; - } else { + } else { $_scope = 'local'; - } + } } if(@is_dir($smarty->config_dir)) { $_config_dir = $smarty->config_dir; } else { // config_dir not found, try include_path - $_params = array('file_path' => $smarty->config_dir); - require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.get_include_path.php'); + $_params = array('file_path' => $smarty->config_dir); + require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.get_include_path.php'); smarty_core_get_include_path($_params, $smarty); - $_config_dir = $_params['new_file_path']; + $_config_dir = $_params['new_file_path']; } - $_file_path = $_config_dir . DIRECTORY_SEPARATOR . $_file; + $_file_path = $_config_dir . DIRECTORY_SEPARATOR . $_file; if (isset($_section)) $_compile_file = $smarty->_get_compile_path($_file_path.'|'.$_section); else $_compile_file = $smarty->_get_compile_path($_file_path); - if($smarty->force_compile - || !file_exists($_compile_file) - || ($smarty->compile_check - && !$smarty->_is_compiled($_file_path, $_compile_file))) { - // compile config file - if(!is_object($smarty->_conf_obj)) { - require_once SMARTY_DIR . $smarty->config_class . '.class.php'; - $smarty->_conf_obj = new $smarty->config_class($_config_dir); - $smarty->_conf_obj->overwrite = $smarty->config_overwrite; - $smarty->_conf_obj->booleanize = $smarty->config_booleanize; - $smarty->_conf_obj->read_hidden = $smarty->config_read_hidden; - $smarty->_conf_obj->fix_newlines = $smarty->config_fix_newlines; - $smarty->_conf_obj->set_path = $_config_dir; - } - $_config_vars = array_merge($smarty->_conf_obj->get($_file), - $smarty->_conf_obj->get($_file, $_section)); - if(function_exists('var_export')) { - $_output = ''; - } else { - $_output = ''\\\'', '\\'=>'\\\\')) . '\'); ?>'; - } - $_params = (array('compile_path' => $_compile_file, 'compiled_content' => $_output, 'resource_timestamp' => filemtime($_file_path))); - require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.write_compiled_resource.php'); - smarty_core_write_compiled_resource($_params, $smarty); - } else { + if($smarty->force_compile + || !file_exists($_compile_file) + || ($smarty->compile_check + && !$smarty->_is_compiled($_file_path, $_compile_file))) { + // compile config file + if(!is_object($smarty->_conf_obj)) { + require_once SMARTY_DIR . $smarty->config_class . '.class.php'; + $smarty->_conf_obj = new $smarty->config_class($_config_dir); + $smarty->_conf_obj->overwrite = $smarty->config_overwrite; + $smarty->_conf_obj->booleanize = $smarty->config_booleanize; + $smarty->_conf_obj->read_hidden = $smarty->config_read_hidden; + $smarty->_conf_obj->fix_newlines = $smarty->config_fix_newlines; + $smarty->_conf_obj->set_path = $_config_dir; + } + $_config_vars = array_merge($smarty->_conf_obj->get($_file), + $smarty->_conf_obj->get($_file, $_section)); + if(function_exists('var_export')) { + $_output = ''; + } else { + $_output = ''\\\'', '\\'=>'\\\\')) . '\'); ?>'; + } + $_params = (array('compile_path' => $_compile_file, 'compiled_content' => $_output, 'resource_timestamp' => filemtime($_file_path))); + require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.write_compiled_resource.php'); + smarty_core_write_compiled_resource($_params, $smarty); + } else { include($_compile_file); - } + } if ($smarty->caching) { $smarty->_cache_info['config'][$_file] = true; @@ -115,8 +115,8 @@ function smarty_function_config_load($params, &$smarty) } if ($smarty->debugging) { - $_params = array(); - require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.get_microtime.php'); + $_params = array(); + require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.get_microtime.php'); $smarty->_smarty_debug_info[] = array('type' => 'config', 'filename' => $_file.' ['.$_section.'] '.$_scope, 'depth' => $smarty->_inclusion_depth,