From b0751afea224486bb4b423e569e2c75a502b4e35 Mon Sep 17 00:00:00 2001 From: plegall Date: Thu, 27 Apr 2006 21:08:50 +0000 Subject: merge -r1281:1283 from branch 1.6 to trunk (bug 228 fixed one more time, and other little things) git-svn-id: http://piwigo.org/svn/trunk@1284 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/functions.inc.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'include/functions.inc.php') diff --git a/include/functions.inc.php b/include/functions.inc.php index 35b1e7935..166b0798f 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -881,4 +881,36 @@ function get_available_upgrade_ids() return $available_upgrade_ids; } +/** + * Add configuration parameters from database to global $conf array + * + * @return void + */ +function load_conf_from_db() +{ + global $conf; + + $query = ' +SELECT param,value + FROM '.CONFIG_TABLE.' +;'; + $result = pwg_query($query); + + if (mysql_num_rows($result) == 0) + { + die('No configuration data'); + } + + while ($row = mysql_fetch_array($result)) + { + $conf[ $row['param'] ] = isset($row['value']) ? $row['value'] : ''; + + // If the field is true or false, the variable is transformed into a + // boolean value. + if ($conf[$row['param']] == 'true' or $conf[$row['param']] == 'false') + { + $conf[ $row['param'] ] = get_boolean($conf[ $row['param'] ]); + } + } +} ?> -- cgit v1.2.3