mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-08 13:38:41 +00:00
fix: 90b3675bd5
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
90b3675bd5
commit
ef774d2e97
@ -2,6 +2,8 @@
|
||||
requirePHPLib('form');
|
||||
requirePHPLib('judger');
|
||||
|
||||
$REQUIRE_LIB['bootstrap5'] = '';
|
||||
|
||||
if (!Auth::check()) {
|
||||
become403Page(UOJLocale::get('need login'));
|
||||
}
|
||||
@ -18,11 +20,13 @@
|
||||
$solution_viewable = hasViewSolutionPermission($problem_extra_config['view_solution_type'], $myUser, $problem);
|
||||
$solution_submittable = hasViewSolutionPermission($problem_extra_config['submit_solution_type'], $myUser, $problem);
|
||||
|
||||
if (!$solution_viewable || isRegisteredRunningContestProblem($myUser, $problem)) {
|
||||
if (!$solution_viewable) {
|
||||
become403Page();
|
||||
}
|
||||
|
||||
$REQUIRE_LIB['bootstrap5'] = '';
|
||||
if (!hasProblemPermission($myUser, $problem) && isRegisteredRunningContestProblem($myUser, $problem)) {
|
||||
become403Page();
|
||||
}
|
||||
|
||||
function removeSolutionForm($blog_id) {
|
||||
$res_form = new UOJForm("remove_solution_{$blog_id}");
|
||||
|
@ -21,10 +21,6 @@
|
||||
if (!isNormalUser($myUser)) {
|
||||
become403Page();
|
||||
}
|
||||
|
||||
if (isRegisteredRunningContestProblem($myUser, $problem)) {
|
||||
become403Page();
|
||||
}
|
||||
}
|
||||
|
||||
function scoreDistributionData() {
|
||||
|
@ -30,7 +30,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
if (!isSubmissionVisibleToUser($submission, $problem, $myUser) || isRegisteredRunningContestProblem($myUser, $problem)) {
|
||||
if (!isSubmissionVisibleToUser($submission, $problem, $myUser)) {
|
||||
become403Page();
|
||||
}
|
||||
|
||||
|
@ -221,12 +221,14 @@ function isHackVisibleToUser($hack, $problem, $user) {
|
||||
function isSubmissionFullVisibleToUser($submission, $contest, $problem, $user) {
|
||||
if (isSuperUser($user)) {
|
||||
return true;
|
||||
} elseif ($submission['submitter'] == $user['username']) {
|
||||
return true;
|
||||
} elseif (isRegisteredRunningContestProblem($user, $problem)) {
|
||||
return false;
|
||||
} elseif (!$contest) {
|
||||
return true;
|
||||
} elseif ($contest['cur_progress'] > CONTEST_IN_PROGRESS) {
|
||||
return true;
|
||||
} elseif ($submission['submitter'] == $user['username']) {
|
||||
return true;
|
||||
} else {
|
||||
return hasProblemPermission($user, $problem);
|
||||
}
|
||||
@ -250,7 +252,7 @@ function isRegisteredRunningContestProblem($user, $problem) {
|
||||
while (list($contest_id) = DB::fetch($result, MYSQLI_NUM)) {
|
||||
$contest = queryContest($contest_id);
|
||||
genMoreContestInfo($contest);
|
||||
if (CONTEST_NOT_STARTED < $contest['cur_progress'] && $contest['cur_progress'] <= CONTEST_IN_PROGRESS
|
||||
if ($contest['cur_progress'] == CONTEST_IN_PROGRESS
|
||||
&& hasRegistered($user, $contest)
|
||||
&& !hasContestPermission($user, $contest)
|
||||
&& queryContestProblemRank($contest, $problem)) {
|
||||
|
Loading…
Reference in New Issue
Block a user