From 6b7e714b59e28bc138681662006941274c3261af Mon Sep 17 00:00:00 2001
From: Jonas Kohl
Date: Mon, 16 Sep 2024 19:32:09 +0200
Subject: A lot more stuff
---
src/application/views/view_post.php | 26 ++++++++++++++++++++++----
1 file changed, 22 insertions(+), 4 deletions(-)
(limited to 'src/application/views/view_post.php')
diff --git a/src/application/views/view_post.php b/src/application/views/view_post.php
index 510b22c..fe885bc 100644
--- a/src/application/views/view_post.php
+++ b/src/application/views/view_post.php
@@ -6,8 +6,10 @@ use mystic\forum\orm\Attachment;
/** @var mystic\forum\orm\Post $post */
/** @var mystic\forum\orm\User $postAuthor */
-$fileAttachments = array_filter($attachments, fn(Attachment $a) => !str_starts_with($a->mimeType, "image/"));
-$imageAttachments = array_filter($attachments, fn(Attachment $a) => str_starts_with($a->mimeType, "image/"));
+$isImage = fn(string $m) => str_starts_with($m, "image/") || str_starts_with($m, "video/");
+
+$fileAttachments = array_filter($attachments, fn(Attachment $a) => !$isImage($a->mimeType));
+$imageAttachments = array_filter($attachments, fn(Attachment $a) => $isImage($a->mimeType));
$canReply = $GLOBALS["currentUser"]?->hasPermission(UserPermissions::CREATE_OWN_POST) ?? false;
@@ -17,9 +19,12 @@ $canEdit = ($GLOBALS["currentUser"]?->id === $postAuthor?->id && $postAuthor?->h
$canDelete = ($GLOBALS["currentUser"]?->id === $postAuthor?->id && $postAuthor?->hasPermission(UserPermissions::DELETE_OWN_POST))
|| ($GLOBALS["currentUser"]?->hasPermission(UserPermissions::DELETE_OTHER_POST));
+$canViewAttachments = $GLOBALS["currentUser"] !== null;
+
$hide_actions ??= false;
$hide_pfp ??= false;
$your_are_the_author = $GLOBALS["currentUser"]?->id === $postAuthor?->id;
+$is_op = $postAuthor?->id === $topicAuthor?->id && $postAuthor?->id !== null;
?>
@@ -78,6 +83,9 @@ $your_are_the_author = $GLOBALS["currentUser"]?->id === $postAuthor?->id;
= htmlentities($postAuthor->displayName) ?>
= htmlentities($postAuthor->displayName) ?>
+
+ " class="text-info glyphicon glyphicon-comment">
+
= __("You") ?>
@@ -101,8 +109,13 @@ $your_are_the_author = $GLOBALS["currentUser"]?->id === $postAuthor?->id;
-
+ video-attachment" href="?_action=attachment&attachment== htmlentities(urlencode($attachment->id)) ?>" title="= htmlentities($attachment->name) ?>" data-attachment-id="= htmlentities($attachment->id) ?>">
+
+
+ mimeType, "video/")): ?>
+
+
@@ -116,7 +129,12 @@ $your_are_the_author = $GLOBALS["currentUser"]?->id === $postAuthor?->id;
- = htmlentities($attachment->name) ?>
+
+
+
+
+ = htmlentities($attachment->name) ?>
+
--
cgit v1.2.3