mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-21 21:08:42 +00:00
fix(blogs): list order
This commit is contained in:
parent
025ec365c4
commit
d91f72491f
@ -3,7 +3,7 @@ requirePHPLib('form');
|
||||
|
||||
Auth::check() || redirectToLogin();
|
||||
|
||||
function echoBlogItem($info) {
|
||||
function echoBlog($info) {
|
||||
$blog = new UOJBlog($info);
|
||||
$poster = UOJUser::query($blog->info['poster']);
|
||||
|
||||
@ -60,7 +60,7 @@ $pag = new Paginator([
|
||||
'table_name' => 'blogs',
|
||||
'col_names' => ['id', 'poster', 'title', 'post_time', 'active_time', 'zan', 'is_hidden'],
|
||||
'cond' => '1',
|
||||
'tail' => 'order by post_time desc',
|
||||
'tail' => 'order by post_time desc, id desc',
|
||||
'post_filter' => function ($info) {
|
||||
return (new UOJBlog($info))->userCanView(Auth::user());
|
||||
},
|
||||
@ -104,7 +104,7 @@ $pag = new Paginator([
|
||||
<?php endif ?>
|
||||
|
||||
<?php foreach ($pag->get() as $idx => $row) : ?>
|
||||
<?php echoBlogItem($row) ?>
|
||||
<?php echoBlog($row) ?>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -983,24 +983,6 @@ function echoHacksList($cond, $tail, $config, $user) {
|
||||
);
|
||||
}
|
||||
|
||||
function echoBlog($blog, $config = array()) {
|
||||
global $REQUIRE_LIB;
|
||||
|
||||
$default_config = array(
|
||||
'blog' => $blog,
|
||||
'show_title_only' => false,
|
||||
'is_preview' => false
|
||||
);
|
||||
foreach ($default_config as $key => $val) {
|
||||
if (!isset($config[$key])) {
|
||||
$config[$key] = $val;
|
||||
}
|
||||
}
|
||||
|
||||
$config['REQUIRE_LIB'] = $REQUIRE_LIB;
|
||||
|
||||
uojIncludeView('blog-preview', $config);
|
||||
}
|
||||
function echoBlogTag($tag) {
|
||||
echo ' <a class="uoj-blog-tag">', '<span class="badge bg-secondary">', HTML::escape($tag), '</span></a> ';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user