forked from concept45/CoreManager2
/
error.php
150 lines (129 loc) · 5.59 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<?php
/*
CoreManager, PHP Front End for ArcEmu, MaNGOS, and TrinityCore
Copyright (C) 2010-2014 CoreManager Project
Copyright (C) 2009-2010 ArcManager Project
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// because error needs a header but header.php requires databases,
// we make our own page header, and get any additional required libraries
session_start();
// instead of sanitizing our errors, which breaks inserted line breaks, <br />,
// we will use BBCODE.
require_once("libs/bb2html_lib.php");
$time_start = microtime(true);
//---------------------Loading User Theme and Language Settings----------------
if ( isset($_COOKIE["corem_theme"]) )
{
if ( is_dir("themes/".$_COOKIE["corem_theme"]) )
if ( is_file("themes/".$_COOKIE["corem_theme"]."/".$_COOKIE["corem_theme"]."_1024.css") )
$theme = $_COOKIE["corem_theme"];
}
else
$theme = "Sulfur";
if ( isset($_COOKIE["corem_lang"]) )
{
$lang = $_COOKIE["corem_lang"];
if ( !file_exists("lang/".$lang.".php") )
$lang = "english";
}
else
$lang = "english";
//---------------------Load Default and User Configuration---------------------
if ( file_exists("configs/config.php") )
{
if ( !file_exists("configs/config.dist.php") )
exit('<center><br><code>\'configs/config.dist.php\'</code> not found,<br>
please restore <code>\'configs/config.dist.php\'</code></center>');
require_once "configs/config.php";
}
else
exit('<center><br><code>\'configs/config.php\'</code> not found,<br>
please copy <code>\'configs/config.dist.php\'</code> to
<code>\'configs/config.php\'</code> and make appropriate changes.');
//---------------------Current Filename----------------------------------------
$cur_filename = "error.php";
//---------------------Loading Libraries---------------------------------------
require_once "libs/config_lib.php";
require_once "libs/global_lib.php";
require_once "lang/".$lang.".php";
require_once "libs/lang_lib.php";
// generate minimum info to prevent php errors
if ( $allow_anony && empty($_SESSION["logged_in"]) )
$_SESSION["user_lvl"] = -1;
if ( isset($_SESSION["user_lvl"]) )
$user_lvl = $_SESSION["user_lvl"];
// sets encoding defined in config for language support
// sets encoding defined in config for language support
header("Content-Type: text/html; charset=".$site_encoding);
// the webserver should be adding this directive, but just in case...
header("Cache-Control: private, must-revalidate, post-check=0, pre-check=0");
$output .= '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>'.$title.'</title>
<meta http-equiv="Content-Type" content="text/html; charset='.$site_encoding.'" />
<meta http-equiv="Content-Type" content="text/javascript; charset='.$site_encoding.'" />
<link rel="stylesheet" type="text/css" href="themes/'.$theme.'/'.$theme.'.php" title="1024" />
<!-- link rel="stylesheet" type="text/css" href="themes/'.$theme.'/'.$theme.'_1280.css" title="1280" / -->
<link rel="SHORTCUT ICON" href="img/favicon.ico" />
<script type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" src="libs/js/general.js"></script>
<script type="text/javascript" src="libs/js/layout.js"></script>
</head>';
$output .= '
<body onload="dynamicLayout();">
<div>
<br />
</div>
<div id="body_main">';
// end of header
// we get the error message which was passed to us
$err = ( ( isset($_SESSION["pass_error"]) ) ? $_SESSION["pass_error"] : lang("error", "generic_error").'...' );
// we start with a lead of 10 spaces,
// because last line of header is an opening tag with 8 spaces
// keep html indent in sync, so debuging from browser source would be easy to read
$output .= '
<div class="bubble">
<!-- start of error.php -->
<div class="center_text">
<br />
<table id="error_message_table" class="flat center">
<tr>
<td align="center">
<h1>
<span class="error">
<img src="img/warn_red.gif" width="48" height="48" alt="error" />
<br />'.lang("error", "error").'!
</span>
</h1>
<br />'.bb2html($err).'<br />
</td>
</tr>
</table>
<br />
<table id="error_buttons" class="hidden center">
<tr>
<td align="center">';
makebutton(lang("global", "home"), 'index.php', 130);
makebutton(lang("global", "back"), 'javascript:window.history.back()', 130);
unset($err);
$output .= '
</td>
</tr>
</table>
<br />
</div>
<!-- end of error.php -->';
require_once "footer.php";
?>