From 274707c80b58d2f03738e1e8071ec0a4c368ed77 Mon Sep 17 00:00:00 2001 From: Fluffy-Bean Date: Wed, 7 Sep 2022 09:41:18 +0000 Subject: [PATCH 01/47] File reordering in progress --- account/account.php => account.php | 24 +++++----- app/account/account.php | 42 ++++++++--------- {account => app/account}/logout.php | 4 +- app/server/secrete.php | 46 ++++++++++++++----- index.php | 3 -- .../password-reset.php => password-reset.php | 14 +++--- ui/nav.php | 4 +- 7 files changed, 79 insertions(+), 58 deletions(-) rename account/account.php => account.php (80%) rename {account => app/account}/logout.php (71%) rename account/password-reset.php => password-reset.php (74%) diff --git a/account/account.php b/account.php similarity index 80% rename from account/account.php rename to account.php index b8df11b..0e7be57 100644 --- a/account/account.php +++ b/account.php @@ -2,13 +2,13 @@ - +

Danger ahead

Resetting your password regularly is a good way of keeping your account safe

- Reset Password + Reset Password

Don't leave! I'm with the science team!

- Logout + Logout
- + - + @@ -328,7 +328,7 @@ if (isset($_POST['submit_signup'])) { } else { ?> + diff --git a/app/server/secrete.php b/app/server/secrete.php index d190cb1..06c036b 100644 --- a/app/server/secrete.php +++ b/app/server/secrete.php @@ -1,13 +1,37 @@ \ No newline at end of file diff --git a/index.php b/index.php index e97bc1c..0b0e949 100644 --- a/index.php +++ b/index.php @@ -15,9 +15,6 @@ include __DIR__."/ui/nav.php"; if (params.del == "true") { sniffleAdd("Image Deleted", "Successfully deleted image: ", "var(--green)", "assets/icons/trash.svg"); } - if (params.login == "success") { - sniffleAdd("Logged in", "O hi ", "var(--green)", "assets/icons/hand-waving.svg"); - }
diff --git a/account/password-reset.php b/password-reset.php similarity index 74% rename from account/password-reset.php rename to password-reset.php index 9fb6af8..961d629 100644 --- a/account/password-reset.php +++ b/password-reset.php @@ -2,18 +2,18 @@ - + @@ -26,7 +26,7 @@
- +
@@ -36,7 +36,7 @@ var new_passowrd = $("#newPassword").val(); var confirm_password = $("#confirmSassword").val(); var submit = $("#passwordSubmit").val(); - $("#sniffle").load("../app/account/password_reset.php", { + $("#sniffle").load("app/account/password_reset.php", { new_passowrd: new_passowrd, confirm_password: confirm_password, submit: submit @@ -44,7 +44,7 @@ }); - + \ No newline at end of file diff --git a/ui/nav.php b/ui/nav.php index ec8b258..4a7745c 100644 --- a/ui/nav.php +++ b/ui/nav.php @@ -11,9 +11,9 @@ if (loggedin()) { echo "Upload"; echo "
"; - echo "".substr($_SESSION["username"], 0, 15).""; + echo "".substr($_SESSION["username"], 0, 15).""; } else { - echo "Login"; + echo "Login"; } ?> From 051debfdf0aed29c3551287e74817c01ae06312c Mon Sep 17 00:00:00 2001 From: Fluffy-Bean Date: Wed, 7 Sep 2022 11:00:53 +0000 Subject: [PATCH 02/47] Text boxes prefilled with existing information --- image.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/image.php b/image.php index b657db2..117c4b6 100644 --- a/image.php +++ b/image.php @@ -274,6 +274,8 @@ "; flyoutShow(header, description, actionBox); + $('#descriptionInput').val(""); + $("#descriptionConfirm").submit(function(event) { event.preventDefault(); var descriptionInput = $("#descriptionInput").val(); @@ -308,6 +310,8 @@ "; flyoutShow(header, description, actionBox); + $('#tagsInput').val(""); + $("#tagsConfirm").submit(function(event) { event.preventDefault(); var tagsInput = $("#tagsInput").val(); From 5a6dc1a4b800193dde62fb79bf708bcc7ffcc24c Mon Sep 17 00:00:00 2001 From: Fluffy-Bean Date: Wed, 7 Sep 2022 13:40:58 +0000 Subject: [PATCH 03/47] Switched to textareas for easier typing --- css/main.css | 4 ++++ css/main.scss | 3 +++ image.php | 26 +++++++++++++------------- upload.php | 2 +- 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/css/main.css b/css/main.css index 2c2e2ee..d975b66 100644 --- a/css/main.css +++ b/css/main.css @@ -809,6 +809,10 @@ form > * { margin-bottom: 0.5rem; } +textarea { + resize: none; +} + /* |------------------------------------------------------------- | SVG diff --git a/css/main.scss b/css/main.scss index 5790ecf..a5c1468 100644 --- a/css/main.scss +++ b/css/main.scss @@ -134,6 +134,9 @@ form { } } +textarea { + resize: none; +} /* |------------------------------------------------------------- | SVG diff --git a/image.php b/image.php index 117c4b6..bec212c 100644 --- a/image.php +++ b/image.php @@ -239,8 +239,8 @@ var header = "Are you sure?"; var description = "Deleting this image is pernament, there is no going back after this!!!!!"; var actionBox = "
\ - \ -
"; + \ + "; flyoutShow(header, description, actionBox); $("#deleteConfirm").submit(function(event) { @@ -269,9 +269,9 @@ var header = "Enter new Description/Alt"; var description = "Whatcha gonna put in there 👀"; var actionBox = "
\ - \ - \ -
"; + \ + \ + "; flyoutShow(header, description, actionBox); $('#descriptionInput').val(""); @@ -305,12 +305,12 @@ var header = "Tags"; var description = "Add image tags here! This is still being tested so your tags may be removed later on. Tags ONLY accept, letters, numbers and underscores. Hyphens will be stitched to underscores and spaces will seperate the different tags from eachother"; var actionBox = "
\ - \ - \ -
"; + \ + \ + "; flyoutShow(header, description, actionBox); - - $('#tagsInput').val(""); + + $('#tagsInput').val(""); $("#tagsConfirm").submit(function(event) { event.preventDefault(); @@ -341,9 +341,9 @@ var header = "Who owns the image?????"; var description = "Enter ID of image owner"; var actionBox = "
\ - \ - \ -
"; + \ + \ + "; flyoutShow(header, description, actionBox); $("#authorConfirm").submit(function(event) { diff --git a/upload.php b/upload.php index 636ce56..8ae8a4d 100644 --- a/upload.php +++ b/upload.php @@ -70,7 +70,7 @@
- +
From d4e83dcb4aa59d9096e0b3132e413ad41cbfe7b6 Mon Sep 17 00:00:00 2001 From: Fluffy-Bean Date: Wed, 7 Sep 2022 14:29:53 +0000 Subject: [PATCH 04/47] Rename files on upload --- app/image/upload_image.php | 24 ++++++++++++------------ upload.php | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/app/image/upload_image.php b/app/image/upload_image.php index c0a2551..135826e 100644 --- a/app/image/upload_image.php +++ b/app/image/upload_image.php @@ -16,10 +16,10 @@ if (isset($_POST['submit'])) { $dir = "../../images/"; $thumb_dir = $dir."thumbnails/"; - // File paths - $image_basename = basename($_FILES['image']['name']); - $image_path = $dir.$image_basename; - $file_type = pathinfo($image_path,PATHINFO_EXTENSION); + // File name updating + $file_type = pathinfo($dir.$_FILES['image']['name'],PATHINFO_EXTENSION); + $image_newname = "IMG_".$_SESSION["username"]."_".round(microtime(true)).".".$file_type; + $image_path = $dir.$image_newname; // Allowed file types $allowed_types = array('jpg', 'jpeg', 'png', 'webp'); @@ -30,11 +30,11 @@ if (isset($_POST['submit'])) { try { $image_thumbnail = new Imagick($image_path); $image_thumbnail->resizeImage(300,null,null,1,null); - $image_thumbnail->writeImage($thumb_dir.$image_basename); + $image_thumbnail->writeImage($thumb_dir.$image_newname); } catch (Exception $e) { ?> assets/icons/file-search.svg'); + sniffleAdd('Gwha!', 'Pls provide image', 'var(--red)', 'assets/icons/file-search.svg'); } }); }); @@ -58,7 +58,7 @@ if (!loggedin()) { echo " "; } From d0afc5c8aaad644b00e9f3bbbb256df99e523436 Mon Sep 17 00:00:00 2001 From: Fluffy-Bean Date: Wed, 7 Sep 2022 18:19:17 +0000 Subject: [PATCH 05/47] Footer and image tidy tidy --- about.php | 24 +++++++++++++++++++----- css/main.css | 13 ------------- css/scss/_footer.scss | 3 --- image.php | 23 ++++++++++++----------- ui/footer.php | 13 +------------ 5 files changed, 32 insertions(+), 44 deletions(-) diff --git a/about.php b/about.php index 3f7ce90..c7312a7 100644 --- a/about.php +++ b/about.php @@ -13,19 +13,19 @@ ?>
-

What is Fluffys Amazing Gallery?

-

Fluffys Amazing Gallery is a smol project I originally started to control the images on my main page, but quickly turned into something much bigger...

+

What is this?

+

This Gallery is a smol project I originally started to control the images on my main page, but quickly turned into something much bigger...

What Do I want this to become in the future? No clue, but I do want this to be usable by others, if its a file they download a docker image they setup on your own web server.

Will it become that any time soon? No, but. I am going to work on this untill it becomes what I want it to be!


-

Can you add "A" or "B"?

+

Can you add "A" or "B"?

No.


-

How do I use this!

+

How do I use this!

First you must obtain the invite code. If you don't have one and are interested in trying this, feel free to DM me on Telegram!

But once you're done doing that, you can start making your account at the signup page here.

From there you should be able to go and login at this fancy page here!

@@ -33,7 +33,21 @@
-

Credits!

+

Where to find me

+ + + My website! + + + + Telegram + + + + Twitter + + +

Credits!

To Carty for being super cool again and helping me get started with SQL and PHP!

To Phosphor for providing nice SVG icons.

To mrHDash...

diff --git a/css/main.css b/css/main.css index d975b66..a2d88c4 100644 --- a/css/main.css +++ b/css/main.css @@ -666,26 +666,13 @@ nav .btn { |------------------------------------------------------------- */ footer { - margin-bottom: 1rem; - padding: 0.5rem; - width: calc(100% - 1.4rem); - background-color: #151515; - color: #E8E3E3; - border-radius: 0rem; - border: 0.2rem solid #8C977D; - box-shadow: 6px 6px 2px rgba(21, 21, 21, 0.5333333333); display: flex; flex-direction: row; flex-wrap: wrap; justify-content: space-around; margin: 0 auto; - bottom: 0; width: calc(100% - 1.4rem); } -footer > * { - margin-top: 0; - margin-bottom: 0.5rem; -} footer p { margin: 0 0.5rem; text-decoration: none; diff --git a/css/scss/_footer.scss b/css/scss/_footer.scss index dac9c4a..0f8ff7e 100644 --- a/css/scss/_footer.scss +++ b/css/scss/_footer.scss @@ -4,13 +4,10 @@ |------------------------------------------------------------- */ footer { - @include defaultDecoration($page-accent); @include flexLeft(space-around); margin: 0 auto; - bottom: 0; - width: calc(100% - 1.4rem); p { diff --git a/image.php b/image.php index bec212c..7fde9df 100644 --- a/image.php +++ b/image.php @@ -88,7 +88,7 @@ |------------------------------------------------------------- */ if (isset($image['imagename'])) { - $image_path = "images/" . $image['imagename']; + $image_path = "images/".$image['imagename']; $image_alt = $image['alt']; } else { $image_path = "assets/no_image.png"; @@ -148,32 +148,33 @@

Details

Author: " . $image_author . "

"; + echo "

Author: ".$image_author."

"; // Image ID - echo "

ID: " . $image['id'] . "

"; + echo "

ID: ".$image['id']."

"; // File name + $image_pathinfo = pathinfo($image['imagename']); if (strlen($image['imagename']) > 30) { - echo "

File Name: " . substr($image['imagename'], 0, 30) . "...

"; + echo "

File Name: ".substr($image_pathinfo['filename'], 0, 30)."...

"; } else { - echo "

File Name: " . $image['imagename'] . "

"; + echo "

File Name: ".$image_pathinfo['filename']."

"; } // File extention - echo "

File Type: " . pathinfo($image['imagename'], PATHINFO_EXTENSION) . "

"; + echo "

File Type: ".pathinfo($image['imagename'], PATHINFO_EXTENSION)."

"; // Image resolution list($width, $height) = getimagesize($image_path); - echo "

Image resolution: " . $width . "x" . $height . "

"; + echo "

Image resolution: ".$width."x".$height."

"; // Image Upload date - echo "

Last updated: +0 " . $image['upload'] . "

"; + echo "

Last updated: +0 ".$image['upload']."

"; echo "
"; // Image download - echo "Download image"; + echo "Download image"; // Copy image ?> @@ -198,9 +199,9 @@ $image_tags_array = explode(" ", $image['tags']); foreach ($image_tags_array as $tag) { if ($tag == "nsfw") { - echo "

" . $tag . "

"; + echo "

".$tag."

"; } else { - echo "

" . $tag . "

"; + echo "

".$tag."

"; } } } else { diff --git a/ui/footer.php b/ui/footer.php index be8d452..0814a39 100644 --- a/ui/footer.php +++ b/ui/footer.php @@ -1,12 +1,4 @@ From 8713a6321a5a11fd7e425f9794c63f4a83219ee0 Mon Sep 17 00:00:00 2001 From: Fluffy-Bean Date: Wed, 7 Sep 2022 22:16:43 +0000 Subject: [PATCH 06/47] Fixed that annoying bug with uneven gap in divs --- css/main.css | 25 +++++++++++++------------ css/scss/_mixin.scss | 2 +- css/scss/_navigation.scss | 1 + 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/css/main.css b/css/main.css index a2d88c4..3734153 100644 --- a/css/main.css +++ b/css/main.css @@ -28,7 +28,7 @@ */ nav { margin-bottom: 1rem; - padding: 0.5rem; + padding: 0.5rem 0.5rem 0 0.5rem; width: calc(100% - 1.4rem); background-color: #151515; color: #E8E3E3; @@ -40,6 +40,7 @@ nav { flex-wrap: wrap; justify-content: space-between; margin: 0 auto 1rem; + padding: 0.5rem; width: calc(100% - 1.4rem); height: 2.5rem; position: -webkit-sticky; @@ -298,7 +299,7 @@ nav .btn { .image-description { margin-bottom: 1rem; - padding: 0.5rem; + padding: 0.5rem 0.5rem 0 0.5rem; width: calc(100% - 1.4rem); background-color: #151515; color: #E8E3E3; @@ -326,7 +327,7 @@ nav .btn { .image-detail { margin-bottom: 1rem; - padding: 0.5rem; + padding: 0.5rem 0.5rem 0 0.5rem; width: calc(100% - 1.4rem); background-color: #151515; color: #E8E3E3; @@ -354,7 +355,7 @@ nav .btn { .tags-root { margin-bottom: 1rem; - padding: 0.5rem; + padding: 0.5rem 0.5rem 0 0.5rem; width: calc(100% - 1.4rem); background-color: #151515; color: #E8E3E3; @@ -402,7 +403,7 @@ nav .btn { .danger-zone { margin-bottom: 1rem; - padding: 0.5rem; + padding: 0.5rem 0.5rem 0 0.5rem; width: calc(100% - 1.4rem); background-color: #151515; color: #E8E3E3; @@ -435,7 +436,7 @@ nav .btn { */ .about-root { margin-bottom: 1rem; - padding: 0.5rem; + padding: 0.5rem 0.5rem 0 0.5rem; width: calc(100% - 1.4rem); background-color: #151515; color: #E8E3E3; @@ -468,7 +469,7 @@ nav .btn { */ .upload-root { margin-bottom: 1rem; - padding: 0.5rem; + padding: 0.5rem 0.5rem 0 0.5rem; width: calc(100% - 1.4rem); background-color: #151515; color: #E8E3E3; @@ -501,7 +502,7 @@ nav .btn { */ .account-root { margin-bottom: 1rem; - padding: 0.5rem; + padding: 0.5rem 0.5rem 0 0.5rem; width: calc(100% - 1.4rem); background-color: #151515; color: #E8E3E3; @@ -534,7 +535,7 @@ nav .btn { */ .signup-root { margin-bottom: 1rem; - padding: 0.5rem; + padding: 0.5rem 0.5rem 0 0.5rem; width: calc(100% - 1.4rem); background-color: #151515; color: #E8E3E3; @@ -568,7 +569,7 @@ nav .btn { */ .login-root { margin-bottom: 1rem; - padding: 0.5rem; + padding: 0.5rem 0.5rem 0 0.5rem; width: calc(100% - 1.4rem); background-color: #151515; color: #E8E3E3; @@ -601,7 +602,7 @@ nav .btn { */ .password-reset-root { margin-bottom: 1rem; - padding: 0.5rem; + padding: 0.5rem 0.5rem 0 0.5rem; width: calc(100% - 1.4rem); background-color: #151515; color: #E8E3E3; @@ -634,7 +635,7 @@ nav .btn { */ .search-root { margin-bottom: 1rem; - padding: 0.5rem; + padding: 0.5rem 0.5rem 0 0.5rem; width: calc(100% - 1.4rem); background-color: #151515; color: #E8E3E3; diff --git a/css/scss/_mixin.scss b/css/scss/_mixin.scss index 315f3a1..d0ae871 100644 --- a/css/scss/_mixin.scss +++ b/css/scss/_mixin.scss @@ -1,6 +1,6 @@ @mixin defaultDecoration($border) { margin-bottom: 1rem; - padding: 0.5rem; + padding: 0.5rem 0.5rem 0 0.5rem; width: calc(100% - 1.4rem); diff --git a/css/scss/_navigation.scss b/css/scss/_navigation.scss index 24a48c1..0ef6565 100644 --- a/css/scss/_navigation.scss +++ b/css/scss/_navigation.scss @@ -8,6 +8,7 @@ nav { @include flexLeft(space-between); margin: 0 auto 1rem; + padding: 0.5rem; width: calc(100% - 1.4rem); height: 2.5rem; From b261368a9bb032c593a2519b4244960e17cd9218 Mon Sep 17 00:00:00 2001 From: Fluffy-Bean Date: Thu, 8 Sep 2022 13:29:45 +0000 Subject: [PATCH 07/47] Adding Json config --- about.php | 8 +- account.php | 60 +++--- app/image/edit_author.php | 6 +- app/image/edit_description.php | 8 +- app/image/edit_tags.php | 8 +- app/server/conn.php | 24 ++- app/settings/settings.php | 29 +++ app/settings/user_settings.json | 50 +++++ css/main.css | 63 +++++- css/normalize.css | 349 -------------------------------- css/scss/_body.scss | 32 +-- default.json | 36 ---- image.php | 13 +- index.php | 23 ++- ui/header.php | 21 +- ui/nav.php | 12 +- ui/required.php | 54 ++--- upload.php | 8 +- 18 files changed, 285 insertions(+), 519 deletions(-) create mode 100644 app/settings/settings.php create mode 100644 app/settings/user_settings.json delete mode 100644 css/normalize.css delete mode 100644 default.json diff --git a/about.php b/about.php index c7312a7..a50808e 100644 --- a/about.php +++ b/about.php @@ -2,14 +2,14 @@ - +
@@ -53,7 +53,7 @@

To mrHDash...

- + \ No newline at end of file diff --git a/account.php b/account.php index 0e7be57..2c9d141 100644 --- a/account.php +++ b/account.php @@ -15,34 +15,48 @@ if (isset($_SESSION["loggedin"]) && $_SESSION["loggedin"] === true) { ?> +
+ +
+

Admin controlls

+
+

Invite Codes

+ +
+ + + +
+

Database info

+ Address: ".$database['ip'].":".$database['port']."

"; + echo "

Username: ".$database['username']."

"; + echo "

Password: Not displayed

"; + echo "

Database: ".$database['database']."

"; + ?> +
+ diff --git a/app/image/edit_author.php b/app/image/edit_author.php index f1263c6..2d3f52f 100644 --- a/app/image/edit_author.php +++ b/app/image/edit_author.php @@ -28,14 +28,14 @@ if (isset($_POST['submit'])) { if (mysqli_stmt_execute($stmt)) { ?> connect_error) { - echo ""; + ?> + + data as $settings_list) { + foreach ($settings_list->website as $website) { + foreach ($website->database as $database) { + + } + foreach ($website->debug as $debug) { + + } + foreach ($website->plugins as $plugins) { + + } + } +} +$database = $user_settings["website"]["database"]; +$debug = $user_settings["website"]["debug"]; +$plugins = $user_settings["website"]["plugins"]; diff --git a/app/settings/user_settings.json b/app/settings/user_settings.json new file mode 100644 index 0000000..944bc95 --- /dev/null +++ b/app/settings/user_settings.json @@ -0,0 +1,50 @@ +{ + "website": { + "name": "Only Legs", + "description": "A simple gallery with multiple users in mind", + "welcome_msg": [ + "*internal screaming*", + "Don't forget to drink water!", + "Bruh", + "Fluffy made this!", + "maybe", + "I'm gay", + "I wish we were better strangers.", + "Just like Minecraft!", + "If I were you, I'd run now", + "This is the part where I kill you", + "SILICA GEL \"DO NOT EAT\".", + "This was supposed to be a simple project", + "AAAAAAAAAAAAAAAAAAAA", + "Let me out", + "nice", + "I'm glad you're here", + "The weather is dry", + "Need me a man 👀", + "Gods die too.", + "Eat hotchip and lie" + ], + "license":"GPL 3.0", + "database": { + "ip": "192.168.0.79", + "port": "3306", + "username": "uwu", + "password": "fennec621", + "database": "gallery" + }, + "debug": { + "testing": true, + "version": "22.09.08" + } + }, + "plugins": { + "sniffle": { + "location": "Sniffle/sniffle.js", + "using": true + }, + "flyout": { + "location": "Flyout/flyout.js", + "using": true + } + } +} \ No newline at end of file diff --git a/css/main.css b/css/main.css index 3734153..a3b2265 100644 --- a/css/main.css +++ b/css/main.css @@ -172,6 +172,31 @@ nav .btn { margin-bottom: 1rem; } +.gallery-order { + margin-bottom: 1rem; + display: flex; + flex-direction: row; +} +.gallery-order h1, +.gallery-order h2, +.gallery-order h3, +.gallery-order h4, +.gallery-order h5 { + font-family: "Lexend Deca", sans-serif; +} +.gallery-order p, +.gallery-order a, +.gallery-order button, +.gallery-order input { + font-family: "Secular One", sans-serif; +} +.gallery-order > * { + margin-right: 0.5rem; +} +.gallery-order > *:last-child { + margin-right: 0; +} + .gallery-root { margin-bottom: 1rem; padding: 0.25rem; @@ -528,11 +553,34 @@ nav .btn { font-family: "Secular One", sans-serif; } -/* - |------------------------------------------------------------- - | SIGNUP - |------------------------------------------------------------- -*/ +.admin-root { + margin-bottom: 1rem; + padding: 0.5rem 0.5rem 0 0.5rem; + width: calc(100% - 1.4rem); + background-color: #151515; + color: #E8E3E3; + border-radius: 0rem; + border: 0.2rem solid #8C977D; + box-shadow: 6px 6px 2px rgba(21, 21, 21, 0.5333333333); +} +.admin-root > * { + margin-top: 0; + margin-bottom: 0.5rem; +} +.admin-root h1, +.admin-root h2, +.admin-root h3, +.admin-root h4, +.admin-root h5 { + font-family: "Lexend Deca", sans-serif; +} +.admin-root p, +.admin-root a, +.admin-root button, +.admin-root input { + font-family: "Secular One", sans-serif; +} + .signup-root { margin-bottom: 1rem; padding: 0.5rem 0.5rem 0 0.5rem; @@ -562,11 +610,6 @@ nav .btn { font-family: "Secular One", sans-serif; } -/* - |------------------------------------------------------------- - | LOGIN - |------------------------------------------------------------- -*/ .login-root { margin-bottom: 1rem; padding: 0.5rem 0.5rem 0 0.5rem; diff --git a/css/normalize.css b/css/normalize.css deleted file mode 100644 index 192eb9c..0000000 --- a/css/normalize.css +++ /dev/null @@ -1,349 +0,0 @@ -/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */ - -/* Document - ========================================================================== */ - -/** - * 1. Correct the line height in all browsers. - * 2. Prevent adjustments of font size after orientation changes in iOS. - */ - -html { - line-height: 1.15; /* 1 */ - -webkit-text-size-adjust: 100%; /* 2 */ -} - -/* Sections - ========================================================================== */ - -/** - * Remove the margin in all browsers. - */ - -body { - margin: 0; -} - -/** - * Render the `main` element consistently in IE. - */ - -main { - display: block; -} - -/** - * Correct the font size and margin on `h1` elements within `section` and - * `article` contexts in Chrome, Firefox, and Safari. - */ - -h1 { - font-size: 2em; - margin: 0.67em 0; -} - -/* Grouping content - ========================================================================== */ - -/** - * 1. Add the correct box sizing in Firefox. - * 2. Show the overflow in Edge and IE. - */ - -hr { - box-sizing: content-box; /* 1 */ - height: 0; /* 1 */ - overflow: visible; /* 2 */ -} - -/** - * 1. Correct the inheritance and scaling of font size in all browsers. - * 2. Correct the odd `em` font sizing in all browsers. - */ - -pre { - font-family: monospace, monospace; /* 1 */ - font-size: 1em; /* 2 */ -} - -/* Text-level semantics - ========================================================================== */ - -/** - * Remove the gray background on active links in IE 10. - */ - -a { - background-color: transparent; -} - -/** - * 1. Remove the bottom border in Chrome 57- - * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari. - */ - -abbr[title] { - border-bottom: none; /* 1 */ - text-decoration: underline; /* 2 */ - text-decoration: underline dotted; /* 2 */ -} - -/** - * Add the correct font weight in Chrome, Edge, and Safari. - */ - -b, -strong { - font-weight: bolder; -} - -/** - * 1. Correct the inheritance and scaling of font size in all browsers. - * 2. Correct the odd `em` font sizing in all browsers. - */ - -code, -kbd, -samp { - font-family: monospace, monospace; /* 1 */ - font-size: 1em; /* 2 */ -} - -/** - * Add the correct font size in all browsers. - */ - -small { - font-size: 80%; -} - -/** - * Prevent `sub` and `sup` elements from affecting the line height in - * all browsers. - */ - -sub, -sup { - font-size: 75%; - line-height: 0; - position: relative; - vertical-align: baseline; -} - -sub { - bottom: -0.25em; -} - -sup { - top: -0.5em; -} - -/* Embedded content - ========================================================================== */ - -/** - * Remove the border on images inside links in IE 10. - */ - -img { - border-style: none; -} - -/* Forms - ========================================================================== */ - -/** - * 1. Change the font styles in all browsers. - * 2. Remove the margin in Firefox and Safari. - */ - -button, -input, -optgroup, -select, -textarea { - font-family: inherit; /* 1 */ - font-size: 100%; /* 1 */ - line-height: 1.15; /* 1 */ - margin: 0; /* 2 */ -} - -/** - * Show the overflow in IE. - * 1. Show the overflow in Edge. - */ - -button, -input { /* 1 */ - overflow: visible; -} - -/** - * Remove the inheritance of text transform in Edge, Firefox, and IE. - * 1. Remove the inheritance of text transform in Firefox. - */ - -button, -select { /* 1 */ - text-transform: none; -} - -/** - * Correct the inability to style clickable types in iOS and Safari. - */ - -button, -[type="button"], -[type="reset"], -[type="submit"] { - -webkit-appearance: button; -} - -/** - * Remove the inner border and padding in Firefox. - */ - -button::-moz-focus-inner, -[type="button"]::-moz-focus-inner, -[type="reset"]::-moz-focus-inner, -[type="submit"]::-moz-focus-inner { - border-style: none; - padding: 0; -} - -/** - * Restore the focus styles unset by the previous rule. - */ - -button:-moz-focusring, -[type="button"]:-moz-focusring, -[type="reset"]:-moz-focusring, -[type="submit"]:-moz-focusring { - outline: 1px dotted ButtonText; -} - -/** - * Correct the padding in Firefox. - */ - -fieldset { - padding: 0.35em 0.75em 0.625em; -} - -/** - * 1. Correct the text wrapping in Edge and IE. - * 2. Correct the color inheritance from `fieldset` elements in IE. - * 3. Remove the padding so developers are not caught out when they zero out - * `fieldset` elements in all browsers. - */ - -legend { - box-sizing: border-box; /* 1 */ - color: inherit; /* 2 */ - display: table; /* 1 */ - max-width: 100%; /* 1 */ - padding: 0; /* 3 */ - white-space: normal; /* 1 */ -} - -/** - * Add the correct vertical alignment in Chrome, Firefox, and Opera. - */ - -progress { - vertical-align: baseline; -} - -/** - * Remove the default vertical scrollbar in IE 10+. - */ - -textarea { - overflow: auto; -} - -/** - * 1. Add the correct box sizing in IE 10. - * 2. Remove the padding in IE 10. - */ - -[type="checkbox"], -[type="radio"] { - box-sizing: border-box; /* 1 */ - padding: 0; /* 2 */ -} - -/** - * Correct the cursor style of increment and decrement buttons in Chrome. - */ - -[type="number"]::-webkit-inner-spin-button, -[type="number"]::-webkit-outer-spin-button { - height: auto; -} - -/** - * 1. Correct the odd appearance in Chrome and Safari. - * 2. Correct the outline style in Safari. - */ - -[type="search"] { - -webkit-appearance: textfield; /* 1 */ - outline-offset: -2px; /* 2 */ -} - -/** - * Remove the inner padding in Chrome and Safari on macOS. - */ - -[type="search"]::-webkit-search-decoration { - -webkit-appearance: none; -} - -/** - * 1. Correct the inability to style clickable types in iOS and Safari. - * 2. Change font properties to `inherit` in Safari. - */ - -::-webkit-file-upload-button { - -webkit-appearance: button; /* 1 */ - font: inherit; /* 2 */ -} - -/* Interactive - ========================================================================== */ - -/* - * Add the correct display in Edge, IE 10+, and Firefox. - */ - -details { - display: block; -} - -/* - * Add the correct display in all browsers. - */ - -summary { - display: list-item; -} - -/* Misc - ========================================================================== */ - -/** - * Add the correct display in IE 10+. - */ - -template { - display: none; -} - -/** - * Add the correct display in IE 10. - */ - -[hidden] { - display: none; -} diff --git a/css/scss/_body.scss b/css/scss/_body.scss index 219618f..95072f3 100644 --- a/css/scss/_body.scss +++ b/css/scss/_body.scss @@ -26,6 +26,22 @@ } } +.gallery-order { + @include defaultFont(); + + margin-bottom: 1rem; + + display: flex; + flex-direction: row; + + & > * { + margin-right: 0.5rem; + } + & > *:last-child { + margin-right: 0; + } +} + .gallery-root { margin-bottom: 1rem; padding: 0.25rem; @@ -263,24 +279,16 @@ @include defaultDecoration($green); @include defaultFont(); } - -/* - |------------------------------------------------------------- - | SIGNUP - |------------------------------------------------------------- -*/ +.admin-root { + @include defaultDecoration($green); + @include defaultFont(); +} .signup-root { @include defaultDecoration($green); @include defaultFont(); // By default its hidden, in place is login display: none; } - -/* - |------------------------------------------------------------- - | LOGIN - |------------------------------------------------------------- -*/ .login-root { @include defaultDecoration($green); @include defaultFont(); diff --git a/default.json b/default.json deleted file mode 100644 index 9c531dd..0000000 --- a/default.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "Only Legs", - "description": "A simple gallery with multiple users in mind", - "welcome_msg": [ - "*internal screaming*", - "Don't forget to drink water!", - "Bruh", - "Fluffy made this!", - "maybe", - "I'm gay", - "I wish we were better strangers.", - "Just like Minecraft!", - "If I were you, I'd run now", - "This is the part where I kill you", - "SILICA GEL \"DO NOT EAT\".", - "This was supposed to be a simple project", - "AAAAAAAAAAAAAAAAAAAA", - "Let me out", - "nice", - "I'm glad you're here", - "The weather is dry", - "Need me a man 👀", - "Gods die too.", - "Eat hotchip and lie" - ], - "database": { - "ip": "192.168.0.79", - "port": "3306", - "username": "uwu", - "password": "fennec621", - "database": "gallery" - }, - "testing": true, - "version": "15.08.22", - "license":"GPL 3.0" -} \ No newline at end of file diff --git a/image.php b/image.php index 7fde9df..c7a32cc 100644 --- a/image.php +++ b/image.php @@ -2,7 +2,7 @@ - + @@ -18,8 +18,13 @@ | many rewrites and hours of learning.... |------------------------------------------------------------- */ - include __DIR__."/ui/required.php"; - include __DIR__."/ui/nav.php"; + include "ui/required.php"; + include "ui/nav.php"; + + include "app/image/get_image_info.php"; + include "app/image/image_privilage.php"; + + include "app/format/string_to_tags.php"; /* @@ -372,7 +377,7 @@ } ?> - + \ No newline at end of file diff --git a/index.php b/index.php index 0b0e949..8d8d2e0 100644 --- a/index.php +++ b/index.php @@ -2,18 +2,18 @@ - + @@ -40,14 +40,19 @@ include __DIR__."/ui/nav.php"; } // Random welcome message - $import_welcome = file_get_contents("default.json"); - $import_decode = json_decode($import_welcome, true); - $welcome_message = $import_decode['welcome_msg']; + $welcome_message = $user_settings['website']['welcome_msg']; echo "

".$welcome_message[array_rand($welcome_message, 1)]."

"; ?> - From 951871b9836fbd9d2fecbddc351251fc87b5f269 Mon Sep 17 00:00:00 2001 From: Fluffy-Bean Date: Sat, 10 Sep 2022 08:37:01 +0000 Subject: [PATCH 13/47] Fixes here and there --- app/image/upload_image.php | 4 ++-- css/main.css | 1 + css/scss/_body.scss | 2 ++ ui/required.php | 3 +++ upload.php | 3 ++- 5 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/image/upload_image.php b/app/image/upload_image.php index cfba1b4..f8b0660 100644 --- a/app/image/upload_image.php +++ b/app/image/upload_image.php @@ -44,8 +44,8 @@ if (isset($_POST['submit'])) { 1000) { - $make_preview = make_thumbnail($image_path, $preview_dir.$image_newname, 1000); + if ($width > 1100) { + $make_preview = make_thumbnail($image_path, $preview_dir.$image_newname, 900); if ($make_preview != "success") { ?> resizeImage($resolution,null,null,1,null); + $thumbnail->writeImage($thumbnail_path); + + return "success"; + } catch (Exception $e) { + return $e; + } + } + + /* + Clean up long text input and turn into an array for tags + + Returns clean string of words with equal white space between it + */ + function tags($string) { + // Replace hyphens + $string = str_replace('-', '_', $string); + // Regex + $string = preg_replace('/[^A-Za-z0-9\_ ]/', '', $string); + // Change to lowercase + $string = strtolower($string); + // Removing extra spaces + $string = preg_replace('/ +/', ' ', $string); + + return $string; + } +} + +class Account { + /* + Check if user is loggedin + + Returns True if user is + Returns False if user is NOT + */ + function is_loggedin() { + if (isset($_SESSION["loggedin"]) && $_SESSION["loggedin"] === true) { + return True; + } else { + return False; + } + } + /* + Get full user info from database + + Returns array with user info + */ + function get_user_info($conn, $id) { + // Setting SQL query + $sql = "SELECT * FROM users WHERE id = ".$id; + // Getting results + $query = mysqli_query($conn, $sql); + // Fetching associated info + $user_array = mysqli_fetch_assoc($query); + + return($user_array); + } + /* + Check if user is admin + + Returns True if user is privilaged + Returns False if user is NOT privilaged + */ + function is_admin($id) { + if (isset($id) || !empty($id)) { + if ($id == 1) { + return True; + } else { + return False; + } + } else { + return False; + } + } +} + +class Image { + /* + Get full image info from database + + Returns array with image info + */ + function get_image_info($conn, $id) { + // Setting SQL query + $sql = "SELECT * FROM swag_table WHERE id = ".$id; + // Getting results + $query = mysqli_query($conn, $sql); + // Fetching associated info + $image_array = mysqli_fetch_assoc($query); + + return($image_array); + } + /* + Check if user is image owner + + Returns True if user is privilaged + Returns False if user is NOT privilaged + */ + function image_privilage($id) { + $session_id = $_SESSION['id']; + if (isset($session_id) || !empty($session_id)) { + if ($session_id == $id) { + return True; + } else { + return False; + } + } else { + return False; + } + } + +} diff --git a/app/format/create_thumbnail.php b/app/format/create_thumbnail.php deleted file mode 100644 index 92debfc..0000000 --- a/app/format/create_thumbnail.php +++ /dev/null @@ -1,20 +0,0 @@ -resizeImage($resolution,null,null,1,null); - $thumbnail->writeImage($thumbnail_path); - - return "success"; - } catch (Exception $e) { - return $e; - } -} \ No newline at end of file diff --git a/app/format/string_to_tags.php b/app/format/string_to_tags.php deleted file mode 100644 index 0c8d2a5..0000000 --- a/app/format/string_to_tags.php +++ /dev/null @@ -1,18 +0,0 @@ -get_image_info($conn, $_POST['id']); // If user owns image or has the ID of 1 - if (image_privilage($image_array['author']) || $_SESSION['id'] == 1) { + if ($image_info->image_privilage($image_array['author']) || $_SESSION['id'] == 1) { // Delete from table $sql = "DELETE FROM swag_table WHERE id = ?"; if ($stmt = mysqli_prepare($conn, $sql)) { @@ -92,9 +96,9 @@ if (isset($_POST['submit_delete'])) { */ if (isset($_POST['submit_description'])) { // Get all image info - $image_array = get_image_info($conn, $_POST['id']); + $image_array = $image_info->get_image_info($conn, $_POST['id']); // If user owns image or has the ID of 1 - if (image_privilage($image_array['author']) || $_SESSION['id'] == 1) { + if ($image_info->image_privilage($image_array['author']) || $_SESSION['id'] == 1) { // getting ready forSQL asky asky $sql = "UPDATE swag_table SET alt=? WHERE id=?"; @@ -150,11 +154,11 @@ if (isset($_POST['submit_description'])) { */ if (isset($_POST['submit_tags'])) { // Get all image info - $image_array = get_image_info($conn, $_POST['id']); + $image_array = $image_info->get_image_info($conn, $_POST['id']); // If user owns image or has the ID of 1 - if (image_privilage($image_array['author']) || $_SESSION['id'] == 1) { + if ($image_info->image_privilage($image_array['author']) || $_SESSION['id'] == 1) { // Clean input - $tags_string = tag_clean(trim($_POST['input'])); + $tags_string = $make_stuff->tags(trim($_POST['input'])); // getting ready forSQL asky asky $sql = "UPDATE swag_table SET tags=? WHERE id=?"; @@ -211,7 +215,7 @@ if (isset($_POST['submit_tags'])) { */ if (isset($_POST['submit_author'])) { // If user has the ID of 1 - if ($_SESSION['id'] == 1) { + if ($user_info->is_admin($_SESSION['id'])) { // getting ready forSQL asky asky $sql = "UPDATE swag_table SET author=? WHERE id=?"; diff --git a/app/image/image_privilage.php b/app/image/image_privilage.php deleted file mode 100644 index 439e3fa..0000000 --- a/app/image/image_privilage.php +++ /dev/null @@ -1,19 +0,0 @@ -tags(trim($_POST['tags'])); // Allowed file types $allowed_types = array('jpg', 'jpeg', 'png', 'webp'); @@ -35,7 +38,7 @@ if (isset($_POST['submit'])) { // Attempt making a thumbnail list($width, $height) = getimagesize($image_path); if ($width > 300) { - $make_thumbnail = make_thumbnail($image_path, $thumb_dir.$image_newname, 300); + $make_stuff->thumbnail($image_path, $thumb_dir.$image_newname, 300); if ($make_thumbnail != "success") { ?> - - get_user_info($conn, $image['author']); if (isset($user['username'])) { $image_author = $user['username']; @@ -123,7 +123,7 @@ | Check user privilge |------------------------------------------------------------- */ - if (image_privilage($image['author']) || is_admin($_SESSION['id'])) { + if ($image_info->image_privilage($image['author']) || $user_info->is_admin($_SESSION['id'])) { $privilaged = True; } else { $privilaged = False; @@ -363,7 +363,7 @@ |------------------------------------------------------------- --> is_admin($_SESSION['id'])) { ?> + + - "; + if (!$user_info->is_loggedin()) { + ?> + + From b5375414bc8991e9c3ea4bc16149d11afcfd584d Mon Sep 17 00:00:00 2001 From: Fluffy-Bean Date: Mon, 12 Sep 2022 14:30:57 +0000 Subject: [PATCH 15/47] Fixed Make error in thumbnail generation --- app/app.php | 4 ++-- app/image/upload_image.php | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/app/app.php b/app/app.php index f86a6fa..ce0d1a9 100644 --- a/app/app.php +++ b/app/app.php @@ -12,12 +12,12 @@ class Make { */ function thumbnail($image_path, $thumbnail_path, $resolution) { try { - $thumbnail = new Imagick($image_path); + $thumbnail = new \Imagick($image_path); $thumbnail->resizeImage($resolution,null,null,1,null); $thumbnail->writeImage($thumbnail_path); return "success"; - } catch (Exception $e) { + } catch (\Exception $e) { return $e; } } diff --git a/app/image/upload_image.php b/app/image/upload_image.php index 2ed2af0..7d1bfe8 100644 --- a/app/image/upload_image.php +++ b/app/image/upload_image.php @@ -38,8 +38,7 @@ if (isset($_POST['submit'])) { // Attempt making a thumbnail list($width, $height) = getimagesize($image_path); if ($width > 300) { - $make_stuff->thumbnail($image_path, $thumb_dir.$image_newname, 300); - if ($make_thumbnail != "success") { + if ($make_stuff->thumbnail($image_path, $thumb_dir.$image_newname, 300) != "success") { ?>
"; flyoutShow(header, description, actionBox); - $('#descriptionInput').val(""); - + $('#descriptionInput').val(""); + $("#descriptionConfirm").submit(function(event) { event.preventDefault(); var descriptionInput = $("#descriptionInput").val(); diff --git a/ui/required.php b/ui/required.php index a33c97f..abe437a 100644 --- a/ui/required.php +++ b/ui/required.php @@ -42,7 +42,7 @@ include "app/server/secrete.php"; /* Classes */ -include 'app/app.php'; +require_once 'app/app.php'; ?> diff --git a/app/image/upload_image.php b/app/image/upload_image.php index 7d1bfe8..8c7d19c 100644 --- a/app/image/upload_image.php +++ b/app/image/upload_image.php @@ -8,8 +8,8 @@ */ session_start(); // Include server connection -include "../server/conn.php"; -include "../app.php"; +include dirname(__DIR__)."/server/conn.php"; +include dirname(__DIR__)."/app.php"; use App\Make; diff --git a/app/server/conn.php b/app/server/conn.php index e2fd8c8..c764677 100644 --- a/app/server/conn.php +++ b/app/server/conn.php @@ -9,11 +9,6 @@ $conn_username = "uwu"; $conn_password = "fennec621"; $conn_database = "gallery"; -/* - echo $_SERVER['DOCUMENT_ROOT'].dirname($_SERVER['SCRIPT_NAME']); - echo $_SERVER['PHP_SELF']; -*/ - $conn = mysqli_connect($conn_ip, $conn_username, $conn_password , $conn_database); if ($conn->connect_error) { ?> diff --git a/app/server/secrete.php b/app/server/secrete.php index 06c036b..029c3ea 100644 --- a/app/server/secrete.php +++ b/app/server/secrete.php @@ -1,16 +1,4 @@ - + \ No newline at end of file diff --git a/search.php b/search.php deleted file mode 100644 index c7875fd..0000000 --- a/search.php +++ /dev/null @@ -1,48 +0,0 @@ - 0) { - // Getting thumbnail - if (file_exists("images/thumbnails/".$image['imagename'])) { - $image_path = "images/thumbnails/".$image['imagename']; - } else { - $image_path = "images/".$image['imagename']; - } - - // Image loading - echo ""; - } -}*/ -?> - - - - - - - - - - - -
-

Where did the search go!

-

Due to how it was implemented originally, it was hard to handle and work with. So I removed it.

-

It'll be coming back, but since it's going to be a lot of work it'll have to be much later.

-
- - - - diff --git a/ui/footer.php b/ui/footer.php index 0814a39..38b7792 100644 --- a/ui/footer.php +++ b/ui/footer.php @@ -1,10 +1,10 @@
- - + + Github - - + + About diff --git a/ui/nav.php b/ui/nav.php index eaf7917..ffb0cfb 100644 --- a/ui/nav.php +++ b/ui/nav.php @@ -11,8 +11,6 @@ $loggedin = new Account(); + diff --git a/app/account/account.php b/app/account/account.php index 6ffafad..661b66e 100644 --- a/app/account/account.php +++ b/app/account/account.php @@ -1,6 +1,12 @@ get_ip(); /* |------------------------------------------------------------- @@ -85,12 +91,15 @@ if (isset($_POST['submit_login'])) { //window.location.href = "../index.php?login=success"; @@ -237,6 +247,7 @@ if (isset($_POST['submit_signup'])) { sniffleAdd('smelly', 'Enter Invite Code ;3', 'var(--red)', 'assets/icons/cross.svg'); - * { +.error-root > * { margin-top: 0; margin-bottom: 0.5rem; } -.search-root h1, -.search-root h2, -.search-root h3, -.search-root h4, -.search-root h5 { +.error-root h1, +.error-root h2, +.error-root h3, +.error-root h4, +.error-root h5 { font-family: "Lexend Deca", sans-serif; } -.search-root p, -.search-root a, -.search-root button, -.search-root input { +.error-root p, +.error-root a, +.error-root button, +.error-root input { font-family: "Secular One", sans-serif; } diff --git a/css/scss/_body.scss b/css/scss/_body.scss index 5474a9f..4f22d6e 100644 --- a/css/scss/_body.scss +++ b/css/scss/_body.scss @@ -416,10 +416,10 @@ /* |------------------------------------------------------------- - | SEARCH + | ERROR PAGE |------------------------------------------------------------- */ -.search-root { +.error-root { @include defaultDecoration($page-accent); @include defaultFont(); } \ No newline at end of file diff --git a/error.php b/error.php new file mode 100644 index 0000000..576a58e --- /dev/null +++ b/error.php @@ -0,0 +1,26 @@ + + + + + + + + + +
+ +
+

Woops...

+ An error occured while connecting to the server. If you're an admin, check the database configuration and/or make sure the database is alive

"; + } else { + echo "

An error occured! But no description was provided.

"; + } + ?> +
+ + + + + \ No newline at end of file From 248154f37ded6a188ca773aa456061ef5a8f4bc4 Mon Sep 17 00:00:00 2001 From: Fluffy-Bean Date: Wed, 14 Sep 2022 18:59:02 +0000 Subject: [PATCH 22/47] Show crown next to Admins' names --- assets/icons/crown-simple.svg | 1 + image.php | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 assets/icons/crown-simple.svg diff --git a/assets/icons/crown-simple.svg b/assets/icons/crown-simple.svg new file mode 100644 index 0000000..0ae343b --- /dev/null +++ b/assets/icons/crown-simple.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/image.php b/image.php index 24e66d8..6197873 100644 --- a/image.php +++ b/image.php @@ -173,7 +173,11 @@
Author: ".$image_author."

"; + if ($user_info->is_admin($image['author'])) { + echo "

Author: ".$image_author."

"; + } else { + echo "

Author: ".$image_author."

"; + } // Image ID echo "

ID: ".$image['id']."

"; From b4e388ebcbea85552cb0ab0c659b7d7fd8266a0e Mon Sep 17 00:00:00 2001 From: Fluffy-Bean Date: Wed, 14 Sep 2022 19:43:43 +0000 Subject: [PATCH 23/47] Fixed radius errors, explained tags betterrrr --- css/main.css | 55 ++++++++++++++++++++++------------------ css/main.scss | 6 +++++ css/scss/_body.scss | 2 +- css/scss/_variables.scss | 4 ++- image.php | 2 +- 5 files changed, 42 insertions(+), 27 deletions(-) diff --git a/css/main.css b/css/main.css index 4e94257..7e47777 100644 --- a/css/main.css +++ b/css/main.css @@ -20,6 +20,7 @@ --black: #151515; --white: #E8E3E3; --accent: #8C977D; + --rad: 0.25rem; } /* @@ -33,7 +34,7 @@ nav { width: calc(100% - 1.4rem); background-color: #151515; color: #E8E3E3; - border-radius: 0rem; + border-radius: 0.25rem; border: 0.2rem solid #8C977D; box-shadow: 6px 6px 2px rgba(21, 21, 21, 0.5333333333); display: flex; @@ -207,7 +208,7 @@ nav .btn { flex-direction: row; flex-wrap: wrap; border: 0.2rem solid #8C977D; - border-radius: 0rem; + border-radius: 0.25rem; box-shadow: 6px 6px 2px rgba(21, 21, 21, 0.5333333333); } @@ -217,7 +218,7 @@ nav .btn { height: auto; max-width: calc(33.33% - 0.5rem); background-color: #151515; - border-radius: -0.5rem; + border-radius: -0.25rem; position: relative; overflow: hidden; flex: 1 0 150px; @@ -248,7 +249,7 @@ nav .btn { object-fit: cover; -o-object-position: center; object-position: center; - border-radius: -0.5rem; + border-radius: -0.25rem; } .nsfw-blur { @@ -306,7 +307,7 @@ nav .btn { background-color: rgba(21, 21, 21, 0.7333333333); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); - border-radius: 0rem; + border-radius: 0.25rem; transition: max-height 0.15s cubic-bezier(0.19, 1, 0.22, 1); } @@ -321,7 +322,7 @@ nav .btn { width: auto; max-height: inherit; height: auto; - border-radius: 0rem; + border-radius: 0.25rem; transition: opacity 0.5s; } @@ -336,7 +337,7 @@ nav .btn { font-family: "Secular One", sans-serif; text-decoration: none; border: none; - border-radius: calc(0rem - (0.5rem + 3px)); + border-radius: calc(0.25rem - (0.5rem + 3px)); transition: outline 0.1s cubic-bezier(0.19, 1, 0.22, 1); background-color: #151515; opacity: 0.8; @@ -353,7 +354,7 @@ nav .btn { width: calc(100% - 1.4rem); background-color: #151515; color: #E8E3E3; - border-radius: 0rem; + border-radius: 0.25rem; border: 0.2rem solid #8C977D; box-shadow: 6px 6px 2px rgba(21, 21, 21, 0.5333333333); } @@ -381,7 +382,7 @@ nav .btn { width: calc(100% - 1.4rem); background-color: #151515; color: #E8E3E3; - border-radius: 0rem; + border-radius: 0.25rem; border: 0.2rem solid #8C977D; box-shadow: 6px 6px 2px rgba(21, 21, 21, 0.5333333333); } @@ -432,7 +433,7 @@ nav .btn { width: calc(100% - 1.4rem); background-color: #151515; color: #E8E3E3; - border-radius: 0rem; + border-radius: 0.25rem; border: 0.2rem solid #8C977D; box-shadow: 6px 6px 2px rgba(21, 21, 21, 0.5333333333); } @@ -467,7 +468,7 @@ nav .btn { padding: 0.5rem; display: block; background-color: #8C977D; - border-radius: 0rem; + border-radius: calc(0.25rem - (0.5rem + 3px)); font-family: "Secular One", sans-serif; } .tag::before { @@ -480,7 +481,7 @@ nav .btn { width: calc(100% - 1.4rem); background-color: #151515; color: #E8E3E3; - border-radius: 0rem; + border-radius: 0.25rem; border: 0.2rem solid #B66467; box-shadow: 6px 6px 2px rgba(21, 21, 21, 0.5333333333); } @@ -513,7 +514,7 @@ nav .btn { width: calc(100% - 1.4rem); background-color: #151515; color: #E8E3E3; - border-radius: 0rem; + border-radius: 0.25rem; border: 0.2rem solid #8C977D; box-shadow: 6px 6px 2px rgba(21, 21, 21, 0.5333333333); } @@ -546,7 +547,7 @@ nav .btn { width: calc(100% - 1.4rem); background-color: #151515; color: #E8E3E3; - border-radius: 0rem; + border-radius: 0.25rem; border: 0.2rem solid #8C977D; box-shadow: 6px 6px 2px rgba(21, 21, 21, 0.5333333333); } @@ -579,7 +580,7 @@ nav .btn { width: calc(100% - 1.4rem); background-color: #151515; color: #E8E3E3; - border-radius: 0rem; + border-radius: 0.25rem; border: 0.2rem solid #8C977D; box-shadow: 6px 6px 2px rgba(21, 21, 21, 0.5333333333); } @@ -607,7 +608,7 @@ nav .btn { width: calc(100% - 1.4rem); background-color: #151515; color: #E8E3E3; - border-radius: 0rem; + border-radius: 0.25rem; border: 0.2rem solid #8C977D; box-shadow: 6px 6px 2px rgba(21, 21, 21, 0.5333333333); } @@ -638,7 +639,7 @@ nav .btn { display: flex; flex-direction: column; background-color: #151515; - border-radius: calc(0rem - (0.5rem + 3px)); + border-radius: calc(0.25rem - (0.5rem + 3px)); } .log { @@ -675,7 +676,7 @@ nav .btn { width: calc(100% - 1.4rem); background-color: #151515; color: #E8E3E3; - border-radius: 0rem; + border-radius: 0.25rem; border: 0.2rem solid #8C977D; box-shadow: 6px 6px 2px rgba(21, 21, 21, 0.5333333333); display: none; @@ -704,7 +705,7 @@ nav .btn { width: calc(100% - 1.4rem); background-color: #151515; color: #E8E3E3; - border-radius: 0rem; + border-radius: 0.25rem; border: 0.2rem solid #8C977D; box-shadow: 6px 6px 2px rgba(21, 21, 21, 0.5333333333); } @@ -737,7 +738,7 @@ nav .btn { width: calc(100% - 1.4rem); background-color: #151515; color: #E8E3E3; - border-radius: 0rem; + border-radius: 0.25rem; border: 0.2rem solid #B66467; box-shadow: 6px 6px 2px rgba(21, 21, 21, 0.5333333333); } @@ -770,7 +771,7 @@ nav .btn { width: calc(100% - 1.4rem); background-color: #151515; color: #E8E3E3; - border-radius: 0rem; + border-radius: 0.25rem; border: 0.2rem solid #8C977D; box-shadow: 6px 6px 2px rgba(21, 21, 21, 0.5333333333); } @@ -871,7 +872,7 @@ body * { font-family: "Secular One", sans-serif; text-decoration: none; border: none; - border-radius: calc(0rem - (0.5rem + 3px)); + border-radius: calc(0.25rem - (0.5rem + 3px)); transition: outline 0.1s cubic-bezier(0.19, 1, 0.22, 1); } .btn:hover { @@ -886,7 +887,7 @@ body * { text-decoration: none; background-color: #E8E3E3; border: none; - border-radius: 0rem; + border-radius: 0.25rem; } .btn:where(input[type=file])::file-selector-button { margin: -0.25rem 0.5rem -0.25rem -0.25rem; @@ -896,7 +897,7 @@ body * { text-decoration: none; background-color: #E8E3E3; border: none; - border-radius: 0rem; + border-radius: 0.25rem; } a.btn { @@ -987,4 +988,10 @@ br { display: block; -o-object-position: center; object-position: center; +} + +@media (prefers-reduced-motion) { + * { + transition: none !important; + } }/*# sourceMappingURL=main.css.map */ \ No newline at end of file diff --git a/css/main.scss b/css/main.scss index cf5a0ff..01fe8a3 100644 --- a/css/main.scss +++ b/css/main.scss @@ -202,4 +202,10 @@ br { object-position: center; } +} + +@media(prefers-reduced-motion){ + * { + transition: none !important; + } } \ No newline at end of file diff --git a/css/scss/_body.scss b/css/scss/_body.scss index 4f22d6e..75a537e 100644 --- a/css/scss/_body.scss +++ b/css/scss/_body.scss @@ -298,7 +298,7 @@ background-color: $page-accent; - border-radius: $rad; + border-radius: calc($rad - (0.5rem + 3px)); font-family: $font-body; diff --git a/css/scss/_variables.scss b/css/scss/_variables.scss index 2320ee6..32a2fe2 100644 --- a/css/scss/_variables.scss +++ b/css/scss/_variables.scss @@ -13,7 +13,7 @@ $white: #E8E3E3; $page-accent: #8C977D; $shadow: 6px 6px 2px #15151588; -$rad: 0rem; +$rad: 0.25rem; $weight-bold: 621; $weight-normal: 400; @@ -40,4 +40,6 @@ sans-serif; --white: #{$white}; --accent: #{$page-accent}; + + --rad: #{$rad}; } \ No newline at end of file diff --git a/image.php b/image.php index 6197873..c7592b0 100644 --- a/image.php +++ b/image.php @@ -352,7 +352,7 @@ + + - - - + + + + = 5) { + mysqli_query($conn,"INSERT INTO bans (ipaddress, reason, length, permanent) VALUES('$user_ip','Attempted password too many times', '60', '0')"); + } else { + // Checking if Username is empty + if (empty(trim($_POST["username"]))) { + ?> + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff($ago); + + $diff->w = floor($diff->d / 7); + $diff->d -= $diff->w * 7; + + $string = array( + 'y' => 'year', + 'm' => 'month', + 'w' => 'week', + 'd' => 'day', + 'h' => 'hour', + 'i' => 'minute', + 's' => 'second', + ); + foreach ($string as $k => &$v) { + if ($diff->$k) { + $v = $diff->$k . ' ' . $v . ($diff->$k > 1 ? 's' : ''); + } else { + unset($string[$k]); + } + } + + if (!$full_date) $string = array_slice($string, 0, 1); + return $string ? implode(', ', $string) . ' ago' : 'just now'; + } +} \ No newline at end of file diff --git a/css/main.css b/css/main.css index ed0b881..f6619bc 100644 --- a/css/main.css +++ b/css/main.css @@ -671,6 +671,53 @@ nav .btn { width: 20%; } +.bans { + width: 100%; + max-height: 20rem; + min-height: 5rem; + padding: 0; + overflow-y: scroll; + display: flex; + flex-direction: column; + background-color: #151515; + border-radius: calc(0.25rem - (0.5rem + 3px)); +} + +.ban { + min-width: 769px; + padding: 0.5rem; + display: flex; + flex-direction: row; + justify-content: space-between; +} +.ban:nth-child(odd) { + background-color: rgba(255, 255, 255, 0.0666666667); +} +.ban > * { + margin: 0 0.5rem 0 0; + padding: 0; + word-wrap: break-word; +} +.ban > *:nth-child(1) { + width: 5%; +} +.ban > *:nth-child(2) { + width: 20%; +} +.ban > *:nth-child(3) { + width: 45%; +} +.ban > *:nth-child(4) { + width: 10%; +} +.ban > *:nth-child(5) { + width: 20%; +} + +.perm { + border: 1px #B66467 solid; +} + .signup-root { margin-bottom: 1rem; padding: 0.5rem 0.5rem 0 0.5rem; diff --git a/css/scss/_body.scss b/css/scss/_body.scss index 75a537e..47073bd 100644 --- a/css/scss/_body.scss +++ b/css/scss/_body.scss @@ -393,6 +393,58 @@ } } +.bans { + width: 100%; + max-height: 20rem; min-height: 5rem; + + padding: 0; + + overflow-y: scroll; + + display: flex; flex-direction: column; + + background-color: $bg; + border-radius: calc($rad - (0.5rem + 3px)); +} +.ban { + min-width: 769px; + + padding: 0.5rem; + + display: flex; flex-direction: row; + + justify-content: space-between; + + &:nth-child(odd) { + background-color: #ffffff11; + } + + & > * { + margin: 0 0.5rem 0 0; + padding: 0; + word-wrap: break-word; + + &:nth-child(1) { + width: 5%; + } + &:nth-child(2) { + width: 20%; + } + &:nth-child(3) { + width: 45%; + } + &:nth-child(4) { + width: 10%; + } + &:nth-child(5) { + width: 20%; + } + } +} +.perm { + border: 1px $red solid; +} + .signup-root { @include defaultDecoration($page-accent); @include defaultFont(); From 8d291d0c7dbc2c9f8b48505cffe15d60c269ddcd Mon Sep 17 00:00:00 2001 From: Fluffy-Bean Date: Thu, 15 Sep 2022 17:13:36 +0000 Subject: [PATCH 27/47] Finalised Ban/Log system --- account.php | 4 +- app/account/account.php | 318 ++++++++++++++++++++++------------------ 2 files changed, 177 insertions(+), 145 deletions(-) diff --git a/account.php b/account.php index c99fcce..12b8ccd 100644 --- a/account.php +++ b/account.php @@ -72,7 +72,7 @@ ?>

-

Bans/Timeouts

+

Bans

-

+

mins

" . $log_time->format('d/m/Y H:i:s T') . "
" . $diff->time($ban['time']) . "

"; diff --git a/app/account/account.php b/app/account/account.php index f8aa2d7..fabe6a8 100644 --- a/app/account/account.php +++ b/app/account/account.php @@ -19,20 +19,10 @@ $user_ip = $user_info->get_ip(); |------------------------------------------------------------- */ if (isset($_POST['submit_login'])) { - /* - |------------------------------------------------------------- - | Set error status to 0 - |------------------------------------------------------------- - | if there are more than 0 error, then they cannot submit a - | request - |------------------------------------------------------------- - */ $error = 0; + $ban_query = mysqli_query($conn, "SELECT * FROM bans WHERE ipaddress = '$user_ip' ORDER BY id DESC LIMIT 1"); - $sql = "SELECT * FROM bans WHERE ipaddress = '$user_ip' ORDER BY id DESC LIMIT 1"; - $query = mysqli_query($conn, $sql); - - while ($ban_check = mysqli_fetch_assoc($query)) { + while ($ban_check = mysqli_fetch_assoc($ban_query)) { $ban_time = $ban_check['time']; $ban_perm = $ban_check['permanent']; } @@ -45,55 +35,60 @@ if (isset($_POST['submit_login'])) { sniffleAdd('Bye bye!', 'You have been banned, contact the owner if you feel that this was a mistake', 'var(--red)', 'assets/icons/warning.svg'); = 5) { mysqli_query($conn,"INSERT INTO bans (ipaddress, reason, length, permanent) VALUES('$user_ip','Attempted password too many times', '60', '0')"); - } else { - // Checking if Username is empty - if (empty(trim($_POST["username"]))) { - ?> - - - - + + + + - - - - = 5) { + mysqli_query($conn,"INSERT INTO bans (ipaddress, reason, length, permanent) VALUES('$user_ip','Attempted password too many times', '60', '0')"); } } - // Validate sussness of Password - if (empty(trim($_POST["password"]))) { - // No password entered - ?> - - - - - - + + + + + + + + + + + + + + Date: Thu, 15 Sep 2022 17:35:06 +0000 Subject: [PATCH 28/47] fixy fixy --- Sniffle/sniffle.css | 17 ++++++++++++----- account.php | 4 ++-- css/main.css | 20 ++++++++++---------- css/scss/_body.scss | 16 ++++++++-------- 4 files changed, 32 insertions(+), 25 deletions(-) diff --git a/Sniffle/sniffle.css b/Sniffle/sniffle.css index 27fda32..369fe4c 100644 --- a/Sniffle/sniffle.css +++ b/Sniffle/sniffle.css @@ -58,7 +58,7 @@ cursor: pointer; } -.sniffle-notification:not(:nth-of-type(1), :nth-of-type(2), :nth-of-type(3), :nth-of-type(4)) { +.sniffle-notification:not(:nth-of-type(1), :nth-of-type(2), :nth-of-type(3), :nth-of-type(4), :nth-of-type(5)) { display: none; opacity: 0; } @@ -71,24 +71,31 @@ .sniffle-notification:nth-of-type(2) { z-index: -1; transform: scale(0.95); - margin-top: -4.8rem; + margin-top: -5rem; opacity: 1; transition: transform 1.25s, opacity 0.5s; } .sniffle-notification:nth-of-type(3) { z-index: -2; transform: scale(0.9); - margin-top: -4.8rem; + margin-top: -5rem; opacity: 1; transition: transform 1.5s, opacity 0.75s; } .sniffle-notification:nth-of-type(4) { z-index: -3; transform: scale(0.85); - margin-top: -4.8rem; - opacity: 0; + margin-top: -5rem; + opacity: 1; transition: transform 1.75s, opacity 1s; } +.sniffle-notification:nth-of-type(5) { + z-index: -4; + transform: scale(0.80); + margin-top: -5rem; + opacity: 0; + transition: transform 2s, opacity 1.25s; +} /* Notification content Root diff --git a/account.php b/account.php index 12b8ccd..2a6f505 100644 --- a/account.php +++ b/account.php @@ -64,7 +64,7 @@

" . $log_time->format('d/m/Y H:i:s T') . "
" . $diff->time($log['time']) . "

"; + echo "

" . $log_time->format('Y-m-d H:i:s T') . " | " . $diff->time($log['time']) . "

"; ?>
mins

" . $log_time->format('d/m/Y H:i:s T') . "
" . $diff->time($ban['time']) . "

"; + echo "

" . $log_time->format('Y-m-d H:i:s T') . "
" . $diff->time($ban['time']) . "

"; ?>
*:nth-child(2) { - width: 25%; + width: 17%; } .log > *:nth-child(3) { - width: 50%; + width: 38%; } .log > *:nth-child(4) { - width: 20%; + width: 40%; } .bans { width: 100%; - max-height: 20rem; - min-height: 5rem; + max-height: 21rem; + min-height: auto; padding: 0; overflow-y: scroll; display: flex; @@ -702,16 +702,16 @@ nav .btn { width: 5%; } .ban > *:nth-child(2) { - width: 20%; + width: 17%; } .ban > *:nth-child(3) { - width: 45%; + width: 38%; } .ban > *:nth-child(4) { width: 10%; } .ban > *:nth-child(5) { - width: 20%; + width: 30%; } .perm { diff --git a/css/scss/_body.scss b/css/scss/_body.scss index 47073bd..053d2bf 100644 --- a/css/scss/_body.scss +++ b/css/scss/_body.scss @@ -349,7 +349,7 @@ .logs { width: 100%; - max-height: 20rem; min-height: 5rem; + max-height: 21rem; min-height: auto; padding: 0; @@ -382,20 +382,20 @@ width: 5%; } &:nth-child(2) { - width: 25%; + width: 17%; } &:nth-child(3) { - width: 50%; + width: 38%; } &:nth-child(4) { - width: 20%; + width: 40%; } } } .bans { width: 100%; - max-height: 20rem; min-height: 5rem; + max-height: 21rem; min-height: auto; padding: 0; @@ -428,16 +428,16 @@ width: 5%; } &:nth-child(2) { - width: 20%; + width: 17%; } &:nth-child(3) { - width: 45%; + width: 38%; } &:nth-child(4) { width: 10%; } &:nth-child(5) { - width: 20%; + width: 30%; } } } From e28157de3c39832c8b6912577b0ca4f0939d8739 Mon Sep 17 00:00:00 2001 From: Fluffy-Bean Date: Fri, 16 Sep 2022 16:39:13 +0000 Subject: [PATCH 29/47] In progress admin page --- Flyout/.flyout.css.swp | Bin 12288 -> 0 bytes Sniffle/sniffle.css | 21 ++---- account.php | 108 ++++++++++++++++++++++++++++- app/account/account.php | 57 +++++++++++++++ app/app.php | 11 ++- app/image/image.php | 8 +-- assets/icons/arrow-clockwise.svg | 1 + assets/icons/arrows-out-simple.svg | 1 + assets/icons/scan.svg | 1 + css/main.css | 90 ++++++++++++++++++++++-- css/scss/_body.scss | 93 +++++++++++++++++++++++-- image.php | 8 +-- ui/nav.php | 2 +- 13 files changed, 364 insertions(+), 37 deletions(-) delete mode 100644 Flyout/.flyout.css.swp create mode 100644 assets/icons/arrow-clockwise.svg create mode 100644 assets/icons/arrows-out-simple.svg create mode 100644 assets/icons/scan.svg diff --git a/Flyout/.flyout.css.swp b/Flyout/.flyout.css.swp deleted file mode 100644 index c09233443a2d9229763897d8abdfc9703f2d30cb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeI2yN=U96ov;1B(&TFRL~qiNLjQ_>@17GDG^8%bX+SmwkPp`;|ca;y%!-0cn?54 z2NFC1E9emgh>n7ai$MJ2I2*)ek?4?)qfcIY&YU^(&7_ESBLB*Ti*&jj2weMwFt6T6 zM-T20FAob*7-QY*zg?AzJgZ8p^TC#(on={cs;cUwc9?Zsj~nIftaCnFHDlZ9*SB_D zmRly_MmE3({?Wj0vDgiK*ZJ7dBXnT@<$uh>-PiydU;}J`4X^<=zy{a=8~7g$*wHp| z7lm(cieGH*+kUz?k9=bTY=8~00XDz}*Z><~18jf|umLu}2L3|>G7;j)oDe&Ap?LiN zfBO6X!(Jg?f*0T!cnThZ2jD)q2NDp2%it3DvPXzd;3IesHo$Z60BDecbD#yj?H1xI zcnvndb6`OUu7CjS0lUB)_>B7Afw$ld*Z@z!WAF%E2WP=a&;^IU9B}j64)|gNY=8~0 z0XDz}*Z><~18kr+aA$G}qDm(=4M~oz>52B_K&~fat4$u66*_^>y0|k741E9i?*rFG z=LB6fMV6FQrrNs0zEqjwmMqLTPskdQG%8G#sUcmUR4yyZ4aM15QEDpJ-q#qhQxAv1 zy;85?d~ryTDH2t9c-2E8i7rQ(Tn$O*na&J(o~(iwNvLk;DMmnuC-k*4drjx>F&cN`6Mz8MhI0m$rnHT&{ZH^9P8 zcPWaCTW$xEM~n4hP23J;G0^bp_h=-Oq~0`>#oS!;>0}1sbcHREXFFwICb0X<*#b%fX(kfZrnEj!!^DjXSte5c8}?% K1254-c=!&($9%m2 diff --git a/Sniffle/sniffle.css b/Sniffle/sniffle.css index 369fe4c..10b9686 100644 --- a/Sniffle/sniffle.css +++ b/Sniffle/sniffle.css @@ -45,6 +45,8 @@ border-radius: var(--rad); + transition: margin-top 1s cubic-bezier(.19,1,.22,1); + -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; @@ -53,12 +55,10 @@ user-select: none; } .sniffle-notification:hover { - transform: scale(1.05); - cursor: pointer; } -.sniffle-notification:not(:nth-of-type(1), :nth-of-type(2), :nth-of-type(3), :nth-of-type(4), :nth-of-type(5)) { +.sniffle-notification:not(:nth-of-type(1), :nth-of-type(2), :nth-of-type(3), :nth-of-type(4)) { display: none; opacity: 0; } @@ -71,30 +71,23 @@ .sniffle-notification:nth-of-type(2) { z-index: -1; transform: scale(0.95); - margin-top: -5rem; + margin-top: -4.8rem; opacity: 1; transition: transform 1.25s, opacity 0.5s; } .sniffle-notification:nth-of-type(3) { z-index: -2; transform: scale(0.9); - margin-top: -5rem; + margin-top: -4.8rem; opacity: 1; transition: transform 1.5s, opacity 0.75s; } .sniffle-notification:nth-of-type(4) { z-index: -3; transform: scale(0.85); - margin-top: -5rem; - opacity: 1; - transition: transform 1.75s, opacity 1s; -} -.sniffle-notification:nth-of-type(5) { - z-index: -4; - transform: scale(0.80); - margin-top: -5rem; + margin-top: -4.8rem; opacity: 0; - transition: transform 2s, opacity 1.25s; + transition: transform 1.75s, opacity 1s; } /* diff --git a/account.php b/account.php index 2a6f505..1cf3bc7 100644 --- a/account.php +++ b/account.php @@ -30,7 +30,7 @@ Logout is_admin($_SESSION['id'])) { + if ($user_info->is_admin($conn, $_SESSION['id'])) { ?>

Admin controlls

@@ -52,6 +52,12 @@

Logs

+
+

ID

+

User IP

+

Action

+

Time

+

Bans

+
+

ID

+

User IP

+

Reason

+

Lenght

+

Time

+
mins

" . $log_time->format('Y-m-d H:i:s T') . "
" . $diff->time($ban['time']) . "

"; + echo "

" . $log_time->format('Y-m-d H:i:s T') . " | " . $diff->time($ban['time']) . "

"; ?>
+
+

User settings

+
+ + + + + + get_image_info($conn, $_POST['id']); // If user owns image or has the ID of 1 - if ($image_info->image_privilage($image_array['author']) || $_SESSION['id'] == 1) { + if ($image_info->image_privilage($image_array['author']) || $user_info->is_admin($conn, $_SESSION['id'])) { // Delete from table $sql = "DELETE FROM images WHERE id = ?"; if ($stmt = mysqli_prepare($conn, $sql)) { @@ -101,7 +101,7 @@ if (isset($_POST['submit_description'])) { // Get all image info $image_array = $image_info->get_image_info($conn, $_POST['id']); // If user owns image or has the ID of 1 - if ($image_info->image_privilage($image_array['author']) || $_SESSION['id'] == 1) { + if ($image_info->image_privilage($image_array['author']) || $user_info->is_admin($conn, $_SESSION['id'])) { // getting ready forSQL asky asky $sql = "UPDATE images SET alt=? WHERE id=?"; @@ -159,7 +159,7 @@ if (isset($_POST['submit_tags'])) { // Get all image info $image_array = $image_info->get_image_info($conn, $_POST['id']); // If user owns image or has the ID of 1 - if ($image_info->image_privilage($image_array['author']) || $_SESSION['id'] == 1) { + if ($image_info->image_privilage($image_array['author']) || $user_info->is_admin($conn, $_SESSION['id'])) { // Clean input $tags_string = $make_stuff->tags(trim($_POST['input'])); @@ -218,7 +218,7 @@ if (isset($_POST['submit_tags'])) { */ if (isset($_POST['submit_author'])) { // If user has the ID of 1 - if ($user_info->is_admin($_SESSION['id'])) { + if ($user_info->is_admin($conn, $_SESSION['id'])) { // getting ready forSQL asky asky $sql = "UPDATE images SET author=? WHERE id=?"; diff --git a/assets/icons/arrow-clockwise.svg b/assets/icons/arrow-clockwise.svg new file mode 100644 index 0000000..08457f9 --- /dev/null +++ b/assets/icons/arrow-clockwise.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/icons/arrows-out-simple.svg b/assets/icons/arrows-out-simple.svg new file mode 100644 index 0000000..17e103d --- /dev/null +++ b/assets/icons/arrows-out-simple.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/icons/scan.svg b/assets/icons/scan.svg new file mode 100644 index 0000000..fd3f518 --- /dev/null +++ b/assets/icons/scan.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/css/main.css b/css/main.css index 5f3ae54..0ec690c 100644 --- a/css/main.css +++ b/css/main.css @@ -328,6 +328,8 @@ nav .btn { } .preview-button { + width: 1.5rem; + padding: 0; position: absolute; bottom: 0.5rem; right: 0.5rem; @@ -344,6 +346,10 @@ nav .btn { opacity: 0.8; box-shadow: 6px 6px 2px rgba(21, 21, 21, 0.4); } +.preview-button img { + width: 1.5rem; + display: block; +} .preview-button:hover { outline: #E8E3E3 0.2rem solid; color: #E8E3E3; @@ -650,7 +656,7 @@ nav .btn { flex-direction: row; justify-content: space-between; } -.log:nth-child(odd) { +.log:nth-child(even) { background-color: rgba(255, 255, 255, 0.0666666667); } .log > * { @@ -669,6 +675,14 @@ nav .btn { } .log > *:nth-child(4) { width: 40%; + margin: 0; +} + +.log:first-of-type { + background-color: #151515; + position: -webkit-sticky; + position: sticky; + top: 0; } .bans { @@ -690,7 +704,7 @@ nav .btn { flex-direction: row; justify-content: space-between; } -.ban:nth-child(odd) { +.ban:nth-child(even) { background-color: rgba(255, 255, 255, 0.0666666667); } .ban > * { @@ -705,17 +719,83 @@ nav .btn { width: 17%; } .ban > *:nth-child(3) { - width: 38%; + width: 34%; } .ban > *:nth-child(4) { width: 10%; } .ban > *:nth-child(5) { - width: 30%; + width: 34%; + margin: 0; } .perm { - border: 1px #B66467 solid; + border: 3px #B66467 solid; +} + +.ban:first-of-type { + background-color: #151515; + position: -webkit-sticky; + position: sticky; + top: 0; +} + +.user-settings { + width: 100%; + max-height: 21rem; + min-height: auto; + padding: 0; + overflow-y: scroll; + display: flex; + flex-direction: column; + background-color: #151515; + border-radius: calc(0.25rem - (0.5rem + 3px)); +} + +.user { + min-width: 769px; + padding: 0.5rem; + display: flex; + flex-direction: row; + justify-content: space-between; +} +.user:nth-child(even) { + background-color: rgba(255, 255, 255, 0.0666666667); +} +.user > * { + margin: 0 0.5rem 0 0; + padding: 0; + word-wrap: break-word; +} +.user > *:nth-child(1) { + width: 5%; +} +.user > *:nth-child(2) { + width: 15%; +} +.user > *:nth-child(3) { + width: 35%; +} +.user > *:nth-child(4) { + width: 15%; +} +.user > *:nth-child(5) { + width: 15%; +} +.user > *:nth-child(6) { + width: 15%; + margin: 0; +} + +.is-admin { + background-color: #8C977D !important; +} + +.user:first-of-type { + background-color: #151515; + position: -webkit-sticky; + position: sticky; + top: 0; } .signup-root { diff --git a/css/scss/_body.scss b/css/scss/_body.scss index 053d2bf..8ae5521 100644 --- a/css/scss/_body.scss +++ b/css/scss/_body.scss @@ -207,6 +207,10 @@ } .preview-button { + width: 1.5rem; + + padding: 0; + position: absolute; bottom: 0.5rem; right: 0.5rem; @@ -231,6 +235,12 @@ box-shadow: $shadow; + img { + width: 1.5rem; + + display: block; + } + &:hover { outline: $white 0.2rem solid; color: $fg; @@ -369,7 +379,7 @@ justify-content: space-between; - &:nth-child(odd) { + &:nth-child(even) { background-color: #ffffff11; } @@ -389,9 +399,15 @@ } &:nth-child(4) { width: 40%; + margin: 0; } } } +.log:first-of-type { + background-color: $bg; + position: sticky; + top: 0; +} .bans { width: 100%; @@ -415,7 +431,7 @@ justify-content: space-between; - &:nth-child(odd) { + &:nth-child(even) { background-color: #ffffff11; } @@ -431,18 +447,85 @@ width: 17%; } &:nth-child(3) { - width: 38%; + width: 34%; } &:nth-child(4) { width: 10%; } &:nth-child(5) { - width: 30%; + width: 34%; + margin: 0; } } } .perm { - border: 1px $red solid; + border: 3px $red solid; +} +.ban:first-of-type { + background-color: $bg; + position: sticky; + top: 0; +} + +.user-settings { + width: 100%; + max-height: 21rem; min-height: auto; + + padding: 0; + + overflow-y: scroll; + + display: flex; flex-direction: column; + + background-color: $bg; + border-radius: calc($rad - (0.5rem + 3px)); +} +.user { + min-width: 769px; + + padding: 0.5rem; + + display: flex; flex-direction: row; + + justify-content: space-between; + + &:nth-child(even) { + background-color: #ffffff11; + } + + & > * { + margin: 0 0.5rem 0 0; + padding: 0; + word-wrap: break-word; + + &:nth-child(1) { + width: 5%; + } + &:nth-child(2) { + width: 15%; + } + &:nth-child(3) { + width: 35%; + } + &:nth-child(4) { + width: 15%; + } + &:nth-child(5) { + width: 15%; + } + &:nth-child(6) { + width: 15%; + margin: 0; + } + } +} +.is-admin { + background-color: $green !important; +} +.user:first-of-type { + background-color: $bg; + position: sticky; + top: 0; } .signup-root { diff --git a/image.php b/image.php index 0092334..1929a3f 100644 --- a/image.php +++ b/image.php @@ -123,7 +123,7 @@ | Check user privilge |------------------------------------------------------------- */ - if ($image_info->image_privilage($image['author']) || $user_info->is_admin($_SESSION['id'])) { + if ($image_info->image_privilage($image['author']) || $user_info->is_admin($conn, $_SESSION['id'])) { $privilaged = True; } else { $privilaged = False; @@ -132,7 +132,7 @@ if (is_file("images/previews/".$image['imagename'])) { echo "
".$image_alt." - +
"; ?> + + is_admin($conn, $_POST['userId'])) { + $is_admin = mysqli_query($conn, "SELECT * FROM users WHERE id = " . $_POST['id'] . " ORDER BY id DESC LIMIT 1"); - while ($user_info = mysqli_fetch_assoc($is_admin)) { - $admin_status = $user_info['admin']; - $username = $user_info['username']; - } - - $sql = "UPDATE users SET admin = ? WHERE id = ?"; - - if ($stmt = mysqli_prepare($conn, $sql)) { - // Bind variables to the prepared statement as parameters - mysqli_stmt_bind_param($stmt, "ii", $param_admin_status, $param_user_id); - - // Set parameters - if ($admin_status) { - $param_admin_status = 0; - $admin_update_message = "removed from the admins list"; - } elseif (!$admin_status) { - $param_admin_status = 1; - $admin_update_message = "added to the admins list"; + while ($user_info = mysqli_fetch_assoc($is_admin)) { + $admin_status = $user_info['admin']; + $username = $user_info['username']; } - $param_user_id = $_POST['id']; - // Attempt to execute the prepared statement - if (mysqli_stmt_execute($stmt)) { - ?> - - + + + + - button { + margin-right: 0.5rem; + width: 33.33%; +} +.tabs > button:last-child { + margin-right: 0; +} + +.active-tab { + background-color: #8C977D !important; +} + .logs { width: 100%; - max-height: 21rem; - min-height: auto; + height: 21rem; padding: 0; overflow-y: scroll; - display: flex; + display: none; flex-direction: column; background-color: #151515; border-radius: calc(0.25rem - (0.5rem + 3px)); @@ -687,11 +702,10 @@ nav .btn { .bans { width: 100%; - max-height: 21rem; - min-height: auto; + height: 21rem; padding: 0; overflow-y: scroll; - display: flex; + display: none; flex-direction: column; background-color: #151515; border-radius: calc(0.25rem - (0.5rem + 3px)); @@ -730,7 +744,7 @@ nav .btn { } .perm { - border: 3px #B66467 solid; + border-left: #B66467 0.2rem solid; } .ban:first-of-type { @@ -742,11 +756,10 @@ nav .btn { .user-settings { width: 100%; - max-height: 21rem; - min-height: auto; + height: 21rem; padding: 0; overflow-y: scroll; - display: flex; + display: none; flex-direction: column; background-color: #151515; border-radius: calc(0.25rem - (0.5rem + 3px)); @@ -788,7 +801,7 @@ nav .btn { } .is-admin { - background-color: #8C977D !important; + border-left: #8C977D 0.2rem solid; } .user:first-of-type { diff --git a/css/scss/_body.scss b/css/scss/_body.scss index 8ae5521..2d03dfd 100644 --- a/css/scss/_body.scss +++ b/css/scss/_body.scss @@ -357,15 +357,30 @@ @include defaultFont(); } +.tabs { + display: flex; flex-direction: row; + + & > button { + margin-right: 0.5rem; + width: 33.33%; + } + & > button:last-child { + margin-right: 0; + } +} +.active-tab { + background-color: $page-accent !important; +} + .logs { width: 100%; - max-height: 21rem; min-height: auto; + height: 21rem; padding: 0; overflow-y: scroll; - display: flex; flex-direction: column; + display: none; flex-direction: column; background-color: $bg; border-radius: calc($rad - (0.5rem + 3px)); @@ -411,13 +426,13 @@ .bans { width: 100%; - max-height: 21rem; min-height: auto; + height: 21rem; padding: 0; overflow-y: scroll; - display: flex; flex-direction: column; + display: none; flex-direction: column; background-color: $bg; border-radius: calc($rad - (0.5rem + 3px)); @@ -459,7 +474,7 @@ } } .perm { - border: 3px $red solid; + border-left: $red 0.2rem solid; } .ban:first-of-type { background-color: $bg; @@ -469,13 +484,13 @@ .user-settings { width: 100%; - max-height: 21rem; min-height: auto; + height: 21rem; padding: 0; overflow-y: scroll; - display: flex; flex-direction: column; + display: none; flex-direction: column; background-color: $bg; border-radius: calc($rad - (0.5rem + 3px)); @@ -520,7 +535,7 @@ } } .is-admin { - background-color: $green !important; + border-left: $page-accent 0.2rem solid; } .user:first-of-type { background-color: $bg; From 7143e35bc750067d376b9fb3e79d3f9e5df3f692 Mon Sep 17 00:00:00 2001 From: Fluffy-Bean Date: Sat, 17 Sep 2022 10:28:29 +0000 Subject: [PATCH 31/47] lol --- password-reset.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/password-reset.php b/password-reset.php index 633fb06..e33e1e0 100644 --- a/password-reset.php +++ b/password-reset.php @@ -28,7 +28,7 @@
- +
@@ -38,7 +38,7 @@ $("#passwordForm").submit(function(event) { event.preventDefault(); var new_passowrd = $("#newPassword").val(); - var confirm_password = $("#confirmSassword").val(); + var confirm_password = $("#confirmPassword").val(); var submit = $("#passwordSubmit").val(); $("#sniffle").load("app/account/password_reset.php", { new_passowrd: new_passowrd, From c69ae90a40ce84b0185a33e89e29da26a6d72ba1 Mon Sep 17 00:00:00 2001 From: Fluffy-Bean Date: Sat, 17 Sep 2022 10:51:54 +0000 Subject: [PATCH 32/47] Password resest progress --- account.php | 28 ++++++++++- app/account/password_reset.php | 91 ++++++++++++++++++++++------------ 2 files changed, 87 insertions(+), 32 deletions(-) diff --git a/account.php b/account.php index 8cb05a5..7c08391 100644 --- a/account.php +++ b/account.php @@ -153,7 +153,7 @@ - + + - + - + + + is_admin($conn, $_SESSION["id"])) { + $user_id = $_POST['id']; + } elseif (empty($_POST['id'])) { + $user_id = $_SESSION["id"]; + } else { + ?> - - - + + + + - + Date: Sat, 17 Sep 2022 19:59:58 +0000 Subject: [PATCH 33/47] Cleaning up some code stuffs --- account.php | 92 +---------------------------------------- app/account/account.php | 2 +- scripts/account.js | 92 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+), 91 deletions(-) create mode 100644 scripts/account.js diff --git a/account.php b/account.php index 7c08391..525e3df 100644 --- a/account.php +++ b/account.php @@ -163,98 +163,10 @@ - - - + - diff --git a/app/account/account.php b/app/account/account.php index 4553030..4269257 100644 --- a/app/account/account.php +++ b/app/account/account.php @@ -429,7 +429,7 @@ if (isset($_POST['submit_signup'])) { |------------------------------------------------------------- */ if (isset($_POST['toggle_admin'])) { - if ($user_info->is_admin($conn, $_POST['userId'])) { + if ($user_info->is_admin($conn, $_SESSION['id'])) { $is_admin = mysqli_query($conn, "SELECT * FROM users WHERE id = " . $_POST['id'] . " ORDER BY id DESC LIMIT 1"); while ($user_info = mysqli_fetch_assoc($is_admin)) { diff --git a/scripts/account.js b/scripts/account.js new file mode 100644 index 0000000..5846c29 --- /dev/null +++ b/scripts/account.js @@ -0,0 +1,92 @@ +function userResetPassword(id, username) { + var header = "UwU whats the new passywassy code?"; + var description = "Do this only if "+username+" has forgotten their password, DO NOT abuse this power"; + var actionBox = "
\ + \ + \ +
\ + \ +
"; + + flyoutShow(header, description, actionBox); + + $("#userResetPasswordForm").submit(function(event) { + event.preventDefault(); + var new_passowrd = $("#userNewPassword").val(); + var confirm_password = $("#userConfirmSassword").val(); + var submit = $("#userPasswordSubmit").val(); + var userId = $("#userPasswordSubmit").val(); + $("#sniffle").load("app/account/password_reset.php", { + new_passowrd: new_passowrd, + confirm_password: confirm_password, + id: userId, + submit: submit + }); + }); +} +function userDelete(id, username) { + var header = "Are you very very sure?"; + var description = "This CANNOT be undone, be very carefull with your decition..."; + var actionBox = "
\ + \ +
\ +
\ + \ +
"; + + flyoutShow(header, description, actionBox); + + /*$("#descriptionConfirm").submit(function(event) { + event.preventDefault(); + var descriptionInput = $("#descriptionInput").val(); + var userDeleteSubmit = $("#userDeleteSubmit").val(); + $("#sniffle").load("path/to/.php", { + id: id, + submit_delete: userDeleteSubmit + }); + });*/ + /*$("#descriptionConfirm").submit(function(event) { + event.preventDefault(); + var descriptionInput = $("#descriptionInput").val(); + var userDeleteSubmit = $("#userDeleteSubmit").val(); + $("#sniffle").load("path/to/.php", { + id: id, + submit_delete: userDeleteSubmit + }); + });*/ +} +function userToggleAdmin(id, username) { + var header = "With great power comes great responsibility..."; + var description = "Do you trust this user? With admin permitions they can cause a whole lot of damage to this place, so make sure you're very very sure"; + var actionBox = "
\ + \ +
"; + + flyoutShow(header, description, actionBox); + + $("#toggleAdminConfirm").submit(function(event) { + event.preventDefault(); + var toggleAdminSubmit = $("#toggleAdminSubmit").val(); + $("#sniffle").load("app/account/account.php", { + id: toggleAdminSubmit, + toggle_admin: toggleAdminSubmit + }); + }); +} + +function openTab(evt, tabName) { + var i, tabcontent, tablinks; + + tabcontent = document.getElementsByClassName("tabcontent"); + for (i = 0; i < tabcontent.length; i++) { + tabcontent[i].style.display = "none"; + } + + tablinks = document.getElementsByClassName("tablinks"); + for (i = 0; i < tablinks.length; i++) { + tablinks[i].className = tablinks[i].className.replace(" active-tab", ""); + } + + document.getElementById(tabName).style.display = "flex"; + evt.currentTarget.className += " active-tab"; +} \ No newline at end of file From a400d70969a587ed732d0002b5ac50bfd3e23813 Mon Sep 17 00:00:00 2001 From: Fluffy-Bean Date: Sat, 17 Sep 2022 21:26:15 +0000 Subject: [PATCH 34/47] nice --- image.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/image.php b/image.php index 1929a3f..cbdb1be 100644 --- a/image.php +++ b/image.php @@ -180,7 +180,11 @@ } // Image ID - echo "

ID: ".$image['id']."

"; + if ($image['id'] == 69) { + echo "

ID: ".$image['id']."... nice

"; + } else { + echo "

ID: ".$image['id']."

"; + } // Last time image was updated $update_time = new DateTime($image['upload']); From be2c9768ceb4ef684d42da02e9de17d5e545f3c4 Mon Sep 17 00:00:00 2001 From: Fluffy-Bean Date: Sun, 18 Sep 2022 20:39:01 +0000 Subject: [PATCH 35/47] hi --- image.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/image.php b/image.php index cbdb1be..2b94aed 100644 --- a/image.php +++ b/image.php @@ -181,7 +181,7 @@ // Image ID if ($image['id'] == 69) { - echo "

ID: ".$image['id']."... nice

"; + echo "

ID: ".$image['id'].", nice

"; } else { echo "

ID: ".$image['id']."

"; } From 48f2e1b3658a9b904b05b87a076e58b7a2f99fdb Mon Sep 17 00:00:00 2001 From: Fluffy-Bean Date: Mon, 19 Sep 2022 19:21:57 +0000 Subject: [PATCH 36/47] Password resetting bruh --- account.php | 96 +++++++++++++++++++++++++++++++++- app/account/password_reset.php | 1 + password-reset.php | 4 +- scripts/account.js | 92 -------------------------------- 4 files changed, 98 insertions(+), 95 deletions(-) delete mode 100644 scripts/account.js diff --git a/account.php b/account.php index 525e3df..8e7337f 100644 --- a/account.php +++ b/account.php @@ -163,8 +163,102 @@ + - + $("#passwordForm").submit(function(event) { event.preventDefault(); - var new_passowrd = $("#newPassword").val(); + var new_password = $("#newPassword").val(); var confirm_password = $("#confirmPassword").val(); var submit = $("#passwordSubmit").val(); $("#sniffle").load("app/account/password_reset.php", { - new_passowrd: new_passowrd, + new_password: new_password, confirm_password: confirm_password, submit: submit }); diff --git a/scripts/account.js b/scripts/account.js deleted file mode 100644 index 5846c29..0000000 --- a/scripts/account.js +++ /dev/null @@ -1,92 +0,0 @@ -function userResetPassword(id, username) { - var header = "UwU whats the new passywassy code?"; - var description = "Do this only if "+username+" has forgotten their password, DO NOT abuse this power"; - var actionBox = "
\ - \ - \ -
\ - \ -
"; - - flyoutShow(header, description, actionBox); - - $("#userResetPasswordForm").submit(function(event) { - event.preventDefault(); - var new_passowrd = $("#userNewPassword").val(); - var confirm_password = $("#userConfirmSassword").val(); - var submit = $("#userPasswordSubmit").val(); - var userId = $("#userPasswordSubmit").val(); - $("#sniffle").load("app/account/password_reset.php", { - new_passowrd: new_passowrd, - confirm_password: confirm_password, - id: userId, - submit: submit - }); - }); -} -function userDelete(id, username) { - var header = "Are you very very sure?"; - var description = "This CANNOT be undone, be very carefull with your decition..."; - var actionBox = "
\ - \ -
\ -
\ - \ -
"; - - flyoutShow(header, description, actionBox); - - /*$("#descriptionConfirm").submit(function(event) { - event.preventDefault(); - var descriptionInput = $("#descriptionInput").val(); - var userDeleteSubmit = $("#userDeleteSubmit").val(); - $("#sniffle").load("path/to/.php", { - id: id, - submit_delete: userDeleteSubmit - }); - });*/ - /*$("#descriptionConfirm").submit(function(event) { - event.preventDefault(); - var descriptionInput = $("#descriptionInput").val(); - var userDeleteSubmit = $("#userDeleteSubmit").val(); - $("#sniffle").load("path/to/.php", { - id: id, - submit_delete: userDeleteSubmit - }); - });*/ -} -function userToggleAdmin(id, username) { - var header = "With great power comes great responsibility..."; - var description = "Do you trust this user? With admin permitions they can cause a whole lot of damage to this place, so make sure you're very very sure"; - var actionBox = "
\ - \ -
"; - - flyoutShow(header, description, actionBox); - - $("#toggleAdminConfirm").submit(function(event) { - event.preventDefault(); - var toggleAdminSubmit = $("#toggleAdminSubmit").val(); - $("#sniffle").load("app/account/account.php", { - id: toggleAdminSubmit, - toggle_admin: toggleAdminSubmit - }); - }); -} - -function openTab(evt, tabName) { - var i, tabcontent, tablinks; - - tabcontent = document.getElementsByClassName("tabcontent"); - for (i = 0; i < tabcontent.length; i++) { - tabcontent[i].style.display = "none"; - } - - tablinks = document.getElementsByClassName("tablinks"); - for (i = 0; i < tablinks.length; i++) { - tablinks[i].className = tablinks[i].className.replace(" active-tab", ""); - } - - document.getElementById(tabName).style.display = "flex"; - evt.currentTarget.className += " active-tab"; -} \ No newline at end of file From a2e4507b46253d18bfd51c379a7dcae935be5ae1 Mon Sep 17 00:00:00 2001 From: Fluffy-Bean Date: Mon, 19 Sep 2022 21:57:11 +0000 Subject: [PATCH 37/47] Fixing that really annoying bug --- app/app.php | 4 ++-- image.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/app.php b/app/app.php index 5354b21..2f4f752 100644 --- a/app/app.php +++ b/app/app.php @@ -62,7 +62,7 @@ class Account { */ function get_user_info($conn, $id) { // Setting SQL query - $sql = "SELECT * FROM users WHERE id = ".$id; + $sql = "SELECT id, username FROM users WHERE id = ".$id; // Getting results $query = mysqli_query($conn, $sql); // Fetching associated info @@ -79,7 +79,7 @@ class Account { function is_admin($conn, $id) { if (isset($id) || !empty($id)) { // Setting SQL query - $sql = "SELECT * FROM users WHERE id = ".$id; + $sql = "SELECT admin FROM users WHERE id = ".$id; // Getting results $query = mysqli_query($conn, $sql); // Fetching associated info diff --git a/image.php b/image.php index 2b94aed..697896c 100644 --- a/image.php +++ b/image.php @@ -332,7 +332,7 @@ "; flyoutShow(header, description, actionBox); - $('#descriptionInput').val(""); + $('#descriptionInput').val(""); $("#descriptionConfirm").submit(function(event) { event.preventDefault(); From b0bb4a2e9122929857e8578b10cb6af68f1b4066 Mon Sep 17 00:00:00 2001 From: Fluffy-Bean Date: Mon, 19 Sep 2022 22:21:38 +0000 Subject: [PATCH 38/47] oops --- GitHub/LICENSE.md => LICENSE.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename GitHub/LICENSE.md => LICENSE.md (100%) diff --git a/GitHub/LICENSE.md b/LICENSE.md similarity index 100% rename from GitHub/LICENSE.md rename to LICENSE.md From a465231effa826f2b98f6aa0517e47f2ba2a22da Mon Sep 17 00:00:00 2001 From: Fluffy-Bean Date: Tue, 20 Sep 2022 10:12:32 +0000 Subject: [PATCH 39/47] Account deletion, password reset fixes --- account.php | 81 +++++++++---- app/account/account.php | 212 +++++++++++++++++++++++++++++++++ app/account/password_reset.php | 136 --------------------- app/server/conn.php | 14 ++- css/main.css | 1 + css/main.scss | 2 + password-reset.php | 4 +- 7 files changed, 285 insertions(+), 165 deletions(-) delete mode 100644 app/account/password_reset.php diff --git a/account.php b/account.php index 8e7337f..f47ba5f 100644 --- a/account.php +++ b/account.php @@ -28,7 +28,44 @@

Don't leave! I'm with the science team!

Logout +
+

Be carefull!

+ + + is_admin($conn, $_SESSION['id'])) { ?> @@ -55,7 +92,7 @@
- +
@@ -182,49 +219,51 @@ var confirm_password = $("#userConfirmPassword").val(); var submit = $("#userPasswordSubmit").val(); var userId = $("#userPasswordSubmit").val(); - $("#sniffle").load("app/account/password_reset.php", { + $("#sniffle").load("app/account/account.php", { new_password: new_password, confirm_password: confirm_password, id: userId, - submit: submit + password_reset_submit: submit }); }); } function userDelete(id, username) { var header = "Are you very very sure?"; - var description = "This CANNOT be undone, be very carefull with your decition..."; - var actionBox = "
\ - \ + var description = "This CANNOT be undone, be very carefull with your decition... There is no second warning!"; + var actionBox = "\ + \
\ -
\ - \ + \ + \
"; flyoutShow(header, description, actionBox); - /*$("#descriptionConfirm").submit(function(event) { + $("#userDelete").submit(function(event) { event.preventDefault(); - var descriptionInput = $("#descriptionInput").val(); + var id = $("#userDeleteSubmit").val(); var userDeleteSubmit = $("#userDeleteSubmit").val(); - $("#sniffle").load("path/to/.php", { - id: id, - submit_delete: userDeleteSubmit + $("#sniffle").load("app/account/account.php", { + delete_id: id, + full: false, + account_delete_submit: userDeleteSubmit }); - });*/ - /*$("#descriptionConfirm").submit(function(event) { + }); + $("#userDeleteFull").submit(function(event) { event.preventDefault(); - var descriptionInput = $("#descriptionInput").val(); + var id = $("#userDeleteSubmit").val(); var userDeleteSubmit = $("#userDeleteSubmit").val(); - $("#sniffle").load("path/to/.php", { - id: id, - submit_delete: userDeleteSubmit + $("#sniffle").load("app/account/account.php", { + delete_id: id, + full: true, + account_delete_submit: userDeleteSubmit }); - });*/ + }); } function userToggleAdmin(id, username) { var header = "With great power comes great responsibility..."; var description = "Do you trust this user? With admin permitions they can cause a whole lot of damage to this place, so make sure you're very very sure"; - var actionBox = "
\ + var actionBox = "\ \
"; diff --git a/app/account/account.php b/app/account/account.php index 4269257..2c08129 100644 --- a/app/account/account.php +++ b/app/account/account.php @@ -486,4 +486,216 @@ if (isset($_POST['toggle_admin'])) { + + + + + + + + is_admin($conn, $_SESSION["id"])) { + $user_id = $_POST['id']; + } elseif (empty($_POST['id'])) { + $user_id = $_SESSION["id"]; + } else { + ?> + + + + + + + + + + + + + + + + + + + + - - - - - - - - is_admin($conn, $_SESSION["id"])) { - $user_id = $_POST['id']; - } elseif (empty($_POST['id'])) { - $user_id = $_SESSION["id"]; - } else { - ?> - - - - - - - - From 722f9b7fd6c4aa1bde0549e134a5e5e2228af14d Mon Sep 17 00:00:00 2001 From: Fluffy-Bean Date: Tue, 20 Sep 2022 10:20:18 +0000 Subject: [PATCH 40/47] I forgor --- account.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/account.php b/account.php index f47ba5f..bcee8ad 100644 --- a/account.php +++ b/account.php @@ -30,7 +30,7 @@ Logout

Be carefull!

- +
+ + + + + + + + - - + + + + -<?php echo $user_settings['website']['name']; ?> From 7f5aab165e8a7c55044dac8ee31c5ccbef9d0078 Mon Sep 17 00:00:00 2001 From: Fluffy-Bean Date: Tue, 20 Sep 2022 13:45:08 +0000 Subject: [PATCH 42/47] Fixing notification Style --- Sniffle/sniffle.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sniffle/sniffle.css b/Sniffle/sniffle.css index 576beae..4bfa591 100644 --- a/Sniffle/sniffle.css +++ b/Sniffle/sniffle.css @@ -33,7 +33,7 @@ .sniffle-notification { margin-bottom: 0.5rem; padding: 0; - max-width: calc(100% - 1rem); min-height: 2.5rem; + max-width: 100%; min-height: 2.5rem; display: flex; flex-direction: row; overflow-y: hidden; @@ -99,7 +99,7 @@ .sniffle-content { margin: 0 auto; padding: 0.5rem; - width: calc(100% - 3.5rem); + width: 100%; flex-direction: column; flex-wrap: wrap; overflow-y: hidden; From 1d4c25af2812a89abdc023a482c64a03be068871 Mon Sep 17 00:00:00 2001 From: Fluffy-Bean Date: Tue, 20 Sep 2022 15:47:23 +0000 Subject: [PATCH 43/47] Json config file --- about.php | 55 ++++++++++++--------------------- app/settings/manifest.json | 33 ++++++++++++++++++++ app/settings/settings.php | 17 +++------- app/settings/user_settings.json | 50 ------------------------------ css/main.css | 5 +-- css/scss/_footer.scss | 3 +- index.php | 14 +++++---- ui/footer.php | 14 +++------ ui/nav.php | 2 +- ui/required.php | 33 +++----------------- 10 files changed, 76 insertions(+), 150 deletions(-) create mode 100644 app/settings/manifest.json delete mode 100644 app/settings/user_settings.json diff --git a/about.php b/about.php index 6ff456b..18e1d22 100644 --- a/about.php +++ b/about.php @@ -13,44 +13,29 @@ ?>
-

What is this?

-

This Gallery is a smol project I originally started to control the images on my main page, but quickly turned into something much bigger...

-

What Do I want this to become in the future? No clue, but I do want this to be usable by others, if its a file they download a docker image they setup on your own web server.

-

Will it become that any time soon? No, but. I am going to work on this untill it becomes what I want it to be!

+

+

+

Version

+ +
+ +

TOS

+

+

This project is protected under the license by

+ +
+ +

Credits to development

+

Carty: Kickstarting development and SQL/PHP development

+

Jeetix: Helping patch holes in some features

+

mrHDash, Verg, Fennec, Carty, Jeetix and everyone else for helping with early bug testing

+

Phosphor for providing nice SVG icons


-

Can you add "A" or "B"?

-

No.

- -
- -

How do I use this!

-

First you must obtain the invite code. If you don't have one and are interested in trying this, feel free to DM me on Telegram!

-

But once you're done doing that, you can start making your account at the signup page here.

-

From there you should be able to go and login at this fancy page here!

-

Now you should see "Welcome (your username)" at the homepage. From there navigate to the navbar and click on the upload button. Choose your file, enter the description and your image is up!

- -
- -

Where to find me

- - - My website! - - - - Telegram - - - - Twitter - - -

Credits!

-

To Carty for being super cool again and helping me get started with SQL and PHP!

-

To Phosphor for providing nice SVG icons.

-

To mrHDash...

+

Development

+ Project Github + Creators Twitter
diff --git a/app/settings/manifest.json b/app/settings/manifest.json new file mode 100644 index 0000000..1f3644f --- /dev/null +++ b/app/settings/manifest.json @@ -0,0 +1,33 @@ +{ + "website_name": "Only Legs", + "website_description": "A simple PHP gallery with multiple users in mind", + "tos": "When making an account and interacting with the login/signup page, you agree to have your IP logged for banning purposes.", + "welcome_msg": [ + "*internal screaming*", + "Don't forget to drink water!", + "Bruh", + "Fluffy made this!", + "maybe", + "I'm gay", + "I wish we were better strangers.", + "Just like Minecraft!", + "If I were you, I'd run now", + "This is the part where I kill you", + "SILICA GEL \"DO NOT EAT\".", + "This was supposed to be a simple project", + "AAAAAAAAAAAAAAAAAAAA", + "Let me out", + "nice", + "I'm glad you're here", + "The weather is dry", + "Need me a man 👀", + "Gods die too.", + "Eat hotchip and lie", + "The world will not be destroyed by those who do evil, but by those who watch them and do nothing." + ], + "license":"GPL 3.0", + "version": "22.09.20", + "user_name": "Michal", + "is_testing": true, + "upload_max": "20" +} \ No newline at end of file diff --git a/app/settings/settings.php b/app/settings/settings.php index 9c90437..84cf2fa 100644 --- a/app/settings/settings.php +++ b/app/settings/settings.php @@ -8,22 +8,13 @@ | the default background and accent colour |------------------------------------------------------------- */ -$user_import = file_get_contents("app/settings/user_settings.json"); +$user_import = file_get_contents(__DIR__."/manifest.json"); $user_settings = json_decode($user_import, true); -foreach ($user_settings->data as $settings_list) { - foreach ($settings_list->website as $website) { - foreach ($website->database as $database) { +foreach ($user_settings->data as $website) { + foreach ($website->debug as $debug) { - } - foreach ($website->debug as $debug) { - - } - foreach ($website->plugins as $plugins) { - - } } } -$database = $user_settings["website"]["database"]; + $debug = $user_settings["website"]["debug"]; -$plugins = $user_settings["website"]["plugins"]; diff --git a/app/settings/user_settings.json b/app/settings/user_settings.json deleted file mode 100644 index 9c13fc2..0000000 --- a/app/settings/user_settings.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "website": { - "name": "Only Legs", - "description": "A simple gallery with multiple users in mind", - "welcome_msg": [ - "*internal screaming*", - "Don't forget to drink water!", - "Bruh", - "Fluffy made this!", - "maybe", - "I'm gay", - "I wish we were better strangers.", - "Just like Minecraft!", - "If I were you, I'd run now", - "This is the part where I kill you", - "SILICA GEL \"DO NOT EAT\".", - "This was supposed to be a simple project", - "AAAAAAAAAAAAAAAAAAAA", - "Let me out", - "nice", - "I'm glad you're here", - "The weather is dry", - "Need me a man 👀", - "Gods die too.", - "Eat hotchip and lie", - "The world will not be destroyed by those who do evil, but by those who watch them and do nothing." - ], - "license":"GPL 3.0", - "database": { - "ip": "192.168.0.79:3306", - "username": "uwu", - "password": "fennec621", - "database": "gallery" - }, - "debug": { - "testing": true, - "version": "22.09.12" - } - }, - "plugins": { - "sniffle": { - "location": "Sniffle/sniffle.js", - "using": true - }, - "flyout": { - "location": "Flyout/flyout.js", - "using": true - } - } -} \ No newline at end of file diff --git a/css/main.css b/css/main.css index 2d0dec7..aec0d1d 100644 --- a/css/main.css +++ b/css/main.css @@ -940,12 +940,9 @@ nav .btn { |------------------------------------------------------------- */ footer { - display: flex; - flex-direction: row; - flex-wrap: wrap; - justify-content: space-around; margin: 0 auto; width: calc(100% - 1.4rem); + text-align: center; } footer p { margin: 0 0.5rem; diff --git a/css/scss/_footer.scss b/css/scss/_footer.scss index 0f8ff7e..c32c2a3 100644 --- a/css/scss/_footer.scss +++ b/css/scss/_footer.scss @@ -4,12 +4,11 @@ |------------------------------------------------------------- */ footer { - @include flexLeft(space-around); - margin: 0 auto; width: calc(100% - 1.4rem); + text-align: center; p { margin: 0 0.5rem; diff --git a/index.php b/index.php index 6e93774..2cbfd16 100644 --- a/index.php +++ b/index.php @@ -9,13 +9,15 @@ - + +?>
".$welcome_message[array_rand($welcome_message, 1)]."

"; ?>
diff --git a/ui/footer.php b/ui/footer.php index 38b7792..d111e5e 100644 --- a/ui/footer.php +++ b/ui/footer.php @@ -1,11 +1,5 @@ -