XCL Web Application Platform 2.5.0
The XoopsCube Legacy Project
Loading...
Searching...
No Matches
module.errorhandler.php
1<?php
13
14
15if (!defined('XOOPS_C_ERRORHANDLER_INCLUDED')) {
16 define('XOOPS_C_ERRORHANDLER_INCLUDED', 1);
17
18
19 class ErrorHandler
20 {
29 public function show($e_code, $pages=1)
30 {
31 global $xoopsConfig, $xoopsUser, $xoopsRequestUri, $xoopsModule, $xoopsLogger;
32 $root = XCube_Root::getSingleton();
33 $db = $root->mController->mDB;
34 $errmsg = [
35 '0001' => 'Could not connect to the forums database.',
36 '0002' => 'The forum you selected does not exist. Please go back and try again.',
37 '0003' => 'Password Incorrect.',
38 '0004' => 'Could not query the topics database.',
39 '0005' => 'Error getting messages from the database.',
40 '0006' => 'Please enter the Nickname and the Password.',
41 '0007' => "You are not the Moderator of this forum therefore you can't perform this function.",
42 '0008' => 'You did not enter the correct password, please go back and try again.',
43 '0009' => 'Could not remove posts from the database.',
44 '0010' => 'Could not move selected topic to selected forum. Please go back and try again.',
45 '0011' => 'Could not lock the selected topic. Please go back and try again.',
46 '0012' => 'Could not unlock the selected topic. Please go back and try again.',
47 '0013' => 'Could not query the database. <br>Error: ' . htmlspecialchars($db->error(), ENT_QUOTES, _CHARSET),
48 '0014' => 'No such user or post in the database.',
49 '0015' => 'Search Engine was unable to query the forums database.',
50 '0016' => 'That user does not exist. Please go back and search again.',
51 '0017' => "You must type a subject to post. You can't post an empty subject. Go back and enter the subject",
52 '0018' => 'You must choose message icon to post. Go back and choose message icon.',
53 '0019' => "You must type a message to post. You can't post an empty message. Go back and enter a message.",
54 '0020' => 'Could not enter data into the database. Please go back and try again.',
55 '0021' => "Can't delete the selected message.",
56 '0022' => 'An error occurred while querying the database.',
57 '0023' => 'Selected message was not found in the forum database.',
58 '0024' => "You can't reply to that message. It wasn't sent to you.",
59 '0025' => "You can't post a reply to this topic, it has been locked. Contact the administrator if you have any question.",
60 '0026' => 'The forum or topic you are attempting to post to does not exist. Please try again.',
61 '0027' => 'You must enter your username and password. Go back and do so.',
62 '0028' => 'You have entered an incorrect password. Go back and try again.',
63 '0029' => "Couldn't update post count.",
64 '0030' => 'The forum you are attempting to post to does not exist. Please try again.',
65 '0031' => 'Unknown Error',
66 '0035' => "You can't edit a post that's not yours.",
67 '0036' => 'You do not have permission to edit this post.',
68 '0037' => 'You did not supply the correct password or do not have permission to edit this post. Please go back and try again.',
69 '1001' => 'Please enter value for Title.',
70 '1002' => 'Please enter value for Phone.',
71 '1003' => 'Please enter value for Summary.',
72 '1004' => 'Please enter value for Address.',
73 '1005' => 'Please enter value for City.',
74 '1006' => 'Please enter value for State/Province.',
75 '1007' => 'Please enter value for Zipcode.',
76 '1008' => 'Please enter value for Description.',
77 '1009' => 'Vote for the selected resource only once.<br>All votes are logged and reviewed.',
78 '1010' => 'You cannot vote on the resource you submitted.<br>All votes are logged and reviewed.',
79 '1011' => 'No rating selected - no vote tallied.',
80 '1013' => 'Please enter a search query.',
81 '1016' => 'Please enter value for URL.',
82 '1017' => 'Please enter value for Home Page.',
83 '9999' => 'OOPS! God Knows'
84 ];
85
86 $errorno = array_keys($errmsg);
87 if (!in_array($e_code, $errorno, true)) {
88 $e_code = '9999';
89 }
90 //TODO use module template
91 include_once XOOPS_ROOT_PATH . '/header.php';
92 //OpenTable();
93 echo '<div><b>' . htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES) . ' Error</b><br><br>';
94 echo "Error Code: $e_code<br><br><br>";
95 echo "<b>ERROR:</b> $errmsg[$e_code]<br><br><br>";
96 echo "[ <a href='javascript:history.go(-".$pages.")'>Go Back</a> ]</div>";
97 //CloseTable();
98 include_once XOOPS_ROOT_PATH . '/footer.php';
99 exit();
100 }
101 }
102}