MINOR Replacing deprecated static function calls to Director with

current Controller instance replacements.
This commit is contained in:
Sean Harvey 2012-05-23 21:50:02 +12:00
parent f7f67d90a5
commit 77c2365b87
8 changed files with 24 additions and 24 deletions

View File

@ -164,7 +164,7 @@ class LeftAndMain extends Controller implements PermissionProvider {
);
// Allow customisation of the access check by a extension
// Also all the canView() check to execute Director::redirect()
// Also all the canView() check to execute Controller::redirect()
if(!$this->canView() && !$this->response->isFinished()) {
// When access /admin/, we should try a redirect to another part of the admin rather than be locked out
$menu = $this->MainMenu();
@ -175,7 +175,7 @@ class LeftAndMain extends Controller implements PermissionProvider {
&& $candidate->MenuItem->controller
&& singleton($candidate->MenuItem->controller)->canView()
) {
return Director::redirect($candidate->Link);
return $this->redirect($candidate->Link);
}
}
@ -194,7 +194,7 @@ class LeftAndMain extends Controller implements PermissionProvider {
}
// Don't continue if there's already been a redirection request.
if(Director::redirected_to()) return;
if($this->redirectedTo()) return;
// Audit logging hook
if(empty($_REQUEST['executeForm']) && !$this->request->isAjax()) $this->extend('accessedCMS');

View File

@ -180,6 +180,6 @@ class DevelopmentAdmin extends Controller {
}
function errors() {
Director::redirect("Debug_");
$this->redirect("Debug_");
}
}

View File

@ -175,7 +175,7 @@ class FileIFrameField extends FileField {
|| ($data['FileSource'] == 'existing' && (!isset($data['ExistingFile']) || !$data['ExistingFile']))
) {
$form->sessionMessage(_t('FileIFrameField.NOSOURCE', 'Please select a source file to attach'), 'required');
Director::redirectBack();
Controller::curr()->redirectBack();
return;
}
@ -189,12 +189,12 @@ class FileIFrameField extends FileField {
$this->upload->loadIntoFile($_FILES['Upload'], $fileObject, $this->folderName);
} catch (Exception $e){
$form->sessionMessage(_t('FileIFrameField.DISALLOWEDFILETYPE', 'This filetype is not allowed to be uploaded'), 'bad');
Director::redirectBack();
Controller::curr()->redirectBack();
return;
}
if($this->upload->isError()) {
Director::redirectBack();
Controller::curr()->redirectBack();
return;
}
@ -209,7 +209,7 @@ class FileIFrameField extends FileField {
// dont allow the user to attach a folder by default
if(!$fileObject || ($fileObject instanceof Folder && $desiredClass != 'Folder')) {
Director::redirectBack();
Controller::curr()->redirectBack();
return;
}
@ -222,7 +222,7 @@ class FileIFrameField extends FileField {
}
$this->form->getRecord()->write();
Director::redirectBack();
Controller::curr()->redirectBack();
}
/**
@ -260,7 +260,7 @@ class FileIFrameField extends FileField {
$this->form->getRecord()->{$this->getName() . 'ID'} = 0;
$this->form->getRecord()->write();
Director::redirectBack();
Controller::curr()->redirectBack();
}
/**

View File

@ -53,7 +53,7 @@
* $file->loadUploaded($_FILES['FileTypeID']);
*
* // Redirect to a page thanking people for registering
* Director::redirect('thanks-for-your-submission/');
* $this->redirect('thanks-for-your-submission/');
* }
* </code>
*

View File

@ -284,7 +284,7 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler {
$controller = Controller::curr();
$noActionURL = $controller->removeAction($_REQUEST['url']);
$controller->getResponse()->removeHeader('Location'); //clear the existing redirect
return Director::redirect($noActionURL, 302);
return $controller->redirect($noActionURL, 302);
}
$actions = new FieldList();
@ -406,7 +406,7 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler {
$controller = Controller::curr();
$noActionURL = $controller->removeAction($data['url']);
return Director::redirect($noActionURL, 302); //redirect back to admin section
return $controller->redirect($noActionURL, 302); //redirect back to admin section
}
/**

View File

@ -97,7 +97,7 @@ class DatabaseAdmin extends Controller {
echo "<p>Setting up the database; you will be returned to your site shortly....</p>";
$this->doBuild(true);
echo "<p>Done!</p>";
Director::redirect($_GET['returnURL']);
$this->redirect($_GET['returnURL']);
} else {
$this->doBuild(isset($_REQUEST['quiet']) || isset($_REQUEST['from_installer']), !isset($_REQUEST['dont_populate']));
}

View File

@ -67,7 +67,7 @@ class ChangePasswordForm extends Form {
_t('Member.ERRORPASSWORDNOTMATCH', "Your current password does not match, please try again"),
"bad"
);
Director::redirectBack();
$this->controller->redirectBack();
return;
}
}
@ -80,7 +80,7 @@ class ChangePasswordForm extends Form {
// The user is not logged in and no valid auto login hash is available
if(!$member) {
Session::clear('AutoLoginHash');
Director::redirect('loginpage');
$this->controller->redirect('loginpage');
return;
}
}
@ -91,7 +91,7 @@ class ChangePasswordForm extends Form {
$this->sessionMessage(
_t('Member.EMPTYNEWPASSWORD', "The new password can't be empty, please try again"),
"bad");
Director::redirectBack();
$this->controller->redirectBack();
return;
}
else if($data['NewPassword1'] == $data['NewPassword2']) {
@ -107,12 +107,12 @@ class ChangePasswordForm extends Form {
// absolute redirection URLs may cause spoofing
&& Director::is_site_url($_REQUEST['BackURL'])
) {
Director::redirect($_REQUEST['BackURL']);
$this->controller->redirect($_REQUEST['BackURL']);
}
else {
// Redirect to default location - the login form saying "You are logged in as..."
$redirectURL = HTTP::setGetVar('BackURL', Director::absoluteBaseURL(), $this->controller->Link('login'));
Director::redirect($redirectURL);
$this->controller->redirect($redirectURL);
}
} else {
$this->clearMessage();
@ -124,7 +124,7 @@ class ChangePasswordForm extends Form {
),
"bad"
);
Director::redirectBack();
$this->controller->redirectBack();
}
} else {
@ -132,7 +132,7 @@ class ChangePasswordForm extends Form {
$this->sessionMessage(
_t('Member.ERRORNEWPASSWORD', "You have entered your new password differently, try again"),
"bad");
Director::redirectBack();
$this->controller->redirectBack();
}
}

View File

@ -230,9 +230,9 @@ class Security extends Controller {
// TODO AccessLogEntry needs an extension to handle permission denied errors
// Audit logging hook
if($controller) $controller->extend('permissionDenied', $member);
$controller->extend('permissionDenied', $member);
Director::redirect("Security/login?BackURL=" . urlencode($_SERVER['REQUEST_URI']));
$controller->redirect("Security/login?BackURL=" . urlencode($_SERVER['REQUEST_URI']));
}
return;
}
@ -319,7 +319,7 @@ class Security extends Controller {
// Event handler for pre-login, with an option to let it break you out of the login form
$eventResults = $this->extend('onBeforeSecurityLogin');
// If there was a redirection, return
if(Director::redirected_to()) return;
if($this->redirectedTo()) return;
// If there was an SS_HTTPResponse object returned, then return that
else if($eventResults) {
foreach($eventResults as $result) {