92 return $this->compiled_filepath === null ?
94 $this->compiled_filepath;
104 $_compile_id = isset($this->smarty->compile_id) ? preg_replace(
'![^\w\|]+!',
'_', $this->smarty->compile_id) : null;
105 $_flag = (int) $this->smarty->config_read_hidden + (
int) $this->smarty->config_booleanize * 2
106 + (int) $this->smarty->config_overwrite * 4;
107 $_filepath = sha1($this->source->name . $_flag);
109 if ($this->smarty->use_sub_dirs) {
110 $_filepath = substr($_filepath, 0, 2) . DS
111 . substr($_filepath, 2, 2) . DS
112 . substr($_filepath, 4, 2) . DS
115 $_compile_dir_sep = $this->smarty->use_sub_dirs ? DS :
'^';
116 if (isset($_compile_id)) {
117 $_filepath = $_compile_id . $_compile_dir_sep . $_filepath;
119 $_compile_dir = $this->smarty->getCompileDir();
120 return $_compile_dir . $_filepath .
'.' . basename($this->source->name) .
'.config' .
'.php';
130 return $this->compiled_timestamp === null
158 if ($this->compiled_config === null) {
177 if (!is_object($this->compiler_object)) {
182 if ($this->smarty->compile_locking) {
189 $this->compiler_object->compileSource($this);
190 }
catch (Exception $e) {
192 if ($this->smarty->compile_locking && $saved_timestamp) {
211 $this->data->properties[
'file_dependency'][sha1($this->source->filepath)] = array($this->source->filepath, $this->source->timestamp,
'file');
217 if ($scope ==
'local') {
219 }
elseif ($scope ==
'parent') {
220 if (isset($this->data->parent)) {
221 $scope_ptr = $this->data->parent;
225 }
elseif ($scope ==
'root' || $scope ==
'global') {
227 while (isset($scope_ptr->parent)) {
228 $scope_ptr = $scope_ptr->parent;
231 $_config_vars = array();
234 foreach ($_config_vars[
'vars'] as $variable => $value) {
235 if ($this->smarty->config_overwrite || !isset($scope_ptr->config_vars[$variable])) {
236 $scope_ptr->config_vars[$variable] = $value;
238 $scope_ptr->config_vars[$variable] = array_merge((array) $scope_ptr->config_vars[$variable], (array) $value);
242 if (!empty($sections)) {
243 foreach ((array) $sections as $this_section) {
244 if (isset($_config_vars[
'sections'][$this_section])) {
245 foreach ($_config_vars[
'sections'][$this_section][
'vars'] as $variable => $value) {
246 if ($this->smarty->config_overwrite || !isset($scope_ptr->config_vars[$variable])) {
247 $scope_ptr->config_vars[$variable] = $value;
249 $scope_ptr->config_vars[$variable] = array_merge((array) $scope_ptr->config_vars[$variable], (array) $value);
264 public function __set($property_name, $value)
266 switch ($property_name) {
269 $this->$property_name = $value;
273 throw new SmartyException(
"invalid config property '$property_name'.");
282 public function __get($property_name)
284 switch ($property_name) {
286 if (empty($this->config_resource)) {
287 throw new SmartyException(
"Unable to parse resource name \"{$this->config_resource}\"");
290 return $this->source;
293 $this->compiled = $this->source->getCompiled($this);
294 return $this->compiled;
297 throw new SmartyException(
"config attribute '$property_name' does not exist.");
getCompiledTimestamp()
Returns the timpestamp of the compiled file.
mustCompile()
Returns if the current config file must be compiled.
__construct($config_resource, $smarty, $data=null)
Constructor of config file object.
getCompiledFilepath()
Returns the compiled filepath.
loadConfigVars($sections=null, $scope= 'local')
load config variables
static config(Smarty_Internal_Config $_config)
initialize Config Source Object for given resource
if(strlen($date2)== '10') if($type== 'users-by-age'&&a_priv('admin_users', true)) elseif($type== 'forums-count'&&a_priv('admin_content', true)) elseif($type== 'forums-categories'&&a_priv('admin_content', true)) elseif($type== 'users-count'&&a_priv('admin_users', true)) elseif($type== 'product-categories'&&a_priv('admin_products', true)) elseif($type== 'users-by-sex'&&a_priv('admin_users', true)) elseif($type== 'users-by-country'&&a_priv('admin_users', true)) elseif($type== 'sales'&&a_priv('admin_sales', true))
compileConfigSource()
Compiles the config files.
__get($property_name)
get Smarty property in template context
getCompiledConfig()
Returns the compiled config file.
buildCompiledFilepath()
Get file path.
static writeFile($_filepath, $_contents, Smarty $smarty)
Writes file in a safe way to disk.
__set($property_name, $value)
set Smarty property in template context