super_manage.php 20 KB

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