29 if ($smarty->debugging) {
31 require_once(SMARTY_CORE_DIR .
'core.get_microtime.php');
35 $_file = isset($params[
'file']) ? $smarty->_dequote($params[
'file']) : null;
36 $_section = isset($params[
'section']) ? $smarty->_dequote($params[
'section']) : null;
37 $_scope = isset($params[
'scope']) ? $smarty->_dequote($params[
'scope']) :
'global';
38 $_global = isset($params[
'global']) ? $smarty->_dequote($params[
'global']) :
false;
40 if (!isset($_file) || strlen($_file) == 0) {
41 $smarty->trigger_error(
"missing 'file' attribute in config_load tag", E_USER_ERROR, __FILE__, __LINE__);
45 if ($_scope !=
'local' &&
46 $_scope !=
'parent' &&
47 $_scope !=
'global') {
48 $smarty->trigger_error(
"invalid 'scope' attribute value", E_USER_ERROR, __FILE__, __LINE__);
58 $_params = array(
'resource_name' => $_file,
59 'resource_base_path' => $smarty->config_dir,
60 'get_source' =>
false);
61 $smarty->_parse_resource_name($_params);
62 $_file_path = $_params[
'resource_type'] .
':' . $_params[
'resource_name'];
64 $_compile_file = $smarty->_get_compile_path($_file_path.
'|'.$_section);
66 $_compile_file = $smarty->_get_compile_path($_file_path);
68 if($smarty->force_compile || !file_exists($_compile_file)) {
70 } elseif ($smarty->compile_check) {
71 $_params = array(
'resource_name' => $_file,
72 'resource_base_path' => $smarty->config_dir,
73 'get_source' =>
false);
74 $_compile = $smarty->_fetch_resource_info($_params) &&
75 $_params[
'resource_timestamp'] > filemtime($_compile_file);
82 if(!is_object($smarty->_conf_obj)) {
83 require_once
SMARTY_DIR . $smarty->config_class .
'.class.php';
84 $smarty->_conf_obj =
new $smarty->config_class();
85 $smarty->_conf_obj->overwrite = $smarty->config_overwrite;
86 $smarty->_conf_obj->booleanize = $smarty->config_booleanize;
87 $smarty->_conf_obj->read_hidden = $smarty->config_read_hidden;
88 $smarty->_conf_obj->fix_newlines = $smarty->config_fix_newlines;
91 $_params = array(
'resource_name' => $_file,
92 'resource_base_path' => $smarty->config_dir,
93 $_params[
'get_source'] =
true);
94 if (!$smarty->_fetch_resource_info($_params)) {
97 $smarty->_conf_obj->set_file_contents($_file, $_params[
'source_content']);
98 $_config_vars = array_merge($smarty->_conf_obj->get($_file),
99 $smarty->_conf_obj->get($_file, $_section));
100 if(function_exists(
'var_export')) {
101 $_output =
'<?php $_config_vars = ' . var_export($_config_vars,
true) .
'; ?>';
103 $_output =
'<?php $_config_vars = unserialize(\'' . strtr(serialize($_config_vars),array(
'\''=>
'\\\'',
'\\'=>
'\\\\')) .
'\'); ?>
';
105 $_params = (array('compile_path
' => $_compile_file, 'compiled_content
' => $_output, 'resource_timestamp
' => $_params['resource_timestamp
']));
106 require_once(SMARTY_CORE_DIR . 'core.write_compiled_resource.php
');
107 smarty_core_write_compiled_resource($_params, $smarty);
109 include($_compile_file);
112 if ($smarty->caching) {
113 $smarty->_cache_info['config
'][$_file] = true;
116 $smarty->_config[0]['vars
'] = @array_merge($smarty->_config[0]['vars
'], $_config_vars);
117 $smarty->_config[0]['files
'][$_file] = true;
119 if ($_scope == 'parent
') {
120 $smarty->_config[1]['vars
'] = @array_merge($smarty->_config[1]['vars
'], $_config_vars);
121 $smarty->_config[1]['files
'][$_file] = true;
122 } else if ($_scope == 'global
') {
123 for ($i = 1, $for_max = count($smarty->_config); $i < $for_max; $i++) {
124 $smarty->_config[$i]['vars
'] = @array_merge($smarty->_config[$i]['vars
'], $_config_vars);
125 $smarty->_config[$i]['files
'][$_file] = true;
129 if ($smarty->debugging) {
131 require_once(SMARTY_CORE_DIR . 'core.get_microtime.php
');
132 $smarty->_smarty_debug_info[] = array('type
' => 'config
',
133 'filename
' => $_file.' [
'.$_section.']
'.$_scope,
134 'depth
' => $smarty->_inclusion_depth,
135 'exec_time
' => smarty_core_get_microtime($_params, $smarty) - $_debug_start_time);
140 /* vim: set expandtab: */