Antispam Bee - Version 2.6.4

Version Description

  • English

    • Consideration of the comment time (Spam if a comment was written in less than 5 seconds)
    • Release time investment (Development & QA): 6,25 h
  • Deutsch

    • Bercksichtigung der Kommentarzeit (Spam, wenn ein Kommentar in unter 5 Sekunden verfasst)
    • Mehr Informationen auf Google+
    • Release-Zeitaufwand (Development & QA): 6,25 Stunden
Download this release

Release Info

Developer sergej.mueller
Plugin Icon 128x128 Antispam Bee
Version 2.6.4
Comparing to
See all releases

Code changes from version 2.6.3 to 2.6.4

antispam_bee.php CHANGED
@@ -8,7 +8,7 @@ Author: Sergej Müller
8
  Author URI: http://wpcoder.de
9
  Plugin URI: http://antispambee.com
10
  License: GPLv2 or later
11
- Version: 2.6.3
12
  */
13
 
14
  /*
@@ -338,7 +338,7 @@ class Antispam_Bee {
338
  * Initialisierung der internen Variablen
339
  *
340
  * @since 2.4
341
- * @change 2.6.2
342
  */
343
 
344
  private static function _init_internal_vars()
@@ -353,6 +353,7 @@ class Antispam_Bee {
353
  'regexp_check' => 1,
354
  'spam_ip' => 1,
355
  'already_commented' => 1,
 
356
  'ignore_pings' => 0,
357
  'always_allowed' => 0,
358
 
@@ -385,6 +386,7 @@ class Antispam_Bee {
385
  ),
386
  'reasons' => array(
387
  'css' => 'CSS Hack',
 
388
  'empty' => 'Empty Data',
389
  'server' => 'Fake IP',
390
  'localdb' => 'Local DB Spam',
@@ -1110,12 +1112,12 @@ class Antispam_Bee {
1110
  $hidden_field = self::get_key($_POST, 'comment');
1111
  $plugin_field = self::get_key($_POST, self::$_secret);
1112
 
1113
- /* Fields check */
1114
- if ( empty($hidden_field) && !empty($plugin_field) ) {
1115
  $_POST['comment'] = $plugin_field;
1116
- unset($_POST[self::$_secret]);
1117
  } else {
1118
- $_POST['bee_spam'] = 1;
1119
  }
1120
  }
1121
 
@@ -1227,7 +1229,7 @@ class Antispam_Bee {
1227
  * ersetzt das Kommentarfeld
1228
  *
1229
  * @since 2.4
1230
- * @change 2.4.1
1231
  *
1232
  * @param string $data HTML-Code der Webseite
1233
  * @return string Behandelter HTML-Code
@@ -1245,11 +1247,25 @@ class Antispam_Bee {
1245
  return $data;
1246
  }
1247
 
1248
- /* Convert */
 
 
 
 
 
 
 
 
 
 
1249
  return preg_replace(
1250
  '#<textarea(.+?)name=["\']comment["\'](.+?)</textarea>#s',
1251
- '<textarea$1name="' .self::$_secret. '"$2</textarea><textarea name="comment" style="display:none" rows="1" cols="1"></textarea>',
1252
- (string) $data,
 
 
 
 
1253
  1
1254
  );
1255
  }
@@ -1330,7 +1346,7 @@ class Antispam_Bee {
1330
  * Prüfung den Kommentar
1331
  *
1332
  * @since 2.4
1333
- * @change 2.6.1
1334
  *
1335
  * @param array $comment Daten des Kommentars
1336
  * @return array Array mit dem Verdachtsgrund [optional]
@@ -1375,12 +1391,19 @@ class Antispam_Bee {
1375
  }
1376
 
1377
  /* Bot erkannt */
1378
- if ( ! empty($_POST['bee_spam']) ) {
1379
  return array(
1380
  'reason' => 'css'
1381
  );
1382
  }
1383
 
 
 
 
 
 
 
 
1384
  /* BBCode Spam */
1385
  if ( $options['bbcode_check'] && self::_is_bbcode_spam($body) ) {
1386
  return array(
@@ -1440,6 +1463,31 @@ class Antispam_Bee {
1440
  }
1441
 
1442
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1443
  /**
1444
  * Anwendung von Regexp, auch benutzerdefiniert
1445
  *
8
  Author URI: http://wpcoder.de
9
  Plugin URI: http://antispambee.com
10
  License: GPLv2 or later
11
+ Version: 2.6.4
12
  */
13
 
14
  /*
338
  * Initialisierung der internen Variablen
339
  *
340
  * @since 2.4
341
+ * @change 2.6.4
342
  */
343
 
344
  private static function _init_internal_vars()
353
  'regexp_check' => 1,
354
  'spam_ip' => 1,
355
  'already_commented' => 1,
356
+ 'time_check' => 0,
357
  'ignore_pings' => 0,
358
  'always_allowed' => 0,
359
 
386
  ),
387
  'reasons' => array(
388
  'css' => 'CSS Hack',
389
+ 'time' => 'Comment time',
390
  'empty' => 'Empty Data',
391
  'server' => 'Fake IP',
392
  'localdb' => 'Local DB Spam',
1112
  $hidden_field = self::get_key($_POST, 'comment');
1113
  $plugin_field = self::get_key($_POST, self::$_secret);
1114
 
1115
+ /* Hidden field check */
1116
+ if ( empty($hidden_field) && ! empty($plugin_field) ) {
1117
  $_POST['comment'] = $plugin_field;
1118
+ unset( $_POST[self::$_secret] );
1119
  } else {
1120
+ $_POST['ab_spam__hidden_field'] = 1;
1121
  }
1122
  }
1123
 
1229
  * ersetzt das Kommentarfeld
1230
  *
1231
  * @since 2.4
1232
+ * @change 2.6.4
1233
  *
1234
  * @param string $data HTML-Code der Webseite
1235
  * @return string Behandelter HTML-Code
1247
  return $data;
1248
  }
1249
 
1250
+ /* Build init time field */
1251
+ if ( self::get_option('time_check') ) {
1252
+ $init_time_field = sprintf(
1253
+ '<input type="hidden" name="ab_init_time" value="%d" />',
1254
+ time()
1255
+ );
1256
+ } else {
1257
+ $init_time_field = '';
1258
+ }
1259
+
1260
+ /* Inject HTML */
1261
  return preg_replace(
1262
  '#<textarea(.+?)name=["\']comment["\'](.+?)</textarea>#s',
1263
+ sprintf(
1264
+ '<textarea$1name="%s"$2</textarea><textarea name="comment" style="display:none" rows="1" cols="1"></textarea>%s',
1265
+ self::$_secret,
1266
+ $init_time_field
1267
+ ),
1268
+ $data,
1269
  1
1270
  );
1271
  }
1346
  * Prüfung den Kommentar
1347
  *
1348
  * @since 2.4
1349
+ * @change 2.6.4
1350
  *
1351
  * @param array $comment Daten des Kommentars
1352
  * @return array Array mit dem Verdachtsgrund [optional]
1391
  }
1392
 
1393
  /* Bot erkannt */
1394
+ if ( ! empty($_POST['ab_spam__hidden_field']) ) {
1395
  return array(
1396
  'reason' => 'css'
1397
  );
1398
  }
1399
 
1400
+ /* Action time */
1401
+ if ( $options['time_check'] && self::_is_shortest_time() ) {
1402
+ return array(
1403
+ 'reason' => 'time'
1404
+ );
1405
+ }
1406
+
1407
  /* BBCode Spam */
1408
  if ( $options['bbcode_check'] && self::_is_bbcode_spam($body) ) {
1409
  return array(
1463
  }
1464
 
1465
 
1466
+ /**
1467
+ * Check for comment action time
1468
+ *
1469
+ * @since 2.6.4
1470
+ * @change 2.6.4
1471
+ *
1472
+ * @return boolean TRUE if the action time is less than 5 seconds
1473
+ */
1474
+
1475
+ private static function _is_shortest_time()
1476
+ {
1477
+ /* Comment init time */
1478
+ if ( ! $init_time = (int)self::get_key($_POST, 'ab_init_time') ) {
1479
+ return false;
1480
+ }
1481
+
1482
+ /* Compare time values */
1483
+ if ( time() - $init_time < apply_filters('ab_action_time_limit', 5) ) {
1484
+ return true;
1485
+ }
1486
+
1487
+ return false;
1488
+ }
1489
+
1490
+
1491
  /**
1492
  * Anwendung von Regexp, auch benutzerdefiniert
1493
  *
inc/gui.class.php CHANGED
@@ -53,6 +53,7 @@ class Antispam_Bee_GUI extends Antispam_Bee {
53
  'regexp_check' => (int)(!empty($_POST['ab_regexp_check'])),
54
  'spam_ip' => (int)(!empty($_POST['ab_spam_ip'])),
55
  'already_commented' => (int)(!empty($_POST['ab_already_commented'])),
 
56
  'always_allowed' => (int)(!empty($_POST['ab_always_allowed'])),
57
 
58
  'ignore_pings' => (int)(!empty($_POST['ab_ignore_pings'])),
@@ -175,7 +176,7 @@ class Antispam_Bee_GUI extends Antispam_Bee {
175
  * Anzeige der GUI
176
  *
177
  * @since 0.1
178
- * @change 2.6.1
179
  */
180
 
181
  public static function options_page() { ?>
@@ -215,6 +216,14 @@ class Antispam_Bee_GUI extends Antispam_Bee {
215
  </label>
216
  </li>
217
 
 
 
 
 
 
 
 
 
218
  <li>
219
  <input type="checkbox" name="ab_bbcode_check" id="ab_bbcode_check" value="1" <?php checked($options['bbcode_check'], 1) ?> />
220
  <label for="ab_bbcode_check">
53
  'regexp_check' => (int)(!empty($_POST['ab_regexp_check'])),
54
  'spam_ip' => (int)(!empty($_POST['ab_spam_ip'])),
55
  'already_commented' => (int)(!empty($_POST['ab_already_commented'])),
56
+ 'time_check' => (int)(!empty($_POST['ab_time_check'])),
57
  'always_allowed' => (int)(!empty($_POST['ab_always_allowed'])),
58
 
59
  'ignore_pings' => (int)(!empty($_POST['ab_ignore_pings'])),
176
  * Anzeige der GUI
177
  *
178
  * @since 0.1
179
+ * @change 2.6.4
180
  */
181
 
182
  public static function options_page() { ?>
216
  </label>
217
  </li>
218
 
219
+ <li>
220
+ <input type="checkbox" name="ab_time_check" id="ab_time_check" value="1" <?php checked($options['time_check'], 1) ?> />
221
+ <label for="ab_time_check">
222
+ <?php esc_html_e('Consider the comment time', 'antispam_bee') ?>
223
+ <span><?php esc_html_e('Not recommended when using page caching', 'antispam_bee') ?></span>
224
+ </label>
225
+ </li>
226
+
227
  <li>
228
  <input type="checkbox" name="ab_bbcode_check" id="ab_bbcode_check" value="1" <?php checked($options['bbcode_check'], 1) ?> />
229
  <label for="ab_bbcode_check">
lang/antispam_bee-de_DE.mo CHANGED
Binary file
lang/antispam_bee-de_DE.po CHANGED
@@ -36,6 +36,9 @@ msgstr "Leere Daten"
36
  msgid "CSS Hack"
37
  msgstr "CSS Hack"
38
 
 
 
 
39
  msgid "Fake IP"
40
  msgstr "Gefälschte IP"
41
 
@@ -125,6 +128,12 @@ msgstr "Genehmigten Kommentatoren vertrauen"
125
  msgid "No check for already commenting users"
126
  msgstr "Keine Prüfung bereits kommentierender Nutzer"
127
 
 
 
 
 
 
 
128
  msgid "BBCode is spam"
129
  msgstr "BBCode als Spam einstufen"
130
 
36
  msgid "CSS Hack"
37
  msgstr "CSS Hack"
38
 
39
+ msgid "Comment time"
40
+ msgstr "Kommentarzeit"
41
+
42
  msgid "Fake IP"
43
  msgstr "Gefälschte IP"
44
 
128
  msgid "No check for already commenting users"
129
  msgstr "Keine Prüfung bereits kommentierender Nutzer"
130
 
131
+ msgid "Consider the comment time"
132
+ msgstr "Kommentarzeit berücksichtigen"
133
+
134
+ msgid "Not recommended when using page caching"
135
+ msgstr "Nicht empfohlen beim Caching von Blogseiten"
136
+
137
  msgid "BBCode is spam"
138
  msgstr "BBCode als Spam einstufen"
139
 
readme.txt CHANGED
@@ -104,6 +104,18 @@ Fragen rund ums Plugin werden gern per E-Mail beantwortet. Beachtet auch die [Gu
104
 
105
  == Changelog ==
106
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  = 2.6.3 =
108
 
109
  * **English**
104
 
105
  == Changelog ==
106
 
107
+ = 2.6.4 =
108
+
109
+ * **English**
110
+ * Consideration of the comment time (Spam if a comment was written in less than 5 seconds)
111
+ * *Release time investment (Development & QA): 6,25 h*
112
+
113
+ * **Deutsch**
114
+ * Berücksichtigung der Kommentarzeit (Spam, wenn ein Kommentar in unter 5 Sekunden verfasst)
115
+ * [Mehr Informationen auf Google+](https://plus.google.com/+SergejMüller/posts/73EbP6F1BgC)
116
+ * *Release-Zeitaufwand (Development & QA): 6,25 Stunden*
117
+
118
+
119
  = 2.6.3 =
120
 
121
  * **English**