From ff9b9e17af02f95211185a13ed34a385867e56b7 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Sat, 29 Oct 2011 17:06:19 +1300 Subject: [PATCH] MINOR: Removed use of deprecated Director::redirect* functions. --- forms/ComplexTableField.php | 4 ++-- forms/Form.php | 4 ++-- security/MemberLoginForm.php | 22 +++++++++------------- security/Security.php | 2 +- 4 files changed, 14 insertions(+), 18 deletions(-) diff --git a/forms/ComplexTableField.php b/forms/ComplexTableField.php index 9120a681b..55708ed18 100644 --- a/forms/ComplexTableField.php +++ b/forms/ComplexTableField.php @@ -493,8 +493,8 @@ JS; ); $form->sessionMessage($message, 'good'); - - Director::redirectBack(); + + $this->controller->redirectBack(); } } diff --git a/forms/Form.php b/forms/Form.php index 8c9644d08..791e53e19 100644 --- a/forms/Form.php +++ b/forms/Form.php @@ -316,11 +316,11 @@ class Form extends RequestHandler { if(Director::is_site_url($pageURL)) { // Remove existing pragmas $pageURL = preg_replace('/(#.*)/', '', $pageURL); - return Director::redirect($pageURL . '#' . $this->FormName()); + return $this->controller->redirect($pageURL . '#' . $this->FormName()); } } } - return Director::redirectBack(); + return $this->controller->redirectBack(); } } diff --git a/security/MemberLoginForm.php b/security/MemberLoginForm.php index fa66e3155..84df46cff 100644 --- a/security/MemberLoginForm.php +++ b/security/MemberLoginForm.php @@ -136,12 +136,12 @@ JS if($backURL) Session::set('BackURL', $backURL); if($badLoginURL = Session::get("BadLoginURL")) { - Director::redirect($badLoginURL); + $this->controller->redirect($badLoginURL); } else { // Show the right tab on failed login $loginLink = Director::absoluteURL(Security::Link("login")); if($backURL) $loginLink .= '?BackURL=' . urlencode($backURL); - Director::redirect($loginLink . '#' . $this->FormName() .'_tab'); + $this->controller->redirect($loginLink . '#' . $this->FormName() .'_tab'); } } } @@ -171,26 +171,22 @@ JS } $cp = new ChangePasswordForm($this->controller, 'ChangePasswordForm'); $cp->sessionMessage('Your password has expired. Please choose a new one.', 'good'); - Director::redirect('Security/changepassword'); - return; + return $this->controller->redirect('Security/changepassword'); } // Absolute redirection URLs may cause spoofing if(isset($_REQUEST['BackURL']) && $_REQUEST['BackURL'] && Director::is_site_url($_REQUEST['BackURL']) ) { - Director::redirect($_REQUEST['BackURL']); - return; + return $this->controller->redirect($_REQUEST['BackURL']); } // Spoofing attack, redirect to homepage instead of spoofing url if(isset($_REQUEST['BackURL']) && $_REQUEST['BackURL'] && !Director::is_site_url($_REQUEST['BackURL'])) { - Director::redirect(Director::absoluteBaseURL()); - return; + return $this->controller->redirect(Director::absoluteBaseURL()); } // If a default login dest has been set, redirect to that. if (Security::default_login_dest()) { - Director::redirect(Director::absoluteBaseURL() . Security::default_login_dest()); - return; + return $this->controller->redirect(Director::absoluteBaseURL() . Security::default_login_dest()); } // Redirect the user to the page where he came from @@ -268,18 +264,18 @@ JS ) ); - Director::redirect('Security/passwordsent/' . urlencode($data['Email'])); + $this->controller->redirect('Security/passwordsent/' . urlencode($data['Email'])); } elseif($data['Email']) { // Avoid information disclosure by displaying the same status, // regardless wether the email address actually exists - Director::redirect('Security/passwordsent/' . urlencode($data['Email'])); + $this->controller->redirect('Security/passwordsent/' . urlencode($data['Email'])); } else { $this->sessionMessage( _t('Member.ENTEREMAIL', 'Please enter an email address to get a password reset link.'), 'bad' ); - Director::redirect('Security/lostpassword'); + $this->controller->redirect('Security/lostpassword'); } } diff --git a/security/Security.php b/security/Security.php index edddd2df8..78641c015 100644 --- a/security/Security.php +++ b/security/Security.php @@ -314,7 +314,7 @@ class Security extends Controller { $member = Member::currentUser(); if($member) $member->logOut(); - if($redirect) Director::redirectBack(); + if($redirect) $this->redirectBack(); }