diff --git a/inc/config.php b/inc/config.php index 923b03f1..35d1ad3d 100755 --- a/inc/config.php +++ b/inc/config.php @@ -507,6 +507,8 @@ $config['allow_delete'] = true; // How long after posting should you have to wait before being able to delete that post? (In seconds.) $config['delete_time'] = 10; + // If true, return to thread after the delete. If false, go to the board index instead. + $config['delete_return'] = true; // Reply limit (stops bumping thread when this is reached). $config['reply_limit'] = 250; diff --git a/post.php b/post.php index 0b379009..fb2f9a44 100755 --- a/post.php +++ b/post.php @@ -209,6 +209,8 @@ if (isset($_POST['delete'])) { if (empty($delete)) error($config['error']['nodelete']); + $return_page = $config['file_index']; + $set_return = $config['delete_return']; foreach ($delete as &$id) { $query = prepare(sprintf("SELECT `id`,`thread`,`time`,`password` FROM ``posts_%s`` WHERE `id` = :id", $board['uri'])); $query->bindValue(':id', $id, PDO::PARAM_INT); @@ -241,6 +243,16 @@ if (isset($_POST['delete'])) { modLog("User deleted his own post #$id"); } + if ($set_return) { + $set_return = false; + $return_page = $config['dir']['res'] . link_for($post); + } + // Force return to index if we deleted OP. + if ($post['thread']) { + $set_return = false; + $return_page = $config['file_index']; + } + _syslog(LOG_INFO, 'Deleted post: ' . '/' . $board['dir'] . $config['dir']['res'] . link_for($post) . ($post['thread'] ? '#' . $id : '') ); @@ -253,7 +265,7 @@ if (isset($_POST['delete'])) { $root = $is_mod ? $config['root'] . $config['file_mod'] . '?/' : $config['root']; if (!isset($_POST['json_response'])) { - header('Location: ' . $root . $board['dir'] . $config['file_index'], true, $config['redirect_http']); + header('Location: ' . $root . $board['dir'] . $return_page, true, $config['redirect_http']); } else { header('Content-Type: text/json'); echo json_encode(array('success' => true));