diff --git a/account.php b/account.php index 891bee0..cef34c7 100644 --- a/account.php +++ b/account.php @@ -192,7 +192,7 @@ @@ -208,6 +208,9 @@ +
".$user_time->format('Y-m-d H:i:s T')." (".$diff->time($user['last_modified']).")
"; if ($user['id'] == 1) { - ?> - - - - "; } else { ?> @@ -369,6 +368,7 @@ for (i = 0; i < tabcontent.length; i++) { tabcontent[i].style.height = "0"; tabcontent[i].style.overflow = "hidden"; + tabcontent[i].style.transform = "scale(0.9)"; } tablinks = document.getElementsByClassName("tablinks"); @@ -378,6 +378,7 @@ document.getElementById(tabName).style.height = "21rem"; document.getElementById(tabName).style.overflow = "scroll"; + document.getElementById(tabName).style.transform = "scale(1)"; evt.currentTarget.className += " active-tab"; } @@ -398,48 +399,49 @@ "; - - echo "Critical "; - - if ($result['fix'] == 'auto') { - echo "Auto fix available "; - } elseif ($result['fix'] == 'manual') { - echo "Manual fix required "; - } - - if (isset($result['link'])) { - echo "Recources "; - } - - echo $result['message']; - - echo ""; - } else { - echo ""; - - echo "Warning "; - - if ($result['fix'] == 'auto') { - echo "Auto fix available "; - } elseif ($result['fix'] == 'manual') { - echo "Manual fix required "; - } - - if (isset($result['link'])) { - echo "Recources "; - } - - echo $result['message']; - - echo "
"; + echo "+ Critical "; + } elseif ($result['type'] == 'warning') { + echo "
+ Warning "; } + + if ($result['fix'] == 'auto') { + echo "Auto fix available "; + } elseif ($result['fix'] == 'manual') { + echo "Manual fix required "; + } + + if (isset($result['link'])) { + echo "Recources "; + } + + echo $result['message']."
"; } - echo ""; + ?> + + +[INFO] Found images table
"; + } else { + echo "[INFO] Could not find images table
"; + echo "[INFO] Creating test table...
"; + + $sql = "CREATE TABLE IF NOT EXISTS images ( + id INT(11) AUTO_INCREMENT PRIMARY KEY, + imagename VARCHAR(255) NOT NULL, + alt VARCHAR(text) NOT NULL, + tags VARCHAR(text) NOT NULL, + author INT(11) NOT NULL, + last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + upload_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP + )"; + if ($conn->query($sql) === TRUE) { + echo "[INFO] Table images made!
"; + } + } + + if (check_database($conn, 'users')) { + echo "[INFO] Found users table
"; + } else { + echo "[INFO] Could not find users table
"; + echo "[INFO] Creating test table...
"; + + $sql = "CREATE TABLE IF NOT EXISTS users ( + id INT(11) AUTO_INCREMENT PRIMARY KEY, + username VARCHAR(255) NOT NULL UNIQUE, + password VARCHAR(255) NOT NULL, + pfp_path VARCHAR(255) NOT NULL, + admin BOOLEAN NOT NULL DEFAULT FALSE, + last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP + )"; + if ($conn->query($sql) === TRUE) { + echo "[INFO] Table users made!
"; + } + } + + if (check_database($conn, 'groups')) { + echo "[INFO] Found groups table
"; + } else { + echo "[INFO] Could not find groups table
"; + echo "[INFO] Creating test table...
"; + + $sql = "CREATE TABLE IF NOT EXISTS groups ( + id INT(11) AUTO_INCREMENT PRIMARY KEY, + group_name VARCHAR(255) NOT NULL, + image_list VARCHAR(text) NOT NULL, + last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP + )"; + if ($conn->query($sql) === TRUE) { + echo "[INFO] Table groups made!
"; + } + } + + if (check_database($conn, 'logs')) { + echo "[INFO] Found logs table
"; + } else { + echo "[INFO] Could not find logs table
"; + echo "[INFO] Creating test table...
"; + + $sql = "CREATE TABLE IF NOT EXISTS logs ( + id INT(11) AUTO_INCREMENT PRIMARY KEY, + ipaddress VARCHAR(16) NOT NULL, + action VARCHAR(255) NOT NULL, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP + )"; + if ($conn->query($sql) === TRUE) { + echo "[INFO] Table logs made!
"; + } + } + + if (check_database($conn, 'bans')) { + echo "[INFO] Found bans table
"; + } else { + echo "[INFO] Could not find bans table
"; + echo "[INFO] Creating test table...
"; + + $sql = "CREATE TABLE IF NOT EXISTS bans ( + id INT(11) AUTO_INCREMENT PRIMARY KEY, + ipaddress VARCHAR(16) NOT NULL, + reason VARCHAR(255) NOT NULL, + time TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + length VARCHAR(255) NOT NULL, + permanent BOOLEAN NOT NULL DEFAULT FALSE + )"; + if ($conn->query($sql) === TRUE) { + echo "[INFO] Table bans made!
"; + } + } + + if (check_database($conn, 'tokens')) { + echo "[INFO] Found tokens table
"; + } else { + echo "[INFO] Could not find tokens table
"; + echo "[INFO] Creating test table...
"; + + $sql = "CREATE TABLE IF NOT EXISTS tokens ( + id INT(11) AUTO_INCREMENT PRIMARY KEY, + code VARCHAR(59) NOT NULL, + used BOOLEAN NOT NULL DEFAULT FALSE, + timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + )"; + if ($conn->query($sql) === TRUE) { + echo "[INFO] Table tokens made!
"; + } + }*/ + + if (check_database($conn, 'test')) { + echo "[INFO] Found test table
"; + } else { + echo "[ERRO] Could not find test table
"; + echo "[INFO] Creating test table...
"; + } +} \ No newline at end of file diff --git a/app/sanity/folders.php b/app/sanity/folders.php new file mode 100644 index 0000000..6ffa94b --- /dev/null +++ b/app/sanity/folders.php @@ -0,0 +1,58 @@ +[INFO] Found usr/ folder!"; + } else { + echo "[ERRO] usr/ folder not found
"; + echo "[INFO] Creating usr/ folder...
"; + + mkdir("usr"); + } + + if (is_dir(__DIR__."/../../usr/images")) { + echo "[INFO] Found usr/images/ folder!
"; + } else { + echo "[ERRO] usr/images/ folder not found
"; + echo "[INFO] Creating usr/images/ folder...
"; + + mkdir("usr/images"); + } + if (!is_dir(__DIR__."/../../usr/images/thumbnails")) { + echo "[ERRO] usr/images/thumbnails/ folder not found
"; + echo "[INFO] Creating usr/images/thumbnails/ folder...
"; + + mkdir("usr/images/thumbnails"); + } + if (!is_dir(__DIR__."/../../usr/images/previews")) { + echo "[ERRO] usr/images/previews/ folder not found
"; + echo "[INFO] Creating usr/images/previews/ folder...
"; + + mkdir("usr/images/previews"); + } + + if (!is_dir(__DIR__."/../../usr/conf")) { + echo "[ERRO] usr/conf/ folder not found
"; + echo "[INFO] Creating usr/conf/ folder...
"; + + mkdir("usr/conf"); + } + + if (is_file(__DIR__."/../../usr/conf/conf.json")) { + echo "[INFO] Found usr/conf/conf.json file!
"; + } else { + echo "[ERRO] usr/conf/conf.json file not found
"; + echo "[INFO] Creating usr/conf/conf.json file...
"; + + try { + $conf = file_get_contents(__DIR__."/../../usr/conf.default.json"); + + if (file_put_contents(__DIR__."/../../usr/conf/conf.json", $conf)) { + echo "[INFO] usr/conf/conf.json file created!
"; + } else { + echo "[ERRO] Failed to create usr/conf/conf.json file
"; + } + } catch (Exception $e) { + echo "[ERRO] Could not read usr/conf.default.json file
"; + } + } +} \ No newline at end of file diff --git a/app/sanity/sanity.php b/app/sanity/sanity.php new file mode 100644 index 0000000..77abf97 --- /dev/null +++ b/app/sanity/sanity.php @@ -0,0 +1,42 @@ +[INFO] Starting autofix"; + + if ($_SESSION['id'] != 1) { + echo "[ERRO] You cannot use Autofix as an Admin currently.
"; + exit(); + } + + $check_sanity = $sanity->get_results(); + if (empty($check_sanity)) { + echo "[INFO] Sanity check passed. No errors found.
"; + exit(); + } else { + //echo "[WARN] Sanity check failed
"; + } + + define('ROOT', true); // Only run scripts from this file + + echo "==== Databases ====
"; + include_once "database.php"; + + echo "==== Folders ====
"; + include_once "folders.php"; + + $autofix_end = microtime(true); + $autofix_time = ($autofix_end - $autofix_start); + $autofix_time = round($autofix_time, 6) * 1000; + + echo "[INFO] Autofix complete in $autofix_time ms
"; +} \ No newline at end of file diff --git a/assets/ui/header.php b/assets/ui/header.php index ac1bd84..e99dd45 100644 --- a/assets/ui/header.php +++ b/assets/ui/header.php @@ -8,10 +8,16 @@ } ?> -