/** * Der Konstruktor baut die Klasse auf. Der Konstruktor ist privat, * die Initalisierung geschieht über die Methode singelton. * */ private function __construct() { //Abfangen von Exceptions try { $this->_initObjects(); $this->_checkGpc(); $this->_smarty_array = array(); if (ADMIN_DIR == './') { $this->_is_admin = true; $this->_checkAdmin(); } $this->_initPage(); } catch (CMSException $e) { global $system_textes; $strTrace = '#' . substr($e->getTraceAsString(), 1); //Ist Smarty nicht vorhanden, wird eine Nachricht ueber den Exceptionhandler geschickt, der kein Smarty braucht. if (!class_exists('Smarty') || !$this->_smarty instanceof Smarty) { CMSException::logException($e, null, $system_textes[LANGUAGE_ABR]['core']['exp_no_smarty_instance']); CMSException::printException($e->getFilename(), $e->getLine(), $e->getMessage(), $strTrace); } else { CMSException::logException($e); //Zugriff auf die System-Texte ermöglichen global $system_textes; $textes = $system_textes[LANGUAGE_ABR]['core']; //**Template-Set einstellen und für die Templates als Variable zugänglich machen $this->_smarty_array['TEMPLATESET_DIR'] = TEMPLATESET_DIR; $this->_smarty_array['file'] = 'error_include.tpl'; $this->_smarty_array['error_title'] = CMSException::htmlencode($e->getTitle()); $this->_smarty_array['error_text'] = CMSException::htmlencode($e->getMessage()) . "<br />\n" . $textes['exp_error_in_file'] . " " . $e->getFilename() . " " . $textes['exp_on_line'] . " " . $e->getLine(); //Aus Sicherheitsgründen (z.B. Sicht auf das MySQL-Passwort bei Mysql-Fehler) nur Trace anzeigen, wenn explizit angegeben! if (EXCEPTION_SHOW_TRACE == true) { $this->_smarty_array['error_text'] .= "<br />\n" . "<div style=\"font-size: 11px\">\n" . nl2br(CMSException::htmlencode($strTrace)) . "\n</div>"; } $this->_smarty_array['error_text'] .= "<br /><div style=\"font-size: 13px; font-weight: bold\">" . $textes['exp_error_often'] . "</div>"; $this->_smarty->assign($this->_smarty_array); $this->_smarty->display('index.tpl'); } } }
/** * Gibt eine Exception-Fehlermeldung heraus * * @param string $file Datei * @param string $line Zeile * @param string $msg Nachricht * @param string $trace Trace */ public static function printException($file, $line, $msg, $trace) { global $system_textes; $textes = $system_textes[LANGUAGE_ABR]['excn']; //Style: padding in px $pad = 5; $file = CMSException::htmlencode($file); $msg = CMSException::htmlencode($msg); $trace = nl2br(CMSException::htmlencode($trace)); echo <<<END \t\t<html> \t\t\t<head> \t\t\t\t<title>{$textes['jclub_error']}</title> \t\t\t</head> \t\t\t<body> \t\t\t\t<p style="margin-left: 20%; font-size: 28px; font-weight: bold;">{$textes['unexcn_error']}</p> \t\t\t\t<table style="margin-left: 20%; border-style: solid;"> \t\t\t\t\t<tr style="background-color: #FFDD90"> \t\t\t\t\t\t<td colspan="2" style="font-weight: bold; padding:{$pad}px">{$textes['error_table']}</td> \t\t\t\t\t</tr> \t\t\t\t\t<tr> \t\t\t\t\t\t<td style="padding: {$pad}px">{$textes['file']}</td> \t\t\t\t\t\t<td style="padding: {$pad}px">{$file}</td> \t\t\t\t\t</tr> \t\t\t\t\t<tr style="background-color: #EFEFEF; padding: 30px"> \t\t\t\t\t\t<td style="padding: {$pad}px">{$textes['line']}</td> \t\t\t\t\t\t<td style="padding: {$pad}px">{$line}</td> \t\t\t\t\t</tr> \t\t\t\t\t<tr> \t\t\t\t\t\t<td style="padding: {$pad}px">{$textes['message']}</td> \t\t\t\t\t\t<td style="padding: {$pad}px">{$msg}</td> \t\t\t\t\t</tr> \t\t\t\t\t<tr style="background-color: #EFEFEF;"> \t\t\t\t\t\t<td style="padding: {$pad}px">{$textes['trace']}</td> \t\t\t\t\t\t<td style="padding: {$pad}px">{$trace}</td> \t\t\t\t\t</tr> \t\t\t\t</table> \t\t\t\t<p style="margin-left: 20%; font-style: italic">{$textes['exp_error_often']}</p> \t\t\t</body> \t\t</html> END; }