1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-27 17:00:52 +01:00

Multi-board support.

This commit is contained in:
Savetheinternet 2010-11-30 20:40:37 +11:00
parent d80cca13c0
commit 58b25f319c

View File

@ -8,20 +8,6 @@
require 'inc/template.php';
require 'inc/user.php';
// For example, we're on /b/
$board = Array(
'id' => 1,
'uri' => 'b',
'name' => 'Beta',
'title' => 'In development.');
$board['dir'] = sprintf(BOARD_PATH, $board['uri']);
$board['url'] = sprintf(BOARD_ABBREVIATION, $board['uri']);
if(!file_exists($board['dir'])) mkdir($board['dir'], 0777);
if(!file_exists($board['dir'] . DIR_IMG)) mkdir($board['dir'] . DIR_IMG, 0777);
if(!file_exists($board['dir'] . DIR_THUMB)) mkdir($board['dir'] . DIR_THUMB, 0777);
if(!file_exists($board['dir'] . DIR_RES)) mkdir($board['dir'] . DIR_RES, 0777);
$body = '';
// Fix for magic quotes
@ -40,6 +26,7 @@
!isset($_POST['email']) ||
!isset($_POST['subject']) ||
!isset($_POST['body']) ||
!isset($_POST['board']) ||
!isset($_POST['password'])
) error(ERROR_BOT);
@ -59,8 +46,6 @@
if(!isset($_SERVER['HTTP_REFERER']) || !preg_match(URL_MATCH, $_SERVER['HTTP_REFERER'])) error(ERROR_BOT);
}
// TODO: Since we're now using static HTML files, we can't give them cookies on their first page view
// Find another anti-spam method.
@ -95,6 +80,8 @@
'maxsz'=>commaize(MAX_FILESIZE))));
}
if(!openBoard($post['board'])) error(ERROR_NOBOARD);
$trip = generate_tripcode($post['name']);
$post['name'] = $trip[0];
$post['trip'] = (isset($trip[1])?$trip[1]:'');
@ -320,11 +307,31 @@
exit;
} else {
if(!file_exists(FILE_INDEX)) {
buildIndex();
}
if(!file_exists(HAS_INSTALLED)) {
sql_open();
header('Location: ' . ROOT . FILE_INDEX, true, 302);
// Build all boards
$boards_res = mysql_query('SELECT * FROM `boards`', $sql) or error(mysql_error($sql));
while($_board = mysql_fetch_array($boards_res)) {
setupBoard($_board);
buildIndex();
}
sql_close();
touch(HAS_INSTALLED, 0777);
die(Element('page.html', Array(
'index'=>ROOT,
'title'=>'Success',
'body'=>"<center>" .
"<h2>Tinyboard is now installed!</h2>" .
"</center>"
)));
} else {
// They opened post.php in their browser manually.
// Possible TODO: Redirect back to homepage.
error(ERROR_NOPOST);
}
}
?>