From d0d66a94138d61dcd700380f584a85a483c184fe Mon Sep 17 00:00:00 2001 From: Christian Weber Date: Wed, 19 Sep 2007 16:39:14 +0000 Subject: new it_dbi always adds defaults from singleton --- it_dbi.class | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'it_dbi.class') 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; -- cgit v1.2.3