From c43dbb190da570665c35ea3142118cfbe929981e Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Tue, 31 Jan 2023 18:32:41 +0800 Subject: [PATCH] chore(contest/manage): remove blog_link_contests_form --- web/app/controllers/contest_manage.php | 116 ------------------------- 1 file changed, 116 deletions(-) diff --git a/web/app/controllers/contest_manage.php b/web/app/controllers/contest_manage.php index 340a090..d4ae16a 100644 --- a/web/app/controllers/contest_manage.php +++ b/web/app/controllers/contest_manage.php @@ -419,105 +419,6 @@ function(res) { } EOD); $rule_form->runAtServer(); - - $blog_link_contests = new UOJBs4Form('blog_link_contests'); - $blog_link_contests->addVInput( - 'blog_id', - 'text', - '博客 ID', - '', - function ($blog_id, &$vdata) { - if (!validateUInt($blog_id)) { - return 'ID 不合法'; - } - - if (!queryBlog($blog_id)) { - return '博客不存在'; - } - - $vdata['blog_id'] = $blog_id; - - return ''; - }, - null - ); - $blog_link_contests->addVInput( - 'title', - 'text', - '名称', - '', - function ($title, &$vdata) { - if ($title == '') { - return '名称不能为空'; - } - - if (strlen($title) > 40) { - return '名称过长'; - } - - $title = HTML::escape($title); - if ($title === '') { - return '无效编码'; - } - - $vdata['title'] = $title; - - return ''; - }, - null - ); - $blog_link_contests->addVSelect('op_type', [ - 'add' => '添加', - 'del' => '移除', - ], '操作类型', ''); - $blog_link_contests->handle = function ($vdata) use ($contest) { - if ($_POST['op_type'] == 'add') { - if (!isset($contest['extra_config']['links'])) { - $contest['extra_config']['links'] = []; - } - - $contest['extra_config']['links'][] = [$vdata['title'], $vdata['blog_id']]; - } elseif ($_POST['op_type'] == 'del') { - $n = count($contest['extra_config']['links']); - for ($i = 0; $i < $n; $i++) { - if ($contest['extra_config']['links'][$i][1] == $vdata['blog_id']) { - $contest['extra_config']['links'][$i] = $contest['extra_config']['links'][$n - 1]; - unset($contest['extra_config']['links'][$n - 1]); - break; - } - } - - if (!count($contest['extra_config']['links'])) { - unset($contest['extra_config']['links']); - } - } - - $esc_extra_config = json_encode($contest['extra_config']); - $esc_extra_config = DB::escape($esc_extra_config); - DB::update("UPDATE contests set extra_config = '$esc_extra_config' where id = {$contest['id']}"); - - dieWithJsonData(['status' => 'success', 'message' => '修改成功']); - }; - $blog_link_contests->setAjaxSubmit(<<runAtServer(); } ?> @@ -714,9 +615,6 @@ EOD); -
@@ -740,20 +638,6 @@ EOD);
-
- -
-
- printHTML(); ?> -
-
-
注意事项
-
    -
  • 添加比赛资料前请确认博客是否处于公开状态。
  • -
-
-
-