Skip to content

Commit 3f3c507

Browse files
authored
Merge pull request #6 from CleanTalk/dev
Fixed antispam_activity_status after saved settings
2 parents e7eb4e3 + cef3aa3 commit 3f3c507

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

cleantalk/inc/cron_functions.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,14 @@ function apbct_sfw_send_logs(){
5252
*/
5353
function apbct__plugin_get_latest_version() {
5454
$path_to_config = CLEANTALK_ROOT . 'config.php';
55+
global $antispam_activity_status;
5556

5657
$updater = new \Cleantalk\Updater\Updater( CLEANTALK_ROOT );
5758
$latest_version = $updater->getLatestVersion();
5859
File::clean__variable($path_to_config, 'latest_version');
5960
File::inject__variable($path_to_config, 'latest_version', $latest_version);
60-
File::clean__variable(CLEANTALK_CONFIG_FILE, 'antispam_activity_status');
61-
File::inject__variable(CLEANTALK_CONFIG_FILE, 'antispam_activity_status', true);
61+
if (! isset($antispam_activity_status)) {
62+
File::clean__variable($path_to_config, 'antispam_activity_status');
63+
File::inject__variable($path_to_config, 'antispam_activity_status', true);
64+
}
6265
}

cleantalk/settings.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
$path_to_config = CLEANTALK_ROOT . 'config.php';
5656
$apikey = Post::get( 'apikey' );
5757
global $account_name_ob;
58+
global $antispam_activity_status;
5859

5960
/**
6061
* Apikey validation
@@ -79,8 +80,14 @@
7980
die(Err::add('Please, enter the access key')->get_last( 'as_json' ));
8081
}
8182

83+
if (! isset($antispam_activity_status) && Post::is_set( 'antispam_activity_status' )) {
84+
File::clean__variable($path_to_config, 'antispam_activity_status');
85+
File::inject__variable($path_to_config, 'antispam_activity_status', (bool)Post::get( 'antispam_activity_status' ));
86+
} else {
87+
File::replace__variable( $path_to_config, 'antispam_activity_status', (bool)Post::get( 'antispam_activity_status' ) );
88+
}
89+
8290
File::replace__variable( $path_to_config, 'apikey', $apikey );
83-
File::replace__variable( $path_to_config, 'antispam_activity_status', (bool)Post::get( 'antispam_activity_status' ) );
8491
File::replace__variable( $path_to_config, 'registrations_test', (bool)Post::get( 'registrations_test' ) );
8592
File::replace__variable( $path_to_config, 'general_postdata_test', (bool)Post::get( 'general_postdata_test' ) );
8693
File::replace__variable( $path_to_config, 'spam_firewall', (bool)Post::get( 'spam_firewall' ) );

0 commit comments

Comments
 (0)