|
|
@ -2214,14 +2214,22 @@ function mod_deletebyip($boardName, $post, $global = false) { |
|
|
|
if (!$ip = $query->fetchColumn()) |
|
|
|
error($config['error']['invalidpost']); |
|
|
|
|
|
|
|
// HACK: Prevent D+ or D++ deletion of Tor node or migration placeholder IP |
|
|
|
if ($ip == "127.0.0.1" || $ip == "127.0.0.2") {error("Don't nuke ".$ip);} |
|
|
|
if (in_array($ip, $config['deletebyip_excluded_ips'])) { |
|
|
|
error("The following IP is protected by the deletebyip_excluded_ips configuration ".$ip); |
|
|
|
} |
|
|
|
|
|
|
|
$threadFilter = $config['deletebyip_exclude_threads'] ? "" : "AND `thread` IS NOT NULL"; |
|
|
|
|
|
|
|
$boards = $global ? listBoards() : array(array('uri' => $boardName)); |
|
|
|
|
|
|
|
$query = ''; |
|
|
|
foreach ($boards as $_board) { |
|
|
|
$query .= sprintf("SELECT `thread`, `id`, '%s' AS `board` FROM ``posts_%s`` WHERE `ip` = :ip UNION ALL ", $_board['uri'], $_board['uri']); |
|
|
|
$query .= sprintf( |
|
|
|
"SELECT `thread`, `id`, '%s' AS `board` FROM ``posts_%s`` WHERE `ip` = :ip %s UNION ALL ", |
|
|
|
$_board['uri'], |
|
|
|
$_board['uri'], |
|
|
|
$threadFilter |
|
|
|
); |
|
|
|
} |
|
|
|
$query = preg_replace('/UNION ALL $/', '', $query); |
|
|
|
|
|
|
|