mirror of
https://github.com/Fluffy-Bean/image-gallery.git
synced 2025-06-05 09:53:12 +00:00
Fixed group creation, updated sanity output
This commit is contained in:
parent
c3814000c0
commit
436a49e3ed
9 changed files with 141 additions and 106 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,8 +1,7 @@
|
|||
# Dont include user generated content in github repo
|
||||
images/
|
||||
conf/
|
||||
|
||||
# CSS map, I don't think its needed for upload... I think?
|
||||
*.map
|
||||
|
||||
# Dont include PHPStorm project files
|
||||
.idea/
|
36
account.php
36
account.php
|
@ -262,9 +262,9 @@
|
|||
|
||||
if ($user['id'] == 1) {
|
||||
?>
|
||||
<button class="btn btn-neutral" style="outline: none;">Reset Password</button>
|
||||
<button class="btn btn-neutral" style="outline: none;">Delete user</button>
|
||||
<button class="btn btn-neutral" style="outline: none;">Toggle admin</button>
|
||||
<button class="btn btn-bad" disabled>Reset Password</button>
|
||||
<button class="btn btn-bad" disabled>Delete user</button>
|
||||
<button class="btn btn-bad" disabled>Toggle admin</button>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
|
@ -385,8 +385,8 @@
|
|||
<?php
|
||||
$check_sanity = $sanity->get_results();
|
||||
|
||||
if (empty($check_sanity) || !isset($check_sanity)) {
|
||||
echo "<p class='btn btn-good' style='outline: none;'>No errors! Lookin' good</p>";
|
||||
if (empty($check_sanity)) {
|
||||
echo "<p class='alert alert-good'>No errors! Lookin' good :3</p>";
|
||||
} else {
|
||||
?>
|
||||
<style>
|
||||
|
@ -396,14 +396,28 @@
|
|||
</style>
|
||||
<?php
|
||||
foreach ($check_sanity as $result) {
|
||||
if (str_contains($result, "Critical")) {
|
||||
$result = str_replace("Critical:", "<img class='svg' src='assets/icons/warning.svg'>", $result);
|
||||
echo "<p class='btn btn-bad' style='outline: none; cursor: default;'>".$result."</p>";
|
||||
} elseif (str_contains($result, "Warning")) {
|
||||
$result = str_replace("Warning:", "<img class='svg' src='assets/icons/warning.svg'>", $result);
|
||||
echo "<p class='btn btn-warning' style='outline: none; cursor: default;'>".$result."</p>";
|
||||
if ($result['type'] == 'critical') {
|
||||
echo "<p class='alert alert-bad'>
|
||||
<img class='svg' src='assets/icons/warning.svg'>
|
||||
".$result['message']."
|
||||
</p>";
|
||||
} elseif ($result['type'] == 'warning') {
|
||||
echo "<p class='alert alert-warning'>
|
||||
<img class='svg' src='assets/icons/warning.svg'>
|
||||
".$result['message']."
|
||||
</p>";
|
||||
} else {
|
||||
echo "<p class='alert alert-warning'>
|
||||
<img class='svg' src='assets/icons/warning.svg'>
|
||||
".$result['message']."
|
||||
</p>";
|
||||
}
|
||||
}
|
||||
|
||||
echo "<br> <button class='btn btn-bad' disabled>
|
||||
<img class='svg' src='assets/icons/wrench.svg'>
|
||||
Attemp Autofix
|
||||
</button>";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
|
26
app/app.php
26
app/app.php
|
@ -403,16 +403,16 @@ class Sanity {
|
|||
$results = array();
|
||||
|
||||
if (!is_file(__DIR__."/../usr/conf/manifest.json")) {
|
||||
$results[] = "Critical: manifest.json is missing";
|
||||
$results[] = array('type'=>'critical', 'message'=>'manifest.json is missing');
|
||||
} else {
|
||||
$manifest = json_decode(file_get_contents(__DIR__."/../usr/conf/manifest.json"), true);
|
||||
|
||||
if (empty($manifest['user_name']) || $manifest['user_name'] == "[your name]") {
|
||||
$results[] = "Warning: manifest.json is missing your name";
|
||||
$results[] = array('type'=>'warning', 'message'=>'manifest.json is missing your name');
|
||||
}
|
||||
if ($manifest['upload']['rename_on_upload']) {
|
||||
if (empty($manifest['upload']['rename_to'])) {
|
||||
$results[] = "Critical: manifest.json doesnt know what to rename your files to";
|
||||
$results[] = array('type'=>'critical', 'message'=>'manifest.json doesnt know what to rename your files to');
|
||||
} else {
|
||||
$rename_to = $manifest['upload']['rename_to'];
|
||||
$rename_rate = 0;
|
||||
|
@ -426,15 +426,15 @@ class Sanity {
|
|||
if (str_contains($rename_to, '{{username}}') || str_contains($rename_to, '{{userid}}')) $rename_rate += 1;
|
||||
|
||||
if ($rename_rate < 2) {
|
||||
$results[] = "Critical: You will encounter errors when uploading images due to filenames, update your manifest.json";
|
||||
$results[] = array('type'=>'critical', 'message'=>'You will encounter errors when uploading images due to filenames, update your manifest.json');
|
||||
} elseif ($rename_rate < 5 && $rename_rate > 2) {
|
||||
$results[] = "Warning: You may encounter errors when uploading images due to filenames, concider update your manifest.json";
|
||||
$results[] = array('type'=>'warning', 'message'=>'You may encounter errors when uploading images due to filenames, concider modifying your manifest.json');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($manifest['is_testing']) {
|
||||
$results[] = "Warning: You are currently in testing mode, errors will be displayed to the user";
|
||||
$results[] = array('type'=>'warning', 'message'=>'You are currently in testing mode, errors will be displayed to the user');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -446,16 +446,16 @@ class Sanity {
|
|||
$results = array();
|
||||
|
||||
if (!is_dir("usr/images")) {
|
||||
$results[] = "Critical: You need to setup an images folder, follow the guide on the GitHub repo";
|
||||
$results[] = array('type'=>'critical', 'message'=>'You need to setup an images folder, follow the guide on the GitHub repo');
|
||||
}
|
||||
if (!is_dir("usr/images/pfp")) {
|
||||
$results[] = "Critical: You need to setup an pfp folder, follow the guide on the GitHub repo";
|
||||
$results[] = array('type'=>'critical', 'message'=>'You need to setup an pfp folder, follow the guide on the GitHub repo');
|
||||
}
|
||||
if (!is_dir("usr/images/previews")) {
|
||||
$results[] = "Critical: You need to setup an previews folder, follow the guide on the GitHub repo";
|
||||
$results[] = array('type'=>'critical', 'message'=>'You need to setup an previews folder, follow the guide on the GitHub repo');
|
||||
}
|
||||
if (!is_dir("usr/images/thumbnails")) {
|
||||
$results[] = "Critical: You need to setup an thumbnails folder, follow the guide on the GitHub repo";
|
||||
$results[] = array('type'=>'critical', 'message'=>'You need to setup an thumbnails folder, follow the guide on the GitHub repo');
|
||||
}
|
||||
|
||||
return $results;
|
||||
|
@ -476,13 +476,13 @@ class Sanity {
|
|||
$app_repo = json_decode($result, true);
|
||||
|
||||
if ($app_local['version'] < $app_repo['version']) {
|
||||
$results[] = "Critical: You are not running the latest version of the app v".$app_repo['version']."";
|
||||
$results[] = array('type'=>'critical', 'message'=>'You are not running the latest version of the app v'.$app_repo['version']);
|
||||
} elseif ($app_local['version'] > $app_repo['version']) {
|
||||
$results[] = "Warning: You are running a version of the app that is newer than the latest release v".$app_repo['version']."";
|
||||
$results[] = array('type'=>'critical', 'message'=>'You are running a version of the app that is newer than the latest release v'.$app_repo['version']);
|
||||
}
|
||||
|
||||
if (PHP_VERSION_ID < 80000) {
|
||||
$results[] = "Critical: Your current version of PHP is ".PHP_VERSION.". The reccomended version is 8.0.0 or higher";
|
||||
$results[] = array('type'=>'warning', 'message'=>'Your current version of PHP is '.PHP_VERSION.' The reccomended version is 8.0.0 or higher');
|
||||
}
|
||||
|
||||
return $results;
|
||||
|
|
|
@ -124,7 +124,7 @@ if (isset($_POST['title_submit'])) {
|
|||
|-------------------------------------------------------------
|
||||
*/
|
||||
if (isset($_POST['new_group_submit'])) {
|
||||
if ($user_info->is_loggedin()) {
|
||||
if ($user_info->is_loggedin($conn)) {
|
||||
$group_name = "New Group";
|
||||
$sql = "INSERT INTO groups (group_name, author, image_list) VALUES('$group_name', '".$_SESSION['id']."', '')";
|
||||
|
||||
|
|
1
assets/icons/wrench.svg
Normal file
1
assets/icons/wrench.svg
Normal file
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="192" height="192" fill="#e8e3e3" viewBox="0 0 256 256"><rect width="256" height="256" fill="none"></rect><path d="M218.9,71a63.9,63.9,0,0,1-89.8,81h0L73,217a24,24,0,0,1-34-34l65-56.1h0a63.9,63.9,0,0,1,81-89.8L143,79l5.7,28.3L177,113Z" fill="none" stroke="#e8e3e3" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"></path></svg>
|
After Width: | Height: | Size: 389 B |
90
css/main.css
90
css/main.css
|
@ -215,53 +215,22 @@ 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;
|
||||
text-rendering: optimizeLegibility;
|
||||
}
|
||||
.gallery-order p,
|
||||
.gallery-order a,
|
||||
.gallery-order button,
|
||||
.gallery-order input {
|
||||
font-family: "Secular One", sans-serif;
|
||||
text-rendering: optimizeLegibility;
|
||||
}
|
||||
.gallery-order > * {
|
||||
margin-right: 0.5rem;
|
||||
}
|
||||
.gallery-order > *:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.gallery-root {
|
||||
margin-bottom: 1rem;
|
||||
padding: 0.25rem;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
justify-content: none;
|
||||
padding: 0.5rem;
|
||||
gap: 0.5rem;
|
||||
display: grid;
|
||||
grid-template-columns: auto auto auto auto auto;
|
||||
}
|
||||
|
||||
.gallery-item {
|
||||
margin: 0.25rem;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: auto;
|
||||
max-width: calc(20% - 0.5rem);
|
||||
min-width: calc(20% - 0.5rem);
|
||||
background-color: #151515;
|
||||
border-radius: 3px;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
flex: 1 0 150px;
|
||||
transition: transform 0.15s cubic-bezier(0.19, 1, 0.22, 1);
|
||||
}
|
||||
.gallery-item:hover {
|
||||
|
@ -279,15 +248,13 @@ nav .btn {
|
|||
}
|
||||
|
||||
@media (max-width: 800px) {
|
||||
.gallery-item {
|
||||
max-width: calc(25% - 0.5rem);
|
||||
min-width: calc(25% - 0.5rem);
|
||||
.gallery-root {
|
||||
grid-template-columns: auto auto auto auto;
|
||||
}
|
||||
}
|
||||
@media (max-width: 550px) {
|
||||
.gallery-item {
|
||||
max-width: calc(33.33% - 0.5rem);
|
||||
min-width: calc(33.33% - 0.5rem);
|
||||
.gallery-root {
|
||||
grid-template-columns: auto auto auto;
|
||||
}
|
||||
}
|
||||
.gallery-image {
|
||||
|
@ -609,11 +576,9 @@ nav .btn {
|
|||
}
|
||||
|
||||
.group-make {
|
||||
margin: 0.25rem;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: auto;
|
||||
max-width: calc(20% - 0.5rem);
|
||||
min-width: calc(20% - 0.5rem);
|
||||
border-radius: 3px;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
|
@ -1121,6 +1086,41 @@ a.btn {
|
|||
background-image: linear-gradient(to top, #111111, #121212);
|
||||
}
|
||||
|
||||
/*
|
||||
|-------------------------------------------------------------
|
||||
| ALERTS
|
||||
|-------------------------------------------------------------
|
||||
*/
|
||||
.alert {
|
||||
padding: 0.75rem;
|
||||
width: 100%;
|
||||
display: block;
|
||||
box-sizing: border-box;
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
font-family: "Secular One", sans-serif;
|
||||
text-decoration: none;
|
||||
border-left: 0.2rem solid #E8E3E3;
|
||||
background-color: #151515;
|
||||
background-repeat: no-repeat;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.alert-bad {
|
||||
border-color: #B66467;
|
||||
background-image: linear-gradient(to right, rgba(182, 100, 103, 0.3), rgba(21, 21, 21, 0));
|
||||
}
|
||||
|
||||
.alert-warning {
|
||||
border-color: #D8A657;
|
||||
background-image: linear-gradient(to right, rgba(216, 166, 87, 0.3), rgba(21, 21, 21, 0));
|
||||
}
|
||||
|
||||
.alert-good {
|
||||
border-color: #8C977D;
|
||||
background-image: linear-gradient(to right, rgba(140, 151, 125, 0.3), rgba(21, 21, 21, 0));
|
||||
}
|
||||
|
||||
/*
|
||||
|-------------------------------------------------------------
|
||||
| FORM SIZING
|
||||
|
|
|
@ -146,6 +146,49 @@ a.btn {
|
|||
|
||||
}
|
||||
|
||||
/*
|
||||
|-------------------------------------------------------------
|
||||
| ALERTS
|
||||
|-------------------------------------------------------------
|
||||
*/
|
||||
.alert {
|
||||
padding: 0.75rem;
|
||||
|
||||
width: 100%;
|
||||
|
||||
display: block;
|
||||
box-sizing: border-box;
|
||||
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
font-family: $font-body;
|
||||
|
||||
text-decoration: none;
|
||||
|
||||
border-left: $border-thickness solid $fg;
|
||||
background-color: $bg;
|
||||
background-repeat: no-repeat;
|
||||
|
||||
@if calc($rad - 0.5rem) > 0 {
|
||||
border-radius: calc($rad - 0.3rem);
|
||||
} @else {
|
||||
border-radius: 3px;
|
||||
}
|
||||
}
|
||||
|
||||
.alert-bad {
|
||||
border-color: $warning;
|
||||
background-image: linear-gradient(to right, rgba($warning, 0.3), rgba($bg, 0));
|
||||
}
|
||||
.alert-warning {
|
||||
border-color: $alert;
|
||||
background-image: linear-gradient(to right, rgba($alert, 0.3), rgba($bg, 0));
|
||||
}
|
||||
.alert-good {
|
||||
border-color: $page-accent;
|
||||
background-image: linear-gradient(to right, rgba($page-accent, 0.3), rgba($bg, 0));
|
||||
}
|
||||
|
||||
/*
|
||||
|-------------------------------------------------------------
|
||||
| FORM SIZING
|
||||
|
|
|
@ -40,36 +40,20 @@
|
|||
}
|
||||
}
|
||||
|
||||
.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;
|
||||
padding: 0.5rem;
|
||||
gap: 0.5rem;
|
||||
|
||||
@include flexLeft(none);
|
||||
display: grid;
|
||||
grid-template-columns: auto auto auto auto auto;
|
||||
}
|
||||
|
||||
.gallery-item {
|
||||
margin: 0.25rem;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
||||
height: auto;
|
||||
max-width: calc(20% - 0.5rem);
|
||||
min-width: calc(20% - 0.5rem);
|
||||
|
||||
background-color: $bg;
|
||||
@if calc($rad - 0.5rem) > 0 {
|
||||
|
@ -79,11 +63,8 @@
|
|||
}
|
||||
|
||||
position: relative;
|
||||
|
||||
overflow: hidden;
|
||||
|
||||
flex: 1 0 150px;
|
||||
|
||||
transition: transform 0.15s cubic-bezier(.19, 1, .22, 1);
|
||||
|
||||
&:hover {
|
||||
|
@ -105,15 +86,13 @@
|
|||
}
|
||||
|
||||
@media (max-width: 800px) {
|
||||
.gallery-item {
|
||||
max-width: calc(25% - 0.5rem);
|
||||
min-width: calc(25% - 0.5rem);
|
||||
.gallery-root {
|
||||
grid-template-columns: auto auto auto auto;
|
||||
}
|
||||
}
|
||||
@media (max-width: 550px) {
|
||||
.gallery-item {
|
||||
max-width: calc(33.33% - 0.5rem);
|
||||
min-width: calc(33.33% - 0.5rem);
|
||||
.gallery-root {
|
||||
grid-template-columns: auto auto auto;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -544,12 +523,10 @@
|
|||
}
|
||||
|
||||
.group-make {
|
||||
margin: 0.25rem;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
||||
height: auto;
|
||||
max-width: calc(20% - 0.5rem);
|
||||
min-width: calc(20% - 0.5rem);
|
||||
|
||||
@if calc($rad - 0.5rem) > 0 {
|
||||
border-radius: calc($rad - 0.5rem);
|
||||
|
@ -968,6 +945,7 @@
|
|||
}
|
||||
.is-admin {
|
||||
border-left: $border;
|
||||
//background-image: linear-gradient(to right, rgba($page-accent, 0.3), rgba($page-accent, 0));
|
||||
}
|
||||
.user:first-of-type {
|
||||
background-color: $bg;
|
||||
|
|
|
@ -254,7 +254,7 @@
|
|||
</script>
|
||||
<?php
|
||||
echo "</div>";
|
||||
} elseif (empty($image_list)) {
|
||||
} elseif (empty($image_list[0])) {
|
||||
echo "<div class='info-text defaultFonts' style='text-align: center !important;'>
|
||||
<h1>Nothing here!</h1>
|
||||
<p>There are no images in the group, add some!</p>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue