summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--inc/config.php1
-rw-r--r--inc/display.php8
-rw-r--r--inc/mod/pages.php27
3 files changed, 36 insertions, 0 deletions
diff --git a/inc/config.php b/inc/config.php
index 8ca769bb..ea0300e0 100644
--- a/inc/config.php
+++ b/inc/config.php
@@ -954,6 +954,7 @@
$config['mod']['link_ban'] = '[B]';
$config['mod']['link_bandelete'] = '[B&D]';
$config['mod']['link_deletefile'] = '[F]';
+ $config['mod']['link_spoilerimage'] = '[S]';
$config['mod']['link_deletebyip'] = '[D+]';
$config['mod']['link_deletebyip_global'] = '[D++]';
$config['mod']['link_sticky'] = '[Sticky]';
diff --git a/inc/display.php b/inc/display.php
index 99228fc3..77df971a 100644
--- a/inc/display.php
+++ b/inc/display.php
@@ -345,6 +345,10 @@ class Post {
if (!empty($this->file) && hasPermission($config['mod']['deletefile'], $board['uri'], $this->mod))
$built .= ' ' . secure_link_confirm($config['mod']['link_deletefile'], _('Delete file'), _('Are you sure you want to delete this file?'), $board['dir'] . 'deletefile/' . $this->id);
+ // Spoiler file (keep post)
+ if (!empty($this->file) && $this->file != "deleted" && $this->file != null && $this->thumb != 'spoiler' && hasPermission($config['mod']['spoilerimage'], $board['uri'], $this->mod) && $config['spoiler_images'])
+ $built .= ' ' . secure_link_confirm($config['mod']['link_spoilerimage'], 'Spoiler File', 'Are you sure you want to spoiler this file?', $board['uri'] . '/spoiler/' . $this->id);
+
// Edit post
if (hasPermission($config['mod']['editpost'], $board['uri'], $this->mod))
$built .= ' <a title="'._('Edit post').'" href="?/' . $board['dir'] . 'edit' . ($config['mod']['raw_html_default'] ? '_raw' : '') . '/' . $this->id . '">' . $config['mod']['link_editpost'] . '</a>';
@@ -445,6 +449,10 @@ class Thread {
// Delete file (keep post)
if (!empty($this->file) && $this->file != 'deleted' && hasPermission($config['mod']['deletefile'], $board['uri'], $this->mod))
$built .= ' ' . secure_link_confirm($config['mod']['link_deletefile'], _('Delete file'), _('Are you sure you want to delete this file?'), $board['dir'] . 'deletefile/' . $this->id);
+
+ // Spoiler file (keep post)
+ if (!empty($this->file) && $this->file != "deleted" && $this->file != null && $this->thumb != 'spoiler' && hasPermission($config['mod']['spoilerimage'], $board['uri'], $this->mod) && $config['spoiler_images'])
+ $built .= ' ' . secure_link_confirm($config['mod']['link_spoilerimage'], 'Spoiler File', 'Are you sure you want to spoiler this file?', $board['uri'] . '/spoiler/' . $this->id);
// Sticky
if (hasPermission($config['mod']['sticky'], $board['uri'], $this->mod))
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;