From ed045259949aed75db2bc640553c9adfbff35661 Mon Sep 17 00:00:00 2001 From: ctrlcctrlv Date: Thu, 8 Aug 2013 19:41:21 +0000 Subject: Spoil files moderator action --- inc/mod/pages.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'inc/mod/pages.php') diff --git a/inc/mod/pages.php b/inc/mod/pages.php index 10205a11..23b90aba 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -1361,6 +1361,33 @@ function mod_deletefile($board, $post) { header('Location: ?/' . sprintf($config['board_path'], $board) . $config['file_index'], true, $config['redirect_http']); } +function mod_spoiler_image($board, $post) { + global $config, $mod; + + if (!openBoard($board)) + error($config['error']['noboard']); + + if (!hasPermission($config['mod']['spoilerimage'], $board)) + error($config['error']['noaccess']); + + // Delete file + $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); + $query->bindValue(':id', $post, PDO::PARAM_INT); + $query->execute() or error(db_error($query)); + + // Record the action + modLog("Spoilered file from post #{$post}"); + + // Rebuild board + buildIndex(); + + // Redirect + header('Location: ?/' . sprintf($config['board_path'], $board) . $config['file_index'], true, $config['redirect_http']); +} + function mod_deletebyip($boardName, $post, $global = false) { global $config, $mod, $board; -- cgit v1.3