BUGFIX: Fallback for arrays which do not contain 'alreadyLoggedIn' values

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@95968 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Geoff Munn 2009-12-21 00:12:08 +00:00 committed by Sam Minnee
parent f204f96b1f
commit 6b59dc3e78

View File

@ -189,8 +189,15 @@ class Security extends Controller {
$response = ($controller) ? $controller->getResponse() : new SS_HTTPResponse(); $response = ($controller) ? $controller->getResponse() : new SS_HTTPResponse();
$response->setStatusCode(403); $response->setStatusCode(403);
//If 'alreadyLoggedIn' is not specified in the array, then use the default
//which should have been specified in the lines above
if(isset($messageSet['alreadyLoggedIn']))
$message=$messageSet['alreadyLoggedIn'];
else
$message=$messageSet['default'];
// Replace %s with the log in link // Replace %s with the log in link
$body = sprintf($messageSet['alreadyLoggedIn'], $body = sprintf($message,
Controller::join_links(Director::baseURL(), 'Security/login', Controller::join_links(Director::baseURL(), 'Security/login',
'?BackURL=' . urlencode($_SERVER['REQUEST_URI']))); '?BackURL=' . urlencode($_SERVER['REQUEST_URI'])));