diff options
| author | Savetheinternet <savetheinternet@tinyboard.org> | 2011-10-10 21:07:59 +1100 |
|---|---|---|
| committer | Savetheinternet <savetheinternet@tinyboard.org> | 2011-10-10 21:07:59 +1100 |
| commit | f6a499778033199fac9b2ee6165da85190e98c2b (patch) | |
| tree | 60460940672f9d9ff4d7726adfed483c6a09f4b3 /mod.php | |
| parent | 85d37a55c31c7c69eef80f0395d5355b8b511042 (diff) | |
made D+ (delete posts by IP) global
Diffstat (limited to 'mod.php')
| -rw-r--r-- | mod.php | 25 |
1 files changed, 21 insertions, 4 deletions
@@ -1774,6 +1774,9 @@ // Create the posts table query(Element('posts.sql', Array('board' => $board['uri']))) or error(db_error()); + if($config['cache']['enabled']) + cache::delete('all_boards'); + // Build the board buildIndex(); @@ -1952,21 +1955,35 @@ $ip = $post['ip']; - // Record the action - modLog("Deleted all posts by IP address: {$ip}"); + $boards = listBoards(); + $query = ''; + 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); - $query = prepare(sprintf("SELECT `id` FROM `posts_%s` WHERE `ip` = :ip", $board['uri'])); + $query = prepare($query); $query->bindValue(':ip', $ip); $query->execute() or error(db_error($query)); if($query->rowCount() < 1) error($config['error']['invalidpost']); + $boards = Array(); while($post = $query->fetch()) { + openBoard($post['board']); + $boards[] = $post['board']; + deletePost($post['id'], false); } - buildIndex(); + foreach($boards as &$_board) { + openBoard($_board); + buildIndex(); + } + + // Record the action + modLog("Deleted all posts by IP address: {$ip}"); header('Location: ?/' . sprintf($config['board_path'], $boardName) . $config['file_index'], true, $config['redirect_http']); } elseif(preg_match('/^\/ban$/', $query)) { |
