Compare commits

..

No commits in common. "4f46c38643802895540c1d3c9dbf32a8932dac84" and "c346252f556d4d67ca34ba9298fa715bcaa28269" have entirely different histories.

7 changed files with 9 additions and 51 deletions

View file

@ -95,8 +95,8 @@ templates:
# Translations
#
i18n:
# Default locale (see locales directory for available languages list, default: 'en_US.UTF8')
#default_locale: 'en_US.UTF8'
# Default locale (see locales directory for available languages list)
default_locale: 'en_US.UTF8'
#
# Session
@ -302,6 +302,6 @@ email:
catch_all: false
# Web Stats JS code
#webstats_js_code: ''
webstats_js_code: ''
# vim: tabstop=2 shiftwidth=2 softtabstop=2 expandtab

View file

@ -38,12 +38,6 @@ App::init(
"$root_dir_path/static"
),
),
'default' => array(
'upload_max_filesize' => 10485760,
'i18n' => array(
'default_locale' => "en_US.UTF8",
),
),
),
$root_dir_path
);

View file

@ -30,6 +30,9 @@ function define_common_template_variables($event) {
$status_list:array()
);
Tpl :: assign('admin', isset($admin) && $admin);
Tpl :: assign(
'webstats_js_code',
App::get('webstats_js_code', null, 'string'));
}
Hook :: register('before_displaying_template', 'define_common_template_variables');

View file

@ -302,6 +302,6 @@ email:
catch_all: false
# Web Stats JS code
#webstats_js_code: ''
webstats_js_code: ''
# vim: tabstop=2 shiftwidth=2 softtabstop=2 expandtab

View file

@ -38,9 +38,6 @@ App::init(
"$root_dir_path/static"
),
),
'default' => array(
// Set here your configuration parameters default value
),
),
$root_dir_path
);

View file

@ -95,9 +95,10 @@ class App {
* Check if a specific configuration variable is set
*
* @param string $key The configuration variable key
* @param array|null $config Optional configuration to use instead of current loaded configuration
* @return bool
**/
public static function isset($key) {
public static function isset($key, &$config=null) {
return Config::isset($key, self :: $options) || (Config::loaded() && Config::isset($key));
}
@ -115,7 +116,6 @@ class App {
* @return mixed The configuration variable value
**/
public static function get($key, $default=null, $cast=null, $split=true) {
$default = self :: get_default($key, $default, $cast, $split);
return Config::get(
$key,
Config::loaded()?Config::get($key, $default, $cast, $split):$default,
@ -125,31 +125,6 @@ class App {
);
}
/**
* Get a specific option default value
*
* @param string $key The configuration variable key
* @param mixed $default Default value provided by context
* (optional, priority if not nul, default : null)
* @param string $cast The type of expected value. The configuration variable
* default value will be cast as this type. Could be : bool, int,
* float or string. (Optional, default : raw value)
* @param bool $split If true, $cast is 'array' and value retreived from configuration
* is a string, split the value by comma (optional, default: true)
* @return mixed The configuration variable default value
**/
public static function get_default($key, $default=null, $cast=null, $split=true) {
if (!is_null($default))
return $default;
return Config::get(
"default.$key",
$default,
$cast,
$split,
self :: $options
);
}
/**
* Set a specific option value
*

View file

@ -380,17 +380,6 @@ class Tpl {
// Authenticated user info
if (Auth::user())
self :: assign('auth_user', Auth::user());
// Webstats JS code
Tpl :: assign(
'webstats_js_code',
App::get('webstats_js_code', null, 'string'));
// Upload max size
if (App::get('upload_max_filesize', null, 'int'))
Tpl :: assign(
'upload_max_filesize',
App::get('upload_max_filesize', null, 'int'));
}
/**