S2OJ/web/app/views/blog-preview.php

84 lines
2.7 KiB
PHP
Raw Normal View History

2016-07-18 16:39:37 +00:00
<?php
if ($is_preview) {
2022-11-06 02:26:21 +00:00
$readmore_pos = strpos($blog->content['content'], '<!-- readmore -->');
2016-07-18 16:39:37 +00:00
if ($readmore_pos !== false) {
2022-11-06 02:26:21 +00:00
$content = substr($blog->content['content'], 0, $readmore_pos).'<p><a href="/blog/'.$blog->info['id'].'">阅读更多……</a></p>';
2016-07-18 16:39:37 +00:00
} else {
2022-11-06 02:26:21 +00:00
$content = $blog->content['content'];
2016-07-18 16:39:37 +00:00
}
} else {
2022-11-06 02:26:21 +00:00
$content = $blog->content['content'];
2016-07-18 16:39:37 +00:00
}
2022-11-06 02:26:21 +00:00
$extra_text = $blog->info['is_hidden'] ? '<span class="text-muted">[已隐藏]</span> ' : '';
2022-09-18 04:58:35 +00:00
?>
2022-09-29 14:02:56 +00:00
2022-11-06 02:26:21 +00:00
<h1>
2022-09-29 14:02:56 +00:00
<?= $extra_text ?>
2022-11-06 02:26:21 +00:00
<a class="header-a text-decoration-none text-body" href="<?= HTML::blog_url($blog->info['poster'], '/post/'.$blog->info['id']) ?>">
<?= $blog->info['title'] ?>
2022-09-29 14:02:56 +00:00
</a>
</h1>
2022-11-06 02:26:21 +00:00
<div><?= $blog->info['post_time'] ?> <strong>By</strong> <?= getUserLink($blog->info['poster']) ?> (<strong>博客 ID: </strong> <?= $blog->info['id'] ?>)</div>
2016-07-18 16:39:37 +00:00
<?php if (!$show_title_only): ?>
<div class="card mb-4">
<div class="card-body">
2022-11-06 02:26:21 +00:00
<?php if ($blog->isTypeB()): ?>
2022-09-29 14:02:56 +00:00
<!-- content -->
<article class="markdown-body">
<?= $content ?>
</article>
<!-- content end -->
2022-11-06 02:26:21 +00:00
<?php elseif ($blog->isTypeS()): ?>
<!-- slide -->
2016-07-18 16:39:37 +00:00
<article>
2022-11-06 02:26:21 +00:00
<div class="ratio ratio-16x9">
<iframe class="embed-responsive-item" src="<?= HTML::blog_url($blog->info['poster'], '/slide/'.$blog->info['id']) ?>"></iframe>
2016-07-18 16:39:37 +00:00
</div>
2022-11-06 02:26:21 +00:00
<div class="text-end mt-2">
<a class="btn btn-secondary btn-md" href="<?= HTML::blog_url($blog->info['poster'], '/slide/'.$blog->info['id']) ?>">
2022-10-01 03:55:31 +00:00
<i class="bi bi-arrows-fullscreen"></i>
全屏
</a>
2016-07-18 16:39:37 +00:00
</div>
</article>
2022-11-06 02:26:21 +00:00
<!-- slide end -->
2016-07-18 16:39:37 +00:00
<?php endif ?>
</div>
2022-11-06 02:26:21 +00:00
<div class="card-footer text-end text-right">
<ul class="list-inline mb-0">
<li class="list-inline-item">
2022-11-06 02:26:21 +00:00
<?php foreach ($blog->tags as $tag): ?>
2016-07-18 16:39:37 +00:00
<?php echoBlogTag($tag) ?>
<?php endforeach ?>
</li>
<?php if ($is_preview): ?>
2022-09-29 14:02:56 +00:00
<li class="list-inline-item">
2022-11-06 02:26:21 +00:00
<a class="text-decoration-none" href="<?= HTML::blog_url($blog->info['poster'], '/post/'.$blog->info['id']) ?>">
2022-09-29 14:02:56 +00:00
阅读全文
</a>
</li>
2016-07-18 16:39:37 +00:00
<?php endif ?>
2022-11-06 02:26:21 +00:00
<?php if (Auth::check() && (isSuperUser(Auth::user()) || Auth::id() == $blog->info['poster'])): ?>
2022-09-29 14:02:56 +00:00
<li class="list-inline-item">
2022-11-06 02:26:21 +00:00
<a class="text-decoration-none" href="<?= HTML::blog_url($blog->info['poster'], '/'.($blog->info['type'] == 'B' ? 'post' : 'slide').'/'.$blog->info['id'].'/write') ?>">
2022-09-29 14:02:56 +00:00
修改
</a>
</li>
<li class="list-inline-item">
2022-11-06 02:26:21 +00:00
<a class="text-decoration-none" href="<?= HTML::blog_url($blog->info['poster'], '/post/'.$blog->info['id'].'/delete') ?>">
2022-09-29 14:02:56 +00:00
删除
</a>
</li>
2016-07-18 16:39:37 +00:00
<?php endif ?>
2022-11-06 02:26:21 +00:00
<li class="list-inline-item"><?= ClickZans::getBlock('B', $blog->info['id'], $blog->info['zan']) ?></li>
2016-07-18 16:39:37 +00:00
</ul>
</div>
</div>
<?php endif ?>