finally output a nice error-message on mysql-errors

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2013-10-13 12:59:43 +02:00
parent 4b5b2db6db
commit 92243991bc
3 changed files with 107 additions and 0 deletions

View File

@@ -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("<TEXT>", $errormsg, $err_hint);
$err_hint = str_replace("<DEBUG>", $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");
}
}

View File

@@ -0,0 +1,47 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="Default-Style" content="text/css" />
<link rel="stylesheet" href="templates/Froxlor/assets/css/main.css" />
<!--[if IE]><link rel="stylesheet" href="templates/Froxlor/assets/css/main_ie.css" /><![endif]-->
<!--[if lt IE 9]><script src="js/html5shiv.js"></script><![endif]-->
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="templates/Froxlor/assets/js/main.js"></script>
<link href="templates/Froxlor/assets/img/favicon.ico" rel="icon" type="image/x-icon" />
<title>Froxlor Server Management Panel - Installation</title>
<style type="text/css">
body {
font-family: Verdana, Geneva, sans-serif;
}
</style>
</head>
<body>
<div class="loginpage">
<article class="login bradius">
<header class="dark">
<img src="templates/Froxlor/assets/img/logo.png" alt="Froxlor Server Management Panel" />
</header>
<section class="loginsec">
<div class="errorcontainer bradius">
<div class="errortitle">A database error occured</div>
<div class="error">
<p><TEXT></p>
<p><DEBUG></p>
</div>
</div>
<p class="submit">
<a href="index.php" title="Click here to go back">Go to index</a>
</p>
</section>
</article>
</div>
<footer>
<span>
Froxlor &copy; 2009-2013 by <a href="http://www.froxlor.org/" rel="external">the Froxlor Team</a>
</span>
</footer>
</body>
</html>

51
templates/Sparkle/misc/dberrornice.tpl vendored Normal file
View File

@@ -0,0 +1,51 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="Default-Style" content="text/css" />
<link rel="stylesheet" href="templates/Sparkle/assets/css/main.css" />
<!--[if IE]><link rel="stylesheet" href="templates/Sparkle/assets/css/main_ie.css" /><![endif]-->
<!--[if lt IE 9]><script src="js/html5shiv.js"></script><![endif]-->
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="templates/Sparkle/assets/js/main.js"></script>
<link href="templates/Sparkle/assets/img/favicon.ico" rel="icon" type="image/x-icon" />
<title>Froxlor Server Management Panel - Database error</title>
<style type="text/css">
body {
font-family: Verdana, Geneva, sans-serif;
}
</style>
</head>
<body>
<div class="loginpage">
<article class="login bradius">
<header class="dark">
<img src="templates/Sparkle/assets/img/logo.png" alt="Froxlor Server Management Panel" />
</header>
<section class="loginsec">
<div class="errorcontainer bradius">
<div class="errortitle">A database error occured</div>
<div class="error">
<p><TEXT></p>
<p>&nbsp;</p>
<p><DEBUG></p>
<p>&nbsp;</p>
</div>
</div>
<aside class="right">
<a href="index.php" title="Click here to go back">Go to index</a>
</aside>
</section>
</article>
</div>
<footer>
<span>
Froxlor &copy; 2009-2013 by <a href="http://www.froxlor.org/" rel="external">the Froxlor Team</a>
</span>
</footer>
</body>
</html>