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