userdetails page add H&R

This commit is contained in:
xiaomlove
2022-06-13 15:52:23 +08:00
parent 921f74c93e
commit 4e20c339d9
6 changed files with 28 additions and 5 deletions
+12 -3
View File
@@ -5,8 +5,13 @@ dbconn();
loggedinorreturn();
require_once(get_langfile_path());
$userid = $CURUSER['id'];
if (get_user_class() >= UC_ADMINISTRATOR && !empty($_GET['userid'])) {
$pagerParams = [];
if (!empty($_GET['userid'])) {
if (get_user_class() < $viewhistory_class && $_GET['userid'] != $CURUSER['id']) {
permissiondenied($viewhistory_class);
}
$userid = $_GET['userid'];
$pagerParams['userid'] = $userid;
}
$userInfo = \App\Models\User::query()->find($userid);
if (empty($userInfo)) {
@@ -20,8 +25,12 @@ print("<h1>$pageTitle</h1>");
$status = $_GET['status'] ?? \App\Models\HitAndRun::STATUS_INSPECTING;
$allStatus = \App\Models\HitAndRun::listStatus();
$headerFilters = [];
$pagerParams['status'] = $status;
$filterParams = $pagerParams;
$queryString = http_build_query($pagerParams);
foreach ($allStatus as $key => $value) {
$headerFilters[] = sprintf('<a href="?status=%s" class="%s"><b>%s</b></a>', $key, $key == $status ? 'faqlink' : '', $value['text']);
$filterParams['status'] = $key;
$headerFilters[] = sprintf('<a href="?%s" class="%s"><b>%s</b></a>', http_build_query($filterParams), $key == $status ? 'faqlink' : '', $value['text']);
}
print("<p>" . implode(' | ', $headerFilters) . "</p>");
@@ -40,7 +49,7 @@ print $filterForm;
$baseQuery = \App\Models\HitAndRun::query()->where('uid', $userid)->where('status', $status);
$rescount = (clone $baseQuery)->count();
list($pagertop, $pagerbottom, $limit, $offset, $pageSize) = pager(50, $rescount, "?status=$status&");
list($pagertop, $pagerbottom, $limit, $offset, $pageSize) = pager(50, $rescount, sprintf('?%s&', $queryString));
print("<table width='100%'>");
print("<tr>
<td class='colhead' align='center'>{$lang_myhr['th_hr_id']}</td>
+4
View File
@@ -308,6 +308,10 @@ tr_small($lang_userdetails['row_torrent_comment'], ($torrentcomments && ($user["
tr_small($lang_userdetails['row_forum_posts'], ($forumposts && ($user["id"] == $CURUSER["id"] || get_user_class() >= $viewhistory_class) ? "<a href=\"userhistory.php?action=viewposts&amp;id=".$id."\" title=\"".$lang_userdetails['link_view_posts']."\">".$forumposts."</a>" : $forumposts), 1);
if ($user["id"] == $CURUSER["id"] || get_user_class() >= $viewhistory_class) {
if (\App\Models\HitAndRun::getIsEnabled()) {
$hrStatus = (new \App\Repositories\HitAndRunRepository())->getStatusStats($user['id']);
tr_small('H&R', sprintf('<a href="%s/myhr.php?userid=%s" target="_blank">%s</a>', getSchemeAndHttpHost(), $user['id'], $hrStatus), 1);
}
tr_small($lang_userdetails['row_karma_points'], number_format($user['seedbonus'], 1), 1);
tr_small($lang_functions['text_seed_points'], number_format($user['seed_points'], 1), 1);
}