Project

General

Profile

Feature #24708 ยป class.tx_rsmysherpasusers_authservice.php

Administrator Admin, 2011-02-07 10:43

 
<?php

class tx_rsmysherpasusers_authservice extends tx_sv_authbase {

/**
* Find a user (eg. look up the user record in database when a login is sent)
*
* @return mixed user array or false
*/
public function getUser() {
$user = false;
if ($this->login['status']=='login' && $this->login['uident']) {
$user = $this->fetchUserRecord($this->login['uname']);
}
return $user;
}

/**
* Get a user from DB by email
* provided for usage from services
*
* @param string email-address as username
* @return mixed user array or FALSE
*/
public function fetchUserRecord($username, $extraWhere='', $dbUserSetup='') {
$user = FALSE;
if(strlen($username) > 0) {
$whereClause = 'deleted=0 && disable=0 && ' .
'(starttime < NOW() || starttime=0) && '.
'(endtime > NOW() || endtime=0) && '.
' email=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($username, 'fe_users');
// Look up the user by the username and/or extraWhere:
$dbres = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'*',
'fe_users',
$whereClause
);
if ($dbres) {
$user = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($dbres);
$GLOBALS['TYPO3_DB']->sql_free_result($dbres);
}
}
return $user;
}
}

?>
    (1-1/1)