super_manage.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668
  1. <?php
  2. requirePHPLib('form');
  3. requirePHPLib('judger');
  4. if ($myUser == null || !isSuperUser($myUser)) {
  5. become403Page();
  6. }
  7. $purge_rating_form = new UOJForm('purgerating');
  8. $purge_rating_form->addInput('confirm', 'text', '确认删除所有 Rating(重复)', '',
  9. function($confirm) {
  10. if ($confirm != '确认删除所有 Rating')
  11. return '已取消';
  12. return '';
  13. }, null);
  14. $purge_rating_form->handle = function() {
  15. set_time_limit(0);
  16. ignore_user_abort(true);
  17. DB::update("update user_info set rating = 1500, rating_rd = 350, rating_vol = 0.06;");
  18. $contests = DB::selectAll("select id from contests where status = 'finished' order by id;");
  19. foreach ($contests as $id) {
  20. $id = $id['id'];
  21. DB::update("update contests_registrants c join user_info u on c.username = u.username "
  22. . "set c.user_rating = u.rating, c.user_rd = u.rating_rd, c.user_vol = u.rating_vol where contest_id = $id");
  23. $contest = queryContest($id);
  24. genMoreContestInfo($contest);
  25. if (isset($contest['extra_config']['unrated'])) continue;
  26. $contest_data = queryContestData($contest);
  27. $score = array();
  28. $standings = array();
  29. $ratings = array();
  30. $rating_rds = array();
  31. $rating_vols = array();
  32. calcStandings($contest, $contest_data, $score, $standings, true);
  33. calcRatingGlicko2($standings, $ratings, $rating_rds, $rating_vols);
  34. for ($i = 0; $i < count($standings); ++$i) {
  35. DB::update("update user_info set rating = {$ratings[$i]}, rating_rd = {$rating_rds[$i]}, rating_vol = {$rating_vols[$i]} where username = '{$standings[$i][2][0]}';");
  36. }
  37. }
  38. };
  39. $purge_rating_form->runAtServer();
  40. $user_form = new UOJForm('user');
  41. $user_form->addInput('username', 'text', '用户名', '',
  42. function ($username) {
  43. if (!validateUsername($username)) {
  44. return '用户名不合法';
  45. }
  46. if (!queryUser($username)) {
  47. return '用户不存在';
  48. }
  49. return '';
  50. },
  51. null
  52. );
  53. $options = array(
  54. 'banneduser' => '设为封禁用户',
  55. 'normaluser' => '设为普通用户',
  56. 'superuser' => '设为超级用户'
  57. );
  58. $user_form->addSelect('op-type', $options, '操作类型', '');
  59. $user_form->handle = function() {
  60. global $user_form;
  61. $username = $_POST['username'];
  62. switch ($_POST['op-type']) {
  63. case 'banneduser':
  64. DB::update("update user_info set usergroup = 'B' where username = '{$username}'");
  65. break;
  66. case 'normaluser':
  67. DB::update("update user_info set usergroup = 'U' where username = '{$username}'");
  68. break;
  69. case 'superuser':
  70. DB::update("update user_info set usergroup = 'S' where username = '{$username}'");
  71. break;
  72. }
  73. };
  74. $user_form->runAtServer();
  75. $assign_certs_form = new UOJForm('assign_certs_form');
  76. $color_options = array('red' => '红色', 'blue' => '蓝色', 'green' => '绿色', 'purple' => '紫色', 'pink' => '粉色',
  77. 'olive' => '屎黄色', 'deepblue' => '深蓝',
  78. 'pro' => 'Pro', 'max' => 'Max', 'ultra' => 'Ultra');
  79. $assign_certs_form->addSelect('color-type', $color_options, '勋章颜色', '');
  80. $assign_certs_form->addInput('certs_user', 'text', '用户名', '',
  81. function ($username) {
  82. if (!validateUsername($username))
  83. return '用户名不合法';
  84. if (!queryUser($username))
  85. return '用户不存在';
  86. return '';
  87. }, null
  88. );
  89. $assign_certs_form->addInput('certs_name', 'text', '称号', '',
  90. function ($text) {
  91. if (strpos($text, '#') != false || strpos($text, ',') != false)
  92. return '不能含有井号或逗号';
  93. if (mb_strlen($text) > 8) return '称号过长' . $text;
  94. return '';
  95. }, null
  96. );
  97. $assign_certs_form->handle = function() {
  98. $username = $_POST['certs_user'];
  99. $text = $_POST['certs_name'];
  100. $color = $_POST['color-type'];
  101. $user = queryUser($username);
  102. $newcerts = $user['certslist'];
  103. if ($user['certslist'] != '') $newcerts = $newcerts . ',' . $color . '#' . $text;
  104. else $newcerts = $color . '#' . $text;
  105. DB::update("update user_info set certslist = '{$newcerts}' where username = '{$username}'");
  106. if ($user['certs'] == '') DB::update("update user_info set certs = '{$newcerts}' where username = '{$username}'");
  107. };
  108. $assign_certs_form->runAtServer();
  109. $user_attach_form = new UOJForm('user_attach_form');
  110. $user_attach_form->addInput('username', 'text', '用户名', '',
  111. function ($username) {
  112. if (!validateUsername($username)) {
  113. return '用户名不合法';
  114. }
  115. if (!queryUser($username)) {
  116. return '用户不存在';
  117. }
  118. return '';
  119. },
  120. null
  121. );
  122. $user_attach_form->addInput('group', 'text', '组名', '',
  123. function ($username) {
  124. if (!validateUsername($username))
  125. return '组名不合法';
  126. if (!queryUser($username))
  127. return '组不存在';
  128. if (substr($username, 0, 6) != 'group_')
  129. return '不是合法组(前缀非 group_)';
  130. return '';
  131. },
  132. null
  133. );
  134. $user_attach_form->handle = function() {
  135. $username = $_POST['username'];
  136. $group = $_POST['group'];
  137. attachUserToGroup (queryUser($username), queryUser($group));
  138. };
  139. $user_attach_form->runAtServer();
  140. $problem_attach_form = new UOJForm('problem_attach_form');
  141. $problem_attach_form->addInput('pid', 'text', '题号', '',
  142. function ($pid) {
  143. if (!validateUInt($pid)) {
  144. return '题号不合法';
  145. }
  146. if (!queryProblemBrief($pid)) {
  147. return '题目不存在';
  148. }
  149. return '';
  150. },
  151. null
  152. );
  153. $problem_attach_form->addInput('problem_group', 'text', '组名', '',
  154. function ($username) {
  155. if (!validateUsername($username))
  156. return '组名不合法';
  157. if (!queryUser($username))
  158. return '组不存在';
  159. if (substr($username, 0, 6) != 'group_')
  160. return '不是合法组(前缀非 group_)';
  161. return '';
  162. },
  163. null
  164. );
  165. $problem_attach_form->handle = function() {
  166. $pid = $_POST['pid'];
  167. $group = $_POST['problem_group'];
  168. attachProblemToGroup (queryProblemBrief ($pid), queryUser($group));
  169. };
  170. $problem_attach_form->runAtServer();
  171. $blog_link_contests = new UOJForm('blog_link_contests');
  172. $blog_link_contests->addInput('blog_id', 'text', '博客ID', '',
  173. function ($x) {
  174. if (!validateUInt($x)) {
  175. return 'ID不合法';
  176. }
  177. if (!queryBlog($x)) {
  178. return '博客不存在';
  179. }
  180. return '';
  181. },
  182. null
  183. );
  184. $blog_link_contests->addInput('contest_id', 'text', '比赛ID', '',
  185. function ($x) {
  186. if (!validateUInt($x)) {
  187. return 'ID不合法';
  188. }
  189. if (!queryContest($x)) {
  190. return '比赛不存在';
  191. }
  192. return '';
  193. },
  194. null
  195. );
  196. $blog_link_contests->addInput('title', 'text', '标题', '',
  197. function ($x) {
  198. return '';
  199. },
  200. null
  201. );
  202. $options = array(
  203. 'add' => '添加',
  204. 'del' => '删除'
  205. );
  206. $blog_link_contests->addSelect('op-type', $options, '操作类型', '');
  207. $blog_link_contests->handle = function() {
  208. $blog_id = $_POST['blog_id'];
  209. $contest_id = $_POST['contest_id'];
  210. $str = DB::selectFirst(("select * from contests where id='${contest_id}'"));
  211. $all_config = json_decode($str['extra_config'], true);
  212. $config = $all_config['links'];
  213. $n = count($config);
  214. if ($_POST['op-type'] == 'add') {
  215. $row = array();
  216. $row[0] = $_POST['title'];
  217. $row[1] = $blog_id;
  218. $config[$n] = $row;
  219. }
  220. if ($_POST['op-type'] == 'del') {
  221. for ($i = 0; $i < $n; $i++) {
  222. if ($config[$i][1] == $blog_id) {
  223. $config[$i] = $config[$n - 1];
  224. unset($config[$n - 1]);
  225. break;
  226. }
  227. }
  228. }
  229. $all_config['links'] = $config;
  230. $str = json_encode($all_config);
  231. $str = DB::escape($str);
  232. DB::query("update contests set extra_config='${str}' where id='${contest_id}'");
  233. };
  234. $blog_link_contests->runAtServer();
  235. $blog_link_index = new UOJForm('blog_link_index');
  236. $blog_link_index->addInput('blog_id2', 'text', '博客ID', '',
  237. function ($x) {
  238. if (!validateUInt($x)) {
  239. return 'ID不合法';
  240. }
  241. if (!queryBlog($x)) {
  242. return '博客不存在';
  243. }
  244. return '';
  245. },
  246. null
  247. );
  248. $blog_link_index->addInput('blog_level', 'text', '置顶级别(删除不用填)', '0',
  249. function ($x) {
  250. if (!validateUInt($x)) {
  251. return '数字不合法';
  252. }
  253. if ($x > 3) {
  254. return '该级别不存在';
  255. }
  256. return '';
  257. },
  258. null
  259. );
  260. $options = array(
  261. 'add' => '添加',
  262. 'del' => '删除'
  263. );
  264. $blog_link_index->addSelect('op-type2', $options, '操作类型', '');
  265. $blog_link_index->handle = function() {
  266. $blog_id = $_POST['blog_id2'];
  267. $blog_level = $_POST['blog_level'];
  268. if ($_POST['op-type2'] == 'add') {
  269. if (DB::selectFirst("select * from important_blogs where blog_id = {$blog_id}")) {
  270. DB::update("update important_blogs set level = {$blog_level} where blog_id = {$blog_id}");
  271. } else {
  272. DB::insert("insert into important_blogs (blog_id, level) values ({$blog_id}, {$blog_level})");
  273. }
  274. }
  275. if ($_POST['op-type2'] == 'del') {
  276. DB::delete("delete from important_blogs where blog_id = {$blog_id}");
  277. }
  278. };
  279. $blog_link_index->runAtServer();
  280. $blog_deleter = new UOJForm('blog_deleter');
  281. $blog_deleter->addInput('blog_del_id', 'text', '博客ID', '',
  282. function ($x) {
  283. if (!validateUInt($x)) {
  284. return 'ID不合法';
  285. }
  286. if (!queryBlog($x)) {
  287. return '博客不存在';
  288. }
  289. return '';
  290. },
  291. null
  292. );
  293. $blog_deleter->handle = function() {
  294. deleteBlog($_POST['blog_del_id']);
  295. };
  296. $blog_deleter->runAtServer();
  297. $contest_submissions_deleter = new UOJForm('contest_submissions');
  298. $contest_submissions_deleter->addInput('contest_id', 'text', '比赛ID', '',
  299. function ($x) {
  300. if (!validateUInt($x)) {
  301. return 'ID不合法';
  302. }
  303. if (!queryContest($x)) {
  304. return '博客不存在';
  305. }
  306. return '';
  307. },
  308. null
  309. );
  310. $contest_submissions_deleter->handle = function() {
  311. $contest = queryContest($_POST['contest_id']);
  312. genMoreContestInfo($contest);
  313. $contest_problems = DB::selectAll("select problem_id from contests_problems where contest_id = {$contest['id']}");
  314. foreach ($contest_problems as $problem) {
  315. $submissions = DB::selectAll("select * from submissions where problem_id = {$problem['problem_id']} and submit_time < '{$contest['start_time_str']}'");
  316. foreach ($submissions as $submission) {
  317. $content = json_decode($submission['content'], true);
  318. unlink(UOJContext::storagePath().$content['file_name']);
  319. DB::delete("delete from submissions where id = {$submission['id']}");
  320. updateBestACSubmissions($submission['submitter'], $submission['problem_id']);
  321. }
  322. }
  323. };
  324. $contest_submissions_deleter->runAtServer();
  325. $custom_test_deleter = new UOJForm('custom_test_deleter');
  326. $custom_test_deleter->addInput('last', 'text', '删除末尾记录', '5',
  327. function ($x, &$vdata) {
  328. if (!validateUInt($x)) {
  329. return '不合法';
  330. }
  331. $vdata['last'] = $x;
  332. return '';
  333. },
  334. null
  335. );
  336. $custom_test_deleter->handle = function(&$vdata) {
  337. $all = DB::selectAll("select * from custom_test_submissions order by id asc limit {$vdata['last']}");
  338. foreach ($all as $submission) {
  339. $content = json_decode($submission['content'], true);
  340. unlink(UOJContext::storagePath().$content['file_name']);
  341. }
  342. DB::delete("delete from custom_test_submissions order by id asc limit {$vdata['last']}");
  343. };
  344. $custom_test_deleter->runAtServer();
  345. $judger_adder = new UOJForm('judger_adder');
  346. $judger_adder->addInput('judger_adder_name', 'text', '评测机名称', '',
  347. function ($x, &$vdata) {
  348. if (!validateUsername($x)) {
  349. return '不合法';
  350. }
  351. if (DB::selectCount("select count(*) from judger_info where judger_name='$x'")!=0) {
  352. return '不合法';
  353. }
  354. $vdata['name'] = $x;
  355. return '';
  356. },
  357. null
  358. );
  359. $judger_adder->handle = function(&$vdata) {
  360. $password=uojRandString(32);
  361. DB::insert("insert into judger_info (judger_name,password) values('{$vdata['name']}','{$password}')");
  362. };
  363. $judger_adder->runAtServer();
  364. $judger_deleter = new UOJForm('judger_deleter');
  365. $judger_deleter->addInput('judger_deleter_name', 'text', '评测机名称', '',
  366. function ($x, &$vdata) {
  367. if (!validateUsername($x)) {
  368. return '不合法';
  369. }
  370. if (DB::selectCount("select count(*) from judger_info where judger_name='$x'")!=1) {
  371. return '不合法';
  372. }
  373. $vdata['name'] = $x;
  374. return '';
  375. },
  376. null
  377. );
  378. $judger_deleter->handle = function(&$vdata) {
  379. DB::delete("delete from judger_info where judger_name='{$vdata['name']}'");
  380. };
  381. $judger_deleter->runAtServer();
  382. $paste_deleter = new UOJForm('paste_deleter');
  383. $paste_deleter->addInput('paste_deleter_name', 'text', 'Paste ID', '',
  384. function ($x, &$vdata) {
  385. if (DB::selectCount("select count(*) from pastes where `index`='$x'")==0) {
  386. return '不合法';
  387. }
  388. $vdata['name'] = $x;
  389. return '';
  390. },
  391. null
  392. );
  393. $paste_deleter->handle = function(&$vdata) {
  394. DB::delete("delete from pastes where `index` = '${vdata['name']}'");
  395. };
  396. $paste_deleter->runAtServer();
  397. $judgerlist_cols = array('judger_name', 'password');
  398. $judgerlist_config = array();
  399. $judgerlist_header_row = <<<EOD
  400. <tr>
  401. <th>评测机名称</th>
  402. <th>密码</th>
  403. </tr>
  404. EOD;
  405. $judgerlist_print_row = function($row) {
  406. echo <<<EOD
  407. <tr>
  408. <td>{$row['judger_name']}</td>
  409. <td>{$row['password']}</td>
  410. </tr>
  411. EOD;
  412. };
  413. $banlist_cols = array('username', 'usergroup');
  414. $banlist_config = array();
  415. $banlist_header_row = <<<EOD
  416. <tr>
  417. <th>用户名</th>
  418. </tr>
  419. EOD;
  420. $banlist_print_row = function($row) {
  421. $hislink = getUserLink($row['username']);
  422. echo <<<EOD
  423. <tr>
  424. <td>${hislink}</td>
  425. </tr>
  426. EOD;
  427. };
  428. $cur_tab = isset($_GET['tab']) ? $_GET['tab'] : 'users';
  429. $tabs_info = array(
  430. 'users' => array(
  431. 'name' => '用户操作',
  432. 'url' => "/super-manage/users"
  433. ),
  434. 'blogs' => array(
  435. 'name' => '博客管理',
  436. 'url' => "/super-manage/blogs"
  437. ),
  438. 'submissions' => array(
  439. 'name' => '提交记录',
  440. 'url' => "/super-manage/submissions"
  441. ),
  442. 'custom-test' => array(
  443. 'name' => '自定义测试',
  444. 'url' => '/super-manage/custom-test'
  445. ),
  446. 'click-zan' => array(
  447. 'name' => '点赞管理',
  448. 'url' => '/super-manage/click-zan'
  449. ),
  450. 'search' => array(
  451. 'name' => '搜索管理',
  452. 'url' => '/super-manage/search'
  453. ),
  454. 'judger' => array(
  455. 'name' => '评测机管理',
  456. 'url' => '/super-manage/judger'
  457. ),
  458. 'paste' => array(
  459. 'name' => 'Paste管理',
  460. 'url' => '/super-manage/paste'
  461. ),
  462. 'groups' => array(
  463. 'name' => '用户组管理',
  464. 'url' => '/super-manage/groups'
  465. ),
  466. 'certs' => array(
  467. 'name' => '勋章管理',
  468. 'url' => '/super-manage/certs'
  469. ),
  470. 'rating' => array(
  471. 'name' => 'Rating 管理',
  472. 'url' => '/super-manage/rating'
  473. )
  474. );
  475. if (!isset($tabs_info[$cur_tab])) {
  476. become404Page();
  477. }
  478. ?>
  479. <?php
  480. requireLib('hljs');
  481. requireLib('morris');
  482. ?>
  483. <?php echoUOJPageHeader('系统管理') ?>
  484. <div class="row">
  485. <div class="col-sm-3">
  486. <?= HTML::tablist($tabs_info, $cur_tab, 'nav-pills flex-column') ?>
  487. </div>
  488. <div class="col-sm-9">
  489. <?php if ($cur_tab === 'users'): ?>
  490. <?php $user_form->printHTML(); ?>
  491. <h3>封禁名单</h3>
  492. <?php echoLongTable($banlist_cols, 'user_info', "usergroup='B'", '', $banlist_header_row, $banlist_print_row, $banlist_config) ?>
  493. <?php elseif ($cur_tab === 'blogs'): ?>
  494. <div>
  495. <h4>添加到比赛链接</h4>
  496. <?php $blog_link_contests->printHTML(); ?>
  497. </div>
  498. <div>
  499. <h4>添加到公告</h4>
  500. <?php $blog_link_index->printHTML(); ?>
  501. </div>
  502. <div>
  503. <h4>删除博客</h4>
  504. <?php $blog_deleter->printHTML(); ?>
  505. </div>
  506. <?php elseif ($cur_tab === 'submissions'): ?>
  507. <div>
  508. <h4>删除赛前提交记录</h4>
  509. <?php $contest_submissions_deleter->printHTML(); ?>
  510. </div>
  511. <div>
  512. <h4>测评失败的提交记录</h4>
  513. <?php echoSubmissionsList("result_error = 'Judgement Failed'", 'order by id desc', array('result_hidden' => ''), $myUser); ?>
  514. </div>
  515. <?php elseif ($cur_tab === 'custom-test'): ?>
  516. <?php $custom_test_deleter->printHTML() ?>
  517. <?php
  518. $submissions_pag = new Paginator(array(
  519. 'col_names' => array('*'),
  520. 'table_name' => 'custom_test_submissions',
  521. 'cond' => '1',
  522. 'tail' => 'order by id asc',
  523. 'page_len' => 5
  524. ));
  525. foreach ($submissions_pag->get() as $submission) {
  526. $problem = queryProblemBrief($submission['problem_id']);
  527. $submission_result = json_decode($submission['result'], true);
  528. echo '<dl class="dl-horizontal">';
  529. echo '<dt>id</dt>';
  530. echo '<dd>', "#{$submission['id']}", '</dd>';
  531. echo '<dt>problem_id</dt>';
  532. echo '<dd>', "#{$submission['problem_id']}", '</dd>';
  533. echo '<dt>submit time</dt>';
  534. echo '<dd>', $submission['submit_time'], '</dd>';
  535. echo '<dt>submitter</dt>';
  536. echo '<dd>', $submission['submitter'], '</dd>';
  537. echo '<dt>judge_time</dt>';
  538. echo '<dd>', $submission['judge_time'], '</dd>';
  539. echo '</dl>';
  540. echoSubmissionContent($submission, getProblemCustomTestRequirement($problem));
  541. echoCustomTestSubmissionDetails($submission_result['details'], "submission-{$submission['id']}-details");
  542. }
  543. ?>
  544. <?= $submissions_pag->pagination() ?>
  545. <?php elseif ($cur_tab === 'click-zan'): ?>
  546. 没写好QAQ
  547. <?php elseif ($cur_tab === 'search'): ?>
  548. <h2 class="text-center">一周搜索情况</h2>
  549. <div id="search-distribution-chart-week" style="height: 250px;"></div>
  550. <script type="text/javascript">
  551. new Morris.Line({
  552. element: 'search-distribution-chart-week',
  553. data: <?= json_encode(DB::selectAll("select DATE_FORMAT(created_at, '%Y-%m-%d %h:00'), count(*) from search_requests where created_at > now() - interval 1 week group by DATE_FORMAT(created_at, '%Y-%m-%d %h:00')")) ?>,
  554. xkey: "DATE_FORMAT(created_at, '%Y-%m-%d %h:00')",
  555. ykeys: ["count(*)"],
  556. labels: ['number'],
  557. resize: true
  558. });
  559. </script>
  560. <h2 class="text-center">一月搜索情况</h2>
  561. <div id="search-distribution-chart-month" style="height: 250px;"></div>
  562. <script type="text/javascript">
  563. new Morris.Line({
  564. element: 'search-distribution-chart-month',
  565. data: <?= json_encode(DB::selectAll("select DATE_FORMAT(created_at, '%Y-%m-%d'), count(*) from search_requests where created_at > now() - interval 1 week group by DATE_FORMAT(created_at, '%Y-%m-%d')")) ?>,
  566. xkey: "DATE_FORMAT(created_at, '%Y-%m-%d')",
  567. ykeys: ["count(*)"],
  568. labels: ['number'],
  569. resize: true
  570. });
  571. </script>
  572. <?php echoLongTable(array('*'), 'search_requests', "1", 'order by id desc',
  573. '<tr><th>id</th><th>created_at</th><th>remote_addr</th><th>type</th><th>q</th><tr>',
  574. function($row) {
  575. echo '<tr>';
  576. echo '<td>', $row['id'], '</td>';
  577. echo '<td>', $row['created_at'], '</td>';
  578. echo '<td>', $row['remote_addr'], '</td>';
  579. echo '<td>', $row['type'], '</td>';
  580. echo '<td>', HTML::escape($row['q']), '</td>';
  581. echo '</tr>';
  582. }, array(
  583. 'page_len' => 1000
  584. ))
  585. ?>
  586. <?php elseif ($cur_tab === 'judger'): ?>
  587. <div>
  588. <h4>添加评测机</h4>
  589. <?php $judger_adder->printHTML(); ?>
  590. </div>
  591. <div>
  592. <h4>删除评测机</h4>
  593. <?php $judger_deleter->printHTML(); ?>
  594. </div>
  595. <h3>评测机列表</h3>
  596. <?php echoLongTable($judgerlist_cols, 'judger_info', "1=1", '', $judgerlist_header_row, $judgerlist_print_row, $judgerlist_config) ?>
  597. <?php elseif ($cur_tab === 'paste'): ?>
  598. <div>
  599. <h4>Paste管理</h4>
  600. <?php echoPastesList() ?>
  601. </div>
  602. <?php elseif ($cur_tab == 'groups'): ?>
  603. <div>
  604. <h4>用户组管理</h4>
  605. <?php echoGroupsList() ?>
  606. </div>
  607. <div>
  608. <h4>添加用户到组</h4>
  609. <?php $user_attach_form->printHTML(); ?>
  610. </div>
  611. <div>
  612. <h4>添加题目到组</h4>
  613. <?php $problem_attach_form->printHTML(); ?>
  614. </div>
  615. <?php elseif ($cur_tab == 'certs'): ?>
  616. <div>
  617. <h4>将勋章授予某人</h4>
  618. <?php $assign_certs_form->printHTML(); ?>
  619. </div>
  620. <?php elseif ($cur_tab == 'rating'): ?>
  621. <div>
  622. <h4>Rating 管理</h4>
  623. <h4 style="color: red">重置 Rating</h4>
  624. <?php $purge_rating_form->printHTML(); ?>
  625. </div>
  626. <?php endif ?>
  627. </div>
  628. </div>
  629. <?php echoUOJPageFooter() ?>