Spam protection, AntiSpam, FireWall by CleanTalk - Version 3.6

Version Description

2014-09-15 = * Fixed preg_match() issue for Formidable forms and Custom contact forms. * Improved anti spam protection for Custom contact forms.

Download this release

Release Info

Developer shagimuratov
Plugin Icon 128x128 Spam protection, AntiSpam, FireWall by CleanTalk
Version 3.6
Comparing to
See all releases

Code changes from version 3.4 to 3.6

Files changed (3) hide show
  1. cleantalk-admin.php +8 -6
  2. cleantalk.php +22 -13
  3. readme.txt +9 -2
cleantalk-admin.php CHANGED
@@ -315,13 +315,15 @@ function admin_notice_message(){
315
  $show_notice = false;
316
  }
317
 
318
- if ($show_notice && !empty($show_ct_notice_online)) {
319
  echo '<div class="updated"><h3><b>';
320
- if($show_ct_notice_online === 'Y'){
321
- echo __("Please don’t forget to disable CAPTCHA if you have it!", 'cleantalk');
322
- }else{
323
- echo __("Wrong <a href=\"options-general.php?page=cleantalk\"><b style=\"color: #49C73B;\">Clean</b><b style=\"color: #349ebf;\">Talk</b> access key</a>! Please check it or ask <a target=\"_blank\" href=\"https://cleantalk.org/forum/\">support</a>.", 'cleantalk');
324
- }
 
 
325
  echo '</b></h3></div>';
326
  }
327
 
315
  $show_notice = false;
316
  }
317
 
318
+ if ($show_notice && $show_ct_notice_online != '') {
319
  echo '<div class="updated"><h3><b>';
320
+ if($show_ct_notice_online === 'Y'){
321
+ echo __("Please don’t forget to disable CAPTCHA if you have it!", 'cleantalk');
322
+ }
323
+
324
+ if($show_ct_notice_online === 'N'){
325
+ echo __("Wrong <a href=\"options-general.php?page=cleantalk\"><b style=\"color: #49C73B;\">Clean</b><b style=\"color: #349ebf;\">Talk</b> access key</a>! Please check it or ask <a target=\"_blank\" href=\"https://cleantalk.org/forum/\">support</a>.", 'cleantalk');
326
+ }
327
  echo '</b></h3></div>';
328
  }
329
 
cleantalk.php CHANGED
@@ -3,14 +3,14 @@
3
  Plugin Name: Anti-spam by CleanTalk
4
  Plugin URI: http://cleantalk.org
5
  Description: Cloud antispam for comments, registrations and contacts. The plugin doesn't use CAPTCHA, Q&A, math, counting animals or quiz to stop spam bots.
6
- Version: 3.4
7
  Author: СleanTalk <welcome@cleantalk.ru>
8
  Author URI: http://cleantalk.org
9
  */
10
 
11
  define('CLEANTALK_PLUGIN_DIR', plugin_dir_path(__FILE__));
12
 
13
- $ct_agent_version = 'wordpress-34';
14
  $ct_plugin_name = 'Anti-spam by CleanTalk';
15
  $ct_checkjs_frm = 'ct_checkjs_frm';
16
  $ct_checkjs_register_form = 'ct_checkjs_register_form';
@@ -239,10 +239,14 @@ function ct_init() {
239
  //
240
  // Load JS code to website footer for contact forms
241
  //
242
- if (!is_admin() && !(defined( 'DOING_AJAX' ) && DOING_AJAX)) {
243
  $options = get_option('cleantalk_settings');
244
  if (isset($options['general_contact_forms_test']) && $options['general_contact_forms_test'] == 1) {
245
- add_action('wp_footer', 'ct_footer_add_cookie', 1);
 
 
 
 
246
  ct_contact_form_validate();
247
  }
248
  }
@@ -653,7 +657,7 @@ function ct_frm_validate_entry ($errors, $values) {
653
  $sender_email = null;
654
  $message = '';
655
  foreach ($values['item_meta'] as $v) {
656
- if (preg_match("/^\S+@\S+\.\S+$/", $v)) {
657
  $sender_email = $v;
658
  continue;
659
  }
@@ -1726,7 +1730,7 @@ function ct_contact_form_validate () {
1726
  $message = '';
1727
  $contact_form = false;
1728
  foreach ($_POST as $k => $v) {
1729
- if ($sender_email === null && preg_match("/^\S+@\S+\.\S+$/", $v)) {
1730
  $sender_email = $v;
1731
  }
1732
  if ($sender_nickname === null && ct_get_data_from_submit($k, 'name')) {
@@ -1744,8 +1748,8 @@ function ct_contact_form_validate () {
1744
  }
1745
  }
1746
 
1747
- // Skip submision if no data found
1748
- if ((!$sender_email && $message == '' && $subject == '') || !$contact_form) {
1749
  return false;
1750
  }
1751
 
@@ -1761,11 +1765,16 @@ function ct_contact_form_validate () {
1761
 
1762
  $ct = $ct_base_call_result['ct'];
1763
  $ct_result = $ct_base_call_result['ct_result'];
1764
-
1765
  if ($ct_result->allow == 0) {
1766
- global $ct_comment;
1767
- $ct_comment = $ct_result->comment;
1768
- ct_die(null, null);
 
 
 
 
 
1769
  exit;
1770
  }
1771
 
@@ -1778,7 +1787,7 @@ function ct_contact_form_validate () {
1778
  * @return null|bool
1779
  */
1780
  function ct_get_data_from_submit($value = null, $field_name = null) {
1781
- if (!$value || !$field_name) {
1782
  return false;
1783
  }
1784
  if (preg_match("/[a-z0-9_\-]*" . $field_name. "[a-z0-9_\-]*$/", $value)) {
3
  Plugin Name: Anti-spam by CleanTalk
4
  Plugin URI: http://cleantalk.org
5
  Description: Cloud antispam for comments, registrations and contacts. The plugin doesn't use CAPTCHA, Q&A, math, counting animals or quiz to stop spam bots.
6
+ Version: 3.6
7
  Author: СleanTalk <welcome@cleantalk.ru>
8
  Author URI: http://cleantalk.org
9
  */
10
 
11
  define('CLEANTALK_PLUGIN_DIR', plugin_dir_path(__FILE__));
12
 
13
+ $ct_agent_version = 'wordpress-36';
14
  $ct_plugin_name = 'Anti-spam by CleanTalk';
15
  $ct_checkjs_frm = 'ct_checkjs_frm';
16
  $ct_checkjs_register_form = 'ct_checkjs_register_form';
239
  //
240
  // Load JS code to website footer for contact forms
241
  //
242
+ if (ct_is_user_enable()) {
243
  $options = get_option('cleantalk_settings');
244
  if (isset($options['general_contact_forms_test']) && $options['general_contact_forms_test'] == 1) {
245
+
246
+ if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)) {
247
+ add_action('wp_footer', 'ct_footer_add_cookie', 1);
248
+ }
249
+
250
  ct_contact_form_validate();
251
  }
252
  }
657
  $sender_email = null;
658
  $message = '';
659
  foreach ($values['item_meta'] as $v) {
660
+ if (isset($v) && is_string($v) && preg_match("/^\S+@\S+\.\S+$/", $v)) {
661
  $sender_email = $v;
662
  continue;
663
  }
1730
  $message = '';
1731
  $contact_form = false;
1732
  foreach ($_POST as $k => $v) {
1733
+ if ($sender_email === null && isset($v) && is_string($v) && preg_match("/^\S+@\S+\.\S+$/", $v)) {
1734
  $sender_email = $v;
1735
  }
1736
  if ($sender_nickname === null && ct_get_data_from_submit($k, 'name')) {
1748
  }
1749
  }
1750
 
1751
+ // Skip submission if no data found
1752
+ if (!$sender_email || !$contact_form) {
1753
  return false;
1754
  }
1755
 
1765
 
1766
  $ct = $ct_base_call_result['ct'];
1767
  $ct_result = $ct_base_call_result['ct_result'];
1768
+
1769
  if ($ct_result->allow == 0) {
1770
+
1771
+ if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)) {
1772
+ global $ct_comment;
1773
+ $ct_comment = $ct_result->comment;
1774
+ ct_die(null, null);
1775
+ } else {
1776
+ echo $ct_result->comment;
1777
+ }
1778
  exit;
1779
  }
1780
 
1787
  * @return null|bool
1788
  */
1789
  function ct_get_data_from_submit($value = null, $field_name = null) {
1790
+ if (!$value || !$field_name || !is_string($value)) {
1791
  return false;
1792
  }
1793
  if (preg_match("/[a-z0-9_\-]*" . $field_name. "[a-z0-9_\-]*$/", $value)) {
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === Anti-spam by CleanTalk (no CAPTCHA) ===
2
  Contributors: znaeff, shagimuratov
3
- Tags: antispam, anti-spam, anti spam, spam, spammers, captcha, comments, registration, contact form, blacklist, math, signup, formidable, bot, spam bots, spammy, s2member, wordpress, support, BuddyPress, bbpress, landing pages, fast secure contact form, WooCommerce, jetpack, cf7
4
  Requires at least: 3.0
5
  Tested up to: 4.0
6
- Stable tag: 3.4
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -151,6 +151,10 @@ WordPress 3.0 at least. PHP 4, 5 with CURL or file_get_contents() function and e
151
  1. Anti spam stopped spam bot at the CAPTCHA less registration form.
152
 
153
  == Changelog ==
 
 
 
 
154
  = 3.4 2014-09-04 =
155
  * We've added anti spam for themes contact forms and any untested contact forms plugins. To use this test enable option "Custom contact forms" in plugin settings.
156
  * We've added auto rotation for spam comments. Now the plugin removes comments in SPAM folder older then 15 days. This option is enabled by default.
@@ -389,6 +393,9 @@ WordPress 3.0 at least. PHP 4, 5 with CURL or file_get_contents() function and e
389
  * First version
390
 
391
  == Upgrade Notice ==
 
 
 
392
  = 3.4 2014-09-04 =
393
  Spam comments rotation. Custom (themes) contact forms support.
394
 
1
  === Anti-spam by CleanTalk (no CAPTCHA) ===
2
  Contributors: znaeff, shagimuratov
3
+ Tags: antispam, anti-spam, anti spam, spam, spammers, captcha, comments, registration, contact form, blacklist, math, signup, formidable, bot, spam bots, spammy, s2member, wordpress, support, BuddyPress, bbpress, landing pages, fast secure contact form, WooCommerce, jetpack, cf7, form
4
  Requires at least: 3.0
5
  Tested up to: 4.0
6
+ Stable tag: 3.6
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
151
  1. Anti spam stopped spam bot at the CAPTCHA less registration form.
152
 
153
  == Changelog ==
154
+ = 3.6 2014-09-15 =
155
+ * Fixed preg_match() issue for Formidable forms and Custom contact forms.
156
+ * Improved anti spam protection for Custom contact forms.
157
+
158
  = 3.4 2014-09-04 =
159
  * We've added anti spam for themes contact forms and any untested contact forms plugins. To use this test enable option "Custom contact forms" in plugin settings.
160
  * We've added auto rotation for spam comments. Now the plugin removes comments in SPAM folder older then 15 days. This option is enabled by default.
393
  * First version
394
 
395
  == Upgrade Notice ==
396
+ = 3.6 2014-09-15 =
397
+ Minor fixes in anti spam protection for Formidable and custom contact forms.
398
+
399
  = 3.4 2014-09-04 =
400
  Spam comments rotation. Custom (themes) contact forms support.
401