You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
577 B
34 lines
577 B
4 years ago
|
<?php
|
||
|
|
||
|
function init()
|
||
|
{
|
||
|
load_settings();
|
||
|
}
|
||
|
|
||
|
function load_settings()
|
||
|
{
|
||
|
$settings = @parse_ini_file(getcwd().DIRECTORY_SEPARATOR.'settings.ini', true, INI_SCANNER_RAW);
|
||
|
if ($settings === false)
|
||
|
{
|
||
|
die('Could not read or parse settings.ini'.PHP_EOL);
|
||
|
}
|
||
|
foreach ($settings as $section_key=>$section_value)
|
||
|
{
|
||
|
$section_key = strtoupper($section_key);
|
||
|
if (is_array($section_value))
|
||
|
{
|
||
|
foreach ($section_value as $key=>$value)
|
||
|
{
|
||
|
define($section_key.'_'.strtoupper($key), $value);
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
define($section_key, $section_value);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
init();
|
||
|
|