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
a4be5bc9
Commit
a4be5bc9
authored
Apr 01, 2014
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dropped defaultView
parent
542d532b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
14 deletions
+1
-14
ViewAction.php
framework/web/ViewAction.php
+1
-14
No files found.
framework/web/ViewAction.php
View file @
a4be5bc9
...
...
@@ -15,8 +15,6 @@ use yii\base\InvalidParamException;
*
* By default, the view being displayed is specified via the `view` GET parameter.
* The name of the GET parameter can be customized via [[\yii\base\ViewAction::$viewParam]].
* If the user doesn't provide the GET parameter, the default view specified by [[\yii\base\ViewAction::$defaultView]]
* will be displayed.
*
* Users specify a view in the format of `path/to/view`, which translates to the view name
* `ViewPrefix/path/to/view` where `ViewPrefix` is given by [[\yii\base\ViewAction::$viewPrefix]].
...
...
@@ -39,14 +37,6 @@ class ViewAction extends Action
public
$viewParam
=
'view'
;
/**
* @var string the name of the default view when [[\yii\base\ViewAction::$viewParam]] GET parameter is not provided
* by user. Defaults to 'index'. This should be in the format of 'path/to/view', similar to that given in
* the GET parameter.
* @see \yii\base\ViewAction::$viewPrefix
*/
public
$defaultView
=
'index'
;
/**
* @var string the base path for the views. Defaults to 'pages'.
* The base path will be prefixed to any user-specified page view.
* For example, if a user requests for `tutorial/chap1`, the corresponding view name will
...
...
@@ -116,11 +106,8 @@ class ViewAction extends Action
protected
function
getViewPath
()
{
$viewPath
=
\Yii
::
$app
->
request
->
get
(
$this
->
viewParam
);
if
(
empty
(
$viewPath
)
||
!
is_string
(
$viewPath
))
{
$viewPath
=
$this
->
defaultView
;
}
if
(
!
preg_match
(
'/^\w[\w\/\-]*$/'
,
$viewPath
))
{
if
(
empty
(
$viewPath
)
||
!
is_string
(
$viewPath
)
||
!
preg_match
(
'/^\w[\w\/\-]*$/'
,
$viewPath
))
{
if
(
YII_DEBUG
)
{
throw
new
NotFoundHttpException
(
"The requested view
\"
$viewPath
\"
should start with a word char and contain word chars, forward slashes and dashes only."
);
}
else
{
...
...
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