| 19 |
* the users details. |
* the users details. |
| 20 |
*/ |
*/ |
| 21 |
function loginUser ($username=null, $passwd=null, $remember=null) { |
function loginUser ($username=null, $passwd=null, $remember=null) { |
| 22 |
$mambothandler = mosMambotHandler::getInstance(); |
$mambothandler =& mosMambotHandler::getInstance(); |
| 23 |
$mambothandler->loadBotGroup('authenticator'); |
$mambothandler->loadBotGroup('authenticator'); |
| 24 |
$session = mosSession::getCurrent(); |
$session =& mosSession::getCurrent(); |
| 25 |
$database = mamboDatabase::getInstance(); |
$database =& mamboDatabase::getInstance(); |
| 26 |
if (!$username OR !$passwd) { |
if (!$username OR !$passwd) { |
| 27 |
$username = mosGetParam($_REQUEST, 'username', ''); |
$username = mosGetParam($_REQUEST, 'username', ''); |
| 28 |
$passwd = mosGetParam($_REQUEST, 'passwd', '' ); |
$passwd = mosGetParam($_REQUEST, 'passwd', '' ); |
| 61 |
*/ |
*/ |
| 62 |
function authenticateUser (&$message, $username, $passwd, $remember=null, $session=null) { |
function authenticateUser (&$message, $username, $passwd, $remember=null, $session=null) { |
| 63 |
$message = ''; |
$message = ''; |
| 64 |
if ($session === null) $session = mosSession::getCurrent(); |
if ($session === null) $session =& mosSession::getCurrent(); |
| 65 |
$database = mamboDatabase::getInstance(); |
$database =& mamboDatabase::getInstance(); |
| 66 |
$database->setQuery( "SELECT id, gid, block, usertype" |
$database->setQuery( "SELECT id, gid, block, usertype" |
| 67 |
. "\nFROM #__users" |
. "\nFROM #__users" |
| 68 |
. "\nWHERE username='$username' AND password='$passwd'" |
. "\nWHERE username='$username' AND password='$passwd'" |
| 108 |
} |
} |
| 109 |
|
|
| 110 |
function clearSession ($session=null) { |
function clearSession ($session=null) { |
| 111 |
if ($session === null) $session = mosSession::getCurrent(); |
if ($session === null) $session =& mosSession::getCurrent(); |
| 112 |
//mosCache::cleanCache('com_content'); |
//mosCache::cleanCache('com_content'); |
| 113 |
mosCache::cleanCache(); |
mosCache::cleanCache(); |
| 114 |
$session->guest = 1; |
$session->guest = 1; |
| 131 |
* Reverts the current session record back to 'anonymous' parameters |
* Reverts the current session record back to 'anonymous' parameters |
| 132 |
*/ |
*/ |
| 133 |
function logoutUser () { |
function logoutUser () { |
| 134 |
$session = mosSession::getCurrent(); |
$session =& mosSession::getCurrent(); |
| 135 |
if ($session) { |
if ($session) { |
| 136 |
$mambothandler = mosMambotHandler::getInstance(); |
$mambothandler =& mosMambotHandler::getInstance(); |
| 137 |
$mambothandler->loadBotGroup('authenticator'); |
$mambothandler->loadBotGroup('authenticator'); |
| 138 |
$loginfo = new mosLoginDetails($session->username); |
$loginfo = new mosLoginDetails($session->username); |
| 139 |
$mambothandler->trigger('beforeLogout', array($loginfo)); |
$mambothandler->trigger('beforeLogout', array($loginfo)); |
| 142 |
} |
} |
| 143 |
|
|
| 144 |
function &loginAdmin ($acl) { |
function &loginAdmin ($acl) { |
| 145 |
$database = mamboDatabase::getInstance(); |
$database =& mamboDatabase::getInstance(); |
| 146 |
/** escape and trim to minimise injection of malicious sql */ |
/** escape and trim to minimise injection of malicious sql */ |
| 147 |
$usrname = $database->getEscaped(mosGetParam($_POST, 'usrname', '')); |
$usrname = $database->getEscaped(mosGetParam($_POST, 'usrname', '')); |
| 148 |
$pass = $database->getEscaped(mosGetParam($_POST, 'pass', '')); |
$pass = $database->getEscaped(mosGetParam($_POST, 'pass', '')); |