pkg_comments.php 1.94 KB
Newer Older
1
<?php
2
$base_id = pkgbase_from_pkgid($row['ID']);
3
$count = pkgbase_comments_count($base_id);
4
?>
5
6
<div id="news">
	<h3>
7
		<a href="<?= htmlentities(get_pkgbase_uri($pkgbase_name), ENT_QUOTES) . '?' . mkurl('comments=all') ?>" title="<?= __('View all %s comments' , $count) ?>"><?= __('Latest Comments') ?></a>
8
9
10
11
		<span class="arrow"></span>
	</h3>

	<?php while (list($indx, $row) = each($comments)): ?>
12
		<?php if ($row['UserName'] && $SID):
13
			$row['UserName'] = "<a href=\"" . get_user_uri($row['UserName']) . "\">{$row['UserName']}</a>";
14
15
		endif; ?>
		<h4>
Lukas Fleischer's avatar
Lukas Fleischer committed
16
			<?php if (can_delete_comment_array($row)): ?>
17
				<form method="post" action="<?= htmlspecialchars(get_pkgbase_uri($pkgbase_name), ENT_QUOTES); ?>">
18
19
					<fieldset style="display:inline;">
						<input type="hidden" name="action" value="do_DeleteComment" />
Lukas Fleischer's avatar
Lukas Fleischer committed
20
21
22
						<input type="hidden" name="comment_id" value="<?= $row['ID'] ?>" />
						<input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
						<input type="image" src="/images/x.png" alt="<?= __('Delete comment') ?>" name="submit" value="1" />
23
					</fieldset>
24
					<?php if ($row['UserName']): ?>
25
					<?= __('Comment by %s', $row['UserName']) ?>
26
27
28
					<?php else: ?>
					<?= __('Anonymous comment') ?>
					<?php endif; ?>
29
				</form>
30
			<?php else: ?>
31
			<?php if ($row['UserName']): ?>
Lukas Fleischer's avatar
Lukas Fleischer committed
32
			<?= __('Comment by %s', $row['UserName']) ?>
33
34
35
			<?php else: ?>
			<?= __('Anonymous comment') ?>
			<?php endif; ?>
36
			<?php endif; ?>
37
		</h4>
Lukas Fleischer's avatar
Lukas Fleischer committed
38
		<p class="timestamp"><?= gmdate('Y-m-d H:i', $row['CommentTS']) ?></p>
39
40
		<div class="article-content">
			<p>
Lukas Fleischer's avatar
Lukas Fleischer committed
41
				<?= parse_comment($row['Comments']) ?>
42
43
44
			</p>
		</div>
	<?php endwhile; ?>
45
</div>
46

47
48
49
<?php if ($count > 10 && !isset($_GET['comments'])): ?>
<div id="news">
	<h3>
50
		<a href="<?= htmlentities(get_pkgbase_uri($pkgbase_name), ENT_QUOTES) . '?' . mkurl('comments=all') ?>" title="<?= __('View all %s comments', $count) ?>"><?= __('All comments', $count) ?></a>
51
52
53
	</h3>
</div>
<?php endif; ?>