From 91e8547b0469e0e046bc15cd9c86f7d7abe86999 Mon Sep 17 00:00:00 2001 From: Macil Tech Date: Wed, 14 Nov 2012 13:33:27 -0700 Subject: Add image_reject_repost_in_thread option --- post.php | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) (limited to 'post.php') diff --git a/post.php b/post.php index 16566b51..a462916b 100644 --- a/post.php +++ b/post.php @@ -500,17 +500,34 @@ if (isset($_POST['delete'])) { } } - if ($post['has_file'] && $config['image_reject_repost'] && $p = getPostByHash($post['filehash'])) { - undoImage($post); - error(sprintf($config['error']['fileexists'], - $post['mod'] ? $config['root'] . $config['file_mod'] . '?/' : $config['root'] . - $board['dir'] . $config['dir']['res'] . - ($p['thread'] ? - $p['thread'] . '.html#' . $p['id'] - : - $p['id'] . '.html' - ) - )); + if ($post['has_file']) { + if ($config['image_reject_repost']) { + if ($p = getPostByHash($post['filehash'])) { + undoImage($post); + error(sprintf($config['error']['fileexists'], + $post['mod'] ? $config['root'] . $config['file_mod'] . '?/' : $config['root'] . + $board['dir'] . $config['dir']['res'] . + ($p['thread'] ? + $p['thread'] . '.html#' . $p['id'] + : + $p['id'] . '.html' + ) + )); + } + } else if (!$post['op'] && $config['image_reject_repost_in_thread']) { + if ($p = getPostByHashInThread($post['filehash'], $post['thread'])) { + undoImage($post); + error(sprintf($config['error']['fileexistsinthread'], + $post['mod'] ? $config['root'] . $config['file_mod'] . '?/' : $config['root'] . + $board['dir'] . $config['dir']['res'] . + ($p['thread'] ? + $p['thread'] . '.html#' . $p['id'] + : + $p['id'] . '.html' + ) + )); + } + } } if (!hasPermission($config['mod']['postunoriginal'], $board['uri']) && $config['robot_enable'] && checkRobot($post['body_nomarkup'])) { -- cgit v1.3 From 67ab3760baf43061d68b9480ed2e651b7b6566ae Mon Sep 17 00:00:00 2001 From: Macil Tech Date: Thu, 19 Jul 2012 00:16:50 -0600 Subject: Removed redundant code in image processing. Both paths of the code here did the same thing. --- post.php | 34 ++++++---------------------------- 1 file changed, 6 insertions(+), 28 deletions(-) (limited to 'post.php') diff --git a/post.php b/post.php index 16566b51..1153b46a 100644 --- a/post.php +++ b/post.php @@ -407,34 +407,12 @@ if (isset($_POST['delete'])) { require_once 'inc/image.php'; - if ($config['thumb_method'] == 'imagick') { - // This is tricky, because Imagick won't let us find - // an image's dimensions without loading it all into - // memory first, unlike GD which provides the - // getimagesize() to do exactly that. This section - // is why GD is required, even when using Imagick - // instead. There doesn't seem to be an alternative. - // Necessary for security, as Imagick even ignores - // PHP's memory limit. - - // first try GD's getimagesize() - if ($size = @getimagesize($upload)) { - if ($size[0] > $config['max_width'] || $size[1] > $config['max_height']) { - - error($config['error']['maxsize']); - } - } else { - // GD failed - // TODO? - } - } else { - // find dimensions of an image using GD - if (!$size = @getimagesize($upload)) { - error($config['error']['invalidimg']); - } - if ($size[0] > $config['max_width'] || $size[1] > $config['max_height']) { - error($config['error']['maxsize']); - } + // find dimensions of an image using GD + if (!$size = @getimagesize($upload)) { + error($config['error']['invalidimg']); + } + if ($size[0] > $config['max_width'] || $size[1] > $config['max_height']) { + error($config['error']['maxsize']); } // create image object -- cgit v1.3 From 0da1c18a7ff2328a3cdd422e3f67d4b4bf403fb5 Mon Sep 17 00:00:00 2001 From: Macil Tech Date: Thu, 30 Aug 2012 04:07:23 -0600 Subject: Add field_disable_subject and field_disable_reply_subject config options. --- inc/config.php | 4 ++++ post.php | 8 +++++++- templates/post_form.html | 8 +++++++- 3 files changed, 18 insertions(+), 2 deletions(-) (limited to 'post.php') diff --git a/inc/config.php b/inc/config.php index e977f066..ea936032 100644 --- a/inc/config.php +++ b/inc/config.php @@ -348,6 +348,10 @@ $config['field_disable_name'] = false; // When true, no email will be able to be set. $config['field_disable_email'] = false; + // When true, no subject will be able to be set. + $config['field_disable_subject'] = false; + // When true, no subject will be able to be set in replies. + $config['field_disable_reply_subject'] = false; // When true, a blank password will be used for files (not usable for deletion). $config['field_disable_password'] = false; diff --git a/post.php b/post.php index 98da7486..54065832 100644 --- a/post.php +++ b/post.php @@ -139,7 +139,7 @@ if (isset($_POST['delete'])) { header('Location: ' . $root . $board['dir'] . $config['file_index'], true, $config['redirect_http']); } elseif (isset($_POST['post'])) { - if (!isset($_POST['subject'], $_POST['body'], $_POST['board'])) + if (!isset($_POST['body'], $_POST['board'])) error($config['error']['bot']); if (!isset($_POST['name'])) @@ -148,6 +148,9 @@ if (isset($_POST['delete'])) { if (!isset($_POST['email'])) $_POST['email'] = ''; + if (!isset($_POST['subject'])) + $_POST['subject'] = ''; + if (!isset($_POST['password'])) $_POST['password'] = ''; @@ -271,6 +274,9 @@ if (isset($_POST['delete'])) { if ($config['field_disable_password']) $_POST['password'] = ''; + + if ($config['field_disable_subject'] || (!$post['op'] && $config['field_disable_reply_subject'])) + $_POST['subject'] = ''; } // Check for a file diff --git a/templates/post_form.html b/templates/post_form.html index 8b7350c7..aa051f5f 100644 --- a/templates/post_form.html +++ b/templates/post_form.html @@ -27,12 +27,18 @@ {% endif %} - + {% if not (config.field_disable_subject or (id and config.field_disable_reply_subject)) or (mod and post.mod|hasPermission(config.mod.bypass_field_disable, board.uri)) %} {% trans %}Subject{% endtrans %} {{ antibot.html() }} + {% else %} + {% trans %}Submit{% endtrans %} + {{ antibot.html() }} + + + {% endif %} {% if config.spoiler_images %} {% endif %} -- cgit v1.3