diff options
| author | ctrlcctrlv <wizardchan@hush.com> | 2013-08-11 13:54:11 +0000 |
|---|---|---|
| committer | Michael Foster <savetheinternet@tinyboard.org> | 2013-08-12 12:57:54 +1000 |
| commit | 2018fd206bfcd69789c2f2ff7c034f7287cc3226 (patch) | |
| tree | 4b5bdb72329055bab7fe7f376cdd3e25ee6c6708 /inc | |
| parent | a12fe86f490d3963f0264607146b070d1cee842c (diff) | |
Improve spoiler action
Conflicts:
inc/mod/pages.php
Diffstat (limited to 'inc')
| -rw-r--r-- | inc/config.php | 2 | ||||
| -rw-r--r-- | inc/mod/pages.php | 15 |
2 files changed, 15 insertions, 2 deletions
diff --git a/inc/config.php b/inc/config.php index ea0300e0..7bde3d6a 100644 --- a/inc/config.php +++ b/inc/config.php @@ -1093,6 +1093,8 @@ $config['mod']['bandelete'] = MOD; // Remove bans $config['mod']['unban'] = MOD; + // Spoiler file (and keep post) + $config['mod']['deletefile'] = JANITOR; // Delete file (and keep post) $config['mod']['deletefile'] = JANITOR; // Delete all posts by IP diff --git a/inc/mod/pages.php b/inc/mod/pages.php index 23b90aba..932b2ed6 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -1371,7 +1371,15 @@ function mod_spoiler_image($board, $post) { error($config['error']['noaccess']); // Delete file - $query = prepare(sprintf("UPDATE `posts_%s` SET `thumb` = :thumb, `thumbwidth` = :thumbwidth, `thumbheight` = :thumbheight WHERE `id` = :id", $board)); + $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); $query->bindValue(':thumbheight', 128, PDO::PARAM_INT); @@ -1380,7 +1388,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(); |
