From c8277ed5b962289f60336e115d7a9ab56ceae645 Mon Sep 17 00:00:00 2001
From: Baoshuo
Date: Thu, 20 Oct 2022 21:23:55 +0800
Subject: [PATCH] refactor(web/super_manage): judger
---
web/app/controllers/super_manage.php | 82 +++++++++++++++++++++++++++-
1 file changed, 81 insertions(+), 1 deletion(-)
diff --git a/web/app/controllers/super_manage.php b/web/app/controllers/super_manage.php
index 483390e..1a33206 100644
--- a/web/app/controllers/super_manage.php
+++ b/web/app/controllers/super_manage.php
@@ -494,6 +494,47 @@ EOD);
};
$custom_test_deleter->submit_button_config['align'] = 'compressed';
$custom_test_deleter->runAtServer();
+ } elseif ($cur_tab == 'judger') {
+ $judger_adder = new UOJForm('judger_adder');
+ $judger_adder->addInput('judger_adder_name', 'text', '评测机名称', '',
+ function ($x, &$vdata) {
+ if (!validateUsername($x)) {
+ return '不合法';
+ }
+ if (DB::selectCount("select count(*) from judger_info where judger_name='$x'")!=0) {
+ return '不合法';
+ }
+ $vdata['name'] = $x;
+ return '';
+ },
+ null
+ );
+ $judger_adder->handle = function(&$vdata) {
+ $password = uojRandString(32);
+ DB::insert("insert into judger_info (judger_name,password) values('{$vdata['name']}','{$password}')");
+ };
+ $judger_adder->submit_button_config['align'] = 'compressed';
+ $judger_adder->runAtServer();
+
+ $judger_deleter = new UOJForm('judger_deleter');
+ $judger_deleter->addInput('judger_deleter_name', 'text', '评测机名称', '',
+ function ($x, &$vdata) {
+ if (!validateUsername($x)) {
+ return '不合法';
+ }
+ if (DB::selectCount("select count(*) from judger_info where judger_name='$x'")!=1) {
+ return '不合法';
+ }
+ $vdata['name'] = $x;
+ return '';
+ },
+ null
+ );
+ $judger_deleter->handle = function(&$vdata) {
+ DB::delete("delete from judger_info where judger_name='{$vdata['name']}'");
+ };
+ $judger_deleter->submit_button_config['align'] = 'compressed';
+ $judger_deleter->runAtServer();
} elseif ($cur_tab == 'image_hosting') {
if (isset($_POST['submit-delete_image']) && $_POST['submit-delete_image'] == 'delete_image') {
crsf_defend();
@@ -1029,6 +1070,45 @@ echoSubmissionsList(
printHTML() ?>
+
+ 评测机列表
+
+