Commit 08f78e71 authored by Aaron Wells's avatar Aaron Wells

Updating with latest version

parent 8b8a7749
......@@ -50,7 +50,7 @@ class MaharaAuthPlugin extends AuthPlugin {
$this->dbname = $dbname;
$this->host = $host;
$this->prefix = $prefix;
$this->dbtype = $dbtype;
$this->dbtype = $dbtype;
$this->dbuser = $user;
$this->dbpass = $password;
$this->passwordsaltmain = $passwordsaltmain;
......@@ -178,7 +178,7 @@ class MaharaAuthPlugin extends AuthPlugin {
*
* @param $template UserLoginTemplate object.
*/
public function modifyUITemplate( &$template ) {
public function modifyUITemplate( &$template, &$type ) {
# Override this!
$template->set( 'usedomain', false );
}
......@@ -214,21 +214,22 @@ class MaharaAuthPlugin extends AuthPlugin {
* @param User $user
*/
public function updateUser( &$user ) {
$db = $this->getDatabase();
$db = $this->getDatabase();
$sql = "SELECT * FROM ".$this->prefix."usr where LOWER(username) = LOWER('".$user->mName."')";
$res = $db->query($sql);
$val = $db->fetchObject($res);
$db->close();
$user->setOption('nickname',$val->username);
$user->setEmail($val->email);
$user->setRealName($val->firstname.' '.$val->lastname);
if ($val->admin == 1) {
$user->addGroup('sysop');
} else if (in_array('sysop',$user->getGroups())) {
$user->removeGroup('sysop');
}
return true;
$res = $db->query($sql);
$val = $db->fetchObject($res);
$db->close();
$user->setOption('nickname',$val->username);
$user->setEmail($val->email);
$user->setRealName($val->firstname.' '.$val->lastname);
if (($val->admin == 1) and !(in_array('sysop',$user->getGroups()))) { // Now checks whether user is already a sysop before adding group (2015-05-28)
$user->addGroup('sysop');
} else if (in_array('sysop',$user->getGroups())) {
$user->removeGroup('sysop');
}
return true;
}
......@@ -379,3 +380,4 @@ class MaharaAuthPlugin extends AuthPlugin {
return false;
}
}
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