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
fa0022e7
Commit
fa0022e7
authored
May 25, 2013
by
resurtm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New error/exception page WIP.
parent
5944fd03
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
322 additions
and
322 deletions
+322
-322
SiteController.php
apps/bootstrap/controllers/SiteController.php
+1
-0
main.css
apps/bootstrap/www/tmp/main.css
+40
-59
main.js
apps/bootstrap/www/tmp/main.js
+33
-48
ErrorHandler.php
framework/yii/base/ErrorHandler.php
+113
-6
errorHandler.php
framework/yii/views/errorHandler.php
+0
-209
callStackItem.php
framework/yii/views/errorHandler/callStackItem.php
+34
-0
main.php
framework/yii/views/errorHandler/main.php
+101
-0
No files found.
apps/bootstrap/controllers/SiteController.php
View file @
fa0022e7
...
@@ -21,6 +21,7 @@ class SiteController extends Controller
...
@@ -21,6 +21,7 @@ class SiteController extends Controller
public
function
actionIndex
()
public
function
actionIndex
()
{
{
throw
new
\yii\base\HttpException
(
500
,
'Test exception'
);
throw
new
\yii\base\HttpException
(
500
,
'Test exception'
);
$x
=
1
;
echo
$this
->
render
(
'index'
);
echo
$this
->
render
(
'index'
);
}
}
...
...
apps/bootstrap/www/tmp/main.css
View file @
fa0022e7
...
@@ -50,9 +50,6 @@ h1,h2,p,img,ul li{
...
@@ -50,9 +50,6 @@ h1,h2,p,img,ul li{
font-family
:
Arial
,
sans-serif
;
font-family
:
Arial
,
sans-serif
;
color
:
#505050
;
color
:
#505050
;
}
}
body
,
html
{
/*overflow-x: hidden;*/
}
/* header */
/* header */
.header
{
.header
{
...
@@ -85,70 +82,70 @@ body,html{
...
@@ -85,70 +82,70 @@ body,html{
text-shadow
:
0
1px
0
#cacaca
;
text-shadow
:
0
1px
0
#cacaca
;
}
}
/*
traceb
ack */
/*
call st
ack */
.
traceb
ack
{
.
call-st
ack
{
margin-top
:
30px
;
margin-top
:
30px
;
margin-bottom
:
40px
;
margin-bottom
:
40px
;
}
}
.
traceb
ack
ul
li
{
.
call-st
ack
ul
li
{
margin
:
1px
0
;
margin
:
1px
0
;
}
}
.
traceback
ul
li
.li
-wrap
{
.
call-stack
ul
li
.element
-wrap
{
cursor
:
pointer
;
cursor
:
pointer
;
padding
:
15px
0
;
padding
:
15px
0
;
}
}
.
traceback
ul
li
.application
.li
-wrap
{
.
call-stack
ul
li
.application
.element
-wrap
{
background-color
:
#fafafa
;
background-color
:
#fafafa
;
}
}
.
traceback
ul
li
.li
-wrap
:hover
{
.
call-stack
ul
li
.element
-wrap
:hover
{
background-color
:
#edf9ff
;
background-color
:
#edf9ff
;
}
}
.
traceback
ul
li
.li
{
.
call-stack
ul
li
.element
{
min-width
:
860px
;
/* 960px - 50px * 2 */
min-width
:
860px
;
/* 960px - 50px * 2 */
max-width
:
1100px
;
/* 1200px - 50px * 2 */
max-width
:
1100px
;
/* 1200px - 50px * 2 */
margin
:
0
auto
;
margin
:
0
auto
;
padding
:
0
50px
;
padding
:
0
50px
;
position
:
relative
;
position
:
relative
;
}
}
.
traceb
ack
ul
li
a
{
.
call-st
ack
ul
li
a
{
color
:
#505050
;
color
:
#505050
;
}
}
.
traceb
ack
ul
li
a
:hover
{
.
call-st
ack
ul
li
a
:hover
{
color
:
#000000
;
color
:
#000000
;
text-shadow
:
0
1px
0
#cacaca
;
text-shadow
:
0
1px
0
#cacaca
;
}
}
.
traceb
ack
ul
li
.number
{
.
call-st
ack
ul
li
.number
{
width
:
45px
;
width
:
45px
;
display
:
inline-block
;
display
:
inline-block
;
}
}
.
traceb
ack
ul
li
.text
{
.
call-st
ack
ul
li
.text
{
color
:
#bbbbbb
;
color
:
#bbbbbb
;
}
}
.
traceb
ack
ul
li
.application
.text
{
.
call-st
ack
ul
li
.application
.text
{
color
:
#505050
;
color
:
#505050
;
}
}
.
traceb
ack
ul
li
.at
{
.
call-st
ack
ul
li
.at
{
position
:
absolute
;
position
:
absolute
;
right
:
110px
;
/* 50px + 60px */
right
:
110px
;
/* 50px + 60px */
color
:
#bbbbbb
;
color
:
#bbbbbb
;
}
}
.
traceb
ack
ul
li
.application
.at
{
.
call-st
ack
ul
li
.application
.at
{
color
:
#505050
;
color
:
#505050
;
}
}
.
traceb
ack
ul
li
.line
{
.
call-st
ack
ul
li
.line
{
position
:
absolute
;
position
:
absolute
;
right
:
50px
;
right
:
50px
;
width
:
60px
;
width
:
60px
;
text-align
:
right
;
text-align
:
right
;
}
}
.
traceb
ack
ul
li
.code-wrap
{
.
call-st
ack
ul
li
.code-wrap
{
display
:
none
;
display
:
none
;
position
:
relative
;
position
:
relative
;
}
}
.
traceb
ack
ul
li
.application
.code-wrap
{
.
call-st
ack
ul
li
.application
.code-wrap
{
display
:
block
;
display
:
block
;
}
}
.
traceback
ul
li
.erro
r-line
{
.
call-stack
ul
li
.error-line
,
.call-stack
ul
li
.hove
r-line
{
background-color
:
#ffebeb
;
background-color
:
#ffebeb
;
position
:
absolute
;
position
:
absolute
;
width
:
100%
;
width
:
100%
;
...
@@ -156,29 +153,36 @@ body,html{
...
@@ -156,29 +153,36 @@ body,html{
z-index
:
100
;
z-index
:
100
;
margin-top
:
15px
;
margin-top
:
15px
;
}
}
.traceback
ul
li
.code
{
.call-stack
ul
li
.hover-line
{
background
:
none
;
}
.call-stack
ul
li
.hover-line.hover
,
.call-stack
ul
li
.hover-line
:hover
{
background
:
#edf9ff
!important
;
}
.call-stack
ul
li
.code
{
min-width
:
860px
;
/* 960px - 50px * 2 */
min-width
:
860px
;
/* 960px - 50px * 2 */
max-width
:
1100px
;
/* 1200px - 50px * 2 */
max-width
:
1100px
;
/* 1200px - 50px * 2 */
margin
:
0
auto
;
margin
:
0
auto
;
padding
:
15px
50px
;
padding
:
15px
50px
;
position
:
relative
;
position
:
relative
;
}
}
.
traceb
ack
ul
li
.code
.lines
{
.
call-st
ack
ul
li
.code
.lines
{
position
:
absolute
;
position
:
absolute
;
z-index
:
200
;
z-index
:
200
;
left
:
50px
;
left
:
50px
;
line-height
:
18px
;
line-height
:
18px
;
font-size
:
14px
;
font-size
:
14px
;
font-family
:
Consolas
,
Courier
New
,
monospace
d
;
font-family
:
Consolas
,
Courier
New
,
monospace
;
color
:
#bbbbbb
;
color
:
#bbbbbb
;
}
}
.
traceb
ack
ul
li
.code
pre
{
.
call-st
ack
ul
li
.code
pre
{
position
:
relative
;
position
:
relative
;
z-index
:
200
;
z-index
:
200
;
left
:
50px
;
left
:
50px
;
line-height
:
18px
;
line-height
:
18px
;
font-size
:
14px
;
font-size
:
14px
;
font-family
:
Consolas
,
Courier
New
,
monospaced
;
font-family
:
Consolas
,
Courier
New
,
monospace
;
display
:
inline
;
}
}
/* request */
/* request */
...
@@ -190,15 +194,15 @@ body,html{
...
@@ -190,15 +194,15 @@ body,html{
margin-bottom
:
1px
;
margin-bottom
:
1px
;
}
}
.request
pre
{
.request
pre
{
font-family
:
Consolas
,
Courier
New
,
monospace
d
;
font-family
:
Consolas
,
Courier
New
,
monospace
;
}
}
/* footer */
/* footer */
.footer
{
.footer
{
position
:
relative
;
position
:
relative
;
height
:
222px
;
height
:
222px
;
min-width
:
860px
;
/*
padding compensation:
960px - 50px * 2 */
min-width
:
860px
;
/* 960px - 50px * 2 */
max-width
:
1100px
;
/*
padding compensation:
1200px - 50px * 2 */
max-width
:
1100px
;
/* 1200px - 50px * 2 */
padding
:
0
50px
;
padding
:
0
50px
;
margin
:
1px
auto
0
auto
;
margin
:
1px
auto
0
auto
;
}
}
...
@@ -223,30 +227,7 @@ body,html{
...
@@ -223,30 +227,7 @@ body,html{
right
:
-50px
;
right
:
-50px
;
}
}
/* code */
/* highlight.js */
#code-wrap
{
overflow
:
hidden
;
position
:
relative
;
}
#code-highlighter
{
background-color
:
#ffffff
;
position
:
fixed
;
width
:
100%
;
z-index
:
100
;
}
#code-inner-wrap
{
min-width
:
860px
;
/* padding compensation: 960px - 50px * 2 */
max-width
:
1100px
;
/* padding compensation: 1200px - 50px * 2 */
margin
:
0
auto
;
}
pre
{
display
:
inline
;
color
:
#505050
;
font-size
:
14px
;
line-height
:
18px
;
z-index
:
200
;
position
:
relative
;
}
pre
.subst
,
pre
.title
{
pre
.subst
,
pre
.title
{
font-weight
:
normal
;
font-weight
:
normal
;
color
:
#505050
;
color
:
#505050
;
...
@@ -255,16 +236,16 @@ pre .comment,pre .template_comment,pre .javadoc,pre .diff .header{
...
@@ -255,16 +236,16 @@ pre .comment,pre .template_comment,pre .javadoc,pre .diff .header{
color
:
#808080
;
color
:
#808080
;
font-style
:
italic
;
font-style
:
italic
;
}
}
pre
.annotation
,
pre
.decorator
,
pre
.preprocessor
,
pre
.doctype
,
pre
.pi
,
pre
.chunk
,
pre
.shebang
,
pre
.annotation
,
pre
.decorator
,
pre
.preprocessor
,
pre
.doctype
,
pre
.pi
,
pre
.chunk
,
pre
.shebang
,
pre
.apache
.cbracket
,
pre
.
apache
.cbracket
,
pre
.
prompt
,
pre
.http
.title
{
pre
.prompt
,
pre
.http
.title
{
color
:
#808000
;
color
:
#808000
;
}
}
pre
.tag
,
pre
.pi
{
pre
.tag
,
pre
.pi
{
background
:
#efefef
;
background
:
#efefef
;
}
}
pre
.tag
.title
,
pre
.id
,
pre
.attr_selector
,
pre
.pseudo
,
pre
.literal
,
pre
.keyword
,
pre
.hexcolor
,
pre
.tag
.title
,
pre
.id
,
pre
.attr_selector
,
pre
.pseudo
,
pre
.literal
,
pre
.keyword
,
pre
.hexcolor
,
pre
.css
.function
,
pre
.
css
.function
,
pre
.ini
.title
,
pre
.css
.class
,
pre
.list
.title
,
pre
.clojure
.title
,
pre
.nginx
.title
,
pre
.
ini
.title
,
pre
.css
.class
,
pre
.list
.title
,
pre
.clojure
.title
,
pre
.nginx
.title
,
pre
.tex
.command
,
pre
.
tex
.command
,
pre
.
request
,
pre
.status
{
pre
.request
,
pre
.status
{
color
:
#000080
;
color
:
#000080
;
}
}
pre
.attribute
,
pre
.rules
.keyword
,
pre
.number
,
pre
.date
,
pre
.regexp
,
pre
.tex
.special
{
pre
.attribute
,
pre
.rules
.keyword
,
pre
.number
,
pre
.date
,
pre
.regexp
,
pre
.tex
.special
{
...
@@ -273,7 +254,7 @@ pre .attribute,pre .rules .keyword,pre .number,pre .date,pre .regexp,pre .tex .s
...
@@ -273,7 +254,7 @@ pre .attribute,pre .rules .keyword,pre .number,pre .date,pre .regexp,pre .tex .s
pre
.number
,
pre
.regexp
{
pre
.number
,
pre
.regexp
{
font-weight
:
normal
;
font-weight
:
normal
;
}
}
pre
.string
,
pre
.value
,
pre
.filter
.argument
,
pre
.css
.function
.params
,
pre
.apache
.tag
{
pre
.string
,
pre
.value
,
pre
.filter
.argument
,
pre
.css
.function
.params
,
pre
.apache
.tag
{
color
:
#00aa00
;
color
:
#00aa00
;
}
}
pre
.symbol
,
pre
.ruby
.symbol
.string
,
pre
.char
,
pre
.tex
.formula
{
pre
.symbol
,
pre
.ruby
.symbol
.string
,
pre
.char
,
pre
.tex
.formula
{
...
...
apps/bootstrap/www/tmp/main.js
View file @
fa0022e7
/*;
var lines = null;
var line = document.getElementById('code-highlighter')
var updateLines = function() {
lines = document.getElementById('code').getClientRects();
};
updateLines();
window.onresize = updateLines;
window.onscroll = updateLines;
document.onmousemove = function(e) {
var event = e || window.event;
var x = event.clientX, y = event.clientY;
for (var i = 0, max = lines.length; i < max; i++) {
if (y > lines[i].top && y < lines[i].bottom) {
line.style.height = parseInt(lines[i].bottom - lines[i].top + 1) + 'px';
line.style.top = parseInt(lines[i].top) + 'px';
break;
}
}
}
*/
window
.
onload
=
function
()
{
window
.
onload
=
function
()
{
var
i
,
j
,
max
,
max2
,
var
i
,
imax
,
codeBlocks
=
Sizzle
(
'pre'
),
codeBlocks
=
Sizzle
(
'pre'
),
traceBackItems
=
Sizzle
(
'.trace-b
ack-item'
);
callStackItems
=
Sizzle
(
'.call-st
ack-item'
);
// highlight code
// highlight code
blocks
for
(
i
=
0
,
max
=
codeBlocks
.
length
;
i
<
max
;
i
++
)
{
for
(
i
=
0
,
imax
=
codeBlocks
.
length
;
i
<
imax
;
++
i
)
{
hljs
.
highlightBlock
(
codeBlocks
[
i
],
' '
);
hljs
.
highlightBlock
(
codeBlocks
[
i
],
' '
);
}
}
// error lines
//
// var updateErrorLines = function() {
document
.
onmousemove
=
function
(
e
)
{
// for (i = 0, max = codeBlocks.length; i < max; i++) {
var
lines
,
i
,
imax
,
j
,
jmax
,
k
,
kmax
,
// var lines = codeBlocks[i].getClientRects(),
event
=
e
||
window
.
event
,
// errorLine = codeBlocks[i].getAttribute('data-error-line'),
y
=
event
.
clientY
,
// top = 0;
lineFound
=
false
;
// if (errorLine > lines.length - 1) {
for
(
i
=
0
,
imax
=
codeBlocks
.
length
;
i
<
imax
;
++
i
)
{
// errorLine = lines.length - 1;
lines
=
codeBlocks
[
i
].
getClientRects
();
// }
for
(
j
=
0
,
jmax
=
lines
.
length
;
j
<
jmax
;
++
j
)
{
// for (j = 0; j < errorLine; j++) {
if
(
y
>
lines
[
j
].
top
&&
y
<
lines
[
j
].
bottom
)
{
// top += lines[j].height;
lineFound
=
true
;
// }
break
;
// Sizzle('.error-line', codeBlocks[i].parentNode.parentNode)[0].style.marginTop = top + 'px';
}
// }
}
// };
if
(
lineFound
)
{
// updateErrorLines();
break
;
}
}
var
hoverLines
=
Sizzle
(
'.hover-line'
);
for
(
k
=
0
,
kmax
=
hoverLines
.
length
;
k
<
kmax
;
++
k
)
{
hoverLines
[
k
].
className
=
'hover-line'
;
}
if
(
lineFound
)
{
Sizzle
(
'.call-stack-item:eq('
+
i
+
') .hover-line:eq('
+
j
+
')'
)[
0
].
className
=
'hover-line hover'
;
}
}
// toggle code block visibility
of each trace back item
// toggle code block visibility
for
(
i
=
0
,
max
=
traceBackItems
.
length
;
i
<
max
;
i
++
)
{
for
(
i
=
0
,
imax
=
callStackItems
.
length
;
i
<
i
max
;
i
++
)
{
Sizzle
(
'.
li-wrap'
,
traceB
ackItems
[
i
])[
0
].
addEventListener
(
'click'
,
function
()
{
Sizzle
(
'.
element-wrap'
,
callSt
ackItems
[
i
])[
0
].
addEventListener
(
'click'
,
function
()
{
var
code
=
Sizzle
(
'.code-wrap'
,
this
.
parentNode
)[
0
];
var
code
=
Sizzle
(
'.code-wrap'
,
this
.
parentNode
)[
0
];
code
.
style
.
display
=
window
.
getComputedStyle
(
code
).
display
==
'block'
?
'none'
:
'block'
;
code
.
style
.
display
=
window
.
getComputedStyle
(
code
).
display
==
'block'
?
'none'
:
'block'
;
});
});
...
...
framework/yii/base/ErrorHandler.php
View file @
fa0022e7
...
@@ -16,6 +16,7 @@ use Yii;
...
@@ -16,6 +16,7 @@ use Yii;
* nature of the errors and the mode the application runs at.
* nature of the errors and the mode the application runs at.
*
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @author Qiang Xue <qiang.xue@gmail.com>
* @author Timur Ruziev <resurtm@gmail.com>
* @since 2.0
* @since 2.0
*/
*/
class
ErrorHandler
extends
Component
class
ErrorHandler
extends
Component
...
@@ -42,7 +43,11 @@ class ErrorHandler extends Component
...
@@ -42,7 +43,11 @@ class ErrorHandler extends Component
/**
/**
* @var string the path of the view file for rendering exceptions and errors.
* @var string the path of the view file for rendering exceptions and errors.
*/
*/
public
$view
=
'@yii/views/errorHandler.php'
;
public
$mainView
=
'@yii/views/errorHandler/main.php'
;
/**
* @var string the path of the view file for rendering exceptions and errors call stack element.
*/
public
$callStackItemView
=
'@yii/views/errorHandler/callStackItem.php'
;
/**
/**
* @var \Exception the exception that is being handled currently.
* @var \Exception the exception that is being handled currently.
*/
*/
...
@@ -56,11 +61,9 @@ class ErrorHandler extends Component
...
@@ -56,11 +61,9 @@ class ErrorHandler extends Component
public
function
handle
(
$exception
)
public
function
handle
(
$exception
)
{
{
$this
->
exception
=
$exception
;
$this
->
exception
=
$exception
;
if
(
$this
->
discardExistingOutput
)
{
if
(
$this
->
discardExistingOutput
)
{
$this
->
clearOutput
();
$this
->
clearOutput
();
}
}
$this
->
renderException
(
$exception
);
$this
->
renderException
(
$exception
);
}
}
...
@@ -90,9 +93,8 @@ class ErrorHandler extends Component
...
@@ -90,9 +93,8 @@ class ErrorHandler extends Component
if
(
YII_DEBUG
)
{
if
(
YII_DEBUG
)
{
ini_set
(
'display_errors'
,
1
);
ini_set
(
'display_errors'
,
1
);
}
}
$view
=
new
View
();
$view
=
new
View
();
echo
$view
->
renderFile
(
$this
->
v
iew
,
array
(
'e'
=>
$exception
),
$this
);
echo
$view
->
renderFile
(
$this
->
mainV
iew
,
array
(
'e'
=>
$exception
),
$this
);
}
}
}
}
}
}
...
@@ -100,7 +102,7 @@ class ErrorHandler extends Component
...
@@ -100,7 +102,7 @@ class ErrorHandler extends Component
/**
/**
* Converts special characters to HTML entities.
* Converts special characters to HTML entities.
* @param string $text to encode.
* @param string $text to encode.
* @return string encoded text.
* @return string encoded
original
text.
*/
*/
public
function
htmlEncode
(
$text
)
public
function
htmlEncode
(
$text
)
{
{
...
@@ -117,4 +119,109 @@ class ErrorHandler extends Component
...
@@ -117,4 +119,109 @@ class ErrorHandler extends Component
@
ob_end_clean
();
@
ob_end_clean
();
}
}
}
}
/**
* Adds informational links to the given PHP type/class.
* @param string $code type/class name to be linkified.
* @return string linkified with HTML type/class name.
*/
public
function
addTypeLinks
(
$code
)
{
$html
=
''
;
if
(
strpos
(
$code
,
'\\'
)
!==
false
)
{
// namespaced class
foreach
(
explode
(
'\\'
,
$code
)
as
$part
)
{
$html
.=
'<a href="http://yiiframework.com/doc/api/2.0/'
.
$this
->
htmlEncode
(
$part
)
.
'" target="_blank">'
.
$this
->
htmlEncode
(
$part
)
.
'</a>\\'
;
}
$html
=
rtrim
(
$html
,
'\\'
);
}
return
$html
;
}
/**
* Creates HTML containing link to the page with the information on given HTTP status code.
* @param integer $statusCode to be used to generate information link.
* @return string generated HTML with HTTP status code information.
*/
public
function
createHttpStatusLink
(
$statusCode
)
{
return
'<a href="http://en.wikipedia.org/wiki/List_of_HTTP_status_codes#'
.
(
int
)
$statusCode
.
'" target="_blank">'
.
(
int
)
$statusCode
.
'</a>'
;
}
/**
* Renders a single call stack element.
* @param string $file name where call has happened.
* @param integer $line number on which call has happened.
* @param integer $index number of the call stack element.
* @return string HTML content of the rendered call stack element.
*/
public
function
renderCallStackItem
(
$file
,
$line
,
$index
)
{
$line
--
;
// adjust line number from one-based to zero-based
$lines
=
@
file
(
$file
);
if
(
$line
<
0
||
$lines
===
false
||
(
$lineCount
=
count
(
$lines
))
<
$line
+
1
)
{
return
''
;
}
$half
=
(
int
)((
$index
==
0
?
$this
->
maxSourceLines
:
$this
->
maxTraceSourceLines
)
/
2
);
$begin
=
$line
-
$half
>
0
?
$line
-
$half
:
0
;
$end
=
$line
+
$half
<
$lineCount
?
$line
+
$half
:
$lineCount
-
1
;
$view
=
new
View
();
return
$view
->
renderFile
(
$this
->
callStackItemView
,
array
(
'file'
=>
$file
,
'line'
=>
$line
,
'index'
=>
$index
,
'lines'
=>
$lines
,
'begin'
=>
$begin
,
'end'
=>
$end
,
),
$this
);
}
/**
* Determines whether given name of the file belongs to the framework.
* @param string $file name to be checked.
* @return boolean whether given name of the file belongs to the framework.
*/
public
function
isCoreFile
(
$file
)
{
return
$file
===
'unknown'
||
strpos
(
realpath
(
$file
),
YII_PATH
.
DIRECTORY_SEPARATOR
)
===
0
;
}
/**
* Creates string containing HTML link which refers to the home page of determined web-server software
* and its full name.
* @return string server software information hyperlink.
*/
public
function
createServerInformationLink
()
{
static
$serverUrls
=
array
(
'http://httpd.apache.org/'
=>
array
(
'apache'
),
'http://nginx.org/'
=>
array
(
'nginx'
),
'http://lighttpd.net/'
=>
array
(
'lighttpd'
),
'http://gwan.com/'
=>
array
(
'g-wan'
,
'gwan'
),
'http://iis.net/'
=>
array
(
'iis'
,
'services'
),
'http://php.net/manual/en/features.commandline.webserver.php'
=>
array
(
'development'
),
);
if
(
isset
(
$_SERVER
[
'SERVER_SOFTWARE'
]))
{
foreach
(
$serverUrls
as
$url
=>
$keywords
)
{
foreach
(
$keywords
as
$keyword
)
{
if
(
stripos
(
$_SERVER
[
'SERVER_SOFTWARE'
],
$keyword
)
!==
false
)
{
return
'<a href="'
.
$url
.
'" target="_blank">'
.
$this
->
htmlEncode
(
$_SERVER
[
'SERVER_SOFTWARE'
])
.
'</a>'
;
}
}
}
}
return
''
;
}
/**
* Creates string containing HTML link which refers to the page with the current version
* of the framework and version number text.
* @return string framework version information hyperlink.
*/
public
function
createFrameworkVersionLink
()
{
return
'<a href="http://github.com/yiisoft/yii2/" target="_blank">'
.
$this
->
htmlEncode
(
Yii
::
getVersion
())
.
'</a>'
;
}
}
}
framework/yii/views/errorHandler.php
deleted
100644 → 0
View file @
5944fd03
<?php
/**
* @var \yii\base\View $this
* @var \Exception $e
* @var \yii\base\ErrorHandler $c
*/
$c
=
$this
->
context
;
?>
<!doctype html>
<html
lang=
"en-us"
>
<head>
<meta
charset=
"utf-8"
/>
<title></title>
<link
rel=
"stylesheet"
href=
"/tmp/main.css"
/>
<script
type=
"text/javascript"
src=
"/tmp/highlight.js"
></script>
<script
type=
"text/javascript"
src=
"/tmp/sizzle.min.js"
></script>
<script
type=
"text/javascript"
src=
"/tmp/main.js"
></script>
</head>
<?php
ob_start
();
ob_implicit_flush
(
false
);
?>
<div
class=
"code-wrap"
>
<div
class=
"error-line"
style=
"top:
<?php
echo
18
*
(
1
+
1
);
?>
px;"
></div>
<div
class=
"hover-line"
></div>
<div
class=
"code"
>
<span
class=
"lines"
>
10
<br/>
11
<br/>
12
<br/>
13
<br/>
14
<br/>
15
<br/>
16
<br/>
17
<br/>
18
<br/>
19
<br/>
20
<br/>
21
<br/>
22
<br/>
23
<br/>
24
<br/>
25
<br/>
26
<br/>
27
<br/>
28
<br/>
29
<br/>
30
<br/>
31
<br/>
32
<br/>
33
<br/>
34
</span>
<pre>
{
return array(
'captcha' => array(
'class' => 'yii\web\CaptchaAction',
),
);
}
public function actionIndex()
{
// throw new \yii\base\HttpException(500);
$x = null;
$x->y = 1;
echo $this->render('index');
}
public function actionLogin()
{
$model = new LoginForm();
if ($this->populate($_POST, $model)
&&
$model->login()) {
Yii::$app->response->redirect(array('site/index'));
} else {
echo $this->render('login', array(
'model' => $model,
</pre>
</div>
</div>
<?php
$codeBlock
=
ob_get_clean
();
?>
<body>
<div
class=
"header"
>
<img
src=
"/tmp/attention.png"
alt=
"Attention"
/>
<h1><span>
Exception
</span>
–
<a
href=
"#"
>
yii
</a>
\
<a
href=
"#"
>
base
</a>
\
<a
href=
"#"
>
HttpException
</a>
–
404
</h1>
<h2>
Requested user cannot be found!
</h2>
</div>
<div
class=
"traceback"
>
<ul>
<li
class=
"application trace-back-item"
>
<div
class=
"li-wrap"
>
<div
class=
"li"
>
<span
class=
"number"
>
1.
</span>
<span
class=
"text"
>
in C:\_work\jetbrains\yii2\apps\bootstrap\protected\controllers\SiteController.php
</span>
<span
class=
"at"
>
at line
</span>
<span
class=
"line"
>
22
</span>
</div>
</div>
<?php
echo
$codeBlock
;
?>
</li>
<li
class=
"trace-back-item"
>
<div
class=
"li-wrap"
>
<div
class=
"li"
>
<span
class=
"number"
>
2.
</span>
<span
class=
"text"
>
at C:\_work\jetbrains\yii2\yii\base\InlineAction.php
–
</span>
<span
class=
"call"
><a
href=
"#"
>
call_user_func_array
</a>
()
</span>
<span
class=
"at"
>
at line
</span>
<span
class=
"line"
>
47
</span>
</div>
</div>
<?php
echo
$codeBlock
;
?>
</li>
<li
class=
"trace-back-item"
>
<div
class=
"li-wrap"
>
<div
class=
"li"
>
<span
class=
"number"
>
3.
</span>
<span
class=
"text"
>
at C:\_work\jetbrains\yii2\yii\base\Controller.php
–
</span>
<span
class=
"call"
><a
href=
"#"
>
yii
</a>
\
<a
href=
"#"
>
base
</a>
\
<a
href=
"#"
>
InlineAction
</a>
→
<a
href=
"#"
>
runWithParams
</a>
()
</span>
<span
class=
"at"
>
at line
</span>
<span
class=
"line"
>
117
</span>
</div>
</div>
<?php
echo
$codeBlock
;
?>
</li>
<li
class=
"trace-back-item"
>
<div
class=
"li-wrap"
>
<div
class=
"li"
>
<span
class=
"number"
>
4.
</span>
<span
class=
"text"
>
at C:\_work\jetbrains\yii2\yii\web\Application.php
–
</span>
<span
class=
"call"
><a
href=
"#"
>
yii
</a>
\
<a
href=
"#"
>
base
</a>
\
<a
href=
"#"
>
Module
</a>
→
<a
href=
"#"
>
runAction
</a>
()
</span>
<span
class=
"at"
>
at line
</span>
<span
class=
"line"
>
35
</span>
</div>
</div>
<?php
echo
$codeBlock
;
?>
</li>
<li
class=
"trace-back-item"
>
<div
class=
"li-wrap"
>
<div
class=
"li"
>
<span
class=
"number"
>
5.
</span>
<span
class=
"text"
>
at C:\_work\jetbrains\yii2\yii\web\Application.php
–
</span>
<span
class=
"call"
><a
href=
"#"
>
yii
</a>
\
<a
href=
"#"
>
base
</a>
\
<a
href=
"#"
>
Module
</a>
→
<a
href=
"#"
>
runAction
</a>
()
</span>
<span
class=
"at"
>
at line
</span>
<span
class=
"line"
>
35
</span>
</div>
</div>
<?php
echo
$codeBlock
;
?>
</li>
<li
class=
"trace-back-item"
>
<div
class=
"li-wrap"
>
<div
class=
"li"
>
<span
class=
"number"
>
6.
</span>
<span
class=
"text"
>
at C:\_work\jetbrains\yii2\yii\base\Application.php
–
</span>
<span
class=
"call"
><a
href=
"#"
>
yii
</a>
\
<a
href=
"#"
>
web
</a>
\
<a
href=
"#"
>
Application
</a>
→
<a
href=
"#"
>
processRequest
</a>
()
</span>
<span
class=
"at"
>
at line
</span>
<span
class=
"line"
>
146
</span>
</div>
</div>
<?php
echo
$codeBlock
;
?>
</li>
<li
class=
"application trace-back-item"
>
<div
class=
"li-wrap"
>
<div
class=
"li"
>
<span
class=
"number"
>
7.
</span>
<span
class=
"text"
>
at C:\_work\jetbrains\yii2\apps\bootstrap\index.php
–
</span>
<span
class=
"call"
><a
href=
"#"
>
yii
</a>
\
<a
href=
"#"
>
base
</a>
\
<a
href=
"#"
>
Application
</a>
→
<a
href=
"#"
>
run
</a>
()
</span>
<span
class=
"at"
>
at line
</span>
<span
class=
"line"
>
14
</span>
</div>
</div>
<?php
echo
$codeBlock
;
?>
</li>
</ul>
</div>
<?php
/*
<div class="request">
<div id="code-wrap"></div>
<div id="code-highlighter"></div>
<div id="code-inner-wrap">
<pre id="code">$_GET = [
'show-post' => 100,
'refresh-page' => 'yes',
'ascending-sort' => 1,
];
$_POST = [
'blog-post-form' => [
'title' => 'hello',
'author_id' => '12',
],
];
$_SERVER = [
'DOCUMENT_ROOT' => '/home/resurtm/work/data',
'REMOTE_ADDR' => '::1',
'REMOTE_PORT' => '52694',
'SERVER_SOFTWARE' => 'PHP 5.4.3 Development Server',
'SERVER_PROTOCOL' => 'HTTP/1.1',
'SERVER_NAME' => 'localhost',
'SERVER_PORT' => '8000',
'REQUEST_URI' => '/index.php?post-form[title]=hello&post-form[author_id]=12',
'REQUEST_METHOD' => 'GET',
'SCRIPT_NAME' => '/index.php',
'SCRIPT_FILENAME' => '/home/resurtm/work/data/index.php',
'PHP_SELF' => '/index.php',
'QUERY_STRING' => 'post-form[title]=hello&post-form[author_id]=12',
'HTTP_HOST' => 'localhost:8000',
'HTTP_USER_AGENT' => 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:20.0) Gecko/20100101 Firefox/20.0',
'HTTP_ACCEPT_LANGUAGE' => 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
'HTTP_ACCEPT_ENCODING' => 'gzip, deflate',
'HTTP_CONNECTION' => 'keep-alive',
'REQUEST_TIME_FLOAT' => 1369146454.0856,
'REQUEST_TIME' => 1369146454,
];</pre>
</div>
</div>
</div>*/
?>
<div
class=
"footer"
>
<img
src=
"/tmp/logo.png"
alt=
"Yii Framework"
/>
<p
class=
"timestamp"
>
2013-05-16, 19:14:12
</p>
<p><a
href=
"http://php.net/manual/en/features.commandline.webserver.php"
>
PHP 5.4.3 Development Server
</a></p>
<p><a
href=
"http://yiiframework.com/"
>
Yii Framework
</a>
/
<a
href=
"#"
>
2.0-dev
</a></p>
</div>
</body>
</html>
framework/yii/views/errorHandler/callStackItem.php
0 → 100644
View file @
fa0022e7
<?php
/**
* @var \yii\base\View $this
* @var \yii\base\ErrorHandler $c
* @var string $file
* @var integer $line
* @var integer $index
* @var string[] $lines
* @var integer $begin
* @var integer $end
*/
$c
=
$this
->
context
;
?>
<li
class=
"
<?php
if
(
!
$c
->
isCoreFile
(
$file
))
echo
'application'
;
?>
call-stack-item"
>
<div
class=
"element-wrap"
>
<div
class=
"element"
>
<span
class=
"number"
>
<?php
echo
(
int
)
$index
;
?>
.
</span>
<span
class=
"text"
>
in
<?php
echo
$c
->
htmlEncode
(
$file
);
?>
</span>
<span
class=
"at"
>
at line
</span>
<span
class=
"line"
>
<?php
echo
(
int
)
$line
;
?>
</span>
</div>
</div>
<div
class=
"code-wrap"
>
<div
class=
"error-line"
style=
"top:
<?php
echo
18
*
(
int
)(
$line
-
$begin
);
?>
px;"
></div>
<?php
for
(
$i
=
$begin
;
$i
<=
$end
;
++
$i
)
:
?>
<div
class=
"hover-line"
style=
"top:
<?php
echo
18
*
(
int
)(
$i
-
$begin
);
?>
px;"
></div>
<?php
endfor
;
?>
<div
class=
"code"
>
<span
class=
"lines"
>
<?php
for
(
$i
=
$begin
;
$i
<=
$end
;
++
$i
)
echo
(
int
)
$i
.
'<br/>'
;
?>
</span>
<pre>
<?php
for
(
$i
=
$begin
;
$i
<=
$end
;
++
$i
)
echo
$c
->
htmlEncode
(
$lines
[
$i
]);
?>
</pre>
</div>
</div>
</li>
framework/yii/views/errorHandler/main.php
0 → 100644
View file @
fa0022e7
<?php
/**
* @var \yii\base\View $this
* @var \Exception $e
* @var \yii\base\ErrorHandler $c
*/
$c
=
$this
->
context
;
?>
<!doctype html>
<html
lang=
"en-us"
>
<head>
<meta
charset=
"utf-8"
/>
<?php
if
(
$e
instanceof
\yii\base\Exception
)
:
?>
<title>
<?php
echo
$c
->
htmlEncode
(
$e
->
getName
()
.
' – '
.
get_class
(
$e
));
?>
</title>
<?php
else
:
?>
<title>
<?php
echo
$c
->
htmlEncode
(
get_class
(
$e
));
?>
</title>
<?php
endif
;
?>
<link
rel=
"stylesheet"
href=
"/tmp/main.css"
/>
<script
type=
"text/javascript"
src=
"/tmp/highlight.js"
></script>
<script
type=
"text/javascript"
src=
"/tmp/sizzle.min.js"
></script>
<script
type=
"text/javascript"
src=
"/tmp/main.js"
></script>
</head>
<body>
<div
class=
"header"
>
<img
src=
"/tmp/attention.png"
alt=
"Attention"
/>
<h1>
<span>
Exception
</span>
–
<?php
echo
$c
->
addTypeLinks
(
get_class
(
$e
));
?>
<?php
if
(
$e
instanceof
\yii\base\HttpException
)
:
?>
–
<?php
echo
$c
->
createHttpStatusLink
(
$e
->
statusCode
);
?>
<?php
endif
;
?>
</h1>
<h2>
<?php
echo
$c
->
htmlEncode
(
$e
->
getName
());
?>
</h2>
</div>
<div
class=
"call-stack"
>
<ul>
<?php
echo
$c
->
renderCallStackItem
(
$e
->
getFile
(),
$e
->
getLine
(),
1
);
?>
<?php
for
(
$i
=
1
,
$trace
=
$e
->
getTrace
(),
$length
=
count
(
$trace
);
$i
<
$length
;
++
$i
)
:
?>
<?php
echo
$c
->
renderCallStackItem
(
$trace
[
$i
][
'file'
],
$trace
[
$i
][
'line'
],
$i
+
1
);
?>
<?php
endfor
;
?>
</ul>
</div>
<?php
/*
<div class="request">
<div id="code-wrap"></div>
<div id="code-highlighter"></div>
<div id="code-inner-wrap">
<pre id="code">$_GET = [
'show-post' => 100,
'refresh-page' => 'yes',
'ascending-sort' => 1,
];
$_POST = [
'blog-post-form' => [
'title' => 'hello',
'author_id' => '12',
],
];
$_SERVER = [
'DOCUMENT_ROOT' => '/home/resurtm/work/data',
'REMOTE_ADDR' => '::1',
'REMOTE_PORT' => '52694',
'SERVER_SOFTWARE' => 'PHP 5.4.3 Development Server',
'SERVER_PROTOCOL' => 'HTTP/1.1',
'SERVER_NAME' => 'localhost',
'SERVER_PORT' => '8000',
'REQUEST_URI' => '/index.php?post-form[title]=hello&post-form[author_id]=12',
'REQUEST_METHOD' => 'GET',
'SCRIPT_NAME' => '/index.php',
'SCRIPT_FILENAME' => '/home/resurtm/work/data/index.php',
'PHP_SELF' => '/index.php',
'QUERY_STRING' => 'post-form[title]=hello&post-form[author_id]=12',
'HTTP_HOST' => 'localhost:8000',
'HTTP_USER_AGENT' => 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:20.0) Gecko/20100101 Firefox/20.0',
'HTTP_ACCEPT_LANGUAGE' => 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
'HTTP_ACCEPT_ENCODING' => 'gzip, deflate',
'HTTP_CONNECTION' => 'keep-alive',
'REQUEST_TIME_FLOAT' => 1369146454.0856,
'REQUEST_TIME' => 1369146454,
];</pre>
</div>
</div>
</div>*/
?>
<div
class=
"footer"
>
<img
src=
"/tmp/logo.png"
alt=
"Yii Framework"
/>
<p
class=
"timestamp"
>
<?php
echo
date
(
'Y-m-d, H:i:s'
);
?>
</p>
<p>
<?php
echo
$c
->
createServerInformationLink
();
?>
</p>
<p><a
href=
"http://yiiframework.com/"
>
Yii Framework
</a>
/
<?php
echo
$c
->
createFrameworkVersionLink
();
?>
</p>
</div>
</body>
</html>
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