mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-11-26 00:10:55 +01:00
Spoil files moderator action
This commit is contained in:
parent
4fbbec0e5d
commit
1c78a04edd
@ -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]';
|
||||
|
@ -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))
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user