S2OJ/web/app/controllers/blogs.php

85 lines
1.9 KiB
PHP
Raw Normal View History

2016-07-18 16:39:37 +00:00
<?php
2022-10-22 13:12:13 +00:00
requireLib('bootstrap5');
2016-07-18 16:39:37 +00:00
requirePHPLib('form');
2022-03-17 04:00:03 +00:00
if (!Auth::check() && UOJConfig::$data['switch']['force-login']) {
redirectToLogin();
2022-03-17 04:00:03 +00:00
}
2022-04-03 10:18:17 +00:00
if (!isNormalUser($myUser) && UOJConfig::$data['switch']['force-login']) {
2022-04-03 10:18:17 +00:00
become403Page();
}
2022-09-18 04:58:35 +00:00
?>
2016-07-18 16:39:37 +00:00
<?php echoUOJPageHeader(UOJLocale::get('blogs')) ?>
2022-09-26 12:55:56 +00:00
<div class="row">
2022-10-22 13:12:13 +00:00
<!-- left col -->
2022-09-26 23:57:01 +00:00
<div class="col-lg-9">
2022-09-26 12:55:56 +00:00
2022-10-22 13:12:13 +00:00
<!-- title container -->
<div class="d-flex flex-wrap justify-content-between align-items-center">
2022-09-26 12:55:56 +00:00
<h1 class="h2">
<?= UOJLocale::get("blogs overview") ?>
</h1>
2022-10-22 13:12:13 +00:00
2022-09-26 12:55:56 +00:00
<div class="text-end">
<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">
<i class="bi bi-pencil"></i>
写新博客
</a>
</div>
</div>
</div>
2022-10-22 13:12:13 +00:00
<!-- end title container -->
2022-09-26 12:55:56 +00:00
2022-10-22 13:12:13 +00:00
<?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'],
]
);
?>
2022-09-26 12:55:56 +00:00
</div>
2022-10-22 13:12:13 +00:00
<!-- right col -->
2022-10-19 03:57:06 +00:00
<aside class="col-lg-3 mt-3 mt-lg-0">
2022-10-22 13:12:13 +00:00
<?php uojIncludeView('sidebar') ?>
2022-09-26 12:55:56 +00:00
</aside>
2022-10-22 13:12:13 +00:00
<!-- end right col -->
2022-09-26 12:55:56 +00:00
</div>
2016-07-18 16:39:37 +00:00
<?php echoUOJPageFooter() ?>