mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-22 14:48:41 +00:00
fix(web/contest/self_reviews): remove useless DB::escape
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
4f5bbf82a5
commit
80e8b72fb6
@ -259,7 +259,7 @@ if ($cur_tab == 'dashboard') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for ($i = 0; $i < count($contest_problems); $i++) {
|
for ($i = 0; $i < count($contest_problems); $i++) {
|
||||||
$content = DB::selectFirst([
|
$content = DB::selectSingle([
|
||||||
"select content",
|
"select content",
|
||||||
"from", "contests_reviews",
|
"from", "contests_reviews",
|
||||||
"where", [
|
"where", [
|
||||||
@ -271,7 +271,7 @@ if ($cur_tab == 'dashboard') {
|
|||||||
$self_reviews_update_form->addVTextArea(
|
$self_reviews_update_form->addVTextArea(
|
||||||
'self_review_update__problem_' . $contest_problems[$i]['problem']->getLetter(),
|
'self_review_update__problem_' . $contest_problems[$i]['problem']->getLetter(),
|
||||||
'<b>' . $contest_problems[$i]['problem']->getLetter() . '</b>: ' . $contest_problems[$i]['problem']->info['title'],
|
'<b>' . $contest_problems[$i]['problem']->getLetter() . '</b>: ' . $contest_problems[$i]['problem']->info['title'],
|
||||||
$content['content'],
|
$content,
|
||||||
function ($content) {
|
function ($content) {
|
||||||
if (strlen($content) > 200) {
|
if (strlen($content) > 200) {
|
||||||
return '总结不能超过200字';
|
return '总结不能超过200字';
|
||||||
@ -284,7 +284,7 @@ if ($cur_tab == 'dashboard') {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$content = DB::selectFirst([
|
$content = DB::selectSingle([
|
||||||
"select content",
|
"select content",
|
||||||
"from", "contests_reviews",
|
"from", "contests_reviews",
|
||||||
"where", [
|
"where", [
|
||||||
@ -296,7 +296,7 @@ if ($cur_tab == 'dashboard') {
|
|||||||
$self_reviews_update_form->addVTextArea(
|
$self_reviews_update_form->addVTextArea(
|
||||||
'self_review_update__overall',
|
'self_review_update__overall',
|
||||||
'比赛总结',
|
'比赛总结',
|
||||||
$content['content'],
|
$content,
|
||||||
function ($content) {
|
function ($content) {
|
||||||
if (strlen($content) > 200) {
|
if (strlen($content) > 200) {
|
||||||
return '总结不能超过200字';
|
return '总结不能超过200字';
|
||||||
@ -309,27 +309,31 @@ if ($cur_tab == 'dashboard') {
|
|||||||
);
|
);
|
||||||
|
|
||||||
$self_reviews_update_form->handle = function () use ($contest, $contest_problems) {
|
$self_reviews_update_form->handle = function () use ($contest, $contest_problems) {
|
||||||
global $contest, $contest_problems, $myUser;
|
|
||||||
|
|
||||||
for ($i = 0; $i < count($contest_problems); $i++) {
|
for ($i = 0; $i < count($contest_problems); $i++) {
|
||||||
if (isset($_POST['self_review_update__problem_' . $contest_problems[$i]['problem']->getLetter()])) {
|
if (isset($_POST['self_review_update__problem_' . $contest_problems[$i]['problem']->getLetter()])) {
|
||||||
$esc_content = DB::escape($_POST['self_review_update__problem_' . $contest_problems[$i]['problem']->getLetter()]);
|
|
||||||
$problem_id = $contest_problems[$i]['problem_id'];
|
|
||||||
|
|
||||||
DB::query([
|
DB::query([
|
||||||
"replace into contests_reviews",
|
"replace into contests_reviews",
|
||||||
"(contest_id, problem_id, poster, content)",
|
"(contest_id, problem_id, poster, content)",
|
||||||
"values", DB::tuple([$contest['id'], $problem_id, Auth::id(), $esc_content]),
|
"values", DB::tuple([
|
||||||
|
$contest['id'],
|
||||||
|
$contest_problems[$i]['problem_id'],
|
||||||
|
Auth::id(),
|
||||||
|
$_POST['self_review_update__problem_' . $contest_problems[$i]['problem']->getLetter()],
|
||||||
|
]),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_POST['self_review_update__overall'])) {
|
if (isset($_POST['self_review_update__overall'])) {
|
||||||
$esc_content = DB::escape($_POST['self_review_update__overall']);
|
|
||||||
DB::query([
|
DB::query([
|
||||||
"replace into contests_reviews",
|
"replace into contests_reviews",
|
||||||
"(contest_id, problem_id, poster, content)",
|
"(contest_id, problem_id, poster, content)",
|
||||||
"values", DB::tuple([$contest['id'], -1, Auth::id(), $esc_content]),
|
"values", DB::tuple([
|
||||||
|
$contest['id'],
|
||||||
|
-1,
|
||||||
|
Auth::id(),
|
||||||
|
$_POST['self_review_update__overall'],
|
||||||
|
]),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -543,7 +543,7 @@ $solution_view_type_form->handle = function () {
|
|||||||
$config = $problem_extra_config;
|
$config = $problem_extra_config;
|
||||||
$config['view_solution_type'] = $_POST['view_solution_type'];
|
$config['view_solution_type'] = $_POST['view_solution_type'];
|
||||||
$config['submit_solution_type'] = $_POST['submit_solution_type'];
|
$config['submit_solution_type'] = $_POST['submit_solution_type'];
|
||||||
$esc_config = DB::escape(json_encode($config));
|
$esc_config = json_encode($config);
|
||||||
|
|
||||||
DB::update([
|
DB::update([
|
||||||
"update problems",
|
"update problems",
|
||||||
@ -919,7 +919,7 @@ $info_form->runAtServer();
|
|||||||
<label for="time_limit" class="col-sm-5 control-label">time_limit</label>
|
<label for="time_limit" class="col-sm-5 control-label">time_limit</label>
|
||||||
<div class="col-sm-7">
|
<div class="col-sm-7">
|
||||||
<?php $time_limit_value = is_array($problem_conf) ? getUOJConfVal($problem_conf, 'time_limit', 1) : ""; ?>
|
<?php $time_limit_value = is_array($problem_conf) ? getUOJConfVal($problem_conf, 'time_limit', 1) : ""; ?>
|
||||||
<input type="number" class="form-control" id="time_limit" name="time_limit" placeholder="时间限制(不能填写小数,默认为 1s)" value="<?= $time_limit_value ?>">
|
<input type="text" class="form-control" id="time_limit" name="time_limit" placeholder="时间限制(默认为 1s)" value="<?= $time_limit_value ?>">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
|
Loading…
Reference in New Issue
Block a user