From 6fb529e7451b601e3276d58ca820ef65307e1cf8 Mon Sep 17 00:00:00 2001 From: discomrade Date: Sat, 29 Jan 2022 21:55:33 -0100 Subject: [PATCH] Add option to force a subject when posting threads --- inc/config.php | 3 +++ post.php | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/inc/config.php b/inc/config.php index d589f203..8306d8cb 100644 --- a/inc/config.php +++ b/inc/config.php @@ -489,6 +489,8 @@ $config['force_body_op'] = true; // Require an image for threads? $config['force_image_op'] = true; + // Require a subject for threads? + $config['force_subject_op'] = false; // Strip superfluous new lines at the end of a post. $config['strip_superfluous_returns'] = true; @@ -1232,6 +1234,7 @@ $config['error']['tooshort_body_op'] = _('OP must be at least %d characters long.'); $config['error']['no_body'] = _('The body was too short or empty.'); $config['error']['noimage'] = _('You must upload an image.'); + $config['error']['nosubject'] = _('You must add a subject.'); $config['error']['toomanyimages'] = _('You have attempted to upload too many images!'); $config['error']['nomove'] = _('The server failed to handle your upload.'); $config['error']['fileext'] = _('Unsupported image format.'); diff --git a/post.php b/post.php index ce269b03..d82646d2 100644 --- a/post.php +++ b/post.php @@ -641,7 +641,11 @@ if (isset($_POST['delete'])) { error($config['error']['no_body']); } } - + + if ($post['op'] && $config['force_subject_op'] && $post['subject'] == '') { + error($config['error']['nosubject']); + } + if (!$post['op']) { // Check if thread is locked // but allow mods to post