Rev 1263 | Rev 1286 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1263 | Rev 1266 | ||
---|---|---|---|
Line 47... | Line 47... | ||
47 | if (strtolower(substr($htmlmsg, 0, 3)) === '<p ') { |
47 | if (strtolower(substr($htmlmsg, 0, 3)) === '<p ') { |
48 | $out['text'] = $htmlmsg; |
48 | $out['text'] = $htmlmsg; |
49 | } else { |
49 | } else { |
50 | $out['text'] = '<p>'.$htmlmsg.'</p>'; |
50 | $out['text'] = '<p>'.$htmlmsg.'</p>'; |
51 | } |
51 | } |
- | 52 | if (isset($_SERVER['SCRIPT_FILENAME']) && (strtolower(basename($_SERVER['SCRIPT_FILENAME'])) !== 'ajax.php')) { // don't send HTTP error codes in ajax.php, because we want a page and not a JavaScript alert box, when someone enters an invalid OID in the GoTo-Box |
|
- | 53 | if (PHP_SAPI != 'cli') @http_response_code($e instanceof OIDplusException ? $e->getHttpStatus() : 500); |
|
- | 54 | } |
|
52 | if (OIDplus::baseConfig()->getValue('DEBUG')) { |
55 | if (OIDplus::baseConfig()->getValue('DEBUG')) { |
53 | $out['text'] .= self::getExceptionTechInfo($e); |
56 | $out['text'] .= self::getExceptionTechInfo($e); |
54 | } |
57 | } |
55 | } |
58 | } |
56 | if ($handled) break; |
59 | if ($handled) break; |
Line 130... | Line 133... | ||
130 | * @throws OIDplusException |
133 | * @throws OIDplusException |
131 | */ |
134 | */ |
132 | public static function html_exception_handler(\Throwable $exception) { |
135 | public static function html_exception_handler(\Throwable $exception) { |
133 | // Note: This method must be static, because of its registration as Exception handler |
136 | // Note: This method must be static, because of its registration as Exception handler |
134 | 137 | ||
135 | if (PHP_SAPI != 'cli') @http_response_code(500); |
- | |
136 | - | ||
137 | if ($exception instanceof OIDplusException) { |
138 | if ($exception instanceof OIDplusException) { |
138 | $htmlTitle = $exception->gethtmlTitle(); |
139 | $htmlTitle = $exception->gethtmlTitle(); |
139 | $htmlMessage = $exception->getHtmlMessage(); |
140 | $htmlMessage = $exception->getHtmlMessage(); |
- | 141 | if (isset($_SERVER['SCRIPT_FILENAME']) && (strtolower(basename($_SERVER['SCRIPT_FILENAME'])) !== 'ajax.php')) { // don't send HTTP error codes in ajax.php, because we want a page and not a JavaScript alert box, when someone enters an invalid OID in the GoTo-Box |
|
- | 142 | if (PHP_SAPI != 'cli') @http_response_code($exception->getHttpStatus()); |
|
- | 143 | } |
|
140 | } else { |
144 | } else { |
141 | $htmlTitle = ''; |
145 | $htmlTitle = ''; |
142 | //$htmlMessage = htmlentities($exception->getMessage()); |
146 | //$htmlMessage = htmlentities($exception->getMessage()); |
143 | $htmlMessage = nl2br(htmlentities(html_to_text($exception->getMessage()))); |
147 | $htmlMessage = nl2br(htmlentities(html_to_text($exception->getMessage()))); |
144 | 148 | if (isset($_SERVER['SCRIPT_FILENAME']) && (strtolower(basename($_SERVER['SCRIPT_FILENAME'])) !== 'ajax.php')) { // don't send HTTP error codes in ajax.php, because we want a page and not a JavaScript alert box, when someone enters an invalid OID in the GoTo-Box |
|
- | 149 | if (PHP_SAPI != 'cli') @http_response_code(500); |
|
- | 150 | } |
|
145 | } |
151 | } |
146 | if (!$htmlTitle) { |
152 | if (!$htmlTitle) { |
147 | $htmlTitle = _L('OIDplus Error'); |
153 | $htmlTitle = _L('OIDplus Error'); |
148 | } |
154 | } |
149 | 155 |