From 92243991bce5d18b12bc1a1f57cfb360cb511dd2 Mon Sep 17 00:00:00 2001 From: "Michael Kaufmann (d00p)" Date: Sun, 13 Oct 2013 12:59:43 +0200 Subject: [PATCH] finally output a nice error-message on mysql-errors Signed-off-by: Michael Kaufmann (d00p) --- lib/classes/database/class.db.php | 9 +++++ templates/Froxlor/misc/dberrornice.tpl | 47 ++++++++++++++++++++++++ templates/Sparkle/misc/dberrornice.tpl | 51 ++++++++++++++++++++++++++ 3 files changed, 107 insertions(+) create mode 100644 templates/Froxlor/misc/dberrornice.tpl create mode 100644 templates/Sparkle/misc/dberrornice.tpl diff --git a/lib/classes/database/class.db.php b/lib/classes/database/class.db.php index 4cbfed0d..2b866422 100644 --- a/lib/classes/database/class.db.php +++ b/lib/classes/database/class.db.php @@ -307,6 +307,15 @@ class db { @fwrite($sqllog, date('d.m.Y H:i', time())." --- ".$text."\n"); @fclose($sqllog); + if (isset($_SERVER['SHELL']) && $_SERVER['SHELL'] != '') { + // if we're not on the shell, output a nicer error-message + $err_hint = file_get_contents(dirname($sl_dir).'/templates/'.$theme.'/misc/dberrornice.tpl'); + // replace values + $err_hint = str_replace("", $errormsg, $err_hint); + $err_hint = str_replace("", $text, $err_hint); + // show + die($err_hint); + } die("We are sorry, but a MySQL - error occurred. The administrator may find more information in syslog with the ID ".$md5." or in the sql-error.log in the logs/ directory"); } } diff --git a/templates/Froxlor/misc/dberrornice.tpl b/templates/Froxlor/misc/dberrornice.tpl new file mode 100644 index 00000000..33d6d1ec --- /dev/null +++ b/templates/Froxlor/misc/dberrornice.tpl @@ -0,0 +1,47 @@ + + + + + + + + + + + + Froxlor Server Management Panel - Installation + + + +
+ +
+ + + diff --git a/templates/Sparkle/misc/dberrornice.tpl b/templates/Sparkle/misc/dberrornice.tpl new file mode 100644 index 00000000..cf3482e8 --- /dev/null +++ b/templates/Sparkle/misc/dberrornice.tpl @@ -0,0 +1,51 @@ + + + + + + + + + + + + Froxlor Server Management Panel - Database error + + + +
+ + + +
+ + +