Browse Source

Added Feature - Different wait-time for OP and reply deletion.

main
Arvo Huru 7 years ago
committed by discomrade
parent
commit
4989762458
  1. 6
      inc/config.php
  2. 40
      post.php

6
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;

40
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'] .
'<script>if (actually_load_captcha !== undefined) actually_load_captcha("'.$config['captcha']['provider_get'].'", "'.$config['captcha']['extra'].'");</script>');
$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'] .
'<script>if (actually_load_captcha !== undefined) actually_load_captcha("'.$config['captcha']['provider_get'].'", "'.$config['captcha']['extra'].'");</script>');
}
}
}
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'])) {

Loading…
Cancel
Save