From 5660317403edec2b5a5980b82084d1252e495f9f Mon Sep 17 00:00:00 2001 From: ruan Date: Sat, 9 Jan 2016 21:24:18 +0200 Subject: [PATCH] Updates - Remove namespaces for PHP 5.2 support - Rename "includes" to "inc" - Add database error handling and error pages --- bans.php | 5 +-- check.php | 8 +--- error/access-denied.php | 25 +++++++++++ error/tables-not-found.php | 33 +++++++++++++++ history.php | 12 ++---- {includes => inc}/css/bootstrap.css | 0 {includes => inc}/css/bootstrap.min.css | 0 {includes => inc}/css/custom.css | 0 .../fonts/glyphicons-halflings-regular.eot | Bin .../fonts/glyphicons-halflings-regular.svg | 0 .../fonts/glyphicons-halflings-regular.ttf | Bin .../fonts/glyphicons-halflings-regular.woff | Bin inc/footer.php | 3 ++ {includes => inc}/header.php | 13 ++---- {includes => inc}/img/console.png | Bin {includes => inc}/img/minecraft.ico | Bin {includes => inc}/js/bootstrap.js | 0 {includes => inc}/js/bootstrap.min.js | 0 {includes => inc}/js/jquery.js | 0 {includes => inc}/js/jquery.min.js | 0 {includes => inc}/page.php | 12 ++---- {includes => inc}/settings.php | 40 +++++++++++++++--- includes/footer.php | 3 -- index.php | 4 +- info.php | 6 +-- kicks.php | 5 +-- mutes.php | 5 +-- warnings.php | 5 +-- 28 files changed, 114 insertions(+), 65 deletions(-) create mode 100644 error/access-denied.php create mode 100644 error/tables-not-found.php rename {includes => inc}/css/bootstrap.css (100%) rename {includes => inc}/css/bootstrap.min.css (100%) rename {includes => inc}/css/custom.css (100%) rename {includes => inc}/fonts/glyphicons-halflings-regular.eot (100%) rename {includes => inc}/fonts/glyphicons-halflings-regular.svg (100%) rename {includes => inc}/fonts/glyphicons-halflings-regular.ttf (100%) rename {includes => inc}/fonts/glyphicons-halflings-regular.woff (100%) create mode 100644 inc/footer.php rename {includes => inc}/header.php (92%) rename {includes => inc}/img/console.png (100%) rename {includes => inc}/img/minecraft.ico (100%) rename {includes => inc}/js/bootstrap.js (100%) rename {includes => inc}/js/bootstrap.min.js (100%) rename {includes => inc}/js/jquery.js (100%) rename {includes => inc}/js/jquery.min.js (100%) rename {includes => inc}/page.php (98%) rename {includes => inc}/settings.php (78%) delete mode 100644 includes/footer.php diff --git a/bans.php b/bans.php index a569922..bbfad05 100644 --- a/bans.php +++ b/bans.php @@ -1,9 +1,6 @@ print_title(); diff --git a/check.php b/check.php index 0f4bf3e..7182bac 100644 --- a/check.php +++ b/check.php @@ -1,9 +1,5 @@ getMessage()); + Settings::handle_database_error($page->settings, $ex); } } diff --git a/error/access-denied.php b/error/access-denied.php new file mode 100644 index 0000000..2e2a03d --- /dev/null +++ b/error/access-denied.php @@ -0,0 +1,25 @@ + + + + + + + litebans-php - Database Error + + + +
+
+

Database Error


+ +
+ The web interface was unable to connect to the database using the configuration provided. +
+ Database error: Access denied +
+
+ Try Again +
+
+ + diff --git a/error/tables-not-found.php b/error/tables-not-found.php new file mode 100644 index 0000000..b05dd7e --- /dev/null +++ b/error/tables-not-found.php @@ -0,0 +1,33 @@ + + + + + + + litebans-php - Database Error + + + +
+
+

Database Error


+
+ The web interface has connected to the database, but could not find any tables generated by LiteBans. +
+ This means that the plugin has not successfully connected to this database before with the same configuration. +

+ Solutions: +
+ - Check the startup logs to see if there are any errors. +
+ - Ensure that the plugin is using the MySQL driver (not SQLite) to connect to the database. +
+ - Ensure that the table prefix is the same in config.yml and settings.php. +
+
+
+ Try Again +
+
+ + diff --git a/history.php b/history.php index 32f6261..baf372a 100644 --- a/history.php +++ b/history.php @@ -1,11 +1,5 @@ table_begin(); @@ -211,5 +205,5 @@ try { $page->print_footer(); } catch (PDOException $ex) { - die($ex->getMessage()); + Settings::handle_database_error($page->settings, $ex); } diff --git a/includes/css/bootstrap.css b/inc/css/bootstrap.css similarity index 100% rename from includes/css/bootstrap.css rename to inc/css/bootstrap.css diff --git a/includes/css/bootstrap.min.css b/inc/css/bootstrap.min.css similarity index 100% rename from includes/css/bootstrap.min.css rename to inc/css/bootstrap.min.css diff --git a/includes/css/custom.css b/inc/css/custom.css similarity index 100% rename from includes/css/custom.css rename to inc/css/custom.css diff --git a/includes/fonts/glyphicons-halflings-regular.eot b/inc/fonts/glyphicons-halflings-regular.eot similarity index 100% rename from includes/fonts/glyphicons-halflings-regular.eot rename to inc/fonts/glyphicons-halflings-regular.eot diff --git a/includes/fonts/glyphicons-halflings-regular.svg b/inc/fonts/glyphicons-halflings-regular.svg similarity index 100% rename from includes/fonts/glyphicons-halflings-regular.svg rename to inc/fonts/glyphicons-halflings-regular.svg diff --git a/includes/fonts/glyphicons-halflings-regular.ttf b/inc/fonts/glyphicons-halflings-regular.ttf similarity index 100% rename from includes/fonts/glyphicons-halflings-regular.ttf rename to inc/fonts/glyphicons-halflings-regular.ttf diff --git a/includes/fonts/glyphicons-halflings-regular.woff b/inc/fonts/glyphicons-halflings-regular.woff similarity index 100% rename from includes/fonts/glyphicons-halflings-regular.woff rename to inc/fonts/glyphicons-halflings-regular.woff diff --git a/inc/footer.php b/inc/footer.php new file mode 100644 index 0000000..2027265 --- /dev/null +++ b/inc/footer.php @@ -0,0 +1,3 @@ + + +"; ?> diff --git a/includes/header.php b/inc/header.php similarity index 92% rename from includes/header.php rename to inc/header.php index 03a18a7..7484097 100644 --- a/includes/header.php +++ b/inc/header.php @@ -1,8 +1,4 @@ $row['c_kicks'], ); } catch (PDOException $ex) { - die($ex->getMessage()); + Settings::handle_database_error($page->settings, $ex); } } } @@ -62,10 +58,10 @@ $settings = $this->page->settings; - + - - + + "; + + die; + } } diff --git a/includes/footer.php b/includes/footer.php deleted file mode 100644 index 1979518..0000000 --- a/includes/footer.php +++ /dev/null @@ -1,3 +0,0 @@ - - -"; ?> diff --git a/index.php b/index.php index 1689c83..00dcfdd 100644 --- a/index.php +++ b/index.php @@ -1,10 +1,8 @@ print_title(); - ?>
diff --git a/info.php b/info.php index c34899f..a914c48 100644 --- a/info.php +++ b/info.php @@ -1,9 +1,5 @@ print_title(); diff --git a/mutes.php b/mutes.php index a1dc2c4..8eae54e 100644 --- a/mutes.php +++ b/mutes.php @@ -1,9 +1,6 @@ print_title(); diff --git a/warnings.php b/warnings.php index 0c55ea1..fbab429 100644 --- a/warnings.php +++ b/warnings.php @@ -1,9 +1,6 @@ print_title();