mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Use an INI-style configuration file
Replace web/lib/config.inc.php with an INI-style configuration file. This allows us to get rid of several globals and makes it easier to use the same configuration file in external scripts. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
parent
a0a5230708
commit
76343fb915
24 changed files with 200 additions and 216 deletions
20
web/lib/confparser.inc.php
Normal file
20
web/lib/confparser.inc.php
Normal file
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
function config_get($section, $key) {
|
||||
global $AUR_CONFIG;
|
||||
|
||||
if (!isset($AUR_CONFIG)) {
|
||||
$AUR_CONFIG = parse_ini_file("../../conf/config", true);
|
||||
}
|
||||
|
||||
return $AUR_CONFIG[$section][$key];
|
||||
}
|
||||
|
||||
function config_get_int($section, $key) {
|
||||
return intval(config_get($section, $key));
|
||||
}
|
||||
|
||||
function config_get_bool($section, $key) {
|
||||
$val = strtolower(config_get($section, $key));
|
||||
return ($val == 'yes' || $val == 'true' || $val == '1');
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue