summaryrefslogtreecommitdiff
path: root/mod.php
diff options
context:
space:
mode:
authorMichael Save <savetheinternet@tinyboard.org>2012-03-25 16:12:42 +1100
committerMichael Save <savetheinternet@tinyboard.org>2012-03-25 16:12:42 +1100
commit1e88a003cfd5e433a7bbbb4fa3e2f0d2e415e8d3 (patch)
tree4695c31f3ef0a0ccf560abf597530a60c807e926 /mod.php
parent4c6faeb7a252b708f0f54adac82c7ce403ce2e77 (diff)
Split [D+] (delete all posts by IP address) into global and non-global commands
Diffstat (limited to 'mod.php')
-rw-r--r--mod.php12
1 files changed, 9 insertions, 3 deletions
diff --git a/mod.php b/mod.php
index a7d57ffa..64c3e8fb 100644
--- a/mod.php
+++ b/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'];
- $boards = listBoards();
+ 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);