bibis/view/post_list.php

36 行
1.5 KiB
PHP

<?php
$reply_list_mode = isset($view['reply_list_mode']) && $view['reply_list_mode'];
?>
<?php if (isset($view['post_list'])): ?>
<?php foreach ($view['post_list'] as $i => $post):
$no = $i + 2;
$title = htmlspecialchars($post['title'] ?? '');
$username = htmlspecialchars($post['username']);
$userid = htmlspecialchars($post['userid']);
$time = $post['time']; // safe
$detail_url = htmlspecialchars($post['detail_url']);
$user_url = htmlspecialchars($post['user_url']);
$body = $post['body']; // body is valid html
$is_guest = $post['is_guest'] ?? false;
$thread_id = $post['thread_id'] ?? '';
$thread_title = $post['thread_title'] ?? '';
$thread_url = $post['thread_url'] ?? '';
?>
<dl<?= ($reply_list_mode ? ' id="' . $no . '"' : '') ?>>
<?php if ($title != ''): ?>
<dt><b>件名:<a href="<?= $detail_url ?>"><?= $title ?></a></b></dt>
<?php endif; ?>
<?php if ($is_guest): ?>
<dt><?= $reply_list_mode ? "$no " : '' ?> <b><?= $username ?></b> <a class="post-time" href="<?= $detail_url ?>"><?= $time ?></a></dt>
<?php else: ?>
<dt><?= $reply_list_mode ? "$no " : '' ?> <b><a href="<?= $user_url ?>"><?= $username ?></a></b> @<?= $userid ?> <a class="post-time" href="<?= $detail_url ?>"><?= $time ?></a></dt>
<?php endif; ?>
<?php if ($thread_id >= 0 && !$reply_list_mode): ?>
<dd>RE:<a href="<?= $thread_url ?>"><?= $thread_title ?></a></dd>
<?php endif; ?>
<dd><?= $body ?></dd>
<dd><a href="<?= $detail_url ?>#REPLY_FORM">返信</a></dd>
</dl>
<?php endforeach; ?>
<?php endif; ?>