Anti-spam - Version 4.3

Version Description

  • 2016-11-22 =
  • fix notices
Download this release

Release Info

Developer webvitaly
Plugin Icon 128x128 Anti-spam
Version 4.3
Comparing to
See all releases

Code changes from version 4.2 to 4.3

anti-spam-info.php CHANGED
@@ -8,10 +8,10 @@ function antispam_admin_notice() {
8
  $user_id = get_current_user_id();
9
  $antispam_info_visibility = get_user_meta($user_id, 'antispam_info_visibility', true);
10
  if ($antispam_info_visibility == 1 OR $antispam_info_visibility == ''):
 
11
  $antispam_stats = get_option('antispam_stats', array());
12
- $blocked_total = $antispam_stats['blocked_total'];
13
- if(empty($blocked_total)){
14
- $blocked_total = 0;
15
  }
16
  ?>
17
  <div class="update-nag antispam-panel-info">
8
  $user_id = get_current_user_id();
9
  $antispam_info_visibility = get_user_meta($user_id, 'antispam_info_visibility', true);
10
  if ($antispam_info_visibility == 1 OR $antispam_info_visibility == ''):
11
+ $blocked_total = 0; // show 0 by default
12
  $antispam_stats = get_option('antispam_stats', array());
13
+ if (isset($antispam_stats['blocked_total'])) {
14
+ $blocked_total = $antispam_stats['blocked_total'];
 
15
  }
16
  ?>
17
  <div class="update-nag antispam-panel-info">
anti-spam.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Anti-spam
4
  Plugin URI: http://wordpress.org/plugins/anti-spam/
5
  Description: No spam in comments. No captcha.
6
- Version: 4.2
7
  Author: webvitaly
8
  Text Domain: anti-spam
9
  Author URI: http://web-profile.com.ua/wordpress/plugins/
@@ -20,7 +20,7 @@ $antispam_allow_trackbacks = false; // if true, than trackbacks will be allowed
20
  // trackbacks almost not used by users, but mostly used by spammers; pingbacks are always enabled
21
  // more about the difference between trackback and pingback - http://web-profile.com.ua/web/trackback-vs-pingback/
22
 
23
- define('ANTISPAM_PLUGIN_VERSION', '4.2');
24
 
25
  $antispam_settings = array(
26
  'send_spam_comment_to_admin' => $antispam_send_spam_comment_to_admin,
@@ -35,7 +35,7 @@ include('anti-spam-info.php');
35
 
36
  function antispam_enqueue_script() {
37
  if (is_singular() && comments_open()) { // load script only for pages with comments form
38
- wp_enqueue_script('anti-spam-script', plugins_url('/js/anti-spam-4.2.js', __FILE__), null, null, true);
39
  }
40
  }
41
  add_action('wp_enqueue_scripts', 'antispam_enqueue_script');
@@ -104,21 +104,34 @@ function antispam_check_comment($commentdata) {
104
 
105
  if ( ! is_user_logged_in() && $comment_type != 'pingback' && $comment_type != 'trackback') { // logged in user is not a spammer
106
  $spam_flag = false;
107
-
108
- if ( trim($_POST['antspm-q']) != date('Y') ) { // year-answer is wrong - it is spam
109
- if ( trim($_POST['antspm-d']) != date('Y') ) { // extra js-only check: there is no js added input - it is spam
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  $spam_flag = true;
111
- if (empty($_POST['antspm-q'])) { // empty answer - it is spam
112
- $antispam_error_message .= 'Error: empty answer. ['.esc_attr( $_POST['antspm-q'] ).']<br> '.$rn;
113
  } else {
114
- $antispam_error_message .= 'Error: answer is wrong. ['.esc_attr( $_POST['antspm-q'] ).']<br> '.$rn;
115
  }
116
  }
117
  }
118
 
119
- if ( ! empty($_POST['antspm-e-email-url-website'])) { // trap field is not empty - it is spam
120
  $spam_flag = true;
121
- $antispam_error_message .= 'Error: field should be empty. ['.esc_attr( $_POST['antspm-e-email-url-website'] ).']<br> '.$rn;
122
  }
123
 
124
  if ($spam_flag) { // it is spam
3
  Plugin Name: Anti-spam
4
  Plugin URI: http://wordpress.org/plugins/anti-spam/
5
  Description: No spam in comments. No captcha.
6
+ Version: 4.3
7
  Author: webvitaly
8
  Text Domain: anti-spam
9
  Author URI: http://web-profile.com.ua/wordpress/plugins/
20
  // trackbacks almost not used by users, but mostly used by spammers; pingbacks are always enabled
21
  // more about the difference between trackback and pingback - http://web-profile.com.ua/web/trackback-vs-pingback/
22
 
23
+ define('ANTISPAM_PLUGIN_VERSION', '4.3');
24
 
25
  $antispam_settings = array(
26
  'send_spam_comment_to_admin' => $antispam_send_spam_comment_to_admin,
35
 
36
  function antispam_enqueue_script() {
37
  if (is_singular() && comments_open()) { // load script only for pages with comments form
38
+ wp_enqueue_script('anti-spam-script', plugins_url('/js/anti-spam-4.3.js', __FILE__), null, null, true);
39
  }
40
  }
41
  add_action('wp_enqueue_scripts', 'antispam_enqueue_script');
104
 
105
  if ( ! is_user_logged_in() && $comment_type != 'pingback' && $comment_type != 'trackback') { // logged in user is not a spammer
106
  $spam_flag = false;
107
+
108
+ $antspm_q = '';
109
+ if (isset($_POST['antspm-q'])) {
110
+ $antspm_q = trim($_POST['antspm-q']);
111
+ }
112
+ $antspm_d = '';
113
+ if (isset($_POST['antspm-d'])) {
114
+ $antspm_d = trim($_POST['antspm-d']);
115
+ }
116
+ $antspm_e = '';
117
+ if (isset($_POST['antspm-e-email-url-website'])) {
118
+ $antspm_e = trim($_POST['antspm-e-email-url-website']);
119
+ }
120
+
121
+ if ( $antspm_q != date('Y') ) { // year-answer is wrong - it is spam
122
+ if ( $antspm_d != date('Y') ) { // extra js-only check: there is no js added input - it is spam
123
  $spam_flag = true;
124
+ if (empty($antspm_q)) { // empty answer - it is spam
125
+ $antispam_error_message .= 'Error: empty answer. ['.esc_attr( $antspm_q ).']<br> '.$rn;
126
  } else {
127
+ $antispam_error_message .= 'Error: answer is wrong. ['.esc_attr( $antspm_q ).']<br> '.$rn;
128
  }
129
  }
130
  }
131
 
132
+ if ( ! empty($antspm_e)) { // trap field is not empty - it is spam
133
  $spam_flag = true;
134
+ $antispam_error_message .= 'Error: field should be empty. ['.esc_attr( $antspm_e ).']<br> '.$rn;
135
  }
136
 
137
  if ($spam_flag) { // it is spam
js/{anti-spam-4.2.js → anti-spam-4.3.js} RENAMED
File without changes
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: webvitaly
3
  Donate link: http://web-profile.com.ua/donate/
4
  Tags: spam, spammer, comment, comments, comment-spam, antispam, anti-spam, block-spam, spam-free, spambot, spam-bot, bot
5
  Requires at least: 3.3
6
- Tested up to: 4.7
7
- Stable tag: 4.2
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl.html
10
 
@@ -135,6 +135,10 @@ The plugin is pretty small and easy to read.
135
 
136
  == Changelog ==
137
 
 
 
 
 
138
  = 4.2 - 2016-01-30 =
139
  * removed XSS vulnerability - thanks to Kenan from [tbmnull.com](http://tbmnull.com/)
140
 
3
  Donate link: http://web-profile.com.ua/donate/
4
  Tags: spam, spammer, comment, comments, comment-spam, antispam, anti-spam, block-spam, spam-free, spambot, spam-bot, bot
5
  Requires at least: 3.3
6
+ Tested up to: 4.9
7
+ Stable tag: 4.3
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl.html
10
 
135
 
136
  == Changelog ==
137
 
138
+
139
+ = 4.3 - 2016-11-22 =
140
+ * fix notices
141
+
142
  = 4.2 - 2016-01-30 =
143
  * removed XSS vulnerability - thanks to Kenan from [tbmnull.com](http://tbmnull.com/)
144