Rev 1188 | Rev 1203 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1188 | Rev 1201 | ||
---|---|---|---|
Line 41... | Line 41... | ||
41 | try { |
41 | try { |
42 | $plugin->gui($id, $out, $handled); |
42 | $plugin->gui($id, $out, $handled); |
43 | } catch (\Exception $e) { |
43 | } catch (\Exception $e) { |
44 | $out['title'] = _L('Error'); |
44 | $out['title'] = _L('Error'); |
45 | $out['icon'] = 'img/error.png'; |
45 | $out['icon'] = 'img/error.png'; |
- | 46 | $htmlmsg = $e instanceof OIDplusException ? $e->getHtmlMessage() : htmlentities($e->getMessage()); |
|
46 | $out['text'] = '<p>'.$e->getMessage().'</p>'; |
47 | $out['text'] = '<p>'.$htmlmsg.'</p>'; |
47 | if (OIDplus::baseConfig()->getValue('DEBUG')) { |
48 | if (OIDplus::baseConfig()->getValue('DEBUG')) { |
48 | $out['text'] .= self::getExceptionTechInfo($e); |
49 | $out['text'] .= self::getExceptionTechInfo($e); |
49 | } |
50 | } |
50 | } |
51 | } |
51 | if ($handled) break; |
52 | if ($handled) break; |
Line 124... | Line 125... | ||
124 | * @return void |
125 | * @return void |
125 | * @throws OIDplusException |
126 | * @throws OIDplusException |
126 | */ |
127 | */ |
127 | public static function html_exception_handler(\Throwable $exception) { |
128 | public static function html_exception_handler(\Throwable $exception) { |
128 | // Note: This method must be static |
129 | // Note: This method must be static |
- | 130 | ||
- | 131 | // OXOXO: Implement HTMLEXCEPTIONS |
|
- | 132 | ||
129 | if ($exception instanceof OIDplusConfigInitializationException) { |
133 | if ($exception instanceof OIDplusConfigInitializationException) { |
130 | echo '<!DOCTYPE HTML>'; |
134 | echo '<!DOCTYPE HTML>'; |
131 | echo '<html><head><title>'.htmlentities(_L('OIDplus initialization error')).'</title></head><body>'; |
135 | echo '<html><head><title>'.htmlentities(_L('OIDplus initialization error')).'</title></head><body>'; |
132 | echo '<h1>'.htmlentities(_L('OIDplus initialization error')).'</h1>'; |
136 | echo '<h1>'.htmlentities(_L('OIDplus initialization error')).'</h1>'; |
133 | echo '<p>'.htmlentities($exception->getMessage(), ENT_SUBSTITUTE).'</p>'; |
137 | echo '<p>'.htmlentities($exception->getMessage(), ENT_SUBSTITUTE).'</p>'; |
Line 157... | Line 161... | ||
157 | $out = '<p><b>'.htmlentities(_L('Technical information about the problem')).':</b></p>'; |
161 | $out = '<p><b>'.htmlentities(_L('Technical information about the problem')).':</b></p>'; |
158 | $out .= '<pre>'; |
162 | $out .= '<pre>'; |
159 | $out .= get_class($exception)."\n"; |
163 | $out .= get_class($exception)."\n"; |
160 | $out .= _L('at file %1 (line %2)',$exception->getFile(),"".$exception->getLine())."\n\n"; |
164 | $out .= _L('at file %1 (line %2)',$exception->getFile(),"".$exception->getLine())."\n\n"; |
161 | $out .= _L('Stacktrace').":\n"; |
165 | $out .= _L('Stacktrace').":\n"; |
162 | $out .= htmlentities($exception->getTraceAsString()); |
166 | $stacktrace = $exception->getTraceAsString(); |
- | 167 | try { |
|
- | 168 | $syspath = OIDplus::localpath(NULL); |
|
- | 169 | $stacktrace = str_replace($syspath, '...'.DIRECTORY_SEPARATOR, $stacktrace); // for security |
|
- | 170 | } catch (\Throwable $e) { |
|
- | 171 | // Catch Exception and Error, because this step (censoring) is purely optional and shoult not prevent the stacktrace of being shown |
|
- | 172 | } |
|
- | 173 | $out .= htmlentities($stacktrace); |
|
163 | $out .= '</pre>'; |
174 | $out .= '</pre>'; |
164 | return $out; |
175 | return $out; |
165 | } |
176 | } |
166 | 177 | ||
167 | /** |
178 | /** |