summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Save <savetheinternet@tinyboard.org>2012-05-28 17:08:09 +1000
committerMichael Save <savetheinternet@tinyboard.org>2012-05-28 17:08:09 +1000
commit97dd6ab391d617698196abd7ad3c360b9edebb6b (patch)
treed2ef797ce16df94ea604d3ebad34c38310d47bc2
parent6775eebcfa36118dc3a2f131d00a84a8ff3c84ba (diff)
Bugfix: deleting OP image didn't rebuild
-rw-r--r--inc/functions.php9
1 files changed, 3 insertions, 6 deletions
diff --git a/inc/functions.php b/inc/functions.php
index ff255614..f175ba05 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -803,12 +803,8 @@ function deleteFile($id, $remove_entirely_if_already=true) {
$query = prepare(sprintf("SELECT `thread`,`thumb`,`file` FROM `posts_%s` WHERE `id` = :id LIMIT 1", $board['uri']));
$query->bindValue(':id', $id, PDO::PARAM_INT);
$query->execute() or error(db_error($query));
-
- if ($query->rowCount() < 1) {
+ if (!$post = $query->fetch())
error($config['error']['invalidpost']);
- }
-
- $post = $query->fetch();
if ($post['file'] == 'deleted' && !$post['thread'])
return; // Can't delete OP's image completely.
@@ -827,13 +823,14 @@ function deleteFile($id, $remove_entirely_if_already=true) {
// Set file to 'deleted'
$query->bindValue(':file', 'deleted', PDO::PARAM_INT);
}
- // Update database
$query->bindValue(':id', $id, PDO::PARAM_INT);
$query->execute() or error(db_error($query));
if ($post['thread'])
buildThread($post['thread']);
+ else
+ buildThread($id);
}
// rebuild post (markup)