forked from rapid7/hackazon
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix missed escaping of parameters on the exception render page.
FIx some JS.
- Loading branch information
1 parent
a040a4a
commit 4588f11
Showing
2 changed files
with
131 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Error</title> | ||
<style> | ||
html{ | ||
width:100%; | ||
min-height:100%; | ||
font-family:'Verdana'; | ||
font-size:14px; | ||
} | ||
body{ | ||
|
||
min-height:100%; | ||
background: #a90329; /* Old browsers */ | ||
background: -moz-radial-gradient(center, ellipse cover, #a90329 0%, #6d0019 100%); /* FF3.6+ */ | ||
background: -webkit-radial-gradient(center, ellipse cover, #a90329 0%,#6d0019 100%); /* Chrome10+,Safari5.1+ */ | ||
} | ||
#content{ | ||
max-width:80%; | ||
min-width:1000px; | ||
margin:auto; | ||
padding:10px 0px; | ||
background:#eee; | ||
} | ||
.file{ | ||
font-weight:bold; | ||
} | ||
.block{ | ||
border-bottom:1px solid #000; | ||
margin:10px; | ||
} | ||
.code{ | ||
overflow: auto; | ||
padding:10px; | ||
} | ||
.highlight{ | ||
background:#efecd0; | ||
} | ||
#exception{ | ||
font-size:25px; | ||
font-weight:bold; | ||
padding:10px; | ||
} | ||
#debug{ | ||
border-bottom: 1px solid black; | ||
margin: 10px; | ||
} | ||
#log{ | ||
font-size:15px; | ||
font-weight:bold; | ||
padding:5px; | ||
} | ||
.log{ | ||
padding:10px; | ||
border-bottom: 1px solid black; | ||
} | ||
.log.odd{ | ||
|
||
} | ||
pre{ | ||
margin:0px; | ||
} | ||
.thick{ | ||
border-width:2px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<?php | ||
$rawblocks=array_merge(array(array( | ||
'file'=>$exception->getFile(), | ||
'line'=>$exception->getLine() | ||
)), $exception->getTrace()); | ||
$blocks = array(); | ||
foreach($rawblocks as $block){ | ||
if(!isset($block['file'])) | ||
continue; | ||
//avoid duplicates | ||
if(count($blocks)>0){ | ||
$last=$blocks[count($blocks)-1]; | ||
if($block['file']==$last['file'] && $block['line']==$last['line']) | ||
continue; | ||
} | ||
$blocks[]=$block; | ||
} | ||
|
||
|
||
?> | ||
<div id="content"> | ||
<div id="exception"><?php echo str_replace("\n",'<br/>',$_($exception->getMessage())); ?></div> | ||
<div id="blocks"> | ||
<?php foreach($blocks as $bkey=>$block): ?> | ||
<div class="block <?php echo (!empty($log)&&$bkey==0)?'thick':''; ?>"> | ||
<div class="file"><?php echo $block['file'];?></div> | ||
<div class="code"> | ||
<?php | ||
$line=$block['line']-1; | ||
$code = explode("\n", file_get_contents($block['file'])); | ||
$start = $line - 3; | ||
if ($start < 0) $start = 0; | ||
$end = $line + 3; | ||
if($end>=count($code)) $end=count($code)-1; | ||
$code=array_slice($code,$start,$end-$start,true); | ||
?> | ||
|
||
<?php foreach($code as $n=>$text):?> | ||
<pre class="line <?php echo $n==$line?'highlight':''; ?>"><?php echo ($n+1).' '.htmlspecialchars($text); ?></pre> | ||
<?php endforeach;?> | ||
</div> | ||
</div> | ||
<?php if($bkey==0&&!empty($log)):?> | ||
<div id="debug"> | ||
<div id="log">Logged values:</div> | ||
<?php foreach($log as $key=>$val):?> | ||
<div class="log <?php echo $key%2?'odd':''; ?>"> | ||
<pre><?php var_export($val);?></pre> | ||
</div> | ||
<?php endforeach;?> | ||
</div> | ||
<div id="log">Call stack:</div> | ||
<?php endif;?> | ||
<?php endforeach;?> | ||
</div> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters