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
+6 -2
View File
@@ -4003,9 +4003,13 @@ function classlist($selectname,$maxclass, $selected, $minClass = 0){
return $list;
}
function permissiondenied(){
function permissiondenied($allowMinimumClass = null){
global $lang_functions;
stderr($lang_functions['std_error'], $lang_functions['std_permission_denied']);
if ($allowMinimumClass === null) {
stderr($lang_functions['std_error'], $lang_functions['std_permission_denied']);
} else {
stderr($lang_functions['std_sorry'],$lang_functions['std_permission_denied_only'].get_user_class_name($allowMinimumClass,false,true,true).$lang_functions['std_or_above_can_view'],false);
}
}
function gettime($time, $withago = true, $twoline = false, $forceago = false, $oneunit = false, $isfuturetime = false){
+2
View File
@@ -5,6 +5,8 @@ $lang_functions = array
'std_access_denied' => "访问拒绝!",
'std_fake_account' => "我们怀疑你在使用伪造账户,因此记录了本次行为!",
'std_permission_denied' => "你没有该权限!",
'std_permission_denied_only' => "你没有该权限。只有",
'std_or_above_can_view' => "及以上等级的用户才能查看。<br /><br />请查看"."<a class=\"faqlink\" href=\"faq.php#id22\"><b>常见问题</b></a>了解更多关于用户等级和权限的信息。<br /><br /><b></p>" .$SITENAME."管理组</b>",
'std_target_not_exists' => '目标不存在',
'std_already_logged_in' => "你已经登录!",
'text_page_last_updated' => "本页面最后更新于",
+2
View File
@@ -5,6 +5,8 @@ $lang_functions = array
'std_access_denied' => "訪問拒絕!",
'std_fake_account' => "我們懷疑你在使用偽造帳戶,因此記錄了本次行為!",
'std_permission_denied' => "你沒有該許可權!",
'std_permission_denied_only' => "你沒有該許可權。只有",
'std_or_above_can_view' => "及以上等級的用戶才能檢視。<br /><br />請檢視"."<a class=\"faqlink\" href=\"faq.php#id22\"><b>常見問題</b></a>了解更多關于用戶等級和許可權的資訊。<br /><br /><b></p>" .$SITENAME."管理組</b>",
'std_target_not_exists' => '目標不存在',
'std_already_logged_in' => "你已經登錄!",
'text_page_last_updated' => "本頁面最後更新於",
+2
View File
@@ -5,6 +5,8 @@ $lang_functions = array
'std_access_denied' => "Access Denied!",
'std_fake_account' => "We come to believe you are using a fake account, therefore we've logged this action!",
'std_permission_denied' => "Permission denied!",
'std_permission_denied_only' => "Permission denied. Only ",
'std_or_above_can_view' => " or above could view. <br /><br /> Please see the "."<a class=\"faqlink\" href=\"faq.php#id22\"><b>FAQ</b></a> for more information on different user classes and what they can do.<br /><br /><b></p>The " .$SITENAME." Staff</b>",
'std_target_not_exists' => 'Target not exists',
'std_already_logged_in' => "You have already logged in!",
'text_page_last_updated' => "This page last updated ",
+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);
}