Spam protection, AntiSpam, FireWall by CleanTalk - Version 5.25.1

Version Description

2015-09-28 = * Added widget with anti-spam statistics * Added information about blocked spam attacks in admin dashboard and CleanTalk settings * Added ability not to check comments for users with 3 or above allowed comments * Added an option 'Help others known CleanTalk' to show information for site visitors, that your site is protected from spam by us * Some backend interface settings

Download this release

Release Info

Developer Vlad Cleantalk
Plugin Icon 128x128 Spam protection, AntiSpam, FireWall by CleanTalk
Version 5.25.1
Comparing to
See all releases

Code changes from version 5.24.1 to 5.25.1

cleantalk-admin.js CHANGED
@@ -17,6 +17,32 @@ jQuery(document).ready(function(){
17
  //
18
  }
19
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  ct_adv_settings=jQuery('#cleantalk_registrations_test1').parent().parent().parent().parent();
21
  ct_adv_settings.hide();
22
  ct_adv_settings_title=ct_adv_settings.prev();
17
  //
18
  }
19
  });
20
+
21
+ if(cleantalk_good_key)
22
+ {
23
+ jQuery('.form-table').first().hide();
24
+
25
+ banner_html="<div id='ct_stats_banner'>"+cleantalk_blocked_message;
26
+ banner_html+=cleantalk_statistics_link+'</div>';
27
+ jQuery('.form-table').first().before(banner_html);
28
+ jQuery('.form-table').first().before("<br /><a href='#' style='font-size:10pt;' id='cleantalk_access_key_link'>Show the access key</a>");
29
+ }
30
+
31
+ jQuery('#cleantalk_access_key_link').click(function(){
32
+ if(jQuery('.form-table').first().is(":visible"))
33
+ {
34
+ jQuery('.form-table').first().hide();
35
+ }
36
+ else
37
+ {
38
+ jQuery('.form-table').first().show();
39
+ }
40
+ });
41
+
42
+ jQuery('#cleantalk_registrations_test1').parent().parent().hide();
43
+ jQuery('#cleantalk_comments_test1').parent().parent().hide();
44
+ jQuery('#cleantalk_contact_forms_test1').parent().parent().hide();
45
+
46
  ct_adv_settings=jQuery('#cleantalk_registrations_test1').parent().parent().parent().parent();
47
  ct_adv_settings.hide();
48
  ct_adv_settings_title=ct_adv_settings.prev();
cleantalk-admin.php CHANGED
@@ -4,6 +4,27 @@ $ct_plugin_basename = 'cleantalk-spam-protect/cleantalk.php';
4
  $ct_options=ct_get_options();
5
  $ct_data=ct_get_data();
6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  if(isset($_GET['close_notice']))
8
  {
9
  global $ct_data, $pagenow;
@@ -14,8 +35,6 @@ if(isset($_GET['close_notice']))
14
  header("Location: $pagenow?".$_SERVER["QUERY_STRING"]);
15
  }
16
 
17
- require_once('cleantalk.class.php');
18
-
19
  // Timeout to get app server
20
  $ct_server_timeout = 10;
21
 
@@ -83,25 +102,25 @@ function ct_admin_init() {
83
  {
84
  $ct_data['current_version']=$cleantalk_plugin_version;
85
  update_option('cleantalk_data', $ct_data);
86
- $ct_base_call_result = ct_base_call(array(
87
  'message' => 'CleanTalk setup test',
88
  'example' => null,
89
  'sender_email' => 'good@cleantalk.org',
90
  'sender_nickname' => 'CleanTalk',
91
  'post_info' => '',
92
  'checkjs' => 1
93
- ));
94
  }
95
  if(isset($_POST['option_page'])&&$_POST['option_page']=='cleantalk_settings')
96
  {
97
- $ct_base_call_result = ct_base_call(array(
98
  'message' => 'CleanTalk setup test',
99
  'example' => null,
100
  'sender_email' => 'good@cleantalk.org',
101
  'sender_nickname' => 'CleanTalk',
102
  'post_info' => '',
103
  'checkjs' => 1
104
- ));
105
  }
106
 
107
  $show_ct_notice_trial = false;
@@ -130,6 +149,11 @@ function ct_admin_init() {
130
  $website = parse_url(get_option('siteurl'),PHP_URL_HOST);
131
  $platform = 'wordpress';
132
 
 
 
 
 
 
133
  $result = getAutoKey($email, $website, $platform);
134
 
135
  if ($result)
@@ -151,14 +175,14 @@ function ct_admin_init() {
151
  $_POST['cleantalk_settings']['apikey'] = $result['auth_key'];
152
  $ct_options['apikey']=$result['auth_key'];
153
  update_option('cleantalk_settings', $ct_options);
154
- $ct_base_call_result = ct_base_call(array(
155
  'message' => 'CleanTalk setup test',
156
  'example' => null,
157
  'sender_email' => 'good@cleantalk.org',
158
  'sender_nickname' => 'CleanTalk',
159
  'post_info' => '',
160
  'checkjs' => 1
161
- ));
162
  } else {
163
  setcookie($ct_notice_autokey_label, (string) base64_encode($result['error_message']), 0, '/');
164
  }
@@ -171,6 +195,10 @@ function ct_admin_init() {
171
  isset($_POST['option_page'])&&$_POST['option_page']=='cleantalk_settings'&&$ct_options['apikey']!=$_POST['cleantalk_settings']['apikey']) {
172
  $result = false;
173
  if (function_exists('curl_init') && function_exists('json_decode') && ct_valid_key($ct_options['apikey'])) {
 
 
 
 
174
  if(@isset($_POST['cleantalk_settings']['apikey']))
175
  {
176
  $result=noticePaidTill($_POST['cleantalk_settings']['apikey']);
@@ -184,7 +212,11 @@ function ct_admin_init() {
184
  $result = json_decode($result, true);
185
  if (isset($result['data']) && is_array($result['data'])) {
186
  $result = $result['data'];
187
- }
 
 
 
 
188
 
189
  if (isset($result['show_notice'])) {
190
  if ($result['show_notice'] == 1 && isset($result['trial']) && $result['trial'] == 1) {
@@ -230,64 +262,84 @@ function ct_admin_init() {
230
  }
231
  }
232
 
233
- ct_init_session();
234
 
235
- if(isset($ct_data['testing_failed'])&&$ct_data['testing_failed']==1)
236
- {
237
- $buttons_html='
238
- <style type="text/css">
239
- #ct_button_check_comments, #ct_button_check_users {background: #999999;}
240
-
241
- ';
242
- }
243
- else
244
  {
245
- $buttons_html='
246
- <style type="text/css">
247
- #ct_button_check_comments, #ct_button_check_users {background: #69dd69;}
248
-
249
- ';
250
- }
251
-
252
- $buttons_html.='
253
- #ct_button_check_comments, #ct_button_check_users {padding: 10px; color: #fff; border:0 none;
254
- cursor:pointer;
255
- -webkit-border-radius: 5px;
256
- border-radius: 5px;
257
- font-size: 12pt;
258
- text-decoration:none;
259
- margin-bottom:5px;
260
- display:inline-block;
261
- }
262
- </style>';
263
- if(isset($ct_data['testing_failed'])&&$ct_data['testing_failed']==1)
264
- {
265
- $buttons_html.='<a href="#" id="ct_button_check_comments" onclick="alert('."'".__('Feature is disabled, because testing of access key is failed!', 'cleantalk')."'".')">'.__('Check comments', 'cleantalk').'</a>
266
- <a href="#" id="ct_button_check_users" onclick="alert('."'".__('Feature is disabled, because testing of access key is failed!', 'cleantalk')."'".')">'.__('Check users', 'cleantalk').'</a><div class="clear"></div>';
267
- }
268
- else
269
- {
270
- $buttons_html.='<a href="edit-comments.php?page=ct_check_spam&do_check=1" id="ct_button_check_comments">'.__('Check comments', 'cleantalk').'</a>
271
- <a href="users.php?page=ct_check_users&do_check=1" id="ct_button_check_users">'.__('Check users', 'cleantalk').'</a><div class="clear"></div>';
272
- }
273
-
274
- register_setting('cleantalk_settings', 'cleantalk_settings', 'ct_settings_validate');
275
- add_settings_section('cleantalk_settings_main', __($ct_plugin_name, 'cleantalk'), 'ct_section_settings_main', 'cleantalk');
276
- add_settings_section('cleantalk_settings_state', "<hr>".__('Protection is active for:', 'cleantalk'), 'ct_section_settings_state', 'cleantalk');
277
- //add_settings_section('cleantalk_settings_autodel', "<hr>", 'ct_section_settings_autodel', 'cleantalk');
278
- add_settings_section('cleantalk_settings_anti_spam', "<hr>Check existing comments and users <br /><br />$buttons_html<hr></h3><a href='#' style='text-decoration:underline;font-size:14px;'>".__('Advanced settings', 'cleantalk')."</a>", 'ct_section_settings_anti_spam', 'cleantalk');
279
- add_settings_field('cleantalk_apikey', __('Access key', 'cleantalk'), 'ct_input_apikey', 'cleantalk', 'cleantalk_settings_main');
280
- add_settings_field('cleantalk_remove_old_spam', __('Automatically delete spam comments', 'cleantalk'), 'ct_input_remove_old_spam', 'cleantalk', 'cleantalk_settings_anti_spam');
281
 
282
- add_settings_field('cleantalk_registrations_test', __('Registration forms', 'cleantalk'), 'ct_input_registrations_test', 'cleantalk', 'cleantalk_settings_anti_spam');
283
- add_settings_field('cleantalk_comments_test', __('Comments form', 'cleantalk'), 'ct_input_comments_test', 'cleantalk', 'cleantalk_settings_anti_spam');
284
- add_settings_field('cleantalk_contact_forms_test', __('Contact forms', 'cleantalk'), 'ct_input_contact_forms_test', 'cleantalk', 'cleantalk_settings_anti_spam');
285
- add_settings_field('cleantalk_general_contact_forms_test', __('Custom contact forms', 'cleantalk'), 'ct_input_general_contact_forms_test', 'cleantalk', 'cleantalk_settings_anti_spam');
286
- add_settings_field('cleantalk_general_postdata_test', __('Check all post data', 'cleantalk'), 'ct_input_general_postdata_test', 'cleantalk', 'cleantalk_settings_anti_spam');
287
- add_settings_field('cleantalk_show_adminbar', __('Show statistics in admin bar', 'cleantalk'), 'ct_input_show_adminbar', 'cleantalk', 'cleantalk_settings_anti_spam');
288
- add_settings_field('cleantalk_use_ajax', __('Use AJAX for JavaScript check', 'cleantalk'), 'ct_input_use_ajax', 'cleantalk', 'cleantalk_settings_anti_spam');
289
- add_settings_field('cleantalk_check_external', __('Protect external forms', 'cleantalk'), 'ct_input_check_external', 'cleantalk', 'cleantalk_settings_anti_spam');
290
- //add_settings_field('cleantalk_show_link', __('Show link to CleanTalk on comment forms', 'cleantalk'), 'ct_input_show_link', 'cleantalk', 'cleantalk_settings_anti_spam');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
291
  }
292
 
293
  /**
@@ -437,13 +489,35 @@ function ct_input_apikey() {
437
  $ct_options=ct_get_options();
438
  $ct_data=ct_get_data();
439
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
440
  echo "<script src='".plugins_url( 'cleantalk-admin.js', __FILE__ )."'></script>\n";
441
 
442
  $value = $ct_options['apikey'];
443
  $def_value = '';
444
  echo "<input id='cleantalk_apikey' name='cleantalk_settings[apikey]' size='20' type='text' value='$value' style=\"font-size: 14pt;\"/>";
445
  if (ct_valid_key($value) === false) {
446
-
447
  echo "<a target='__blank' style='margin-left: 10px' href='https://cleantalk.org/register?platform=wordpress&email=".urlencode(get_option('admin_email'))."&website=".urlencode(parse_url(get_option('siteurl'),PHP_URL_HOST))."'>".__('Click here to get access key manually', 'cleantalk')."</a>";
448
  if (function_exists('curl_init') && function_exists('json_decode')) {
449
  echo '<br /><br /><input name="get_apikey_auto" type="submit" value="' . __('Get access key automatically', 'cleantalk') . '" />';
@@ -451,10 +525,11 @@ function ct_input_apikey() {
451
  admin_addDescriptionsFields(sprintf('<a target="__blank" style="color:#BBB;" href="https://cleantalk.org/publicoffer">%s</a>', __('License agreement', 'cleantalk')));
452
  }
453
  } else {
 
454
  if (isset($_COOKIE[$ct_notice_online_label]) && $_COOKIE[$ct_notice_online_label] > 0) {
455
  //echo '&nbsp;&nbsp;<span style="text-decoration: underline;">The key accepted!</span>&nbsp;';
456
  }
457
- echo "<br /><br /><a target='__blank' href='https://cleantalk.org/my?user_token=".@$ct_data['user_token']."'>".__('Click here to get anti-spam statistics', 'cleantalk')."</a>";
458
  }
459
  }
460
 
@@ -611,6 +686,66 @@ function ct_input_use_ajax() {
611
  @admin_addDescriptionsFields(sprintf(__('', 'cleantalk'), $ct_options['use_ajax']));
612
  }
613
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
614
  function ct_input_check_external() {
615
  global $ct_options, $ct_data;
616
 
@@ -645,10 +780,46 @@ function ct_input_show_link() {
645
  {
646
  $value=0;
647
  }
648
- echo "<input type='radio' id='cleantalk_show_link1' name='cleantalk_settings[show_link]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_show_link1'> " . __('Yes') . "</label>";
 
649
  echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
650
- echo "<input type='radio' id='cleantalk_show_link0' name='cleantalk_settings[show_link]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_show_link0'> " . __('No') . "</label>";
 
 
 
651
  @admin_addDescriptionsFields(sprintf(__("Place a small link under comments form, it lets know what's anti-spam tool protects your site", 'cleantalk'), $ct_options['show_link']));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
652
  }
653
 
654
 
@@ -692,7 +863,7 @@ input[type=submit] {padding: 10px; background: #3399FF; color: #fff; border:0 no
692
  <br />
693
  <div>
694
  <?php echo __('Plugin Homepage at', 'cleantalk'); ?> <a href="http://cleantalk.org" target="_blank">cleantalk.org</a>.<br />
695
- <?php echo __('Tech support CleanTalk:', 'cleantalk'); ?> <a href="https://cleantalk.org/forum/viewforum.php?f=25" target="_blank"><?php echo __('CleanTalk tech forum', 'cleantalk'); ?></a>.<br />
696
  </div>
697
  <?php
698
  }
@@ -701,7 +872,7 @@ input[type=submit] {padding: 10px; background: #3399FF; color: #fff; border:0 no
701
  * Notice blog owner if plugin is used without Access key
702
  * @return bool
703
  */
704
- function admin_notice_message(){
705
  global $show_ct_notice_trial, $show_ct_notice_renew, $show_ct_notice_online, $show_ct_notice_autokey, $ct_notice_autokey_value, $ct_plugin_name, $ct_options, $ct_data;
706
 
707
  $ct_options = ct_get_options();
@@ -953,19 +1124,25 @@ function ct_update_option($option_name) {
953
  return;
954
  }
955
 
956
- $ct_base_call_result = ct_base_call(array(
957
  'message' => 'CleanTalk setup test',
958
  'example' => null,
959
  'sender_email' => 'good@cleantalk.org',
960
  'sender_nickname' => 'CleanTalk',
961
  'post_info' => '',
962
  'checkjs' => 1
963
- ));
964
 
965
  $key_valid = true;
966
  $app_server_error = false;
967
  $ct_data['testing_failed']=0;
968
 
 
 
 
 
 
 
969
  $request=Array();
970
  $request['method_name'] = 'notice_validate_key';
971
  $request['auth_key'] = $api_key;
4
  $ct_options=ct_get_options();
5
  $ct_data=ct_get_data();
6
 
7
+ add_filter( 'activity_box_end', 'cleantalk_custom_glance_items', 10, 1 );
8
+ function cleantalk_custom_glance_items( )
9
+ {
10
+ global $ct_data;
11
+ $ct_data=ct_get_data();
12
+ if(!isset($ct_data['admin_blocked']))
13
+ {
14
+ $blocked=0;
15
+ }
16
+ else
17
+ {
18
+ $blocked=$ct_data['admin_blocked'];
19
+ }
20
+ if($blocked>0)
21
+ {
22
+ $blocked = number_format($blocked, 0, ',', ' ');
23
+ print "<div style='height:24px;width:100%;display:table-cell; vertical-align:middle;'><img src='" . plugin_dir_url(__FILE__) . "inc/images/logo_color.png' style='margin-right:1em;vertical-align:middle;'/><span><a href='options-general.php?page=cleantalk'>CleanTalk</a> has blocked $blocked spam.</span></div>";
24
+ }
25
+ }
26
+
27
+
28
  if(isset($_GET['close_notice']))
29
  {
30
  global $ct_data, $pagenow;
35
  header("Location: $pagenow?".$_SERVER["QUERY_STRING"]);
36
  }
37
 
 
 
38
  // Timeout to get app server
39
  $ct_server_timeout = 10;
40
 
102
  {
103
  $ct_data['current_version']=$cleantalk_plugin_version;
104
  update_option('cleantalk_data', $ct_data);
105
+ /*$ct_base_call_result = ct_base_call(array(
106
  'message' => 'CleanTalk setup test',
107
  'example' => null,
108
  'sender_email' => 'good@cleantalk.org',
109
  'sender_nickname' => 'CleanTalk',
110
  'post_info' => '',
111
  'checkjs' => 1
112
+ ));*/
113
  }
114
  if(isset($_POST['option_page'])&&$_POST['option_page']=='cleantalk_settings')
115
  {
116
+ /*$ct_base_call_result = ct_base_call(array(
117
  'message' => 'CleanTalk setup test',
118
  'example' => null,
119
  'sender_email' => 'good@cleantalk.org',
120
  'sender_nickname' => 'CleanTalk',
121
  'post_info' => '',
122
  'checkjs' => 1
123
+ ));*/
124
  }
125
 
126
  $show_ct_notice_trial = false;
149
  $website = parse_url(get_option('siteurl'),PHP_URL_HOST);
150
  $platform = 'wordpress';
151
 
152
+ if(!function_exists('getAutoKey'))
153
+ {
154
+ require_once('cleantalk.class.php');
155
+ }
156
+
157
  $result = getAutoKey($email, $website, $platform);
158
 
159
  if ($result)
175
  $_POST['cleantalk_settings']['apikey'] = $result['auth_key'];
176
  $ct_options['apikey']=$result['auth_key'];
177
  update_option('cleantalk_settings', $ct_options);
178
+ /*$ct_base_call_result = ct_base_call(array(
179
  'message' => 'CleanTalk setup test',
180
  'example' => null,
181
  'sender_email' => 'good@cleantalk.org',
182
  'sender_nickname' => 'CleanTalk',
183
  'post_info' => '',
184
  'checkjs' => 1
185
+ )); */
186
  } else {
187
  setcookie($ct_notice_autokey_label, (string) base64_encode($result['error_message']), 0, '/');
188
  }
195
  isset($_POST['option_page'])&&$_POST['option_page']=='cleantalk_settings'&&$ct_options['apikey']!=$_POST['cleantalk_settings']['apikey']) {
196
  $result = false;
197
  if (function_exists('curl_init') && function_exists('json_decode') && ct_valid_key($ct_options['apikey'])) {
198
+ if(!function_exists('noticePaidTill'))
199
+ {
200
+ require_once('cleantalk.class.php');
201
+ }
202
  if(@isset($_POST['cleantalk_settings']['apikey']))
203
  {
204
  $result=noticePaidTill($_POST['cleantalk_settings']['apikey']);
212
  $result = json_decode($result, true);
213
  if (isset($result['data']) && is_array($result['data'])) {
214
  $result = $result['data'];
215
+ }
216
+ if(isset($result['spam_count']))
217
+ {
218
+ $ct_data['admin_blocked']=$result['spam_count'];
219
+ }
220
 
221
  if (isset($result['show_notice'])) {
222
  if ($result['show_notice'] == 1 && isset($result['trial']) && $result['trial'] == 1) {
262
  }
263
  }
264
 
265
+ //ct_init_session();
266
 
267
+ if(stripos($_SERVER['REQUEST_URI'],'options.php')!==false || stripos($_SERVER['REQUEST_URI'],'options-general.php')!==false)
 
 
 
 
 
 
 
 
268
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
269
 
270
+ if(isset($ct_data['testing_failed'])&&$ct_data['testing_failed']==1)
271
+ {
272
+ $buttons_html='
273
+ <style type="text/css">
274
+ #ct_button_check_comments, #ct_button_check_users {background: #999999;}
275
+
276
+ ';
277
+ }
278
+ else
279
+ {
280
+ $buttons_html='
281
+ <style type="text/css">
282
+ #ct_button_check_comments, #ct_button_check_users {background: #69dd69;}
283
+
284
+ ';
285
+ }
286
+
287
+ $buttons_html.='
288
+ #ct_button_check_comments, #ct_button_check_users {padding: 10px; color: #fff; border:0 none;
289
+ cursor:pointer;
290
+ -webkit-border-radius: 5px;
291
+ border-radius: 5px;
292
+ font-size: 12pt;
293
+ text-decoration:none;
294
+ margin-bottom:5px;
295
+ display:inline-block;
296
+ }
297
+
298
+ #ct_stats_banner
299
+ {
300
+ padding: 0px;
301
+ color: #000;
302
+ /*border:2px solid #e5e5e5;*/
303
+ font-size: 10pt;
304
+ text-decoration:none;
305
+ margin-bottom:5px;
306
+ display:inline-block;
307
+ }
308
+ </style>';
309
+ if(isset($ct_data['testing_failed'])&&$ct_data['testing_failed']==1)
310
+ {
311
+ $buttons_html.='<a href="#" id="ct_button_check_comments" onclick="alert('."'".__('Feature is disabled, because testing of access key is failed!', 'cleantalk')."'".')">'.__('Check comments', 'cleantalk').'</a>
312
+ <a href="#" id="ct_button_check_users" onclick="alert('."'".__('Feature is disabled, because testing of access key is failed!', 'cleantalk')."'".')">'.__('Check users', 'cleantalk').'</a><div class="clear"></div>';
313
+ }
314
+ else
315
+ {
316
+ $buttons_html.='<a href="edit-comments.php?page=ct_check_spam&do_check=1" style="font-size:10pt;font-weight:400;">'.__('Check comments', 'cleantalk').'</a><br />
317
+ <a href="users.php?page=ct_check_users&do_check=1" style="font-size:10pt;font-weight:400;">'.__('Check users', 'cleantalk').'</a><div class="clear"></div>';
318
+ }
319
+
320
+ register_setting('cleantalk_settings', 'cleantalk_settings', 'ct_settings_validate');
321
+ add_settings_section('cleantalk_settings_main', __($ct_plugin_name, 'cleantalk'), 'ct_section_settings_main', 'cleantalk');
322
+ add_settings_section('cleantalk_settings_state', "<hr>".__('Protection is active', 'cleantalk'), 'ct_section_settings_state', 'cleantalk');
323
+ //add_settings_section('cleantalk_settings_autodel', "<hr>", 'ct_section_settings_autodel', 'cleantalk');
324
+ add_settings_section('cleantalk_settings_banner', "<hr>Check existing comments and users <br /><br />$buttons_html<hr></h3>", '', 'cleantalk');
325
+ add_settings_section('cleantalk_settings_anti_spam', "<a href='#' style='text-decoration:underline;font-size:10pt;font-weight:400;'>".__('Advanced settings', 'cleantalk')."</a>", 'ct_section_settings_anti_spam', 'cleantalk');
326
+
327
+ add_settings_field('cleantalk_apikey', __('Access key', 'cleantalk'), 'ct_input_apikey', 'cleantalk', 'cleantalk_settings_main');
328
+ add_settings_field('cleantalk_remove_old_spam', __('Automatically delete spam comments', 'cleantalk'), 'ct_input_remove_old_spam', 'cleantalk', 'cleantalk_settings_anti_spam');
329
+
330
+ add_settings_field('cleantalk_registrations_test', __('Registration forms', 'cleantalk'), 'ct_input_registrations_test', 'cleantalk', 'cleantalk_settings_anti_spam');
331
+ add_settings_field('cleantalk_comments_test', __('Comments form', 'cleantalk'), 'ct_input_comments_test', 'cleantalk', 'cleantalk_settings_anti_spam');
332
+ add_settings_field('cleantalk_contact_forms_test', __('Contact forms', 'cleantalk'), 'ct_input_contact_forms_test', 'cleantalk', 'cleantalk_settings_anti_spam');
333
+ add_settings_field('cleantalk_general_contact_forms_test', __('Custom contact forms', 'cleantalk'), 'ct_input_general_contact_forms_test', 'cleantalk', 'cleantalk_settings_anti_spam');
334
+ add_settings_field('cleantalk_general_postdata_test', __('Check all post data', 'cleantalk'), 'ct_input_general_postdata_test', 'cleantalk', 'cleantalk_settings_anti_spam');
335
+ add_settings_field('cleantalk_show_adminbar', __('Show statistics in admin bar', 'cleantalk'), 'ct_input_show_adminbar', 'cleantalk', 'cleantalk_settings_anti_spam');
336
+ add_settings_field('cleantalk_use_ajax', __('Use AJAX for JavaScript check', 'cleantalk'), 'ct_input_use_ajax', 'cleantalk', 'cleantalk_settings_anti_spam');
337
+ add_settings_field('cleantalk_check_external', __('Protect external forms', 'cleantalk'), 'ct_input_check_external', 'cleantalk', 'cleantalk_settings_anti_spam');
338
+ add_settings_field('cleantalk_check_comments_number', __("Don't check comments", 'cleantalk'), 'ct_input_check_comments_number', 'cleantalk', 'cleantalk_settings_anti_spam');
339
+ //add_settings_field('cleantalk_check_messages_number', __("Don't check messages", 'cleantalk'), 'ct_input_check_messages_number', 'cleantalk', 'cleantalk_settings_anti_spam');
340
+ add_settings_field('cleantalk_show_link', __('', 'cleantalk'), 'ct_input_show_link', 'cleantalk', 'cleantalk_settings_banner');
341
+ //add_settings_field('cleantalk_spam_firewall', __('', 'cleantalk'), 'ct_input_spam_firewall', 'cleantalk', 'cleantalk_settings_banner');
342
+ }
343
  }
344
 
345
  /**
489
  $ct_options=ct_get_options();
490
  $ct_data=ct_get_data();
491
 
492
+ if(!isset($ct_data['admin_blocked']))
493
+ {
494
+ $blocked=0;
495
+ }
496
+ else
497
+ {
498
+ $blocked=$ct_data['admin_blocked'];
499
+ }
500
+
501
+ if($blocked>0)
502
+ {
503
+ $blocked = number_format($blocked, 0, ',', ' ');
504
+
505
+ echo "<script>var cleantalk_blocked_message=\"<div style='height:24px;width:100%;display:table-cell; vertical-align:middle;'><span>CleanTalk has blocked <b>$blocked</b> spam.</span></div><br />\";\n";
506
+ }
507
+ else
508
+ {
509
+ echo "<script>var cleantalk_blocked_message=\"\";\n";
510
+ }
511
+ echo "var cleantalk_statistics_link=\"<a target='__blank' href='https://cleantalk.org/my?user_token=".@$ct_data['user_token']."'>".__('Click here to get anti-spam statistics', 'cleantalk')."</a>\";
512
+ </script>";
513
+
514
  echo "<script src='".plugins_url( 'cleantalk-admin.js', __FILE__ )."'></script>\n";
515
 
516
  $value = $ct_options['apikey'];
517
  $def_value = '';
518
  echo "<input id='cleantalk_apikey' name='cleantalk_settings[apikey]' size='20' type='text' value='$value' style=\"font-size: 14pt;\"/>";
519
  if (ct_valid_key($value) === false) {
520
+ echo "<script>var cleantalk_good_key=false;</script>";
521
  echo "<a target='__blank' style='margin-left: 10px' href='https://cleantalk.org/register?platform=wordpress&email=".urlencode(get_option('admin_email'))."&website=".urlencode(parse_url(get_option('siteurl'),PHP_URL_HOST))."'>".__('Click here to get access key manually', 'cleantalk')."</a>";
522
  if (function_exists('curl_init') && function_exists('json_decode')) {
523
  echo '<br /><br /><input name="get_apikey_auto" type="submit" value="' . __('Get access key automatically', 'cleantalk') . '" />';
525
  admin_addDescriptionsFields(sprintf('<a target="__blank" style="color:#BBB;" href="https://cleantalk.org/publicoffer">%s</a>', __('License agreement', 'cleantalk')));
526
  }
527
  } else {
528
+ echo "<script>var cleantalk_good_key=true;</script>";
529
  if (isset($_COOKIE[$ct_notice_online_label]) && $_COOKIE[$ct_notice_online_label] > 0) {
530
  //echo '&nbsp;&nbsp;<span style="text-decoration: underline;">The key accepted!</span>&nbsp;';
531
  }
532
+ //echo "<br /><br /><a target='__blank' href='https://cleantalk.org/my?user_token=".@$ct_data['user_token']."'>".__('Click here to get anti-spam statistics', 'cleantalk')."</a>";
533
  }
534
  }
535
 
686
  @admin_addDescriptionsFields(sprintf(__('', 'cleantalk'), $ct_options['use_ajax']));
687
  }
688
 
689
+ function ct_input_check_comments_number() {
690
+ global $ct_options, $ct_data;
691
+
692
+ $ct_options = ct_get_options();
693
+ $ct_data = ct_get_data();
694
+
695
+ if(isset($ct_options['check_comments_number']))
696
+ {
697
+ $value = @intval($ct_options['check_comments_number']);
698
+ }
699
+ else
700
+ {
701
+ $value=1;
702
+ }
703
+
704
+ if(defined('CLEANTALK_CHECK_COMMENTS_NUMBER'))
705
+ {
706
+ $comments_check_number = CLEANTALK_CHECK_COMMENTS_NUMBER;
707
+ }
708
+ else
709
+ {
710
+ $comments_check_number = 3;
711
+ }
712
+
713
+ echo "<input type='radio' id='cleantalk_check_comments_number1' name='cleantalk_settings[check_comments_number]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_check_comments_number1'> " . __('Yes') . "</label>";
714
+ echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
715
+ echo "<input type='radio' id='cleantalk_check_comments_number0' name='cleantalk_settings[check_comments_number]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_check_comments_number0'> " . __('No') . "</label>";
716
+ @admin_addDescriptionsFields(sprintf(__("Dont't check comments for users with above $comments_check_number comments", 'cleantalk'), $ct_options['check_comments_number']));
717
+ }
718
+
719
+ function ct_input_check_messages_number() {
720
+ global $ct_options, $ct_data;
721
+
722
+ $ct_options = ct_get_options();
723
+ $ct_data = ct_get_data();
724
+
725
+ if(isset($ct_options['check_messages_number']))
726
+ {
727
+ $value = @intval($ct_options['check_messages_number']);
728
+ }
729
+ else
730
+ {
731
+ $value=0;
732
+ }
733
+
734
+ if(defined('CLEANTALK_CHECK_MESSAGES_NUMBER'))
735
+ {
736
+ $messages_check_number = CLEANTALK_CHECK_MESSAGES_NUMBER;
737
+ }
738
+ else
739
+ {
740
+ $messages_check_number = 3;
741
+ }
742
+
743
+ echo "<input type='radio' id='cleantalk_check_messages_number1' name='cleantalk_settings[check_messages_number]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_check_messages_number1'> " . __('Yes') . "</label>";
744
+ echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
745
+ echo "<input type='radio' id='cleantalk_check_messages_number0' name='cleantalk_settings[check_messages_number]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_check_messages_number0'> " . __('No') . "</label>";
746
+ @admin_addDescriptionsFields(sprintf(__("Dont't check messages for users with above $messages_check_number messages", 'cleantalk'), $ct_options['check_messages_number']));
747
+ }
748
+
749
  function ct_input_check_external() {
750
  global $ct_options, $ct_data;
751
 
780
  {
781
  $value=0;
782
  }
783
+
784
+ /* echo "<input type='radio' id='cleantalk_show_link1' name='cleantalk_settings[show_link]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_show_link1'> " . __('Yes') . "</label>";
785
  echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
786
+ echo "<input type='radio' id='cleantalk_show_link0' name='cleantalk_settings[show_link]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_show_link0'> " . __('No') . "</label>";*/
787
+
788
+ echo "<div id='cleantalk_anchor' style='display:none'></div><input type=hidden name='cleantalk_settings[show_link]' value='0' />";
789
+ echo "<input type='checkbox' id='cleantalk_show_link1' name='cleantalk_settings[show_link]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_show_link1'> " . __('Help others known CleanTalk') . "</label>";
790
  @admin_addDescriptionsFields(sprintf(__("Place a small link under comments form, it lets know what's anti-spam tool protects your site", 'cleantalk'), $ct_options['show_link']));
791
+ echo "<script>
792
+ jQuery(document).ready(function(){
793
+ jQuery('#cleantalk_anchor').parent().parent().children().first().hide();
794
+ jQuery('#cleantalk_anchor').parent().css('padding-left','0px');
795
+ });
796
+ </script>";
797
+ }
798
+
799
+ function ct_input_spam_firewall() {
800
+ global $ct_options, $ct_data;
801
+
802
+ $ct_options = ct_get_options();
803
+ $ct_data = ct_get_data();
804
+
805
+ if(isset($ct_options['spam_firewall']))
806
+ {
807
+ $value = @intval($ct_options['spam_firewall']);
808
+ }
809
+ else
810
+ {
811
+ $value=0;
812
+ }
813
+
814
+ echo "<div id='cleantalk_anchor1' style='display:none'></div><input type=hidden name='cleantalk_settings[spam_firewall]' value='0' />";
815
+ echo "<input type='checkbox' id='cleantalk_spam_firewall1' name='cleantalk_settings[spam_firewall]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_spam_firewall1'> " . __('SpamFireWall') . "</label>";
816
+ @admin_addDescriptionsFields(sprintf(__("This option allows to filter spam bots before they access website. Also reduces CPU usage on hosting server and accelerates pages load time.", 'cleantalk'), $ct_options['spam_firewall']));
817
+ echo "<script>
818
+ jQuery(document).ready(function(){
819
+ jQuery('#cleantalk_anchor1').parent().parent().children().first().hide();
820
+ jQuery('#cleantalk_anchor1').parent().css('padding-left','0px');
821
+ });
822
+ </script>";
823
  }
824
 
825
 
863
  <br />
864
  <div>
865
  <?php echo __('Plugin Homepage at', 'cleantalk'); ?> <a href="http://cleantalk.org" target="_blank">cleantalk.org</a>.<br />
866
+ <?php echo __('Tech support CleanTalk:', 'cleantalk'); ?> <a href="https://cleantalk.org/forum/viewforum.php?f=25" target="_blank"><?php echo __('CleanTalk tech forum', 'cleantalk'); ?></a>.<br />Use s@cleantalk.org to test plugin in any WordPress form.<br />
867
  </div>
868
  <?php
869
  }
872
  * Notice blog owner if plugin is used without Access key
873
  * @return bool
874
  */
875
+ function cleantalk_admin_notice_message(){
876
  global $show_ct_notice_trial, $show_ct_notice_renew, $show_ct_notice_online, $show_ct_notice_autokey, $ct_notice_autokey_value, $ct_plugin_name, $ct_options, $ct_data;
877
 
878
  $ct_options = ct_get_options();
1124
  return;
1125
  }
1126
 
1127
+ /*$ct_base_call_result = ct_base_call(array(
1128
  'message' => 'CleanTalk setup test',
1129
  'example' => null,
1130
  'sender_email' => 'good@cleantalk.org',
1131
  'sender_nickname' => 'CleanTalk',
1132
  'post_info' => '',
1133
  'checkjs' => 1
1134
+ ));*/
1135
 
1136
  $key_valid = true;
1137
  $app_server_error = false;
1138
  $ct_data['testing_failed']=0;
1139
 
1140
+
1141
+ if(!function_exists('sendRawRequest'))
1142
+ {
1143
+ require_once('cleantalk.class.php');
1144
+ }
1145
+
1146
  $request=Array();
1147
  $request['method_name'] = 'notice_validate_key';
1148
  $request['auth_key'] = $api_key;
cleantalk-ajax.php CHANGED
@@ -75,6 +75,9 @@ add_action( 'wp_ajax_woocommerce_checkout', 'ct_ajax_hook',1 );
75
  add_action( 'wp_ajax_nopriv_frm_entries_create', 'ct_ajax_hook',1 );
76
  add_action( 'wp_ajax_frm_entries_create', 'ct_ajax_hook',1 );
77
 
 
 
 
78
  /**hooks for cm answers pro */
79
  add_action( 'template_redirect', 'ct_ajax_hook',1 );
80
 
@@ -420,6 +423,11 @@ function ct_ajax_hook()
420
  print json_encode($result);
421
  die();
422
  }
 
 
 
 
 
423
  }
424
  }
425
  }
75
  add_action( 'wp_ajax_nopriv_frm_entries_create', 'ct_ajax_hook',1 );
76
  add_action( 'wp_ajax_frm_entries_create', 'ct_ajax_hook',1 );
77
 
78
+ add_action( 'wp_ajax_nopriv_td_mod_register', 'ct_ajax_hook',1 );
79
+ add_action( 'wp_ajax_td_mod_register', 'ct_ajax_hook',1 );
80
+
81
  /**hooks for cm answers pro */
82
  add_action( 'template_redirect', 'ct_ajax_hook',1 );
83
 
423
  print json_encode($result);
424
  die();
425
  }
426
+ else if($_POST['action']=='td_mod_register')
427
+ {
428
+ print json_encode(array('register', 0, $ct_result->comment));
429
+ die();
430
+ }
431
  }
432
  }
433
  }
cleantalk-common.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- $ct_agent_version = 'wordpress-5241';
4
  $ct_plugin_name = 'Anti-spam by CleanTalk';
5
  $ct_checkjs_frm = 'ct_checkjs_frm';
6
  $ct_checkjs_register_form = 'ct_checkjs_register_form';
@@ -133,6 +133,50 @@ function ct_base_call($params = array()) {
133
 
134
  $ct_options=ct_get_options();
135
  $ct_data=ct_get_data();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
 
137
  require_once('cleantalk.class.php');
138
 
@@ -189,21 +233,22 @@ function ct_base_call($params = array()) {
189
  // Restart submit form counter for failed requests
190
  if ($ct_result->allow == 0) {
191
  $_SESSION[$ct_formtime_label] = time();
192
- ct_add_event('no');
 
 
 
193
  }
194
  else
195
  {
196
- if(isset($ct_result->errno))
 
 
 
 
197
  {
198
- if($ct_result->errno==1||$ct_result->errno==0)
199
- {
200
- $ct_data['last_error_no']=$ct_result->errno;
201
- $ct_data['last_error_time']=time();
202
- $ct_data['last_error_text']=$ct_result->errstr;
203
- update_option('cleantalk_data', $ct_data);
204
- }
205
  }
206
- ct_add_event('yes');
207
  }
208
 
209
  return array('ct' => $ct, 'ct_result' => $ct_result);
@@ -589,6 +634,7 @@ function ct_get_fields_any(&$email,&$message,&$nickname,&$subject, &$contact,$ar
589
  'ipn_track_id', // PayPal IPN #
590
  'txn_type', // PayPal transaction type
591
  'payment_status', // PayPal payment status
 
592
  );
593
  foreach($skip_params as $key=>$value)
594
  {
1
  <?php
2
 
3
+ $ct_agent_version = 'wordpress-5251';
4
  $ct_plugin_name = 'Anti-spam by CleanTalk';
5
  $ct_checkjs_frm = 'ct_checkjs_frm';
6
  $ct_checkjs_register_form = 'ct_checkjs_register_form';
133
 
134
  $ct_options=ct_get_options();
135
  $ct_data=ct_get_data();
136
+
137
+ /*if(defined('CLEANTALK_CHECK_MESSAGES_NUMBER'))
138
+ {
139
+ $messages_check_number = CLEANTALK_CHECK_MESSAGES_NUMBER;
140
+ }
141
+ else
142
+ {
143
+ $messages_check_number = 3;
144
+ }
145
+
146
+ $is_max_messages = false;
147
+ $is_logged_in = false;
148
+ $user_id = 0;
149
+ $user_cnt = 0;
150
+ if(isset($ct_options['check_messages_number']))
151
+ {
152
+ $value = @intval($ct_options['check_messages_number']);
153
+ }
154
+ else
155
+ {
156
+ $value=0;
157
+ }
158
+
159
+ if($value == 1 && is_user_logged_in())
160
+ {
161
+ $is_logged_in = true;
162
+ $user_id = get_current_user_id();
163
+ $user_cnt = get_user_meta( $user_id, 'cleantalk_messages_number', true );
164
+ if($user_cnt===false)
165
+ {
166
+ $user_cnt = 0;
167
+ }
168
+ if($user_cnt!==false && $user_cnt > $messages_check_number)
169
+ {
170
+ $is_max_messages = true;
171
+ }
172
+ }
173
+
174
+ if($is_max_messages)
175
+ {
176
+ $ct_result = new stdClass();
177
+ $ct_result->allow = 1;
178
+ return array('ct' => null, 'ct_result' => $ct_result);
179
+ }*/
180
 
181
  require_once('cleantalk.class.php');
182
 
233
  // Restart submit form counter for failed requests
234
  if ($ct_result->allow == 0) {
235
  $_SESSION[$ct_formtime_label] = time();
236
+ if(!isset($ct_result->errno)||isset($ct_result->errno)&&$ct_result->errno!=0)
237
+ {
238
+ ct_add_event('no');
239
+ }
240
  }
241
  else
242
  {
243
+ if(!isset($ct_result->errno)||isset($ct_result->errno)&&$ct_result->errno!=0)
244
+ {
245
+ ct_add_event('yes');
246
+ }
247
+ if($is_logged_in)
248
  {
249
+ $user_cnt++;
250
+ update_user_meta( $user_id, 'cleantalk_messages_number', $user_cnt);
 
 
 
 
 
251
  }
 
252
  }
253
 
254
  return array('ct' => $ct, 'ct_result' => $ct_result);
634
  'ipn_track_id', // PayPal IPN #
635
  'txn_type', // PayPal transaction type
636
  'payment_status', // PayPal payment status
637
+ 'ccbill_ipn' //CCBill IPN
638
  );
639
  foreach($skip_params as $key=>$value)
640
  {
cleantalk-public.php CHANGED
@@ -467,10 +467,43 @@ function ct_preprocess_comment($comment) {
467
 
468
  $ct_options = ct_get_options();
469
  $ct_data = ct_get_data();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
470
 
471
- if (ct_is_user_enable() === false || $ct_options['comments_test'] == 0 || $ct_comment_done || (isset($_SERVER['HTTP_REFERER']) && stripos($_SERVER['HTTP_REFERER'],'page=wysija_campaigns&action=editTemplate')!==false)) {
472
  return $comment;
473
  }
 
474
 
475
  $local_blacklists = wp_blacklist_check(
476
  $comment['comment_author'],
@@ -1663,7 +1696,9 @@ function ct_contact_form_validate () {
1663
  strpos($_SERVER['REQUEST_URI'],'wp-comments-post.php')!==false ||
1664
  @strpos($_SERVER['HTTP_REFERER'],'/wp-admin/')!==false ||
1665
  check_url_exclusions() ||
1666
- ct_check_array_keys($_POST)
 
 
1667
  ) {
1668
  return null;
1669
  }
@@ -1783,7 +1818,8 @@ function ct_contact_form_validate_postdata () {
1783
  strpos($_SERVER['REQUEST_URI'],'wp-login.php')!==false ||
1784
  strpos($_SERVER['REQUEST_URI'],'wp-comments-post.php')!==false ||
1785
  @strpos($_SERVER['HTTP_REFERER'],'/wp-admin/')!==false ||
1786
- check_url_exclusions()
 
1787
  ) {
1788
  return null;
1789
  }
467
 
468
  $ct_options = ct_get_options();
469
  $ct_data = ct_get_data();
470
+
471
+ if(defined('CLEANTALK_CHECK_COMMENTS_NUMBER'))
472
+ {
473
+ $comments_check_number = CLEANTALK_CHECK_COMMENTS_NUMBER;
474
+ }
475
+ else
476
+ {
477
+ $comments_check_number = 3;
478
+ }
479
+
480
+ $is_max_comments = false;
481
+ if(isset($ct_options['check_comments_number']))
482
+ {
483
+ $value = @intval($ct_options['check_comments_number']);
484
+ }
485
+ else
486
+ {
487
+ $value=1;
488
+ }
489
+
490
+ if($value == 1)
491
+ {
492
+ $args=Array('author_email' => $comment['comment_author_email'],
493
+ 'status' => 'approve',
494
+ 'count' => true,
495
+ );
496
+ $cnt = get_comments( $args );
497
+ if($cnt >= $comments_check_number)
498
+ {
499
+ $is_max_comments = true;
500
+ }
501
+ }
502
 
503
+ if (ct_is_user_enable() === false || $ct_options['comments_test'] == 0 || $ct_comment_done || (isset($_SERVER['HTTP_REFERER']) && stripos($_SERVER['HTTP_REFERER'],'page=wysija_campaigns&action=editTemplate')!==false) || $is_max_comments) {
504
  return $comment;
505
  }
506
+
507
 
508
  $local_blacklists = wp_blacklist_check(
509
  $comment['comment_author'],
1696
  strpos($_SERVER['REQUEST_URI'],'wp-comments-post.php')!==false ||
1697
  @strpos($_SERVER['HTTP_REFERER'],'/wp-admin/')!==false ||
1698
  check_url_exclusions() ||
1699
+ ct_check_array_keys($_POST) ||
1700
+ isset($_POST['ct_checkjs_register_form']) ||
1701
+ (isset($_POST['signup_username']) && isset($_POST['signup_password_confirm']) && isset($_POST['signup_submit']) )
1702
  ) {
1703
  return null;
1704
  }
1818
  strpos($_SERVER['REQUEST_URI'],'wp-login.php')!==false ||
1819
  strpos($_SERVER['REQUEST_URI'],'wp-comments-post.php')!==false ||
1820
  @strpos($_SERVER['HTTP_REFERER'],'/wp-admin/')!==false ||
1821
+ check_url_exclusions() ||
1822
+ isset($_POST['ct_checkjs_register_form'])
1823
  ) {
1824
  return null;
1825
  }
cleantalk-widget.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class cleantalk_widget extends WP_Widget
4
+ {
5
+
6
+ function __construct()
7
+ {
8
+ parent::__construct(
9
+ // Base ID of your widget
10
+ 'cleantalk_widget',
11
+
12
+ // Widget name will appear in UI
13
+ __('CleanTalk Widget', 'cleantalk'),
14
+
15
+ // Widget description
16
+ array( 'description' => __( 'CleanTalk widget', 'cleantalk' ), )
17
+ );
18
+ }
19
+
20
+ // Creating widget front-end
21
+ // This is where the action happens
22
+ public function widget( $args, $instance )
23
+ {
24
+ $title = apply_filters( 'widget_title', $instance['title'] );
25
+ // before and after widget arguments are defined by themes
26
+ echo $args['before_widget'];
27
+ if ( ! empty( $title ) )
28
+ {
29
+ echo $args['before_title'] . $title . $args['after_title'];
30
+ }
31
+ global $ct_data;
32
+ $ct_data=ct_get_data();
33
+ if(!isset($ct_data['admin_blocked']))
34
+ {
35
+ $blocked=0;
36
+ }
37
+ else
38
+ {
39
+ $blocked=$ct_data['admin_blocked'];
40
+ }
41
+ $blocked = number_format($blocked, 0, ',', ' ');
42
+
43
+ // This is where you run the code and display the output
44
+ ?>
45
+ <div style="width:auto;">
46
+ <a href="http://cleantalk.org" target="_blank" title="" style="background: #3090C7; background-image: -moz-linear-gradient(0% 100% 90deg,#2060a7,#3090C7); background-image: -webkit-gradient(linear,0% 0,0% 100%,from(#3090C7),to(#2060A7)); border: 1px solid #33eeee; border-radius: 5px; color: #AFCA63; cursor: pointer; display: block; font-weight: normal; height: 100%; -moz-border-radius: 5px; padding: 5px 0 5px; text-align: center; text-decoration: none; -webkit-border-radius: 5px; width: 100%;"><strong style="color: #FFF;display: block;font-size: 15px; line-height: 16px; padding: 0 13px; white-space: nowrap;"><b><?php print $blocked; ?></b> spam</strong> blocked by <strong>CleanTalk</strong></a>
47
+ </div>
48
+ <?php
49
+ echo $args['after_widget'];
50
+ }
51
+
52
+ // Widget Backend
53
+ public function form( $instance )
54
+ {
55
+ if ( isset( $instance[ 'title' ] ) )
56
+ {
57
+ $title = $instance[ 'title' ];
58
+ }
59
+ else
60
+ {
61
+ $title = __( 'Spam blocked', 'cleantalk' );
62
+ }
63
+ // Widget admin form
64
+ ?>
65
+ <p>
66
+ <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
67
+ <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
68
+ </p>
69
+ <?php
70
+ }
71
+
72
+ // Updating widget replacing old instances with new
73
+ public function update( $new_instance, $old_instance )
74
+ {
75
+ $instance = array();
76
+ $instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
77
+ return $instance;
78
+ }
79
+ } // Class cleantalk_widget ends here
80
+
81
+ // Register and load the widget
82
+ function cleantalk_load_widget()
83
+ {
84
+ register_widget( 'cleantalk_widget' );
85
+ }
86
+ add_action( 'widgets_init', 'cleantalk_load_widget' );
87
+ ?>
cleantalk.class.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Cleantalk base class
4
  *
5
- * @version 2.0.0
6
  * @package Cleantalk
7
  * @subpackage Base
8
  * @author Cleantalk team (welcome@cleantalk.org)
@@ -428,6 +428,12 @@ class Cleantalk {
428
  * @var bool
429
  */
430
  public $ssl_on = false;
 
 
 
 
 
 
431
 
432
  /**
433
  * Minimal server response in miliseconds to catch the server
@@ -625,10 +631,15 @@ class Cleantalk {
625
 
626
  // Disabling CA cert verivication
627
  // Disabling common name verification
628
- if ($this->ssl_on) {
629
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
630
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
631
  }
 
 
 
 
 
632
 
633
  $result = curl_exec($ch);
634
  if (!$result) {
@@ -654,8 +665,8 @@ class Cleantalk {
654
  $result = @file_get_contents($url, false, $context);
655
  }
656
  }
657
-
658
- if (!$result) {
659
  $response = null;
660
  $response['errno'] = 1;
661
  if ($curl_error) {
@@ -698,7 +709,18 @@ class Cleantalk {
698
  //$msg->remote_addr=$_SERVER['REMOTE_ADDR'];
699
  //$msg->sender_info['remote_addr']=$_SERVER['REMOTE_ADDR'];
700
  $si=(array)json_decode($msg->sender_info,true);
701
- $si['remote_addr']=$_SERVER['REMOTE_ADDR'];
 
 
 
 
 
 
 
 
 
 
 
702
  $msg->sender_info=json_encode($si);
703
  if (((isset($this->work_url) && $this->work_url !== '') && ($this->server_changed + $this->server_ttl > time()))
704
  || $this->stay_on_server == true) {
@@ -995,6 +1017,21 @@ class Cleantalk {
995
 
996
  return $str;
997
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
998
  }
999
 
1000
  /**
@@ -1129,17 +1166,24 @@ function cleantalk_get_real_ip()
1129
  {
1130
  $headers = $_SERVER;
1131
  }
1132
- if ( array_key_exists( 'X-Forwarded-For', $headers ) && filter_var( $headers['X-Forwarded-For'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 ) )
1133
  {
1134
- $the_ip = $headers['X-Forwarded-For'];
 
1135
  }
1136
- elseif ( array_key_exists( 'HTTP_X_FORWARDED_FOR', $headers ) && filter_var( $headers['HTTP_X_FORWARDED_FOR'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 ))
1137
  {
1138
- $the_ip = $headers['HTTP_X_FORWARDED_FOR'];
 
1139
  }
1140
  else
1141
  {
1142
  $the_ip = filter_var( $_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 );
1143
  }
1144
  return $the_ip;
 
 
 
 
 
1145
  }
2
  /**
3
  * Cleantalk base class
4
  *
5
+ * @version 2.1.0
6
  * @package Cleantalk
7
  * @subpackage Base
8
  * @author Cleantalk team (welcome@cleantalk.org)
428
  * @var bool
429
  */
430
  public $ssl_on = false;
431
+
432
+ /**
433
+ * Path to SSL certificate
434
+ * @var string
435
+ */
436
+ public $ssl_path = '';
437
 
438
  /**
439
  * Minimal server response in miliseconds to catch the server
631
 
632
  // Disabling CA cert verivication
633
  // Disabling common name verification
634
+ if ($this->ssl_on && $this->ssl_path=='') {
635
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
636
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
637
  }
638
+ else if ($this->ssl_on && $this->ssl_path!='') {
639
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
640
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, true);
641
+ curl_setopt($ch, CURLOPT_CAINFO, $this->ssl_path);
642
+ }
643
 
644
  $result = curl_exec($ch);
645
  if (!$result) {
665
  $result = @file_get_contents($url, false, $context);
666
  }
667
  }
668
+
669
+ if (!$result || !cleantalk_is_JSON($result)) {
670
  $response = null;
671
  $response['errno'] = 1;
672
  if ($curl_error) {
709
  //$msg->remote_addr=$_SERVER['REMOTE_ADDR'];
710
  //$msg->sender_info['remote_addr']=$_SERVER['REMOTE_ADDR'];
711
  $si=(array)json_decode($msg->sender_info,true);
712
+ if(defined('IN_PHPBB'))
713
+ {
714
+ global $request;
715
+ if(method_exists($request,'server'))
716
+ {
717
+ $si['remote_addr']=$request->server('REMOTE_ADDR');
718
+ }
719
+ }
720
+ else
721
+ {
722
+ $si['remote_addr']=$_SERVER['REMOTE_ADDR'];
723
+ }
724
  $msg->sender_info=json_encode($si);
725
  if (((isset($this->work_url) && $this->work_url !== '') && ($this->server_changed + $this->server_ttl > time()))
726
  || $this->stay_on_server == true) {
1017
 
1018
  return $str;
1019
  }
1020
+
1021
+ /**
1022
+ * Function gets information about spam active networks
1023
+ *
1024
+ * @param string api_key
1025
+ * @return JSON/array
1026
+ */
1027
+ public function get_2s_blacklists_db ($api_key) {
1028
+ $request=Array();
1029
+ $request['method_name'] = '2s_blacklists_db';
1030
+ $request['auth_key'] = $api_key;
1031
+ $url='https://api.cleantalk.org';
1032
+ $result=sendRawRequest($url,$request);
1033
+ return $result;
1034
+ }
1035
  }
1036
 
1037
  /**
1166
  {
1167
  $headers = $_SERVER;
1168
  }
1169
+ if ( array_key_exists( 'X-Forwarded-For', $headers ) )
1170
  {
1171
+ $the_ip=explode(",", trim($headers['X-Forwarded-For']));
1172
+ $the_ip = trim($the_ip[0]);
1173
  }
1174
+ elseif ( array_key_exists( 'HTTP_X_FORWARDED_FOR', $headers ))
1175
  {
1176
+ $the_ip=explode(",", trim($headers['HTTP_X_FORWARDED_FOR']));
1177
+ $the_ip = trim($the_ip[0]);
1178
  }
1179
  else
1180
  {
1181
  $the_ip = filter_var( $_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 );
1182
  }
1183
  return $the_ip;
1184
+ }
1185
+
1186
+ function cleantalk_is_JSON($string)
1187
+ {
1188
+ return ((is_string($string) && (is_object(json_decode($string)) || is_array(json_decode($string))))) ? true : false;
1189
  }
cleantalk.php CHANGED
@@ -3,11 +3,11 @@
3
  Plugin Name: Anti-spam by CleanTalk
4
  Plugin URI: http://cleantalk.org
5
  Description: Max power, all-in-one, captcha less, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms.
6
- Version: 5.24.1
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
10
- $cleantalk_plugin_version='5.24.1';
11
  $cleantalk_executed=false;
12
 
13
  if(defined('CLEANTALK_AJAX_USE_BUFFER'))
@@ -34,6 +34,7 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
34
 
35
 
36
  require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-common.php');
 
37
  $ct_options=ct_get_options();
38
  $ct_data=ct_get_data();
39
  $jigo_version=@get_option('jigoshop_db_version', '');
@@ -114,17 +115,17 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
114
  }
115
  if($value==1)
116
  {
117
- //add_action('comment_form_after', 'ct_show_comment_link');
118
  }
119
 
120
 
121
- if (is_admin())
122
  {
123
  require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-admin.php');
124
  if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)) {
125
  add_action('admin_init', 'ct_admin_init', 1);
126
  add_action('admin_menu', 'ct_admin_add_page');
127
- add_action('admin_notices', 'admin_notice_message');
128
  }
129
  if (defined( 'DOING_AJAX' ) && DOING_AJAX||isset($_POST['cma-action']))
130
  {
@@ -313,7 +314,9 @@ if(isset($_GET['ait-action'])&&$_GET['ait-action']=='register')
313
 
314
  function ct_show_comment_link()
315
  {
316
- print "<div style='font-size:10pt;'><a href='https://cleantalk.org/wordpress-anti-spam-plugin' target='_blank'>WordPress spam</a> blocked by CleanTalk</div>";
317
  }
318
 
 
 
319
  ?>
3
  Plugin Name: Anti-spam by CleanTalk
4
  Plugin URI: http://cleantalk.org
5
  Description: Max power, all-in-one, captcha less, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms.
6
+ Version: 5.25.1
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
10
+ $cleantalk_plugin_version='5.251';
11
  $cleantalk_executed=false;
12
 
13
  if(defined('CLEANTALK_AJAX_USE_BUFFER'))
34
 
35
 
36
  require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-common.php');
37
+ require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-widget.php');
38
  $ct_options=ct_get_options();
39
  $ct_data=ct_get_data();
40
  $jigo_version=@get_option('jigoshop_db_version', '');
115
  }
116
  if($value==1)
117
  {
118
+ add_action('comment_form_after', 'ct_show_comment_link');
119
  }
120
 
121
 
122
+ if (is_admin() && !isset($_GET['P3_HIDE_ADMIN_BAR']) && !isset($_POST['P3_HIDE_ADMIN_BAR']) && !isset($_POST['P3_NOCACHE']) && !isset($_GET['P3_NOCACHE']))
123
  {
124
  require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-admin.php');
125
  if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)) {
126
  add_action('admin_init', 'ct_admin_init', 1);
127
  add_action('admin_menu', 'ct_admin_add_page');
128
+ add_action('admin_notices', 'cleantalk_admin_notice_message');
129
  }
130
  if (defined( 'DOING_AJAX' ) && DOING_AJAX||isset($_POST['cma-action']))
131
  {
314
 
315
  function ct_show_comment_link()
316
  {
317
+ print "<div style='font-size:10pt;'><a href='https://cleantalk.org/wordpress-anti-spam-plugin' target='_blank'>WordPress spam</a> blocked by CleanTalk.</div>";
318
  }
319
 
320
+ add_action( 'right_now_content_table_end', 'my_add_counts_to_dashboard' );
321
+
322
  ?>
cleantalk_nocache.js CHANGED
@@ -66,7 +66,8 @@ function ct_setCookie(name, value)
66
  var date = new Date;
67
  date.setDate(date.getDate() + 1);
68
  //setTimeout(function() { document.cookie = name+"=" + value + "; expires=" + date.toUTCString() + "; path = /; domain = " + domain}, 500)
69
- setTimeout(function() { document.cookie = name+"=" + value + "; expires=" + date.toUTCString() + "; path = /;"}, 500)
 
70
  }
71
 
72
  function ct_callback(req)
66
  var date = new Date;
67
  date.setDate(date.getDate() + 1);
68
  //setTimeout(function() { document.cookie = name+"=" + value + "; expires=" + date.toUTCString() + "; path = /; domain = " + domain}, 500)
69
+ //setTimeout(function() { document.cookie = name+"=" + value + "; expires=" + date.toUTCString() + "; path = /;"}, 500);
70
+ document.cookie = name+"=" + value + "; expires=" + date.toUTCString() + "; path = /;";
71
  }
72
 
73
  function ct_callback(req)
inc/images/logo_color.png ADDED
Binary file
readme.txt CHANGED
@@ -1,13 +1,13 @@
1
  === Anti-Spam by CleanTalk - No Captcha, no comments & registrations spam ===
2
  Contributors: znaeff, shagimuratov, vlad-cleantalk
3
- Tags: anti-spam, antispam, bbpress, buddypress, captcha, capcha, captha, catcha, cf7 spam, comments, contact form spam, signup, spam, spammers, spammy, woocommerce, wordpress spam, booking, order, subscription, gravity spam, jetpack, bots, contact form 7, contact form, registrations, ninja, Fast Secure Contact, Gravity forms, formidable, mailchimp, s2member, protection, protect, email, akismet, plugin, contact, recaptcha, google captcha, math, security, login, blacklist, cache, prevent, wordpress, User Frontend, bulk delete, bulk remove, cloudflare, widget, spam comments
4
  Requires at least: 3.0
5
  Tested up to: 4.3
6
- Stable tag: 5.24.1
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
- Max power, all-in-one, premium anti-spam. No comments spam & registrations spam, no email spam, trackback spam. Forget about spam.
11
 
12
  == Description ==
13
  No CAPTCHA, no questions, no counting animals, no puzzles, no math and no spam bots.
@@ -311,6 +311,13 @@ WordPress 3.0 at least. PHP 5 with CURL or file_get_contents() function and enab
311
  1. Setup Android/iOS app to have push notices when new legitiamte comments/registrations or contactcs appears on the website.
312
 
313
  == Changelog ==
 
 
 
 
 
 
 
314
  = 5.24.1 2015-09-16 =
315
  * Fixed some errors in frontend
316
  * Fixed access key saving
@@ -763,6 +770,14 @@ WordPress 3.0 at least. PHP 5 with CURL or file_get_contents() function and enab
763
  * First version
764
 
765
  == Upgrade Notice ==
 
 
 
 
 
 
 
 
766
  = 5.24.1 2015-09-16 =
767
  * Fixed some errors in frontend
768
  * Fixed access key saving
1
  === Anti-Spam by CleanTalk - No Captcha, no comments & registrations spam ===
2
  Contributors: znaeff, shagimuratov, vlad-cleantalk
3
+ Tags: anti-spam, antispam, bbpress, buddypress, captcha, capcha, captha, catcha, cf7 spam, comments, contact form spam, signup, spam, spammers, spammy, woocommerce, wordpress spam, booking, order, subscription, gravity spam, jetpack, bots, contact form 7, contact form, registrations, ninja, Fast Secure Contact, Gravity forms, formidable, mailchimp, s2member, protection, protect, email, akismet, plugin, contact, recaptcha, google captcha, math, security, login, blacklist, cache, prevent, wordpress, User Frontend, bulk delete, bulk remove, cloudflare, widget
4
  Requires at least: 3.0
5
  Tested up to: 4.3
6
+ Stable tag: 5.25.1
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
+ Max power, all-in-one, premium anti-spam. No comments spam & registrations spam, no email spam, protects any forms. Just install and forget spam.
11
 
12
  == Description ==
13
  No CAPTCHA, no questions, no counting animals, no puzzles, no math and no spam bots.
311
  1. Setup Android/iOS app to have push notices when new legitiamte comments/registrations or contactcs appears on the website.
312
 
313
  == Changelog ==
314
+ = 5.25.1 2015-09-28 =
315
+ * Added widget with anti-spam statistics
316
+ * Added information about blocked spam attacks in admin dashboard and CleanTalk settings
317
+ * Added ability not to check comments for users with 3 or above allowed comments
318
+ * Added an option 'Help others known CleanTalk' to show information for site visitors, that your site is protected from spam by us
319
+ * Some backend interface settings
320
+
321
  = 5.24.1 2015-09-16 =
322
  * Fixed some errors in frontend
323
  * Fixed access key saving
770
  * First version
771
 
772
  == Upgrade Notice ==
773
+ = 5.25.1 2015-09-28 =
774
+ * Added widget with anti-spam statistics
775
+ * Added information about blocked spam attacks in admin dashboard and CleanTalk settings
776
+ * Added ability not to check comments for users with 3 or above allowed comments
777
+ * Added an option 'Help others known CleanTalk' to show information for site visitors, that your site is protected from spam by us
778
+ * Some backend interface settings
779
+ * Removed "CleanTalk connection test" query
780
+
781
  = 5.24.1 2015-09-16 =
782
  * Fixed some errors in frontend
783
  * Fixed access key saving