mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-11-15 03:17:38 +01:00
Merge pull request #136 from PupperWoff/master
Added function - Ban & Delete all post by IP in one go
This commit is contained in:
commit
c1215b4897
@ -1600,6 +1600,7 @@ $config['nicenotice_reasons'][] = "We care, and we hope you feel better soon. We
|
||||
$config['mod']['link_warningdelete'] = '[W&D]';
|
||||
$config['mod']['link_ban'] = '[B]';
|
||||
$config['mod']['link_bandelete'] = '[B&D]';
|
||||
$config['mod']['link_bandeletebyip'] = '[B&D+]';
|
||||
$config['mod']['link_deletefile'] = '[F]';
|
||||
$config['mod']['link_deletefilepermaban'] = '[FPb]';
|
||||
$config['mod']['link_spoilerimage'] = '[S]';
|
||||
@ -1782,6 +1783,8 @@ $config['nicenotice_reasons'][] = "We care, and we hope you feel better soon. We
|
||||
$config['mod']['ban_all_boards'] = MOD;
|
||||
// Ban and delete (one click; instant)
|
||||
$config['mod']['bandelete'] = MOD;
|
||||
// Ban and delete all by ip on board (one click; instant)
|
||||
$config['mod']['bandeletebyip'] = MOD;
|
||||
// Remove bans
|
||||
$config['mod']['unban'] = JANITOR;
|
||||
// Remove a Ban on all boards even if mod isnt moderator of all boards
|
||||
|
@ -1909,14 +1909,23 @@ function mod_move($originBoard, $postID) {
|
||||
|
||||
function mod_ban_post($board, $delete, $post, $token = false) {
|
||||
global $config, $mod;
|
||||
|
||||
|
||||
if (!openBoard($board))
|
||||
error($config['error']['noboard']);
|
||||
|
||||
if (!hasPermission($config['mod']['delete'], $board))
|
||||
error($config['error']['noaccess']);
|
||||
|
||||
$security_token = make_secure_link_token($board . '/ban/' . $post);
|
||||
|
||||
switch($delete) {
|
||||
case '&deletebyip':
|
||||
if (!hasPermission($config['mod']['deletebyip'], $board))
|
||||
error($config['error']['noaccess']);
|
||||
case '&delete':
|
||||
case '':
|
||||
default:
|
||||
if (!hasPermission($config['mod']['delete'], $board))
|
||||
error($config['error']['noaccess']);
|
||||
break;
|
||||
}
|
||||
|
||||
$security_token = make_secure_link_token($board . '/ban' . $delete . '/' . $post);
|
||||
|
||||
$query = prepare(sprintf('SELECT ' . ($config['ban_show_post'] ? '*' : '`ip`, `cookie`, `thread`') .
|
||||
' FROM ``posts_%s`` WHERE `id` = :id', $board));
|
||||
@ -1956,13 +1965,23 @@ function mod_ban_post($board, $delete, $post, $token = false) {
|
||||
buildThread($thread ? $thread : $post);
|
||||
buildIndex();
|
||||
} elseif (isset($_POST['delete']) && (int) $_POST['delete']) {
|
||||
// Delete post
|
||||
deletePostShadow($post);
|
||||
modLog("Deleted post #{$post}");
|
||||
// Rebuild board
|
||||
buildIndex();
|
||||
// Rebuild themes
|
||||
rebuildThemes('post-delete', $board);
|
||||
|
||||
switch($delete) {
|
||||
case '&delete':
|
||||
// Delete post
|
||||
deletePostShadow($post);
|
||||
modLog("Deleted post #{$post}");
|
||||
// Rebuild board
|
||||
buildIndex();
|
||||
// Rebuild themes
|
||||
rebuildThemes('post-delete', $board);
|
||||
case '&deletebyip':
|
||||
mod_deletebyip($board, $post, false);
|
||||
case '':
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
header('Location: ?/' . sprintf($config['board_path'], $board) . $config['file_index'], true, $config['redirect_http']);
|
||||
@ -1974,6 +1993,7 @@ function mod_ban_post($board, $delete, $post, $token = false) {
|
||||
'uusercookie' => $cookie,
|
||||
'post' => $post,
|
||||
'board' => $board,
|
||||
'delete_str' => "" . $delete,
|
||||
'delete' => (bool)$delete,
|
||||
'boards' => listBoards(),
|
||||
'reasons' => $config['ban_reasons'],
|
||||
|
2
mod.php
2
mod.php
@ -100,7 +100,7 @@ $pages = array(
|
||||
'/(\%b)/shadow_purge/(\d+)' => 'secure_POST shadow_purge', // permanent delete all shadow deleted post that have timed out
|
||||
|
||||
|
||||
'/(\%b)/ban(&delete)?/(\d+)' => 'secure_POST ban_post', // ban poster
|
||||
'/(\%b)/ban(&delete|&deletebyip)?/(\d+)' => 'secure_POST ban_post', // ban poster
|
||||
'/(\%b)/move/(\d+)' => 'secure_POST move', // move thread
|
||||
'/(\%b)/move_reply/(\d+)' => 'secure_POST move_reply', // move reply
|
||||
'/(\%b)/edit(_raw)?/(\d+)' => 'secure_POST edit_post', // edit post
|
||||
|
@ -1,5 +1,5 @@
|
||||
{% if post and board %}
|
||||
{% set action = '?/' ~ board ~ '/ban/' ~ post %}
|
||||
{% set action = '?/' ~ board ~ '/ban' ~ delete_str ~ '/' ~ post %}
|
||||
{% else %}
|
||||
{% set action = '?/ban' %}
|
||||
{% endif %}
|
||||
|
@ -35,6 +35,9 @@
|
||||
{% if mod|hasPermission(config.mod.bandelete, board.uri) %}
|
||||
<a title="{% trans %}Ban & Delete{% endtrans %}" href="?/{{ board.dir }}ban&delete/{{ post.id }}">{{ config.mod.link_bandelete }}</a>
|
||||
{% endif %}
|
||||
{% if mod|hasPermission(config.mod.bandeletebyip, board.uri) %}
|
||||
<a title="{% trans %}Ban & Delete all post by IP{% endtrans %}" href="?/{{ board.dir }}ban&deletebyip/{{ post.id }}">{{ config.mod.link_bandeletebyip }}</a>
|
||||
{% endif %}
|
||||
|
||||
<br/>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user