mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-22 12:18:42 +00:00
refactor(user): user info
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
8e57d52af7
commit
d7f5d58eb7
@ -6,7 +6,7 @@ return [
|
|||||||
'banned user' => 'Banned User',
|
'banned user' => 'Banned User',
|
||||||
'tmp user' => 'Temporary User',
|
'tmp user' => 'Temporary User',
|
||||||
'real name' => 'Real name',
|
'real name' => 'Real name',
|
||||||
'belongs to these groups' => 'Belongs to these groups:',
|
'belongs to these groups' => 'Belongs to these groups',
|
||||||
'avatar source' => 'Avatar source',
|
'avatar source' => 'Avatar source',
|
||||||
'website' => 'Website',
|
'website' => 'Website',
|
||||||
'user type' => 'User type',
|
'user type' => 'User type',
|
||||||
|
@ -6,7 +6,7 @@ return [
|
|||||||
'banned user' => '封禁用户',
|
'banned user' => '封禁用户',
|
||||||
'tmp user' => '临时用户',
|
'tmp user' => '临时用户',
|
||||||
'real name' => '真实姓名',
|
'real name' => '真实姓名',
|
||||||
'belongs to these groups' => '属于这些小组:',
|
'belongs to these groups' => '属于这些小组',
|
||||||
'avatar source' => '头像来源',
|
'avatar source' => '头像来源',
|
||||||
'website' => '网址',
|
'website' => '网址',
|
||||||
'user type' => '用户类型',
|
'user type' => '用户类型',
|
||||||
|
@ -201,43 +201,111 @@
|
|||||||
<?php if (!isset($is_blog_aboutme)) : ?>
|
<?php if (!isset($is_blog_aboutme)) : ?>
|
||||||
<?php $groups = UOJGroup::queryGroupsOfUser($user) ?>
|
<?php $groups = UOJGroup::queryGroupsOfUser($user) ?>
|
||||||
<div class="card mb-2">
|
<div class="card mb-2">
|
||||||
<div class="card-body">
|
<div class="card-header fw-bold">
|
||||||
<h4 class="card-title">
|
|
||||||
<?= UOJLocale::get('user::belongs to these groups') ?>
|
<?= UOJLocale::get('user::belongs to these groups') ?>
|
||||||
</h4>
|
</div>
|
||||||
<ul class="mb-0">
|
<ul class="list-group list-group-flush">
|
||||||
<?php foreach ($groups as $group) : ?>
|
<?php foreach ($groups as $group) : ?>
|
||||||
<li>
|
<li class="list-group-item">
|
||||||
<?= $group->getLink() ?>
|
<?= $group->getLink(['class' => 'fw-bold']) ?>
|
||||||
</li>
|
</li>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
<?php if (empty($groups)) : ?>
|
<?php if (empty($groups)) : ?>
|
||||||
|
<li class="list-group-item text-center">
|
||||||
<?= UOJLocale::get('none') ?>
|
<?= UOJLocale::get('none') ?>
|
||||||
|
</li>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
<?php endif ?>
|
||||||
|
|
||||||
|
<?php if (isset($extra['acm'])) : ?>
|
||||||
|
<div class="card mb-2">
|
||||||
|
<div class="card-header fw-bold">ACM 队伍信息</div>
|
||||||
|
<div class="list-group list-group-flush">
|
||||||
|
<?php foreach ($extra['acm']['members'] as $mem) : ?>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<b><?= HTML::escape($mem['name']) ?></b>(<?= HTML::escape($mem['organization']) ?>)
|
||||||
|
</li>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
|
<?php if (isSuperUser(Auth::user())) : ?>
|
||||||
<div class="card mb-2">
|
<div class="card mb-2">
|
||||||
<div class="card-body">
|
<div class="card-header fw-bold">超级管理员可见信息</div>
|
||||||
|
<ul class="list-group list-group-flush">
|
||||||
|
<li class="list-group-item">
|
||||||
|
<div class="fw-bold mb-2">注册时间</div>
|
||||||
|
<?= $user['register_time'] ?>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<div class="fw-bold mb-2">最后一次登录的 IP (remote_addr)</div>
|
||||||
|
<?= $user['remote_addr'] ?>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<div class="fw-bold mb-2">最后一次登录的 IP (http_x_forwarded_for)</div>
|
||||||
|
<?= $user['http_x_forwarded_for'] ?>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<div class="fw-bold mb-2">最后一次登录时间</div>
|
||||||
|
<?= $user['last_login_time'] ?>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<div class="fw-bold mb-2">最后一次上线时间</div>
|
||||||
|
<?= $user['last_visit_time'] ?>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<div class="fw-bold mb-2">过期时间</div>
|
||||||
|
<?= $user['expiration_time'] ?: '永不过期' ?>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<div class="fw-bold mb-2">最近访问时使用的 IP 和终端</div>
|
||||||
|
<dl class="row">
|
||||||
|
<?php foreach ($extra['history'] as $vis) : ?>
|
||||||
|
<dt class="col-sm-3"><?= HTML::escape($vis['last']) ?></dt>
|
||||||
|
<dd class="col-sm-9">
|
||||||
|
<b>addr</b>: <?= HTML::escape($vis['addr']) ?>
|
||||||
|
<br>
|
||||||
|
<b>forwarded_addr</b>: <?= HTML::escape($vis['forwarded_addr']) ?>
|
||||||
|
<br>
|
||||||
|
<b>user_agent</b>: <?= HTML::escape($vis['ua']) ?>
|
||||||
|
</dd>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</dl>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<?php endif ?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$_result = DB::query("select date_format(submit_time, '%Y-%m-%d'), problem_id from submissions where submitter = '{$user['username']}' and score = 100 and date(submit_time) between date_sub(curdate(), interval 1 year) and curdate()");
|
$ac_records = DB::selectAll([
|
||||||
$result = [];
|
"select", DB::bracketed_fields([
|
||||||
$vis = [];
|
"submit_time" => "date_format(submit_time, '%Y-%m-%d')",
|
||||||
$cnt = 0;
|
"problem_id",
|
||||||
while ($row = DB::fetch($_result)) {
|
]),
|
||||||
$cnt++;
|
"from submissions",
|
||||||
$result[$row["date_format(submit_time, '%Y-%m-%d')"]]++;
|
"where", [
|
||||||
|
"submitter" => $user['username'],
|
||||||
|
"score" => 100,
|
||||||
|
["date(submit_time)", "between", DB::raw("date_sub(curdate(), interval 1 year) and curdate()")],
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
$last_year_ac_cnt_by_day = [];
|
||||||
|
$last_year_ac_cnt = 0;
|
||||||
|
foreach ($ac_records as $record) {
|
||||||
|
$last_year_ac_cnt++;
|
||||||
|
$last_year_ac_cnt_by_day[$record["submit_time"]]++;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<h4 class="card-title">
|
<div class="card mb-2">
|
||||||
<?= UOJLocale::get('n accepted in last year', $cnt) ?>
|
<div class="card-header fw-bold"><?= UOJLocale::get('n accepted in last year', $last_year_ac_cnt) ?></div>
|
||||||
</h4>
|
<div class="card-body">
|
||||||
<div id="accepted-graph" style="font-size: 14px"></div>
|
<div id="accepted-graph" style="font-size: 14px"></div>
|
||||||
<script>
|
<script>
|
||||||
var accepted_graph_data = [
|
var accepted_graph_data = [
|
||||||
<?php foreach ($result as $key => $val) : ?> {
|
<?php foreach ($last_year_ac_cnt_by_day as $key => $val) : ?> {
|
||||||
date: '<?= $key ?>',
|
date: '<?= $key ?>',
|
||||||
count: <?= $val ?>
|
count: <?= $val ?>
|
||||||
},
|
},
|
||||||
@ -250,12 +318,13 @@
|
|||||||
</script>
|
</script>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card mb-2">
|
|
||||||
<div class="card-body">
|
|
||||||
<?php $ac_problems = DB::selectAll("select problem_id from best_ac_submissions where submitter = '{$user['username']}' order by problem_id") ?>
|
<?php $ac_problems = DB::selectAll("select problem_id from best_ac_submissions where submitter = '{$user['username']}' order by problem_id") ?>
|
||||||
<h4 class="card-title">
|
<div class="card mb-2">
|
||||||
|
<div class="card-header fw-bold">
|
||||||
<?= UOJLocale::get('accepted problems') . ': ' . UOJLocale::get('n problems in total', count($ac_problems)) ?>
|
<?= UOJLocale::get('accepted problems') . ': ' . UOJLocale::get('n problems in total', count($ac_problems)) ?>
|
||||||
</h4>
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
<ul class="nav uoj-ac-problems-list">
|
<ul class="nav uoj-ac-problems-list">
|
||||||
<?php foreach ($ac_problems as $prob) : ?>
|
<?php foreach ($ac_problems as $prob) : ?>
|
||||||
<?php $problem = UOJProblem::query($prob['problem_id']) ?>
|
<?php $problem = UOJProblem::query($prob['problem_id']) ?>
|
||||||
@ -278,36 +347,5 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php if (isSuperUser(Auth::user())) : ?>
|
|
||||||
<div class="card card-default">
|
|
||||||
<ul class="list-group list-group-flush">
|
|
||||||
<li class="list-group-item">
|
|
||||||
<h5 class="list-group-item-heading">register time</h5>
|
|
||||||
<p class="list-group-item-text"><?= $user['register_time'] ?></p>
|
|
||||||
</li>
|
|
||||||
<li class="list-group-item">
|
|
||||||
<h5 class="list-group-item-heading">remote_addr</h5>
|
|
||||||
<p class="list-group-item-text"><?= $user['remote_addr'] ?></p>
|
|
||||||
</li>
|
|
||||||
<li class="list-group-item">
|
|
||||||
<h5 class="list-group-item-heading">http_x_forwarded_for</h5>
|
|
||||||
<p class="list-group-item-text"><?= $user['http_x_forwarded_for'] ?></p>
|
|
||||||
</li>
|
|
||||||
<li class="list-group-item">
|
|
||||||
<h5 class="list-group-item-heading">last_login_time</h5>
|
|
||||||
<p class="list-group-item-text"><?= $user['last_login_time'] ?></p>
|
|
||||||
</li>
|
|
||||||
<li class="list-group-item">
|
|
||||||
<h5 class="list-group-item-heading">last_visit_time</h5>
|
|
||||||
<p class="list-group-item-text"><?= $user['last_visit_time'] ?></p>
|
|
||||||
</li>
|
|
||||||
<li class="list-group-item">
|
|
||||||
<h5 class="list-group-item-heading">expiration_time</h5>
|
|
||||||
<p class="list-group-item-text"><?= $user['expiration_time'] ?></p>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<?php endif ?>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user