-
Notifications
You must be signed in to change notification settings - Fork 0
/
_error.php
121 lines (111 loc) · 4.45 KB
/
_error.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<?php
/*
##########################################################################
# #
# Version 4 / / / #
# -----------__---/__---__------__----__---/---/- #
# | /| / /___) / ) (_ ` / ) /___) / / #
# _|/_|/__(___ _(___/_(__)___/___/_(___ _/___/___ #
# Free Content / Management System #
# / #
# #
# #
# Copyright 2005-2015 by webspell.org #
# #
# visit webSPELL.org, webspell.info to get webSPELL for free #
# - Script runs under the GNU GENERAL PUBLIC LICENSE #
# - It's NOT allowed to remove this copyright-tag #
# -- http://www.fsf.org/licensing/licenses/gpl.html #
# #
# Code based on WebSPELL Clanpackage (Michael Gruber - webspell.at), #
# Far Development by Development Team - webspell.org #
# #
# visit webspell.org #
# #
##########################################################################
*/
ob_start();
function generateCallTrace()
{
$trace = debug_backtrace();
$trace = array_reverse($trace);
array_pop($trace);
array_pop($trace);
$basepath = realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR;
$result = array();
for ($i=0; $i < count($trace); $i++) {
$line = str_replace($basepath, '', $trace[$i]['file']);
$line .= '('.$trace[$i]['line']."): ";
$line .= "<strong>".$trace[$i]['function']."</strong>(";
$params = array();
foreach ($trace[$i]['args'] as $param) {
$params[] = htmlspecialchars(var_export(str_replace($basepath, '', $param), true));
}
$line .= implode(", ", $params);
$line .= ")";
$result[] = $line;
}
return implode("\n", $result);
}
function system_error($text, $system = 1, $strace = 0)
{
ob_clean();
global $_database;
if ($strace) {
$trace = '<pre>' . generateCallTrace() . '</pre>';
} else {
$trace = '';
}
if ($system) {
include('version.php');
$info = 'Version: ' . $version . ', PHP Version: ' . phpversion();
if (!mysqli_connect_error()) {
$info .= ', MySQL Version: ' . $_database->server_info;
}
} else {
$info = 'webSPELL';
}
die('<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="utf-8">
<meta name="description" content="Clanpage using webSPELL 4 CMS">
<meta name="author" content="webspell.org">
<meta name="generator" content="webSPELL">
<!-- Head & Title include -->
<title>webSPELL - Error</title>
<link href="vendor/twbs/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="_stylesheet.css" rel="stylesheet">
<!-- end Head & Title include -->
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="index.php">webSPELL</a>
<p class="navbar-text">' . $info . '</p>
</div>
</div>
<!-- container -->
</div>
<div class="container">
<div class="row row-centered">
<!-- main content area -->
<div class="col-xs-12 col-sm-6 col-sm-offset-3 col-md-8 col-md-offset-2">
<div>
<div class="alert alert-danger" role="alert"><strong>An error has occured</strong></div>
</div>
<div class="alert alert-info" role="alert">
' . $text . '
</div>
' . $trace . '
</div>
</div>
</div>
<script src="vendor/jquery/jquery/jquery-3.6.0.min.js"></script>
<script src="node_modules/popper.js/dist/umd/popper.min.js"></script>
<script src="vendor/twbs/bootstrap/dist/js/bootstrap.min.js"></script>
</body>
</html>');
}