mirror of
https://github.com/Fluffy-Bean/image-gallery.git
synced 2025-01-14 10:35:13 +00:00
Random Group fixes
This commit is contained in:
parent
8ecd3f5921
commit
d8f2166a1f
|
@ -120,7 +120,7 @@ if (isset($_POST['title_submit'])) {
|
|||
|
||||
if (isset($_POST['new_group_submit'])) {
|
||||
if ($user_info->is_loggedin()) {
|
||||
$group_name = $_SESSION['username']." new image group";
|
||||
$group_name = $_SESSION['username']."\'s Group";
|
||||
$sql = "INSERT INTO groups (group_name, author, image_list) VALUES('$group_name', '".$_SESSION['id']."', '')";
|
||||
|
||||
mysqli_query($conn, $sql);
|
||||
|
|
|
@ -31,10 +31,7 @@ if (isset($_POST['submit_delete'])) {
|
|||
// Delete from table
|
||||
$sql = "DELETE FROM images WHERE id = ?";
|
||||
if ($stmt = mysqli_prepare($conn, $sql)) {
|
||||
mysqli_stmt_bind_param($stmt, "i", $param_id);
|
||||
|
||||
// Setting parameters
|
||||
$param_id = $_POST['id'];
|
||||
mysqli_stmt_bind_param($stmt, "i", $_POST['id']);
|
||||
|
||||
// Attempt to execute the prepared statement
|
||||
if (mysqli_stmt_execute($stmt)) {
|
||||
|
@ -52,9 +49,10 @@ if (isset($_POST['submit_delete'])) {
|
|||
}
|
||||
// TP user to the homepage with a success message
|
||||
mysqli_query($conn,"INSERT INTO logs (ipaddress, action) VALUES('$user_ip','Deleted image ".$_POST['id']."')");
|
||||
$_SESSION['del'] = $_POST['id'];
|
||||
?>
|
||||
<script>
|
||||
window.location.replace("index.php?del=true&id=<?php echo $_POST['id']; ?>");
|
||||
window.location.replace("index.php");
|
||||
</script>
|
||||
<?php
|
||||
} else {
|
||||
|
|
|
@ -15,7 +15,7 @@ $loggedin = new Account();
|
|||
<a class='btn' href='group.php'><img class='svg' src='assets/icons/package.svg'><span class='nav-hide'>Groups</span></a>
|
||||
<hr>
|
||||
<?php
|
||||
if ($loggedin->is_loggedin()) {
|
||||
if ($_SESSION["loggedin"]) {
|
||||
?>
|
||||
<a class='btn' href='upload.php'><img class='svg' src='assets/icons/upload.svg'><span class='nav-hide'>Upload</span></a>
|
||||
<hr>
|
||||
|
|
51
css/main.css
51
css/main.css
|
@ -243,7 +243,7 @@ nav .btn {
|
|||
max-width: calc(20% - 0.5rem);
|
||||
min-width: calc(20% - 0.5rem);
|
||||
background-color: #151515;
|
||||
border-radius: -0.1rem;
|
||||
border-radius: -0.3rem;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
flex: 1 0 150px;
|
||||
|
@ -487,6 +487,48 @@ nav .btn {
|
|||
| Groups
|
||||
|-------------------------------------------------------------
|
||||
*/
|
||||
.group-banner {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.group-description {
|
||||
height: auto;
|
||||
width: auto;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
.group-description > * {
|
||||
margin: 0 0 0.5rem 0;
|
||||
}
|
||||
|
||||
.group-cover {
|
||||
height: 100%;
|
||||
max-width: 40%;
|
||||
width: auto;
|
||||
position: absolute;
|
||||
display: inline-block;
|
||||
right: 0;
|
||||
top: 0;
|
||||
overflow: hidden;
|
||||
z-index: 0;
|
||||
}
|
||||
.group-cover span {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
background: linear-gradient(to right, #151515, rgba(21, 21, 21, 0.7333333333));
|
||||
z-index: 1;
|
||||
border-radius: 0.2rem;
|
||||
}
|
||||
.group-cover img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
-o-object-fit: cover;
|
||||
object-fit: cover;
|
||||
margin-left: auto;
|
||||
border-radius: 0.2rem;
|
||||
}
|
||||
|
||||
.selectedImage {
|
||||
outline: #8C977D solid 0.3rem;
|
||||
}
|
||||
|
@ -503,6 +545,7 @@ nav .btn {
|
|||
font-size: 17px;
|
||||
font-family: "Secular One", sans-serif;
|
||||
text-decoration: none;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.gallery-group {
|
||||
|
@ -516,14 +559,14 @@ nav .btn {
|
|||
z-index: 5;
|
||||
}
|
||||
|
||||
.group-item:hover .gallery-group {
|
||||
.group-item .gallery-group {
|
||||
-webkit-backdrop-filter: brightness(0.5);
|
||||
backdrop-filter: brightness(0.5);
|
||||
}
|
||||
.group-item:hover .nsfw-warning > * {
|
||||
.group-item .nsfw-warning > * {
|
||||
display: none;
|
||||
}
|
||||
.group-item:hover .group-name {
|
||||
.group-item .group-name {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
min-width: calc(20% - 0.5rem);
|
||||
|
||||
background-color: $bg;
|
||||
border-radius: calc($rad - 0.5rem);
|
||||
border-radius: calc($rad - 0.7rem);
|
||||
|
||||
position: relative;
|
||||
|
||||
|
@ -384,6 +384,64 @@
|
|||
| Groups
|
||||
|-------------------------------------------------------------
|
||||
*/
|
||||
.group-banner {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.group-description {
|
||||
height: auto;
|
||||
width: auto;
|
||||
|
||||
position: relative;
|
||||
|
||||
z-index: +1;
|
||||
|
||||
& > * {
|
||||
margin: 0 0 0.5rem 0;
|
||||
}
|
||||
}
|
||||
|
||||
.group-cover {
|
||||
height: 100%;
|
||||
max-width: 40%;
|
||||
width: auto;
|
||||
|
||||
position: absolute;
|
||||
|
||||
display: inline-block;
|
||||
|
||||
right: 0;
|
||||
top: 0;
|
||||
|
||||
overflow: hidden;
|
||||
|
||||
z-index: 0;
|
||||
|
||||
span {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
position: absolute;
|
||||
|
||||
background: linear-gradient(to right, $bg, $bg-alt);
|
||||
|
||||
z-index: +1;
|
||||
|
||||
border-radius: calc($rad - 0.2rem);
|
||||
}
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
object-fit: cover;
|
||||
|
||||
margin-left: auto;
|
||||
|
||||
border-radius: calc($rad - 0.2rem);
|
||||
}
|
||||
}
|
||||
|
||||
.selectedImage {
|
||||
outline: $page-accent solid 0.3rem;
|
||||
}
|
||||
|
@ -403,6 +461,7 @@
|
|||
font-size: 17px;
|
||||
font-family: $font-body;
|
||||
text-decoration: none;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.gallery-group {
|
||||
|
@ -419,16 +478,14 @@
|
|||
}
|
||||
|
||||
.group-item {
|
||||
&:hover {
|
||||
& .gallery-group {
|
||||
backdrop-filter: brightness(0.5);
|
||||
}
|
||||
& .nsfw-warning > * {
|
||||
display: none;
|
||||
}
|
||||
& .group-name {
|
||||
opacity: 1;
|
||||
}
|
||||
& .gallery-group {
|
||||
backdrop-filter: brightness(0.5);
|
||||
}
|
||||
& .nsfw-warning > * {
|
||||
display: none;
|
||||
}
|
||||
& .group-name {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
35
group.php
35
group.php
|
@ -30,7 +30,8 @@
|
|||
if (isset($_GET['id'])) {
|
||||
$image_list = array_reverse(explode(" ", $group['image_list']));
|
||||
|
||||
echo "<div class='defaultDecoration defaultSpacing defaultFonts'>";
|
||||
echo "<div class='group-banner defaultDecoration defaultSpacing defaultFonts'>
|
||||
<div class='group-description'>";
|
||||
|
||||
echo "<h2>".$group['group_name']."</h2>";
|
||||
|
||||
|
@ -42,11 +43,13 @@
|
|||
$members_array = array();
|
||||
foreach ($group_members as $member) {
|
||||
$member_info = $user_info->get_user_info($conn, $member);
|
||||
if (!empty($member_info['username'])) $members_array[] = $member_info['username'];
|
||||
if (!empty($member_info['username'])) $members_array[] = "<a class='link' href='profile.php?user=".$member_info['id']."'>".$member_info['username']."</a>";
|
||||
}
|
||||
echo "<p>Members: ".implode(", ", $members_array)."</p>";
|
||||
}
|
||||
|
||||
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;>";
|
||||
?>
|
||||
|
@ -88,8 +91,8 @@
|
|||
?>
|
||||
<script>
|
||||
$('#editTitle').click(function() {
|
||||
var header = "Enter new Description/Alt";
|
||||
var description = "Newwww photo group name!";
|
||||
var header = "Newwww photo group name!";
|
||||
var description = "What will it be? uwu";
|
||||
var actionBox = "<form id='titleForm' action='app/image/edit_description.php' method='POST'>\
|
||||
<input id='titleText' class='btn btn-neutral' type='text' placeholder='New title'>\
|
||||
<button id='titleSubmit' class='btn btn-bad' type='submit'><img class='svg' src='assets/icons/edit.svg'>Update title</button>\
|
||||
|
@ -120,7 +123,7 @@
|
|||
echo "<input style='display: none;' type='checkbox' id='".$image['id']."' name='".$image['id']."'/>";
|
||||
}
|
||||
}
|
||||
echo "<button id='groupSubmit' class='btn btn-good' type='submit'>Update Images</button>
|
||||
echo "<button id='groupSubmit' class='btn btn-good' type='submit'>Save changes</button>
|
||||
</form>";
|
||||
|
||||
echo "<a href='group.php?id=".$_GET['id']."' class='btn btn-neutral'>Back</a>";
|
||||
|
@ -132,11 +135,27 @@
|
|||
}
|
||||
|
||||
echo "</div>";
|
||||
|
||||
$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>";
|
||||
}
|
||||
|
||||
echo "</div>";
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="gallery-root defaultDecoration">
|
||||
<?php
|
||||
<?php
|
||||
if (empty($group['image_list']) && $_GET['mode'] != "edit" && !empty($_GET['id'])) {
|
||||
echo "<div id='gallery' class='gallery-root defaultDecoration' style='display: none;'>";
|
||||
} else {
|
||||
echo "<div id='gallery' class='gallery-root defaultDecoration' >";
|
||||
}
|
||||
if (isset($_GET['id']) && !empty($_GET['id'])) {
|
||||
if (isset($_GET['mode']) && $_GET['mode'] == "edit") {
|
||||
$image_request = mysqli_query($conn, "SELECT * FROM images ORDER BY id DESC");
|
||||
|
@ -238,7 +257,7 @@
|
|||
}
|
||||
}
|
||||
} elseif (!isset($_GET['id']) && empty($_GET['id'])) {
|
||||
if ($user_info->is_loggedin()) {
|
||||
if ($_SESSION["loggedin"]) {
|
||||
echo "<div class='group-make'>
|
||||
<button id='createGroup'><img class='svg' src='assets/icons/plus.svg'><span>Make new group</span></button>
|
||||
</div>";
|
||||
|
|
|
@ -11,12 +11,13 @@
|
|||
<?php
|
||||
require_once __DIR__."/assets/ui/nav.php";
|
||||
|
||||
if ($_GET['del']) {
|
||||
if (isset($_SESSION['del'])) {
|
||||
?>
|
||||
<script>
|
||||
sniffleAdd("Image Deleted", "Successfully deleted image: <?php echo $_GET['id']; ?>", "var(--green)", "assets/icons/trash.svg");
|
||||
sniffleAdd("Image Deleted", "Successfully deleted image: <?php echo $_SESSION['del']; ?>", "var(--green)", "assets/icons/trash.svg");
|
||||
</script>
|
||||
<?php
|
||||
unset($_SESSION['del']);
|
||||
}
|
||||
?>
|
||||
|
||||
|
|
|
@ -93,10 +93,7 @@
|
|||
$("#postCount").html("Posts: "+postCount);
|
||||
|
||||
var updateDate = new Date('<?php echo $join_date->format('m/d/Y T'); ?>');
|
||||
var format = {year: 'numeric',
|
||||
month: 'short',
|
||||
day: 'numeric'
|
||||
};
|
||||
var format = {year: 'numeric', month: 'short', day: 'numeric'};
|
||||
|
||||
updateDate = updateDate.toLocaleDateString('en-GB', format);
|
||||
|
||||
|
|
Loading…
Reference in a new issue