3 function config_load() {
6 if (!isset($AUR_CONFIG)) {
7 $path = getenv('AUR_CONFIG');
9 $path = "/etc/aurweb/config";
11 $defaults_path = getenv('AUR_CONFIG_DEFAULTS');
12 if (!$defaults_path) {
13 $defaults_path = $path . ".defaults";
15 if (file_exists($defaults_path)) {
16 $default_config = parse_ini_file($defaults_path, true, INI_SCANNER_RAW
);
20 if (file_exists($path)) {
21 $config = parse_ini_file($path, true, INI_SCANNER_RAW
);
23 die("aurweb config file not found");
25 $AUR_CONFIG = array_replace_recursive($default_config, $config);
29 function config_get($section, $key) {
33 return $AUR_CONFIG[$section][$key];
36 function config_get_int($section, $key) {
37 return intval(config_get($section, $key));
40 function config_get_bool($section, $key) {
41 $val = strtolower(config_get($section, $key));
42 return ($val == 'yes' ||
$val == 'true' ||
$val == '1');
45 function config_items($section) {
49 return $AUR_CONFIG[$section];
52 function config_section_exists($key) {
56 return array_key_exists($key, $AUR_CONFIG);