1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
<?php /* Copyright (c) 2024 Freya Murphy */ ?>
<?php /* vi: syntax=php */ ?>
<div class="post card">
<div class="row">
<?php $this->view('template/pfp', array('user' => $user))?>
<div class="col ml">
<strong><?=$user['first_name'] . ' ' . $user['last_name']?></strong>
<span class="dim"><?=$post['created']?></span>
</div>
</div>
<p>
<?=$post['content']?>
</p>
<?php
$self = $this->main->user();
$liked = $post['like_id'] ? 'btn-blue' : '';
$post_attrs = array(
'postId' => $post['id']
);
if ($post['like_id'] !== NULL) {
$post_attrs['likeId'] = $post['like_id'];
}
?>
<?php if ($self): ?>
<hr>
<div class="row">
<?=ilang('action_like',
class: 'btn btn-wide action-like ' . $liked,
attrs: $post_attrs
)?>
<?=ilang('action_comment', class: 'btn btn-wide action-comment',
click: '$(\'#action-new-comment-' . $post['id'] . '\').focus()'
)?>
</div>
<hr>
<?php endif; ?>
<div class="col comments pb">
<?php
$_GET = array('id' => $post['id']);
$cdata = $this->comments();
$loaded = $cdata['loaded'];
$max = $cdata['max'];
$page_size = $cdata['page_size'];
$total = $post['comment_count'];
if ($loaded >= $page_size && $page_size < $total) {
ilang('action_load_comments',
class: 'action-load-comments btn btn-line mt',
attrs: array(
'postId' => $post['id'],
'loaded' => $loaded,
'pageSize' => $page_size,
'commentCount' => $total,
'commentMax' => $max,
)
);
}
?>
</div>
<?php if ($self): ?>
<div class="row pb">
<?php $this->view('template/pfp', array('user' => $self))?>
<form class="ml action-new-comment-form row">
<input
type="hidden"
name="id"
value="<?=$post['id']?>"
>
<input
id="action-new-comment-<?=$post['id']?>"
class="action-new-comment btn btn-wide btn-alt"
postId="<?=$post['id']?>"
autocomplete="off"
type="text"
name="text"
placeholder="<?=lang('action_new_comment_text')?>"
aria-label="<?=lang('action_new_comment_tip')?>"
>
</form>
</div>
<?php endif; ?>
</div>
|