|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace XoopsModules\Extgallery; |
|
4
|
|
|
|
|
5
|
|
|
// -------------------------------------------------------------------------------- |
|
6
|
|
|
// PhpConcept Library (PCL) Error 1.0 |
|
7
|
|
|
// -------------------------------------------------------------------------------- |
|
8
|
|
|
// License GNU/GPL - Vincent Blavet - Mars 2001 |
|
9
|
|
|
// http://www.phpconcept.net & http://phpconcept.free.fr |
|
10
|
|
|
// -------------------------------------------------------------------------------- |
|
11
|
|
|
// Français : |
|
12
|
|
|
// La description de l'usage de la librairie PCL Error 1.0 n'est pas encore |
|
13
|
|
|
// disponible. Celle-ci n'est pour le moment distribuée qu'avec les |
|
14
|
|
|
// développements applicatifs de PhpConcept. |
|
15
|
|
|
// Une version indépendante sera bientot disponible sur http://www.phpconcept.net |
|
16
|
|
|
// |
|
17
|
|
|
// English : |
|
18
|
|
|
// The PCL Error 1.0 library description is not available yet. This library is |
|
19
|
|
|
// released only with PhpConcept application and libraries. |
|
20
|
|
|
// An independant release will be soon available on http://www.phpconcept.net |
|
21
|
|
|
// |
|
22
|
|
|
// -------------------------------------------------------------------------------- |
|
23
|
|
|
// |
|
24
|
|
|
// * Avertissement : |
|
25
|
|
|
// |
|
26
|
|
|
// Cette librairie a été créée de façon non professionnelle. |
|
27
|
|
|
// Son usage est au risque et péril de celui qui l'utilise, en aucun cas l'auteur |
|
28
|
|
|
// de ce code ne pourra être tenu pour responsable des éventuels dégats qu'il pourrait |
|
29
|
|
|
// engendrer. |
|
30
|
|
|
// Il est entendu cependant que l'auteur a réalisé ce code par plaisir et n'y a |
|
31
|
|
|
// caché aucun virus, ni malveillance. |
|
32
|
|
|
// Cette libairie est distribuée sous la license GNU/GPL (https://www.gnu.org) |
|
33
|
|
|
// |
|
34
|
|
|
// * Auteur : |
|
35
|
|
|
// |
|
36
|
|
|
// Ce code a été écrit par Vincent Blavet ([email protected]) sur son temps |
|
37
|
|
|
// de loisir. |
|
38
|
|
|
// |
|
39
|
|
|
// -------------------------------------------------------------------------------- |
|
40
|
|
|
|
|
41
|
|
|
// ----- Look for double include |
|
42
|
|
|
|
|
43
|
|
|
if (!\defined('PCLERROR_LIB')) { |
|
44
|
|
|
\define('PCLERROR_LIB', 1); |
|
45
|
|
|
|
|
46
|
|
|
// ----- Version |
|
47
|
|
|
$g_pcl_error_version = '1.0'; |
|
48
|
|
|
|
|
49
|
|
|
// ----- Internal variables |
|
50
|
|
|
// These values must only be change by PclError library functions |
|
51
|
|
|
$g_pcl_error_string = ''; |
|
52
|
|
|
$g_pcl_error_code = 1; |
|
53
|
|
|
|
|
54
|
|
|
// -------------------------------------------------------------------------------- |
|
55
|
|
|
// Function : PclErrorLog() |
|
56
|
|
|
// Description : |
|
57
|
|
|
// Parameters : |
|
58
|
|
|
// -------------------------------------------------------------------------------- |
|
59
|
|
|
/** |
|
60
|
|
|
* @param int $p_error_code |
|
61
|
|
|
* @param string $p_error_string |
|
62
|
|
|
*/ |
|
63
|
|
|
function PclErrorLog($p_error_code = 0, $p_error_string = '') |
|
64
|
|
|
{ |
|
65
|
|
|
global $g_pcl_error_string; |
|
66
|
|
|
global $g_pcl_error_code; |
|
67
|
|
|
|
|
68
|
|
|
$g_pcl_error_code = $p_error_code; |
|
69
|
|
|
$g_pcl_error_string = $p_error_string; |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
// -------------------------------------------------------------------------------- |
|
73
|
|
|
|
|
74
|
|
|
// -------------------------------------------------------------------------------- |
|
75
|
|
|
// Function : PclErrorFatal() |
|
76
|
|
|
// Description : |
|
77
|
|
|
// Parameters : |
|
78
|
|
|
// -------------------------------------------------------------------------------- |
|
79
|
|
|
/** |
|
80
|
|
|
* @param $p_file |
|
81
|
|
|
* @param $p_line |
|
82
|
|
|
* @param string $p_error_string |
|
83
|
|
|
*/ |
|
84
|
|
|
function PclErrorFatal($p_file, $p_line, $p_error_string = '') |
|
85
|
|
|
{ |
|
86
|
|
|
global $g_pcl_error_string; |
|
87
|
|
|
global $g_pcl_error_code; |
|
88
|
|
|
|
|
89
|
|
|
$v_message = '<html><body>'; |
|
90
|
|
|
$v_message .= "<p align=center><span bgcolor=white style='color: #ff0000; font-weight: bold;'>PclError Library has detected a fatal error on file '$p_file', line $p_line</span></p>"; |
|
91
|
|
|
$v_message .= "<p align=center><span bgcolor=white style='color: #ff0000; font-weight: bold;'>$p_error_string</span></p>"; |
|
92
|
|
|
$v_message .= '</body></html>'; |
|
93
|
|
|
exit($v_message); |
|
|
|
|
|
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
// -------------------------------------------------------------------------------- |
|
97
|
|
|
|
|
98
|
|
|
// -------------------------------------------------------------------------------- |
|
99
|
|
|
// Function : PclErrorReset() |
|
100
|
|
|
// Description : |
|
101
|
|
|
// Parameters : |
|
102
|
|
|
// -------------------------------------------------------------------------------- |
|
103
|
|
|
function PclErrorReset() |
|
104
|
|
|
{ |
|
105
|
|
|
global $g_pcl_error_string; |
|
106
|
|
|
global $g_pcl_error_code; |
|
107
|
|
|
|
|
108
|
|
|
$g_pcl_error_code = 1; |
|
109
|
|
|
$g_pcl_error_string = ''; |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
// -------------------------------------------------------------------------------- |
|
113
|
|
|
|
|
114
|
|
|
// -------------------------------------------------------------------------------- |
|
115
|
|
|
// Function : PclErrorCode() |
|
116
|
|
|
// Description : |
|
117
|
|
|
// Parameters : |
|
118
|
|
|
// -------------------------------------------------------------------------------- |
|
119
|
|
|
/** |
|
120
|
|
|
* @return int |
|
121
|
|
|
*/ |
|
122
|
|
|
function PclErrorCode() |
|
123
|
|
|
{ |
|
124
|
|
|
global $g_pcl_error_string; |
|
125
|
|
|
global $g_pcl_error_code; |
|
126
|
|
|
|
|
127
|
|
|
return $g_pcl_error_code; |
|
128
|
|
|
} |
|
129
|
|
|
|
|
130
|
|
|
// -------------------------------------------------------------------------------- |
|
131
|
|
|
|
|
132
|
|
|
// -------------------------------------------------------------------------------- |
|
133
|
|
|
// Function : PclErrorString() |
|
134
|
|
|
// Description : |
|
135
|
|
|
// Parameters : |
|
136
|
|
|
// -------------------------------------------------------------------------------- |
|
137
|
|
|
/** |
|
138
|
|
|
* @return string |
|
139
|
|
|
*/ |
|
140
|
|
|
function PclErrorString() |
|
141
|
|
|
{ |
|
142
|
|
|
global $g_pcl_error_string; |
|
143
|
|
|
global $g_pcl_error_code; |
|
144
|
|
|
|
|
145
|
|
|
return ($g_pcl_error_string . " [code $g_pcl_error_code]"); |
|
146
|
|
|
} |
|
147
|
|
|
|
|
148
|
|
|
// -------------------------------------------------------------------------------- |
|
149
|
|
|
|
|
150
|
|
|
// ----- End of double include look |
|
151
|
|
|
} |
|
152
|
|
|
|
In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.