From afd0f8e4d8ff0a37d1a337f160eeae642a2f07d6 Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Mon, 13 Jun 2011 12:51:36 +0200 Subject: [PATCH] load $a->config from db --- index.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/index.php b/index.php index 534cb93f7c..9bca1527bf 100644 --- a/index.php +++ b/index.php @@ -29,7 +29,6 @@ $install = ((file_exists('.htconfig.php') && filesize('.htconfig.php')) ? false @include(".htconfig.php"); - $lang = get_language(); load_translation_table($lang); @@ -45,6 +44,20 @@ $db = new dba($db_host, $db_user, $db_pass, $db_data, $install); unset($db_host, $db_user, $db_pass, $db_data); +/** + * Load configs from db. Overwrite configs from .htconfig.php + */ +$r = q("SELECT * FROM `config` WHERE `cat` IN ('system', 'config')"); +foreach ($r as $c) { + if ($c['cat']=='config') { + $a->config[$c['k']] = $c['v']; + } else { + $a->config[$c['cat']][$c['k']] = $c['v']; + } +} +unset($r); + + /** * * Important stuff we always need to do.