Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions cleantalk.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
<?php
/*
Plugin Name: Anti-Spam by CleanTalk
Plugin Name: Anti-Spam by CleanTalk
Plugin URI: http://cleantalk.org
Description: Max power, all-in-one, captcha less, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms.
Version: 5.39.1
Version: 5.40.4
Author: СleanTalk <welcome@cleantalk.org>
Author URI: http://cleantalk.org
*/
$cleantalk_plugin_version='5.39.1';
$ct_agent_version = 'wordpress-5391';
$cleantalk_plugin_version='5.40.4';
$ct_agent_version = 'wordpress-5404';
$cleantalk_executed=false;
$ct_sfw_updated = false;

if(defined('CLEANTALK_AJAX_USE_BUFFER'))
{
Expand Down Expand Up @@ -453,7 +454,7 @@ function ct_show_comment_link()

function cleantalk_update_sfw()
{
global $wpdb;
global $wpdb, $ct_sfw_updated;

if(!function_exists('sendRawRequest'))
{
Expand All @@ -468,14 +469,14 @@ function cleantalk_update_sfw()
{
$value=0;
}
if($value==1)

if($value==1 && $ct_sfw_updated === false)
{
$data = Array( 'auth_key' => $ct_options['apikey'],
'method_name' => '2s_blacklists_db'
);

$result=sendRawRequest('https://api.cleantalk.org/2.1', $data);
$result=sendRawRequest('https://api.cleantalk.org', $data);
$result=json_decode($result, true);
if(isset($result['data']))
{
Expand All @@ -500,6 +501,7 @@ function cleantalk_update_sfw()
}
}
$wpdb->query($query);
$ct_sfw_updated = true;
}
}
}
Expand Down
Binary file modified i18n/cleantalk-ru_RU.mo
Binary file not shown.
43 changes: 33 additions & 10 deletions inc/cleantalk-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ function ct_admin_add_page() {
*/
function ct_admin_init()
{
global $ct_server_timeout, $show_ct_notice_autokey, $ct_notice_autokey_label, $ct_notice_autokey_value, $show_ct_notice_renew, $ct_notice_renew_label, $show_ct_notice_trial, $ct_notice_trial_label, $show_ct_notice_online, $ct_notice_online_label, $renew_notice_showtime, $trial_notice_showtime, $ct_plugin_name, $ct_options, $ct_data, $trial_notice_check_timeout, $account_notice_check_timeout, $ct_user_token_label, $cleantalk_plugin_version, $notice_check_timeout;
global $ct_server_timeout, $show_ct_notice_autokey, $ct_notice_autokey_label, $ct_notice_autokey_value, $show_ct_notice_renew, $ct_notice_renew_label, $show_ct_notice_trial, $ct_notice_trial_label, $show_ct_notice_online, $ct_notice_online_label, $renew_notice_showtime, $trial_notice_showtime, $ct_plugin_name, $ct_options, $ct_data, $trial_notice_check_timeout, $account_notice_check_timeout, $ct_user_token_label, $cleantalk_plugin_version, $notice_check_timeout, $renew_notice_check_timeout;

$ct_options = ct_get_options();
$ct_data = ct_get_data();
Expand Down Expand Up @@ -219,7 +219,7 @@ function ct_admin_init()
isset($_POST['cleantalk_settings']['apikey']))
{
$result = false;

$notice_check_timeout = $account_notice_check_timeout;
//if (true)
//{
if(!function_exists('noticePaidTill'))
Expand Down Expand Up @@ -257,17 +257,17 @@ function ct_admin_init()
}
if ($result['show_notice'] == 1 && isset($result['renew']) && $result['renew'] == 1)
{
$notice_check_timeout = $account_notice_check_timeout;
$notice_check_timeout = $renew_notice_check_timeout;
$show_ct_notice_renew = true;
$ct_data['show_ct_notice_renew']=1;
}

if ($result['show_notice'] == 0)
{
$notice_check_timeout = $account_notice_check_timeout;
$ct_data['show_ct_notice_trial']=0;
$ct_data['show_ct_notice_renew']=0;
}
$ct_data['show_ct_notice_trial']=(int) $show_ct_notice_trial;
$ct_data['show_ct_notice_renew']= (int) $show_ct_notice_renew;
}

if (isset($result['moderate_ip']) && $result['moderate_ip'] == 1)
Expand All @@ -286,9 +286,8 @@ function ct_admin_init()
$ct_data['user_token'] = $result['user_token'];
}
}

// Save next status request time
$ct_data['next_account_status_check'] = time()+86400;
$ct_data['next_account_status_check'] = time() + $notice_check_timeout * 3600;
update_option('cleantalk_data', $ct_data);
//}

Expand Down Expand Up @@ -399,7 +398,8 @@ function ct_admin_init()
add_settings_field('cleantalk_check_external', __('Protect external forms', 'cleantalk'), 'ct_input_check_external', 'cleantalk', 'cleantalk_settings_anti_spam');
add_settings_field('cleantalk_check_comments_number', __("Don't check comments", 'cleantalk'), 'ct_input_check_comments_number', 'cleantalk', 'cleantalk_settings_anti_spam');
add_settings_field('cleantalk_set_cookies', __("Set cookies", 'cleantalk'), 'ct_input_set_cookies', 'cleantalk', 'cleantalk_settings_anti_spam');
//add_settings_field('cleantalk_check_messages_number', __("Don't check messages", 'cleantalk'), 'ct_input_check_messages_number', 'cleantalk', 'cleantalk_settings_anti_spam');
add_settings_field('cleantalk_ssl_on', __("Use SSL", 'cleantalk'), 'ct_input_ssl_on', 'cleantalk', 'cleantalk_settings_anti_spam');

add_settings_field('cleantalk_spam_firewall', __('', 'cleantalk'), 'ct_input_spam_firewall', 'cleantalk', 'cleantalk_settings_banner');
add_settings_field('cleantalk_collect_details', __('Collect details about browsers', 'cleantalk'), 'ct_input_collect_details', 'cleantalk', 'cleantalk_settings_anti_spam');
add_settings_field('cleantalk_show_link', __('', 'cleantalk'), 'ct_input_show_link', 'cleantalk', 'cleantalk_settings_banner');
Expand Down Expand Up @@ -906,7 +906,27 @@ function ct_input_set_cookies() {
echo "<input type='radio' id='cleantalk_set_cookies1' name='cleantalk_settings[set_cookies]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_set_cookies1'> " . __('Yes') . "</label>";
echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
echo "<input type='radio' id='cleantalk_set_cookies0' name='cleantalk_settings[set_cookies]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_set_cookies0'> " . __('No') . "</label>";
@admin_addDescriptionsFields(sprintf(__('Turn this option off to deny plugin generates any cookies on website fronentd. This option is helpfull if you use Varnish. But most of contact forms will not be protected by CleanTalk if the option is turnded off!', 'cleantalk')));
@admin_addDescriptionsFields(sprintf(__('Turn this option off to deny plugin generates any cookies on website front-end. This option is helpful if you use Varnish. But most of contact forms will not be protected by CleanTalk if the option is turned off!', 'cleantalk')));
}

function ct_input_ssl_on() {
global $ct_options, $ct_data;

$ct_options = ct_get_options();
$ct_data = ct_get_data();

if(isset($ct_options['ssl_on']))
{
$value = @intval($ct_options['ssl_on']);
}
else
{
$value=0;
}
echo "<input type='radio' id='cleantalk_ssl_on1' name='cleantalk_settings[ssl_on]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_ssl_on1'> " . __('Yes') . "</label>";
echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
echo "<input type='radio' id='cleantalk_ssl_on0' name='cleantalk_settings[ssl_on]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_ssl_on0'> " . __('No') . "</label>";
@admin_addDescriptionsFields(sprintf(__('Turn this option on to use encrypted (SSL) connection with CleanTalk servers.', 'cleantalk')));
}

function ct_input_show_link() {
Expand Down Expand Up @@ -956,7 +976,10 @@ function ct_input_spam_firewall() {

echo "<div id='cleantalk_anchor1' style='display:none'></div><input type=hidden name='cleantalk_settings[spam_firewall]' value='0' />";
echo "<input type='checkbox' id='cleantalk_spam_firewall1' name='cleantalk_settings[spam_firewall]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_spam_firewall1'> " . __('SpamFireWall') . "</label>";
@admin_addDescriptionsFields(sprintf(__("This option allows to filter spam bots before they access website. Also reduces CPU usage on hosting server and accelerates pages load time.", 'cleantalk'), $ct_options['spam_firewall']));
@admin_addDescriptionsFields(sprintf(__("This option allows to filter spam bots before they access website. Also reduces CPU usage on hosting server and accelerates pages load time.", 'cleantalk'), $ct_options['spam_firewall']) .
" " .
'<a href="https://cleantalk.org/cleantalk-spam-firewall" style="font-size: 10pt; color: #666 !important" target="_blank">' . __('Learn more') . '</a>.'
);
echo "<script>
jQuery(document).ready(function(){
jQuery('#cleantalk_anchor1').parent().parent().children().first().hide();
Expand Down
59 changes: 26 additions & 33 deletions inc/cleantalk-ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,39 +292,14 @@ function ct_user_register_ajaxlogin($user_id)
return $user_id;
}

function ct_get_fields(&$email,&$message,$arr)
{
foreach($arr as $key=>$value)
{
if(!is_array($value))
{
if ($email === null && preg_match("/^\S+@\S+\.\S+$/", $value))
{
$email = $value;
}
else
{
$message.="$value\n";
}
}
else
{
ct_get_fields($email,$message,$value);
}
}
}

function ct_ajax_hook()
{
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
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;

$ct_options = ct_get_options();
$ct_data = ct_get_data();
$sender_email = null;
$message = '';
$nickname=null;


//
// Skip test if Custom contact forms is disabled.
//
Expand All @@ -342,13 +317,14 @@ function ct_ajax_hook()
//
// Go out because of not spam data
//
$gmw_actions = array(
'gmaps_display_info_window',
'gmw_ps_display_info_window'
$skip_post = array(
'gmaps_display_info_window', // Geo My WP pop-up windows.
'gmw_ps_display_info_window', // Geo My WP pop-up windows.
'the_champ_user_auth', // Super Socializer
);
$checkjs = js_test('ct_checkjs', $_COOKIE, true);
if ($checkjs && // Spammers usually fail the JS test
(isset($_POST['action']) && in_array($_POST['action'], $gmw_actions)) // Geo My WP pop-up windows.
(isset($_POST['action']) && in_array($_POST['action'], $skip_post))
) {
return false;
}
Expand All @@ -374,8 +350,19 @@ function ct_ajax_hook()
$_POST['target']=1;
}

ct_get_fields($sender_email,$message,$_POST);

$temp=ct_get_fields_any($_POST);

$sender_email = ($temp['email'] ? $temp['email'] : '');
$sender_nickname = ($temp['nickname'] ? $temp['nickname'] : '');
$subject = ($temp['subject'] ? $temp['subject'] : '');
$contact_form = ($temp['contact'] ? $temp['contact'] : '');
$message = ($temp['message'] ? $temp['message'] : array());

if ($subject != '') {
$message = array_merge(array('subject' => $subject), $message);
}
$message = json_encode($message);

if(isset($_POST['cscf']['confirm-email']))
{
$_POST['cscf']['confirm-email']=$tmp;
Expand All @@ -397,14 +384,20 @@ function ct_ajax_hook()
{
$sender_info= '';
}

$post_info['comment_type'] = 'feedback_ajax';
$post_info = json_encode($post_info);
if ($post_info === false)
$post_info = '';


$ct_base_call_result = ct_base_call(array(
'message' => $message,
'example' => null,
'sender_email' => $sender_email,
'sender_nickname' => $nickname,
'sender_info' => $sender_info,
'post_info'=>null,
'post_info'=> $post_info,
'checkjs' => $checkjs));

$ct = $ct_base_call_result['ct'];
Expand Down
Loading