Automated loading of more logs

Fixed other random bugs
This commit is contained in:
Michał Gdula 2022-11-08 15:37:19 +00:00
parent 517d0b7071
commit 2d7d359cde
11 changed files with 151 additions and 95 deletions

View file

@ -33,11 +33,7 @@
<div class="defaultDecoration defaultSpacing defaultFonts">
<h2>Profile</h2>
<div class="pfp-upload">
<form id="pfpForm" method="POST" enctype="multipart/form-data">
<h3>Profile Picture</h3>
<input id="image" class="btn btn-neutral" type="file" placeholder="select image UwU">
<button id="pfpSubmit" class="btn btn-good" type="submit"><img class="svg" src="assets/icons/upload.svg">Upload Image</button>
</form>
<h3>Profile Picture</h3>
<?php
if (is_file("usr/images/pfp/".$profile_info['pfp_path'])) {
echo "<img alt='profile picture' src='usr/images/pfp/".$profile_info['pfp_path']."'>";
@ -45,6 +41,10 @@
echo "<img alt='profile picture' src='assets/no_image.png'>";
}
?>
<form id="pfpForm" method="POST" enctype="multipart/form-data">
<input id="image" class="btn btn-neutral" type="file" placeholder="select image UwU">
<button id="pfpSubmit" class="btn btn-good btn-icon" type="submit"><img class="svg" src="assets/icons/upload.svg"></button>
</form>
<script>
$("#pfpForm").submit(function(event) {
event.preventDefault();
@ -162,26 +162,33 @@
<h2>Website</h2>
<h3>Invite Codes</h3>
<?php
$token_request = mysqli_query($conn, "SELECT * FROM tokens WHERE used = 0");
if (mysqli_num_rows($token_request) > 0) {
while ($token = mysqli_fetch_array($token_request)) {
?>
<div style="display: flex; flex-direction: row; gap: 0.5rem;">
<button onclick='copyCode(this)' class='btn btn-neutral btn-code'><?php echo $token['code']; ?></button>
<button onclick='regenerateCode("<?php echo $token["code"]; ?>", this)' class='btn btn-good btn-code-reg'><img src="assets/icons/arrow-clockwise.svg"></button>
<button onclick='deleteCode(<?php echo $token["id"]; ?>)' class='btn btn-bad btn-code-reg'><img src="assets/icons/cross.svg"></button>
</div>
<?php
}
} else {
echo "<div class='info-text defaultFonts' style='text-align: center !important; margin-left: 0 !important;'>
<p>No invite codes/tokens :c</p>
</div>";
}
?>
<div style="display: flex; flex-direction: column; gap: 0.5rem;" id="tokenList">
<?php
$token_request = mysqli_query($conn, "SELECT * FROM tokens WHERE used = 0");
if (mysqli_num_rows($token_request) > 0) {
while ($token = mysqli_fetch_array($token_request)) {
?>
<div style="display: flex; flex-direction: row; gap: 0.5rem;">
<button onclick='copyCode(this)' class='btn btn-neutral btn-code'><?php echo $token['code']; ?></button>
<button onclick='regenerateCode("<?php echo $token["code"]; ?>", this)' class='btn btn-good btn-icon'><img src="assets/icons/arrow-clockwise.svg"></button>
<button onclick='deleteCode(<?php echo $token["id"]; ?>)' class='btn btn-bad btn-icon'><img src="assets/icons/cross.svg"></button>
</div>
<?php
}
} else {
echo "<div class='info-text defaultFonts' style='text-align: center !important; margin-left: 0 !important;'>
<p>No invite codes/tokens :c</p>
</div>";
}
?>
</div>
<button onclick='generateCode()' class='btn btn-good'>Generate code</button>
<script>
function refreshList() {
$("#tokenList").load("app/account/token.php", {
refresh: 'true'
});
}
function copyCode(thisButton) {
var text = thisButton.innerHTML;
navigator.clipboard.writeText(text);
@ -196,10 +203,13 @@
success: function(response) {
if (response == true) {
sniffleAdd("Woop!", "Invite code has been regenerated!", "var(--green)", "assets/icons/check.svg");
//thisButton.parentNode.remove();
refreshList();
} else {
sniffleAdd("Oops!", "Something went wrong!", "var(--red)", "assets/icons/cross.svg");
}
},
error: function() {
sniffleAdd("AAAAAAAAAAAAAAAAA", "Something went wrong!", "var(--red)", "assets/icons/cross.svg");
}
});
}
@ -212,9 +222,13 @@
success: function(response) {
if (response == true) {
sniffleAdd("Woop!", "Invite code has been generated!", "var(--green)", "assets/icons/check.svg");
refreshList();
} else {
sniffleAdd("Oops!", "Something went wrong!", "var(--red)", "assets/icons/cross.svg");
}
},
error: function() {
sniffleAdd("AAAAAAAAAAAAAAAAA", "Something went wrong!", "var(--red)", "assets/icons/cross.svg");
}
});
}
@ -227,10 +241,32 @@
success: function(response) {
if (response == true) {
sniffleAdd("Woop!", "Invite code has been deleted!", "var(--green)", "assets/icons/check.svg");
//thisButton.parentNode.remove();
refreshList();
} else {
sniffleAdd("Oops!", "Something went wrong!", "var(--red)", "assets/icons/cross.svg");
sniffleAdd("AAAAAAAAAAAAAAAAA", "Something went wrong!", "var(--red)", "assets/icons/cross.svg");
}
},
error: function() {
sniffleAdd("AAAAAAAAAAAAAAAAA", "Something went wrong!", "var(--red)", "assets/icons/cross.svg");
}
});
}
function gwa() {
$.ajax ({
url: "app/account/token.php",
type: "POST",
data: { gwagwa: true },
success: function(response) {
if (response == true) {
sniffleAdd("Woop!", "Invite code has been deleted!", "var(--green)", "assets/icons/check.svg");
refreshList();
} else {
sniffleAdd("AAAAAAAAAAAAAAAAA", "Something went wrong!", "var(--red)", "assets/icons/cross.svg");
}
},
error: function() {
sniffleAdd("AAAAAAAAAAAAAAAAA", "Something went wrong!", "var(--red)", "assets/icons/cross.svg");
}
});
}
@ -266,7 +302,6 @@
}
?>
<div>
<button class="btn btn-neutral" onclick="loadMore()">Load More</button>
<script>
function loadMore() {
$.ajax ({
@ -279,10 +314,19 @@
}
});
}
if ($("#logs").children().length > 100) {
var trueHeight = $("#logs").children().length * document.getElementById('logs').children.item(1).clientHeight;
$('#logs').scroll (function() {
if ($(this).scrollTop() + $(this).innerHeight() >= trueHeight - 100) {
loadMore();
}
});
}
</script>
</div>
</div>
<div id="bans" class="bans tabcontent">
<div class="ban">
<p>ID</p> <p>User IP</p> <p>Reason</p> <p>Lenght</p> <p>Time</p>

View file

@ -698,7 +698,7 @@ if (isset($_POST['account_delete_submit'])) {
if (isset($_POST['pfp_submit'])) {
if (isset($_SESSION['id'])) {
// Root paths
$dir = "../../images/pfp/";
$dir = "../../usr/images/pfp/";
// File name updating
$file_type = pathinfo($dir.$_FILES['image']['name'],PATHINFO_EXTENSION);

View file

@ -59,3 +59,24 @@ if (isset($_POST['delete'])) {
}
}
}
if (isset($_POST['refresh'])) {
if ($user_info->is_admin($conn, $_SESSION['id'])) {
$request = mysqli_query($conn, "SELECT * FROM tokens WHERE used = 0");
if (mysqli_num_rows($request) > 0) {
while ($token = mysqli_fetch_array($request)) {
?>
<div style="display: flex; flex-direction: row; gap: 0.5rem;">
<button onclick='copyCode(this)' class='btn btn-neutral btn-code'><?php echo $token['code']; ?></button>
<button onclick='regenerateCode("<?php echo $token["code"]; ?>", this)' class='btn btn-good btn-icon'><img src="assets/icons/arrow-clockwise.svg"></button>
<button onclick='deleteCode(<?php echo $token["id"]; ?>)' class='btn btn-bad btn-icon'><img src="assets/icons/cross.svg"></button>
</div>
<?php
}
} else {
echo "<div class='info-text defaultFonts' style='text-align: center !important; margin-left: 0 !important;'>
<p>No invite codes/tokens :c</p>
</div>";
}
}
}

View file

@ -1,5 +1,5 @@
{
"license": "MIT",
"version": "22.11.06",
"version": "22.11.08",
"branch": "main"
}

View file

@ -39,6 +39,11 @@ if (defined('ROOT') && $_SESSION['id'] == 1) {
'link'=>'https://github.com/Fluffy-Bean/image-gallery',
'fix'=>'manual'
);
} else {
$results[] = array(
'type'=>'success',
'message'=>'You are running the latest version of the app v'.$app_repo['version']
);
}
if (PHP_VERSION_ID < 80000) {

View file

@ -54,8 +54,10 @@ if (isset($_POST['check'])) {
foreach ($results as $result) {
if ($result['type'] == 'critical') {
echo "<p class='alert alert-bad'><span class='badge badge-critical'>Critical</span> ";
} else {
} elseif ($result['type'] == 'warning') {
echo "<p class='alert alert-warning'><span class='badge badge-warning'>Warning</span> ";
} elseif ($result['type'] == 'success') {
echo "<p class='alert alert-good'><span class='badge badge-primary'>Success</span> ";
}
if ($result['fix'] == 'auto') {

View file

@ -24,14 +24,11 @@
<footer>
<p>Copyright <?php echo $user_settings['user_name']; ?></p>
<hr>
<a class='link' href="https://github.com/Fluffy-Bean/image-gallery">Made by Fluffy</a>
<hr>
<p>V<?php echo $web_info['version']; ?></p>
<?php
if ($exec_time != 0) {
echo "<hr>
<p>Generated in ".$exec_time."ms ".$sql_time."</p>";
echo "<p>Generated in ".$exec_time."ms ".$sql_time."</p>";
}
?>
</footer>

View file

@ -729,37 +729,27 @@ nav .btn {
|-------------------------------------------------------------
*/
.pfp-upload {
display: flex;
flex-direction: column;
}
.pfp-upload form {
display: flex;
flex-direction: row;
gap: 0.5rem;
}
.pfp-upload form > * {
margin: 0 0 0.5rem 0;
}
.pfp-upload form > *:last-child {
margin: 0 0 0 0;
margin: 0;
}
.pfp-upload > img {
margin-left: 0.5rem;
width: 8rem;
height: 8rem;
margin: 0 auto 1rem;
width: 12rem;
height: 12rem;
-o-object-fit: cover;
object-fit: cover;
float: right;
border-radius: 3px;
background-color: #121212;
}
@media (max-width: 621px) {
.pfp-upload {
display: flex;
flex-direction: column-reverse;
}
.pfp-upload > img {
margin: 0 auto 1rem;
width: 12rem;
height: 12rem;
}
}
.tabs {
display: flex;
flex-direction: row;
@ -946,7 +936,7 @@ nav .btn {
position: relative;
}
.btn-code::before {
content: "Hover to show code";
content: "Hover to reveal";
color: #E8E3E3;
position: absolute;
top: 50%;
@ -960,11 +950,11 @@ nav .btn {
content: "";
}
.btn-code-reg {
.btn-icon {
width: auto !important;
display: inline-block !important;
}
.btn-code-reg img {
.btn-icon img {
margin: auto 2px;
width: 1.25rem;
height: 1.25rem;
@ -999,15 +989,18 @@ footer {
text-transform: uppercase;
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
gap: 0.5rem;
}
footer p {
margin: 0.2rem;
margin: 0;
padding: 0;
text-decoration: none;
font-family: "Secular One", sans-serif;
}
footer a {
margin: 0.2rem;
margin: 0;
padding: 0;
text-decoration: none;
font-family: "Secular One", sans-serif;
@ -1068,7 +1061,8 @@ body * {
text-decoration: none;
border: none;
border-radius: 3px;
transition: outline 0.1s cubic-bezier(0.19, 1, 0.22, 1);
outline: #E8E3E3 0 solid;
transition: outline 0.1s;
/*
&::after {
content: "";
@ -1108,7 +1102,7 @@ body * {
*/
}
.btn:where(input[type=file])::-webkit-file-upload-button {
margin: -0.25rem 0.5rem -0.25rem -0.25rem;
margin: -0.5rem 0.5rem -0.5rem -0.5rem;
padding: 0.5rem;
display: inline-block;
font-size: 16px;
@ -1119,7 +1113,7 @@ body * {
border-radius: 3px;
}
.btn:where(input[type=file])::file-selector-button {
margin: -0.25rem 0.5rem -0.25rem -0.25rem;
margin: -0.5rem 0.5rem -0.5rem -0.5rem;
padding: 0.5rem;
display: inline-block;
font-size: 16px;
@ -1259,7 +1253,7 @@ a.btn {
*/
form {
width: 100%;
box-sizing: content-box;
box-sizing: border-box;
}
form > * {
margin-bottom: 0.5rem;

View file

@ -85,7 +85,9 @@ body {
border-radius: 3px;
}
transition: outline 0.1s cubic-bezier(.19, 1, .22, 1);
outline: $fg 0 solid;
transition: outline 0.1s;
/*
&::after {
@ -112,7 +114,7 @@ body {
*/
&:hover {
outline: $white 0.2rem solid;
outline: $fg $border-thickness solid;
color: $fg;
cursor: pointer;
@ -129,7 +131,7 @@ body {
}
&:where(input[type="file"])::file-selector-button {
margin: -0.25rem 0.5rem -0.25rem -0.25rem;
margin: -0.5rem 0.5rem -0.5rem -0.5rem;
padding: 0.5rem;
display: inline-block;
@ -301,7 +303,7 @@ a.btn {
*/
form {
width: 100%;
box-sizing: content-box;
box-sizing: border-box;
& > * {
margin-bottom: 0.5rem;

View file

@ -717,25 +717,26 @@
*/
.pfp-upload {
display: flex;
flex-direction: row;
flex-direction: column;
form > * {
margin: 0 0 0.5rem 0;
}
form > *:last-child {
margin: 0 0 0 0;
form {
display: flex;
flex-direction: row;
gap: 0.5rem;
> * {
margin: 0;
}
}
& > img {
margin-left: 0.5rem;
margin: 0 auto 1rem;
width: 8rem;
height: 8rem;
width: 12rem;
height: 12rem;
object-fit: cover;
float: right;
@if calc($rad - 0.5rem) > 0 {
border-radius: calc($rad - 0.5rem);
} @else {
@ -745,19 +746,6 @@
}
}
@media (max-width: 621px) {
.pfp-upload {
display: flex;
flex-direction: column-reverse;
& > img {
margin: 0 auto 1rem;
width: 12rem;
height: 12rem;
}
}
}
.tabs {
display: flex; flex-direction: row;
@ -976,7 +964,7 @@
position: relative;
&::before {
content: "Hover to show code";
content: "Hover to reveal";
color: $fg;
position: absolute;
@ -994,7 +982,7 @@
}
}
.btn-code-reg {
.btn-icon {
width: auto !important;
display: inline-block !important;

View file

@ -13,9 +13,12 @@ footer {
text-transform: uppercase;
display: flex; flex-direction: row;
flex-wrap: wrap;
justify-content: center;
gap: 0.5rem;
p {
margin: 0.2rem;
margin: 0;
padding: 0;
text-decoration: none;
@ -24,7 +27,7 @@ footer {
}
a {
margin: 0.2rem;
margin: 0;
padding: 0;
text-decoration: none;