Version Description
2015-08-11 = * New feature: anti-spam checking for registered users * Fixed issue with AJAX JavaScript anti-spam test. * Fixed issue with SEO Yoast xml sitemaps and JavaScript anti-spam test.
Download this release
Release Info
Developer | shagimuratov |
Plugin | Spam protection, AntiSpam, FireWall by CleanTalk |
Version | 5.19 |
Comparing to | |
See all releases |
Code changes from version 5.18 to 5.19
- cleantalk-admin.php +41 -2
- cleantalk-comments-checkspam.js +6 -0
- cleantalk-comments.php +6 -5
- cleantalk-common.php +1 -1
- cleantalk-public.php +4 -3
- cleantalk-users-checkspam.js +185 -0
- cleantalk-users-editscreen.js +17 -0
- cleantalk-users.php +466 -0
- cleantalk.php +6 -3
- cleantalk_nocache.js +3 -3
- readme.txt +22 -12
cleantalk-admin.php
CHANGED
@@ -71,7 +71,7 @@ function ct_admin_add_page() {
|
|
71 |
* Admin action 'admin_init' - Add the admin settings and such
|
72 |
*/
|
73 |
function ct_admin_init() {
|
74 |
-
global $ct_server_timeout, $show_ct_notice_autokey, $ct_notice_autokey_label, $ct_notice_autokey_value, $show_ct_notice_renew, $ct_notice_renew_label, $show_ct_notice_trial, $ct_notice_trial_label, $show_ct_notice_online, $ct_notice_online_label, $renew_notice_showtime, $trial_notice_showtime, $ct_plugin_name, $ct_options, $ct_data, $trial_notice_check_timeout, $account_notice_check_timeout, $ct_user_token_label, $cleantalk_plugin_version;
|
75 |
|
76 |
//$ct_options = ct_get_options();
|
77 |
//$ct_data = ct_get_data();
|
@@ -227,11 +227,50 @@ function ct_admin_init() {
|
|
227 |
|
228 |
ct_init_session();
|
229 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
230 |
register_setting('cleantalk_settings', 'cleantalk_settings', 'ct_settings_validate');
|
231 |
add_settings_section('cleantalk_settings_main', __($ct_plugin_name, 'cleantalk'), 'ct_section_settings_main', 'cleantalk');
|
232 |
add_settings_section('cleantalk_settings_state', "<hr>".__('Protection is active for:', 'cleantalk'), 'ct_section_settings_state', 'cleantalk');
|
233 |
//add_settings_section('cleantalk_settings_autodel', "<hr>", 'ct_section_settings_autodel', 'cleantalk');
|
234 |
-
add_settings_section('cleantalk_settings_anti_spam', "<hr>".__('Advanced settings', 'cleantalk'), 'ct_section_settings_anti_spam', 'cleantalk');
|
235 |
add_settings_field('cleantalk_apikey', __('Access key', 'cleantalk'), 'ct_input_apikey', 'cleantalk', 'cleantalk_settings_main');
|
236 |
add_settings_field('cleantalk_remove_old_spam', __('Automatically delete spam comments', 'cleantalk'), 'ct_input_remove_old_spam', 'cleantalk', 'cleantalk_settings_anti_spam');
|
237 |
|
71 |
* Admin action 'admin_init' - Add the admin settings and such
|
72 |
*/
|
73 |
function ct_admin_init() {
|
74 |
+
global $ct_server_timeout, $show_ct_notice_autokey, $ct_notice_autokey_label, $ct_notice_autokey_value, $show_ct_notice_renew, $ct_notice_renew_label, $show_ct_notice_trial, $ct_notice_trial_label, $show_ct_notice_online, $ct_notice_online_label, $renew_notice_showtime, $trial_notice_showtime, $ct_plugin_name, $ct_options, $ct_data, $trial_notice_check_timeout, $account_notice_check_timeout, $ct_user_token_label, $cleantalk_plugin_version, $notice_check_timeout;
|
75 |
|
76 |
//$ct_options = ct_get_options();
|
77 |
//$ct_data = ct_get_data();
|
227 |
|
228 |
ct_init_session();
|
229 |
|
230 |
+
if(isset($ct_data['testing_failed'])&&$ct_data['testing_failed']==1)
|
231 |
+
{
|
232 |
+
$buttons_html='
|
233 |
+
<style type="text/css">
|
234 |
+
#ct_button_check_comments, #ct_button_check_users {background: #999999;}
|
235 |
+
|
236 |
+
';
|
237 |
+
}
|
238 |
+
else
|
239 |
+
{
|
240 |
+
$buttons_html='
|
241 |
+
<style type="text/css">
|
242 |
+
#ct_button_check_comments, #ct_button_check_users {background: #69dd69;}
|
243 |
+
|
244 |
+
';
|
245 |
+
}
|
246 |
+
|
247 |
+
$buttons_html.='
|
248 |
+
#ct_button_check_comments, #ct_button_check_users {padding: 10px; color: #fff; border:0 none;
|
249 |
+
cursor:pointer;
|
250 |
+
-webkit-border-radius: 5px;
|
251 |
+
border-radius: 5px;
|
252 |
+
font-size: 12pt;
|
253 |
+
text-decoration:none;
|
254 |
+
margin-bottom:5px;
|
255 |
+
display:inline-block;
|
256 |
+
}
|
257 |
+
</style>';
|
258 |
+
if(isset($ct_data['testing_failed'])&&$ct_data['testing_failed']==1)
|
259 |
+
{
|
260 |
+
$buttons_html.='<a href="#" id="ct_button_check_comments" onclick="alert('."'".__('Feature is disabled, because testing of access key is failed!', 'cleantalk')."'".')">'.__('Check comments', 'cleantalk').'</a>
|
261 |
+
<a href="#" id="ct_button_check_users" onclick="alert('."'".__('Feature is disabled, because testing of access key is failed!', 'cleantalk')."'".')">'.__('Check users', 'cleantalk').'</a><div class="clear"></div>';
|
262 |
+
}
|
263 |
+
else
|
264 |
+
{
|
265 |
+
$buttons_html.='<a href="edit-comments.php?page=ct_check_spam&do_check=1" id="ct_button_check_comments">'.__('Check comments', 'cleantalk').'</a>
|
266 |
+
<a href="users.php?page=ct_check_users&do_check=1" id="ct_button_check_users">'.__('Check users', 'cleantalk').'</a><div class="clear"></div>';
|
267 |
+
}
|
268 |
+
|
269 |
register_setting('cleantalk_settings', 'cleantalk_settings', 'ct_settings_validate');
|
270 |
add_settings_section('cleantalk_settings_main', __($ct_plugin_name, 'cleantalk'), 'ct_section_settings_main', 'cleantalk');
|
271 |
add_settings_section('cleantalk_settings_state', "<hr>".__('Protection is active for:', 'cleantalk'), 'ct_section_settings_state', 'cleantalk');
|
272 |
//add_settings_section('cleantalk_settings_autodel', "<hr>", 'ct_section_settings_autodel', 'cleantalk');
|
273 |
+
add_settings_section('cleantalk_settings_anti_spam', "<hr>Check existing comments and users <br /><br />$buttons_html<hr>".__('Advanced settings', 'cleantalk'), 'ct_section_settings_anti_spam', 'cleantalk');
|
274 |
add_settings_field('cleantalk_apikey', __('Access key', 'cleantalk'), 'ct_input_apikey', 'cleantalk', 'cleantalk_settings_main');
|
275 |
add_settings_field('cleantalk_remove_old_spam', __('Automatically delete spam comments', 'cleantalk'), 'ct_input_remove_old_spam', 'cleantalk', 'cleantalk_settings_anti_spam');
|
276 |
|
cleantalk-comments-checkspam.js
CHANGED
@@ -150,6 +150,8 @@ function ct_delete_checked()
|
|
150 |
}
|
151 |
jQuery("#ct_check_spam_button").click(function(){
|
152 |
jQuery('#ct_working_message').show();
|
|
|
|
|
153 |
working=true;
|
154 |
ct_clear_comments();
|
155 |
});
|
@@ -175,4 +177,8 @@ jQuery(document).ready(function(){
|
|
175 |
working=true;
|
176 |
ct_show_info();
|
177 |
working=false;
|
|
|
|
|
|
|
|
|
178 |
});
|
150 |
}
|
151 |
jQuery("#ct_check_spam_button").click(function(){
|
152 |
jQuery('#ct_working_message').show();
|
153 |
+
jQuery('#ct_check_spam_button').hide();
|
154 |
+
jQuery('#ct_info_message').hide();
|
155 |
working=true;
|
156 |
ct_clear_comments();
|
157 |
});
|
177 |
working=true;
|
178 |
ct_show_info();
|
179 |
working=false;
|
180 |
+
if(location.href.match(/do_check/))
|
181 |
+
{
|
182 |
+
jQuery("#ct_check_spam_button").click();
|
183 |
+
}
|
184 |
});
|
cleantalk-comments.php
CHANGED
@@ -36,8 +36,8 @@ function ct_show_checkspam_page()
|
|
36 |
//if($cnt_unchecked>0)
|
37 |
{
|
38 |
?>
|
39 |
-
<button class="button" id="ct_check_spam_button"><?php _e("Find spam comments", 'cleantalk'); ?></button><br />
|
40 |
-
<div><?php _e("Anti-spam by CleanTalk will check all not spam comments against blacklists database and show you senders that have spam activity on other websites. Just click 'Find spam comments' to start.", 'cleantalk'); ?></div>
|
41 |
<?php
|
42 |
}
|
43 |
?>
|
@@ -45,17 +45,17 @@ function ct_show_checkspam_page()
|
|
45 |
//print '<button class="button" id="ct_insert_comments">Insert comments</button><br />';
|
46 |
?>
|
47 |
|
48 |
-
<div id="ct_working_message" style="display:none">
|
49 |
<?php _e("Please wait for a while. 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'); ?>
|
50 |
</div>
|
51 |
-
<div id="ct_deleting_message" style="display:none">
|
52 |
<?php _e("Please wait for a while. CleanTalk is deleting spam comments. Comments left: ", 'cleantalk'); ?> <span id="cleantalk_comments_left"></span>
|
53 |
</div>
|
54 |
<div id="ct_done_message" <?php if($cnt_unchecked>0) print 'style="display:none"'; ?>>
|
55 |
<?php //_e("Done. All comments tested via blacklists database, please see result bellow.", 'cleantalk');
|
56 |
?>
|
57 |
</div>
|
58 |
-
<h3 id="ct_checking_status"></h3>
|
59 |
<?php
|
60 |
$args_spam = array(
|
61 |
'meta_query' => array(
|
@@ -198,6 +198,7 @@ function ct_show_checkspam_page()
|
|
198 |
}
|
199 |
?>
|
200 |
</div>
|
|
|
201 |
<?php
|
202 |
}
|
203 |
|
36 |
//if($cnt_unchecked>0)
|
37 |
{
|
38 |
?>
|
39 |
+
<button class="button" id="ct_check_spam_button"><?php _e("Find spam comments", 'cleantalk'); ?></button><br /><br />
|
40 |
+
<div id="ct_info_message"><?php _e("Anti-spam by CleanTalk will check all not spam comments against blacklists database and show you senders that have spam activity on other websites. Just click 'Find spam comments' to start.", 'cleantalk'); ?></div>
|
41 |
<?php
|
42 |
}
|
43 |
?>
|
45 |
//print '<button class="button" id="ct_insert_comments">Insert comments</button><br />';
|
46 |
?>
|
47 |
|
48 |
+
<div id="ct_working_message" style="margin:auto;padding:3px;width:70%;border:2px dotted gray;display:none;background:#ffff99;">
|
49 |
<?php _e("Please wait for a while. 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'); ?>
|
50 |
</div>
|
51 |
+
<div id="ct_deleting_message" style="display:none;">
|
52 |
<?php _e("Please wait for a while. CleanTalk is deleting spam comments. Comments left: ", 'cleantalk'); ?> <span id="cleantalk_comments_left"></span>
|
53 |
</div>
|
54 |
<div id="ct_done_message" <?php if($cnt_unchecked>0) print 'style="display:none"'; ?>>
|
55 |
<?php //_e("Done. All comments tested via blacklists database, please see result bellow.", 'cleantalk');
|
56 |
?>
|
57 |
</div>
|
58 |
+
<h3 id="ct_checking_status" style="text-align:center;width:90%;"></h3>
|
59 |
<?php
|
60 |
$args_spam = array(
|
61 |
'meta_query' => array(
|
198 |
}
|
199 |
?>
|
200 |
</div>
|
201 |
+
<br /><a href="options-general.php?page=cleantalk">«<?php print __('Back to CleanTalk settings', 'cleantalk'); ?></a>
|
202 |
<?php
|
203 |
}
|
204 |
|
cleantalk-common.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
$ct_agent_version = 'wordpress-
|
4 |
$ct_plugin_name = 'Anti-spam by CleanTalk';
|
5 |
$ct_checkjs_frm = 'ct_checkjs_frm';
|
6 |
$ct_checkjs_register_form = 'ct_checkjs_register_form';
|
1 |
<?php
|
2 |
|
3 |
+
$ct_agent_version = 'wordpress-519';
|
4 |
$ct_plugin_name = 'Anti-spam by CleanTalk';
|
5 |
$ct_checkjs_frm = 'ct_checkjs_frm';
|
6 |
$ct_checkjs_register_form = 'ct_checkjs_register_form';
|
cleantalk-public.php
CHANGED
@@ -42,6 +42,8 @@ function ct_init() {
|
|
42 |
if(isset($ct_options['general_postdata_test']))
|
43 |
{
|
44 |
$ct_general_postdata_test = @intval($ct_options['general_postdata_test']);
|
|
|
|
|
45 |
}
|
46 |
else
|
47 |
{
|
@@ -51,6 +53,7 @@ function ct_init() {
|
|
51 |
if (isset($ct_options['general_contact_forms_test']) && $ct_options['general_contact_forms_test'] == 1)
|
52 |
{
|
53 |
add_action('CMA_custom_post_type_nav','ct_contact_form_validate_postdata',1);
|
|
|
54 |
/*if(isset($_GET['ait-action'])&&$_GET['ait-action']=='register')
|
55 |
{
|
56 |
$tmp=$_POST['redirect_to'];
|
@@ -151,9 +154,7 @@ function ct_init() {
|
|
151 |
ct_s2member_registration_test();
|
152 |
}
|
153 |
|
154 |
-
|
155 |
-
add_action('template_redirect','ct_contact_form_validate',1);
|
156 |
-
add_action('template_redirect','ct_contact_form_validate_postdata',1);
|
157 |
|
158 |
//
|
159 |
// New user approve hack
|
42 |
if(isset($ct_options['general_postdata_test']))
|
43 |
{
|
44 |
$ct_general_postdata_test = @intval($ct_options['general_postdata_test']);
|
45 |
+
//hook for Anonymous Post
|
46 |
+
add_action('template_redirect','ct_contact_form_validate_postdata',1);
|
47 |
}
|
48 |
else
|
49 |
{
|
53 |
if (isset($ct_options['general_contact_forms_test']) && $ct_options['general_contact_forms_test'] == 1)
|
54 |
{
|
55 |
add_action('CMA_custom_post_type_nav','ct_contact_form_validate_postdata',1);
|
56 |
+
add_action('template_redirect','ct_contact_form_validate',1);
|
57 |
/*if(isset($_GET['ait-action'])&&$_GET['ait-action']=='register')
|
58 |
{
|
59 |
$tmp=$_POST['redirect_to'];
|
154 |
ct_s2member_registration_test();
|
155 |
}
|
156 |
|
157 |
+
|
|
|
|
|
158 |
|
159 |
//
|
160 |
// New user approve hack
|
cleantalk-users-checkspam.js
ADDED
@@ -0,0 +1,185 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
var working=false;
|
2 |
+
|
3 |
+
String.prototype.format = String.prototype.f = function ()
|
4 |
+
{
|
5 |
+
var args = arguments;
|
6 |
+
return this.replace(/\{\{|\}\}|\{(\d+)\}/g, function (m, n)
|
7 |
+
{
|
8 |
+
if (m == "{{") { return "{"; }
|
9 |
+
if (m == "}}") { return "}"; }
|
10 |
+
return args[n];
|
11 |
+
});
|
12 |
+
};
|
13 |
+
|
14 |
+
function ct_clear_users()
|
15 |
+
{
|
16 |
+
var data = {
|
17 |
+
'action': 'ajax_clear_users',
|
18 |
+
'security': ajax_nonce
|
19 |
+
};
|
20 |
+
|
21 |
+
jQuery.ajax({
|
22 |
+
type: "POST",
|
23 |
+
url: ajaxurl,
|
24 |
+
data: data,
|
25 |
+
success: function(msg){
|
26 |
+
ct_send_users();
|
27 |
+
}
|
28 |
+
});
|
29 |
+
}
|
30 |
+
|
31 |
+
function ct_send_users()
|
32 |
+
{
|
33 |
+
var data = {
|
34 |
+
'action': 'ajax_check_users',
|
35 |
+
'security': ajax_nonce
|
36 |
+
};
|
37 |
+
|
38 |
+
jQuery.ajax({
|
39 |
+
type: "POST",
|
40 |
+
url: ajaxurl,
|
41 |
+
data: data,
|
42 |
+
success: function(msg){
|
43 |
+
if(parseInt(msg)==1)
|
44 |
+
{
|
45 |
+
ct_send_users();
|
46 |
+
}
|
47 |
+
else if(parseInt(msg)==0)
|
48 |
+
{
|
49 |
+
working=false;
|
50 |
+
jQuery('#ct_working_message').hide();
|
51 |
+
//alert('finish!');
|
52 |
+
location.href='users.php?page=ct_check_users';
|
53 |
+
}
|
54 |
+
else
|
55 |
+
{
|
56 |
+
working=false;
|
57 |
+
alert(msg);
|
58 |
+
}
|
59 |
+
}
|
60 |
+
});
|
61 |
+
}
|
62 |
+
function ct_show_users_info()
|
63 |
+
{
|
64 |
+
if(working)
|
65 |
+
{
|
66 |
+
var data = {
|
67 |
+
'action': 'ajax_info_users',
|
68 |
+
'security': ajax_nonce
|
69 |
+
};
|
70 |
+
jQuery.ajax({
|
71 |
+
type: "POST",
|
72 |
+
url: ajaxurl,
|
73 |
+
data: data,
|
74 |
+
success: function(msg){
|
75 |
+
jQuery('#ct_checking_users_status').html(msg);
|
76 |
+
setTimeout(ct_show_users_info, 1000);
|
77 |
+
}
|
78 |
+
});
|
79 |
+
}
|
80 |
+
}
|
81 |
+
function ct_insert_users()
|
82 |
+
{
|
83 |
+
var data = {
|
84 |
+
'action': 'ajax_insert_users',
|
85 |
+
'security': ajax_nonce
|
86 |
+
};
|
87 |
+
|
88 |
+
jQuery.ajax({
|
89 |
+
type: "POST",
|
90 |
+
url: ajaxurl,
|
91 |
+
data: data,
|
92 |
+
success: function(msg){
|
93 |
+
if(msg=='ok')
|
94 |
+
{
|
95 |
+
alert('Added 500 users');
|
96 |
+
}
|
97 |
+
}
|
98 |
+
});
|
99 |
+
}
|
100 |
+
function ct_delete_all_users()
|
101 |
+
{
|
102 |
+
var data = {
|
103 |
+
'action': 'ajax_delete_all_users',
|
104 |
+
'security': ajax_nonce
|
105 |
+
};
|
106 |
+
|
107 |
+
jQuery.ajax({
|
108 |
+
type: "POST",
|
109 |
+
url: ajaxurl,
|
110 |
+
data: data,
|
111 |
+
success: function(msg){
|
112 |
+
if(msg>0)
|
113 |
+
{
|
114 |
+
jQuery('#cleantalk_users_left').html(msg);
|
115 |
+
ct_delete_all();
|
116 |
+
}
|
117 |
+
else
|
118 |
+
{
|
119 |
+
location.href='users.php?page=ct_check_users';
|
120 |
+
}
|
121 |
+
}
|
122 |
+
});
|
123 |
+
}
|
124 |
+
function ct_delete_checked_users()
|
125 |
+
{
|
126 |
+
ids=Array();
|
127 |
+
var cnt=0;
|
128 |
+
jQuery('input[id^=cb-select-][id!=cb-select-all-1]').each(function(){
|
129 |
+
if(jQuery(this).prop('checked'))
|
130 |
+
{
|
131 |
+
ids[cnt]=jQuery(this).attr('id').substring(10);
|
132 |
+
cnt++;
|
133 |
+
}
|
134 |
+
});
|
135 |
+
var data = {
|
136 |
+
'action': 'ajax_delete_checked_users',
|
137 |
+
'security': ajax_nonce,
|
138 |
+
'ids':ids
|
139 |
+
};
|
140 |
+
|
141 |
+
jQuery.ajax({
|
142 |
+
type: "POST",
|
143 |
+
url: ajaxurl,
|
144 |
+
data: data,
|
145 |
+
success: function(msg){
|
146 |
+
location.href='users.php?page=ct_check_users';
|
147 |
+
//alert(msg);
|
148 |
+
}
|
149 |
+
});
|
150 |
+
return false;
|
151 |
+
}
|
152 |
+
jQuery("#ct_check_users_button").click(function(){
|
153 |
+
jQuery('#ct_working_message').show();
|
154 |
+
jQuery('#ct_check_users_button').hide();
|
155 |
+
jQuery('#ct_info_message').hide();
|
156 |
+
working=true;
|
157 |
+
ct_clear_users();
|
158 |
+
});
|
159 |
+
jQuery("#ct_check_users_button").click(function(){
|
160 |
+
jQuery('#ct_checking_users_status').html('');
|
161 |
+
working=true;
|
162 |
+
ct_show_users_info();
|
163 |
+
});
|
164 |
+
jQuery("#ct_insert_users").click(function(){
|
165 |
+
ct_insert_users();
|
166 |
+
});
|
167 |
+
jQuery("#ct_delete_all_users").click(function(){
|
168 |
+
jQuery('#ct_check_users_table').hide();
|
169 |
+
jQuery('#ct_deleting_message').show();
|
170 |
+
jQuery("html, body").animate({ scrollTop: 0 }, "slow");
|
171 |
+
ct_delete_all_users();
|
172 |
+
});
|
173 |
+
jQuery("#ct_delete_checked_users").click(function(){
|
174 |
+
ct_delete_checked_users();
|
175 |
+
});
|
176 |
+
|
177 |
+
jQuery(document).ready(function(){
|
178 |
+
working=true;
|
179 |
+
ct_show_users_info();
|
180 |
+
working=false;
|
181 |
+
if(location.href.match(/do_check/))
|
182 |
+
{
|
183 |
+
jQuery("#ct_check_users_button").click();
|
184 |
+
}
|
185 |
+
});
|
cleantalk-users-editscreen.js
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery('#changeit').after(' <a href="users.php?page=ct_check_users" class="button" style="margin-top:1px;">'+spambutton_users_text+'</a>');
|
2 |
+
jQuery("#ct_check_users_button").click(function(){
|
3 |
+
var data = {
|
4 |
+
'action': 'ajax_check_users',
|
5 |
+
security: ajax_nonce
|
6 |
+
};
|
7 |
+
|
8 |
+
jQuery.ajax({
|
9 |
+
type: "POST",
|
10 |
+
url: ajaxurl,
|
11 |
+
data: data,
|
12 |
+
success: function(msg){
|
13 |
+
alert(msg);
|
14 |
+
}
|
15 |
+
});
|
16 |
+
|
17 |
+
});
|
cleantalk-users.php
ADDED
@@ -0,0 +1,466 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
add_action('admin_menu', 'ct_add_users_menu');
|
4 |
+
|
5 |
+
function ct_add_users_menu()
|
6 |
+
{
|
7 |
+
if(current_user_can('activate_plugins'))
|
8 |
+
{
|
9 |
+
add_users_page( __("Check for spam", 'cleantalk'), __("Check for spam", 'cleantalk'), 'read', 'ct_check_users', 'ct_show_users_page');
|
10 |
+
}
|
11 |
+
}
|
12 |
+
|
13 |
+
function ct_show_users_page()
|
14 |
+
{
|
15 |
+
?>
|
16 |
+
<div class="wrap">
|
17 |
+
<h2><?php _e("Anti-spam by CleanTalk", 'cleantalk'); ?></h2><br />
|
18 |
+
<?php
|
19 |
+
$args_unchecked = array(
|
20 |
+
'meta_query' => array(
|
21 |
+
'relation' => 'AND',
|
22 |
+
Array(
|
23 |
+
'key' => 'ct_checked',
|
24 |
+
'value' => '1',
|
25 |
+
'compare' => 'NOT EXISTS'
|
26 |
+
),
|
27 |
+
Array(
|
28 |
+
'key' => 'ct_hash',
|
29 |
+
'value' => '1',
|
30 |
+
'compare' => 'NOT EXISTS'
|
31 |
+
)
|
32 |
+
)
|
33 |
+
);
|
34 |
+
$cnt_unchecked=sizeof(get_users($args_unchecked));
|
35 |
+
//if($cnt_unchecked>0)
|
36 |
+
{
|
37 |
+
?>
|
38 |
+
<button class="button" id="ct_check_users_button"><?php _e("Find spam users", 'cleantalk'); ?></button><br /><br />
|
39 |
+
<div id="ct_info_message"><?php _e("Anti-spam by CleanTalk will check all users against blacklists database and show you senders that have spam activity on other websites. Just click 'Find spam users' to start.", 'cleantalk'); ?></div>
|
40 |
+
<?php
|
41 |
+
}
|
42 |
+
?>
|
43 |
+
<?php
|
44 |
+
//print '<button class="button" id="ct_insert_users">Insert users</button><br />';
|
45 |
+
?>
|
46 |
+
|
47 |
+
<div id="ct_working_message" style="margin:auto;padding:3px;width:70%;border:2px dotted gray;display:none;background:#ffff99;">
|
48 |
+
<?php _e("Please wait for a while. CleanTalk is checking all users via blacklist database at cleantalk.org. You will have option to delete found spam users after plugin finish.", 'cleantalk'); ?>
|
49 |
+
</div>
|
50 |
+
<div id="ct_deleting_message" style="display:none">
|
51 |
+
<?php _e("Please wait for a while. CleanTalk is deleting spam users. Users left: ", 'cleantalk'); ?> <span id="cleantalk_users_left"></span>
|
52 |
+
</div>
|
53 |
+
<div id="ct_done_message" <?php if($cnt_unchecked>0) print 'style="display:none"'; ?>>
|
54 |
+
<?php //_e("Done. All comments tested via blacklists database, please see result bellow.", 'cleantalk');
|
55 |
+
?>
|
56 |
+
</div>
|
57 |
+
<h3 id="ct_checking_users_status" style="text-align:center;width:90%;"></h3>
|
58 |
+
<?php
|
59 |
+
$args_spam = array(
|
60 |
+
'meta_query' => array(
|
61 |
+
Array(
|
62 |
+
'key' => 'ct_marked_as_spam',
|
63 |
+
'compare' => 'EXISTS'
|
64 |
+
)
|
65 |
+
)
|
66 |
+
);
|
67 |
+
$cnt_spam=sizeof(get_users($args_spam));
|
68 |
+
|
69 |
+
|
70 |
+
$page=1;
|
71 |
+
if(isset($_GET['spam_page']))
|
72 |
+
{
|
73 |
+
$page=intval($_GET['spam_page']);
|
74 |
+
}
|
75 |
+
$args_spam = array(
|
76 |
+
'meta_query' => array(
|
77 |
+
Array(
|
78 |
+
'key' => 'ct_marked_as_spam',
|
79 |
+
'value' => '1',
|
80 |
+
'compare' => 'NUMERIC'
|
81 |
+
)
|
82 |
+
),
|
83 |
+
'number'=>30,
|
84 |
+
'offset'=>($page-1)*30
|
85 |
+
);
|
86 |
+
|
87 |
+
$c_spam=get_users($args_spam);
|
88 |
+
if($cnt_spam>0)
|
89 |
+
{
|
90 |
+
?>
|
91 |
+
<table class="widefat fixed comments" id="ct_check_users_table">
|
92 |
+
<thead>
|
93 |
+
<th scope="col" id="cb" class="manage-column column-cb check-column">
|
94 |
+
<label class="screen-reader-text" for="cb-select-all-1">Select All</label>
|
95 |
+
<input id="cb-select-all-1" type="checkbox"/>
|
96 |
+
</th>
|
97 |
+
<th scope="col" id="author" class="manage-column column-slug"><?php print _e('Username');?></th>
|
98 |
+
<th scope="col" id="comment" class="manage-column column-comment"><?php print _x( 'Name', 'column name' );;?></th>
|
99 |
+
<th scope="col" id="response" class="manage-column column-comment"><?php print _x( 'E-mail', 'column name' );?></th>
|
100 |
+
<th scope="col" id="role" class="manage-column column-response sortable desc"><?php print _x( 'Role', 'column name' );?></th>
|
101 |
+
<th scope="col" id="posts" class="manage-column column-response sortable desc"><?php print _x( 'Posts', 'column name' );?></th>
|
102 |
+
</thead>
|
103 |
+
<tbody id="the-comment-list" data-wp-lists="list:comment">
|
104 |
+
<?php
|
105 |
+
for($i=0;$i<sizeof($c_spam);$i++)
|
106 |
+
{
|
107 |
+
?>
|
108 |
+
<tr id="comment-<?php print $c_spam[$i]->ID; ?>" class="comment even thread-even depth-1 approved">
|
109 |
+
<th scope="row" class="check-column">
|
110 |
+
<label class="screen-reader-text" for="cb-select-<?php print $c_spam[$i]->ID; ?>">Select user</label>
|
111 |
+
<input id="cb-select-<?php print $c_spam[$i]->ID; ?>" type="checkbox" name="del_comments[]" value="<?php print $c_spam[$i]->comment_ID; ?>"/>
|
112 |
+
</th>
|
113 |
+
<td class="author column-author" nowrap>
|
114 |
+
<strong>
|
115 |
+
<?php echo get_avatar( $c_spam[$i]->data->user_email , 32); ?>
|
116 |
+
<?php print $c_spam[$i]->data->user_login; ?>
|
117 |
+
</strong>
|
118 |
+
<br/>
|
119 |
+
<a href="mailto:<?php print $c_spam[$i]->data->user_email; ?>"><?php print $c_spam[$i]->data->user_email; ?></a> <a href="https://cleantalk.org/blacklists/<?php print $c_spam[$i]->data->user_email ; ?>" target="_blank"><img src="https://cleantalk.ru/images/icons/new_window.gif" border="0" style="float:none"/></a>
|
120 |
+
<br/>
|
121 |
+
<?php
|
122 |
+
$user_meta=get_user_meta($c_spam[$i]->ID, 'session_tokens', true);
|
123 |
+
if(is_array($user_meta))
|
124 |
+
{
|
125 |
+
$user_meta=array_values($user_meta);
|
126 |
+
}
|
127 |
+
$ip='';
|
128 |
+
if(@isset($user_meta[0]['ip']))
|
129 |
+
{
|
130 |
+
$ip=$user_meta[0]['ip'];
|
131 |
+
?>
|
132 |
+
<a href="user-edit.php?user_id=<?php print $c_spam[$i]->ID ; ?>"><?php print $ip ; ?></a>
|
133 |
+
<a href="https://cleantalk.org/blacklists/<?php print $ip ; ?>" target="_blank"><img src="https://cleantalk.ru/images/icons/new_window.gif" border="0" style="float:none"/></a>
|
134 |
+
<?php
|
135 |
+
}
|
136 |
+
?>
|
137 |
+
</td>
|
138 |
+
<td class="comment column-comment">
|
139 |
+
<div class="submitted-on">
|
140 |
+
<?php print $c_spam[$i]->data->display_name; ?>
|
141 |
+
</div>
|
142 |
+
</td>
|
143 |
+
<td class="comment column-comment">
|
144 |
+
<?php print $c_spam[$i]->data->user_email; ?>
|
145 |
+
</td>
|
146 |
+
<td class="comment column-comment">
|
147 |
+
<?php
|
148 |
+
$info=get_userdata( $c_spam[$i]->ID );
|
149 |
+
print implode(', ', $info->roles);
|
150 |
+
?>
|
151 |
+
</td>
|
152 |
+
<td class="comment column-comment">
|
153 |
+
<?php
|
154 |
+
print count_user_posts($c_spam[$i]->ID);
|
155 |
+
?>
|
156 |
+
</td>
|
157 |
+
</tr>
|
158 |
+
<?php
|
159 |
+
}
|
160 |
+
$args_spam = array(
|
161 |
+
'meta_query' => array(
|
162 |
+
Array(
|
163 |
+
'key' => 'ct_marked_as_spam',
|
164 |
+
'value' => '1',
|
165 |
+
'compare' => 'NUMERIC'
|
166 |
+
)
|
167 |
+
|
168 |
+
),
|
169 |
+
'count'=>true
|
170 |
+
);
|
171 |
+
$cnt_spam=get_comments($args_spam);
|
172 |
+
if($cnt_spam>30)
|
173 |
+
{
|
174 |
+
?>
|
175 |
+
<tr class="comment even thread-even depth-1 approved">
|
176 |
+
<td colspan="4">
|
177 |
+
<?php
|
178 |
+
|
179 |
+
$pages=ceil(intval($cnt_spam)/30);
|
180 |
+
for($i=1;$i<=$pages;$i++)
|
181 |
+
{
|
182 |
+
if($i==$page)
|
183 |
+
{
|
184 |
+
print "<a href='edit-comments.php?page=ct_check_spam&spam_page=$i'><b>$i</b></a> ";
|
185 |
+
}
|
186 |
+
else
|
187 |
+
{
|
188 |
+
print "<a href='edit-comments.php?page=ct_check_spam&spam_page=$i'>$i</a> ";
|
189 |
+
}
|
190 |
+
}
|
191 |
+
?>
|
192 |
+
</td>
|
193 |
+
</tr>
|
194 |
+
<?php
|
195 |
+
}
|
196 |
+
?>
|
197 |
+
</tbody>
|
198 |
+
</table>
|
199 |
+
<button class="button" id="ct_delete_all_users"><?php _e('Delete all content'); ?></button>
|
200 |
+
<button class="button" id="ct_delete_checked_users"><?php _e('Delete selected', 'cleantalk'); ?></button>
|
201 |
+
<?php
|
202 |
+
}
|
203 |
+
?>
|
204 |
+
</div>
|
205 |
+
<br /><a href="options-general.php?page=cleantalk">«<?php print __('Back to CleanTalk settings', 'cleantalk'); ?></a>
|
206 |
+
<?php
|
207 |
+
}
|
208 |
+
|
209 |
+
add_action('admin_print_footer_scripts','ct_add_users_button');
|
210 |
+
function ct_add_users_button()
|
211 |
+
{
|
212 |
+
$screen = get_current_screen();
|
213 |
+
$ajax_nonce = wp_create_nonce( "ct_secret_nonce" );
|
214 |
+
?>
|
215 |
+
<script>
|
216 |
+
var ajax_nonce='<?php echo $ajax_nonce; ?>';
|
217 |
+
var spambutton_users_text='<?php _e("Find spam users", 'cleantalk'); ?>';
|
218 |
+
</script>
|
219 |
+
<?php
|
220 |
+
if( $screen->id == 'users' ){
|
221 |
+
?>
|
222 |
+
<script src="<?php print plugins_url( 'cleantalk-users-editscreen.js', __FILE__ ); ?>"></script>
|
223 |
+
<?php
|
224 |
+
}
|
225 |
+
if($screen->id == 'users_page_ct_check_users')
|
226 |
+
{
|
227 |
+
?>
|
228 |
+
<script src="<?php print plugins_url( 'cleantalk-users-checkspam.js', __FILE__ ); ?>"></script>
|
229 |
+
<?php
|
230 |
+
}
|
231 |
+
}
|
232 |
+
|
233 |
+
|
234 |
+
add_action( 'wp_ajax_ajax_check_users', 'ct_ajax_check_users' );
|
235 |
+
|
236 |
+
function ct_ajax_check_users()
|
237 |
+
{
|
238 |
+
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
239 |
+
global $ct_options;
|
240 |
+
//$ct_options = ct_get_options();
|
241 |
+
|
242 |
+
$args_unchecked = array(
|
243 |
+
'meta_query' => array(
|
244 |
+
'relation' => 'AND',
|
245 |
+
Array(
|
246 |
+
'key' => 'ct_checked',
|
247 |
+
'value' => '1',
|
248 |
+
'compare' => 'NOT EXISTS'
|
249 |
+
),
|
250 |
+
Array(
|
251 |
+
'key' => 'ct_hash',
|
252 |
+
'value' => '1',
|
253 |
+
'compare' => 'NOT EXISTS'
|
254 |
+
)
|
255 |
+
),
|
256 |
+
'number'=>500
|
257 |
+
);
|
258 |
+
|
259 |
+
$u=get_users($args_unchecked);
|
260 |
+
//$u=array_slice($u,0,10);
|
261 |
+
if(sizeof($u)>0)
|
262 |
+
{
|
263 |
+
$data=Array();
|
264 |
+
for($i=0;$i<sizeof($u);$i++)
|
265 |
+
{
|
266 |
+
$user_meta=get_user_meta($u[$i]->ID, 'session_tokens', true);
|
267 |
+
if(is_array($user_meta))
|
268 |
+
{
|
269 |
+
$user_meta=array_values($user_meta);
|
270 |
+
}
|
271 |
+
if(@isset($user_meta[0]['ip']))
|
272 |
+
{
|
273 |
+
$data[]=$user_meta[0]['ip'];
|
274 |
+
}
|
275 |
+
else
|
276 |
+
{
|
277 |
+
$data[]='127.0.0.1';
|
278 |
+
}
|
279 |
+
$data[]=$u[$i]->data->user_email;
|
280 |
+
}
|
281 |
+
$data=implode(',',$data);
|
282 |
+
|
283 |
+
$request="data=$data";
|
284 |
+
|
285 |
+
$opts = array(
|
286 |
+
'http'=>array(
|
287 |
+
'method'=>"POST",
|
288 |
+
'content'=>$request,
|
289 |
+
)
|
290 |
+
);
|
291 |
+
|
292 |
+
$context = stream_context_create($opts);
|
293 |
+
|
294 |
+
$result = @file_get_contents("https://api.cleantalk.org/?method_name=spam_check&auth_key=".$ct_options['apikey'], 0, $context);
|
295 |
+
$result=json_decode($result);
|
296 |
+
if(isset($result->error_message))
|
297 |
+
{
|
298 |
+
print $result->error_message;
|
299 |
+
}
|
300 |
+
else
|
301 |
+
{
|
302 |
+
for($i=0;$i<sizeof($u);$i++)
|
303 |
+
{
|
304 |
+
update_user_meta($u[$i]->ID,'ct_checked',date("Y-m-d H:m:s"),true);
|
305 |
+
$user_meta=get_user_meta($u[$i]->ID, 'session_tokens', true);
|
306 |
+
if(is_array($user_meta))
|
307 |
+
{
|
308 |
+
$user_meta=array_values($user_meta);
|
309 |
+
}
|
310 |
+
if(@isset($user_meta[0]['ip']))
|
311 |
+
{
|
312 |
+
$uip=$user_meta[0]['ip'];
|
313 |
+
}
|
314 |
+
else
|
315 |
+
{
|
316 |
+
$uip='127.0.0.1';
|
317 |
+
}
|
318 |
+
//if($uip=='127.0.0.1')continue;
|
319 |
+
$uim=$u[$i]->data->user_email;
|
320 |
+
if(empty($uim))continue;
|
321 |
+
|
322 |
+
//print "uip: $uip, uim: $uim\n";
|
323 |
+
if($result->data->$uip->appears==1||$result->data->$uim->appears==1)
|
324 |
+
{
|
325 |
+
update_user_meta($u[$i]->ID,'ct_marked_as_spam','1',true);
|
326 |
+
}
|
327 |
+
}
|
328 |
+
print 1;
|
329 |
+
}
|
330 |
+
}
|
331 |
+
else
|
332 |
+
{
|
333 |
+
print 0;
|
334 |
+
}
|
335 |
+
|
336 |
+
die;
|
337 |
+
}
|
338 |
+
|
339 |
+
add_action( 'wp_ajax_ajax_info_users', 'ct_ajax_info_users' );
|
340 |
+
function ct_ajax_info_users()
|
341 |
+
{
|
342 |
+
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
343 |
+
$cnt=sizeof(get_users());
|
344 |
+
|
345 |
+
$args_spam = array(
|
346 |
+
'meta_query' => array(
|
347 |
+
Array(
|
348 |
+
'key' => 'ct_marked_as_spam',
|
349 |
+
'value' => '1',
|
350 |
+
'compare' => 'NUMERIC'
|
351 |
+
)
|
352 |
+
)
|
353 |
+
);
|
354 |
+
|
355 |
+
$cnt_spam=sizeof(get_users($args_spam));
|
356 |
+
|
357 |
+
$args_checked1=array(
|
358 |
+
'meta_query' => array(
|
359 |
+
Array(
|
360 |
+
'key' => 'ct_hash',
|
361 |
+
'compare' => 'EXISTS'
|
362 |
+
)
|
363 |
+
)
|
364 |
+
);
|
365 |
+
$args_checked2=array(
|
366 |
+
'meta_query' => array(
|
367 |
+
Array(
|
368 |
+
'key' => 'ct_checked',
|
369 |
+
'compare' => 'EXISTS'
|
370 |
+
)
|
371 |
+
)
|
372 |
+
);
|
373 |
+
|
374 |
+
$cnt_checked1=sizeof(get_users($args_checked1));
|
375 |
+
$cnt_checked2=sizeof(get_users($args_checked2));
|
376 |
+
$cnt_checked=$cnt_checked1+$cnt_checked2;
|
377 |
+
|
378 |
+
printf (__("Total users %s, checked %s, found %s spam users.", 'cleantalk'), $cnt, $cnt_checked, $cnt_spam);
|
379 |
+
die();
|
380 |
+
}
|
381 |
+
|
382 |
+
add_action( 'wp_ajax_ajax_insert_users', 'ct_ajax_insert_users' );
|
383 |
+
function ct_ajax_insert_users()
|
384 |
+
{
|
385 |
+
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
386 |
+
$time = current_time('mysql');
|
387 |
+
|
388 |
+
for($i=0;$i<500;$i++)
|
389 |
+
{
|
390 |
+
$rnd=mt_rand(1,10000);
|
391 |
+
if($rnd<2000)
|
392 |
+
{
|
393 |
+
$email="stop_email@example.com";
|
394 |
+
}
|
395 |
+
else
|
396 |
+
{
|
397 |
+
$email="stop_email_$rnd@example.com";
|
398 |
+
}
|
399 |
+
$data = array(
|
400 |
+
'user_login'=>"user_$rnd",
|
401 |
+
'user_email'=>$email,
|
402 |
+
'user_pass'=>'123456',
|
403 |
+
);
|
404 |
+
|
405 |
+
wp_insert_user($data);
|
406 |
+
}
|
407 |
+
print "ok";
|
408 |
+
die();
|
409 |
+
}
|
410 |
+
|
411 |
+
add_action( 'wp_ajax_ajax_delete_checked_users', 'ct_ajax_delete_checked_users' );
|
412 |
+
function ct_ajax_delete_checked_users()
|
413 |
+
{
|
414 |
+
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
415 |
+
foreach($_POST['ids'] as $key=>$value)
|
416 |
+
{
|
417 |
+
wp_delete_user($value);
|
418 |
+
}
|
419 |
+
die();
|
420 |
+
}
|
421 |
+
|
422 |
+
add_action( 'wp_ajax_ajax_delete_all_users', 'ct_ajax_delete_all_users' );
|
423 |
+
function ct_ajax_delete_all_users()
|
424 |
+
{
|
425 |
+
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
426 |
+
$args_spam = array(
|
427 |
+
'number'=>100,
|
428 |
+
'meta_query' => array(
|
429 |
+
Array(
|
430 |
+
'key' => 'ct_marked_as_spam',
|
431 |
+
'value' => '1',
|
432 |
+
'compare' => 'NUMERIC'
|
433 |
+
)
|
434 |
+
)
|
435 |
+
);
|
436 |
+
$c_spam=get_users($args_spam);
|
437 |
+
$cnt=sizeof($c_spam);
|
438 |
+
|
439 |
+
$args_spam = array(
|
440 |
+
'meta_query' => array(
|
441 |
+
Array(
|
442 |
+
'key' => 'ct_marked_as_spam',
|
443 |
+
'value' => '1',
|
444 |
+
'compare' => 'NUMERIC'
|
445 |
+
)
|
446 |
+
)
|
447 |
+
);
|
448 |
+
$cnt_all=sizeof(get_users($args_spam));
|
449 |
+
for($i=0;$i<sizeof($c_spam);$i++)
|
450 |
+
{
|
451 |
+
wp_delete_user($c_spam[$i]->ID);
|
452 |
+
usleep(10000);
|
453 |
+
}
|
454 |
+
print $cnt_all;
|
455 |
+
die();
|
456 |
+
}
|
457 |
+
|
458 |
+
add_action( 'wp_ajax_ajax_clear_users', 'ct_ajax_clear_users' );
|
459 |
+
function ct_ajax_clear_users()
|
460 |
+
{
|
461 |
+
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
462 |
+
global $wpdb;
|
463 |
+
$wpdb->query("delete from $wpdb->usermeta where meta_key='ct_hash' or meta_key='ct_checked' or meta_key='ct_marked_as_spam';");
|
464 |
+
die();
|
465 |
+
}
|
466 |
+
?>
|
cleantalk.php
CHANGED
@@ -3,11 +3,11 @@
|
|
3 |
Plugin Name: Anti-spam by CleanTalk
|
4 |
Plugin URI: http://cleantalk.org
|
5 |
Description: Max power, all-in-one, captcha less, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms.
|
6 |
-
Version: 5.
|
7 |
Author: СleanTalk <welcome@cleantalk.org>
|
8 |
Author URI: http://cleantalk.org
|
9 |
*/
|
10 |
-
$cleantalk_plugin_version='5.
|
11 |
$cleantalk_executed=false;
|
12 |
|
13 |
if(!defined('CLEANTALK_PLUGIN_DIR')){
|
@@ -68,7 +68,9 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
|
|
68 |
$use_ajax=1;
|
69 |
}
|
70 |
|
71 |
-
if($use_ajax==1
|
|
|
|
|
72 |
{
|
73 |
add_action('wp_loaded', 'ct_add_nocache_script', 1);
|
74 |
add_action('wp_footer', 'ct_add_nocache_script_footer', 1);
|
@@ -268,6 +270,7 @@ function ct_inject_nocache_script($html)
|
|
268 |
if(is_admin())
|
269 |
{
|
270 |
require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-comments.php');
|
|
|
271 |
}
|
272 |
if(isset($_GET['ait-action'])&&$_GET['ait-action']=='register')
|
273 |
{
|
3 |
Plugin Name: Anti-spam by CleanTalk
|
4 |
Plugin URI: http://cleantalk.org
|
5 |
Description: Max power, all-in-one, captcha less, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms.
|
6 |
+
Version: 5.19
|
7 |
Author: СleanTalk <welcome@cleantalk.org>
|
8 |
Author URI: http://cleantalk.org
|
9 |
*/
|
10 |
+
$cleantalk_plugin_version='5.19';
|
11 |
$cleantalk_executed=false;
|
12 |
|
13 |
if(!defined('CLEANTALK_PLUGIN_DIR')){
|
68 |
$use_ajax=1;
|
69 |
}
|
70 |
|
71 |
+
if($use_ajax==1 &&
|
72 |
+
stripos($_SERVER['REQUEST_URI'],'.xml')===false &&
|
73 |
+
stripos($_SERVER['REQUEST_URI'],'.xsl')===false)
|
74 |
{
|
75 |
add_action('wp_loaded', 'ct_add_nocache_script', 1);
|
76 |
add_action('wp_footer', 'ct_add_nocache_script_footer', 1);
|
270 |
if(is_admin())
|
271 |
{
|
272 |
require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-comments.php');
|
273 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-users.php');
|
274 |
}
|
275 |
if(isset($_GET['ait-action'])&&$_GET['ait-action']=='register')
|
276 |
{
|
cleantalk_nocache.js
CHANGED
@@ -65,8 +65,8 @@ function ct_setCookie(name, value)
|
|
65 |
|
66 |
var date = new Date;
|
67 |
date.setDate(date.getDate() + 1);
|
68 |
-
//setTimeout(function() { document.cookie = name+"=" + value + "; expires=" + date.toUTCString() + "; path = /; domain = " + domain},
|
69 |
-
setTimeout(function() { document.cookie = name+"=" + value + "; expires=" + date.toUTCString() + "; path = /;"},
|
70 |
}
|
71 |
|
72 |
function ct_callback(req)
|
@@ -123,7 +123,7 @@ if(ct_nocache_executed==undefined)
|
|
123 |
}
|
124 |
}
|
125 |
|
126 |
-
if(old_timestamp==undefined||new_timestamp-old_timestamp>
|
127 |
{
|
128 |
ct_setCookie('ct_timestamp', new_timestamp);
|
129 |
//alert('set!');
|
65 |
|
66 |
var date = new Date;
|
67 |
date.setDate(date.getDate() + 1);
|
68 |
+
//setTimeout(function() { document.cookie = name+"=" + value + "; expires=" + date.toUTCString() + "; path = /; domain = " + domain}, 500)
|
69 |
+
setTimeout(function() { document.cookie = name+"=" + value + "; expires=" + date.toUTCString() + "; path = /;"}, 500)
|
70 |
}
|
71 |
|
72 |
function ct_callback(req)
|
123 |
}
|
124 |
}
|
125 |
|
126 |
+
if(old_timestamp==undefined||new_timestamp-old_timestamp>86400||checkjs_cookie==undefined) //86400 is 24 hours
|
127 |
{
|
128 |
ct_setCookie('ct_timestamp', new_timestamp);
|
129 |
//alert('set!');
|
readme.txt
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
=== Anti-Spam by CleanTalk - No Captcha, no comments & registrations spam ===
|
2 |
Contributors: znaeff, shagimuratov, vlad-cleantalk
|
3 |
-
Tags: anti-spam, antispam, bbpress, buddypress, captcha, cf7 spam, comments, contact form spam, signup, spam, spammers, spammy,
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 4.3
|
6 |
-
Stable tag: 5.
|
7 |
License: GPLv2
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
10 |
-
Max power, all-in-one, premium anti-spam. No comments & registrations spam, no
|
11 |
|
12 |
== Description ==
|
13 |
No CAPTCHA, no questions, no counting animals, no puzzles, no math and no spam bots.
|
@@ -47,6 +47,9 @@ Plugin blocks spam emails via any themes (built-in) contact forms. With AJAX for
|
|
47 |
= Check existing comments for spam =
|
48 |
With the help of anti-spam by CleanTalk you can check existing comments, to find and quickly delete spam comments. For use this function, go to WP Console->Comments->Find spam comments.
|
49 |
|
|
|
|
|
|
|
50 |
= Low false/positive rate =
|
51 |
This plugin uses multiple anti-spam tests to filter spam bots with lower false/positive rate as possible. Multiple anti-spam tests avoid false/positive blocks for real website visitors even if one of the tests failed.
|
52 |
|
@@ -56,6 +59,10 @@ Service CleanTalk (this plugin is a client application for CleanTalk anti-spam s
|
|
56 |
= No spam comments, no spam registrations, no spam contact emails, no spam trackbacks. CAPTCHA less anti-spam for WordPress =
|
57 |
Spam is one of the most irritating factors. Spam become every year more and conventional anti-spam can no longer handle all the spam bots. CleanTalk prevents spam and automatically blocks it. You'll be surprised of effective protection against spam.
|
58 |
|
|
|
|
|
|
|
|
|
59 |
= Anti-spam plugin info =
|
60 |
CleanTalk is an anti-spam solution **all in 1 for WordPress** that protects login, comments, contact and WooCommerce forms all at once. You don't need to install separate anti-spam plugins for each form. This allows your blog to work faster and save resources. After installation **you will forget about spam**, CleanTalk plugin will do all the work. You won't have to deal with spam, CleanTalk will do this for you automatically.
|
61 |
|
@@ -75,7 +82,7 @@ CleanTalk is premium anti-spam service for WordPress, please look at the <a href
|
|
75 |
* Traffic acquisition and user loyalty.
|
76 |
* 24/7 technical support.
|
77 |
* Clear statistics.
|
78 |
-
* No captcha, puzzles, etc.
|
79 |
* Free mobile app to control anti-spam function at your website.
|
80 |
|
81 |
= Additional features =
|
@@ -88,10 +95,6 @@ The most popular method is CAPTCHA - the annoying picture with curved and slopin
|
|
88 |
Sometimes CAPTCHA reminds doodle 2x year old child. For users with vision problems captcha is just an insurmountable obstacle. Users hate captcha. Captcha for users means "hate". Unreadable CAPTCHA stops about 80% of site visitors. After 2 failed attempts to bring it up to 95% reject further attempts.
|
89 |
At the sight of CAPTCHA and after input errors, many visitors leave the resource. Thus, CAPTCHA helps to protect the resource both from bots and visitors. CAPTCHA is not a panacea from spam. Doubts Concerning the Need for CAPTCHA?
|
90 |
|
91 |
-
= Public reviews =
|
92 |
-
> Using on WPLift was a great test as we receive huge amounts of spam.
|
93 |
-
> *Oliver Dale. <a href="http://wplift.com/wordpress-anti-spam-plugin" target="_blank">WPLift.com</a>.*
|
94 |
-
|
95 |
= We recommend =
|
96 |
Audience engagement plugin <a href="http://wordpress.org/plugins/feedweb/">Feedweb</a>
|
97 |
|
@@ -147,7 +150,7 @@ Plugin by default pass pingbacks without any checks. All trackbacks will be bloc
|
|
147 |
= Can I use CleanTalk with Akismet? =
|
148 |
Sure, you can use CleanTalk with Akismet. In this case probably you will have bigger false/positive rate (when legitimate comments/signups denies), but you will have stronger antispam protection at website.
|
149 |
|
150 |
-
= Should I use another anti-spam tools (Captcha)? =
|
151 |
CleanTalk stops up to 100% of spam bots, so you can disable other anti-spam plugins (especially CAPTCHA like anti-spam plugins). In some cases several anti-spam plugins can conflict, so it will be better use just one plugin.
|
152 |
|
153 |
= Is the plugin WordPress MultiUser (WPMU or WordPress network) compatible? =
|
@@ -182,9 +185,6 @@ After activation CleanTalk sends test message with email stop_email@example.com.
|
|
182 |
= Compatible with Cloudflare? =
|
183 |
CleanTalk is fully compatible with CloudFlare. Service doesn't filter CloudFlares IP's (AS13335) over blacklists database, so in this way plugin/service filters spam bots uses other anti spam tests.
|
184 |
|
185 |
-
= Can I use Akismet and CleanTalk to protect my website against spam bots? =
|
186 |
-
Sure, you can. You can use CleanTalk and any backend anti-spam tools to protect your website.
|
187 |
-
|
188 |
= Can i use CleanTalk functionality in my plugins? =
|
189 |
Yes, you can. Just use following snippet:
|
190 |
|
@@ -288,6 +288,11 @@ WordPress 3.0 at least. PHP 5 with CURL or file_get_contents() function and enab
|
|
288 |
1. Setup Android/iOS app to have push notices when new legitiamte comments/registrations or contactcs appears on the website.
|
289 |
|
290 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
291 |
= 5.18 2015-08-04 =
|
292 |
* Fixed issue with user_token
|
293 |
* Added anti-spam API, see our FAQ
|
@@ -710,6 +715,11 @@ WordPress 3.0 at least. PHP 5 with CURL or file_get_contents() function and enab
|
|
710 |
* First version
|
711 |
|
712 |
== Upgrade Notice ==
|
|
|
|
|
|
|
|
|
|
|
713 |
= 5.18 2015-08-04 =
|
714 |
* Fixed issue with user_token
|
715 |
* Added anti-spam API, see our FAQ
|
1 |
=== Anti-Spam by CleanTalk - No Captcha, no comments & registrations spam ===
|
2 |
Contributors: znaeff, shagimuratov, vlad-cleantalk
|
3 |
+
Tags: anti-spam, antispam, bbpress, buddypress, captcha, capcha, captha, catcha, cf7 spam, comments, contact form spam, signup, spam, spammers, spammy, woocommerce, wordpress spam, booking, order, subscription, gravity spam, jetpack, bots, contact form 7, contact form, registrations, ninja, Fast Secure Contact, Gravity forms, formidable, mailchimp, s2member, protection, protect, email, akismet, plugin, contact, recaptcha, google captcha, math, security, login, blacklist, cache, prevent, wordpress
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 4.3
|
6 |
+
Stable tag: 5.19
|
7 |
License: GPLv2
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
10 |
+
Max power, all-in-one, premium anti-spam. No comments spam & registrations spam, no email spam, protects any forms. Just install and forget spam.
|
11 |
|
12 |
== Description ==
|
13 |
No CAPTCHA, no questions, no counting animals, no puzzles, no math and no spam bots.
|
47 |
= Check existing comments for spam =
|
48 |
With the help of anti-spam by CleanTalk you can check existing comments, to find and quickly delete spam comments. For use this function, go to WP Console->Comments->Find spam comments.
|
49 |
|
50 |
+
= Check existing users for spam =
|
51 |
+
With the help of anti-spam by CleanTalk you can check existing comments, to find and quickly delete spam users. For use this function, go to WP Console->Users->Check for spam.
|
52 |
+
|
53 |
= Low false/positive rate =
|
54 |
This plugin uses multiple anti-spam tests to filter spam bots with lower false/positive rate as possible. Multiple anti-spam tests avoid false/positive blocks for real website visitors even if one of the tests failed.
|
55 |
|
59 |
= No spam comments, no spam registrations, no spam contact emails, no spam trackbacks. CAPTCHA less anti-spam for WordPress =
|
60 |
Spam is one of the most irritating factors. Spam become every year more and conventional anti-spam can no longer handle all the spam bots. CleanTalk prevents spam and automatically blocks it. You'll be surprised of effective protection against spam.
|
61 |
|
62 |
+
= Public reviews =
|
63 |
+
> Using on WPLift was a great test as we receive huge amounts of spam.
|
64 |
+
> *Oliver Dale. <a href="http://wplift.com/wordpress-anti-spam-plugin" target="_blank">WPLift.com</a>.*
|
65 |
+
|
66 |
= Anti-spam plugin info =
|
67 |
CleanTalk is an anti-spam solution **all in 1 for WordPress** that protects login, comments, contact and WooCommerce forms all at once. You don't need to install separate anti-spam plugins for each form. This allows your blog to work faster and save resources. After installation **you will forget about spam**, CleanTalk plugin will do all the work. You won't have to deal with spam, CleanTalk will do this for you automatically.
|
68 |
|
82 |
* Traffic acquisition and user loyalty.
|
83 |
* 24/7 technical support.
|
84 |
* Clear statistics.
|
85 |
+
* No captcha (reCaptcha), puzzles, etc.
|
86 |
* Free mobile app to control anti-spam function at your website.
|
87 |
|
88 |
= Additional features =
|
95 |
Sometimes CAPTCHA reminds doodle 2x year old child. For users with vision problems captcha is just an insurmountable obstacle. Users hate captcha. Captcha for users means "hate". Unreadable CAPTCHA stops about 80% of site visitors. After 2 failed attempts to bring it up to 95% reject further attempts.
|
96 |
At the sight of CAPTCHA and after input errors, many visitors leave the resource. Thus, CAPTCHA helps to protect the resource both from bots and visitors. CAPTCHA is not a panacea from spam. Doubts Concerning the Need for CAPTCHA?
|
97 |
|
|
|
|
|
|
|
|
|
98 |
= We recommend =
|
99 |
Audience engagement plugin <a href="http://wordpress.org/plugins/feedweb/">Feedweb</a>
|
100 |
|
150 |
= Can I use CleanTalk with Akismet? =
|
151 |
Sure, you can use CleanTalk with Akismet. In this case probably you will have bigger false/positive rate (when legitimate comments/signups denies), but you will have stronger antispam protection at website.
|
152 |
|
153 |
+
= Should I use another anti-spam tools (Captcha, reCaptcha and etc.)? =
|
154 |
CleanTalk stops up to 100% of spam bots, so you can disable other anti-spam plugins (especially CAPTCHA like anti-spam plugins). In some cases several anti-spam plugins can conflict, so it will be better use just one plugin.
|
155 |
|
156 |
= Is the plugin WordPress MultiUser (WPMU or WordPress network) compatible? =
|
185 |
= Compatible with Cloudflare? =
|
186 |
CleanTalk is fully compatible with CloudFlare. Service doesn't filter CloudFlares IP's (AS13335) over blacklists database, so in this way plugin/service filters spam bots uses other anti spam tests.
|
187 |
|
|
|
|
|
|
|
188 |
= Can i use CleanTalk functionality in my plugins? =
|
189 |
Yes, you can. Just use following snippet:
|
190 |
|
288 |
1. Setup Android/iOS app to have push notices when new legitiamte comments/registrations or contactcs appears on the website.
|
289 |
|
290 |
== Changelog ==
|
291 |
+
= 5.19 2015-08-11 =
|
292 |
+
* New feature: anti-spam checking for registered users
|
293 |
+
* Fixed issue with AJAX JavaScript anti-spam test.
|
294 |
+
* Fixed issue with SEO Yoast xml sitemaps and JavaScript anti-spam test.
|
295 |
+
|
296 |
= 5.18 2015-08-04 =
|
297 |
* Fixed issue with user_token
|
298 |
* Added anti-spam API, see our FAQ
|
715 |
* First version
|
716 |
|
717 |
== Upgrade Notice ==
|
718 |
+
= 5.19 2015-08-11 =
|
719 |
+
* New feature: anti-spam checking for registered users
|
720 |
+
* Fixed issue with AJAX JavaScript checking
|
721 |
+
* Fixed issue with SEO Yoast xml sitemaps.
|
722 |
+
|
723 |
= 5.18 2015-08-04 =
|
724 |
* Fixed issue with user_token
|
725 |
* Added anti-spam API, see our FAQ
|