* FusionForge configuration functions
*
* Copyright 2009, Roland Mas
+ * Copyright 2013, Franck Villaume - TrivialDev
*
* This file is part of FusionForge. FusionForge is free software;
* you can redistribute it and/or modify it under the terms of the
$this->settings[$section][$var] = $value ;
}
- function read_config_file ($filename) {
- if (getenv ('FUSIONFORGE_USE_PRE_51_CONFIG') == 'true') {
+ function read_config_file($filename) {
+ if (getenv('FUSIONFORGE_USE_PRE_51_CONFIG') == 'true') {
$fallback_only = true;
} else {
$fallback_only = false;
}
if (file_exists($filename) && is_readable($filename)) {
- $sections = parse_ini_file ($filename, true) ;
+ $sections = parse_ini_file($filename, true);
if (is_array($sections)) {
foreach ($sections as $section => $options) {
- if (!is_array($options)) {
- continue;
- }
- foreach ($options as $var => $value) {
- if ($fallback_only) {
- $this->set_value($section,$var,$value);
- } else {
- $this->reset_value($section,$var,$value);
+ if (is_array($options)) {
+ foreach ($options as $var => $value) {
+ if ($fallback_only) {
+ $this->set_value($section, $var, $value);
+ } else {
+ $this->reset_value($section, $var, $value);
+ }
}
}
}
* Get value of variable "name" in section "section"
* @param string $var
* @param string $section defaults to "core" if missing
- * @return Ambigous <NULL, boolean>
+ * @return mixed <NULL, boolean>
*/
function forge_get_config ($var, $section = 'core') {
$c = FusionForgeConfig::get_instance () ;
*/
function forge_define_config_item ($var, $section, $default) {
$c = FusionForgeConfig::get_instance () ;
-
- return $c->set_value ($section, $var, $default) ;
+ $c->set_value ($section, $var, $default) ;
}
/**
*/
function forge_set_config_item_bool ($var, $section) {
$c = FusionForgeConfig::get_instance () ;
-
- return $c->mark_as_bool ($section, $var) ;
+ $c->mark_as_bool ($section, $var) ;
}
/**
*/
function forge_read_config_file ($filename) {
$c = FusionForgeConfig::get_instance () ;
-
- return $c->read_config_file ($filename) ;
+ $c->read_config_file ($filename) ;
}
/**
function forge_reset_config_item ($var, $section, $default) {
$c = FusionForgeConfig::get_instance () ;
-
- return $c->reset_value ($section, $var, $default) ;
+ $c->reset_value ($section, $var, $default) ;
}
// Local Variables:
// mode: php
// c-file-style: "bsd"
// End:
-
-?>