summaryrefslogtreecommitdiff
path: root/includes/extauth
diff options
context:
space:
mode:
Diffstat (limited to 'includes/extauth')
-rw-r--r--includes/extauth/Hardcoded.php39
-rw-r--r--includes/extauth/MediaWiki.php56
-rw-r--r--includes/extauth/vB.php47
3 files changed, 78 insertions, 64 deletions
diff --git a/includes/extauth/Hardcoded.php b/includes/extauth/Hardcoded.php
index a9a60bea..dfb46742 100644
--- a/includes/extauth/Hardcoded.php
+++ b/includes/extauth/Hardcoded.php
@@ -1,21 +1,26 @@
<?php
-
-# Copyright (C) 2009 Aryeh Gregor
-#
-# 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; either version 2 of the License, or
-# (at your option) any later version.
-#
-# 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.
-# http://www.gnu.org/copyleft/gpl.html
+/**
+ * External authentication with hardcoded user names and passwords
+ *
+ * Copyright © 2009 Aryeh Gregor
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
/**
* This class supports external authentication from a literal array dumped in
diff --git a/includes/extauth/MediaWiki.php b/includes/extauth/MediaWiki.php
index 7d6a3c71..9df4ea1f 100644
--- a/includes/extauth/MediaWiki.php
+++ b/includes/extauth/MediaWiki.php
@@ -1,21 +1,26 @@
<?php
-
-# Copyright (C) 2009 Aryeh Gregor
-#
-# 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; either version 2 of the License, or
-# (at your option) any later version.
-#
-# 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.
-# http://www.gnu.org/copyleft/gpl.html
+/**
+ * External authentication with external MediaWiki database.
+ *
+ * Copyright © 2009 Aryeh Gregor
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
/**
* This class supports authentication against an external MediaWiki database,
@@ -67,15 +72,14 @@ class ExternalUser_MediaWiki extends ExternalUser {
private function initFromCond( $cond ) {
global $wgExternalAuthConf;
- $class = 'Database' . $wgExternalAuthConf['DBtype'];
- $this->mDb = new $class(
- $wgExternalAuthConf['DBserver'],
- $wgExternalAuthConf['DBuser'],
- $wgExternalAuthConf['DBpassword'],
- $wgExternalAuthConf['DBname'],
- false,
- 0,
- $wgExternalAuthConf['DBprefix']
+ $this->mDb = DatabaseBase::newFromType( $wgExternalAuthConf['DBtype'],
+ array(
+ 'server' => $wgExternalAuthConf['DBserver'],
+ 'user' => $wgExternalAuthConf['DBuser'],
+ 'password' => $wgExternalAuthConf['DBpassword'],
+ 'dbname' => $wgExternalAuthConf['DBname'],
+ 'tableprefix' => $wgExternalAuthConf['DBprefix'],
+ )
);
$row = $this->mDb->selectRow(
diff --git a/includes/extauth/vB.php b/includes/extauth/vB.php
index 23523665..860048f3 100644
--- a/includes/extauth/vB.php
+++ b/includes/extauth/vB.php
@@ -1,21 +1,26 @@
<?php
-
-# Copyright (C) 2009 Aryeh Gregor
-#
-# 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; either version 2 of the License, or
-# (at your option) any later version.
-#
-# 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.
-# http://www.gnu.org/copyleft/gpl.html
+/**
+ * External authentication with a vBulletin database.
+ *
+ * Copyright © 2009 Aryeh Gregor
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
/**
* This class supports the proprietary vBulletin forum system
@@ -36,7 +41,7 @@
* @ingroup ExternalUser
*/
class ExternalUser_vB extends ExternalUser {
- private $mDb, $mRow;
+ private $mRow;
protected function initFromName( $name ) {
return $this->initFromCond( array( 'username' => $name ) );
@@ -50,13 +55,13 @@ class ExternalUser_vB extends ExternalUser {
# Try using the session table. It will only have a row if the user has
# an active session, so it might not always work, but it's a lot easier
# than trying to convince PHP to give us vB's $_SESSION.
- global $wgExternalAuthConf;
+ global $wgExternalAuthConf, $wgRequest;
if ( !isset( $wgExternalAuthConf['cookieprefix'] ) ) {
$prefix = 'bb';
} else {
$prefix = $wgExternalAuthConf['cookieprefix'];
}
- if ( !isset( $_COOKIE["{$prefix}sessionhash"] ) ) {
+ if ( $wgRequest->getCookie( 'sessionhash', $prefix ) === null ) {
return false;
}
@@ -67,7 +72,7 @@ class ExternalUser_vB extends ExternalUser {
$this->getFields(),
array(
'session.userid = user.userid',
- 'sessionhash' => $_COOKIE["{$prefix}sessionhash"]
+ 'sessionhash' => $wgRequest->getCookie( 'sessionhash', $prefix ),
),
__METHOD__
);