summaryrefslogtreecommitdiff
path: root/src/application/views/view_post.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/application/views/view_post.php')
-rw-r--r--src/application/views/view_post.php53
1 files changed, 42 insertions, 11 deletions
diff --git a/src/application/views/view_post.php b/src/application/views/view_post.php
index 0776fb5..5022d4a 100644
--- a/src/application/views/view_post.php
+++ b/src/application/views/view_post.php
@@ -11,36 +11,49 @@ $canReply = $GLOBALS["currentUser"]?->hasPermission(UserPermissions::CREATE_OWN_
$canDelete = ($GLOBALS["currentUser"]?->id === $postAuthor?->id && $postAuthor?->hasPermission(UserPermissions::DELETE_OWN_POST))
|| ($GLOBALS["currentUser"]?->hasPermission(UserPermissions::DELETE_OTHER_POST));
+$hide_actions ??= false;
+$hide_pfp ??= false;
+$your_are_the_author = $GLOBALS["currentUser"]?->id === $postAuthor?->id;
+
?>
<?php if ($post->deleted): ?>
-<div class="media">
+<div class="media" id="post-<?= htmlentities($post->id) ?>">
<div class="media-left hidden-sm hidden-xs">
<div class="media-object" style="width:64px"></div>
</div>
<div class="media-body">
- <div class="well">
+ <div class="well icon-well text-warning">
+ <span class="glyphicon glyphicon-exclamation-sign color-warning" aria-hidden="true"></span>
<em>This post has been deleted</em>
</div>
</div>
</div>
<?php else: ?>
-<div class="media">
+<div class="media" id="post-<?= htmlentities($post->id) ?>">
+<?php if (!$hide_pfp): ?>
<div class="media-left hidden-sm hidden-xs">
<?php if ($postAuthor): ?>
- <a href="?_action=viewuser&amp;user=<?= htmlentities(urlencode($postAuthor->id)) ?>">
- <img class="media-object" src="/ui/placeholder.svg" alt="" width="64" height="64">
- </a>
+ <?php if ($hide_actions): ?>
+ <img class="media-object" alt="Profile picture" src="?_action=profilepicture&amp;user=<?= htmlentities(urlencode($postAuthor->id)) ?>" alt="" width="64" height="64">
+ <?php else: ?>
+ <a href="?_action=viewuser&amp;user=<?= htmlentities(urlencode($postAuthor->id)) ?>">
+ <img class="media-object" alt="Profile picture" src="?_action=profilepicture&amp;user=<?= htmlentities(urlencode($postAuthor->id)) ?>" alt="" width="64" height="64">
+ </a>
+ <?php endif; ?>
<?php else: ?>
<div class="media-object" style="width:64px;height:64px"></div>
<?php endif; ?>
</div>
+<?php endif; ?>
<div class="media-body">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
+ <?php if (!$hide_actions): ?>
<div class="pull-right">
<?php if ($canReply): ?>
+ <a href="#post-<?= htmlentities(urlencode($post->id)) ?>" class="btn btn-default"><span class="glyphicon glyphicon-link" aria-hidden="true"></span><span class="sr-only">Permalink</span></a>
<button data-text="<?= htmlentities($post->content) ?>" class="btn btn-default js-only _reply-post"><span class="glyphicon glyphicon-share-alt" aria-hidden="true"></span><span class="sr-only">Reply to post</span></button>
<?php endif; ?>
<?php if ($canDelete): ?>
@@ -50,8 +63,16 @@ $canDelete = ($GLOBALS["currentUser"]?->id === $postAuthor?->id && $postAuthor?-
</form>
<?php endif; ?>
</div>
+ <?php endif; ?>
<?php if ($postAuthor): ?>
- <a href="?_action=viewuser&amp;user=<?= htmlentities(urlencode($postAuthor->id)) ?>"><?= htmlentities($postAuthor->displayName) ?></a>
+ <?php if ($hide_actions): ?>
+ <?= htmlentities($postAuthor->displayName) ?>
+ <?php else: ?>
+ <a href="?_action=viewuser&amp;user=<?= htmlentities(urlencode($postAuthor->id)) ?>"><?= htmlentities($postAuthor->displayName) ?></a>
+ <?php endif; ?>
+ <?php if ($your_are_the_author): ?>
+ <span class="text-normal label label-primary">You</span>
+ <?php endif; ?>
<?php else: ?>
<em class="text-muted">(deleted)</em>
<?php endif; ?>
@@ -63,9 +84,15 @@ $canDelete = ($GLOBALS["currentUser"]?->id === $postAuthor?->id && $postAuthor?-
<?php if (count($imageAttachments) > 0): ?>
<div class="post-images clearfix">
<?php /** @var Attachment $attachment */ foreach ($imageAttachments as $attachment): ?>
- <a class="image-attachment" href="?_action=attachment&amp;attachment=<?= htmlentities(urlencode($attachment->id)) ?>" title="<?= htmlentities($attachment->name) ?>">
- <img class="image-attachment-image" src="?_action=thumb&amp;attachment=<?= htmlentities(urlencode($attachment->id)) ?>" alt="" width="110">
- </a>
+ <?php if ($hide_actions): ?>
+ <span class="image-attachment" title="<?= htmlentities($attachment->name) ?>">
+ <img class="image-attachment-image" src="?_action=thumb&amp;attachment=<?= htmlentities(urlencode($attachment->id)) ?>" alt="" width="110">
+ </span>
+ <?php else: ?>
+ <a class="image-attachment" href="?_action=attachment&amp;attachment=<?= htmlentities(urlencode($attachment->id)) ?>" title="<?= htmlentities($attachment->name) ?>">
+ <img class="image-attachment-image" src="?_action=thumb&amp;attachment=<?= htmlentities(urlencode($attachment->id)) ?>" alt="" width="110">
+ </a>
+ <?php endif; ?>
<?php endforeach; ?>
</div>
<?php endif; ?>
@@ -74,7 +101,11 @@ $canDelete = ($GLOBALS["currentUser"]?->id === $postAuthor?->id && $postAuthor?-
<div class="panel-footer">
<div class="btn-group">
<?php /** @var Attachment $attachment */ foreach ($fileAttachments as $attachment): ?>
- <a class="btn btn-default" href="?_action=attachment&amp;attachment=<?= htmlentities(urlencode($attachment->id)) ?>"><?= htmlentities($attachment->name) ?></a>
+ <?php if ($hide_actions): ?>
+ <button class="btn btn-default"><?= htmlentities($attachment->name) ?></button>
+ <?php else: ?>
+ <a class="btn btn-default" href="?_action=attachment&amp;attachment=<?= htmlentities(urlencode($attachment->id)) ?>"><?= htmlentities($attachment->name) ?></a>
+ <?php endif; ?>
<?php endforeach; ?>
</div>
</div>