BUGFIX Use of Link() in security classes now refers to $this->controller

instead of calling the instance method Link statically (which isn't
allowed for E_STRICT compliance.)
This commit is contained in:
Sean Harvey 2012-04-12 12:09:39 +12:00
parent 6b40377a1c
commit fd3de5158d
4 changed files with 8 additions and 6 deletions

View File

@ -111,7 +111,7 @@ class ChangePasswordForm extends Form {
} }
else { else {
// Redirect to default location - the login form saying "You are logged in as..." // Redirect to default location - the login form saying "You are logged in as..."
$redirectURL = HTTP::setGetVar('BackURL', Director::absoluteBaseURL(), Security::Link('login')); $redirectURL = HTTP::setGetVar('BackURL', Director::absoluteBaseURL(), $this->controller->Link('login'));
Director::redirect($redirectURL); Director::redirect($redirectURL);
} }
} else { } else {

View File

@ -130,14 +130,14 @@ JS
if(isset($_REQUEST['BackURL'])) $backURL = $_REQUEST['BackURL']; if(isset($_REQUEST['BackURL'])) $backURL = $_REQUEST['BackURL'];
else $backURL = null; else $backURL = null;
if($backURL) Session::set('BackURL', $backURL); if($backURL) Session::set('BackURL', $backURL);
if($badLoginURL = Session::get("BadLoginURL")) { if($badLoginURL = Session::get("BadLoginURL")) {
$this->controller->redirect($badLoginURL); $this->controller->redirect($badLoginURL);
} else { } else {
// Show the right tab on failed login // Show the right tab on failed login
$loginLink = Director::absoluteURL(Security::Link("login")); $loginLink = Director::absoluteURL($this->controller->Link('login'));
if($backURL) $loginLink .= '?BackURL=' . urlencode($backURL); if($backURL) $loginLink .= '?BackURL=' . urlencode($backURL);
$this->controller->redirect($loginLink . '#' . $this->FormName() .'_tab'); $this->controller->redirect($loginLink . '#' . $this->FormName() .'_tab');
} }
} }

View File

@ -281,7 +281,7 @@ class PermissionCheckboxSetField_Readonly extends PermissionCheckboxSetField {
protected $readonly = true; protected $readonly = true;
function saveInto($record) { function saveInto(DataObjectInterface $record) {
return false; return false;
} }
} }

View File

@ -514,7 +514,9 @@ class Security extends Controller {
*/ */
public static function getPasswordResetLink($autoLoginHash) { public static function getPasswordResetLink($autoLoginHash) {
$autoLoginHash = urldecode($autoLoginHash); $autoLoginHash = urldecode($autoLoginHash);
return self::Link('changepassword') . "?h=$autoLoginHash"; $selfControllerClass = __CLASS__;
$selfController = new $selfControllerClass();
return $selfController->Link('changepassword') . "?h=$autoLoginHash";
} }
/** /**