mirror of
https://github.com/Fluffy-Bean/image-gallery.git
synced 2025-01-29 17:28:27 +00:00
Code cleany cleany
This commit is contained in:
parent
7308f669a5
commit
a9780f59e7
|
@ -344,7 +344,7 @@
|
|||
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 = "<form id='toggleAdminConfirm' method='POST'>\
|
||||
<button id='toggleAdminSubmit' class='btn btn-bad' type='submit' value='"+id+"'>Make "+username+" powerfull!</button>\
|
||||
<button id='toggleAdminSubmit' class='btn btn-bad' type='submit' value='"+id+"'>Toggle "+username+"'s admin status</button>\
|
||||
</form>";
|
||||
|
||||
flyoutShow(header, description, actionBox);
|
||||
|
|
|
@ -125,10 +125,10 @@ if (isset($_POST['submit_login'])) {
|
|||
// let the user know
|
||||
?>
|
||||
<script>
|
||||
sniffleAdd('O hi <?php echo $_SESSION["username"]; ?>', 'You are now logged in! You will be redirected in a few seconds', 'var(--green)', 'assets/icons/hand-waving.svg');
|
||||
setTimeout(function(){window.location.href = "index.php";}, 2000);
|
||||
window.location.href = "index.php";
|
||||
</script>
|
||||
<?php
|
||||
$_SESSION['welc'] = true;
|
||||
|
||||
mysqli_query($conn,"INSERT INTO logs (ipaddress, action) VALUES('$user_ip','New loggin to ".$_SESSION['username']."')");
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ class Make {
|
|||
|
||||
$string = preg_replace('/ +/', ' ', $string);
|
||||
|
||||
$string = explode(" ", $string);
|
||||
$string = explode(' ', $string);
|
||||
$string_list = array();
|
||||
|
||||
foreach ($string as $i) {
|
||||
|
@ -46,9 +46,9 @@ class Make {
|
|||
}
|
||||
}
|
||||
|
||||
$string = implode(" ", $string_list);
|
||||
$string = implode(' ', $string_list);
|
||||
|
||||
return $string;
|
||||
return trim($string);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,12 +39,10 @@ if (isset($_POST['group_submit'])) {
|
|||
if (mysqli_stmt_execute($stmt)) {
|
||||
?>
|
||||
<script>
|
||||
sniffleAdd('Success!!!', 'Updates the image group! Redirecting.... soon', 'var(--green)', 'assets/icons/check.svg');
|
||||
setTimeout(function() {
|
||||
window.location.href = "group.php?id=<?php echo $_POST['group_id']; ?>";
|
||||
}, 2000);
|
||||
window.location.href = "group.php?id=<?php echo $_POST['group_id']; ?>";
|
||||
</script>
|
||||
<?php
|
||||
$_SESSION['msg'] = "Updated the image group!";
|
||||
} else {
|
||||
?>
|
||||
<script>
|
||||
|
@ -132,6 +130,7 @@ if (isset($_POST['new_group_submit'])) {
|
|||
window.location.href = "group.php?id=<?php echo $group_id; ?>";
|
||||
</script>
|
||||
<?php
|
||||
$_SESSION['msg'] = "New Group successfully made!";
|
||||
} else {
|
||||
?>
|
||||
<script>
|
||||
|
|
41
group.php
41
group.php
|
@ -14,7 +14,10 @@
|
|||
if (isset($_GET['id'])) {
|
||||
$group = $group_info->get_group_info($conn, $_GET['id']);
|
||||
|
||||
if (!isset($group) || empty($group)) header("Location: group.php");
|
||||
if (!isset($group) || empty($group)) {
|
||||
header("Location: group.php");
|
||||
$_SESSION['err'] = "You followed a broken link";
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
@ -28,6 +31,15 @@
|
|||
|
||||
<?php
|
||||
if (isset($_GET['id'])) {
|
||||
if (isset($_SESSION['msg'])) {
|
||||
?>
|
||||
<script>
|
||||
sniffleAdd("Info", "<?php echo $_SESSION['msg']; ?>", "var(--green)", "assets/icons/check.svg");
|
||||
</script>
|
||||
<?php
|
||||
unset($_SESSION['msg']);
|
||||
}
|
||||
|
||||
$image_list = array_reverse(explode(" ", $group['image_list']));
|
||||
|
||||
echo "<div class='group-banner defaultDecoration defaultSpacing defaultFonts'>
|
||||
|
@ -51,7 +63,7 @@
|
|||
if (!empty($group['image_list'])) echo "<p>Images: ".count(explode(" ", $group['image_list']))."</p>";
|
||||
|
||||
$upload_time = new DateTime($group['created_on']);
|
||||
echo "<p id='updateTime'>Created at: ".$upload_time->format('d/m/Y H:i:s T')."</p;>";
|
||||
echo "<p id='updateTime'>Created at: ".$upload_time->format('d/m/Y H:i:s T')."</p>";
|
||||
?>
|
||||
<script>
|
||||
var updateDate = new Date('<?php echo $upload_time->format('m/d/Y H:i:s T'); ?>');
|
||||
|
@ -138,15 +150,26 @@
|
|||
|
||||
$image_list = explode(" ", $group['image_list']);
|
||||
$cover_image = $image_info->get_image_info($conn, $image_list[array_rand($image_list, 1)]);
|
||||
// Getting thumbnail
|
||||
|
||||
if (!empty($cover_image['imagename'])) {
|
||||
echo "<div class='group-cover'>
|
||||
<span></span>
|
||||
<img src='images/".$cover_image['imagename']."'/>
|
||||
</div>";
|
||||
?>
|
||||
<div class='group-cover'>
|
||||
<span></span>
|
||||
<img <?php if(str_contains($cover_image['tags'], "nsfw")) echo "class='nsfw-blur'"; ?> src='images/<?php echo $cover_image['imagename']; ?>'/>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
echo "</div>";
|
||||
} else {
|
||||
if (isset($_SESSION['err'])) {
|
||||
?>
|
||||
<script>
|
||||
sniffleAdd("Error", "<?php echo $_SESSION['msg']; ?>", "var(--red)", "assets/icons/trash.svg");
|
||||
</script>
|
||||
<?php
|
||||
unset($_SESSION['err']);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
@ -264,9 +287,7 @@
|
|||
|
||||
?>
|
||||
<script>
|
||||
$('#createGroup').click(function() {
|
||||
sniffleAdd('*Thinking*', 'Creating your group now!', 'var(--green)', 'assets/icons/package.svg');
|
||||
|
||||
$('#createGroup').click(function() {
|
||||
$("#sniffle").load("app/image/group.php", {
|
||||
new_group_submit: "uwu"
|
||||
});
|
||||
|
|
|
@ -19,6 +19,14 @@
|
|||
<?php
|
||||
unset($_SESSION['del']);
|
||||
}
|
||||
if (isset($_SESSION['welc'])) {
|
||||
?>
|
||||
<script>
|
||||
sniffleAdd('O hi <?php echo $_SESSION["username"]; ?>', 'You are now logged in, enjoy your stay!', 'var(--green)', 'assets/icons/hand-waving.svg');
|
||||
</script>
|
||||
<?php
|
||||
unset($_SESSION['welc']);
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="info-text defaultFonts">
|
||||
|
|
Loading…
Reference in a new issue