<?php

/*
 *	W-AGORA 4.1
 *	-----------
 *	$Id: agora_user.php,v 1.5 2003/12/03 14:52:16 mdruilhe Exp $
 *	Usage:	Default user source class (for agora user db)
 *	Author:	Alastair Foreman <alastair.foreman@uwc.net>
 */	

if (!defined('_GLOBALS')) {
	die('Hacking attempt');
}

if (!defined("_AUTH")) {
	include ("$inc_dir/auth.$ext");
}

#
# default (pass-through) class for Agora-based user authentication
#
class agora_user_source extends wa_Auth {

function getRegisterURL() {
	return -1;
}

function getForgotPasswordURL() {
	return -1;
}

function getChangePasswordURL() {
	return -1;
}

function getEditProfileURL() {
	return -1;
}

 function getLoginURL() {
	//return nothing means use w-agora Login FORM
	return -1;
 }

 function encryptPassword ($password) {
	return md5($password);
 }


/**
 * Returns the login information
 *
 * @since	4.1
 * @access	private
 * @return	array	An associative array with the login parameters:
 *					"userid" => User ID
 *					"clearpw" => clear Password (if known)
 *					"encryptedpw" => encrypted Password (if accurate)
 */
 function getLoginInfo () {
	// no specific authentication
	return -1;
 }

 function authenticateUser($site, $userid, $encryptedpw) {
	global $db;

	$this->user = $db->getUser($site, $userid);
	if (!is_array($this->user) ) {
		return false;
	}

	if ($encryptedpw != $this->user["password"]) {
		unset ($this->user);
		return false;
	}

	return true;
 }

}; // end class

?>
