From: Valerie Pond Date: Sun, 7 Jul 2024 23:30:27 +0000 (+0800) Subject: Add able to change background on overview X-Git-Url: https://jfr.im/git/irc/unrealircd/unrealircd-webpanel.git/commitdiff_plain/452b8eada34a0857aee8b5ea2a1dcb0a550626d3 Add able to change background on overview --- diff --git a/img/wallpaper.jpg b/img/wallpaper.jpg new file mode 100644 index 0000000..0fbfcbd Binary files /dev/null and b/img/wallpaper.jpg differ diff --git a/index.php b/index.php index 4d856a2..aa0a7d0 100644 --- a/index.php +++ b/index.php @@ -53,7 +53,7 @@ if (isset($current_user->user_meta['hibp'])) border-radius: 16px; } body { - background-image: url('https://cdn.wallpapersafari.com/34/98/yznZmQ.jpg'); + background-image: url('img/wallpaper.jpg'); background-size: cover; } .card-container .card-body i { diff --git a/settings/general.php b/settings/general.php index f035ba6..0cee9c8 100644 --- a/settings/general.php +++ b/settings/general.php @@ -18,16 +18,55 @@ if (isset($_POST['submit']) && $canEdit) if ($config['debug'] != $dbug) // we just toggled Message::Info("Debug Mode is now ".(($config['debug']) ? "enabled" : "disabled")); + + if (!empty($_FILES['customFile'])) + { + $cwd = getcwd(); + $a = split($cwd,'/'); + $a[sizeof($a) - 1] = NULL; + $cwd = glue($a,'/'); + $target_dir = "$cwd/img/"; + $target_file = "/$target_dir/wallpaper.jpg"; + $uploadOk = 1; + $imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION)); + $check = getimagesize($_FILES["customFile"]["tmp_name"]); + $errs = []; + + if($check == false) + { + $errs[] = "File is not an image."; + $uploadOk = 0; + } + else if ($_FILES["customFile"]["size"] > 500000) { + $errs[] = "File is too large."; + $uploadOk = 0; + } + elseif($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" + && $imageFileType != "gif" ) + { + $errs[] = "Only JPG, JPEG, PNG & GIF files are allowed."; + $uploadOk = 0; + } + if ($uploadOk != 0) { + if (file_exists($target_file)) + unlink($target_file); + move_uploaded_file($_FILES["customFile"]["tmp_name"], $target_file); + Message::Success("Updloaded file: $target_file"); + } + else Message::Fail($errs); + } + write_config(); unset($_POST['debug'], $_POST['submit'], $_POST['hibp']); Hook::run(HOOKTYPE_GENERAL_SETTINGS_POST, $_POST); } do_log("\$_POST", $_POST); +do_log("\$_FILES", $_FILES); ?>

General Settings


-
+
Password Data Leak Checks
@@ -44,7 +83,27 @@ do_log("\$_POST", $_POST);
Enabling this will likely make your webpanel more difficult to use
+ + +
+
Overview Background Image
+
+ + Might not show current image if caching is used. You'll notice the changes soon. + + +
+