From fb7bde3a6ca049700a691324c21005ae26782584 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Tue, 4 Feb 2014 18:39:49 +0100 Subject: 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 --- web/lib/pkgfuncs.inc.php | 10 +++++----- web/template/pkg_comments.php | 10 +++++++++- 2 files changed, 14 insertions(+), 6 deletions(-) (limited to 'web') diff --git a/web/lib/pkgfuncs.inc.php b/web/lib/pkgfuncs.inc.php index c1a64f7..80165c9 100644 --- a/web/lib/pkgfuncs.inc.php +++ b/web/lib/pkgfuncs.inc.php @@ -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"; diff --git a/web/template/pkg_comments.php b/web/template/pkg_comments.php index 2ed6420..88e739e 100644 --- a/web/template/pkg_comments.php +++ b/web/template/pkg_comments.php @@ -10,7 +10,7 @@ $pkgname = $row['Name']; - {$row['UserName']}"; endif; ?>

@@ -22,10 +22,18 @@ $pkgname = $row['Name']; + + + + + + + +

-- cgit v1.2.3-54-g00ecf