From c04c9bcb6a2090088fdd5aecfb535386fca84fd0 Mon Sep 17 00:00:00 2001 From: nonmakina Date: Sat, 9 Jan 2021 19:24:53 -0600 Subject: [PATCH 1/2] Removes ability to delete own threads. --- inc/config.php | 1 + inc/instance-config.php | 5 +++++ post.php | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/inc/config.php b/inc/config.php index c5842b88..61c45fa5 100644 --- a/inc/config.php +++ b/inc/config.php @@ -1120,6 +1120,7 @@ $config['error']['toomanycites'] = _('Too many cites; post discarded.'); $config['error']['toomanycross'] = _('Too many cross-board links; post discarded.'); $config['error']['nodelete'] = _('You didn\'t select anything to delete.'); + $config['error']['nodeletethread'] = _('You are not allowed to delete threads.'); $config['error']['noreport'] = _('You didn\'t select anything to report.'); $config['error']['toomanyreports'] = _('You can\'t report that many posts at once.'); $config['error']['invalidpassword'] = _('Wrong password…'); diff --git a/inc/instance-config.php b/inc/instance-config.php index eca5bb01..63aa2664 100644 --- a/inc/instance-config.php +++ b/inc/instance-config.php @@ -111,6 +111,11 @@ $config['mod']['editpost'] = MOD; // Raw HTML posting $config['mod']['rawhtml'] = MOD; +$config['mod']['mod_board_log'] = MOD; + +$config['allow_thread_deletion'] = false; + + // Max attachments per post $config['max_images'] = 5; $config['image_reject_repost'] = false; diff --git a/post.php b/post.php index e4f2a63f..8556047e 100644 --- a/post.php +++ b/post.php @@ -230,6 +230,11 @@ function handle_delete(){ $thread = $thread_query->fetch(PDO::FETCH_ASSOC); } + if (isset($config['allow_thread_deletion']) && !$config['allow_thread_deletion'] && !$post['thread']) { + error($config['error']['nodeletethread']); + } + + if ($password != '' && $post['password'] != $password && (!$thread || $thread['password'] != $password)) error($config['error']['invalidpassword']); From 02b4b96ffb030eb4c985f26e39747c14c08f9ae9 Mon Sep 17 00:00:00 2001 From: nonmakina Date: Sat, 9 Jan 2021 19:26:59 -0600 Subject: [PATCH 2/2] Whitespace and removed error. --- inc/instance-config.php | 3 --- post.php | 1 - 2 files changed, 4 deletions(-) diff --git a/inc/instance-config.php b/inc/instance-config.php index 63aa2664..1e1d1bb9 100644 --- a/inc/instance-config.php +++ b/inc/instance-config.php @@ -111,11 +111,8 @@ $config['mod']['editpost'] = MOD; // Raw HTML posting $config['mod']['rawhtml'] = MOD; -$config['mod']['mod_board_log'] = MOD; - $config['allow_thread_deletion'] = false; - // Max attachments per post $config['max_images'] = 5; $config['image_reject_repost'] = false; diff --git a/post.php b/post.php index 8556047e..54db692e 100644 --- a/post.php +++ b/post.php @@ -234,7 +234,6 @@ function handle_delete(){ error($config['error']['nodeletethread']); } - if ($password != '' && $post['password'] != $password && (!$thread || $thread['password'] != $password)) error($config['error']['invalidpassword']);