LimeSurvey API - Master branch

LSHttpRequest extends CHttpRequest
in package

Description of HttpRequest

Used in LSYii_Application.php

   'request'=>array(
       'class'=>'HttpRequest',
       'noCsrfValidationRoutes'=>array(
           '^services/wsdl.*$'
       ),
       'enableCsrfValidation'=>true,
       'enableCookieValidation'=>true,
   ),

Every route will be interpreted as a regex pattern.

Table of Contents

Properties

$noCsrfValidationParams  : mixed
$noCsrfValidationRoutes  : mixed
$_pathInfo  : mixed
$queryParams  : array<string, mixed>|null

Methods

getOriginalUrlReferrer()  : mixed
getPathInfo()  : mixed
getQueryParams()  : array<string|int, mixed>
Returns the request parameters given in the [[queryString]].
getUrlReferrer()  : string
Return the referal url, it's used for the "close" buttons, and the "save and close" buttons So it checks if the referrer url is the same than the current url to avoid looping.
isRestRequest()  : bool
Is this a REST API request
routeMatchesNoCsrfValidationRule()  : bool
Returns true if the route matches the given validation rule.
setQueryParams()  : mixed
Sets the request [[queryString]] parameters.
updateNavigationStack()  : mixed
Method to update the LimeSurvey Navigation Stack to prevent looping
checkLoopInNavigationStack()  : bool
Method to check if an url is part of the stack
normalizeRequest()  : mixed

Properties

$noCsrfValidationParams

public mixed $noCsrfValidationParams = array()

$noCsrfValidationRoutes

public mixed $noCsrfValidationRoutes = array()

$queryParams

private array<string, mixed>|null $queryParams

the request query parameters (name-value pairs)

Methods

getOriginalUrlReferrer()

public getOriginalUrlReferrer() : mixed

getQueryParams()

Returns the request parameters given in the [[queryString]].

public getQueryParams() : array<string|int, mixed>

This method will return the contents of $_GET if params where not explicitly set.

Tags
see
setQueryParams()
Return values
array<string|int, mixed>

the request GET parameter values.

getUrlReferrer()

Return the referal url, it's used for the "close" buttons, and the "save and close" buttons So it checks if the referrer url is the same than the current url to avoid looping.

public getUrlReferrer([ $sAlternativeUrl = null ]) : string

If it the case, a paramater can be set to tell what referrer to return. If the referrer is an external url, Yii return by default the current url.

DEPRECATED #To avoid looping between two urls (like simpleStatistics <=> Expert Statistics), #it can be necessary to check if the referrer contains a specific word (an action in general) #So if you want to forbid a return to a certain page, just provide an alternative url, and the forbidden key world

The checkLoopInNavigationStack-Method will check for looping, though the forbiddenUrl array is not required anymore

Not all "close" and "save and close" buttons should use it. Only close button for pages that can be accessed since different places. eg: edit question, that can be accessed from question list or question

TODO: implement it for all those pages List of pages where it should be implemented :

  • All pages accessible via the top nav-bar (eg: create a new survey, edit template, etc.)
  • All pages accessible via quick actions (home page, survey quick actions, question group quick actions, etc.)
  • All pages accessible via question explorer (only "add question to group" for now)
  • Edition of question and question group, which are accessible via summary or list
  • Import question, question group

TODO: remove misused of it It should not be used for pages accessible from only one place

  • Token activation etc.

In doubt, just use getUrlReferrer with a default link to home page for full page layout pages, or a link to the survey summary for sidemenu layout pages, with the controller action as forbidden world. So the close button will never loop.

TODO : Each time a new quick action or button is added to access an existing page, the "close" & "save and close" button should be updated to use getUrlReferrer()

Parameters
$sAlternativeUrl : = null

string, the url to return if referrer url is the same than current url.

Return values
string

if success, else null

isRestRequest()

Is this a REST API request

public isRestRequest() : bool
Return values
bool

routeMatchesNoCsrfValidationRule()

Returns true if the route matches the given validation rule.

public static routeMatchesNoCsrfValidationRule(string $route, string $rule) : bool
Parameters
$route : string

the route to be checked

$rule : string

the validation rule

Return values
bool

true if the route matches the given validation rule

setQueryParams()

Sets the request [[queryString]] parameters.

public setQueryParams(array<string|int, mixed> $values) : mixed
Parameters
$values : array<string|int, mixed>

the request query parameters (name-value pairs)

Tags
see
getQueryParams()

updateNavigationStack()

Method to update the LimeSurvey Navigation Stack to prevent looping

public updateNavigationStack() : mixed

checkLoopInNavigationStack()

Method to check if an url is part of the stack

protected checkLoopInNavigationStack(string $referrerURL) : bool
Parameters
$referrerURL : string

The URL that is checked against the stack

Return values
bool

Returns true, when an url is saved in the stack


        
On this page

Search results