1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-30 18:24:29 +01:00

Improve spoiler action

Conflicts:
	inc/mod/pages.php
This commit is contained in:
ctrlcctrlv 2013-08-11 13:54:11 +00:00 committed by Michael Foster
parent a12fe86f49
commit 2018fd206b
2 changed files with 15 additions and 2 deletions

View File

@ -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

View File

@ -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);
@ -1381,6 +1389,9 @@ 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();