From e28b0b5c5e992fbbac00981e94c946d2c29ec8d5 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sat, 14 Feb 2009 12:52:08 -0500 Subject: [PATCH] Move all of the auth configuration values into a config file * includes/auth/auth.php: (Authentication::_setupDatabase): Create the database object in this method using the config values * includes/auth/auth_default.php: * includes/auth/auth_drupal.php: * includes/auth/auth_phpbb2.php: * includes/auth/auth_vbulletin.php: (Authentication*::_setupDatabase): Remove the db creation from here and just call parent:: * includes/auth/config.php.new: New file --- includes/auth/auth.php | 15 +++++- includes/auth/auth_default.php | 2 +- includes/auth/auth_drupal.php | 8 ++-- includes/auth/auth_phpbb2.php | 8 ++-- includes/auth/auth_vbulletin.php | 7 ++- includes/auth/config.php.new | 79 ++++++++++++++++++++++++++++++++ 6 files changed, 108 insertions(+), 11 deletions(-) create mode 100644 includes/auth/config.php.new diff --git a/includes/auth/auth.php b/includes/auth/auth.php index 34f7cd0..f2e16ad 100644 --- a/includes/auth/auth.php +++ b/includes/auth/auth.php @@ -117,7 +117,20 @@ class Authentication * database object here. Whatever you choose, you need to reference * Authentication->authDb to the object */ - function _setupDatabase() {} + function _setupDatabase() + { + // connect to the DB + $this->authDb = new DB_MySQL($this->registry); + + require_once 'includes/auth/config.php'; + $this->authDb->connect( + $config['auth']['dbServer'], + $config['auth']['dbUser'], + $config['auth']['dbPassword'], + $config['auth']['dbName'], + false + ); + } // ################################################################### /** diff --git a/includes/auth/auth_default.php b/includes/auth/auth_default.php index 0fe42ca..01b7bbc 100644 --- a/includes/auth/auth_default.php +++ b/includes/auth/auth_default.php @@ -37,7 +37,7 @@ class AuthenticationDefault extends Authentication // ################################################################### function _setupDatabase() { - $this->authDb =& $this->db; + $this->authDb = &$this->db; } // ################################################################### diff --git a/includes/auth/auth_drupal.php b/includes/auth/auth_drupal.php index abcf296..d9f3f5c 100644 --- a/includes/auth/auth_drupal.php +++ b/includes/auth/auth_drupal.php @@ -49,12 +49,12 @@ class AuthenticationDrupal extends Authentication // ################################################################### function _setupDatabase() { + parent::_setupDatabase(); + // check and see if we need to call session_name() + require_once 'includes/auth/config.php'; + $this->cookieName = $config['auth']['Drupal']['cookieName']; $this->cookieName = ($this->cookieName == null ? session_name() : $this->cookieName); - - // connect to the DB - $this->authDb = new DB_MySQL($this->registry); - $this->authDb->connect('DRUPAL_DATABASE_SERVER', 'DATABASE_USER', 'DATABASE_PASSWORD', 'DATABASE_NAME', false); } // ################################################################### diff --git a/includes/auth/auth_phpbb2.php b/includes/auth/auth_phpbb2.php index acabf9a..7b6b3db 100644 --- a/includes/auth/auth_phpbb2.php +++ b/includes/auth/auth_phpbb2.php @@ -59,9 +59,11 @@ class AuthenticationPhpbb2 extends Authentication // ################################################################### function _setupDatabase() { - // connect to the DB - $this->authDb = new DB_MySQL($this->registry); - $this->authDb->connect('DATABASE_SERVER', 'DATABASE_USER', 'DATABASE_PASSWORD', 'DATABASE_NAME', false); + parent::_setupDatabase(); + + require_once 'includes/auth/config.php'; + $this->phpBBTablePrefix = $config['auth']['phpBB2']['tablePrefix']; + $this->cookieName = $config['auth']['phpBB2']['cookieName']; } // ################################################################### diff --git a/includes/auth/auth_vbulletin.php b/includes/auth/auth_vbulletin.php index 2d6da6b..412fe79 100644 --- a/includes/auth/auth_vbulletin.php +++ b/includes/auth/auth_vbulletin.php @@ -62,8 +62,11 @@ class AuthenticationVbulletin extends Authentication // ################################################################### function _setupDatabase() { - $this->authDb = new DB_MySQL($this->registry); - $this->authDb->connect('VBULLETIN_DATABASE_SERVER', 'VB_DATABASE_USER', 'VB_DATABASE_PASSWORD', 'VBULLETIN_DATABASE_NAME', false); + parent::_setupDatabase(); + + require_once 'includes/auth/config.php'; + $this->licenseKey = $config['auth']['vBulletin3']['licenseKey']; + $this->vBTablePrefix = $config['auth']['vBulletin3']['tablePrefix']; } // ################################################################### diff --git a/includes/auth/config.php.new b/includes/auth/config.php.new new file mode 100644 index 0000000..5371043 --- /dev/null +++ b/includes/auth/config.php.new @@ -0,0 +1,79 @@ + Administration -> General Admin -> Configuration -> Cookie Settings -> Cookie Name + */ +$config['auth']['phpBB2']['cookieName'] = 'phpbb2mysql'; + +// ################################################################### +// vBulletin 3 configuration + +/** + * Database table prefix + */ +$config['auth']['vBulletin3']['tablePrefix'] = ''; + +/** + * This is the vBulletin license key that you can find in the Members' Area that is used in creating cookies + */ +$config['auth']['vBulletin3']['licenseKey'] = 'LXXXXXXX'; + +?> \ No newline at end of file -- 2.43.5