| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <?php
- if ($is_preview) {
- $readmore_pos = strpos($blog['content'], '<!-- readmore -->');
- if ($readmore_pos !== false) {
- $content = substr($blog['content'], 0, $readmore_pos).'<p><a href="'.HTML::blog_url(UOJContext::userid(), '/post/'.$blog['id']).'">阅读更多……</a></p>';
- } else {
- $content = $blog['content'];
- }
- $blog_href = HTML::blog_url(UOJContext::userid(), '/post/'.$blog['id']);
- } else {
- $content = $blog['content'];
- $blog_href = null;
- }
-
- $extra_text = $blog['is_hidden'] ? '<span class="text-muted">[已隐藏]</span> ' : '';
-
- $blog_type = $blog['type'] == 'B' ? 'post' : 'slide';
- $poster = queryUser($blog['poster']);
- $avatar_addr = HTML::avatar_addr($poster, 100);
- $profile_href = HTML::url('/user/profile/'.$blog['poster']);
- ?>
- <div class="blog-item">
- <?php // Paginated post view (?page=N): the title stands alone, there is no body to merge it into. ?>
- <?php if (!$is_preview && !$show_content_only && $show_title_only): ?>
- <div class="card mb-4 shadow">
- <div class="card-body">
- <h3 class="blog-title wyoj-blog-detail-title mb-3"><?= $blog['title'] ?></h3>
- <div class="wyoj-blog-meta d-flex align-items-center flex-wrap">
- <a href="<?= $profile_href ?>" class="d-inline-flex align-items-center mr-2">
- <img class="wyoj-blog-meta-avatar rounded-circle" src="<?= $avatar_addr ?>" alt="avatar" />
- </a>
- <?= getUserLink($blog['poster']) ?>
- <span class="text-muted ml-3"><?= $blog['post_time'] ?></span>
- </div>
- </div>
- </div>
- <?php endif ?>
- <?php if (!$show_title_only): ?>
- <div class="card shadow mb-4">
- <div class="card-body blog-content">
- <?php // The title and meta live inside the body card on every page, so a
- // post renders as one card instead of a title card stacked on a
- // content card. Only the size differs: list vs. detail. ?>
- <?php if (!$show_content_only): ?>
- <h3 class="blog-title <?= $is_preview ? 'wyoj-blog-list-title' : 'wyoj-blog-detail-title' ?> mb-2"><?php if ($is_preview): ?><a href="<?= $blog_href ?>"><?= $blog['title'] ?></a><?php else: ?><?= $blog['title'] ?><?php endif ?></h3>
- <div class="wyoj-blog-meta d-flex align-items-center flex-wrap mb-3">
- <a href="<?= $profile_href ?>" class="d-inline-flex align-items-center mr-2">
- <img class="wyoj-blog-meta-avatar rounded-circle" src="<?= $avatar_addr ?>" alt="avatar" />
- </a>
- <?= getUserLink($blog['poster']) ?>
- <span class="text-muted ml-3"><?= $blog['post_time'] ?></span>
- <?php if ($is_preview): ?>
- <span class="ml-auto"><?= getClickZanBlock('B', $blog['id'], $blog['zan']) ?></span>
- <?php endif ?>
- </div>
- <?php endif ?>
- <?php if ($blog_type == 'post'): ?>
- <article class="blog-content-orig"><?= $content ?></article>
- <article class="blog-content-summary"></article>
- <?php elseif ($blog_type == 'slide'): ?>
- <article>
- <div class="embed-responsive embed-responsive-16by9">
- <iframe class="embed-responsive-item" src="<?= HTML::blog_url(UOJContext::userid(), '/slide/'.$blog['id']) ?>"></iframe>
- </div>
- <div class="text-right top-buffer-sm">
- <a class="btn btn-secondary btn-md" href="<?= HTML::blog_url(UOJContext::userid(), '/slide/'.$blog['id']) ?>"><span class="glyphicon glyphicon-fullscreen"></span> 全屏</a>
- </div>
- </article>
- <?php endif ?>
- </div>
- <div class="card-footer text-right blog-footer">
- <ul class="list-inline bot-buffer-no">
- <li class="list-inline-item">
- <?php foreach (queryBlogTags($blog['id']) as $tag): ?>
- <?php echoBlogTag($tag) ?>
- <?php endforeach ?>
- </li>
- <?php if ($is_preview): ?>
- <li class="list-inline-item"><a href="<?= HTML::blog_url(UOJContext::userid(), '/post/'.$blog['id']) ?>">阅读全文</a></li>
- <?php endif ?>
- <?php if (!$outside_blog_domain && Auth::check() && (isSuperUser(Auth::user()) || Auth::id() == $blog['poster'])): ?>
- <li class="list-inline-item"><a href="<?=HTML::blog_url(UOJContext::userid(), '/'.$blog_type.'/'.$blog['id'].'/write')?>">修改</a></li>
- <li class="list-inline-item"><a href="<?=HTML::blog_url(UOJContext::userid(), '/post/'.$blog['id'].'/delete')?>">删除</a></li>
- <?php endif ?>
- <?php if (!$is_preview): ?>
- <li class="list-inline-item"><?= getClickZanBlock('B', $blog['id'], $blog['zan']) ?></li>
- <?php endif ?>
- </ul>
- </div>
- </div></div>
- <?php endif ?>
|