Spam protection, AntiSpam, FireWall by CleanTalk - Version 5.159.7

Version Description

Jul 01 2021 = * Fix. Updater fixed.

Download this release

Release Info

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

Code changes from version 5.159.6 to 5.159.7

Files changed (3) hide show
  1. cleantalk.php +1 -1
  2. inc/cleantalk-updater.php +86 -25
  3. readme.txt +4 -1
cleantalk.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Anti-Spam by CleanTalk
4
  Plugin URI: https://cleantalk.org
5
  Description: Max power, all-in-one, no Captcha, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms.
6
- Version: 5.159.6
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: https://cleantalk.org
9
  Text Domain: cleantalk-spam-protect
3
  Plugin Name: Anti-Spam by CleanTalk
4
  Plugin URI: https://cleantalk.org
5
  Description: Max power, all-in-one, no Captcha, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms.
6
+ Version: 5.159.7
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: https://cleantalk.org
9
  Text Domain: cleantalk-spam-protect
inc/cleantalk-updater.php CHANGED
@@ -53,6 +53,17 @@ function apbct_version_standartization($version){
53
  return $version;
54
  }
55
 
 
 
 
 
 
 
 
 
 
 
 
56
  function apbct_update_to_5_50_0(){
57
  global $wpdb;
58
  $wpdb->query('CREATE TABLE IF NOT EXISTS `'. APBCT_TBL_FIREWALL_DATA .'` (
@@ -442,7 +453,11 @@ function apbct_update_to_5_138_0() {
442
  `mask` int(11) unsigned NOT NULL,
443
  INDEX ( `network` , `mask` )
444
  );';
445
- $sqls[] = 'ALTER TABLE `%scleantalk_sfw` ADD COLUMN IF NOT EXISTS status TINYINT(1) NOT NULL DEFAULT 0 AFTER mask;';
 
 
 
 
446
 
447
  // Actions for WPMS
448
  if( APBCT_WPMS ){
@@ -536,12 +551,18 @@ function apbct_update_to_5_142_0() {
536
  `entries` INT DEFAULT 0,
537
  `interval_start` INT NOT NULL,
538
  PRIMARY KEY (`id`));';
539
-
540
- $sqls[] = 'ALTER TABLE `%scleantalk_sfw_logs`
541
- ADD COLUMN IF NOT EXISTS `id` VARCHAR(40) NOT NULL FIRST,
542
- ADD COLUMN IF NOT EXISTS `status` ENUM(\'PASS_SFW\',\'DENY_SFW\',\'PASS_SFW_BY_WHITELIST\',\'PASS_SFW_BY_COOKIE\',\'DENY_ANTIBOT\',\'DENY_ANTICRAWLER\') NOT NULL AFTER `ip`,
 
 
 
543
  DROP PRIMARY KEY,
544
  ADD PRIMARY KEY (`id`);';
 
 
 
545
 
546
  apbct_activation__create_tables( $sqls );
547
 
@@ -627,17 +648,6 @@ function apbct_update_to_5_146_3() {
627
  update_option( 'cleantalk_plugin_request_ids', array() );
628
  }
629
 
630
- //function apbct_update_to_5_146_4() {
631
- //
632
- // global $apbct;
633
- //
634
- // $sqls[] = 'ALTER TABLE `%scleantalk_sfw`
635
- // ADD COLUMN IF NOT EXISTS `id` INT(11) NOT NULL AUTO_INCREMENT FIRST';
636
- //
637
- // apbct_activation__create_tables( $sqls, $apbct->db_prefix );
638
- //
639
- //
640
- //}
641
  function apbct_update_to_5_148_0() {
642
  $cron = new Cron();
643
  $cron->updateTask('antiflood__clear_table', 'apbct_antiflood__clear_table', 86400);
@@ -932,15 +942,25 @@ function apbct_update_to_5_157_0(){
932
  function apbct_update_to_5_158_0(){
933
 
934
  global $apbct, $wpdb;
935
-
936
- $sqls[] = 'ALTER TABLE `%scleantalk_sfw`'
937
- . ' ADD COLUMN IF NOT EXISTS `source` TINYINT(1) NULL DEFAULT NULL AFTER `status`;';
938
-
939
- $sqls[] = 'ALTER TABLE `%scleantalk_sfw_logs`'
940
- . ' ADD COLUMN IF NOT EXISTS `source` TINYINT(1) NULL DEFAULT NULL AFTER `ua_name`,'
941
- . ' ADD COLUMN IF NOT EXISTS `network` VARCHAR(20) NULL DEFAULT NULL AFTER `source`,'
942
- . ' ADD COLUMN IF NOT EXISTS `first_url` VARCHAR(100) NULL DEFAULT NULL AFTER `network`,'
943
- . ' ADD COLUMN IF NOT EXISTS `last_url` VARCHAR(100) NULL DEFAULT NULL AFTER `first_url`;';
 
 
 
 
 
 
 
 
 
 
944
 
945
  if( APBCT_WPMS ){
946
  // Getting all blog ids
@@ -1027,3 +1047,44 @@ function apbct_update_to_5_159_6() {
1027
  $ct_cron->addTask('antiflood__clear_table', 'apbct_antiflood__clear_table', 86400, time() + 300); // Clear Anti-Flood table
1028
  }
1029
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  return $version;
54
  }
55
 
56
+ function apbct_get_table_columns( $table_name ) {
57
+ global $wpdb;
58
+ $query = 'SHOW COLUMNS FROM ' . $table_name;
59
+ $res = $wpdb->get_results( $query, ARRAY_A );
60
+ $columns_names = array();
61
+ foreach ( $res as $column ) {
62
+ $columns_names[] = $column['Field'];
63
+ }
64
+ return $columns_names;
65
+ }
66
+
67
  function apbct_update_to_5_50_0(){
68
  global $wpdb;
69
  $wpdb->query('CREATE TABLE IF NOT EXISTS `'. APBCT_TBL_FIREWALL_DATA .'` (
453
  `mask` int(11) unsigned NOT NULL,
454
  INDEX ( `network` , `mask` )
455
  );';
456
+
457
+ $table_sfw_columns = apbct_get_table_columns( APBCT_TBL_FIREWALL_DATA );
458
+ if( ! in_array( 'status', $table_sfw_columns ) ) {
459
+ $sqls[] = 'ALTER TABLE `%scleantalk_sfw` ADD COLUMN status TINYINT(1) NOT NULL DEFAULT 0 AFTER mask;';
460
+ }
461
 
462
  // Actions for WPMS
463
  if( APBCT_WPMS ){
551
  `entries` INT DEFAULT 0,
552
  `interval_start` INT NOT NULL,
553
  PRIMARY KEY (`id`));';
554
+
555
+ $table_sfw_logs_columns = apbct_get_table_columns( APBCT_TBL_FIREWALL_LOG );
556
+ if( ! in_array( 'id', $table_sfw_logs_columns ) ) {
557
+ $status = ! in_array( 'status', $table_sfw_logs_columns ) ? ' ADD COLUMN `status` ENUM(\'PASS_SFW\',\'DENY_SFW\',\'PASS_SFW_BY_WHITELIST\',\'PASS_SFW_BY_COOKIE\',\'DENY_ANTIBOT\',\'DENY_ANTICRAWLER\') NOT NULL AFTER `ip`,' : '';
558
+ $sqls[] = 'ALTER TABLE `%scleantalk_sfw_logs`
559
+ ADD COLUMN `id` VARCHAR(40) NOT NULL FIRST,
560
+ ' . $status . '
561
  DROP PRIMARY KEY,
562
  ADD PRIMARY KEY (`id`);';
563
+ }
564
+
565
+
566
 
567
  apbct_activation__create_tables( $sqls );
568
 
648
  update_option( 'cleantalk_plugin_request_ids', array() );
649
  }
650
 
 
 
 
 
 
 
 
 
 
 
 
651
  function apbct_update_to_5_148_0() {
652
  $cron = new Cron();
653
  $cron->updateTask('antiflood__clear_table', 'apbct_antiflood__clear_table', 86400);
942
  function apbct_update_to_5_158_0(){
943
 
944
  global $apbct, $wpdb;
945
+
946
+ $table_sfw_columns = apbct_get_table_columns( APBCT_TBL_FIREWALL_DATA );
947
+ $table_sfw_logs_columns = apbct_get_table_columns( APBCT_TBL_FIREWALL_LOG );
948
+
949
+ if( ! in_array( 'source', $table_sfw_columns ) ) {
950
+ $sqls[] = 'ALTER TABLE `%scleantalk_sfw` ADD COLUMN `source` TINYINT(1) NULL DEFAULT NULL AFTER `status`;';
951
+ }
952
+
953
+ if( ! in_array( 'source', $table_sfw_logs_columns ) ) {
954
+ $network = ! in_array( 'network', $table_sfw_logs_columns ) ? ' ADD COLUMN `network` VARCHAR(20) NULL DEFAULT NULL AFTER `source`,' : '';
955
+ $first_url = ! in_array( 'first_url', $table_sfw_logs_columns ) ? ' ADD COLUMN `first_url` VARCHAR(100) NULL DEFAULT NULL AFTER `network`,' : '';
956
+ $last_url = ! in_array( 'last_url', $table_sfw_logs_columns ) ? ' ADD COLUMN `last_url` VARCHAR(100) NULL DEFAULT NULL AFTER `first_url`' : '';
957
+ $sqls[] = 'ALTER TABLE `%scleantalk_sfw_logs`'
958
+ . ' ADD COLUMN `source` TINYINT(1) NULL DEFAULT NULL AFTER `ua_name`,'
959
+ . $network
960
+ . $first_url
961
+ . $last_url
962
+ . ';';
963
+ }
964
 
965
  if( APBCT_WPMS ){
966
  // Getting all blog ids
1047
  $ct_cron->addTask('antiflood__clear_table', 'apbct_antiflood__clear_table', 86400, time() + 300); // Clear Anti-Flood table
1048
  }
1049
  }
1050
+
1051
+ function apbct_update_to_5_159_7() {
1052
+ global $wpdb;
1053
+
1054
+ $table_sfw_columns = apbct_get_table_columns( APBCT_TBL_FIREWALL_DATA );
1055
+ $table_sfw_logs_columns = apbct_get_table_columns( APBCT_TBL_FIREWALL_LOG );
1056
+
1057
+ if( ! in_array( 'source', $table_sfw_columns ) ) {
1058
+ $sqls[] = 'ALTER TABLE `%scleantalk_sfw` ADD COLUMN `source` TINYINT(1) NULL DEFAULT NULL AFTER `status`;';
1059
+ }
1060
+
1061
+ if( ! in_array( 'source', $table_sfw_logs_columns ) ) {
1062
+ $network = ! in_array( 'network', $table_sfw_logs_columns ) ? ' ADD COLUMN `network` VARCHAR(20) NULL DEFAULT NULL AFTER `source`,' : '';
1063
+ $first_url = ! in_array( 'first_url', $table_sfw_logs_columns ) ? ' ADD COLUMN `first_url` VARCHAR(100) NULL DEFAULT NULL AFTER `network`,' : '';
1064
+ $last_url = ! in_array( 'last_url', $table_sfw_logs_columns ) ? ' ADD COLUMN `last_url` VARCHAR(100) NULL DEFAULT NULL AFTER `first_url`' : '';
1065
+ $sqls[] = 'ALTER TABLE `%scleantalk_sfw_logs`'
1066
+ . ' ADD COLUMN `source` TINYINT(1) NULL DEFAULT NULL AFTER `ua_name`,'
1067
+ . $network
1068
+ . $first_url
1069
+ . $last_url
1070
+ . ';';
1071
+ }
1072
+
1073
+ if( APBCT_WPMS ){
1074
+ // Getting all blog ids
1075
+ $initial_blog = get_current_blog_id();
1076
+ $blogs = array_keys($wpdb->get_results('SELECT blog_id FROM '. $wpdb->blogs, OBJECT_K));
1077
+
1078
+ foreach ($blogs as $blog) {
1079
+
1080
+ switch_to_blog($blog);
1081
+ apbct_activation__create_tables($sqls);
1082
+ }
1083
+
1084
+ // Restoring initial blog
1085
+ switch_to_blog($initial_blog);
1086
+
1087
+ }else{
1088
+ apbct_activation__create_tables($sqls);
1089
+ }
1090
+ }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: spam, antispam, anti-spam, comments, firewall
4
  Requires at least: 3.0
5
  Tested up to: 5.7
6
  Requires PHP: 5.6
7
- Stable tag: 5.159.6
8
  License: GPLv2
9
 
10
  Spam protection, anti-spam, firewall, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
@@ -573,6 +573,9 @@ If your website has forms that send data to external sources, you can enable opt
573
 
574
  == Changelog ==
575
 
 
 
 
576
  = 5.159.6 Jun 30 2021 =
577
  * New. Rest API request detecting implemented.
578
  * Upd. SFW. AntiCrawler was disabled for the new installations.
4
  Requires at least: 3.0
5
  Tested up to: 5.7
6
  Requires PHP: 5.6
7
+ Stable tag: 5.159.7
8
  License: GPLv2
9
 
10
  Spam protection, anti-spam, firewall, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
573
 
574
  == Changelog ==
575
 
576
+ = 5.159.7 Jul 01 2021 =
577
+ * Fix. Updater fixed.
578
+
579
  = 5.159.6 Jun 30 2021 =
580
  * New. Rest API request detecting implemented.
581
  * Upd. SFW. AntiCrawler was disabled for the new installations.