This commit is contained in:
Savetheinternet 2011-02-22 17:43:42 +11:00
parent a1f300cc8f
commit 3defed1c0b

123
mod.php
View File

@ -221,57 +221,59 @@
$query->execute() or error(db_error($query)); $query->execute() or error(db_error($query));
header('Location: ?/', true, $config['redirect_http']); header('Location: ?/', true, $config['redirect_http']);
} elseif(isset($_POST['title']) && isset($_POST['subtitle'])) { } else {
$query = prepare("UPDATE `boards` SET `title` = :title, `subtitle` = :subtitle WHERE `id` = :id"); if(isset($_POST['title']) && isset($_POST['subtitle'])) {
$query->bindValue(':title', utf8tohtml($_POST['title'], true)); $query = prepare("UPDATE `boards` SET `title` = :title, `subtitle` = :subtitle WHERE `id` = :id");
$query->bindValue(':title', utf8tohtml($_POST['title'], true));
if(!empty($_POST['subtitle'])) if(!empty($_POST['subtitle']))
$query->bindValue(':subtitle', utf8tohtml($_POST['subtitle'], true)); $query->bindValue(':subtitle', utf8tohtml($_POST['subtitle'], true));
else else
$query->bindValue(':subtitle', null, PDO::PARAM_NULL); $query->bindValue(':subtitle', null, PDO::PARAM_NULL);
$query->bindValue(':id', $board['id'], PDO::PARAM_INT); $query->bindValue(':id', $board['id'], PDO::PARAM_INT);
$query->execute() or error(db_error($query)); $query->execute() or error(db_error($query));
openBoard($board['uri']); openBoard($board['uri']);
}
$body =
'<fieldset><legend><a href="?/' .
$board['uri'] . '/' . $config['file_index'] . '">' .
sprintf($config['board_abbreviation'], $board['uri']) . '</a>' .
' - ' . $board['name'] . '</legend>' .
// Begin form
'<form style="text-align:center" action="" method="post">' .
'<table>' .
'<tr><th>URI</th><td>' . $board['uri'] . '</td>' .
'<tr><th>Title</th><td><input size="20" maxlength="20" type="text" name="title" value="' . $board['name'] . '" /></td></tr>' .
'<tr><th>Subtitle</th><td><input size="20" maxlength="40" type="text" name="subtitle" value="' .
(isset($board['title']) ? $board['title'] : '') . '" /></td></tr>' .
'</table>' .
'<input type="submit" value="Update" />' .
// End form
'</form> ' .
// Delete button
($mod['type'] >= $config['mod']['deleteboard'] ?
'<p style="text-align:center"><a href="?/board/' . $board['uri'] . '/delete">Delete board</a></p>'
:'') .
'</fieldset>';
echo Element('page.html', Array(
'index'=>$config['root'],
'title'=>'Manage ' . sprintf($config['board_abbreviation'], $board['uri']),
'body'=>$body,
'mod'=>true
));
} }
$body =
'<fieldset><legend><a href="?/' .
$board['uri'] . '/' . $config['file_index'] . '">' .
sprintf($config['board_abbreviation'], $board['uri']) . '</a>' .
' - ' . $board['name'] . '</legend>' .
// Begin form
'<form style="text-align:center" action="" method="post">' .
'<table>' .
'<tr><th>URI</th><td>' . $board['uri'] . '</td>' .
'<tr><th>Title</th><td><input size="20" maxlength="20" type="text" name="title" value="' . $board['name'] . '" /></td></tr>' .
'<tr><th>Subtitle</th><td><input size="20" maxlength="40" type="text" name="subtitle" value="' .
(isset($board['title']) ? $board['title'] : '') . '" /></td></tr>' .
'</table>' .
'<input type="submit" value="Update" />' .
// End form
'</form> ' .
// Delete button
($mod['type'] >= $config['mod']['deleteboard'] ?
'<p style="text-align:center"><a href="?/board/' . $board['uri'] . '/delete">Delete board</a></p>'
:'') .
'</fieldset>';
echo Element('page.html', Array(
'index'=>$config['root'],
'title'=>'Manage ' . sprintf($config['board_abbreviation'], $board['uri']),
'body'=>$body,
'mod'=>true
));
} elseif(preg_match('/^\/bans$/', $query)) { } elseif(preg_match('/^\/bans$/', $query)) {
if($mod['type'] < $config['mod']['view_banlist']) error($config['error']['noaccess']); if($mod['type'] < $config['mod']['view_banlist']) error($config['error']['noaccess']);
@ -493,19 +495,22 @@
// Build the board // Build the board
buildIndex(); buildIndex();
header('Location: ?/board/' . $board['uri'], true, $config['redirect_http']);
} else {
$body .= form_newBoard();
// TODO: Statistics, etc, in the dashboard.
echo Element('page.html', Array(
'index'=>$config['root'],
'title'=>'New board',
'body'=>$body,
'mod'=>true
)
);
} }
$body .= form_newBoard();
// TODO: Statistics, etc, in the dashboard.
echo Element('page.html', Array(
'index'=>$config['root'],
'title'=>'New board',
'body'=>$body,
'mod'=>true
)
);
} elseif(preg_match('/^\/' . $regex['board'] . '(' . $regex['index'] . '|' . $regex['page'] . ')?$/', $query, $matches)) { } elseif(preg_match('/^\/' . $regex['board'] . '(' . $regex['index'] . '|' . $regex['page'] . ')?$/', $query, $matches)) {
// Board index // Board index