Spam protection, AntiSpam, FireWall by CleanTalk - Version 5.82

Version Description

December 4 2017 = * Plugin doesn't use PHP sessions anymore. * Bug fixes. * Improved update logic.

Download this release

Release Info

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

Code changes from version 5.81 to 5.82

cleantalk.php CHANGED
@@ -3,13 +3,13 @@
3
  Plugin Name: Anti-Spam by CleanTalk
4
  Plugin URI: http://cleantalk.org
5
  Description: Max power, all-in-one, no Captcha, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms. Formerly Anti-Spam by CleanTalk.
6
- Version: 5.81
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
10
 
11
- $cleantalk_plugin_version='5.81';
12
- $ct_agent_version = 'wordpress-581';
13
  $cleantalk_executed = false;
14
 
15
  define('CLEANTALK_REMOTE_CALL_SLEEP', 10); // Minimum time between remote call
@@ -45,7 +45,8 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
45
  //Delete cookie for admin trial notice
46
  add_action('wp_logout', 'ct_wp_logout');
47
 
48
- add_action('template_redirect','apbct_cookie', 2);
 
49
 
50
  // Early checks
51
  // Facebook
@@ -378,7 +379,6 @@ function apbct_activation() {
378
 
379
  // Additional options
380
  add_option('ct_plugin_do_activation_redirect', true);
381
- add_option('ct_installing', true);
382
 
383
  // Updating SFW
384
  ct_sfw_update();
@@ -554,9 +554,16 @@ function ct_send_daily_request(){
554
  */
555
  function apbct_cookie(){
556
 
557
- global $ct_options;
 
558
  $ct_options=ct_get_options();
559
 
 
 
 
 
 
 
560
  // Cookie names to validate
561
  $cookie_test_value = array(
562
  'cookies_names' => array(),
@@ -564,11 +571,13 @@ function apbct_cookie(){
564
  );
565
 
566
  // Submit time
567
- $apbct_timestamp = time();
568
- setcookie('apbct_timestamp', $apbct_timestamp, 0, '/');
569
- $cookie_test_value['cookies_names'][] = 'apbct_timestamp';
570
- $cookie_test_value['check_value'] .= $apbct_timestamp;
571
-
 
 
572
  // Pervious referer
573
  if(!empty($_SERVER['HTTP_REFERER'])){
574
  setcookie('apbct_prev_referer', $_SERVER['HTTP_REFERER'], 0, '/');
@@ -580,15 +589,24 @@ function apbct_cookie(){
580
  if(isset($_COOKIE['apbct_site_landing_ts'])){
581
  $site_landing_timestamp = $_COOKIE['apbct_site_landing_ts'];
582
  }else{
583
- $site_landing_timestamp = $apbct_timestamp;
584
- setcookie('apbct_site_landing_ts', $apbct_timestamp, 0, '/');
585
  }
586
  $cookie_test_value['cookies_names'][] = 'apbct_site_landing_ts';
587
  $cookie_test_value['check_value'] .= $site_landing_timestamp;
588
 
 
 
 
 
 
 
589
  // Cookies test
590
  $cookie_test_value['check_value'] = md5($cookie_test_value['check_value']);
591
  setcookie('apbct_cookies_test', json_encode($cookie_test_value), 0, '/');
 
 
 
592
  }
593
 
594
  /**
@@ -627,11 +645,7 @@ function apbct_cookies_test()
627
  */
628
  function apbct_get_submit_time()
629
  {
630
- if(apbct_cookies_test() == 1){
631
- return time() - $_COOKIE['apbct_timestamp'];
632
- }else{
633
- return null;
634
- }
635
  }
636
 
637
  /*
3
  Plugin Name: Anti-Spam by CleanTalk
4
  Plugin URI: http://cleantalk.org
5
  Description: Max power, all-in-one, no Captcha, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms. Formerly Anti-Spam by CleanTalk.
6
+ Version: 5.82
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
10
 
11
+ $cleantalk_plugin_version='5.82';
12
+ $ct_agent_version = 'wordpress-582';
13
  $cleantalk_executed = false;
14
 
15
  define('CLEANTALK_REMOTE_CALL_SLEEP', 10); // Minimum time between remote call
45
  //Delete cookie for admin trial notice
46
  add_action('wp_logout', 'ct_wp_logout');
47
 
48
+ if (!(defined( 'DOING_AJAX' ) && DOING_AJAX))
49
+ add_action('template_redirect','apbct_cookie', 2);
50
 
51
  // Early checks
52
  // Facebook
379
 
380
  // Additional options
381
  add_option('ct_plugin_do_activation_redirect', true);
 
382
 
383
  // Updating SFW
384
  ct_sfw_update();
554
  */
555
  function apbct_cookie(){
556
 
557
+ global $ct_options, $ct_page_timer_setuped;
558
+
559
  $ct_options=ct_get_options();
560
 
561
+ if(
562
+ empty($ct_options['set_cookies']) || // Do not set cookies if option is disabled (for Varnish cache).
563
+ !empty($ct_page_timer_setuped) // Cookies already set
564
+ )
565
+ return false;
566
+
567
  // Cookie names to validate
568
  $cookie_test_value = array(
569
  'cookies_names' => array(),
571
  );
572
 
573
  // Submit time
574
+ if(empty($_POST['ct_multipage_form'])){ // Do not start reset page timer if it is multipage form (Gravitiy forms))
575
+ $apbct_timestamp = time();
576
+ setcookie('apbct_timestamp', $apbct_timestamp, 0, '/');
577
+ $cookie_test_value['cookies_names'][] = 'apbct_timestamp';
578
+ $cookie_test_value['check_value'] .= $apbct_timestamp;
579
+ }
580
+
581
  // Pervious referer
582
  if(!empty($_SERVER['HTTP_REFERER'])){
583
  setcookie('apbct_prev_referer', $_SERVER['HTTP_REFERER'], 0, '/');
589
  if(isset($_COOKIE['apbct_site_landing_ts'])){
590
  $site_landing_timestamp = $_COOKIE['apbct_site_landing_ts'];
591
  }else{
592
+ $site_landing_timestamp = time();
593
+ setcookie('apbct_site_landing_ts', $site_landing_timestamp, 0, '/');
594
  }
595
  $cookie_test_value['cookies_names'][] = 'apbct_site_landing_ts';
596
  $cookie_test_value['check_value'] .= $site_landing_timestamp;
597
 
598
+ // Page hits
599
+ $page_hits = isset($_COOKIE['apbct_page_hits']) && apbct_cookies_test() ? $_COOKIE['apbct_page_hits'] + 1 : 1;
600
+ setcookie('apbct_page_hits', $page_hits, 0, '/');
601
+ $cookie_test_value['cookies_names'][] = 'apbct_page_hits';
602
+ $cookie_test_value['check_value'] .= $page_hits;
603
+
604
  // Cookies test
605
  $cookie_test_value['check_value'] = md5($cookie_test_value['check_value']);
606
  setcookie('apbct_cookies_test', json_encode($cookie_test_value), 0, '/');
607
+
608
+ $ct_page_timer_setuped = true; // Global. Not to set cookies twice.
609
+
610
  }
611
 
612
  /**
645
  */
646
  function apbct_get_submit_time()
647
  {
648
+ return apbct_cookies_test() == 1 ? time() - $_COOKIE['apbct_timestamp'] : null;
 
 
 
 
649
  }
650
 
651
  /*
{assets/css → css}/cleantalk-admin-settings-page.css RENAMED
File without changes
{assets/css → css}/cleantalk-admin.css RENAMED
File without changes
{assets/css → css}/cleantalk-dashboard-widget.css RENAMED
File without changes
{assets/css → css}/cleantalk-public.css RENAMED
File without changes
{assets/css → css}/cleantalk-spam-check.css RENAMED
File without changes
i18n/cleantalk-ru_RU.mo CHANGED
Binary file
inc/cleantalk-admin.php CHANGED
@@ -161,7 +161,7 @@ function ct_dashboard_statistics_widget_output( $post, $callback_args ) {
161
  <a href='https://cleantalk.org/my/?user_token=".@$ct_data['user_token']."&utm_source=wp-backend&utm_medium=dashboard_widget&cp_mode=antispam' target='_blank'>CleanTalk</a> ";
162
  printf(
163
  /* translators: %s: Number of spam messages */
164
- __( 'has blocked %s spam. The statistics is automatically updated every 24 hours.', 'cleantalk' ),
165
  $blocked
166
  );
167
  print "</span><br><br>".sprintf(__('%sDo you like CleanTalk? %sPost your feedback here%s', 'cleantalk'), '<b style=\'font-size: 16px;\'>', '<u><a href=\'https://wordpress.org/support/plugin/cleantalk-spam-protect/reviews/#new-post\' target=\'_blank\'>', '</a></u>.</b>')."</div>";
@@ -197,8 +197,8 @@ function apbct_enqueue_scripts($hook) {
197
  global $cleantalk_plugin_version, $ct_data, $ct_options;
198
 
199
  // Scripts to all admin pages
200
- wp_enqueue_script('ct_admin_js_notices', plugins_url('/cleantalk-spam-protect/assets/js/cleantalk-admin.js'), array(), $cleantalk_plugin_version);
201
- wp_enqueue_style ('ct_admin_css', plugins_url('/cleantalk-spam-protect/assets/css/cleantalk-admin.css'), array(), $cleantalk_plugin_version, 'all');
202
 
203
  wp_localize_script( 'jquery', 'ctAdminCommon', array(
204
  'logo_small_colored' => '<img src="' . plugin_dir_url(__FILE__) . 'images/logo_color.png" alt="" height="" style="width: 17px; vertical-align: text-bottom;" />'
@@ -206,15 +206,15 @@ function apbct_enqueue_scripts($hook) {
206
 
207
  // Scripts & Styles to main dashboard page
208
  if($hook == 'index.php' && current_user_can('activate_plugins')){
209
- wp_enqueue_script('ct_gstatic_charts_loader', 'https://www.gstatic.com/charts/loader.js', array(), $cleantalk_plugin_version);
210
- wp_enqueue_script('ct_admin_js_widget_dashboard', plugins_url('/cleantalk-spam-protect/assets/js/cleantalk-dashboard-widget.js'), array('ct_gstatic_charts_loader'), $cleantalk_plugin_version);
211
- wp_enqueue_style('ct_admin_css_widget_dashboard', plugins_url('/cleantalk-spam-protect/assets/css/cleantalk-dashboard-widget.css'), array(), $cleantalk_plugin_version, 'all');
212
  }
213
 
214
  // Scripts & Styles for CleanTalk's settings page
215
  if( $hook == 'settings_page_cleantalk' ){
216
- wp_enqueue_script('cleantalk_admin_js_settings_page', plugins_url('/cleantalk-spam-protect/assets/js/cleantalk-admin-settings-page.js'), array(), $cleantalk_plugin_version);
217
- wp_enqueue_style('cleantalk_admin_css_settings_page', plugins_url().'/cleantalk-spam-protect/assets/css/cleantalk-admin-settings-page.css', array(), $cleantalk_plugin_version, 'all');
218
 
219
  $ajax_nonce = wp_create_nonce( "ct_secret_nonce" );
220
  wp_localize_script( 'jquery', 'ctSettingsPage', array(
@@ -225,8 +225,8 @@ function apbct_enqueue_scripts($hook) {
225
  // Scripts for comments check
226
  if( $hook == 'comments_page_ct_check_spam' || $hook == 'edit-comments.php'){
227
 
228
- wp_enqueue_style('cleantalk_admin_css_settings_page', plugins_url().'/cleantalk-spam-protect/assets/css/cleantalk-spam-check.css', array(), $cleantalk_plugin_version, 'all');
229
- wp_enqueue_style('jqueryui_css', plugins_url().'/cleantalk-spam-protect/assets/js/jquery-ui.min.css', array(), '1.21.1', 'all');
230
 
231
  $ajax_nonce = wp_create_nonce( "ct_secret_nonce" );
232
  $user_token = !empty($ct_data['user_token']) ? $ct_data['user_token'] : '';
@@ -234,9 +234,9 @@ function apbct_enqueue_scripts($hook) {
234
  if(!empty($_COOKIE['ct_paused_comments_check']))
235
  $prev_check = json_decode(stripslashes($_COOKIE['ct_paused_comments_check']), true);
236
 
237
- wp_enqueue_script('ct_comments_checkspam', plugins_url('/cleantalk-spam-protect/assets/js/cleantalk-comments-checkspam.js'), array(), $cleantalk_plugin_version);
238
- wp_enqueue_script('ct_comments_editscreen', plugins_url('/cleantalk-spam-protect/assets/js/cleantalk-comments-editscreen.js'), array(), $cleantalk_plugin_version);
239
- wp_enqueue_script('jqueryui', plugins_url('/cleantalk-spam-protect/assets/js/jquery-ui.min.js'), array('jquery'), '1.12.1');
240
 
241
  wp_localize_script( 'jquery', 'ctCommentsCheck', array(
242
  'ct_ajax_nonce' => $ajax_nonce,
@@ -268,8 +268,8 @@ function apbct_enqueue_scripts($hook) {
268
  // Scripts for users check
269
  if( $hook == 'users_page_ct_check_users' || $hook == 'users.php'){
270
 
271
- wp_enqueue_style('cleantalk_admin_css_settings_page', plugins_url().'/cleantalk-spam-protect/assets/css/cleantalk-spam-check.css', array(), $cleantalk_plugin_version, 'all');
272
- wp_enqueue_style('jqueryui_css', plugins_url().'/cleantalk-spam-protect/assets/js/jquery-ui.min.css', array(), '1.21.1', 'all');
273
 
274
  $current_user = wp_get_current_user();
275
  $ajax_nonce = wp_create_nonce( "ct_secret_nonce" );
@@ -277,9 +277,9 @@ function apbct_enqueue_scripts($hook) {
277
  if(!empty($_COOKIE['ct_paused_users_check']))
278
  $prev_check = json_decode(stripslashes($_COOKIE['ct_paused_users_check']), true);
279
 
280
- wp_enqueue_script('ct_users_checkspam', plugins_url('/cleantalk-spam-protect/assets/js/cleantalk-users-checkspam.js'), array(), $cleantalk_plugin_version);
281
- wp_enqueue_script('ct_users_editscreen', plugins_url('/cleantalk-spam-protect/assets/js/cleantalk-users-editscreen.js'), array(), $cleantalk_plugin_version);
282
- wp_enqueue_script('jqueryui', plugins_url('/cleantalk-spam-protect/assets/js/jquery-ui.min.js'), array('jquery'), '1.12.1');
283
 
284
  wp_localize_script( 'jquery', 'ctUsersCheck', array(
285
  'ct_ajax_nonce' => $ajax_nonce,
@@ -299,7 +299,7 @@ function apbct_enqueue_scripts($hook) {
299
  'ct_status_string_warning' => "<p>".__("Please do backup of WordPress database before delete any accounts!", 'cleantalk')."</p>"
300
  ));
301
  wp_localize_script( 'jquery', 'ctUsersScreen', array(
302
- 'spambutton_text' => __("Find spam-users", 'cleantalk'),
303
  'ct_show_check_links' => $show_check_links,
304
  'ct_img_src_new_tab' => plugin_dir_url(__FILE__)."images/new_window.gif"
305
  ));
@@ -330,60 +330,67 @@ function ct_account_status_check(){
330
  $ct_options = ct_get_options();
331
  $ct_data = ct_get_data();
332
 
333
- $api_key = isset($_POST['cleantalk_settings']['apikey']) ? $_POST['cleantalk_settings']['apikey'] : $ct_options['apikey'];
 
 
 
 
334
 
335
- if(!function_exists('noticePaidTill'))
336
- require_once('cleantalk.class.php');
337
 
338
- $result = noticePaidTill($api_key);
339
-
340
- if ($result){
341
-
342
- $result = json_decode($result, true);
343
 
344
- if (isset($result['data']) && is_array($result['data']))
345
- $result = $result['data'];
 
 
 
 
 
 
346
 
347
- if(isset($result['spam_count']))
348
- $ct_data['admin_blocked'] = $result['spam_count'];
349
 
350
- if (isset($result['show_notice'])){
351
-
352
- if ($result['show_notice'] == 1 && isset($result['trial']) && $result['trial'] == 1){
353
- CleantalkCron::updateTask('check_account_status', 'ct_account_status_check', 3600);
354
- $show_ct_notice_trial = true;
355
- $ct_data['show_ct_notice_trial']=1;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
356
  }
357
 
358
- if ($result['show_notice'] == 1 && isset($result['renew']) && $result['renew'] == 1){
359
- CleantalkCron::updateTask('check_account_status', 'ct_account_status_check', 1800);
360
- $show_ct_notice_renew = true;
361
- $ct_data['show_ct_notice_renew']=1;
 
 
362
  }
363
 
364
- if (isset($result['show_review']) && $result['show_review'] == 1)
365
- $ct_data['show_ct_notice_review'] = 1;
366
-
367
- if ($result['show_notice'] == 0)
368
- CleantalkCron::updateTask('check_account_status', 'ct_account_status_check', 86400);
369
 
370
- $ct_data['show_ct_notice_trial'] = (int) $show_ct_notice_trial;
371
- $ct_data['show_ct_notice_renew'] = (int) $show_ct_notice_renew;
372
- }
373
-
374
- if (isset($result['moderate_ip']) && $result['moderate_ip'] == 1){
375
- $ct_data['moderate_ip'] = 1;
376
- $ct_data['ip_license'] = $result['ip_license'];
377
- }else{
378
- $ct_data['moderate_ip'] = 0;
379
- $ct_data['ip_license'] = 0;
380
  }
381
-
382
- if (isset($result['user_token']))
383
- $ct_data['user_token'] = $result['user_token'];
384
-
385
- update_option('cleantalk_data', $ct_data);
386
-
387
  }
388
  }
389
 
@@ -397,28 +404,20 @@ function apbct_admin_init(){
397
  $ct_options = ct_get_options();
398
  $ct_data = ct_get_data();
399
 
400
- //Update logic
401
- $is_installing = get_option('ct_installing');
402
- if($is_installing){
403
- delete_option('ct_installing');
404
- $ct_data['plugin_version'] = $cleantalk_plugin_version;
405
- ct_account_status_check(); // Initilazing Notice_paid_till
406
- update_option( 'cleantalk_data' , $ct_data);
407
- }else{
408
- $current_version = (isset($ct_data['plugin_version']) ? $ct_data['plugin_version'] : '1.0.0');
409
- $start_version = (!empty($ct_data['start_version']) ? $ct_data['start_version'] : $current_version);
410
- if($current_version != $cleantalk_plugin_version){
411
- if(is_main_site()){
412
- require_once('cleantalk-updater.php');
413
- $result = ct_run_update_actions($current_version, $cleantalk_plugin_version, $start_version);
414
- //If update is successfull
415
- if($result === true){
416
- ct_send_feedback(
417
- '0:' . $ct_agent_version // 0 - request_id, agent version.
418
- );
419
- $ct_data['plugin_version'] = $cleantalk_plugin_version;
420
- update_option( 'cleantalk_data' , $ct_data);
421
- }
422
  }
423
  }
424
  }
@@ -517,8 +516,6 @@ function apbct_admin_init(){
517
  $show_ct_notice_online = 'Y';
518
  }
519
  }
520
-
521
- //ct_init_session();
522
 
523
  if(stripos($_SERVER['REQUEST_URI'],'options.php')!==false || stripos($_SERVER['REQUEST_URI'],'options-general.php')!==false || stripos($_SERVER['REQUEST_URI'],'network/settings.php')!==false)
524
  {
@@ -1907,7 +1904,7 @@ function ct_delete_user($user_id, $reassign = null){
1907
 
1908
  $hash = get_user_meta($user_id, 'ct_hash', true);
1909
  if ($hash !== '') {
1910
- ct_feedback($hash, null, 0);
1911
  }
1912
  }
1913
 
161
  <a href='https://cleantalk.org/my/?user_token=".@$ct_data['user_token']."&utm_source=wp-backend&utm_medium=dashboard_widget&cp_mode=antispam' target='_blank'>CleanTalk</a> ";
162
  printf(
163
  /* translators: %s: Number of spam messages */
164
+ __( 'has blocked %s spam. The statistics are automatically updated every 24 hours.', 'cleantalk' ),
165
  $blocked
166
  );
167
  print "</span><br><br>".sprintf(__('%sDo you like CleanTalk? %sPost your feedback here%s', 'cleantalk'), '<b style=\'font-size: 16px;\'>', '<u><a href=\'https://wordpress.org/support/plugin/cleantalk-spam-protect/reviews/#new-post\' target=\'_blank\'>', '</a></u>.</b>')."</div>";
197
  global $cleantalk_plugin_version, $ct_data, $ct_options;
198
 
199
  // Scripts to all admin pages
200
+ wp_enqueue_script('ct_admin_js_notices', plugins_url('/cleantalk-spam-protect/js/cleantalk-admin.js'), array(), $cleantalk_plugin_version);
201
+ wp_enqueue_style ('ct_admin_css', plugins_url('/cleantalk-spam-protect/css/cleantalk-admin.css'), array(), $cleantalk_plugin_version, 'all');
202
 
203
  wp_localize_script( 'jquery', 'ctAdminCommon', array(
204
  'logo_small_colored' => '<img src="' . plugin_dir_url(__FILE__) . 'images/logo_color.png" alt="" height="" style="width: 17px; vertical-align: text-bottom;" />'
206
 
207
  // Scripts & Styles to main dashboard page
208
  if($hook == 'index.php' && current_user_can('activate_plugins')){
209
+ wp_enqueue_script('ct_gstatic_charts_loader', 'https://www.gstatic.com/charts/loader.js', array(), $cleantalk_plugin_version);
210
+ wp_enqueue_script('ct_admin_js_widget_dashboard', plugins_url('/cleantalk-spam-protect/js/cleantalk-dashboard-widget.js'), array('ct_gstatic_charts_loader'), $cleantalk_plugin_version);
211
+ wp_enqueue_style('ct_admin_css_widget_dashboard', plugins_url('/cleantalk-spam-protect/css/cleantalk-dashboard-widget.css'), array(), $cleantalk_plugin_version, 'all');
212
  }
213
 
214
  // Scripts & Styles for CleanTalk's settings page
215
  if( $hook == 'settings_page_cleantalk' ){
216
+ wp_enqueue_script('cleantalk_admin_js_settings_page', plugins_url('/cleantalk-spam-protect/js/cleantalk-admin-settings-page.js'), array(), $cleantalk_plugin_version);
217
+ wp_enqueue_style('cleantalk_admin_css_settings_page', plugins_url('/cleantalk-spam-protect/css/cleantalk-admin-settings-page.css'), array(), $cleantalk_plugin_version, 'all');
218
 
219
  $ajax_nonce = wp_create_nonce( "ct_secret_nonce" );
220
  wp_localize_script( 'jquery', 'ctSettingsPage', array(
225
  // Scripts for comments check
226
  if( $hook == 'comments_page_ct_check_spam' || $hook == 'edit-comments.php'){
227
 
228
+ wp_enqueue_style('cleantalk_admin_css_settings_page', plugins_url('/cleantalk-spam-protect/css/cleantalk-spam-check.css'), array(), $cleantalk_plugin_version, 'all');
229
+ wp_enqueue_style('jqueryui_css', plugins_url('/cleantalk-spam-protect/js/jquery-ui.min.css'), array(), '1.21.1', 'all');
230
 
231
  $ajax_nonce = wp_create_nonce( "ct_secret_nonce" );
232
  $user_token = !empty($ct_data['user_token']) ? $ct_data['user_token'] : '';
234
  if(!empty($_COOKIE['ct_paused_comments_check']))
235
  $prev_check = json_decode(stripslashes($_COOKIE['ct_paused_comments_check']), true);
236
 
237
+ wp_enqueue_script('ct_comments_checkspam', plugins_url('/cleantalk-spam-protect/js/cleantalk-comments-checkspam.js'), array(), $cleantalk_plugin_version);
238
+ wp_enqueue_script('ct_comments_editscreen', plugins_url('/cleantalk-spam-protect/js/cleantalk-comments-editscreen.js'), array(), $cleantalk_plugin_version);
239
+ wp_enqueue_script('jqueryui', plugins_url('/cleantalk-spam-protect/js/jquery-ui.min.js'), array('jquery'), '1.12.1');
240
 
241
  wp_localize_script( 'jquery', 'ctCommentsCheck', array(
242
  'ct_ajax_nonce' => $ajax_nonce,
268
  // Scripts for users check
269
  if( $hook == 'users_page_ct_check_users' || $hook == 'users.php'){
270
 
271
+ wp_enqueue_style('cleantalk_admin_css_settings_page', plugins_url().'/cleantalk-spam-protect/css/cleantalk-spam-check.css', array(), $cleantalk_plugin_version, 'all');
272
+ wp_enqueue_style('jqueryui_css', plugins_url().'/cleantalk-spam-protect/js/jquery-ui.min.css', array(), '1.21.1', 'all');
273
 
274
  $current_user = wp_get_current_user();
275
  $ajax_nonce = wp_create_nonce( "ct_secret_nonce" );
277
  if(!empty($_COOKIE['ct_paused_users_check']))
278
  $prev_check = json_decode(stripslashes($_COOKIE['ct_paused_users_check']), true);
279
 
280
+ wp_enqueue_script('ct_users_checkspam', plugins_url('/cleantalk-spam-protect/js/cleantalk-users-checkspam.js'), array(), $cleantalk_plugin_version);
281
+ wp_enqueue_script('ct_users_editscreen', plugins_url('/cleantalk-spam-protect/js/cleantalk-users-editscreen.js'), array(), $cleantalk_plugin_version);
282
+ wp_enqueue_script('jqueryui', plugins_url('/cleantalk-spam-protect/js/jquery-ui.min.js'), array('jquery'), '1.12.1');
283
 
284
  wp_localize_script( 'jquery', 'ctUsersCheck', array(
285
  'ct_ajax_nonce' => $ajax_nonce,
299
  'ct_status_string_warning' => "<p>".__("Please do backup of WordPress database before delete any accounts!", 'cleantalk')."</p>"
300
  ));
301
  wp_localize_script( 'jquery', 'ctUsersScreen', array(
302
+ 'spambutton_text' => __("Find spam-users", 'cleantalk'),
303
  'ct_show_check_links' => $show_check_links,
304
  'ct_img_src_new_tab' => plugin_dir_url(__FILE__)."images/new_window.gif"
305
  ));
330
  $ct_options = ct_get_options();
331
  $ct_data = ct_get_data();
332
 
333
+ $api_key = isset($_POST['cleantalk_settings']['apikey'])
334
+ ? $_POST['cleantalk_settings']['apikey']
335
+ : (!empty($ct_options['apikey'])
336
+ ? $ct_options['apikey']
337
+ : false);
338
 
339
+ if($api_key){
 
340
 
341
+ if(!function_exists('noticePaidTill'))
342
+ require_once('cleantalk.class.php');
 
 
 
343
 
344
+ $result = noticePaidTill($api_key);
345
+
346
+ if ($result){
347
+
348
+ $result = json_decode($result, true);
349
+
350
+ if (isset($result['data']) && is_array($result['data']))
351
+ $result = $result['data'];
352
 
353
+ if(isset($result['spam_count']))
354
+ $ct_data['admin_blocked'] = $result['spam_count'];
355
 
356
+ if (isset($result['show_notice'])){
357
+
358
+ if ($result['show_notice'] == 1 && isset($result['trial']) && $result['trial'] == 1){
359
+ CleantalkCron::updateTask('check_account_status', 'ct_account_status_check', 3600);
360
+ $show_ct_notice_trial = true;
361
+ $ct_data['show_ct_notice_trial']=1;
362
+ }
363
+
364
+ if ($result['show_notice'] == 1 && isset($result['renew']) && $result['renew'] == 1){
365
+ CleantalkCron::updateTask('check_account_status', 'ct_account_status_check', 1800);
366
+ $show_ct_notice_renew = true;
367
+ $ct_data['show_ct_notice_renew']=1;
368
+ }
369
+
370
+ if (isset($result['show_review']) && $result['show_review'] == 1)
371
+ $ct_data['show_ct_notice_review'] = 1;
372
+
373
+ if ($result['show_notice'] == 0)
374
+ CleantalkCron::updateTask('check_account_status', 'ct_account_status_check', 86400);
375
+
376
+ $ct_data['show_ct_notice_trial'] = (int) $show_ct_notice_trial;
377
+ $ct_data['show_ct_notice_renew'] = (int) $show_ct_notice_renew;
378
  }
379
 
380
+ if (isset($result['moderate_ip']) && $result['moderate_ip'] == 1){
381
+ $ct_data['moderate_ip'] = 1;
382
+ $ct_data['ip_license'] = $result['ip_license'];
383
+ }else{
384
+ $ct_data['moderate_ip'] = 0;
385
+ $ct_data['ip_license'] = 0;
386
  }
387
 
388
+ if (isset($result['user_token']))
389
+ $ct_data['user_token'] = $result['user_token'];
390
+
391
+ update_option('cleantalk_data', $ct_data);
 
392
 
 
 
 
 
 
 
 
 
 
 
393
  }
 
 
 
 
 
 
394
  }
395
  }
396
 
404
  $ct_options = ct_get_options();
405
  $ct_data = ct_get_data();
406
 
407
+ // Update logic
408
+ $current_version = (!empty($ct_data['plugin_version']) ? $ct_data['plugin_version'] : '1.0.0');
409
+
410
+ if($current_version != $cleantalk_plugin_version){
411
+ if(is_main_site()){
412
+ require_once('cleantalk-updater.php');
413
+ $result = ct_run_update_actions($current_version, $cleantalk_plugin_version);
414
+ //If update is successfull
415
+ if($result === true){
416
+ ct_send_feedback(
417
+ '0:' . $ct_agent_version // 0 - request_id, agent version.
418
+ );
419
+ $ct_data['plugin_version'] = $cleantalk_plugin_version;
420
+ update_option( 'cleantalk_data' , $ct_data);
 
 
 
 
 
 
 
 
421
  }
422
  }
423
  }
516
  $show_ct_notice_online = 'Y';
517
  }
518
  }
 
 
519
 
520
  if(stripos($_SERVER['REQUEST_URI'],'options.php')!==false || stripos($_SERVER['REQUEST_URI'],'options-general.php')!==false || stripos($_SERVER['REQUEST_URI'],'network/settings.php')!==false)
521
  {
1904
 
1905
  $hash = get_user_meta($user_id, 'ct_hash', true);
1906
  if ($hash !== '') {
1907
+ ct_feedback($hash, 0);
1908
  }
1909
  }
1910
 
inc/cleantalk-ajax.php CHANGED
@@ -141,7 +141,7 @@ $cleantalk_hooked_actions[]='rwp-submit-wrap';
141
  function ct_validate_email_ajaxlogin($email=null, $is_ajax=true)
142
  {
143
  require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
144
- global $ct_agent_version, $ct_checkjs_register_form, $ct_session_request_id_label, $ct_session_register_ok_label, $bp, $ct_signup_done, $ct_formtime_label, $ct_negative_comment, $ct_options, $ct_data;
145
 
146
  $ct_options = ct_get_options();
147
  $ct_data = ct_get_data();
@@ -159,7 +159,7 @@ function ct_validate_email_ajaxlogin($email=null, $is_ajax=true)
159
 
160
  //$ct_options=ct_get_options();
161
  $checkjs = js_test('ct_checkjs', $_COOKIE, true);
162
- $submit_time = submit_time_test();
163
  $sender_info = get_sender_info();
164
  $sender_info['post_checkjs_passed']=$checkjs;
165
 
@@ -188,7 +188,6 @@ function ct_validate_email_ajaxlogin($email=null, $is_ajax=true)
188
  $ct_request = new CleantalkRequest();
189
  $ct_request->auth_key = $ct_options['apikey'];
190
  $ct_request->sender_email = $email;
191
- // $ct_request->sender_ip = $ct->ct_session_ip($_SERVER['REMOTE_ADDR']);
192
  $ct_request->sender_ip = cleantalk_get_real_ip();
193
  $ct_request->sender_nickname = '';
194
  $ct_request->agent = $ct_agent_version;
@@ -244,7 +243,7 @@ function ct_validate_email_ajaxlogin($email=null, $is_ajax=true)
244
  function ct_user_register_ajaxlogin($user_id)
245
  {
246
  require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
247
- global $ct_agent_version, $ct_checkjs_register_form, $ct_session_request_id_label, $ct_session_register_ok_label, $bp, $ct_signup_done, $ct_formtime_label, $ct_negative_comment, $ct_options, $ct_data;
248
 
249
  $ct_options = ct_get_options();
250
  $ct_data = ct_get_data();
@@ -252,7 +251,7 @@ function ct_user_register_ajaxlogin($user_id)
252
  if(class_exists('AjaxLogin')&&isset($_POST['action'])&&$_POST['action']=='register_submit')
253
  {
254
  $checkjs = js_test('ct_checkjs', $_COOKIE, true);
255
- $submit_time = submit_time_test();
256
  $sender_info = get_sender_info();
257
  $sender_info['post_checkjs_passed']=$checkjs;
258
 
@@ -281,7 +280,6 @@ function ct_user_register_ajaxlogin($user_id)
281
  $ct_request = new CleantalkRequest();
282
  $ct_request->auth_key = $ct_options['apikey'];
283
  $ct_request->sender_email = sanitize_email($_POST['email']);
284
- // $ct_request->sender_ip = $ct->ct_session_ip($_SERVER['REMOTE_ADDR']);
285
  $ct_request->sender_ip = cleantalk_get_real_ip();
286
  $ct_request->sender_nickname = sanitize_email($_POST['login']); ;
287
  $ct_request->agent = $ct_agent_version;
@@ -337,7 +335,7 @@ function ct_mc4wp_ajax_hook( array $errors )
337
  function ct_ajax_hook($message_obj = false, $additional = false)
338
  {
339
  require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
340
- global $ct_agent_version, $ct_checkjs_register_form, $ct_session_request_id_label, $ct_session_register_ok_label, $bp, $ct_signup_done, $ct_formtime_label, $ct_negative_comment, $ct_options, $ct_data, $current_user;
341
 
342
  $ct_options = ct_get_options();
343
  $ct_data = ct_get_data();
@@ -436,7 +434,7 @@ function ct_ajax_hook($message_obj = false, $additional = false)
436
 
437
  if($sender_email!=null)
438
  {
439
- $submit_time = submit_time_test();
440
  $sender_info = get_sender_info();
441
  $sender_info['post_checkjs_passed']=$checkjs;
442
 
141
  function ct_validate_email_ajaxlogin($email=null, $is_ajax=true)
142
  {
143
  require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
144
+ global $ct_agent_version, $ct_checkjs_register_form, $bp, $ct_signup_done, $ct_negative_comment, $ct_options, $ct_data;
145
 
146
  $ct_options = ct_get_options();
147
  $ct_data = ct_get_data();
159
 
160
  //$ct_options=ct_get_options();
161
  $checkjs = js_test('ct_checkjs', $_COOKIE, true);
162
+ $submit_time = apbct_get_submit_time();
163
  $sender_info = get_sender_info();
164
  $sender_info['post_checkjs_passed']=$checkjs;
165
 
188
  $ct_request = new CleantalkRequest();
189
  $ct_request->auth_key = $ct_options['apikey'];
190
  $ct_request->sender_email = $email;
 
191
  $ct_request->sender_ip = cleantalk_get_real_ip();
192
  $ct_request->sender_nickname = '';
193
  $ct_request->agent = $ct_agent_version;
243
  function ct_user_register_ajaxlogin($user_id)
244
  {
245
  require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
246
+ global $ct_agent_version, $ct_checkjs_register_form, $bp, $ct_signup_done, $ct_negative_comment, $ct_options, $ct_data;
247
 
248
  $ct_options = ct_get_options();
249
  $ct_data = ct_get_data();
251
  if(class_exists('AjaxLogin')&&isset($_POST['action'])&&$_POST['action']=='register_submit')
252
  {
253
  $checkjs = js_test('ct_checkjs', $_COOKIE, true);
254
+ $submit_time = apbct_get_submit_time();
255
  $sender_info = get_sender_info();
256
  $sender_info['post_checkjs_passed']=$checkjs;
257
 
280
  $ct_request = new CleantalkRequest();
281
  $ct_request->auth_key = $ct_options['apikey'];
282
  $ct_request->sender_email = sanitize_email($_POST['email']);
 
283
  $ct_request->sender_ip = cleantalk_get_real_ip();
284
  $ct_request->sender_nickname = sanitize_email($_POST['login']); ;
285
  $ct_request->agent = $ct_agent_version;
335
  function ct_ajax_hook($message_obj = false, $additional = false)
336
  {
337
  require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
338
+ global $ct_agent_version, $ct_checkjs_register_form, $bp, $ct_signup_done, $ct_negative_comment, $ct_options, $ct_data, $current_user;
339
 
340
  $ct_options = ct_get_options();
341
  $ct_data = ct_get_data();
434
 
435
  if($sender_email!=null)
436
  {
437
+ $submit_time = apbct_get_submit_time();
438
  $sender_info = get_sender_info();
439
  $sender_info['post_checkjs_passed']=$checkjs;
440
 
inc/cleantalk-common.php CHANGED
@@ -3,8 +3,9 @@
3
  $ct_plugin_name = 'Antispam by CleanTalk';
4
  $ct_checkjs_frm = 'ct_checkjs_frm';
5
  $ct_checkjs_register_form = 'ct_checkjs_register_form';
6
- $ct_session_request_id_label = 'request_id';
7
- $ct_session_register_ok_label = 'register_ok';
 
8
 
9
  $ct_checkjs_cf7 = 'ct_checkjs_cf7';
10
  $ct_cf7_comment = '';
@@ -67,12 +68,6 @@ $ct_post_data_label = 's2member_pro_paypal_registration';
67
  // S2member Auth.Net post data label
68
  $ct_post_data_authnet_label = 's2member_pro_authnet_registration';
69
 
70
- // Form time load label
71
- $ct_formtime_label = 'ct_formtime';
72
-
73
- // Post without page load
74
- $ct_direct_post = 0;
75
-
76
  // WP admin email notice interval in seconds
77
  $ct_admin_notoice_period = 21600;
78
 
@@ -89,8 +84,6 @@ $ct_notice_autokey_label = 'ct_autokey';
89
  // Apikey automatic getting error text
90
  $ct_notice_autokey_value = '';
91
 
92
- $ct_feedback_requests_pool = array();
93
-
94
  // Set globals to NULL to avoid massive DB requests. Globals will be set when needed only and by accessors only.
95
  $ct_options = NULL;
96
  $ct_data = NULL;
@@ -109,21 +102,56 @@ function apbct_plugin_loaded() {
109
  }
110
 
111
  /**
112
- * Session init
113
- * @return null;
 
 
 
 
 
 
 
 
114
  */
115
- function ct_init_session() {
116
-
117
- $session_id = session_id();
118
- if(empty($session_id) && !headers_sent()) {
119
- $result = @session_start();
120
- if(!$result){
121
- session_regenerate_id(true); // replace the Session ID, bug report https://bugs.php.net/bug.php?id=68063
122
- @session_start();
123
- }
124
- }
 
 
 
 
 
 
125
 
126
- return null;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
  }
128
 
129
  /**
@@ -139,35 +167,26 @@ function ct_init_session() {
139
  * @return array array('ct'=> Cleantalk, 'ct_result' => CleantalkResponse)
140
  */
141
  function ct_base_call($params = array(), $cookie_submit_time = false, $field_count = false) {
142
- global $wpdb, $ct_agent_version, $ct_formtime_label, $ct_options, $ct_data;
143
 
144
- $ct_options=ct_get_options();
145
- $ct_data=ct_get_data();
146
 
147
  require_once('cleantalk.class.php');
148
-
149
- $submit_time = $cookie_submit_time ? $params['submit_time'] : submit_time_test();
150
-
151
  $sender_info = get_sender_info($cookie_submit_time, $field_count);
152
- if (array_key_exists('sender_info', $params)) {
153
  $sender_info = array_merge($sender_info, (array) $params['sender_info']);
154
- }
155
-
156
- $sender_info['page_hits'] = (isset($_SESSION['ct_page_hits']) ? $_SESSION['ct_page_hits'] : 0);
157
-
158
- $sender_info = json_encode($sender_info);
159
- if ($sender_info === false)
160
- $sender_info = '';
161
 
162
  $config = ct_get_server();
163
 
164
  $ct = new Cleantalk();
165
- $ct->work_url = $config['ct_work_url'];
166
- $ct->server_url = $ct_options['server'];
167
-
168
- $ct->server_ttl = $config['ct_server_ttl'];
 
169
  $ct->server_changed = $config['ct_server_changed'];
170
- $ct->ssl_on = $ct_options['ssl_on'];
171
 
172
  $ct_request = new CleantalkRequest();
173
 
@@ -178,19 +197,11 @@ function ct_base_call($params = array(), $cookie_submit_time = false, $field_cou
178
  $ct_request->sender_nickname = $params['sender_nickname'];
179
  $ct_request->sender_ip = cleantalk_get_real_ip();
180
  $ct_request->agent = $ct_agent_version;
181
- $ct_request->sender_info = $sender_info;
182
  $ct_request->js_on = $params['checkjs'];
183
- $ct_request->submit_time = $submit_time;
184
  $ct_request->post_info = $params['post_info'];
185
 
186
- if(isset($ct_data['last_error_no']))
187
- {
188
- $ct_request->last_error_no = $ct_data['last_error_no'];
189
- $ct_request->last_error_time = $ct_data['last_error_time'];
190
- $ct_request->last_error_text = $ct_data['last_error_text'];
191
- }
192
-
193
-
194
  $ct_result = @$ct->isAllowMessage($ct_request);
195
  if ($ct_result->errno === 0 && empty($ct_result->errstr))
196
  $ct_data['connection_reports']['success']++;
@@ -200,22 +211,21 @@ function ct_base_call($params = array(), $cookie_submit_time = false, $field_cou
200
  $ct_data['connection_reports']['negative_report'][] = array('date'=>date("Y-m-d H:i:s"),'page_url'=>$_SERVER['REQUEST_URI'],'lib_report'=>$ct_result->errstr);
201
  }
202
  if ($ct->server_change) {
203
- update_option(
204
- 'cleantalk_server', array(
205
- 'ct_work_url' => $ct->work_url,
206
- 'ct_server_ttl' => $ct->server_ttl,
207
- 'ct_server_changed' => time()
208
- )
209
- );
 
210
  }
211
 
212
  $ct_result = ct_change_plugin_resonse($ct_result, $params['checkjs']);
213
 
214
  // Restart submit form counter for failed requests
215
  if ($ct_result->allow == 0) {
216
- ct_init_session();
217
-
218
- $_SESSION[$ct_formtime_label] = time();
219
  ct_add_event('no');
220
  }
221
  else
@@ -225,43 +235,15 @@ function ct_base_call($params = array(), $cookie_submit_time = false, $field_cou
225
  return array('ct' => $ct, 'ct_result' => $ct_result);
226
  }
227
 
228
- /**
229
- * Validate form submit time
230
- *
231
- */
232
- function submit_time_test() {
233
- global $ct_formtime_label;
234
-
235
- ct_init_session();
236
-
237
- $submit_time = null;
238
- if (isset($_SESSION[$ct_formtime_label])) {
239
- $submit_time = time() - (int) $_SESSION[$ct_formtime_label];
240
- }
241
-
242
- return $submit_time;
243
- }
244
-
245
  /**
246
  * Inner function - Default data array for senders
247
  * @return array
248
  */
249
  function get_sender_info($cookie_submit_time = false, $field_count = false) {
250
- global $ct_direct_post, $ct_options, $ct_data, $wp_rewrite, $ct_formtime_label;
251
-
252
- $ct_options = ct_get_options();
253
- $ct_data = ct_get_data();
254
-
255
- $php_session = session_id() != '' ? 1 : 0;
256
 
257
- // Raw data to validated JavaScript test in the cloud
258
- $checkjs_data_cookies = null;
259
- if (isset($_COOKIE['ct_checkjs'])) {
260
- $checkjs_data_cookies = $_COOKIE['ct_checkjs'];
261
- }
262
-
263
-
264
- $checkjs_data_post = null;
265
  if (count($_POST) > 0) {
266
  foreach ($_POST as $k => $v) {
267
  if (preg_match("/^ct_check.+/", $k)) {
@@ -269,44 +251,26 @@ function get_sender_info($cookie_submit_time = false, $field_count = false) {
269
  }
270
  }
271
  }
272
-
273
- $options2server=$ct_options;
274
- $js_info='';
275
- if(isset($_COOKIE['ct_user_info']) && function_exists('mb_convert_encoding'))
276
- {
277
- $js_info=stripslashes(rawurldecode($_COOKIE['ct_user_info']));
278
- $js_info=mb_convert_encoding($js_info, "UTF-8", "Windows-1252");
279
- }
280
-
281
-
282
- if ($_SERVER['REQUEST_METHOD'] == 'POST') {
283
- ct_init_session();
284
- if (isset($_SESSION) && is_array($_SESSION) && !array_key_exists($ct_formtime_label, $_SESSION) && session_id() != '') {
285
- $ct_direct_post = 1;
286
- }
287
- }
288
-
289
- $cookie_test = apbct_cookies_test();
290
-
291
  $sender_info = array(
292
- 'page_url' => htmlspecialchars(@$_SERVER['SERVER_NAME'].@$_SERVER['REQUEST_URI']),
293
- 'cms_lang' => substr(get_locale(), 0, 2),
294
  'REFFERRER' => htmlspecialchars(@$_SERVER['HTTP_REFERER']),
295
  'USER_AGENT' => htmlspecialchars(@$_SERVER['HTTP_USER_AGENT']),
296
- 'php_session' => $php_session,
297
- 'cookies_enabled' => $cookie_submit_time ? $cookie_test : ct_cookies_test(true),
298
- 'REFFERRER_PREVIOUS' => $cookie_test && !empty($_COOKIE['apbct_prev_referer']) ? htmlspecialchars($_COOKIE['apbct_prev_referer']) : null,
299
- 'site_landing_ts' => $cookie_test && !empty($_COOKIE['apbct_site_landing_ts']) ? htmlspecialchars($_COOKIE['apbct_site_landing_ts']) : null,
300
- 'direct_post' => $ct_direct_post,
301
- 'checkjs_data_post' => $checkjs_data_post,
302
- 'checkjs_data_cookies' => $checkjs_data_cookies,
303
- 'ct_options' => json_encode($options2server),
304
  'fields_number' => sizeof($_POST),
305
- 'js_info' => $js_info,
306
- 'mouse_cursor_positions' => isset($_COOKIE['ct_pointer_data']) ? json_decode($_COOKIE['ct_pointer_data']) : 0,
307
- 'js_timezone' => isset($_COOKIE['ct_timezone']) ? $_COOKIE['ct_timezone'] : 0,
308
- 'key_press_timestamp' => isset($_COOKIE['ct_fkp_timestamp']) ? $_COOKIE['ct_fkp_timestamp'] : 0,
309
- 'page_set_timestamp' => isset($_COOKIE['ct_ps_timestamp']) ? $_COOKIE['ct_ps_timestamp'] : 0,
 
 
 
 
 
 
 
310
  );
311
 
312
  if($field_count){
@@ -317,7 +281,7 @@ function get_sender_info($cookie_submit_time = false, $field_count = false) {
317
  ? json_decode(stripslashes($_COOKIE['apbct_visible_fields']), true)
318
  : null;
319
  $sender_info['form_visible_inputs'] = $visible_inputs_count;
320
- $sender_info['apbct_visible_fields'] = json_encode($apbct_visible_fields);
321
  }
322
 
323
  return $sender_info;
@@ -609,41 +573,19 @@ function ct_hash($new_hash = '') {
609
  * @param int $allow flag good comment (1) or bad (0)
610
  * @return string comment_content w\o cleantalk resume
611
  */
612
- function ct_feedback($hash, $message = null, $allow) {
613
- global $ct_options, $ct_data;
 
614
 
615
- $ct_options = ct_get_options();
616
  $ct_data = ct_get_data();
617
-
618
- require_once('cleantalk.class.php');
619
-
620
- $config = ct_get_server();
621
-
622
- $ct = new Cleantalk();
623
- $ct->work_url = $config['ct_work_url'];
624
- $ct->server_url = $ct_options['server'];
625
- $ct->server_ttl = $config['ct_server_ttl'];
626
- $ct->server_changed = $config['ct_server_changed'];
627
-
628
- if (empty($hash)) {
629
- $hash = $ct->getCleantalkCommentHash($message);
630
- }
631
-
632
- $resultMessage = null;
633
- if ($message !== null) {
634
- $resultMessage = $ct->delCleantalkComment($message);
635
- }
636
-
637
- ct_init_session();
638
-
639
  $ct_feedback = $hash . ':' . $allow . ';';
640
- if (empty($_SESSION['feedback_request'])) {
641
- $_SESSION['feedback_request'] = $ct_feedback;
642
- } else {
643
- $_SESSION['feedback_request'] .= $ct_feedback;
644
- }
645
-
646
- return $resultMessage;
647
  }
648
 
649
  /**
@@ -653,24 +595,19 @@ function ct_feedback($hash, $message = null, $allow) {
653
  * @return bool
654
  */
655
  function ct_send_feedback($feedback_request = null) {
656
- global $ct_options, $ct_data, $ct_feedback_requests_pool;
 
657
 
658
  $ct_options = ct_get_options();
659
  $ct_data = ct_get_data();
660
-
661
- ct_init_session();
662
 
663
- if (empty($feedback_request) && isset($_SESSION['feedback_request']) && preg_match("/^[a-z0-9\;\:]+$/", $_SESSION['feedback_request'])) {
664
- $feedback_request = $_SESSION['feedback_request'];
665
- unset($_SESSION['feedback_request']);
 
666
  }
667
 
668
  if ($feedback_request !== null) {
669
- if (in_array($feedback_request, $ct_feedback_requests_pool)) { // The request already sent.
670
- return false;
671
- } else {
672
- $ct_feedback_requests_pool[] = $feedback_request;
673
- }
674
 
675
  require_once('cleantalk.class.php');
676
  $config = ct_get_server();
3
  $ct_plugin_name = 'Antispam by CleanTalk';
4
  $ct_checkjs_frm = 'ct_checkjs_frm';
5
  $ct_checkjs_register_form = 'ct_checkjs_register_form';
6
+
7
+ $apbct_cookie_request_id_label = 'request_id';
8
+ $apbct_cookie_register_ok_label = 'register_ok';
9
 
10
  $ct_checkjs_cf7 = 'ct_checkjs_cf7';
11
  $ct_cf7_comment = '';
68
  // S2member Auth.Net post data label
69
  $ct_post_data_authnet_label = 's2member_pro_authnet_registration';
70
 
 
 
 
 
 
 
71
  // WP admin email notice interval in seconds
72
  $ct_admin_notoice_period = 21600;
73
 
84
  // Apikey automatic getting error text
85
  $ct_notice_autokey_value = '';
86
 
 
 
87
  // Set globals to NULL to avoid massive DB requests. Globals will be set when needed only and by accessors only.
88
  $ct_options = NULL;
89
  $ct_data = NULL;
102
  }
103
 
104
  /**
105
+ * Inner function - Request's wrapper for anything
106
+ * @param array Array of parameters:
107
+ * 'message' - string
108
+ * 'example' - string
109
+ * 'checkjs' - int
110
+ * 'sender_email' - string
111
+ * 'sender_nickname' - string
112
+ * 'sender_info' - array
113
+ * 'post_info' - string
114
+ * @return array array('ct'=> Cleantalk, 'ct_result' => CleantalkResponse)
115
  */
116
+ function apbct_check(){
117
+
118
+ global $ct_agent_version, $ct_options, $ct_data;
119
+
120
+ $ct_options = ct_get_options();
121
+ $ct_data = ct_get_data();
122
+
123
+ $sender_info = get_sender_info($cookie_submit_time, $field_count);
124
+ if (isset($params['sender_info']))
125
+ $sender_info = array_merge($sender_info, (array) $params['sender_info']);
126
+
127
+ $config = ct_get_server();
128
+
129
+ require_once('cleantalk.class.php');
130
+
131
+ $ct_request = new CleantalkRequest();
132
 
133
+ $ct_request->auth_key = $ct_options['apikey'];
134
+ $ct_request->message = $params['message'];
135
+ $ct_request->example = $params['example'];
136
+ $ct_request->sender_email = $params['sender_email'];
137
+ $ct_request->sender_nickname = $params['sender_nickname'];
138
+ $ct_request->sender_ip = cleantalk_get_real_ip();
139
+ $ct_request->agent = $ct_agent_version;
140
+ $ct_request->sender_info = json_encode($sender_info);
141
+ $ct_request->js_on = $params['checkjs'];
142
+ $ct_request->submit_time = apbct_get_submit_time();
143
+ $ct_request->post_info = $params['post_info'];
144
+
145
+ $ct = new Cleantalk();
146
+
147
+ $ct->ssl_on = $ct_options['ssl_on'];
148
+ $ct->server_url = $ct_options['server'];
149
+ $ct->server_ttl = $config['ct_server_ttl'];
150
+ $ct->work_url = $config['ct_work_url'];
151
+ $ct->server_changed = $config['ct_server_changed'];
152
+
153
+ $ct_result = @$ct->isAllowMessage($ct_request);
154
+
155
  }
156
 
157
  /**
167
  * @return array array('ct'=> Cleantalk, 'ct_result' => CleantalkResponse)
168
  */
169
  function ct_base_call($params = array(), $cookie_submit_time = false, $field_count = false) {
170
+ global $ct_agent_version, $ct_options, $ct_data;
171
 
172
+ $ct_options = ct_get_options();
173
+ $ct_data = ct_get_data();
174
 
175
  require_once('cleantalk.class.php');
176
+
 
 
177
  $sender_info = get_sender_info($cookie_submit_time, $field_count);
178
+ if (isset($params['sender_info']))
179
  $sender_info = array_merge($sender_info, (array) $params['sender_info']);
 
 
 
 
 
 
 
180
 
181
  $config = ct_get_server();
182
 
183
  $ct = new Cleantalk();
184
+
185
+ $ct->ssl_on = $ct_options['ssl_on'];
186
+ $ct->server_url = $ct_options['server'];
187
+ $ct->server_ttl = $config['ct_server_ttl'];
188
+ $ct->work_url = $config['ct_work_url'];
189
  $ct->server_changed = $config['ct_server_changed'];
 
190
 
191
  $ct_request = new CleantalkRequest();
192
 
197
  $ct_request->sender_nickname = $params['sender_nickname'];
198
  $ct_request->sender_ip = cleantalk_get_real_ip();
199
  $ct_request->agent = $ct_agent_version;
200
+ $ct_request->sender_info = json_encode($sender_info);
201
  $ct_request->js_on = $params['checkjs'];
202
+ $ct_request->submit_time = apbct_get_submit_time();
203
  $ct_request->post_info = $params['post_info'];
204
 
 
 
 
 
 
 
 
 
205
  $ct_result = @$ct->isAllowMessage($ct_request);
206
  if ($ct_result->errno === 0 && empty($ct_result->errstr))
207
  $ct_data['connection_reports']['success']++;
211
  $ct_data['connection_reports']['negative_report'][] = array('date'=>date("Y-m-d H:i:s"),'page_url'=>$_SERVER['REQUEST_URI'],'lib_report'=>$ct_result->errstr);
212
  }
213
  if ($ct->server_change) {
214
+ update_option(
215
+ 'cleantalk_server',
216
+ array(
217
+ 'ct_work_url' => $ct->work_url,
218
+ 'ct_server_ttl' => $ct->server_ttl,
219
+ 'ct_server_changed' => time(),
220
+ )
221
+ );
222
  }
223
 
224
  $ct_result = ct_change_plugin_resonse($ct_result, $params['checkjs']);
225
 
226
  // Restart submit form counter for failed requests
227
  if ($ct_result->allow == 0) {
228
+ apbct_cookie(); // Setting page timer and cookies
 
 
229
  ct_add_event('no');
230
  }
231
  else
235
  return array('ct' => $ct, 'ct_result' => $ct_result);
236
  }
237
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
238
  /**
239
  * Inner function - Default data array for senders
240
  * @return array
241
  */
242
  function get_sender_info($cookie_submit_time = false, $field_count = false) {
243
+
244
+ // Validate cookie from the backend
245
+ $ct = apbct_cookies_test();
 
 
 
246
 
 
 
 
 
 
 
 
 
247
  if (count($_POST) > 0) {
248
  foreach ($_POST as $k => $v) {
249
  if (preg_match("/^ct_check.+/", $k)) {
251
  }
252
  }
253
  }
254
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
255
  $sender_info = array(
 
 
256
  'REFFERRER' => htmlspecialchars(@$_SERVER['HTTP_REFERER']),
257
  'USER_AGENT' => htmlspecialchars(@$_SERVER['HTTP_USER_AGENT']),
258
+ 'page_url' => htmlspecialchars(@$_SERVER['SERVER_NAME'].@$_SERVER['REQUEST_URI']),
259
+ 'cms_lang' => substr(get_locale(), 0, 2),
260
+ 'ct_options' => json_encode(ct_get_options()),
 
 
 
 
 
261
  'fields_number' => sizeof($_POST),
262
+ 'direct_post' => $ct === null && $_SERVER['REQUEST_METHOD'] == 'POST'? 1 : 0,
263
+ 'cookies_enabled' => $cookie_submit_time ? $ct : ct_cookies_test(true),
264
+ 'checkjs_data_post' => !empty($checkjs_data_post) ? $checkjs_data_post : null,
265
+ 'checkjs_data_cookies' => !empty($_COOKIE['ct_checkjs']) ? $_COOKIE['ct_checkjs'] : null, // Raw data to validated JavaScript test in the cloud
266
+ 'REFFERRER_PREVIOUS' => !empty($_COOKIE['apbct_prev_referer']) && $ct ? $_COOKIE['apbct_prev_referer'] : null,
267
+ 'site_landing_ts' => !empty($_COOKIE['apbct_site_landing_ts']) && $ct ? $_COOKIE['apbct_site_landing_ts'] : null,
268
+ 'js_info' => !empty($_COOKIE['ct_user_info']) ? json_decode(stripslashes($_COOKIE['ct_user_info'])) : '',
269
+ 'mouse_cursor_positions' => !empty($_COOKIE['ct_pointer_data']) ? json_decode($_COOKIE['ct_pointer_data']) : 0,
270
+ 'js_timezone' => !empty($_COOKIE['ct_timezone']) ? $_COOKIE['ct_timezone'] : 0,
271
+ 'key_press_timestamp' => !empty($_COOKIE['ct_fkp_timestamp']) ? $_COOKIE['ct_fkp_timestamp'] : 0,
272
+ 'page_set_timestamp' => !empty($_COOKIE['ct_ps_timestamp']) ? $_COOKIE['ct_ps_timestamp'] : 0,
273
+ 'page_hits' => !empty($_COOKIE['apbct_page_hits']) ? $_COOKIE['apbct_page_hits'] : 0,
274
  );
275
 
276
  if($field_count){
281
  ? json_decode(stripslashes($_COOKIE['apbct_visible_fields']), true)
282
  : null;
283
  $sender_info['form_visible_inputs'] = $visible_inputs_count;
284
+ $sender_info['apbct_visible_fields'] = $apbct_visible_fields;
285
  }
286
 
287
  return $sender_info;
573
  * @param int $allow flag good comment (1) or bad (0)
574
  * @return string comment_content w\o cleantalk resume
575
  */
576
+ function ct_feedback($hash, $allow) {
577
+
578
+ global $ct_data;
579
 
 
580
  $ct_data = ct_get_data();
581
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
582
  $ct_feedback = $hash . ':' . $allow . ';';
583
+ if(empty($ct_data['feedback_request']))
584
+ $ct_data['feedback_request'] = $ct_feedback;
585
+ else
586
+ $ct_data['feedback_request'] .= $ct_feedback;
587
+
588
+ update_option('cleantalk_data', $ct_data);
 
589
  }
590
 
591
  /**
595
  * @return bool
596
  */
597
  function ct_send_feedback($feedback_request = null) {
598
+
599
+ global $ct_options, $ct_data;
600
 
601
  $ct_options = ct_get_options();
602
  $ct_data = ct_get_data();
 
 
603
 
604
+ if (empty($feedback_request) && isset($ct_data['feedback_request']) && preg_match("/^[a-z0-9\;\:]+$/", $ct_data['feedback_request'])){
605
+ $feedback_request = $ct_data['feedback_request'];
606
+ unset($ct_data['feedback_request']);
607
+ update_option('cleantalk_data', $ct_data);
608
  }
609
 
610
  if ($feedback_request !== null) {
 
 
 
 
 
611
 
612
  require_once('cleantalk.class.php');
613
  $config = ct_get_server();
inc/cleantalk-public.php CHANGED
@@ -5,7 +5,7 @@
5
  * @return mixed[] Array of options
6
  */
7
  function apbct_init() {
8
- global $ct_wplp_result_label, $ct_jp_comments, $ct_post_data_label, $ct_post_data_authnet_label, $ct_formtime_label, $ct_direct_post, $ct_options, $ct_data, $ct_check_post_result, $test_external_forms, $cleantalk_executed, $wpdb, $ct_agent_version;
9
 
10
  $ct_options = ct_get_options();
11
  $ct_data=ct_get_data();
@@ -170,11 +170,11 @@ function apbct_init() {
170
 
171
  // bbPress
172
  if(class_exists('bbPress')){
173
- add_filter('bbp_new_topic_pre_title', 'ct_bbp_get_topic', 1);
174
- add_filter('bbp_new_topic_pre_content', 'ct_bbp_new_pre_content', 1);
175
- add_filter('bbp_new_reply_pre_content', 'ct_bbp_new_pre_content', 1);
176
- add_action('bbp_theme_before_topic_form_content', 'ct_comment_form');
177
- add_action('bbp_theme_before_reply_form_content', 'ct_comment_form');
178
  }
179
 
180
  //Custom Contact Forms
@@ -227,7 +227,6 @@ function apbct_init() {
227
  //
228
  if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)) {
229
  add_action('wp_footer', 'ct_footer_add_cookie', 1);
230
- add_action('wp_footer', 'ct_page_count', 1);
231
  }
232
 
233
  if ($ct_options['protect_logged_in'] != 1 && is_user_logged_in()) {
@@ -562,39 +561,6 @@ function ct_pirate_forms_check(){
562
  wp_die("<h1>".__('Spam protection by CleanTalk', 'cleantalk')."</h1><h2>".$ct_result->comment."</h2>", '', array('response' => 403, "back_link" => true, "text_direction" => 'ltr'));
563
  }
564
 
565
- /**
566
- * Does actions to prepare anti-spam tests.
567
- * @return bool;
568
- */
569
- function ct_setup_page_timer($set_global = false) {
570
- global $ct_formtime_label, $ct_page_timer_setuped;
571
-
572
- //
573
- // Timer is already setuped.
574
- //
575
- if ($ct_page_timer_setuped) {
576
- return $ct_page_timer_setuped;
577
- }
578
-
579
- //
580
- // Skip sessions to do not break Varnish caching.
581
- //
582
- if ($set_global) {
583
- $ct_options = ct_get_options();
584
- if ($ct_options['set_cookies'] != 1) {
585
- return false;
586
- }
587
- }
588
-
589
- ct_init_session();
590
-
591
- $_SESSION[$ct_formtime_label] = time();
592
-
593
- $ct_page_timer_setuped = true;
594
-
595
- return true;
596
- }
597
-
598
  function ct_ajaxurl() {
599
  ?>
600
  <script type="text/javascript">
@@ -621,9 +587,7 @@ function ct_comment_form($post_id) {
621
  }
622
 
623
  ct_add_hidden_fields(true, 'ct_checkjs', false, false);
624
-
625
- ct_setup_page_timer();
626
-
627
  return null;
628
  }
629
 
@@ -632,22 +596,11 @@ function ct_comment_form($post_id) {
632
  */
633
  function ct_footer_add_cookie() {
634
 
635
- if(empty($_POST['ct_multipage_form']))
636
- ct_setup_page_timer(true);
637
-
638
  ct_add_hidden_fields(true, 'ct_checkjs', false, true, true);
639
- ct_add_mouse_tracking(false);
640
 
641
  return null;
642
  }
643
 
644
- /**
645
- * Adds initiates and ++ page counter
646
- */
647
- function ct_page_count(){
648
- $_SESSION['ct_page_hits'] = (!isset($_SESSION['ct_page_hits']) ? 1 : $_SESSION['ct_page_hits'] + 1);
649
- }
650
-
651
  /**
652
  * Adds hidden filed to define avaialbility of client's JavaScript
653
  * @param bool $random_key switch on generation random key for every page load
@@ -698,130 +651,6 @@ function ct_add_hidden_fields($random_key = false, $field_name = 'ct_checkjs', $
698
  }
699
  }
700
 
701
- /**
702
- * Adds mouse tracking via JavaScript
703
- * @param bool $random_key switch on generation random key for every page load
704
- */
705
- function ct_add_mouse_tracking($return_string = false){
706
-
707
- $js_script = '<script type="text/javascript">
708
- var ct_date = new Date(),
709
- ctTimeMs = new Date().getTime(),
710
- ctMouseEventTimerFlag = true, //Reading interval flag
711
- ctMouseData = [],
712
- ctMouseDataCounter = 0;
713
-
714
- function ctSetCookieSec(c_name, value) {
715
- document.cookie = c_name + "=" + encodeURIComponent(value) + "; path=/";
716
- }
717
-
718
- function apbct_attach_event_handler(elem, event, callback){
719
- if(typeof window.addEventListener == "function") elem.addEventListener(event, callback);
720
- else elem.attachEvent(event, callback);
721
- }
722
-
723
- function apbct_remove_event_handler(elem, event, callback){
724
- if(typeof window.removeEventListener == "function") elem.removeEventListener(event, callback);
725
- else elem.detachEvent(event, callback);
726
- }
727
-
728
- ctSetCookieSec("ct_ps_timestamp", Math.floor(new Date().getTime()/1000));
729
- ctSetCookieSec("ct_fkp_timestamp", "0");
730
- ctSetCookieSec("ct_pointer_data", "0");
731
- ctSetCookieSec("ct_timezone", "0");
732
-
733
- setTimeout(function(){
734
- ctSetCookieSec("ct_timezone", ct_date.getTimezoneOffset()/60*(-1));
735
- },1000);
736
-
737
- //Writing first key press timestamp
738
- var ctFunctionFirstKey = function output(event){
739
- var KeyTimestamp = Math.floor(new Date().getTime()/1000);
740
- ctSetCookieSec("ct_fkp_timestamp", KeyTimestamp);
741
- ctKeyStopStopListening();
742
- }
743
-
744
- //Reading interval
745
- var ctMouseReadInterval = setInterval(function(){
746
- ctMouseEventTimerFlag = true;
747
- }, 150);
748
-
749
- //Writting interval
750
- var ctMouseWriteDataInterval = setInterval(function(){
751
- ctSetCookieSec("ct_pointer_data", JSON.stringify(ctMouseData));
752
- }, 1200);
753
-
754
- //Logging mouse position each 150 ms
755
- var ctFunctionMouseMove = function output(event){
756
- if(ctMouseEventTimerFlag == true){
757
-
758
- ctMouseData.push([
759
- Math.round(event.pageY),
760
- Math.round(event.pageX),
761
- Math.round(new Date().getTime() - ctTimeMs)
762
- ]);
763
-
764
- ctMouseDataCounter++;
765
- ctMouseEventTimerFlag = false;
766
- if(ctMouseDataCounter >= 100){
767
- ctMouseStopData();
768
- }
769
- }
770
- }
771
-
772
- //Stop mouse observing function
773
- function ctMouseStopData(){
774
- apbct_remove_event_handler(window, "mousemove", ctFunctionMouseMove);
775
- clearInterval(ctMouseReadInterval);
776
- clearInterval(ctMouseWriteDataInterval);
777
- }
778
-
779
- //Stop key listening function
780
- function ctKeyStopStopListening(){
781
- apbct_remove_event_handler(window, "mousedown", ctFunctionFirstKey);
782
- apbct_remove_event_handler(window, "keydown", ctFunctionFirstKey);
783
- }
784
-
785
- apbct_attach_event_handler(window, "mousemove", ctFunctionMouseMove);
786
- apbct_attach_event_handler(window, "mousedown", ctFunctionFirstKey);
787
- apbct_attach_event_handler(window, "keydown", ctFunctionFirstKey);
788
-
789
- // Ready function
790
- function apbct_ready(){
791
- ctSetCookieSec("apbct_visible_fields_count", 0);
792
- for(var i=0; i < document.forms.length; i++){
793
- var form = document.forms[i];
794
- form.onsubmit = function(){
795
- var apbct_vf = {apbct_visible_fields: ""};
796
- for(var j=0, elem_count=form.elements.length; j < form.elements.length; j++){
797
- var elem = form.elements[j];
798
- if( getComputedStyle(elem).display == "none" ||
799
- getComputedStyle(elem).visibility == "hidden" ||
800
- getComputedStyle(elem).width == "0" ||
801
- getComputedStyle(elem).heigth == "0" ||
802
- getComputedStyle(elem).opacity == "0" ||
803
- elem.getAttribute("type") == "hidden" ||
804
- elem.getAttribute("type") == "submit"
805
- ){
806
- elem_count--;
807
- }else{
808
- apbct_vf.apbct_visible_fields += elem.getAttribute("name") + (j+1 == form.elements.length ? "" : " ");
809
- }
810
- }
811
- ctSetCookieSec("apbct_visible_fields", JSON.stringify(apbct_vf));
812
- ctSetCookieSec("apbct_visible_fields_count", elem_count);
813
- }
814
- }
815
- }
816
- apbct_attach_event_handler(window, "DOMContentLoaded", apbct_ready);
817
- </script>';
818
-
819
- if($return_string)
820
- return $js_script;
821
- else
822
- echo $js_script;
823
- }
824
-
825
  /**
826
  * Is enable for user group
827
  * @return boolean
@@ -857,8 +686,6 @@ function ct_frm_entries_footer_scripts($fields, $form) {
857
  $ct_frm_base_name = 'form_';
858
  $ct_frm_name = $ct_frm_base_name . $form->form_key;
859
 
860
- ct_setup_page_timer();
861
-
862
  echo "var input = document.createElement('input');
863
  input.setAttribute('type', 'hidden');
864
  input.setAttribute('name', '$ct_checkjs_frm');
@@ -870,7 +697,6 @@ function ct_frm_entries_footer_scripts($fields, $form) {
870
  }";
871
 
872
  $js_code = ct_add_hidden_fields(true, 'ct_checkjs', true, true);
873
- $js_code .= ct_add_mouse_tracking(true);
874
  $js_code = strip_tags($js_code); // Removing <script> tag
875
  echo $js_code;
876
  }
@@ -1403,31 +1229,27 @@ function ct_register_form() {
1403
  }
1404
 
1405
  ct_add_hidden_fields(true, $ct_checkjs_register_form, false);
1406
- ct_add_mouse_tracking(false);
1407
- ct_setup_page_timer();
1408
-
1409
  return null;
1410
  }
1411
 
1412
  /**
1413
- * Adds notification text to login form - to inform about approced registration
1414
  * @return null
1415
  */
1416
  function ct_login_message($message) {
1417
- global $errors, $ct_session_register_ok_label, $ct_options, $ct_data;
1418
-
 
1419
  $ct_options = ct_get_options();
1420
- $ct_data = ct_get_data();
1421
-
1422
- if ($ct_options['registrations_test'] != 0) {
1423
- ct_init_session();
1424
-
1425
- if( isset($_GET['checkemail']) && 'registered' == $_GET['checkemail'] ) {
1426
- if (isset($_SESSION[$ct_session_register_ok_label])) {
1427
- unset($_SESSION[$ct_session_register_ok_label]);
1428
- if(is_wp_error($errors))
1429
- $errors->add('ct_message','<br />' . sprintf(__('Registration is approved by %s.', 'cleantalk'), '<b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk</b>'), 'message');
1430
- }
1431
  }
1432
  }
1433
  return $message;
@@ -1531,7 +1353,7 @@ function ct_test_registration($nickname, $email, $ip){
1531
  $ct_options = ct_get_options();
1532
  $ct_data = ct_get_data();
1533
 
1534
- $submit_time = apbct_get_submit_time();//submit_time_test();
1535
 
1536
  $sender_info = get_sender_info(true);
1537
 
@@ -1598,7 +1420,7 @@ function ct_test_registration($nickname, $email, $ip){
1598
  * @return array with errors
1599
  */
1600
  function ct_registration_errors($errors, $sanitized_user_login = null, $user_email = null) {
1601
- global $ct_agent_version, $ct_checkjs_register_form, $ct_session_request_id_label, $ct_session_register_ok_label, $bp, $ct_signup_done, $ct_formtime_label, $ct_negative_comment, $ct_options, $ct_data, $ct_registration_error_comment;
1602
 
1603
  $ct_options=ct_get_options();
1604
  $ct_data=ct_get_data();
@@ -1651,7 +1473,7 @@ function ct_registration_errors($errors, $sanitized_user_login = null, $user_ema
1651
  return $errors;
1652
  }
1653
 
1654
- $submit_time = apbct_get_submit_time();//submit_time_test();
1655
 
1656
  $sender_info = get_sender_info(true);
1657
 
@@ -1700,7 +1522,6 @@ function ct_registration_errors($errors, $sanitized_user_login = null, $user_ema
1700
  $ct_request = new CleantalkRequest();
1701
  $ct_request->auth_key = $ct_options['apikey'];
1702
  $ct_request->sender_email = $user_email;
1703
- // $ct_request->sender_ip = $ct->ct_session_ip($_SERVER['REMOTE_ADDR']);
1704
  $ct_request->sender_ip = cleantalk_get_real_ip();
1705
  $ct_request->sender_nickname = $sanitized_user_login;
1706
  $ct_request->agent = $ct_agent_version;
@@ -1736,12 +1557,9 @@ function ct_registration_errors($errors, $sanitized_user_login = null, $user_ema
1736
  return $errors;
1737
  }
1738
 
1739
- ct_init_session();
1740
-
1741
  if ($ct_result->allow == 0) {
1742
 
1743
- // Restart submit form counter for failed requests
1744
- $_SESSION[$ct_formtime_label] = time();
1745
 
1746
  if ($buddypress === true) {
1747
  $bp->signup->errors['signup_username'] = $ct_result->comment;
@@ -1759,8 +1577,8 @@ function ct_registration_errors($errors, $sanitized_user_login = null, $user_ema
1759
 
1760
  } else {
1761
  if ($ct_result->id !== null) {
1762
- $_SESSION[$ct_session_request_id_label] = $ct_result->id;
1763
- $_SESSION[$ct_session_register_ok_label] = $ct_result->id;
1764
  }
1765
  }
1766
 
@@ -1796,17 +1614,15 @@ function ct_check_registration_erros($errors, $sanitized_user_login = null, $use
1796
  }
1797
 
1798
  /**
1799
- * Set user meta
1800
  * @return null
1801
  */
1802
  function ct_user_register($user_id) {
1803
- global $ct_session_request_id_label;
1804
-
1805
- ct_init_session();
1806
-
1807
- if (isset($_SESSION[$ct_session_request_id_label])) {
1808
- update_user_meta($user_id, 'ct_hash', $_SESSION[$ct_session_request_id_label]);
1809
- unset($_SESSION[$ct_session_request_id_label]);
1810
  }
1811
  }
1812
 
@@ -1832,10 +1648,7 @@ function ct_grunion_contact_form_field_html($r, $field_label) {
1832
  }
1833
 
1834
  $r .= ct_add_hidden_fields(true, $ct_checkjs_jpcf, true);
1835
- $r .= ct_add_mouse_tracking(true);
1836
  $ct_jpcf_patched = true;
1837
-
1838
- ct_setup_page_timer();
1839
  }
1840
 
1841
  return $r;
@@ -1981,9 +1794,7 @@ function ct_wpcf7_form_elements($html) {
1981
  }
1982
 
1983
  $html .= ct_add_hidden_fields(true, $ct_checkjs_cf7, true);
1984
- $html .= ct_add_mouse_tracking(false);
1985
- ct_setup_page_timer();
1986
-
1987
  return $html;
1988
  }
1989
 
@@ -2100,9 +1911,6 @@ function ct_wpcf7_display_message($message, $status = 'spam') {
2100
  */
2101
  function ct_si_contact_display_after_fields($string = '', $style = '', $form_errors = array(), $form_id_num = 0) {
2102
  $string .= ct_add_hidden_fields(true, 'ct_checkjs', true);
2103
- $string .= ct_add_mouse_tracking(true);
2104
- ct_setup_page_timer();
2105
-
2106
  return $string;
2107
  }
2108
 
@@ -2274,18 +2082,12 @@ function ct_gforms_hidden_field ( $form_string, $form ) {
2274
 
2275
  // Adding JS code
2276
  $js_code = ct_add_hidden_fields(true, $ct_hidden_field, true, false);
2277
- $js_code .= ct_add_mouse_tracking(true);
2278
  $form_string = str_replace($search, $js_code . $search, $form_string);
2279
 
2280
- // Adding field for multipage form
2281
  $append_string = "<input type='hidden' name='ct_multipage_form' value='yes'>";
2282
  $form_string = str_replace($search, $append_string.$search, $form_string);
2283
-
2284
- // Do not start reset page timer if it is multipage form
2285
- if(empty($_POST['ct_multipage_form'])){
2286
- ct_setup_page_timer();
2287
- }
2288
-
2289
  return $form_string;
2290
  }
2291
 
@@ -2364,7 +2166,7 @@ function ct_gforms_spam_test ($is_spam, $form, $entry) {
2364
  * @return array with errors
2365
  */
2366
  function ct_s2member_registration_test() {
2367
- global $ct_agent_version, $ct_post_data_label, $ct_post_data_authnet_label, $ct_formtime_label, $ct_options, $ct_data;
2368
 
2369
  $ct_options = ct_get_options();
2370
  $ct_data = ct_get_data();
@@ -2373,7 +2175,7 @@ function ct_s2member_registration_test() {
2373
  return null;
2374
  }
2375
 
2376
- $submit_time = apbct_get_submit_time();//submit_time_test();
2377
 
2378
  $sender_info = get_sender_info(true);
2379
 
@@ -2413,7 +2215,6 @@ function ct_s2member_registration_test() {
2413
 
2414
  $ct_request->auth_key = $ct_options['apikey'];
2415
  $ct_request->sender_email = $sender_email;
2416
- // $ct_request->sender_ip = $ct->ct_session_ip($_SERVER['REMOTE_ADDR']);
2417
  $ct_request->sender_ip = cleantalk_get_real_ip();
2418
  $ct_request->sender_nickname = $sender_nickname;
2419
  $ct_request->agent = $ct_agent_version;
@@ -2446,8 +2247,7 @@ function ct_s2member_registration_test() {
2446
 
2447
  // Restart submit form counter for failed requests
2448
  if ($ct_result->allow == 0) {
2449
- ct_init_session();
2450
- $_SESSION[$ct_formtime_label] = time();
2451
  }
2452
 
2453
  if ($ct_result->allow == 0) {
@@ -2519,17 +2319,14 @@ function ct_contact_form_validate() {
2519
  $post_info['comment_type'] = 'feedback_general_contact_form';
2520
 
2521
  // Skip the test if it's WooCommerce and the checkout test unset
2522
- if(
2523
- (
2524
- strpos($_SERVER['REQUEST_URI'], 'wc-ajax=checkout') !==false ||
2525
- strpos($_SERVER['REQUEST_URI'], 'wc-ajax=update_order_review') !== false ||
2526
- (isset($_POST['_wp_http_referer']) && strpos($_SERVER['REQUEST_URI'], 'wc-ajax=update_order_review') !== false)
2527
- ) &&
2528
- $ct_options['wc_checkout_test'] == 0
2529
- ){
2530
- return null;
2531
- }else{
2532
  $post_info['comment_type'] = 'order';
 
 
 
2533
  }
2534
 
2535
  $post_info = json_encode($post_info);
@@ -2656,7 +2453,7 @@ function ct_contact_form_validate() {
2656
  // Divi Theme Contact Form. Using $contact_form
2657
  }elseif(!empty($contact_form) && $contact_form == 'divi_theme_contact_form'){
2658
  echo "<div id='et_pb_contact_form{$contact_form_additional}'><h1>Your request looks like spam.</h1><div><p>{$ct_result->comment}</p></div></div>";
2659
- die;
2660
  // Enfold Theme Contact Form. Using $contact_form
2661
  }elseif(!empty($contact_form) && $contact_form == 'enfold_theme_contact_form'){
2662
  echo "<div id='ajaxresponse_1' class='ajaxresponse ajaxresponse_1' style='display: block;'><div id='ajaxresponse_1' class='ajaxresponse ajaxresponse_1'><h3 class='avia-form-success'>Antispam by CleanTalk: ".$ct_result->comment."</h3><a href='.'><-Back</a></div></div>";
@@ -2858,11 +2655,13 @@ function ct_enqueue_scripts_public($hook){
2858
 
2859
  global $cleantalk_plugin_version, $current_user, $ct_data, $ct_options;
2860
 
 
 
2861
  if(!defined('CLEANTALK_AJAX_USE_FOOTER_HEADER') || (defined('CLEANTALK_AJAX_USE_FOOTER_HEADER') && CLEANTALK_AJAX_USE_FOOTER_HEADER)){
2862
  if(!empty($ct_options['use_ajax']) && stripos($_SERVER['REQUEST_URI'],'.xml') === false && stripos($_SERVER['REQUEST_URI'],'.xsl') === false){
2863
  if(strpos($_SERVER['REQUEST_URI'],'jm-ajax') === false){
2864
 
2865
- wp_enqueue_script('ct_nocache', plugins_url('/cleantalk-spam-protect/inc/cleantalk_nocache.js'), array(), $cleantalk_plugin_version, 'in_footer');
2866
 
2867
  if(!empty($ct_options['check_external']))
2868
  wp_enqueue_script('ct_external', plugins_url('/cleantalk-spam-protect/inc/cleantalk_external.js'), array('jquery'), $cleantalk_plugin_version, 'in_footer');
@@ -2887,22 +2686,22 @@ function ct_enqueue_scripts_public($hook){
2887
  $ajax_nonce = wp_create_nonce( "ct_secret_nonce" );
2888
  $user_token = !empty($ct_data['user_token']) ? $ct_data['user_token'] : null;
2889
 
2890
- wp_enqueue_style ('ct_public_css', plugins_url('/cleantalk-spam-protect/assets/css/cleantalk-public.css'), array(), $cleantalk_plugin_version, 'all');
2891
- wp_enqueue_script('ct_public_js', plugins_url('/cleantalk-spam-protect/assets/js/cleantalk-public.js'), array('jquery'), $cleantalk_plugin_version, true);
2892
 
2893
- wp_localize_script('ct_public_js', 'ctPublic', array(
2894
  'ct_ajax_nonce' => $ajax_nonce,
2895
  'ajaxurl' => admin_url('admin-ajax.php'),
2896
- 'ct_feedback_msg' => sprintf(__("Feedback has been sent to %sCleanTalk Dashboard%s.", 'cleantalk'), $user_token ? "<a target='_blank' href=https://cleantalk.org/my/show_requests?user_token={$user_token}&cp_mode=antispam>" : '', $user_token ? "</a>" : ''),
2897
  'ct_feedback_error' => __('Error occured while sending feedback.', 'cleantalk'),
2898
- 'ct_feedback_no_hash' => __('Feedback wasn\'t sent. There is no associated request.', 'cleantalk')
 
2899
  ));
2900
 
2901
  }
2902
  }
2903
 
2904
  if(!empty($ct_options['debug_ajax'])){
2905
- wp_enqueue_script('ct_debug_js', plugins_url('/cleantalk-spam-protect/assets/js/cleantalk-debug-ajax.js'), array('jquery'), $cleantalk_plugin_version, true);
2906
  }
2907
  }
2908
 
5
  * @return mixed[] Array of options
6
  */
7
  function apbct_init() {
8
+ global $ct_wplp_result_label, $ct_jp_comments, $ct_post_data_label, $ct_post_data_authnet_label, $ct_options, $ct_data, $ct_check_post_result, $test_external_forms, $cleantalk_executed, $wpdb, $ct_agent_version;
9
 
10
  $ct_options = ct_get_options();
11
  $ct_data=ct_get_data();
170
 
171
  // bbPress
172
  if(class_exists('bbPress')){
173
+ add_filter('bbp_new_topic_pre_title', 'ct_bbp_get_topic', 1);
174
+ add_filter('bbp_new_topic_pre_content', 'ct_bbp_new_pre_content', 1);
175
+ add_filter('bbp_new_reply_pre_content', 'ct_bbp_new_pre_content', 1);
176
+ add_action('bbp_theme_before_topic_form_content', 'ct_comment_form');
177
+ add_action('bbp_theme_before_reply_form_content', 'ct_comment_form');
178
  }
179
 
180
  //Custom Contact Forms
227
  //
228
  if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)) {
229
  add_action('wp_footer', 'ct_footer_add_cookie', 1);
 
230
  }
231
 
232
  if ($ct_options['protect_logged_in'] != 1 && is_user_logged_in()) {
561
  wp_die("<h1>".__('Spam protection by CleanTalk', 'cleantalk')."</h1><h2>".$ct_result->comment."</h2>", '', array('response' => 403, "back_link" => true, "text_direction" => 'ltr'));
562
  }
563
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
564
  function ct_ajaxurl() {
565
  ?>
566
  <script type="text/javascript">
587
  }
588
 
589
  ct_add_hidden_fields(true, 'ct_checkjs', false, false);
590
+
 
 
591
  return null;
592
  }
593
 
596
  */
597
  function ct_footer_add_cookie() {
598
 
 
 
 
599
  ct_add_hidden_fields(true, 'ct_checkjs', false, true, true);
 
600
 
601
  return null;
602
  }
603
 
 
 
 
 
 
 
 
604
  /**
605
  * Adds hidden filed to define avaialbility of client's JavaScript
606
  * @param bool $random_key switch on generation random key for every page load
651
  }
652
  }
653
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
654
  /**
655
  * Is enable for user group
656
  * @return boolean
686
  $ct_frm_base_name = 'form_';
687
  $ct_frm_name = $ct_frm_base_name . $form->form_key;
688
 
 
 
689
  echo "var input = document.createElement('input');
690
  input.setAttribute('type', 'hidden');
691
  input.setAttribute('name', '$ct_checkjs_frm');
697
  }";
698
 
699
  $js_code = ct_add_hidden_fields(true, 'ct_checkjs', true, true);
 
700
  $js_code = strip_tags($js_code); // Removing <script> tag
701
  echo $js_code;
702
  }
1229
  }
1230
 
1231
  ct_add_hidden_fields(true, $ct_checkjs_register_form, false);
1232
+
 
 
1233
  return null;
1234
  }
1235
 
1236
  /**
1237
+ * Adds notification text to login form - to inform about approved registration
1238
  * @return null
1239
  */
1240
  function ct_login_message($message) {
1241
+
1242
+ global $errors, $ct_options, $apbct_cookie_register_ok_label;
1243
+
1244
  $ct_options = ct_get_options();
1245
+
1246
+ if ($ct_options['registrations_test'] != 0){
1247
+ if( isset($_GET['checkemail']) && 'registered' == $_GET['checkemail'] ){
1248
+ if (isset($_COOKIE[$apbct_cookie_register_ok_label])){
1249
+ if(is_wp_error($errors)){
1250
+ $errors->add('ct_message',sprintf(__('Registration approved by %s.', 'cleantalk'), '<b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk</b>'), 'message');
1251
+ }
1252
+ }
 
 
 
1253
  }
1254
  }
1255
  return $message;
1353
  $ct_options = ct_get_options();
1354
  $ct_data = ct_get_data();
1355
 
1356
+ $submit_time = apbct_get_submit_time();
1357
 
1358
  $sender_info = get_sender_info(true);
1359
 
1420
  * @return array with errors
1421
  */
1422
  function ct_registration_errors($errors, $sanitized_user_login = null, $user_email = null) {
1423
+ global $ct_agent_version, $ct_checkjs_register_form, $apbct_cookie_request_id_label, $apbct_cookie_register_ok_label, $bp, $ct_signup_done, $ct_negative_comment, $ct_options, $ct_data, $ct_registration_error_comment;
1424
 
1425
  $ct_options=ct_get_options();
1426
  $ct_data=ct_get_data();
1473
  return $errors;
1474
  }
1475
 
1476
+ $submit_time = apbct_get_submit_time();
1477
 
1478
  $sender_info = get_sender_info(true);
1479
 
1522
  $ct_request = new CleantalkRequest();
1523
  $ct_request->auth_key = $ct_options['apikey'];
1524
  $ct_request->sender_email = $user_email;
 
1525
  $ct_request->sender_ip = cleantalk_get_real_ip();
1526
  $ct_request->sender_nickname = $sanitized_user_login;
1527
  $ct_request->agent = $ct_agent_version;
1557
  return $errors;
1558
  }
1559
 
 
 
1560
  if ($ct_result->allow == 0) {
1561
 
1562
+ apbct_cookie(); // Setting page timer and cookies
 
1563
 
1564
  if ($buddypress === true) {
1565
  $bp->signup->errors['signup_username'] = $ct_result->comment;
1577
 
1578
  } else {
1579
  if ($ct_result->id !== null) {
1580
+ setcookie($apbct_cookie_register_ok_label, $ct_result->id, time()+10, '/');
1581
+ setcookie($apbct_cookie_request_id_label, $ct_result->id, time()+10, '/');
1582
  }
1583
  }
1584
 
1614
  }
1615
 
1616
  /**
1617
+ * Set user meta (ct_hash) for successed registration
1618
  * @return null
1619
  */
1620
  function ct_user_register($user_id) {
1621
+ global $apbct_cookie_request_id_label;
1622
+ if (isset($_COOKIE[$apbct_cookie_request_id_label])) {
1623
+ if(update_user_meta($user_id, 'ct_hash', $_COOKIE[$apbct_cookie_request_id_label])){
1624
+ setcookie($apbct_cookie_request_id_label, '0', 1, '/');
1625
+ }
 
 
1626
  }
1627
  }
1628
 
1648
  }
1649
 
1650
  $r .= ct_add_hidden_fields(true, $ct_checkjs_jpcf, true);
 
1651
  $ct_jpcf_patched = true;
 
 
1652
  }
1653
 
1654
  return $r;
1794
  }
1795
 
1796
  $html .= ct_add_hidden_fields(true, $ct_checkjs_cf7, true);
1797
+
 
 
1798
  return $html;
1799
  }
1800
 
1911
  */
1912
  function ct_si_contact_display_after_fields($string = '', $style = '', $form_errors = array(), $form_id_num = 0) {
1913
  $string .= ct_add_hidden_fields(true, 'ct_checkjs', true);
 
 
 
1914
  return $string;
1915
  }
1916
 
2082
 
2083
  // Adding JS code
2084
  $js_code = ct_add_hidden_fields(true, $ct_hidden_field, true, false);
 
2085
  $form_string = str_replace($search, $js_code . $search, $form_string);
2086
 
2087
+ // Adding field for multipage form. Look for cleantalk.php -> apbct_cookie();
2088
  $append_string = "<input type='hidden' name='ct_multipage_form' value='yes'>";
2089
  $form_string = str_replace($search, $append_string.$search, $form_string);
2090
+
 
 
 
 
 
2091
  return $form_string;
2092
  }
2093
 
2166
  * @return array with errors
2167
  */
2168
  function ct_s2member_registration_test() {
2169
+ global $ct_agent_version, $ct_post_data_label, $ct_post_data_authnet_label, $ct_options, $ct_data;
2170
 
2171
  $ct_options = ct_get_options();
2172
  $ct_data = ct_get_data();
2175
  return null;
2176
  }
2177
 
2178
+ $submit_time = apbct_get_submit_time();
2179
 
2180
  $sender_info = get_sender_info(true);
2181
 
2215
 
2216
  $ct_request->auth_key = $ct_options['apikey'];
2217
  $ct_request->sender_email = $sender_email;
 
2218
  $ct_request->sender_ip = cleantalk_get_real_ip();
2219
  $ct_request->sender_nickname = $sender_nickname;
2220
  $ct_request->agent = $ct_agent_version;
2247
 
2248
  // Restart submit form counter for failed requests
2249
  if ($ct_result->allow == 0) {
2250
+ apbct_cookie(); // Setting page timer and cookies
 
2251
  }
2252
 
2253
  if ($ct_result->allow == 0) {
2319
  $post_info['comment_type'] = 'feedback_general_contact_form';
2320
 
2321
  // Skip the test if it's WooCommerce and the checkout test unset
2322
+ if(strpos($_SERVER['REQUEST_URI'], 'wc-ajax=checkout') !== false ||
2323
+ strpos($_SERVER['REQUEST_URI'], 'wc-ajax=update_order_review') !== false ||
2324
+ (isset($_POST['_wp_http_referer']) && strpos($_SERVER['REQUEST_URI'], 'wc-ajax=update_order_review') !== false))
2325
+ {
 
 
 
 
 
 
2326
  $post_info['comment_type'] = 'order';
2327
+ if($ct_options['wc_checkout_test'] == 0){
2328
+ return null;
2329
+ }
2330
  }
2331
 
2332
  $post_info = json_encode($post_info);
2453
  // Divi Theme Contact Form. Using $contact_form
2454
  }elseif(!empty($contact_form) && $contact_form == 'divi_theme_contact_form'){
2455
  echo "<div id='et_pb_contact_form{$contact_form_additional}'><h1>Your request looks like spam.</h1><div><p>{$ct_result->comment}</p></div></div>";
2456
+ die();
2457
  // Enfold Theme Contact Form. Using $contact_form
2458
  }elseif(!empty($contact_form) && $contact_form == 'enfold_theme_contact_form'){
2459
  echo "<div id='ajaxresponse_1' class='ajaxresponse ajaxresponse_1' style='display: block;'><div id='ajaxresponse_1' class='ajaxresponse ajaxresponse_1'><h3 class='avia-form-success'>Antispam by CleanTalk: ".$ct_result->comment."</h3><a href='.'><-Back</a></div></div>";
2655
 
2656
  global $cleantalk_plugin_version, $current_user, $ct_data, $ct_options;
2657
 
2658
+ wp_enqueue_script('ct_nocache', plugins_url('/cleantalk-spam-protect/js/apbct-public.js'), array(), $cleantalk_plugin_version, 'in_footer');
2659
+
2660
  if(!defined('CLEANTALK_AJAX_USE_FOOTER_HEADER') || (defined('CLEANTALK_AJAX_USE_FOOTER_HEADER') && CLEANTALK_AJAX_USE_FOOTER_HEADER)){
2661
  if(!empty($ct_options['use_ajax']) && stripos($_SERVER['REQUEST_URI'],'.xml') === false && stripos($_SERVER['REQUEST_URI'],'.xsl') === false){
2662
  if(strpos($_SERVER['REQUEST_URI'],'jm-ajax') === false){
2663
 
2664
+ wp_enqueue_script('ct_nocache', plugins_url('/cleantalk-spam-protect/inc/cleantalk_nocache.js'), array(), $cleantalk_plugin_version, 'in_footer');
2665
 
2666
  if(!empty($ct_options['check_external']))
2667
  wp_enqueue_script('ct_external', plugins_url('/cleantalk-spam-protect/inc/cleantalk_external.js'), array('jquery'), $cleantalk_plugin_version, 'in_footer');
2686
  $ajax_nonce = wp_create_nonce( "ct_secret_nonce" );
2687
  $user_token = !empty($ct_data['user_token']) ? $ct_data['user_token'] : null;
2688
 
2689
+ wp_enqueue_style ('ct_public_admin_css', plugins_url('/cleantalk-spam-protect/css/cleantalk-public-admin.css'), array(), $cleantalk_plugin_version, 'all');
2690
+ wp_enqueue_script('ct_public_admin_js', plugins_url('/cleantalk-spam-protect/js/cleantalk-public-admin.js'), array('jquery'), $cleantalk_plugin_version, true);
2691
 
2692
+ wp_localize_script('ct_public_admin_js', 'ctPublic', array(
2693
  'ct_ajax_nonce' => $ajax_nonce,
2694
  'ajaxurl' => admin_url('admin-ajax.php'),
 
2695
  'ct_feedback_error' => __('Error occured while sending feedback.', 'cleantalk'),
2696
+ 'ct_feedback_no_hash' => __('Feedback wasn\'t sent. There is no associated request.', 'cleantalk'),
2697
+ 'ct_feedback_msg' => sprintf(__("Feedback has been sent to %sCleanTalk Dashboard%s.", 'cleantalk'), $user_token ? "<a target='_blank' href=https://cleantalk.org/my/show_requests?user_token={$user_token}&cp_mode=antispam>" : '', $user_token ? "</a>" : ''),
2698
  ));
2699
 
2700
  }
2701
  }
2702
 
2703
  if(!empty($ct_options['debug_ajax'])){
2704
+ wp_enqueue_script('ct_debug_js', plugins_url('/cleantalk-spam-protect/js/cleantalk-debug-ajax.js'), array('jquery'), $cleantalk_plugin_version, true);
2705
  }
2706
  }
2707
 
inc/cleantalk-updater.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- function ct_run_update_actions($current_version, $new_version, $start_version){
4
 
5
  global $ct_data, $wpdb;
6
 
1
  <?php
2
 
3
+ function ct_run_update_actions($current_version, $new_version){
4
 
5
  global $ct_data, $wpdb;
6
 
inc/cleantalk.class.php CHANGED
@@ -477,13 +477,7 @@ class Cleantalk {
477
  if (!is_string($value) && !is_integer($value)) {
478
  $request->$param = NULL;
479
  }
480
- }
481
-
482
- if (in_array($param, array('stoplist_check', 'allow_links')) && !empty($value)) {
483
- if (!in_array($value, array(1, 2))) {
484
- $request->$param = NULL;
485
- }
486
- }
487
 
488
  if (in_array($param, array('js_on')) && !empty($value)) {
489
  if (!is_integer($value)) {
@@ -924,18 +918,6 @@ class Cleantalk {
924
  return $message;
925
  }
926
 
927
- /**
928
- * Get user IP behind proxy server
929
- */
930
- public function ct_session_ip( $data_ip ) {
931
- // Return FALSE if FALSE !?
932
- // if (!preg_match("/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/", $data_ip)) {
933
- // error_log(__FUNCTION__ . " " . "condition");
934
- // return $data_ip;
935
- // }
936
- return cleantalk_get_real_ip();
937
- }
938
-
939
  /**
940
  * From http://php.net/manual/en/function.ip2long.php#82397
941
  */
477
  if (!is_string($value) && !is_integer($value)) {
478
  $request->$param = NULL;
479
  }
480
+ }
 
 
 
 
 
 
481
 
482
  if (in_array($param, array('js_on')) && !empty($value)) {
483
  if (!is_integer($value)) {
918
  return $message;
919
  }
920
 
 
 
 
 
 
 
 
 
 
 
 
 
921
  /**
922
  * From http://php.net/manual/en/function.ip2long.php#82397
923
  */
js/apbct-public.js ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var ct_date = new Date(),
2
+ ctTimeMs = new Date().getTime(),
3
+ ctMouseEventTimerFlag = true, //Reading interval flag
4
+ ctMouseData = [],
5
+ ctMouseDataCounter = 0;
6
+
7
+ function ctSetCookieSec(c_name, value) {
8
+ document.cookie = c_name + "=" + encodeURIComponent(value) + "; path=/";
9
+ }
10
+
11
+ function apbct_attach_event_handler(elem, event, callback){
12
+ if(typeof window.addEventListener == "function") elem.addEventListener(event, callback);
13
+ else elem.attachEvent(event, callback);
14
+ }
15
+
16
+ function apbct_remove_event_handler(elem, event, callback){
17
+ if(typeof window.removeEventListener == "function") elem.removeEventListener(event, callback);
18
+ else elem.detachEvent(event, callback);
19
+ }
20
+
21
+ ctSetCookieSec("ct_ps_timestamp", Math.floor(new Date().getTime()/1000));
22
+ ctSetCookieSec("ct_fkp_timestamp", "0");
23
+ ctSetCookieSec("ct_pointer_data", "0");
24
+ ctSetCookieSec("ct_timezone", "0");
25
+
26
+ setTimeout(function(){
27
+ ctSetCookieSec("ct_timezone", ct_date.getTimezoneOffset()/60*(-1));
28
+ },1000);
29
+
30
+ //Writing first key press timestamp
31
+ var ctFunctionFirstKey = function output(event){
32
+ var KeyTimestamp = Math.floor(new Date().getTime()/1000);
33
+ ctSetCookieSec("ct_fkp_timestamp", KeyTimestamp);
34
+ ctKeyStopStopListening();
35
+ }
36
+
37
+ //Reading interval
38
+ var ctMouseReadInterval = setInterval(function(){
39
+ ctMouseEventTimerFlag = true;
40
+ }, 150);
41
+
42
+ //Writting interval
43
+ var ctMouseWriteDataInterval = setInterval(function(){
44
+ ctSetCookieSec("ct_pointer_data", JSON.stringify(ctMouseData));
45
+ }, 1200);
46
+
47
+ //Logging mouse position each 150 ms
48
+ var ctFunctionMouseMove = function output(event){
49
+ if(ctMouseEventTimerFlag == true){
50
+
51
+ ctMouseData.push([
52
+ Math.round(event.pageY),
53
+ Math.round(event.pageX),
54
+ Math.round(new Date().getTime() - ctTimeMs)
55
+ ]);
56
+
57
+ ctMouseDataCounter++;
58
+ ctMouseEventTimerFlag = false;
59
+ if(ctMouseDataCounter >= 100){
60
+ ctMouseStopData();
61
+ }
62
+ }
63
+ }
64
+
65
+ //Stop mouse observing function
66
+ function ctMouseStopData(){
67
+ apbct_remove_event_handler(window, "mousemove", ctFunctionMouseMove);
68
+ clearInterval(ctMouseReadInterval);
69
+ clearInterval(ctMouseWriteDataInterval);
70
+ }
71
+
72
+ //Stop key listening function
73
+ function ctKeyStopStopListening(){
74
+ apbct_remove_event_handler(window, "mousedown", ctFunctionFirstKey);
75
+ apbct_remove_event_handler(window, "keydown", ctFunctionFirstKey);
76
+ }
77
+
78
+ apbct_attach_event_handler(window, "mousemove", ctFunctionMouseMove);
79
+ apbct_attach_event_handler(window, "mousedown", ctFunctionFirstKey);
80
+ apbct_attach_event_handler(window, "keydown", ctFunctionFirstKey);
81
+
82
+ // Ready function
83
+ function apbct_ready(){
84
+ ctSetCookieSec("apbct_visible_fields_count", 0);
85
+ for(var i=0; i < document.forms.length; i++){
86
+ var form = document.forms[i];
87
+ form.onsubmit = function(){
88
+ var apbct_vf = {apbct_visible_fields: ""};
89
+ for(var j=0, elem_count=form.elements.length; j < form.elements.length; j++){
90
+ var elem = form.elements[j];
91
+ if( getComputedStyle(elem).display == "none" ||
92
+ getComputedStyle(elem).visibility == "hidden" ||
93
+ getComputedStyle(elem).width == "0" ||
94
+ getComputedStyle(elem).heigth == "0" ||
95
+ getComputedStyle(elem).opacity == "0" ||
96
+ elem.getAttribute("type") == "hidden" ||
97
+ elem.getAttribute("type") == "submit"
98
+ ){
99
+ elem_count--;
100
+ }else{
101
+ apbct_vf.apbct_visible_fields += elem.getAttribute("name") + (j+1 == form.elements.length ? "" : " ");
102
+ }
103
+ }
104
+ ctSetCookieSec("apbct_visible_fields", JSON.stringify(apbct_vf));
105
+ ctSetCookieSec("apbct_visible_fields_count", elem_count);
106
+ }
107
+ }
108
+ }
109
+ apbct_attach_event_handler(window, "DOMContentLoaded", apbct_ready);
{assets/js → js}/cleantalk-admin-settings-page.js RENAMED
File without changes
{assets/js → js}/cleantalk-admin.js RENAMED
File without changes
{assets/js → js}/cleantalk-comments-checkspam.js RENAMED
File without changes
{assets/js → js}/cleantalk-comments-editscreen.js RENAMED
File without changes
{assets/js → js}/cleantalk-dashboard-widget.js RENAMED
File without changes
{assets/js → js}/cleantalk-debug-ajax.js RENAMED
File without changes
{assets/js → js}/cleantalk-public.js RENAMED
File without changes
{assets/js → js}/cleantalk-users-checkspam.js RENAMED
File without changes
{assets/js → js}/cleantalk-users-editscreen.js RENAMED
File without changes
{assets/js → js}/jquery-ui.min.css RENAMED
File without changes
{assets/js → js}/jquery-ui.min.js RENAMED
File without changes
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: znaeff, shagimuratov, sartemd174
3
  Tags: spam, antispam, protection, comments, contact form
4
  Requires at least: 3.0
5
- Tested up to: 4.9
6
- Stable tag: 5.81
7
  License: GPLv2
8
 
9
  Spam protection, antispam, all-in-one, premium plugin. No spam comments & users, no spam contact form & WooCommerce spam. Forget spam.
@@ -37,7 +37,7 @@ CleanTalk is a free anti spam plugin which work with the premium Cloud AntiSpam
37
  >I know you have heard of a number of anti-spam plugins. But you must know, the cloud-based ones are the best regarding detection rate. They compare all the content in forms with their own algorithm to find out the legibility.
38
  >*<a href="https://www.techwibe.com/cleantalk-wordpress-plugin-review/" target="_blank">www.techwibe.com</a>*
39
 
40
- > The key selling point of CleanTalk for me is not simply its effectiveness. Its the fact that CleanTalk works in the background. It does not make users jump through hoops in order to submit a comment or complete a form.
41
  > <a href="https://www.kevinmuldoon.com/cleantalk-anti-spam-service/">www.kevinmuldoon.com</a>
42
 
43
  = AntiSpam protection for comments =
@@ -74,17 +74,17 @@ Spam protection for everything about bbPress: logins, registrations, forums, top
74
  = Other spam filters =
75
  * WordPress Landing Pages.
76
  * WP User Frontend, UserPro.
77
- * Any WordPress form (checkbox 'Custom contact forms')
78
  * Any submission to the site (checkbox 'Check all POST data')
79
 
80
  = Compatible with WordPress cache plugins =
81
  * W3 Total Cache, Quick Cache, WP Fastest Cache, Hyper Cache, WP Super cache, WP-Rocket and any other cache plugins.
82
 
83
  = Check existing comments for spam. Bulk comments removal =
84
- With the help of anti-spam by CleanTalk you can inspect through existing comments to find and quickly delete spam comments at once. To use this function, go to WP Console —> Comments —> Find spam comments.
85
 
86
  = Check existing users for spam. Bulk accounts removal =
87
- With the help of anti-spam by CleanTalk you can inspect through existing accounts to find and quickly delete spam users at once. For use this function, go to WP Console —> Users —> Check for spam. Also, you can export a list of spam users to the CSV.
88
 
89
  = Blocking users by country =
90
  Automatically block comments and registrations from the countries you have set a ban for. This option is useful in cases of manual spam protection and for protection enhancement. If your site is not intended for international audience and you do not expect comments/users from other countries.
@@ -130,7 +130,7 @@ https://s.w.org/plugins/cleantalk-spam-protect/screenshot-5.png?r=1288723
130
  * A visitor writes a comment or registers
131
  * Anti-Spam by CleanTalk plugin sends action parameters into the CleanTalk cloud
132
  * Service analyzes the parameters
133
- * If this is a visitor, the comment will be published. If its a spam bot, then CleanTalk blocks this comment or registration.
134
  * Parameters are written to the spam log which can be viewed in the Control Panel service.
135
 
136
  CleanTalk team has been developing a cloud antispam system for five years and has created a truly reliable anti-spam service designed for you to guarantee
@@ -199,7 +199,7 @@ site visitors. After 2 failed attempts to decipher CAPTCHA 95% of visitors
199
  reject further attempts. At the sight of CAPTCHA and after input errors, many
200
  visitors leave the resource. Thus, CAPTCHA helps to protect the resource spam both from bots and visitors. CAPTCHA is not a panacea from spam. Doubts concerning the Need for CAPTCHA?
201
 
202
- *“Ultimately, CAPTCHAs are useless for spam because theyre designed to tell you if someone is human or not, but not whether something is spam or not.” Matt Mullenweg*
203
 
204
  You do not have to work in IT to know what spam is. Besides piles of unwanted email, there are spam bots, or special software programs designed to act as human website visitors that post unwelcome messages over the Internet to advertise dubious services. More often than not spam messages do not even make sense. Similar to bacteria and virus mutations developing antibiotic resistance, spam bots are becoming more resilient in penetrating Internet firewalls and security layers.
205
 
@@ -210,13 +210,13 @@ CleanTalk team has developed unique anti spam algorithms to assess visitors'
210
  behavior. CleanTalk analyzes user behavior and the parameters of the filled
211
  forms. Our anti-spam module, being installed in your website, sends the
212
  behavior parameters of either a visitor or a spam bot. When these parameters
213
- are estimated, the anti spam service makes a decision to post a message or to define it as spam and reject it. Based on these checks, the service forms its own list of email addresses used by spam bots.
214
 
215
  The registrations of visitors are being checked in a similar manner. The service adds to the blacklist not just email addresses, but also IP addresses and domains of websites that promote themselves through spam mailing. All of this happens automatically and requires no action from the administration of the website. In 2.5 million queries the service makes a mistake in 40-45 cases, i.e. CleanTalk detects spam with 99.9982% accuracy. We constantly monitor these errors and make adjustments to our algorithms. Even with this exceptional accuracy our team is aiming to improve the figures over time.
216
 
217
- All-in-one. CleanTalk protects form spam all forms instantaneously comments, registrations, feedback, contacts. No need to install additional plugins for each form. You save resources and increase performance of your website.
218
 
219
- Spam attacks log. Anti-Spam by CleanTalk records all filtered comments, registrations and other spam attacks in the Log of spam attacks and stores the data in the log for up to 45 days. Using the log, you can ensure reliable protection of your website from spam and experience no false/positive filtering.
220
 
221
  With the help of anti-spam by CleanTalk you can check existing comments and
222
  users, to find and quickly delete spam comments at once. This allows
@@ -225,9 +225,9 @@ comments and users, which were not detected by conventional anti-spam tools.
225
  The existing comments and users checking process is performed in a database of
226
  the nearly 2 million identified spam bots. Detailed spam stats allows CleanTalk customers to fully control it.
227
 
228
- CleanTalk has an advanced option SpamFireWall”. This option allows you to block the most active spam bots before they get access to your website. It unloads you website pages when an attempt attack was made, so your web server won't run unnecessary scripts on these pages. Also it prevents any scanning of website pages by spam bots. Subsequently SpamFireWall significantly reduces your webserver load. SpamFireWall can mitigate HTTP/HTTPS DDoS attacks. When an intruder makes GET requests to attack your website, SpamFireWall will block requests from bad IP addresses. Your website gives the intruder a special page with a description of DDoS rejection instead of the website pages. SpamFireWall can help to reduce the CPU usage of your server because of this reason.
229
 
230
- CleanTalk team has been developing a cloud spam protection system for five years and has created a truly reliable anti-spam service designed for you to guarantee your safety”.
231
 
232
  = Translations =
233
  * Danish (da_DK)
@@ -296,7 +296,7 @@ The plugin Anti-Spam by CleanTalk stops up to 99.998% of spam comments, spam sig
296
  Yes, it does. Please turn the option 'SpamFireWall' on in the plugin settings to protect your website from DoS/DDoS, XML-RPC attacks.
297
 
298
  = How does the plugin stop spam? =
299
- Please, note administrator's actions are NOT being checked.
300
 
301
  The plugin uses several simple tests to stop spammers:
302
 
@@ -395,7 +395,7 @@ Yes, you can. Add this string in your wp-config.php file before defining databas
395
 
396
  $cleantalk_url_exclusions = array('url1', 'url2', 'url3');
397
 
398
- Now, all pages containing strings 'url1', 'url2', or 'url3' will be excluded from anti-spam checking. Remember, that this option will not be applied in registration and comment checking they are always protected from spam. This is similar to regular expression /.*url1.*/ or wildcard like *url1*.
399
 
400
  For example: If you need to except these URLs:
401
  example.com/some/thing
@@ -410,7 +410,7 @@ Yes, you can. Add this string in your wp-config.php file before defining databas
410
 
411
  $cleantalk_ip_exclusions = array('127.0.0.1', '8.8.8.8');
412
 
413
- Now, all requests from IP 127.0.0.1 and 8.8.8.8 will be excluded from anti-spam checking. Remember, that this option will not be applied in registration and comment checking they are always protected from spam.
414
 
415
  = Can I not send my personal data to CleanTalk servers? =
416
  Yes, you can exclude your data. Add this string in your wp-config.php file before defining database constants:
@@ -455,7 +455,7 @@ Yes, it does. But you have to turn off the option 'Use AJAX for JavaScript check
455
  To close the notice please save the plugin settings again or it will be closed automatically within 60 minutes after the renewal.
456
 
457
  = I'm using PHP 4.2 version and i'm getting errors related with JSON. Why does it happens? =
458
- СleanTalk is no longer supports PHP lower than 5.2 version because the support code have incompatibility with PHP 7 version. Please, upgrade your PHP. If you couldn't perform that, let us know about it via support ticket here: https://cleantalk.org/my/support.
459
 
460
  = Should I change anything in the plugin's settings or in my CleanTalk Control Panel when I switch my website from HTTP to HTTPS or vice versa? =
461
  No. You don't need to change anything in the plugin's settings or in your CleanTalk Control Panel. The plugin will work regardless of the protocol.
@@ -463,22 +463,22 @@ No. You don't need to change anything in the plugin's settings or in your CleanT
463
  = How to use Anti-Spam Log? =
464
  The following possibilities are available for you in the Anti-Spam Log:
465
 
466
- Time period for all spam records you want to see.
467
 
468
- Filter spam records by their status: Any status, Denied, Approved.
469
 
470
- Filter spam records by your websites.
471
 
472
- Filter spam records by country they came from.
473
 
474
- Filter spam records by IP address, e-mail address or username.
475
 
476
- Available options for a specific record:
477
 
478
- * Details see item 4 below.
479
- * Spam/Not Spam press this string if our system made wrong decision and blocked or approved a registration, a comment ot a contact form submission. More about it here: https://cleantalk.org/faq#feedback_spam
480
- * Delete delete a record permanently.
481
- * Personal blacklists go to your website Black&White Lists page.
482
  * Record details: block reason, body of the message, additional caught data.
483
 
484
  = SpamFireWall and AntiSpam - Networks Blocking =
@@ -496,7 +496,7 @@ By default, all spam comments are placed in the spam folder, now you can change
496
 
497
  1. **Move to the Spam folder.** All spam comments will be placed to the folder "Spam" in the WordPress Comments section except comments with Stop-Words. Stop-Word comments will be always stored in the "Pending" folder.
498
 
499
- You can prevent the proliferation of Spam folder. It can be cleaned automatically using the option "Keep spam comments for 15 days." Enable this option in the settings of the plugin: WordPress Admin Page —> Settings —> Antispam by CleanTalk —> Advanced settings —> enable "Keep spam comments for 15 days" —> Save Changes.
500
 
501
  2. **Move to Trash.** All spam comments will be placed to the folder "Trash" in the WordPress Comments section except comments with Stop-Words. Stop-Word comments will be always stored in the "Pending" folder.
502
 
@@ -533,6 +533,11 @@ We develop plugin to do it as optimized as possible, CleanTalk doesn't downgrade
533
  1. The plugin deletes/removes the existing spam comments and users accounts.
534
 
535
  == Changelog ==
 
 
 
 
 
536
  = 5.81 November 22 2017 =
537
  * Fixed error with "Show/Hide key" button.
538
  * Slightly improved spam protection for all forms.
@@ -1283,7 +1288,7 @@ We develop plugin to do it as optimized as possible, CleanTalk doesn't downgrade
1283
  * Fixed account status check logic. Previous version makes unnecessary test API calls when the plugin asks account status check.
1284
 
1285
  = 2.55 2014-07-11 =
1286
- * Fixed bug with account status function. In backend the plugin showed notice 'Please dont forget to disable CAPTCHA if you have it!' on every page.
1287
 
1288
  = 2.54 2014-07-11 =
1289
  * Fixed signup anti-spam protection logic for BuddyPress registrations.
@@ -1492,6 +1497,11 @@ We develop plugin to do it as optimized as possible, CleanTalk doesn't downgrade
1492
  * First version
1493
 
1494
  == Upgrade Notice ==
 
 
 
 
 
1495
  = 5.81 November 22 2017 =
1496
  * Fixed error with "Show/Hide key" button.
1497
  * Slightly improved spam protection for all forms.
@@ -2201,7 +2211,7 @@ Added immediate spam protection activation.
2201
  * Fixed account status check logic. Previous version makes unnecessary test API calls when the plugin asks account status check.
2202
 
2203
  = 2.55 2014-07-11 =
2204
- * Fixed bug with account status function. In backend the plugin showed notice 'Please dont forget to disable CAPTCHA if you have it!' on every page.
2205
 
2206
  = 2.54 2014-07-11 =
2207
  * Fixed signup anti-spam protection logic for BuddyPress registrations.
2
  Contributors: znaeff, shagimuratov, sartemd174
3
  Tags: spam, antispam, protection, comments, contact form
4
  Requires at least: 3.0
5
+ Tested up to: 4.9.1
6
+ Stable tag: 5.82
7
  License: GPLv2
8
 
9
  Spam protection, antispam, all-in-one, premium plugin. No spam comments & users, no spam contact form & WooCommerce spam. Forget spam.
37
  >I know you have heard of a number of anti-spam plugins. But you must know, the cloud-based ones are the best regarding detection rate. They compare all the content in forms with their own algorithm to find out the legibility.
38
  >*<a href="https://www.techwibe.com/cleantalk-wordpress-plugin-review/" target="_blank">www.techwibe.com</a>*
39
 
40
+ > The key selling point of CleanTalk for me is not simply its effectiveness. Its the fact that CleanTalk works in the background. It does not make users jump through hoops in order to submit a comment or complete a form.
41
  > <a href="https://www.kevinmuldoon.com/cleantalk-anti-spam-service/">www.kevinmuldoon.com</a>
42
 
43
  = AntiSpam protection for comments =
74
  = Other spam filters =
75
  * WordPress Landing Pages.
76
  * WP User Frontend, UserPro.
77
+ * Any WordPress form (checkbox 'Custom contact forms').�
78
  * Any submission to the site (checkbox 'Check all POST data')
79
 
80
  = Compatible with WordPress cache plugins =
81
  * W3 Total Cache, Quick Cache, WP Fastest Cache, Hyper Cache, WP Super cache, WP-Rocket and any other cache plugins.
82
 
83
  = Check existing comments for spam. Bulk comments removal =
84
+ With the help of anti-spam by CleanTalk youcan inspect through existing comments to find and quickly delete spam comments at once. To use this function, go to WP Console �> Comments �> Find spam comments.
85
 
86
  = Check existing users for spam. Bulk accounts removal =
87
+ With the help of anti-spam by CleanTalk youcan inspect through existing accounts to find and quickly delete spam users at once. For use this function, go to WP Console �> Users �> Check for spam. Also, you can export a list of spam users to the CSV.
88
 
89
  = Blocking users by country =
90
  Automatically block comments and registrations from the countries you have set a ban for. This option is useful in cases of manual spam protection and for protection enhancement. If your site is not intended for international audience and you do not expect comments/users from other countries.
130
  * A visitor writes a comment or registers
131
  * Anti-Spam by CleanTalk plugin sends action parameters into the CleanTalk cloud
132
  * Service analyzes the parameters
133
+ * If this is a visitor, the comment will be published. If its a spam bot, then CleanTalk blocks this comment or registration.
134
  * Parameters are written to the spam log which can be viewed in the Control Panel service.
135
 
136
  CleanTalk team has been developing a cloud antispam system for five years and has created a truly reliable anti-spam service designed for you to guarantee
199
  reject further attempts. At the sight of CAPTCHA and after input errors, many
200
  visitors leave the resource. Thus, CAPTCHA helps to protect the resource spam both from bots and visitors. CAPTCHA is not a panacea from spam. Doubts concerning the Need for CAPTCHA?
201
 
202
+ *�Ultimately, CAPTCHAs are useless for spam because theyre designed to tell you if someone is human or not, but not whether something is spam or not.� Matt Mullenweg*
203
 
204
  You do not have to work in IT to know what spam is. Besides piles of unwanted email, there are spam bots, or special software programs designed to act as human website visitors that post unwelcome messages over the Internet to advertise dubious services. More often than not spam messages do not even make sense. Similar to bacteria and virus mutations developing antibiotic resistance, spam bots are becoming more resilient in penetrating Internet firewalls and security layers.
205
 
210
  behavior. CleanTalk analyzes user behavior and the parameters of the filled
211
  forms. Our anti-spam module, being installed in your website, sends the
212
  behavior parameters of either a visitor or a spam bot. When these parameters
213
+ are estimated, the anti spam service makes a decision to post a message or to define it as spam and reject it. Based on these checks, the service forms its own list of email addresses used by spam bots.
214
 
215
  The registrations of visitors are being checked in a similar manner. The service adds to the blacklist not just email addresses, but also IP addresses and domains of websites that promote themselves through spam mailing. All of this happens automatically and requires no action from the administration of the website. In 2.5 million queries the service makes a mistake in 40-45 cases, i.e. CleanTalk detects spam with 99.9982% accuracy. We constantly monitor these errors and make adjustments to our algorithms. Even with this exceptional accuracy our team is aiming to improve the figures over time.
216
 
217
+ All-in-one. CleanTalk protects form spam all forms instantaneously comments, registrations, feedback, contacts. No need to install additional plugins for each form. You save resources and increase performance of your website.
218
 
219
+ Spam attacks log. Anti-Spam by CleanTalk records all filtered comments, registrations and other spam attacks in the Log of spam attacks and stores the data in the log for up to 45 days. Using the log, you can ensure reliable protection of your website from spam and experience no false/positive filtering.
220
 
221
  With the help of anti-spam by CleanTalk you can check existing comments and
222
  users, to find and quickly delete spam comments at once. This allows
225
  The existing comments and users checking process is performed in a database of
226
  the nearly 2 million identified spam bots. Detailed spam stats allows CleanTalk customers to fully control it.
227
 
228
+ CleanTalk has an advanced option SpamFireWall�. This option allows you to block the most active spam bots before they get access to your website. It unloads you website pages when an attempt attack was made, so your web server won't run unnecessary scripts on these pages. Also it prevents any scanning of website pages by spam bots. Subsequently SpamFireWall significantly reduces your webserver load. SpamFireWall can mitigate HTTP/HTTPS DDoS attacks. When an intruder makes GET requests to attack your website, SpamFireWall will block requests from bad IP addresses. Your website gives the intruder a special page with a description of DDoS rejection instead of the website pages. SpamFireWall can help to reduce the CPU usage of your server because of this reason.
229
 
230
+ CleanTalk team has been developing a cloud spam protection system for five years and has created a truly reliable anti-spam service designed for you to guarantee your safety�.
231
 
232
  = Translations =
233
  * Danish (da_DK)
296
  Yes, it does. Please turn the option 'SpamFireWall' on in the plugin settings to protect your website from DoS/DDoS, XML-RPC attacks.
297
 
298
  = How does the plugin stop spam? =
299
+ Please, note administrator's actions are NOT being checked.
300
 
301
  The plugin uses several simple tests to stop spammers:
302
 
395
 
396
  $cleantalk_url_exclusions = array('url1', 'url2', 'url3');
397
 
398
+ Now, all pages containing strings 'url1', 'url2', or 'url3' will be excluded from anti-spam checking. Remember, that this option will not be applied in registration and comment checking they are always protected from spam. This is similar to regular expression /.*url1.*/ or wildcard like *url1*.
399
 
400
  For example: If you need to except these URLs:
401
  example.com/some/thing
410
 
411
  $cleantalk_ip_exclusions = array('127.0.0.1', '8.8.8.8');
412
 
413
+ Now, all requests from IP 127.0.0.1 and 8.8.8.8 will be excluded from anti-spam checking. Remember, that this option will not be applied in registration and comment checking they are always protected from spam.
414
 
415
  = Can I not send my personal data to CleanTalk servers? =
416
  Yes, you can exclude your data. Add this string in your wp-config.php file before defining database constants:
455
  To close the notice please save the plugin settings again or it will be closed automatically within 60 minutes after the renewal.
456
 
457
  = I'm using PHP 4.2 version and i'm getting errors related with JSON. Why does it happens? =
458
+ leanTalk is no longer supports PHP lower than 5.2 version because the support code have incompatibility with PHP 7 version. Please, upgrade your PHP. If you couldn't perform that, let us know about it via support ticket here: https://cleantalk.org/my/support.
459
 
460
  = Should I change anything in the plugin's settings or in my CleanTalk Control Panel when I switch my website from HTTP to HTTPS or vice versa? =
461
  No. You don't need to change anything in the plugin's settings or in your CleanTalk Control Panel. The plugin will work regardless of the protocol.
463
  = How to use Anti-Spam Log? =
464
  The following possibilities are available for you in the Anti-Spam Log:
465
 
466
+ Time period for all spam records you want to see.
467
 
468
+ Filter spam records by their status: Any status, Denied, Approved.
469
 
470
+ Filter spam records by your websites.
471
 
472
+ Filter spam records by country they came from.
473
 
474
+ Filter spam records by IP address, e-mail address or username.
475
 
476
+ Available options for a specific record:
477
 
478
+ * Details see item 4 below.
479
+ * Spam/Not Spam press this string if our system made wrong decision and blocked or approved a registration, a comment ot a contact form submission. More about it here: https://cleantalk.org/faq#feedback_spam
480
+ * Delete delete a record permanently.
481
+ * Personal blacklists go to your website Black&White Lists page.
482
  * Record details: block reason, body of the message, additional caught data.
483
 
484
  = SpamFireWall and AntiSpam - Networks Blocking =
496
 
497
  1. **Move to the Spam folder.** All spam comments will be placed to the folder "Spam" in the WordPress Comments section except comments with Stop-Words. Stop-Word comments will be always stored in the "Pending" folder.
498
 
499
+ You can prevent the proliferation of Spam folder. It can be cleaned automatically using the option "Keep spam comments for 15 days." Enable this option in the settings of the plugin: WordPress Admin Page �> Settings �> Antispam by CleanTalk �> Advanced settings �> enable "Keep spam comments for 15 days" �> Save Changes.
500
 
501
  2. **Move to Trash.** All spam comments will be placed to the folder "Trash" in the WordPress Comments section except comments with Stop-Words. Stop-Word comments will be always stored in the "Pending" folder.
502
 
533
  1. The plugin deletes/removes the existing spam comments and users accounts.
534
 
535
  == Changelog ==
536
+ = 5.82 December 4 2017 =
537
+ * Plugin doesn't use PHP sessions anymore.
538
+ * Bug fixes.
539
+ * Improved update logic.
540
+
541
  = 5.81 November 22 2017 =
542
  * Fixed error with "Show/Hide key" button.
543
  * Slightly improved spam protection for all forms.
1288
  * Fixed account status check logic. Previous version makes unnecessary test API calls when the plugin asks account status check.
1289
 
1290
  = 2.55 2014-07-11 =
1291
+ * Fixed bug with account status function. In backend the plugin showed notice 'Please dont forget to disable CAPTCHA if you have it!' on every page.
1292
 
1293
  = 2.54 2014-07-11 =
1294
  * Fixed signup anti-spam protection logic for BuddyPress registrations.
1497
  * First version
1498
 
1499
  == Upgrade Notice ==
1500
+ = 5.82 November 4 December 2017 =
1501
+ * Plugin doesn't use PHP sessions anymore.
1502
+ * Bug fixes.
1503
+ * Improved update logic.
1504
+
1505
  = 5.81 November 22 2017 =
1506
  * Fixed error with "Show/Hide key" button.
1507
  * Slightly improved spam protection for all forms.
2211
  * Fixed account status check logic. Previous version makes unnecessary test API calls when the plugin asks account status check.
2212
 
2213
  = 2.55 2014-07-11 =
2214
+ * Fixed bug with account status function. In backend the plugin showed notice 'Please dont forget to disable CAPTCHA if you have it!' on every page.
2215
 
2216
  = 2.54 2014-07-11 =
2217
  * Fixed signup anti-spam protection logic for BuddyPress registrations.