95 行
2.1 KiB
PHP
95 行
2.1 KiB
PHP
<?php
|
|
//直接アクセスしちゃ駄目
|
|
require $d_root.'/hide_php/conf/c.php';
|
|
$bbs_dir = $d_root.'/sqlike/bbs';
|
|
|
|
|
|
|
|
//スレッドリスト並び替え
|
|
//板の枚数を数える
|
|
$fols = scandir($bbs_dir);
|
|
$thread_list = [];
|
|
$number_of_thread = 0;
|
|
foreach ($fols as $b){
|
|
if (preg_match('/^[0-9]+$/', $b) === 1){
|
|
|
|
if ($b < 200){
|
|
$b_data = get($bbs_dir.'/boards.txt', $b);
|
|
} else {
|
|
$b_data = get($bbs_dir.'/user_board/'.$b.'.txt', 1);
|
|
}
|
|
if (($b_data === false) || empty($b_data)){
|
|
continue;
|
|
}
|
|
if (explode("'", $b_data)[3] !== ''){
|
|
continue;
|
|
}
|
|
|
|
$thread_files = scandir($bbs_dir.'/'.$b);
|
|
foreach ($thread_files as $thread_file){
|
|
if (preg_match('/^[0-9]+\.txt$/', $thread_file) === 1){
|
|
$id = str_replace('.txt', '', $thread_file);
|
|
$thread_list[filemtime($bbs_dir.'/'.$b.'/'.$thread_file).'.'.$b.$id] = [$b, $id];
|
|
++$number_of_thread;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//新しい順にする
|
|
krsort($thread_list, SORT_NUMERIC);
|
|
|
|
|
|
|
|
if (isset($_POST['submit'])){
|
|
$cookie = (isset($_COOKIE)?$_COOKIE:[]);
|
|
foreach ($cookie as $c_key => $c_content){
|
|
setcookie($c_key, '', time(), '/');
|
|
}
|
|
//「フォーム再送信の確認」を防止
|
|
header('Location:bbs.php');
|
|
exit;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#############html開始
|
|
html_head('掲示板-', '掲示板のトップページです。', $d_root.'/sqlike/css/home/bbs_home.css', true);
|
|
|
|
$html_file = $d_root.'/sqlike/html/home/bbs_home.html';
|
|
if (!file_exists($html_file)){
|
|
exit;
|
|
}
|
|
$html = explode('{NEW_THREAD}', file_get_contents($html_file));
|
|
|
|
echo str_replace('{NUMBER_OF_THREAD}', $number_of_thread, $html[0]);
|
|
|
|
|
|
$count = 0;
|
|
foreach ($thread_list as $date => $area){
|
|
if ($count > 14){
|
|
continue;
|
|
}
|
|
$thread_file = $bbs_dir.'/'.$area[0].'/'.$area[1].'.txt';
|
|
$thread_title = get($thread_file, 1);
|
|
if ($thread_title !== false){
|
|
if ($area[0] >= 10){
|
|
$areas = $area[0].'-'.$area[1];
|
|
} else {
|
|
$areas = $area[0].$area[1];
|
|
}
|
|
echo '<li><a href="/thread.php?Area='.$areas.'">'.$thread_title.'</a></li>';
|
|
++$count;
|
|
}
|
|
}
|
|
if ($count === 0){
|
|
echo '<li>まだスレッドがありません</li>';
|
|
}
|
|
|
|
|
|
echo $html[1];
|
|
|
|
html_foot('', '');
|
|
|