From 8a8f82f6036feca1b1562873bd1de5f5d418d769 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Thu, 19 Mar 2009 16:07:43 -0400 Subject: [PATCH] Cherry pick e28b0b5c5e992fbbac00981e94c946d2c29ec8d5: 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 Conflicts: includes/auth/auth_default.php includes/auth/auth_drupal.php includes/auth/auth_phpbb2.php includes/auth/auth_vbulletin.php --- includes/auth/auth.php | 14 +++++- includes/auth/auth_drupal.php | 8 ++-- includes/auth/auth_phpbb2.php | 8 ++-- includes/auth/auth_vbulletin.php | 5 +- includes/auth/config.php.new | 79 ++++++++++++++++++++++++++++++++ 5 files changed, 104 insertions(+), 10 deletions(-) create mode 100644 includes/auth/config.php.new diff --git a/includes/auth/auth.php b/includes/auth/auth.php index d8d32f1..f7e129f 100644 --- a/includes/auth/auth.php +++ b/includes/auth/auth.php @@ -108,7 +108,19 @@ 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 BSDBMySQLI(); + + require_once 'includes/auth/config.php'; + $this->authDb->connect( + $config['auth']['dbServer'], + $config['auth']['dbUser'], + $config['auth']['dbPassword'], + $config['auth']['dbName'] + ); + } // ################################################################### /** diff --git a/includes/auth/auth_drupal.php b/includes/auth/auth_drupal.php index 1cb1907..b5644bb 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 BSDbMySQLI(); - $this->authDb->connect('DRUPAL_DATABASE_SERVER', 'DATABASE_USER', 'DATABASE_PASSWORD', 'DATABASE_NAME'); } // ################################################################### diff --git a/includes/auth/auth_phpbb2.php b/includes/auth/auth_phpbb2.php index 6f96a34..5bfca53 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 BSDbMySQLI($this->registry); - $this->authDb->connect('DATABASE_SERVER', 'DATABASE_USER', 'DATABASE_PASSWORD', 'DATABASE_NAME'); + 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 8303e8b..4c2d378 100644 --- a/includes/auth/auth_vbulletin.php +++ b/includes/auth/auth_vbulletin.php @@ -62,8 +62,9 @@ class AuthenticationVbulletin extends Authentication // ################################################################### function _setupDatabase() { - $this->authDb = new BSDbMySqlI($this->registry); - $this->authDb->connect('VBULLETIN_DATABASE_SERVER', 'VB_DATABASE_USER', 'VB_DATABASE_PASSWORD', 'VBULLETIN_DATABASE_NAME'); + 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.22.5