1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-12 01:50:48 +01:00

Merge pull request #645 from vichan-devel/RealAngeleno-patch-13

Allow prohibition of deleting old posts
This commit is contained in:
RealAngeleno 2023-10-31 22:05:06 -07:00 committed by GitHub
commit e80cc95858
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -541,6 +541,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;
// How long should a user be able to delete their post for? (In seconds. Set to 0 to disable.)
$config['max_delete_time'] = 0;
// Reply limit (stops bumping thread when this is reached).
$config['reply_limit'] = 250;
@ -1187,6 +1189,7 @@
$config['error']['fileexists'] = _('That file <a href="%s">already exists</a>!');
$config['error']['fileexistsinthread'] = _('That file <a href="%s">already exists</a> in this thread!');
$config['error']['delete_too_soon'] = _('You\'ll have to wait another %s before deleting that.');
$config['error']['delete_too_late'] = _('You cannot delete a post this old.');
$config['error']['mime_exploit'] = _('MIME type detection XSS exploit (IE) detected; post discarded.');
$config['error']['invalid_embed'] = _('Couldn\'t make sense of the URL of the video you tried to embed.');
$config['error']['captcha'] = _('You seem to have mistyped the verification.');

View File

@ -227,6 +227,10 @@ if (isset($_POST['delete'])) {
$thread = $thread_query->fetch(PDO::FETCH_ASSOC);
}
if ($post['time'] < time() - $config['max_delete_time'] && $config['max_delete_time'] != false) {
error(sprintf($config['error']['delete_too_late'], until($post['time'] + $config['max_delete_time'])));
}
if ($password != '' && $post['password'] != $password && (!$thread || $thread['password'] != $password))
error($config['error']['invalidpassword']);