Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
6f829596
Commit
6f829596
authored
Jan 27, 2014
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
made post params consistend with body and query params in request
issue #2093
parent
ffed5d01
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
8 deletions
+37
-8
CaptchaAction.php
framework/captcha/CaptchaAction.php
+1
-1
Request.php
framework/web/Request.php
+36
-7
No files found.
framework/captcha/CaptchaAction.php
View file @
6f829596
...
@@ -114,7 +114,7 @@ class CaptchaAction extends Action
...
@@ -114,7 +114,7 @@ class CaptchaAction extends Action
*/
*/
public
function
run
()
public
function
run
()
{
{
if
(
isset
(
$_GET
[
self
::
REFRESH_GET_VAR
])
)
{
if
(
Yii
::
$app
->
request
->
getQueryParam
(
self
::
REFRESH_GET_VAR
)
!==
null
)
{
// AJAX request for regenerating code
// AJAX request for regenerating code
$code
=
$this
->
getVerifyCode
(
true
);
$code
=
$this
->
getVerifyCode
(
true
);
/** @var \yii\web\Controller $controller */
/** @var \yii\web\Controller $controller */
...
...
framework/web/Request.php
View file @
6f829596
...
@@ -412,7 +412,8 @@ class Request extends \yii\base\Request
...
@@ -412,7 +412,8 @@ class Request extends \yii\base\Request
* @param string $name the GET parameter name. If not specified, whole $_GET is returned.
* @param string $name the GET parameter name. If not specified, whole $_GET is returned.
* @param mixed $defaultValue the default parameter value if the GET parameter does not exist.
* @param mixed $defaultValue the default parameter value if the GET parameter does not exist.
* @return mixed the GET parameter value
* @return mixed the GET parameter value
* @see getPost()
* @see getPostParam()
* @see getBodyParam()
*/
*/
public
function
getQueryParam
(
$name
,
$defaultValue
=
null
)
public
function
getQueryParam
(
$name
,
$defaultValue
=
null
)
{
{
...
@@ -420,6 +421,35 @@ class Request extends \yii\base\Request
...
@@ -420,6 +421,35 @@ class Request extends \yii\base\Request
return
isset
(
$params
[
$name
])
?
$params
[
$name
]
:
$defaultValue
;
return
isset
(
$params
[
$name
])
?
$params
[
$name
]
:
$defaultValue
;
}
}
private
$_postParams
;
/**
* Returns the POST request parameters.
*
* This method will return the contents of `$_POST` if params where not explicitly set.
* @return array the request POST parameter values.
* @see setPostParams()
* @see getPostParam()
*/
public
function
getPostParams
()
{
if
(
$this
->
_postParams
===
null
)
{
return
$_POST
;
}
return
$this
->
_postParams
;
}
/**
* Sets the request POST parameters.
* @param array $values the request POST parameters (name-value pairs)
* @see getPostParam()
* @see getPostParams()
*/
public
function
setPostParams
(
$values
)
{
$this
->
_postParams
=
$values
;
}
/**
/**
* Returns the named POST parameter value.
* Returns the named POST parameter value.
* If the POST parameter does not exist, the second parameter to this method will be returned.
* If the POST parameter does not exist, the second parameter to this method will be returned.
...
@@ -427,14 +457,13 @@ class Request extends \yii\base\Request
...
@@ -427,14 +457,13 @@ class Request extends \yii\base\Request
* @param mixed $defaultValue the default parameter value if the POST parameter does not exist.
* @param mixed $defaultValue the default parameter value if the POST parameter does not exist.
* @property array the POST request parameter values
* @property array the POST request parameter values
* @return mixed the POST parameter value
* @return mixed the POST parameter value
* @see get()
* @see getQueryParam()
* @see getBodyParam() for request method independent body parameters.
*/
*/
public
function
getPostParam
(
$name
=
null
,
$defaultValue
=
null
)
public
function
getPostParam
(
$name
,
$defaultValue
=
null
)
{
{
if
(
$name
===
null
)
{
$params
=
$this
->
getPostParams
();
return
$_POST
;
return
isset
(
$params
[
$name
])
?
$params
[
$name
]
:
$defaultValue
;
}
return
isset
(
$_POST
[
$name
])
?
$_POST
[
$name
]
:
$defaultValue
;
}
}
private
$_hostInfo
;
private
$_hostInfo
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment