フォルダの構造を変更

このコミットが含まれているのは:
たかし 2024-03-29 15:05:14 +00:00
コミット 81cf65f5aa
24個のファイルの変更63行の追加136行の削除

ファイルの表示

@ -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 をランダムに変更し、どこかにバックアップしてください。

ファイルの表示

@ -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');

ファイルの表示

ファイルの表示

ファイルの表示

@ -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,7 +21,7 @@ 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;
}
@ -31,7 +31,7 @@ function output_html($view, $_components) {
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; ?>