diff options
-rw-r--r-- | it_dbi.class | 5 | ||||
-rw-r--r-- | it_user.class | 2 |
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; |