mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 09:43:03 +00:00
Add support for anonymous comments
This allows for removing users without also removing the corresponding comments. Instead, all comments from deleted users will be displayed as "Anonymous comment". Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
parent
6ee1321211
commit
fb7bde3a6c
4 changed files with 33 additions and 8 deletions
|
@ -208,11 +208,11 @@ function package_comments($pkgid) {
|
|||
if ($pkgid > 0) {
|
||||
$dbh = DB::connect();
|
||||
$q = "SELECT PackageComments.ID, UserName, UsersID, Comments, CommentTS ";
|
||||
$q.= "FROM PackageComments, Users ";
|
||||
$q.= "WHERE PackageComments.UsersID = Users.ID";
|
||||
$q.= " AND PackageID = " . $pkgid;
|
||||
$q.= " AND DelUsersID IS NULL"; # only display non-deleted comments
|
||||
$q.= " ORDER BY CommentTS DESC";
|
||||
$q.= "FROM PackageComments LEFT JOIN Users ";
|
||||
$q.= "ON PackageComments.UsersID = Users.ID ";
|
||||
$q.= "WHERE PackageID = " . $pkgid . " ";
|
||||
$q.= "AND DelUsersID IS NULL "; # only display non-deleted comments
|
||||
$q.= "ORDER BY CommentTS DESC";
|
||||
|
||||
if (!isset($_GET['comments'])) {
|
||||
$q.= " LIMIT 10";
|
||||
|
|
|
@ -10,7 +10,7 @@ $pkgname = $row['Name'];
|
|||
</h3>
|
||||
|
||||
<?php while (list($indx, $row) = each($comments)): ?>
|
||||
<?php if ($SID):
|
||||
<?php if ($row['UserName'] && $SID):
|
||||
$row['UserName'] = "<a href=\"" . get_user_uri($row['UserName']) . "\">{$row['UserName']}</a>";
|
||||
endif; ?>
|
||||
<h4>
|
||||
|
@ -22,10 +22,18 @@ $pkgname = $row['Name'];
|
|||
<input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
|
||||
<input type="image" src="/images/x.png" alt="<?= __('Delete comment') ?>" name="submit" value="1" />
|
||||
</fieldset>
|
||||
<?php if ($row['UserName']): ?>
|
||||
<?= __('Comment by %s', $row['UserName']) ?>
|
||||
<?php else: ?>
|
||||
<?= __('Anonymous comment') ?>
|
||||
<?php endif; ?>
|
||||
</form>
|
||||
<?php else: ?>
|
||||
<?php if ($row['UserName']): ?>
|
||||
<?= __('Comment by %s', $row['UserName']) ?>
|
||||
<?php else: ?>
|
||||
<?= __('Anonymous comment') ?>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</h4>
|
||||
<p class="timestamp"><?= gmdate('Y-m-d H:i', $row['CommentTS']) ?></p>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue