Skip to content

Commit 6d8d579

Browse files
committed
Merge remote-tracking branch 'origin/dev' into master
2 parents e7f140e + 505d35f commit 6d8d579

File tree

18 files changed

+1354
-364
lines changed

18 files changed

+1354
-364
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ php-uni
22
=======
33
[![Build Status](https://travis-ci.org/CleanTalk/php-uni.svg)](https://travis-ci.org/CleanTalk/php-uni)
44

5-
# Version 2.5.4
5+
# Version 2.6.0
66

77
Module for any CMS
88
## Installation

cleantalk/config.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
$registrations_test = true;
66
$general_postdata_test = false;
77
$spam_firewall = true;
8+
$general_post_exclusion_usage = false;
89

910
// Statistics
1011
$sfw_last_update = 0;

cleantalk/inc/admin.php

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,27 +74,27 @@ function install_config( $modified_files, $api_key, $cms, $exclusions ){
7474
// Attention. Backwards order because inserting it step by step
7575

7676
$pass = 'NO PASS';
77-
$email = '';
77+
$uni_email = '';
7878

7979
if( Post::get( 'admin_password' ) ) {
8080
$pass = trim( Post::get( 'admin_password' ) );
8181
File::inject__variable( $path_to_config, 'password', hash( 'sha256', trim( Post::get( 'admin_password' ) ) ) );
8282
}
8383

8484
if( Post::get( 'email' ) ) {
85-
$email = trim( Post::get( 'email' ) );
86-
File::inject__variable( $path_to_config, 'email', trim( Post::get( 'email' ) ) );
85+
$uni_email = trim( Post::get( 'email' ) );
86+
File::inject__variable( $path_to_config, 'uni_email', trim( Post::get( 'email' ) ) );
8787
}
8888

8989
if( Post::get( 'user_token' ) )
9090
File::inject__variable( $path_to_config, 'user_token', trim( Post::get( 'user_token' ) ) );
9191
if( Post::get( 'account_name_ob' ) )
9292
File::inject__variable( $path_to_config, 'account_name_ob', trim( Post::get( 'account_name_ob' ) ) );
9393

94-
if($email) {
94+
if($uni_email) {
9595
$host = $_SERVER['HTTP_HOST'] ?: 'Your Site';
96-
$to = $email;
97-
$login = $email;
96+
$to = $uni_email;
97+
$login = $uni_email;
9898
$subject = 'Universal Anti-Spam Plugin settings for ' . $host;
9999
$message = "Hi,<br><br>
100100
Your credentials to get access to settings of Universal Anti-Spam Plugin by CleanTalk are bellow,<br><br>
@@ -125,6 +125,7 @@ function install_config( $modified_files, $api_key, $cms, $exclusions ){
125125
if( $exclusions )
126126
File::inject__variable( $path_to_config, 'exclusions', $exclusions, true );
127127
File::inject__variable( $path_to_config, 'apikey', $api_key );
128+
File::inject__variable( $path_to_config, 'exclusion_key', md5($api_key) );
128129
File::inject__variable( $path_to_config, 'detected_cms', $cms );
129130
File::inject__variable( $path_to_config, 'is_installed', true );
130131
}
@@ -149,7 +150,8 @@ function uninstall( $files = array() ){
149150
File::clean__variable( $path_to_config, 'password' );
150151
File::clean__variable( $path_to_config, 'salt' );
151152
File::clean__variable( $path_to_config, 'apikey' );
152-
File::clean__variable( $path_to_config, 'email' );
153+
File::clean__variable( $path_to_config, 'exclusion_key' );
154+
File::clean__variable( $path_to_config, 'uni_email' );
153155
File::clean__variable( $path_to_config, 'user_token' );
154156
File::clean__variable( $path_to_config, 'account_name_ob' );
155157
File::clean__variable( $path_to_config, 'detected_cms' );
@@ -166,6 +168,7 @@ function uninstall( $files = array() ){
166168
File::replace__variable( $path_to_config, 'registrations_test', true );
167169
File::replace__variable( $path_to_config, 'general_postdata_test', false );
168170
File::replace__variable( $path_to_config, 'spam_firewall', true );
171+
File::replace__variable( $path_to_config, 'general_post_exclusion_usage', false );
169172

170173
// Deleting cron tasks
171174
File::replace__variable( CLEANTALK_CRON_FILE, 'tasks', array() );
@@ -229,11 +232,15 @@ function detect_cms( $path_to_index, $out = 'Unknown' ){
229232
function apbct__plugin_update_message() {
230233
global $latest_version;
231234

235+
if (!$latest_version) {
236+
$latest_version = APBCT_VERSION;
237+
}
238+
232239
if( version_compare( APBCT_VERSION, $latest_version ) === -1 ){
233240
echo '<p class="text-center">There is a newer version. Update to the latest ' . $latest_version . '</p>';
234241
echo '<p class="text-center"><button id="btn-update" form="none" class="btn btn-setup" value="">Update</button><img class="ajax-preloader" src="img/preloader.gif"></p>';
235242
}elseif( version_compare( APBCT_VERSION, $latest_version ) === 1 ){
236-
echo '<p class="text-center">You are using more than the latest version '. APBCT_VERSION . '</p>';
243+
echo '<p class="text-center">You are using a higher version than the latest version '. APBCT_VERSION . '</p>';
237244
}else{
238245
echo '<p class="text-center">You are using the latest version '. APBCT_VERSION . '</p>';
239246
}

cleantalk/inc/common.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
define('APBCT_PLUGIN', 'uni');
4-
define('APBCT_VERSION', '2.5.4');
4+
define('APBCT_VERSION', '2.6.0');
55
define('APBCT_AGENT', APBCT_PLUGIN . '-' . str_replace( '.', '', APBCT_VERSION ) );
66
define('APBCT_USER_AGENT', 'Cleantalk-Antispam-Universal-Plugin/' . APBCT_VERSION);
77

@@ -14,7 +14,9 @@ function apbct_restore_include_path(){
1414
}
1515

1616
$ds = DIRECTORY_SEPARATOR;
17-
define( 'DS', DIRECTORY_SEPARATOR );
17+
if ( ! defined('DS') ) {
18+
define( 'DS', DIRECTORY_SEPARATOR );
19+
}
1820
define( 'CLEANTALK_SITE_ROOT', realpath(__DIR__ . "$ds..$ds..$ds" ) . $ds );
1921
define( 'CLEANTALK_ROOT', CLEANTALK_SITE_ROOT . 'cleantalk' . $ds );
2022
define( 'CLEANTALK_LIB', CLEANTALK_ROOT . 'lib' . $ds );

cleantalk/inc/cron_functions.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,15 @@ function apbct__plugin_get_latest_version() {
5555
global $antispam_activity_status;
5656

5757
$updater = new \Cleantalk\Updater\Updater( CLEANTALK_ROOT );
58-
$latest_version = $updater->getLatestVersion();
59-
File::clean__variable($path_to_config, 'latest_version');
60-
File::inject__variable($path_to_config, 'latest_version', $latest_version);
58+
$latest_version = $updater->getLatestRelease();
59+
60+
if (isset($latest_version['error'])){
61+
Err::add($latest_version['error']);
62+
} else {
63+
File::clean__variable($path_to_config, 'latest_version');
64+
File::inject__variable($path_to_config, 'latest_version', $latest_version);
65+
}
66+
6167
if (! isset($antispam_activity_status)) {
6268
File::clean__variable($path_to_config, 'antispam_activity_status');
6369
File::inject__variable($path_to_config, 'antispam_activity_status', true);

0 commit comments

Comments
 (0)