feat(web): drop bs4
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Baoshuo Ren 2022-10-22 21:12:13 +08:00
parent 236a152f51
commit 277e69f507
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
24 changed files with 236 additions and 605 deletions

View File

@ -7,10 +7,7 @@
become403Page(); become403Page();
} }
if (!isset($_COOKIE['bootstrap4'])) { requireLib('bootstrap5');
$REQUIRE_LIB['bootstrap5'] = '';
}
requirePHPLib('form'); requirePHPLib('form');
function echoBlogCell($blog) { function echoBlogCell($blog) {
@ -45,22 +42,16 @@
</tr> </tr>
EOD; EOD;
$config = [ $config = [
'table_classes' => ['table', 'table-hover'], 'page_len' => 40,
'page_len' => 40 'div_classes' => ['card', 'my-3'],
'table_classes' => ['table', 'uoj-table', 'mb-0'],
]; ];
if (isset($REQUIRE_LIB['bootstrap5'])) {
$config['div_classes'] = ['card', 'my-3'];
$config['table_classes'] = ['table', 'uoj-table', 'mb-0'];
}
?> ?>
<?php echoUOJPageHeader(UOJLocale::get('announcements')) ?> <?php echoUOJPageHeader(UOJLocale::get('announcements')) ?>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<div class="row"> <div class="row">
<!-- left col --> <!-- left col -->
<div class="col-lg-9"> <div class="col-lg-9">
<?php endif ?>
<h1 class="h2"> <h1 class="h2">
<?= UOJLocale::get('announcements') ?> <?= UOJLocale::get('announcements') ?>
@ -68,7 +59,6 @@ EOD;
<?php echoLongTable(array('blogs.id', 'poster', 'title', 'post_time', 'zan', 'level'), 'important_blogs, blogs', 'is_hidden = 0 and important_blogs.blog_id = blogs.id', 'order by level desc, important_blogs.blog_id desc', $header, 'echoBlogCell', $config); ?> <?php echoLongTable(array('blogs.id', 'poster', 'title', 'post_time', 'zan', 'level'), 'important_blogs, blogs', 'is_hidden = 0 and important_blogs.blog_id = blogs.id', 'order by level desc, important_blogs.blog_id desc', $header, 'echoBlogCell', $config); ?>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
</div> </div>
<!-- end left col --> <!-- end left col -->
@ -79,6 +69,5 @@ EOD;
<!-- end right col --> <!-- end right col -->
</div> </div>
<?php endif ?>
<?php echoUOJPageFooter() ?> <?php echoUOJPageFooter() ?>

View File

@ -1,4 +1,5 @@
<?php <?php
requireLib('bootstrap5');
requirePHPLib('form'); requirePHPLib('form');
if (!Auth::check() && UOJConfig::$data['switch']['force-login']) { if (!Auth::check() && UOJConfig::$data['switch']['force-login']) {
@ -8,62 +9,21 @@
if (!isNormalUser($myUser) && UOJConfig::$data['switch']['force-login']) { if (!isNormalUser($myUser) && UOJConfig::$data['switch']['force-login']) {
become403Page(); become403Page();
} }
if (!isset($_COOKIE['bootstrap4'])) {
$REQUIRE_LIB['bootstrap5'] = '';
}
function echoBlogCell($blog) {
global $REQUIRE_LIB;
echo '<tr>';
if ($blog['is_hidden']) {
echo '<td><span class="text-danger">[已隐藏]</span> ' . getBlogLink($blog['id']) . '</td>';
} else {
echo '<td>' . getBlogLink($blog['id']) . '</td>';
}
echo '<td>' . getUserLink($blog['poster']) . '</td>';
echo '<td>' . $blog['post_time'] . '</td>';
echo '</tr>';
}
$header = <<<EOD
<tr>
<th width="60%">标题</th>
<th width="20%">发表者</th>
<th width="20%">发表日期</th>
</tr>
EOD;
$config = array();
$config['table_classes'] = array('table', 'table-hover');
if (isset($REQUIRE_LIB['bootstrap5'])) {
$config['div_classes'] = array('card', 'my-3', 'table-responsive');
$config['table_classes'] = array('table', 'uoj-table', 'mb-0');
}
?> ?>
<?php echoUOJPageHeader(UOJLocale::get('blogs')) ?> <?php echoUOJPageHeader(UOJLocale::get('blogs')) ?>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<div class="row"> <div class="row">
<!-- left col -->
<div class="col-lg-9"> <div class="col-lg-9">
<div class="d-flex flex-wrap justify-content-between">
<?php endif ?>
<?php if (!isset($REQUIRE_LIB['bootstrap5'])): ?> <!-- title container -->
<?php if (Auth::check()): ?> <div class="d-flex flex-wrap justify-content-between align-items-center">
<div class="float-right">
<div class="btn-group">
<a href="<?= HTML::blog_url(Auth::id(), '/') ?>" class="btn btn-secondary btn-sm">我的博客首页</a>
<a href="<?= HTML::blog_url(Auth::id(), '/post/new/write')?>" class="btn btn-primary btn-sm"><span class="glyphicon glyphicon-edit"></span> 写新博客</a>
</div>
</div>
<?php endif ?>
<?php endif ?>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<h1 class="h2"> <h1 class="h2">
<?= UOJLocale::get("blogs overview") ?> <?= UOJLocale::get("blogs overview") ?>
</h1> </h1>
<div class="text-end"> <div class="text-end">
<div class="btn-group"> <div class="btn-group">
<a href="<?= HTML::blog_url(Auth::id(), '/') ?>" class="btn btn-secondary btn-sm"> <a href="<?= HTML::blog_url(Auth::id(), '/') ?>" class="btn btn-secondary btn-sm">
@ -75,24 +35,50 @@ EOD;
</a> </a>
</div> </div>
</div> </div>
<?php else: ?>
<h3>博客总览</h3>
<?php endif ?>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
</div> </div>
<?php endif ?> <!-- end title container -->
<?php echoLongTable(array('id', 'poster', 'title', 'post_time', 'zan', 'is_hidden'), 'blogs', isSuperUser($myUser) ? "1" : "is_hidden = 0 or poster = '{$myUser['username']}'", 'order by post_time desc', $header, 'echoBlogCell', $config); ?> <?php
echoLongTable(
['id', 'poster', 'title', 'post_time', 'zan', 'is_hidden'],
'blogs',
isSuperUser($myUser) ? "1" : "is_hidden = 0 or poster = '{$myUser['username']}'",
'order by post_time desc',
<<<EOD
<tr>
<th width="60%">标题</th>
<th width="20%">发表者</th>
<th width="20%">发表日期</th>
</tr>
EOD,
function($blog) {
echo '<tr>';
echo '<td>';
echo getBlogLink($blog['id']);
if ($blog['is_hidden']) {
echo ' <span class="badge text-bg-danger"><i class="bi bi-eye-slash-fill"></i> ', UOJLocale::get('hidden'), '</span> ';
}
echo '</td>';
echo '<td>' . getUserLink($blog['poster']) . '</td>';
echo '<td>' . $blog['post_time'] . '</td>';
echo '</tr>';
},
[
'page_len' => 10,
'div_classes' => ['card', 'my-3', 'table-responsive'],
'table_classes' => ['table', 'uoj-table', 'mb-0'],
]
);
?>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
</div> </div>
<!-- right col -->
<aside class="col-lg-3 mt-3 mt-lg-0"> <aside class="col-lg-3 mt-3 mt-lg-0">
<?php uojIncludeView('sidebar', array()) ?> <?php uojIncludeView('sidebar') ?>
</aside> </aside>
<!-- end right col -->
</div> </div>
<?php endif ?>
<?php echoUOJPageFooter() ?> <?php echoUOJPageFooter() ?>

View File

@ -1,9 +1,8 @@
<?php <?php
requireLib('bootstrap5');
requireLib('mathjax');
requirePHPLib('form'); requirePHPLib('form');
$REQUIRE_LIB['bootstrap5'] = '';
$REQUIRE_LIB['mathjax'] = '';
if (!Auth::check() && UOJConfig::$data['switch']['force-login']) { if (!Auth::check() && UOJConfig::$data['switch']['force-login']) {
redirectToLogin(); redirectToLogin();
} }
@ -354,7 +353,7 @@ EOD;
} }
function echoDashboard() { function echoDashboard() {
global $contest, $post_notice, $post_question, $reply_question, $REQUIRE_LIB; global $contest, $post_notice, $post_question, $reply_question;
$myname = Auth::id(); $myname = Auth::id();
$contest_problems = DB::selectAll("select contests_problems.problem_id, best_ac_submissions.submission_id from contests_problems left join best_ac_submissions on contests_problems.problem_id = best_ac_submissions.problem_id and submitter = '{$myname}' where contest_id = {$contest['id']} order by contests_problems.dfn, contests_problems.problem_id"); $contest_problems = DB::selectAll("select contests_problems.problem_id, best_ac_submissions.submission_id from contests_problems left join best_ac_submissions on contests_problems.problem_id = best_ac_submissions.problem_id and submitter = '{$myname}' where contest_id = {$contest['id']} order by contests_problems.dfn, contests_problems.problem_id");
@ -389,7 +388,6 @@ EOD;
'post_question' => $post_question, 'post_question' => $post_question,
'my_questions_pag' => $my_questions_pag, 'my_questions_pag' => $my_questions_pag,
'others_questions_pag' => $others_questions_pag, 'others_questions_pag' => $others_questions_pag,
'REQUIRE_LIB' => $REQUIRE_LIB,
]); ]);
} }

View File

@ -1,4 +1,5 @@
<?php <?php
requireLib('bootstrap5');
requirePHPLib('form'); requirePHPLib('form');
if (!Auth::check() && UOJConfig::$data['switch']['force-login']) { if (!Auth::check() && UOJConfig::$data['switch']['force-login']) {
@ -13,10 +14,6 @@
become404Page(); become404Page();
} }
if (!isset($_COOKIE['bootstrap4'])) {
$REQUIRE_LIB['bootstrap5'] = '';
}
genMoreContestInfo($contest); genMoreContestInfo($contest);
if (isSuperUser($myUser)) { if (isSuperUser($myUser)) {
@ -178,26 +175,24 @@
?> ?>
<?php echoUOJPageHeader(HTML::stripTags($contest['name']) . ' - ' . UOJLocale::get('contests::contest registrants')) ?> <?php echoUOJPageHeader(HTML::stripTags($contest['name']) . ' - ' . UOJLocale::get('contests::contest registrants')) ?>
<h1 class="h2 text-center"><?= $contest['name'] ?></h1> <h1 class="h2 text-center">
<?= $contest['name'] ?>
</h1>
<?php if ($contest['cur_progress'] == CONTEST_NOT_STARTED): ?> <?php if ($contest['cur_progress'] == CONTEST_NOT_STARTED): ?>
<?php if ($iHasRegistered): ?> <?php if ($iHasRegistered): ?>
<div class="row"> <div class="row">
<div class="col-6"> <div class="col-6">
<a style="color:green">已报名</a> <a style="color:green">已报名</a>
</div> </div>
<div class="col-6 <div class="col-6 text-end">
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
text-end
<?php else: ?>
text-right
<?php endif ?>">
<?php $unregister_form->printHTML(); ?> <?php $unregister_form->printHTML(); ?>
</div> </div>
</div> </div>
<?php else: ?> <?php else: ?>
<div>当前尚未报名,您可以<a style="color:red" href="/contest/<?= $contest['id'] ?>/register">报名</a></div> <div>当前尚未报名,您可以 <a class="text-decoration-none text-danger" href="/contest/<?= $contest['id'] ?>/register">报名</a></div>
<?php endif ?> <?php endif ?>
<div class="top-buffer-sm"></div> <div class="mt-2"></div>
<?php endif ?> <?php endif ?>
<?php <?php
@ -220,63 +215,56 @@
} }
$header_row .= '</tr>'; $header_row .= '</tr>';
$config = array('page_len' => 100, echoLongTable(
'get_row_index' => '', ['*'],
'print_after_table' => function() { 'contests_registrants',
global $add_new_contestant_form, "contest_id = {$contest['id']}",
$add_group_to_contest_form, 'order by username desc',
$remove_user_from_contest_form,
$force_set_user_participated_form;
if (isset($add_new_contestant_form)) {
$add_new_contestant_form->printHTML();
}
if (isset($add_group_to_contest_form)) {
$add_group_to_contest_form->printHTML();
}
if (isset($remove_user_from_contest_form)) {
$remove_user_from_contest_form->printHTML();
}
if (isset($force_set_user_participated_form)) {
$force_set_user_participated_form->printHTML();
}
}
);
if (isset($REQUIRE_LIB['bootstrap5'])) {
$config['div_classes'] = array('card', 'mb-3');
$config['table_classes'] = array('table', 'uoj-table', 'mb-0', 'text-center');
}
echoLongTable(array('*'), 'contests_registrants', "contest_id = {$contest['id']}", 'order by username desc',
$header_row, $header_row,
function($contest, $num) { function($contestant, $num) use ($myUser, $has_contest_permission, $show_ip, $ip_owner, $has_participated) {
global $myUser; $user = queryUser($contestant['username']);
global $has_contest_permission, $show_ip, $ip_owner, $has_participated;
$user = queryUser($contest['username']);
$user_link = getUserLink($contest['username']);
if (!$show_ip) { if (!$show_ip) {
echo '<tr>'; echo '<tr>';
} else { } else {
if ($ip_owner[$user['remote_addr']] != $user['username'] || $forwarded_ip_owner[$user['http_x_forwarded_for']] != $user['username']) { if ($ip_owner[$user['remote_addr']] != $user['username'] || $forwarded_ip_owner[$user['http_x_forwarded_for']] != $user['username']) {
echo '<tr class="danger">'; echo '<tr class="table-danger">';
} else { } else {
echo '<tr>'; echo '<tr>';
} }
} }
echo '<td>'.$num.'</td>'; echo '<td>'.$num.'</td>';
echo '<td>'.$user_link.'</td>'; echo '<td>'.getUserLink($contestant['username']).'</td>';
if ($show_ip) { if ($show_ip) {
echo '<td>'.$user['remote_addr'].'</td>'; echo '<td>'.$user['remote_addr'].'</td>';
echo '<td>'.$user['http_x_forwarded_for'].'</td>'; echo '<td>'.$user['http_x_forwarded_for'].'</td>';
} }
if ($has_contest_permission) { if ($has_contest_permission) {
echo '<td>'.($has_participated[$user['username']] ? 'Yes' : 'No').'</td>'; echo '<td>'.($contestant['has_participated'] ? 'Yes' : 'No').'</td>';
} }
echo '</tr>'; echo '</tr>';
}, },
$config [
'page_len' => 50,
'get_row_index' => '',
'div_classes' => ['table-responsive', 'card', 'mb-3'],
'table_classes' => ['table', 'uoj-table', 'mb-0', 'text-center'],
]
); );
?> ?>
<?php
if (isset($add_new_contestant_form)) {
$add_new_contestant_form->printHTML();
}
if (isset($add_group_to_contest_form)) {
$add_group_to_contest_form->printHTML();
}
if (isset($remove_user_from_contest_form)) {
$remove_user_from_contest_form->printHTML();
}
if (isset($force_set_user_participated_form)) {
$force_set_user_participated_form->printHTML();
}
?>
<?php echoUOJPageFooter() ?> <?php echoUOJPageFooter() ?>

View File

@ -1,28 +1,19 @@
<?php <?php
requireLib('bootstrap5');
requirePHPLib('form'); requirePHPLib('form');
if (!Auth::check() && UOJConfig::$data['switch']['force-login']) { if (!Auth::check() && UOJConfig::$data['switch']['force-login']) {
redirectToLogin(); redirectToLogin();
} }
if (!isset($_COOKIE['bootstrap4'])) {
$REQUIRE_LIB['bootstrap5'] = '';
}
$upcoming_contest_name = null; $upcoming_contest_name = null;
$upcoming_contest_href = null; $upcoming_contest_href = null;
$rest_second = 1000000; $rest_second = 1000000;
function echoContest($contest) { function echoContest($contest) {
global $myUser, $upcoming_contest_name, $upcoming_contest_href, $rest_second, $REQUIRE_LIB; global $myUser, $upcoming_contest_name, $upcoming_contest_href, $rest_second;
$a_class = ' ';
if (isset($REQUIRE_LIB['bootstrap5'])) {
$a_class = ' class="text-decoration-none" ';
}
$contest_name_link = <<<EOD $contest_name_link = <<<EOD
<a $a_class href="/contest/{$contest['id']}">{$contest['name']}</a> <a class="text-decoration-none" href="/contest/{$contest['id']}">{$contest['name']}</a>
EOD; EOD;
genMoreContestInfo($contest); genMoreContestInfo($contest);
if ($contest['cur_progress'] == CONTEST_NOT_STARTED) { if ($contest['cur_progress'] == CONTEST_NOT_STARTED) {
@ -33,18 +24,18 @@ EOD;
$rest_second = $cur_rest_second; $rest_second = $cur_rest_second;
} }
if ($myUser != null && hasRegistered($myUser, $contest)) { if ($myUser != null && hasRegistered($myUser, $contest)) {
$contest_name_link .= '<sup><a '.$a_class.' style="color:green">'.UOJLocale::get('contests::registered').'</a></sup>'; $contest_name_link .= '<sup><a class="text-decoration-none" style="color:green">'.UOJLocale::get('contests::registered').'</a></sup>';
} else { } else {
$contest_name_link .= '<sup><a '.$a_class.' style="color:red" href="/contest/'.$contest['id'].'/register">'.UOJLocale::get('contests::register').'</a></sup>'; $contest_name_link .= '<sup><a class="text-decoration-none" style="color:red" href="/contest/'.$contest['id'].'/register">'.UOJLocale::get('contests::register').'</a></sup>';
} }
} elseif ($contest['cur_progress'] == CONTEST_IN_PROGRESS) { } elseif ($contest['cur_progress'] == CONTEST_IN_PROGRESS) {
$contest_name_link .= '<sup><a '.$a_class.' style="color:blue" href="/contest/'.$contest['id'].'">'.UOJLocale::get('contests::in progress').'</a></sup>'; $contest_name_link .= '<sup><a class="text-decoration-none" style="color:blue" href="/contest/'.$contest['id'].'">'.UOJLocale::get('contests::in progress').'</a></sup>';
} elseif ($contest['cur_progress'] == CONTEST_PENDING_FINAL_TEST) { } elseif ($contest['cur_progress'] == CONTEST_PENDING_FINAL_TEST) {
$contest_name_link .= '<sup><a '.$a_class.' style="color:blue" href="/contest/'.$contest['id'].'">'.UOJLocale::get('contests::pending final test').'</a></sup>'; $contest_name_link .= '<sup><a class="text-decoration-none" style="color:blue" href="/contest/'.$contest['id'].'">'.UOJLocale::get('contests::pending final test').'</a></sup>';
} elseif ($contest['cur_progress'] == CONTEST_TESTING) { } elseif ($contest['cur_progress'] == CONTEST_TESTING) {
$contest_name_link .= '<sup><a '.$a_class.' style="color:blue" href="/contest/'.$contest['id'].'">'.UOJLocale::get('contests::final testing').'</a></sup>'; $contest_name_link .= '<sup><a class="text-decoration-none" style="color:blue" href="/contest/'.$contest['id'].'">'.UOJLocale::get('contests::final testing').'</a></sup>';
} elseif ($contest['cur_progress'] == CONTEST_FINISHED) { } elseif ($contest['cur_progress'] == CONTEST_FINISHED) {
$contest_name_link .= '<sup><a '.$a_class.'style="color:grey" href="/contest/'.$contest['id'].'/standings">'.UOJLocale::get('contests::ended').'</a></sup>'; $contest_name_link .= '<sup><a class="text-decoration-none" style="color:grey" href="/contest/'.$contest['id'].'/standings">'.UOJLocale::get('contests::ended').'</a></sup>';
} }
$last_hour = round($contest['last_min'] / 60, 2); $last_hour = round($contest['last_min'] / 60, 2);
@ -52,44 +43,33 @@ EOD;
$click_zan_block = getClickZanBlock('C', $contest['id'], $contest['zan']); $click_zan_block = getClickZanBlock('C', $contest['id'], $contest['zan']);
echo '<tr>'; echo '<tr>';
echo '<td>', $contest_name_link, '</td>'; echo '<td>', $contest_name_link, '</td>';
echo '<td>', '<a'.$a_class.'href="'.HTML::timeanddate_url($contest['start_time'], array('duration' => $contest['last_min'])).'">'.$contest['start_time_str'].'</a>', '</td>'; echo '<td>', '<a class="text-decoration-none" href="'.HTML::timeanddate_url($contest['start_time'], array('duration' => $contest['last_min'])).'">'.$contest['start_time_str'].'</a>', '</td>';
echo '<td>', UOJLocale::get('hours', $last_hour), '</td>'; echo '<td>', UOJLocale::get('hours', $last_hour), '</td>';
echo '<td>', '<a'.$a_class.'href="/contest/'.$contest['id'].'/registrants">'; echo '<td>', '<a class="text-decoration-none" href="/contest/'.$contest['id'].'/registrants">', '<i class="bi bi-person-fill"></i>', ' &times;'.$contest['player_num'].'</a>', '</td>';
if (isset($REQUIRE_LIB['bootstrap5'])) {
echo '<i class="bi bi-person-fill"></i>';
} else {
echo '<span class="glyphicon glyphicon-user"></span>';
}
echo ' &times;'.$contest['player_num'].'</a>', '</td>';
echo '<td>', '<div class="text-left">'.$click_zan_block.'</div>', '</td>'; echo '<td>', '<div class="text-left">'.$click_zan_block.'</div>', '</td>';
echo '</tr>'; echo '</tr>';
} }
?> ?>
<?php echoUOJPageHeader(UOJLocale::get('contests')) ?> <?php echoUOJPageHeader(UOJLocale::get('contests')) ?>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<!-- title container -->
<div class="d-flex justify-content-between"> <div class="d-flex justify-content-between">
<?php endif ?>
<h1 class="h2"> <h1 class="h2">
<?= UOJLocale::get('contests') ?> <?= UOJLocale::get('contests') ?>
</h1> </h1>
<?php
if (isSuperUser($myUser)) {
if (isset($REQUIRE_LIB['bootstrap5'])) {
echo '<div class="text-end">';
} else {
echo '<div class="text-right">';
}
echo '<a href="/contest/new" class="btn btn-primary">'.UOJLocale::get('contests::add new contest').'</a>';
echo '</div>';
}
?>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?> <?php if (isSuperUser($myUser)): ?>
<div class="text-end">
<a href="/contest/new" class="btn btn-primary"><?= UOJLocale::get('contests::add new contest') ?></a>
</div> </div>
<?php endif ?> <?php endif ?>
<h4><?= UOJLocale::get('contests::current or upcoming contests') ?></h4>
</div>
<!-- end title container -->
<h2 class="h4">
<?= UOJLocale::get('contests::current or upcoming contests') ?>
</h2>
<?php <?php
$table_header = ''; $table_header = '';
$table_header .= '<tr>'; $table_header .= '<tr>';
@ -100,12 +80,18 @@ if (isSuperUser($myUser)) {
$table_header .= '<th style="width:180px;">'.UOJLocale::get('appraisal').'</th>'; $table_header .= '<th style="width:180px;">'.UOJLocale::get('appraisal').'</th>';
$table_header .= '</tr>'; $table_header .= '</tr>';
$table_config = array('page_len' => 40); $table_config = [
if (isset($REQUIRE_LIB['bootstrap5'])) { 'page_len' => 40,
$table_config['div_classes'] = array('card', 'mb-3'); 'div_classes' => ['card', 'mb-3'],
$table_config['table_classes'] = array('table', 'uoj-table', 'mb-0', 'text-center'); 'table_classes' => ['table', 'uoj-table', 'mb-0', 'text-center'],
} ];
echoLongTable(array('*'), 'contests', "status != 'finished'", 'order by start_time asc, id asc', $table_header,
echoLongTable(
['*'],
'contests',
"status != 'finished'",
'order by start_time asc, id asc',
$table_header,
echoContest, echoContest,
$table_config $table_config
); );
@ -128,9 +114,16 @@ EOD;
} }
?> ?>
<h4><?= UOJLocale::get('contests::ended contests') ?></h4> <h2 class="h4">
<?= UOJLocale::get('contests::ended contests') ?>
</h2>
<?php <?php
echoLongTable(array('*'), 'contests', "status = 'finished'", 'order by start_time desc, id desc', $table_header, echoLongTable(
['*'],
'contests',
"status = 'finished'",
'order by start_time desc, id desc',
$table_header,
echoContest, echoContest,
$table_config $table_config
); );

View File

@ -3,28 +3,20 @@
$countdowns = DB::selectAll("select * from countdowns order by end_time asc"); $countdowns = DB::selectAll("select * from countdowns order by end_time asc");
$friend_links = DB::selectAll("select * from friend_links order by level desc, id asc"); $friend_links = DB::selectAll("select * from friend_links order by level desc, id asc");
if (!isset($_COOKIE['bootstrap4'])) { requireLib('bootstrap5');
$REQUIRE_LIB['bootstrap5'] = '';
}
?> ?>
<?php echoUOJPageHeader(UOJConfig::$data['profile']['oj-name-short']) ?> <?php echoUOJPageHeader(UOJConfig::$data['profile']['oj-name-short']) ?>
<div class="row"> <div class="row">
<div class="col-lg-9"> <div class="col-lg-9">
<div class="card card-default"> <div class="card card-default">
<div class="card-body"> <div class="card-body">
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?> <h4 class="card-title">
<h4 class="card-title"> <?= UOJLocale::get('announcements') ?>
<?= UOJLocale::get('announcements') ?> </h4>
</h4>
<?php endif ?>
<table class="table table-sm"> <table class="table table-sm">
<thead> <thead>
<tr> <tr>
<th style="width:60%"> <th style="width:60%"></th>
<?php if (!isset($REQUIRE_LIB['bootstrap5'])): ?>
<?= UOJLocale::get('announcements') ?>
<?php endif ?>
</th>
<th style="width:20%"></th> <th style="width:20%"></th>
<th style="width:20%"></th> <th style="width:20%"></th>
</tr> </tr>
@ -41,11 +33,7 @@
?> ?>
<tr> <tr>
<td> <td>
<a href="/blogs/<?= $blog['id'] ?>" <a href="/blogs/<?= $blog['id'] ?>" class="text-decoration-none"><?= $blog['title'] ?></a>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
class="text-decoration-none"
<?php endif ?>
><?= $blog['title'] ?></a>
<?= $new_tag ?> <?= $new_tag ?>
</td> </td>
<td>by <?= getUserLink($blog['poster']) ?></td> <td>by <?= getUserLink($blog['poster']) ?></td>
@ -55,51 +43,33 @@
<?php for ($i = $now_cnt + 1; $i <= 5; $i++): ?> <?php for ($i = $now_cnt + 1; $i <= 5; $i++): ?>
<tr><td colspan="233">&nbsp;</td></tr> <tr><td colspan="233">&nbsp;</td></tr>
<?php endfor ?> <?php endfor ?>
<?php if (!isset($REQUIRE_LIB['bootstrap5'])): ?>
<tr><td class="text-right" colspan="233"><a href="/announcements"><?= UOJLocale::get('all the announcements') ?></a></td></tr>
<?php endif ?>
</tbody> </tbody>
</table> </table>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?> <div class="text-end">
<div class="text-end"> <a class="text-decoration-none" href="/announcements">
<a class="text-decoration-none" href="/announcements"><?= UOJLocale::get('all the announcements') ?></a> <?= UOJLocale::get('all the announcements') ?>
</div> </a>
<?php endif ?> </div>
</div> </div>
</div> </div>
<?php if (!UOJConfig::$data['switch']['force-login'] || Auth::check()): ?> <?php if (!UOJConfig::$data['switch']['force-login'] || Auth::check()): ?>
<?php if (!UOJConfig::$data['switch']['force-login'] || isNormalUser($myUser)): ?> <?php if (!UOJConfig::$data['switch']['force-login'] || isNormalUser($myUser)): ?>
<div class="mt-4 <div class="mt-4 card">
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
card
<?php endif ?>
">
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<div class="card-body"> <div class="card-body">
<h4 class="card-title"><?= UOJLocale::get('top solver') ?></h4> <h4 class="card-title"><?= UOJLocale::get('top solver') ?></h4>
<?php else: ?> <?php echoRanklist([
<h3><?= UOJLocale::get('top solver') ?></h3>
<?php endif ?>
<?php echoRanklist(array(
'echo_full' => true, 'echo_full' => true,
'top10' => true, 'top10' => true,
'by_accepted' => true, 'by_accepted' => true,
'table_classes' => isset($REQUIRE_LIB['bootstrap5']) 'table_classes' => ['table', 'text-center'],
? array('table', 'text-center') ]) ?>
: array('table', 'table-bordered', 'table-hover', 'table-striped', 'table-text-center'),
)) ?>
<div class="text-center"> <div class="text-center">
<a href="/solverlist" <a href="/solverlist" class="text-decoration-none">
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?> <?= UOJLocale::get('view all') ?>
class="text-decoration-none" </a>
<?php endif ?>
><?= UOJLocale::get('view all') ?></a>
</div> </div>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
</div> </div>
<?php endif ?>
</div> </div>
<?php endif ?> <?php endif ?>
<?php else: ?> <?php else: ?>
@ -115,23 +85,11 @@
<img class="media-object img-thumbnail" src="/images/logo.png" alt="Logo" /> <img class="media-object img-thumbnail" src="/images/logo.png" alt="Logo" />
</div> </div>
<div class="card card-default mb-2"> <div class="card card-default mb-2">
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<div class="card-header bg-white"> <div class="card-header bg-white">
<b><?= UOJLocale::get('countdowns') ?></b> <b><?= UOJLocale::get('countdowns') ?></b>
</div> </div>
<?php endif ?>
<div class="card-body"> <div class="card-body">
<?php if (!isset($REQUIRE_LIB['bootstrap5'])): ?> <ul class="list-unstyled mb-0">
<h4 class="card-title" style="font-size: 1.25rem">
<?= UOJLocale::get('countdowns') ?>
</h4>
<?php endif ?>
<ul class="
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
list-unstyled
<?php else: ?>
pl-4
<?php endif ?> mb-0">
<?php foreach ($countdowns as $countdown): ?> <?php foreach ($countdowns as $countdown): ?>
<?php <?php
$enddate = strtotime($countdown['end_time']); $enddate = strtotime($countdown['end_time']);
@ -156,37 +114,20 @@
</div> </div>
<?php if (Auth::check()): ?> <?php if (Auth::check()): ?>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?> <?php uojIncludeView('sidebar', ['assignments_hidden' => '', 'groups_hidden' => '']) ?>
<?php uojIncludeView('sidebar', ['assignments_hidden' => '', 'groups_hidden' => '']) ?>
<?php endif ?>
<?php endif ?> <?php endif ?>
<div class="card card-default mb-2"> <div class="card card-default mb-2">
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?> <div class="card-header bg-white">
<div class="card-header bg-white"> <b><?= UOJLocale::get('friend links') ?></b>
<b><?= UOJLocale::get('friend links') ?></b> </div>
</div>
<?php endif ?>
<div class="card-body"> <div class="card-body">
<?php if (!isset($REQUIRE_LIB['bootstrap5'])): ?> <ul class="ps-3 mb-0">
<h4 class="card-title" style="font-size: 1.25rem">
<?= UOJLocale::get('friend links') ?>
</h4>
<?php endif ?>
<ul class="
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
ps-3
<?php else: ?>
pl-4
<?php endif ?>
mb-0">
<?php foreach ($friend_links as $friend_link): ?> <?php foreach ($friend_links as $friend_link): ?>
<li> <li>
<a <a class="text-decoration-none" href="<?= $friend_link['url'] ?>" target="_blank">
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?> <?= $friend_link['title'] ?>
class="text-decoration-none" </a>
<?php endif ?>
href="<?= $friend_link['url'] ?>" target="_blank"><?= $friend_link['title'] ?></a>
</li> </li>
<?php endforeach ?> <?php endforeach ?>
</ul> </ul>

View File

@ -2,6 +2,9 @@
use Gregwar\Captcha\PhraseBuilder; use Gregwar\Captcha\PhraseBuilder;
use Gregwar\Captcha\CaptchaBuilder; use Gregwar\Captcha\CaptchaBuilder;
requireLib('md5');
requireLib('bootstrap5');
if (Auth::check()) { if (Auth::check()) {
redirectTo('/'); redirectTo('/');
} }
@ -50,10 +53,6 @@
die(); die();
} }
?> ?>
<?php
$REQUIRE_LIB['bootstrap5'] = '';
$REQUIRE_LIB['md5'] = '';
?>
<?php echoUOJPageHeader(UOJLocale::get('login')) ?> <?php echoUOJPageHeader(UOJLocale::get('login')) ?>
<style> <style>

View File

@ -1,4 +1,7 @@
<?php <?php
requireLib('bootstrap5');
requireLib('hljs');
requireLib('mathjax');
requirePHPLib('form'); requirePHPLib('form');
requirePHPLib('judger'); requirePHPLib('judger');
@ -10,10 +13,6 @@
become404Page(); become404Page();
} }
if (!isset($_COOKIE['bootstrap4'])) {
$REQUIRE_LIB['bootstrap5'] = '';
}
$problem_content = queryProblemContent($problem['id']); $problem_content = queryProblemContent($problem['id']);
$contest = validateUInt($_GET['contest_id']) ? queryContest($_GET['contest_id']) : null; $contest = validateUInt($_GET['contest_id']) ? queryContest($_GET['contest_id']) : null;
@ -220,16 +219,6 @@ EOD
} }
?> ?>
<?php
requireLib('mathjax');
if (isset($REQUIRE_LIB['bootstrap5'])) {
requireLib('hljs');
} else {
$REQUIRE_LIB['shjs'] = '';
}
?>
<?php echoUOJPageHeader(HTML::stripTags($problem['title']) . ' - ' . UOJLocale::get('problems::problem')) ?> <?php echoUOJPageHeader(HTML::stripTags($problem['title']) . ' - ' . UOJLocale::get('problems::problem')) ?>
<?php <?php
$limit = getUOJConf("/var/uoj_data/{$problem['id']}/problem.conf"); $limit = getUOJConf("/var/uoj_data/{$problem['id']}/problem.conf");
@ -239,14 +228,12 @@ EOD
$problem_uploader = $problem['uploader']; $problem_uploader = $problem['uploader'];
?> ?>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<div class="row"> <div class="row">
<!-- Left col --> <!-- Left col -->
<div class="col-lg-9"> <div class="col-lg-9">
<?php endif ?>
<?php if (isset($REQUIRE_LIB['bootstrap5']) && $contest): ?> <?php if ($contest): ?>
<!-- 比赛导航 --> <!-- 比赛导航 -->
<?php <?php
$tabs_info = array( $tabs_info = array(
@ -287,65 +274,17 @@ EOD
</div> </div>
<?php endif ?> <?php endif ?>
<?php if (!isset($REQUIRE_LIB['bootstrap5'])): ?>
<div class="row d-flex justify-content-center">
<span class="badge badge-secondary mr-1">时间限制:<?=$time_limit!=null?"$time_limit s":"N/A"?></span>
<span class="badge badge-secondary mr-1">空间限制:<?=$memory_limit!=null?"$memory_limit MB":"N/A"?></span>
<span class="badge badge-secondary mr-1">上传者:<?= $problem_uploader ?: "root" ?></span>
</div>
<div class="float-right">
<?= getClickZanBlock('P', $problem['id'], $problem['zan']) ?>
</div>
<?php endif ?>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<div class="card card-default mb-2"> <div class="card card-default mb-2">
<div class="card-body"> <div class="card-body">
<?php endif ?>
<h1 class="h2 card-title text-center">
<?php if ($contest): ?> <?php if ($contest): ?>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<h1 class="h2 card-title text-center">
<?= $problem_letter ?>. <?= $problem['title'] ?> <?= $problem_letter ?>. <?= $problem['title'] ?>
</h1>
<?php else: ?> <?php else: ?>
<div class="page-header row">
<h1 class="col-md-3 text-left"><small><?= $contest['name'] ?></small></h1>
<h1 class="col-md-7 text-center"><?= $problem_letter ?>. <?= $problem['title'] ?></h1>
<div class="col-md-2 text-right" id="contest-countdown"></div>
</div>
<div class="btn-group float-right" role="group">
<a role="button" class="btn btn-primary" href="<?= HTML::url("/download.php?type=attachment&id={$problem['id']}") ?>"><span class="glyphicon glyphicon-download-alt"></span> 附件下载</a>
<a role="button" class="btn btn-info" href="/contest/<?= $contest['id'] ?>/problem/<?= $problem['id'] ?>/statistics"><span class="glyphicon glyphicon-stats"></span> <?= UOJLocale::get('problems::statistics') ?></a>
</div>
<?php if ($contest['cur_progress'] <= CONTEST_IN_PROGRESS): ?>
<script type="text/javascript">
$('#contest-countdown').countdown(<?= $contest['end_time']->getTimestamp() - UOJTime::$time_now->getTimestamp() ?>);
</script>
<?php endif ?>
<?php endif ?>
<?php else: ?>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<h1 class="h2 card-title text-center">
<?php else: ?>
<h1 class="page-header text-center">
<?php endif ?>
#<?= $problem['id']?>. <?= $problem['title'] ?> #<?= $problem['id']?>. <?= $problem['title'] ?>
<?php endif ?>
</h1> </h1>
<?php if (!isset($REQUIRE_LIB['bootstrap5'])): ?>
<div class="btn-group float-right" role="group">
<a role="button" class="btn btn-primary" href="<?= HTML::url("/download.php?type=problem&id={$problem['id']}") ?>"><span class="glyphicon glyphicon-tasks"></span> 测试数据</a>
<a role="button" class="btn btn-primary" href="<?= HTML::url("/download.php?type=attachment&id={$problem['id']}") ?>"><span class="glyphicon glyphicon-download-alt"></span> 附件下载</a>
<a role="button" class="btn btn-info" href="/problem/<?= $problem['id'] ?>/statistics"><span class="glyphicon glyphicon-stats"></span> <?= UOJLocale::get('problems::statistics') ?></a>
</div>
<?php endif ?>
<?php endif ?>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<div class="text-center small"> <div class="text-center small">
时间限制: <?= $time_limit != null ? "$time_limit s" : "N/A" ?> 时间限制: <?= $time_limit != null ? "$time_limit s" : "N/A" ?>
&emsp; &emsp;
@ -355,34 +294,12 @@ $('#contest-countdown').countdown(<?= $contest['end_time']->getTimestamp() - UOJ
</div> </div>
<hr> <hr>
<?php endif ?>
<?php if (!isset($REQUIRE_LIB['bootstrap5'])): ?>
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item"><a class="nav-link active" href="#statement" role="tab" data-toggle="tab"><span class="glyphicon glyphicon-book"></span> <?= UOJLocale::get('problems::statement') ?></a></li>
<li class="nav-item"><a class="nav-link" href="#submit" role="tab" data-toggle="tab"><span class="glyphicon glyphicon-upload"></span> <?= UOJLocale::get('problems::submit') ?></a></li>
<?php if ($custom_test_requirement): ?>
<li class="nav-item"><a class="nav-link" href="#custom-test" role="tab" data-toggle="tab"><span class="glyphicon glyphicon-console"></span> <?= UOJLocale::get('problems::custom test') ?></a></li>
<?php endif ?>
<?php if (!$contest || $contest['cur_progress'] >= CONTEST_FINISHED): ?>
<li class="nav-item"><a class="nav-link" href="/problem/<?= $problem['id'] ?>/solutions" role="tab"><?= UOJLocale::get('problems::solutions') ?></a></li>
<?php endif ?>
<?php if (hasProblemPermission($myUser, $problem)): ?>
<li class="nav-item"><a class="nav-link" href="/problem/<?= $problem['id'] ?>/manage/statement" role="tab"><?= UOJLocale::get('problems::manage') ?></a></li>
<?php endif ?>
<?php if ($contest): ?>
<li class="nav-item"><a class="nav-link" href="/contest/<?= $contest['id'] ?>" role="tab"><?= UOJLocale::get('contests::back to the contest') ?></a></li>
<?php endif ?>
</ul>
<?php endif ?>
<?php if (!isset($REQUIRE_LIB['bootstrap5'])): ?>
<link rel="stylesheet" type="text/css" href="<?= HTML::url('/css/markdown.css') ?>">
<?php endif ?>
<div class="tab-content"> <div class="tab-content">
<div class="tab-pane active" id="statement"> <div class="tab-pane active" id="statement">
<article class="mt-3 markdown-body"><?= $problem_content['statement'] ?></article> <article class="mt-3 markdown-body">
<?= $problem_content['statement'] ?>
</article>
</div> </div>
<div class="tab-pane" id="submit"> <div class="tab-pane" id="submit">
<div class="top-buffer-sm"></div> <div class="top-buffer-sm"></div>
@ -401,13 +318,9 @@ $('#contest-countdown').countdown(<?= $contest['end_time']->getTimestamp() - UOJ
<?php endif ?> <?php endif ?>
</div> </div>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
</div> </div>
</div> </div>
<?php endif ?>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
</div> </div>
<!-- End left col --> <!-- End left col -->
@ -547,7 +460,6 @@ $(document).ready(function() {
}); });
}); });
</script> </script>
<?php endif ?>
<?php if ($contest && $contest['cur_progress'] <= CONTEST_IN_PROGRESS): ?> <?php if ($contest && $contest['cur_progress'] <= CONTEST_IN_PROGRESS): ?>
<script type="text/javascript"> <script type="text/javascript">

View File

@ -1,4 +1,5 @@
<?php <?php
requireLib('bootstrap5');
requirePHPLib('form'); requirePHPLib('form');
if (!Auth::check() && UOJConfig::$data['switch']['force-login']) { if (!Auth::check() && UOJConfig::$data['switch']['force-login']) {
@ -12,10 +13,6 @@
become403Page(); become403Page();
} }
if (!isset($_COOKIE['bootstrap4'])) {
$REQUIRE_LIB['bootstrap5'] = '';
}
$managers_form = newAddDelCmdForm('managers', $managers_form = newAddDelCmdForm('managers',
function($username) { function($username) {
if (!validateUsername($username) || !queryUser($username)) { if (!validateUsername($username) || !queryUser($username)) {
@ -67,25 +64,15 @@
?> ?>
<?php echoUOJPageHeader(HTML::stripTags($problem['title']) . ' - 管理者 - 题目管理') ?> <?php echoUOJPageHeader(HTML::stripTags($problem['title']) . ' - 管理者 - 题目管理') ?>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<div class="row"> <div class="row">
<!-- left col -->
<div class="col-lg-9"> <div class="col-lg-9">
<?php endif ?>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<h1 class="h2"> <h1 class="h2">
<?php else: ?> #<?= $problem['id'] ?>. <?= $problem['title'] ?> 管理
<h1 class="page-header text-center">
<?php endif ?>
#<?=$problem['id']?>. <?=$problem['title']?> 管理
</h1> </h1>
<ul class="nav <ul class="nav nav-pills my-3" role="tablist">
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
nav-pills my-3
<?php else: ?>
nav-tabs
<?php endif ?>" role="tablist">
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="/problem/<?= $problem['id'] ?>/manage/statement" role="tab"> <a class="nav-link" href="/problem/<?= $problem['id'] ?>/manage/statement" role="tab">
题面 题面
@ -101,25 +88,12 @@
数据 数据
</a> </a>
</li> </li>
<?php if (!isset($REQUIRE_LIB['bootstrap5'])): ?>
<li class="nav-item">
<a class="nav-link" href="/problem/<?=$problem['id']?>" role="tab">
返回
</a>
</li>
<?php endif ?>
</ul> </ul>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<div class="card card-default"> <div class="card card-default">
<div class="card-body"> <div class="card-body">
<?php endif ?>
<table class="table <table class="table">
<?php if (!isset($REQUIRE_LIB['bootstrap5'])): ?>
table-hover
<?php endif ?>">
<thead> <thead>
<tr> <tr>
<th>#</th> <th>#</th>
@ -146,12 +120,9 @@ table-hover
<?php $update_uploader_form->printHTML(); ?> <?php $update_uploader_form->printHTML(); ?>
<?php endif ?> <?php endif ?>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
</div> </div>
</div> </div>
<?php endif ?>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<!-- end left col --> <!-- end left col -->
</div> </div>
@ -192,8 +163,8 @@ table-hover
<?php uojIncludeView('sidebar', array()) ?> <?php uojIncludeView('sidebar', array()) ?>
</aside> </aside>
<!-- end right col -->
</div> </div>
<?php endif ?>
<?php echoUOJPageFooter() ?> <?php echoUOJPageFooter() ?>

View File

@ -1,5 +1,7 @@
<?php <?php
requireLib('bootstrap5'); requireLib('bootstrap5');
requireLib('hljs');
requireLib('mathjax');
requirePHPLib('form'); requirePHPLib('form');
requirePHPLib('judger'); requirePHPLib('judger');
@ -161,10 +163,6 @@ EOD;
} }
} }
?> ?>
<?php
$REQUIRE_LIB['mathjax'] = '';
$REQUIRE_LIB['hljs'] = '';
?>
<?php echoUOJPageHeader(UOJLocale::get('problems::solutions') . ' - ' . HTML::stripTags($problem['title'])) ?> <?php echoUOJPageHeader(UOJLocale::get('problems::solutions') . ' - ' . HTML::stripTags($problem['title'])) ?>

View File

@ -1,4 +1,6 @@
<?php <?php
requireLib('bootstrap5');
requireLib('calendar_heatmap');
requirePHPLib('form'); requirePHPLib('form');
if (!Auth::check() && UOJConfig::$data['switch']['force-login']) { if (!Auth::check() && UOJConfig::$data['switch']['force-login']) {
@ -8,9 +10,6 @@
if (!isNormalUser($myUser) && UOJConfig::$data['switch']['force-login']) { if (!isNormalUser($myUser) && UOJConfig::$data['switch']['force-login']) {
become403Page(); become403Page();
} }
$REQUIRE_LIB['bootstrap5'] = '';
$REQUIRE_LIB['calendar_heatmap'] = '';
?> ?>
<?php echoUOJPageHeader('关于我') ?> <?php echoUOJPageHeader('关于我') ?>

View File

@ -1,4 +1,7 @@
<?php <?php
requireLib('bootstrap5');
requireLib('mathjax');
requireLib('hljs');
requirePHPLib('form'); requirePHPLib('form');
if (!Auth::check() && UOJConfig::$data['switch']['force-login']) { if (!Auth::check() && UOJConfig::$data['switch']['force-login']) {
@ -9,8 +12,6 @@
become403Page(); become403Page();
} }
$REQUIRE_LIB['bootstrap5'] = '';
$blogs_cond = "poster = '".UOJContext::userid()."'"; $blogs_cond = "poster = '".UOJContext::userid()."'";
if (!UOJContext::hasBlogPermission()) { if (!UOJContext::hasBlogPermission()) {
$blogs_cond .= " and is_hidden = false"; $blogs_cond .= " and is_hidden = false";
@ -34,9 +35,6 @@
)); ));
$all_tags = DB::selectAll("select distinct tag from blogs_tags where blog_id in (select id from blogs where $blogs_cond)"); $all_tags = DB::selectAll("select distinct tag from blogs_tags where blog_id in (select id from blogs where $blogs_cond)");
requireLib('mathjax');
requireLib('hljs');
?> ?>
<?php echoUOJPageHeader('日志') ?> <?php echoUOJPageHeader('日志') ?>

View File

@ -1,4 +1,7 @@
<?php <?php
requireLib('bootstrap5');
requireLib('mathjax');
requireLib('hljs');
requirePHPLib('form'); requirePHPLib('form');
if (!Auth::check() && UOJConfig::$data['switch']['force-login']) { if (!Auth::check() && UOJConfig::$data['switch']['force-login']) {
@ -27,10 +30,6 @@
} }
} }
if (!isset($_COOKIE['bootstrap4'])) {
$REQUIRE_LIB['bootstrap5'] = '';
}
$comment_form = new UOJForm('comment'); $comment_form = new UOJForm('comment');
$comment_form->addVTextArea('comment', '内容', '', $comment_form->addVTextArea('comment', '内容', '',
function($comment) { function($comment) {
@ -161,23 +160,11 @@
'page_len' => 20 'page_len' => 20
)); ));
?> ?>
<?php
$REQUIRE_LIB['mathjax'] = '';
if (isset($REQUIRE_LIB['bootstrap5'])) {
$REQUIRE_LIB['hljs'] = '';
} else {
$REQUIRE_LIB['shjs'] = '';
}
?>
<?php echoUOJPageHeader(HTML::stripTags($blog['title']) . ' - 博客') ?> <?php echoUOJPageHeader(HTML::stripTags($blog['title']) . ' - 博客') ?>
<?php echoBlog($blog, array('show_title_only' => isset($_GET['page']) && $_GET['page'] != 1)) ?> <?php echoBlog($blog, array('show_title_only' => isset($_GET['page']) && $_GET['page'] != 1)) ?>
<h2> <h2>
评论 评论
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<i class="bi bi-chat-fill"></i> <i class="bi bi-chat-fill"></i>
<?php else: ?>
<span class="glyphicon glyphicon-comment"></span>
<?php endif ?>
</h2> </h2>
<div class="list-group"> <div class="list-group">
<?php if ($comments_pag->isEmpty()): ?> <?php if ($comments_pag->isEmpty()): ?>
@ -195,59 +182,26 @@
$replies_json = json_encode($replies); $replies_json = json_encode($replies);
?> ?>
<div id="comment-<?= $comment['id'] ?>" class="list-group-item"> <div id="comment-<?= $comment['id'] ?>" class="list-group-item">
<div class=" <div class="d-flex">
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?> <div class="comtposterbox mr-3 flex-shrink-0">
d-flex <a href="<?= HTML::url('/user/'.$poster['username']) ?>" class="d-none d-sm-block text-decoration-none">
<?php else: ?>
media
<?php endif ?>
">
<div class="comtposterbox mr-3
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
flex-shrink-0
<?php else: ?>
media-left
<?php endif ?>">
<a href="<?= HTML::url('/user/'.$poster['username']) ?>" class="d-none d-sm-block
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
text-decoration-none
<?php endif ?>">
<img class="media-object img-rounded" src="<?= $asrc ?>" alt="avatar" /> <img class="media-object img-rounded" src="<?= $asrc ?>" alt="avatar" />
</a> </a>
</div> </div>
<div id="comment-body-<?= $comment['id'] ?>" class="comtbox <div id="comment-body-<?= $comment['id'] ?>" class="comtbox flex-grow-1 ms-3">
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
flex-grow-1 ms-3
<?php else: ?>
media-body
<?php endif ?>">
<div class="row"> <div class="row">
<div class="col-sm-6"><?= getUserLink($poster['username']) ?></div> <div class="col-sm-6"><?= getUserLink($poster['username']) ?></div>
<div class="col-sm-6 <div class="col-sm-6 text-end"><?= getClickZanBlock('BC', $comment['id'], $comment['zan']) ?></div>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
text-end
<?php else: ?>
text-right
<?php endif ?>"><?= getClickZanBlock('BC', $comment['id'], $comment['zan']) ?></div>
</div> </div>
<div class="comtbox1"><?= $comment['content'] ?></div> <div class="comtbox1"><?= $comment['content'] ?></div>
<ul class="list-inline bot-buffer-no <ul class="list-inline mb-0 text-end">
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
text-end
<?php else: ?>
text-right
<?php endif ?>">
<li> <li>
<small class="text-muted"> <small class="text-muted">
<?= $comment['post_time'] ?> <?= $comment['post_time'] ?>
</small> </small>
</li> </li>
<li> <li>
<a class=" <a class="text-decoration-none" id="reply-to-<?= $comment['id'] ?>" href="#">
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
text-decoration-none
<?php endif ?>"
id="reply-to-<?= $comment['id'] ?>" href="#">
回复 回复
</a> </a>
</li> </li>

View File

@ -1,4 +1,5 @@
<?php <?php
requireLib('bootstrap5');
requirePHPLib('form'); requirePHPLib('form');
if (!Auth::check() && UOJConfig::$data['switch']['force-login']) { if (!Auth::check() && UOJConfig::$data['switch']['force-login']) {
@ -9,8 +10,6 @@
become403Page(); become403Page();
} }
$REQUIRE_LIB['bootstrap5'] = '';
if (!UOJContext::hasBlogPermission()) { if (!UOJContext::hasBlogPermission()) {
become403Page(); become403Page();
} }

View File

@ -1,4 +1,5 @@
<?php <?php
requireLib('bootstrap5');
requirePHPLib('form'); requirePHPLib('form');
if (!Auth::check() && UOJConfig::$data['switch']['force-login']) { if (!Auth::check() && UOJConfig::$data['switch']['force-login']) {
@ -18,8 +19,6 @@
} }
} }
requireLib('bootstrap5');
$blog_editor = new UOJBlogEditor(); $blog_editor = new UOJBlogEditor();
$blog_editor->name = 'blog'; $blog_editor->name = 'blog';
if ($blog) { if ($blog) {

View File

@ -1,4 +1,8 @@
<?php <?php
requireLib('bootstrap5');
requireLib('hljs');
requireLib('mathjax');
if (!Auth::check() && UOJConfig::$data['switch']['force-login']) { if (!Auth::check() && UOJConfig::$data['switch']['force-login']) {
redirectToLogin(); redirectToLogin();
} }
@ -7,10 +11,6 @@
become403Page(); become403Page();
} }
if (!isset($_COOKIE['bootstrap4'])) {
$REQUIRE_LIB['bootstrap5'] = '';
}
$blogs_pag = new Paginator(array( $blogs_pag = new Paginator(array(
'col_names' => array('*'), 'col_names' => array('*'),
'table_name' => 'blogs', 'table_name' => 'blogs',
@ -20,24 +20,11 @@
)); ));
$all_tags = DB::selectAll("select distinct tag from blogs_tags where blog_id in (select id from blogs where $blogs_cond)"); $all_tags = DB::selectAll("select distinct tag from blogs_tags where blog_id in (select id from blogs where $blogs_cond)");
$REQUIRE_LIB['mathjax'] = '';
if (isset($REQUIRE_LIB['bootstrap5'])) {
requireLib('hljs');
} else {
$REQUIRE_LIB['shjs'] = '';
}
?> ?>
<?php echoUOJPageHeader(UOJContext::user()['username'] . '的博客') ?> <?php echoUOJPageHeader(UOJContext::user()['username'] . '的博客') ?>
<div class="row"> <div class="row">
<div class=" <div class="col-lg-9">
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
col-lg-9
<?php else: ?>
col-md-9
<?php endif ?>
">
<?php if ($blogs_pag->isEmpty()): ?> <?php if ($blogs_pag->isEmpty()): ?>
<div class="text-muted">此人很懒,什么博客也没留下。</div> <div class="text-muted">此人很懒,什么博客也没留下。</div>
<?php else: ?> <?php else: ?>
@ -49,39 +36,21 @@
<?= $blogs_pag->pagination(); ?> <?= $blogs_pag->pagination(); ?>
</div> </div>
</div> </div>
<div class=" <div class="col-lg-3">
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
col-lg-3
<?php else: ?>
col-md-3
<?php endif ?>">
<img class="media-object img-thumbnail center-block" alt="<?= UOJContext::user()['username'] ?> Avatar" src="<?= HTML::avatar_addr(UOJContext::user(), 512) ?>" /> <img class="media-object img-thumbnail center-block" alt="<?= UOJContext::user()['username'] ?> Avatar" src="<?= HTML::avatar_addr(UOJContext::user(), 512) ?>" />
<?php if (UOJContext::hasBlogPermission()): ?> <?php if (UOJContext::hasBlogPermission()): ?>
<div class="btn-group d-flex mt-3"> <div class="btn-group d-flex mt-3">
<a href="<?= HTML::blog_url(UOJContext::userid(), '/post/new/write') ?>" class="btn btn-primary"> <a href="<?= HTML::blog_url(UOJContext::userid(), '/post/new/write') ?>" class="btn btn-primary">
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<i class="bi bi-pencil-square"></i> <i class="bi bi-pencil-square"></i>
<?php else: ?>
<span class="glyphicon glyphicon-edit"></span>
<?php endif ?>
写新博客 写新博客
</a> </a>
<a href="<?= HTML::blog_url(UOJContext::userid(), '/slide/new/write') ?>" class="btn btn-primary"> <a href="<?= HTML::blog_url(UOJContext::userid(), '/slide/new/write') ?>" class="btn btn-primary">
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<i class="bi bi-file-earmark-slides"></i> <i class="bi bi-file-earmark-slides"></i>
<?php else: ?>
<span class="glyphicon glyphicon-edit"></span>
<?php endif ?>
写新幻灯片 写新幻灯片
</a> </a>
</div> </div>
<?php endif ?> <?php endif ?>
<div class="card border-info <div class="card border-info mt-3">
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
mt-3
<?php else: ?>
top-buffer-sm
<?php endif ?>">
<div class="card-header bg-info">标签</div> <div class="card-header bg-info">标签</div>
<div class="card-body"> <div class="card-body">
<?php if ($all_tags): ?> <?php if ($all_tags): ?>

View File

@ -7,12 +7,11 @@
become403Page(); become403Page();
} }
requireLib('bootstrap5');
requireLib('mathjax');
requirePHPLib('form'); requirePHPLib('form');
$username = UOJContext::userid(); $username = UOJContext::userid();
$REQUIRE_LIB['bootstrap5'] = '';
$REQUIRE_LIB['mathjax'] = '';
?> ?>
<?php echoUOJPageHeader(UOJLocale::get('contests::contest self reviews')) ?> <?php echoUOJPageHeader(UOJLocale::get('contests::contest self reviews')) ?>

View File

@ -1,5 +1,6 @@
<?php <?php
requirePHPLib('form'); requirePHPLib('form');
requireLib('bootstrap5');
if (!Auth::check() && UOJConfig::$data['switch']['force-login']) { if (!Auth::check() && UOJConfig::$data['switch']['force-login']) {
redirectToLogin(); redirectToLogin();
@ -18,10 +19,6 @@
} }
} }
if (!isset($_COOKIE['bootstrap4'])) {
$REQUIRE_LIB['bootstrap5'] = '';
}
$blog_editor = new UOJBlogEditor(); $blog_editor = new UOJBlogEditor();
$blog_editor->type = 'slide'; $blog_editor->type = 'slide';
$blog_editor->name = 'blog'; $blog_editor->name = 'blog';
@ -78,17 +75,8 @@
$blog_editor->runAtServer(); $blog_editor->runAtServer();
?> ?>
<?php echoUOJPageHeader('写幻灯片') ?> <?php echoUOJPageHeader('写幻灯片') ?>
<div class=" <div class="text-end">
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?> <a class="text-decoration-none" href="http://uoj.ac/blog/75">这玩意儿怎么用?</a>
text-end
<?php else: ?>
text-right
<?php endif ?>">
<a class="
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
text-decoration-none
<?php endif ?>
" href="http://uoj.ac/blog/75">这玩意儿怎么用?</a>
</div> </div>
<?php $blog_editor->printHTML() ?> <?php $blog_editor->printHTML() ?>
<?php echoUOJPageFooter() ?> <?php echoUOJPageFooter() ?>

View File

@ -1,4 +1,6 @@
<?php <?php
requireLib('bootstrap5');
requireLib('hljs');
requirePHPLib('form'); requirePHPLib('form');
requirePHPLib('judger'); requirePHPLib('judger');
@ -10,10 +12,6 @@
become404Page(); become404Page();
} }
if (!isset($_COOKIE['bootstrap4'])) {
$REQUIRE_LIB['bootstrap5'] = '';
}
$submission_result = json_decode($submission['result'], true); $submission_result = json_decode($submission['result'], true);
$problem = queryProblemBrief($submission['problem_id']); $problem = queryProblemBrief($submission['problem_id']);
@ -139,13 +137,6 @@
} }
} }
?> ?>
<?php
if (isset($REQUIRE_LIB['bootstrap5'])) {
$REQUIRE_LIB['hljs'] = '';
} else {
$REQUIRE_LIB['shjs'] = '';
}
?>
<script> <script>
var problem_id = parseInt('<?= $submission['problem_id'] ?>'); var problem_id = parseInt('<?= $submission['problem_id'] ?>');
</script> </script>
@ -182,47 +173,30 @@
<h4 class="card-title"><?= UOJLocale::get('details') ?></h4> <h4 class="card-title"><?= UOJLocale::get('details') ?></h4>
</div> </div>
<?php if (!isset($REQUIRE_LIB['bootstrap5'])): ?> <?php echoJudgementDetails($submission_result['details'], $styler, 'details') ?>
<div class="card-body"> <?php if ($should_show_details_to_me): ?>
<?php endif ?> <?php if (isset($submission_result['final_result'])): ?>
<hr />
<?php echoJudgementDetails($submission_result['details'], $styler, 'details') ?> <?php echoSubmissionDetails($submission_result['final_result']['details'], 'final_details') ?>
<?php if ($should_show_details_to_me): ?> <?php endif ?>
<?php if (isset($submission_result['final_result'])): ?> <?php if ($styler->fade_all_details): ?>
<hr /> <hr />
<?php echoSubmissionDetails($submission_result['final_result']['details'], 'final_details') ?> <?php echoSubmissionDetails($submission_result['details'], 'final_details') ?>
<?php endif ?>
<?php if ($styler->fade_all_details): ?>
<hr />
<?php echoSubmissionDetails($submission_result['details'], 'final_details') ?>
<?php endif ?>
<?php endif ?> <?php endif ?>
<?php if (!isset($REQUIRE_LIB['bootstrap5'])): ?>
</div>
<?php endif ?> <?php endif ?>
</div> </div>
<?php endif ?> <?php endif ?>
<?php if (isset($rejudge_form)): ?> <?php if (isset($rejudge_form)): ?>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?> <div class="text-end">
<div class="text-end">
<?php endif ?>
<?php $rejudge_form->printHTML() ?> <?php $rejudge_form->printHTML() ?>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?> </div>
</div>
<?php endif ?>
<?php endif ?> <?php endif ?>
<?php if (isset($delete_form)): ?> <?php if (isset($delete_form)): ?>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?> <div class="text-end">
<div class="text-end"> <?php $delete_form->printHTML() ?>
<?php endif ?> </div>
<div class="top-buffer-sm">
<?php $delete_form->printHTML() ?>
</div>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
</div>
<?php endif ?>
<?php endif ?> <?php endif ?>
<?php echoUOJPageFooter() ?> <?php echoUOJPageFooter() ?>

View File

@ -103,16 +103,13 @@
<?php <?php
echoSubmissionsList($cond, echoSubmissionsList($cond,
'order by id desc', 'order by id desc',
array( [
'judge_time_hidden' => '', 'judge_time_hidden' => '',
'table_config' => (isset($REQUIRE_LIB['bootstrap5']) 'table_config' => [
? array( 'div_classes' => ['card', 'mb-3', 'table-responsive'],
'div_classes' => array('card', 'mb-3', 'table-responsive'), 'table_classes' => ['table', 'mb-0', 'uoj-table', 'text-center'],
'table_classes' => array('table', 'mb-0', 'uoj-table', 'text-center') ]
) ],
: array()
),
),
$myUser); $myUser);
?> ?>

View File

@ -263,8 +263,7 @@ EOD;
} }
public function addCKEditor($name, $label_text, $default_value, $validator_php, $validator_js) { public function addCKEditor($name, $label_text, $default_value, $validator_php, $validator_js) {
$default_value = htmlspecialchars($default_value); $default_value = htmlspecialchars($default_value);
global $REQUIRE_LIB; $GLOBALS['REQUIRE_LIB']['ckeditor'] = '';
$REQUIRE_LIB['ckeditor'] = '';
$this->is_big = true; $this->is_big = true;
@ -279,8 +278,7 @@ EOD;
} }
public function addBlogEditor(UOJBlogEditor $editor) { public function addBlogEditor(UOJBlogEditor $editor) {
global $REQUIRE_LIB; $GLOBALS['REQUIRE_LIB']['blog-editor'] = '';
$REQUIRE_LIB['blog-editor'] = '';
$this->is_big = true; $this->is_big = true;
@ -325,9 +323,8 @@ EOD
}; };
} }
public function addSlideEditor($name, $label_text, $default_value, $validator_php, $validator_js) { public function addSlideEditor($name, $label_text, $default_value, $validator_php, $validator_js) {
$GLOBALS['REQUIRE_LIB']['slide-editor'] = '';
$default_value = htmlspecialchars($default_value); $default_value = htmlspecialchars($default_value);
global $REQUIRE_LIB;
$REQUIRE_LIB['slide-editor'] = '';
$this->is_big = true; $this->is_big = true;

View File

@ -62,9 +62,7 @@ function becomeMsgPage($msg, $title = '消息') {
if (UOJContext::isAjax()) { if (UOJContext::isAjax()) {
die($msg); die($msg);
} else { } else {
if (!isset($_COOKIE['bootstrap4'])) { $REQUIRE_LIB['bootstrap5'] = '';
$REQUIRE_LIB['bootstrap5'] = '';
}
echoUOJPageHeader($title); echoUOJPageHeader($title);
echo $msg; echo $msg;

View File

@ -1,10 +1,5 @@
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<div class="card card-default table-responsive mb-3"> <div class="card card-default table-responsive mb-3">
<table class="table uoj-table text-center mb-0"> <table class="table uoj-table text-center mb-0">
<?php else: ?>
<div class="table-responsive">
<table class="table table-bordered table-hover table-striped table-text-center">
<?php endif ?>
<thead> <thead>
<tr> <tr>
<th style="width:5em">#</th> <th style="width:5em">#</th>
@ -27,13 +22,8 @@
</div> </div>
<h3><?= UOJLocale::get('contests::contest notice') ?></h3> <h3><?= UOJLocale::get('contests::contest notice') ?></h3>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<div class="card card-default table-responsive mb-3"> <div class="card card-default table-responsive mb-3">
<table class="table uoj-table text-center mb-0"> <table class="table uoj-table text-center mb-0">
<?php else: ?>
<div class="table-responsive">
<table class="table table-bordered table-hover table-vertical-middle table-text-center">
<?php endif ?>
<thead> <thead>
<tr> <tr>
<th style="width:10em"><?= UOJLocale::get('title') ?></th> <th style="width:10em"><?= UOJLocale::get('title') ?></th>

View File

@ -6,7 +6,6 @@ if (!isset($can_reply)) {
} }
?> ?>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<div class="table-responsive mb-3 <div class="table-responsive mb-3
<?php if (!isset($no_bs5_card)): ?> <?php if (!isset($no_bs5_card)): ?>
card card-default card card-default
@ -15,10 +14,6 @@ if (!isset($can_reply)) {
<?php if (!isset($no_bs5_card)): ?> <?php if (!isset($no_bs5_card)): ?>
uoj-table uoj-table
<?php endif ?>"> <?php endif ?>">
<?php else: ?>
<div class="table-responsive">
<table class="table table-bordered table-hover table-vertical-middle table-text-center">
<?php endif ?>
<thead> <thead>
<tr> <tr>
<th style="width:10em">提问者</th> <th style="width:10em">提问者</th>