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

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

parent bec35da3
<?php
/**
*/
require('GlobalFunctions.php');
# Copyright (C) 2004 Brion Vibber <brion@pobox.com>
# http://www.mediawiki.org/
#
......@@ -55,17 +54,14 @@ class MaharaAuthPlugin extends AuthPlugin {
$this->dbtype = $dbtype;
$this->dbuser = $user;
$this->dbpass = $password;
wfDebugLog('mahara','authplugin constructed');
}
public function userExists( $username ) {
$username = strtolower($username);
$db = $this->getDatabase();
$sql = "SELECT username FROM ".$this->prefix."usr where username = '".$username."'";
wfDebugLog('mahara',$sql);
$res = $db->query($sql);
$val = $db->fetchObject($res);
wfDebugLog('mahara',print_r($val,true));
$db->close();
if (!empty($val)) {
return true;
......@@ -87,7 +83,6 @@ class MaharaAuthPlugin extends AuthPlugin {
$username = strtolower($username);
$db = $this->getDatabase();
$sql = "SELECT username, password, salt FROM ".$this->prefix."usr where username = '".$username."'";
wfDebugLog('mahara',$sql);
$res = $db->query($sql);
$val = $db->fetchObject($res);
$db->close();
......@@ -143,13 +138,12 @@ class MaharaAuthPlugin extends AuthPlugin {
public function updateUser( &$user ) {
$db = $this->getDatabase();
$sql = "SELECT * FROM ".$this->prefix."usr where username = '".$username."'";
wfDebugLog('mahara',$sql);
$res = $db->query($sql);
$val = $db->fetchRow($res);
$db->close();
$user->setOption('nickname',$val->username);
$user->setEmail($this->email);
$user->setRealName($this->firstname.' '.$this->lastname);
$user->setEmail($val->email);
$user->setRealName($val->firstname.' '.$val->lastname);
return true;
}
......@@ -268,11 +262,9 @@ class MaharaAuthPlugin extends AuthPlugin {
public function initUser( &$user, $autocreate=false ) {
$db = $this->getDatabase();
$sql = "SELECT * FROM ".$this->prefix."usr where username = '".$username."'";
wfDebugLog('mahara',$sql);
$res = $db->query($sql);
$val = $db->fetchRow($res);
$db->close();
wfDebugLog('mahara',print_r($val,true),false);
$user->setOption('nickname',$val->username);
$user->setEmail($this->email);
$user->setRealName($this->firstname.' '.$this->lastname);
......@@ -318,30 +310,3 @@ class MaharaAuthPlugin extends AuthPlugin {
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