Spam protection, AntiSpam, FireWall by CleanTalk - Version 5.69

Version Description

July 3 2017 = * Reviewer - integration. * Optimization for Users and Comments check for big databases. * Errors fixes. * Improved protection from spam.

Download this release

Release Info

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

Code changes from version 5.68 to 5.69

assets/css/cleantalk-admin.css CHANGED
@@ -8,7 +8,7 @@
8
 
9
  .ct_translate_links:hover{color: rgba(210, 210, 20, 1) !important;}
10
  .ct_support_links:hover {color: rgba(250, 20, 20, 1) !important;}
11
- .ct_faq_links :hover {color: rgba(20, 250, 20, 1) !important;}
12
  .ct_setting_links:hover {color: rgba(20, 20, 250, 1) !important;}
13
 
14
  .ct_link_new_tab img{
8
 
9
  .ct_translate_links:hover{color: rgba(210, 210, 20, 1) !important;}
10
  .ct_support_links:hover {color: rgba(250, 20, 20, 1) !important;}
11
+ .ct_faq_links:hover {color: rgba(20, 250, 20, 1) !important;}
12
  .ct_setting_links:hover {color: rgba(20, 20, 250, 1) !important;}
13
 
14
  .ct_link_new_tab img{
assets/js/cleantalk-comments-checkspam.js CHANGED
@@ -1,23 +1,33 @@
1
- var working = false;
2
- var ajax_nonce = ctCommentsCheck.ct_ajax_nonce;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  var ct_cool_down_time = 65000,
4
  ct_requests_counter = 0,
5
- ct_max_requests = 95,
6
- ct_cooling_down_flag = false;
7
- var ct_new_check = true;
 
 
 
 
 
8
 
9
- String.prototype.format = String.prototype.f = function (){
10
- var args = arguments;
11
- return this.replace(/\{\{|\}\}|\{(\d+)\}/g, function (m, n){
12
- if (m == "{{") { return "{"; }
13
- if (m == "}}") { return "}"; }
14
- return args[n];
15
- });
16
- };
17
-
18
- var close_animate=true;
19
  function animate_comment(to,id){
20
- if(close_animate){
21
  if(to==0.3){
22
  jQuery('#comment-'+id).fadeTo(200,to,function(){
23
  animate_comment(1,id)
@@ -28,14 +38,14 @@ function animate_comment(to,id){
28
  });
29
  }
30
  }else{
31
- close_animate=true;
32
  }
33
  }
34
 
35
  function ct_clear_comments(){
36
  var data = {
37
  'action': 'ajax_clear_comments',
38
- 'security': ajax_nonce
39
  };
40
 
41
  jQuery.ajax({
@@ -72,8 +82,9 @@ function ct_send_comments(){
72
 
73
  var data = {
74
  'action': 'ajax_check_comments',
75
- 'security': ajax_nonce,
76
- 'new_check': ct_new_check
 
77
  };
78
 
79
  jQuery.ajax({
@@ -81,17 +92,31 @@ function ct_send_comments(){
81
  url: ajaxurl,
82
  data: data,
83
  success: function(msg){
84
- ct_new_check = false;
85
- if(parseInt(msg)==1){
86
- ct_send_comments();
87
- }else if(parseInt(msg)==0){
88
- working=false;
89
- jQuery('#ct_working_message').hide();
90
  location.href='edit-comments.php?page=ct_check_spam&ct_worked=1';
91
  }else{
92
- working=false;
93
- alert(msg);
94
- location.href='edit-comments.php?page=ct_check_spam&ct_worked=1';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  }
96
  },
97
  error: function(jqXHR, textStatus, errorThrown) {
@@ -100,11 +125,13 @@ function ct_send_comments(){
100
  jQuery('#cleantalk_js_func').html('Check comments');
101
  setTimeout(ct_send_users(), 3000);
102
  },
103
- timeout: 15000
104
  });
105
  }
106
  function ct_show_info(){
107
- if(working){
 
 
108
  if(ct_cooling_down_flag == true){
109
  jQuery('#ct_cooling_notice').html('Waiting for API to cool down. (About a minute)');
110
  jQuery('#ct_cooling_notice').show();
@@ -113,32 +140,38 @@ function ct_show_info(){
113
  jQuery('#ct_cooling_notice').hide();
114
  }
115
 
116
- var data = {
117
- 'action': 'ajax_info_comments',
118
- 'security': ajax_nonce
119
- };
120
- jQuery.ajax({
121
- type: "POST",
122
- url: ajaxurl,
123
- data: data,
124
- success: function(msg){
125
- jQuery('#ct_checking_status').html(msg);
126
- setTimeout(ct_show_info, 1000);
127
- },
128
- error: function(jqXHR, textStatus, errorThrown) {
129
- jQuery('#ct_error_message').show();
130
- jQuery('#cleantalk_ajax_error').html(textStatus);
131
- jQuery('#cleantalk_js_func').html('Check comments');
132
- setTimeout(ct_send_users(), 3000);
133
- },
134
- timeout: 5000
135
- });
 
 
 
 
 
 
136
  }
137
  }
138
  function ct_insert_comments(){
139
  var data = {
140
  'action': 'ajax_insert_comments',
141
- 'security': ajax_nonce
142
  };
143
 
144
  jQuery.ajax({
@@ -153,7 +186,7 @@ function ct_insert_comments(){
153
  function ct_delete_all(){
154
  var data = {
155
  'action': 'ajax_delete_all',
156
- 'security': ajax_nonce
157
  };
158
 
159
  jQuery.ajax({
@@ -187,7 +220,7 @@ function ct_delete_checked(){
187
  });
188
  var data = {
189
  'action': 'ajax_delete_checked',
190
- 'security': ajax_nonce,
191
  'ids':ids
192
  };
193
 
@@ -221,7 +254,7 @@ jQuery(document).ready(function(){
221
  jQuery('#ct_working_message').show();
222
  jQuery('#ct_preloader').show();
223
 
224
- working=true;
225
  ct_show_info();
226
  ct_clear_comments();
227
  });
@@ -255,7 +288,7 @@ jQuery(document).ready(function(){
255
  ids[0]=id;
256
  var data = {
257
  'action': 'ajax_delete_checked',
258
- 'security': ajax_nonce,
259
  'ids':ids
260
  };
261
  jQuery.ajax({
@@ -263,10 +296,10 @@ jQuery(document).ready(function(){
263
  url: ajaxurl,
264
  data: data,
265
  success: function(msg){
266
- close_animate=false;
267
  jQuery("#comment-"+id).hide();
268
  jQuery("#comment-"+id).remove();
269
- close_animate=true;
270
  }
271
  });
272
  });
@@ -292,7 +325,7 @@ jQuery(document).ready(function(){
292
  // Approving
293
  var data = {
294
  'action': 'ajax_ct_approve_comment',
295
- 'security': ajax_nonce,
296
  'id': ct_id
297
  };
298
  jQuery.ajax({
@@ -309,7 +342,7 @@ jQuery(document).ready(function(){
309
  // Positive feedback
310
  var data = {
311
  'action': 'ct_feedback_comment',
312
- 'security': ajax_nonce,
313
  'comment_id': ct_id,
314
  'comment_status': 'approve'
315
  };
1
+ // Printf for JS
2
+ String.prototype.printf = function(){
3
+ var formatted = this;
4
+ for( var arg in arguments ) {
5
+ var before_formatted = formatted.substring(0, formatted.indexOf("%s", 0));
6
+ var after_formatted = formatted.substring(formatted.indexOf("%s", 0)+2, formatted.length);
7
+ formatted = before_formatted + arguments[arg] + after_formatted;
8
+ }
9
+ return formatted;
10
+ };
11
+
12
+ // Flags
13
+ var ct_working = false,
14
+ ct_new_check = true,
15
+ ct_cooling_down_flag = false,
16
+ ct_close_animate = true;
17
+ // Settings
18
  var ct_cool_down_time = 65000,
19
  ct_requests_counter = 0,
20
+ ct_max_requests = 95;
21
+ // Variables
22
+ var ct_ajax_nonce = ctCommentsCheck.ct_ajax_nonce,
23
+ ct_comments_total = 0,
24
+ ct_comments_checked = 0,
25
+ ct_comments_spam = 0,
26
+ ct_comments_bad = 0,
27
+ ct_unchecked = 'unset';
28
 
 
 
 
 
 
 
 
 
 
 
29
  function animate_comment(to,id){
30
+ if(ct_close_animate){
31
  if(to==0.3){
32
  jQuery('#comment-'+id).fadeTo(200,to,function(){
33
  animate_comment(1,id)
38
  });
39
  }
40
  }else{
41
+ ct_close_animate=true;
42
  }
43
  }
44
 
45
  function ct_clear_comments(){
46
  var data = {
47
  'action': 'ajax_clear_comments',
48
+ 'security': ct_ajax_nonce
49
  };
50
 
51
  jQuery.ajax({
82
 
83
  var data = {
84
  'action': 'ajax_check_comments',
85
+ 'security': ct_ajax_nonce,
86
+ 'new_check': ct_new_check,
87
+ 'unchecked': ct_unchecked
88
  };
89
 
90
  jQuery.ajax({
92
  url: ajaxurl,
93
  data: data,
94
  success: function(msg){
95
+
96
+ msg = JSON.parse(msg);
97
+
98
+ if(parseInt(msg.error)){
99
+ ct_working=false;
100
+ alert(msg.error_message);
101
  location.href='edit-comments.php?page=ct_check_spam&ct_worked=1';
102
  }else{
103
+ ct_new_check = false;
104
+ if(parseInt(msg.end) == 0){
105
+ ct_comments_checked += msg.checked;
106
+ ct_comments_spam += msg.spam;
107
+ ct_comments_bad += msg.bad;
108
+ ct_unchecked = ct_comments_total - ct_comments_checked - ct_comments_bad;
109
+ var status_string = String(ctCommentsCheck.ct_status_string);
110
+ var status_string = status_string.printf(ct_comments_total, ct_comments_checked, ct_comments_spam, ct_comments_bad);
111
+ if(parseInt(ct_comments_spam) > 0)
112
+ status_string += ctCommentsCheck.ct_status_string_warning;
113
+ jQuery('#ct_checking_status').html(status_string);
114
+ ct_send_comments();
115
+ }else if(parseInt(msg.end) == 1){
116
+ ct_working=false;
117
+ jQuery('#ct_working_message').hide();
118
+ location.href='edit-comments.php?page=ct_check_spam&ct_worked=1';
119
+ }
120
  }
121
  },
122
  error: function(jqXHR, textStatus, errorThrown) {
125
  jQuery('#cleantalk_js_func').html('Check comments');
126
  setTimeout(ct_send_users(), 3000);
127
  },
128
+ timeout: 25000
129
  });
130
  }
131
  function ct_show_info(){
132
+
133
+ if(ct_working){
134
+
135
  if(ct_cooling_down_flag == true){
136
  jQuery('#ct_cooling_notice').html('Waiting for API to cool down. (About a minute)');
137
  jQuery('#ct_cooling_notice').show();
140
  jQuery('#ct_cooling_notice').hide();
141
  }
142
 
143
+ setTimeout(ct_show_info, 3000);
144
+
145
+ if(!ct_comments_total){
146
+ var data = {
147
+ 'action': 'ajax_info_comments',
148
+ 'security': ct_ajax_nonce
149
+ };
150
+ jQuery.ajax({
151
+ type: "POST",
152
+ url: ajaxurl,
153
+ data: data,
154
+ success: function(msg){
155
+ msg = jQuery.parseJSON(msg);
156
+ console.log(msg);
157
+ jQuery('#ct_checking_status').html(msg.message);
158
+ ct_comments_total = msg.total;
159
+ },
160
+ error: function(jqXHR, textStatus, errorThrown) {
161
+ jQuery('#ct_error_message').show();
162
+ jQuery('#cleantalk_ajax_error').html(textStatus);
163
+ jQuery('#cleantalk_js_func').html('Check comments');
164
+ setTimeout(ct_send_users(), 3000);
165
+ },
166
+ timeout: 15000
167
+ });
168
+ }
169
  }
170
  }
171
  function ct_insert_comments(){
172
  var data = {
173
  'action': 'ajax_insert_comments',
174
+ 'security': ct_ajax_nonce
175
  };
176
 
177
  jQuery.ajax({
186
  function ct_delete_all(){
187
  var data = {
188
  'action': 'ajax_delete_all',
189
+ 'security': ct_ajax_nonce
190
  };
191
 
192
  jQuery.ajax({
220
  });
221
  var data = {
222
  'action': 'ajax_delete_checked',
223
+ 'security': ct_ajax_nonce,
224
  'ids':ids
225
  };
226
 
254
  jQuery('#ct_working_message').show();
255
  jQuery('#ct_preloader').show();
256
 
257
+ ct_working=true;
258
  ct_show_info();
259
  ct_clear_comments();
260
  });
288
  ids[0]=id;
289
  var data = {
290
  'action': 'ajax_delete_checked',
291
+ 'security': ct_ajax_nonce,
292
  'ids':ids
293
  };
294
  jQuery.ajax({
296
  url: ajaxurl,
297
  data: data,
298
  success: function(msg){
299
+ ct_close_animate=false;
300
  jQuery("#comment-"+id).hide();
301
  jQuery("#comment-"+id).remove();
302
+ ct_close_animate=true;
303
  }
304
  });
305
  });
325
  // Approving
326
  var data = {
327
  'action': 'ajax_ct_approve_comment',
328
+ 'security': ct_ajax_nonce,
329
  'id': ct_id
330
  };
331
  jQuery.ajax({
342
  // Positive feedback
343
  var data = {
344
  'action': 'ct_feedback_comment',
345
+ 'security': ct_ajax_nonce,
346
  'comment_id': ct_id,
347
  'comment_status': 'approve'
348
  };
assets/js/cleantalk-users-checkspam.js CHANGED
@@ -1,23 +1,33 @@
1
- var working = false;
2
- var ajax_nonce = ctUsersCheck.ct_ajax_nonce;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  var ct_cool_down_time = 65000,
4
  ct_requests_counter = 0,
5
- ct_max_requests = 95,
6
- ct_cooling_down_flag = false;
7
- var ct_new_check = true;
8
-
9
- String.prototype.format = String.prototype.f = function (){
10
- var args = arguments;
11
- return this.replace(/\{\{|\}\}|\{(\d+)\}/g, function (m, n){
12
- if (m == "{{") { return "{"; }
13
- if (m == "}}") { return "}"; }
14
- return args[n];
15
- });
16
- };
17
 
18
- var close_animate=true;
19
  function animate_comment(to,id){
20
- if(close_animate){
21
  if(to==0.3){
22
  jQuery('#comment-'+id).fadeTo(200,to,function(){
23
  animate_comment(1,id)
@@ -28,14 +38,14 @@ function animate_comment(to,id){
28
  });
29
  }
30
  }else{
31
- close_animate=true;
32
  }
33
  }
34
 
35
  function ct_clear_users(){
36
  var data = {
37
  'action': 'ajax_clear_users',
38
- 'security': ajax_nonce
39
  };
40
 
41
  jQuery.ajax({
@@ -72,8 +82,9 @@ function ct_send_users(){
72
 
73
  var data = {
74
  'action': 'ajax_check_users',
75
- 'security': ajax_nonce,
76
- 'new_check': ct_new_check
 
77
  };
78
 
79
  jQuery.ajax({
@@ -81,17 +92,30 @@ function ct_send_users(){
81
  url: ajaxurl,
82
  data: data,
83
  success: function(msg){
84
- ct_new_check = false;
85
- if(parseInt(msg)==1){
86
- ct_send_users();
87
- }else if(parseInt(msg)==0){
88
- working=false;
89
- jQuery('#ct_working_message').hide();
90
  location.href='users.php?page=ct_check_users&ct_worked=1';
91
  }else{
92
- working=false;
93
- alert(msg);
94
- location.href='users.php?page=ct_check_users&ct_worked=1';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  }
96
  },
97
  error: function(jqXHR, textStatus, errorThrown) {
@@ -105,7 +129,7 @@ function ct_send_users(){
105
  }
106
  function ct_show_users_info(){
107
 
108
- if(working){
109
 
110
  if(ct_cooling_down_flag == true){
111
  jQuery('#ct_cooling_notice').html('Waiting for API to cool down. (About a minute)');
@@ -115,33 +139,38 @@ function ct_show_users_info(){
115
  jQuery('#ct_cooling_notice').hide();
116
  }
117
 
118
- var data = {
119
- 'action': 'ajax_info_users',
120
- 'security': ajax_nonce
121
- };
122
- jQuery.ajax({
123
- type: "POST",
124
- url: ajaxurl,
125
- data: data,
126
- success: function(msg){
127
- jQuery('#ct_checking_users_status').html(msg);
128
- setTimeout(ct_show_users_info, 3000);
129
- },
130
- error: function (jqXHR, textStatus, errorThrown){
131
- jQuery('#ct_error_message').show();
132
- jQuery('#cleantalk_ajax_error').html(textStatus);
133
- jQuery('#cleantalk_js_func').html('Show users');
134
- setTimeout(ct_show_users_info(), 3000);
135
- },
136
- timeout: 5000
137
- });
 
 
 
 
 
138
  }
139
  }
140
  function ct_insert_users(){
141
 
142
  var data = {
143
  'action': 'ajax_insert_users',
144
- 'security': ajax_nonce
145
  };
146
 
147
  jQuery.ajax({
@@ -157,7 +186,7 @@ function ct_delete_all_users(){
157
 
158
  var data = {
159
  'action': 'ajax_delete_all_users',
160
- 'security': ajax_nonce
161
  };
162
 
163
  jQuery.ajax({
@@ -193,7 +222,7 @@ function ct_delete_checked_users(){
193
  });
194
  var data = {
195
  'action': 'ajax_delete_checked_users',
196
- 'security': ajax_nonce,
197
  'ids':ids
198
  };
199
 
@@ -224,7 +253,7 @@ jQuery(document).ready(function(){
224
  ids[0]=id;
225
  var data = {
226
  'action': 'ajax_delete_checked_users',
227
- 'security': ajax_nonce,
228
  'ids':ids
229
  };
230
  jQuery.ajax({
@@ -232,10 +261,10 @@ jQuery(document).ready(function(){
232
  url: ajaxurl,
233
  data: data,
234
  success: function(msg){
235
- close_animate=false;
236
  jQuery("#comment-"+id).hide();
237
  jQuery("#comment-"+id).remove();
238
- close_animate=true;
239
  },
240
  timeout: 15000
241
  });
@@ -258,7 +287,7 @@ jQuery(document).ready(function(){
258
  jQuery('#ct_info_message').hide();
259
  jQuery('#ct_working_message').show();
260
  jQuery('#ct_preloader').show();
261
- working=true;
262
  ct_clear_users();
263
  ct_show_users_info();
264
  });
@@ -320,7 +349,7 @@ jQuery(document).ready(function(){
320
  ct_id = jQuery(this).attr("data-id");
321
  var data = {
322
  'action': 'ajax_ct_approve_user',
323
- 'security': ajax_nonce,
324
  'id': ct_id
325
  };
326
  jQuery.ajax({
@@ -337,7 +366,7 @@ jQuery(document).ready(function(){
337
  // Positive feedback
338
  var data = {
339
  'action': 'ct_feedback_user',
340
- 'security': ajax_nonce,
341
  'user_id': ct_id,
342
  'status': 'approve'
343
  };
@@ -368,7 +397,7 @@ jQuery(document).ready(function(){
368
  jQuery("#ct_get_csv_file").click(function(){
369
  var data = {
370
  'action': 'ajax_ct_get_csv_file',
371
- 'security': ajax_nonce,
372
  'filename': ctUsersCheck.ct_csv_filename
373
  };
374
  jQuery.ajax({
1
+ // Printf for JS
2
+ String.prototype.printf = function(){
3
+ var formatted = this;
4
+ for( var arg in arguments ) {
5
+ var before_formatted = formatted.substring(0, formatted.indexOf("%s", 0));
6
+ var after_formatted = formatted.substring(formatted.indexOf("%s", 0)+2, formatted.length);
7
+ formatted = before_formatted + arguments[arg] + after_formatted;
8
+ }
9
+ return formatted;
10
+ };
11
+
12
+ // Flags
13
+ var ct_working = false,
14
+ ct_new_check = true,
15
+ ct_cooling_down_flag = false,
16
+ ct_close_animate = true;
17
+ // Settings
18
  var ct_cool_down_time = 65000,
19
  ct_requests_counter = 0,
20
+ ct_max_requests = 95;
21
+ // Variables
22
+ var ct_ajax_nonce = ctUsersCheck.ct_ajax_nonce,
23
+ ct_users_total = 0,
24
+ ct_users_checked = 0,
25
+ ct_users_spam = 0,
26
+ ct_users_bad = 0,
27
+ ct_unchecked = 'unset';
 
 
 
 
28
 
 
29
  function animate_comment(to,id){
30
+ if(ct_close_animate){
31
  if(to==0.3){
32
  jQuery('#comment-'+id).fadeTo(200,to,function(){
33
  animate_comment(1,id)
38
  });
39
  }
40
  }else{
41
+ ct_close_animate=true;
42
  }
43
  }
44
 
45
  function ct_clear_users(){
46
  var data = {
47
  'action': 'ajax_clear_users',
48
+ 'security': ct_ajax_nonce
49
  };
50
 
51
  jQuery.ajax({
82
 
83
  var data = {
84
  'action': 'ajax_check_users',
85
+ 'security': ct_ajax_nonce,
86
+ 'new_check': ct_new_check,
87
+ 'unchecked': ct_unchecked
88
  };
89
 
90
  jQuery.ajax({
92
  url: ajaxurl,
93
  data: data,
94
  success: function(msg){
95
+ msg = JSON.parse(msg);
96
+
97
+ if(parseInt(msg.error)){
98
+ ct_working=false;
99
+ alert(msg.error_message);
 
100
  location.href='users.php?page=ct_check_users&ct_worked=1';
101
  }else{
102
+ ct_new_check = false;
103
+ if(parseInt(msg.end) == 0){
104
+ ct_users_checked += msg.checked;
105
+ ct_users_spam += msg.spam;
106
+ ct_users_bad += msg.bad;
107
+ ct_unchecked = ct_users_total - ct_users_checked - ct_users_bad;
108
+ var status_string = String(ctUsersCheck.ct_status_string);
109
+ var status_string = status_string.printf(ct_users_total, ct_users_checked, ct_users_spam, ct_users_bad);
110
+ if(parseInt(ct_users_spam) > 0)
111
+ status_string += ctUsersCheck.ct_status_string_warning;
112
+ jQuery('#ct_checking_users_status').html(status_string);
113
+ ct_send_users();
114
+ }else if(parseInt(msg.end) == 1){
115
+ ct_working=false;
116
+ jQuery('#ct_working_message').hide();
117
+ location.href='users.php?page=ct_check_users&ct_worked=1';
118
+ }
119
  }
120
  },
121
  error: function(jqXHR, textStatus, errorThrown) {
129
  }
130
  function ct_show_users_info(){
131
 
132
+ if(ct_working){
133
 
134
  if(ct_cooling_down_flag == true){
135
  jQuery('#ct_cooling_notice').html('Waiting for API to cool down. (About a minute)');
139
  jQuery('#ct_cooling_notice').hide();
140
  }
141
 
142
+ setTimeout(ct_show_users_info, 3000);
143
+
144
+ if(!ct_users_total){
145
+ var data = {
146
+ 'action': 'ajax_info_users',
147
+ 'security': ct_ajax_nonce
148
+ };
149
+ jQuery.ajax({
150
+ type: "POST",
151
+ url: ajaxurl,
152
+ data: data,
153
+ success: function(msg){
154
+ msg = jQuery.parseJSON(msg);
155
+ jQuery('#ct_checking_users_status').html(msg.message);
156
+ ct_users_total = msg.total;
157
+ },
158
+ error: function (jqXHR, textStatus, errorThrown){
159
+ jQuery('#ct_error_message').show();
160
+ jQuery('#cleantalk_ajax_error').html(textStatus);
161
+ jQuery('#cleantalk_js_func').html('Show users');
162
+ setTimeout(ct_show_users_info(), 3000);
163
+ },
164
+ timeout: 15000
165
+ });
166
+ }
167
  }
168
  }
169
  function ct_insert_users(){
170
 
171
  var data = {
172
  'action': 'ajax_insert_users',
173
+ 'security': ct_ajax_nonce
174
  };
175
 
176
  jQuery.ajax({
186
 
187
  var data = {
188
  'action': 'ajax_delete_all_users',
189
+ 'security': ct_ajax_nonce
190
  };
191
 
192
  jQuery.ajax({
222
  });
223
  var data = {
224
  'action': 'ajax_delete_checked_users',
225
+ 'security': ct_ajax_nonce,
226
  'ids':ids
227
  };
228
 
253
  ids[0]=id;
254
  var data = {
255
  'action': 'ajax_delete_checked_users',
256
+ 'security': ct_ajax_nonce,
257
  'ids':ids
258
  };
259
  jQuery.ajax({
261
  url: ajaxurl,
262
  data: data,
263
  success: function(msg){
264
+ ct_close_animate=false;
265
  jQuery("#comment-"+id).hide();
266
  jQuery("#comment-"+id).remove();
267
+ ct_close_animate=true;
268
  },
269
  timeout: 15000
270
  });
287
  jQuery('#ct_info_message').hide();
288
  jQuery('#ct_working_message').show();
289
  jQuery('#ct_preloader').show();
290
+ ct_working=true;
291
  ct_clear_users();
292
  ct_show_users_info();
293
  });
349
  ct_id = jQuery(this).attr("data-id");
350
  var data = {
351
  'action': 'ajax_ct_approve_user',
352
+ 'security': ct_ajax_nonce,
353
  'id': ct_id
354
  };
355
  jQuery.ajax({
366
  // Positive feedback
367
  var data = {
368
  'action': 'ct_feedback_user',
369
+ 'security': ct_ajax_nonce,
370
  'user_id': ct_id,
371
  'status': 'approve'
372
  };
397
  jQuery("#ct_get_csv_file").click(function(){
398
  var data = {
399
  'action': 'ajax_ct_get_csv_file',
400
+ 'security': ct_ajax_nonce,
401
  'filename': ctUsersCheck.ct_csv_filename
402
  };
403
  jQuery.ajax({
cleantalk.php CHANGED
@@ -3,12 +3,12 @@
3
  Plugin Name: Anti-Spam by CleanTalk
4
  Plugin URI: http://cleantalk.org
5
  Description: Max power, all-in-one, no Captcha, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms. Formerly Anti-Spam by CleanTalk.
6
- Version: 5.68
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
10
- $cleantalk_plugin_version='5.68';
11
- $ct_agent_version = 'wordpress-568';
12
  $cleantalk_executed=false;
13
  $ct_sfw_updated = false;
14
 
3
  Plugin Name: Anti-Spam by CleanTalk
4
  Plugin URI: http://cleantalk.org
5
  Description: Max power, all-in-one, no Captcha, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms. Formerly Anti-Spam by CleanTalk.
6
+ Version: 5.69
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
10
+ $cleantalk_plugin_version='5.69';
11
+ $ct_agent_version = 'wordpress-569';
12
  $cleantalk_executed=false;
13
  $ct_sfw_updated = false;
14
 
inc/cleantalk-admin.php CHANGED
@@ -204,7 +204,7 @@ function ct_enqueue_scripts($hook) {
204
  wp_enqueue_style ('ct_admin_css', plugins_url('/cleantalk-spam-protect/assets/css/cleantalk-admin.css'), array(), $cleantalk_plugin_version, 'all');
205
 
206
  // Scripts & Styles to main dashboard page
207
- if($hook == 'index.php'){
208
  wp_enqueue_script('ct_admin_js_widget_dashboard', plugins_url('/cleantalk-spam-protect/assets/js/cleantalk-dashboard-widget.js'), array(), $cleantalk_plugin_version);
209
  wp_enqueue_style('ct_admin_css_widget_dashboard', plugins_url('/cleantalk-spam-protect/assets/css/cleantalk-dashboard-widget.css'), array(), $cleantalk_plugin_version, 'all');
210
  }
@@ -238,7 +238,9 @@ function ct_enqueue_scripts($hook) {
238
  'ct_comments_added' => __('Added', 'cleantalk'),
239
  'ct_comments_added_after' => __('comments', 'cleantalk'),
240
  'ct_confirm_deletion_all' => __('Delete all spam comments?', 'cleantalk'),
241
- 'ct_confirm_deletion_checked' => __('Delete checked comments?', 'cleantalk')
 
 
242
  ));
243
  wp_localize_script( 'jquery', 'ctCommentsScreen', array(
244
  'ct_ajax_nonce' => $ajax_nonce,
@@ -274,7 +276,9 @@ function ct_enqueue_scripts($hook) {
274
  'ct_confirm_deletion_all' => __('Delete all spam users?', 'cleantalk'),
275
  'ct_confirm_deletion_checked' => __('Delete checked users?', 'cleantalk'),
276
  'ct_csv_filename' => "user_check_by_".$current_user->user_login,
277
- 'ct_bad_csv' => __("File doesn't exist. File will be generated while checking. Please, press \"Check for spam\".")
 
 
278
  ));
279
  wp_localize_script( 'jquery', 'ctUsersScreen', array(
280
  'spambutton_users_text' => __("Find spam-users", 'cleantalk'),
204
  wp_enqueue_style ('ct_admin_css', plugins_url('/cleantalk-spam-protect/assets/css/cleantalk-admin.css'), array(), $cleantalk_plugin_version, 'all');
205
 
206
  // Scripts & Styles to main dashboard page
207
+ if($hook == 'index.php' && current_user_can('activate_plugins')){
208
  wp_enqueue_script('ct_admin_js_widget_dashboard', plugins_url('/cleantalk-spam-protect/assets/js/cleantalk-dashboard-widget.js'), array(), $cleantalk_plugin_version);
209
  wp_enqueue_style('ct_admin_css_widget_dashboard', plugins_url('/cleantalk-spam-protect/assets/css/cleantalk-dashboard-widget.css'), array(), $cleantalk_plugin_version, 'all');
210
  }
238
  'ct_comments_added' => __('Added', 'cleantalk'),
239
  'ct_comments_added_after' => __('comments', 'cleantalk'),
240
  'ct_confirm_deletion_all' => __('Delete all spam comments?', 'cleantalk'),
241
+ 'ct_confirm_deletion_checked' => __('Delete checked comments?', 'cleantalk'),
242
+ 'ct_status_string' => __("Total comments %s. Checked %s. Found %s spam comments. %s bad comments (without IP or email).", 'cleantalk'),
243
+ 'ct_status_string_warning' => "<p>".__("Please do backup of WordPress database before delete any accounts!", 'cleantalk')."</p>"
244
  ));
245
  wp_localize_script( 'jquery', 'ctCommentsScreen', array(
246
  'ct_ajax_nonce' => $ajax_nonce,
276
  'ct_confirm_deletion_all' => __('Delete all spam users?', 'cleantalk'),
277
  'ct_confirm_deletion_checked' => __('Delete checked users?', 'cleantalk'),
278
  'ct_csv_filename' => "user_check_by_".$current_user->user_login,
279
+ 'ct_bad_csv' => __("File doesn't exist. File will be generated while checking. Please, press \"Check for spam\"."),
280
+ 'ct_status_string' => __("Total users %s, checked %s, found %s spam users and %s bad users (without IP or email)", 'cleantalk'),
281
+ 'ct_status_string_warning' => "<p>".__("Please do backup of WordPress database before delete any accounts!", 'cleantalk')."</p>"
282
  ));
283
  wp_localize_script( 'jquery', 'ctUsersScreen', array(
284
  'spambutton_users_text' => __("Find spam-users", 'cleantalk'),
inc/cleantalk-ajax.php CHANGED
@@ -135,6 +135,9 @@ $cleantalk_hooked_actions[]='ninja_forms_ajax_submit';
135
  add_action( 'wp_ajax_nopriv_smuzform-storage', 'ct_ajax_hook',1 );
136
  $cleantalk_hooked_actions[]='smuzform_form_submit';
137
 
 
 
 
138
  function ct_validate_email_ajaxlogin($email=null, $is_ajax=true)
139
  {
140
  require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
@@ -326,7 +329,7 @@ function ct_ajax_hook($message_obj = false, $additional = false)
326
  $ct_data = ct_get_data();
327
  $sender_email = null;
328
  $message = '';
329
- $nickname=null;
330
  $contact = true;
331
  $subject = '';
332
 
@@ -363,9 +366,9 @@ function ct_ajax_hook($message_obj = false, $additional = false)
363
  }
364
 
365
  if(isset($_POST['user_login']))
366
- $nickname=$_POST['user_login'];
367
  else
368
- $nickname='';
369
 
370
  //QAEngine Theme answers
371
  if( !empty($message_obj) && isset($message_obj['post_type'], $message_obj['author'], $message_obj['post_content']) ){
@@ -393,7 +396,13 @@ function ct_ajax_hook($message_obj = false, $additional = false)
393
  $ct_post_temp = $_POST;
394
  $ct_post_temp['shortcode'] = '';
395
  }
396
-
 
 
 
 
 
 
397
  if(isset($ct_post_temp))
398
  $ct_temp_msg_data = ct_get_fields_any($ct_post_temp);
399
  else
@@ -434,7 +443,7 @@ function ct_ajax_hook($message_obj = false, $additional = false)
434
  'message' => $message,
435
  'example' => null,
436
  'sender_email' => $sender_email,
437
- 'sender_nickname' => $nickname,
438
  'sender_info' => $sender_info,
439
  'post_info'=> $post_info,
440
  'checkjs' => $checkjs
@@ -647,7 +656,6 @@ function ct_ajax_hook($message_obj = false, $additional = false)
647
  }
648
  // Smart Forms
649
  elseif (isset($_POST['action']) && $_POST['action'] == 'rednao_smart_forms_save_form_values'){
650
- error_log('true');
651
  $result = Array(
652
  'message' => $ct_result->comment,
653
  'refreshCaptcha' => 'n',
@@ -684,7 +692,17 @@ function ct_ajax_hook($message_obj = false, $additional = false)
684
  );
685
  print json_encode($result);
686
  die();
687
- }
 
 
 
 
 
 
 
 
 
 
688
  else
689
  {
690
  print $ct_result->comment;
135
  add_action( 'wp_ajax_nopriv_smuzform-storage', 'ct_ajax_hook',1 );
136
  $cleantalk_hooked_actions[]='smuzform_form_submit';
137
 
138
+ /* hooks for reviewer plugin*/
139
+ add_action( 'wp_ajax_nopriv_rwp_ajax_action_rating', 'ct_ajax_hook',1 );
140
+ $cleantalk_hooked_actions[]='rwp-submit-wrap';
141
  function ct_validate_email_ajaxlogin($email=null, $is_ajax=true)
142
  {
143
  require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
329
  $ct_data = ct_get_data();
330
  $sender_email = null;
331
  $message = '';
332
+ $sender_nickname = null;
333
  $contact = true;
334
  $subject = '';
335
 
366
  }
367
 
368
  if(isset($_POST['user_login']))
369
+ $sender_nickname = $_POST['user_login'];
370
  else
371
+ $sender_nickname = '';
372
 
373
  //QAEngine Theme answers
374
  if( !empty($message_obj) && isset($message_obj['post_type'], $message_obj['author'], $message_obj['post_content']) ){
396
  $ct_post_temp = $_POST;
397
  $ct_post_temp['shortcode'] = '';
398
  }
399
+ //Reviewer fix
400
+ if(isset($_POST['action']) && $_POST['action'] == 'rwp_ajax_action_rating')
401
+ {
402
+ $ct_post_temp['name'] = $_POST['user_name'];
403
+ $ct_post_temp['email'] = $_POST['user_email'];
404
+ $ct_post_temp['comment'] = $_POST['comment'];
405
+ }
406
  if(isset($ct_post_temp))
407
  $ct_temp_msg_data = ct_get_fields_any($ct_post_temp);
408
  else
443
  'message' => $message,
444
  'example' => null,
445
  'sender_email' => $sender_email,
446
+ 'sender_nickname' => $sender_nickname,
447
  'sender_info' => $sender_info,
448
  'post_info'=> $post_info,
449
  'checkjs' => $checkjs
656
  }
657
  // Smart Forms
658
  elseif (isset($_POST['action']) && $_POST['action'] == 'rednao_smart_forms_save_form_values'){
 
659
  $result = Array(
660
  'message' => $ct_result->comment,
661
  'refreshCaptcha' => 'n',
692
  );
693
  print json_encode($result);
694
  die();
695
+ }
696
+ //Reviewer
697
+ elseif(isset($_POST['action']) && $_POST['action'] == 'rwp_ajax_action_rating')
698
+ {
699
+ $result = Array(
700
+ 'success' => false,
701
+ 'data' => array(0=>$ct_result->comment)
702
+ );
703
+ print json_encode($result);
704
+ die();
705
+ }
706
  else
707
  {
708
  print $ct_result->comment;
inc/cleantalk-ajax_old.php DELETED
@@ -1,775 +0,0 @@
1
- <?php
2
-
3
- /*
4
- AJAX functions
5
- */
6
-
7
- /*hooks for AJAX Login & Register email validation*/
8
- add_action( 'wp_ajax_nopriv_validate_email', 'ct_validate_email_ajaxlogin',1 );
9
- add_action( 'wp_ajax_validate_email', 'ct_validate_email_ajaxlogin',1 );
10
-
11
- /*hooks for user registration*/
12
- add_action( 'user_register', 'ct_user_register_ajaxlogin',1 );
13
-
14
- /*hooks for WPUF pro */
15
- add_action( 'wp_ajax_nopriv_wpuf_submit_register', 'ct_wpuf_submit_register',1 );
16
- add_action( 'wp_ajax_wpuf_submit_register', 'ct_wpuf_submit_register',1 );
17
-
18
- /*hooks for MyMail */
19
- add_action( 'wp_ajax_nopriv_mymail_form_submit', 'ct_mymail_form_submit',1 );
20
- add_action( 'wp_ajax_mymail_form_submit', 'ct_mymail_form_submit',1 );
21
-
22
- /*hooks for MailPoet */
23
- add_action( 'wp_ajax_nopriv_wysija_ajax', 'ct_wysija_ajax',1 );
24
- add_action( 'wp_ajax_wysija_ajax', 'ct_wysija_ajax',1 );
25
-
26
- /*hooks for cs_registration_validation */
27
- add_action( 'wp_ajax_nopriv_cs_registration_validation', 'ct_cs_registration_validation',1 );
28
- add_action( 'wp_ajax_cs_registration_validation', 'ct_cs_registration_validation',1 );
29
-
30
- /*hooks for cs_registration_validation */
31
- add_action( 'wp_ajax_nopriv_cs_registration_validation', 'ct_cs_registration_validation',1 );
32
- add_action( 'wp_ajax_cs_registration_validation', 'ct_cs_registration_validation',1 );
33
-
34
- /*hooks for send_message and request_appointment */
35
- add_action( 'wp_ajax_nopriv_send_message', 'ct_sm_ra',1 );
36
- add_action( 'wp_ajax_send_message', 'ct_sm_ra',1 );
37
- add_action( 'wp_ajax_nopriv_request_appointment', 'ct_sm_ra',1 );
38
- add_action( 'wp_ajax_request_appointment', 'ct_sm_ra',1 );
39
-
40
- /*hooks for zn_do_login */
41
- add_action( 'wp_ajax_nopriv_zn_do_login', 'ct_zn_do_login',1 );
42
- add_action( 'wp_ajax_zn_do_login', 'ct_zn_do_login',1 );
43
-
44
- /*hooks for zn_do_login */
45
- add_action( 'wp_ajax_nopriv_cscf-submitform', 'ct_cscf_submitform',1 );
46
- add_action( 'wp_ajax_cscf-submitform', 'ct_cscf_submitform',1 );
47
-
48
- /*hooks for stats */
49
- add_action( 'wp_ajax_nopriv_ajax_get_stats', 'ct_get_stats',1 );
50
- add_action( 'wp_ajax_ajax_get_stats', 'ct_get_stats',1 );
51
-
52
- /*hooks for visual form builder */
53
- add_action( 'wp_ajax_nopriv_vfb_submit', 'ct_vfb_submit',1 );
54
- add_action( 'wp_ajax_vfb_submit', 'ct_vfb_submit',1 );
55
-
56
- function ct_get_stats()
57
- {
58
- check_ajax_referer( 'ct_secret_nonce', 'security' );
59
- global $ct_data;
60
- $ct_data=ct_get_data();
61
- $t=time();
62
-
63
- if(!isset($ct_data['stat_accepted']))
64
- {
65
- $ct_data['stat_accepted']=0;
66
- $ct_data['stat_blocked']=0;
67
- $ct_data['stat_all']=0;
68
- $ct_data['last_time']=$t;
69
- update_option('cleantalk_data', $ct_data);
70
- }
71
-
72
- $last_time=intval($ct_data['last_time']);
73
- if($t-$last_time>86400)
74
- {
75
- $ct_data['stat_accepted']=0;
76
- $ct_data['stat_blocked']=0;
77
- $ct_data['stat_all']=0;
78
- $ct_data['last_time']=$t;
79
- update_option('cleantalk_data', $ct_data);
80
- }
81
-
82
- $ret=Array('stat_accepted'=>$ct_data['stat_accepted'],'stat_blocked'=>$ct_data['stat_blocked'],'stat_all'=>$ct_data['stat_all']);
83
- print json_encode($ret);
84
- die();
85
- }
86
-
87
- function ct_validate_email_ajaxlogin($email=null, $is_ajax=true)
88
- {
89
- require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
90
- global $ct_agent_version, $ct_checkjs_register_form, $ct_session_request_id_label, $ct_session_register_ok_label, $bp, $ct_signup_done, $ct_formtime_label, $ct_negative_comment, $ct_options, $ct_data;
91
-
92
- $ct_options=ct_get_options();
93
- $ct_data=ct_get_data();
94
-
95
- $email = is_null( $email ) ? $email : $_POST['email'];
96
- $email=sanitize_email($email);
97
- $is_good=true;
98
- if ( ! filter_var( $email, FILTER_VALIDATE_EMAIL )||email_exists( $email ) )
99
- {
100
- $is_good=false;
101
- }
102
-
103
- if(class_exists('AjaxLogin')&&isset($_POST['action'])&&$_POST['action']=='validate_email')
104
- {
105
-
106
- $ct_options=ct_get_options();
107
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
108
- $submit_time = submit_time_test();
109
- $sender_info = get_sender_info();
110
- $sender_info['post_checkjs_passed']=$checkjs;
111
-
112
- if ($checkjs === null)
113
- {
114
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
115
- $sender_info['cookie_checkjs_passed'] = $checkjs;
116
- }
117
-
118
- $sender_info = json_encode($sender_info);
119
- if ($sender_info === false)
120
- {
121
- $sender_info= '';
122
- }
123
-
124
- require_once('cleantalk.class.php');
125
- $config = get_option('cleantalk_server');
126
- $ct = new Cleantalk();
127
- $ct->work_url = $config['ct_work_url'];
128
- $ct->server_url = $ct_options['server'];
129
-
130
- $ct->server_ttl = $config['ct_server_ttl'];
131
- $ct->server_changed = $config['ct_server_changed'];
132
- $ct->ssl_on = $ct_options['ssl_on'];
133
-
134
- $ct_request = new CleantalkRequest();
135
- $ct_request->auth_key = $ct_options['apikey'];
136
- $ct_request->sender_email = $email;
137
- $ct_request->sender_ip = $ct->ct_session_ip($_SERVER['REMOTE_ADDR']);
138
- $ct_request->sender_nickname = '';
139
- $ct_request->agent = $ct_agent_version;
140
- $ct_request->sender_info = $sender_info;
141
- $ct_request->js_on = $checkjs;
142
- $ct_request->submit_time = $submit_time;
143
-
144
- $ct_result = $ct->isAllowUser($ct_request);
145
-
146
- if ($ct->server_change)
147
- {
148
- update_option(
149
- 'cleantalk_server', array(
150
- 'ct_work_url' => $ct->work_url,
151
- 'ct_server_ttl' => $ct->server_ttl,
152
- 'ct_server_changed' => time()
153
- )
154
- );
155
- }
156
- if ($ct_result->allow===0)
157
- {
158
- $is_good=false;
159
- }
160
- }
161
- if($is_good)
162
- {
163
- $ajaxresult=array(
164
- 'description' => null,
165
- 'cssClass' => 'noon',
166
- 'code' => 'success'
167
- );
168
- }
169
- else
170
- {
171
- $ajaxresult=array(
172
- 'description' => 'Invalid Email',
173
- 'cssClass' => 'error-container',
174
- 'code' => 'error'
175
- );
176
- }
177
- $ajaxresult=json_encode($ajaxresult);
178
- print $ajaxresult;
179
- wp_die();
180
- }
181
-
182
- function ct_user_register_ajaxlogin($user_id)
183
- {
184
- require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
185
- global $ct_agent_version, $ct_checkjs_register_form, $ct_session_request_id_label, $ct_session_register_ok_label, $bp, $ct_signup_done, $ct_formtime_label, $ct_negative_comment, $ct_options, $ct_data;
186
-
187
- $ct_options=ct_get_options();
188
- $ct_data=ct_get_data();
189
-
190
- if(class_exists('AjaxLogin')&&isset($_POST['action'])&&$_POST['action']=='register_submit')
191
- {
192
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
193
- $submit_time = submit_time_test();
194
- $sender_info = get_sender_info();
195
- $sender_info['post_checkjs_passed']=$checkjs;
196
-
197
- if ($checkjs === null)
198
- {
199
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
200
- $sender_info['cookie_checkjs_passed'] = $checkjs;
201
- }
202
-
203
- $sender_info = json_encode($sender_info);
204
- if ($sender_info === false)
205
- {
206
- $sender_info= '';
207
- }
208
-
209
- require_once('cleantalk.class.php');
210
- $config = get_option('cleantalk_server');
211
- $ct = new Cleantalk();
212
- $ct->work_url = $config['ct_work_url'];
213
- $ct->server_url = $ct_options['server'];
214
-
215
- $ct->server_ttl = $config['ct_server_ttl'];
216
- $ct->server_changed = $config['ct_server_changed'];
217
- $ct->ssl_on = $ct_options['ssl_on'];
218
-
219
- $ct_request = new CleantalkRequest();
220
- $ct_request->auth_key = $ct_options['apikey'];
221
- $ct_request->sender_email = sanitize_email($_POST['email']);
222
- $ct_request->sender_ip = $ct->ct_session_ip($_SERVER['REMOTE_ADDR']);
223
- $ct_request->sender_nickname = sanitize_email($_POST['login']); ;
224
- $ct_request->agent = $ct_agent_version;
225
- $ct_request->sender_info = $sender_info;
226
- $ct_request->js_on = $checkjs;
227
- $ct_request->submit_time = $submit_time;
228
-
229
- $ct_result = $ct->isAllowUser($ct_request);
230
-
231
- if ($ct->server_change)
232
- {
233
- update_option(
234
- 'cleantalk_server', array(
235
- 'ct_work_url' => $ct->work_url,
236
- 'ct_server_ttl' => $ct->server_ttl,
237
- 'ct_server_changed' => time()
238
- )
239
- );
240
- }
241
- if ($ct_result->allow===0)
242
- {
243
- wp_delete_user($user_id);
244
- }
245
- }
246
- return $user_id;
247
- }
248
-
249
- function ct_wpuf_submit_register()
250
- {
251
- require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
252
- global $ct_agent_version, $ct_checkjs_register_form, $ct_session_request_id_label, $ct_session_register_ok_label, $bp, $ct_signup_done, $ct_formtime_label, $ct_negative_comment, $ct_options, $ct_data;
253
-
254
- $ct_data=ct_get_data();
255
-
256
- $ct_options=ct_get_options();
257
-
258
- $sender_email = null;
259
- $message = '';
260
-
261
- foreach ($_POST as $key => $value)
262
- {
263
- if ($sender_email === null && preg_match("/^\S+@\S+\.\S+$/", $value))
264
- {
265
- $sender_email = $value;
266
- }
267
- else
268
- {
269
- $message.="$value\n";
270
- }
271
- }
272
-
273
- if($sender_email!=null)
274
- {
275
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
276
- $submit_time = submit_time_test();
277
- $sender_info = get_sender_info();
278
- $sender_info['post_checkjs_passed']=$checkjs;
279
-
280
- $sender_info = json_encode($sender_info);
281
- if ($sender_info === false)
282
- {
283
- $sender_info= '';
284
- }
285
-
286
- $ct_base_call_result = ct_base_call(array(
287
- 'message' => $message,
288
- 'example' => null,
289
- 'sender_email' => $sender_email,
290
- 'sender_nickname' => null,
291
- 'sender_info' => $sender_info,
292
- 'post_info'=>null,
293
- 'checkjs' => $checkjs));
294
-
295
- $ct = $ct_base_call_result['ct'];
296
- $ct_result = $ct_base_call_result['ct_result'];
297
- if ($ct_result->allow == 0)
298
- {
299
- $result=Array('success'=>false,'error'=>$ct_result->comment);
300
- @header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
301
- print json_encode($result);
302
- die();
303
- }
304
- }
305
- }
306
-
307
- function ct_mymail_form_submit()
308
- {
309
- require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
310
- global $ct_agent_version, $ct_checkjs_register_form, $ct_session_request_id_label, $ct_session_register_ok_label, $bp, $ct_signup_done, $ct_formtime_label, $ct_negative_comment, $ct_options, $ct_data;
311
-
312
- $ct_data=ct_get_data();
313
-
314
- $ct_options=ct_get_options();
315
-
316
- $sender_email = null;
317
- $message = '';
318
-
319
- ct_get_fields($sender_email,$message,$_POST);
320
-
321
- if($sender_email!=null)
322
- {
323
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
324
- $submit_time = submit_time_test();
325
- $sender_info = get_sender_info();
326
- $sender_info['post_checkjs_passed']=$checkjs;
327
-
328
- $sender_info = json_encode($sender_info);
329
- if ($sender_info === false)
330
- {
331
- $sender_info= '';
332
- }
333
-
334
- $ct_base_call_result = ct_base_call(array(
335
- 'message' => $message,
336
- 'example' => null,
337
- 'sender_email' => $sender_email,
338
- 'sender_nickname' => null,
339
- 'sender_info' => $sender_info,
340
- 'post_info'=>null,
341
- 'checkjs' => $checkjs));
342
-
343
- $ct = $ct_base_call_result['ct'];
344
- $ct_result = $ct_base_call_result['ct_result'];
345
- if ($ct_result->allow == 0)
346
- {
347
- $result=Array('success'=>false,'html'=>$ct_result->comment);
348
- @header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
349
- print json_encode($result);
350
- die();
351
- }
352
- }
353
- }
354
-
355
- function ct_wysija_ajax()
356
- {
357
- require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
358
- global $ct_agent_version, $ct_checkjs_register_form, $ct_session_request_id_label, $ct_session_register_ok_label, $bp, $ct_signup_done, $ct_formtime_label, $ct_negative_comment, $ct_options, $ct_data;
359
-
360
- $ct_data=ct_get_data();
361
-
362
- $ct_options=ct_get_options();
363
-
364
- $sender_email = null;
365
- $message = '';
366
-
367
- ct_get_fields($sender_email,$message,$_POST);
368
-
369
-
370
- if($sender_email!=null&&isset($_GET['callback']))
371
- {
372
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
373
- $submit_time = submit_time_test();
374
- $sender_info = get_sender_info();
375
- $sender_info['post_checkjs_passed']=$checkjs;
376
-
377
- $sender_info = json_encode($sender_info);
378
- if ($sender_info === false)
379
- {
380
- $sender_info= '';
381
- }
382
-
383
- $ct_base_call_result = ct_base_call(array(
384
- 'message' => $message,
385
- 'example' => null,
386
- 'sender_email' => $sender_email,
387
- 'sender_nickname' => null,
388
- 'sender_info' => $sender_info,
389
- 'post_info'=>null,
390
- 'checkjs' => $checkjs));
391
-
392
- $ct = $ct_base_call_result['ct'];
393
- $ct_result = $ct_base_call_result['ct_result'];
394
- if ($ct_result->allow == 0)
395
- {
396
- $result=Array('result'=>false,'msgs'=>Array('updated'=>Array($ct_result->comment)));
397
- //@header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
398
- print $_GET['callback'].'('.json_encode($result).');';
399
- die();
400
- }
401
- }
402
- }
403
-
404
- function ct_cs_registration_validation()
405
- {
406
-
407
- require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
408
- global $ct_agent_version, $ct_checkjs_register_form, $ct_session_request_id_label, $ct_session_register_ok_label, $bp, $ct_signup_done, $ct_formtime_label, $ct_negative_comment, $ct_options, $ct_data;
409
-
410
- $ct_data=ct_get_data();
411
-
412
- $ct_options=ct_get_options();
413
-
414
- $sender_email = null;
415
- $message = '';
416
-
417
- ct_get_fields($sender_email,$message,$_POST);
418
-
419
- if($sender_email!=null)
420
- {
421
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
422
- $submit_time = submit_time_test();
423
- $sender_info = get_sender_info();
424
- $sender_info['post_checkjs_passed']=$checkjs;
425
-
426
- $sender_info = json_encode($sender_info);
427
- if ($sender_info === false)
428
- {
429
- $sender_info = '';
430
- }
431
- if(isset($_POST['user_login']))
432
- {
433
- $nickname=$_POST['user_login'];
434
- }
435
- else
436
- {
437
- $nickname='';
438
- }
439
- require_once('cleantalk.class.php');
440
-
441
- $config = get_option('cleantalk_server');
442
- $ct = new Cleantalk();
443
- $ct->work_url = $config['ct_work_url'];
444
- $ct->server_url = $ct_options['server'];
445
-
446
- $ct->server_ttl = $config['ct_server_ttl'];
447
- $ct->server_changed = $config['ct_server_changed'];
448
- $ct->ssl_on = $ct_options['ssl_on'];
449
-
450
-
451
- $ct_request = new CleantalkRequest();
452
- $ct_request->auth_key = $ct_options['apikey'];
453
- $ct_request->sender_email = $sender_email;
454
- $ct_request->sender_ip = $_SERVER['REMOTE_ADDR'];
455
- $ct_request->sender_nickname = $nickname;
456
- $ct_request->agent = $ct_agent_version;
457
- $ct_request->sender_info = $sender_info;
458
- $ct_request->js_on = $checkjs;
459
- $ct_request->submit_time = $submit_time;
460
-
461
- $ct_result = $ct->isAllowUser($ct_request);
462
-
463
- if ($ct_result->allow == 0)
464
- {
465
- $result=Array("type"=>"error","message"=>$ct_result->comment);
466
- print json_encode($result);
467
- die();
468
- }
469
- }
470
- }
471
-
472
- function ct_sm_ra()
473
- {
474
- require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
475
- global $ct_agent_version, $ct_checkjs_register_form, $ct_session_request_id_label, $ct_session_register_ok_label, $bp, $ct_signup_done, $ct_formtime_label, $ct_negative_comment, $ct_options, $ct_data;
476
-
477
- $ct_data=ct_get_data();
478
-
479
- $ct_options=ct_get_options();
480
-
481
- $sender_email = null;
482
- $message = '';
483
-
484
- if(isset($_POST['target']))
485
- {
486
- $tmp=$_POST['target'];
487
- $_POST['target']=1;
488
- }
489
-
490
- ct_get_fields($sender_email,$message,$_POST);
491
-
492
- if(isset($_POST['target']))
493
- {
494
- $_POST['target']=$tmp;
495
- }
496
-
497
-
498
- if($sender_email!=null)
499
- {
500
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
501
- $submit_time = submit_time_test();
502
- $sender_info = get_sender_info();
503
- $sender_info['post_checkjs_passed']=$checkjs;
504
-
505
- $sender_info = json_encode($sender_info);
506
- if ($sender_info === false)
507
- {
508
- $sender_info= '';
509
- }
510
-
511
- $ct_base_call_result = ct_base_call(array(
512
- 'message' => $message,
513
- 'example' => null,
514
- 'sender_email' => $sender_email,
515
- 'sender_nickname' => null,
516
- 'sender_info' => $sender_info,
517
- 'post_info'=>null,
518
- 'checkjs' => $checkjs));
519
-
520
- $ct = $ct_base_call_result['ct'];
521
- $ct_result = $ct_base_call_result['ct_result'];
522
- if ($ct_result->allow == 0)
523
- {
524
- print $ct_result->comment;
525
- die();
526
- }
527
- }
528
- }
529
-
530
- function ct_zn_do_login()
531
- {
532
- require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
533
- global $ct_agent_version, $ct_checkjs_register_form, $ct_session_request_id_label, $ct_session_register_ok_label, $bp, $ct_signup_done, $ct_formtime_label, $ct_negative_comment, $ct_options, $ct_data;
534
-
535
- $ct_data=ct_get_data();
536
-
537
- $ct_options=ct_get_options();
538
-
539
- $sender_email = null;
540
- $message = '';
541
-
542
- ct_get_fields($sender_email,$message,$_POST);
543
-
544
-
545
- if($sender_email!=null&&$_POST['zn_form_action']=='register')
546
- {
547
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
548
- $submit_time = submit_time_test();
549
- $sender_info = get_sender_info();
550
- $sender_info['post_checkjs_passed']=$checkjs;
551
-
552
- $sender_info = json_encode($sender_info);
553
- if ($sender_info === false)
554
- {
555
- $sender_info= '';
556
- }
557
-
558
- $ct_base_call_result = ct_base_call(array(
559
- 'message' => $message,
560
- 'example' => null,
561
- 'sender_email' => $sender_email,
562
- 'sender_nickname' => null,
563
- 'sender_info' => $sender_info,
564
- 'post_info'=>null,
565
- 'checkjs' => $checkjs));
566
-
567
- $ct = $ct_base_call_result['ct'];
568
- $ct_result = $ct_base_call_result['ct_result'];
569
- if ($ct_result->allow == 0)
570
- {
571
- print '<div id="login_error">'.$ct_result->comment.'</div>';
572
- die();
573
- }
574
- }
575
- }
576
-
577
- function ct_vfb_submit()
578
- {
579
- require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
580
- global $ct_agent_version, $ct_checkjs_register_form, $ct_session_request_id_label, $ct_session_register_ok_label, $bp, $ct_signup_done, $ct_formtime_label, $ct_negative_comment, $ct_options, $ct_data;
581
-
582
- $ct_data=ct_get_data();
583
-
584
- $ct_options=ct_get_options();
585
-
586
- $sender_email = null;
587
- $message = '';
588
-
589
- foreach ($_POST as $key => $value)
590
- {
591
- if ($sender_email === null && preg_match("/^\S+@\S+\.\S+$/", $value))
592
- {
593
- $sender_email = $value;
594
- }
595
- else
596
- {
597
- $message.="$value\n";
598
- }
599
- }
600
-
601
- if($sender_email!=null)
602
- {
603
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
604
- $submit_time = submit_time_test();
605
- $sender_info = get_sender_info();
606
- $sender_info['post_checkjs_passed']=$checkjs;
607
-
608
- $sender_info = json_encode($sender_info);
609
- if ($sender_info === false)
610
- {
611
- $sender_info= '';
612
- }
613
-
614
- $ct_base_call_result = ct_base_call(array(
615
- 'message' => $message,
616
- 'example' => null,
617
- 'sender_email' => $sender_email,
618
- 'sender_nickname' => null,
619
- 'sender_info' => $sender_info,
620
- 'post_info'=>null,
621
- 'checkjs' => $checkjs));
622
-
623
- $ct = $ct_base_call_result['ct'];
624
- $ct_result = $ct_base_call_result['ct_result'];
625
- if ($ct_result->allow == 0)
626
- {
627
- $result=Array('result'=>false,'message'=>$ct_result->comment);
628
- @header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
629
- print json_encode($result);
630
- die();
631
- }
632
- }
633
- }
634
-
635
- function ct_cscf_submitform()
636
- {
637
- require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
638
- global $ct_agent_version, $ct_checkjs_register_form, $ct_session_request_id_label, $ct_session_register_ok_label, $bp, $ct_signup_done, $ct_formtime_label, $ct_negative_comment, $ct_options, $ct_data;
639
-
640
- $ct_data=ct_get_data();
641
-
642
- $ct_options=ct_get_options();
643
-
644
- $sender_email = null;
645
- $message = '';
646
-
647
- if(isset($_POST['cscf']['confirm-email']))
648
- {
649
- $tmp=$_POST['cscf']['confirm-email'];
650
- $_POST['cscf']['confirm-email']=1;
651
- }
652
-
653
- ct_get_fields($sender_email,$message,$_POST);
654
-
655
- if(isset($_POST['cscf']['confirm-email']))
656
- {
657
- $_POST['cscf']['confirm-email']=$tmp;
658
- }
659
-
660
-
661
- if($sender_email!=null)
662
- {
663
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
664
- $submit_time = submit_time_test();
665
- $sender_info = get_sender_info();
666
- $sender_info['post_checkjs_passed']=$checkjs;
667
-
668
- $sender_info = json_encode($sender_info);
669
- if ($sender_info === false)
670
- {
671
- $sender_info= '';
672
- }
673
-
674
- $ct_base_call_result = ct_base_call(array(
675
- 'message' => $message,
676
- 'example' => null,
677
- 'sender_email' => $sender_email,
678
- 'sender_nickname' => null,
679
- 'sender_info' => $sender_info,
680
- 'post_info'=>null,
681
- 'checkjs' => $checkjs));
682
-
683
- $ct = $ct_base_call_result['ct'];
684
- $ct_result = $ct_base_call_result['ct_result'];
685
- if ($ct_result->allow == 0)
686
- {
687
- $result=Array('sent'=>true,'valid'=>false,'errorlist'=>Array('name'=>$ct_result->comment));
688
- print json_encode($result);
689
- die();
690
- }
691
- }
692
- }
693
-
694
- function ct_theme_submit()
695
- {
696
- require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
697
- global $ct_agent_version, $ct_checkjs_register_form, $ct_session_request_id_label, $ct_session_register_ok_label, $bp, $ct_signup_done, $ct_formtime_label, $ct_negative_comment, $ct_options, $ct_data;
698
-
699
- $ct_data=ct_get_data();
700
-
701
- $ct_options=ct_get_options();
702
-
703
- $sender_email = null;
704
- $message = '';
705
-
706
- if(isset($_POST['cscf']['confirm-email']))
707
- {
708
- $tmp=$_POST['cscf']['confirm-email'];
709
- $_POST['cscf']['confirm-email']=1;
710
- }
711
-
712
- ct_get_fields($sender_email,$message,$_POST);
713
-
714
- if(isset($_POST['cscf']['confirm-email']))
715
- {
716
- $_POST['cscf']['confirm-email']=$tmp;
717
- }
718
-
719
-
720
- if($sender_email!=null)
721
- {
722
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
723
- $submit_time = submit_time_test();
724
- $sender_info = get_sender_info();
725
- $sender_info['post_checkjs_passed']=$checkjs;
726
-
727
- $sender_info = json_encode($sender_info);
728
- if ($sender_info === false)
729
- {
730
- $sender_info= '';
731
- }
732
-
733
- $ct_base_call_result = ct_base_call(array(
734
- 'message' => $message,
735
- 'example' => null,
736
- 'sender_email' => $sender_email,
737
- 'sender_nickname' => null,
738
- 'sender_info' => $sender_info,
739
- 'post_info'=>null,
740
- 'checkjs' => $checkjs));
741
-
742
- $ct = $ct_base_call_result['ct'];
743
- $ct_result = $ct_base_call_result['ct_result'];
744
- if ($ct_result->allow == 0)
745
- {
746
- $result=Array('sent'=>true,'valid'=>false,'errorlist'=>Array('name'=>$ct_result->comment));
747
- print json_encode($result);
748
- die();
749
- }
750
- }
751
- }
752
-
753
- function ct_get_fields(&$email,&$message,$arr)
754
- {
755
- foreach($arr as $key=>$value)
756
- {
757
- if(!is_array($value))
758
- {
759
- if ($email === null && preg_match("/^\S+@\S+\.\S+$/", $value))
760
- {
761
- $email = $value;
762
- }
763
- else
764
- {
765
- $message.="$value\n";
766
- }
767
- }
768
- else
769
- {
770
- ct_get_fields($email,$message,$value);
771
- }
772
- }
773
- }
774
-
775
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/cleantalk-comments.php CHANGED
@@ -49,7 +49,7 @@ function ct_show_checkspam_page(){
49
  </div>
50
 
51
  <!-- Main info -->
52
- <h3 id="ct_checking_status"><?php ct_ajax_info_comments(true);?></h3>
53
 
54
  <!-- Cooling notice -->
55
  <h3 id="ct_cooling_notice"></h3>
@@ -104,8 +104,8 @@ function ct_show_checkspam_page(){
104
  <label class="screen-reader-text" for="cb-select-all-1">Select All</label>
105
  <input id="cb-select-all-1" type="checkbox" style="margin-top:0;"/>
106
  </th>
107
- <th scope="col" id="author" class="manage-column column-slug"><?php print _e( 'Author' );?></th>
108
- <th scope="col" id="comment" class="manage-column column-comment"><?php _e( 'Comment', 'cleantalk');;?></th>
109
  <th scope="col" id="response" class="manage-column column-response sortable desc"><?php _e( 'In Response To', 'cleantalk' );?></th>
110
  </thead>
111
  <tbody id="the-comment-list" data-wp-lists="list:comment">
@@ -267,11 +267,17 @@ function ct_ajax_check_comments(){
267
  'number'=>100,
268
  'status' => 'all'
269
  );
270
-
271
  $c=get_comments($args_unchecked);
272
-
273
  $c=array_values($c);
274
 
 
 
 
 
 
 
 
 
275
  if(sizeof($c)>0){
276
 
277
  foreach($c as $comment_index => $comment){
@@ -296,7 +302,8 @@ function ct_ajax_check_comments(){
296
  $curr_email = preg_match('/^\S+@\S+\.\S+$/', $curr_email) === 1 ? $curr_email : null;
297
 
298
  if(empty($curr_ip) && empty($curr_email)){
299
- update_comment_meta($c[$i]->comment_ID,'ct_bad','1',true);
 
300
  unset($c[$i]);
301
  $c = array_values($c);
302
  }else{
@@ -309,9 +316,13 @@ function ct_ajax_check_comments(){
309
  }
310
  }
311
 
312
- // Drop if data empty
313
- if(count($data) == 0)
314
- die('1');
 
 
 
 
315
 
316
  $data=implode(',',$data);
317
 
@@ -329,20 +340,25 @@ function ct_ajax_check_comments(){
329
  $result=sendRawRequest($url, $request, false, 5);
330
 
331
  if(empty($result)){
332
- echo "Connection error";
 
 
333
  }else{
334
 
335
  $result=json_decode($result);
336
  if(isset($result->error_message)){
337
 
338
  // Data not set, marks comments as checked to avoid loops.
339
- if (isset($result->error_no) && $result->error_no == 8) { // Data not set.
340
- for($i=0;$i<sizeof($c);$i++) {
341
- add_comment_meta($c[$i]->comment_ID,'ct_checked',date("Y-m-d H:m:s"),true);
342
- }
343
- print 1;
344
- }else
 
 
345
  print "Server response: ".$result->error_message;
 
346
 
347
  }else{
348
  for($i=0;$i<sizeof($c);$i++){
@@ -351,7 +367,8 @@ function ct_ajax_check_comments(){
351
  $mark_spam_ip = false;
352
  $mark_spam_email = false;
353
 
354
- add_comment_meta($c[$i]->comment_ID,'ct_checked',date("Y-m-d H:m:s"),true);
 
355
  $uip=$c[$i]->comment_author_IP;
356
  $uim=$c[$i]->comment_author_email;
357
 
@@ -361,15 +378,17 @@ function ct_ajax_check_comments(){
361
  if(isset($result->data->$uim) && $result->data->$uim->appears==1)
362
  $mark_spam_email = true;
363
 
364
- if ($mark_spam_ip || $mark_spam_email)
365
- add_comment_meta($c[$i]->comment_ID,'ct_marked_as_spam','1',true);
366
-
 
367
  }
368
- print 1;
369
  }
370
  }
371
  }else{
372
- print 0;
 
373
  }
374
 
375
  die;
@@ -396,18 +415,19 @@ function ct_ajax_info_comments($direct_call = true){
396
  );
397
  $cnt_spam=get_comments($args_spam);
398
 
 
399
  // Already checked by Cleantalk
400
- $args_checked1=array(
401
- 'meta_query' => array(
402
- Array(
403
- 'key' => 'ct_hash',
404
  // 'value'=>'1',
405
- 'compare' => 'EXISTS'
406
- )
407
- ),
408
- 'count'=>true
409
- );
410
- $cnt_checked1=get_comments($args_checked1);
411
 
412
  // Checked comments
413
  $args_checked2=array(
@@ -423,7 +443,8 @@ function ct_ajax_info_comments($direct_call = true){
423
  $cnt_checked2 =get_comments($args_checked2);
424
 
425
  // Total checked
426
- $cnt_checked =$cnt_checked1 + $cnt_checked2;
 
427
 
428
  // Bad comments (without IP and Email)
429
  $args_bad=array(
@@ -438,15 +459,25 @@ function ct_ajax_info_comments($direct_call = true){
438
  );
439
  $cnt_bad =get_comments($args_bad);
440
 
441
- printf (__("Total comments %s. Checked %s. Found %s spam comments. %d bad comments (without IP or email).", 'cleantalk'), $cnt, $cnt_checked, $cnt_spam, $cnt_bad);
442
- $backup_notice = '&nbsp;';
 
 
 
 
443
 
444
- if ($cnt_spam > 0)
 
445
  $backup_notice = __("Please do backup of WordPress database before delete any comments!", 'cleantalk');
 
 
446
 
447
- print "<p>$backup_notice</p>";
448
- if (!$direct_call)
449
- die();
 
 
 
450
 
451
  return null;
452
  }
49
  </div>
50
 
51
  <!-- Main info -->
52
+ <h3 id="ct_checking_status"><?php echo ct_ajax_info_comments(true);?></h3>
53
 
54
  <!-- Cooling notice -->
55
  <h3 id="ct_cooling_notice"></h3>
104
  <label class="screen-reader-text" for="cb-select-all-1">Select All</label>
105
  <input id="cb-select-all-1" type="checkbox" style="margin-top:0;"/>
106
  </th>
107
+ <th scope="col" id="author" class="manage-column column-slug"><?php print _e( 'Author' ); ?></th>
108
+ <th scope="col" id="comment" class="manage-column column-comment"><?php _e( 'Comment', 'cleantalk'); ?></th>
109
  <th scope="col" id="response" class="manage-column column-response sortable desc"><?php _e( 'In Response To', 'cleantalk' );?></th>
110
  </thead>
111
  <tbody id="the-comment-list" data-wp-lists="list:comment">
267
  'number'=>100,
268
  'status' => 'all'
269
  );
 
270
  $c=get_comments($args_unchecked);
 
271
  $c=array_values($c);
272
 
273
+ $check_result = array(
274
+ 'end' => 0,
275
+ 'checked' => 0,
276
+ 'spam' => 0,
277
+ 'bad' => 0,
278
+ 'error' => 0
279
+ );
280
+
281
  if(sizeof($c)>0){
282
 
283
  foreach($c as $comment_index => $comment){
302
  $curr_email = preg_match('/^\S+@\S+\.\S+$/', $curr_email) === 1 ? $curr_email : null;
303
 
304
  if(empty($curr_ip) && empty($curr_email)){
305
+ $check_result['bad']++;
306
+ update_comment_meta($c[$i]->comment_ID,'ct_bad','1');
307
  unset($c[$i]);
308
  $c = array_values($c);
309
  }else{
316
  }
317
  }
318
 
319
+ // Drop if data empty and there's no comments to check
320
+ if(count($data) == 0){
321
+ if($_POST['unchecked'] === 0)
322
+ $check_result['end'] = 1;
323
+ print json_encode($check_result);
324
+ die();
325
+ }
326
 
327
  $data=implode(',',$data);
328
 
340
  $result=sendRawRequest($url, $request, false, 5);
341
 
342
  if(empty($result)){
343
+ $check_result['error'] = 1;
344
+ $check_result['error_message'] = __('Connection error', 'cleantalk');
345
+ echo json_encode($check_result);
346
  }else{
347
 
348
  $result=json_decode($result);
349
  if(isset($result->error_message)){
350
 
351
  // Data not set, marks comments as checked to avoid loops.
352
+ // if (isset($result->error_no) && $result->error_no == 8) { // Data not set.
353
+ // for($i=0;$i<sizeof($c);$i++) {
354
+ // add_comment_meta($c[$i]->comment_ID,'ct_checked',date("Y-m-d H:m:s"),true);
355
+ // }
356
+ // print 1;
357
+ // }else{
358
+ $check_result['error'] = 1;
359
+ $check_result['error_message'] = __('Server response: ', 'cleantalk').$result->error_message;
360
  print "Server response: ".$result->error_message;
361
+ // }
362
 
363
  }else{
364
  for($i=0;$i<sizeof($c);$i++){
367
  $mark_spam_ip = false;
368
  $mark_spam_email = false;
369
 
370
+ $check_result['checked']++;
371
+ add_comment_meta($c[$i]->comment_ID,'ct_checked',date("Y-m-d H:m:s"));
372
  $uip=$c[$i]->comment_author_IP;
373
  $uim=$c[$i]->comment_author_email;
374
 
378
  if(isset($result->data->$uim) && $result->data->$uim->appears==1)
379
  $mark_spam_email = true;
380
 
381
+ if ($mark_spam_ip || $mark_spam_email){
382
+ $check_result['spam']++;
383
+ add_comment_meta($c[$i]->comment_ID,'ct_marked_as_spam','1');
384
+ }
385
  }
386
+ print json_encode($check_result);
387
  }
388
  }
389
  }else{
390
+ $check_result['end'] = 1;
391
+ print json_encode($check_result);
392
  }
393
 
394
  die;
415
  );
416
  $cnt_spam=get_comments($args_spam);
417
 
418
+
419
  // Already checked by Cleantalk
420
+ // $args_checked1=array(
421
+ // 'meta_query' => array(
422
+ // Array(
423
+ // 'key' => 'ct_hash',
424
  // 'value'=>'1',
425
+ // 'compare' => 'EXISTS'
426
+ // )
427
+ // ),
428
+ // 'count'=>true
429
+ // );
430
+ // $cnt_checked1=get_comments($args_checked1);
431
 
432
  // Checked comments
433
  $args_checked2=array(
443
  $cnt_checked2 =get_comments($args_checked2);
444
 
445
  // Total checked
446
+ // $cnt_checked =$cnt_checked1 + $cnt_checked2;
447
+ $cnt_checked = $cnt_checked2;
448
 
449
  // Bad comments (without IP and Email)
450
  $args_bad=array(
459
  );
460
  $cnt_bad =get_comments($args_bad);
461
 
462
+ $return = array(
463
+ 'message' => '',
464
+ 'total' => $cnt
465
+ );
466
+
467
+ $return['message'] .= sprintf (__("Total comments %s. Checked %s. Found %s spam comments. %s bad comments (without IP or email).", 'cleantalk'), $cnt, $cnt_checked, $cnt_spam, $cnt_bad);
468
 
469
+ $backup_notice = '&nbsp;';
470
+ if ($cnt_spam > 0){
471
  $backup_notice = __("Please do backup of WordPress database before delete any comments!", 'cleantalk');
472
+ }
473
+ $return['message'] .= "<p>$backup_notice</p>";
474
 
475
+ if($direct_call){
476
+ return $return['message'];
477
+ }else{
478
+ echo json_encode($return);
479
+ die();
480
+ }
481
 
482
  return null;
483
  }
inc/cleantalk-common.php CHANGED
@@ -402,19 +402,19 @@ function ct_get_admin_email() {
402
  */
403
  function ct_get_server($force=false) {
404
  global $ct_server;
405
- if(!$force && isset($ct_server) && isset($ct_server['ct_work_url']) && !empty($ct_server['ct_work_url']))
406
- {
407
  return $ct_server;
408
- }
409
- else
410
- {
411
  $ct_server = get_option('cleantalk_server');
412
  if (!is_array($ct_server)){
413
  $ct_server = array(
414
- 'ct_work_url' => NULL,
415
- 'ct_server_ttl' => NULL,
416
- 'ct_server_changed' => NULL
417
- );
418
  }
419
  return $ct_server;
420
  }
@@ -718,36 +718,38 @@ function ct_get_fields_any($arr, $message=array(), $email = null, $nickname = ar
718
  );
719
 
720
  $skip_fields_with_strings = array( //Array for strings in keys to skip and known service fields
721
- //Common
722
  'ct_checkjs', //Do not send ct_checkjs
723
  'nonce', //nonce for strings such as 'rsvp_nonce_name'
724
  'security',
725
  'action',
726
  'http_referer',
727
- //Formidable Form
728
  'form_key',
729
  'submit_entry',
730
- //Custom Contact Forms
731
  'form_id',
732
  'ccf_form',
733
  'form_page',
734
- //Qu Forms
735
  'iphorm_uid',
736
  'form_url',
737
  'post_id',
738
  'iphorm_ajax',
739
  'iphorm_id',
740
- //Fast SecureContact Froms
741
  'fs_postonce_1',
742
  'fscf_submitted',
743
  'mailto_id',
744
  'si_contact_action',
745
- //Ninja Forms
746
  'formData_id',
747
  'formData_settings',
748
- //E_signature
 
749
  'recipient_signature',
750
  'output_\d+_\w{0,2}',
 
751
  '_formId',
752
  '_returnLink'
753
  );
@@ -778,14 +780,14 @@ function ct_get_fields_any($arr, $message=array(), $email = null, $nickname = ar
778
  if($value === '')
779
  continue;
780
 
781
- //Skipping fields names with strings from (array)skip_fields_with_strings
782
  foreach($skip_fields_with_strings as $needle){
783
  if (preg_match("/".$needle."/", $prev_name.$key) == 1){
784
  continue(2);
785
  }
786
  }unset($needle);
787
 
788
- //Obfuscating params
789
  foreach($obfuscate_params as $needle){
790
  if (strpos($key, $needle) !== false){
791
  $value = ct_obfuscate_param($value);
@@ -799,11 +801,11 @@ function ct_get_fields_any($arr, $message=array(), $email = null, $nickname = ar
799
  // Decodes URL-encoded data to string.
800
  $value = urldecode($value);
801
 
802
- //Email
803
  if (!$email && preg_match("/^\S+@\S+\.\S+$/", $value)){
804
  $email = $value;
805
 
806
- //Names
807
  }elseif (preg_match("/name/i", $key)){
808
 
809
  if(preg_match("/first/i", $key) || preg_match("/fore/i", $key) || preg_match("/private/i", $key))
@@ -815,11 +817,11 @@ function ct_get_fields_any($arr, $message=array(), $email = null, $nickname = ar
815
  else
816
  $message[$prev_name.$key] = $value;
817
 
818
- //Subject
819
  }elseif ($subject === null && preg_match("/subj/i", $key)){
820
  $subject = $value;
821
 
822
- //Message
823
  }else{
824
  $message[$prev_name.$key] = $value;
825
  }
402
  */
403
  function ct_get_server($force=false) {
404
  global $ct_server;
405
+ if(!$force && isset($ct_server) && isset($ct_server['ct_work_url']) && !empty($ct_server['ct_work_url'])){
406
+
407
  return $ct_server;
408
+
409
+ }else{
410
+
411
  $ct_server = get_option('cleantalk_server');
412
  if (!is_array($ct_server)){
413
  $ct_server = array(
414
+ 'ct_work_url' => NULL,
415
+ 'ct_server_ttl' => NULL,
416
+ 'ct_server_changed' => NULL
417
+ );
418
  }
419
  return $ct_server;
420
  }
718
  );
719
 
720
  $skip_fields_with_strings = array( //Array for strings in keys to skip and known service fields
721
+ // Common
722
  'ct_checkjs', //Do not send ct_checkjs
723
  'nonce', //nonce for strings such as 'rsvp_nonce_name'
724
  'security',
725
  'action',
726
  'http_referer',
727
+ // Formidable Form
728
  'form_key',
729
  'submit_entry',
730
+ // Custom Contact Forms
731
  'form_id',
732
  'ccf_form',
733
  'form_page',
734
+ // Qu Forms
735
  'iphorm_uid',
736
  'form_url',
737
  'post_id',
738
  'iphorm_ajax',
739
  'iphorm_id',
740
+ // Fast SecureContact Froms
741
  'fs_postonce_1',
742
  'fscf_submitted',
743
  'mailto_id',
744
  'si_contact_action',
745
+ // Ninja Forms
746
  'formData_id',
747
  'formData_settings',
748
+ 'formData_fields_\d+_id',
749
+ // E_signature
750
  'recipient_signature',
751
  'output_\d+_\w{0,2}',
752
+ // Contact Form by Web-Settler protection
753
  '_formId',
754
  '_returnLink'
755
  );
780
  if($value === '')
781
  continue;
782
 
783
+ // Skipping fields names with strings from (array)skip_fields_with_strings
784
  foreach($skip_fields_with_strings as $needle){
785
  if (preg_match("/".$needle."/", $prev_name.$key) == 1){
786
  continue(2);
787
  }
788
  }unset($needle);
789
 
790
+ // Obfuscating params
791
  foreach($obfuscate_params as $needle){
792
  if (strpos($key, $needle) !== false){
793
  $value = ct_obfuscate_param($value);
801
  // Decodes URL-encoded data to string.
802
  $value = urldecode($value);
803
 
804
+ // Email
805
  if (!$email && preg_match("/^\S+@\S+\.\S+$/", $value)){
806
  $email = $value;
807
 
808
+ // Names
809
  }elseif (preg_match("/name/i", $key)){
810
 
811
  if(preg_match("/first/i", $key) || preg_match("/fore/i", $key) || preg_match("/private/i", $key))
817
  else
818
  $message[$prev_name.$key] = $value;
819
 
820
+ // Subject
821
  }elseif ($subject === null && preg_match("/subj/i", $key)){
822
  $subject = $value;
823
 
824
+ // Message
825
  }else{
826
  $message[$prev_name.$key] = $value;
827
  }
inc/cleantalk-public.php CHANGED
@@ -466,7 +466,7 @@ function ct_bp_private_msg_check( $bp_message_obj){
466
  $email = $sender_user_obj->data->user_email;
467
  $nickname = $sender_user_obj->data->user_login;
468
 
469
- $post_info['comment_type'] = 'feedback';
470
  $post_info['post_url'] = $_SERVER['HTTP_REFERER'];
471
  $post_info = json_encode($post_info);
472
  if ($post_info === false)
@@ -2374,11 +2374,11 @@ function ct_s2member_registration_test() {
2374
  $ct_result = $ct->isAllowUser($ct_request);
2375
  if ($ct->server_change) {
2376
  update_option(
2377
- 'cleantalk_server', array(
2378
- 'ct_work_url' => $ct->work_url,
2379
- 'ct_server_ttl' => $ct->server_ttl,
2380
- 'ct_server_changed' => time()
2381
- )
2382
  );
2383
  }
2384
 
466
  $email = $sender_user_obj->data->user_email;
467
  $nickname = $sender_user_obj->data->user_login;
468
 
469
+ $post_info['comment_type'] = 'buddypress_comment';
470
  $post_info['post_url'] = $_SERVER['HTTP_REFERER'];
471
  $post_info = json_encode($post_info);
472
  if ($post_info === false)
2374
  $ct_result = $ct->isAllowUser($ct_request);
2375
  if ($ct->server_change) {
2376
  update_option(
2377
+ 'cleantalk_server', array(
2378
+ 'ct_work_url' => $ct->work_url,
2379
+ 'ct_server_ttl' => $ct->server_ttl,
2380
+ 'ct_server_changed' => time()
2381
+ )
2382
  );
2383
  }
2384
 
inc/cleantalk-users.php CHANGED
@@ -27,6 +27,7 @@ function ct_show_users_page(){
27
  WHERE $wpdb->usermeta.meta_key='ct_marked_as_spam';"
28
  , ARRAY_A);
29
  $cnt_spam1=$r[0]['cnt'];
 
30
  ?>
31
  <div class="wrap">
32
  <h2><?php echo $ct_plugin_name; ?></h2><br />
@@ -47,7 +48,7 @@ function ct_show_users_page(){
47
  </div>
48
 
49
  <!-- Main info -->
50
- <h3 id="ct_checking_users_status" style="text-align:center;width:90%;"><?php ct_ajax_info_users(true);?></h3>
51
 
52
  <!-- Cooling notice -->
53
  <h3 id="ct_cooling_notice" style="text-align:center;width:90%;"></h3>
@@ -272,6 +273,14 @@ function ct_ajax_check_users(){
272
  );
273
  $u = get_users($args_unchecked);
274
 
 
 
 
 
 
 
 
 
275
  if(count($u) > 0){
276
 
277
  foreach($u as $user_index => $user){
@@ -300,6 +309,7 @@ function ct_ajax_check_users(){
300
  $curr_email = preg_match('/^\S+@\S+\.\S+$/', $curr_email) === 1 ? $curr_email : null;
301
 
302
  if(empty($curr_ip) && empty($curr_email)){
 
303
  update_user_meta($u[$i]->ID,'ct_bad','1',true);
304
  unset($u[$i]);
305
  $u = array_values($u);
@@ -313,9 +323,15 @@ function ct_ajax_check_users(){
313
  }
314
  }
315
 
316
- // Drop if data empty
317
- if(count($data) == 0)
318
- die('1');
 
 
 
 
 
 
319
 
320
  $data=implode(',',$data);
321
 
@@ -331,14 +347,18 @@ function ct_ajax_check_users(){
331
  $result=sendRawRequest($url, $request, false, 5);
332
 
333
  if(empty($result)){
334
- echo "Connection error";
 
 
335
  }else{
336
 
337
  $result = json_decode($result);
338
 
339
- if(isset($result->error_message))
 
 
340
  print "Server response: ".$result->error_message;
341
- else{
342
 
343
  // Opening CSV file
344
  $current_user = wp_get_current_user();
@@ -354,6 +374,7 @@ function ct_ajax_check_users(){
354
 
355
  for($i=0;$i<sizeof($u);$i++){
356
 
 
357
  update_user_meta($u[$i]->ID,'ct_checked',date("Y-m-d H:m:s"),true);
358
 
359
  // Do not display forbidden roles.
@@ -377,6 +398,7 @@ function ct_ajax_check_users(){
377
  $mark_spam_email = true;
378
 
379
  if ($mark_spam_ip || $mark_spam_email){
 
380
  update_user_meta($u[$i]->ID,'ct_marked_as_spam','1',true);
381
  $text .= $u[$i]->user_login.',';
382
  $text .= ($mark_spam_email ? $uim : '').',';
@@ -385,59 +407,64 @@ function ct_ajax_check_users(){
385
 
386
  }
387
  fwrite($file_desc, $text);
388
- fclose($file_desc);
389
- print 1;
390
  }
391
  }
392
- }else
393
- print 0;
394
-
 
395
  die;
396
  }
397
 
398
  function ct_ajax_info_users($direct_call = false)
399
  {
400
- if (!$direct_call) {
401
  check_ajax_referer( 'ct_secret_nonce', 'security' );
402
- }
403
 
404
- global $wpdb;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
405
 
406
- // All users
407
- // $r=$wpdb->get_results("
408
- // SELECT
409
- // COUNT(ID) AS cnt
410
- // FROM $wpdb->users
411
- // ");
412
- // $cnt = $r[0]->cnt;
413
- $args = array(
414
- 'total_users' => true
415
- );
416
- $user_query = new WP_User_Query($args);
417
- $cnt = $user_query->get_total();
418
-
419
- // Checked
420
- $r=$wpdb->get_results("select distinct count($wpdb->users.ID) as cnt from $wpdb->users inner join $wpdb->usermeta on $wpdb->users.ID=$wpdb->usermeta.user_id where $wpdb->usermeta.meta_key='ct_checked' or $wpdb->usermeta.meta_key='ct_hash';");
421
- $cnt_checked = $r[0]->cnt;
422
-
423
- //Spam
424
- $r=$wpdb->get_results("select distinct count($wpdb->users.ID) as cnt from $wpdb->users inner join $wpdb->usermeta on $wpdb->users.ID=$wpdb->usermeta.user_id where $wpdb->usermeta.meta_key='ct_marked_as_spam';", ARRAY_A);
425
- $cnt_spam = $r[0]['cnt'];
426
-
427
- //Bad
428
- $r=$wpdb->get_results("select distinct count($wpdb->users.ID) as cnt from $wpdb->users inner join $wpdb->usermeta on $wpdb->users.ID=$wpdb->usermeta.user_id where $wpdb->usermeta.meta_key='ct_bad';", ARRAY_A);
429
- $cnt_bad = $r[0]['cnt'];
430
-
431
- printf (__("Total users %s, checked %s, found %s spam users and %s bad users (without IP or email)", 'cleantalk'), $cnt, $cnt_checked, $cnt_spam, $cnt_bad);
432
  $backup_notice = '&nbsp;';
433
  if ($cnt_spam > 0) {
434
  $backup_notice = __("Please do backup of WordPress database before delete any accounts!", 'cleantalk');
435
  }
436
- print "<p>$backup_notice</p>";
437
-
438
- if (!$direct_call)
439
- die();
440
-
 
 
 
 
441
  return null;
442
  }
443
 
27
  WHERE $wpdb->usermeta.meta_key='ct_marked_as_spam';"
28
  , ARRAY_A);
29
  $cnt_spam1=$r[0]['cnt'];
30
+
31
  ?>
32
  <div class="wrap">
33
  <h2><?php echo $ct_plugin_name; ?></h2><br />
48
  </div>
49
 
50
  <!-- Main info -->
51
+ <h3 id="ct_checking_users_status" style="text-align:center;width:90%;"><?php echo ct_ajax_info_users(true); ?></h3>
52
 
53
  <!-- Cooling notice -->
54
  <h3 id="ct_cooling_notice" style="text-align:center;width:90%;"></h3>
273
  );
274
  $u = get_users($args_unchecked);
275
 
276
+ $check_result = array(
277
+ 'end' => 0,
278
+ 'checked' => 0,
279
+ 'spam' => 0,
280
+ 'bad' => 0,
281
+ 'error' => 0
282
+ );
283
+
284
  if(count($u) > 0){
285
 
286
  foreach($u as $user_index => $user){
309
  $curr_email = preg_match('/^\S+@\S+\.\S+$/', $curr_email) === 1 ? $curr_email : null;
310
 
311
  if(empty($curr_ip) && empty($curr_email)){
312
+ $check_result['bad']++;
313
  update_user_meta($u[$i]->ID,'ct_bad','1',true);
314
  unset($u[$i]);
315
  $u = array_values($u);
323
  }
324
  }
325
 
326
+ // Drop if data empty and there's no users to check
327
+ if(count($data) == 0){
328
+
329
+ if($_POST['unchecked'] === 0)
330
+ $check_result['end'] = 1;
331
+
332
+ print json_encode($check_result);
333
+ die();
334
+ }
335
 
336
  $data=implode(',',$data);
337
 
347
  $result=sendRawRequest($url, $request, false, 5);
348
 
349
  if(empty($result)){
350
+ $check_result['error'] = 1;
351
+ $check_result['error_message'] = __('Connection error', 'cleantalk');
352
+ print json_encode($check_result);
353
  }else{
354
 
355
  $result = json_decode($result);
356
 
357
+ if(isset($result->error_message)){
358
+ $check_result['error'] = 1;
359
+ $check_result['error_message'] = __('Server response: ', 'cleantalk').$result->error_message;
360
  print "Server response: ".$result->error_message;
361
+ }else{
362
 
363
  // Opening CSV file
364
  $current_user = wp_get_current_user();
374
 
375
  for($i=0;$i<sizeof($u);$i++){
376
 
377
+ $check_result['checked']++;
378
  update_user_meta($u[$i]->ID,'ct_checked',date("Y-m-d H:m:s"),true);
379
 
380
  // Do not display forbidden roles.
398
  $mark_spam_email = true;
399
 
400
  if ($mark_spam_ip || $mark_spam_email){
401
+ $check_result['spam']++;
402
  update_user_meta($u[$i]->ID,'ct_marked_as_spam','1',true);
403
  $text .= $u[$i]->user_login.',';
404
  $text .= ($mark_spam_email ? $uim : '').',';
407
 
408
  }
409
  fwrite($file_desc, $text);
410
+ fclose($file_desc);
411
+ print json_encode($check_result);
412
  }
413
  }
414
+ }else{
415
+ $check_result['end'] = 1;
416
+ print json_encode($check_result);
417
+ }
418
  die;
419
  }
420
 
421
  function ct_ajax_info_users($direct_call = false)
422
  {
423
+ if (!$direct_call)
424
  check_ajax_referer( 'ct_secret_nonce', 'security' );
 
425
 
426
+ global $wpdb;
427
+
428
+ // All users
429
+ $r=$wpdb->get_results("
430
+ SELECT
431
+ COUNT(ID) AS cnt
432
+ FROM $wpdb->users
433
+ ");
434
+ $cnt = $r[0]->cnt;
435
+
436
+ // Checked
437
+ $r=$wpdb->get_results("select distinct count($wpdb->users.ID) as cnt from $wpdb->users inner join $wpdb->usermeta on $wpdb->users.ID=$wpdb->usermeta.user_id where $wpdb->usermeta.meta_key='ct_checked' or $wpdb->usermeta.meta_key='ct_hash';");
438
+ $cnt_checked = $r[0]->cnt;
439
+
440
+ //Spam
441
+ $r=$wpdb->get_results("select distinct count($wpdb->users.ID) as cnt from $wpdb->users inner join $wpdb->usermeta on $wpdb->users.ID=$wpdb->usermeta.user_id where $wpdb->usermeta.meta_key='ct_marked_as_spam';", ARRAY_A);
442
+ $cnt_spam = $r[0]['cnt'];
443
+
444
+ //Bad
445
+ $r=$wpdb->get_results("select distinct count($wpdb->users.ID) as cnt from $wpdb->users inner join $wpdb->usermeta on $wpdb->users.ID=$wpdb->usermeta.user_id where $wpdb->usermeta.meta_key='ct_bad';", ARRAY_A);
446
+ $cnt_bad = $r[0]['cnt'];
447
+
448
+ $return = array(
449
+ 'message' => '',
450
+ 'total' => $cnt
451
+ );
452
+
453
+ $return['message'] .= sprintf (__("Total users %s, checked %s, found %s spam users and %s bad users (without IP or email)", 'cleantalk'), $cnt, $cnt_checked, $cnt_spam, $cnt_bad);
454
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
455
  $backup_notice = '&nbsp;';
456
  if ($cnt_spam > 0) {
457
  $backup_notice = __("Please do backup of WordPress database before delete any accounts!", 'cleantalk');
458
  }
459
+ $return['message'] .= "<p>$backup_notice</p>";
460
+
461
+ if($direct_call){
462
+ return json_encode($return);
463
+ }else{
464
+ echo json_encode($return);
465
+ die();
466
+ }
467
+
468
  return null;
469
  }
470
 
inc/cleantalk.class.php CHANGED
@@ -831,7 +831,8 @@ class Cleantalk {
831
 
832
  if ($records !== FALSE) {
833
  foreach ($records as $server) {
834
- $response[] = array("ip" => $server,
 
835
  "host" => $host,
836
  "ttl" => $this->server_ttl
837
  );
@@ -974,7 +975,8 @@ class Cleantalk {
974
  * @return string
975
  */
976
  function stringToUTF8($str, $data_codepage = null){
977
- if (!preg_match('//u', $str) && function_exists('mb_detect_encoding') && function_exists('mb_convert_encoding')) {
 
978
 
979
  if ($data_codepage !== null)
980
  return mb_convert_encoding($str, 'UTF-8', $data_codepage);
@@ -994,7 +996,8 @@ class Cleantalk {
994
  * @return string
995
  */
996
  function stringFromUTF8($str, $data_codepage = null){
997
- if (preg_match('//u', $str) && function_exists('mb_convert_encoding') && $data_codepage !== null) {
 
998
  return mb_convert_encoding($str, $data_codepage, 'UTF-8');
999
  }
1000
 
831
 
832
  if ($records !== FALSE) {
833
  foreach ($records as $server) {
834
+ $response[] = array(
835
+ "ip" => $server,
836
  "host" => $host,
837
  "ttl" => $this->server_ttl
838
  );
975
  * @return string
976
  */
977
  function stringToUTF8($str, $data_codepage = null){
978
+ if (!preg_match('//u', $str) && function_exists('mb_detect_encoding') && function_exists('mb_convert_encoding'))
979
+ {
980
 
981
  if ($data_codepage !== null)
982
  return mb_convert_encoding($str, 'UTF-8', $data_codepage);
996
  * @return string
997
  */
998
  function stringFromUTF8($str, $data_codepage = null){
999
+ if (preg_match('//u', $str) && function_exists('mb_convert_encoding') && $data_codepage !== null)
1000
+ {
1001
  return mb_convert_encoding($str, $data_codepage, 'UTF-8');
1002
  }
1003
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: znaeff, shagimuratov, serge00, sartemd174, amagsumov
3
  Tags: antispam, protection, contact form, comments, spam
4
  Requires at least: 3.0
5
  Tested up to: 4.8
6
- Stable tag: 5.68
7
  License: GPLv2
8
 
9
  Spam protection, antispam, all-in-one, premium plugin. No spam comments & users, no spam contact form & WooCommerce spam. Forget spam.
@@ -504,6 +504,12 @@ We develop plugin to do it as optimized as possible, CleanTalk doesn't downgrade
504
  1. The Dashboard with a map of most spam active countries per your account.
505
 
506
  == Changelog ==
 
 
 
 
 
 
507
  = 5.68 June 22 2017 =
508
  * Contact Form for WordPress - Ultimate Form Builder Lite - integration.
509
  * Contact Bank - Contact Forms Builder - integration.
@@ -1375,6 +1381,12 @@ We develop plugin to do it as optimized as possible, CleanTalk doesn't downgrade
1375
  * First version
1376
 
1377
  == Upgrade Notice ==
 
 
 
 
 
 
1378
  = 5.68 June 22 2017 =
1379
  * Contact Form for WordPress - Ultimate Form Builder Lite - integration.
1380
  * Contact Bank - Contact Forms Builder - integration.
3
  Tags: antispam, protection, contact form, comments, spam
4
  Requires at least: 3.0
5
  Tested up to: 4.8
6
+ Stable tag: 5.69
7
  License: GPLv2
8
 
9
  Spam protection, antispam, all-in-one, premium plugin. No spam comments & users, no spam contact form & WooCommerce spam. Forget spam.
504
  1. The Dashboard with a map of most spam active countries per your account.
505
 
506
  == Changelog ==
507
+ = 5.69 July 3 2017 =
508
+ * Reviewer - integration.
509
+ * Optimization for Users and Comments check for big databases.
510
+ * Errors fixes.
511
+ * Improved protection from spam.
512
+
513
  = 5.68 June 22 2017 =
514
  * Contact Form for WordPress - Ultimate Form Builder Lite - integration.
515
  * Contact Bank - Contact Forms Builder - integration.
1381
  * First version
1382
 
1383
  == Upgrade Notice ==
1384
+ = 5.69 July 3 2017 =
1385
+ * Reviewer - integration.
1386
+ * Optimization for Users and Comments check for big databases.
1387
+ * Errors fixes.
1388
+ * Improved protection from spam.
1389
+
1390
  = 5.68 June 22 2017 =
1391
  * Contact Form for WordPress - Ultimate Form Builder Lite - integration.
1392
  * Contact Bank - Contact Forms Builder - integration.