_prefs) { if ($prefs) $this->_prefs = $prefs; } if (!isset($this->_prefs->_method)) _PassUser::_PassUser($UserName); elseif (!$this->isValidName($UserName)) { trigger_error(_("Invalid username."), E_USER_WARNING); return false; } $this->_authmethod = 'Db'; //$this->getAuthDbh(); //$this->_auth_crypt_method = @$GLOBALS['DBAuthParams']['auth_crypt_method']; $dbi =& $GLOBALS['request']->_dbi; $dbtype = $dbi->getParam('dbtype'); if ($dbtype == 'ADODB') { include_once 'lib/WikiUser/AdoDb.php'; return new _AdoDbPassUser($UserName, $this->_prefs); } elseif ($dbtype == 'SQL') { include_once 'lib/WikiUser/PearDb.php'; return new _PearDbPassUser($UserName, $this->_prefs); } elseif ($dbtype == 'PDO') { include_once 'lib/WikiUser/PdoDb.php'; return new _PdoDbPassUser($UserName, $this->_prefs); } return false; } /* Since we properly quote the username, we allow most chars here. Just " ; and ' is forbidden, max length: 48 as defined in the schema. */ function isValidName($userid = false) { if (!$userid) $userid = $this->_userid; if (strcspn($userid, ";'\"") != strlen($userid)) return false; if (strlen($userid) > 48) return false; return true; } function mayChangePass() { return !isset($this->_authupdate); } } // Local Variables: // mode: php // tab-width: 8 // c-basic-offset: 4 // c-hanging-comment-ender-p: nil // indent-tabs-mode: nil // End: