mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-11-30 18:24:29 +01:00
Split [D+] (delete all posts by IP address) into global and non-global commands
This commit is contained in:
parent
4c6faeb7a2
commit
1e88a003cf
@ -739,6 +739,7 @@
|
||||
$config['mod']['link_bandelete'] = '[B&D]';
|
||||
$config['mod']['link_deletefile'] = '[F]';
|
||||
$config['mod']['link_deletebyip'] = '[D+]';
|
||||
$config['mod']['link_deletebyip_global'] = '[D++]';
|
||||
$config['mod']['link_sticky'] = '[Sticky]';
|
||||
$config['mod']['link_desticky'] = '[-Sticky]';
|
||||
$config['mod']['link_lock'] = '[Lock]';
|
||||
@ -851,6 +852,8 @@
|
||||
$config['mod']['deletefile'] = JANITOR;
|
||||
// Delete all posts by IP
|
||||
$config['mod']['deletebyip'] = MOD;
|
||||
// Delete all posts by IP across all boards
|
||||
$config['mod']['deletebyip_global'] = ADMIN;
|
||||
// Sticky a thread
|
||||
$config['mod']['sticky'] = MOD;
|
||||
// Lock a thread
|
||||
|
@ -275,6 +275,10 @@
|
||||
if(hasPermission($config['mod']['deletebyip'], $board['uri'], $this->mod))
|
||||
$built .= ' ' . confirmLink($config['mod']['link_deletebyip'], 'Delete all posts by IP', 'Are you sure you want to delete all posts by this IP address?', $board['uri'] . '/deletebyip/' . $this->id);
|
||||
|
||||
// Delete all posts by IP (global)
|
||||
if(hasPermission($config['mod']['deletebyip_global'], $board['uri'], $this->mod))
|
||||
$built .= ' ' . confirmLink($config['mod']['link_deletebyip_global'], 'Delete all posts by IP across all boards', 'Are you sure you want to delete all posts by this IP address, across all boards?', $board['uri'] . '/deletebyip/' . $this->id . '/global');
|
||||
|
||||
// Ban
|
||||
if(hasPermission($config['mod']['ban'], $board['uri'], $this->mod))
|
||||
$built .= ' <a title="Ban" href="?/' . $board['uri'] . '/ban/' . $this->id . '">' . $config['mod']['link_ban'] . '</a>';
|
||||
@ -368,6 +372,10 @@
|
||||
if(hasPermission($config['mod']['deletebyip'], $board['uri'], $this->mod))
|
||||
$built .= ' ' . confirmLink($config['mod']['link_deletebyip'], 'Delete all posts by IP', 'Are you sure you want to delete all posts by this IP address?', $board['uri'] . '/deletebyip/' . $this->id);
|
||||
|
||||
// Delete all posts by IP (global)
|
||||
if(hasPermission($config['mod']['deletebyip_global'], $board['uri'], $this->mod))
|
||||
$built .= ' ' . confirmLink($config['mod']['link_deletebyip_global'], 'Delete all posts by IP across all boards', 'Are you sure you want to delete all posts by this IP address, across all boards?', $board['uri'] . '/deletebyip/' . $this->id . '/global');
|
||||
|
||||
// Ban
|
||||
if(hasPermission($config['mod']['ban'], $board['uri'], $this->mod))
|
||||
$built .= ' <a title="Ban" href="?/' . $board['uri'] . '/ban/' . $this->id . '">' . $config['mod']['link_ban'] . '</a>';
|
||||
|
10
mod.php
10
mod.php
@ -2481,11 +2481,13 @@
|
||||
|
||||
// Redirect
|
||||
header('Location: ?/' . sprintf($config['board_path'], $boardName) . $config['file_index'], true, $config['redirect_http']);
|
||||
} elseif(preg_match('/^\/' . $regex['board'] . 'deletebyip\/(\d+)$/', $query, $matches)) {
|
||||
} elseif(preg_match('/^\/' . $regex['board'] . 'deletebyip\/(\d+)(\/global)?$/', $query, $matches)) {
|
||||
// Delete all posts by an IP
|
||||
|
||||
$boardName = &$matches[1];
|
||||
$post = &$matches[2];
|
||||
$global = isset($matches[3]) && $matches[3] == '/global';
|
||||
|
||||
// Open board
|
||||
if(!openBoard($boardName))
|
||||
error($config['error']['noboard']);
|
||||
@ -2499,9 +2501,13 @@
|
||||
|
||||
$ip = $post['ip'];
|
||||
|
||||
if($global)
|
||||
$boards = listBoards();
|
||||
else
|
||||
$boards = Array(Array('uri' => $board['uri']));
|
||||
|
||||
$query = '';
|
||||
foreach($boards as &$_board) {
|
||||
foreach($boards as $_board) {
|
||||
$query .= sprintf("SELECT `id`, '%s' AS `board` FROM `posts_%s` WHERE `ip` = :ip UNION ALL ", $_board['uri'], $_board['uri']);
|
||||
}
|
||||
$query = preg_replace('/UNION ALL $/', '', $query);
|
||||
|
Loading…
Reference in New Issue
Block a user