This commit is contained in:
ruan 2016-07-05 12:19:24 +02:00
parent 570d1c762a
commit 2d519f6396
3 changed files with 32 additions and 1 deletions

28
error/outdated-plugin.php Normal file
View File

@ -0,0 +1,28 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<title>litebans-php - Outdated Plugin</title>
<link href="../inc/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="jumbotron">
<h2>Outdated Plugin</h2><br>
<div class="text-warning">
The web interface has connected to the database, but this database is managed by an older version of LiteBans.
<br>
You will need to update LiteBans before you can continue using the web interface. Older versions are not supported.
<br>
Updates can be downloaded here: https://www.spigotmc.org/resources/litebans.3715/
<br>
LiteBans will automatically upgrade the tables in the database after you have updated. After this, the web interface will work as normal.
</div>
<br>
<a href="../" class="btn btn-default">Try Again</a>
</div>
</div>
</body>
</html>

View File

@ -137,7 +137,7 @@ class Page {
// Under certain versions of PHP, there is a bug with BIT columns. // Under certain versions of PHP, there is a bug with BIT columns.
// An empty string is returned no matter what the value is. // An empty string is returned no matter what the value is.
// Workaround: cast to unsigned. // Workaround: cast to unsigned.
$selection = "id,uuid,reason,banned_by_name,banned_by_uuid,time,until,CAST(active AS UNSIGNED) AS active"; $selection = "id,uuid,reason,banned_by_name,banned_by_uuid,removed_by_name,time,until,CAST(active AS UNSIGNED) AS active";
if ($table === $this->settings->table['warnings']) { if ($table === $this->settings->table['warnings']) {
$selection .= ",CAST(warned AS UNSIGNED) AS warned"; $selection .= ",CAST(warned AS UNSIGNED) AS warned";
} }

View File

@ -146,6 +146,9 @@ final class Settings {
if (strstr($message, "Base table or view not found:")) { if (strstr($message, "Base table or view not found:")) {
$settings->redirect("error/tables-not-found.php"); $settings->redirect("error/tables-not-found.php");
} }
if (strstr($message, "Unknown column")) {
$settings->redirect("error/outdated-plugin.php");
}
} }
die('Database error: ' . $message); die('Database error: ' . $message);
} }