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:
Johannes Löthberg 2018-08-06 02:02:57 +02:00 committed by Lukas Fleischer
parent a7865ef5aa
commit 3578e77ad4
12 changed files with 258 additions and 30 deletions

View file

@ -8,7 +8,7 @@ include_once('acctfuncs.inc.php'); # access Account specific functions
$action = in_request("Action");
$need_userinfo = array(
"DisplayAccount", "DeleteAccount", "AccountInfo", "UpdateAccount"
"DisplayAccount", "DeleteAccount", "AccountInfo", "UpdateAccount", "ListComments"
);
if (in_array($action, $need_userinfo)) {
@ -166,6 +166,24 @@ if (isset($_COOKIE["AURSID"])) {
$row["Username"]);
}
} elseif ($action == "ListComments") {
if (has_credential(CRED_ACCOUNT_LIST_COMMENTS)) {
# display the comment list if they're a TU/dev
$total_comment_count = account_comments_count($row["ID"]);
list($pagination_templs, $per_page, $offset) = calculate_pagination($total_comment_count);
$username = $row["Username"];
$uid = $row["ID"];
$comments = account_comments($uid, $per_page, $offset);
$comment_section = "account";
include('pkg_comments.php');
} else {
print __("You are not allowed to access this area.");
}
} else {
if (has_credential(CRED_ACCOUNT_SEARCH)) {
# display the search page if they're a TU/dev