mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-22 13:28:41 +00:00
fix: e0cffaa762
This commit is contained in:
parent
b7a0ee7fda
commit
c3b72eb114
@ -39,14 +39,10 @@
|
|||||||
$add_new_contestant_form->submit_button_config['text'] = '注册该用户';
|
$add_new_contestant_form->submit_button_config['text'] = '注册该用户';
|
||||||
$add_new_contestant_form->handle = function() {
|
$add_new_contestant_form->handle = function() {
|
||||||
global $contest;
|
global $contest;
|
||||||
|
|
||||||
$username = $_POST['new_username'];
|
$username = $_POST['new_username'];
|
||||||
|
|
||||||
$user = queryUser($username);
|
DB::query("replace into contests_registrants (username, contest_id, has_participated) values ('{$username}', {$contest['id']}, 0)");
|
||||||
if (!$user) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
DB::query("replace into contests_registrants (username, contest_id, has_participated) values ('{$user['username']}', {$contest['id']}, 0)");
|
|
||||||
|
|
||||||
updateContestPlayerNum($contest);
|
updateContestPlayerNum($contest);
|
||||||
};
|
};
|
||||||
@ -92,9 +88,16 @@
|
|||||||
if (!validateUsername($x)) {
|
if (!validateUsername($x)) {
|
||||||
return '用户名不合法';
|
return '用户名不合法';
|
||||||
}
|
}
|
||||||
if (!queryUser($x)) {
|
|
||||||
|
$user = queryUser($x);
|
||||||
|
if (!$user) {
|
||||||
return '用户不存在';
|
return '用户不存在';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!hasRegistered($user, $contest)) {
|
||||||
|
return '该用户未报名';
|
||||||
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
},
|
},
|
||||||
null
|
null
|
||||||
@ -104,7 +107,9 @@
|
|||||||
$remove_user_from_contest_form->submit_button_config['class_str'] = 'mt-2 btn btn-danger';
|
$remove_user_from_contest_form->submit_button_config['class_str'] = 'mt-2 btn btn-danger';
|
||||||
$remove_user_from_contest_form->handle = function() {
|
$remove_user_from_contest_form->handle = function() {
|
||||||
global $contest;
|
global $contest;
|
||||||
DB::query("delete from contests_registrants where username = '{$_POST['remove_username']}' and contest_id = {$contest['id']}");
|
$username = $_POST['remove_username'];
|
||||||
|
|
||||||
|
DB::query("delete from contests_registrants where username = '{$username}' and contest_id = {$contest['id']}");
|
||||||
updateContestPlayerNum($contest);
|
updateContestPlayerNum($contest);
|
||||||
};
|
};
|
||||||
$remove_user_from_contest_form->runAtServer();
|
$remove_user_from_contest_form->runAtServer();
|
||||||
@ -186,7 +191,7 @@
|
|||||||
array('page_len' => 100,
|
array('page_len' => 100,
|
||||||
'get_row_index' => '',
|
'get_row_index' => '',
|
||||||
'print_after_table' => function() {
|
'print_after_table' => function() {
|
||||||
global $add_new_contestant_form, $add_group_to_contest_form;
|
global $add_new_contestant_form, $add_group_to_contest_form, $remove_user_from_contest_form;
|
||||||
|
|
||||||
if (isset($add_new_contestant_form)) {
|
if (isset($add_new_contestant_form)) {
|
||||||
$add_new_contestant_form->printHTML();
|
$add_new_contestant_form->printHTML();
|
||||||
|
Loading…
Reference in New Issue
Block a user