diff --git a/mod.php b/mod.php index d438cd9d..340b6d80 100644 --- a/mod.php +++ b/mod.php @@ -221,57 +221,59 @@ $query->execute() or error(db_error($query)); header('Location: ?/', true, $config['redirect_http']); - } elseif(isset($_POST['title']) && isset($_POST['subtitle'])) { - $query = prepare("UPDATE `boards` SET `title` = :title, `subtitle` = :subtitle WHERE `id` = :id"); - $query->bindValue(':title', utf8tohtml($_POST['title'], true)); + } else { + if(isset($_POST['title']) && isset($_POST['subtitle'])) { + $query = prepare("UPDATE `boards` SET `title` = :title, `subtitle` = :subtitle WHERE `id` = :id"); + $query->bindValue(':title', utf8tohtml($_POST['title'], true)); + + if(!empty($_POST['subtitle'])) + $query->bindValue(':subtitle', utf8tohtml($_POST['subtitle'], true)); + else + $query->bindValue(':subtitle', null, PDO::PARAM_NULL); + + $query->bindValue(':id', $board['id'], PDO::PARAM_INT); + $query->execute() or error(db_error($query)); + + openBoard($board['uri']); + } - if(!empty($_POST['subtitle'])) - $query->bindValue(':subtitle', utf8tohtml($_POST['subtitle'], true)); - else - $query->bindValue(':subtitle', null, PDO::PARAM_NULL); + $body = + '
' . + sprintf($config['board_abbreviation'], $board['uri']) . '' . + ' - ' . $board['name'] . '' . - $query->bindValue(':id', $board['id'], PDO::PARAM_INT); - $query->execute() or error(db_error($query)); + // Begin form + '
' . - openBoard($board['uri']); + '' . + + '' . + '' . + '' . + + '
URI' . $board['uri'] . '
Title
Subtitle
' . + + '' . + + // End form + '
' . + + // Delete button + ($mod['type'] >= $config['mod']['deleteboard'] ? + '

Delete board

' + :'') . + + '
'; + + echo Element('page.html', Array( + 'index'=>$config['root'], + 'title'=>'Manage – ' . sprintf($config['board_abbreviation'], $board['uri']), + 'body'=>$body, + 'mod'=>true + )); } - - $body = - '
' . - sprintf($config['board_abbreviation'], $board['uri']) . '' . - ' - ' . $board['name'] . '' . - - // Begin form - '
' . - - '' . - - '' . - '' . - '' . - - '
URI' . $board['uri'] . '
Title
Subtitle
' . - - '' . - - // End form - '
' . - - // Delete button - ($mod['type'] >= $config['mod']['deleteboard'] ? - '

Delete board

' - :'') . - - '
'; - - 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)) { if($mod['type'] < $config['mod']['view_banlist']) error($config['error']['noaccess']); @@ -493,19 +495,22 @@ // Build the board 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)) { // Board index