summaryrefslogtreecommitdiff
path: root/post.php
diff options
context:
space:
mode:
authorMacil Tech <maciltech@gmail.com>2013-06-18 12:21:41 -0500
committerMacil Tech <maciltech@gmail.com>2013-06-18 12:21:41 -0500
commit3eda5b054361f7312b40a14728b76841c01628d2 (patch)
treed3769bb2948da90eda5c01c449b81249757bc06e /post.php
parentfd33e9eba1e72fd4ee5f064944e9592be66c12c1 (diff)
Adds image_hard_limit and reply_hard_limit options.
Also reworks the numPosts() function and uses it elsewhere too.
Diffstat (limited to 'post.php')
-rw-r--r--post.php20
1 files changed, 14 insertions, 6 deletions
diff --git a/post.php b/post.php
index c5e68578..f236e929 100644
--- a/post.php
+++ b/post.php
@@ -302,13 +302,21 @@ if (isset($_POST['delete'])) {
}
}
- // Check if thread is locked
- // but allow mods to post
- if (!$post['op'] && !hasPermission($config['mod']['postinlocked'], $board['uri'])) {
- if ($thread['locked'])
+ if (!$post['op']) {
+ // Check if thread is locked
+ // but allow mods to post
+ if ($thread['locked'] && !hasPermission($config['mod']['postinlocked'], $board['uri']))
error($config['error']['locked']);
+
+ $numposts = numPosts($post['thread']);
+
+ if ($config['reply_hard_limit'] != 0 && $config['reply_hard_limit'] <= $numposts['replies'])
+ error($config['error']['reply_hard_limit']);
+
+ if ($post['has_file'] && $config['image_hard_limit'] != 0 && $config['image_hard_limit'] <= $numposts['images'])
+ error($config['error']['image_hard_limit']);
}
-
+
if ($post['has_file']) {
$size = $_FILES['file']['size'];
if ($size > $config['max_filesize'])
@@ -636,7 +644,7 @@ if (isset($_POST['delete'])) {
buildThread($post['op'] ? $id : $post['thread']);
- if (!$post['op'] && strtolower($post['email']) != 'sage' && !$thread['sage'] && ($config['reply_limit'] == 0 || numPosts($post['thread']) < $config['reply_limit'])) {
+ if (!$post['op'] && strtolower($post['email']) != 'sage' && !$thread['sage'] && ($config['reply_limit'] == 0 || $numposts['replies']+1 < $config['reply_limit'])) {
bumpThread($post['thread']);
}