Version Description
2015-10-13 = * Improvements in Spam FireWall feature * Code optimization * Backend interface fixes
Download this release
Release Info
Developer | Vlad Cleantalk |
Plugin | Spam protection, AntiSpam, FireWall by CleanTalk |
Version | 5.27 |
Comparing to | |
See all releases |
Code changes from version 5.26 to 5.27
- cleantalk.php +18 -18
- JSON.php → inc/JSON.php +0 -0
- cleantalk-admin.js → inc/cleantalk-admin.js +0 -0
- cleantalk-admin.php → inc/cleantalk-admin.php +12 -11
- inc/cleantalk-admin_old.php +1219 -0
- cleantalk-ajax.php → inc/cleantalk-ajax.php +0 -0
- inc/cleantalk-ajax_old.php +775 -0
- cleantalk-comments-checkspam.js → inc/cleantalk-comments-checkspam.js +0 -0
- cleantalk-comments-editscreen.js → inc/cleantalk-comments-editscreen.js +0 -0
- cleantalk-comments.php → inc/cleantalk-comments.php +0 -0
- cleantalk-common.php → inc/cleantalk-common.php +1 -1
- cleantalk-public.php → inc/cleantalk-public.php +18 -8
- cleantalk-rel.js → inc/cleantalk-rel.js +0 -0
- cleantalk-sfw.class.php → inc/cleantalk-sfw.class.php +8 -0
- cleantalk-sfw.php → inc/cleantalk-sfw.php +0 -0
- cleantalk-stats.js → inc/cleantalk-stats.js +0 -0
- cleantalk-users-checkspam.js → inc/cleantalk-users-checkspam.js +0 -0
- cleantalk-users-editscreen.js → inc/cleantalk-users-editscreen.js +0 -0
- cleantalk-users.php → inc/cleantalk-users.php +0 -0
- cleantalk-widget.php → inc/cleantalk-widget.php +0 -0
- cleantalk.class.php → inc/cleantalk.class.php +0 -0
- inc/cleantalk_api.php +127 -0
- cleantalk_external.js → inc/cleantalk_external.js +0 -0
- cleantalk_nocache.js → inc/cleantalk_nocache.js +2 -2
- sfw_die_page.html → inc/sfw_die_page.html +0 -0
- readme.txt +14 -4
- screenshot-1.png +0 -0
cleantalk.php
CHANGED
@@ -3,11 +3,11 @@
|
|
3 |
Plugin Name: Anti-spam by CleanTalk
|
4 |
Plugin URI: http://cleantalk.org
|
5 |
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.
|
6 |
-
Version: 5.
|
7 |
Author: СleanTalk <welcome@cleantalk.org>
|
8 |
Author URI: http://cleantalk.org
|
9 |
*/
|
10 |
-
$cleantalk_plugin_version='5.
|
11 |
$cleantalk_executed=false;
|
12 |
|
13 |
if(defined('CLEANTALK_AJAX_USE_BUFFER'))
|
@@ -33,8 +33,8 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
|
|
33 |
global $ct_options, $ct_data;
|
34 |
|
35 |
|
36 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-common.php');
|
37 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-widget.php');
|
38 |
$ct_options=ct_get_options();
|
39 |
$ct_data=ct_get_data();
|
40 |
|
@@ -47,7 +47,7 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
|
|
47 |
$value=0;
|
48 |
}
|
49 |
|
50 |
-
if($value==1 &&
|
51 |
{
|
52 |
$is_sfw_check=true;
|
53 |
if(isset($_COOKIE['ct_sfw_pass_key']) && $_COOKIE['ct_sfw_pass_key']==md5(cleantalk_get_ip().$ct_options['apikey']))
|
@@ -59,7 +59,7 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
|
|
59 |
if($is_sfw_check)
|
60 |
{
|
61 |
//include_once("cleantalk-sfw.php");
|
62 |
-
include_once("cleantalk-sfw.class.php");
|
63 |
$sfw = new CleanTalkSFW();
|
64 |
$sfw->cleantalk_get_real_ip();
|
65 |
$sfw->check_ip();
|
@@ -154,7 +154,7 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
|
|
154 |
|
155 |
if (is_admin() && !isset($_GET['P3_HIDE_ADMIN_BAR']) && !isset($_POST['P3_HIDE_ADMIN_BAR']) && !isset($_POST['P3_NOCACHE']) && !isset($_GET['P3_NOCACHE']))
|
156 |
{
|
157 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-admin.php');
|
158 |
if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)) {
|
159 |
add_action('admin_init', 'ct_admin_init', 1);
|
160 |
add_action('admin_menu', 'ct_admin_add_page');
|
@@ -162,8 +162,8 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
|
|
162 |
}
|
163 |
if (defined( 'DOING_AJAX' ) && DOING_AJAX||isset($_POST['cma-action']))
|
164 |
{
|
165 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
|
166 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-ajax.php');
|
167 |
}
|
168 |
|
169 |
add_action('admin_enqueue_scripts', 'ct_enqueue_scripts');
|
@@ -179,7 +179,7 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
|
|
179 |
add_filter('plugin_action_links', 'ct_plugin_action_links', 10, 2);
|
180 |
add_action('updated_option', 'ct_update_option'); // param - option name, i.e. 'cleantalk_settings'
|
181 |
}else{
|
182 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
|
183 |
|
184 |
// Init action.
|
185 |
//add_action('init', 'ct_init', 1);
|
@@ -310,11 +310,11 @@ function ct_add_nocache_script()
|
|
310 |
function ct_add_nocache_script_footer()
|
311 |
{
|
312 |
global $test_external_forms, $cleantalk_plugin_version;
|
313 |
-
print "<script async type='text/javascript' src='".plugins_url( '/cleantalk_nocache.js' , __FILE__ )."?random=".$cleantalk_plugin_version."'></script>\n";
|
314 |
if($test_external_forms)
|
315 |
{
|
316 |
print "\n<script type='text/javascript'>var ct_blog_home = '".get_home_url()."';</script>\n";
|
317 |
-
print "<script async type='text/javascript' src='".plugins_url( '/cleantalk_external.js' , __FILE__ )."?random=".$cleantalk_plugin_version."'></script>\n";
|
318 |
}
|
319 |
}
|
320 |
|
@@ -329,11 +329,11 @@ function ct_inject_nocache_script($html)
|
|
329 |
if(!is_admin()&&stripos($html,"</body")!==false)
|
330 |
{
|
331 |
//$ct_replace.="\n<script type='text/javascript'>var ajaxurl = '".admin_url('admin-ajax.php')."';</script>\n";
|
332 |
-
$ct_replace="<script async type='text/javascript' src='".plugins_url( '/cleantalk_nocache.js' , __FILE__ )."?random=".$cleantalk_plugin_version."'></script>\n";
|
333 |
if($test_external_forms)
|
334 |
{
|
335 |
$ct_replace.="\n<script type='text/javascript'>var ct_blog_home = '".get_home_url()."';</script>\n";
|
336 |
-
$ct_replace.="<script async type='text/javascript' src='".plugins_url( '/cleantalk_external.js' , __FILE__ )."?random=".$cleantalk_plugin_version."'></script>\n";
|
337 |
}
|
338 |
|
339 |
//$html=str_ireplace("</body",$ct_replace."</body",$html);
|
@@ -348,8 +348,8 @@ function ct_inject_nocache_script($html)
|
|
348 |
}
|
349 |
if(is_admin())
|
350 |
{
|
351 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-comments.php');
|
352 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-users.php');
|
353 |
}
|
354 |
if(isset($_GET['ait-action'])&&$_GET['ait-action']=='register')
|
355 |
{
|
@@ -370,7 +370,7 @@ function cleantalk_update_sfw()
|
|
370 |
{
|
371 |
if(!function_exists('sendRawRequest'))
|
372 |
{
|
373 |
-
require_once('cleantalk.class.php');
|
374 |
}
|
375 |
global $ct_options, $ct_data, $wpdb;
|
376 |
if(isset($ct_options['spam_firewall']))
|
@@ -486,7 +486,7 @@ function ct_send_sfw_log()
|
|
486 |
}
|
487 |
|
488 |
}*/
|
489 |
-
include_once("cleantalk-sfw.class.php");
|
490 |
$sfw = new CleanTalkSFW();
|
491 |
$sfw->send_logs();
|
492 |
}
|
3 |
Plugin Name: Anti-spam by CleanTalk
|
4 |
Plugin URI: http://cleantalk.org
|
5 |
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.
|
6 |
+
Version: 5.27
|
7 |
Author: СleanTalk <welcome@cleantalk.org>
|
8 |
Author URI: http://cleantalk.org
|
9 |
*/
|
10 |
+
$cleantalk_plugin_version='5.27';
|
11 |
$cleantalk_executed=false;
|
12 |
|
13 |
if(defined('CLEANTALK_AJAX_USE_BUFFER'))
|
33 |
global $ct_options, $ct_data;
|
34 |
|
35 |
|
36 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-common.php');
|
37 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-widget.php');
|
38 |
$ct_options=ct_get_options();
|
39 |
$ct_data=ct_get_data();
|
40 |
|
47 |
$value=0;
|
48 |
}
|
49 |
|
50 |
+
if($value==1 && !is_admin() && stripos($_SERVER['REQUEST_URI'],'/wp-admin/')===false) //&& (!isset($_POST) || isset($_POST) && sizeof($_POST)==0)
|
51 |
{
|
52 |
$is_sfw_check=true;
|
53 |
if(isset($_COOKIE['ct_sfw_pass_key']) && $_COOKIE['ct_sfw_pass_key']==md5(cleantalk_get_ip().$ct_options['apikey']))
|
59 |
if($is_sfw_check)
|
60 |
{
|
61 |
//include_once("cleantalk-sfw.php");
|
62 |
+
include_once("inc/cleantalk-sfw.class.php");
|
63 |
$sfw = new CleanTalkSFW();
|
64 |
$sfw->cleantalk_get_real_ip();
|
65 |
$sfw->check_ip();
|
154 |
|
155 |
if (is_admin() && !isset($_GET['P3_HIDE_ADMIN_BAR']) && !isset($_POST['P3_HIDE_ADMIN_BAR']) && !isset($_POST['P3_NOCACHE']) && !isset($_GET['P3_NOCACHE']))
|
156 |
{
|
157 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-admin.php');
|
158 |
if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)) {
|
159 |
add_action('admin_init', 'ct_admin_init', 1);
|
160 |
add_action('admin_menu', 'ct_admin_add_page');
|
162 |
}
|
163 |
if (defined( 'DOING_AJAX' ) && DOING_AJAX||isset($_POST['cma-action']))
|
164 |
{
|
165 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
|
166 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-ajax.php');
|
167 |
}
|
168 |
|
169 |
add_action('admin_enqueue_scripts', 'ct_enqueue_scripts');
|
179 |
add_filter('plugin_action_links', 'ct_plugin_action_links', 10, 2);
|
180 |
add_action('updated_option', 'ct_update_option'); // param - option name, i.e. 'cleantalk_settings'
|
181 |
}else{
|
182 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
|
183 |
|
184 |
// Init action.
|
185 |
//add_action('init', 'ct_init', 1);
|
310 |
function ct_add_nocache_script_footer()
|
311 |
{
|
312 |
global $test_external_forms, $cleantalk_plugin_version;
|
313 |
+
print "<script async type='text/javascript' src='".plugins_url( '/inc/cleantalk_nocache.js' , __FILE__ )."?random=".$cleantalk_plugin_version."'></script>\n";
|
314 |
if($test_external_forms)
|
315 |
{
|
316 |
print "\n<script type='text/javascript'>var ct_blog_home = '".get_home_url()."';</script>\n";
|
317 |
+
print "<script async type='text/javascript' src='".plugins_url( '/inc/cleantalk_external.js' , __FILE__ )."?random=".$cleantalk_plugin_version."'></script>\n";
|
318 |
}
|
319 |
}
|
320 |
|
329 |
if(!is_admin()&&stripos($html,"</body")!==false)
|
330 |
{
|
331 |
//$ct_replace.="\n<script type='text/javascript'>var ajaxurl = '".admin_url('admin-ajax.php')."';</script>\n";
|
332 |
+
$ct_replace="<script async type='text/javascript' src='".plugins_url( '/inc/cleantalk_nocache.js' , __FILE__ )."?random=".$cleantalk_plugin_version."'></script>\n";
|
333 |
if($test_external_forms)
|
334 |
{
|
335 |
$ct_replace.="\n<script type='text/javascript'>var ct_blog_home = '".get_home_url()."';</script>\n";
|
336 |
+
$ct_replace.="<script async type='text/javascript' src='".plugins_url( '/inc/cleantalk_external.js' , __FILE__ )."?random=".$cleantalk_plugin_version."'></script>\n";
|
337 |
}
|
338 |
|
339 |
//$html=str_ireplace("</body",$ct_replace."</body",$html);
|
348 |
}
|
349 |
if(is_admin())
|
350 |
{
|
351 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-comments.php');
|
352 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-users.php');
|
353 |
}
|
354 |
if(isset($_GET['ait-action'])&&$_GET['ait-action']=='register')
|
355 |
{
|
370 |
{
|
371 |
if(!function_exists('sendRawRequest'))
|
372 |
{
|
373 |
+
require_once('inc/cleantalk.class.php');
|
374 |
}
|
375 |
global $ct_options, $ct_data, $wpdb;
|
376 |
if(isset($ct_options['spam_firewall']))
|
486 |
}
|
487 |
|
488 |
}*/
|
489 |
+
include_once("inc/cleantalk-sfw.class.php");
|
490 |
$sfw = new CleanTalkSFW();
|
491 |
$sfw->send_logs();
|
492 |
}
|
JSON.php → inc/JSON.php
RENAMED
File without changes
|
cleantalk-admin.js → inc/cleantalk-admin.js
RENAMED
File without changes
|
cleantalk-admin.php → inc/cleantalk-admin.php
RENAMED
@@ -20,7 +20,7 @@ function cleantalk_custom_glance_items( )
|
|
20 |
if($blocked>0)
|
21 |
{
|
22 |
$blocked = number_format($blocked, 0, ',', ' ');
|
23 |
-
print "<div style='height:24px;width:100%;display:table-cell; vertical-align:middle;'><img src='" . plugin_dir_url(__FILE__) . "
|
24 |
printf(
|
25 |
/* translators: %s: Number of spam messages */
|
26 |
__( 'has blocked %s spam', 'cleantalk' ),
|
@@ -389,7 +389,7 @@ function ct_add_admin_menu( $wp_admin_bar ) {
|
|
389 |
//$ct_data=ct_get_data();
|
390 |
$args = array(
|
391 |
'id' => 'ct_parent_node',
|
392 |
-
'title' => '<img src="' . plugin_dir_url(__FILE__) . '
|
393 |
);
|
394 |
$wp_admin_bar->add_node( $args );
|
395 |
|
@@ -441,38 +441,38 @@ function ct_section_settings_state() {
|
|
441 |
print "<div style='color:$color'>";
|
442 |
if($ct_options['registrations_test']==1)
|
443 |
{
|
444 |
-
print '<img src="' . plugin_dir_url(__FILE__) . '
|
445 |
}
|
446 |
else
|
447 |
{
|
448 |
-
print '<img src="' . plugin_dir_url(__FILE__) . '
|
449 |
}
|
450 |
|
451 |
if($ct_options['comments_test']==1)
|
452 |
{
|
453 |
-
print ' <img src="' . plugin_dir_url(__FILE__) . '
|
454 |
}
|
455 |
else
|
456 |
{
|
457 |
-
print ' <img src="' . plugin_dir_url(__FILE__) . '
|
458 |
}
|
459 |
|
460 |
if($ct_options['contact_forms_test']==1)
|
461 |
{
|
462 |
-
print ' <img src="' . plugin_dir_url(__FILE__) . '
|
463 |
}
|
464 |
else
|
465 |
{
|
466 |
-
print ' <img src="' . plugin_dir_url(__FILE__) . '
|
467 |
}
|
468 |
|
469 |
if($ct_options['general_contact_forms_test']==1)
|
470 |
{
|
471 |
-
print ' <img src="' . plugin_dir_url(__FILE__) . '
|
472 |
}
|
473 |
else
|
474 |
{
|
475 |
-
print ' <img src="' . plugin_dir_url(__FILE__) . '
|
476 |
}
|
477 |
|
478 |
print "</div>";
|
@@ -953,7 +953,8 @@ function cleantalk_admin_notice_message(){
|
|
953 |
if ($show_notice && $show_ct_notice_online != '' && $value==1) {
|
954 |
if($show_ct_notice_online === 'Y'){
|
955 |
echo '<div class="updated"><h3><b>';
|
956 |
-
echo __("Don’t forget to disable CAPTCHA if you have it!", 'cleantalk');
|
|
|
957 |
echo '</b></h3></div>';
|
958 |
}
|
959 |
|
20 |
if($blocked>0)
|
21 |
{
|
22 |
$blocked = number_format($blocked, 0, ',', ' ');
|
23 |
+
print "<div style='height:24px;width:100%;display:table-cell; vertical-align:middle;'><img src='" . plugin_dir_url(__FILE__) . "images/logo_color.png' style='margin-right:1em;vertical-align:middle;'/><span><a href='options-general.php?page=cleantalk'>CleanTalk</a> ";
|
24 |
printf(
|
25 |
/* translators: %s: Number of spam messages */
|
26 |
__( 'has blocked %s spam', 'cleantalk' ),
|
389 |
//$ct_data=ct_get_data();
|
390 |
$args = array(
|
391 |
'id' => 'ct_parent_node',
|
392 |
+
'title' => '<img src="' . plugin_dir_url(__FILE__) . 'images/logo_small1.png" alt="" height="" style="margin-top:9px;" /><a href="#" class="ab-item alignright" title="allowed / blocked" alt="allowed / blocked"><span class="ab-label" id="ct_stats"><span>0</span> / <span>0</span></span></a>'
|
393 |
);
|
394 |
$wp_admin_bar->add_node( $args );
|
395 |
|
441 |
print "<div style='color:$color'>";
|
442 |
if($ct_options['registrations_test']==1)
|
443 |
{
|
444 |
+
print '<img src="' . plugin_dir_url(__FILE__) . 'images/'.$img.'" alt="" height="" /> '.__('Registration forms', 'cleantalk');
|
445 |
}
|
446 |
else
|
447 |
{
|
448 |
+
print '<img src="' . plugin_dir_url(__FILE__) . 'images/'.$img_no.'" alt="" height="" /> '.__('Registration forms', 'cleantalk');
|
449 |
}
|
450 |
|
451 |
if($ct_options['comments_test']==1)
|
452 |
{
|
453 |
+
print ' <img src="' . plugin_dir_url(__FILE__) . 'images/'.$img.'" alt="" height="" /> '.__('Comments form', 'cleantalk');
|
454 |
}
|
455 |
else
|
456 |
{
|
457 |
+
print ' <img src="' . plugin_dir_url(__FILE__) . 'images/'.$img_no.'" alt="" height="" /> '.__('Comments form', 'cleantalk');
|
458 |
}
|
459 |
|
460 |
if($ct_options['contact_forms_test']==1)
|
461 |
{
|
462 |
+
print ' <img src="' . plugin_dir_url(__FILE__) . 'images/'.$img.'" alt="" height="" /> '.__('Contact forms', 'cleantalk');
|
463 |
}
|
464 |
else
|
465 |
{
|
466 |
+
print ' <img src="' . plugin_dir_url(__FILE__) . 'images/'.$img_no.'" alt="" height="" /> '.__('Contact forms', 'cleantalk');
|
467 |
}
|
468 |
|
469 |
if($ct_options['general_contact_forms_test']==1)
|
470 |
{
|
471 |
+
print ' <img src="' . plugin_dir_url(__FILE__) . 'images/'.$img.'" alt="" height="" /> '.__('Custom contact forms', 'cleantalk');
|
472 |
}
|
473 |
else
|
474 |
{
|
475 |
+
print ' <img src="' . plugin_dir_url(__FILE__) . 'images/'.$img_no.'" alt="" height="" /> '.__('Custom contact forms', 'cleantalk');
|
476 |
}
|
477 |
|
478 |
print "</div>";
|
953 |
if ($show_notice && $show_ct_notice_online != '' && $value==1) {
|
954 |
if($show_ct_notice_online === 'Y'){
|
955 |
echo '<div class="updated"><h3><b>';
|
956 |
+
//echo __("Don’t forget to disable CAPTCHA if you have it!", 'cleantalk');
|
957 |
+
echo __("Settings updated!", 'cleantalk');
|
958 |
echo '</b></h3></div>';
|
959 |
}
|
960 |
|
inc/cleantalk-admin_old.php
ADDED
@@ -0,0 +1,1219 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$ct_plugin_basename = 'cleantalk-spam-protect/cleantalk.php';
|
4 |
+
$ct_options=ct_get_options();
|
5 |
+
$ct_data=ct_get_data();
|
6 |
+
|
7 |
+
add_filter( 'activity_box_end', 'cleantalk_custom_glance_items', 10, 1 );
|
8 |
+
function cleantalk_custom_glance_items( )
|
9 |
+
{
|
10 |
+
global $ct_data;
|
11 |
+
$ct_data=ct_get_data();
|
12 |
+
if(!isset($ct_data['admin_blocked']))
|
13 |
+
{
|
14 |
+
$blocked=0;
|
15 |
+
}
|
16 |
+
else
|
17 |
+
{
|
18 |
+
$blocked=$ct_data['admin_blocked'];
|
19 |
+
}
|
20 |
+
if($blocked>0)
|
21 |
+
{
|
22 |
+
$blocked = number_format($blocked, 0, ',', ' ');
|
23 |
+
print "<div style='height:24px;width:100%;display:table-cell; vertical-align:middle;'><img src='" . plugin_dir_url(__FILE__) . "images/logo_color.png' style='margin-right:1em;vertical-align:middle;'/><span><a href='options-general.php?page=cleantalk'>CleanTalk</a> ";
|
24 |
+
printf(
|
25 |
+
/* translators: %s: Number of spam messages */
|
26 |
+
__( 'has blocked %s spam', 'cleantalk' ),
|
27 |
+
$blocked
|
28 |
+
);
|
29 |
+
print "</span></div>";
|
30 |
+
}
|
31 |
+
}
|
32 |
+
|
33 |
+
if(isset($_GET['close_notice']))
|
34 |
+
{
|
35 |
+
global $ct_data, $pagenow;
|
36 |
+
$ct_data=ct_get_data();
|
37 |
+
$ct_data['next_notice_show']=time()+86400;
|
38 |
+
update_option('cleantalk_data', $ct_data);
|
39 |
+
$_SERVER["QUERY_STRING"]=str_replace("close_notice=1","",$_SERVER["QUERY_STRING"]);
|
40 |
+
header("Location: $pagenow?".$_SERVER["QUERY_STRING"]);
|
41 |
+
}
|
42 |
+
|
43 |
+
// Timeout to get app server
|
44 |
+
$ct_server_timeout = 10;
|
45 |
+
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Admin action 'admin_print_footer_scripts' - Enqueue admin script for checking if timezone offset is saved in settings
|
49 |
+
*/
|
50 |
+
|
51 |
+
add_action( 'admin_print_footer_scripts', 'ct_add_stats_js' );
|
52 |
+
|
53 |
+
function ct_add_stats_js()
|
54 |
+
{
|
55 |
+
echo "<script src='".plugins_url( 'cleantalk-stats.js', __FILE__ )."'></script>\n";
|
56 |
+
}
|
57 |
+
|
58 |
+
|
59 |
+
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Admin action 'wp_ajax_ajax_get_timezone' - Ajax method for getting timezone offset
|
63 |
+
*/
|
64 |
+
|
65 |
+
function ct_ajax_get_timezone()
|
66 |
+
{
|
67 |
+
global $ct_data;
|
68 |
+
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
69 |
+
$ct_data = ct_get_data();
|
70 |
+
if(isset($_POST['offset']))
|
71 |
+
{
|
72 |
+
$ct_data['timezone'] = intval($_POST['offset']);
|
73 |
+
update_option('cleantalk_data', $ct_data);
|
74 |
+
}
|
75 |
+
}
|
76 |
+
|
77 |
+
add_action( 'wp_ajax_ajax_get_timezone', 'ct_ajax_get_timezone' );
|
78 |
+
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Admin action 'admin_enqueue_scripts' - Enqueue admin script of reloading admin page after needed AJAX events
|
82 |
+
* @param string $hook URL of hooked page
|
83 |
+
*/
|
84 |
+
function ct_enqueue_scripts($hook) {
|
85 |
+
if ($hook == 'edit-comments.php')
|
86 |
+
wp_enqueue_script('ct_reload_script', plugins_url('/cleantalk-rel.js', __FILE__));
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Admin action 'admin_menu' - Add the admin options page
|
91 |
+
*/
|
92 |
+
function ct_admin_add_page() {
|
93 |
+
add_options_page(__('CleanTalk settings', 'cleantalk'), 'CleanTalk', 'manage_options', 'cleantalk', 'ct_settings_page');
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Admin action 'admin_init' - Add the admin settings and such
|
98 |
+
*/
|
99 |
+
function ct_admin_init() {
|
100 |
+
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;
|
101 |
+
|
102 |
+
$ct_options = ct_get_options();
|
103 |
+
$ct_data = ct_get_data();
|
104 |
+
|
105 |
+
$current_version=@trim($ct_data['current_version']);
|
106 |
+
if($current_version!=$cleantalk_plugin_version)
|
107 |
+
{
|
108 |
+
$ct_data['current_version']=$cleantalk_plugin_version;
|
109 |
+
update_option('cleantalk_data', $ct_data);
|
110 |
+
/*$ct_base_call_result = ct_base_call(array(
|
111 |
+
'message' => 'CleanTalk setup test',
|
112 |
+
'example' => null,
|
113 |
+
'sender_email' => 'good@cleantalk.org',
|
114 |
+
'sender_nickname' => 'CleanTalk',
|
115 |
+
'post_info' => '',
|
116 |
+
'checkjs' => 1
|
117 |
+
));*/
|
118 |
+
}
|
119 |
+
if(isset($_POST['option_page'])&&$_POST['option_page']=='cleantalk_settings')
|
120 |
+
{
|
121 |
+
/*$ct_base_call_result = ct_base_call(array(
|
122 |
+
'message' => 'CleanTalk setup test',
|
123 |
+
'example' => null,
|
124 |
+
'sender_email' => 'good@cleantalk.org',
|
125 |
+
'sender_nickname' => 'CleanTalk',
|
126 |
+
'post_info' => '',
|
127 |
+
'checkjs' => 1
|
128 |
+
));*/
|
129 |
+
}
|
130 |
+
|
131 |
+
if(@isset($_POST['cleantalk_settings']['spam_firewall']) && $_POST['cleantalk_settings']['spam_firewall']==1 || isset($ct_options['spam_firewall']) && intval($ct_options['spam_firewall'])==1)
|
132 |
+
{
|
133 |
+
cleantalk_update_sfw();
|
134 |
+
}
|
135 |
+
|
136 |
+
$show_ct_notice_trial = false;
|
137 |
+
if (isset($_COOKIE[$ct_notice_trial_label])) {
|
138 |
+
if ($_COOKIE[$ct_notice_trial_label] == 1) {
|
139 |
+
$show_ct_notice_trial = true;
|
140 |
+
}
|
141 |
+
}
|
142 |
+
$show_ct_notice_renew = false;
|
143 |
+
if (isset($_COOKIE[$ct_notice_renew_label])) {
|
144 |
+
if ($_COOKIE[$ct_notice_renew_label] == 1) {
|
145 |
+
$show_ct_notice_renew = true;
|
146 |
+
}
|
147 |
+
}
|
148 |
+
$show_ct_notice_autokey = false;
|
149 |
+
if (isset($_COOKIE[$ct_notice_autokey_label]) && !empty($_COOKIE[$ct_notice_autokey_label])) {
|
150 |
+
if (!empty($_COOKIE[$ct_notice_autokey_label])) {
|
151 |
+
$show_ct_notice_autokey = true;
|
152 |
+
$ct_notice_autokey_value = base64_decode($_COOKIE[$ct_notice_autokey_label]);
|
153 |
+
setcookie($ct_notice_autokey_label, '', 1, '/');
|
154 |
+
}
|
155 |
+
}
|
156 |
+
|
157 |
+
if (isset($_POST['get_apikey_auto'])){
|
158 |
+
$email = get_option('admin_email');
|
159 |
+
$website = parse_url(get_option('siteurl'),PHP_URL_HOST);
|
160 |
+
$platform = 'wordpress';
|
161 |
+
|
162 |
+
if(!function_exists('getAutoKey'))
|
163 |
+
{
|
164 |
+
require_once('cleantalk.class.php');
|
165 |
+
}
|
166 |
+
|
167 |
+
$result = getAutoKey($email, $website, $platform);
|
168 |
+
|
169 |
+
if ($result)
|
170 |
+
{
|
171 |
+
$ct_data['next_account_status_check']=0;
|
172 |
+
update_option('cleantalk_data', $ct_data);
|
173 |
+
$result = json_decode($result, true);
|
174 |
+
if (isset($result['data']) && is_array($result['data']))
|
175 |
+
{
|
176 |
+
$result = $result['data'];
|
177 |
+
}
|
178 |
+
if(isset($result['user_token']))
|
179 |
+
{
|
180 |
+
$ct_data['user_token'] = $result['user_token'];
|
181 |
+
update_option('cleantalk_data', $ct_data);
|
182 |
+
}
|
183 |
+
if (isset($result['auth_key']) && !empty($result['auth_key']))
|
184 |
+
{
|
185 |
+
$_POST['cleantalk_settings']['apikey'] = $result['auth_key'];
|
186 |
+
$ct_options['apikey']=$result['auth_key'];
|
187 |
+
update_option('cleantalk_settings', $ct_options);
|
188 |
+
/*$ct_base_call_result = ct_base_call(array(
|
189 |
+
'message' => 'CleanTalk setup test',
|
190 |
+
'example' => null,
|
191 |
+
'sender_email' => 'good@cleantalk.org',
|
192 |
+
'sender_nickname' => 'CleanTalk',
|
193 |
+
'post_info' => '',
|
194 |
+
'checkjs' => 1
|
195 |
+
)); */
|
196 |
+
} else {
|
197 |
+
setcookie($ct_notice_autokey_label, (string) base64_encode($result['error_message']), 0, '/');
|
198 |
+
}
|
199 |
+
} else {
|
200 |
+
setcookie($ct_notice_autokey_label, (string) base64_encode(sprintf(__('Unable to connect to %s.', 'cleantalk'), 'api.cleantalk.org')), 0, '/');
|
201 |
+
}
|
202 |
+
}
|
203 |
+
|
204 |
+
if (time() > $ct_data['next_account_status_check']||
|
205 |
+
isset($_POST['option_page'])&&$_POST['option_page']=='cleantalk_settings'&&$ct_options['apikey']!=$_POST['cleantalk_settings']['apikey']) {
|
206 |
+
$result = false;
|
207 |
+
if (function_exists('curl_init') && function_exists('json_decode') && ct_valid_key($ct_options['apikey'])) {
|
208 |
+
if(!function_exists('noticePaidTill'))
|
209 |
+
{
|
210 |
+
require_once('cleantalk.class.php');
|
211 |
+
}
|
212 |
+
if(@isset($_POST['cleantalk_settings']['apikey']))
|
213 |
+
{
|
214 |
+
$result=noticePaidTill($_POST['cleantalk_settings']['apikey']);
|
215 |
+
}
|
216 |
+
else
|
217 |
+
{
|
218 |
+
$result=noticePaidTill($ct_options['apikey']);
|
219 |
+
}
|
220 |
+
|
221 |
+
if ($result) {
|
222 |
+
$result = json_decode($result, true);
|
223 |
+
if (isset($result['data']) && is_array($result['data'])) {
|
224 |
+
$result = $result['data'];
|
225 |
+
}
|
226 |
+
if(isset($result['spam_count']))
|
227 |
+
{
|
228 |
+
$ct_data['admin_blocked']=$result['spam_count'];
|
229 |
+
}
|
230 |
+
|
231 |
+
if (isset($result['show_notice'])) {
|
232 |
+
if ($result['show_notice'] == 1 && isset($result['trial']) && $result['trial'] == 1) {
|
233 |
+
$notice_check_timeout = $trial_notice_check_timeout;
|
234 |
+
$show_ct_notice_trial = true;
|
235 |
+
}
|
236 |
+
if ($result['show_notice'] == 1 && isset($result['renew']) && $result['renew'] == 1) {
|
237 |
+
$notice_check_timeout = $account_notice_check_timeout;
|
238 |
+
$show_ct_notice_renew = true;
|
239 |
+
}
|
240 |
+
|
241 |
+
if ($result['show_notice'] == 0) {
|
242 |
+
$notice_check_timeout = $account_notice_check_timeout;
|
243 |
+
}
|
244 |
+
}
|
245 |
+
|
246 |
+
if (isset($result['user_token'])) {
|
247 |
+
$ct_data['user_token'] = $result['user_token'];
|
248 |
+
}
|
249 |
+
}
|
250 |
+
|
251 |
+
// Save next status request time
|
252 |
+
$ct_data['next_account_status_check'] = strtotime("+$notice_check_timeout hours", time());
|
253 |
+
update_option('cleantalk_data', $ct_data);
|
254 |
+
}
|
255 |
+
|
256 |
+
if ($result) {
|
257 |
+
if($show_ct_notice_trial == true){
|
258 |
+
setcookie($ct_notice_trial_label, (string) $show_ct_notice_trial, strtotime("+$trial_notice_showtime minutes"), '/');
|
259 |
+
}
|
260 |
+
if($show_ct_notice_renew == true){
|
261 |
+
setcookie($ct_notice_renew_label, (string) $show_ct_notice_renew, strtotime("+$renew_notice_showtime minutes"), '/');
|
262 |
+
}
|
263 |
+
}
|
264 |
+
}
|
265 |
+
|
266 |
+
$show_ct_notice_online = '';
|
267 |
+
if (isset($_COOKIE[$ct_notice_online_label])) {
|
268 |
+
if ($_COOKIE[$ct_notice_online_label] === 'BAD_KEY') {
|
269 |
+
$show_ct_notice_online = 'N';
|
270 |
+
} else if (time() - $_COOKIE[$ct_notice_online_label] <= 5) {
|
271 |
+
$show_ct_notice_online = 'Y';
|
272 |
+
}
|
273 |
+
}
|
274 |
+
|
275 |
+
//ct_init_session();
|
276 |
+
|
277 |
+
if(stripos($_SERVER['REQUEST_URI'],'options.php')!==false || stripos($_SERVER['REQUEST_URI'],'options-general.php')!==false)
|
278 |
+
{
|
279 |
+
|
280 |
+
if(isset($ct_data['testing_failed'])&&$ct_data['testing_failed']==1)
|
281 |
+
{
|
282 |
+
$buttons_html='
|
283 |
+
<style type="text/css">
|
284 |
+
#ct_button_check_comments, #ct_button_check_users {background: #999999;}
|
285 |
+
|
286 |
+
';
|
287 |
+
}
|
288 |
+
else
|
289 |
+
{
|
290 |
+
$buttons_html='
|
291 |
+
<style type="text/css">
|
292 |
+
#ct_button_check_comments, #ct_button_check_users {background: #69dd69;}
|
293 |
+
|
294 |
+
';
|
295 |
+
}
|
296 |
+
|
297 |
+
$buttons_html.='
|
298 |
+
#ct_button_check_comments, #ct_button_check_users {padding: 10px; color: #fff; border:0 none;
|
299 |
+
cursor:pointer;
|
300 |
+
-webkit-border-radius: 5px;
|
301 |
+
border-radius: 5px;
|
302 |
+
font-size: 12pt;
|
303 |
+
text-decoration:none;
|
304 |
+
margin-bottom:5px;
|
305 |
+
display:inline-block;
|
306 |
+
}
|
307 |
+
|
308 |
+
#ct_stats_banner
|
309 |
+
{
|
310 |
+
padding: 0px;
|
311 |
+
color: #000;
|
312 |
+
/*border:2px solid #e5e5e5;*/
|
313 |
+
font-size: 10pt;
|
314 |
+
text-decoration:none;
|
315 |
+
margin-bottom:5px;
|
316 |
+
display:inline-block;
|
317 |
+
}
|
318 |
+
</style>';
|
319 |
+
if(isset($ct_data['testing_failed'])&&$ct_data['testing_failed']==1)
|
320 |
+
{
|
321 |
+
$buttons_html.='<a href="#" id="ct_button_check_comments" onclick="alert('."'".__('Feature is disabled, because testing of access key is failed!', 'cleantalk')."'".')">'.__('Check comments', 'cleantalk').'</a>
|
322 |
+
<a href="#" id="ct_button_check_users" onclick="alert('."'".__('Feature is disabled, because testing of access key is failed!', 'cleantalk')."'".')">'.__('Check users', 'cleantalk').'</a><div class="clear"></div>';
|
323 |
+
}
|
324 |
+
else
|
325 |
+
{
|
326 |
+
$buttons_html.='<a href="edit-comments.php?page=ct_check_spam&do_check=1" style="font-size:10pt;font-weight:400;">'.__('Check comments', 'cleantalk').'</a><br />
|
327 |
+
<a href="users.php?page=ct_check_users&do_check=1" style="font-size:10pt;font-weight:400;">'.__('Check users', 'cleantalk').'</a><div class="clear"></div>';
|
328 |
+
}
|
329 |
+
|
330 |
+
register_setting('cleantalk_settings', 'cleantalk_settings', 'ct_settings_validate');
|
331 |
+
add_settings_section('cleantalk_settings_main', __($ct_plugin_name, 'cleantalk'), 'ct_section_settings_main', 'cleantalk');
|
332 |
+
add_settings_section('cleantalk_settings_state', "<hr>".__('Protection is active', 'cleantalk'), 'ct_section_settings_state', 'cleantalk');
|
333 |
+
//add_settings_section('cleantalk_settings_autodel', "<hr>", 'ct_section_settings_autodel', 'cleantalk');
|
334 |
+
add_settings_section('cleantalk_settings_banner', "<hr>Check existing comments and users <br /><br />$buttons_html<hr></h3>", '', 'cleantalk');
|
335 |
+
add_settings_section('cleantalk_settings_anti_spam', "<a href='#' style='text-decoration:underline;font-size:10pt;font-weight:400;'>".__('Advanced settings', 'cleantalk')."</a>", 'ct_section_settings_anti_spam', 'cleantalk');
|
336 |
+
|
337 |
+
add_settings_field('cleantalk_apikey', __('Access key', 'cleantalk'), 'ct_input_apikey', 'cleantalk', 'cleantalk_settings_main');
|
338 |
+
add_settings_field('cleantalk_remove_old_spam', __('Automatically delete spam comments', 'cleantalk'), 'ct_input_remove_old_spam', 'cleantalk', 'cleantalk_settings_anti_spam');
|
339 |
+
|
340 |
+
add_settings_field('cleantalk_registrations_test', __('Registration forms', 'cleantalk'), 'ct_input_registrations_test', 'cleantalk', 'cleantalk_settings_anti_spam');
|
341 |
+
add_settings_field('cleantalk_comments_test', __('Comments form', 'cleantalk'), 'ct_input_comments_test', 'cleantalk', 'cleantalk_settings_anti_spam');
|
342 |
+
add_settings_field('cleantalk_contact_forms_test', __('Contact forms', 'cleantalk'), 'ct_input_contact_forms_test', 'cleantalk', 'cleantalk_settings_anti_spam');
|
343 |
+
add_settings_field('cleantalk_general_contact_forms_test', __('Custom contact forms', 'cleantalk'), 'ct_input_general_contact_forms_test', 'cleantalk', 'cleantalk_settings_anti_spam');
|
344 |
+
add_settings_field('cleantalk_general_postdata_test', __('Check all post data', 'cleantalk'), 'ct_input_general_postdata_test', 'cleantalk', 'cleantalk_settings_anti_spam');
|
345 |
+
add_settings_field('cleantalk_show_adminbar', __('Show statistics in admin bar', 'cleantalk'), 'ct_input_show_adminbar', 'cleantalk', 'cleantalk_settings_anti_spam');
|
346 |
+
add_settings_field('cleantalk_use_ajax', __('Use AJAX for JavaScript check', 'cleantalk'), 'ct_input_use_ajax', 'cleantalk', 'cleantalk_settings_anti_spam');
|
347 |
+
add_settings_field('cleantalk_check_external', __('Protect external forms', 'cleantalk'), 'ct_input_check_external', 'cleantalk', 'cleantalk_settings_anti_spam');
|
348 |
+
add_settings_field('cleantalk_check_comments_number', __("Don't check comments", 'cleantalk'), 'ct_input_check_comments_number', 'cleantalk', 'cleantalk_settings_anti_spam');
|
349 |
+
//add_settings_field('cleantalk_check_messages_number', __("Don't check messages", 'cleantalk'), 'ct_input_check_messages_number', 'cleantalk', 'cleantalk_settings_anti_spam');
|
350 |
+
add_settings_field('cleantalk_show_link', __('', 'cleantalk'), 'ct_input_show_link', 'cleantalk', 'cleantalk_settings_banner');
|
351 |
+
add_settings_field('cleantalk_spam_firewall', __('', 'cleantalk'), 'ct_input_spam_firewall', 'cleantalk', 'cleantalk_settings_banner');
|
352 |
+
}
|
353 |
+
}
|
354 |
+
|
355 |
+
/**
|
356 |
+
* Admin callback function - Displays description of 'main' plugin parameters section
|
357 |
+
*/
|
358 |
+
function ct_section_settings_main() {
|
359 |
+
return true;
|
360 |
+
}
|
361 |
+
|
362 |
+
/**
|
363 |
+
* Admin callback function - Displays description of 'anti-spam' plugin parameters section
|
364 |
+
*/
|
365 |
+
function ct_section_settings_anti_spam() {
|
366 |
+
return true;
|
367 |
+
}
|
368 |
+
|
369 |
+
add_action( 'admin_bar_menu', 'ct_add_admin_menu', 999 );
|
370 |
+
|
371 |
+
function ct_add_admin_menu( $wp_admin_bar ) {
|
372 |
+
// add a parent item
|
373 |
+
global $ct_options, $ct_data;
|
374 |
+
|
375 |
+
$ct_options = ct_get_options();
|
376 |
+
$ct_data = ct_get_data();
|
377 |
+
|
378 |
+
if(isset($ct_options['show_adminbar']))
|
379 |
+
{
|
380 |
+
$value = @intval($ct_options['show_adminbar']);
|
381 |
+
}
|
382 |
+
else
|
383 |
+
{
|
384 |
+
$value=1;
|
385 |
+
}
|
386 |
+
|
387 |
+
if ( current_user_can('activate_plugins')&&$value==1 )
|
388 |
+
{
|
389 |
+
//$ct_data=ct_get_data();
|
390 |
+
$args = array(
|
391 |
+
'id' => 'ct_parent_node',
|
392 |
+
'title' => '<img src="' . plugin_dir_url(__FILE__) . 'images/logo_small1.png" alt="" height="" style="margin-top:9px;" /><a href="#" class="ab-item alignright" title="allowed / blocked" alt="allowed / blocked"><span class="ab-label" id="ct_stats"><span>0</span> / <span>0</span></span></a>'
|
393 |
+
);
|
394 |
+
$wp_admin_bar->add_node( $args );
|
395 |
+
|
396 |
+
// add a child item to our parent item
|
397 |
+
$args = array(
|
398 |
+
'id' => 'ct_dashboard_link',
|
399 |
+
'title' => '<a href="https://cleantalk.org/my/?user_token='.@$ct_data['user_token'].'&utm_source=wp-backend&utm_medium=admin-bar" target="_blank">CleanTalk '.__('dashboard', 'cleantalk').'</a>',
|
400 |
+
'parent' => 'ct_parent_node'
|
401 |
+
);
|
402 |
+
$wp_admin_bar->add_node( $args );
|
403 |
+
|
404 |
+
// add another child item to our parent item (not to our first group)
|
405 |
+
$args = array(
|
406 |
+
'id' => 'ct_settings_link',
|
407 |
+
'title' => '<a href="options-general.php?page=cleantalk">'.__('Settings', 'cleantalk').'</a>',
|
408 |
+
'parent' => 'ct_parent_node'
|
409 |
+
);
|
410 |
+
$wp_admin_bar->add_node( $args );
|
411 |
+
}
|
412 |
+
}
|
413 |
+
|
414 |
+
/**
|
415 |
+
* Admin callback function - Displays description of 'state' plugin parameters section
|
416 |
+
*/
|
417 |
+
function ct_section_settings_state() {
|
418 |
+
global $ct_options, $ct_data;
|
419 |
+
|
420 |
+
$ct_options = ct_get_options();
|
421 |
+
$ct_data = ct_get_data();
|
422 |
+
|
423 |
+
$img="yes.png";
|
424 |
+
$img_no="no.png";
|
425 |
+
$color="black";
|
426 |
+
$test_failed=false;
|
427 |
+
//if(isset($ct_data['testing_failed'])&&$ct_data['testing_failed']==1)
|
428 |
+
if(trim($ct_options['apikey'])=='')
|
429 |
+
{
|
430 |
+
$img="yes_gray.png";
|
431 |
+
$img_no="no_gray.png";
|
432 |
+
$color="gray";
|
433 |
+
}
|
434 |
+
if(isset($ct_data['testing_failed'])&&$ct_data['testing_failed']==1)
|
435 |
+
{
|
436 |
+
$img="no.png";
|
437 |
+
$img_no="no.png";
|
438 |
+
$color="black";
|
439 |
+
$test_failed=true;
|
440 |
+
}
|
441 |
+
print "<div style='color:$color'>";
|
442 |
+
if($ct_options['registrations_test']==1)
|
443 |
+
{
|
444 |
+
print '<img src="' . plugin_dir_url(__FILE__) . 'images/'.$img.'" alt="" height="" /> '.__('Registration forms', 'cleantalk');
|
445 |
+
}
|
446 |
+
else
|
447 |
+
{
|
448 |
+
print '<img src="' . plugin_dir_url(__FILE__) . 'images/'.$img_no.'" alt="" height="" /> '.__('Registration forms', 'cleantalk');
|
449 |
+
}
|
450 |
+
|
451 |
+
if($ct_options['comments_test']==1)
|
452 |
+
{
|
453 |
+
print ' <img src="' . plugin_dir_url(__FILE__) . 'images/'.$img.'" alt="" height="" /> '.__('Comments form', 'cleantalk');
|
454 |
+
}
|
455 |
+
else
|
456 |
+
{
|
457 |
+
print ' <img src="' . plugin_dir_url(__FILE__) . 'images/'.$img_no.'" alt="" height="" /> '.__('Comments form', 'cleantalk');
|
458 |
+
}
|
459 |
+
|
460 |
+
if($ct_options['contact_forms_test']==1)
|
461 |
+
{
|
462 |
+
print ' <img src="' . plugin_dir_url(__FILE__) . 'images/'.$img.'" alt="" height="" /> '.__('Contact forms', 'cleantalk');
|
463 |
+
}
|
464 |
+
else
|
465 |
+
{
|
466 |
+
print ' <img src="' . plugin_dir_url(__FILE__) . 'images/'.$img_no.'" alt="" height="" /> '.__('Contact forms', 'cleantalk');
|
467 |
+
}
|
468 |
+
|
469 |
+
if($ct_options['general_contact_forms_test']==1)
|
470 |
+
{
|
471 |
+
print ' <img src="' . plugin_dir_url(__FILE__) . 'images/'.$img.'" alt="" height="" /> '.__('Custom contact forms', 'cleantalk');
|
472 |
+
}
|
473 |
+
else
|
474 |
+
{
|
475 |
+
print ' <img src="' . plugin_dir_url(__FILE__) . 'images/'.$img_no.'" alt="" height="" /> '.__('Custom contact forms', 'cleantalk');
|
476 |
+
}
|
477 |
+
|
478 |
+
print "</div>";
|
479 |
+
if($test_failed)
|
480 |
+
{
|
481 |
+
//print "Testing is failed, check settings. Tech support <a target=_blank href='mailto:support@cleantalk.org'>support@cleantalk.org</a>";
|
482 |
+
print __("Testing is failed, check settings. Tech support <a target=_blank href='mailto:support@cleantalk.org'>support@cleantalk.org</a>", 'cleantalk');
|
483 |
+
}
|
484 |
+
return true;
|
485 |
+
}
|
486 |
+
|
487 |
+
/**
|
488 |
+
* Admin callback function - Displays description of 'autodel' plugin parameters section
|
489 |
+
*/
|
490 |
+
function ct_section_settings_autodel() {
|
491 |
+
return true;
|
492 |
+
}
|
493 |
+
|
494 |
+
/**
|
495 |
+
* Admin callback function - Displays inputs of 'apikey' plugin parameter
|
496 |
+
*/
|
497 |
+
function ct_input_apikey() {
|
498 |
+
global $ct_options, $ct_data, $ct_notice_online_label;
|
499 |
+
$ct_options=ct_get_options();
|
500 |
+
$ct_data=ct_get_data();
|
501 |
+
|
502 |
+
if(!isset($ct_data['admin_blocked']))
|
503 |
+
{
|
504 |
+
$blocked=0;
|
505 |
+
}
|
506 |
+
else
|
507 |
+
{
|
508 |
+
$blocked=$ct_data['admin_blocked'];
|
509 |
+
}
|
510 |
+
|
511 |
+
if($blocked>0)
|
512 |
+
{
|
513 |
+
$blocked = number_format($blocked, 0, ',', ' ');
|
514 |
+
|
515 |
+
echo "<script>var cleantalk_blocked_message=\"<div style='height:24px;width:100%;display:table-cell; vertical-align:middle;'><span>CleanTalk ";
|
516 |
+
printf(
|
517 |
+
/* translators: %s: Number of spam messages */
|
518 |
+
__( 'has blocked <b>%s</b> spam.', 'cleantalk' ),
|
519 |
+
$blocked
|
520 |
+
);
|
521 |
+
print "</span></div><br />\";\n";
|
522 |
+
}
|
523 |
+
else
|
524 |
+
{
|
525 |
+
echo "<script>var cleantalk_blocked_message=\"\";\n";
|
526 |
+
}
|
527 |
+
echo "var cleantalk_statistics_link=\"<a target='__blank' href='https://cleantalk.org/my?user_token=".@$ct_data['user_token']."'>".__('Click here to get anti-spam statistics', 'cleantalk')."</a>\";
|
528 |
+
</script>";
|
529 |
+
|
530 |
+
echo "<script src='".plugins_url( 'cleantalk-admin.js', __FILE__ )."'></script>\n";
|
531 |
+
|
532 |
+
$value = $ct_options['apikey'];
|
533 |
+
$def_value = '';
|
534 |
+
echo "<input id='cleantalk_apikey' name='cleantalk_settings[apikey]' size='20' type='text' value='$value' style=\"font-size: 14pt;\"/>";
|
535 |
+
if (ct_valid_key($value) === false) {
|
536 |
+
echo "<script>var cleantalk_good_key=false;</script>";
|
537 |
+
echo "<a target='__blank' style='margin-left: 10px' href='https://cleantalk.org/register?platform=wordpress&email=".urlencode(get_option('admin_email'))."&website=".urlencode(parse_url(get_option('siteurl'),PHP_URL_HOST))."'>".__('Click here to get access key manually', 'cleantalk')."</a>";
|
538 |
+
if (function_exists('curl_init') && function_exists('json_decode')) {
|
539 |
+
echo '<br /><br /><input name="get_apikey_auto" type="submit" value="' . __('Get access key automatically', 'cleantalk') . '" />';
|
540 |
+
admin_addDescriptionsFields(sprintf(__('Admin e-mail (%s) will be used for registration', 'cleantalk'), get_option('admin_email')));
|
541 |
+
admin_addDescriptionsFields(sprintf('<a target="__blank" style="color:#BBB;" href="https://cleantalk.org/publicoffer">%s</a>', __('License agreement', 'cleantalk')));
|
542 |
+
}
|
543 |
+
} else {
|
544 |
+
echo "<script>var cleantalk_good_key=true;</script>";
|
545 |
+
if (isset($_COOKIE[$ct_notice_online_label]) && $_COOKIE[$ct_notice_online_label] > 0) {
|
546 |
+
//echo ' <span style="text-decoration: underline;">The key accepted!</span> ';
|
547 |
+
}
|
548 |
+
//echo "<br /><br /><a target='__blank' href='https://cleantalk.org/my?user_token=".@$ct_data['user_token']."'>".__('Click here to get anti-spam statistics', 'cleantalk')."</a>";
|
549 |
+
}
|
550 |
+
}
|
551 |
+
|
552 |
+
/**
|
553 |
+
* Admin callback function - Displays inputs of 'comments_test' plugin parameter
|
554 |
+
*/
|
555 |
+
function ct_input_comments_test() {
|
556 |
+
global $ct_options, $ct_data;
|
557 |
+
|
558 |
+
$ct_options = ct_get_options();
|
559 |
+
$ct_data = ct_get_data();
|
560 |
+
|
561 |
+
$value = $ct_options['comments_test'];
|
562 |
+
echo "<input type='radio' id='cleantalk_comments_test1' name='cleantalk_settings[comments_test]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_comments_test1'> " . __('Yes') . "</label>";
|
563 |
+
echo ' ';
|
564 |
+
echo "<input type='radio' id='cleantalk_comments_test0' name='cleantalk_settings[comments_test]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_comments_test0'> " . __('No') . "</label>";
|
565 |
+
admin_addDescriptionsFields(__('WordPress, JetPack, WooCommerce', 'cleantalk'));
|
566 |
+
}
|
567 |
+
|
568 |
+
/**
|
569 |
+
* Admin callback function - Displays inputs of 'comments_test' plugin parameter
|
570 |
+
*/
|
571 |
+
function ct_input_registrations_test() {
|
572 |
+
global $ct_options, $ct_data;
|
573 |
+
|
574 |
+
$ct_options = ct_get_options();
|
575 |
+
$ct_data = ct_get_data();
|
576 |
+
|
577 |
+
$value = $ct_options['registrations_test'];
|
578 |
+
echo "<input type='radio' id='cleantalk_registrations_test1' name='cleantalk_settings[registrations_test]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_registrations_test1'> " . __('Yes') . "</label>";
|
579 |
+
echo ' ';
|
580 |
+
echo "<input type='radio' id='cleantalk_registrations_test0' name='cleantalk_settings[registrations_test]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_registrations_test0'> " . __('No') . "</label>";
|
581 |
+
admin_addDescriptionsFields(__('WordPress, BuddyPress, bbPress, S2Member, WooCommerce', 'cleantalk'));
|
582 |
+
}
|
583 |
+
|
584 |
+
/**
|
585 |
+
* Admin callback function - Displays inputs of 'contact_forms_test' plugin parameter
|
586 |
+
*/
|
587 |
+
function ct_input_contact_forms_test() {
|
588 |
+
global $ct_options, $ct_data;
|
589 |
+
|
590 |
+
$ct_options = ct_get_options();
|
591 |
+
$ct_data = ct_get_data();
|
592 |
+
|
593 |
+
$value = $ct_options['contact_forms_test'];
|
594 |
+
echo "<input type='radio' id='cleantalk_contact_forms_test1' name='cleantalk_settings[contact_forms_test]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_contact_forms_test1'> " . __('Yes') . "</label>";
|
595 |
+
echo ' ';
|
596 |
+
echo "<input type='radio' id='cleantalk_contact_forms_test0' name='cleantalk_settings[contact_forms_test]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_contact_forms_test0'> " . __('No') . "</label>";
|
597 |
+
admin_addDescriptionsFields(__('Contact Form 7, Formiadble forms, JetPack, Fast Secure Contact Form, WordPress Landing Pages', 'cleantalk'));
|
598 |
+
}
|
599 |
+
|
600 |
+
/**
|
601 |
+
* Admin callback function - Displays inputs of 'general_contact_forms_test' plugin parameter
|
602 |
+
*/
|
603 |
+
function ct_input_general_contact_forms_test() {
|
604 |
+
global $ct_options, $ct_data;
|
605 |
+
|
606 |
+
$ct_options = ct_get_options();
|
607 |
+
$ct_data = ct_get_data();
|
608 |
+
|
609 |
+
$value = $ct_options['general_contact_forms_test'];
|
610 |
+
echo "<input type='radio' id='cleantalk_general_contact_forms_test1' name='cleantalk_settings[general_contact_forms_test]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_general_contact_forms_test1'> " . __('Yes') . "</label>";
|
611 |
+
echo ' ';
|
612 |
+
echo "<input type='radio' id='cleantalk_general_contact_forms_test0' name='cleantalk_settings[general_contact_forms_test]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_general_contact_forms_test0'> " . __('No') . "</label>";
|
613 |
+
admin_addDescriptionsFields(__('Anti spam test for any WordPress or themes contacts forms', 'cleantalk'));
|
614 |
+
}
|
615 |
+
|
616 |
+
/**
|
617 |
+
* @author Artem Leontiev
|
618 |
+
* Admin callback function - Displays inputs of 'Publicate relevant comments' plugin parameter
|
619 |
+
*
|
620 |
+
* @return null
|
621 |
+
*/
|
622 |
+
function ct_input_remove_old_spam() {
|
623 |
+
global $ct_options, $ct_data;
|
624 |
+
|
625 |
+
$ct_options = ct_get_options();
|
626 |
+
$ct_data = ct_get_data();
|
627 |
+
|
628 |
+
$value = $ct_options['remove_old_spam'];
|
629 |
+
echo "<input type='radio' id='cleantalk_remove_old_spam1' name='cleantalk_settings[remove_old_spam]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_remove_old_spam1'> " . __('Yes') . "</label>";
|
630 |
+
echo ' ';
|
631 |
+
echo "<input type='radio' id='cleantalk_remove_old_spam0' name='cleantalk_settings[remove_old_spam]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_remove_old_spam0'> " . __('No') . "</label>";
|
632 |
+
admin_addDescriptionsFields(sprintf(__('Delete spam comments older than %d days.', 'cleantalk'), $ct_options['spam_store_days']));
|
633 |
+
}
|
634 |
+
|
635 |
+
/**
|
636 |
+
* Admin callback function - Displays inputs of 'Show statistics in adminbar' plugin parameter
|
637 |
+
*
|
638 |
+
* @return null
|
639 |
+
*/
|
640 |
+
function ct_input_show_adminbar() {
|
641 |
+
global $ct_options, $ct_data;
|
642 |
+
|
643 |
+
$ct_options = ct_get_options();
|
644 |
+
$ct_data = ct_get_data();
|
645 |
+
|
646 |
+
if(isset($ct_options['show_adminbar']))
|
647 |
+
{
|
648 |
+
$value = @intval($ct_options['show_adminbar']);
|
649 |
+
}
|
650 |
+
else
|
651 |
+
{
|
652 |
+
$value=1;
|
653 |
+
}
|
654 |
+
echo "<input type='radio' id='cleantalk_show_adminbar1' name='cleantalk_settings[show_adminbar]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_show_adminbar1'> " . __('Yes') . "</label>";
|
655 |
+
echo ' ';
|
656 |
+
echo "<input type='radio' id='cleantalk_show_adminbar0' name='cleantalk_settings[show_adminbar]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_show_adminbar0'> " . __('No') . "</label>";
|
657 |
+
admin_addDescriptionsFields(sprintf(__('Show/hide CleanTalk icon in top level menu in WordPress backend.', 'cleantalk'), $ct_options['show_adminbar']));
|
658 |
+
}
|
659 |
+
|
660 |
+
/**
|
661 |
+
* Admin callback function - Displays inputs of 'Show statistics in adminbar' plugin parameter
|
662 |
+
*
|
663 |
+
* @return null
|
664 |
+
*/
|
665 |
+
function ct_input_general_postdata_test() {
|
666 |
+
global $ct_options, $ct_data;
|
667 |
+
|
668 |
+
$ct_options = ct_get_options();
|
669 |
+
$ct_data = ct_get_data();
|
670 |
+
|
671 |
+
if(isset($ct_options['general_postdata_test']))
|
672 |
+
{
|
673 |
+
$value = @intval($ct_options['general_postdata_test']);
|
674 |
+
}
|
675 |
+
else
|
676 |
+
{
|
677 |
+
$value=0;
|
678 |
+
}
|
679 |
+
echo "<input type='radio' id='cleantalk_general_postdata_test1' name='cleantalk_settings[general_postdata_test]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_general_postdata_test1'> " . __('Yes') . "</label>";
|
680 |
+
echo ' ';
|
681 |
+
echo "<input type='radio' id='cleantalk_general_postdata_test0' name='cleantalk_settings[general_postdata_test]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_general_postdata_test0'> " . __('No') . "</label>";
|
682 |
+
@admin_addDescriptionsFields(sprintf(__('Check all POST submissions from website visitors. Enable this option if you have spam misses on website or you don`t have records about missed spam in <a href="https://cleantalk.org/my/?user_token='.@$ct_data['user_token'].'&utm_source=wp-backend&utm_medium=admin-bar" target="_blank">CleanTalk dashboard</a>.', 'cleantalk'), $ct_options['general_postdata_test']));
|
683 |
+
}
|
684 |
+
|
685 |
+
function ct_input_use_ajax() {
|
686 |
+
global $ct_options, $ct_data;
|
687 |
+
|
688 |
+
$ct_options = ct_get_options();
|
689 |
+
$ct_data = ct_get_data();
|
690 |
+
|
691 |
+
if(isset($ct_options['use_ajax']))
|
692 |
+
{
|
693 |
+
$value = @intval($ct_options['use_ajax']);
|
694 |
+
}
|
695 |
+
else
|
696 |
+
{
|
697 |
+
$value=1;
|
698 |
+
}
|
699 |
+
echo "<input type='radio' id='cleantalk_use_ajax1' name='cleantalk_settings[use_ajax]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_use_ajax1'> " . __('Yes') . "</label>";
|
700 |
+
echo ' ';
|
701 |
+
echo "<input type='radio' id='cleantalk_use_ajax0' name='cleantalk_settings[use_ajax]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_use_ajax0'> " . __('No') . "</label>";
|
702 |
+
@admin_addDescriptionsFields(sprintf(__('', 'cleantalk'), $ct_options['use_ajax']));
|
703 |
+
}
|
704 |
+
|
705 |
+
function ct_input_check_comments_number() {
|
706 |
+
global $ct_options, $ct_data;
|
707 |
+
|
708 |
+
$ct_options = ct_get_options();
|
709 |
+
$ct_data = ct_get_data();
|
710 |
+
|
711 |
+
if(isset($ct_options['check_comments_number']))
|
712 |
+
{
|
713 |
+
$value = @intval($ct_options['check_comments_number']);
|
714 |
+
}
|
715 |
+
else
|
716 |
+
{
|
717 |
+
$value=1;
|
718 |
+
}
|
719 |
+
|
720 |
+
if(defined('CLEANTALK_CHECK_COMMENTS_NUMBER'))
|
721 |
+
{
|
722 |
+
$comments_check_number = CLEANTALK_CHECK_COMMENTS_NUMBER;
|
723 |
+
}
|
724 |
+
else
|
725 |
+
{
|
726 |
+
$comments_check_number = 3;
|
727 |
+
}
|
728 |
+
|
729 |
+
echo "<input type='radio' id='cleantalk_check_comments_number1' name='cleantalk_settings[check_comments_number]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_check_comments_number1'> " . __('Yes') . "</label>";
|
730 |
+
echo ' ';
|
731 |
+
echo "<input type='radio' id='cleantalk_check_comments_number0' name='cleantalk_settings[check_comments_number]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_check_comments_number0'> " . __('No') . "</label>";
|
732 |
+
@admin_addDescriptionsFields(sprintf(__("Dont't check comments for users with above $comments_check_number comments", 'cleantalk'), $ct_options['check_comments_number']));
|
733 |
+
}
|
734 |
+
|
735 |
+
function ct_input_check_messages_number() {
|
736 |
+
global $ct_options, $ct_data;
|
737 |
+
|
738 |
+
$ct_options = ct_get_options();
|
739 |
+
$ct_data = ct_get_data();
|
740 |
+
|
741 |
+
if(isset($ct_options['check_messages_number']))
|
742 |
+
{
|
743 |
+
$value = @intval($ct_options['check_messages_number']);
|
744 |
+
}
|
745 |
+
else
|
746 |
+
{
|
747 |
+
$value=0;
|
748 |
+
}
|
749 |
+
|
750 |
+
if(defined('CLEANTALK_CHECK_MESSAGES_NUMBER'))
|
751 |
+
{
|
752 |
+
$messages_check_number = CLEANTALK_CHECK_MESSAGES_NUMBER;
|
753 |
+
}
|
754 |
+
else
|
755 |
+
{
|
756 |
+
$messages_check_number = 3;
|
757 |
+
}
|
758 |
+
|
759 |
+
echo "<input type='radio' id='cleantalk_check_messages_number1' name='cleantalk_settings[check_messages_number]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_check_messages_number1'> " . __('Yes') . "</label>";
|
760 |
+
echo ' ';
|
761 |
+
echo "<input type='radio' id='cleantalk_check_messages_number0' name='cleantalk_settings[check_messages_number]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_check_messages_number0'> " . __('No') . "</label>";
|
762 |
+
@admin_addDescriptionsFields(sprintf(__("Dont't check messages for users with above $messages_check_number messages", 'cleantalk'), $ct_options['check_messages_number']));
|
763 |
+
}
|
764 |
+
|
765 |
+
function ct_input_check_external() {
|
766 |
+
global $ct_options, $ct_data;
|
767 |
+
|
768 |
+
$ct_options = ct_get_options();
|
769 |
+
$ct_data = ct_get_data();
|
770 |
+
|
771 |
+
if(isset($ct_options['check_external']))
|
772 |
+
{
|
773 |
+
$value = @intval($ct_options['check_external']);
|
774 |
+
}
|
775 |
+
else
|
776 |
+
{
|
777 |
+
$value=0;
|
778 |
+
}
|
779 |
+
echo "<input type='radio' id='cleantalk_check_external1' name='cleantalk_settings[check_external]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_check_external1'> " . __('Yes') . "</label>";
|
780 |
+
echo ' ';
|
781 |
+
echo "<input type='radio' id='cleantalk_check_external0' name='cleantalk_settings[check_external]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_check_external0'> " . __('No') . "</label>";
|
782 |
+
@admin_addDescriptionsFields(sprintf(__('', 'cleantalk'), $ct_options['check_external']));
|
783 |
+
}
|
784 |
+
|
785 |
+
function ct_input_show_link() {
|
786 |
+
global $ct_options, $ct_data;
|
787 |
+
|
788 |
+
$ct_options = ct_get_options();
|
789 |
+
$ct_data = ct_get_data();
|
790 |
+
|
791 |
+
if(isset($ct_options['show_link']))
|
792 |
+
{
|
793 |
+
$value = @intval($ct_options['show_link']);
|
794 |
+
}
|
795 |
+
else
|
796 |
+
{
|
797 |
+
$value=0;
|
798 |
+
}
|
799 |
+
|
800 |
+
/* echo "<input type='radio' id='cleantalk_show_link1' name='cleantalk_settings[show_link]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_show_link1'> " . __('Yes') . "</label>";
|
801 |
+
echo ' ';
|
802 |
+
echo "<input type='radio' id='cleantalk_show_link0' name='cleantalk_settings[show_link]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_show_link0'> " . __('No') . "</label>";*/
|
803 |
+
|
804 |
+
echo "<div id='cleantalk_anchor' style='display:none'></div><input type=hidden name='cleantalk_settings[show_link]' value='0' />";
|
805 |
+
echo "<input type='checkbox' id='cleantalk_show_link1' name='cleantalk_settings[show_link]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_show_link1'> " . __('Tell others about CleanTalk') . "</label>";
|
806 |
+
@admin_addDescriptionsFields(sprintf(__("Checking this box places a small link under the comment form that lets others know what anti-spam tool protects your site.", 'cleantalk'), $ct_options['show_link']));
|
807 |
+
echo "<script>
|
808 |
+
jQuery(document).ready(function(){
|
809 |
+
jQuery('#cleantalk_anchor').parent().parent().children().first().hide();
|
810 |
+
jQuery('#cleantalk_anchor').parent().css('padding-left','0px');
|
811 |
+
});
|
812 |
+
</script>";
|
813 |
+
}
|
814 |
+
|
815 |
+
function ct_input_spam_firewall() {
|
816 |
+
global $ct_options, $ct_data;
|
817 |
+
|
818 |
+
$ct_options = ct_get_options();
|
819 |
+
$ct_data = ct_get_data();
|
820 |
+
|
821 |
+
if(isset($ct_options['spam_firewall']))
|
822 |
+
{
|
823 |
+
$value = @intval($ct_options['spam_firewall']);
|
824 |
+
}
|
825 |
+
else
|
826 |
+
{
|
827 |
+
$value=0;
|
828 |
+
}
|
829 |
+
|
830 |
+
echo "<div id='cleantalk_anchor1' style='display:none'></div><input type=hidden name='cleantalk_settings[spam_firewall]' value='0' />";
|
831 |
+
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>";
|
832 |
+
@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']));
|
833 |
+
echo "<script>
|
834 |
+
jQuery(document).ready(function(){
|
835 |
+
jQuery('#cleantalk_anchor1').parent().parent().children().first().hide();
|
836 |
+
jQuery('#cleantalk_anchor1').parent().css('padding-left','0px');
|
837 |
+
});
|
838 |
+
</script>";
|
839 |
+
}
|
840 |
+
|
841 |
+
|
842 |
+
/**
|
843 |
+
* Admin callback function - Plugin parameters validator
|
844 |
+
*/
|
845 |
+
function ct_settings_validate($input) {
|
846 |
+
return $input;
|
847 |
+
}
|
848 |
+
|
849 |
+
|
850 |
+
/**
|
851 |
+
* Admin callback function - Displays plugin options page
|
852 |
+
*/
|
853 |
+
function ct_settings_page() {
|
854 |
+
?>
|
855 |
+
<style type="text/css">
|
856 |
+
input[type=submit] {padding: 10px; background: #3399FF; color: #fff; border:0 none;
|
857 |
+
cursor:pointer;
|
858 |
+
-webkit-border-radius: 5px;
|
859 |
+
border-radius: 5px;
|
860 |
+
font-size: 12pt;
|
861 |
+
}
|
862 |
+
</style>
|
863 |
+
|
864 |
+
<div>
|
865 |
+
<form action="options.php" method="post">
|
866 |
+
<?php settings_fields('cleantalk_settings'); ?>
|
867 |
+
<?php do_settings_sections('cleantalk'); ?>
|
868 |
+
<br>
|
869 |
+
<input name="Submit" type="submit" value="<?php esc_attr_e('Save Changes'); ?>" />
|
870 |
+
</form>
|
871 |
+
</div>
|
872 |
+
<?php
|
873 |
+
|
874 |
+
if (ct_valid_key() === false)
|
875 |
+
return null;
|
876 |
+
?>
|
877 |
+
<br />
|
878 |
+
<br />
|
879 |
+
<br />
|
880 |
+
<div>
|
881 |
+
<?php echo __('Plugin Homepage at', 'cleantalk'); ?> <a href="http://cleantalk.org" target="_blank">cleantalk.org</a>.<br />
|
882 |
+
<?php echo __('Tech support CleanTalk:', 'cleantalk'); ?> <a href="https://cleantalk.org/forum/viewforum.php?f=25" target="_blank"><?php echo __('CleanTalk tech forum', 'cleantalk'); ?></a>.<br /><?php echo __('Use s@cleantalk.org to test plugin in any WordPress form.', 'cleantalk'); ?><br />
|
883 |
+
</div>
|
884 |
+
<?php
|
885 |
+
}
|
886 |
+
|
887 |
+
/**
|
888 |
+
* Notice blog owner if plugin is used without Access key
|
889 |
+
* @return bool
|
890 |
+
*/
|
891 |
+
function cleantalk_admin_notice_message(){
|
892 |
+
global $show_ct_notice_trial, $show_ct_notice_renew, $show_ct_notice_online, $show_ct_notice_autokey, $ct_notice_autokey_value, $ct_plugin_name, $ct_options, $ct_data;
|
893 |
+
|
894 |
+
$ct_options = ct_get_options();
|
895 |
+
$ct_data = ct_get_data();
|
896 |
+
|
897 |
+
$user_token = '';
|
898 |
+
if (isset($ct_data['user_token']) && $ct_data['user_token'] != '') {
|
899 |
+
$user_token = '&user_token=' . $ct_data['user_token'];
|
900 |
+
}
|
901 |
+
|
902 |
+
$show_notice = true;
|
903 |
+
|
904 |
+
if(current_user_can('activate_plugins'))
|
905 |
+
{
|
906 |
+
$value = 1;
|
907 |
+
}
|
908 |
+
else
|
909 |
+
{
|
910 |
+
$value = 0;
|
911 |
+
}
|
912 |
+
|
913 |
+
if ($show_notice && $show_ct_notice_autokey && $value==1) {
|
914 |
+
echo '<div class="error"><h3>' . sprintf(__("Unable to get Access key automatically: %s", 'cleantalk'), $ct_notice_autokey_value);
|
915 |
+
echo " <a target='__blank' style='margin-left: 10px' href='https://cleantalk.org/register?platform=wordpress&email=".urlencode(get_option('admin_email'))."&website=".urlencode(parse_url(get_option('siteurl'),PHP_URL_HOST))."'>".__('Click here to get access key manually', 'cleantalk').'</a></h3></div>';
|
916 |
+
}
|
917 |
+
|
918 |
+
if ($show_notice && ct_valid_key($ct_options['apikey']) === false && $value==1) {
|
919 |
+
echo '<div class="error"><h3>' . sprintf(__("Please enter Access Key in %s settings to enable anti spam protection!", 'cleantalk'), "<a href=\"options-general.php?page=cleantalk\">CleanTalk plugin</a>") . '</h3></div>';
|
920 |
+
$show_notice = false;
|
921 |
+
}
|
922 |
+
|
923 |
+
if ($show_notice && $show_ct_notice_trial && $value==1) {
|
924 |
+
echo '<div class="error"><h3>' . sprintf(__("%s trial period ends, please upgrade to %s!", 'cleantalk'), "<a href=\"options-general.php?page=cleantalk\">$ct_plugin_name</a>", "<a href=\"http://cleantalk.org/my/bill/recharge?utm_source=wp-backend&utm_medium=cpc&utm_campaign=WP%20backend%20trial$user_token\" target=\"_blank\"><b>premium version</b></a>") . '</h3></div>';
|
925 |
+
$show_notice = false;
|
926 |
+
}
|
927 |
+
|
928 |
+
if(isset($ct_data['next_notice_show']))
|
929 |
+
{
|
930 |
+
$next_notice_show=$ct_data['next_notice_show'];
|
931 |
+
}
|
932 |
+
else
|
933 |
+
{
|
934 |
+
$next_notice_show=0;
|
935 |
+
}
|
936 |
+
|
937 |
+
$link=@$_SERVER["QUERY_STRING"];
|
938 |
+
if($link!='')
|
939 |
+
{
|
940 |
+
$link="?".$link."&close_notice=1";
|
941 |
+
}
|
942 |
+
else
|
943 |
+
{
|
944 |
+
$link="?close_notice=1";
|
945 |
+
}
|
946 |
+
|
947 |
+
if ($show_notice && $show_ct_notice_renew && $value==1 && time()>$next_notice_show) {
|
948 |
+
$button_html = "<a href=\"http://cleantalk.org/my/bill/recharge?utm_source=wp-backend&utm_medium=cpc&utm_campaign=WP%20backend%20renew$user_token\" target=\"_blank\">" . '<input type="button" class="button button-primary" value="' . __('RENEW ANTI-SPAM', 'cleantalk') . '" />' . "</a>";
|
949 |
+
echo '<div class="updated"><a href="'.$link.'" style="text-decoration:none;float:right;font-size:16px;margin-top:5px;"><b>X</b></a><h3>' . sprintf(__("Please renew your anti-spam license for %s.", 'cleantalk'), "<a href=\"http://cleantalk.org/my/bill/recharge?utm_source=wp-backend&utm_medium=cpc&utm_campaign=WP%20backend%20renew$user_token\" target=\"_blank\"><b>" . __('next year', 'cleantalk') ."</b></a>") . '<br /><br />' . $button_html . '</h3></div>';
|
950 |
+
$show_notice = false;
|
951 |
+
}
|
952 |
+
|
953 |
+
if ($show_notice && $show_ct_notice_online != '' && $value==1) {
|
954 |
+
if($show_ct_notice_online === 'Y'){
|
955 |
+
echo '<div class="updated"><h3><b>';
|
956 |
+
//echo __("Don’t forget to disable CAPTCHA if you have it!", 'cleantalk');
|
957 |
+
echo __("Settings updated!", 'cleantalk');
|
958 |
+
echo '</b></h3></div>';
|
959 |
+
}
|
960 |
+
|
961 |
+
if($show_ct_notice_online === 'N' && $value==1){
|
962 |
+
echo '<div class="error"><h3><b>';
|
963 |
+
echo __("Wrong <a href=\"options-general.php?page=cleantalk\"><b style=\"color: #49C73B;\">Clean</b><b style=\"color: #349ebf;\">Talk</b> access key</a>! Please check it or ask <a target=\"_blank\" href=\"https://cleantalk.org/forum/\">support</a>.", 'cleantalk');
|
964 |
+
echo '</b></h3></div>';
|
965 |
+
}
|
966 |
+
}
|
967 |
+
|
968 |
+
//ct_send_feedback(); -- removed to ct_do_this_hourly()
|
969 |
+
|
970 |
+
return true;
|
971 |
+
}
|
972 |
+
|
973 |
+
/**
|
974 |
+
* @author Artem Leontiev
|
975 |
+
*
|
976 |
+
* Add descriptions for field
|
977 |
+
*/
|
978 |
+
function admin_addDescriptionsFields($descr = '') {
|
979 |
+
echo "<div style='font-size: 10pt; color: #666 !important'>$descr</div>";
|
980 |
+
}
|
981 |
+
|
982 |
+
/**
|
983 |
+
* Test API key
|
984 |
+
*/
|
985 |
+
function ct_valid_key($apikey = null) {
|
986 |
+
global $ct_options, $ct_data;
|
987 |
+
|
988 |
+
$ct_options = ct_get_options();
|
989 |
+
$ct_data = ct_get_data();
|
990 |
+
|
991 |
+
if ($apikey === null) {
|
992 |
+
$apikey = $ct_options['apikey'];
|
993 |
+
}
|
994 |
+
|
995 |
+
return ($apikey === 'enter key' || $apikey === '') ? false : true;
|
996 |
+
}
|
997 |
+
|
998 |
+
/**
|
999 |
+
* Admin action 'comment_unapproved_to_approved' - Approve comment, sends good feedback to cleantalk, removes cleantalk resume
|
1000 |
+
* @param object $comment_object Comment object
|
1001 |
+
* @return boolean TRUE
|
1002 |
+
*/
|
1003 |
+
function ct_comment_approved($comment_object) {
|
1004 |
+
$comment = get_comment($comment_object->comment_ID, 'ARRAY_A');
|
1005 |
+
$hash = get_comment_meta($comment_object->comment_ID, 'ct_hash', true);
|
1006 |
+
|
1007 |
+
$comment['comment_content'] = ct_unmark_red($comment['comment_content']);
|
1008 |
+
$comment['comment_content'] = ct_feedback($hash, $comment['comment_content'], 1);
|
1009 |
+
$comment['comment_approved'] = 1;
|
1010 |
+
wp_update_comment($comment);
|
1011 |
+
|
1012 |
+
return true;
|
1013 |
+
}
|
1014 |
+
|
1015 |
+
/**
|
1016 |
+
* Admin action 'comment_approved_to_unapproved' - Unapprove comment, sends bad feedback to cleantalk
|
1017 |
+
* @param object $comment_object Comment object
|
1018 |
+
* @return boolean TRUE
|
1019 |
+
*/
|
1020 |
+
function ct_comment_unapproved($comment_object) {
|
1021 |
+
$comment = get_comment($comment_object->comment_ID, 'ARRAY_A');
|
1022 |
+
$hash = get_comment_meta($comment_object->comment_ID, 'ct_hash', true);
|
1023 |
+
ct_feedback($hash, $comment['comment_content'], 0);
|
1024 |
+
$comment['comment_approved'] = 0;
|
1025 |
+
wp_update_comment($comment);
|
1026 |
+
|
1027 |
+
return true;
|
1028 |
+
}
|
1029 |
+
|
1030 |
+
/**
|
1031 |
+
* Admin actions 'comment_unapproved_to_spam', 'comment_approved_to_spam' - Mark comment as spam, sends bad feedback to cleantalk
|
1032 |
+
* @param object $comment_object Comment object
|
1033 |
+
* @return boolean TRUE
|
1034 |
+
*/
|
1035 |
+
function ct_comment_spam($comment_object) {
|
1036 |
+
$comment = get_comment($comment_object->comment_ID, 'ARRAY_A');
|
1037 |
+
$hash = get_comment_meta($comment_object->comment_ID, 'ct_hash', true);
|
1038 |
+
ct_feedback($hash, $comment['comment_content'], 0);
|
1039 |
+
$comment['comment_approved'] = 'spam';
|
1040 |
+
wp_update_comment($comment);
|
1041 |
+
|
1042 |
+
return true;
|
1043 |
+
}
|
1044 |
+
|
1045 |
+
|
1046 |
+
/**
|
1047 |
+
* Unspam comment
|
1048 |
+
* @param type $comment_id
|
1049 |
+
*/
|
1050 |
+
function ct_unspam_comment($comment_id) {
|
1051 |
+
update_comment_meta($comment_id, '_wp_trash_meta_status', 1);
|
1052 |
+
$comment = get_comment($comment_id, 'ARRAY_A');
|
1053 |
+
$hash = get_comment_meta($comment_id, 'ct_hash', true);
|
1054 |
+
$comment['comment_content'] = ct_unmark_red($comment['comment_content']);
|
1055 |
+
$comment['comment_content'] = ct_feedback($hash, $comment['comment_content'], 1);
|
1056 |
+
|
1057 |
+
wp_update_comment($comment);
|
1058 |
+
}
|
1059 |
+
|
1060 |
+
/**
|
1061 |
+
* Admin filter 'get_comment_text' - Adds some info to comment text to display
|
1062 |
+
* @param string $current_text Current comment text
|
1063 |
+
* @return string New comment text
|
1064 |
+
*/
|
1065 |
+
function ct_get_comment_text($current_text) {
|
1066 |
+
global $comment;
|
1067 |
+
$new_text = $current_text;
|
1068 |
+
if (isset($comment) && is_object($comment)) {
|
1069 |
+
$hash = get_comment_meta($comment->comment_ID, 'ct_hash', true);
|
1070 |
+
if (!empty($hash)) {
|
1071 |
+
$new_text .= '<hr>Cleantalk ID = ' . $hash;
|
1072 |
+
}
|
1073 |
+
}
|
1074 |
+
return $new_text;
|
1075 |
+
}
|
1076 |
+
|
1077 |
+
/**
|
1078 |
+
* Send feedback for user deletion
|
1079 |
+
* @return null
|
1080 |
+
*/
|
1081 |
+
function ct_delete_user($user_id) {
|
1082 |
+
$hash = get_user_meta($user_id, 'ct_hash', true);
|
1083 |
+
if ($hash !== '') {
|
1084 |
+
ct_feedback($hash, null, 0);
|
1085 |
+
}
|
1086 |
+
}
|
1087 |
+
|
1088 |
+
/**
|
1089 |
+
* Manage links and plugins page
|
1090 |
+
* @return array
|
1091 |
+
*/
|
1092 |
+
if (!function_exists ( 'ct_register_plugin_links')) {
|
1093 |
+
function ct_register_plugin_links($links, $file) {
|
1094 |
+
global $ct_plugin_basename;
|
1095 |
+
|
1096 |
+
if ($file == $ct_plugin_basename) {
|
1097 |
+
$links[] = '<a href="options-general.php?page=cleantalk">' . __( 'Settings' ) . '</a>';
|
1098 |
+
$links[] = '<a href="http://wordpress.org/plugins/cleantalk-spam-protect/faq/" target="_blank">' . __( 'FAQ','cleantalk' ) . '</a>';
|
1099 |
+
$links[] = '<a href="http://cleantalk.org/forum" target="_blank">' . __( 'Support','cleantalk' ) . '</a>';
|
1100 |
+
}
|
1101 |
+
return $links;
|
1102 |
+
}
|
1103 |
+
}
|
1104 |
+
|
1105 |
+
/**
|
1106 |
+
* Manage links in plugins list
|
1107 |
+
* @return array
|
1108 |
+
*/
|
1109 |
+
if (!function_exists ( 'ct_plugin_action_links')) {
|
1110 |
+
function ct_plugin_action_links($links, $file) {
|
1111 |
+
global $ct_plugin_basename;
|
1112 |
+
|
1113 |
+
if ($file == $ct_plugin_basename) {
|
1114 |
+
$settings_link = '<a href="options-general.php?page=cleantalk">' . __( 'Settings' ) . '</a>';
|
1115 |
+
array_unshift( $links, $settings_link ); // before other links
|
1116 |
+
}
|
1117 |
+
return $links;
|
1118 |
+
}
|
1119 |
+
}
|
1120 |
+
|
1121 |
+
/**
|
1122 |
+
* After options update
|
1123 |
+
* @return array
|
1124 |
+
*/
|
1125 |
+
function ct_update_option($option_name) {
|
1126 |
+
global $show_ct_notice_online, $ct_notice_online_label, $ct_notice_trial_label, $trial_notice_showtime, $ct_options, $ct_data, $ct_server_timeout;
|
1127 |
+
|
1128 |
+
$ct_options = ct_get_options(true);
|
1129 |
+
$ct_data = ct_get_data(true);
|
1130 |
+
|
1131 |
+
if($option_name !== 'cleantalk_settings') {
|
1132 |
+
return;
|
1133 |
+
}
|
1134 |
+
|
1135 |
+
$api_key = $ct_options['apikey'];
|
1136 |
+
if (isset($_POST['cleantalk_settings']['apikey'])) {
|
1137 |
+
$api_key = trim($_POST['cleantalk_settings']['apikey']);
|
1138 |
+
$ct_options['apikey'] = $api_key;
|
1139 |
+
}
|
1140 |
+
|
1141 |
+
if(@isset($_POST['cleantalk_settings']['spam_firewall']) && $_POST['cleantalk_settings']['spam_firewall']==1 || isset($ct_options['spam_firewall']) && intval($ct_options['spam_firewall'])==1)
|
1142 |
+
{
|
1143 |
+
cleantalk_update_sfw();
|
1144 |
+
}
|
1145 |
+
|
1146 |
+
if (!ct_valid_key($api_key)) {
|
1147 |
+
return;
|
1148 |
+
}
|
1149 |
+
|
1150 |
+
/*$ct_base_call_result = ct_base_call(array(
|
1151 |
+
'message' => 'CleanTalk setup test',
|
1152 |
+
'example' => null,
|
1153 |
+
'sender_email' => 'good@cleantalk.org',
|
1154 |
+
'sender_nickname' => 'CleanTalk',
|
1155 |
+
'post_info' => '',
|
1156 |
+
'checkjs' => 1
|
1157 |
+
));*/
|
1158 |
+
|
1159 |
+
$key_valid = true;
|
1160 |
+
$app_server_error = false;
|
1161 |
+
$ct_data['testing_failed']=0;
|
1162 |
+
|
1163 |
+
|
1164 |
+
if(!function_exists('sendRawRequest'))
|
1165 |
+
{
|
1166 |
+
require_once('cleantalk.class.php');
|
1167 |
+
}
|
1168 |
+
|
1169 |
+
$request=Array();
|
1170 |
+
$request['method_name'] = 'notice_validate_key';
|
1171 |
+
$request['auth_key'] = $api_key;
|
1172 |
+
$url='https://api.cleantalk.org';
|
1173 |
+
if(!function_exists('sendRawRequest'))
|
1174 |
+
{
|
1175 |
+
require_once('cleantalk.class.php');
|
1176 |
+
}
|
1177 |
+
$result=sendRawRequest($url, $request);
|
1178 |
+
if ($result)
|
1179 |
+
{
|
1180 |
+
$result = json_decode($result, true);
|
1181 |
+
if (isset($result['valid']) && $result['valid'] == 0) {
|
1182 |
+
$key_valid = false;
|
1183 |
+
$ct_data['testing_failed']=1;
|
1184 |
+
}
|
1185 |
+
}
|
1186 |
+
if (!$result || !isset($result['valid']))
|
1187 |
+
{
|
1188 |
+
$app_server_error = true;
|
1189 |
+
$ct_data['testing_failed']=1;
|
1190 |
+
}
|
1191 |
+
|
1192 |
+
update_option('cleantalk_data', $ct_data);
|
1193 |
+
|
1194 |
+
if ($key_valid) {
|
1195 |
+
// Removes cookie for server errors
|
1196 |
+
if ($app_server_error) {
|
1197 |
+
setcookie($ct_notice_online_label, '', 1, '/'); // time 1 is exactly in past even clients time() is wrong
|
1198 |
+
unset($_COOKIE[$ct_notice_online_label]);
|
1199 |
+
} else {
|
1200 |
+
setcookie($ct_notice_online_label, (string) time(), strtotime("+14 days"), '/');
|
1201 |
+
}
|
1202 |
+
setcookie($ct_notice_trial_label, '0', strtotime("+$trial_notice_showtime minutes"), '/');
|
1203 |
+
} else {
|
1204 |
+
setcookie($ct_notice_online_label, 'BAD_KEY', 0, '/');
|
1205 |
+
}
|
1206 |
+
}
|
1207 |
+
|
1208 |
+
/**
|
1209 |
+
* Unmark bad words
|
1210 |
+
* @param string $message
|
1211 |
+
* @return string Cleat comment
|
1212 |
+
*/
|
1213 |
+
function ct_unmark_red($message) {
|
1214 |
+
$message = preg_replace("/\<font rel\=\"cleantalk\" color\=\"\#FF1000\"\>(\S+)\<\/font>/iu", '$1', $message);
|
1215 |
+
|
1216 |
+
return $message;
|
1217 |
+
}
|
1218 |
+
|
1219 |
+
?>
|
cleantalk-ajax.php → inc/cleantalk-ajax.php
RENAMED
File without changes
|
inc/cleantalk-ajax_old.php
ADDED
@@ -0,0 +1,775 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
AJAX functions
|
5 |
+
*/
|
6 |
+
|
7 |
+
/*hooks for AJAX Login & Register email validation*/
|
8 |
+
add_action( 'wp_ajax_nopriv_validate_email', 'ct_validate_email_ajaxlogin',1 );
|
9 |
+
add_action( 'wp_ajax_validate_email', 'ct_validate_email_ajaxlogin',1 );
|
10 |
+
|
11 |
+
/*hooks for user registration*/
|
12 |
+
add_action( 'user_register', 'ct_user_register_ajaxlogin',1 );
|
13 |
+
|
14 |
+
/*hooks for WPUF pro */
|
15 |
+
add_action( 'wp_ajax_nopriv_wpuf_submit_register', 'ct_wpuf_submit_register',1 );
|
16 |
+
add_action( 'wp_ajax_wpuf_submit_register', 'ct_wpuf_submit_register',1 );
|
17 |
+
|
18 |
+
/*hooks for MyMail */
|
19 |
+
add_action( 'wp_ajax_nopriv_mymail_form_submit', 'ct_mymail_form_submit',1 );
|
20 |
+
add_action( 'wp_ajax_mymail_form_submit', 'ct_mymail_form_submit',1 );
|
21 |
+
|
22 |
+
/*hooks for MailPoet */
|
23 |
+
add_action( 'wp_ajax_nopriv_wysija_ajax', 'ct_wysija_ajax',1 );
|
24 |
+
add_action( 'wp_ajax_wysija_ajax', 'ct_wysija_ajax',1 );
|
25 |
+
|
26 |
+
/*hooks for cs_registration_validation */
|
27 |
+
add_action( 'wp_ajax_nopriv_cs_registration_validation', 'ct_cs_registration_validation',1 );
|
28 |
+
add_action( 'wp_ajax_cs_registration_validation', 'ct_cs_registration_validation',1 );
|
29 |
+
|
30 |
+
/*hooks for cs_registration_validation */
|
31 |
+
add_action( 'wp_ajax_nopriv_cs_registration_validation', 'ct_cs_registration_validation',1 );
|
32 |
+
add_action( 'wp_ajax_cs_registration_validation', 'ct_cs_registration_validation',1 );
|
33 |
+
|
34 |
+
/*hooks for send_message and request_appointment */
|
35 |
+
add_action( 'wp_ajax_nopriv_send_message', 'ct_sm_ra',1 );
|
36 |
+
add_action( 'wp_ajax_send_message', 'ct_sm_ra',1 );
|
37 |
+
add_action( 'wp_ajax_nopriv_request_appointment', 'ct_sm_ra',1 );
|
38 |
+
add_action( 'wp_ajax_request_appointment', 'ct_sm_ra',1 );
|
39 |
+
|
40 |
+
/*hooks for zn_do_login */
|
41 |
+
add_action( 'wp_ajax_nopriv_zn_do_login', 'ct_zn_do_login',1 );
|
42 |
+
add_action( 'wp_ajax_zn_do_login', 'ct_zn_do_login',1 );
|
43 |
+
|
44 |
+
/*hooks for zn_do_login */
|
45 |
+
add_action( 'wp_ajax_nopriv_cscf-submitform', 'ct_cscf_submitform',1 );
|
46 |
+
add_action( 'wp_ajax_cscf-submitform', 'ct_cscf_submitform',1 );
|
47 |
+
|
48 |
+
/*hooks for stats */
|
49 |
+
add_action( 'wp_ajax_nopriv_ajax_get_stats', 'ct_get_stats',1 );
|
50 |
+
add_action( 'wp_ajax_ajax_get_stats', 'ct_get_stats',1 );
|
51 |
+
|
52 |
+
/*hooks for visual form builder */
|
53 |
+
add_action( 'wp_ajax_nopriv_vfb_submit', 'ct_vfb_submit',1 );
|
54 |
+
add_action( 'wp_ajax_vfb_submit', 'ct_vfb_submit',1 );
|
55 |
+
|
56 |
+
function ct_get_stats()
|
57 |
+
{
|
58 |
+
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
59 |
+
global $ct_data;
|
60 |
+
$ct_data=ct_get_data();
|
61 |
+
$t=time();
|
62 |
+
|
63 |
+
if(!isset($ct_data['stat_accepted']))
|
64 |
+
{
|
65 |
+
$ct_data['stat_accepted']=0;
|
66 |
+
$ct_data['stat_blocked']=0;
|
67 |
+
$ct_data['stat_all']=0;
|
68 |
+
$ct_data['last_time']=$t;
|
69 |
+
update_option('cleantalk_data', $ct_data);
|
70 |
+
}
|
71 |
+
|
72 |
+
$last_time=intval($ct_data['last_time']);
|
73 |
+
if($t-$last_time>86400)
|
74 |
+
{
|
75 |
+
$ct_data['stat_accepted']=0;
|
76 |
+
$ct_data['stat_blocked']=0;
|
77 |
+
$ct_data['stat_all']=0;
|
78 |
+
$ct_data['last_time']=$t;
|
79 |
+
update_option('cleantalk_data', $ct_data);
|
80 |
+
}
|
81 |
+
|
82 |
+
$ret=Array('stat_accepted'=>$ct_data['stat_accepted'],'stat_blocked'=>$ct_data['stat_blocked'],'stat_all'=>$ct_data['stat_all']);
|
83 |
+
print json_encode($ret);
|
84 |
+
die();
|
85 |
+
}
|
86 |
+
|
87 |
+
function ct_validate_email_ajaxlogin($email=null, $is_ajax=true)
|
88 |
+
{
|
89 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
|
90 |
+
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;
|
91 |
+
|
92 |
+
$ct_options=ct_get_options();
|
93 |
+
$ct_data=ct_get_data();
|
94 |
+
|
95 |
+
$email = is_null( $email ) ? $email : $_POST['email'];
|
96 |
+
$email=sanitize_email($email);
|
97 |
+
$is_good=true;
|
98 |
+
if ( ! filter_var( $email, FILTER_VALIDATE_EMAIL )||email_exists( $email ) )
|
99 |
+
{
|
100 |
+
$is_good=false;
|
101 |
+
}
|
102 |
+
|
103 |
+
if(class_exists('AjaxLogin')&&isset($_POST['action'])&&$_POST['action']=='validate_email')
|
104 |
+
{
|
105 |
+
|
106 |
+
$ct_options=ct_get_options();
|
107 |
+
$checkjs = js_test('ct_checkjs', $_COOKIE, true);
|
108 |
+
$submit_time = submit_time_test();
|
109 |
+
$sender_info = get_sender_info();
|
110 |
+
$sender_info['post_checkjs_passed']=$checkjs;
|
111 |
+
|
112 |
+
if ($checkjs === null)
|
113 |
+
{
|
114 |
+
$checkjs = js_test('ct_checkjs', $_COOKIE, true);
|
115 |
+
$sender_info['cookie_checkjs_passed'] = $checkjs;
|
116 |
+
}
|
117 |
+
|
118 |
+
$sender_info = json_encode($sender_info);
|
119 |
+
if ($sender_info === false)
|
120 |
+
{
|
121 |
+
$sender_info= '';
|
122 |
+
}
|
123 |
+
|
124 |
+
require_once('cleantalk.class.php');
|
125 |
+
$config = get_option('cleantalk_server');
|
126 |
+
$ct = new Cleantalk();
|
127 |
+
$ct->work_url = $config['ct_work_url'];
|
128 |
+
$ct->server_url = $ct_options['server'];
|
129 |
+
|
130 |
+
$ct->server_ttl = $config['ct_server_ttl'];
|
131 |
+
$ct->server_changed = $config['ct_server_changed'];
|
132 |
+
$ct->ssl_on = $ct_options['ssl_on'];
|
133 |
+
|
134 |
+
$ct_request = new CleantalkRequest();
|
135 |
+
$ct_request->auth_key = $ct_options['apikey'];
|
136 |
+
$ct_request->sender_email = $email;
|
137 |
+
$ct_request->sender_ip = $ct->ct_session_ip($_SERVER['REMOTE_ADDR']);
|
138 |
+
$ct_request->sender_nickname = '';
|
139 |
+
$ct_request->agent = $ct_agent_version;
|
140 |
+
$ct_request->sender_info = $sender_info;
|
141 |
+
$ct_request->js_on = $checkjs;
|
142 |
+
$ct_request->submit_time = $submit_time;
|
143 |
+
|
144 |
+
$ct_result = $ct->isAllowUser($ct_request);
|
145 |
+
|
146 |
+
if ($ct->server_change)
|
147 |
+
{
|
148 |
+
update_option(
|
149 |
+
'cleantalk_server', array(
|
150 |
+
'ct_work_url' => $ct->work_url,
|
151 |
+
'ct_server_ttl' => $ct->server_ttl,
|
152 |
+
'ct_server_changed' => time()
|
153 |
+
)
|
154 |
+
);
|
155 |
+
}
|
156 |
+
if ($ct_result->allow===0)
|
157 |
+
{
|
158 |
+
$is_good=false;
|
159 |
+
}
|
160 |
+
}
|
161 |
+
if($is_good)
|
162 |
+
{
|
163 |
+
$ajaxresult=array(
|
164 |
+
'description' => null,
|
165 |
+
'cssClass' => 'noon',
|
166 |
+
'code' => 'success'
|
167 |
+
);
|
168 |
+
}
|
169 |
+
else
|
170 |
+
{
|
171 |
+
$ajaxresult=array(
|
172 |
+
'description' => 'Invalid Email',
|
173 |
+
'cssClass' => 'error-container',
|
174 |
+
'code' => 'error'
|
175 |
+
);
|
176 |
+
}
|
177 |
+
$ajaxresult=json_encode($ajaxresult);
|
178 |
+
print $ajaxresult;
|
179 |
+
wp_die();
|
180 |
+
}
|
181 |
+
|
182 |
+
function ct_user_register_ajaxlogin($user_id)
|
183 |
+
{
|
184 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
|
185 |
+
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;
|
186 |
+
|
187 |
+
$ct_options=ct_get_options();
|
188 |
+
$ct_data=ct_get_data();
|
189 |
+
|
190 |
+
if(class_exists('AjaxLogin')&&isset($_POST['action'])&&$_POST['action']=='register_submit')
|
191 |
+
{
|
192 |
+
$checkjs = js_test('ct_checkjs', $_COOKIE, true);
|
193 |
+
$submit_time = submit_time_test();
|
194 |
+
$sender_info = get_sender_info();
|
195 |
+
$sender_info['post_checkjs_passed']=$checkjs;
|
196 |
+
|
197 |
+
if ($checkjs === null)
|
198 |
+
{
|
199 |
+
$checkjs = js_test('ct_checkjs', $_COOKIE, true);
|
200 |
+
$sender_info['cookie_checkjs_passed'] = $checkjs;
|
201 |
+
}
|
202 |
+
|
203 |
+
$sender_info = json_encode($sender_info);
|
204 |
+
if ($sender_info === false)
|
205 |
+
{
|
206 |
+
$sender_info= '';
|
207 |
+
}
|
208 |
+
|
209 |
+
require_once('cleantalk.class.php');
|
210 |
+
$config = get_option('cleantalk_server');
|
211 |
+
$ct = new Cleantalk();
|
212 |
+
$ct->work_url = $config['ct_work_url'];
|
213 |
+
$ct->server_url = $ct_options['server'];
|
214 |
+
|
215 |
+
$ct->server_ttl = $config['ct_server_ttl'];
|
216 |
+
$ct->server_changed = $config['ct_server_changed'];
|
217 |
+
$ct->ssl_on = $ct_options['ssl_on'];
|
218 |
+
|
219 |
+
$ct_request = new CleantalkRequest();
|
220 |
+
$ct_request->auth_key = $ct_options['apikey'];
|
221 |
+
$ct_request->sender_email = sanitize_email($_POST['email']);
|
222 |
+
$ct_request->sender_ip = $ct->ct_session_ip($_SERVER['REMOTE_ADDR']);
|
223 |
+
$ct_request->sender_nickname = sanitize_email($_POST['login']); ;
|
224 |
+
$ct_request->agent = $ct_agent_version;
|
225 |
+
$ct_request->sender_info = $sender_info;
|
226 |
+
$ct_request->js_on = $checkjs;
|
227 |
+
$ct_request->submit_time = $submit_time;
|
228 |
+
|
229 |
+
$ct_result = $ct->isAllowUser($ct_request);
|
230 |
+
|
231 |
+
if ($ct->server_change)
|
232 |
+
{
|
233 |
+
update_option(
|
234 |
+
'cleantalk_server', array(
|
235 |
+
'ct_work_url' => $ct->work_url,
|
236 |
+
'ct_server_ttl' => $ct->server_ttl,
|
237 |
+
'ct_server_changed' => time()
|
238 |
+
)
|
239 |
+
);
|
240 |
+
}
|
241 |
+
if ($ct_result->allow===0)
|
242 |
+
{
|
243 |
+
wp_delete_user($user_id);
|
244 |
+
}
|
245 |
+
}
|
246 |
+
return $user_id;
|
247 |
+
}
|
248 |
+
|
249 |
+
function ct_wpuf_submit_register()
|
250 |
+
{
|
251 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
|
252 |
+
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;
|
253 |
+
|
254 |
+
$ct_data=ct_get_data();
|
255 |
+
|
256 |
+
$ct_options=ct_get_options();
|
257 |
+
|
258 |
+
$sender_email = null;
|
259 |
+
$message = '';
|
260 |
+
|
261 |
+
foreach ($_POST as $key => $value)
|
262 |
+
{
|
263 |
+
if ($sender_email === null && preg_match("/^\S+@\S+\.\S+$/", $value))
|
264 |
+
{
|
265 |
+
$sender_email = $value;
|
266 |
+
}
|
267 |
+
else
|
268 |
+
{
|
269 |
+
$message.="$value\n";
|
270 |
+
}
|
271 |
+
}
|
272 |
+
|
273 |
+
if($sender_email!=null)
|
274 |
+
{
|
275 |
+
$checkjs = js_test('ct_checkjs', $_COOKIE, true);
|
276 |
+
$submit_time = submit_time_test();
|
277 |
+
$sender_info = get_sender_info();
|
278 |
+
$sender_info['post_checkjs_passed']=$checkjs;
|
279 |
+
|
280 |
+
$sender_info = json_encode($sender_info);
|
281 |
+
if ($sender_info === false)
|
282 |
+
{
|
283 |
+
$sender_info= '';
|
284 |
+
}
|
285 |
+
|
286 |
+
$ct_base_call_result = ct_base_call(array(
|
287 |
+
'message' => $message,
|
288 |
+
'example' => null,
|
289 |
+
'sender_email' => $sender_email,
|
290 |
+
'sender_nickname' => null,
|
291 |
+
'sender_info' => $sender_info,
|
292 |
+
'post_info'=>null,
|
293 |
+
'checkjs' => $checkjs));
|
294 |
+
|
295 |
+
$ct = $ct_base_call_result['ct'];
|
296 |
+
$ct_result = $ct_base_call_result['ct_result'];
|
297 |
+
if ($ct_result->allow == 0)
|
298 |
+
{
|
299 |
+
$result=Array('success'=>false,'error'=>$ct_result->comment);
|
300 |
+
@header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
|
301 |
+
print json_encode($result);
|
302 |
+
die();
|
303 |
+
}
|
304 |
+
}
|
305 |
+
}
|
306 |
+
|
307 |
+
function ct_mymail_form_submit()
|
308 |
+
{
|
309 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
|
310 |
+
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;
|
311 |
+
|
312 |
+
$ct_data=ct_get_data();
|
313 |
+
|
314 |
+
$ct_options=ct_get_options();
|
315 |
+
|
316 |
+
$sender_email = null;
|
317 |
+
$message = '';
|
318 |
+
|
319 |
+
ct_get_fields($sender_email,$message,$_POST);
|
320 |
+
|
321 |
+
if($sender_email!=null)
|
322 |
+
{
|
323 |
+
$checkjs = js_test('ct_checkjs', $_COOKIE, true);
|
324 |
+
$submit_time = submit_time_test();
|
325 |
+
$sender_info = get_sender_info();
|
326 |
+
$sender_info['post_checkjs_passed']=$checkjs;
|
327 |
+
|
328 |
+
$sender_info = json_encode($sender_info);
|
329 |
+
if ($sender_info === false)
|
330 |
+
{
|
331 |
+
$sender_info= '';
|
332 |
+
}
|
333 |
+
|
334 |
+
$ct_base_call_result = ct_base_call(array(
|
335 |
+
'message' => $message,
|
336 |
+
'example' => null,
|
337 |
+
'sender_email' => $sender_email,
|
338 |
+
'sender_nickname' => null,
|
339 |
+
'sender_info' => $sender_info,
|
340 |
+
'post_info'=>null,
|
341 |
+
'checkjs' => $checkjs));
|
342 |
+
|
343 |
+
$ct = $ct_base_call_result['ct'];
|
344 |
+
$ct_result = $ct_base_call_result['ct_result'];
|
345 |
+
if ($ct_result->allow == 0)
|
346 |
+
{
|
347 |
+
$result=Array('success'=>false,'html'=>$ct_result->comment);
|
348 |
+
@header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
|
349 |
+
print json_encode($result);
|
350 |
+
die();
|
351 |
+
}
|
352 |
+
}
|
353 |
+
}
|
354 |
+
|
355 |
+
function ct_wysija_ajax()
|
356 |
+
{
|
357 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
|
358 |
+
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;
|
359 |
+
|
360 |
+
$ct_data=ct_get_data();
|
361 |
+
|
362 |
+
$ct_options=ct_get_options();
|
363 |
+
|
364 |
+
$sender_email = null;
|
365 |
+
$message = '';
|
366 |
+
|
367 |
+
ct_get_fields($sender_email,$message,$_POST);
|
368 |
+
|
369 |
+
|
370 |
+
if($sender_email!=null&&isset($_GET['callback']))
|
371 |
+
{
|
372 |
+
$checkjs = js_test('ct_checkjs', $_COOKIE, true);
|
373 |
+
$submit_time = submit_time_test();
|
374 |
+
$sender_info = get_sender_info();
|
375 |
+
$sender_info['post_checkjs_passed']=$checkjs;
|
376 |
+
|
377 |
+
$sender_info = json_encode($sender_info);
|
378 |
+
if ($sender_info === false)
|
379 |
+
{
|
380 |
+
$sender_info= '';
|
381 |
+
}
|
382 |
+
|
383 |
+
$ct_base_call_result = ct_base_call(array(
|
384 |
+
'message' => $message,
|
385 |
+
'example' => null,
|
386 |
+
'sender_email' => $sender_email,
|
387 |
+
'sender_nickname' => null,
|
388 |
+
'sender_info' => $sender_info,
|
389 |
+
'post_info'=>null,
|
390 |
+
'checkjs' => $checkjs));
|
391 |
+
|
392 |
+
$ct = $ct_base_call_result['ct'];
|
393 |
+
$ct_result = $ct_base_call_result['ct_result'];
|
394 |
+
if ($ct_result->allow == 0)
|
395 |
+
{
|
396 |
+
$result=Array('result'=>false,'msgs'=>Array('updated'=>Array($ct_result->comment)));
|
397 |
+
//@header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
|
398 |
+
print $_GET['callback'].'('.json_encode($result).');';
|
399 |
+
die();
|
400 |
+
}
|
401 |
+
}
|
402 |
+
}
|
403 |
+
|
404 |
+
function ct_cs_registration_validation()
|
405 |
+
{
|
406 |
+
|
407 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
|
408 |
+
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;
|
409 |
+
|
410 |
+
$ct_data=ct_get_data();
|
411 |
+
|
412 |
+
$ct_options=ct_get_options();
|
413 |
+
|
414 |
+
$sender_email = null;
|
415 |
+
$message = '';
|
416 |
+
|
417 |
+
ct_get_fields($sender_email,$message,$_POST);
|
418 |
+
|
419 |
+
if($sender_email!=null)
|
420 |
+
{
|
421 |
+
$checkjs = js_test('ct_checkjs', $_COOKIE, true);
|
422 |
+
$submit_time = submit_time_test();
|
423 |
+
$sender_info = get_sender_info();
|
424 |
+
$sender_info['post_checkjs_passed']=$checkjs;
|
425 |
+
|
426 |
+
$sender_info = json_encode($sender_info);
|
427 |
+
if ($sender_info === false)
|
428 |
+
{
|
429 |
+
$sender_info = '';
|
430 |
+
}
|
431 |
+
if(isset($_POST['user_login']))
|
432 |
+
{
|
433 |
+
$nickname=$_POST['user_login'];
|
434 |
+
}
|
435 |
+
else
|
436 |
+
{
|
437 |
+
$nickname='';
|
438 |
+
}
|
439 |
+
require_once('cleantalk.class.php');
|
440 |
+
|
441 |
+
$config = get_option('cleantalk_server');
|
442 |
+
$ct = new Cleantalk();
|
443 |
+
$ct->work_url = $config['ct_work_url'];
|
444 |
+
$ct->server_url = $ct_options['server'];
|
445 |
+
|
446 |
+
$ct->server_ttl = $config['ct_server_ttl'];
|
447 |
+
$ct->server_changed = $config['ct_server_changed'];
|
448 |
+
$ct->ssl_on = $ct_options['ssl_on'];
|
449 |
+
|
450 |
+
|
451 |
+
$ct_request = new CleantalkRequest();
|
452 |
+
$ct_request->auth_key = $ct_options['apikey'];
|
453 |
+
$ct_request->sender_email = $sender_email;
|
454 |
+
$ct_request->sender_ip = $_SERVER['REMOTE_ADDR'];
|
455 |
+
$ct_request->sender_nickname = $nickname;
|
456 |
+
$ct_request->agent = $ct_agent_version;
|
457 |
+
$ct_request->sender_info = $sender_info;
|
458 |
+
$ct_request->js_on = $checkjs;
|
459 |
+
$ct_request->submit_time = $submit_time;
|
460 |
+
|
461 |
+
$ct_result = $ct->isAllowUser($ct_request);
|
462 |
+
|
463 |
+
if ($ct_result->allow == 0)
|
464 |
+
{
|
465 |
+
$result=Array("type"=>"error","message"=>$ct_result->comment);
|
466 |
+
print json_encode($result);
|
467 |
+
die();
|
468 |
+
}
|
469 |
+
}
|
470 |
+
}
|
471 |
+
|
472 |
+
function ct_sm_ra()
|
473 |
+
{
|
474 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
|
475 |
+
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;
|
476 |
+
|
477 |
+
$ct_data=ct_get_data();
|
478 |
+
|
479 |
+
$ct_options=ct_get_options();
|
480 |
+
|
481 |
+
$sender_email = null;
|
482 |
+
$message = '';
|
483 |
+
|
484 |
+
if(isset($_POST['target']))
|
485 |
+
{
|
486 |
+
$tmp=$_POST['target'];
|
487 |
+
$_POST['target']=1;
|
488 |
+
}
|
489 |
+
|
490 |
+
ct_get_fields($sender_email,$message,$_POST);
|
491 |
+
|
492 |
+
if(isset($_POST['target']))
|
493 |
+
{
|
494 |
+
$_POST['target']=$tmp;
|
495 |
+
}
|
496 |
+
|
497 |
+
|
498 |
+
if($sender_email!=null)
|
499 |
+
{
|
500 |
+
$checkjs = js_test('ct_checkjs', $_COOKIE, true);
|
501 |
+
$submit_time = submit_time_test();
|
502 |
+
$sender_info = get_sender_info();
|
503 |
+
$sender_info['post_checkjs_passed']=$checkjs;
|
504 |
+
|
505 |
+
$sender_info = json_encode($sender_info);
|
506 |
+
if ($sender_info === false)
|
507 |
+
{
|
508 |
+
$sender_info= '';
|
509 |
+
}
|
510 |
+
|
511 |
+
$ct_base_call_result = ct_base_call(array(
|
512 |
+
'message' => $message,
|
513 |
+
'example' => null,
|
514 |
+
'sender_email' => $sender_email,
|
515 |
+
'sender_nickname' => null,
|
516 |
+
'sender_info' => $sender_info,
|
517 |
+
'post_info'=>null,
|
518 |
+
'checkjs' => $checkjs));
|
519 |
+
|
520 |
+
$ct = $ct_base_call_result['ct'];
|
521 |
+
$ct_result = $ct_base_call_result['ct_result'];
|
522 |
+
if ($ct_result->allow == 0)
|
523 |
+
{
|
524 |
+
print $ct_result->comment;
|
525 |
+
die();
|
526 |
+
}
|
527 |
+
}
|
528 |
+
}
|
529 |
+
|
530 |
+
function ct_zn_do_login()
|
531 |
+
{
|
532 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
|
533 |
+
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;
|
534 |
+
|
535 |
+
$ct_data=ct_get_data();
|
536 |
+
|
537 |
+
$ct_options=ct_get_options();
|
538 |
+
|
539 |
+
$sender_email = null;
|
540 |
+
$message = '';
|
541 |
+
|
542 |
+
ct_get_fields($sender_email,$message,$_POST);
|
543 |
+
|
544 |
+
|
545 |
+
if($sender_email!=null&&$_POST['zn_form_action']=='register')
|
546 |
+
{
|
547 |
+
$checkjs = js_test('ct_checkjs', $_COOKIE, true);
|
548 |
+
$submit_time = submit_time_test();
|
549 |
+
$sender_info = get_sender_info();
|
550 |
+
$sender_info['post_checkjs_passed']=$checkjs;
|
551 |
+
|
552 |
+
$sender_info = json_encode($sender_info);
|
553 |
+
if ($sender_info === false)
|
554 |
+
{
|
555 |
+
$sender_info= '';
|
556 |
+
}
|
557 |
+
|
558 |
+
$ct_base_call_result = ct_base_call(array(
|
559 |
+
'message' => $message,
|
560 |
+
'example' => null,
|
561 |
+
'sender_email' => $sender_email,
|
562 |
+
'sender_nickname' => null,
|
563 |
+
'sender_info' => $sender_info,
|
564 |
+
'post_info'=>null,
|
565 |
+
'checkjs' => $checkjs));
|
566 |
+
|
567 |
+
$ct = $ct_base_call_result['ct'];
|
568 |
+
$ct_result = $ct_base_call_result['ct_result'];
|
569 |
+
if ($ct_result->allow == 0)
|
570 |
+
{
|
571 |
+
print '<div id="login_error">'.$ct_result->comment.'</div>';
|
572 |
+
die();
|
573 |
+
}
|
574 |
+
}
|
575 |
+
}
|
576 |
+
|
577 |
+
function ct_vfb_submit()
|
578 |
+
{
|
579 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
|
580 |
+
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;
|
581 |
+
|
582 |
+
$ct_data=ct_get_data();
|
583 |
+
|
584 |
+
$ct_options=ct_get_options();
|
585 |
+
|
586 |
+
$sender_email = null;
|
587 |
+
$message = '';
|
588 |
+
|
589 |
+
foreach ($_POST as $key => $value)
|
590 |
+
{
|
591 |
+
if ($sender_email === null && preg_match("/^\S+@\S+\.\S+$/", $value))
|
592 |
+
{
|
593 |
+
$sender_email = $value;
|
594 |
+
}
|
595 |
+
else
|
596 |
+
{
|
597 |
+
$message.="$value\n";
|
598 |
+
}
|
599 |
+
}
|
600 |
+
|
601 |
+
if($sender_email!=null)
|
602 |
+
{
|
603 |
+
$checkjs = js_test('ct_checkjs', $_COOKIE, true);
|
604 |
+
$submit_time = submit_time_test();
|
605 |
+
$sender_info = get_sender_info();
|
606 |
+
$sender_info['post_checkjs_passed']=$checkjs;
|
607 |
+
|
608 |
+
$sender_info = json_encode($sender_info);
|
609 |
+
if ($sender_info === false)
|
610 |
+
{
|
611 |
+
$sender_info= '';
|
612 |
+
}
|
613 |
+
|
614 |
+
$ct_base_call_result = ct_base_call(array(
|
615 |
+
'message' => $message,
|
616 |
+
'example' => null,
|
617 |
+
'sender_email' => $sender_email,
|
618 |
+
'sender_nickname' => null,
|
619 |
+
'sender_info' => $sender_info,
|
620 |
+
'post_info'=>null,
|
621 |
+
'checkjs' => $checkjs));
|
622 |
+
|
623 |
+
$ct = $ct_base_call_result['ct'];
|
624 |
+
$ct_result = $ct_base_call_result['ct_result'];
|
625 |
+
if ($ct_result->allow == 0)
|
626 |
+
{
|
627 |
+
$result=Array('result'=>false,'message'=>$ct_result->comment);
|
628 |
+
@header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
|
629 |
+
print json_encode($result);
|
630 |
+
die();
|
631 |
+
}
|
632 |
+
}
|
633 |
+
}
|
634 |
+
|
635 |
+
function ct_cscf_submitform()
|
636 |
+
{
|
637 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
|
638 |
+
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;
|
639 |
+
|
640 |
+
$ct_data=ct_get_data();
|
641 |
+
|
642 |
+
$ct_options=ct_get_options();
|
643 |
+
|
644 |
+
$sender_email = null;
|
645 |
+
$message = '';
|
646 |
+
|
647 |
+
if(isset($_POST['cscf']['confirm-email']))
|
648 |
+
{
|
649 |
+
$tmp=$_POST['cscf']['confirm-email'];
|
650 |
+
$_POST['cscf']['confirm-email']=1;
|
651 |
+
}
|
652 |
+
|
653 |
+
ct_get_fields($sender_email,$message,$_POST);
|
654 |
+
|
655 |
+
if(isset($_POST['cscf']['confirm-email']))
|
656 |
+
{
|
657 |
+
$_POST['cscf']['confirm-email']=$tmp;
|
658 |
+
}
|
659 |
+
|
660 |
+
|
661 |
+
if($sender_email!=null)
|
662 |
+
{
|
663 |
+
$checkjs = js_test('ct_checkjs', $_COOKIE, true);
|
664 |
+
$submit_time = submit_time_test();
|
665 |
+
$sender_info = get_sender_info();
|
666 |
+
$sender_info['post_checkjs_passed']=$checkjs;
|
667 |
+
|
668 |
+
$sender_info = json_encode($sender_info);
|
669 |
+
if ($sender_info === false)
|
670 |
+
{
|
671 |
+
$sender_info= '';
|
672 |
+
}
|
673 |
+
|
674 |
+
$ct_base_call_result = ct_base_call(array(
|
675 |
+
'message' => $message,
|
676 |
+
'example' => null,
|
677 |
+
'sender_email' => $sender_email,
|
678 |
+
'sender_nickname' => null,
|
679 |
+
'sender_info' => $sender_info,
|
680 |
+
'post_info'=>null,
|
681 |
+
'checkjs' => $checkjs));
|
682 |
+
|
683 |
+
$ct = $ct_base_call_result['ct'];
|
684 |
+
$ct_result = $ct_base_call_result['ct_result'];
|
685 |
+
if ($ct_result->allow == 0)
|
686 |
+
{
|
687 |
+
$result=Array('sent'=>true,'valid'=>false,'errorlist'=>Array('name'=>$ct_result->comment));
|
688 |
+
print json_encode($result);
|
689 |
+
die();
|
690 |
+
}
|
691 |
+
}
|
692 |
+
}
|
693 |
+
|
694 |
+
function ct_theme_submit()
|
695 |
+
{
|
696 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
|
697 |
+
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;
|
698 |
+
|
699 |
+
$ct_data=ct_get_data();
|
700 |
+
|
701 |
+
$ct_options=ct_get_options();
|
702 |
+
|
703 |
+
$sender_email = null;
|
704 |
+
$message = '';
|
705 |
+
|
706 |
+
if(isset($_POST['cscf']['confirm-email']))
|
707 |
+
{
|
708 |
+
$tmp=$_POST['cscf']['confirm-email'];
|
709 |
+
$_POST['cscf']['confirm-email']=1;
|
710 |
+
}
|
711 |
+
|
712 |
+
ct_get_fields($sender_email,$message,$_POST);
|
713 |
+
|
714 |
+
if(isset($_POST['cscf']['confirm-email']))
|
715 |
+
{
|
716 |
+
$_POST['cscf']['confirm-email']=$tmp;
|
717 |
+
}
|
718 |
+
|
719 |
+
|
720 |
+
if($sender_email!=null)
|
721 |
+
{
|
722 |
+
$checkjs = js_test('ct_checkjs', $_COOKIE, true);
|
723 |
+
$submit_time = submit_time_test();
|
724 |
+
$sender_info = get_sender_info();
|
725 |
+
$sender_info['post_checkjs_passed']=$checkjs;
|
726 |
+
|
727 |
+
$sender_info = json_encode($sender_info);
|
728 |
+
if ($sender_info === false)
|
729 |
+
{
|
730 |
+
$sender_info= '';
|
731 |
+
}
|
732 |
+
|
733 |
+
$ct_base_call_result = ct_base_call(array(
|
734 |
+
'message' => $message,
|
735 |
+
'example' => null,
|
736 |
+
'sender_email' => $sender_email,
|
737 |
+
'sender_nickname' => null,
|
738 |
+
'sender_info' => $sender_info,
|
739 |
+
'post_info'=>null,
|
740 |
+
'checkjs' => $checkjs));
|
741 |
+
|
742 |
+
$ct = $ct_base_call_result['ct'];
|
743 |
+
$ct_result = $ct_base_call_result['ct_result'];
|
744 |
+
if ($ct_result->allow == 0)
|
745 |
+
{
|
746 |
+
$result=Array('sent'=>true,'valid'=>false,'errorlist'=>Array('name'=>$ct_result->comment));
|
747 |
+
print json_encode($result);
|
748 |
+
die();
|
749 |
+
}
|
750 |
+
}
|
751 |
+
}
|
752 |
+
|
753 |
+
function ct_get_fields(&$email,&$message,$arr)
|
754 |
+
{
|
755 |
+
foreach($arr as $key=>$value)
|
756 |
+
{
|
757 |
+
if(!is_array($value))
|
758 |
+
{
|
759 |
+
if ($email === null && preg_match("/^\S+@\S+\.\S+$/", $value))
|
760 |
+
{
|
761 |
+
$email = $value;
|
762 |
+
}
|
763 |
+
else
|
764 |
+
{
|
765 |
+
$message.="$value\n";
|
766 |
+
}
|
767 |
+
}
|
768 |
+
else
|
769 |
+
{
|
770 |
+
ct_get_fields($email,$message,$value);
|
771 |
+
}
|
772 |
+
}
|
773 |
+
}
|
774 |
+
|
775 |
+
?>
|
cleantalk-comments-checkspam.js → inc/cleantalk-comments-checkspam.js
RENAMED
File without changes
|
cleantalk-comments-editscreen.js → inc/cleantalk-comments-editscreen.js
RENAMED
File without changes
|
cleantalk-comments.php → inc/cleantalk-comments.php
RENAMED
File without changes
|
cleantalk-common.php → inc/cleantalk-common.php
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
$ct_agent_version = 'wordpress-
|
4 |
$ct_plugin_name = 'Anti-spam by CleanTalk';
|
5 |
$ct_checkjs_frm = 'ct_checkjs_frm';
|
6 |
$ct_checkjs_register_form = 'ct_checkjs_register_form';
|
1 |
<?php
|
2 |
|
3 |
+
$ct_agent_version = 'wordpress-527';
|
4 |
$ct_plugin_name = 'Anti-spam by CleanTalk';
|
5 |
$ct_checkjs_frm = 'ct_checkjs_frm';
|
6 |
$ct_checkjs_register_form = 'ct_checkjs_register_form';
|
cleantalk-public.php → inc/cleantalk-public.php
RENAMED
@@ -500,7 +500,7 @@ function ct_preprocess_comment($comment) {
|
|
500 |
}
|
501 |
}
|
502 |
|
503 |
-
if (ct_is_user_enable() === false || $ct_options['comments_test'] == 0 || $ct_comment_done || (isset($_SERVER['HTTP_REFERER']) && stripos($_SERVER['HTTP_REFERER'],'page=wysija_campaigns&action=editTemplate')!==false) || $is_max_comments) {
|
504 |
return $comment;
|
505 |
}
|
506 |
|
@@ -1676,7 +1676,11 @@ function ct_s2member_registration_test() {
|
|
1676 |
* General test for any contact form
|
1677 |
*/
|
1678 |
function ct_contact_form_validate () {
|
1679 |
-
global $pagenow,$cleantalk_executed, $cleantalk_url_exclusions;
|
|
|
|
|
|
|
|
|
1680 |
if($cleantalk_executed)
|
1681 |
{
|
1682 |
return null;
|
@@ -1704,12 +1708,13 @@ function ct_contact_form_validate () {
|
|
1704 |
check_url_exclusions() ||
|
1705 |
ct_check_array_keys($_POST) ||
|
1706 |
isset($_POST['ct_checkjs_register_form']) ||
|
1707 |
-
(isset($_POST['signup_username']) && isset($_POST['signup_password_confirm']) && isset($_POST['signup_submit']) )
|
|
|
1708 |
) {
|
1709 |
return null;
|
1710 |
}
|
1711 |
|
1712 |
-
@header("CtConditions:
|
1713 |
|
1714 |
$_POST=ct_filter_array($_POST);
|
1715 |
|
@@ -1727,7 +1732,7 @@ function ct_contact_form_validate () {
|
|
1727 |
$message = '';
|
1728 |
$contact_form = true;
|
1729 |
|
1730 |
-
ct_get_fields_any($sender_email, $message, $sender_nickname, $subject, $contact_form, $_POST);
|
1731 |
|
1732 |
|
1733 |
// Skip submission if no data found
|
@@ -1794,7 +1799,11 @@ function ct_contact_form_validate () {
|
|
1794 |
* General test for any post data
|
1795 |
*/
|
1796 |
function ct_contact_form_validate_postdata () {
|
1797 |
-
global $pagenow,$cleantalk_executed, $cleantalk_url_exclusions;
|
|
|
|
|
|
|
|
|
1798 |
if($cleantalk_executed)
|
1799 |
{
|
1800 |
return null;
|
@@ -1826,7 +1835,8 @@ function ct_contact_form_validate_postdata () {
|
|
1826 |
@strpos($_SERVER['HTTP_REFERER'],'/wp-admin/')!==false ||
|
1827 |
check_url_exclusions() ||
|
1828 |
strpos($_SERVER['REQUEST_URI'],'/login/')!==false ||
|
1829 |
-
isset($_POST['ct_checkjs_register_form'])
|
|
|
1830 |
) {
|
1831 |
return null;
|
1832 |
}
|
@@ -1843,7 +1853,7 @@ function ct_contact_form_validate_postdata () {
|
|
1843 |
|
1844 |
$message = '';
|
1845 |
|
1846 |
-
ct_get_fields_any_postdata($message, $_POST);
|
1847 |
|
1848 |
if(strlen(trim($message))<10)
|
1849 |
{
|
500 |
}
|
501 |
}
|
502 |
|
503 |
+
if (ct_is_user_enable() === false || $ct_options['comments_test'] == 0 || $ct_comment_done || (isset($_SERVER['HTTP_REFERER']) && stripos($_SERVER['HTTP_REFERER'],'page=wysija_campaigns&action=editTemplate')!==false) || $is_max_comments || strpos($_SERVER['REQUEST_URI'],'/wp-admin/')!==false) {
|
504 |
return $comment;
|
505 |
}
|
506 |
|
1676 |
* General test for any contact form
|
1677 |
*/
|
1678 |
function ct_contact_form_validate () {
|
1679 |
+
global $pagenow,$cleantalk_executed, $cleantalk_url_exclusions,$ct_options, $ct_data;
|
1680 |
+
|
1681 |
+
$ct_options = ct_get_options();
|
1682 |
+
$ct_data = ct_get_data();
|
1683 |
+
|
1684 |
if($cleantalk_executed)
|
1685 |
{
|
1686 |
return null;
|
1708 |
check_url_exclusions() ||
|
1709 |
ct_check_array_keys($_POST) ||
|
1710 |
isset($_POST['ct_checkjs_register_form']) ||
|
1711 |
+
(isset($_POST['signup_username']) && isset($_POST['signup_password_confirm']) && isset($_POST['signup_submit']) ) ||
|
1712 |
+
@intval($ct_options['general_contact_forms_test'])==0
|
1713 |
) {
|
1714 |
return null;
|
1715 |
}
|
1716 |
|
1717 |
+
@header("CtConditions: Passed");
|
1718 |
|
1719 |
$_POST=ct_filter_array($_POST);
|
1720 |
|
1732 |
$message = '';
|
1733 |
$contact_form = true;
|
1734 |
|
1735 |
+
@ct_get_fields_any($sender_email, $message, $sender_nickname, $subject, $contact_form, $_POST);
|
1736 |
|
1737 |
|
1738 |
// Skip submission if no data found
|
1799 |
* General test for any post data
|
1800 |
*/
|
1801 |
function ct_contact_form_validate_postdata () {
|
1802 |
+
global $pagenow,$cleantalk_executed, $cleantalk_url_exclusions, $ct_options, $ct_data;
|
1803 |
+
|
1804 |
+
$ct_options = ct_get_options();
|
1805 |
+
$ct_data = ct_get_data();
|
1806 |
+
|
1807 |
if($cleantalk_executed)
|
1808 |
{
|
1809 |
return null;
|
1835 |
@strpos($_SERVER['HTTP_REFERER'],'/wp-admin/')!==false ||
|
1836 |
check_url_exclusions() ||
|
1837 |
strpos($_SERVER['REQUEST_URI'],'/login/')!==false ||
|
1838 |
+
isset($_POST['ct_checkjs_register_form']) ||
|
1839 |
+
@intval($ct_options['general_postdata_test'])==0
|
1840 |
) {
|
1841 |
return null;
|
1842 |
}
|
1853 |
|
1854 |
$message = '';
|
1855 |
|
1856 |
+
@ct_get_fields_any_postdata($message, $_POST);
|
1857 |
|
1858 |
if(strlen(trim($message))<10)
|
1859 |
{
|
cleantalk-rel.js → inc/cleantalk-rel.js
RENAMED
File without changes
|
cleantalk-sfw.class.php → inc/cleantalk-sfw.class.php
RENAMED
@@ -73,6 +73,14 @@ class CleanTalkSFW
|
|
73 |
}
|
74 |
$ct_data['sfw_log'] = $sfw_log;
|
75 |
update_option('cleantalk_data', $ct_data);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
}
|
77 |
|
78 |
public function sfw_die()
|
73 |
}
|
74 |
$ct_data['sfw_log'] = $sfw_log;
|
75 |
update_option('cleantalk_data', $ct_data);
|
76 |
+
if($this->result)
|
77 |
+
{
|
78 |
+
@header("CtSFWCheck: block");
|
79 |
+
}
|
80 |
+
else
|
81 |
+
{
|
82 |
+
@header("CtSFWCheck: allow");
|
83 |
+
}
|
84 |
}
|
85 |
|
86 |
public function sfw_die()
|
cleantalk-sfw.php → inc/cleantalk-sfw.php
RENAMED
File without changes
|
cleantalk-stats.js → inc/cleantalk-stats.js
RENAMED
File without changes
|
cleantalk-users-checkspam.js → inc/cleantalk-users-checkspam.js
RENAMED
File without changes
|
cleantalk-users-editscreen.js → inc/cleantalk-users-editscreen.js
RENAMED
File without changes
|
cleantalk-users.php → inc/cleantalk-users.php
RENAMED
File without changes
|
cleantalk-widget.php → inc/cleantalk-widget.php
RENAMED
File without changes
|
cleantalk.class.php → inc/cleantalk.class.php
RENAMED
File without changes
|
inc/cleantalk_api.php
ADDED
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require_once("cleantalk.class.php");
|
3 |
+
require_once("JSON.php");
|
4 |
+
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Get ct_get_checkjs_value
|
8 |
+
* @return string
|
9 |
+
*/
|
10 |
+
function ct_get_checkjs_value_plugin($random_key = false) {
|
11 |
+
|
12 |
+
$ct_data=get_option("cleantalk_data");
|
13 |
+
|
14 |
+
if ($random_key) {
|
15 |
+
$keys = $ct_data['js_keys'];
|
16 |
+
$keys_checksum = md5(json_encode($keys));
|
17 |
+
|
18 |
+
$key = null;
|
19 |
+
$latest_key_time = 0;
|
20 |
+
foreach ($keys as $k => $t) {
|
21 |
+
|
22 |
+
// Removing key if it's to old
|
23 |
+
if (time() - $t > $ct_data['js_keys_store_days'] * 86400) {
|
24 |
+
unset($keys[$k]);
|
25 |
+
continue;
|
26 |
+
}
|
27 |
+
|
28 |
+
if ($t > $latest_key_time) {
|
29 |
+
$latest_key_time = $t;
|
30 |
+
$key = $k;
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
34 |
+
// Get new key if the latest key is too old
|
35 |
+
if (time() - $latest_key_time > $ct_data['js_key_lifetime']) {
|
36 |
+
$key = rand();
|
37 |
+
$keys[$key] = time();
|
38 |
+
}
|
39 |
+
|
40 |
+
if (md5(json_encode($keys)) != $keys_checksum) {
|
41 |
+
$ct_data['js_keys'] = $keys;
|
42 |
+
update_option('cleantalk_data', $ct_data);
|
43 |
+
}
|
44 |
+
} else {
|
45 |
+
$key = md5($ct_options['apikey'] . '+' . get_option('admin_email'));
|
46 |
+
}
|
47 |
+
|
48 |
+
return $key;
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Validates JavaScript anti-spam test
|
53 |
+
*
|
54 |
+
*/
|
55 |
+
function js_test_plugin($field_name = 'ct_checkjs', $data = null, $random_key = false) {
|
56 |
+
|
57 |
+
$ct_data=get_option("cleantalk_data");
|
58 |
+
|
59 |
+
$checkjs = null;
|
60 |
+
$js_post_value = null;
|
61 |
+
|
62 |
+
if (!$data)
|
63 |
+
return $checkjs;
|
64 |
+
|
65 |
+
if (isset($data[$field_name])) {
|
66 |
+
$js_post_value = $data[$field_name];
|
67 |
+
if (isset($keys[$js_post_value])) {
|
68 |
+
|
69 |
+
//
|
70 |
+
// Random key check
|
71 |
+
//
|
72 |
+
if ($random_key) {
|
73 |
+
|
74 |
+
$keys = $ct_data['js_keys'];
|
75 |
+
$checkjs = 1;
|
76 |
+
} else {
|
77 |
+
$checkjs = 0;
|
78 |
+
}
|
79 |
+
} else {
|
80 |
+
$ct_challenge = ct_get_checkjs_value();
|
81 |
+
|
82 |
+
if(preg_match("/$ct_challenge/", $js_post_value)) {
|
83 |
+
$checkjs = 1;
|
84 |
+
} else {
|
85 |
+
$checkjs = 0;
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
89 |
+
|
90 |
+
}
|
91 |
+
|
92 |
+
return $checkjs;
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Check messages for external plugins
|
97 |
+
* @return array with checking result;
|
98 |
+
*/
|
99 |
+
|
100 |
+
function ct_test_message($nickname, $email, $ip, $text){
|
101 |
+
$checkjs = js_test_plugin('ct_checkjs', $_COOKIE, true);
|
102 |
+
|
103 |
+
$post_info['comment_type'] = 'feedback_plugin_check';
|
104 |
+
$post_info = json_encode($post_info);
|
105 |
+
|
106 |
+
$ct_base_call_result = ct_base_call(array(
|
107 |
+
'message' => $text,
|
108 |
+
'example' => null,
|
109 |
+
'sender_email' => $email,
|
110 |
+
'sender_nickname' => $nickname,
|
111 |
+
'post_info' => $post_info,
|
112 |
+
'sender_info' => get_sender_info(),
|
113 |
+
'checkjs' => $checkjs
|
114 |
+
));
|
115 |
+
|
116 |
+
$ct_result = $ct_base_call_result['ct_result'];
|
117 |
+
|
118 |
+
$result=Array(
|
119 |
+
'allow' => $ct_result->allow,
|
120 |
+
'comment' => $ct_result->comment,
|
121 |
+
);
|
122 |
+
return $result;
|
123 |
+
}
|
124 |
+
|
125 |
+
|
126 |
+
|
127 |
+
?>
|
cleantalk_external.js → inc/cleantalk_external.js
RENAMED
File without changes
|
cleantalk_nocache.js → inc/cleantalk_nocache.js
RENAMED
@@ -66,8 +66,8 @@ function ct_setCookie(name, value)
|
|
66 |
var date = new Date;
|
67 |
date.setDate(date.getDate() + 1);
|
68 |
//setTimeout(function() { document.cookie = name+"=" + value + "; expires=" + date.toUTCString() + "; path = /; domain = " + domain}, 500)
|
69 |
-
|
70 |
-
document.cookie = name+"=" + value + "; expires=" + date.toUTCString() + "; path = /;";
|
71 |
}
|
72 |
|
73 |
function ct_callback(req)
|
66 |
var date = new Date;
|
67 |
date.setDate(date.getDate() + 1);
|
68 |
//setTimeout(function() { document.cookie = name+"=" + value + "; expires=" + date.toUTCString() + "; path = /; domain = " + domain}, 500)
|
69 |
+
setTimeout(function() { document.cookie = name+"=" + value + "; expires=" + date.toUTCString() + "; path = /;"}, 500);
|
70 |
+
//document.cookie = name+"=" + value + "; expires=" + date.toUTCString() + "; path = /;";
|
71 |
}
|
72 |
|
73 |
function ct_callback(req)
|
sfw_die_page.html → inc/sfw_die_page.html
RENAMED
File without changes
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: znaeff, shagimuratov, vlad-cleantalk
|
|
3 |
Tags: anti-spam, antispam, bbpress, buddypress, captcha, capcha, captha, catcha, cf7 spam, comments, contact form spam, signup, spam, spammers, spammy, woocommerce, wordpress spam, booking, order, subscription, gravity spam, jetpack, bots, contact form 7, contact form, registrations, ninja, Fast Secure Contact, Gravity forms, formidable, mailchimp, s2member, protection, protect, email, akismet, plugin, contact, recaptcha, google captcha, math, security, login, blacklist, cache, prevent, wordpress, User Frontend, bulk delete, bulk remove, cloudflare, widget, review, auth forms, firewall, ddos, flood
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 4.3
|
6 |
-
Stable tag: 5.
|
7 |
License: GPLv2
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -234,14 +234,14 @@ or
|
|
234 |
define('CLEANTALK_AJAX_USE_FOOTER_HEADER', false); //false - don't use wp_footer() and wp_header() for including AJAX script, true - use it
|
235 |
|
236 |
= Can I add exclusions for some pages of my site? =
|
237 |
-
Yes, you can. Add in
|
238 |
|
239 |
$cleantalk_url_exclusions = Array('url1', 'url2', 'url3');
|
240 |
|
241 |
-
Now, all pages
|
242 |
|
243 |
= Can I exclude personal data from sending to CleanTalk servers? =
|
244 |
-
Yes, you can. Add in
|
245 |
|
246 |
$cleantalk_key_exclusions = Array('key1', 'key2', 'key3');
|
247 |
|
@@ -338,6 +338,11 @@ WordPress 3.0 at least. PHP 5 with CURL or file_get_contents() function and enab
|
|
338 |
1. Setup Android/iOS app to have push notices when new legitiamte comments/registrations or contactcs appears on the website.
|
339 |
|
340 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
341 |
= 5.26 2015-10-05 =
|
342 |
* Added WordPress Language Pack support
|
343 |
* Removed spam checking for some autorisation plugins
|
@@ -805,6 +810,11 @@ WordPress 3.0 at least. PHP 5 with CURL or file_get_contents() function and enab
|
|
805 |
* First version
|
806 |
|
807 |
== Upgrade Notice ==
|
|
|
|
|
|
|
|
|
|
|
808 |
= 5.26 2015-10-05 =
|
809 |
* Added WordPress Language Pack support
|
810 |
* Removed spam checking for some autorisation plugins
|
3 |
Tags: anti-spam, antispam, bbpress, buddypress, captcha, capcha, captha, catcha, cf7 spam, comments, contact form spam, signup, spam, spammers, spammy, woocommerce, wordpress spam, booking, order, subscription, gravity spam, jetpack, bots, contact form 7, contact form, registrations, ninja, Fast Secure Contact, Gravity forms, formidable, mailchimp, s2member, protection, protect, email, akismet, plugin, contact, recaptcha, google captcha, math, security, login, blacklist, cache, prevent, wordpress, User Frontend, bulk delete, bulk remove, cloudflare, widget, review, auth forms, firewall, ddos, flood
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 4.3
|
6 |
+
Stable tag: 5.27
|
7 |
License: GPLv2
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
234 |
define('CLEANTALK_AJAX_USE_FOOTER_HEADER', false); //false - don't use wp_footer() and wp_header() for including AJAX script, true - use it
|
235 |
|
236 |
= Can I add exclusions for some pages of my site? =
|
237 |
+
Yes, you can. Add in your wp-config.php file, before defining database constants, this string:
|
238 |
|
239 |
$cleantalk_url_exclusions = Array('url1', 'url2', 'url3');
|
240 |
|
241 |
+
Now, all pages containing strings 'url1', 'url2', or 'url3' will be excluded from anti-spam checking. Remember, that this option will be not applied in registrations and comment checking - they are always protected from spam.
|
242 |
|
243 |
= Can I exclude personal data from sending to CleanTalk servers? =
|
244 |
+
Yes, you can. Add in your wp-config.php file, before defining database constants, this string:
|
245 |
|
246 |
$cleantalk_key_exclusions = Array('key1', 'key2', 'key3');
|
247 |
|
338 |
1. Setup Android/iOS app to have push notices when new legitiamte comments/registrations or contactcs appears on the website.
|
339 |
|
340 |
== Changelog ==
|
341 |
+
= 5.27 2015-10-13 =
|
342 |
+
* Improvements in Spam FireWall feature
|
343 |
+
* Code optimization
|
344 |
+
* Backend interface fixes
|
345 |
+
|
346 |
= 5.26 2015-10-05 =
|
347 |
* Added WordPress Language Pack support
|
348 |
* Removed spam checking for some autorisation plugins
|
810 |
* First version
|
811 |
|
812 |
== Upgrade Notice ==
|
813 |
+
= 5.27 2015-10-13 =
|
814 |
+
* Improvements in Spam FireWall feature
|
815 |
+
* Code optimization
|
816 |
+
* Backend interface fixes
|
817 |
+
|
818 |
= 5.26 2015-10-05 =
|
819 |
* Added WordPress Language Pack support
|
820 |
* Removed spam checking for some autorisation plugins
|
screenshot-1.png
CHANGED
Binary file
|