2016-07-18 16:39:37 +00:00
|
|
|
|
<?php
|
|
|
|
|
requirePHPLib('form');
|
2022-03-17 04:00:03 +00:00
|
|
|
|
|
|
|
|
|
if (!Auth::check()) {
|
2022-10-06 12:28:43 +00:00
|
|
|
|
redirectToLogin();
|
2022-03-17 04:00:03 +00:00
|
|
|
|
}
|
2022-04-03 10:18:17 +00:00
|
|
|
|
|
|
|
|
|
if (!isNormalUser($myUser)) {
|
|
|
|
|
become403Page();
|
|
|
|
|
}
|
2016-07-18 16:39:37 +00:00
|
|
|
|
|
|
|
|
|
if (!validateUInt($_GET['id']) || !($problem = queryProblemBrief($_GET['id']))) {
|
|
|
|
|
become404Page();
|
|
|
|
|
}
|
|
|
|
|
if (!hasProblemPermission($myUser, $problem)) {
|
|
|
|
|
become403Page();
|
|
|
|
|
}
|
2022-10-03 06:46:18 +00:00
|
|
|
|
|
|
|
|
|
if (!isset($_COOKIE['bootstrap4'])) {
|
|
|
|
|
$REQUIRE_LIB['bootstrap5'] = '';
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-18 16:39:37 +00:00
|
|
|
|
$managers_form = newAddDelCmdForm('managers',
|
|
|
|
|
function($username) {
|
|
|
|
|
if (!validateUsername($username) || !queryUser($username)) {
|
|
|
|
|
return "不存在名为{$username}的用户";
|
|
|
|
|
}
|
|
|
|
|
return '';
|
|
|
|
|
},
|
|
|
|
|
function($type, $username) {
|
|
|
|
|
global $problem;
|
|
|
|
|
if ($type == '+') {
|
2017-11-25 15:29:18 +00:00
|
|
|
|
DB::query("insert into problems_permissions (problem_id, username) values (${problem['id']}, '$username')");
|
2020-06-25 12:41:16 +00:00
|
|
|
|
} elseif ($type == '-') {
|
2017-11-25 15:29:18 +00:00
|
|
|
|
DB::query("delete from problems_permissions where problem_id = ${problem['id']} and username = '$username'");
|
2016-07-18 16:39:37 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$managers_form->runAtServer();
|
2022-09-25 13:03:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isSuperUser($myUser)) {
|
|
|
|
|
$update_uploader_form = new UOJForm('update_uploader');
|
|
|
|
|
$update_uploader_form->addInput('new_uploader_username', 'text', '用户名', $problem['uploader'] ?: 'root',
|
|
|
|
|
function ($x) {
|
|
|
|
|
if (!validateUsername($x)) {
|
|
|
|
|
return '用户名不合法';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!queryUser($x)) {
|
|
|
|
|
return '用户不存在';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return '';
|
|
|
|
|
},
|
|
|
|
|
null
|
|
|
|
|
);
|
|
|
|
|
$update_uploader_form->submit_button_config['align'] = 'compressed';
|
|
|
|
|
$update_uploader_form->submit_button_config['text'] = '修改上传者';
|
|
|
|
|
$update_uploader_form->submit_button_config['class_str'] = 'mt-2 btn btn-warning';
|
|
|
|
|
$update_uploader_form->handle = function() {
|
|
|
|
|
global $problem;
|
|
|
|
|
|
|
|
|
|
$username = $_POST['new_uploader_username'];
|
|
|
|
|
|
|
|
|
|
DB::query("update problems set uploader = '{$username}' where id = {$problem['id']}");
|
|
|
|
|
};
|
|
|
|
|
$update_uploader_form->runAtServer();
|
|
|
|
|
}
|
2022-09-18 04:58:35 +00:00
|
|
|
|
?>
|
2016-07-18 16:39:37 +00:00
|
|
|
|
<?php echoUOJPageHeader(HTML::stripTags($problem['title']) . ' - 管理者 - 题目管理') ?>
|
2022-10-03 06:46:18 +00:00
|
|
|
|
|
|
|
|
|
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
|
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col-lg-9">
|
|
|
|
|
<?php endif ?>
|
|
|
|
|
|
|
|
|
|
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
|
|
|
|
|
<h1 class="h2">
|
|
|
|
|
<?php else: ?>
|
|
|
|
|
<h1 class="page-header text-center">
|
|
|
|
|
<?php endif ?>
|
|
|
|
|
#<?=$problem['id']?>. <?=$problem['title']?> 管理
|
|
|
|
|
</h1>
|
|
|
|
|
|
|
|
|
|
<ul class="nav
|
|
|
|
|
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
|
|
|
|
|
nav-pills my-3
|
|
|
|
|
<?php else: ?>
|
|
|
|
|
nav-tabs
|
|
|
|
|
<?php endif ?>" role="tablist">
|
|
|
|
|
<li class="nav-item">
|
|
|
|
|
<a class="nav-link" href="/problem/<?= $problem['id'] ?>/manage/statement" role="tab">
|
|
|
|
|
题面
|
|
|
|
|
</a>
|
|
|
|
|
</li>
|
|
|
|
|
<li class="nav-item">
|
|
|
|
|
<a class="nav-link active" href="/problem/<?= $problem['id'] ?>/manage/managers" role="tab">
|
|
|
|
|
管理者
|
|
|
|
|
</a>
|
|
|
|
|
</li>
|
|
|
|
|
<li class="nav-item">
|
|
|
|
|
<a class="nav-link" href="/problem/<?= $problem['id'] ?>/manage/data" role="tab">
|
|
|
|
|
数据
|
|
|
|
|
</a>
|
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
<?php if (!isset($REQUIRE_LIB['bootstrap5'])): ?>
|
|
|
|
|
<li class="nav-item">
|
|
|
|
|
<a class="nav-link" href="/problem/<?=$problem['id']?>" role="tab">
|
|
|
|
|
返回
|
|
|
|
|
</a>
|
|
|
|
|
</li>
|
|
|
|
|
<?php endif ?>
|
2016-07-18 16:39:37 +00:00
|
|
|
|
</ul>
|
|
|
|
|
|
2022-10-03 06:46:18 +00:00
|
|
|
|
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
|
|
|
|
|
<div class="card card-default">
|
|
|
|
|
<div class="card-body">
|
|
|
|
|
<?php endif ?>
|
|
|
|
|
|
|
|
|
|
<table class="table
|
|
|
|
|
<?php if (!isset($REQUIRE_LIB['bootstrap5'])): ?>
|
|
|
|
|
table-hover
|
|
|
|
|
<?php endif ?>">
|
2016-07-18 16:39:37 +00:00
|
|
|
|
<thead>
|
|
|
|
|
<tr>
|
|
|
|
|
<th>#</th>
|
|
|
|
|
<th>用户名</th>
|
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody>
|
|
|
|
|
<?php
|
2022-09-18 04:58:35 +00:00
|
|
|
|
$row_id = 0;
|
2017-11-25 15:29:18 +00:00
|
|
|
|
$result = DB::query("select username from problems_permissions where problem_id = ${problem['id']}");
|
|
|
|
|
while ($row = DB::fetch($result, MYSQLI_ASSOC)) {
|
2016-07-18 16:39:37 +00:00
|
|
|
|
$row_id++;
|
|
|
|
|
echo '<tr>', '<td>', $row_id, '</td>', '<td>', getUserLink($row['username']), '</td>', '</tr>';
|
|
|
|
|
}
|
2022-09-18 04:58:35 +00:00
|
|
|
|
?>
|
2016-07-18 16:39:37 +00:00
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
<p class="text-center">命令格式:命令一行一个,+mike表示把mike加入管理者,-mike表示把mike从管理者中移除</p>
|
|
|
|
|
<?php $managers_form->printHTML(); ?>
|
2022-09-25 13:03:56 +00:00
|
|
|
|
|
|
|
|
|
<?php if (isset($update_uploader_form)): ?>
|
2022-10-03 06:46:18 +00:00
|
|
|
|
<hr>
|
|
|
|
|
|
|
|
|
|
<?php $update_uploader_form->printHTML(); ?>
|
|
|
|
|
<?php endif ?>
|
|
|
|
|
|
|
|
|
|
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<?php endif ?>
|
|
|
|
|
|
|
|
|
|
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<aside class="col mt-3 mt-lg-0">
|
|
|
|
|
|
|
|
|
|
<div class="card card-default mb-2">
|
|
|
|
|
<ul class="nav nav-pills nav-fill flex-column" role="tablist">
|
|
|
|
|
<li class="nav-item text-start">
|
|
|
|
|
<a href="/problem/<?= $problem['id'] ?>" class="nav-link" role="tab">
|
|
|
|
|
<i class="bi bi-journal-text"></i>
|
|
|
|
|
<?= UOJLocale::get('problems::statement') ?>
|
|
|
|
|
</a>
|
|
|
|
|
</li>
|
|
|
|
|
<li class="nav-item text-start">
|
|
|
|
|
<a href="/problem/<?= $problem['id'] ?>/solutions" class="nav-link" role="tab">
|
|
|
|
|
<i class="bi bi-journal-bookmark"></i>
|
|
|
|
|
<?= UOJLocale::get('problems::solutions') ?>
|
|
|
|
|
</a>
|
|
|
|
|
</li>
|
2022-10-07 01:13:35 +00:00
|
|
|
|
<li class="nav-item text-start">
|
|
|
|
|
<a class="nav-link" href="/problem/<?= $problem['id'] ?>/statistics">
|
|
|
|
|
<i class="bi bi-graph-up"></i>
|
|
|
|
|
<?= UOJLocale::get('problems::statistics') ?>
|
|
|
|
|
</a>
|
|
|
|
|
</li>
|
2022-10-03 06:46:18 +00:00
|
|
|
|
<li class="nav-item text-start">
|
|
|
|
|
<a class="nav-link active" href="#" role="tab">
|
|
|
|
|
<i class="bi bi-sliders"></i>
|
|
|
|
|
<?= UOJLocale::get('problems::manage') ?>
|
|
|
|
|
</a>
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
2022-10-07 01:13:35 +00:00
|
|
|
|
<div class="card-footer bg-transparent">
|
|
|
|
|
评价:<?= getClickZanBlock('P', $problem['id'], $problem['zan']) ?>
|
|
|
|
|
</div>
|
2022-10-03 06:46:18 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<?php uojIncludeView('sidebar', array()) ?>
|
|
|
|
|
</aside>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
|
$('.markdown-body table').each(function() {
|
|
|
|
|
$(this).addClass('table table-bordered table-striped');
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
</script>
|
2022-09-25 13:03:56 +00:00
|
|
|
|
<?php endif ?>
|
|
|
|
|
|
2016-07-18 16:39:37 +00:00
|
|
|
|
<?php echoUOJPageFooter() ?>
|