2016-07-18 16:39:37 +00:00
< ? php
requirePHPLib ( 'form' );
2022-03-17 04:00:03 +00:00
2022-10-07 09:29:26 +00:00
if ( ! Auth :: check () && UOJConfig :: $data [ 'switch' ][ 'force-login' ]) {
2022-10-06 12:28:43 +00:00
redirectToLogin ();
2022-03-17 04:00:03 +00:00
}
2022-04-03 10:18:17 +00:00
2022-10-07 09:29:26 +00:00
if ( ! isNormalUser ( $myUser ) && UOJConfig :: $data [ 'switch' ][ 'force-login' ]) {
2022-04-03 10:18:17 +00:00
become403Page ();
}
2022-09-26 12:55:56 +00:00
if ( ! isset ( $_COOKIE [ 'bootstrap4' ])) {
$REQUIRE_LIB [ 'bootstrap5' ] = '' ;
}
2016-07-18 16:39:37 +00:00
function echoBlogCell ( $blog ) {
2022-09-26 12:55:56 +00:00
global $REQUIRE_LIB ;
2016-07-18 16:39:37 +00:00
echo '<tr>' ;
2022-03-17 03:30:38 +00:00
if ( $blog [ 'is_hidden' ]) {
2022-09-26 12:55:56 +00:00
echo '<td><span class="text-danger">[已隐藏]</span> ' . getBlogLink ( $blog [ 'id' ]) . '</td>' ;
2022-03-17 03:30:38 +00:00
} else {
echo '<td>' . getBlogLink ( $blog [ 'id' ]) . '</td>' ;
}
2016-07-18 16:39:37 +00:00
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' );
2022-09-26 12:55:56 +00:00
2022-09-26 13:11:58 +00:00
if ( isset ( $REQUIRE_LIB [ 'bootstrap5' ])) {
$config [ 'div_classes' ] = array ( 'card' , 'my-3' );
$config [ 'table_classes' ] = array ( 'table' , 'uoj-table' , 'mb-0' );
}
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
< ? php if ( isset ( $REQUIRE_LIB [ 'bootstrap5' ])) : ?>
< div class = " row " >
2022-09-26 23:57:01 +00:00
< div class = " col-lg-9 " >
2022-09-26 12:55:56 +00:00
< div class = " d-flex flex-wrap justify-content-between " >
< ? php endif ?>
< ? php if ( ! isset ( $REQUIRE_LIB [ 'bootstrap5' ])) : ?>
2016-07-18 16:39:37 +00:00
< ? php if ( Auth :: check ()) : ?>
2019-09-10 02:15:20 +00:00
< div class = " float-right " >
2017-11-25 04:00:00 +00:00
< div class = " btn-group " >
2019-09-10 02:15:20 +00:00
< a href = " <?= HTML::blog_url(Auth::id(), '/') ?> " class = " btn btn-secondary btn-sm " > 我的博客首页 </ a >
style(web): change link location of blog functions
When using sub-directory blog, the 'blogof' not looks so good.
And, there are duplicate 'blog' characters, which making people uncomfortable.
So, for sub-directory blog, use 'blog' instead of 'blogof'.
'blog' is not as a sub folder or type anymore, use 'post' instead.
BREAKING CHANGE: Due to the conflict of 'blog' sub-directory, when go to blog post,
now should use 'blogs/{id}'; but when subdomain mode is on, you can still use 'blog'
to access these blog posts. 'blogof' is no longer used, and you need to inform users
that blog link is changed, to avoid the inaccessbility.
2019-07-12 04:13:30 +00:00
< a href = " <?= HTML::blog_url(Auth::id(), '/post/new/write')?> " class = " btn btn-primary btn-sm " >< span class = " glyphicon glyphicon-edit " ></ span > 写新博客 </ a >
2017-11-25 04:00:00 +00:00
</ div >
2016-07-18 16:39:37 +00:00
</ div >
< ? php endif ?>
2022-09-26 12:55:56 +00:00
< ? php endif ?>
< ? php if ( isset ( $REQUIRE_LIB [ 'bootstrap5' ])) : ?>
< h1 class = " h2 " >
< ? = UOJLocale :: get ( " blogs overview " ) ?>
</ h1 >
< 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 >
< ? php else : ?>
2016-07-18 16:39:37 +00:00
< h3 > 博客总览 </ h3 >
2022-09-26 12:55:56 +00:00
< ? php endif ?>
< ? php if ( isset ( $REQUIRE_LIB [ 'bootstrap5' ])) : ?>
</ div >
< ? php endif ?>
2022-04-14 07:34:16 +00:00
< ? 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 ); ?>
2022-09-26 12:55:56 +00:00
< ? php if ( isset ( $REQUIRE_LIB [ 'bootstrap5' ])) : ?>
</ div >
2022-09-26 23:57:01 +00:00
< aside class = " col mt-3 mt-lg-0 " >
2022-09-26 12:55:56 +00:00
< ? php uojIncludeView ( 'sidebar' , array ()) ?>
</ aside >
</ div >
< ? php endif ?>
2016-07-18 16:39:37 +00:00
< ? php echoUOJPageFooter () ?>