summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorBenjamin Southall <applemansigloo@gmail.com>2017-06-08 07:44:27 +0900
committerBenjamin Southall <applemansigloo@gmail.com>2017-06-08 07:44:27 +0900
commit257ead7313f5a3248d07e9be89f84aa2ea984008 (patch)
tree133123bda31630939b9a930c84f71d6561e52259 /inc
parent894e8eadfd869dcfacbe3df8489c04b6a407fb0b (diff)
Merge pull request from vichan-devel/vichan#200 from seisatsu/patch-2 Fix typo in max_images comment , Adding early 404 staged from https://github.com/vichan-devel/vichan/commit/40fe35fedce79557fdc8b7e5c208d7d279757803
Diffstat (limited to 'inc')
-rw-r--r--inc/config.php3
-rwxr-xr-xinc/functions.php20
2 files changed, 21 insertions, 2 deletions
diff --git a/inc/config.php b/inc/config.php
index 6d6e92f5..72ac4984 100644
--- a/inc/config.php
+++ b/inc/config.php
@@ -538,6 +538,7 @@
$config['early_404_page'] = 3;
$config['early_404_replies'] = 5;
+ $config['early_404_staged'] = false;
// A wordfilter (sometimes referred to as just a "filter" or "censor") automatically scans users’ posts
// as they are submitted and changes or censors particular words or phrases.
@@ -678,7 +679,7 @@
*/
// Maximum number of images allowed. Increasing this number enabled multi image.
// If you make it more than 1, make sure to enable the below script for the post form to change.
- // $config['additional_javascript'][] = 'js/multi_image.js';
+ // $config['additional_javascript'][] = 'js/multi-image.js';
$config['max_images'] = 1;
// Method to use for determing the max filesize.
diff --git a/inc/functions.php b/inc/functions.php
index ed00743c..9283c3ae 100755
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -1279,11 +1279,28 @@ function clean($pid = false) {
$query->bindValue(':offset', $offset, PDO::PARAM_INT);
$query->execute() or error(db_error($query));
+ if ($config['early_404_staged']) {
+ $page = $config['early_404_page'];
+ $iter = 0;
+ }
+ else {
+ $page = 1;
+ }
+
while ($post = $query->fetch(PDO::FETCH_ASSOC)) {
- if ($post['reply_count'] < $config['early_404_replies']) {
+ if ($post['reply_count'] < $page*$config['early_404_replies']) {
deletePost($post['thread_id'], false, false);
if ($pid) modLog("Automatically deleting thread #{$post['thread_id']} due to new thread #{$pid} (early 404 is set, #{$post['thread_id']} had {$post['reply_count']} replies)");
}
+
+ if ($config['early_404_staged']) {
+ $iter++;
+
+ if ($iter == $config['threads_per_page']) {
+ $page++;
+ $iter = 0;
+ }
+ }
}
}
}
@@ -1310,6 +1327,7 @@ function index($page, $mod=false, $brief = false) {
$query->bindValue(':threads_per_page', $config['threads_per_page'], PDO::PARAM_INT);
$query->execute() or error(db_error($query));
+
if ($page == 1 && $query->rowCount() < $config['threads_per_page'])
$board['thread_count'] = $query->rowCount();