summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Weber2007-09-19 16:39:14 +0000
committerChristian Weber2007-09-19 16:39:14 +0000
commitd0d66a94138d61dcd700380f584a85a483c184fe (patch)
treef27ba4016f00b95e2f307889fb4091a817b089d7
parent28a71c4111d1b010ca26e1ab051dd4f1bf98fe66 (diff)
downloaditools-d0d66a94138d61dcd700380f584a85a483c184fe.tar.gz
itools-d0d66a94138d61dcd700380f584a85a483c184fe.tar.bz2
itools-d0d66a94138d61dcd700380f584a85a483c184fe.zip
new it_dbi always adds defaults from singleton
-rw-r--r--it_dbi.class5
-rw-r--r--it_user.class2
2 files changed, 5 insertions, 2 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;
diff --git a/it_user.class b/it_user.class
index 30033e9..4bafc85 100644
--- a/it_user.class
+++ b/it_user.class
@@ -73,7 +73,7 @@ function it_user($p)
);
# Default to uid being primary key, may change later
- $this->it_dbi(array('table' => $this->p['table'], 'keyfield' => $this->p['uid_field']) + (array)$GLOBALS['it_dbi']->_defaults);
+ $this->it_dbi(array('table' => $this->p['table'], 'keyfield' => $this->p['uid_field']));
$this->session = new it_session;
$this->status = _IT_USER_STATUS_INVALID;