S2OJ/web/app/controllers/submission_status_details.php

39 lines
742 B
PHP
Raw Normal View History

2016-07-18 16:39:37 +00:00
<?php
if (!Auth::check()) {
redirectToLogin();
2016-07-18 16:39:37 +00:00
}
if (!is_array($_GET['get'])) {
become404Page();
}
$res = [];
foreach ($_GET['get'] as $id) {
if (!validateUInt($id)) {
become404Page();
}
$submission = querySubmission($id);
if ($submission['submitter'] !== Auth::id()) {
become403Page();
}
2022-04-03 10:18:17 +00:00
if ($submission['contest_id'] == null && !isNormalUser($myUser)) {
become403Page();
}
2016-07-18 16:39:37 +00:00
$problem = queryProblemBrief($submission['problem_id']);
if (!isSubmissionVisibleToUser($submission, $problem, Auth::user())) {
become403Page();
}
$out_status = explode(', ', $submission['status'])[0];
$res[] = [
'judged' => $out_status == 'Judged',
'html' => getSubmissionStatusDetails($submission)
];
}
die(json_encode($res));