diff --git a/inc/config.php b/inc/config.php index 8fa55c8a..eb2e2229 100644 --- a/inc/config.php +++ b/inc/config.php @@ -526,8 +526,10 @@ $config['allow_delete'] = true; // If thread has at least this number of replies, OP can't delete it anymore. (Set to false to disable) $config['allow_delete_cutoff'] = 10; - // How long after posting should you have to wait before being able to delete that post? (In seconds.) - $config['delete_time'] = 10; + // How long after posting should you have to wait before being able to delete an OP thread? (In seconds.) + $config['delete_time_op'] = 10; + // How long after posting should you have to wait before being able to delete a reply post? (In seconds.) + $config['delete_time_reply'] = 0; // Reply limit (stops bumping thread when this is reached). $config['reply_limit'] = 250; diff --git a/post.php b/post.php index a70d2bd7..21807d9b 100644 --- a/post.php +++ b/post.php @@ -230,10 +230,17 @@ if (isset($_POST['delete'])) { if ($password != '' && $post['password'] != $password && (!$thread || $thread['password'] != $password)) error($config['error']['invalidpassword']); - if ($post['time'] > time() - $config['delete_time'] && (!$thread || $thread['password'] != $password)) { - error(sprintf($config['error']['delete_too_soon'], until($post['time'] + $config['delete_time']))); + if ($post['thread'] == NULL) { + if ($post['time'] > time() - $config['delete_time_op'] && (!$thread || $thread['password'] != $password)) { + error(sprintf($config['error']['delete_too_soon'], until($post['time'] + $config['delete_time_op']))); + } } - + else { + if ($post['time'] > time() - $config['delete_time_reply'] && (!$thread || $thread['password'] != $password)) { + error(sprintf($config['error']['delete_too_soon'], until($post['time'] + $config['delete_time_reply']))); + } + } + if (isset($_POST['file'])) { // Delete just the file deleteFile($id); @@ -423,20 +430,20 @@ if (isset($_POST['delete'])) { } // Same, but now with our custom captcha provider if (($config['captcha']['enabled']) || (($post['op']) && ($config['new_thread_capt'])) ) { - $ch = curl_init($config['domain'].'/'.$config['captcha']['provider_check'] . "?" . http_build_query([ - 'mode' => 'check', - 'text' => $_POST['captcha_text'], - 'extra' => $config['captcha']['extra'], - 'cookie' => $_POST['captcha_cookie'] - ])); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - $resp = curl_exec($ch); - - if ($resp !== '1') { - error($config['error']['captcha'] . - ''); + $ch = curl_init($config['domain'].'/'.$config['captcha']['provider_check'] . "?" . http_build_query([ + 'mode' => 'check', + 'text' => $_POST['captcha_text'], + 'extra' => $config['captcha']['extra'], + 'cookie' => $_POST['captcha_cookie'] + ])); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + $resp = curl_exec($ch); + + if ($resp !== '1') { + error($config['error']['captcha'] . + ''); + } } - } if (!(($post['op'] && $_POST['post'] == $config['button_newtopic']) || (!$post['op'] && $_POST['post'] == $config['button_reply']))) @@ -497,7 +504,6 @@ if (isset($_POST['delete'])) { else { $thread = false; } - // Check for an embed field if ($config['enable_embedding'] && isset($_POST['embed']) && !empty($_POST['embed'])) {