From 3fc505c312800cb6e4f8eca3cdb9855d340b4000 Mon Sep 17 00:00:00 2001
From: Horus3
Date: Thu, 18 Sep 2014 16:53:44 +0200
Subject: fixed invalid html
---
public_html/class/mysql.php | 8 +++++---
public_html/functions.php | 4 +++-
public_html/setup.php | 2 +-
3 files changed, 9 insertions(+), 5 deletions(-)
(limited to 'public_html')
diff --git a/public_html/class/mysql.php b/public_html/class/mysql.php
index 0031eec..d0c6949 100644
--- a/public_html/class/mysql.php
+++ b/public_html/class/mysql.php
@@ -12,7 +12,7 @@ class vfsdb {
try {
$this->db = new mysqli(DBHOST, DBUSER, DBPASSWORD, DBNAME);
} catch (Exception $e){
- failure($e->getMessage(), '
500 Server Failure
', false, 'Failed to open database.
');
+ failure("".$e->getMessage()."
", '500 Server Failure', false, 'Failed to open database connection.
');
}
if ( $this->db->connect_errno() ){
@@ -24,7 +24,7 @@ class vfsdb {
}
if ( ! $this->db->set_charset(DBCHARSET) ){
- failure("Can't set UTF-8 as a charset on your MySQL server.
" , '500 Server Failure', false, "Setting Charset failed!
");
+ failure("Can't set " . DBCHARSET . " as the charset on your MySQL server.
" , '500 Server Failure', false, "Setting Charset failed!
");
}
}
@@ -73,6 +73,7 @@ class vfsdb {
color_folder VARCHAR(70),
color_file VARCHAR(70))
ENGINE=InnoDB;';
+
$files_table =
'CREATE TABLE IF NOT EXISTS ' . DBPREFIX . 'files
( files_id INTEGER AUTO_INCREMENT NOT NULL, PRIMARY KEY(files_id),
@@ -90,6 +91,7 @@ class vfsdb {
FOREIGN KEY(files_id) REFERENCES user(id) ON DELETE CASCADE
)
ENGINE=InnoDB;';
+
$banned_user_table =
'CREATE TABLE IF NOT EXISTS ' . DBPREFIX . 'banned_user
( banned_id INTEGER AUTO_INCREMENT NOT NULL, PRIMARY KEY(banned_id),
@@ -102,7 +104,7 @@ class vfsdb {
ENGINE=InnoDB;';
if ( ! $this->db->query($user_table . ' ' . $files_table . ' ' . $banned_user_table) )
- failure("Setting up the database failed.
", '500 Server Failure', false, "CREATE TABLE FAILED");
+ failure("
There was a problem during bootstrapping the database schema. " . $this->db->error . "
", '500 Server Failure', false, "CREATE TABLE FAILED
");
}
public function __destruct(){
diff --git a/public_html/functions.php b/public_html/functions.php
index c185bd5..51979da 100644
--- a/public_html/functions.php
+++ b/public_html/functions.php
@@ -5,13 +5,15 @@ function failure($reason, $httpcode, $ajax = true, $heading = NULL){
# send header with $httpcode
header($_SERVER['SERVER_PROTOCOL'] . " " . $httpcode)
+ # just echo the reason to the ajax response
if($ajax){
- # just echo the reason to the ajax response
echo htmlentities($reason);
exit
}
// TODO: Put pretty HTML here, please
+
+ # print full error page
if($heading != NULL)
echo htmlentities($heading);
diff --git a/public_html/setup.php b/public_html/setup.php
index 74b0e10..8781a5f 100644
--- a/public_html/setup.php
+++ b/public_html/setup.php
@@ -6,7 +6,7 @@ $vfsdb = new vfsdb();
$vfsdb->createTables();
$vfsdb->close();
-echo "Successfully created the database.";
+echo "
Successfully created the database.
";
# rename this file to avoid setting up the tables twice
rename(ABSPATH . 'setup.php', ABSPATH . '_setup.php');
--
cgit v1.2.3