| 296 |
if (strpos($url, '?')) $url .= '&mosmsg='.urlencode($message); |
if (strpos($url, '?')) $url .= '&mosmsg='.urlencode($message); |
| 297 |
else $url .= '?mosmsg='.urlencode($message); |
else $url .= '?mosmsg='.urlencode($message); |
| 298 |
} |
} |
|
//die('Ready to redirect to '.$url); |
|
| 299 |
if (headers_sent()) echo "<script>document.location.href='$url';</script>\n"; |
if (headers_sent()) echo "<script>document.location.href='$url';</script>\n"; |
| 300 |
else { |
else { |
| 301 |
@ob_end_clean(); // clear output buffer |
@ob_end_clean(); // clear output buffer |
| 316 |
<?php |
<?php |
| 317 |
} |
} |
| 318 |
if ($return = mosGetParam( $_REQUEST, 'return', '' )) { |
if ($return = mosGetParam( $_REQUEST, 'return', '' )) { |
|
echo 'About to redirect (return)'; |
|
| 319 |
$this->redirect( $return ); |
$this->redirect( $return ); |
| 320 |
} |
} |
| 321 |
else { |
else { |
|
echo 'About to redirect (live site)'; |
|
| 322 |
$this->redirect( $this->mosConfig_live_site.'/index.php' ); |
$this->redirect( $this->mosConfig_live_site.'/index.php' ); |
| 323 |
} |
} |
| 324 |
} |
} |
| 325 |
|
|
| 326 |
function handleLogin ($session) { |
function handleLogin () { |
| 327 |
require_once($this->rootPath().'/includes/authenticator.php'); |
require_once($this->rootPath().'/includes/authenticator.php'); |
| 328 |
$authenticator = mamboAuthenticator::getInstance(); |
$authenticator = mamboAuthenticator::getInstance(); |
| 329 |
$authenticator->loginUser(); |
$loggedin = $authenticator->loginUser(); |
| 330 |
$this->logMessage(_LOGIN_SUCCESS); |
if ($loggedin) $this->logMessage(_LOGIN_SUCCESS); |
| 331 |
|
else mamboCore::redirect('index.php'); |
| 332 |
} |
} |
| 333 |
|
|
| 334 |
function handleLogout ($session) { |
function handleLogout () { |
| 335 |
require_once($this->rootPath().'/includes/authenticator.php'); |
require_once($this->rootPath().'/includes/authenticator.php'); |
| 336 |
$authenticator = mamboAuthenticator::getInstance(); |
$authenticator = mamboAuthenticator::getInstance(); |
| 337 |
$authenticator->logoutUser(); |
$authenticator->logoutUser(); |
|
@session_destroy(); |
|
| 338 |
$this->logMessage(_LOGOUT_SUCCESS); |
$this->logMessage(_LOGOUT_SUCCESS); |
| 339 |
} |
} |
| 340 |
|
|
| 1655 |
function getUser() { |
function getUser() { |
| 1656 |
return mamboCore::get('currentUser'); |
return mamboCore::get('currentUser'); |
| 1657 |
} |
} |
| 1658 |
|
/** |
| 1659 |
|
* Logout the current user - deprecated - use the code here directly |
| 1660 |
|
*/ |
| 1661 |
|
function logout() { |
| 1662 |
|
require_once(mamboCore::get('mosConfig_absolute_path').'/includes/authenticator.php'); |
| 1663 |
|
$authenticator = mamboAuthenticator::getInstance(); |
| 1664 |
|
$authenticator->logoutUser(); |
| 1665 |
|
} |
| 1666 |
|
/** |
| 1667 |
|
* Login a user given name and password - deprecated - use the code here directly |
| 1668 |
|
*/ |
| 1669 |
|
function login ($username=null,$passwd=null) { |
| 1670 |
|
require_once(mamboCore::get('mosConfig_absolute_path').'/includes/authenticator.php'); |
| 1671 |
|
$authenticator = mamboAuthenticator::getInstance(); |
| 1672 |
|
return $authenticator->loginUser($username, $passwd); |
| 1673 |
|
} |
| 1674 |
|
|
| 1675 |
/** |
/** |
| 1676 |
* Singleton get instance |
* Singleton get instance |
| 2453 |
$Itemid = $configuration->get('Itemid'); |
$Itemid = $configuration->get('Itemid'); |
| 2454 |
|
|
| 2455 |
$mainframe =& new mosMainFrame($database, $option, '.'); |
$mainframe =& new mosMainFrame($database, $option, '.'); |
| 2456 |
$session = mosSession::getCurrent(); |
if ($option == 'login') $configuration->handleLogin(); |
| 2457 |
if ($option == 'login') $configuration->handleLogin($session); |
elseif ($option == 'logout') $configuration->handleLogout(); |
|
elseif ($option == 'logout') $configuration->handleLogout($session); |
|
| 2458 |
|
|
| 2459 |
|
$session = mosSession::getCurrent(); |
| 2460 |
$my =& new mosUser($database); |
$my =& new mosUser($database); |
| 2461 |
$my->getSessionData(); |
$my->getSessionData(); |
| 2462 |
mamboCore::set('currentUser',$my); |
mamboCore::set('currentUser',$my); |