Deprecated: Assigning the return value of new by reference is deprecated in /home/bluestat/public_html/source/index.php on line 477
Bugdar - Commitdiff - ViewGit - Blue Static

Cherry pick e28b0b5c5e992fbbac00981e94c946d2c29ec8d5: Move all of the auth configuration values into a config file

Robert Sesek [2009-03-19 20:07]
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
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 @@
+<?php
+/*=====================================================================*\
+|| ###################################################################
+|| # Bugdar
+|| # Copyright (c)2004-2009 Blue Static
+|| #
+|| # This program is free software; you can redistribute it and/or modify
+|| # it under the terms of the GNU General Public License as published by
+|| # the Free Software Foundation; version 2 of the License.
+|| #
+|| # This program is distributed in the hope that it will be useful, but
+|| # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+|| # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+|| # more details.
+|| #
+|| # You should have received a copy of the GNU General Public License along
+|| # with this program; if not, write to the Free Software Foundation, Inc.,
+|| # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+|| ###################################################################
+\*=====================================================================*/
+
+// ###################################################################
+// Database connectivity settings
+
+/**
+ * Name of the database server to connect to for authentication
+ */
+$config['auth']['dbServer'] = 'localhost';
+
+/**
+ * MySQL user of the authentication database
+ */
+$config['auth']['dbUser'] = 'mysql';
+
+/**
+ * Password of the authentication database
+ */
+$config['auth']['dbPassword'] = 'secret';
+
+/**
+ * Authentication database name
+ */
+$config['auth']['dbName'] = 'remote_auth_db';
+
+// ###################################################################
+// Drupal configuration
+
+/**
+ * The cookie name to use for Drupal. Leaving this NULL will get it from session_name()
+ */
+$config['auth']['Drupal']['cookieName'] = null;
+
+// ###################################################################
+// phpBB2 configuration
+
+/**
+ * Database table prefix
+ */
+$config['auth']['phpBB2']['tablePrefix'] = 'phpbb2_';
+
+/**
+ * The cookie name that is set in phpBB -> 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