diff --git a/web/app/controllers/problem.php b/web/app/controllers/problem.php index 1575b6d..bd23685 100644 --- a/web/app/controllers/problem.php +++ b/web/app/controllers/problem.php @@ -101,7 +101,7 @@ if (UOJContest::cur()) { $submission_requirement = UOJProblem::cur()->getSubmissionRequirement(); $custom_test_requirement = UOJProblem::cur()->getCustomTestRequirement(); -$custom_test_enabled = $custom_test_requirement && $pre_submit_check_ret === true; +$custom_test_enabled = $custom_test_requirement && $pre_submit_check_ret === true && UOJProblem::info('type') != 'remote'; function handleUpload($zip_file_name, $content, $tot_size) { global $is_participating; @@ -171,11 +171,8 @@ if ($custom_test_enabled) { $custom_test_form->runAtServer(); } -$can_use_zip_upload = true; -foreach ($submission_requirement as $req) { - if ($req['type'] == 'source code') { - $can_use_zip_upload = false; - } +if (empty($submission_requirement)) { + $no_more_submission = '当前题目未配置提交文件,请联系管理员!'; } if ($pre_submit_check_ret === true && !$no_more_submission) { @@ -274,12 +271,12 @@ if (UOJContest::cur()) {
= $pre_submit_check_ret ?>
-= $no_more_submission ?>
-= $submission_warning ?>
printHTML(); ?> diff --git a/web/app/models/UOJProblem.php b/web/app/models/UOJProblem.php index d5ca165..f836e3b 100644 --- a/web/app/models/UOJProblem.php +++ b/web/app/models/UOJProblem.php @@ -460,10 +460,6 @@ class UOJProblem { return $key === null ? $extra_config : $extra_config[$key]; } public function getCustomTestRequirement() { - if ($this->info['type'] == 'remote') { - return []; - } - $extra_config = json_decode($this->info['extra_config'], true); if (isset($extra_config['custom_test_requirement'])) { @@ -559,11 +555,16 @@ class UOJProblem { } public function userCanUploadSubmissionViaZip(array $user = null) { - foreach ($this->getSubmissionRequirement() as $req) { + $submission_requirement = $this->getSubmissionRequirement(); + + if (empty($submission_requirement)) return false; + + foreach ($submission_requirement as $req) { if ($req['type'] == 'source code') { return false; } } + return true; }