1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* XOOPS legacy error handler |
4
|
|
|
* |
5
|
|
|
* You may not change or alter any portion of this comment or credits |
6
|
|
|
* of supporting developers from this source code or any supporting source code |
7
|
|
|
* which is considered copyrighted (c) material of the original comment or credit authors. |
8
|
|
|
* This program is distributed in the hope that it will be useful, |
9
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
10
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
11
|
|
|
* |
12
|
|
|
* @copyright (c) 2000-2025 XOOPS Project (https://xoops.org) |
13
|
|
|
* @license GNU GPL 2 (https://www.gnu.org/licenses/gpl-2.0.html) |
14
|
|
|
* @package kernel |
15
|
|
|
* @since 1.0.0 |
16
|
|
|
* @author Goghs (http://www.eqiao.com/) |
17
|
|
|
* @deprecated |
18
|
|
|
*/ |
19
|
|
|
|
20
|
|
|
defined('XOOPS_ROOT_PATH') || exit('Restricted access'); |
21
|
|
|
|
22
|
|
|
$GLOBALS['xoopsLogger']->addDeprecated("'/class/module.errorhandler.php' is deprecated since XOOPS 2.5.4, please create your own error messages instead."); |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* Error Handler class |
26
|
|
|
* |
27
|
|
|
* @package kernel |
28
|
|
|
* @subpackage core |
29
|
|
|
* @author Goghs (http://www.eqiao.com/) |
30
|
|
|
*/ |
31
|
|
|
class ErrorHandler |
32
|
|
|
{ |
33
|
|
|
/** |
34
|
|
|
* Show an error message |
35
|
|
|
* |
36
|
|
|
* @param string $e_code Errorcode |
37
|
|
|
* @param integer $pages How many pages should the link take you back? |
38
|
|
|
* @global $xoopsConfig |
39
|
|
|
*/ |
40
|
|
|
public static function show($e_code, $pages = 1) |
41
|
|
|
{ |
42
|
|
|
global $xoopsConfig; |
43
|
|
|
|
44
|
|
|
$errmsg = [ |
45
|
|
|
'0001' => 'Could not connect to the forums database.', |
46
|
|
|
'0002' => 'The forum you selected does not exist. Please go back and try again.', |
47
|
|
|
'0003' => 'Incorrect Password.', |
48
|
|
|
'0004' => 'Could not query the topics database.', |
49
|
|
|
'0005' => 'Error getting messages from the database.', |
50
|
|
|
'0006' => 'Please enter the Nickname and the Password.', |
51
|
|
|
'0007' => 'You are not the Moderator of this forum therefore you can\'t perform this function.', |
52
|
|
|
'0008' => 'You did not enter the correct password, please go back and try again.', |
53
|
|
|
'0009' => 'Could not remove posts from the database.', |
54
|
|
|
'0010' => 'Could not move selected topic to selected forum. Please go back and try again.', |
55
|
|
|
'0011' => 'Could not lock the selected topic. Please go back and try again.', |
56
|
|
|
'0012' => 'Could not unlock the selected topic. Please go back and try again.', |
57
|
|
|
'0013' => 'Could not query the database.', // <br>Error: ' . mysql_error() . '', |
58
|
|
|
'0014' => 'No such user or post in the database.', |
59
|
|
|
'0015' => 'Search Engine was unable to query the forums database.', |
60
|
|
|
'0016' => 'That user does not exist. Please go back and search again.', |
61
|
|
|
'0017' => 'You must type a subject to post. You can\'t post an empty subject. Go back and enter the subject', |
62
|
|
|
'0018' => 'You must select message icon to post. Go back and select message icon.', |
63
|
|
|
'0019' => 'You must type a message to post. You can\'t post an empty message. Go back and enter a message.', |
64
|
|
|
'0020' => 'Could not enter data into the database. Please go back and try again.', |
65
|
|
|
'0021' => 'Can\'t delete the selected message.', |
66
|
|
|
'0022' => 'An error occurred while querying the database.', |
67
|
|
|
'0023' => 'Selected message was not found in the forum database.', |
68
|
|
|
'0024' => 'You can\'t reply to that message. It wasn\'t sent to you.', |
69
|
|
|
'0025' => 'You can\'t post a reply to this topic, it has been locked. Contact the administrator if you have any question.', |
70
|
|
|
'0026' => 'The forum or topic you are attempting to post to does not exist. Please try again.', |
71
|
|
|
'0027' => 'You must enter your username and password. Go back and do so.', |
72
|
|
|
'0028' => 'You have entered an incorrect password. Go back and try again.', |
73
|
|
|
'0029' => 'Couldn\'t update post count.', |
74
|
|
|
'0030' => 'The forum you are attempting to post to does not exist. Please try again.', |
75
|
|
|
'0031' => 'Unknown Error', |
76
|
|
|
'0035' => 'You can\'t edit a post that\'s not yours.', |
77
|
|
|
'0036' => 'You do not have permission to edit this post.', |
78
|
|
|
'0037' => 'You did not supply the correct password or do not have permission to edit this post. Please go back and try again.', |
79
|
|
|
'1001' => 'Please enter value for Title.', |
80
|
|
|
'1002' => 'Please enter value for Phone.', |
81
|
|
|
'1003' => 'Please enter value for Summary.', |
82
|
|
|
'1004' => 'Please enter value for Address.', |
83
|
|
|
'1005' => 'Please enter value for City.', |
84
|
|
|
'1006' => 'Please enter value for State/Province.', |
85
|
|
|
'1007' => 'Please enter value for Zipcode.', |
86
|
|
|
'1008' => 'Please enter value for Description.', |
87
|
|
|
'1009' => 'Vote for the selected resource only once.<br>All votes are logged and reviewed.', |
88
|
|
|
'1010' => 'You cannot vote on the resource you submitted.<br>All votes are logged and reviewed.', |
89
|
|
|
'1011' => 'No rating selected - no vote tallied.', |
90
|
|
|
'1013' => 'Please enter a search query.', |
91
|
|
|
'1016' => 'Please enter value for URL.', |
92
|
|
|
'1017' => 'Please enter value for Home Page.', |
93
|
|
|
'9999' => 'OOPS! Unknown Error', |
94
|
|
|
]; |
95
|
|
|
|
96
|
|
|
$errorno = array_keys($errmsg); |
97
|
|
|
if (!in_array($e_code, $errorno)) { |
98
|
|
|
$e_code = '9999'; |
99
|
|
|
} |
100
|
|
|
include_once XOOPS_ROOT_PATH . '/header.php'; |
101
|
|
|
echo '<div><strong>' . $xoopsConfig['sitename'] . ' Error</strong><br><br>'; |
102
|
|
|
|
103
|
|
|
echo "Error Code: $e_code<br><br><br>"; |
104
|
|
|
echo "<strong>ERROR:</strong> $errmsg[$e_code]<br><br><br>"; |
105
|
|
|
echo '[ <a href=\'javascript:history.go(-' . $pages . ')\'>Go Back</a> ]</div>'; |
106
|
|
|
|
107
|
|
|
include_once XOOPS_ROOT_PATH . '/footer.php'; |
108
|
|
|
exit(); |
|
|
|
|
109
|
|
|
} |
110
|
|
|
} |
111
|
|
|
// } |
112
|
|
|
|
In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.