fix: problem uploader

This commit is contained in:
Baoshuo Ren 2022-09-19 16:02:44 +08:00
parent 09e5234e5f
commit 5dd5934e8c
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A

View File

@ -14,6 +14,8 @@
if (isSuperUser($myUser) || isProblemManager($myUser) || isProblemUploader($myUser)) { if (isSuperUser($myUser) || isProblemManager($myUser) || isProblemUploader($myUser)) {
$new_problem_form = new UOJForm('new_problem'); $new_problem_form = new UOJForm('new_problem');
$new_problem_form->handle = function() { $new_problem_form->handle = function() {
global $myUser;
DB::query("insert into problems (title, uploader, is_hidden, submission_requirement) values ('New Problem', '{$myUser['username']}', 1, '{}')"); DB::query("insert into problems (title, uploader, is_hidden, submission_requirement) values ('New Problem', '{$myUser['username']}', 1, '{}')");
$id = DB::insert_id(); $id = DB::insert_id();
DB::query("insert into problems_contents (id, statement, statement_md) values ($id, '', '')"); DB::query("insert into problems_contents (id, statement, statement_md) values ($id, '', '')");
@ -113,29 +115,9 @@ EOD;
'url' => "/problems/template" 'url' => "/problems/template"
) )
); );
/*
<?php
echoLongTable(array('*'),
"problems left join best_ac_submissions on best_ac_submissions.submitter = '{$myUser['username']}' and problems.id = best_ac_submissions.problem_id", $cond, 'order by id asc',
$header,
'echoProblem',
array('page_len' => 3,
'table_classes' => array('table', 'table-bordered', 'table-hover', 'table-striped'),
'print_after_table' => function() {
global $myUser;
if (isSuperUser($myUser)) {
global $new_problem_form;
$new_problem_form->printHTML();
}
},
'head_pagination' => true
)
);
?>*/
$pag_config = array('page_len' => 40); $pag_config = array('page_len' => 40);
$pag_config['col_names'] = array('*'); $pag_config['col_names'] = array('best_ac_submissions.submission_id as submission_id', 'problems.id as id', 'problems.is_hidden as is_hidden', 'problems.title as title', 'problems.submit_num as submit_num', 'problems.ac_num as ac_num', 'problems.zan as zan', 'problems.extra_config as extra_config', 'problems.uploader as uploader');
$pag_config['table_name'] = "problems left join best_ac_submissions on best_ac_submissions.submitter = '{$myUser['username']}' and problems.id = best_ac_submissions.problem_id"; $pag_config['table_name'] = "problems left join best_ac_submissions on best_ac_submissions.submitter = '{$myUser['username']}' and problems.id = best_ac_submissions.problem_id";
$pag_config['cond'] = $cond; $pag_config['cond'] = $cond;
$pag_config['tail'] = "order by id asc"; $pag_config['tail'] = "order by id asc";