Skip to content

Commit 1a20175

Browse files
committed
Move views to another folder
1 parent 97d1231 commit 1a20175

File tree

3 files changed

+355
-2
lines changed

3 files changed

+355
-2
lines changed

ErrorHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,12 +284,12 @@ public static function exception($exception)
284284
$error['highlighted'] = self::highlightCode($error['file'], $error['line']);
285285

286286
@header('HTTP/1.1 500 Internal Server Error');
287-
include 'Resources/Views/Errors/exception.php';
287+
include 'views/exception.php';
288288

289289
} else {
290290

291291
@header('HTTP/1.1 500 Internal Server Error');
292-
include 'Resources/Views/Errors/production.php';
292+
include 'views/production.php';
293293

294294
}
295295

views/exception.php

Lines changed: 302 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,302 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Error</title>
6+
<style type="text/css">
7+
body {
8+
background: #F5F5F5;
9+
padding: 0;
10+
margin: 0;
11+
}
12+
#error-handler {
13+
background:#F5F5F5;
14+
color:0;
15+
width:100%;
16+
font-size:14px;
17+
font-family:Verdana, Arial, Helvetica, "Nimbus Sans", FreeSans, Malayalam, sans-serif;
18+
}
19+
20+
#error-handler pre {
21+
font-family:"Andale Mono", "Courier New", Courier;
22+
font-size:12px;
23+
margin:0;
24+
padding:0;
25+
}
26+
27+
#error-handler a {
28+
color:#DC143C;
29+
text-decoration:none;
30+
}
31+
32+
#error-handler .error {
33+
background:#DC143C;
34+
color:#fff;
35+
font-size:24px;
36+
font-weight:700;
37+
padding:10px;
38+
39+
}
40+
41+
#error-handler .body {
42+
border:0 solid #ccc;
43+
padding:10px;
44+
}
45+
46+
#error-handler .code {
47+
background:#fff;
48+
border:1px solid #ccc;
49+
overflow:auto;
50+
}
51+
52+
#error-handler .heading {
53+
background:#444;
54+
color:#fff;
55+
font-size:18px;
56+
font-weight:700;
57+
padding:10px;
58+
}
59+
60+
#error-handler .line {
61+
background:#777;
62+
color:#fff;
63+
padding-left:4px;
64+
padding-right:4px;
65+
}
66+
67+
#error-handler .highlighted {
68+
background:#fceb71;
69+
border-top:1px solid #ccc;
70+
border-bottom:1px solid #ccc;
71+
}
72+
73+
#error-handler .backtrace {
74+
background:#fff;
75+
margin-bottom:10px;
76+
border:1px solid #ccc;
77+
padding:10px;
78+
}
79+
80+
#error-handler .backtrace ol {
81+
padding-left:40px;
82+
}
83+
84+
#error-handler table {
85+
border-spacing:0;
86+
border-collapse:collapse;
87+
border-color:#ddd;
88+
border-style:solid;
89+
border-width:0 0 1px 1px;
90+
}
91+
92+
#error-handler td {
93+
font-size:14px;
94+
background:#fff;
95+
border-color:#ddd;
96+
border-style:solid;
97+
border-width:1px 1px 0 0;
98+
margin:0;
99+
padding:4px;
100+
}
101+
102+
.pull-right {
103+
float:right;
104+
}
105+
</style>
106+
<body>
107+
<div id="error-handler">
108+
109+
<div class="error">
110+
<?php echo $error['type']; ?><?php if(isset($error['code'])): ?> <span style="color:#e1e1e1;padding:0px">[<?php echo $error['code']; ?>]</span><?php endif; ?>
111+
<span class="pull-right">Error Handler</span>
112+
</div>
113+
<div class="body">
114+
<strong>Message:</strong> <?php echo htmlspecialchars($error['message'], ENT_COMPAT, 'UTF-8', false); ?>
115+
116+
<?php if(!empty($error['file'])): ?>
117+
<br><br>
118+
<strong>Location:</strong> <?php echo $error['file']; ?> (line <?php echo $error['line']; ?>)
119+
<?php endif; ?>
120+
121+
<?php if(!empty($error['highlighted'])): ?>
122+
<br><br>
123+
<div class="code">
124+
<?php foreach($error['highlighted'] as $line): ?>
125+
<pre<?php if($line['highlighted']): ?> class="highlighted"<?php endif; ?>><span class="line"><?php echo $line['number']; ?></span> <?php echo $line['code']; ?></pre>
126+
<?php endforeach; ?>
127+
</div>
128+
<?php endif; ?>
129+
</div>
130+
131+
<?php if(!empty($error['backtrace'])): ?>
132+
<div class="heading">
133+
Backtrace <a href="#" onclick="return toggle('backtrace', this);" style="float:right">+</a>
134+
</div>
135+
<div class="body" style="display:none;" id="backtrace">
136+
<?php foreach($error['backtrace'] as $trace): ?>
137+
<div class="backtrace">
138+
<p><strong>Function:</strong> <?php echo $trace['function']; ?></p>
139+
<?php if(!empty($trace['arguments'])): $id = md5(uniqid('', true)); ?>
140+
<p><strong>Arguments: [<a href="#" onclick="return toggle('<?php echo $id; ?>', this);">+</a>]</strong></p>
141+
<div style="display:none" id="<?php echo $id; ?>">
142+
<ol>
143+
<?php foreach($trace['arguments'] as $arg): ?>
144+
<li><pre><?php echo $arg; ?></pre></li>
145+
<?php endforeach; ?>
146+
</ol>
147+
</div>
148+
<?php endif; ?>
149+
<?php if(!empty($trace['location'])): $id = md5(uniqid('', true)); ?>
150+
<p><strong>Location:</strong> <?php echo $trace['location']['file']; ?> (<a href="#" onclick="return toggle('<?php echo $id; ?>');">line <?php echo $trace['location']['line']; ?></a>)</p>
151+
<div class="code" style="display:none" id="<?php echo $id; ?>">
152+
<?php foreach($trace['location']['code'] as $line): ?>
153+
<pre<?php if($line['highlighted']): ?> class="highlighted"<?php endif; ?>><span class="line"><?php echo $line['number']; ?></span> <?php echo $line['code']; ?></pre>
154+
<?php endforeach; ?>
155+
</div>
156+
<?php endif; ?>
157+
</div>
158+
<?php endforeach; ?>
159+
</div>
160+
<?php endif; ?>
161+
162+
<div class="heading">
163+
Superglobals <a href="#" onclick="return toggle('superglobals', this);" style="float:right">+</a>
164+
</div>
165+
<div class="body" style="display:none;" id="superglobals">
166+
167+
<?php if(!empty($_SERVER)): ?>
168+
<p><b>$_SERVER [<a href="#" onclick="return toggle('_server', this);">+</a>]</b></p>
169+
<div id="_server" style="display:none">
170+
<table width="100%">
171+
<?php foreach($_SERVER as $k => $v): ?>
172+
<tr>
173+
<td width="15%"><?php echo htmlspecialchars($k); ?></td>
174+
<td width="85%"><pre><?php ob_start(); var_dump($v); echo htmlspecialchars(ob_get_clean()); ?></pre></td>
175+
</tr>
176+
<?php endforeach; ?>
177+
</table>
178+
</div>
179+
<?php endif; ?>
180+
181+
<?php if(!empty($_GET)): ?>
182+
<p><b>$_GET [<a href="#" onclick="return toggle('_get', this);">+</a>]</b></p>
183+
<div id="_get" style="display:none">
184+
<table width="100%">
185+
<?php foreach($_GET as $k => $v): ?>
186+
<tr>
187+
<td width="15%"><?php echo htmlspecialchars($k); ?></td>
188+
<td width="85%"><pre><?php ob_start(); var_dump($v); echo htmlspecialchars(ob_get_clean()); ?></pre></td>
189+
</tr>
190+
<?php endforeach; ?>
191+
</table>
192+
</div>
193+
<?php endif; ?>
194+
195+
<?php if(!empty($_POST)): ?>
196+
<p><b>$_POST [<a href="#" onclick="return toggle('_post', this);">+</a>]</b></p>
197+
<div id="_post" style="display:none">
198+
<table width="100%">
199+
<?php foreach($_POST as $k => $v): ?>
200+
<tr>
201+
<td width="15%"><?php echo htmlspecialchars($k); ?></td>
202+
<td width="85%"><pre><?php ob_start(); var_dump($v); echo htmlspecialchars(ob_get_clean()); ?></pre></td>
203+
</tr>
204+
<?php endforeach; ?>
205+
</table>
206+
</div>
207+
<?php endif; ?>
208+
209+
<?php if(!empty($_FILES)): ?>
210+
<p><b>$_FILES [<a href="#" onclick="return toggle('_files', this);">+</a>]</b></p>
211+
<div id="_files" style="display:none">
212+
<table width="100%">
213+
<?php foreach($_FILES as $k => $v): ?>
214+
<tr>
215+
<td width="15%"><?php echo htmlspecialchars($k); ?></td>
216+
<td width="85%"><pre><?php ob_start(); var_dump($v); echo htmlspecialchars(ob_get_clean()); ?></pre></td>
217+
</tr>
218+
<?php endforeach; ?>
219+
</table>
220+
</div>
221+
<?php endif; ?>
222+
223+
<?php if(!empty($_COOKIE)): ?>
224+
<p><b>$_COOKIE [<a href="#" onclick="return toggle('_cookie', this);">+</a>]</b></p>
225+
<div id="_cookie" style="display:none">
226+
<table width="100%">
227+
<?php foreach($_COOKIE as $k => $v): ?>
228+
<tr>
229+
<td width="15%"><?php echo htmlspecialchars($k); ?></td>
230+
<td width="85%"><?php ob_start(); var_dump($v); echo htmlspecialchars(ob_get_clean()); ?></td>
231+
</tr>
232+
<?php endforeach; ?>
233+
</table>
234+
</div>
235+
<?php endif; ?>
236+
237+
<?php if(!empty($_SESSION)): ?>
238+
<p><b>$_SESSION [<a href="#" onclick="return toggle('_session', this);">+</a>]</b></p>
239+
<div id="_session" style="display:none">
240+
<table width="100%">
241+
<?php foreach($_SESSION as $k => $v): ?>
242+
<tr>
243+
<td width="15%"><?php echo htmlspecialchars($k); ?></td>
244+
<td width="85%"><pre><?php ob_start(); var_dump($v); echo htmlspecialchars(ob_get_clean()); ?></pre></td>
245+
</tr>
246+
<?php endforeach; ?>
247+
</table>
248+
</div>
249+
<?php endif; ?>
250+
251+
<?php if(!empty($_ENV)): ?>
252+
<p><b>$_ENV [<a href="#" onclick="return toggle('_env', this);">+</a>]</b></p>
253+
<div id="_env" style="display:none">
254+
<table width="100%">
255+
<?php foreach($_ENV as $k => $v): ?>
256+
<tr>
257+
<td width="15%"><?php echo htmlspecialchars($k); ?></td>
258+
<td width="85%"><pre><?php ob_start(); var_dump($v); echo htmlspecialchars(ob_get_clean()); ?></pre></td>
259+
</tr>
260+
<?php endforeach; ?>
261+
</table>
262+
</div>
263+
<?php endif; ?>
264+
</div>
265+
266+
<div class="heading">
267+
Included Files <a href="#" onclick="return toggle('files', this);" style="float:right">+</a>
268+
</div>
269+
<div class="body" style="display:none;" id="files">
270+
<table width="100%">
271+
<?php foreach(get_included_files() as $k => $v): ?>
272+
<tr>
273+
<td width="5%"><?php echo $k + 1; ?></td>
274+
<td width="95%"><?php echo $v; ?></td>
275+
</tr>
276+
<?php endforeach; ?>
277+
</table>
278+
</div>
279+
</div>
280+
281+
<script type="text/javascript">
282+
function toggle(id, link)
283+
{
284+
var div = document.getElementById(id);
285+
286+
if (div.style.display == "none") {
287+
if (link != null) {
288+
link.innerHTML = '-';
289+
}
290+
div.style.display = "block";
291+
} else {
292+
if (link != null) {
293+
link.innerHTML = '+';
294+
}
295+
div.style.display = "none";
296+
}
297+
298+
return false;
299+
}
300+
</script>
301+
</body>
302+
</html>

views/production.php

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Error Handler</title>
6+
<style type="text/css">
7+
body {
8+
height:100%;
9+
background:#eee;
10+
padding:0px;
11+
margin:0px;
12+
height: 100%;
13+
font-size: 100%;
14+
color:#333;
15+
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
16+
line-height: 100%;
17+
}
18+
a {
19+
color:#0088cc;
20+
text-decoration:none;
21+
}
22+
a:hover {
23+
color:#005580;
24+
text-decoration:underline;
25+
}
26+
h1 {
27+
font-size: 4em;
28+
}
29+
small {
30+
font-size: 0.7em;
31+
color: #999;
32+
font-weight: normal;
33+
}
34+
hr {
35+
border:0px;
36+
border-bottom:1px #ddd solid;
37+
}
38+
#message {
39+
width: 700px;
40+
margin: 15% auto;
41+
}
42+
</style>
43+
</head>
44+
<body>
45+
<div id="message">
46+
<h1>Error</h1>
47+
<hr>
48+
<p>Aw, snap! An error has occurred while processing your request.</p>
49+
</div>
50+
</body>
51+
</html>

0 commit comments

Comments
 (0)