public function dispatch() { global $debug_mode; if ($debug_mode) { printGenericException($this); return; } showError($this->message); redirectUser(buildRedirectURL('index', 'default')); }
protected final function genHTMLPage($title, $text) { global $helpdesk_banner, $debug_mode; if (isset($debug_mode) && $debug_mode && $this->code != RackTablesError::NOT_AUTHENTICATED) { // in debug mode, dump backtrace instead of standard page // NOT_AUTHENTICATED exception does not need debugging, so it is skipped printGenericException($this); return; } header('Content-Type: text/html; charset=UTF-8'); echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n"; echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">' . "\n"; echo "<head><title>{$title}</title>"; echo "</head><body>{$text}"; if (isset($helpdesk_banner)) { echo '<hr>' . $helpdesk_banner; } echo '</body></html>'; }
function printException($e) { if ($e instanceof RackTablesError) { $e->dispatch(); } elseif ($e instanceof PDOException) { printPDOException($e); } else { printGenericException($e); } }