bibis/view/post-form.php

42 行
1.6 KiB
PHP

<?php
// Post form
?>
<?php if (ENABLE_POST): ?>
<?php if (isset($view['form']['thread_id']) && $view['form']['thread_id'] > ''): ?>
<h2 id="REPLY_FORM">返信・Reply</h2>
<?php endif; ?>
<?php if (!can_post()): ?>
<?php if (!post_limited()): ?>
<ul>
<li>書き込み制限中。</li>
</ul>
<?php endif; ?>
<?php elseif ($view['thread_size_over'] ?? false): ?>
<ul>
<li>スレッドの長さが上限の <?= THREAD_SIZE ?> 件に到達。</li>
</ul>
<?php else: ?>
<?php
$view['form'] = $view['form'] ?? [];
?>
<form method="POST" action="<?= sitebase('post/') ?>" enctype="multipart/form-data">
<ul>
<li><?= $view['logged_in'] ? 'ログイン中:<b>' . htmlspecialchars($view['login_user']['username']) . '</b>' : '<b>' . htmlspecialchars(GUESTNAME) . '</b>' ?>
<?php if (!(isset($view['form']['thread_id']) && $view['form']['thread_id'] > '')): ?>
<li><label for="TITLE">件名 (省略可)・Title (Optional)</label> <input type="text" id="TITLE" name="title">
<?php endif; ?>
<li><label for="BODY">本文 (500文字以内)・Text (500)</label> <textarea id="BODY" name="body" cols="40" rows="5"></textarea>
<?php if (ENABLE_IMAGE): ?>
<li><label for="ATTACHMENT">画像 (gif/jpg/png・上限 500kb 程)</label> <input type="file" id="ATTACHMENT" name="attachment">
<?php endif; ?>
<li class="form-li-submit">
<?php if (isset($view['form']['thread_id']) && $view['form']['thread_id'] > ''): ?>
<input type="hidden" name="thread_id" value="<?= htmlspecialchars($view['form']['thread_id'] ?? '') ?>">
<?php endif; ?>
<?= output_csrf_token_hidden() ?>
<button type="submit">書き込み</button>
</ul>
</form>
<?php endif; ?>
<?php endif; ?>