mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
UPDATE: change all instances of $this->request to use appropriate getter/setter
This commit is contained in:
parent
ee7ff8b5cf
commit
0d94cf15a5
@ -264,7 +264,7 @@ class LeftAndMain extends Controller implements PermissionProvider {
|
|||||||
if($this->redirectedTo()) return;
|
if($this->redirectedTo()) return;
|
||||||
|
|
||||||
// Audit logging hook
|
// Audit logging hook
|
||||||
if(empty($_REQUEST['executeForm']) && !$this->request->isAjax()) $this->extend('accessedCMS');
|
if(empty($_REQUEST['executeForm']) && !$this->getRequest()->isAjax()) $this->extend('accessedCMS');
|
||||||
|
|
||||||
// Set the members html editor config
|
// Set the members html editor config
|
||||||
if(Member::currentUser()) {
|
if(Member::currentUser()) {
|
||||||
@ -472,10 +472,10 @@ class LeftAndMain extends Controller implements PermissionProvider {
|
|||||||
* See LeftAndMain.js for the required jQuery ajaxComplete handlers.
|
* See LeftAndMain.js for the required jQuery ajaxComplete handlers.
|
||||||
*/
|
*/
|
||||||
public function redirect($url, $code=302) {
|
public function redirect($url, $code=302) {
|
||||||
if($this->request->isAjax()) {
|
if($this->getRequest()->isAjax()) {
|
||||||
$this->response->addHeader('X-ControllerURL', $url);
|
$this->response->addHeader('X-ControllerURL', $url);
|
||||||
if($this->request->getHeader('X-Pjax') && !$this->response->getHeader('X-Pjax')) {
|
if($this->getRequest()->getHeader('X-Pjax') && !$this->response->getHeader('X-Pjax')) {
|
||||||
$this->response->addHeader('X-Pjax', $this->request->getHeader('X-Pjax'));
|
$this->response->addHeader('X-Pjax', $this->getRequest()->getHeader('X-Pjax'));
|
||||||
}
|
}
|
||||||
$oldResponse = $this->response;
|
$oldResponse = $this->response;
|
||||||
$newResponse = new LeftAndMain_HTTPResponse(
|
$newResponse = new LeftAndMain_HTTPResponse(
|
||||||
@ -786,7 +786,7 @@ class LeftAndMain extends Controller implements PermissionProvider {
|
|||||||
$filterFunction = null, $nodeCountThreshold = 30) {
|
$filterFunction = null, $nodeCountThreshold = 30) {
|
||||||
|
|
||||||
// Filter criteria
|
// Filter criteria
|
||||||
$params = $this->request->getVar('q');
|
$params = $this->getRequest()->getVar('q');
|
||||||
if(isset($params['FilterClass']) && $filterClass = $params['FilterClass']){
|
if(isset($params['FilterClass']) && $filterClass = $params['FilterClass']){
|
||||||
if(!is_subclass_of($filterClass, 'CMSSiteTreeFilter')) {
|
if(!is_subclass_of($filterClass, 'CMSSiteTreeFilter')) {
|
||||||
throw new Exception(sprintf('Invalid filter class passed: %s', $filterClass));
|
throw new Exception(sprintf('Invalid filter class passed: %s', $filterClass));
|
||||||
@ -1006,7 +1006,7 @@ class LeftAndMain extends Controller implements PermissionProvider {
|
|||||||
$this->setCurrentPageID($record->ID);
|
$this->setCurrentPageID($record->ID);
|
||||||
|
|
||||||
$this->response->addHeader('X-Status', rawurlencode(_t('LeftAndMain.SAVEDUP', 'Saved.')));
|
$this->response->addHeader('X-Status', rawurlencode(_t('LeftAndMain.SAVEDUP', 'Saved.')));
|
||||||
return $this->getResponseNegotiator()->respond($this->request);
|
return $this->getResponseNegotiator()->respond($this->getRequest());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete($data, $form) {
|
public function delete($data, $form) {
|
||||||
@ -1021,7 +1021,7 @@ class LeftAndMain extends Controller implements PermissionProvider {
|
|||||||
|
|
||||||
$this->response->addHeader('X-Status', rawurlencode(_t('LeftAndMain.DELETED', 'Deleted.')));
|
$this->response->addHeader('X-Status', rawurlencode(_t('LeftAndMain.DELETED', 'Deleted.')));
|
||||||
return $this->getResponseNegotiator()->respond(
|
return $this->getResponseNegotiator()->respond(
|
||||||
$this->request,
|
$this->getRequest(),
|
||||||
array('currentform' => array($this, 'EmptyForm'))
|
array('currentform' => array($this, 'EmptyForm'))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -1443,8 +1443,8 @@ class LeftAndMain extends Controller implements PermissionProvider {
|
|||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function currentPageID() {
|
public function currentPageID() {
|
||||||
if($this->request->requestVar('ID') && is_numeric($this->request->requestVar('ID'))) {
|
if($this->getRequest()->requestVar('ID') && is_numeric($this->getRequest()->requestVar('ID'))) {
|
||||||
return $this->request->requestVar('ID');
|
return $this->getRequest()->requestVar('ID');
|
||||||
} elseif (isset($this->urlParams['ID']) && is_numeric($this->urlParams['ID'])) {
|
} elseif (isset($this->urlParams['ID']) && is_numeric($this->urlParams['ID'])) {
|
||||||
return $this->urlParams['ID'];
|
return $this->urlParams['ID'];
|
||||||
} elseif(Session::get($this->sessionNamespace() . ".currentPage")) {
|
} elseif(Session::get($this->sessionNamespace() . ".currentPage")) {
|
||||||
|
@ -98,8 +98,8 @@ abstract class ModelAdmin extends LeftAndMain {
|
|||||||
|
|
||||||
$models = $this->getManagedModels();
|
$models = $this->getManagedModels();
|
||||||
|
|
||||||
if($this->request->param('ModelClass')) {
|
if($this->getRequest()->param('ModelClass')) {
|
||||||
$this->modelClass = $this->unsanitiseClassName($this->request->param('ModelClass'));
|
$this->modelClass = $this->unsanitiseClassName($this->getRequest()->param('ModelClass'));
|
||||||
} else {
|
} else {
|
||||||
reset($models);
|
reset($models);
|
||||||
$this->modelClass = key($models);
|
$this->modelClass = key($models);
|
||||||
@ -200,7 +200,7 @@ abstract class ModelAdmin extends LeftAndMain {
|
|||||||
$form->setFormAction($this->Link($this->sanitiseClassName($this->modelClass)));
|
$form->setFormAction($this->Link($this->sanitiseClassName($this->modelClass)));
|
||||||
$form->addExtraClass('cms-search-form');
|
$form->addExtraClass('cms-search-form');
|
||||||
$form->disableSecurityToken();
|
$form->disableSecurityToken();
|
||||||
$form->loadDataFrom($this->request->getVars());
|
$form->loadDataFrom($this->getRequest()->getVars());
|
||||||
|
|
||||||
$this->extend('updateSearchForm', $form);
|
$this->extend('updateSearchForm', $form);
|
||||||
|
|
||||||
@ -209,7 +209,7 @@ abstract class ModelAdmin extends LeftAndMain {
|
|||||||
|
|
||||||
public function getList() {
|
public function getList() {
|
||||||
$context = $this->getSearchContext();
|
$context = $this->getSearchContext();
|
||||||
$params = $this->request->requestVar('q');
|
$params = $this->getRequest()->requestVar('q');
|
||||||
|
|
||||||
if(is_array($params)) {
|
if(is_array($params)) {
|
||||||
$params = array_map('trim', $params);
|
$params = array_map('trim', $params);
|
||||||
@ -449,7 +449,7 @@ abstract class ModelAdmin extends LeftAndMain {
|
|||||||
|
|
||||||
// Show the class name rather than ModelAdmin title as root node
|
// Show the class name rather than ModelAdmin title as root node
|
||||||
$models = $this->getManagedModels();
|
$models = $this->getManagedModels();
|
||||||
$params = $this->request->getVars();
|
$params = $this->getRequest()->getVars();
|
||||||
if(isset($params['url'])) unset($params['url']);
|
if(isset($params['url'])) unset($params['url']);
|
||||||
|
|
||||||
$items[0]->Title = $models[$this->modelClass]['title'];
|
$items[0]->Title = $models[$this->modelClass]['title'];
|
||||||
|
@ -166,7 +166,7 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
|
|||||||
$rolesTab->push($rolesField);
|
$rolesTab->push($rolesField);
|
||||||
}
|
}
|
||||||
|
|
||||||
$actionParam = $this->request->param('Action');
|
$actionParam = $this->getRequest()->param('Action');
|
||||||
if($actionParam == 'groups') {
|
if($actionParam == 'groups') {
|
||||||
$groupsTab->addExtraClass('ui-state-active');
|
$groupsTab->addExtraClass('ui-state-active');
|
||||||
} elseif($actionParam == 'users') {
|
} elseif($actionParam == 'users') {
|
||||||
@ -273,7 +273,7 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
|
|||||||
// Name root breadcrumb based on which record is edited,
|
// Name root breadcrumb based on which record is edited,
|
||||||
// which can only be determined by looking for the fieldname of the GridField.
|
// which can only be determined by looking for the fieldname of the GridField.
|
||||||
// Note: Titles should be same titles as tabs in RootForm().
|
// Note: Titles should be same titles as tabs in RootForm().
|
||||||
$params = $this->request->allParams();
|
$params = $this->getRequest()->allParams();
|
||||||
if(isset($params['FieldName'])) {
|
if(isset($params['FieldName'])) {
|
||||||
// TODO FieldName param gets overwritten by nested GridFields,
|
// TODO FieldName param gets overwritten by nested GridFields,
|
||||||
// so shows "Members" rather than "Groups" for the following URL:
|
// so shows "Members" rather than "Groups" for the following URL:
|
||||||
|
@ -81,8 +81,8 @@ class CMSFormTest_Controller extends Controller implements TestOnly {
|
|||||||
protected $template = 'BlankPage';
|
protected $template = 'BlankPage';
|
||||||
|
|
||||||
public function Link($action = null) {
|
public function Link($action = null) {
|
||||||
return Controller::join_links('CMSFormTest_Controller', $this->request->latestParam('Action'),
|
return Controller::join_links('CMSFormTest_Controller', $this->getRequest()->latestParam('Action'),
|
||||||
$this->request->latestParam('ID'), $action);
|
$this->getRequest()->latestParam('ID'), $action);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function Form() {
|
public function Form() {
|
||||||
|
@ -118,7 +118,7 @@ class Controller extends RequestHandler implements TemplateGlobalProvider {
|
|||||||
|
|
||||||
$this->pushCurrent();
|
$this->pushCurrent();
|
||||||
$this->urlParams = $request->allParams();
|
$this->urlParams = $request->allParams();
|
||||||
$this->request = $request;
|
$this->setRequest($request);
|
||||||
$this->response = new SS_HTTPResponse();
|
$this->response = new SS_HTTPResponse();
|
||||||
$this->setDataModel($model);
|
$this->setDataModel($model);
|
||||||
|
|
||||||
@ -487,13 +487,13 @@ class Controller extends RequestHandler implements TemplateGlobalProvider {
|
|||||||
// In edge-cases, this will be called outside of a handleRequest() context; in that case,
|
// In edge-cases, this will be called outside of a handleRequest() context; in that case,
|
||||||
// redirect to the homepage - don't break into the global state at this stage because we'll
|
// redirect to the homepage - don't break into the global state at this stage because we'll
|
||||||
// be calling from a test context or something else where the global state is inappropraite
|
// be calling from a test context or something else where the global state is inappropraite
|
||||||
if($this->request) {
|
if($this->getRequest()) {
|
||||||
if($this->request->requestVar('BackURL')) {
|
if($this->getRequest()->requestVar('BackURL')) {
|
||||||
$url = $this->request->requestVar('BackURL');
|
$url = $this->getRequest()->requestVar('BackURL');
|
||||||
} else if($this->request->isAjax() && $this->request->getHeader('X-Backurl')) {
|
} else if($this->getRequest()->isAjax() && $this->getRequest()->getHeader('X-Backurl')) {
|
||||||
$url = $this->request->getHeader('X-Backurl');
|
$url = $this->getRequest()->getHeader('X-Backurl');
|
||||||
} else if($this->request->getHeader('Referer')) {
|
} else if($this->getRequest()->getHeader('Referer')) {
|
||||||
$url = $this->request->getHeader('Referer');
|
$url = $this->getRequest()->getHeader('Referer');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ class RequestHandler extends ViewableData {
|
|||||||
$this->brokenOnConstruct = false;
|
$this->brokenOnConstruct = false;
|
||||||
|
|
||||||
// Check necessary to avoid class conflicts before manifest is rebuilt
|
// Check necessary to avoid class conflicts before manifest is rebuilt
|
||||||
if(class_exists('NullHTTPRequest')) $this->request = new NullHTTPRequest();
|
if(class_exists('NullHTTPRequest')) $this->setRequest(new NullHTTPRequest());
|
||||||
|
|
||||||
// This will prevent bugs if setDataModel() isn't called.
|
// This will prevent bugs if setDataModel() isn't called.
|
||||||
$this->model = DataModel::inst();
|
$this->model = DataModel::inst();
|
||||||
@ -155,7 +155,7 @@ class RequestHandler extends ViewableData {
|
|||||||
user_error("parent::__construct() needs to be called on {$handlerClass}::__construct()", E_USER_WARNING);
|
user_error("parent::__construct() needs to be called on {$handlerClass}::__construct()", E_USER_WARNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->request = $request;
|
$this->setRequest($request);
|
||||||
$this->setDataModel($model);
|
$this->setDataModel($model);
|
||||||
|
|
||||||
$match = $this->findAction($request);
|
$match = $this->findAction($request);
|
||||||
@ -462,11 +462,14 @@ class RequestHandler extends ViewableData {
|
|||||||
* @uses SS_HTTPResponse_Exception
|
* @uses SS_HTTPResponse_Exception
|
||||||
*/
|
*/
|
||||||
public function httpError($errorCode, $errorMessage = null) {
|
public function httpError($errorCode, $errorMessage = null) {
|
||||||
|
|
||||||
|
$request = $this->getRequest();
|
||||||
|
|
||||||
// Call a handler method such as onBeforeHTTPError404
|
// Call a handler method such as onBeforeHTTPError404
|
||||||
$this->extend('onBeforeHTTPError' . $errorCode, $this->request);
|
$this->extend('onBeforeHTTPError' . $errorCode, $request);
|
||||||
|
|
||||||
// Call a handler method such as onBeforeHTTPError, passing 404 as the first arg
|
// Call a handler method such as onBeforeHTTPError, passing 404 as the first arg
|
||||||
$this->extend('onBeforeHTTPError', $errorCode, $this->request);
|
$this->extend('onBeforeHTTPError', $errorCode, $request);
|
||||||
|
|
||||||
// Throw a new exception
|
// Throw a new exception
|
||||||
throw new SS_HTTPResponse_Exception($errorMessage, $errorCode);
|
throw new SS_HTTPResponse_Exception($errorMessage, $errorCode);
|
||||||
|
@ -28,7 +28,7 @@ class PaginatedList extends SS_ListDecorator {
|
|||||||
throw new Exception('The request must be readable as an array.');
|
throw new Exception('The request must be readable as an array.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->request = $request;
|
$this->setRequest($request);
|
||||||
parent::__construct($list);
|
parent::__construct($list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,13 +92,14 @@ class PaginatedList extends SS_ListDecorator {
|
|||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getPageStart() {
|
public function getPageStart() {
|
||||||
|
$request = $this->getRequest();
|
||||||
if ($this->pageStart === null) {
|
if ($this->pageStart === null) {
|
||||||
if(
|
if(
|
||||||
$this->request
|
$request
|
||||||
&& isset($this->request[$this->getPaginationGetVar()])
|
&& isset($request[$this->getPaginationGetVar()])
|
||||||
&& $this->request[$this->getPaginationGetVar()] > 0
|
&& $request[$this->getPaginationGetVar()] > 0
|
||||||
) {
|
) {
|
||||||
$this->pageStart = (int)$this->request[$this->getPaginationGetVar()];
|
$this->pageStart = (int)$request[$this->getPaginationGetVar()];
|
||||||
} else {
|
} else {
|
||||||
$this->pageStart = 0;
|
$this->pageStart = 0;
|
||||||
}
|
}
|
||||||
@ -433,4 +434,20 @@ class PaginatedList extends SS_ListDecorator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the request object for this list
|
||||||
|
*
|
||||||
|
* @param SS_HTTPRequest
|
||||||
|
*/
|
||||||
|
public function setRequest($request) {
|
||||||
|
$this->request = $request;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the request object for this list
|
||||||
|
*/
|
||||||
|
public function getRequest() {
|
||||||
|
return $this->request;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ class DevelopmentAdmin extends Controller {
|
|||||||
parent::init();
|
parent::init();
|
||||||
|
|
||||||
// Special case for dev/build: Defer permission checks to DatabaseAdmin->init() (see #4957)
|
// Special case for dev/build: Defer permission checks to DatabaseAdmin->init() (see #4957)
|
||||||
$requestedDevBuild = (stripos($this->request->getURL(), 'dev/build') === 0);
|
$requestedDevBuild = (stripos($this->getRequest()->getURL(), 'dev/build') === 0);
|
||||||
|
|
||||||
// We allow access to this controller regardless of live-status or ADMIN permission only
|
// We allow access to this controller regardless of live-status or ADMIN permission only
|
||||||
// if on CLI. Access to this controller is always allowed in "dev-mode", or of the user is ADMIN.
|
// if on CLI. Access to this controller is always allowed in "dev-mode", or of the user is ADMIN.
|
||||||
|
@ -357,8 +357,8 @@ class TestRunner extends Controller {
|
|||||||
|
|
||||||
// Optionally skip certain tests
|
// Optionally skip certain tests
|
||||||
$skipTests = array();
|
$skipTests = array();
|
||||||
if($this->request->getVar('SkipTests')) {
|
if($this->getRequest()->getVar('SkipTests')) {
|
||||||
$skipTests = explode(',', $this->request->getVar('SkipTests'));
|
$skipTests = explode(',', $this->getRequest()->getVar('SkipTests'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$abstractClasses = array();
|
$abstractClasses = array();
|
||||||
|
@ -84,7 +84,7 @@ Variables can come from your database fields, or custom methods you define on yo
|
|||||||
|
|
||||||
:::php
|
:::php
|
||||||
public function UsersIpAddress() {
|
public function UsersIpAddress() {
|
||||||
return $this->request->getIP();
|
return $this->getRequest()->getIP();
|
||||||
}
|
}
|
||||||
|
|
||||||
**mysite/code/Page.ss**
|
**mysite/code/Page.ss**
|
||||||
|
@ -17,7 +17,7 @@ The `PaginatedList` will automatically set up query limits and read the request
|
|||||||
public function PaginatedPages() {
|
public function PaginatedPages() {
|
||||||
$list = Page::get();
|
$list = Page::get();
|
||||||
|
|
||||||
return new PaginatedList($list, $this->request);
|
return new PaginatedList($list, $this->getRequest());
|
||||||
}
|
}
|
||||||
|
|
||||||
<div class="notice" markdown="1">
|
<div class="notice" markdown="1">
|
||||||
@ -78,14 +78,14 @@ when using custom lists.
|
|||||||
:::php
|
:::php
|
||||||
$myPreLimitedList = Page::get()->limit(10);
|
$myPreLimitedList = Page::get()->limit(10);
|
||||||
|
|
||||||
$pages = new PaginatedList($myPreLimitedList, $this->request);
|
$pages = new PaginatedList($myPreLimitedList, $this->getRequest());
|
||||||
$pages->setLimitItems(false);
|
$pages->setLimitItems(false);
|
||||||
|
|
||||||
|
|
||||||
## Setting the limit of items
|
## Setting the limit of items
|
||||||
|
|
||||||
:::php
|
:::php
|
||||||
$pages = new PaginatedList(Page::get(), $this->request);
|
$pages = new PaginatedList(Page::get(), $this->getRequest());
|
||||||
$pages->setPageLength(25);
|
$pages->setPageLength(25);
|
||||||
|
|
||||||
If you set this limit to 0 it will disable paging entirely, effectively causing it to appear as a single page
|
If you set this limit to 0 it will disable paging entirely, effectively causing it to appear as a single page
|
||||||
|
@ -41,10 +41,10 @@ This route has defined that any URL beginning with `team` should create, and be
|
|||||||
|
|
||||||
It also contains 3 `parameters` or `params` for short. `$Action`, `$ID` and `$Name`. These variables are placeholders
|
It also contains 3 `parameters` or `params` for short. `$Action`, `$ID` and `$Name`. These variables are placeholders
|
||||||
which will be filled when the user makes their request. Request parameters are available on the `SS_HTTPRequest` object
|
which will be filled when the user makes their request. Request parameters are available on the `SS_HTTPRequest` object
|
||||||
and able to be pulled out from a controller using `$this->request->param($name)`.
|
and able to be pulled out from a controller using `$this->getRequest()->param($name)`.
|
||||||
|
|
||||||
<div class="info" markdown="1">
|
<div class="info" markdown="1">
|
||||||
All Controllers have access to `$this->request` for the request object and `$this->response` for the response.
|
All Controllers have access to `$this->getRequest()` for the request object and `$this->response` for the response.
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
Here is what those parameters would look like for certain requests
|
Here is what those parameters would look like for certain requests
|
||||||
@ -52,7 +52,7 @@ Here is what those parameters would look like for certain requests
|
|||||||
:::php
|
:::php
|
||||||
// GET /teams/
|
// GET /teams/
|
||||||
|
|
||||||
print_r($this->request->params());
|
print_r($this->getRequest()->params());
|
||||||
|
|
||||||
// Array
|
// Array
|
||||||
// (
|
// (
|
||||||
@ -63,7 +63,7 @@ Here is what those parameters would look like for certain requests
|
|||||||
|
|
||||||
// GET /teams/players/
|
// GET /teams/players/
|
||||||
|
|
||||||
print_r($this->request->params());
|
print_r($this->getRequest()->params());
|
||||||
|
|
||||||
// Array
|
// Array
|
||||||
// (
|
// (
|
||||||
@ -74,7 +74,7 @@ Here is what those parameters would look like for certain requests
|
|||||||
|
|
||||||
// GET /teams/players/1
|
// GET /teams/players/1
|
||||||
|
|
||||||
print_r($this->request->params());
|
print_r($this->getRequest()->params());
|
||||||
|
|
||||||
// Array
|
// Array
|
||||||
// (
|
// (
|
||||||
@ -89,7 +89,7 @@ You can also fetch one parameter at a time.
|
|||||||
|
|
||||||
// GET /teams/players/1/
|
// GET /teams/players/1/
|
||||||
|
|
||||||
echo $this->request->param('ID');
|
echo $this->getRequest()->param('ID');
|
||||||
// returns '1'
|
// returns '1'
|
||||||
|
|
||||||
|
|
||||||
@ -184,8 +184,8 @@ parameters.
|
|||||||
);
|
);
|
||||||
public function go() {
|
public function go() {
|
||||||
$this->validateUser(
|
$this->validateUser(
|
||||||
$this->request->param('UserName'),
|
$this->getRequest()->param('UserName'),
|
||||||
$this->request->param('AuthToken')
|
$this->getRequest()->param('AuthToken')
|
||||||
);
|
);
|
||||||
/* more processing goes here */
|
/* more processing goes here */
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,7 @@ in order to read page limit information. It is also passed the current
|
|||||||
|
|
||||||
:::php
|
:::php
|
||||||
public function getResults($searchCriteria = array()) {
|
public function getResults($searchCriteria = array()) {
|
||||||
$start = ($this->request->getVar('start')) ? (int)$this->request->getVar('start') : 0;
|
$start = ($this->getRequest()->getVar('start')) ? (int)$this->getRequest()->getVar('start') : 0;
|
||||||
$limit = 10;
|
$limit = 10;
|
||||||
|
|
||||||
$context = singleton('MyDataObject')->getCustomSearchContext();
|
$context = singleton('MyDataObject')->getCustomSearchContext();
|
||||||
@ -124,7 +124,7 @@ in order to read page limit information. It is also passed the current
|
|||||||
$records = $context->getResults($searchCriteria, null, array('start'=>$start,'limit'=>$limit));
|
$records = $context->getResults($searchCriteria, null, array('start'=>$start,'limit'=>$limit));
|
||||||
|
|
||||||
if($records) {
|
if($records) {
|
||||||
$records = new PaginatedList($records, $this->request);
|
$records = new PaginatedList($records, $this->getRequest());
|
||||||
$records->setPageStart($start);
|
$records->setPageStart($start);
|
||||||
$records->setPageLength($limit);
|
$records->setPageLength($limit);
|
||||||
$records->setTotalItems($query->unlimitedRowCount());
|
$records->setTotalItems($query->unlimitedRowCount());
|
||||||
|
@ -215,7 +215,7 @@ checkbox which limits search results to expensive products (over $100).
|
|||||||
public function getList() {
|
public function getList() {
|
||||||
$list = parent::getList();
|
$list = parent::getList();
|
||||||
|
|
||||||
$params = $this->request->requestVar('q'); // use this to access search parameters
|
$params = $this->getRequest()->requestVar('q'); // use this to access search parameters
|
||||||
|
|
||||||
if($this->modelClass == 'Product' && isset($params['ExpensiveOnly']) && $params['ExpensiveOnly']) {
|
if($this->modelClass == 'Product' && isset($params['ExpensiveOnly']) && $params['ExpensiveOnly']) {
|
||||||
$list = $list->exclude('Price:LessThan', '100');
|
$list = $list->exclude('Price:LessThan', '100');
|
||||||
|
@ -506,7 +506,7 @@ class HtmlEditorField_Toolbar extends RequestHandler {
|
|||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getanchors() {
|
public function getanchors() {
|
||||||
$id = (int)$this->request->getVar('PageID');
|
$id = (int)$this->getRequest()->getVar('PageID');
|
||||||
$anchors = array();
|
$anchors = array();
|
||||||
|
|
||||||
if (($page = Page::get()->byID($id)) && !empty($page)) {
|
if (($page = Page::get()->byID($id)) && !empty($page)) {
|
||||||
|
@ -689,10 +689,10 @@ class GridField extends FormField {
|
|||||||
user_error("parent::__construct() needs to be called on {$handlerClass}::__construct()", E_USER_WARNING);
|
user_error("parent::__construct() needs to be called on {$handlerClass}::__construct()", E_USER_WARNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->request = $request;
|
$this->setRequest($request);
|
||||||
$this->setDataModel($model);
|
$this->setDataModel($model);
|
||||||
|
|
||||||
$fieldData = $this->request->requestVar($this->getName());
|
$fieldData = $this->getRequest()->requestVar($this->getName());
|
||||||
if($fieldData && isset($fieldData['GridState'])) $this->getState(false)->setValue($fieldData['GridState']);
|
if($fieldData && isset($fieldData['GridState'])) $this->getState(false)->setValue($fieldData['GridState']);
|
||||||
|
|
||||||
foreach($this->getComponents() as $component) {
|
foreach($this->getComponents() as $component) {
|
||||||
|
@ -50,7 +50,7 @@ class CMSSecurity extends Security {
|
|||||||
* @return Member
|
* @return Member
|
||||||
*/
|
*/
|
||||||
public function getTargetMember() {
|
public function getTargetMember() {
|
||||||
if($tempid = $this->request->requestVar('tempid')) {
|
if($tempid = $this->getRequest()->requestVar('tempid')) {
|
||||||
return Member::member_from_tempid($tempid);
|
return Member::member_from_tempid($tempid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -191,7 +191,7 @@ PHP
|
|||||||
|
|
||||||
// Get redirect url
|
// Get redirect url
|
||||||
$controller = $this->getResponseController(_t('CMSSecurity.SUCCESS', 'Success'));
|
$controller = $this->getResponseController(_t('CMSSecurity.SUCCESS', 'Success'));
|
||||||
$backURL = $this->request->requestVar('BackURL')
|
$backURL = $this->getRequest()->requestVar('BackURL')
|
||||||
?: Session::get('BackURL')
|
?: Session::get('BackURL')
|
||||||
?: Director::absoluteURL(AdminRootController::config()->url_base, true);
|
?: Director::absoluteURL(AdminRootController::config()->url_base, true);
|
||||||
|
|
||||||
|
@ -318,7 +318,7 @@ class Security extends Controller implements TemplateGlobalProvider {
|
|||||||
* @return string Class name of Authenticator
|
* @return string Class name of Authenticator
|
||||||
*/
|
*/
|
||||||
protected function getAuthenticator() {
|
protected function getAuthenticator() {
|
||||||
$authenticator = $this->request->requestVar('AuthenticationMethod');
|
$authenticator = $this->getRequest()->requestVar('AuthenticationMethod');
|
||||||
if($authenticator) {
|
if($authenticator) {
|
||||||
$authenticators = Authenticator::get_authenticators();
|
$authenticators = Authenticator::get_authenticators();
|
||||||
if(in_array($authenticator, $authenticators)) {
|
if(in_array($authenticator, $authenticators)) {
|
||||||
@ -420,7 +420,7 @@ class Security extends Controller implements TemplateGlobalProvider {
|
|||||||
// This step is necessary in cases such as automatic redirection where a user is authenticated
|
// This step is necessary in cases such as automatic redirection where a user is authenticated
|
||||||
// upon landing on an SSL secured site and is automatically logged in, or some other case
|
// upon landing on an SSL secured site and is automatically logged in, or some other case
|
||||||
// where the user has permissions to continue but is not given the option.
|
// where the user has permissions to continue but is not given the option.
|
||||||
if($this->request->requestVar('BackURL')
|
if($this->getRequest()->requestVar('BackURL')
|
||||||
&& !$this->getLoginMessage()
|
&& !$this->getLoginMessage()
|
||||||
&& ($member = Member::currentUser())
|
&& ($member = Member::currentUser())
|
||||||
&& $member->exists()
|
&& $member->exists()
|
||||||
|
@ -10,12 +10,13 @@ class FakeController extends Controller {
|
|||||||
|
|
||||||
$this->pushCurrent();
|
$this->pushCurrent();
|
||||||
|
|
||||||
$this->request = new SS_HTTPRequest(
|
$request = new SS_HTTPRequest(
|
||||||
(isset($_SERVER['X-HTTP-Method-Override']))
|
(isset($_SERVER['X-HTTP-Method-Override']))
|
||||||
? $_SERVER['X-HTTP-Method-Override']
|
? $_SERVER['X-HTTP-Method-Override']
|
||||||
: $_SERVER['REQUEST_METHOD'],
|
: $_SERVER['REQUEST_METHOD'],
|
||||||
'/'
|
'/'
|
||||||
);
|
);
|
||||||
|
$this->setRequest($request);
|
||||||
|
|
||||||
$this->response = new SS_HTTPResponse();
|
$this->response = new SS_HTTPResponse();
|
||||||
|
|
||||||
|
@ -343,18 +343,18 @@ class RestfulServiceTest_Controller extends Controller implements TestOnly {
|
|||||||
|
|
||||||
public function index() {
|
public function index() {
|
||||||
$request = '';
|
$request = '';
|
||||||
foreach ($this->request->requestVars() as $key=>$value) {
|
foreach ($this->getRequest()->requestVars() as $key=>$value) {
|
||||||
$request .= "\t\t<request_item name=\"$key\">$value</request_item>\n";
|
$request .= "\t\t<request_item name=\"$key\">$value</request_item>\n";
|
||||||
}
|
}
|
||||||
$get = '';
|
$get = '';
|
||||||
foreach ($this->request->getVars() as $key => $value) {
|
foreach ($this->getRequest()->getVars() as $key => $value) {
|
||||||
$get .= "\t\t<get_item name=\"$key\">$value</get_item>\n";
|
$get .= "\t\t<get_item name=\"$key\">$value</get_item>\n";
|
||||||
}
|
}
|
||||||
$post = '';
|
$post = '';
|
||||||
foreach ($this->request->postVars() as $key => $value) {
|
foreach ($this->getRequest()->postVars() as $key => $value) {
|
||||||
$post .= "\t\t<post_item name=\"$key\">$value</post_item>\n";
|
$post .= "\t\t<post_item name=\"$key\">$value</post_item>\n";
|
||||||
}
|
}
|
||||||
$body = $this->request->getBody();
|
$body = $this->getRequest()->getBody();
|
||||||
|
|
||||||
$out = <<<XML
|
$out = <<<XML
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
|
@ -84,8 +84,8 @@ class EmailFieldTest_Controller extends Controller implements TestOnly {
|
|||||||
function Link($action = null) {
|
function Link($action = null) {
|
||||||
return Controller::join_links(
|
return Controller::join_links(
|
||||||
'EmailFieldTest_Controller',
|
'EmailFieldTest_Controller',
|
||||||
$this->request->latestParam('Action'),
|
$this->getRequest()->latestParam('Action'),
|
||||||
$this->request->latestParam('ID'),
|
$this->getRequest()->latestParam('ID'),
|
||||||
$action
|
$action
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -654,8 +654,8 @@ class FormTest_Controller extends Controller implements TestOnly {
|
|||||||
protected $template = 'BlankPage';
|
protected $template = 'BlankPage';
|
||||||
|
|
||||||
public function Link($action = null) {
|
public function Link($action = null) {
|
||||||
return Controller::join_links('FormTest_Controller', $this->request->latestParam('Action'),
|
return Controller::join_links('FormTest_Controller', $this->getRequest()->latestParam('Action'),
|
||||||
$this->request->latestParam('ID'), $action);
|
$this->getRequest()->latestParam('ID'), $action);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function Form() {
|
public function Form() {
|
||||||
@ -706,8 +706,8 @@ class FormTest_ControllerWithSecurityToken extends Controller implements TestOnl
|
|||||||
protected $template = 'BlankPage';
|
protected $template = 'BlankPage';
|
||||||
|
|
||||||
public function Link($action = null) {
|
public function Link($action = null) {
|
||||||
return Controller::join_links('FormTest_ControllerWithSecurityToken', $this->request->latestParam('Action'),
|
return Controller::join_links('FormTest_ControllerWithSecurityToken', $this->getRequest()->latestParam('Action'),
|
||||||
$this->request->latestParam('ID'), $action);
|
$this->getRequest()->latestParam('ID'), $action);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function Form() {
|
public function Form() {
|
||||||
@ -741,8 +741,8 @@ class FormTest_ControllerWithStrictPostCheck extends Controller implements TestO
|
|||||||
public function Link($action = null) {
|
public function Link($action = null) {
|
||||||
return Controller::join_links(
|
return Controller::join_links(
|
||||||
'FormTest_ControllerWithStrictPostCheck',
|
'FormTest_ControllerWithStrictPostCheck',
|
||||||
$this->request->latestParam('Action'),
|
$this->getRequest()->latestParam('Action'),
|
||||||
$this->request->latestParam('ID'),
|
$this->getRequest()->latestParam('ID'),
|
||||||
$action
|
$action
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user