From 53c4cb26a17f3454a6cc3ae9e31df0c16013259a Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Thu, 15 Sep 2011 20:32:49 +1000 Subject: [PATCH] Removed $config[force_body]. Made threads without text possible. --- inc/config.php | 6 +++--- main.js | 2 +- post.php | 19 ++++++++++++------- templates/main.js | 2 +- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/inc/config.php b/inc/config.php index b4bbc60e..0a8b982d 100644 --- a/inc/config.php +++ b/inc/config.php @@ -109,10 +109,10 @@ $config['flood_time_ip'] = 120; // Same as above but different IP address $config['flood_time_same'] = 30; - // Do you need a body for your non-OP posts? + // Do you need a body for your reply posts? $config['force_body'] = false; - // Reject blank posts? (just whitespace, etc)? - $config['reject_blank'] = true; + // Do you need a body for new threads? + $config['force_body_op'] = true; // Max body length $config['max_body'] = 1800; diff --git a/main.js b/main.js index e0d0d6f4..d8fc0a47 100644 --- a/main.js +++ b/main.js @@ -50,7 +50,7 @@ function dopost(form) { saved[document.location] = form.body.value; sessionStorage.body = JSON.stringify(saved); - return form.body.value != "" || (typeof form.thread != "undefined" && form.file.value != ""); + return form.body.value != "" || form.file.value != ""; } function citeReply(id) { body = document.getElementById('body'); diff --git a/post.php b/post.php index 3c1bbaa3..3c430f17 100644 --- a/post.php +++ b/post.php @@ -189,8 +189,8 @@ } } - if(checkSpam()) - error($config['error']['spam']); + //if(checkSpam()) + // error($config['error']['spam']); if($config['robot_enable'] && $config['robot_mute']) { checkMute(); @@ -243,11 +243,13 @@ $post['mod'] = isset($_POST['mod']) && $_POST['mod']; if($post['has_file']) $post['filename'] = utf8tohtml(get_magic_quotes_gpc() ? stripslashes($_FILES['file']['name']) : $_FILES['file']['name']); + elseif(empty($post['body'])) + error($config['error']['tooshort_body']); if($config['force_body'] && empty($post['body'])) error($config['error']['tooshort_body']); - if($config['reject_blank'] && !empty($post['body'])) { + if($config['force_body'] && !empty($post['body'])) { $stripped_whitespace = preg_replace('/[\s]/u', '', $post['body']); if(empty($stripped_whitespace)) error($config['error']['tooshort_body']); @@ -315,7 +317,10 @@ if(strlen($post['email']) > 40) error(sprintf($config['error']['toolong'], 'email')); if(strlen($post['subject']) > 100) error(sprintf($config['error']['toolong'], 'subject')); if(!$mod && strlen($post['body']) > $config['max_body']) error($config['error']['toolong_body']); - if(!(!$OP && $post['has_file']) && strlen($post['body']) < 1) error($config['error']['tooshort_body']); + if($config['force_body_op'] && empty($post['body'])) error($config['error']['tooshort_body']); + + //if(!($config['force_body_op'] && !$OP && $post['has_file']) && strlen($post['body']) < 1) error($config['error']['tooshort_body']); + if(strlen($post['password']) > 20) error(sprintf($config['error']['toolong'], 'password')); wordfilters($post['body']); @@ -326,9 +331,9 @@ markup($post['body']); // Check for a flood - if(!($mod && $mod['type'] >= $config['mod']['flood']) && checkFlood($post)) { - error($config['error']['flood']); - } + //if(!($mod && $mod['type'] >= $config['mod']['flood']) && checkFlood($post)) { + // error($config['error']['flood']); + //} // Custom anti-spam filters if(isset($config['flood_filters'])) { diff --git a/templates/main.js b/templates/main.js index 4476e2ff..66d7d99d 100644 --- a/templates/main.js +++ b/templates/main.js @@ -50,7 +50,7 @@ function dopost(form) { saved[document.location] = form.body.value; sessionStorage.body = JSON.stringify(saved); - return form.body.value != "" || (typeof form.thread != "undefined" && form.file.value != ""); + return form.body.value != "" || form.file.value != ""; } function citeReply(id) { body = document.getElementById('body');