Browse Source

Added Function - Mod can shadow delete if they are unsure

main
Arvo Huru 7 years ago
committed by discomrade
parent
commit
ce750b8a20
  1. 1
      inc/config.php
  2. 4
      inc/functions.php
  3. 4
      inc/mod/pages.php
  4. 2
      mod.php
  5. 3
      templates/post/post_controls.html

1
inc/config.php

@ -1481,6 +1481,7 @@
// Mod links (full HTML).
$config['mod']['link_delete'] = '[D]';
$config['mod']['link_shadow_delete'] = '[ShD]';
$config['mod']['link_warning'] = '[W]';
$config['mod']['link_warningdelete'] = '[W&D]';
$config['mod']['link_ban'] = '[B]';

4
inc/functions.php

@ -1458,11 +1458,11 @@ function rebuildPost($id) {
// Delete a post (reply or thread)
function deletePostShadow($id, $error_if_doesnt_exist=true, $rebuild_after=true) {
function deletePostShadow($id, $error_if_doesnt_exist=true, $rebuild_after=true, $force_shadow_delete = false) {
global $board, $config;
// If we are using non permanent delete run that function
if($config['shadow_del']['use'] && ($config['mod']['auto_delete_shadow_post'] === false || !hasPermission($config['mod']['auto_delete_shadow_post'])))
if($force_shadow_delete || ($config['shadow_del']['use'] && ($config['mod']['auto_delete_shadow_post'] === false || !hasPermission($config['mod']['auto_delete_shadow_post']))))
return ShadowDelete::deletePost($id, $error_if_doesnt_exist, $rebuild_after);
else
return deletePostPermanent($id, $error_if_doesnt_exist, $rebuild_after);

4
inc/mod/pages.php

@ -2330,7 +2330,7 @@ function mod_shadow_purge() {
function mod_delete($board, $post) {
function mod_delete($board, $force_shadow_delete, $post) {
global $config, $mod;
if (!openBoard($board))
@ -2382,7 +2382,7 @@ function mod_delete($board, $post) {
}
}
// Delete post (get thread id)
$thread_id = deletePostShadow($post);
$thread_id = deletePostShadow($post, true, true, $force_shadow_delete);
// Record the action
modLog("Deleted post #{$post}");
// Rebuild board

2
mod.php

@ -92,7 +92,7 @@ $pages = array(
'/(\%b)/move_reply/(\d+)' => 'secure_POST move_reply', // move reply
'/(\%b)/merge/(\d+)' => 'secure_POST merge', // merge thread
'/(\%b)/edit(_raw)?/(\d+)' => 'secure_POST edit_post', // edit post
'/(\%b)/delete/(\d+)' => 'secure delete', // delete post
'/(\%b)/delete(_shadow)?/(\d+)' => 'secure delete', // delete post
'/(\%b)/deletefile/(\d+)/(\d+)' => 'secure deletefile', // delete file from post
'/(\%b)/deletefilepermaban/(\d+)/(\d+)' => 'secure deletefilepermaban', // delete file from post and permaban it
'/(\%b+)/spoiler/(\d+)/(\d+)' => 'secure spoiler_image', // spoiler file

3
templates/post/post_controls.html

@ -4,6 +4,9 @@
{% if not post.shadow %}
{% if mod|hasPermission(config.mod.delete, board.uri) %}
{{ secure_link_confirm(config.mod.link_delete, 'Delete'|trans, 'Are you sure you want to delete this?'|trans, board.dir ~ 'delete/' ~ post.id) }} 
{% if mod|hasPermission(config.mod.auto_delete_shadow_post, board.uri) %}
{{ secure_link_confirm(config.mod.link_shadow_delete, 'Shadow Delete'|trans, 'Are you sure you want to shadow delete this?'|trans, board.dir ~ 'delete_shadow/' ~ post.id) }} 
{% endif %}
{% endif %}
{% if mod|hasPermission(config.mod.deletebyip, board.uri) %}
{{ secure_link_confirm(config.mod.link_deletebyip, 'Delete all posts by IP'|trans, 'Are you sure you want to delete all posts by this IP address?'|trans, board.dir ~ 'deletebyip/' ~ post.id) }} 

Loading…
Cancel
Save