Browse Source

Fixed a small bug on the flood filter

pull/40/head
Savetheinternet 13 years ago
parent
commit
7c2938b542
  1. 14
      inc/config.php
  2. 5
      post.php

14
inc/config.php

@ -19,7 +19,8 @@
'error' => Array(), 'error' => Array(),
'dir' => Array(), 'dir' => Array(),
'mod' => Array(), 'mod' => Array(),
'spam' => Array() 'spam' => Array(),
'flood_filters' => Array()
); );
// Database stuff // Database stuff
@ -378,8 +379,7 @@
); );
// Custom flood filters. Detect flood attacks and reject new posts if there's a positive match. // Custom flood filters. Detect flood attacks and reject new posts if there's a positive match.
//$config['flood_filters'] = Array( //$config['flood_filters'][] = Array(
// Array(
// 'condition' => Array( // 'condition' => Array(
// // 100 posts in the past 5 minutes (~20 p/m) // // 100 posts in the past 5 minutes (~20 p/m)
// 'posts_in_past_x_minutes' => Array(100, 5) // 'posts_in_past_x_minutes' => Array(100, 5)
@ -388,9 +388,10 @@
// 'action' => 'reject', // 'action' => 'reject',
// // Display this message // // Display this message
// 'message' => 'Your post has been rejected on the suspicion of a flood attack on this board.' // 'message' => 'Your post has been rejected on the suspicion of a flood attack on this board.'
// ), //);
// // Another filter
// Array( // Another filter
//$config['flood_filters'][] = Array(
// 'condition' => Array( // 'condition' => Array(
// // 10 new empty threads in the past 2 minutes // // 10 new empty threads in the past 2 minutes
// 'threads_with_no_replies_in_past_x_minutes' => Array(10, 2), // 'threads_with_no_replies_in_past_x_minutes' => Array(10, 2),
@ -399,7 +400,6 @@
// ), // ),
// 'action' => 'reject', // 'action' => 'reject',
// 'message' => 'Your post has been rejected on the suspicion of a flood attack on this board (too many new threads); post a reply instead.' // 'message' => 'Your post has been rejected on the suspicion of a flood attack on this board (too many new threads); post a reply instead.'
// )
//); //);
// A small file in the main directory indicating that the script has been ran and the board(s) have been generated. // A small file in the main directory indicating that the script has been ran and the board(s) have been generated.

5
post.php

@ -303,6 +303,7 @@
// Custom anti-spam filters // Custom anti-spam filters
if(isset($config['flood_filters'])) { if(isset($config['flood_filters'])) {
foreach($config['flood_filters'] as &$filter) { foreach($config['flood_filters'] as &$filter) {
unset($did_not_match);
// Set up default stuff // Set up default stuff
if(!isset($filter['action'])) if(!isset($filter['action']))
$filter['action'] = 'reject'; $filter['action'] = 'reject';
@ -333,7 +334,7 @@
} }
} elseif($condition == 'OP') { } elseif($condition == 'OP') {
// Am I OP? // Am I OP?
if($OP) if($value == $OP)
continue; continue;
} else { } else {
// Unknown block // Unknown block
@ -343,6 +344,7 @@
$did_not_match = true; $did_not_match = true;
break; break;
} }
}
if(!isset($did_not_match)) { if(!isset($did_not_match)) {
// Matched filter! // Matched filter!
if($filter['action'] == 'reject') { if($filter['action'] == 'reject') {
@ -350,7 +352,6 @@
} }
} }
} }
}
if($post['has_file']) { if($post['has_file']) {
// Just trim the filename if it's too long // Just trim the filename if it's too long

Loading…
Cancel
Save