diff --git a/post.php b/post.php index 7d5bdb12..39d15644 100644 --- a/post.php +++ b/post.php @@ -1347,7 +1347,21 @@ if (isset($_POST['delete'])) { if (!$post['mod']) header('X-Associated-Content: "' . $redirect . '"'); - if ($post['op']) { + if (!isset($_POST['json_response'])) { + header('Location: ' . $redirect, true, $config['redirect_http']); + } else { + header('Content-Type: text/json; charset=utf-8'); + echo json_encode(array( + 'redirect' => $redirect, + 'noko' => $noko, + 'id' => $id + )); + } + + if ($config['try_smarter'] && $post['op']) + $build_pages = range(1, $config['max_pages']); + + if ($post['op']) clean($id); if ($config['try_smarter']) @@ -1356,18 +1370,13 @@ if (isset($_POST['delete'])) { event('post-after', $post); - // If this is a new thread or the poster is returning to the index, build it before they redirect - if ($post['op'] || !$noko) - buildIndex(); - + buildIndex(); + // We are already done, let's continue our heavy-lifting work in the background (if we run off FastCGI) if (function_exists('fastcgi_finish_request')) { @fastcgi_finish_request(); } - if (!$post['op'] && $noko) - buildIndex(); - if ($post['op']) { rebuildThemes('post-thread', $board['uri']); } else {