Commit 01c6238c authored by Brett Wilkins's avatar Brett Wilkins

MaharaAuthPlugin: Adding a couple of minor changes (shouldn't change operation)

parent bec35da3
<?php <?php
/** /**
*/ */
require('GlobalFunctions.php');
# Copyright (C) 2004 Brion Vibber <brion@pobox.com> # Copyright (C) 2004 Brion Vibber <brion@pobox.com>
# http://www.mediawiki.org/ # http://www.mediawiki.org/
# #
...@@ -55,17 +54,14 @@ class MaharaAuthPlugin extends AuthPlugin { ...@@ -55,17 +54,14 @@ class MaharaAuthPlugin extends AuthPlugin {
$this->dbtype = $dbtype; $this->dbtype = $dbtype;
$this->dbuser = $user; $this->dbuser = $user;
$this->dbpass = $password; $this->dbpass = $password;
wfDebugLog('mahara','authplugin constructed');
} }
public function userExists( $username ) { public function userExists( $username ) {
$username = strtolower($username); $username = strtolower($username);
$db = $this->getDatabase(); $db = $this->getDatabase();
$sql = "SELECT username FROM ".$this->prefix."usr where username = '".$username."'"; $sql = "SELECT username FROM ".$this->prefix."usr where username = '".$username."'";
wfDebugLog('mahara',$sql);
$res = $db->query($sql); $res = $db->query($sql);
$val = $db->fetchObject($res); $val = $db->fetchObject($res);
wfDebugLog('mahara',print_r($val,true));
$db->close(); $db->close();
if (!empty($val)) { if (!empty($val)) {
return true; return true;
...@@ -87,7 +83,6 @@ class MaharaAuthPlugin extends AuthPlugin { ...@@ -87,7 +83,6 @@ class MaharaAuthPlugin extends AuthPlugin {
$username = strtolower($username); $username = strtolower($username);
$db = $this->getDatabase(); $db = $this->getDatabase();
$sql = "SELECT username, password, salt FROM ".$this->prefix."usr where username = '".$username."'"; $sql = "SELECT username, password, salt FROM ".$this->prefix."usr where username = '".$username."'";
wfDebugLog('mahara',$sql);
$res = $db->query($sql); $res = $db->query($sql);
$val = $db->fetchObject($res); $val = $db->fetchObject($res);
$db->close(); $db->close();
...@@ -143,13 +138,12 @@ class MaharaAuthPlugin extends AuthPlugin { ...@@ -143,13 +138,12 @@ class MaharaAuthPlugin extends AuthPlugin {
public function updateUser( &$user ) { public function updateUser( &$user ) {
$db = $this->getDatabase(); $db = $this->getDatabase();
$sql = "SELECT * FROM ".$this->prefix."usr where username = '".$username."'"; $sql = "SELECT * FROM ".$this->prefix."usr where username = '".$username."'";
wfDebugLog('mahara',$sql);
$res = $db->query($sql); $res = $db->query($sql);
$val = $db->fetchRow($res); $val = $db->fetchRow($res);
$db->close(); $db->close();
$user->setOption('nickname',$val->username); $user->setOption('nickname',$val->username);
$user->setEmail($this->email); $user->setEmail($val->email);
$user->setRealName($this->firstname.' '.$this->lastname); $user->setRealName($val->firstname.' '.$val->lastname);
return true; return true;
} }
...@@ -268,11 +262,9 @@ class MaharaAuthPlugin extends AuthPlugin { ...@@ -268,11 +262,9 @@ class MaharaAuthPlugin extends AuthPlugin {
public function initUser( &$user, $autocreate=false ) { public function initUser( &$user, $autocreate=false ) {
$db = $this->getDatabase(); $db = $this->getDatabase();
$sql = "SELECT * FROM ".$this->prefix."usr where username = '".$username."'"; $sql = "SELECT * FROM ".$this->prefix."usr where username = '".$username."'";
wfDebugLog('mahara',$sql);
$res = $db->query($sql); $res = $db->query($sql);
$val = $db->fetchRow($res); $val = $db->fetchRow($res);
$db->close(); $db->close();
wfDebugLog('mahara',print_r($val,true),false);
$user->setOption('nickname',$val->username); $user->setOption('nickname',$val->username);
$user->setEmail($this->email); $user->setEmail($this->email);
$user->setRealName($this->firstname.' '.$this->lastname); $user->setRealName($this->firstname.' '.$this->lastname);
...@@ -318,30 +310,3 @@ class MaharaAuthPlugin extends AuthPlugin { ...@@ -318,30 +310,3 @@ class MaharaAuthPlugin extends AuthPlugin {
return false; return false;
} }
} }
/*
class AuthPluginUser {
function __construct( $user ) {
# Override this!
}
public function getId() {
# Override this!
return -1;
}
public function isLocked() {
# Override this!
return false;
}
public function isHidden() {
# Override this!
return false;
}
public function resetAuthToken() {
# Override this!
return true;
}
}*/
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment