S2OJ/web/app/controllers/subdomain/blog/index.php

42 lines
1.1 KiB
PHP
Raw Normal View History

2016-07-18 16:39:37 +00:00
<?php
2022-03-17 04:00:03 +00:00
if (!Auth::check()) {
2022-04-02 10:01:26 +00:00
become403Page(UOJLocale::get('need login'));
2022-03-17 04:00:03 +00:00
}
2016-07-18 16:39:37 +00:00
$blogs_pag = new Paginator(array(
'col_names' => array('*'),
'table_name' => 'blogs',
2022-09-29 14:06:36 +00:00
'cond' => "poster = '".UOJContext::userid()."' and is_hidden = 0",
2016-07-18 16:39:37 +00:00
'tail' => 'order by post_time desc limit 5',
'echo_full' => true
));
2022-09-29 14:06:36 +00:00
if (!isset($_COOKIE['bootstrap4'])) {
$REQUIRE_LIB['bootstrap5'] = '';
}
2016-07-18 16:39:37 +00:00
$REQUIRE_LIB['mathjax'] = '';
2022-09-29 14:06:36 +00:00
if (isset($REQUIRE_LIB['bootstrap5'])) {
$REQUIRE_LIB['hljs'] = '';
} else {
$REQUIRE_LIB['shjs'] = '';
}
2022-09-18 04:58:35 +00:00
?>
2016-07-18 16:39:37 +00:00
<?php echoUOJPageHeader(UOJContext::user()['username'] . '的博客') ?>
<div class="row">
<div class="col-md-9">
<?php if ($blogs_pag->isEmpty()): ?>
<div class="text-muted">此人很懒,什么博客也没留下。</div>
<?php else: ?>
<?php foreach ($blogs_pag->get() as $blog): ?>
<?php echoBlog($blog, array('is_preview' => true)) ?>
<?php endforeach ?>
<?php endif ?>
</div>
<div class="col-md-3">
<img class="media-object img-thumbnail center-block" alt="<?= UOJContext::user()['username'] ?> Avatar" src="<?= HTML::avatar_addr(UOJContext::user(), 256) ?>" />
</div>
</div>
<?php echoUOJPageFooter() ?>