Update config.php

This commit is contained in:
Namhyeon Go 2018-03-07 13:44:06 +09:00 committed by GitHub
parent e6bb3fbd3e
commit 9fb69db202
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,10 +1,18 @@
<?php
if(!function_exists("get_config")) {
function get_config() {
$config = array();
/**
* @file security.php
* @date 2018-01-18
* @author Go Namhyeon <gnh1201@gmail.com>
* @brief Configuration module for VSPF
*/
if(!function_exists("set_config")) {
function set_config() {
global $config;
if($handle = opendir('./config')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && end(explode('.', $file)) == 'ini') {
if ($file != "." && $file != ".." && @end(explode('.', $file)) == 'ini') {
$ini = parse_ini_file('./config/' . $file);
foreach($ini as $k=>$v) {
$config[$k] = $v;
@ -13,9 +21,16 @@ if(!function_exists("get_config")) {
}
closedir($handle);
}
return $config;
}
}
function get_config() {
global $config;
return $config;
}
$config = array();
set_config();
$config = get_config();