Spam protection, AntiSpam, FireWall by CleanTalk - Version 5.137.1

Version Description

April 29 2020 = * Fix: Call to undefined function wp_get_current_user(). * Fix: "Capture buffer" setting, YOAST sitemap. * Integration: Simple Membership plugin integration implemented. * Fix: Integrations system fixed. * Fix: Query for SFW fixed. * Fix: SFW error handling.

Download this release

Release Info

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

Code changes from version 5.137 to 5.137.1

cleantalk.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Anti-Spam by CleanTalk
4
  Plugin URI: https://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.137
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: https://cleantalk.org
9
  Text Domain: cleantalk
@@ -189,7 +189,8 @@ if( !defined( 'CLEANTALK_PLUGIN_DIR' ) ){
189
  $apbct_active_integrations = array(
190
  'ContactBank' => array( 'hook' => 'contact_bank_frontend_ajax_call', 'ajax' => true ),
191
  'FluentForm' => array( 'hook' => 'fluentform_before_insert_submission', 'ajax' => false ),
192
- 'ElfsightContactForm' => array( 'hook' => 'elfsight_contact_form_mail', 'ajax' => true )
 
193
  );
194
  new \Cleantalk\Antispam\Integrations( $apbct_active_integrations );
195
 
@@ -951,7 +952,7 @@ function ct_sfw_update($immediate = false){
951
  $apbct->save('stats');
952
  }
953
  } else
954
- return array('error' => 'ERROR_WHILE_INSERTING_SFW_DATA');
955
  }
956
  }
957
 
3
  Plugin Name: Anti-Spam by CleanTalk
4
  Plugin URI: https://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.137.1
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: https://cleantalk.org
9
  Text Domain: cleantalk
189
  $apbct_active_integrations = array(
190
  'ContactBank' => array( 'hook' => 'contact_bank_frontend_ajax_call', 'ajax' => true ),
191
  'FluentForm' => array( 'hook' => 'fluentform_before_insert_submission', 'ajax' => false ),
192
+ 'ElfsightContactForm' => array( 'hook' => 'elfsight_contact_form_mail', 'ajax' => true ),
193
+ 'SimpleMembership' => array( 'hook' => 'swpm_front_end_registration_complete_user_data', 'ajax' => false )
194
  );
195
  new \Cleantalk\Antispam\Integrations( $apbct_active_integrations );
196
 
952
  $apbct->save('stats');
953
  }
954
  } else
955
+ return $result;
956
  }
957
  }
958
 
inc/cleantalk-ajax.php CHANGED
@@ -300,6 +300,7 @@ function ct_ajax_hook($message_obj = false, $additional = false)
300
  'dflg_do_sign_in_user', // Unknown plugin
301
  'cartflows_save_cart_abandonment_data', // WooCommerce cartflow
302
  'rcp_process_register_form', // WordPress Membership Plugin – Restrict Content
 
303
  );
304
 
305
  // Skip test if
300
  'dflg_do_sign_in_user', // Unknown plugin
301
  'cartflows_save_cart_abandonment_data', // WooCommerce cartflow
302
  'rcp_process_register_form', // WordPress Membership Plugin – Restrict Content
303
+ 'give_process_donation' // GiveWP
304
  );
305
 
306
  // Skip test if
inc/cleantalk-public.php CHANGED
@@ -37,19 +37,22 @@ function apbct_init() {
37
 
38
  // Fixing form and directs it this site
39
  if($apbct->settings['check_external__capture_buffer'] && !is_admin() && !apbct_is_ajax() && !apbct_is_post() && apbct_is_user_enable() && !(defined('DOING_CRON') && DOING_CRON) && !(defined('XMLRPC_REQUEST') && XMLRPC_REQUEST)){
40
- $catch_buffer = defined('CLEANTALK_CAPTURE_BUFFER_SPECIFIC_URL') ? false : true;
41
 
42
  if (defined('CLEANTALK_CAPTURE_BUFFER_SPECIFIC_URL') && is_string(CLEANTALK_CAPTURE_BUFFER_SPECIFIC_URL)) {
 
43
  $urls = explode(',', CLEANTALK_CAPTURE_BUFFER_SPECIFIC_URL);
44
  foreach ($urls as $url) {
45
  if (apbct_is_in_uri($url))
46
  $catch_buffer = true;
47
  }
 
 
48
  }
49
- if ($catch_buffer) {
 
50
  add_action('wp', 'apbct_buffer__start');
51
  add_action('shutdown', 'apbct_buffer__end', 0);
52
- add_action('shutdown', 'apbct_buffer__output', 2);
53
  }
54
  }
55
 
@@ -382,17 +385,13 @@ function apbct_buffer__output(){
382
  }
383
 
384
  } unset($form);
385
-
386
  $html = $dom->getElementsByTagName('html');
387
 
388
- $output = '';
389
-
390
- if (gettype($html) == 'object' && isset($html[0], $html[0]->childNodes, $html[0]->childNodes[0])) {
391
- foreach ($html[0]->childNodes as $node)
392
- $output .= $html[0]->ownerDocument->saveHTML($node);
393
- } else
394
- $output = $apbct->buffer;
395
-
396
  echo $output;
397
  }
398
 
@@ -1174,9 +1173,9 @@ function apbct_comment__sanitize_data__before_wp_die($function){
1174
 
1175
  if(isset($comment_content, $comment_parent)){
1176
 
1177
- $user = wp_get_current_user();
1178
 
1179
- if($user->exists()){
1180
  $comment_author = empty($user->display_name) ? $user->user_login : $user->display_name;
1181
  $comment_author_email = $user->user_email;
1182
  $comment_author_url = $user->user_url;
@@ -3324,6 +3323,7 @@ function ct_contact_form_validate() {
3324
  'sender_email' => $sender_email,
3325
  'sender_nickname' => $sender_nickname,
3326
  'post_info' => $post_info,
 
3327
  )
3328
  );
3329
 
@@ -3598,6 +3598,7 @@ function ct_enqueue_scripts_public($hook){
3598
  if (apbct_exclusions_check__url()) {
3599
  return;
3600
  }
 
3601
  if($apbct->settings['registrations_test'] || $apbct->settings['comments_test'] || $apbct->settings['contact_forms_test'] || $apbct->settings['general_contact_forms_test'] || $apbct->settings['wc_checkout_test'] || $apbct->settings['check_external'] || $apbct->settings['check_internal'] || $apbct->settings['bp_private_messages'] || $apbct->settings['general_postdata_test']){
3602
 
3603
  // Differnt JS params
37
 
38
  // Fixing form and directs it this site
39
  if($apbct->settings['check_external__capture_buffer'] && !is_admin() && !apbct_is_ajax() && !apbct_is_post() && apbct_is_user_enable() && !(defined('DOING_CRON') && DOING_CRON) && !(defined('XMLRPC_REQUEST') && XMLRPC_REQUEST)){
 
40
 
41
  if (defined('CLEANTALK_CAPTURE_BUFFER_SPECIFIC_URL') && is_string(CLEANTALK_CAPTURE_BUFFER_SPECIFIC_URL)) {
42
+ $catch_buffer = false;
43
  $urls = explode(',', CLEANTALK_CAPTURE_BUFFER_SPECIFIC_URL);
44
  foreach ($urls as $url) {
45
  if (apbct_is_in_uri($url))
46
  $catch_buffer = true;
47
  }
48
+ }else{
49
+ $catch_buffer = true;
50
  }
51
+
52
+ if( $catch_buffer ){
53
  add_action('wp', 'apbct_buffer__start');
54
  add_action('shutdown', 'apbct_buffer__end', 0);
55
+ add_action('shutdown', 'apbct_buffer__output', 2);
56
  }
57
  }
58
 
385
  }
386
 
387
  } unset($form);
388
+
389
  $html = $dom->getElementsByTagName('html');
390
 
391
+ $output = gettype($html) == 'object' && isset($html[0], $html[0]->childNodes, $html[0]->childNodes[0])
392
+ ? $dom->saveHTML()
393
+ : $apbct->buffer;
394
+
 
 
 
 
395
  echo $output;
396
  }
397
 
1173
 
1174
  if(isset($comment_content, $comment_parent)){
1175
 
1176
+ $user = function_exists('apbct_wp_get_current_user') ? apbct_wp_get_current_user() : null;
1177
 
1178
+ if($user && $user->exists()){
1179
  $comment_author = empty($user->display_name) ? $user->user_login : $user->display_name;
1180
  $comment_author_email = $user->user_email;
1181
  $comment_author_url = $user->user_url;
3323
  'sender_email' => $sender_email,
3324
  'sender_nickname' => $sender_nickname,
3325
  'post_info' => $post_info,
3326
+ 'sender_info' => array( 'sender_email' => urlencode( $sender_email ) ),
3327
  )
3328
  );
3329
 
3598
  if (apbct_exclusions_check__url()) {
3599
  return;
3600
  }
3601
+
3602
  if($apbct->settings['registrations_test'] || $apbct->settings['comments_test'] || $apbct->settings['contact_forms_test'] || $apbct->settings['general_contact_forms_test'] || $apbct->settings['wc_checkout_test'] || $apbct->settings['check_external'] || $apbct->settings['check_internal'] || $apbct->settings['bp_private_messages'] || $apbct->settings['general_postdata_test']){
3603
 
3604
  // Differnt JS params
inc/cleantalk-updater.php CHANGED
@@ -1,413 +1,438 @@
1
- <?php
2
-
3
- function apbct_run_update_actions($current_version, $new_version){
4
-
5
- $current_version = apbct_version_standartization($current_version);
6
- $new_version = apbct_version_standartization($new_version);
7
-
8
- $current_version_str = implode('.', $current_version);
9
- $new_version_str = implode('.', $new_version);
10
-
11
- for($ver_major = $current_version[0]; $ver_major <= $new_version[0]; $ver_major++){
12
- for($ver_minor = 0; $ver_minor <= 200; $ver_minor++){
13
- for($ver_fix = 0; $ver_fix <= 10; $ver_fix++){
14
-
15
- if(version_compare("{$ver_major}.{$ver_minor}.{$ver_fix}", $current_version_str, '<='))
16
- continue;
17
-
18
- if(function_exists("apbct_update_to_{$ver_major}_{$ver_minor}_{$ver_fix}")){
19
- $result = call_user_func("apbct_update_to_{$ver_major}_{$ver_minor}_{$ver_fix}");
20
- if(!empty($result['error']))
21
- break;
22
- }
23
-
24
- if(version_compare("{$ver_major}.{$ver_minor}.{$ver_fix}", $new_version_str, '>='))
25
- break(2);
26
-
27
- }
28
- }
29
- }
30
-
31
- return true;
32
-
33
- }
34
-
35
- function apbct_version_standartization($version){
36
-
37
- $version = explode('.', $version);
38
- $version = !empty($version) ? $version : array();
39
-
40
- $version[0] = !empty($version[0]) ? (int)$version[0] : 0;
41
- $version[1] = !empty($version[1]) ? (int)$version[1] : 0;
42
- $version[2] = !empty($version[2]) ? (int)$version[2] : 0;
43
-
44
- return $version;
45
- }
46
-
47
- function apbct_update_to_5_50_0(){
48
- global $wpdb;
49
- $wpdb->query('CREATE TABLE IF NOT EXISTS `'. APBCT_TBL_FIREWALL_DATA .'` (
50
- `network` int(11) unsigned NOT NULL,
51
- `mask` int(11) unsigned NOT NULL,
52
- INDEX ( `network` , `mask` )
53
- );');
54
-
55
- $wpdb->query('CREATE TABLE IF NOT EXISTS `'. APBCT_TBL_FIREWALL_LOG .'` (
56
- `ip` VARCHAR(15) NOT NULL ,
57
- `all` INT NOT NULL ,
58
- `blocked` INT NOT NULL ,
59
- `timestamp` INT NOT NULL ,
60
- PRIMARY KEY (`ip`));');
61
- }
62
-
63
- function apbct_update_to_5_56_0(){
64
- if (!wp_next_scheduled('cleantalk_update_sfw_hook'))
65
- wp_schedule_event(time()+1800, 'daily', 'cleantalk_update_sfw_hook' );
66
- }
67
- function apbct_update_to_5_70_0(){
68
-
69
- global $wpdb;
70
-
71
- if(!in_array('all_entries', $wpdb->get_col('DESC '. APBCT_TBL_FIREWALL_LOG, 0))){
72
- $wpdb->query('ALTER TABLE `'. APBCT_TBL_FIREWALL_LOG .'`
73
- CHANGE `all` `all_entries` INT(11) NOT NULL,
74
- CHANGE `blocked` `blocked_entries` INT(11) NOT NULL,
75
- CHANGE `timestamp` `entries_timestamp` INT(11) NOT NULL;'
76
- );
77
- }
78
-
79
- // Deleting usless data
80
- delete_option('cleantalk_sends_reports_till');
81
- delete_option('cleantalk_activation_timestamp');
82
-
83
- // Disabling WP_Cron tasks
84
- wp_clear_scheduled_hook('cleantalk_send_daily_report_hook');
85
- wp_clear_scheduled_hook('ct_hourly_event_hook');
86
- wp_clear_scheduled_hook('ct_send_sfw_log');
87
- wp_clear_scheduled_hook('cleantalk_update_sfw_hook');
88
- wp_clear_scheduled_hook('cleantalk_get_brief_data_hook');
89
-
90
- // Adding Self cron system tasks
91
- CleantalkCron::addTask('check_account_status', 'ct_account_status_check', 3600, time()+1800); // New
92
- CleantalkCron::addTask('delete_spam_comments', 'ct_delete_spam_comments', 3600, time()+3500);
93
- CleantalkCron::addTask('send_feedback', 'ct_send_feedback', 3600, time()+3500);
94
- CleantalkCron::addTask('sfw_update', 'ct_sfw_update', 86400, time()+43200);
95
- CleantalkCron::addTask('send_sfw_logs', 'ct_sfw_send_logs', 3600, time()+1800); // New
96
- CleantalkCron::addTask('get_brief_data', 'cleantalk_get_brief_data', 86400, time()+3500);
97
- }
98
- function apbct_update_to_5_74_0(){
99
- CleantalkCron::removeTask('send_daily_request');
100
- }
101
-
102
- function apbct_update_to_5_97_0(){
103
-
104
- global $apbct;
105
-
106
- if(count($apbct->data['connection_reports']['negative_report']) >= 20)
107
- $apbct->data['connection_reports']['negative_report'] = array_slice($apbct->data['connection_reports']['negative_report'], -20, 20);
108
-
109
- $apbct->saveData();
110
- }
111
-
112
- function apbct_update_to_5_109_0(){
113
-
114
- global $apbct, $wpdb;
115
-
116
- if(apbct_is_plugin_active_for_network($apbct->base_name) && !defined('CLEANTALK_ACCESS_KEY')){
117
-
118
- $sfw_data_query = 'CREATE TABLE IF NOT EXISTS `%s` (
119
- `network` int(11) unsigned NOT NULL,
120
- `mask` int(11) unsigned NOT NULL,
121
- INDEX ( `network` , `mask` )
122
- );';
123
-
124
- $sfw_log_query = 'CREATE TABLE IF NOT EXISTS `%s` (
125
- `ip` VARCHAR(15) NOT NULL,
126
- `all_entries` INT NOT NULL,
127
- `blocked_entries` INT NOT NULL,
128
- `entries_timestamp` INT NOT NULL,
129
- PRIMARY KEY (`ip`));';
130
-
131
- $initial_blog = get_current_blog_id();
132
- $blogs = array_keys($wpdb->get_results('SELECT blog_id FROM '. $wpdb->blogs, OBJECT_K));
133
- foreach ($blogs as $blog) {
134
- switch_to_blog($blog);
135
- $wpdb->query(sprintf($sfw_data_query, $wpdb->prefix . 'cleantalk_sfw')); // Table for SpamFireWall data
136
- $wpdb->query(sprintf($sfw_log_query, $wpdb->prefix . 'cleantalk_sfw_logs')); // Table for SpamFireWall logs
137
- // Cron tasks
138
- CleantalkCron::addTask('check_account_status', 'ct_account_status_check', 3600, time()+1800); // Checks account status
139
- CleantalkCron::addTask('delete_spam_comments', 'ct_delete_spam_comments', 3600, time()+3500); // Formerly ct_hourly_event_hook()
140
- CleantalkCron::addTask('send_feedback', 'ct_send_feedback', 3600, time()+3500); // Formerly ct_hourly_event_hook()
141
- CleantalkCron::addTask('sfw_update', 'ct_sfw_update', 86400, time()+300); // SFW update
142
- CleantalkCron::addTask('send_sfw_logs', 'ct_sfw_send_logs', 3600, time()+1800); // SFW send logs
143
- CleantalkCron::addTask('get_brief_data', 'cleantalk_get_brief_data', 86400, time()+3500); // Get data for dashboard widget
144
- CleantalkCron::addTask('send_connection_report','ct_mail_send_connection_report', 86400, time()+3500); // Send connection report to welcome@cleantalk.org
145
- }
146
- switch_to_blog($initial_blog);
147
- }
148
- }
149
-
150
- function apbct_update_to_5_110_0(){
151
- global $apbct;
152
- unset($apbct->data['last_remote_call']);
153
- $apbct->saveData;
154
- $apbct->save('remote_calls');
155
- }
156
-
157
- function apbct_update_to_5_115_1(){
158
- ct_sfw_update();
159
- }
160
-
161
- function apbct_update_to_5_116_0(){
162
-
163
- global $apbct, $wpdb;
164
-
165
- $apbct->settings['store_urls'] = 0;
166
- $apbct->settings['store_urls__sessions'] = 0;
167
- $apbct->saveSettings();
168
-
169
- $wpdb->query('CREATE TABLE IF NOT EXISTS `'. APBCT_TBL_SESSIONS .'` (
170
- `id` VARCHAR(64) NOT NULL,
171
- `name` TEXT NOT NULL,
172
- `value` TEXT NULL,
173
- `last_update` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
174
- PRIMARY KEY (`id`, `name`(10)));'
175
- );
176
- }
177
-
178
- function apbct_update_to_5_116_1(){
179
-
180
- global $wpdb;
181
-
182
- $wpdb->query('CREATE TABLE IF NOT EXISTS `'. APBCT_TBL_SESSIONS .'` (
183
- `id` VARCHAR(64) NOT NULL,
184
- `name` TEXT NOT NULL,
185
- `value` TEXT NULL,
186
- `last_update` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
187
- PRIMARY KEY (`id`, `name`(10)));'
188
- );
189
- }
190
-
191
- function apbct_update_to_5_116_2(){
192
-
193
- global $wpdb;
194
-
195
- $wpdb->query('CREATE TABLE IF NOT EXISTS `'. APBCT_TBL_SESSIONS .'` (
196
- `id` VARCHAR(64) NOT NULL,
197
- `name` TEXT NOT NULL,
198
- `value` TEXT NULL DEFAULT NULL,
199
- `last_update` DATETIME NULL DEFAULT NULL,
200
- PRIMARY KEY (`id`, `name`(10)));'
201
- );
202
- }
203
-
204
- function apbct_update_to_5_118_0(){
205
- global $wpdb;
206
- $wpdb->query(
207
- 'DELETE
208
- FROM `'. APBCT_TBL_SESSIONS .'`
209
- WHERE last_update < NOW() - INTERVAL '. APBCT_SEESION__LIVE_TIME .' SECOND;'
210
- );
211
- delete_option('cleantalk_server');
212
- }
213
-
214
- function apbct_update_to_5_118_2(){
215
- global $apbct;
216
- $apbct->data['connection_reports'] = $apbct->def_data['connection_reports'];
217
- $apbct->data['connection_reports']['since'] = date('d M');
218
- $apbct->saveData();
219
- }
220
-
221
- function apbct_update_to_5_119_0(){
222
-
223
- global $wpdb;
224
-
225
- $wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->prefix.'cleantalk_sessions`;'); // Deleting session table
226
-
227
- // SFW data
228
- $sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sfw` (
229
- `network` int(11) unsigned NOT NULL,
230
- `mask` int(11) unsigned NOT NULL,
231
- INDEX ( `network` , `mask` )
232
- );';
233
-
234
- // SFW log
235
- $sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sfw_logs` (
236
- `ip` VARCHAR(15) NOT NULL,
237
- `all_entries` INT NOT NULL,
238
- `blocked_entries` INT NOT NULL,
239
- `entries_timestamp` INT NOT NULL,
240
- PRIMARY KEY (`ip`));';
241
-
242
- // Sessions
243
- $sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sessions` (
244
- `id` VARCHAR(64) NOT NULL,
245
- `name` VARCHAR(64) NOT NULL,
246
- `value` TEXT NULL DEFAULT NULL,
247
- `last_update` DATETIME NULL DEFAULT NULL,
248
- PRIMARY KEY (`id`(64), `name`(64)));';
249
-
250
- apbct_activation__create_tables($sqls);
251
-
252
- // WPMS
253
- if(is_multisite()){
254
- global $wpdb;
255
- $initial_blog = get_current_blog_id();
256
- $blogs = array_keys($wpdb->get_results('SELECT blog_id FROM '. $wpdb->blogs, OBJECT_K));
257
- foreach ($blogs as $blog) {
258
- switch_to_blog($blog);
259
- $wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->prefix.'cleantalk_sessions`;'); // Deleting session table
260
- apbct_activation__create_tables($sqls);
261
- }
262
- switch_to_blog($initial_blog);
263
- }
264
-
265
- // Drop work url
266
- update_option(
267
- 'cleantalk_server',
268
- array(
269
- 'ct_work_url' => null,
270
- 'ct_server_ttl' => 0,
271
- 'ct_server_changed' => 0,
272
- )
273
- );
274
- }
275
-
276
- function apbct_update_to_5_124_0(){
277
- global $apbct;
278
- // Deleting error in database because format were changed
279
- $apbct->errors = array();
280
- $apbct->saveErrors();
281
- }
282
-
283
- function apbct_update_to_5_126_0(){
284
- global $apbct;
285
- // Enable storing URLs
286
- $apbct->settings['store_urls'] = 1;
287
- $apbct->settings['store_urls__sessions'] = 1;
288
- $apbct->saveSettings();
289
- }
290
-
291
- function apbct_update_to_5_127_0(){
292
-
293
- global $apbct;
294
-
295
- // Move exclusions from variable to settins
296
- global $cleantalk_url_exclusions, $cleantalk_key_exclusions;
297
- // URLs
298
- if(!empty($cleantalk_url_exclusions) && is_array($cleantalk_url_exclusions)){
299
- $apbct->settings['exclusions__urls'] = implode(',', $cleantalk_url_exclusions);
300
- if(APBCT_WPMS){
301
- $initial_blog = get_current_blog_id();
302
- switch_to_blog( 1 );
303
- }
304
- $apbct->saveSettings();
305
- if(APBCT_WPMS){
306
- switch_to_blog($initial_blog);
307
- }
308
- }
309
- // Fields
310
- if(!empty($cleantalk_key_exclusions) && is_array($cleantalk_key_exclusions)){
311
- $apbct->settings['exclusions__fields'] = implode(',', $cleantalk_key_exclusions);
312
- if(APBCT_WPMS){
313
- $initial_blog = get_current_blog_id();
314
- switch_to_blog( 1 );
315
- }
316
- $apbct->saveSettings();
317
- if(APBCT_WPMS){
318
- switch_to_blog($initial_blog);
319
- }
320
- }
321
-
322
- // Deleting legacy
323
- if(isset($apbct->data['testing_failed'])){
324
- unset($apbct->data['testing_failed']);
325
- $apbct->saveData();
326
- }
327
-
328
- if(APBCT_WPMS){
329
-
330
- // Whitelabel
331
- // Reset "api_key_is_recieved" flag
332
- global $wpdb;
333
- $initial_blog = get_current_blog_id();
334
- $blogs = array_keys( $wpdb->get_results( 'SELECT blog_id FROM ' . $wpdb->blogs, OBJECT_K ) );
335
- foreach ( $blogs as $blog ){
336
- switch_to_blog( $blog );
337
-
338
- $settings = get_option( 'cleantalk_settings' );
339
- if( isset( $settings['use_static_js_key'] ) ){
340
- $settings['use_static_js_key'] = $settings['use_static_js_key'] === 0
341
- ? - 1
342
- : $settings['use_static_js_key'];
343
- update_option( 'cleantalk_settings', $settings );
344
-
345
- $data = get_option( 'cleantalk_data' );
346
- if( isset( $data['white_label_data']['is_key_recieved'] ) ){
347
- unset( $data['white_label_data']['is_key_recieved'] );
348
- update_option( 'cleantalk_data', $data );
349
- }
350
- }
351
- switch_to_blog( $initial_blog );
352
-
353
- if( defined( 'APBCT_WHITELABEL' ) ){
354
- $apbct->network_settings = array(
355
- 'white_label' => defined( 'APBCT_WHITELABEL' ) && APBCT_WHITELABEL == true ? 1 : 0,
356
- 'white_label__hoster_key' => defined( 'APBCT_HOSTER_API_KEY' ) ? APBCT_HOSTER_API_KEY : '',
357
- 'white_label__plugin_name' => defined( 'APBCT_WHITELABEL_NAME' ) ? APBCT_WHITELABEL_NAME : APBCT_NAME,
358
- );
359
- }elseif( defined( 'CLEANTALK_ACCESS_KEY' ) ){
360
- $apbct->network_settings = array(
361
- 'allow_custom_key' => 0,
362
- 'apikey' => CLEANTALK_ACCESS_KEY,
363
- );
364
- }
365
- $apbct->saveNetworkSettings();
366
- }
367
- }else{
368
- // Switch use_static_js_key to Auto if it was disabled
369
- $apbct->settings['use_static_js_key'] = $apbct->settings['use_static_js_key'] === 0
370
- ? -1
371
- : $apbct->settings['use_static_js_key'];
372
- $apbct->saveSettings();
373
- }
374
- }
375
-
376
- function apbct_update_to_5_127_1(){
377
- if(APBCT_WPMS && is_main_site()){
378
- global $apbct;
379
- $network_settings = get_site_option( 'cleantalk_network_settings' );
380
- if( $network_settings !== false && empty( $network_settings['allow_custom_key'] ) && empty( $network_settings['white_label'] ) ){
381
- $network_settings['allow_custom_key'] = 1;
382
- update_site_option( 'cleantalk_network_settings', $network_settings );
383
- }
384
- if( $network_settings !== false && $network_settings['white_label'] == 1 && $apbct->data['moderate'] == 0 ){
385
- ct_account_status_check( $network_settings['apikey'] ? $network_settings['apikey'] : $apbct->settings['apikey'], false);
386
- }
387
- }
388
- }
389
-
390
- function apbct_update_to_5_128_0(){
391
- global $apbct;
392
- $apbct->remote_calls = array();
393
- $apbct->save('remote_calls');
394
- }
395
-
396
- function apbct_update_to_5_133_0() {
397
-
398
- global $wpdb;
399
-
400
- // Scan comment/user log
401
- $sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_spamscan_logs` (
402
- `id` int(11) NOT NULL AUTO_INCREMENT,
403
- `scan_type` varchar(11) NOT NULL,
404
- `start_time` datetime NOT NULL,
405
- `finish_time` datetime NOT NULL,
406
- `count_to_scan` int(11) DEFAULT NULL,
407
- `found_spam` int(11) DEFAULT NULL,
408
- `found_bad` int(11) DEFAULT NULL,
409
- PRIMARY KEY (`id`));';
410
-
411
- apbct_activation__create_tables($sqls);
412
-
413
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function apbct_run_update_actions($current_version, $new_version){
4
+
5
+ $current_version = apbct_version_standartization($current_version);
6
+ $new_version = apbct_version_standartization($new_version);
7
+
8
+ $current_version_str = implode('.', $current_version);
9
+ $new_version_str = implode('.', $new_version);
10
+
11
+ for($ver_major = $current_version[0]; $ver_major <= $new_version[0]; $ver_major++){
12
+ for($ver_minor = 0; $ver_minor <= 200; $ver_minor++){
13
+ for($ver_fix = 0; $ver_fix <= 10; $ver_fix++){
14
+
15
+ if(version_compare("{$ver_major}.{$ver_minor}.{$ver_fix}", $current_version_str, '<='))
16
+ continue;
17
+
18
+ if(function_exists("apbct_update_to_{$ver_major}_{$ver_minor}_{$ver_fix}")){
19
+ $result = call_user_func("apbct_update_to_{$ver_major}_{$ver_minor}_{$ver_fix}");
20
+ if(!empty($result['error']))
21
+ break;
22
+ }
23
+
24
+ if(version_compare("{$ver_major}.{$ver_minor}.{$ver_fix}", $new_version_str, '>='))
25
+ break(2);
26
+
27
+ }
28
+ }
29
+ }
30
+
31
+ return true;
32
+
33
+ }
34
+
35
+ function apbct_version_standartization($version){
36
+
37
+ $version = explode('.', $version);
38
+ $version = !empty($version) ? $version : array();
39
+
40
+ $version[0] = !empty($version[0]) ? (int)$version[0] : 0;
41
+ $version[1] = !empty($version[1]) ? (int)$version[1] : 0;
42
+ $version[2] = !empty($version[2]) ? (int)$version[2] : 0;
43
+
44
+ return $version;
45
+ }
46
+
47
+ function apbct_update_to_5_50_0(){
48
+ global $wpdb;
49
+ $wpdb->query('CREATE TABLE IF NOT EXISTS `'. APBCT_TBL_FIREWALL_DATA .'` (
50
+ `network` int(11) unsigned NOT NULL,
51
+ `mask` int(11) unsigned NOT NULL,
52
+ INDEX ( `network` , `mask` )
53
+ );');
54
+
55
+ $wpdb->query('CREATE TABLE IF NOT EXISTS `'. APBCT_TBL_FIREWALL_LOG .'` (
56
+ `ip` VARCHAR(15) NOT NULL ,
57
+ `all` INT NOT NULL ,
58
+ `blocked` INT NOT NULL ,
59
+ `timestamp` INT NOT NULL ,
60
+ PRIMARY KEY (`ip`));');
61
+ }
62
+
63
+ function apbct_update_to_5_56_0(){
64
+ if (!wp_next_scheduled('cleantalk_update_sfw_hook'))
65
+ wp_schedule_event(time()+1800, 'daily', 'cleantalk_update_sfw_hook' );
66
+ }
67
+ function apbct_update_to_5_70_0(){
68
+
69
+ global $wpdb;
70
+
71
+ if(!in_array('all_entries', $wpdb->get_col('DESC '. APBCT_TBL_FIREWALL_LOG, 0))){
72
+ $wpdb->query('ALTER TABLE `'. APBCT_TBL_FIREWALL_LOG .'`
73
+ CHANGE `all` `all_entries` INT(11) NOT NULL,
74
+ CHANGE `blocked` `blocked_entries` INT(11) NOT NULL,
75
+ CHANGE `timestamp` `entries_timestamp` INT(11) NOT NULL;'
76
+ );
77
+ }
78
+
79
+ // Deleting usless data
80
+ delete_option('cleantalk_sends_reports_till');
81
+ delete_option('cleantalk_activation_timestamp');
82
+
83
+ // Disabling WP_Cron tasks
84
+ wp_clear_scheduled_hook('cleantalk_send_daily_report_hook');
85
+ wp_clear_scheduled_hook('ct_hourly_event_hook');
86
+ wp_clear_scheduled_hook('ct_send_sfw_log');
87
+ wp_clear_scheduled_hook('cleantalk_update_sfw_hook');
88
+ wp_clear_scheduled_hook('cleantalk_get_brief_data_hook');
89
+
90
+ // Adding Self cron system tasks
91
+ CleantalkCron::addTask('check_account_status', 'ct_account_status_check', 3600, time()+1800); // New
92
+ CleantalkCron::addTask('delete_spam_comments', 'ct_delete_spam_comments', 3600, time()+3500);
93
+ CleantalkCron::addTask('send_feedback', 'ct_send_feedback', 3600, time()+3500);
94
+ CleantalkCron::addTask('sfw_update', 'ct_sfw_update', 86400, time()+43200);
95
+ CleantalkCron::addTask('send_sfw_logs', 'ct_sfw_send_logs', 3600, time()+1800); // New
96
+ CleantalkCron::addTask('get_brief_data', 'cleantalk_get_brief_data', 86400, time()+3500);
97
+ }
98
+ function apbct_update_to_5_74_0(){
99
+ CleantalkCron::removeTask('send_daily_request');
100
+ }
101
+
102
+ function apbct_update_to_5_97_0(){
103
+
104
+ global $apbct;
105
+
106
+ if(count($apbct->data['connection_reports']['negative_report']) >= 20)
107
+ $apbct->data['connection_reports']['negative_report'] = array_slice($apbct->data['connection_reports']['negative_report'], -20, 20);
108
+
109
+ $apbct->saveData();
110
+ }
111
+
112
+ function apbct_update_to_5_109_0(){
113
+
114
+ global $apbct, $wpdb;
115
+
116
+ if(apbct_is_plugin_active_for_network($apbct->base_name) && !defined('CLEANTALK_ACCESS_KEY')){
117
+
118
+ $sfw_data_query = 'CREATE TABLE IF NOT EXISTS `%s` (
119
+ `network` int(11) unsigned NOT NULL,
120
+ `mask` int(11) unsigned NOT NULL,
121
+ INDEX ( `network` , `mask` )
122
+ );';
123
+
124
+ $sfw_log_query = 'CREATE TABLE IF NOT EXISTS `%s` (
125
+ `ip` VARCHAR(15) NOT NULL,
126
+ `all_entries` INT NOT NULL,
127
+ `blocked_entries` INT NOT NULL,
128
+ `entries_timestamp` INT NOT NULL,
129
+ PRIMARY KEY (`ip`));';
130
+
131
+ $initial_blog = get_current_blog_id();
132
+ $blogs = array_keys($wpdb->get_results('SELECT blog_id FROM '. $wpdb->blogs, OBJECT_K));
133
+ foreach ($blogs as $blog) {
134
+ switch_to_blog($blog);
135
+ $wpdb->query(sprintf($sfw_data_query, $wpdb->prefix . 'cleantalk_sfw')); // Table for SpamFireWall data
136
+ $wpdb->query(sprintf($sfw_log_query, $wpdb->prefix . 'cleantalk_sfw_logs')); // Table for SpamFireWall logs
137
+ // Cron tasks
138
+ CleantalkCron::addTask('check_account_status', 'ct_account_status_check', 3600, time()+1800); // Checks account status
139
+ CleantalkCron::addTask('delete_spam_comments', 'ct_delete_spam_comments', 3600, time()+3500); // Formerly ct_hourly_event_hook()
140
+ CleantalkCron::addTask('send_feedback', 'ct_send_feedback', 3600, time()+3500); // Formerly ct_hourly_event_hook()
141
+ CleantalkCron::addTask('sfw_update', 'ct_sfw_update', 86400, time()+300); // SFW update
142
+ CleantalkCron::addTask('send_sfw_logs', 'ct_sfw_send_logs', 3600, time()+1800); // SFW send logs
143
+ CleantalkCron::addTask('get_brief_data', 'cleantalk_get_brief_data', 86400, time()+3500); // Get data for dashboard widget
144
+ CleantalkCron::addTask('send_connection_report','ct_mail_send_connection_report', 86400, time()+3500); // Send connection report to welcome@cleantalk.org
145
+ }
146
+ switch_to_blog($initial_blog);
147
+ }
148
+ }
149
+
150
+ function apbct_update_to_5_110_0(){
151
+ global $apbct;
152
+ unset($apbct->data['last_remote_call']);
153
+ $apbct->saveData;
154
+ $apbct->save('remote_calls');
155
+ }
156
+
157
+ function apbct_update_to_5_115_1(){
158
+ ct_sfw_update();
159
+ }
160
+
161
+ function apbct_update_to_5_116_0(){
162
+
163
+ global $apbct, $wpdb;
164
+
165
+ $apbct->settings['store_urls'] = 0;
166
+ $apbct->settings['store_urls__sessions'] = 0;
167
+ $apbct->saveSettings();
168
+
169
+ $wpdb->query('CREATE TABLE IF NOT EXISTS `'. APBCT_TBL_SESSIONS .'` (
170
+ `id` VARCHAR(64) NOT NULL,
171
+ `name` TEXT NOT NULL,
172
+ `value` TEXT NULL,
173
+ `last_update` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
174
+ PRIMARY KEY (`id`, `name`(10)));'
175
+ );
176
+ }
177
+
178
+ function apbct_update_to_5_116_1(){
179
+
180
+ global $wpdb;
181
+
182
+ $wpdb->query('CREATE TABLE IF NOT EXISTS `'. APBCT_TBL_SESSIONS .'` (
183
+ `id` VARCHAR(64) NOT NULL,
184
+ `name` TEXT NOT NULL,
185
+ `value` TEXT NULL,
186
+ `last_update` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
187
+ PRIMARY KEY (`id`, `name`(10)));'
188
+ );
189
+ }
190
+
191
+ function apbct_update_to_5_116_2(){
192
+
193
+ global $wpdb;
194
+
195
+ $wpdb->query('CREATE TABLE IF NOT EXISTS `'. APBCT_TBL_SESSIONS .'` (
196
+ `id` VARCHAR(64) NOT NULL,
197
+ `name` TEXT NOT NULL,
198
+ `value` TEXT NULL DEFAULT NULL,
199
+ `last_update` DATETIME NULL DEFAULT NULL,
200
+ PRIMARY KEY (`id`, `name`(10)));'
201
+ );
202
+ }
203
+
204
+ function apbct_update_to_5_118_0(){
205
+ global $wpdb;
206
+ $wpdb->query(
207
+ 'DELETE
208
+ FROM `'. APBCT_TBL_SESSIONS .'`
209
+ WHERE last_update < NOW() - INTERVAL '. APBCT_SEESION__LIVE_TIME .' SECOND;'
210
+ );
211
+ delete_option('cleantalk_server');
212
+ }
213
+
214
+ function apbct_update_to_5_118_2(){
215
+ global $apbct;
216
+ $apbct->data['connection_reports'] = $apbct->def_data['connection_reports'];
217
+ $apbct->data['connection_reports']['since'] = date('d M');
218
+ $apbct->saveData();
219
+ }
220
+
221
+ function apbct_update_to_5_119_0(){
222
+
223
+ global $wpdb;
224
+
225
+ $wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->prefix.'cleantalk_sessions`;'); // Deleting session table
226
+
227
+ // SFW data
228
+ $sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sfw` (
229
+ `network` int(11) unsigned NOT NULL,
230
+ `mask` int(11) unsigned NOT NULL,
231
+ INDEX ( `network` , `mask` )
232
+ );';
233
+
234
+ // SFW log
235
+ $sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sfw_logs` (
236
+ `ip` VARCHAR(15) NOT NULL,
237
+ `all_entries` INT NOT NULL,
238
+ `blocked_entries` INT NOT NULL,
239
+ `entries_timestamp` INT NOT NULL,
240
+ PRIMARY KEY (`ip`));';
241
+
242
+ // Sessions
243
+ $sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sessions` (
244
+ `id` VARCHAR(64) NOT NULL,
245
+ `name` VARCHAR(64) NOT NULL,
246
+ `value` TEXT NULL DEFAULT NULL,
247
+ `last_update` DATETIME NULL DEFAULT NULL,
248
+ PRIMARY KEY (`id`(64), `name`(64)));';
249
+
250
+ apbct_activation__create_tables($sqls);
251
+
252
+ // WPMS
253
+ if(is_multisite()){
254
+ global $wpdb;
255
+ $initial_blog = get_current_blog_id();
256
+ $blogs = array_keys($wpdb->get_results('SELECT blog_id FROM '. $wpdb->blogs, OBJECT_K));
257
+ foreach ($blogs as $blog) {
258
+ switch_to_blog($blog);
259
+ $wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->prefix.'cleantalk_sessions`;'); // Deleting session table
260
+ apbct_activation__create_tables($sqls);
261
+ }
262
+ switch_to_blog($initial_blog);
263
+ }
264
+
265
+ // Drop work url
266
+ update_option(
267
+ 'cleantalk_server',
268
+ array(
269
+ 'ct_work_url' => null,
270
+ 'ct_server_ttl' => 0,
271
+ 'ct_server_changed' => 0,
272
+ )
273
+ );
274
+ }
275
+
276
+ function apbct_update_to_5_124_0(){
277
+ global $apbct;
278
+ // Deleting error in database because format were changed
279
+ $apbct->errors = array();
280
+ $apbct->saveErrors();
281
+ }
282
+
283
+ function apbct_update_to_5_126_0(){
284
+ global $apbct;
285
+ // Enable storing URLs
286
+ $apbct->settings['store_urls'] = 1;
287
+ $apbct->settings['store_urls__sessions'] = 1;
288
+ $apbct->saveSettings();
289
+ }
290
+
291
+ function apbct_update_to_5_127_0(){
292
+
293
+ global $apbct;
294
+
295
+ // Move exclusions from variable to settins
296
+ global $cleantalk_url_exclusions, $cleantalk_key_exclusions;
297
+ // URLs
298
+ if(!empty($cleantalk_url_exclusions) && is_array($cleantalk_url_exclusions)){
299
+ $apbct->settings['exclusions__urls'] = implode(',', $cleantalk_url_exclusions);
300
+ if(APBCT_WPMS){
301
+ $initial_blog = get_current_blog_id();
302
+ switch_to_blog( 1 );
303
+ }
304
+ $apbct->saveSettings();
305
+ if(APBCT_WPMS){
306
+ switch_to_blog($initial_blog);
307
+ }
308
+ }
309
+ // Fields
310
+ if(!empty($cleantalk_key_exclusions) && is_array($cleantalk_key_exclusions)){
311
+ $apbct->settings['exclusions__fields'] = implode(',', $cleantalk_key_exclusions);
312
+ if(APBCT_WPMS){
313
+ $initial_blog = get_current_blog_id();
314
+ switch_to_blog( 1 );
315
+ }
316
+ $apbct->saveSettings();
317
+ if(APBCT_WPMS){
318
+ switch_to_blog($initial_blog);
319
+ }
320
+ }
321
+
322
+ // Deleting legacy
323
+ if(isset($apbct->data['testing_failed'])){
324
+ unset($apbct->data['testing_failed']);
325
+ $apbct->saveData();
326
+ }
327
+
328
+ if(APBCT_WPMS){
329
+
330
+ // Whitelabel
331
+ // Reset "api_key_is_recieved" flag
332
+ global $wpdb;
333
+ $initial_blog = get_current_blog_id();
334
+ $blogs = array_keys( $wpdb->get_results( 'SELECT blog_id FROM ' . $wpdb->blogs, OBJECT_K ) );
335
+ foreach ( $blogs as $blog ){
336
+ switch_to_blog( $blog );
337
+
338
+ $settings = get_option( 'cleantalk_settings' );
339
+ if( isset( $settings['use_static_js_key'] ) ){
340
+ $settings['use_static_js_key'] = $settings['use_static_js_key'] === 0
341
+ ? - 1
342
+ : $settings['use_static_js_key'];
343
+ update_option( 'cleantalk_settings', $settings );
344
+
345
+ $data = get_option( 'cleantalk_data' );
346
+ if( isset( $data['white_label_data']['is_key_recieved'] ) ){
347
+ unset( $data['white_label_data']['is_key_recieved'] );
348
+ update_option( 'cleantalk_data', $data );
349
+ }
350
+ }
351
+ switch_to_blog( $initial_blog );
352
+
353
+ if( defined( 'APBCT_WHITELABEL' ) ){
354
+ $apbct->network_settings = array(
355
+ 'white_label' => defined( 'APBCT_WHITELABEL' ) && APBCT_WHITELABEL == true ? 1 : 0,
356
+ 'white_label__hoster_key' => defined( 'APBCT_HOSTER_API_KEY' ) ? APBCT_HOSTER_API_KEY : '',
357
+ 'white_label__plugin_name' => defined( 'APBCT_WHITELABEL_NAME' ) ? APBCT_WHITELABEL_NAME : APBCT_NAME,
358
+ );
359
+ }elseif( defined( 'CLEANTALK_ACCESS_KEY' ) ){
360
+ $apbct->network_settings = array(
361
+ 'allow_custom_key' => 0,
362
+ 'apikey' => CLEANTALK_ACCESS_KEY,
363
+ );
364
+ }
365
+ $apbct->saveNetworkSettings();
366
+ }
367
+ }else{
368
+ // Switch use_static_js_key to Auto if it was disabled
369
+ $apbct->settings['use_static_js_key'] = $apbct->settings['use_static_js_key'] === 0
370
+ ? -1
371
+ : $apbct->settings['use_static_js_key'];
372
+ $apbct->saveSettings();
373
+ }
374
+ }
375
+
376
+ function apbct_update_to_5_127_1(){
377
+ if(APBCT_WPMS && is_main_site()){
378
+ global $apbct;
379
+ $network_settings = get_site_option( 'cleantalk_network_settings' );
380
+ if( $network_settings !== false && empty( $network_settings['allow_custom_key'] ) && empty( $network_settings['white_label'] ) ){
381
+ $network_settings['allow_custom_key'] = 1;
382
+ update_site_option( 'cleantalk_network_settings', $network_settings );
383
+ }
384
+ if( $network_settings !== false && $network_settings['white_label'] == 1 && $apbct->data['moderate'] == 0 ){
385
+ ct_account_status_check( $network_settings['apikey'] ? $network_settings['apikey'] : $apbct->settings['apikey'], false);
386
+ }
387
+ }
388
+ }
389
+
390
+ function apbct_update_to_5_128_0(){
391
+ global $apbct;
392
+ $apbct->remote_calls = array();
393
+ $apbct->save('remote_calls');
394
+ }
395
+
396
+ function apbct_update_to_5_133_0() {
397
+
398
+ global $wpdb;
399
+
400
+ // Scan comment/user log
401
+ $sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_spamscan_logs` (
402
+ `id` int(11) NOT NULL AUTO_INCREMENT,
403
+ `scan_type` varchar(11) NOT NULL,
404
+ `start_time` datetime NOT NULL,
405
+ `finish_time` datetime NOT NULL,
406
+ `count_to_scan` int(11) DEFAULT NULL,
407
+ `found_spam` int(11) DEFAULT NULL,
408
+ `found_bad` int(11) DEFAULT NULL,
409
+ PRIMARY KEY (`id`));';
410
+
411
+ apbct_activation__create_tables($sqls);
412
+
413
+ }
414
+
415
+ function apbct_update_to_5_137_1() {
416
+
417
+ global $apbct;
418
+
419
+ if( APBCT_WPMS && $apbct->white_label ) {
420
+
421
+ $initial_blog = get_current_blog_id();
422
+
423
+ if ( $initial_blog !== 1 && $apbct->settings[''] ) {
424
+
425
+ $allow_custom_settings = $apbct->network_settings['allow_custom_settings'];
426
+ $apbct->network_settings['allow_custom_settings'] = 1;
427
+
428
+ switch_to_blog( 1 );
429
+ $main_blog_settings = get_option( 'cleantalk_settings' );
430
+ switch_to_blog( $initial_blog );
431
+
432
+ update_option( 'cleantalk_settings', $main_blog_settings );
433
+
434
+ $apbct->network_settings['allow_custom_settings'] = $allow_custom_settings;
435
+
436
+ }
437
+ }
438
+ }
inc/sfw_die_page.html CHANGED
@@ -94,6 +94,7 @@
94
  <div id='js_passed'>
95
  <h3>{SFW_DIE_CLICK_TO_PASS}</h3>
96
  <a href='{REQUEST_URI}'><script>get_current_url();</script></a>
 
97
  <p class='js_notice'>{SFW_DIE_YOU_WILL_BE_REDIRECTED}</p>
98
  <br />
99
  <div class="spinner">
94
  <div id='js_passed'>
95
  <h3>{SFW_DIE_CLICK_TO_PASS}</h3>
96
  <a href='{REQUEST_URI}'><script>get_current_url();</script></a>
97
+ <br />
98
  <p class='js_notice'>{SFW_DIE_YOU_WILL_BE_REDIRECTED}</p>
99
  <br />
100
  <div class="spinner">
lib/Cleantalk/Antispam/Integrations.php CHANGED
@@ -25,7 +25,7 @@ class Integrations
25
  }
26
  }
27
 
28
- public function checkSpam()
29
  {
30
  global $cleantalk_executed;
31
 
@@ -42,7 +42,7 @@ class Integrations
42
  return;
43
  }
44
  // Run data collecting for spam checking
45
- $data = $this->integration->getDataForChecking();
46
  if( ! is_null( $data ) ) {
47
  // Go spam checking
48
  $base_call_result = apbct_base_call(
25
  }
26
  }
27
 
28
+ public function checkSpam( $argument )
29
  {
30
  global $cleantalk_executed;
31
 
42
  return;
43
  }
44
  // Run data collecting for spam checking
45
+ $data = $this->integration->getDataForChecking( $argument );
46
  if( ! is_null( $data ) ) {
47
  // Go spam checking
48
  $base_call_result = apbct_base_call(
lib/Cleantalk/Antispam/Integrations/ContactBank.php CHANGED
@@ -7,7 +7,7 @@ namespace Cleantalk\Antispam\Integrations;
7
  class ContactBank extends IntegrationBase
8
  {
9
 
10
- function getDataForChecking()
11
  {
12
  if( isset( $_REQUEST['param'] ) ) {
13
  parse_str( isset( $_REQUEST['data'] ) ? base64_decode( $_REQUEST['data'] ) : '', $form_data );
7
  class ContactBank extends IntegrationBase
8
  {
9
 
10
+ function getDataForChecking( $argument )
11
  {
12
  if( isset( $_REQUEST['param'] ) ) {
13
  parse_str( isset( $_REQUEST['data'] ) ? base64_decode( $_REQUEST['data'] ) : '', $form_data );
lib/Cleantalk/Antispam/Integrations/ElfsightContactForm.php CHANGED
@@ -1,23 +1,23 @@
1
- <?php
2
-
3
-
4
- namespace Cleantalk\Antispam\Integrations;
5
-
6
-
7
- class ElfsightContactForm extends IntegrationBase
8
- {
9
-
10
- function getDataForChecking()
11
- {
12
- if( isset( $_POST ) && isset( $_POST['fields'] ) ) {
13
- return ct_get_fields_any( $_POST['fields'] );
14
- }
15
- return null;
16
- }
17
-
18
- function doBlock( $message )
19
- {
20
- header( 'Content-type: application/json; charset=utf-8' );
21
- exit( json_encode( array( 400, $message ) ) );
22
- }
23
  }
1
+ <?php
2
+
3
+
4
+ namespace Cleantalk\Antispam\Integrations;
5
+
6
+
7
+ class ElfsightContactForm extends IntegrationBase
8
+ {
9
+
10
+ function getDataForChecking( $argument )
11
+ {
12
+ if( isset( $_POST ) && isset( $_POST['fields'] ) ) {
13
+ return ct_get_fields_any( $_POST['fields'] );
14
+ }
15
+ return null;
16
+ }
17
+
18
+ function doBlock( $message )
19
+ {
20
+ header( 'Content-type: application/json; charset=utf-8' );
21
+ exit( json_encode( array( 400, $message ) ) );
22
+ }
23
  }
lib/Cleantalk/Antispam/Integrations/FluentForm.php CHANGED
@@ -7,7 +7,7 @@ namespace Cleantalk\Antispam\Integrations;
7
  class FluentForm extends IntegrationBase
8
  {
9
 
10
- function getDataForChecking()
11
  {
12
  if( isset( $_POST['data'] ) ) {
13
  parse_str( $_POST['data'], $form_data );
7
  class FluentForm extends IntegrationBase
8
  {
9
 
10
+ function getDataForChecking( $argument )
11
  {
12
  if( isset( $_POST['data'] ) ) {
13
  parse_str( $_POST['data'], $form_data );
lib/Cleantalk/Antispam/Integrations/IntegrationBase.php CHANGED
@@ -6,6 +6,6 @@ namespace Cleantalk\Antispam\Integrations;
6
 
7
  abstract class IntegrationBase
8
  {
9
- abstract function getDataForChecking();
10
  abstract function doBlock( $message );
11
  }
6
 
7
  abstract class IntegrationBase
8
  {
9
+ abstract function getDataForChecking( $argument );
10
  abstract function doBlock( $message );
11
  }
lib/Cleantalk/Antispam/Integrations/SimpleMembership.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ namespace Cleantalk\Antispam\Integrations;
5
+
6
+
7
+ class SimpleMembership extends IntegrationBase
8
+ {
9
+
10
+ protected $member_info = array();
11
+
12
+ function getDataForChecking( $member_info )
13
+ {
14
+ $this->member_info = $member_info;
15
+
16
+ return(
17
+ array(
18
+ 'email' => $member_info['email'],
19
+ 'nickname' => $member_info['user_name'],
20
+ )
21
+ );
22
+ }
23
+
24
+ function doBlock( $message )
25
+ {
26
+ global $ct_comment;
27
+ $ct_comment = $message;
28
+
29
+ if( class_exists( 'SwpmMemberUtils' ) ) {
30
+ // Doing inactive user status after blocking.
31
+ $member = \SwpmMemberUtils::get_user_by_email( $this->member_info['email'] );
32
+ $member_id = $member->member_id;
33
+ \SwpmMemberUtils::update_account_state( $member_id, 'inactive' );
34
+ }
35
+
36
+ ct_die(null, null);
37
+ }
38
+ }
lib/Cleantalk/Antispam/SFW.php CHANGED
@@ -115,7 +115,7 @@ class SFW
115
  foreach($this->ip_array as $origin => $current_ip){
116
 
117
  $current_ip_v4 = sprintf("%u", ip2long($current_ip));
118
- for ( $needles = array(), $m = 15; $m <= 32; $m ++ ) {
119
  $mask = sprintf( "%u", ip2long( long2ip( - 1 << ( 32 - (int) $m ) ) ) );
120
  $needles[] = bindec( decbin( $mask ) & decbin( $current_ip_v4 ) );
121
  }
115
  foreach($this->ip_array as $origin => $current_ip){
116
 
117
  $current_ip_v4 = sprintf("%u", ip2long($current_ip));
118
+ for ( $needles = array(), $m = 6; $m <= 32; $m ++ ) {
119
  $mask = sprintf( "%u", ip2long( long2ip( - 1 << ( 32 - (int) $m ) ) ) );
120
  $needles[] = bindec( decbin( $mask ) & decbin( $current_ip_v4 ) );
121
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: spam, antispam, woocommerce, comments, firewall
4
  Requires at least: 3.0
5
  Tested up to: 5.4
6
  Requires PHP: 5.4
7
- Stable tag: 5.137
8
  License: GPLv2
9
 
10
  Spam protection, anti-spam, firewall, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
@@ -393,7 +393,7 @@ the comments will be passed, because the plugin detects sender as a human. So, u
393
  = Is it free or paid? =
394
  The plugin is free and distributed under the GPLv2 license.
395
 
396
- CleanTalk anti-spam plugin works with a cloud base anti-spam service and this plugin is a Software as a service (SaaS).
397
  CleanTalk it’s a free plugin that works with premium Cloud Anti-Spam service.
398
  https://en.wikipedia.org/wiki/Software_as_a_service
399
 
@@ -574,6 +574,14 @@ If your website has forms that send data to external sources, you can enable opt
574
 
575
  == Changelog ==
576
 
 
 
 
 
 
 
 
 
577
  = 5.137 April 23 2020 =
578
  * Fix: WPMU and WhiteLabel mode fixed.
579
  * Fix: 403 Response code for blocked entries.
4
  Requires at least: 3.0
5
  Tested up to: 5.4
6
  Requires PHP: 5.4
7
+ Stable tag: 5.137.1
8
  License: GPLv2
9
 
10
  Spam protection, anti-spam, firewall, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
393
  = Is it free or paid? =
394
  The plugin is free and distributed under the GPLv2 license.
395
 
396
+ CleanTalk anti-spam plugin works with a cloud base anti-spam service and this plugin is a Software as a service (SaaS).
397
  CleanTalk it’s a free plugin that works with premium Cloud Anti-Spam service.
398
  https://en.wikipedia.org/wiki/Software_as_a_service
399
 
574
 
575
  == Changelog ==
576
 
577
+ = 5.137.1 April 29 2020 =
578
+ * Fix: Call to undefined function wp_get_current_user().
579
+ * Fix: "Capture buffer" setting, YOAST sitemap.
580
+ * Integration: Simple Membership plugin integration implemented.
581
+ * Fix: Integrations system fixed.
582
+ * Fix: Query for SFW fixed.
583
+ * Fix: SFW error handling.
584
+
585
  = 5.137 April 23 2020 =
586
  * Fix: WPMU and WhiteLabel mode fixed.
587
  * Fix: 403 Response code for blocked entries.