summaryrefslogtreecommitdiff
path: root/inc/mod/pages.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/mod/pages.php')
-rw-r--r--inc/mod/pages.php13
1 files changed, 12 insertions, 1 deletions
diff --git a/inc/mod/pages.php b/inc/mod/pages.php
index b087f6db..f8eb64ab 100644
--- a/inc/mod/pages.php
+++ b/inc/mod/pages.php
@@ -1466,6 +1466,14 @@ function mod_spoiler_image($board, $post) {
error($config['error']['noaccess']);
// Delete file
+ $query = prepare(sprintf("SELECT `thumb`, `thread` FROM ``posts_%s`` WHERE id = :id", $board));
+ $query->bindValue(':id', $post, PDO::PARAM_INT);
+ $query->execute() or error(db_error($query));
+ $result = $query->fetch(PDO::FETCH_ASSOC);
+
+ file_unlink($board . '/' . $config['dir']['thumb'] . $result['thumb']);
+
+ // Make thumbnail spoiler
$query = prepare(sprintf("UPDATE ``posts_%s`` SET `thumb` = :thumb, `thumbwidth` = :thumbwidth, `thumbheight` = :thumbheight WHERE `id` = :id", $board));
$query->bindValue(':thumb', "spoiler");
$query->bindValue(':thumbwidth', 128, PDO::PARAM_INT);
@@ -1475,7 +1483,10 @@ function mod_spoiler_image($board, $post) {
// Record the action
modLog("Spoilered file from post #{$post}");
-
+
+ // Rebuild thread
+ buildThread($result['thread'] ? $result['thread'] : $post);
+
// Rebuild board
buildIndex();