mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Allow listing all comments from a user
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
parent
a7865ef5aa
commit
3578e77ad4
12 changed files with 258 additions and 30 deletions
|
@ -44,7 +44,7 @@ function pkgbase_comments_count($base_id, $include_deleted, $only_pinned=false)
|
|||
*
|
||||
* @return array All package comment information for a specific package base
|
||||
*/
|
||||
function pkgbase_comments($base_id, $limit, $include_deleted, $only_pinned=false) {
|
||||
function pkgbase_comments($base_id, $limit, $include_deleted, $only_pinned=false, $offset=0) {
|
||||
$base_id = intval($base_id);
|
||||
$limit = intval($limit);
|
||||
if (!$base_id) {
|
||||
|
@ -71,6 +71,9 @@ function pkgbase_comments($base_id, $limit, $include_deleted, $only_pinned=false
|
|||
if ($limit > 0) {
|
||||
$q.=" LIMIT " . $limit;
|
||||
}
|
||||
if ($offset > 0) {
|
||||
$q.=" OFFSET " . $offset;
|
||||
}
|
||||
$result = $dbh->query($q);
|
||||
if (!$result) {
|
||||
return null;
|
||||
|
@ -273,6 +276,7 @@ function pkgbase_display_details($base_id, $row, $SID="") {
|
|||
include('pkgbase_details.php');
|
||||
|
||||
if ($SID) {
|
||||
$comment_section = "package";
|
||||
include('pkg_comment_box.php');
|
||||
}
|
||||
|
||||
|
@ -281,13 +285,17 @@ function pkgbase_display_details($base_id, $row, $SID="") {
|
|||
$limit_pinned = isset($_GET['pinned']) ? 0 : 5;
|
||||
$pinned = pkgbase_comments($base_id, $limit_pinned, false, true);
|
||||
if (!empty($pinned)) {
|
||||
$comment_section = "package";
|
||||
include('pkg_comments.php');
|
||||
}
|
||||
unset($pinned);
|
||||
|
||||
|
||||
$limit = isset($_GET['comments']) ? 0 : 10;
|
||||
$comments = pkgbase_comments($base_id, $limit, $include_deleted);
|
||||
|
||||
if (!empty($comments)) {
|
||||
$comment_section = "package";
|
||||
include('pkg_comments.php');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue