1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2025-01-18 09:04:44 +01:00

Huge bug with deleting boards: $tmp_board unused; sometimes it would delete the wrong board's directory

This commit is contained in:
Michael Foster 2013-08-21 21:34:18 +10:00
parent ee19d2b68f
commit 88dccc7f84

View File

@ -379,7 +379,7 @@ function mod_edit_board($boardName) {
$query->bindValue(':uri', $board['uri'], PDO::PARAM_INT); $query->bindValue(':uri', $board['uri'], PDO::PARAM_INT);
$query->execute() or error(db_error($query)); $query->execute() or error(db_error($query));
$query = prepare("SELECT `board`, `post` FROM ``cites`` WHERE `target_board` = :board"); $query = prepare("SELECT `board`, `post` FROM ``cites`` WHERE `target_board` = :board ORDER BY `board`");
$query->bindValue(':board', $board['uri']); $query->bindValue(':board', $board['uri']);
$query->execute() or error(db_error($query)); $query->execute() or error(db_error($query));
while ($cite = $query->fetch(PDO::FETCH_ASSOC)) { while ($cite = $query->fetch(PDO::FETCH_ASSOC)) {
@ -391,6 +391,9 @@ function mod_edit_board($boardName) {
} }
} }
if (isset($tmp_board))
$board = $tmp_board;
$query = prepare('DELETE FROM ``cites`` WHERE `board` = :board OR `target_board` = :board'); $query = prepare('DELETE FROM ``cites`` WHERE `board` = :board OR `target_board` = :board');
$query->bindValue(':board', $board['uri']); $query->bindValue(':board', $board['uri']);
$query->execute() or error(db_error($query)); $query->execute() or error(db_error($query));