From 33a3107844d800047ab1baa124a687032fd119d6 Mon Sep 17 00:00:00 2001
From: Floorb <132411956+Neetpone@users.noreply.github.com>
Date: Tue, 29 Aug 2023 03:32:49 -0400
Subject: [PATCH] fix(pastes): make expiry 1h work and make expiry display work
---
includes/Models/Paste.php | 7 +++----
public/index.php | 2 +-
theme/bulma/main.php | 2 +-
theme/bulma/view.php | 2 +-
4 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/includes/Models/Paste.php b/includes/Models/Paste.php
index a4f81c3..04794ee 100644
--- a/includes/Models/Paste.php
+++ b/includes/Models/Paste.php
@@ -55,15 +55,14 @@ class Paste extends Model {
if ($expiry == 'SELF') {
return 'View Once';
}
-
- var_dump($expiry);
-
- $dateTime = new DateTime($expiry);
+
+ $dateTime = new DateTime();
$dateTime->setTimestamp($expiry);
$ret = $dateTime->format('Y-m-d H:i:s');
if ($dateTime->diff(new DateTime())->days < 1) {
$ret = "$ret";
}
+
return $ret;
}
diff --git a/public/index.php b/public/index.php
index 7116126..0cd1435 100644
--- a/public/index.php
+++ b/public/index.php
@@ -37,7 +37,7 @@ function calculatePasteExpiry(string $expiry) : ?string {
return 'SELF';
}
- $valid_expiries = ['0Y0M0DT0H10M', '1H', '1D', '1W', '2W', '1M'];
+ $valid_expiries = ['0Y0M0DT0H10M', 'T1H', '1D', '1W', '2W', '1M'];
return in_array($expiry, $valid_expiries)
? (new DateTime())->add(new DateInterval("P{$expiry}"))->format('U')
diff --git a/theme/bulma/main.php b/theme/bulma/main.php
index 84136b6..7a01d02 100644
--- a/theme/bulma/main.php
+++ b/theme/bulma/main.php
@@ -92,7 +92,7 @@
diff --git a/theme/bulma/view.php b/theme/bulma/view.php
index 28ee3fc..f0924d7 100644
--- a/theme/bulma/view.php
+++ b/theme/bulma/view.php
@@ -268,7 +268,7 @@
-
+