summaryrefslogtreecommitdiff
path: root/it_dbi.class
diff options
context:
space:
mode:
authorChristian Weber2007-09-19 16:39:14 +0000
committerChristian Weber2007-09-19 16:39:14 +0000
commitd0d66a94138d61dcd700380f584a85a483c184fe (patch)
treef27ba4016f00b95e2f307889fb4091a817b089d7 /it_dbi.class
parent28a71c4111d1b010ca26e1ab051dd4f1bf98fe66 (diff)
downloaditools-d0d66a94138d61dcd700380f584a85a483c184fe.tar.gz
itools-d0d66a94138d61dcd700380f584a85a483c184fe.tar.bz2
itools-d0d66a94138d61dcd700380f584a85a483c184fe.zip
new it_dbi always adds defaults from singleton
Diffstat (limited to 'it_dbi.class')
-rw-r--r--it_dbi.class5
1 files changed, 4 insertions, 1 deletions
diff --git a/it_dbi.class b/it_dbi.class
index 5b41f45..d7f7e20 100644
--- a/it_dbi.class
+++ b/it_dbi.class
@@ -51,8 +51,11 @@ function it_dbi($config = array(), $query = null)
if (!is_array($config))
$config = array('table' => $config);
+ # If global singleton $it_dbi exists, use its defaults (db, user, pw, host)
+ $defaults = $GLOBALS['it_dbi']->_defaults ? eval("return array({$GLOBALS['it_dbi']->_defaults});") : array();
+
# Create current settings
- foreach ($config + (array)$GLOBALS['it_dbi_defaultconfig'] + $this->_defaultconfig as $key => $value)
+ foreach ($config + $defaults + (array)$GLOBALS['it_dbi_defaultconfig'] + $this->_defaultconfig as $key => $value)
{
$var = "_$key";
$this->$var = $value;