Spam protection, AntiSpam, FireWall by CleanTalk - Version 5.127.4

Version Description

October 13 2019 = * Mod: Automatically decrease amount of checked users by one request if an error occurs. * Fix: Security issue. * Fix: Static JS key.

Download this release

Release Info

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

Code changes from version 5.127.3 to 5.127.4

cleantalk.php CHANGED
@@ -3,7 +3,7 @@
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.
6
- Version: 5.127.3
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  Text Domain: cleantalk
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.
6
+ Version: 5.127.4
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  Text Domain: cleantalk
inc/cleantalk-ajax.php CHANGED
@@ -281,6 +281,8 @@ function ct_ajax_hook($message_obj = false, $additional = false)
281
  'ihc_check_reg_field_ajax', //Ajax check required fields
282
  'OSTC_lostPassword', //Lost password ajax form
283
  'check_retina_image_availability', //There are too many ajax requests from mobile
 
 
284
  );
285
 
286
  // Skip test if
281
  'ihc_check_reg_field_ajax', //Ajax check required fields
282
  'OSTC_lostPassword', //Lost password ajax form
283
  'check_retina_image_availability', //There are too many ajax requests from mobile
284
+ 'uap_check_reg_field_ajax', // Ultimate Affiliate Pro. Form validation.
285
+ 'edit-comment', // Edit comments by admin ??? that shouldn't happen
286
  );
287
 
288
  // Skip test if
inc/cleantalk-comments.php CHANGED
@@ -1,661 +1,661 @@
1
- <?php
2
-
3
- add_action('admin_menu', 'ct_add_comments_menu');
4
- add_action( 'wp_ajax_ajax_check_comments', 'ct_ajax_check_comments' );
5
- add_action( 'wp_ajax_ajax_info_comments', 'ct_ajax_info_comments' );
6
- add_action( 'wp_ajax_ajax_insert_comments', 'ct_ajax_insert_comments' );
7
- add_action( 'wp_ajax_ajax_delete_checked', 'ct_ajax_delete_checked' );
8
- add_action( 'wp_ajax_ajax_delete_all', 'ct_ajax_delete_all' );
9
- add_action( 'wp_ajax_ajax_clear_comments', 'ct_ajax_clear_comments' );
10
- add_action( 'wp_ajax_ajax_ct_approve_comment', 'ct_comment_check_approve_comment' );
11
-
12
- function ct_add_comments_menu(){
13
- if(current_user_can('activate_plugins'))
14
- add_comments_page( __("Check for spam", 'cleantalk'), __("Find spam comments", 'cleantalk'), 'read', 'ct_check_spam', 'ct_show_checkspam_page');
15
- }
16
-
17
- function ct_show_checkspam_page(){
18
-
19
- global $apbct;
20
-
21
- ?>
22
- <div class="wrap">
23
- <h2><img src="<?php echo $apbct->logo__small__colored; ?>" /> <?php echo $apbct->plugin_name; ?></h2>
24
- <a style="color: gray; margin-left: 23px;" href="<?php echo $apbct->settings_link; ?>"><?php _e('Plugin Settings', 'cleantalk'); ?></a>
25
- <br />
26
- <?php
27
-
28
- // If access key is unset in
29
- if(!apbct_api_key__is_correct()){
30
- if($apbct->moderate_ip == 1){
31
- echo '<h3>'
32
- .sprintf(
33
- __('Antispam hosting tariff does not allow you to use this feature. To do so, you need to enter an Access Key in the %splugin settings%s.', 'cleantalk'),
34
- '<a href="' . (is_network_admin() ? 'settings.php?page=cleantalk' : 'options-general.php?page=cleantalk').'">',
35
- '</a>'
36
- )
37
- .'</h3>';
38
- return;
39
- }
40
- }
41
-
42
- // Getting total spam comments
43
- $args_spam = array(
44
- 'meta_query' => array(
45
- Array(
46
- 'key' => 'ct_marked_as_spam',
47
- 'compare' => 'EXISTS'
48
- )
49
- ),
50
- 'count'=>true
51
- );
52
- $cnt_spam = get_comments($args_spam);
53
-
54
- ?>
55
- <!-- AJAX error message -->
56
- <div id="ct_error_message" style="display:none">
57
- <h3>
58
- <?php _e("Ajax error. Process will be automatically restarted in 3 seconds. Status: ", 'cleantalk'); ?><span id="cleantalk_ajax_error"></span> (<span id="cleantalk_js_func"></span>)
59
- </h3>
60
- <h4>Please, check for JavaScript errors in your dashboard and and repair it.</h4>
61
- </div>
62
-
63
- <!-- Deleting message -->
64
- <div id="ct_deleting_message" style="display:none;">
65
- <?php _e("Please wait for a while. CleanTalk is deleting spam comments. Comments left: ", 'cleantalk'); ?> <span id="cleantalk_comments_left">
66
- <?php echo $cnt_spam; ?>
67
- </span>
68
- </div>
69
-
70
- <!-- Main info -->
71
- <h3 id="ct_checking_status"><?php echo ct_ajax_info_comments(true);?></h3>
72
-
73
- <!-- Check options -->
74
- <div class="ct_to_hide" id="ct_check_params_wrapper">
75
- <button class="button ct_check_params_elem" id="ct_check_spam_button" <?php echo !$apbct->data['moderate'] ? 'disabled="disabled"' : ''; ?>><?php _e("Start check", 'cleantalk'); ?></button>
76
- <?php if(!empty($_COOKIE['ct_paused_comments_check'])) { ?><button class="button ct_check_params_elem" id="ct_proceed_check_button"><?php _e("Continue check", 'cleantalk'); ?></button><?php } ?>
77
- <p class="ct_check_params_desc"><?php _e("The plugin will check all comments against blacklists database and show you senders that have spam activity on other websites.", 'cleantalk'); ?></p>
78
- <br />
79
- <div class="ct_check_params_elem ct_check_params_elem_sub">
80
- <input id="ct_accurate_check" type="checkbox" value="1" /><b><label for="ct_accurate_check"><?php _e("Accurate check", 'cleantalk'); ?></b></label>
81
- </div>
82
- <p class="ct_check_params_desc"><?php _e("Allows to use comment's dates to perform more accurate check. Could seriously slow down the check.", 'cleantalk'); ?></p>
83
- <br />
84
- <div class="ct_check_params_elem ct_check_params_elem_sub">
85
- <input id="ct_allow_date_range" type="checkbox" value="1" /><label for="ct_allow_date_range"><b><?php _e("Specify date range", 'cleantalk'); ?></b></label>
86
- </div>
87
- <div class="ct_check_params_desc">
88
- <input class="ct_date" type="text" id="ct_date_range_from" value="<?php echo isset($_GET['from']) ? $_GET['from'] : ''; ?>" disabled readonly />
89
- <input class="ct_date" type="text" id="ct_date_range_till" value="<?php echo isset($_GET['till']) ? $_GET['till'] : ''; ?>" disabled readonly />
90
- </div>
91
- <br>
92
- <?php apbct_admin__badge__get_premium(); ?>
93
- </div>
94
-
95
- <!-- Cooling notice -->
96
- <h3 id="ct_cooling_notice"></h3>
97
-
98
- <!-- Preloader and working message -->
99
- <div id="ct_preloader">
100
- <img border=0 src="<?php print plugin_dir_url(__FILE__); ?>images/preloader.gif" />
101
- </div>
102
- <div id="ct_working_message">
103
- <?php _e("Please wait! CleanTalk is checking all approved and pending comments via blacklist database at cleantalk.org. You will have option to delete found spam comments after plugin finish.", 'cleantalk'); ?>
104
- </div>
105
-
106
- <!-- Pause button -->
107
- <button class="button" id="ct_pause">Pause check</button>
108
-
109
- <?php
110
-
111
- // Pagination
112
- $page = !empty($_GET['spam_page']) ? intval($_GET['spam_page']) : 1;
113
- $on_page = 20;
114
-
115
- $args_spam = array(
116
- 'meta_query' => array(
117
- Array(
118
- 'key' => 'ct_marked_as_spam',
119
- 'value' => '1',
120
- 'compare' => 'NUMERIC'
121
- )
122
- ),
123
- 'number'=>$on_page,
124
- 'offset'=>($page-1)*$on_page
125
- );
126
-
127
- $c_spam = get_comments($args_spam);
128
- if($cnt_spam>0){
129
-
130
- $pages = ceil(intval($cnt_spam)/$on_page);
131
- if($pages && $pages != 1){
132
- echo "<div class='ct_to_hide pagination'>"
133
- ."<b>Pages:</b>"
134
- ."<ul class='pagination'>";
135
- for($i = 1; $i <= $pages; $i++){
136
- echo "<li class='pagination'>"
137
- ."<a href='edit-comments.php?page=ct_check_spam&spam_page=$i&ct_worked=1'>"
138
- .($i == $page ? "<span class='current_page'>$i</span>" : $i)
139
- ."</a>"
140
- ."</li>";
141
- }
142
- echo "</ul>";
143
- echo "</div>";
144
- }
145
- ?>
146
- <table class="ct_to_hide widefat fixed comments" id="ct_check_comments_table">
147
- <thead>
148
- <th scope="col" id="cb" class="manage-column column-cb check-column">
149
- <label class="screen-reader-text" for="cb-select-all-1">Select All</label>
150
- <input id="cb-select-all-1" type="checkbox" style="margin-top:0;"/>
151
- </th>
152
- <th scope="col" id="author" class="manage-column column-slug"><?php print _e( 'Author' ); ?></th>
153
- <th scope="col" id="comment" class="manage-column column-comment"><?php _e( 'Comment', 'cleantalk'); ?></th>
154
- <th scope="col" id="response" class="manage-column column-response sortable desc"><?php _e( 'In Response To', 'cleantalk' );?></th>
155
- </thead>
156
- <tbody id="the-comment-list" data-wp-lists="list:comment">
157
- <?php
158
- for($i=0;$i<sizeof($c_spam);$i++){
159
- $id = $c_spam[$i]->comment_ID;
160
- $post_id = $c_spam[$i]->comment_post_ID;
161
- $login = $c_spam[$i]->comment_author;
162
- $email = $c_spam[$i]->comment_author_email;
163
- $ip = $c_spam[$i]->comment_author_IP;
164
-
165
- echo "<tr id='comment-$id' class='comment even thread-even depth-1 approved cleantalk_comment' data-id='$id'>"
166
- ."<th scope='row' class='check-column'>"
167
- ."<label class='screen-reader-text' for='cb-select-$id'>Select comment</label>"
168
- ."<input id='cb-select-$id' type='checkbox' name='del_comments[]' value='$id'/>"
169
- ."</th>"
170
- ."<td class='author column-author' nowrap>"
171
- ."<strong>"
172
- .get_avatar( $c_spam[$i]->user_id , 32)
173
- ."$login"
174
- ."</strong>"
175
- ."<br />"
176
- ."<br />";
177
-
178
- // Outputs email if exists
179
- if($email)
180
- echo "<a href='mailto:$email'>$email</a>"
181
- .(!$apbct->white_label
182
- ? "<a href='https://cleantalk.org/blacklists/$email' target='_blank'>"
183
- ."&nbsp;<img src='".plugin_dir_url(__FILE__)."images/new_window.gif' border='0' style='float:none' />"
184
- ."</a>"
185
- : '');
186
- else
187
- echo "No email";
188
- echo "<br/>";
189
-
190
- // Outputs IP if exists
191
- if($ip)
192
- echo "<a href='edit-comments.php?s=$ip&mode=detail'>$ip </a>"
193
- .(!$apbct->white_label
194
- ?"<a href='https://cleantalk.org/blacklists/$ip ' target='_blank'>"
195
- ."&nbsp;<img src='".plugin_dir_url(__FILE__)."images/new_window.gif' border='0' style='float:none'/>"
196
- ."</a>"
197
- : '');
198
- else
199
- echo "No IP adress";
200
- echo "</td>";
201
- ?>
202
- <td class="comment column-comment">
203
- <div class="submitted-on">
204
- <?php printf( __( 'Submitted on <a href="%1$s">%2$s at %3$s</a>' ), get_comment_link($id),
205
- /* translators: comment date format. See http://php.net/date */
206
- get_comment_date( __( 'Y/m/d' ),$id ),
207
- get_comment_date( get_option( 'time_format' ),$id )
208
- );
209
- ?>
210
-
211
- </div>
212
- <p>
213
- <?php print $c_spam[$i]->comment_content; ?>
214
- </p>
215
- <div style="height:16px; display: none;" id='cleantalk_button_set_<?php print $id; ?>'>
216
- <a href="#" class="cleantalk_delete_from_list_button" data-id="<?php print $id; ?>" style="color:#0a0;" onclick="return false;" onmouseover="this.style.textDecoration='underline';" onmouseout="this.style.textDecoration='none';"><?php _e("Approve", "cleantalk"); ?></a>
217
- &nbsp;|&nbsp;
218
- <a href="#" class="cleantalk_delete_button" data-id="<?php print $id; ?>" style="color:#a00;" onclick="return false;" onmouseover="this.style.textDecoration='underline';" onmouseout="this.style.textDecoration='none';"><?php _e("Delete", "cleantalk"); ?></a>
219
- </div>
220
- </td>
221
- <td class="response column-response">
222
- <div>
223
- <span>
224
- <a href="/wp-admin/post.php?post=<?php print $post_id; ?>&action=edit"><?php print get_the_title($post_id); ?></a>
225
- <br/>
226
- <a href="/wp-admin/edit-comments.php?p=<?php print $post_id; ?>" class="post-com-count">
227
- <span class="comment-count"><?php
228
- $p_cnt=wp_count_comments();
229
- print $p_cnt->total_comments;
230
- ?></span>
231
- </a>
232
- </span>
233
- <a href="<?php print get_permalink($post_id); ?>"><?php print _e('View Post');?></a>
234
- </div>
235
- </td>
236
- </tr>
237
- <?php
238
- }
239
- ?>
240
- </tbody>
241
- </table>
242
- <?php
243
- // Pagination
244
- if($pages && $pages != 1){
245
- echo "<div class='ct_to_hide pagination'>"
246
- ."<b>Pages:</b>"
247
- ."<ul class='pagination'>";
248
- for($i = 1; $i <= $pages; $i++){
249
- echo "<li class='pagination'>"
250
- ."<a href='edit-comments.php?page=ct_check_spam&spam_page=$i&ct_worked=1'>"
251
- .($i == $page ? "<span class='current_page'>$i</span>" : $i)
252
- ."</a>"
253
- ."</li>";
254
- }
255
- echo "</ul>";
256
- echo "</div>";
257
- }
258
- ?>
259
- <div class="ct_to_hide" id="ct_tools_buttons" style="margin-top: 10px;">
260
- <button class= "button" id="ct_delete_all"><?php _e('Delete all comments from the list', 'cleantalk'); ?></button>
261
- <button class="button" id="ct_delete_checked"><?php _e('Delete selected', 'cleantalk'); ?></button><br /><br />
262
- </div>
263
- <?php
264
- }
265
- echo $_SERVER['REMOTE_ADDR']=='127.0.0.1' ? '<button class="button ct_to_hide" id="ct_insert_comments">'. __('Insert comments', 'cleantalk') .' (100)</button> ' : '';
266
- echo $_SERVER['REMOTE_ADDR']=='127.0.0.1' ? '<button class="button ct_to_hide" id="ct_delete_comments">'. __('Delete comments', 'cleantalk') .' (110)</button>' : '';
267
-
268
- if($cnt_spam > 0){
269
- echo "<div id='ct_search_info'>"
270
- ."<br />"
271
- .__('There is some differencies between blacklists database and our API mechanisms. Blacklists shows all history of spam activity, but our API (that used in spam checking) used another parameters, too: last day of activity, number of spam attacks during last days etc. This mechanisms help us to reduce number of false positivitie. So, there is nothing strange, if some emails/IPs will be not found by this checking.', 'cleantalk')
272
- ."</div>";
273
- }
274
- ?>
275
- <div>
276
- <button class="button" id="ct_stop_deletion" style="display:none;"><?php _e("Stop deletion", 'cleantalk'); ?></button>
277
- </div>
278
- </div>
279
- <?php
280
- }
281
-
282
- function ct_ajax_check_comments(){
283
-
284
- check_ajax_referer( 'ct_secret_nonce', 'security' );
285
-
286
- global $wpdb, $apbct;
287
-
288
- if(isset($_POST['from'], $_POST['till'])){
289
- $from_date = date('Y-m-d', intval(strtotime($_POST['from'])));
290
- $till_date = date('Y-m-d', intval(strtotime($_POST['till'])));
291
- }
292
-
293
- // Gettings comments 100 unchecked comments
294
- if(isset($_COOKIE['ct_comments_safe_check'])){
295
- $c = $wpdb->get_results("
296
- SELECT comment_ID, comment_date_gmt, comment_author_IP, comment_author_email
297
- FROM {$wpdb->comments} as comm
298
- WHERE
299
- (comm.comment_approved = '1' OR comm.comment_approved = '0')
300
- AND NOT EXISTS(
301
- SELECT comment_id, meta_key
302
- FROM {$wpdb->commentmeta} as meta
303
- WHERE comm.comment_ID = meta.comment_id AND (meta_key = 'ct_checked' OR meta_key = 'ct_bad')
304
- )
305
- ORDER BY comment_date_gmt
306
- LIMIT 100",
307
- ARRAY_A
308
- );
309
- }else{
310
- $params = array(
311
- 'meta_query' => array(
312
- 'relation' => 'AND',
313
- array(
314
- 'key' => 'ct_checked',
315
- 'compare' => 'NOT EXISTS'
316
- ),
317
- array(
318
- 'key' => 'ct_bad',
319
- 'compare' => 'NOT EXISTS'
320
- )
321
- ),
322
- 'orderby' => 'comment_date_gmt',
323
- 'order' => 'ASC',
324
- 'number' => 100
325
- );
326
- if(isset($from_date, $till_date)){
327
- $params['date_query'] = array(
328
- 'column' => 'comment_date_gmt',
329
- 'after' => $from_date,
330
- 'before' => $till_date,
331
- 'inclusive' => true,
332
- );
333
- }
334
- $c = get_comments( $params );
335
- }
336
-
337
- $check_result = array(
338
- 'end' => 0,
339
- 'checked' => 0,
340
- 'spam' => 0,
341
- 'bad' => 0,
342
- 'error' => 0
343
- );
344
-
345
- if(sizeof($c)>0){
346
-
347
- // Coverting $c to objects
348
- if(is_array($c[0])){
349
- foreach($c as $key => $value){
350
- $c[$key] = (object)$value;
351
- } unset($key, $value);
352
- }
353
-
354
- if(!empty($_POST['accurate_check'])){
355
- // Leaving comments only with first comment's date. Unsetting others.
356
-
357
- foreach($c as $comment_index => $comment){
358
-
359
- if(!isset($curr_date))
360
- $curr_date = (substr($comment->comment_date_gmt, 0, 10) ? substr($comment->comment_date_gmt, 0, 10) : '');
361
-
362
- if(substr($comment->comment_date_gmt, 0, 10) != $curr_date)
363
- unset($c[$comment_index]);
364
-
365
- }
366
- unset($comment_index, $comment);
367
- }
368
-
369
- // Checking comments IP/Email. Gathering $data for check.
370
- $data = Array();
371
- for($i=0;$i<sizeof($c);$i++){
372
-
373
- $curr_ip = $c[$i]->comment_author_IP;
374
- $curr_email = $c[$i]->comment_author_email;
375
-
376
- // Check for identity
377
- $curr_ip = preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $curr_ip) === 1 ? $curr_ip : null;
378
- $curr_email = preg_match('/^\S+@\S+\.\S+$/', $curr_email) === 1 ? $curr_email : null;
379
-
380
- if(empty($curr_ip) && empty($curr_email)){
381
- $check_result['bad']++;
382
- update_comment_meta($c[$i]->comment_ID,'ct_bad','1');
383
- unset($c[$i]);
384
- }else{
385
- if(!empty($curr_ip))
386
- $data[] = $curr_ip;
387
- if(!empty($curr_email))
388
- $data[] = $curr_email;
389
- // Patch for empty IP/Email
390
- $c[$i]->comment_author_IP = empty($curr_ip) ? 'none' : $curr_ip;
391
- $c[$i]->comment_author_email = empty($curr_email) ? 'none' : $curr_email;
392
- }
393
- }
394
-
395
- // Recombining after checking and unsettting
396
- $c = array_values($c);
397
-
398
- // Drop if data empty and there's no comments to check
399
- if(count($data) == 0){
400
- if($_POST['unchecked'] === 0)
401
- $check_result['end'] = 1;
402
- print json_encode($check_result);
403
- die();
404
- }
405
-
406
- $result = CleantalkAPI::method__spam_check_cms($apbct->api_key, $data, !empty($_POST['accurate_check']) ? $curr_date : null);
407
-
408
- if(empty($result['error'])){
409
-
410
- for($i=0;$i<sizeof($c);$i++){
411
-
412
- $mark_spam_ip = false;
413
- $mark_spam_email = false;
414
-
415
- $check_result['checked']++;
416
- update_comment_meta($c[$i]->comment_ID,'ct_checked',date("Y-m-d H:m:s"));
417
- $uip=$c[$i]->comment_author_IP;
418
- $uim=$c[$i]->comment_author_email;
419
-
420
- if(isset($result[$uip]) && $result[$uip]['appears'] == 1)
421
- $mark_spam_ip = true;
422
-
423
- if(isset($result[$uim]) && $result[$uim]['appears'] == 1)
424
- $mark_spam_email = true;
425
-
426
- if ($mark_spam_ip || $mark_spam_email){
427
- $check_result['spam']++;
428
- update_comment_meta($c[$i]->comment_ID,'ct_marked_as_spam','1');
429
- }
430
- }
431
- print json_encode($check_result);
432
-
433
- }else{
434
- $check_result['error'] = 1;
435
- $check_result['error_message'] = $result['error'];
436
- echo json_encode($check_result);
437
- }
438
- }else{
439
- $check_result['end'] = 1;
440
- print json_encode($check_result);
441
- }
442
-
443
- die;
444
- }
445
-
446
- function ct_ajax_info_comments($direct_call = false){
447
-
448
- if (!$direct_call)
449
- check_ajax_referer( 'ct_secret_nonce', 'security' );
450
-
451
- global $wpdb;
452
-
453
- // Checking dates value
454
- if(isset($_POST['from'], $_POST['till'])){
455
- $from_date = date('Y-m-d', intval(strtotime($_POST['from'])));
456
- $till_date = date('Y-m-d', intval(strtotime($_POST['till'])));
457
- }
458
-
459
- $metas = array('', 'ct_marked_as_spam', 'ct_checked', 'ct_bad');
460
-
461
- $result = array();
462
- foreach($metas as $meta){
463
- if(isset($_COOKIE['ct_comments_safe_check'])){
464
- $res = $wpdb->get_results("
465
- SELECT COUNT(DISTINCT comment_ID) AS cnt
466
- FROM {$wpdb->comments} AS comm
467
- WHERE comm.comment_approved IN ('1','0')".
468
- (!empty($meta)
469
- ? " AND EXISTS (SELECT comment_id, meta_key
470
- FROM {$wpdb->commentmeta} meta
471
- WHERE comm.comment_ID = meta.comment_id AND meta_key = '$meta')"
472
- : '').
473
- (isset($from_date, $till_date)
474
- ? " AND comment_date_gmt BETWEEN
475
- STR_TO_DATE('$from_date', '%Y-%m-%d %H:%i:%s') AND
476
- STR_TO_DATE('$till_date', '%Y-%m-%d %H:%i:%s')"
477
- : ''),
478
- ARRAY_A);
479
- $result[] = $res[0]['cnt'];
480
- }else{
481
- $params = array('fields' => 'ids', 'count' => true);
482
- if(!empty($meta))
483
- $params['meta_key'] = $meta;
484
- if(isset($from_date, $till_date))
485
- $params['date_query'] = array('column' => 'comment_date_gmt', 'after' => $from_date, 'before' => $till_date, 'inclusive' => true);
486
- $result[] = get_comments( $params );
487
- }
488
- }
489
-
490
- $cnt = $result[0]; // Total comments
491
- $cnt_spam = $result[1]; // Spam comments
492
- $cnt_checked = $result[2]; // Checked comments
493
- $cnt_bad = $result[3]; // Bad comments (without IP and Email)
494
-
495
- $return = array(
496
- 'message' => '',
497
- 'total' => $cnt,
498
- 'spam' => $cnt_spam,
499
- 'checked' => $cnt_checked,
500
- 'bad' => $cnt_bad,
501
- );
502
-
503
- $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);
504
-
505
- $backup_notice = '&nbsp;';
506
- if ($cnt_spam > 0){
507
- $backup_notice = __("Please do backup of WordPress database before delete any comments!", 'cleantalk');
508
- }
509
- $return['message'] .= "<p>$backup_notice</p>";
510
-
511
- if($direct_call){
512
- return $return['message'];
513
- }else{
514
- echo json_encode($return);
515
- die();
516
- }
517
-
518
- }
519
-
520
-
521
- function ct_ajax_insert_comments(){
522
-
523
- check_ajax_referer( 'ct_secret_nonce', 'security' );
524
-
525
- //* DELETION
526
- if(!empty($_POST['delete'])){
527
- $comments = get_comments(array('author_email' => 'stop_email@example.com'));
528
- $deleted = 0;
529
- $amount_to_delete = 15;
530
- foreach($comments as $comment){
531
- if($deleted >= $amount_to_delete)
532
- break;
533
- if(wp_delete_comment($comment->comment_ID, true))
534
- $deleted++;
535
- }
536
- print "$deleted";
537
- die();
538
- }
539
-
540
- //* INSERTION
541
- global $wpdb;
542
-
543
- $to_insert = 100;
544
- $time = current_time('timestamp')-(730*86400);
545
-
546
- $result = $wpdb->get_results('SELECT network FROM `'. APBCT_TBL_FIREWALL_DATA .'` LIMIT '. $to_insert .';', ARRAY_A);
547
-
548
- if($result){
549
- $ip = array();
550
- foreach($result as $value){
551
- $ips[] = long2ip($value['network']);
552
- }
553
- unset($value);
554
-
555
- $inserted = 0;
556
- for($i=0, $j=0; $i<$to_insert; $i++, $j++){
557
-
558
- if(!isset($ips[$j]))
559
- $j=0;
560
-
561
- $rnd=mt_rand(1,100);
562
-
563
- $email="stop_email@example.com";
564
-
565
- $data = array(
566
- 'comment_post_ID' => 1,
567
- 'comment_author' => "author_$rnd",
568
- 'comment_author_email' => $email,
569
- 'comment_author_url' => 'http://',
570
- 'comment_content' => "comment content ".mt_rand(1,10000)." ".mt_rand(1,10000)." ".mt_rand(1,10000),
571
- 'comment_type' => '',
572
- 'comment_parent' => 0,
573
- 'user_id' => 1,
574
- 'comment_author_IP' => $ips[$j],
575
- 'comment_agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 3.5.30729)',
576
- 'comment_date' => date('Y-m-d H:i:s', $time),
577
- 'comment_approved' => 1,
578
- );
579
-
580
- wp_insert_comment($data);
581
- $time = $time + 86400;
582
- $inserted++;
583
- }
584
- }else{
585
- $inserted = '0';
586
- }
587
-
588
- print $inserted;
589
- die();
590
- }
591
-
592
- function ct_ajax_delete_checked(){
593
- check_ajax_referer( 'ct_secret_nonce', 'security' );
594
- foreach($_POST['ids'] as $key=>$value){
595
- wp_delete_comment($value, false);
596
- }
597
- die();
598
- }
599
-
600
- function ct_ajax_delete_all(){
601
- check_ajax_referer( 'ct_secret_nonce', 'security' );
602
- $args_spam = array(
603
- 'number'=>100,
604
- 'meta_query' => array(
605
- Array(
606
- 'key' => 'ct_marked_as_spam',
607
- 'value' => '1',
608
- 'compare' => 'NUMERIC'
609
- )
610
- )
611
- );
612
- $c_spam=get_comments($args_spam);
613
-
614
- $cnt=sizeof($c_spam);
615
-
616
- $args_spam = array(
617
- 'count'=>true,
618
- 'meta_query' => array(
619
- Array(
620
- 'key' => 'ct_marked_as_spam',
621
- 'value' => '1',
622
- 'compare' => 'NUMERIC'
623
- )
624
- )
625
- );
626
- $cnt_all=get_comments($args_spam);
627
-
628
- for($i=0;$i<sizeof($c_spam);$i++){
629
- wp_delete_comment($c_spam[$i]->comment_ID, false);
630
- usleep(10000);
631
- }
632
- print $cnt_all;
633
- die();
634
- }
635
-
636
- function ct_ajax_clear_comments(){
637
-
638
- check_ajax_referer( 'ct_secret_nonce', 'security' );
639
- global $wpdb;
640
- $wpdb->query("DELETE
641
- FROM {$wpdb->commentmeta}
642
- WHERE meta_key IN ('ct_checked', 'ct_marked_as_spam', 'ct_bad');");
643
- die();
644
- }
645
-
646
- /**
647
- * Admin action 'comment_unapproved_to_approved' - Approve comment, delete from the deleting list
648
- */
649
- function ct_comment_check_approve_comment(){
650
-
651
- check_ajax_referer( 'ct_secret_nonce', 'security' );
652
-
653
- $id=$_POST['id'];
654
- $comment = get_comment($id, 'ARRAY_A');
655
- $comment['comment_content'] = apbct_comment__unmark_red($comment['comment_content']);
656
- $comment['comment_approved'] = 1;
657
- update_comment_meta($id, 'ct_marked_as_spam', 0);
658
- wp_update_comment($comment);
659
-
660
- die();
661
  }
1
+ <?php
2
+
3
+ add_action('admin_menu', 'ct_add_comments_menu');
4
+ add_action( 'wp_ajax_ajax_check_comments', 'ct_ajax_check_comments' );
5
+ add_action( 'wp_ajax_ajax_info_comments', 'ct_ajax_info_comments' );
6
+ add_action( 'wp_ajax_ajax_insert_comments', 'ct_ajax_insert_comments' );
7
+ add_action( 'wp_ajax_ajax_delete_checked', 'ct_ajax_delete_checked' );
8
+ add_action( 'wp_ajax_ajax_delete_all', 'ct_ajax_delete_all' );
9
+ add_action( 'wp_ajax_ajax_clear_comments', 'ct_ajax_clear_comments' );
10
+ add_action( 'wp_ajax_ajax_ct_approve_comment', 'ct_comment_check_approve_comment' );
11
+
12
+ function ct_add_comments_menu(){
13
+ if(current_user_can('activate_plugins'))
14
+ add_comments_page( __("Check for spam", 'cleantalk'), __("Find spam comments", 'cleantalk'), 'read', 'ct_check_spam', 'ct_show_checkspam_page');
15
+ }
16
+
17
+ function ct_show_checkspam_page(){
18
+
19
+ global $apbct;
20
+
21
+ ?>
22
+ <div class="wrap">
23
+ <h2><img src="<?php echo $apbct->logo__small__colored; ?>" /> <?php echo $apbct->plugin_name; ?></h2>
24
+ <a style="color: gray; margin-left: 23px;" href="<?php echo $apbct->settings_link; ?>"><?php _e('Plugin Settings', 'cleantalk'); ?></a>
25
+ <br />
26
+ <?php
27
+
28
+ // If access key is unset in
29
+ if(!apbct_api_key__is_correct()){
30
+ if($apbct->moderate_ip == 1){
31
+ echo '<h3>'
32
+ .sprintf(
33
+ __('Antispam hosting tariff does not allow you to use this feature. To do so, you need to enter an Access Key in the %splugin settings%s.', 'cleantalk'),
34
+ '<a href="' . (is_network_admin() ? 'settings.php?page=cleantalk' : 'options-general.php?page=cleantalk').'">',
35
+ '</a>'
36
+ )
37
+ .'</h3>';
38
+ return;
39
+ }
40
+ }
41
+
42
+ // Getting total spam comments
43
+ $args_spam = array(
44
+ 'meta_query' => array(
45
+ Array(
46
+ 'key' => 'ct_marked_as_spam',
47
+ 'compare' => 'EXISTS'
48
+ )
49
+ ),
50
+ 'count'=>true
51
+ );
52
+ $cnt_spam = get_comments($args_spam);
53
+
54
+ ?>
55
+ <!-- AJAX error message -->
56
+ <div id="ct_error_message" style="display:none">
57
+ <h3>
58
+ <?php _e("Ajax error. Process will be automatically restarted in 3 seconds. Status: ", 'cleantalk'); ?><span id="cleantalk_ajax_error"></span> (<span id="cleantalk_js_func"></span>)
59
+ </h3>
60
+ <h4>Please, check for JavaScript errors in your dashboard and and repair it.</h4>
61
+ </div>
62
+
63
+ <!-- Deleting message -->
64
+ <div id="ct_deleting_message" style="display:none;">
65
+ <?php _e("Please wait for a while. CleanTalk is deleting spam comments. Comments left: ", 'cleantalk'); ?> <span id="cleantalk_comments_left">
66
+ <?php echo $cnt_spam; ?>
67
+ </span>
68
+ </div>
69
+
70
+ <!-- Main info -->
71
+ <h3 id="ct_checking_status"><?php echo ct_ajax_info_comments(true);?></h3>
72
+
73
+ <!-- Check options -->
74
+ <div class="ct_to_hide" id="ct_check_params_wrapper">
75
+ <button class="button ct_check_params_elem" id="ct_check_spam_button" <?php echo !$apbct->data['moderate'] ? 'disabled="disabled"' : ''; ?>><?php _e("Start check", 'cleantalk'); ?></button>
76
+ <?php if(!empty($_COOKIE['ct_paused_comments_check'])) { ?><button class="button ct_check_params_elem" id="ct_proceed_check_button"><?php _e("Continue check", 'cleantalk'); ?></button><?php } ?>
77
+ <p class="ct_check_params_desc"><?php _e("The plugin will check all comments against blacklists database and show you senders that have spam activity on other websites.", 'cleantalk'); ?></p>
78
+ <br />
79
+ <div class="ct_check_params_elem ct_check_params_elem_sub">
80
+ <input id="ct_accurate_check" type="checkbox" value="1" /><b><label for="ct_accurate_check"><?php _e("Accurate check", 'cleantalk'); ?></b></label>
81
+ </div>
82
+ <p class="ct_check_params_desc"><?php _e("Allows to use comment's dates to perform more accurate check. Could seriously slow down the check.", 'cleantalk'); ?></p>
83
+ <br />
84
+ <div class="ct_check_params_elem ct_check_params_elem_sub">
85
+ <input id="ct_allow_date_range" type="checkbox" value="1" /><label for="ct_allow_date_range"><b><?php _e("Specify date range", 'cleantalk'); ?></b></label>
86
+ </div>
87
+ <div class="ct_check_params_desc">
88
+ <input class="ct_date" type="text" id="ct_date_range_from" value="<?php echo isset($_GET['from']) && preg_match('/\d{4}-\d{2}-\d{2}/', $_GET['from']) ? $_GET['from'] : ''; ?>" disabled readonly />
89
+ <input class="ct_date" type="text" id="ct_date_range_till" value="<?php echo isset($_GET['till']) && preg_match('/\d{4}-\d{2}-\d{2}/', $_GET['till'])? $_GET['till'] : ''; ?>" disabled readonly />
90
+ </div>
91
+ <br>
92
+ <?php apbct_admin__badge__get_premium(); ?>
93
+ </div>
94
+
95
+ <!-- Cooling notice -->
96
+ <h3 id="ct_cooling_notice"></h3>
97
+
98
+ <!-- Preloader and working message -->
99
+ <div id="ct_preloader">
100
+ <img border=0 src="<?php print plugin_dir_url(__FILE__); ?>images/preloader.gif" />
101
+ </div>
102
+ <div id="ct_working_message">
103
+ <?php _e("Please wait! CleanTalk is checking all approved and pending comments via blacklist database at cleantalk.org. You will have option to delete found spam comments after plugin finish.", 'cleantalk'); ?>
104
+ </div>
105
+
106
+ <!-- Pause button -->
107
+ <button class="button" id="ct_pause">Pause check</button>
108
+
109
+ <?php
110
+
111
+ // Pagination
112
+ $page = !empty($_GET['spam_page']) ? intval($_GET['spam_page']) : 1;
113
+ $on_page = 20;
114
+
115
+ $args_spam = array(
116
+ 'meta_query' => array(
117
+ Array(
118
+ 'key' => 'ct_marked_as_spam',
119
+ 'value' => '1',
120
+ 'compare' => 'NUMERIC'
121
+ )
122
+ ),
123
+ 'number'=>$on_page,
124
+ 'offset'=>($page-1)*$on_page
125
+ );
126
+
127
+ $c_spam = get_comments($args_spam);
128
+ if($cnt_spam>0){
129
+
130
+ $pages = ceil(intval($cnt_spam)/$on_page);
131
+ if($pages && $pages != 1){
132
+ echo "<div class='ct_to_hide pagination'>"
133
+ ."<b>Pages:</b>"
134
+ ."<ul class='pagination'>";
135
+ for($i = 1; $i <= $pages; $i++){
136
+ echo "<li class='pagination'>"
137
+ ."<a href='edit-comments.php?page=ct_check_spam&spam_page=$i&ct_worked=1'>"
138
+ .($i == $page ? "<span class='current_page'>$i</span>" : $i)
139
+ ."</a>"
140
+ ."</li>";
141
+ }
142
+ echo "</ul>";
143
+ echo "</div>";
144
+ }
145
+ ?>
146
+ <table class="ct_to_hide widefat fixed comments" id="ct_check_comments_table">
147
+ <thead>
148
+ <th scope="col" id="cb" class="manage-column column-cb check-column">
149
+ <label class="screen-reader-text" for="cb-select-all-1">Select All</label>
150
+ <input id="cb-select-all-1" type="checkbox" style="margin-top:0;"/>
151
+ </th>
152
+ <th scope="col" id="author" class="manage-column column-slug"><?php print _e( 'Author' ); ?></th>
153
+ <th scope="col" id="comment" class="manage-column column-comment"><?php _e( 'Comment', 'cleantalk'); ?></th>
154
+ <th scope="col" id="response" class="manage-column column-response sortable desc"><?php _e( 'In Response To', 'cleantalk' );?></th>
155
+ </thead>
156
+ <tbody id="the-comment-list" data-wp-lists="list:comment">
157
+ <?php
158
+ for($i=0;$i<sizeof($c_spam);$i++){
159
+ $id = $c_spam[$i]->comment_ID;
160
+ $post_id = $c_spam[$i]->comment_post_ID;
161
+ $login = $c_spam[$i]->comment_author;
162
+ $email = $c_spam[$i]->comment_author_email;
163
+ $ip = $c_spam[$i]->comment_author_IP;
164
+
165
+ echo "<tr id='comment-$id' class='comment even thread-even depth-1 approved cleantalk_comment' data-id='$id'>"
166
+ ."<th scope='row' class='check-column'>"
167
+ ."<label class='screen-reader-text' for='cb-select-$id'>Select comment</label>"
168
+ ."<input id='cb-select-$id' type='checkbox' name='del_comments[]' value='$id'/>"
169
+ ."</th>"
170
+ ."<td class='author column-author' nowrap>"
171
+ ."<strong>"
172
+ .get_avatar( $c_spam[$i]->user_id , 32)
173
+ ."$login"
174
+ ."</strong>"
175
+ ."<br />"
176
+ ."<br />";
177
+
178
+ // Outputs email if exists
179
+ if($email)
180
+ echo "<a href='mailto:$email'>$email</a>"
181
+ .(!$apbct->white_label
182
+ ? "<a href='https://cleantalk.org/blacklists/$email' target='_blank'>"
183
+ ."&nbsp;<img src='".plugin_dir_url(__FILE__)."images/new_window.gif' border='0' style='float:none' />"
184
+ ."</a>"
185
+ : '');
186
+ else
187
+ echo "No email";
188
+ echo "<br/>";
189
+
190
+ // Outputs IP if exists
191
+ if($ip)
192
+ echo "<a href='edit-comments.php?s=$ip&mode=detail'>$ip </a>"
193
+ .(!$apbct->white_label
194
+ ?"<a href='https://cleantalk.org/blacklists/$ip ' target='_blank'>"
195
+ ."&nbsp;<img src='".plugin_dir_url(__FILE__)."images/new_window.gif' border='0' style='float:none'/>"
196
+ ."</a>"
197
+ : '');
198
+ else
199
+ echo "No IP adress";
200
+ echo "</td>";
201
+ ?>
202
+ <td class="comment column-comment">
203
+ <div class="submitted-on">
204
+ <?php printf( __( 'Submitted on <a href="%1$s">%2$s at %3$s</a>' ), get_comment_link($id),
205
+ /* translators: comment date format. See http://php.net/date */
206
+ get_comment_date( __( 'Y/m/d' ),$id ),
207
+ get_comment_date( get_option( 'time_format' ),$id )
208
+ );
209
+ ?>
210
+
211
+ </div>
212
+ <p>
213
+ <?php print $c_spam[$i]->comment_content; ?>
214
+ </p>
215
+ <div style="height:16px; display: none;" id='cleantalk_button_set_<?php print $id; ?>'>
216
+ <a href="#" class="cleantalk_delete_from_list_button" data-id="<?php print $id; ?>" style="color:#0a0;" onclick="return false;" onmouseover="this.style.textDecoration='underline';" onmouseout="this.style.textDecoration='none';"><?php _e("Approve", "cleantalk"); ?></a>
217
+ &nbsp;|&nbsp;
218
+ <a href="#" class="cleantalk_delete_button" data-id="<?php print $id; ?>" style="color:#a00;" onclick="return false;" onmouseover="this.style.textDecoration='underline';" onmouseout="this.style.textDecoration='none';"><?php _e("Delete", "cleantalk"); ?></a>
219
+ </div>
220
+ </td>
221
+ <td class="response column-response">
222
+ <div>
223
+ <span>
224
+ <a href="/wp-admin/post.php?post=<?php print $post_id; ?>&action=edit"><?php print get_the_title($post_id); ?></a>
225
+ <br/>
226
+ <a href="/wp-admin/edit-comments.php?p=<?php print $post_id; ?>" class="post-com-count">
227
+ <span class="comment-count"><?php
228
+ $p_cnt=wp_count_comments();
229
+ print $p_cnt->total_comments;
230
+ ?></span>
231
+ </a>
232
+ </span>
233
+ <a href="<?php print get_permalink($post_id); ?>"><?php print _e('View Post');?></a>
234
+ </div>
235
+ </td>
236
+ </tr>
237
+ <?php
238
+ }
239
+ ?>
240
+ </tbody>
241
+ </table>
242
+ <?php
243
+ // Pagination
244
+ if($pages && $pages != 1){
245
+ echo "<div class='ct_to_hide pagination'>"
246
+ ."<b>Pages:</b>"
247
+ ."<ul class='pagination'>";
248
+ for($i = 1; $i <= $pages; $i++){
249
+ echo "<li class='pagination'>"
250
+ ."<a href='edit-comments.php?page=ct_check_spam&spam_page=$i&ct_worked=1'>"
251
+ .($i == $page ? "<span class='current_page'>$i</span>" : $i)
252
+ ."</a>"
253
+ ."</li>";
254
+ }
255
+ echo "</ul>";
256
+ echo "</div>";
257
+ }
258
+ ?>
259
+ <div class="ct_to_hide" id="ct_tools_buttons" style="margin-top: 10px;">
260
+ <button class= "button" id="ct_delete_all"><?php _e('Delete all comments from the list', 'cleantalk'); ?></button>
261
+ <button class="button" id="ct_delete_checked"><?php _e('Delete selected', 'cleantalk'); ?></button><br /><br />
262
+ </div>
263
+ <?php
264
+ }
265
+ echo $_SERVER['REMOTE_ADDR']=='127.0.0.1' ? '<button class="button ct_to_hide" id="ct_insert_comments">'. __('Insert comments', 'cleantalk') .' (100)</button> ' : '';
266
+ echo $_SERVER['REMOTE_ADDR']=='127.0.0.1' ? '<button class="button ct_to_hide" id="ct_delete_comments">'. __('Delete comments', 'cleantalk') .' (110)</button>' : '';
267
+
268
+ if($cnt_spam > 0){
269
+ echo "<div id='ct_search_info'>"
270
+ ."<br />"
271
+ .__('There is some differencies between blacklists database and our API mechanisms. Blacklists shows all history of spam activity, but our API (that used in spam checking) used another parameters, too: last day of activity, number of spam attacks during last days etc. This mechanisms help us to reduce number of false positivitie. So, there is nothing strange, if some emails/IPs will be not found by this checking.', 'cleantalk')
272
+ ."</div>";
273
+ }
274
+ ?>
275
+ <div>
276
+ <button class="button" id="ct_stop_deletion" style="display:none;"><?php _e("Stop deletion", 'cleantalk'); ?></button>
277
+ </div>
278
+ </div>
279
+ <?php
280
+ }
281
+
282
+ function ct_ajax_check_comments(){
283
+
284
+ check_ajax_referer( 'ct_secret_nonce', 'security' );
285
+
286
+ global $wpdb, $apbct;
287
+
288
+ if(isset($_POST['from'], $_POST['till'])){
289
+ $from_date = date('Y-m-d', intval(strtotime($_POST['from'])));
290
+ $till_date = date('Y-m-d', intval(strtotime($_POST['till'])));
291
+ }
292
+
293
+ // Gettings comments 100 unchecked comments
294
+ if(isset($_COOKIE['ct_comments_safe_check'])){
295
+ $c = $wpdb->get_results("
296
+ SELECT comment_ID, comment_date_gmt, comment_author_IP, comment_author_email
297
+ FROM {$wpdb->comments} as comm
298
+ WHERE
299
+ (comm.comment_approved = '1' OR comm.comment_approved = '0')
300
+ AND NOT EXISTS(
301
+ SELECT comment_id, meta_key
302
+ FROM {$wpdb->commentmeta} as meta
303
+ WHERE comm.comment_ID = meta.comment_id AND (meta_key = 'ct_checked' OR meta_key = 'ct_bad')
304
+ )
305
+ ORDER BY comment_date_gmt
306
+ LIMIT 100",
307
+ ARRAY_A
308
+ );
309
+ }else{
310
+ $params = array(
311
+ 'meta_query' => array(
312
+ 'relation' => 'AND',
313
+ array(
314
+ 'key' => 'ct_checked',
315
+ 'compare' => 'NOT EXISTS'
316
+ ),
317
+ array(
318
+ 'key' => 'ct_bad',
319
+ 'compare' => 'NOT EXISTS'
320
+ )
321
+ ),
322
+ 'orderby' => 'comment_date_gmt',
323
+ 'order' => 'ASC',
324
+ 'number' => 100
325
+ );
326
+ if(isset($from_date, $till_date)){
327
+ $params['date_query'] = array(
328
+ 'column' => 'comment_date_gmt',
329
+ 'after' => $from_date,
330
+ 'before' => $till_date,
331
+ 'inclusive' => true,
332
+ );
333
+ }
334
+ $c = get_comments( $params );
335
+ }
336
+
337
+ $check_result = array(
338
+ 'end' => 0,
339
+ 'checked' => 0,
340
+ 'spam' => 0,
341
+ 'bad' => 0,
342
+ 'error' => 0
343
+ );
344
+
345
+ if(sizeof($c)>0){
346
+
347
+ // Coverting $c to objects
348
+ if(is_array($c[0])){
349
+ foreach($c as $key => $value){
350
+ $c[$key] = (object)$value;
351
+ } unset($key, $value);
352
+ }
353
+
354
+ if(!empty($_POST['accurate_check'])){
355
+ // Leaving comments only with first comment's date. Unsetting others.
356
+
357
+ foreach($c as $comment_index => $comment){
358
+
359
+ if(!isset($curr_date))
360
+ $curr_date = (substr($comment->comment_date_gmt, 0, 10) ? substr($comment->comment_date_gmt, 0, 10) : '');
361
+
362
+ if(substr($comment->comment_date_gmt, 0, 10) != $curr_date)
363
+ unset($c[$comment_index]);
364
+
365
+ }
366
+ unset($comment_index, $comment);
367
+ }
368
+
369
+ // Checking comments IP/Email. Gathering $data for check.
370
+ $data = Array();
371
+ for($i=0;$i<sizeof($c);$i++){
372
+
373
+ $curr_ip = $c[$i]->comment_author_IP;
374
+ $curr_email = $c[$i]->comment_author_email;
375
+
376
+ // Check for identity
377
+ $curr_ip = preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $curr_ip) === 1 ? $curr_ip : null;
378
+ $curr_email = preg_match('/^\S+@\S+\.\S+$/', $curr_email) === 1 ? $curr_email : null;
379
+
380
+ if(empty($curr_ip) && empty($curr_email)){
381
+ $check_result['bad']++;
382
+ update_comment_meta($c[$i]->comment_ID,'ct_bad','1');
383
+ unset($c[$i]);
384
+ }else{
385
+ if(!empty($curr_ip))
386
+ $data[] = $curr_ip;
387
+ if(!empty($curr_email))
388
+ $data[] = $curr_email;
389
+ // Patch for empty IP/Email
390
+ $c[$i]->comment_author_IP = empty($curr_ip) ? 'none' : $curr_ip;
391
+ $c[$i]->comment_author_email = empty($curr_email) ? 'none' : $curr_email;
392
+ }
393
+ }
394
+
395
+ // Recombining after checking and unsettting
396
+ $c = array_values($c);
397
+
398
+ // Drop if data empty and there's no comments to check
399
+ if(count($data) == 0){
400
+ if($_POST['unchecked'] === 0)
401
+ $check_result['end'] = 1;
402
+ print json_encode($check_result);
403
+ die();
404
+ }
405
+
406
+ $result = CleantalkAPI::method__spam_check_cms($apbct->api_key, $data, !empty($_POST['accurate_check']) ? $curr_date : null);
407
+
408
+ if(empty($result['error'])){
409
+
410
+ for($i=0;$i<sizeof($c);$i++){
411
+
412
+ $mark_spam_ip = false;
413
+ $mark_spam_email = false;
414
+
415
+ $check_result['checked']++;
416
+ update_comment_meta($c[$i]->comment_ID,'ct_checked',date("Y-m-d H:m:s"));
417
+ $uip=$c[$i]->comment_author_IP;
418
+ $uim=$c[$i]->comment_author_email;
419
+
420
+ if(isset($result[$uip]) && $result[$uip]['appears'] == 1)
421
+ $mark_spam_ip = true;
422
+
423
+ if(isset($result[$uim]) && $result[$uim]['appears'] == 1)
424
+ $mark_spam_email = true;
425
+
426
+ if ($mark_spam_ip || $mark_spam_email){
427
+ $check_result['spam']++;
428
+ update_comment_meta($c[$i]->comment_ID,'ct_marked_as_spam','1');
429
+ }
430
+ }
431
+ print json_encode($check_result);
432
+
433
+ }else{
434
+ $check_result['error'] = 1;
435
+ $check_result['error_message'] = $result['error'];
436
+ echo json_encode($check_result);
437
+ }
438
+ }else{
439
+ $check_result['end'] = 1;
440
+ print json_encode($check_result);
441
+ }
442
+
443
+ die;
444
+ }
445
+
446
+ function ct_ajax_info_comments($direct_call = false){
447
+
448
+ if (!$direct_call)
449
+ check_ajax_referer( 'ct_secret_nonce', 'security' );
450
+
451
+ global $wpdb;
452
+
453
+ // Checking dates value
454
+ if(isset($_POST['from'], $_POST['till'])){
455
+ $from_date = date('Y-m-d', intval(strtotime($_POST['from'])));
456
+ $till_date = date('Y-m-d', intval(strtotime($_POST['till'])));
457
+ }
458
+
459
+ $metas = array('', 'ct_marked_as_spam', 'ct_checked', 'ct_bad');
460
+
461
+ $result = array();
462
+ foreach($metas as $meta){
463
+ if(isset($_COOKIE['ct_comments_safe_check'])){
464
+ $res = $wpdb->get_results("
465
+ SELECT COUNT(DISTINCT comment_ID) AS cnt
466
+ FROM {$wpdb->comments} AS comm
467
+ WHERE comm.comment_approved IN ('1','0')".
468
+ (!empty($meta)
469
+ ? " AND EXISTS (SELECT comment_id, meta_key
470
+ FROM {$wpdb->commentmeta} meta
471
+ WHERE comm.comment_ID = meta.comment_id AND meta_key = '$meta')"
472
+ : '').
473
+ (isset($from_date, $till_date)
474
+ ? " AND comment_date_gmt BETWEEN
475
+ STR_TO_DATE('$from_date', '%Y-%m-%d %H:%i:%s') AND
476
+ STR_TO_DATE('$till_date', '%Y-%m-%d %H:%i:%s')"
477
+ : ''),
478
+ ARRAY_A);
479
+ $result[] = $res[0]['cnt'];
480
+ }else{
481
+ $params = array('fields' => 'ids', 'count' => true);
482
+ if(!empty($meta))
483
+ $params['meta_key'] = $meta;
484
+ if(isset($from_date, $till_date))
485
+ $params['date_query'] = array('column' => 'comment_date_gmt', 'after' => $from_date, 'before' => $till_date, 'inclusive' => true);
486
+ $result[] = get_comments( $params );
487
+ }
488
+ }
489
+
490
+ $cnt = $result[0]; // Total comments
491
+ $cnt_spam = $result[1]; // Spam comments
492
+ $cnt_checked = $result[2]; // Checked comments
493
+ $cnt_bad = $result[3]; // Bad comments (without IP and Email)
494
+
495
+ $return = array(
496
+ 'message' => '',
497
+ 'total' => $cnt,
498
+ 'spam' => $cnt_spam,
499
+ 'checked' => $cnt_checked,
500
+ 'bad' => $cnt_bad,
501
+ );
502
+
503
+ $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);
504
+
505
+ $backup_notice = '&nbsp;';
506
+ if ($cnt_spam > 0){
507
+ $backup_notice = __("Please do backup of WordPress database before delete any comments!", 'cleantalk');
508
+ }
509
+ $return['message'] .= "<p>$backup_notice</p>";
510
+
511
+ if($direct_call){
512
+ return $return['message'];
513
+ }else{
514
+ echo json_encode($return);
515
+ die();
516
+ }
517
+
518
+ }
519
+
520
+
521
+ function ct_ajax_insert_comments(){
522
+
523
+ check_ajax_referer( 'ct_secret_nonce', 'security' );
524
+
525
+ //* DELETION
526
+ if(!empty($_POST['delete'])){
527
+ $comments = get_comments(array('author_email' => 'stop_email@example.com'));
528
+ $deleted = 0;
529
+ $amount_to_delete = 15;
530
+ foreach($comments as $comment){
531
+ if($deleted >= $amount_to_delete)
532
+ break;
533
+ if(wp_delete_comment($comment->comment_ID, true))
534
+ $deleted++;
535
+ }
536
+ print "$deleted";
537
+ die();
538
+ }
539
+
540
+ //* INSERTION
541
+ global $wpdb;
542
+
543
+ $to_insert = 100;
544
+ $time = current_time('timestamp')-(730*86400);
545
+
546
+ $result = $wpdb->get_results('SELECT network FROM `'. APBCT_TBL_FIREWALL_DATA .'` LIMIT '. $to_insert .';', ARRAY_A);
547
+
548
+ if($result){
549
+ $ip = array();
550
+ foreach($result as $value){
551
+ $ips[] = long2ip($value['network']);
552
+ }
553
+ unset($value);
554
+
555
+ $inserted = 0;
556
+ for($i=0, $j=0; $i<$to_insert; $i++, $j++){
557
+
558
+ if(!isset($ips[$j]))
559
+ $j=0;
560
+
561
+ $rnd=mt_rand(1,100);
562
+
563
+ $email="stop_email@example.com";
564
+
565
+ $data = array(
566
+ 'comment_post_ID' => 1,
567
+ 'comment_author' => "author_$rnd",
568
+ 'comment_author_email' => $email,
569
+ 'comment_author_url' => 'http://',
570
+ 'comment_content' => "comment content ".mt_rand(1,10000)." ".mt_rand(1,10000)." ".mt_rand(1,10000),
571
+ 'comment_type' => '',
572
+ 'comment_parent' => 0,
573
+ 'user_id' => 1,
574
+ 'comment_author_IP' => $ips[$j],
575
+ 'comment_agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 3.5.30729)',
576
+ 'comment_date' => date('Y-m-d H:i:s', $time),
577
+ 'comment_approved' => 1,
578
+ );
579
+
580
+ wp_insert_comment($data);
581
+ $time = $time + 86400;
582
+ $inserted++;
583
+ }
584
+ }else{
585
+ $inserted = '0';
586
+ }
587
+
588
+ print $inserted;
589
+ die();
590
+ }
591
+
592
+ function ct_ajax_delete_checked(){
593
+ check_ajax_referer( 'ct_secret_nonce', 'security' );
594
+ foreach($_POST['ids'] as $key=>$value){
595
+ wp_delete_comment($value, false);
596
+ }
597
+ die();
598
+ }
599
+
600
+ function ct_ajax_delete_all(){
601
+ check_ajax_referer( 'ct_secret_nonce', 'security' );
602
+ $args_spam = array(
603
+ 'number'=>100,
604
+ 'meta_query' => array(
605
+ Array(
606
+ 'key' => 'ct_marked_as_spam',
607
+ 'value' => '1',
608
+ 'compare' => 'NUMERIC'
609
+ )
610
+ )
611
+ );
612
+ $c_spam=get_comments($args_spam);
613
+
614
+ $cnt=sizeof($c_spam);
615
+
616
+ $args_spam = array(
617
+ 'count'=>true,
618
+ 'meta_query' => array(
619
+ Array(
620
+ 'key' => 'ct_marked_as_spam',
621
+ 'value' => '1',
622
+ 'compare' => 'NUMERIC'
623
+ )
624
+ )
625
+ );
626
+ $cnt_all=get_comments($args_spam);
627
+
628
+ for($i=0;$i<sizeof($c_spam);$i++){
629
+ wp_delete_comment($c_spam[$i]->comment_ID, false);
630
+ usleep(10000);
631
+ }
632
+ print $cnt_all;
633
+ die();
634
+ }
635
+
636
+ function ct_ajax_clear_comments(){
637
+
638
+ check_ajax_referer( 'ct_secret_nonce', 'security' );
639
+ global $wpdb;
640
+ $wpdb->query("DELETE
641
+ FROM {$wpdb->commentmeta}
642
+ WHERE meta_key IN ('ct_checked', 'ct_marked_as_spam', 'ct_bad');");
643
+ die();
644
+ }
645
+
646
+ /**
647
+ * Admin action 'comment_unapproved_to_approved' - Approve comment, delete from the deleting list
648
+ */
649
+ function ct_comment_check_approve_comment(){
650
+
651
+ check_ajax_referer( 'ct_secret_nonce', 'security' );
652
+
653
+ $id=$_POST['id'];
654
+ $comment = get_comment($id, 'ARRAY_A');
655
+ $comment['comment_content'] = apbct_comment__unmark_red($comment['comment_content']);
656
+ $comment['comment_approved'] = 1;
657
+ update_comment_meta($id, 'ct_marked_as_spam', 0);
658
+ wp_update_comment($comment);
659
+
660
+ die();
661
  }
inc/cleantalk-users.php CHANGED
@@ -87,8 +87,8 @@ function ct_show_users_page(){
87
  <input id="ct_allow_date_range" type="checkbox" value="1" /><label for="ct_allow_date_range"><b><?php _e("Specify date range", 'cleantalk'); ?></b></label>
88
  </div>
89
  <div class="ct_check_params_desc">
90
- <input class="ct_date" type="text" id="ct_date_range_from" value="<?php echo isset($_GET['from']) ? $_GET['from'] : ''; ?>" disabled readonly />
91
- <input class="ct_date" type="text" id="ct_date_range_till" value="<?php echo isset($_GET['till']) ? $_GET['till'] : ''; ?>" disabled readonly />
92
  </div>
93
  <br>
94
  <?php apbct_admin__badge__get_premium(); ?>
@@ -289,6 +289,10 @@ function ct_ajax_check_users(){
289
 
290
  check_ajax_referer('ct_secret_nonce', 'security');
291
 
 
 
 
 
292
  global $apbct;
293
 
294
  $skip_roles = array(
@@ -315,7 +319,7 @@ function ct_ajax_check_users(){
315
  ),
316
  'orderby' => 'registered',
317
  'order' => 'ASC',
318
- 'number' => 100
319
  );
320
 
321
  if(isset($_POST['from'], $_POST['till'])){
@@ -483,20 +487,29 @@ function ct_ajax_info_users($direct_call = false)
483
  $params = array(
484
  'fields' => 'ID',
485
  'count'=>true,
 
486
  );
487
- if(isset($from_date, $till_date)) $params['date_query'] = array('column' => 'user_registered', 'after' => $from_date, 'before' => $till_date, 'inclusive' => true);
488
  $tmp = new WP_User_Query($params);
489
  $cnt = $tmp->get_total();
490
 
 
 
491
  // Checked users
492
  $params = array(
493
  'fields' => 'ID',
494
  'meta_key' => 'ct_checked',
495
  'count_total' => true,
 
496
  );
497
- if(isset($from_date, $till_date)) $params['date_query'] = array('column' => 'user_registered', 'after' => $from_date, 'before' => $till_date, 'inclusive' => true);
498
  $tmp = new WP_User_Query($params);
499
  $cnt_checked = $tmp->get_total();
 
 
 
 
 
500
 
501
  // Spam users
502
  $params = array(
@@ -684,4 +697,13 @@ function ct_usercheck_get_csv_file() {
684
  echo $output;
685
 
686
  die();
687
- }
 
 
 
 
 
 
 
 
 
87
  <input id="ct_allow_date_range" type="checkbox" value="1" /><label for="ct_allow_date_range"><b><?php _e("Specify date range", 'cleantalk'); ?></b></label>
88
  </div>
89
  <div class="ct_check_params_desc">
90
+ <input class="ct_date" type="text" id="ct_date_range_from" value="<?php echo isset($_GET['from']) && preg_match('/\d{4}-\d{2}-\d{2}/', $_GET['from']) ? $_GET['from'] : ''; ?>" disabled readonly />
91
+ <input class="ct_date" type="text" id="ct_date_range_till" value="<?php echo isset($_GET['till']) && preg_match('/\d{4}-\d{2}-\d{2}/', $_GET['till']) ? $_GET['till'] : ''; ?>" disabled readonly />
92
  </div>
93
  <br>
94
  <?php apbct_admin__badge__get_premium(); ?>
289
 
290
  check_ajax_referer('ct_secret_nonce', 'security');
291
 
292
+ $amount = !empty($_POST['amount']) && intval($_POST['amount'])
293
+ ? intval($_POST['amount'])
294
+ : 100;
295
+
296
  global $apbct;
297
 
298
  $skip_roles = array(
319
  ),
320
  'orderby' => 'registered',
321
  'order' => 'ASC',
322
+ 'number' => $amount,
323
  );
324
 
325
  if(isset($_POST['from'], $_POST['till'])){
487
  $params = array(
488
  'fields' => 'ID',
489
  'count'=>true,
490
+ 'orderby' => 'user_registered'
491
  );
492
+ //if(isset($from_date, $till_date)) $params['date_query'] = array('column' => 'user_registered', 'after' => $from_date, 'before' => $till_date, 'inclusive' => true);
493
  $tmp = new WP_User_Query($params);
494
  $cnt = $tmp->get_total();
495
 
496
+ $_GET['from'] = ct_get_user_register( current($tmp->get_results()) );
497
+
498
  // Checked users
499
  $params = array(
500
  'fields' => 'ID',
501
  'meta_key' => 'ct_checked',
502
  'count_total' => true,
503
+ 'orderby' => 'ct_checked'
504
  );
505
+ //if(isset($from_date, $till_date)) $params['date_query'] = array('column' => 'user_registered', 'after' => $from_date, 'before' => $till_date, 'inclusive' => true);
506
  $tmp = new WP_User_Query($params);
507
  $cnt_checked = $tmp->get_total();
508
+
509
+ if( $cnt_checked > 0 ) {
510
+ $tmp2 = $tmp->get_results();
511
+ $_GET['from'] = ct_get_user_register( end( $tmp2 ) );
512
+ }
513
 
514
  // Spam users
515
  $params = array(
697
  echo $output;
698
 
699
  die();
700
+ }
701
+
702
+ function ct_get_user_register( $user_id ) {
703
+
704
+ $user_data = get_userdata( $user_id );
705
+ $registered = $user_data->user_registered;
706
+
707
+ return date( "Y-m-d", strtotime( $registered ) );
708
+
709
+ }
js/cleantalk-users-checkspam.min.js CHANGED
@@ -1,2 +1,2 @@
1
- var ct_working=!(String.prototype.printf=function(){var e=this;for(var t in arguments){var c=e.substring(0,e.indexOf("%s",0)),_=e.substring(e.indexOf("%s",0)+2,e.length);e=c+arguments[t]+_}return e}),ct_new_check=!0,ct_cooling_down_flag=!1,ct_close_animate=!0,ct_accurate_check=!1,ct_pause=!1,ct_prev_accurate=ctUsersCheck.ct_prev_accurate,ct_prev_from=ctUsersCheck.ct_prev_from,ct_prev_till=ctUsersCheck.ct_prev_till,ct_cool_down_time=9e4,ct_requests_counter=0,ct_max_requests=60,ct_ajax_nonce=ctUsersCheck.ct_ajax_nonce,ct_users_total=0,ct_users_checked=0,ct_users_spam=0,ct_users_bad=0,ct_unchecked="unset",ct_date_from=0,ct_date_till=0;function animate_comment(e,t){ct_close_animate?.3==e?jQuery("#comment-"+t).fadeTo(200,e,function(){animate_comment(1,t)}):jQuery("#comment-"+t).fadeTo(200,e,function(){animate_comment(.3,t)}):ct_close_animate=!0}function ct_clear_users(){var e={action:"ajax_clear_users",security:ct_ajax_nonce};jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){ct_show_users_info(),ct_send_users()}})}function ct_cooling_down_toggle(){ct_cooling_down_flag=!1,ct_send_users(),ct_show_users_info()}function ct_send_users(){if(1!=ct_cooling_down_flag){if(ct_max_requests<=ct_requests_counter)return setTimeout(ct_cooling_down_toggle,ct_cool_down_time),void(ct_cooling_down_flag=!(ct_requests_counter=0));ct_requests_counter++;var e={action:"ajax_check_users",security:ct_ajax_nonce,new_check:ct_new_check,unchecked:ct_unchecked};ct_accurate_check&&(e.accurate_check=!0),ct_date_from&&ct_date_till&&(e.from=ct_date_from,e.till=ct_date_till),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){if(e=jQuery.parseJSON(e),parseInt(e.error))if(ct_working=!1,confirm(e.error_message+". Do you want to proceed?"))ct_send_users();else{var t="users.php?page=ct_check_users";0!=ct_date_from&&0!=ct_date_till&&(t+="&from="+ct_date_from+"&till="+ct_date_till),location.href=t}else if(ct_new_check=!1,1==parseInt(e.end)||1==ct_pause){1==parseInt(e.end)&&(document.cookie="ct_paused_users_check=0; path=/"),ct_working=!1,jQuery("#ct_working_message").hide();t="users.php?page=ct_check_users&ct_worked=1";0!=ct_date_from&&0!=ct_date_till&&(t+="&from="+ct_date_from+"&till="+ct_date_till),location.href=t}else if(0==parseInt(e.end)){ct_users_checked+=e.checked,ct_users_spam+=e.spam,ct_users_bad+=e.bad,ct_unchecked=ct_users_total-ct_users_checked-ct_users_bad;var c=(c=String(ctUsersCheck.ct_status_string)).printf(ct_users_total,ct_users_checked,ct_users_spam,ct_users_bad);0<parseInt(ct_users_spam)&&(c+=ctUsersCheck.ct_status_string_warning),jQuery("#ct_checking_status").html(c),jQuery("#ct_error_message").hide(),ct_send_users()}},error:function(e,t,c){jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("Check users"),setTimeout(ct_send_users(),3e3)},timeout:25e3})}}function ct_show_users_info(){if(ct_working){if(1==ct_cooling_down_flag)return jQuery("#ct_cooling_notice").html("Waiting for API to cool down. (About a minute)"),void jQuery("#ct_cooling_notice").show();if(jQuery("#ct_cooling_notice").hide(),setTimeout(ct_show_users_info,3e3),!ct_users_total){var e={action:"ajax_info_users",security:ct_ajax_nonce};ct_date_from&&ct_date_till&&(e.from=ct_date_from,e.till=ct_date_till),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){e=jQuery.parseJSON(e),jQuery("#ct_checking_status").html(e.message),ct_users_total=e.total,ct_users_spam=e.spam,ct_users_checked=e.checked,ct_users_bad=e.bad},error:function(e,t,c){jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("Show users"),setTimeout(ct_show_users_info(),3e3)},timeout:15e3})}}}function ct_insert_users(t){var e={action:"ajax_insert_users",security:ct_ajax_nonce};(t=t||null)&&(e.delete=!0),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){t?alert(ctUsersCheck.ct_deleted+" "+e+" "+ctUsersCheck.ct_iusers):alert(ctUsersCheck.ct_inserted+" "+e+" "+ctUsersCheck.ct_iusers)}})}function ct_delete_all_users(){var e={action:"ajax_delete_all_users",security:ct_ajax_nonce};jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){0<e?(jQuery("#cleantalk_users_left").html(e),ct_delete_all_users()):location.href="users.php?page=ct_check_users&ct_worked=1"},error:function(e,t,c){jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("All users deleteion"),setTimeout(ct_delete_all_users(),3e3)},timeout:25e3})}function ct_delete_checked_users(){ids=Array();var e=0;jQuery("input[id^=cb-select-][id!=cb-select-all-1]").each(function(){jQuery(this).prop("checked")&&(ids[e]=jQuery(this).attr("id").substring(10),e++)});var t={action:"ajax_delete_checked_users",security:ct_ajax_nonce,ids:ids};jQuery.ajax({type:"POST",url:ajaxurl,data:t,success:function(e){location.href="users.php?page=ct_check_users&ct_worked=1"},error:function(e,t,c){jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("All users deleteion"),setTimeout(ct_delete_checked_users(),3e3)},timeout:15e3})}function ct_toggle_depended(e,t){t=t||null;var c=jQuery(e.data("depended"));e.data("state")||t?(e.data("state",!1),c.prop("disabled",!0),c.removeProp("checked"),c.data("depended")&&ct_toggle_depended(c,!0)):(e.data("state",!0),c.removeProp("disabled"))}jQuery(document).ready(function(){jQuery("#ct_allow_date_range").data({depended:".ct_date",state:!1}),ct_prev_accurate&&jQuery("#ct_accurate_check").prop("checked",!0),ct_prev_from&&(jQuery("#ct_allow_date_range").prop("checked",!0).data("state",!0),jQuery("#ct_date_range_from").removeProp("disabled").val(ct_prev_from),jQuery("#ct_date_range_till").removeProp("disabled").val(ct_prev_till)),jQuery("#ct_allow_date_range, #ct_accurate_check").on("change",function(){ct_toggle_depended(jQuery(this))});var r=jQuery("#ct_date_range_from, #ct_date_range_till").datepicker({dateFormat:"yy-mm-dd",maxDate:"+0D",changeMonth:!0,changeYear:!0,showAnim:"slideDown",onSelect:function(e){var t="ct_date_range_from"==this.id?"minDate":"maxDate",c=jQuery(this).data("datepicker"),_=jQuery.datepicker.parseDate(c.settings.dateFormat||jQuery.datepicker._defaults.dateFormat,e,c.settings);r.not(this).datepicker("option",t,_)}});function e(e){e=e||null,jQuery("#ct_allow_date_range").is(":checked")&&(ct_date_from=jQuery("#ct_date_range_from").val(),ct_date_till=jQuery("#ct_date_range_till").val(),""==ct_date_from||""==ct_date_till)?alert("Please, specify a date range."):(jQuery("#ct_accurate_check").is(":checked")&&(ct_accurate_check=!0),jQuery(".ct_to_hide").hide(),jQuery("#ct_working_message").show(),jQuery("#ct_preloader").show(),jQuery("#ct_pause").show(),ct_working=!0,e?(ct_show_users_info(),ct_send_users()):ct_clear_users())}jQuery("#ct_check_spam_button").click(function(){e(!(document.cookie="ct_paused_users_check=0; path=/"))}),jQuery("#ct_proceed_check_button").click(function(){e(!0)}),jQuery("#ct_pause").on("click",function(){ct_pause=!0;var e={accurate:ct_accurate_check,from:ct_date_from,till:ct_date_till};document.cookie="ct_paused_users_check="+JSON.stringify(e)+"; path=/"}),jQuery("#ct_insert_users").click(function(){ct_insert_users()}),jQuery("#ct_delete_users").click(function(){ct_insert_users(!0)}),jQuery("#ct_delete_all_users").click(function(){if(!confirm(ctUsersCheck.ct_confirm_deletion_all))return!1;jQuery(".ct_to_hide").hide(),jQuery("#ct_checking_status").hide(),jQuery("#ct_search_info").hide(),jQuery("#ct_preloader").show(),jQuery("#ct_deleting_message").show(),jQuery("#ct_stop_deletion").show(),jQuery("html, body").animate({scrollTop:0},"slow"),ct_delete_all_users()}),jQuery("#ct_delete_checked_users").click(function(){if(!confirm(ctUsersCheck.ct_confirm_deletion_checked))return!1;ct_delete_checked_users()}),jQuery("#ct_stop_deletion").click(function(){location.href="users.php?page=ct_check_users"}),jQuery(".cleantalk_delete_user_button").click(function(){id=jQuery(this).attr("data-id"),ids=Array(),ids[0]=id;var e={action:"ajax_delete_checked_users",security:ct_ajax_nonce,ids:ids};jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){ct_close_animate=!1,jQuery("#comment-"+id).hide(),jQuery("#comment-"+id).remove(),ct_close_animate=!0},timeout:15e3})}),jQuery(".cleantalk_delete_user_button").click(function(){id=jQuery(this).attr("data-id"),animate_comment(.3,id)}),jQuery(".cleantalk_user").mouseover(function(){id=jQuery(this).attr("data-id"),jQuery("#cleantalk_delete_user_"+id).show()}),jQuery(".cleantalk_user").mouseout(function(){id=jQuery(this).attr("data-id"),jQuery("#cleantalk_delete_user_"+id).hide()}),jQuery(".cleantalk_delete_from_list_button").click(function(){ct_id=jQuery(this).attr("data-id");var e={action:"ajax_ct_approve_user",security:ct_ajax_nonce,id:ct_id};jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){jQuery("#comment-"+ct_id).fadeOut("slow",function(){jQuery("#comment-"+ct_id).remove()})}});e={action:"ct_feedback_user",security:ct_ajax_nonce,user_id:ct_id,status:"approve"};jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){},error:function(e,t,c){},timeout:5e3})}),jQuery("#ct_get_csv_file").click(function(){var e={action:"ajax_ct_get_csv_file",security:ct_ajax_nonce,filename:ctUsersCheck.ct_csv_filename};jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){0==parseInt(e)?alert(ctUsersCheck.ct_bad_csv):jQuery("#ct_csv_wrapper").html("<iframe src='"+location.protocol+"//"+location.hostname+"/wp-content/plugins/cleantalk-spam-protect/check-results/"+ctUsersCheck.ct_csv_filename+".csv'></iframe>")}})})});
2
- //# sourceMappingURL=cleantalk-users-checkspam.min.js.map
1
+ String.prototype.printf=function(){var e=this;for(var t in arguments){var c=e.substring(0,e.indexOf("%s",0)),_=e.substring(e.indexOf("%s",0)+2,e.length);e=c+arguments[t]+_}return e};var ct_working=!(document.cookie="ct_check_users__amount=100; path=/"),ct_new_check=!0,ct_cooling_down_flag=!1,ct_close_animate=!0,ct_accurate_check=!1,ct_pause=!1,ct_prev_accurate=ctUsersCheck.ct_prev_accurate,ct_prev_from=ctUsersCheck.ct_prev_from,ct_prev_till=ctUsersCheck.ct_prev_till,ct_cool_down_time=9e4,ct_requests_counter=0,ct_max_requests=60,ct_ajax_nonce=ctUsersCheck.ct_ajax_nonce,ct_users_total=0,ct_users_checked=0,ct_users_spam=0,ct_users_bad=0,ct_unchecked="unset",ct_date_from=0,ct_date_till=0;function apbct_cookie__get(r,a){var s={};return"string"==typeof(r=r||null)&&(r=r.split()),"none"==(a=a||["apbct_","ct_"])&&(a=null),"string"==typeof a&&(a=a.split()),document.cookie.split(";").forEach(function(e,t,c){var _=e.trim().split("=");r&&r.forEach(function(e,t,c){_[0]===e&&(s[_[0]]=_[1])}),a&&a.forEach(function(e,t,c){0===_[0].indexOf(e)&&(s[_[0]]=_[1])})}),s}function apbct_get_cookie(e){var t=apbct_cookie__get(e,e);return"object"==typeof t&&void 0!==t[e]?t[e]:null}function animate_comment(e,t){ct_close_animate?.3==e?jQuery("#comment-"+t).fadeTo(200,e,function(){animate_comment(1,t)}):jQuery("#comment-"+t).fadeTo(200,e,function(){animate_comment(.3,t)}):ct_close_animate=!0}function ct_clear_users(){if(jQuery("#ct_allow_date_range").is(":checked"))ct_show_users_info(),ct_send_users();else{var e={action:"ajax_clear_users",security:ct_ajax_nonce};jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){ct_show_users_info(),ct_send_users()}})}}function ct_cooling_down_toggle(){ct_cooling_down_flag=!1,ct_send_users(),ct_show_users_info()}function ct_send_users(){if(1!=ct_cooling_down_flag){if(ct_max_requests<=ct_requests_counter)return setTimeout(ct_cooling_down_toggle,ct_cool_down_time),void(ct_cooling_down_flag=!(ct_requests_counter=0));ct_requests_counter++;var e={action:"ajax_check_users",security:ct_ajax_nonce,new_check:ct_new_check,unchecked:ct_unchecked,amount:apbct_get_cookie("ct_check_users__amount")};ct_accurate_check&&(e.accurate_check=!0),ct_date_from&&ct_date_till&&(e.from=ct_date_from,e.till=ct_date_till),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){if(e=jQuery.parseJSON(e),parseInt(e.error))if(ct_working=!1,confirm(e.error_message+". Do you want to proceed?"))ct_send_users();else{var t="users.php?page=ct_check_users";0!=ct_date_from&&0!=ct_date_till&&(t+="&from="+ct_date_from+"&till="+ct_date_till),location.href=t}else if(ct_new_check=!1,1==parseInt(e.end)||1==ct_pause){1==parseInt(e.end)&&(document.cookie="ct_paused_users_check=0; path=/"),ct_working=!1,jQuery("#ct_working_message").hide();t="users.php?page=ct_check_users&ct_worked=1";0!=ct_date_from&&0!=ct_date_till&&(t+="&from="+ct_date_from+"&till="+ct_date_till),location.href=t}else if(0==parseInt(e.end)){ct_users_checked+=e.checked,ct_users_spam+=e.spam,ct_users_bad+=e.bad,ct_unchecked=ct_users_total-ct_users_checked-ct_users_bad;var c=(c=String(ctUsersCheck.ct_status_string)).printf(ct_users_total,ct_users_checked,ct_users_spam,ct_users_bad);0<parseInt(ct_users_spam)&&(c+=ctUsersCheck.ct_status_string_warning),jQuery("#ct_checking_status").html(c),jQuery("#ct_error_message").hide(),ct_send_users()}},error:function(e,t,c){20<check_amount&&(check_amount-=20,document.cookie="ct_check_users__amount="+check_amount+"; path=/"),jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("Check users"),setTimeout(ct_send_users(),3e3)},timeout:25e3})}}function ct_show_users_info(){if(ct_working){if(1==ct_cooling_down_flag)return jQuery("#ct_cooling_notice").html("Waiting for API to cool down. (About a minute)"),void jQuery("#ct_cooling_notice").show();if(jQuery("#ct_cooling_notice").hide(),setTimeout(ct_show_users_info,3e3),!ct_users_total){var e={action:"ajax_info_users",security:ct_ajax_nonce};ct_date_from&&ct_date_till&&(e.from=ct_date_from,e.till=ct_date_till),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){e=jQuery.parseJSON(e),jQuery("#ct_checking_status").html(e.message),ct_users_total=e.total,ct_users_spam=e.spam,ct_users_checked=e.checked,ct_users_bad=e.bad},error:function(e,t,c){jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("Show users"),setTimeout(ct_show_users_info(),3e3)},timeout:15e3})}}}function ct_insert_users(t){var e={action:"ajax_insert_users",security:ct_ajax_nonce};(t=t||null)&&(e.delete=!0),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){t?alert(ctUsersCheck.ct_deleted+" "+e+" "+ctUsersCheck.ct_iusers):alert(ctUsersCheck.ct_inserted+" "+e+" "+ctUsersCheck.ct_iusers)}})}function ct_delete_all_users(){var e={action:"ajax_delete_all_users",security:ct_ajax_nonce};jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){0<e?(jQuery("#cleantalk_users_left").html(e),ct_delete_all_users()):location.href="users.php?page=ct_check_users&ct_worked=1"},error:function(e,t,c){jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("All users deleteion"),setTimeout(ct_delete_all_users(),3e3)},timeout:25e3})}function ct_delete_checked_users(){ids=Array();var e=0;jQuery("input[id^=cb-select-][id!=cb-select-all-1]").each(function(){jQuery(this).prop("checked")&&(ids[e]=jQuery(this).attr("id").substring(10),e++)});var t={action:"ajax_delete_checked_users",security:ct_ajax_nonce,ids:ids};jQuery.ajax({type:"POST",url:ajaxurl,data:t,success:function(e){location.href="users.php?page=ct_check_users&ct_worked=1"},error:function(e,t,c){jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("All users deleteion"),setTimeout(ct_delete_checked_users(),3e3)},timeout:15e3})}function ct_toggle_depended(e,t){t=t||null;var c=jQuery(e.data("depended"));e.data("state")||t?(e.data("state",!1),c.prop("disabled",!0),c.removeProp("checked"),c.data("depended")&&ct_toggle_depended(c,!0)):(e.data("state",!0),c.removeProp("disabled"))}jQuery(document).ready(function(){jQuery("#ct_allow_date_range").data({depended:".ct_date",state:!1}),ct_prev_accurate&&jQuery("#ct_accurate_check").prop("checked",!0),ct_prev_from&&(jQuery("#ct_allow_date_range").prop("checked",!0).data("state",!0),jQuery("#ct_date_range_from").removeProp("disabled").val(ct_prev_from),jQuery("#ct_date_range_till").removeProp("disabled").val(ct_prev_till)),jQuery("#ct_allow_date_range, #ct_accurate_check").on("change",function(){ct_toggle_depended(jQuery(this))});var r=jQuery("#ct_date_range_from, #ct_date_range_till").datepicker({dateFormat:"yy-mm-dd",maxDate:"+0D",changeMonth:!0,changeYear:!0,showAnim:"slideDown",onSelect:function(e){var t="ct_date_range_from"==this.id?"minDate":"maxDate",c=jQuery(this).data("datepicker"),_=jQuery.datepicker.parseDate(c.settings.dateFormat||jQuery.datepicker._defaults.dateFormat,e,c.settings);r.not(this).datepicker("option",t,_)}});function e(e){e=e||null,jQuery("#ct_allow_date_range").is(":checked")&&(ct_date_from=jQuery("#ct_date_range_from").val(),ct_date_till=jQuery("#ct_date_range_till").val(),""===ct_date_from||""===ct_date_till)?alert("Please, specify a date range."):(jQuery("#ct_accurate_check").is(":checked")&&(ct_accurate_check=!0),jQuery(".ct_to_hide").hide(),jQuery("#ct_working_message").show(),jQuery("#ct_preloader").show(),jQuery("#ct_pause").show(),ct_working=!0,e?(ct_show_users_info(),ct_send_users()):ct_clear_users())}jQuery("#ct_check_spam_button").click(function(){e(!(document.cookie="ct_paused_users_check=0; path=/"))}),jQuery("#ct_proceed_check_button").click(function(){e(!0)}),jQuery("#ct_pause").on("click",function(){ct_pause=!0;var e={accurate:ct_accurate_check,from:ct_date_from,till:ct_date_till};document.cookie="ct_paused_users_check="+JSON.stringify(e)+"; path=/"}),jQuery("#ct_insert_users").click(function(){ct_insert_users()}),jQuery("#ct_delete_users").click(function(){ct_insert_users(!0)}),jQuery("#ct_delete_all_users").click(function(){if(!confirm(ctUsersCheck.ct_confirm_deletion_all))return!1;jQuery(".ct_to_hide").hide(),jQuery("#ct_checking_status").hide(),jQuery("#ct_search_info").hide(),jQuery("#ct_preloader").show(),jQuery("#ct_deleting_message").show(),jQuery("#ct_stop_deletion").show(),jQuery("html, body").animate({scrollTop:0},"slow"),ct_delete_all_users()}),jQuery("#ct_delete_checked_users").click(function(){if(!confirm(ctUsersCheck.ct_confirm_deletion_checked))return!1;ct_delete_checked_users()}),jQuery("#ct_stop_deletion").click(function(){location.href="users.php?page=ct_check_users"}),jQuery(".cleantalk_delete_user_button").click(function(){id=jQuery(this).attr("data-id"),ids=Array(),ids[0]=id;var e={action:"ajax_delete_checked_users",security:ct_ajax_nonce,ids:ids};jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){ct_close_animate=!1,jQuery("#comment-"+id).hide(),jQuery("#comment-"+id).remove(),ct_close_animate=!0},timeout:15e3})}),jQuery(".cleantalk_delete_user_button").click(function(){id=jQuery(this).attr("data-id"),animate_comment(.3,id)}),jQuery(".cleantalk_user").mouseover(function(){id=jQuery(this).attr("data-id"),jQuery("#cleantalk_delete_user_"+id).show()}),jQuery(".cleantalk_user").mouseout(function(){id=jQuery(this).attr("data-id"),jQuery("#cleantalk_delete_user_"+id).hide()}),jQuery(".cleantalk_delete_from_list_button").click(function(){ct_id=jQuery(this).attr("data-id");var e={action:"ajax_ct_approve_user",security:ct_ajax_nonce,id:ct_id};jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){jQuery("#comment-"+ct_id).fadeOut("slow",function(){jQuery("#comment-"+ct_id).remove()})}});e={action:"ct_feedback_user",security:ct_ajax_nonce,user_id:ct_id,status:"approve"};jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){},error:function(e,t,c){},timeout:5e3})}),jQuery("#ct_get_csv_file").click(function(){var e={action:"ajax_ct_get_csv_file",security:ct_ajax_nonce,filename:ctUsersCheck.ct_csv_filename};jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){0==parseInt(e)?alert(ctUsersCheck.ct_bad_csv):jQuery("#ct_csv_wrapper").html("<iframe src='"+location.protocol+"//"+location.hostname+"/wp-content/plugins/cleantalk-spam-protect/check-results/"+ctUsersCheck.ct_csv_filename+".csv'></iframe>")}})})});
2
+ //# sourceMappingURL=cleantalk-users-checkspam.min.js.map
js/cleantalk-users-checkspam.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["cleantalk-users-checkspam.js"],"names":["ct_working","String","prototype","printf","formatted","this","arg","arguments","before_formatted","substring","indexOf","after_formatted","length","ct_new_check","ct_cooling_down_flag","ct_close_animate","ct_accurate_check","ct_pause","ct_prev_accurate","ctUsersCheck","ct_prev_from","ct_prev_till","ct_cool_down_time","ct_requests_counter","ct_max_requests","ct_ajax_nonce","ct_users_total","ct_users_checked","ct_users_spam","ct_users_bad","ct_unchecked","ct_date_from","ct_date_till","animate_comment","to","id","jQuery","fadeTo","ct_clear_users","data","action","security","ajax","type","url","ajaxurl","success","msg","ct_show_users_info","ct_send_users","ct_cooling_down_toggle","setTimeout","new_check","unchecked","parseJSON","parseInt","error","confirm","error_message","new_href","location","href","end","document","cookie","hide","checked","spam","bad","status_string","ct_status_string","ct_status_string_warning","html","jqXHR","textStatus","errorThrown","show","timeout","message","total","ct_insert_users","delete_accounts","alert","ct_deleted","ct_iusers","ct_inserted","ct_delete_all_users","ct_delete_checked_users","ids","Array","cnt","each","prop","attr","ct_toggle_depended","obj","secondary","depended","removeProp","ready","state","val","on","dates","datepicker","dateFormat","maxDate","changeMonth","changeYear","showAnim","onSelect","selectedDate","option","instance","date","parseDate","settings","_defaults","not","ct_start_check","continue_check","is","click","ct_check","accurate","from","till","JSON","stringify","ct_confirm_deletion_all","animate","scrollTop","ct_confirm_deletion_checked","remove","mouseover","mouseout","ct_id","fadeOut","user_id","status","filename","ct_csv_filename","ct_bad_csv","protocol","hostname"],"mappings":"AAYA,IAAIA,aAXJC,OAAOC,UAAUC,OAAS,WACtB,IAAIC,EAAYC,KAChB,IAAK,IAAIC,KAAOC,UAAY,CAC9B,IAAIC,EAAmBJ,EAAUK,UAAU,EAAGL,EAAUM,QAAQ,KAAM,IAClEC,EAAmBP,EAAUK,UAAUL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M,OACNC,IAAKC,QACLN,KAAMA,EACNO,QAAS,SAASC,KAWlBS,MAAO,SAASiB,EAAOC,EAAYC,KAGnCE,QAAS,QAMXzC,OAAO,oBAAoBsF,MAAM,WAChC,IAAInF,EAAO,CACVC,OAAU,uBACVC,SAAYhB,cACZmH,SAAYzH,aAAa0H,iBAE1BzG,OAAOM,KAAK,CACXC,KAAM,OACNC,IAAKC,QACLN,KAAMA,EACNO,QAAS,SAASC,GACC,GAAfQ,SAASR,GACXmC,MAAM/D,aAAa2H,YAEnB1G,OAAO,mBAAmBoC,KAAK,gBAAgBZ,SAASmF,SAAS,KAAKnF,SAASoF,SAAS,4DAA4D7H,aAAa0H,gBAAgB","file":"cleantalk-users-checkspam.min.js","sourcesContent":["// Printf for JS\r\nString.prototype.printf = function(){\r\n var formatted = this;\r\n for( var arg in arguments ) {\r\n\t\tvar before_formatted = formatted.substring(0, formatted.indexOf(\"%s\", 0));\r\n\t\tvar after_formatted = formatted.substring(formatted.indexOf(\"%s\", 0)+2, formatted.length);\r\n\t\tformatted = before_formatted + arguments[arg] + after_formatted;\r\n }\r\n return formatted;\r\n};\r\n\r\n// Flags\r\nvar ct_working = false,\r\n\tct_new_check = true,\r\n\tct_cooling_down_flag = false,\r\n\tct_close_animate = true,\r\n\tct_accurate_check = false,\r\n\tct_pause = false,\r\n\tct_prev_accurate = ctUsersCheck.ct_prev_accurate,\r\n\tct_prev_from = ctUsersCheck.ct_prev_from,\t\r\n\tct_prev_till = ctUsersCheck.ct_prev_till;\r\n// Settings\r\nvar ct_cool_down_time = 90000,\r\n\tct_requests_counter = 0,\r\n\tct_max_requests = 60;\r\n// Variables\r\nvar ct_ajax_nonce = ctUsersCheck.ct_ajax_nonce,\r\n\tct_users_total = 0,\r\n\tct_users_checked = 0,\r\n\tct_users_spam = 0,\r\n\tct_users_bad = 0,\r\n\tct_unchecked = 'unset',\r\n\tct_date_from = 0,\r\n\tct_date_till = 0;\r\n\r\nfunction animate_comment(to,id){\r\n\tif(ct_close_animate){\r\n\t\tif(to==0.3){\r\n\t\t\tjQuery('#comment-'+id).fadeTo(200,to,function(){\r\n\t\t\t\tanimate_comment(1,id)\r\n\t\t\t});\r\n\t\t}else{\r\n\t\t\tjQuery('#comment-'+id).fadeTo(200,to,function(){\r\n\t\t\t\tanimate_comment(0.3,id)\r\n\t\t\t});\r\n\t\t}\r\n\t}else{\r\n\t\tct_close_animate=true;\r\n\t}\r\n}\r\n\r\nfunction ct_clear_users(){\r\n\t\r\n\tvar data = {\r\n\t\t'action': 'ajax_clear_users',\r\n\t\t'security': ct_ajax_nonce\r\n\t};\r\n\t\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function(msg){\r\n\t\t\tct_show_users_info();\r\n\t\t\tct_send_users();\r\n\t\t}\r\n\t});\r\n}\r\n\r\n//Continues the check after cooldown time\r\n//Called by ct_send_users();\r\nfunction ct_cooling_down_toggle(){\r\n\tct_cooling_down_flag = false;\r\n\tct_send_users();\r\n\tct_show_users_info();\r\n}\r\n\r\nfunction ct_send_users(){\r\n\t\r\n\tif(ct_cooling_down_flag == true)\r\n\t\treturn;\r\n\t\r\n\tif(ct_requests_counter >= ct_max_requests){\r\n\t\tsetTimeout(ct_cooling_down_toggle, ct_cool_down_time);\r\n\t\tct_requests_counter = 0;\r\n\t\tct_cooling_down_flag = true;\r\n\t\treturn;\r\n\t}else{\r\n\t\tct_requests_counter++;\r\n\t}\r\n\t\r\n\tvar data = {\r\n\t\t'action': 'ajax_check_users',\r\n\t\t'security': ct_ajax_nonce,\r\n\t\t'new_check': ct_new_check,\r\n\t\t'unchecked': ct_unchecked\r\n\t};\r\n\t\r\n\tif(ct_accurate_check)\r\n\t\tdata['accurate_check'] = true;\r\n\t\r\n\tif(ct_date_from && ct_date_till){\r\n\t\tdata['from'] = ct_date_from;\r\n\t\tdata['till'] = ct_date_till;\r\n\t}\r\n\t\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function(msg){\r\n\t\t\t\r\n\t\t\tmsg = jQuery.parseJSON(msg);\r\n\t\t\t\r\n\t\t\tif(parseInt(msg.error)){\r\n\t\t\t\tct_working=false;\r\n\t\t\t\tif(!confirm(msg.error_message+\". Do you want to proceed?\")){\r\n\t\t\t\t\tvar new_href = 'users.php?page=ct_check_users';\r\n\t\t\t\t\tif(ct_date_from != 0 && ct_date_till != 0)\r\n\t\t\t\t\t\tnew_href+='&from='+ct_date_from+'&till='+ct_date_till;\r\n\t\t\t\t\tlocation.href = new_href;\r\n\t\t\t\t}else\r\n\t\t\t\t\tct_send_users();\r\n\t\t\t}else{\r\n\t\t\t\tct_new_check = false;\r\n\t\t\t\tif(parseInt(msg.end) == 1 || ct_pause == true){\r\n\t\t\t\t\tif(parseInt(msg.end) == 1)\r\n\t\t\t\t\t\tdocument.cookie = 'ct_paused_users_check=0; path=/';\r\n\t\t\t\t\tct_working=false;\r\n\t\t\t\t\tjQuery('#ct_working_message').hide();\r\n\t\t\t\t\tvar new_href = 'users.php?page=ct_check_users&ct_worked=1';\r\n\t\t\t\t\tif(ct_date_from != 0 && ct_date_till != 0)\r\n\t\t\t\t\t\tnew_href+='&from='+ct_date_from+'&till='+ct_date_till;\r\n\t\t\t\t\tlocation.href = new_href;\r\n\t\t\t\t}else if(parseInt(msg.end) == 0){\r\n\t\t\t\t\tct_users_checked += msg.checked;\r\n\t\t\t\t\tct_users_spam += msg.spam;\r\n\t\t\t\t\tct_users_bad += msg.bad;\r\n\t\t\t\t\tct_unchecked = ct_users_total - ct_users_checked - ct_users_bad;\r\n\t\t\t\t\tvar status_string = String(ctUsersCheck.ct_status_string);\r\n\t\t\t\t\tvar status_string = status_string.printf(ct_users_total, ct_users_checked, ct_users_spam, ct_users_bad);\r\n\t\t\t\t\tif(parseInt(ct_users_spam) > 0)\r\n\t\t\t\t\t\tstatus_string += ctUsersCheck.ct_status_string_warning;\r\n\t\t\t\t\tjQuery('#ct_checking_status').html(status_string);\r\n\t\t\t\t\tjQuery('#ct_error_message').hide();\r\n\t\t\t\t\tct_send_users();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t},\r\n error: function(jqXHR, textStatus, errorThrown) {\r\n\t\t\tjQuery('#ct_error_message').show();\r\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\r\n\t\t\tjQuery('#cleantalk_js_func').html('Check users');\r\n\t\t\tsetTimeout(ct_send_users(), 3000);\r\n },\r\n timeout: 25000\r\n\t});\r\n}\r\nfunction ct_show_users_info(){\r\n\t\r\n\tif(ct_working){\r\n\t\t\r\n\t\tif(ct_cooling_down_flag == true){\r\n\t\t\tjQuery('#ct_cooling_notice').html('Waiting for API to cool down. (About a minute)');\r\n\t\t\tjQuery('#ct_cooling_notice').show();\r\n\t\t\treturn;\t\t\t\r\n\t\t}else{\r\n\t\t\tjQuery('#ct_cooling_notice').hide();\r\n\t\t}\r\n\t\t\r\n\t\tsetTimeout(ct_show_users_info, 3000);\r\n\t\t\r\n\t\tif(!ct_users_total){\r\n\t\t\t\r\n\t\t\tvar data = {\r\n\t\t\t\t'action': 'ajax_info_users',\r\n\t\t\t\t'security': ct_ajax_nonce\r\n\t\t\t};\r\n\t\t\t\r\n\t\t\tif(ct_date_from && ct_date_till){\r\n\t\t\t\tdata['from'] = ct_date_from;\r\n\t\t\t\tdata['till'] = ct_date_till;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tjQuery.ajax({\r\n\t\t\t\ttype: \"POST\",\r\n\t\t\t\turl: ajaxurl,\r\n\t\t\t\tdata: data,\r\n\t\t\t\tsuccess: function(msg){\r\n\t\t\t\t\tmsg = jQuery.parseJSON(msg);\r\n\t\t\t\t\tjQuery('#ct_checking_status').html(msg.message);\r\n\t\t\t\t\tct_users_total = msg.total;\r\n\t\t\t\t\tct_users_spam = msg.spam;\r\n\t\t\t\t\tct_users_checked = msg.checked;\r\n\t\t\t\t\tct_users_bad = msg.bad;\r\n\t\t\t\t},\r\n\t\t\t\terror: function (jqXHR, textStatus, errorThrown){\r\n\t\t\t\t\tjQuery('#ct_error_message').show();\r\n\t\t\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\r\n\t\t\t\t\tjQuery('#cleantalk_js_func').html('Show users');\r\n\t\t\t\t\tsetTimeout(ct_show_users_info(), 3000);\r\n\t\t\t\t},\r\n\t\t\t\ttimeout: 15000\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n}\r\nfunction ct_insert_users(delete_accounts){\r\n\r\n delete_accounts = delete_accounts || null;\r\n\r\n\tvar data = {\r\n\t\t'action': 'ajax_insert_users',\r\n\t\t'security': ct_ajax_nonce\r\n\t};\r\n\t\r\n\tif(delete_accounts)\r\n\t\tdata['delete'] = true;\r\n\t\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function(msg){\r\n\t\t\tif(delete_accounts)\r\n\t\t\t\talert(ctUsersCheck.ct_deleted + ' ' + msg + ' ' + ctUsersCheck.ct_iusers);\r\n\t\t\telse\r\n\t\t\t\talert(ctUsersCheck.ct_inserted + ' ' + msg + ' ' + ctUsersCheck.ct_iusers);\r\n\t\t}\r\n\t});\r\n}\r\nfunction ct_delete_all_users(){\r\n\t\r\n\tvar data = {\r\n\t\t'action': 'ajax_delete_all_users',\r\n\t\t'security': ct_ajax_nonce\r\n\t};\r\n\t\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function(msg){\r\n\t\t\tif(msg>0){\r\n\t\t\t\tjQuery('#cleantalk_users_left').html(msg);\r\n\t\t\t\tct_delete_all_users();\r\n\t\t\t}else{\r\n\t\t\t\tlocation.href='users.php?page=ct_check_users&ct_worked=1';\r\n\t\t\t}\r\n\t\t},\r\n error: function(jqXHR, textStatus, errorThrown) {\r\n\t\t\tjQuery('#ct_error_message').show();\r\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\r\n\t\t\tjQuery('#cleantalk_js_func').html('All users deleteion');\r\n\t\t\tsetTimeout(ct_delete_all_users(), 3000);\r\n },\r\n timeout: 25000\r\n\t});\r\n}\r\nfunction ct_delete_checked_users(){\r\n\t\r\n\tids=Array();\r\n\tvar cnt=0;\r\n\tjQuery('input[id^=cb-select-][id!=cb-select-all-1]').each(function(){\r\n\t\tif(jQuery(this).prop('checked')){\r\n\t\t\tids[cnt]=jQuery(this).attr('id').substring(10);\r\n\t\t\tcnt++;\r\n\t\t}\r\n\t});\r\n\tvar data = {\r\n\t\t'action': 'ajax_delete_checked_users',\r\n\t\t'security': ct_ajax_nonce,\r\n\t\t'ids':ids\r\n\t};\r\n\t\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function(msg){\r\n\t\t\tlocation.href='users.php?page=ct_check_users&ct_worked=1';\r\n\t\t},\r\n\t\terror: function(jqXHR, textStatus, errorThrown) {\r\n\t\t\tjQuery('#ct_error_message').show();\r\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\r\n\t\t\tjQuery('#cleantalk_js_func').html('All users deleteion');\r\n\t\t\tsetTimeout(ct_delete_checked_users(), 3000);\r\n\t\t},\r\n\t\ttimeout: 15000\r\n\t});\r\n}\r\n\r\n// Function to toggle dependences\r\nfunction ct_toggle_depended(obj, secondary){\r\n\r\n secondary = secondary || null;\r\n\r\n\tvar depended = jQuery(obj.data('depended')),\r\n\t\tstate = obj.data('state');\r\n\t\t\r\n\tif(!state && !secondary){\r\n\t\tobj.data('state', true);\r\n\t\tdepended.removeProp('disabled');\r\n\t}else{\r\n\t\tobj.data('state', false);\r\n\t\tdepended.prop('disabled', true);\r\n\t\tdepended.removeProp('checked');\r\n\t\tif(depended.data('depended'))\r\n\t\t\tct_toggle_depended(depended, true);\r\n\t}\r\n}\r\n\r\njQuery(document).ready(function(){\r\n\t\r\n\t// Setting dependences\r\n\t// jQuery('#ct_accurate_check') .data({'depended': '#ct_allow_date_range', 'state': false});\r\n\tjQuery('#ct_allow_date_range').data({'depended': '.ct_date', 'state': false});\r\n\t\r\n\t// Prev check parameters\r\n\tif(ct_prev_accurate){\r\n\t\tjQuery(\"#ct_accurate_check\").prop('checked', true);\r\n\t}\r\n\tif(ct_prev_from){\r\n\t\tjQuery(\"#ct_allow_date_range\").prop('checked', true).data('state', true);\r\n\t\tjQuery(\"#ct_date_range_from\").removeProp('disabled').val(ct_prev_from);\r\n\t\tjQuery(\"#ct_date_range_till\").removeProp('disabled').val(ct_prev_till);\r\n\t}\r\n\t\r\n\t// Toggle dependences\r\n\tjQuery(\"#ct_allow_date_range, #ct_accurate_check\").on('change', function(){\r\n\t\tct_toggle_depended(jQuery(this));\r\n\t});\r\n\t\t\r\n\tvar dates = jQuery('#ct_date_range_from, #ct_date_range_till').datepicker(\r\n\t\t{\r\n\t\t\tdateFormat: 'yy-mm-dd',\r\n\t\t\tmaxDate:\"+0D\",\r\n\t\t\tchangeMonth:true,\r\n\t\t\tchangeYear:true,\r\n\t\t\tshowAnim: 'slideDown',\r\n\t\t\tonSelect: function(selectedDate){\r\n\t\t\tvar option = this.id == \"ct_date_range_from\" ? \"minDate\" : \"maxDate\",\r\n\t\t\t\tinstance = jQuery( this ).data( \"datepicker\" ),\r\n\t\t\t\tdate = jQuery.datepicker.parseDate(\r\n\t\t\t\t\tinstance.settings.dateFormat || jQuery.datepicker._defaults.dateFormat,\r\n\t\t\t\t\tselectedDate, instance.settings);\r\n\t\t\t\tdates.not(this).datepicker(\"option\", option, date);\r\n\t\t\t}\r\n\t\t}\r\n\t);\r\n\t\t\r\n\tfunction ct_start_check(continue_check){\r\n\r\n\t continue_check = continue_check || null;\r\n\t\t\r\n\t\tif(jQuery('#ct_allow_date_range').is(':checked')){\r\n\t\t\t\r\n\t\t\tct_date_from = jQuery('#ct_date_range_from').val(),\r\n\t\t\tct_date_till = jQuery('#ct_date_range_till').val();\r\n\t\t\t\t\t\t\r\n\t\t\tif(!(ct_date_from != '' && ct_date_till != '')){\r\n\t\t\t\talert('Please, specify a date range.');\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tif(jQuery('#ct_accurate_check').is(':checked')){\r\n\t\t\tct_accurate_check = true;\r\n\t\t}\r\n\t\t\r\n\t\tjQuery('.ct_to_hide').hide();\r\n\t\tjQuery('#ct_working_message').show();\r\n\t\tjQuery('#ct_preloader').show();\r\n\t\tjQuery('#ct_pause').show();\r\n\t\t\r\n\t\tct_working=true;\r\n\t\t\r\n\t\tif(continue_check){\r\n\t\t\tct_show_users_info();\r\n\t\t\tct_send_users();\r\n\t\t}else\r\n\t\t\tct_clear_users();\r\n\t\t\r\n\t}\r\n\t\r\n\t// Check users\r\n\tjQuery(\"#ct_check_spam_button\").click(function(){\r\n\t\tdocument.cookie = 'ct_paused_users_check=0; path=/';\r\n\t\tct_start_check(false);\r\n\t});\r\n\tjQuery(\"#ct_proceed_check_button\").click(function(){\r\n\t\tct_start_check(true);\r\n\t});\r\n\t\r\n\t// Pause the check\r\n\tjQuery('#ct_pause').on('click', function(){\r\n\t\tct_pause = true;\r\n\t\tvar ct_check = {\r\n\t\t\t'accurate': ct_accurate_check,\r\n\t\t\t'from' : ct_date_from,\r\n\t\t\t'till' : ct_date_till\r\n\t\t};\r\n\t\tdocument.cookie = 'ct_paused_users_check=' + JSON.stringify(ct_check) + '; path=/';\r\n\t});\r\n\t\r\n\tjQuery(\"#ct_insert_users\").click(function(){\r\n\t\tct_insert_users();\r\n\t});\r\n\t\r\n\tjQuery(\"#ct_delete_users\").click(function(){\r\n\t\tct_insert_users(true);\r\n\t});\r\n\t\r\n\t// Delete all spam users\r\n\tjQuery(\"#ct_delete_all_users\").click(function(){\r\n\t\t\r\n\t\tif (!confirm(ctUsersCheck.ct_confirm_deletion_all))\r\n\t\t\treturn false;\r\n\t\t\r\n\t\tjQuery('.ct_to_hide').hide();\r\n\t\tjQuery('#ct_checking_status').hide();\r\n\t\tjQuery('#ct_search_info').hide();\r\n\t\tjQuery('#ct_preloader').show();\r\n\t\tjQuery('#ct_deleting_message').show();\r\n\t\tjQuery('#ct_stop_deletion').show();\r\n\t\tjQuery(\"html, body\").animate({ scrollTop: 0 }, \"slow\");\r\n\t\tct_delete_all_users();\r\n\t});\r\n\tjQuery(\"#ct_delete_checked_users\").click(function(){\r\n\t\tif (!confirm(ctUsersCheck.ct_confirm_deletion_checked))\r\n\t\t\treturn false;\r\n\t\tct_delete_checked_users();\r\n\t});\r\n\t\r\n\tjQuery(\"#ct_stop_deletion\").click(function(){\r\n\t\tlocation.href='users.php?page=ct_check_users';\r\n\t});\r\n\t\r\n\tjQuery(\".cleantalk_delete_user_button\").click(function(){\r\n\t\tid = jQuery(this).attr(\"data-id\");\r\n\t\tids=Array();\r\n\t\tids[0]=id;\r\n\t\tvar data = {\r\n\t\t\t'action': 'ajax_delete_checked_users',\r\n\t\t\t'security': ct_ajax_nonce,\r\n\t\t\t'ids':ids\r\n\t\t};\r\n\t\tjQuery.ajax({\r\n\t\t\ttype: \"POST\",\r\n\t\t\turl: ajaxurl,\r\n\t\t\tdata: data,\r\n\t\t\tsuccess: function(msg){\r\n\t\t\t\tct_close_animate=false;\r\n\t\t\t\tjQuery(\"#comment-\"+id).hide();\r\n\t\t\t\tjQuery(\"#comment-\"+id).remove();\r\n\t\t\t\tct_close_animate=true;\r\n\t\t\t},\r\n\t\t\ttimeout: 15000\r\n\t\t});\r\n\t});\r\n\t\r\n\tjQuery(\".cleantalk_delete_user_button\").click(function(){\r\n\t\tid = jQuery(this).attr(\"data-id\");\r\n\t\tanimate_comment(0.3, id);\r\n\t});\r\n\t\t\r\n\t//Show/hide action on mouse over/out\r\n\tjQuery(\".cleantalk_user\").mouseover(function(){\r\n\t\tid = jQuery(this).attr(\"data-id\");\r\n\t\tjQuery(\"#cleantalk_delete_user_\"+id).show();\r\n\t});\r\n\tjQuery(\".cleantalk_user\").mouseout(function(){\r\n\t\tid = jQuery(this).attr(\"data-id\");\r\n\t\tjQuery(\"#cleantalk_delete_user_\"+id).hide();\r\n\t});\r\n\t\t\r\n\t//Approve button\r\n\tjQuery(\".cleantalk_delete_from_list_button\").click(function(){\r\n\t\tct_id = jQuery(this).attr(\"data-id\");\r\n\t\t\r\n\t\t// Approving\r\n\t\tvar data = {\r\n\t\t\t'action': 'ajax_ct_approve_user',\r\n\t\t\t'security': ct_ajax_nonce,\r\n\t\t\t'id': ct_id\r\n\t\t};\r\n\t\tjQuery.ajax({\r\n\t\t\ttype: \"POST\",\r\n\t\t\turl: ajaxurl,\r\n\t\t\tdata: data,\r\n\t\t\tsuccess: function(msg){\r\n\t\t\t\tjQuery(\"#comment-\"+ct_id).fadeOut('slow', function(){\r\n\t\t\t\t\tjQuery(\"#comment-\"+ct_id).remove();\r\n\t\t\t\t});\r\n\t\t\t},\r\n\t\t});\r\n\t\t\r\n\t\t// Positive feedback\r\n\t\tvar data = {\r\n\t\t\t'action': 'ct_feedback_user',\r\n\t\t\t'security': ct_ajax_nonce,\r\n\t\t\t'user_id': ct_id,\r\n\t\t\t'status': 'approve'\r\n\t\t};\r\n\t\tjQuery.ajax({\r\n\t\t\ttype: \"POST\",\r\n\t\t\turl: ajaxurl,\r\n\t\t\tdata: data,\r\n\t\t\tsuccess: function(msg){\r\n\t\t\t\tif(msg == 1){\r\n\t\t\t\t\t// Success\r\n\t\t\t\t}\r\n\t\t\t\tif(msg == 0){\r\n\t\t\t\t\t// Error occurred\r\n\t\t\t\t}\r\n\t\t\t\tif(msg == 'no_hash'){\r\n\t\t\t\t\t// No hash\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\terror: function(jqXHR, textStatus, errorThrown) {\r\n\t\t\t\t\r\n\t\t\t},\r\n\t\t\ttimeout: 5000\r\n\t\t});\r\n\t\t\r\n\t});\r\n\t\r\n\t// Request to Download CSV file.\r\n\tjQuery(\"#ct_get_csv_file\").click(function(){\r\n\t\tvar data = {\r\n\t\t\t'action': 'ajax_ct_get_csv_file',\r\n\t\t\t'security': ct_ajax_nonce,\r\n\t\t\t'filename': ctUsersCheck.ct_csv_filename\r\n\t\t};\r\n\t\tjQuery.ajax({\r\n\t\t\ttype: \"POST\",\r\n\t\t\turl: ajaxurl,\r\n\t\t\tdata: data,\r\n\t\t\tsuccess: function(msg){\r\n\t\t\t\tif(parseInt(msg)==0)\r\n\t\t\t\t\talert(ctUsersCheck.ct_bad_csv);\r\n\t\t\t\telse\r\n\t\t\t\t\tjQuery(\"#ct_csv_wrapper\").html(\"<iframe src='\"+location.protocol+\"//\"+location.hostname+\"/wp-content/plugins/cleantalk-spam-protect/check-results/\"+ctUsersCheck.ct_csv_filename+\".csv'></iframe>\");\r\n\t\t\t},\r\n\t\t});\r\n\t});\r\n});"]}
1
+ {"version":3,"sources":["cleantalk-users-checkspam.js"],"names":["String","prototype","printf","formatted","this","arg","arguments","before_formatted","substring","indexOf","after_formatted","length","ct_working","document","cookie","ct_new_check","ct_cooling_down_flag","ct_close_animate","ct_accurate_check","ct_pause","ct_prev_accurate","ctUsersCheck","ct_prev_from","ct_prev_till","ct_cool_down_time","ct_requests_counter","ct_max_requests","ct_ajax_nonce","ct_users_total","ct_users_checked","ct_users_spam","ct_users_bad","ct_unchecked","ct_date_from","ct_date_till","apbct_cookie__get","names","prefixes","split","forEach","item","i","arr","curr","trim","name","all","prefix","apbct_get_cookie","animate_comment","to","id","jQuery","fadeTo","ct_clear_users","is","ct_show_users_info","ct_send_users","data","action","security","ajax","type","url","ajaxurl","success","msg","ct_cooling_down_toggle","setTimeout","new_check","unchecked","amount","parseJSON","parseInt","error","confirm","error_message","new_href","location","href","end","hide","checked","spam","bad","status_string","ct_status_string","ct_status_string_warning","html","jqXHR","textStatus","errorThrown","check_amount","show","timeout","message","total","ct_insert_users","delete_accounts","alert","ct_deleted","ct_iusers","ct_inserted","ct_delete_all_users","ct_delete_checked_users","ids","Array","cnt","each","prop","attr","ct_toggle_depended","obj","secondary","depended","removeProp","ready","state","val","on","dates","datepicker","dateFormat","maxDate","changeMonth","changeYear","showAnim","onSelect","selectedDate","option","instance","date","parseDate","settings","_defaults","not","ct_start_check","continue_check","click","ct_check","accurate","from","till","JSON","stringify","ct_confirm_deletion_all","animate","scrollTop","ct_confirm_deletion_checked","remove","mouseover","mouseout","ct_id","fadeOut","user_id","status","filename","ct_csv_filename","ct_bad_csv","protocol","hostname"],"mappings":"AACAA,OAAOC,UAAUC,OAAS,WACtB,IAAIC,EAAYC,KAChB,IAAK,IAAIC,KAAOC,UAAY,CAC9B,IAAIC,EAAmBJ,EAAUK,UAAU,EAAGL,EAAUM,QAAQ,KAAM,IAClEC,EAAmBP,EAAUK,UAAUL,EAAUM,QAAQ,KAAM,GAAG,EAAGN,EAAUQ,QACnFR,EAAYI,EAAmBD,UAAUD,GAAOK,EAE9C,OAAOP,GAOX,IAAIS,aAHJC,SAASC,OAAS,sCAIjBC,cAAe,EACfC,sBAAuB,EACvBC,kBAAmB,EACnBC,mBAAoB,EACpBC,UAAW,EACXC,iBAAmBC,aAAaD,iBAChCE,aAAmBD,aAAaC,aAChCC,aAAmBF,aAAaE,aAE7BC,kBAAoB,IACvBC,oBAAsB,EACtBC,gBAAkB,GAEfC,cAAgBN,aAAaM,cAChCC,eAAiB,EACjBC,iBAAmB,EACnBC,cAAgB,EAChBC,aAAe,EACfC,aAAe,QACfC,aAAe,EACfC,aAAe,EAGhB,SAASC,kBAAkBC,EAAOC,GACjC,IAAIvB,EAAS,GAuBb,MArBmB,iBADnBsB,EAAQA,GAAS,QACYA,EAAQA,EAAME,SAE5B,SADfD,EAAWA,GAAY,CAAC,SAAU,UACFA,EAAW,MACrB,iBAAZA,IAAsBA,EAAWA,EAASC,SACpDzB,SAASC,OAAOwB,MAAM,KAAKC,QAAQ,SAASC,EAAMC,EAAGC,GACpD,IAAIC,EAAOH,EAAKI,OAAON,MAAM,KAE1BF,GACFA,EAA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AMzB3F,EAAO,CACVC,OAAU,mBACVC,SAAYjC,cACZ+H,QAAWF,MACXG,OAAU,WAEXvG,OAAOS,KAAK,CACXC,KAAM,OACNC,IAAKC,QACLN,KAAMA,EACNO,QAAS,SAASC,KAWlBQ,MAAO,SAASe,EAAOC,EAAYC,KAGnCG,QAAS,QAMX1C,OAAO,oBAAoBsF,MAAM,WAChC,IAAIhF,EAAO,CACVC,OAAU,uBACVC,SAAYjC,cACZiI,SAAYvI,aAAawI,iBAE1BzG,OAAOS,KAAK,CACXC,KAAM,OACNC,IAAKC,QACLN,KAAMA,EACNO,QAAS,SAASC,GACC,GAAfO,SAASP,GACXiC,MAAM9E,aAAayI,YAEnB1G,OAAO,mBAAmBoC,KAAK,gBAAgBV,SAASiF,SAAS,KAAKjF,SAASkF,SAAS,4DAA4D3I,aAAawI,gBAAgB","file":"cleantalk-users-checkspam.min.js","sourcesContent":["// Printf for JS\r\nString.prototype.printf = function(){\r\n var formatted = this;\r\n for( var arg in arguments ) {\r\n\t\tvar before_formatted = formatted.substring(0, formatted.indexOf(\"%s\", 0));\r\n\t\tvar after_formatted = formatted.substring(formatted.indexOf(\"%s\", 0)+2, formatted.length);\r\n\t\tformatted = before_formatted + arguments[arg] + after_formatted;\r\n }\r\n return formatted;\r\n};\r\n\r\n// Set deafult amount to check by request.\r\ndocument.cookie = \"ct_check_users__amount=\" + 100 + \"; path=/\";\r\n\r\n// Flags\r\nvar ct_working = false,\r\n\tct_new_check = true,\r\n\tct_cooling_down_flag = false,\r\n\tct_close_animate = true,\r\n\tct_accurate_check = false,\r\n\tct_pause = false,\r\n\tct_prev_accurate = ctUsersCheck.ct_prev_accurate,\r\n\tct_prev_from = ctUsersCheck.ct_prev_from,\t\r\n\tct_prev_till = ctUsersCheck.ct_prev_till;\r\n// Settings\r\nvar ct_cool_down_time = 90000,\r\n\tct_requests_counter = 0,\r\n\tct_max_requests = 60;\r\n// Variables\r\nvar ct_ajax_nonce = ctUsersCheck.ct_ajax_nonce,\r\n\tct_users_total = 0,\r\n\tct_users_checked = 0,\r\n\tct_users_spam = 0,\r\n\tct_users_bad = 0,\r\n\tct_unchecked = 'unset',\r\n\tct_date_from = 0,\r\n\tct_date_till = 0;\r\n\r\n/* Function: Reuturns cookie with prefix */\r\nfunction apbct_cookie__get(names, prefixes){\r\n\tvar cookie = {};\r\n\tnames = names || null;\r\n\tif(typeof names == 'string') names = names.split();\r\n\tprefixes = prefixes || ['apbct_', 'ct_'];\r\n\tif(prefixes == 'none') prefixes = null;\r\n\tif(typeof prefixes == 'string') prefixes = prefixes.split();\r\n\tdocument.cookie.split(';').forEach(function(item, i, arr){\r\n\t\tvar curr = item.trim().split('=');\r\n\t\t// Detect by full cookie name\r\n\t\tif(names){\r\n\t\t\tnames.forEach(function(name, i, all){\r\n\t\t\t\tif(curr[0] === name)\r\n\t\t\t\t\tcookie[curr[0]] = (curr[1]);\r\n\t\t\t});\r\n\t\t}\r\n\t\t// Detect by name prefix\r\n\t\tif(prefixes){\r\n\t\t\tprefixes.forEach(function(prefix, i, all){\r\n\t\t\t\tif(curr[0].indexOf(prefix) === 0)\r\n\t\t\t\t\tcookie[curr[0]] = (curr[1]);\r\n\t\t\t});\r\n\t\t}\r\n\t});\r\n\treturn cookie;\r\n}\r\n\r\nfunction apbct_get_cookie( name ){\r\n\tvar cookie = apbct_cookie__get( name, name );\r\n\tif(typeof cookie === 'object' && typeof cookie[name] != 'undefined'){\r\n\t\treturn cookie[name];\r\n\t}else\r\n\t\treturn null;\r\n}\r\n\r\nfunction animate_comment(to,id){\r\n\tif(ct_close_animate){\r\n\t\tif(to==0.3){\r\n\t\t\tjQuery('#comment-'+id).fadeTo(200,to,function(){\r\n\t\t\t\tanimate_comment(1,id)\r\n\t\t\t});\r\n\t\t}else{\r\n\t\t\tjQuery('#comment-'+id).fadeTo(200,to,function(){\r\n\t\t\t\tanimate_comment(0.3,id)\r\n\t\t\t});\r\n\t\t}\r\n\t}else{\r\n\t\tct_close_animate=true;\r\n\t}\r\n}\r\n\r\nfunction ct_clear_users(){\r\n\r\n\tif(jQuery('#ct_allow_date_range').is(':checked')) {\r\n\r\n\t\tct_show_users_info();\r\n\t\tct_send_users();\r\n\r\n\t} else {\r\n\r\n\t\tvar data = {\r\n\t\t\t'action': 'ajax_clear_users',\r\n\t\t\t'security': ct_ajax_nonce\r\n\t\t};\r\n\r\n\t\tjQuery.ajax({\r\n\t\t\ttype: \"POST\",\r\n\t\t\turl: ajaxurl,\r\n\t\t\tdata: data,\r\n\t\t\tsuccess: function(msg){\r\n\t\t\t\tct_show_users_info();\r\n\t\t\t\tct_send_users();\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t}\r\n\r\n}\r\n\r\n//Continues the check after cooldown time\r\n//Called by ct_send_users();\r\nfunction ct_cooling_down_toggle(){\r\n\tct_cooling_down_flag = false;\r\n\tct_send_users();\r\n\tct_show_users_info();\r\n}\r\n\r\nfunction ct_send_users(){\r\n\t\r\n\tif(ct_cooling_down_flag == true)\r\n\t\treturn;\r\n\t\r\n\tif(ct_requests_counter >= ct_max_requests){\r\n\t\tsetTimeout(ct_cooling_down_toggle, ct_cool_down_time);\r\n\t\tct_requests_counter = 0;\r\n\t\tct_cooling_down_flag = true;\r\n\t\treturn;\r\n\t}else{\r\n\t\tct_requests_counter++;\r\n\t}\r\n\r\n\tvar data = {\r\n\t\taction: 'ajax_check_users',\r\n\t\tsecurity: ct_ajax_nonce,\r\n\t\tnew_check: ct_new_check,\r\n\t\tunchecked: ct_unchecked,\r\n\t\tamount: apbct_get_cookie('ct_check_users__amount'),\r\n\t};\r\n\t\r\n\tif(ct_accurate_check)\r\n\t\tdata['accurate_check'] = true;\r\n\t\r\n\tif(ct_date_from && ct_date_till){\r\n\t\tdata['from'] = ct_date_from;\r\n\t\tdata['till'] = ct_date_till;\r\n\t}\r\n\t\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function(msg){\r\n\t\t\t\r\n\t\t\tmsg = jQuery.parseJSON(msg);\r\n\t\t\t\r\n\t\t\tif(parseInt(msg.error)){\r\n\t\t\t\tct_working=false;\r\n\t\t\t\tif(!confirm(msg.error_message+\". Do you want to proceed?\")){\r\n\t\t\t\t\tvar new_href = 'users.php?page=ct_check_users';\r\n\t\t\t\t\tif(ct_date_from != 0 && ct_date_till != 0)\r\n\t\t\t\t\t\tnew_href+='&from='+ct_date_from+'&till='+ct_date_till;\r\n\t\t\t\t\tlocation.href = new_href;\r\n\t\t\t\t}else\r\n\t\t\t\t\tct_send_users();\r\n\t\t\t}else{\r\n\t\t\t\tct_new_check = false;\r\n\t\t\t\tif(parseInt(msg.end) == 1 || ct_pause == true){\r\n\t\t\t\t\tif(parseInt(msg.end) == 1)\r\n\t\t\t\t\t\tdocument.cookie = 'ct_paused_users_check=0; path=/';\r\n\t\t\t\t\tct_working=false;\r\n\t\t\t\t\tjQuery('#ct_working_message').hide();\r\n\t\t\t\t\tvar new_href = 'users.php?page=ct_check_users&ct_worked=1';\r\n\t\t\t\t\tif(ct_date_from != 0 && ct_date_till != 0)\r\n\t\t\t\t\t\tnew_href+='&from='+ct_date_from+'&till='+ct_date_till;\r\n\t\t\t\t\tlocation.href = new_href;\r\n\t\t\t\t}else if(parseInt(msg.end) == 0){\r\n\t\t\t\t\tct_users_checked += msg.checked;\r\n\t\t\t\t\tct_users_spam += msg.spam;\r\n\t\t\t\t\tct_users_bad += msg.bad;\r\n\t\t\t\t\tct_unchecked = ct_users_total - ct_users_checked - ct_users_bad;\r\n\t\t\t\t\tvar status_string = String(ctUsersCheck.ct_status_string);\r\n\t\t\t\t\tvar status_string = status_string.printf(ct_users_total, ct_users_checked, ct_users_spam, ct_users_bad);\r\n\t\t\t\t\tif(parseInt(ct_users_spam) > 0)\r\n\t\t\t\t\t\tstatus_string += ctUsersCheck.ct_status_string_warning;\r\n\t\t\t\t\tjQuery('#ct_checking_status').html(status_string);\r\n\t\t\t\t\tjQuery('#ct_error_message').hide();\r\n\t\t\t\t\tct_send_users();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t},\r\n error: function(jqXHR, textStatus, errorThrown) {\r\n\t\t\tif(check_amount > 20){\r\n\t\t\t\tcheck_amount -= 20;\r\n\t\t\t\tdocument.cookie = \"ct_check_users__amount=\" + check_amount + \"; path=/\";\r\n\t\t\t}\r\n\t\t\tjQuery('#ct_error_message').show();\r\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\r\n\t\t\tjQuery('#cleantalk_js_func').html('Check users');\r\n\t\t\tsetTimeout(ct_send_users(), 3000);\r\n },\r\n timeout: 25000\r\n\t});\r\n}\r\nfunction ct_show_users_info(){\r\n\t\r\n\tif(ct_working){\r\n\t\t\r\n\t\tif(ct_cooling_down_flag == true){\r\n\t\t\tjQuery('#ct_cooling_notice').html('Waiting for API to cool down. (About a minute)');\r\n\t\t\tjQuery('#ct_cooling_notice').show();\r\n\t\t\treturn;\t\t\t\r\n\t\t}else{\r\n\t\t\tjQuery('#ct_cooling_notice').hide();\r\n\t\t}\r\n\t\t\r\n\t\tsetTimeout(ct_show_users_info, 3000);\r\n\t\t\r\n\t\tif(!ct_users_total){\r\n\t\t\t\r\n\t\t\tvar data = {\r\n\t\t\t\t'action': 'ajax_info_users',\r\n\t\t\t\t'security': ct_ajax_nonce\r\n\t\t\t};\r\n\t\t\t\r\n\t\t\tif(ct_date_from && ct_date_till){\r\n\t\t\t\tdata['from'] = ct_date_from;\r\n\t\t\t\tdata['till'] = ct_date_till;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tjQuery.ajax({\r\n\t\t\t\ttype: \"POST\",\r\n\t\t\t\turl: ajaxurl,\r\n\t\t\t\tdata: data,\r\n\t\t\t\tsuccess: function(msg){\r\n\t\t\t\t\tmsg = jQuery.parseJSON(msg);\r\n\t\t\t\t\tjQuery('#ct_checking_status').html(msg.message);\r\n\t\t\t\t\tct_users_total = msg.total;\r\n\t\t\t\t\tct_users_spam = msg.spam;\r\n\t\t\t\t\tct_users_checked = msg.checked;\r\n\t\t\t\t\tct_users_bad = msg.bad;\r\n\t\t\t\t},\r\n\t\t\t\terror: function (jqXHR, textStatus, errorThrown){\r\n\t\t\t\t\tjQuery('#ct_error_message').show();\r\n\t\t\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\r\n\t\t\t\t\tjQuery('#cleantalk_js_func').html('Show users');\r\n\t\t\t\t\tsetTimeout(ct_show_users_info(), 3000);\r\n\t\t\t\t},\r\n\t\t\t\ttimeout: 15000\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n}\r\nfunction ct_insert_users(delete_accounts){\r\n\r\n delete_accounts = delete_accounts || null;\r\n\r\n\tvar data = {\r\n\t\t'action': 'ajax_insert_users',\r\n\t\t'security': ct_ajax_nonce\r\n\t};\r\n\t\r\n\tif(delete_accounts)\r\n\t\tdata['delete'] = true;\r\n\t\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function(msg){\r\n\t\t\tif(delete_accounts)\r\n\t\t\t\talert(ctUsersCheck.ct_deleted + ' ' + msg + ' ' + ctUsersCheck.ct_iusers);\r\n\t\t\telse\r\n\t\t\t\talert(ctUsersCheck.ct_inserted + ' ' + msg + ' ' + ctUsersCheck.ct_iusers);\r\n\t\t}\r\n\t});\r\n}\r\nfunction ct_delete_all_users(){\r\n\t\r\n\tvar data = {\r\n\t\t'action': 'ajax_delete_all_users',\r\n\t\t'security': ct_ajax_nonce\r\n\t};\r\n\t\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function(msg){\r\n\t\t\tif(msg>0){\r\n\t\t\t\tjQuery('#cleantalk_users_left').html(msg);\r\n\t\t\t\tct_delete_all_users();\r\n\t\t\t}else{\r\n\t\t\t\tlocation.href='users.php?page=ct_check_users&ct_worked=1';\r\n\t\t\t}\r\n\t\t},\r\n error: function(jqXHR, textStatus, errorThrown) {\r\n\t\t\tjQuery('#ct_error_message').show();\r\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\r\n\t\t\tjQuery('#cleantalk_js_func').html('All users deleteion');\r\n\t\t\tsetTimeout(ct_delete_all_users(), 3000);\r\n },\r\n timeout: 25000\r\n\t});\r\n}\r\nfunction ct_delete_checked_users(){\r\n\t\r\n\tids=Array();\r\n\tvar cnt=0;\r\n\tjQuery('input[id^=cb-select-][id!=cb-select-all-1]').each(function(){\r\n\t\tif(jQuery(this).prop('checked')){\r\n\t\t\tids[cnt]=jQuery(this).attr('id').substring(10);\r\n\t\t\tcnt++;\r\n\t\t}\r\n\t});\r\n\tvar data = {\r\n\t\t'action': 'ajax_delete_checked_users',\r\n\t\t'security': ct_ajax_nonce,\r\n\t\t'ids':ids\r\n\t};\r\n\t\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function(msg){\r\n\t\t\tlocation.href='users.php?page=ct_check_users&ct_worked=1';\r\n\t\t},\r\n\t\terror: function(jqXHR, textStatus, errorThrown) {\r\n\t\t\tjQuery('#ct_error_message').show();\r\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\r\n\t\t\tjQuery('#cleantalk_js_func').html('All users deleteion');\r\n\t\t\tsetTimeout(ct_delete_checked_users(), 3000);\r\n\t\t},\r\n\t\ttimeout: 15000\r\n\t});\r\n}\r\n\r\n// Function to toggle dependences\r\nfunction ct_toggle_depended(obj, secondary){\r\n\r\n secondary = secondary || null;\r\n\r\n\tvar depended = jQuery(obj.data('depended')),\r\n\t\tstate = obj.data('state');\r\n\t\t\r\n\tif(!state && !secondary){\r\n\t\tobj.data('state', true);\r\n\t\tdepended.removeProp('disabled');\r\n\t}else{\r\n\t\tobj.data('state', false);\r\n\t\tdepended.prop('disabled', true);\r\n\t\tdepended.removeProp('checked');\r\n\t\tif(depended.data('depended'))\r\n\t\t\tct_toggle_depended(depended, true);\r\n\t}\r\n}\r\n\r\njQuery(document).ready(function(){\r\n\t\r\n\t// Setting dependences\r\n\t// jQuery('#ct_accurate_check') .data({'depended': '#ct_allow_date_range', 'state': false});\r\n\tjQuery('#ct_allow_date_range').data({'depended': '.ct_date', 'state': false});\r\n\t\r\n\t// Prev check parameters\r\n\tif(ct_prev_accurate){\r\n\t\tjQuery(\"#ct_accurate_check\").prop('checked', true);\r\n\t}\r\n\tif(ct_prev_from){\r\n\t\tjQuery(\"#ct_allow_date_range\").prop('checked', true).data('state', true);\r\n\t\tjQuery(\"#ct_date_range_from\").removeProp('disabled').val(ct_prev_from);\r\n\t\tjQuery(\"#ct_date_range_till\").removeProp('disabled').val(ct_prev_till);\r\n\t}\r\n\t\r\n\t// Toggle dependences\r\n\tjQuery(\"#ct_allow_date_range, #ct_accurate_check\").on('change', function(){\r\n\t\tct_toggle_depended(jQuery(this));\r\n\t});\r\n\t\t\r\n\tvar dates = jQuery('#ct_date_range_from, #ct_date_range_till').datepicker(\r\n\t\t{\r\n\t\t\tdateFormat: 'yy-mm-dd',\r\n\t\t\tmaxDate:\"+0D\",\r\n\t\t\tchangeMonth:true,\r\n\t\t\tchangeYear:true,\r\n\t\t\tshowAnim: 'slideDown',\r\n\t\t\tonSelect: function(selectedDate){\r\n\t\t\tvar option = this.id == \"ct_date_range_from\" ? \"minDate\" : \"maxDate\",\r\n\t\t\t\tinstance = jQuery( this ).data( \"datepicker\" ),\r\n\t\t\t\tdate = jQuery.datepicker.parseDate(\r\n\t\t\t\t\tinstance.settings.dateFormat || jQuery.datepicker._defaults.dateFormat,\r\n\t\t\t\t\tselectedDate, instance.settings);\r\n\t\t\t\tdates.not(this).datepicker(\"option\", option, date);\r\n\t\t\t}\r\n\t\t}\r\n\t);\r\n\t\t\r\n\tfunction ct_start_check(continue_check){\r\n\r\n\t continue_check = continue_check || null;\r\n\t\t\r\n\t\tif(jQuery('#ct_allow_date_range').is(':checked')){\r\n\t\t\t\r\n\t\t\tct_date_from = jQuery('#ct_date_range_from').val();\r\n\t\t\tct_date_till = jQuery('#ct_date_range_till').val();\r\n\t\t\t\t\t\t\r\n\t\t\tif(!(ct_date_from !== '' && ct_date_till !== '')){\r\n\t\t\t\talert('Please, specify a date range.');\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tif(jQuery('#ct_accurate_check').is(':checked')){\r\n\t\t\tct_accurate_check = true;\r\n\t\t}\r\n\t\t\r\n\t\tjQuery('.ct_to_hide').hide();\r\n\t\tjQuery('#ct_working_message').show();\r\n\t\tjQuery('#ct_preloader').show();\r\n\t\tjQuery('#ct_pause').show();\r\n\t\t\r\n\t\tct_working=true;\r\n\t\t\r\n\t\tif(continue_check){\r\n\t\t\tct_show_users_info();\r\n\t\t\tct_send_users();\r\n\t\t}else\r\n\t\t\tct_clear_users();\r\n\t\t\r\n\t}\r\n\t\r\n\t// Check users\r\n\tjQuery(\"#ct_check_spam_button\").click(function(){\r\n\t\tdocument.cookie = 'ct_paused_users_check=0; path=/';\r\n\t\tct_start_check(false);\r\n\t});\r\n\tjQuery(\"#ct_proceed_check_button\").click(function(){\r\n\t\tct_start_check(true);\r\n\t});\r\n\t\r\n\t// Pause the check\r\n\tjQuery('#ct_pause').on('click', function(){\r\n\t\tct_pause = true;\r\n\t\tvar ct_check = {\r\n\t\t\t'accurate': ct_accurate_check,\r\n\t\t\t'from' : ct_date_from,\r\n\t\t\t'till' : ct_date_till\r\n\t\t};\r\n\t\tdocument.cookie = 'ct_paused_users_check=' + JSON.stringify(ct_check) + '; path=/';\r\n\t});\r\n\t\r\n\tjQuery(\"#ct_insert_users\").click(function(){\r\n\t\tct_insert_users();\r\n\t});\r\n\t\r\n\tjQuery(\"#ct_delete_users\").click(function(){\r\n\t\tct_insert_users(true);\r\n\t});\r\n\t\r\n\t// Delete all spam users\r\n\tjQuery(\"#ct_delete_all_users\").click(function(){\r\n\t\t\r\n\t\tif (!confirm(ctUsersCheck.ct_confirm_deletion_all))\r\n\t\t\treturn false;\r\n\t\t\r\n\t\tjQuery('.ct_to_hide').hide();\r\n\t\tjQuery('#ct_checking_status').hide();\r\n\t\tjQuery('#ct_search_info').hide();\r\n\t\tjQuery('#ct_preloader').show();\r\n\t\tjQuery('#ct_deleting_message').show();\r\n\t\tjQuery('#ct_stop_deletion').show();\r\n\t\tjQuery(\"html, body\").animate({ scrollTop: 0 }, \"slow\");\r\n\t\tct_delete_all_users();\r\n\t});\r\n\tjQuery(\"#ct_delete_checked_users\").click(function(){\r\n\t\tif (!confirm(ctUsersCheck.ct_confirm_deletion_checked))\r\n\t\t\treturn false;\r\n\t\tct_delete_checked_users();\r\n\t});\r\n\t\r\n\tjQuery(\"#ct_stop_deletion\").click(function(){\r\n\t\tlocation.href='users.php?page=ct_check_users';\r\n\t});\r\n\t\r\n\tjQuery(\".cleantalk_delete_user_button\").click(function(){\r\n\t\tid = jQuery(this).attr(\"data-id\");\r\n\t\tids=Array();\r\n\t\tids[0]=id;\r\n\t\tvar data = {\r\n\t\t\t'action': 'ajax_delete_checked_users',\r\n\t\t\t'security': ct_ajax_nonce,\r\n\t\t\t'ids':ids\r\n\t\t};\r\n\t\tjQuery.ajax({\r\n\t\t\ttype: \"POST\",\r\n\t\t\turl: ajaxurl,\r\n\t\t\tdata: data,\r\n\t\t\tsuccess: function(msg){\r\n\t\t\t\tct_close_animate=false;\r\n\t\t\t\tjQuery(\"#comment-\"+id).hide();\r\n\t\t\t\tjQuery(\"#comment-\"+id).remove();\r\n\t\t\t\tct_close_animate=true;\r\n\t\t\t},\r\n\t\t\ttimeout: 15000\r\n\t\t});\r\n\t});\r\n\t\r\n\tjQuery(\".cleantalk_delete_user_button\").click(function(){\r\n\t\tid = jQuery(this).attr(\"data-id\");\r\n\t\tanimate_comment(0.3, id);\r\n\t});\r\n\t\t\r\n\t//Show/hide action on mouse over/out\r\n\tjQuery(\".cleantalk_user\").mouseover(function(){\r\n\t\tid = jQuery(this).attr(\"data-id\");\r\n\t\tjQuery(\"#cleantalk_delete_user_\"+id).show();\r\n\t});\r\n\tjQuery(\".cleantalk_user\").mouseout(function(){\r\n\t\tid = jQuery(this).attr(\"data-id\");\r\n\t\tjQuery(\"#cleantalk_delete_user_\"+id).hide();\r\n\t});\r\n\t\t\r\n\t//Approve button\r\n\tjQuery(\".cleantalk_delete_from_list_button\").click(function(){\r\n\t\tct_id = jQuery(this).attr(\"data-id\");\r\n\t\t\r\n\t\t// Approving\r\n\t\tvar data = {\r\n\t\t\t'action': 'ajax_ct_approve_user',\r\n\t\t\t'security': ct_ajax_nonce,\r\n\t\t\t'id': ct_id\r\n\t\t};\r\n\t\tjQuery.ajax({\r\n\t\t\ttype: \"POST\",\r\n\t\t\turl: ajaxurl,\r\n\t\t\tdata: data,\r\n\t\t\tsuccess: function(msg){\r\n\t\t\t\tjQuery(\"#comment-\"+ct_id).fadeOut('slow', function(){\r\n\t\t\t\t\tjQuery(\"#comment-\"+ct_id).remove();\r\n\t\t\t\t});\r\n\t\t\t},\r\n\t\t});\r\n\t\t\r\n\t\t// Positive feedback\r\n\t\tvar data = {\r\n\t\t\t'action': 'ct_feedback_user',\r\n\t\t\t'security': ct_ajax_nonce,\r\n\t\t\t'user_id': ct_id,\r\n\t\t\t'status': 'approve'\r\n\t\t};\r\n\t\tjQuery.ajax({\r\n\t\t\ttype: \"POST\",\r\n\t\t\turl: ajaxurl,\r\n\t\t\tdata: data,\r\n\t\t\tsuccess: function(msg){\r\n\t\t\t\tif(msg == 1){\r\n\t\t\t\t\t// Success\r\n\t\t\t\t}\r\n\t\t\t\tif(msg == 0){\r\n\t\t\t\t\t// Error occurred\r\n\t\t\t\t}\r\n\t\t\t\tif(msg == 'no_hash'){\r\n\t\t\t\t\t// No hash\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\terror: function(jqXHR, textStatus, errorThrown) {\r\n\t\t\t\t\r\n\t\t\t},\r\n\t\t\ttimeout: 5000\r\n\t\t});\r\n\t\t\r\n\t});\r\n\t\r\n\t// Request to Download CSV file.\r\n\tjQuery(\"#ct_get_csv_file\").click(function(){\r\n\t\tvar data = {\r\n\t\t\t'action': 'ajax_ct_get_csv_file',\r\n\t\t\t'security': ct_ajax_nonce,\r\n\t\t\t'filename': ctUsersCheck.ct_csv_filename\r\n\t\t};\r\n\t\tjQuery.ajax({\r\n\t\t\ttype: \"POST\",\r\n\t\t\turl: ajaxurl,\r\n\t\t\tdata: data,\r\n\t\t\tsuccess: function(msg){\r\n\t\t\t\tif(parseInt(msg)==0)\r\n\t\t\t\t\talert(ctUsersCheck.ct_bad_csv);\r\n\t\t\t\telse\r\n\t\t\t\t\tjQuery(\"#ct_csv_wrapper\").html(\"<iframe src='\"+location.protocol+\"//\"+location.hostname+\"/wp-content/plugins/cleantalk-spam-protect/check-results/\"+ctUsersCheck.ct_csv_filename+\".csv'></iframe>\");\r\n\t\t\t},\r\n\t\t});\r\n\t});\r\n});"]}
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: safronik
3
  Tags: spam, antispam, protection, comments, firewall
4
  Requires at least: 3.0
5
  Tested up to: 5.3
6
- Stable tag: 5.127.3
7
  License: GPLv2
8
 
9
  Spam protection, antispam, all-in-one, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
@@ -568,6 +568,11 @@ If your website has forms that send data to external sources, you can enable opt
568
  10. Website's options.
569
 
570
  == Changelog ==
 
 
 
 
 
571
  = 5.127.3 October 8 2019 =
572
  * Fix: Errors during registration.
573
 
3
  Tags: spam, antispam, protection, comments, firewall
4
  Requires at least: 3.0
5
  Tested up to: 5.3
6
+ Stable tag: 5.127.4
7
  License: GPLv2
8
 
9
  Spam protection, antispam, all-in-one, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
568
  10. Website's options.
569
 
570
  == Changelog ==
571
+ = 5.127.4 October 13 2019 =
572
+ * Mod: Automatically decrease amount of checked users by one request if an error occurs.
573
+ * Fix: Security issue.
574
+ * Fix: Static JS key.
575
+
576
  = 5.127.3 October 8 2019 =
577
  * Fix: Errors during registration.
578