コミットを比較
2 コミット
6ac39bb364
...
81cf65f5aa
作成者 | SHA1 | 日付 |
---|---|---|
たかし | 81cf65f5aa | |
たかし | f799917ed4 |
|
@ -36,7 +36,7 @@
|
|||
# git clone https://gitler.moe/tak4/bibis.git
|
||||
# cd /var/www/bibis
|
||||
# mkdir -m700 data
|
||||
# cp -p config.example.php config.php
|
||||
# cp -p example/config.example.php config.php
|
||||
# vi config.php
|
||||
```
|
||||
必ず、PASSWORD_SOLT をランダムに変更し、どこかにバックアップしてください。
|
||||
|
|
|
@ -62,6 +62,8 @@ define('ENABLE_POST', true);
|
|||
## 投稿時間のごまかしを有効にする。
|
||||
# define('ENABLE_SPOOF_TIME', true);
|
||||
|
||||
# define('ENABLE_FAKE_ERROR', true);
|
||||
|
||||
## 投稿に COOKIE を必須にする。
|
||||
# define('REQUIRE_COOKIE', true);
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
require_once(__DIR__ . '/../../require.php');
|
||||
require_once(__DIR__ . '/../../src/require.php');
|
||||
|
||||
# TODO: thumbnail cache
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
require_once(__DIR__ . '/../require.php');
|
||||
require_once(__DIR__ . '/../src/require.php');
|
||||
|
||||
$page = max(1, (int)($_GET['page'] ?? 1));
|
||||
$result = search_post([
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
require_once(__DIR__ . '/../../require.php');
|
||||
require_once(__DIR__ . '/../../src/require.php');
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
do_get();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
require_once(__DIR__ . '/../../require.php');
|
||||
require_once(__DIR__ . '/../../src/require.php');
|
||||
session_destroy();
|
||||
http_response_code(301);
|
||||
header('Location: ' . sitebase());
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
require_once(__DIR__ . '/../../require.php');
|
||||
require_once(__DIR__ . '/../../src/require.php');
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
do_get();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
require_once(__DIR__ . '/../../require.php');
|
||||
require_once(__DIR__ . '/../../src/require.php');
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
do_get();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
require_once(__DIR__ . '/../../require.php');
|
||||
require_once(__DIR__ . '/../../src/require.php');
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
do_get();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
require_once(__DIR__ . '/../../require.php');
|
||||
require_once(__DIR__ . '/../../src/require.php');
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
do_get();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
require_once(__DIR__ . '/../../require.php');
|
||||
require_once(__DIR__ . '/../../src/require.php');
|
||||
|
||||
$view['threads'] = load_threads();
|
||||
output_html($view, ['header.php', 'thread.php']);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
require_once(__DIR__ . '/../../require.php');
|
||||
require_once(__DIR__ . '/../../src/require.php');
|
||||
|
||||
$user_list = load_users();
|
||||
ksort($user_list, SORT_STRING | SORT_FLAG_CASE);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
require_once(__DIR__ . '/../../require.php');
|
||||
require_once(__DIR__ . '/../../src/require.php');
|
||||
|
||||
$id = '' . ($_GET['id'] ?? '');
|
||||
if ($id !== 'tl' && (!strlen($id) || validate_register_id($id))) { return on_error(400, ['不正なリクエスト。']); }
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// ただし次の項目は必須: PASSWORD_SOLT, and PASSWORD_ITER
|
||||
// TODO: PASSWORD_SOLT->PASSWORD_SALT (PASSWORD_PEPPER?)
|
||||
|
||||
default_config('DATA_ROOT', __DIR__ . '/data/');
|
||||
default_config('DATA_ROOT', __DIR__ . '/../data/');
|
||||
default_config('OPEN_BASEDIR', null);
|
||||
default_config('USERS_TSV', DATA_ROOT . 'users.tsv');
|
||||
default_config('LIMIT_TSV', DATA_ROOT . 'repeating-limit.tsv');
|
||||
|
@ -27,6 +27,7 @@ default_config('ENABLE_ATTACHMENT', false);
|
|||
default_config('ENABLE_IMAGE', false);
|
||||
default_config('ENABLE_THUMBNAIL', true);
|
||||
default_config('ENABLE_SPOOF_TIME', false);
|
||||
default_config('ENABLE_FAKE_ERROR', false);
|
||||
|
||||
default_config('THREAD_SIZE', 100);
|
||||
default_config('POST_LIMIT', 500);
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
require_once(__DIR__ . '/config.php');
|
||||
require_once(__DIR__ . '/../config.php');
|
||||
require_once(__DIR__ . '/config-default.php');
|
||||
require_once(__DIR__ . '/util.php');
|
||||
require_once(__DIR__ . '/common.php');
|
|
@ -21,15 +21,17 @@ function on_error($code, $errors) {
|
|||
if (function_exists('bibis_http_header')) { bibis_http_header(); }
|
||||
|
||||
$view['errors'] = $errors;
|
||||
require(__DIR__ . '/view/header.php');
|
||||
require(__DIR__ . '/../view/header.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
function output_html($view, $_components) {
|
||||
if (ENABLE_FAKE_ERROR) { http_response_code(400); }
|
||||
|
||||
if (function_exists('bibis_http_header')) { bibis_http_header(); }
|
||||
|
||||
foreach ($_components as $_name) {
|
||||
require(__DIR__ . "/view/$_name");
|
||||
require(__DIR__ . "/../view/$_name");
|
||||
}
|
||||
exit;
|
||||
}
|
|
@ -1,60 +1,36 @@
|
|||
<?php
|
||||
// 投稿フォーム
|
||||
$value = '';
|
||||
if (($view['res_num'] ?? 0) >= 2) {
|
||||
$value = '>>' . $view['res_num'] . PHP_EOL;
|
||||
}
|
||||
?>
|
||||
<?php if (ENABLE_POST): ?>
|
||||
<?php if (isset($view['form']['thread_id']) && $view['form']['thread_id'] != ''): ?>
|
||||
<h2 id="REPLY_FORM">返信・Reply</h2>
|
||||
<?php if (isset($view['form']['thread_id']) && $view['form']['thread_id'] >= 0): ?>
|
||||
<h2 id="REPLY_FORM">返信</h2>
|
||||
<?php endif; ?>
|
||||
<?php if (!can_post()): ?>
|
||||
<?php if (!ENABLE_GUEST && !is_logged_in()): ?>
|
||||
<?php if (!post_limited()): ?>
|
||||
<ul>
|
||||
<li>書き込みするにはログインしてください。
|
||||
</ul>
|
||||
<?php elseif (!post_limited()): ?>
|
||||
<ul>
|
||||
<li>書き込み制限中。
|
||||
<li>書き込み制限中。</li>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
<?php elseif ($view['thread_size_over'] ?? false): ?>
|
||||
<ul>
|
||||
<li>スレッドの長さが上限の <?= THREAD_SIZE ?> 件に到達。
|
||||
</ul>
|
||||
<?php elseif ($view['is_future_post'] ?? false): ?>
|
||||
<ul>
|
||||
<li>予約投稿は時間になるまで返信不可。
|
||||
</ul>
|
||||
<?php elseif (REQUIRE_COOKIE && !has_cookie()): ?>
|
||||
<ul>
|
||||
<li>投稿するにはリロードしてください。(要:COOKIE)
|
||||
<li>スレッドの長さが上限の <?= THREAD_SIZE ?> 件に到達。</li>
|
||||
</ul>
|
||||
<?php else: ?>
|
||||
<?php
|
||||
$view['form'] = $view['form'] ?? [];
|
||||
?>
|
||||
<form method="POST" action="<?= sitebase('post/') ?>" enctype="multipart/form-data">
|
||||
<form method="POST" action="/post/">
|
||||
<ul>
|
||||
<li><?= is_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"><?= htmlspecialchars($value) ?></textarea>
|
||||
<?php if (ENABLE_SPOOF_TIME): ?>
|
||||
<li><label><input type="checkbox" name="spooftime" value="1"> <b class="spooftime-text">ランダム予約投稿(3H~27H遅らせる)</b></label></li>
|
||||
<?php endif; ?>
|
||||
<?php if (ENABLE_IMAGE): ?>
|
||||
<li><label for="ATTACHMENT">画像 (gif/jpg/png・上限 500kb 程)</label> <input type="file" id="ATTACHMENT" name="attachment">
|
||||
<?php if (!(isset($view['form']['thread_id']) && $view['form']['thread_id'] >= 0)): ?>
|
||||
<li><label for="TITLE">件名 (省略可)</label> <input type="text" id="TITLE" name="title">
|
||||
<?php endif; ?>
|
||||
<li><label for="BODY">本文 (500文字以内)</label> <textarea id="BODY" name="body" cols="40" rows="5"></textarea>
|
||||
<li class="form-li-submit">
|
||||
<?php if (isset($view['form']['thread_id']) && $view['form']['thread_id'] != ''): ?>
|
||||
<?php if (isset($view['form']['thread_id']) && $view['form']['thread_id'] >= 0): ?>
|
||||
<input type="hidden" name="thread_id" value="<?= htmlspecialchars($view['form']['thread_id'] ?? '') ?>">
|
||||
<button type="submit">返信</button>
|
||||
<?php else: ?>
|
||||
<button type="submit">書き込む</button>
|
||||
<?php endif; ?>
|
||||
<?= output_csrf_token_hidden() ?>
|
||||
<button type="submit">書き込み</button>
|
||||
</ul>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
|
|
@ -1,13 +1,36 @@
|
|||
<?php
|
||||
// 投稿一覧
|
||||
|
||||
require __DIR__ . '/post-common.php';
|
||||
|
||||
if (!($view['post_list'] ?? false)) {
|
||||
echo '<p>まだ書き込みがありません。' . PHP_EOL;
|
||||
exit;
|
||||
}
|
||||
|
||||
foreach ($view['post_list'] ?? [] as $post) {
|
||||
view_post($post, ['link_to_thread' => true]);
|
||||
}
|
||||
$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; ?>
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
<?php
|
||||
// 投稿フォーム
|
||||
?>
|
||||
<?php if (isset($view['form']['thread_id']) && $view['form']['thread_id'] >= 0): ?>
|
||||
<h2 id="REPLY_FORM">返信</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="/post/">
|
||||
<ul>
|
||||
<?php if (!(isset($view['form']['thread_id']) && $view['form']['thread_id'] >= 0)): ?>
|
||||
<li><label for="TITLE">件名 (省略可)</label> <input type="text" id="TITLE" name="title">
|
||||
<?php endif; ?>
|
||||
<li><label for="BODY">本文 (500文字以内)</label> <textarea id="BODY" name="body" cols="40" rows="5"></textarea>
|
||||
<li class="form-li-submit">
|
||||
<?php if (isset($view['form']['thread_id']) && $view['form']['thread_id'] >= 0): ?>
|
||||
<input type="hidden" name="thread_id" value="<?= htmlspecialchars($view['form']['thread_id'] ?? '') ?>">
|
||||
<button type="submit">返信</button>
|
||||
<?php else: ?>
|
||||
<button type="submit">書き込む</button>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
</form>
|
||||
<?php endif; ?>
|
|
@ -1,36 +0,0 @@
|
|||
<?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; ?>
|
読み込み中…
新しいイシューから参照