userCanView(Auth::user(), ['ensure' => true]); $perm = UOJSubmission::cur()->viewerCanSeeComponents(Auth::user()); $can_see_minor = false; if ($perm['score']) { $can_see_minor = UOJSubmission::cur()->userCanSeeMinorVersions(Auth::user()); UOJSubmissionHistory::init(UOJSubmission::cur(), ['minor' => $can_see_minor]) || UOJResponse::page404(); if (isset($_GET['time'])) { $history_time = UOJRequest::get('time', 'is_short_string'); !empty($history_time) || UOJResponse::page404(); UOJSubmission::cur()->loadHistoryByTime($history_time) || UOJResponse::page404(); UOJSubmission::cur()->isMajor() || UOJResponse::page404(); } elseif (isset($_GET['tid'])) { $can_see_minor || UOJResponse::page404(); UOJSubmission::cur()->loadHistoryByTID(UOJRequest::get('tid', 'validateUInt')) || UOJResponse::page404(); !UOJSubmission::cur()->isMajor() || UOJResponse::page404(); } } $submission = UOJSubmission::info(); $submission_result = UOJSubmission::cur()->getResult(); $problem = UOJProblem::info(); if ($can_see_minor) { $minor_rejudge_form = new UOJForm('minor_rejudge'); $minor_rejudge_form->handle = function () { UOJSubmission::rejudgeById(UOJSubmission::info('id'), [ 'reason_text' => '管理员偷偷重测该提交记录', 'major' => false ]); $tid = DB::insert_id(); redirectTo(UOJSubmission::cur()->getUriForNewTID($tid)); }; $minor_rejudge_form->config['submit_button']['class'] = 'btn btn-sm btn-primary'; $minor_rejudge_form->config['submit_button']['text'] = '偷偷重新测试'; $minor_rejudge_form->config['submit_container']['class'] = 'd-inline-block text-end'; $minor_rejudge_form->runAtServer(); } if (UOJSubmission::cur()->isLatest()) { if (UOJSubmission::cur()->preHackCheck()) { $hack_form = new UOJBs4Form('hack'); $hack_form->addTextFileInput('input', '输入数据'); $hack_form->addCheckBox('use_formatter', '帮我整理文末回车、行末空格、换行符', true); $hack_form->handle = function (&$vdata) { global $problem, $submission; Auth::check() || redirectToLogin(); if ($_POST["input_upload_type"] == 'file') { $tmp_name = UOJBs4Form::uploadedFileTmpName("input_file"); if ($tmp_name == null) { UOJResponse::message('你在干啥……怎么什么都没交过来……?'); } } $fileName = FS::randomAvailableTmpFileName(); $fileFullName = UOJContext::storagePath() . $fileName; if ($_POST["input_upload_type"] == 'editor') { file_put_contents($fileFullName, $_POST['input_editor']); } else { move_uploaded_file($_FILES["input_file"]['tmp_name'], $fileFullName); } $input_type = isset($_POST['use_formatter']) ? "USE_FORMATTER" : "DONT_USE_FORMATTER"; DB::insert([ "insert into hacks", "(problem_id, submission_id, hacker, owner, input, input_type, submit_time, status, details, is_hidden)", "values", DB::tuple([ $problem['id'], $submission['id'], Auth::id(), $submission['submitter'], $fileName, $input_type, DB::now(), 'Waiting', '', $problem['is_hidden'] ]) ]); }; $hack_form->max_post_size = 25 * 1024 * 1024; $hack_form->max_file_size_mb = 20; $hack_form->succ_href = "/hacks"; $hack_form->runAtServer(); } if (UOJSubmission::cur()->userCanRejudge(Auth::user())) { $rejudge_form = new UOJForm('rejudge'); $rejudge_form->handle = function () { UOJSubmission::rejudgeById(UOJSubmission::info('id')); }; $rejudge_form->config['submit_button']['class'] = 'btn btn-sm btn-primary'; $rejudge_form->config['submit_button']['text'] = '重新测试'; $rejudge_form->config['submit_container']['class'] = 'text-end d-inline-block'; $rejudge_form->runAtServer(); } if (UOJSubmission::cur()->userCanDelete(Auth::user())) { $delete_form = new UOJForm('delete'); $delete_form->handle = function () { UOJSubmission::cur()->delete(); }; $delete_form->config['submit_button']['class'] = 'btn btn-sm btn-danger'; $delete_form->config['submit_button']['text'] = '删除此提交记录'; $delete_form->config['submit_container']['class'] = 'text-end d-inline-block'; $delete_form->config['confirm']['smart'] = true; $delete_form->succ_href = "/submissions"; $delete_form->runAtServer(); } } else { if (UOJSubmission::cur()->userCanDelete(Auth::user()) && !UOJSubmission::cur()->isMajor()) { $delete_form = new UOJForm('delete'); $delete_form->handle = function () { UOJSubmission::cur()->deleteThisMinorVersion(); }; $delete_form->config['submit_button']['class'] = 'btn btn-sm btn-danger'; $delete_form->config['submit_button']['text'] = '删除当前历史记录(保留其他历史记录)'; $delete_form->config['submit_container']['class'] = 'text-end d-inline-block'; $delete_form->config['confirm']['smart'] = true; $delete_form->succ_href = UOJSubmission::cur()->getUriForLatest(); $delete_form->runAtServer(); } } ?>
这程序好像有点Bug,我给组数据试试?
hasJudged()) { if ($perm['high_level_details']) { HTML::echoPanel(['card' => 'mb-3', 'body' => 'p-0'], UOJLocale::get('details'), function () use ($perm, $submission_result) { $styler = new SubmissionDetailsStyler(); if (!$perm['low_level_details']) { $styler->fade_all_details = true; $styler->show_small_tip = false; } echoJudgmentDetails($submission_result['details'], $styler, 'details'); if ($perm['manager_view'] && !$perm['low_level_details']) { echo '