Mercurial > hg > mgallery
diff mgallery.inc.php @ 297:77f85b1f35f2
Improve configuration file handling.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 02 Aug 2019 12:54:51 +0300 |
parents | df66529eff47 |
children | cf166dcc6e77 |
line wrap: on
line diff
--- a/mgallery.inc.php Fri Aug 02 09:26:12 2019 +0300 +++ b/mgallery.inc.php Fri Aug 02 12:54:51 2019 +0300 @@ -11,6 +11,8 @@ $mgProgEmail = "<ccr@tnsp.org>"; $mgProgCopyright = "2015-2019 Tecnic Software productions (TNSP)"; +$mgProgConfigFile = "mgallery.cfg"; + $mgalDebug = FALSE; @@ -214,7 +216,7 @@ } -function mgReadSettings($filename = "mgallery.cfg") +function mgReadSettings(&$spaths) { global $mgSettings, $mgDefaults; @@ -237,9 +239,14 @@ } $spaths[] = dirname(__FILE__)."/"; - foreach (array_unique($spaths) as $path) + $spaths = array_map(function ($path) { - $file = $path.$filename; + global $mgProgConfigFile; + return $path.$mgProgConfigFile; + }, $spaths); + + foreach (array_unique($spaths) as $file) + { mgDebug("Checking '".$file."' for configuration ..\n"); if (file_exists($file) && ($mgSettings = parse_ini_file($file, FALSE)) !== FALSE)