Setting time to viwers local

Fixing image sizes
Dont allow HTML in Description
This commit is contained in:
Michał Gdula 2022-09-13 13:24:48 +00:00
parent b5375414bc
commit d548f967c5
4 changed files with 25 additions and 8 deletions

View file

@ -300,6 +300,7 @@ nav .btn {
width: 100%; width: 100%;
max-height: 50vh; max-height: 50vh;
height: auto; height: auto;
min-height: 30vh;
display: flex; display: flex;
background-color: rgba(21, 21, 21, 0.7333333333); background-color: rgba(21, 21, 21, 0.7333333333);
-webkit-backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
@ -314,7 +315,7 @@ nav .btn {
} }
} }
.image { .image {
margin: 0 auto; margin: auto;
max-width: 100%; max-width: 100%;
width: auto; width: auto;
max-height: inherit; max-height: inherit;

View file

@ -175,6 +175,7 @@
width: 100%; width: 100%;
max-height: 50vh; max-height: 50vh;
height: auto; height: auto;
min-height: 30vh;
display: flex; display: flex;
@ -193,7 +194,7 @@
} }
.image { .image {
margin: 0 auto; margin: auto;
max-width: 100%; max-width: 100%;
width: auto; width: auto;

View file

@ -163,7 +163,7 @@
<div class="image-description default-window"> <div class="image-description default-window">
<h2>Description</h2> <h2>Description</h2>
<p><?php echo $image_alt; ?></p> <p><?php echo htmlentities($image_alt, ENT_QUOTES); ?></p>
</div> </div>
@ -178,9 +178,24 @@
// Image ID // Image ID
echo "<p>ID: ".$image['id']."</p>"; echo "<p>ID: ".$image['id']."</p>";
// Image Upload date // Last time image was updated
echo "<p>Last updated: +0 ".$image['upload']."</p>"; $update_time = new DateTime($image['upload']);
echo "<p id='updateTime'>Last updated: ".$update_time->format('d/m/Y H:i:s T')."</p>";
?> ?>
<script>
// Updating time to Viewers local
var updateDate = new Date('<?php echo $update_time->format('m/d/Y H:i:s T'); ?>');
var format = {year: 'numeric',
month: 'short',
day: 'numeric',
hour: '2-digit',
minute: '2-digit'
};
updateDate = updateDate.toLocaleDateString('en-GB', format);
$("#updateTime").html("Last updated: "+updateDate);
</script>
</div> </div>
<div> <div>
<?php <?php
@ -304,8 +319,8 @@
</form>"; </form>";
flyoutShow(header, description, actionBox); flyoutShow(header, description, actionBox);
$('#descriptionInput').val("<?php echo $image['alt']; ?>"); $('#descriptionInput').val("<?php echo str_replace('"', '\"', $image_alt); ?>");
$("#descriptionConfirm").submit(function(event) { $("#descriptionConfirm").submit(function(event) {
event.preventDefault(); event.preventDefault();
var descriptionInput = $("#descriptionInput").val(); var descriptionInput = $("#descriptionInput").val();

View file

@ -42,7 +42,7 @@ include "app/server/secrete.php";
/* /*
Classes Classes
*/ */
include 'app/app.php'; require_once 'app/app.php';
?> ?>
<script> <script>