Version Description
February 8 2017 = * Setting page changes. * Bug fixes for WooCommerce. * SpamFireWall filters only GET requests. * Optimization. * Minor and major fixes.
Download this release
Release Info
Developer | Safronik |
Plugin | Spam protection, AntiSpam, FireWall by CleanTalk |
Version | 5.57 |
Comparing to | |
See all releases |
Code changes from version 5.56.1 to 5.57
- cleantalk.php +248 -197
- inc/cleantalk-admin.js +2 -0
- inc/cleantalk-admin.php +189 -164
- inc/cleantalk-ajax.php +15 -10
- inc/cleantalk-common.php +31 -23
- inc/cleantalk-public.php +70 -41
- inc/cleantalk-users.php +11 -14
- inc/cleantalk.class.php +27 -3
- readme.txt +22 -6
- templates/daily_report.php +181 -0
cleantalk.php
CHANGED
@@ -3,42 +3,34 @@
|
|
3 |
Plugin Name: Spam Protection by CleanTalk
|
4 |
Plugin URI: http://cleantalk.org
|
5 |
Description: Max power, all-in-one, no Captcha, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms. Formerly Anti-Spam by CleanTalk.
|
6 |
-
Version: 5.
|
7 |
Author: СleanTalk <welcome@cleantalk.org>
|
8 |
Author URI: http://cleantalk.org
|
9 |
*/
|
10 |
-
$cleantalk_plugin_version='5.
|
11 |
-
$ct_agent_version = 'wordpress-
|
12 |
$cleantalk_executed=false;
|
13 |
$ct_sfw_updated = false;
|
14 |
|
15 |
$ct_redirects_label = 'ct_redirects';
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
$cleantalk_use_buffer=CLEANTALK_AJAX_USE_BUFFER;
|
20 |
-
}
|
21 |
-
else
|
22 |
-
{
|
23 |
-
$cleantalk_use_buffer=true;
|
24 |
-
}
|
25 |
|
26 |
-
if(defined('CLEANTALK_AJAX_USE_FOOTER_HEADER'))
|
27 |
-
{
|
28 |
-
$cleantalk_use_footer_header=CLEANTALK_AJAX_USE_FOOTER_HEADER;
|
29 |
-
}
|
30 |
-
else
|
31 |
-
{
|
32 |
-
$cleantalk_use_footer_header=true;
|
33 |
-
}
|
34 |
if(!defined('CLEANTALK_PLUGIN_DIR')){
|
35 |
-
|
36 |
global $ct_options, $ct_data, $pagenow;
|
|
|
|
|
37 |
|
38 |
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-common.php');
|
39 |
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-widget.php');
|
|
|
40 |
$ct_options=ct_get_options();
|
41 |
$ct_data=ct_get_data();
|
|
|
|
|
|
|
42 |
|
43 |
if(!isset($ct_data['db_refreshed'])){
|
44 |
|
@@ -60,29 +52,19 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
|
|
60 |
|
61 |
$ct_data['db_refreshed'] = 1;
|
62 |
update_option('cleantalk_data', $ct_data);
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
}
|
71 |
|
72 |
if(@stripos($_SERVER['REQUEST_URI'],'admin-ajax.php')!==false && sizeof($_POST)>0 && isset($_GET['action']) && $_GET['action']=='ninja_forms_ajax_submit')
|
73 |
-
{
|
74 |
$_POST['action']='ninja_forms_ajax_submit';
|
75 |
-
}
|
76 |
-
|
77 |
-
if(isset($ct_options['spam_firewall']))
|
78 |
-
{
|
79 |
-
$value = @intval($ct_options['spam_firewall']);
|
80 |
-
}
|
81 |
-
else
|
82 |
-
{
|
83 |
-
$value=0;
|
84 |
-
}
|
85 |
|
|
|
86 |
/*
|
87 |
Turn off the SpamFireWall if current url in the exceptions list.
|
88 |
*/
|
@@ -110,9 +92,10 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
|
|
110 |
}
|
111 |
}
|
112 |
}
|
113 |
-
|
114 |
-
if($value==1 && !is_admin() || $value==1 && defined( 'DOING_AJAX' ) && DOING_AJAX)
|
115 |
{
|
|
|
116 |
include_once("inc/cleantalk-sfw.class.php");
|
117 |
|
118 |
$is_sfw_check=true;
|
@@ -138,19 +121,12 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
|
|
138 |
}
|
139 |
}
|
140 |
|
141 |
-
//cron start
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
}
|
146 |
-
else
|
147 |
-
{
|
148 |
-
$last_sfw_send=0;
|
149 |
-
}
|
150 |
-
if(time()-$last_sfw_send>3600)
|
151 |
-
{
|
152 |
ct_send_sfw_log();
|
153 |
-
$ct_data['last_sfw_send']=time();
|
154 |
update_option('cleantalk_data', $ct_data);
|
155 |
}
|
156 |
//cron end
|
@@ -175,93 +151,74 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
|
|
175 |
// Redirect admin to plugin settings.
|
176 |
//
|
177 |
if(!defined('WP_ALLOW_MULTISITE') || defined('WP_ALLOW_MULTISITE') && WP_ALLOW_MULTISITE == false)
|
178 |
-
{
|
179 |
add_action('admin_init', 'ct_plugin_redirect');
|
180 |
-
|
181 |
-
|
182 |
// After plugin loaded - to load locale as described in manual
|
183 |
add_action( 'ct_init', 'ct_plugin_loaded' );
|
184 |
ct_plugin_loaded();
|
185 |
|
186 |
-
|
187 |
-
{
|
188 |
-
$use_ajax = @intval($ct_options['use_ajax']);
|
189 |
-
}
|
190 |
-
else
|
191 |
-
{
|
192 |
-
$use_ajax=1;
|
193 |
-
}
|
194 |
|
195 |
-
if($use_ajax==1 &&
|
196 |
stripos($_SERVER['REQUEST_URI'],'.xml')===false &&
|
197 |
stripos($_SERVER['REQUEST_URI'],'.xsl')===false)
|
198 |
{
|
199 |
if($cleantalk_use_buffer)
|
200 |
-
{
|
201 |
add_action('wp_loaded', 'ct_add_nocache_script', 1);
|
202 |
-
|
203 |
-
if($cleantalk_use_footer_header)
|
204 |
-
{
|
205 |
add_action('wp_footer', 'ct_add_nocache_script_footer', 1);
|
206 |
add_action('wp_head', 'ct_add_nocache_script_header', 1);
|
207 |
}
|
208 |
add_action( 'wp_ajax_nopriv_ct_get_cookie', 'ct_get_cookie',1 );
|
209 |
add_action( 'wp_ajax_ct_get_cookie', 'ct_get_cookie',1 );
|
210 |
}
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
{
|
215 |
-
$value = @intval($ct_options['show_link']);
|
216 |
-
}
|
217 |
-
else
|
218 |
-
{
|
219 |
-
$value=0;
|
220 |
-
}
|
221 |
-
if($value==1)
|
222 |
-
{
|
223 |
-
add_action('comment_form_after', 'ct_show_comment_link');
|
224 |
-
}
|
225 |
|
226 |
-
|
227 |
-
|
|
|
|
|
|
|
|
|
|
|
228 |
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-admin.php');
|
229 |
-
|
230 |
-
{
|
231 |
add_action('admin_init', 'ct_admin_init', 1);
|
232 |
add_action('admin_menu', 'ct_admin_add_page');
|
233 |
if(is_network_admin())
|
234 |
-
{
|
235 |
add_action('network_admin_menu', 'ct_admin_add_page');
|
236 |
-
|
237 |
add_action('admin_notices', 'cleantalk_admin_notice_message');
|
238 |
}
|
239 |
-
if (defined( 'DOING_AJAX' ) && DOING_AJAX||isset($_POST['cma-action']))
|
240 |
-
{
|
241 |
$cleantalk_hooked_actions = array();
|
242 |
$cleantalk_ajax_actions_to_check = array();
|
243 |
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
|
244 |
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-ajax.php');
|
245 |
|
246 |
-
if
|
247 |
-
|
|
|
|
|
|
|
|
|
248 |
}
|
249 |
-
if(isset($_POST['action']) && in_array($_POST['action'],$cleantalk_ajax_actions_to_check) && !isset($_COOKIE[LOGGED_IN_COOKIE])){
|
250 |
-
ct_ajax_hook();
|
251 |
-
}
|
252 |
-
|
253 |
//
|
254 |
// Some of plugins to register a users use AJAX context.
|
255 |
//
|
256 |
add_filter('registration_errors', 'ct_registration_errors', 1, 3);
|
|
|
257 |
add_action('user_register', 'ct_user_register');
|
258 |
|
259 |
}
|
260 |
|
261 |
add_action('admin_enqueue_scripts', 'ct_enqueue_scripts');
|
262 |
|
263 |
-
if($pagenow=='edit-comments.php')
|
264 |
-
{
|
265 |
add_action('comment_unapproved_to_approvecomment', 'ct_comment_approved'); // param - comment object
|
266 |
add_action('comment_unapproved_to_approved', 'ct_comment_approved'); // param - comment object
|
267 |
add_action('comment_approved_to_unapproved', 'ct_comment_unapproved'); // param - comment object
|
@@ -270,60 +227,70 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
|
|
270 |
//add_filter('get_comment_text', 'ct_get_comment_text'); // param - current comment text
|
271 |
add_filter('unspam_comment', 'ct_unspam_comment');
|
272 |
}
|
|
|
273 |
if($pagenow=='users.php')
|
274 |
-
{
|
275 |
add_action('delete_user', 'ct_delete_user');
|
276 |
-
|
277 |
-
if($pagenow=='plugins.php' || @strpos($_SERVER['REQUEST_URI'],'plugins.php')!==false)
|
278 |
-
|
279 |
add_filter('plugin_row_meta', 'ct_register_plugin_links', 10, 2);
|
280 |
add_filter('plugin_action_links', 'ct_plugin_action_links', 10, 2);
|
281 |
}
|
282 |
add_action('updated_option', 'ct_update_option'); // param - option name, i.e. 'cleantalk_settings'
|
283 |
}else{
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
|
|
288 |
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
|
|
301 |
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
|
306 |
-
|
307 |
-
|
308 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
309 |
}
|
310 |
|
311 |
function ct_db_refresh(){
|
312 |
global $wpdb;
|
313 |
|
314 |
$wpdb->query("CREATE TABLE IF NOT EXISTS `".$wpdb->base_prefix."cleantalk_sfw` (
|
315 |
-
`network` int(11) unsigned NOT NULL,
|
316 |
-
`mask` int(11) unsigned NOT NULL,
|
317 |
-
INDEX ( `network` , `mask` )
|
318 |
-
) ENGINE = MYISAM ;");
|
319 |
-
|
320 |
-
|
321 |
-
`ip` VARCHAR(15) NOT NULL ,
|
322 |
-
`all` INT NOT NULL ,
|
323 |
-
`blocked` INT NOT NULL ,
|
324 |
-
`timestamp` INT NOT NULL ,
|
325 |
-
PRIMARY KEY (`ip`))
|
326 |
-
ENGINE = MYISAM;");
|
327 |
|
328 |
}
|
329 |
|
@@ -340,10 +307,13 @@ if (!function_exists ( 'ct_activation')) {
|
|
340 |
wp_schedule_event(time(), 'hourly', 'ct_hourly_event_hook' );
|
341 |
//wp_schedule_event(time(), 'hourly', 'ct_send_sfw_log' );
|
342 |
wp_schedule_event(time(), 'daily', 'cleantalk_update_sfw_hook' );
|
343 |
-
|
|
|
344 |
|
345 |
cleantalk_update_sfw();
|
|
|
346 |
add_option('ct_plugin_do_activation_redirect', true);
|
|
|
347 |
}
|
348 |
}
|
349 |
/**
|
@@ -358,9 +328,12 @@ if (!function_exists ( 'ct_deactivation')) {
|
|
358 |
$wpdb->query("DROP TABLE IF EXISTS `".$wpdb->base_prefix."cleantalk_sfw_logs`;");
|
359 |
|
360 |
wp_clear_scheduled_hook( 'ct_hourly_event_hook' );
|
361 |
-
|
362 |
wp_clear_scheduled_hook( 'cleantalk_update_sfw' );
|
363 |
wp_clear_scheduled_hook( 'cleantalk_update_sfw_hook' );
|
|
|
|
|
|
|
364 |
}
|
365 |
}
|
366 |
|
@@ -455,18 +428,19 @@ function ct_add_nocache_script()
|
|
455 |
ob_start('ct_inject_nocache_script');
|
456 |
}
|
457 |
|
458 |
-
function ct_add_nocache_script_footer()
|
459 |
-
|
460 |
-
if(strpos($_SERVER['REQUEST_URI'],'jm-ajax')===false)
|
461 |
-
|
462 |
global $test_external_forms, $test_internal_forms, $cleantalk_plugin_version;
|
463 |
|
464 |
print "<script async type='text/javascript' src='".plugins_url( '/inc/cleantalk_nocache.js' , __FILE__ )."?random=".$cleantalk_plugin_version."'></script>\n";
|
465 |
-
|
466 |
-
{
|
467 |
print "\n<script type='text/javascript'>var ct_blog_home = '".get_home_url()."';</script>\n";
|
468 |
print "<script async type='text/javascript' src='".plugins_url( '/inc/cleantalk_external.js' , __FILE__ )."?random=".$cleantalk_plugin_version."'></script>\n";
|
469 |
}
|
|
|
470 |
if($test_internal_forms){
|
471 |
print "\n<script type='text/javascript'>var ct_blog_home = '".get_home_url()."';</script>\n";
|
472 |
print "<script async type='text/javascript' src='".plugins_url( '/inc/cleantalk_internal.js' , __FILE__ )."?random=".$cleantalk_plugin_version."'></script>\n";
|
@@ -502,75 +476,57 @@ function ct_set_info_flag () {
|
|
502 |
return $ct_info_flag . $ct_set_cookies_flag;
|
503 |
}
|
504 |
|
505 |
-
function ct_add_nocache_script_header()
|
506 |
-
|
507 |
-
if(strpos($_SERVER['REQUEST_URI'],'jm-ajax')===false)
|
508 |
-
{
|
509 |
$ct_info_flag = ct_set_info_flag();
|
510 |
print "\n<script type='text/javascript'>\nvar ct_ajaxurl = '".admin_url('admin-ajax.php')."';\n $ct_info_flag </script>\n";
|
511 |
}
|
|
|
512 |
}
|
513 |
|
514 |
-
function ct_inject_nocache_script($html)
|
515 |
-
|
516 |
-
if(strpos($_SERVER['REQUEST_URI'],'jm-ajax')===false)
|
517 |
-
|
518 |
global $test_external_forms, $test_internal_forms, $cleantalk_plugin_version, $ct_options;
|
519 |
|
520 |
$ct_info_flag = ct_set_info_flag();
|
521 |
|
522 |
-
if(!is_admin()&&stripos($html,"</body")!==false)
|
523 |
-
|
524 |
$ct_replace="<script async type='text/javascript' src='".plugins_url( '/inc/cleantalk_nocache.js' , __FILE__ )."?random=".$cleantalk_plugin_version."'></script>\n";
|
525 |
-
|
526 |
-
{
|
527 |
$ct_replace.="\n<script type='text/javascript'>var ct_blog_home = '".get_home_url()."';</script>\n";
|
528 |
$ct_replace.="<script async type='text/javascript' src='".plugins_url( '/inc/cleantalk_external.js' , __FILE__ )."?random=".$cleantalk_plugin_version."'></script>\n";
|
529 |
}
|
|
|
530 |
if($test_internal_forms){
|
531 |
$ct_replace .= "\n<script type='text/javascript'>var ct_blog_home = '".get_home_url()."';</script>\n";
|
532 |
$ct_replace .= "<script async type='text/javascript' src='".plugins_url( '/inc/cleantalk_internal.js' , __FILE__ )."?random=".$cleantalk_plugin_version."'></script>\n";
|
533 |
}
|
534 |
|
535 |
-
$html=
|
536 |
-
}
|
537 |
}
|
538 |
return $html;
|
539 |
}
|
540 |
-
if(is_admin())
|
541 |
-
{
|
542 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-comments.php');
|
543 |
-
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-users.php');
|
544 |
-
}
|
545 |
-
if(isset($_GET['ait-action'])&&$_GET['ait-action']=='register')
|
546 |
-
{
|
547 |
-
$tmp=$_POST['redirect_to'];
|
548 |
-
unset($_POST['redirect_to']);
|
549 |
-
ct_contact_form_validate();
|
550 |
-
$_POST['redirect_to']=$tmp;
|
551 |
-
}
|
552 |
|
553 |
-
function ct_show_comment_link()
|
554 |
-
|
555 |
print "<div style='font-size:10pt;'><a href='https://cleantalk.org/wordpress-anti-spam-plugin' target='_blank'>".__( 'WordPress spam', 'cleantalk' )."</a> ".__( 'blocked by', 'cleantalk' )." CleanTalk.</div>";
|
|
|
556 |
}
|
557 |
|
558 |
add_action( 'right_now_content_table_end', 'my_add_counts_to_dashboard' );
|
559 |
|
560 |
-
function cleantalk_update_sfw()
|
561 |
-
|
562 |
-
global $wpdb, $ct_sfw_updated;
|
563 |
|
564 |
if(!function_exists('sendRawRequest'))
|
565 |
require_once('inc/cleantalk.class.php');
|
566 |
-
|
567 |
-
global $ct_options, $ct_data;
|
568 |
-
if(isset($ct_options['spam_firewall']))
|
569 |
-
$value = @intval($ct_options['spam_firewall']);
|
570 |
-
else
|
571 |
-
$value=0;
|
572 |
|
573 |
-
if($
|
574 |
|
575 |
$data = Array( 'auth_key' => $ct_options['apikey'],
|
576 |
'method_name' => '2s_blacklists_db'
|
@@ -580,18 +536,18 @@ function cleantalk_update_sfw()
|
|
580 |
|
581 |
$result=json_decode($result, true);
|
582 |
|
583 |
-
if(isset($result['data']))
|
584 |
-
|
585 |
$wpdb->query("TRUNCATE TABLE `".$wpdb->base_prefix."cleantalk_sfw`;");
|
586 |
$result=$result['data'];
|
587 |
$query="INSERT INTO `".$wpdb->base_prefix."cleantalk_sfw` VALUES ";
|
588 |
-
for($i=0;$i<sizeof($result);$i++)
|
589 |
-
|
590 |
if($i==sizeof($result)-1)
|
591 |
$query.="(".$result[$i][0].",".$result[$i][1].");";
|
592 |
else
|
593 |
$query.="(".$result[$i][0].",".$result[$i][1]."), ";
|
594 |
-
|
595 |
}
|
596 |
$wpdb->query($query);
|
597 |
$ct_sfw_updated = true;
|
@@ -599,33 +555,30 @@ function cleantalk_update_sfw()
|
|
599 |
}
|
600 |
}
|
601 |
|
602 |
-
function cleantalk_get_ip()
|
603 |
-
|
604 |
$result=Array();
|
|
|
605 |
if ( function_exists( 'apache_request_headers' ) )
|
606 |
-
{
|
607 |
$headers = apache_request_headers();
|
608 |
-
}
|
609 |
else
|
610 |
-
{
|
611 |
$headers = $_SERVER;
|
612 |
-
|
613 |
-
if ( array_key_exists( 'X-Forwarded-For', $headers ) )
|
614 |
-
{
|
615 |
$the_ip=explode(",", trim($headers['X-Forwarded-For']));
|
616 |
$result[] = trim($the_ip[0]);
|
617 |
}
|
618 |
-
|
619 |
-
{
|
620 |
$the_ip=explode(",", trim($headers['HTTP_X_FORWARDED_FOR']));
|
621 |
$result[] = trim($the_ip[0]);
|
622 |
}
|
|
|
623 |
$result[] = filter_var( $_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 );
|
624 |
|
625 |
if(isset($_GET['sfw_test_ip']))
|
626 |
-
{
|
627 |
$result[]=$_GET['sfw_test_ip'];
|
628 |
-
|
629 |
return $result;
|
630 |
}
|
631 |
|
@@ -643,16 +596,114 @@ function ct_send_sfw_log()
|
|
643 |
|
644 |
if(!isset($ct_data['sfw_counter']))
|
645 |
$ct_data['sfw_counter'] = array('all' => 0, 'blocked' => 0);
|
|
|
646 |
$ct_data['sfw_counter']['all'] += $result['all'];
|
647 |
$ct_data['sfw_counter']['blocked'] += $result['blocked'];
|
648 |
$ct_data['last_sfw_send']=time();
|
649 |
update_option('cleantalk_data', $ct_data);
|
650 |
|
651 |
return true;
|
|
|
652 |
}else
|
653 |
return false;
|
654 |
}
|
655 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
656 |
/*
|
657 |
function myplugin_update_field( $new_value, $old_value ) {
|
658 |
error_log('cleantalk_data dump: '. strlen(serialize($new_value)));
|
3 |
Plugin Name: Spam Protection by CleanTalk
|
4 |
Plugin URI: http://cleantalk.org
|
5 |
Description: Max power, all-in-one, no Captcha, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms. Formerly Anti-Spam by CleanTalk.
|
6 |
+
Version: 5.57
|
7 |
Author: СleanTalk <welcome@cleantalk.org>
|
8 |
Author URI: http://cleantalk.org
|
9 |
*/
|
10 |
+
$cleantalk_plugin_version='5.57';
|
11 |
+
$ct_agent_version = 'wordpress-557';
|
12 |
$cleantalk_executed=false;
|
13 |
$ct_sfw_updated = false;
|
14 |
|
15 |
$ct_redirects_label = 'ct_redirects';
|
16 |
|
17 |
+
$cleantalk_use_buffer = (defined('CLEANTALK_AJAX_USE_BUFFER') ? CLEANTALK_AJAX_USE_BUFFER : true);
|
18 |
+
$cleantalk_use_footer_header = (defined('CLEANTALK_AJAX_USE_FOOTER_HEADER') ? CLEANTALK_AJAX_USE_FOOTER_HEADER : true);
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
if(!defined('CLEANTALK_PLUGIN_DIR')){
|
21 |
+
|
22 |
global $ct_options, $ct_data, $pagenow;
|
23 |
+
|
24 |
+
define('CLEANTALK_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
25 |
|
26 |
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-common.php');
|
27 |
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-widget.php');
|
28 |
+
|
29 |
$ct_options=ct_get_options();
|
30 |
$ct_data=ct_get_data();
|
31 |
+
|
32 |
+
//Cron jobs
|
33 |
+
//add_action('cleantalk_send_daily_report_hook', 'cleantalk_send_daily_report'); //Sending daily report // Inactive
|
34 |
|
35 |
if(!isset($ct_data['db_refreshed'])){
|
36 |
|
52 |
|
53 |
$ct_data['db_refreshed'] = 1;
|
54 |
update_option('cleantalk_data', $ct_data);
|
55 |
+
|
56 |
+
}
|
57 |
+
if(isset($ct_data['db_refreshed']) && $ct_data['db_refreshed'] == 1){
|
58 |
+
if (!wp_next_scheduled('cleantalk_update_sfw_hook'))
|
59 |
+
wp_schedule_event(time()+1800, 'daily', 'cleantalk_update_sfw_hook' );
|
60 |
+
$ct_data['db_refreshed'] = 2;
|
61 |
+
update_option('cleantalk_data', $ct_data);
|
62 |
}
|
63 |
|
64 |
if(@stripos($_SERVER['REQUEST_URI'],'admin-ajax.php')!==false && sizeof($_POST)>0 && isset($_GET['action']) && $_GET['action']=='ninja_forms_ajax_submit')
|
|
|
65 |
$_POST['action']='ninja_forms_ajax_submit';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
|
67 |
+
$value = (isset($ct_options['spam_firewall']) ? intval($ct_options['spam_firewall']) : 0);
|
68 |
/*
|
69 |
Turn off the SpamFireWall if current url in the exceptions list.
|
70 |
*/
|
92 |
}
|
93 |
}
|
94 |
}
|
95 |
+
|
96 |
+
if($value==1 && !is_admin() || $value==1 && defined( 'DOING_AJAX' ) && DOING_AJAX && $_SERVER["REQUEST_METHOD"] == 'GET')
|
97 |
{
|
98 |
+
|
99 |
include_once("inc/cleantalk-sfw.class.php");
|
100 |
|
101 |
$is_sfw_check=true;
|
121 |
}
|
122 |
}
|
123 |
|
124 |
+
//cron start
|
125 |
+
$last_sfw_send = (isset($ct_data['last_sfw_send']) ? $ct_data['last_sfw_send'] : 0);
|
126 |
+
|
127 |
+
if(time() - $last_sfw_send > 3600){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
ct_send_sfw_log();
|
129 |
+
$ct_data['last_sfw_send'] = time();
|
130 |
update_option('cleantalk_data', $ct_data);
|
131 |
}
|
132 |
//cron end
|
151 |
// Redirect admin to plugin settings.
|
152 |
//
|
153 |
if(!defined('WP_ALLOW_MULTISITE') || defined('WP_ALLOW_MULTISITE') && WP_ALLOW_MULTISITE == false)
|
|
|
154 |
add_action('admin_init', 'ct_plugin_redirect');
|
155 |
+
|
|
|
156 |
// After plugin loaded - to load locale as described in manual
|
157 |
add_action( 'ct_init', 'ct_plugin_loaded' );
|
158 |
ct_plugin_loaded();
|
159 |
|
160 |
+
$use_ajax = (isset($ct_options['use_ajax']) ? intval($ct_options['use_ajax']) : 1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
|
162 |
+
if( $use_ajax==1 &&
|
163 |
stripos($_SERVER['REQUEST_URI'],'.xml')===false &&
|
164 |
stripos($_SERVER['REQUEST_URI'],'.xsl')===false)
|
165 |
{
|
166 |
if($cleantalk_use_buffer)
|
|
|
167 |
add_action('wp_loaded', 'ct_add_nocache_script', 1);
|
168 |
+
|
169 |
+
if($cleantalk_use_footer_header){
|
|
|
170 |
add_action('wp_footer', 'ct_add_nocache_script_footer', 1);
|
171 |
add_action('wp_head', 'ct_add_nocache_script_header', 1);
|
172 |
}
|
173 |
add_action( 'wp_ajax_nopriv_ct_get_cookie', 'ct_get_cookie',1 );
|
174 |
add_action( 'wp_ajax_ct_get_cookie', 'ct_get_cookie',1 );
|
175 |
}
|
176 |
+
|
177 |
+
if(isset($ct_options['show_link']) && intval($ct_options['show_link']) == 1)
|
178 |
+
add_action('comment_form_after', 'ct_show_comment_link');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
|
180 |
+
if(is_admin()){
|
181 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-comments.php');
|
182 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-users.php');
|
183 |
+
}
|
184 |
+
|
185 |
+
if (is_admin()||is_network_admin()){
|
186 |
+
|
187 |
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-admin.php');
|
188 |
+
|
189 |
+
if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)){
|
190 |
add_action('admin_init', 'ct_admin_init', 1);
|
191 |
add_action('admin_menu', 'ct_admin_add_page');
|
192 |
if(is_network_admin())
|
|
|
193 |
add_action('network_admin_menu', 'ct_admin_add_page');
|
194 |
+
|
195 |
add_action('admin_notices', 'cleantalk_admin_notice_message');
|
196 |
}
|
197 |
+
if (defined( 'DOING_AJAX' ) && DOING_AJAX||isset($_POST['cma-action'])){
|
|
|
198 |
$cleantalk_hooked_actions = array();
|
199 |
$cleantalk_ajax_actions_to_check = array();
|
200 |
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
|
201 |
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-ajax.php');
|
202 |
|
203 |
+
// Do check for AJAX if Unknown action or Known action with mandatory check
|
204 |
+
if(isset($_POST['action']) &&
|
205 |
+
!isset($_COOKIE[LOGGED_IN_COOKIE]) &&
|
206 |
+
(!in_array($_POST['action'], $cleantalk_hooked_actions) || in_array($_POST['action'], $cleantalk_ajax_actions_to_check))
|
207 |
+
){
|
208 |
+
ct_ajax_hook();
|
209 |
}
|
|
|
|
|
|
|
|
|
210 |
//
|
211 |
// Some of plugins to register a users use AJAX context.
|
212 |
//
|
213 |
add_filter('registration_errors', 'ct_registration_errors', 1, 3);
|
214 |
+
add_filter('registration_errors', 'ct_check_registration_erros', 999999, 3);
|
215 |
add_action('user_register', 'ct_user_register');
|
216 |
|
217 |
}
|
218 |
|
219 |
add_action('admin_enqueue_scripts', 'ct_enqueue_scripts');
|
220 |
|
221 |
+
if($pagenow=='edit-comments.php'){
|
|
|
222 |
add_action('comment_unapproved_to_approvecomment', 'ct_comment_approved'); // param - comment object
|
223 |
add_action('comment_unapproved_to_approved', 'ct_comment_approved'); // param - comment object
|
224 |
add_action('comment_approved_to_unapproved', 'ct_comment_unapproved'); // param - comment object
|
227 |
//add_filter('get_comment_text', 'ct_get_comment_text'); // param - current comment text
|
228 |
add_filter('unspam_comment', 'ct_unspam_comment');
|
229 |
}
|
230 |
+
|
231 |
if($pagenow=='users.php')
|
|
|
232 |
add_action('delete_user', 'ct_delete_user');
|
233 |
+
|
234 |
+
if($pagenow=='plugins.php' || @strpos($_SERVER['REQUEST_URI'],'plugins.php')!==false){
|
235 |
+
|
236 |
add_filter('plugin_row_meta', 'ct_register_plugin_links', 10, 2);
|
237 |
add_filter('plugin_action_links', 'ct_plugin_action_links', 10, 2);
|
238 |
}
|
239 |
add_action('updated_option', 'ct_update_option'); // param - option name, i.e. 'cleantalk_settings'
|
240 |
}else{
|
241 |
+
|
242 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
|
243 |
+
|
244 |
+
// Init action.
|
245 |
+
add_action('plugins_loaded', 'ct_init', 1);
|
246 |
|
247 |
+
// Hourly run hook
|
248 |
+
add_action('ct_hourly_event_hook', 'ct_do_this_hourly');
|
249 |
+
add_action('cleantalk_update_sfw_hook', 'cleantalk_update_sfw');
|
250 |
|
251 |
+
// Comments
|
252 |
+
add_filter('preprocess_comment', 'ct_preprocess_comment', 1, 1); // param - comment data array
|
253 |
+
add_filter('comment_text', 'ct_comment_text' );
|
254 |
|
255 |
+
// Registrations
|
256 |
+
add_action('register_form','ct_register_form');
|
257 |
+
add_filter('registration_errors', 'ct_registration_errors', 1, 3);
|
258 |
+
add_filter('registration_errors', 'ct_check_registration_erros', 999999, 3);
|
259 |
+
add_action('user_register', 'ct_user_register');
|
260 |
|
261 |
+
// Multisite registrations
|
262 |
+
add_action('signup_extra_fields','ct_register_form');
|
263 |
+
add_filter('wpmu_validate_user_signup', 'ct_registration_errors_wpmu', 10, 3);
|
264 |
|
265 |
+
// Login form - for notifications only
|
266 |
+
add_filter('login_message', 'ct_login_message');
|
267 |
+
|
268 |
+
// Ait-Themes fix
|
269 |
+
if(isset($_GET['ait-action']) && $_GET['ait-action']=='register'){
|
270 |
+
$tmp=$_POST['redirect_to'];
|
271 |
+
unset($_POST['redirect_to']);
|
272 |
+
ct_contact_form_validate();
|
273 |
+
$_POST['redirect_to']=$tmp;
|
274 |
+
}
|
275 |
+
}
|
276 |
}
|
277 |
|
278 |
function ct_db_refresh(){
|
279 |
global $wpdb;
|
280 |
|
281 |
$wpdb->query("CREATE TABLE IF NOT EXISTS `".$wpdb->base_prefix."cleantalk_sfw` (
|
282 |
+
`network` int(11) unsigned NOT NULL,
|
283 |
+
`mask` int(11) unsigned NOT NULL,
|
284 |
+
INDEX ( `network` , `mask` )
|
285 |
+
) ENGINE = MYISAM ;");
|
286 |
+
|
287 |
+
$wpdb->query("CREATE TABLE IF NOT EXISTS `".$wpdb->base_prefix."cleantalk_sfw_logs` (
|
288 |
+
`ip` VARCHAR(15) NOT NULL ,
|
289 |
+
`all` INT NOT NULL ,
|
290 |
+
`blocked` INT NOT NULL ,
|
291 |
+
`timestamp` INT NOT NULL ,
|
292 |
+
PRIMARY KEY (`ip`))
|
293 |
+
ENGINE = MYISAM;");
|
294 |
|
295 |
}
|
296 |
|
307 |
wp_schedule_event(time(), 'hourly', 'ct_hourly_event_hook' );
|
308 |
//wp_schedule_event(time(), 'hourly', 'ct_send_sfw_log' );
|
309 |
wp_schedule_event(time(), 'daily', 'cleantalk_update_sfw_hook' );
|
310 |
+
//Sends log every day
|
311 |
+
//wp_schedule_event(time()+85400 , 'daily', 'cleantalk_send_daily_report_hook' );
|
312 |
|
313 |
cleantalk_update_sfw();
|
314 |
+
|
315 |
add_option('ct_plugin_do_activation_redirect', true);
|
316 |
+
//add_option('cleantalk_sends_reports_till', time()+7*24*3600);
|
317 |
}
|
318 |
}
|
319 |
/**
|
328 |
$wpdb->query("DROP TABLE IF EXISTS `".$wpdb->base_prefix."cleantalk_sfw_logs`;");
|
329 |
|
330 |
wp_clear_scheduled_hook( 'ct_hourly_event_hook' );
|
331 |
+
wp_clear_scheduled_hook( 'ct_send_sfw_log' );
|
332 |
wp_clear_scheduled_hook( 'cleantalk_update_sfw' );
|
333 |
wp_clear_scheduled_hook( 'cleantalk_update_sfw_hook' );
|
334 |
+
//wp_clear_scheduled_hook( 'cleantalk_send_daily_report_hook' );
|
335 |
+
|
336 |
+
//delete_option('cleantalk_sends_reports_till');
|
337 |
}
|
338 |
}
|
339 |
|
428 |
ob_start('ct_inject_nocache_script');
|
429 |
}
|
430 |
|
431 |
+
function ct_add_nocache_script_footer(){
|
432 |
+
|
433 |
+
if(strpos($_SERVER['REQUEST_URI'],'jm-ajax') === false){
|
434 |
+
|
435 |
global $test_external_forms, $test_internal_forms, $cleantalk_plugin_version;
|
436 |
|
437 |
print "<script async type='text/javascript' src='".plugins_url( '/inc/cleantalk_nocache.js' , __FILE__ )."?random=".$cleantalk_plugin_version."'></script>\n";
|
438 |
+
|
439 |
+
if($test_external_forms){
|
440 |
print "\n<script type='text/javascript'>var ct_blog_home = '".get_home_url()."';</script>\n";
|
441 |
print "<script async type='text/javascript' src='".plugins_url( '/inc/cleantalk_external.js' , __FILE__ )."?random=".$cleantalk_plugin_version."'></script>\n";
|
442 |
}
|
443 |
+
|
444 |
if($test_internal_forms){
|
445 |
print "\n<script type='text/javascript'>var ct_blog_home = '".get_home_url()."';</script>\n";
|
446 |
print "<script async type='text/javascript' src='".plugins_url( '/inc/cleantalk_internal.js' , __FILE__ )."?random=".$cleantalk_plugin_version."'></script>\n";
|
476 |
return $ct_info_flag . $ct_set_cookies_flag;
|
477 |
}
|
478 |
|
479 |
+
function ct_add_nocache_script_header(){
|
480 |
+
|
481 |
+
if(strpos($_SERVER['REQUEST_URI'],'jm-ajax')===false){
|
|
|
482 |
$ct_info_flag = ct_set_info_flag();
|
483 |
print "\n<script type='text/javascript'>\nvar ct_ajaxurl = '".admin_url('admin-ajax.php')."';\n $ct_info_flag </script>\n";
|
484 |
}
|
485 |
+
|
486 |
}
|
487 |
|
488 |
+
function ct_inject_nocache_script($html){
|
489 |
+
|
490 |
+
if(strpos($_SERVER['REQUEST_URI'],'jm-ajax')===false){
|
491 |
+
|
492 |
global $test_external_forms, $test_internal_forms, $cleantalk_plugin_version, $ct_options;
|
493 |
|
494 |
$ct_info_flag = ct_set_info_flag();
|
495 |
|
496 |
+
if(!is_admin()&&stripos($html,"</body>")!==false){
|
497 |
+
|
498 |
$ct_replace="<script async type='text/javascript' src='".plugins_url( '/inc/cleantalk_nocache.js' , __FILE__ )."?random=".$cleantalk_plugin_version."'></script>\n";
|
499 |
+
|
500 |
+
if($test_external_forms){
|
501 |
$ct_replace.="\n<script type='text/javascript'>var ct_blog_home = '".get_home_url()."';</script>\n";
|
502 |
$ct_replace.="<script async type='text/javascript' src='".plugins_url( '/inc/cleantalk_external.js' , __FILE__ )."?random=".$cleantalk_plugin_version."'></script>\n";
|
503 |
}
|
504 |
+
|
505 |
if($test_internal_forms){
|
506 |
$ct_replace .= "\n<script type='text/javascript'>var ct_blog_home = '".get_home_url()."';</script>\n";
|
507 |
$ct_replace .= "<script async type='text/javascript' src='".plugins_url( '/inc/cleantalk_internal.js' , __FILE__ )."?random=".$cleantalk_plugin_version."'></script>\n";
|
508 |
}
|
509 |
|
510 |
+
$html = preg_replace("/<\/body>\s*<\/html>/", $ct_replace."</body></html>", $html, 1); }
|
|
|
511 |
}
|
512 |
return $html;
|
513 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
514 |
|
515 |
+
function ct_show_comment_link(){
|
516 |
+
|
517 |
print "<div style='font-size:10pt;'><a href='https://cleantalk.org/wordpress-anti-spam-plugin' target='_blank'>".__( 'WordPress spam', 'cleantalk' )."</a> ".__( 'blocked by', 'cleantalk' )." CleanTalk.</div>";
|
518 |
+
|
519 |
}
|
520 |
|
521 |
add_action( 'right_now_content_table_end', 'my_add_counts_to_dashboard' );
|
522 |
|
523 |
+
function cleantalk_update_sfw(){
|
524 |
+
global $wpdb, $ct_sfw_updated, $ct_options, $ct_data;
|
|
|
525 |
|
526 |
if(!function_exists('sendRawRequest'))
|
527 |
require_once('inc/cleantalk.class.php');
|
|
|
|
|
|
|
|
|
|
|
|
|
528 |
|
529 |
+
if(isset($ct_options['spam_firewall']) && intval($ct_options['spam_firewall']) == 1 && ($ct_sfw_updated === false || !isset($ct_sfw_updated))){
|
530 |
|
531 |
$data = Array( 'auth_key' => $ct_options['apikey'],
|
532 |
'method_name' => '2s_blacklists_db'
|
536 |
|
537 |
$result=json_decode($result, true);
|
538 |
|
539 |
+
if(isset($result['data'])){
|
540 |
+
|
541 |
$wpdb->query("TRUNCATE TABLE `".$wpdb->base_prefix."cleantalk_sfw`;");
|
542 |
$result=$result['data'];
|
543 |
$query="INSERT INTO `".$wpdb->base_prefix."cleantalk_sfw` VALUES ";
|
544 |
+
for($i=0;$i<sizeof($result);$i++){
|
545 |
+
|
546 |
if($i==sizeof($result)-1)
|
547 |
$query.="(".$result[$i][0].",".$result[$i][1].");";
|
548 |
else
|
549 |
$query.="(".$result[$i][0].",".$result[$i][1]."), ";
|
550 |
+
|
551 |
}
|
552 |
$wpdb->query($query);
|
553 |
$ct_sfw_updated = true;
|
555 |
}
|
556 |
}
|
557 |
|
558 |
+
function cleantalk_get_ip(){
|
559 |
+
|
560 |
$result=Array();
|
561 |
+
|
562 |
if ( function_exists( 'apache_request_headers' ) )
|
|
|
563 |
$headers = apache_request_headers();
|
|
|
564 |
else
|
|
|
565 |
$headers = $_SERVER;
|
566 |
+
|
567 |
+
if ( array_key_exists( 'X-Forwarded-For', $headers ) ){
|
|
|
568 |
$the_ip=explode(",", trim($headers['X-Forwarded-For']));
|
569 |
$result[] = trim($the_ip[0]);
|
570 |
}
|
571 |
+
|
572 |
+
if ( array_key_exists( 'HTTP_X_FORWARDED_FOR', $headers )){
|
573 |
$the_ip=explode(",", trim($headers['HTTP_X_FORWARDED_FOR']));
|
574 |
$result[] = trim($the_ip[0]);
|
575 |
}
|
576 |
+
|
577 |
$result[] = filter_var( $_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 );
|
578 |
|
579 |
if(isset($_GET['sfw_test_ip']))
|
|
|
580 |
$result[]=$_GET['sfw_test_ip'];
|
581 |
+
|
582 |
return $result;
|
583 |
}
|
584 |
|
596 |
|
597 |
if(!isset($ct_data['sfw_counter']))
|
598 |
$ct_data['sfw_counter'] = array('all' => 0, 'blocked' => 0);
|
599 |
+
|
600 |
$ct_data['sfw_counter']['all'] += $result['all'];
|
601 |
$ct_data['sfw_counter']['blocked'] += $result['blocked'];
|
602 |
$ct_data['last_sfw_send']=time();
|
603 |
update_option('cleantalk_data', $ct_data);
|
604 |
|
605 |
return true;
|
606 |
+
|
607 |
}else
|
608 |
return false;
|
609 |
}
|
610 |
|
611 |
+
// Sends daily report from get_antispam_report method
|
612 |
+
function cleantalk_send_daily_report(){
|
613 |
+
|
614 |
+
$do_send = get_option('cleantalk_sends_reports_till');
|
615 |
+
|
616 |
+
// If 7 days is over
|
617 |
+
if(!$do_send || $do_send < time()){
|
618 |
+
|
619 |
+
delete_option('cleantalk_sends_reports_till');
|
620 |
+
wp_clear_scheduled_hook( 'cleantalk_send_daily_report_hook' );
|
621 |
+
|
622 |
+
return;
|
623 |
+
}
|
624 |
+
|
625 |
+
if(!function_exists('ct_get_data'))
|
626 |
+
include_once("inc/cleantalk-common.php");
|
627 |
+
|
628 |
+
$ct_options = ct_get_options();
|
629 |
+
$ct_data = ct_get_data();
|
630 |
+
$site_url = get_option('siteurl');
|
631 |
+
|
632 |
+
if($ct_options['apikey'] == ''){
|
633 |
+
|
634 |
+
if(!function_exists('getAntispamReport'))
|
635 |
+
include_once("inc/cleantalk.class.php");
|
636 |
+
|
637 |
+
$result = getAntispamReport($site_url);
|
638 |
+
$result = json_decode($result, true);
|
639 |
+
|
640 |
+
//Connection failed
|
641 |
+
if(!$result){
|
642 |
+
|
643 |
+
$ct_data['errors'][__FUNCTION__] = array(
|
644 |
+
'time' => date("M d Y H:i:s", time()),
|
645 |
+
'error_no' => (-1),
|
646 |
+
'error' => false
|
647 |
+
);
|
648 |
+
update_option('cleantalk_data', $ct_data);
|
649 |
+
return;
|
650 |
+
} //Error returned
|
651 |
+
elseif(isset($result['error_message']) && isset($result['error_no']))
|
652 |
+
{
|
653 |
+
$ct_data['errors'][__FUNCTION__] = array(
|
654 |
+
'time' => date("M d Y H:i:s", time()),
|
655 |
+
'error_no' => $result['error_no'],
|
656 |
+
'error' => $result['error_message']
|
657 |
+
);
|
658 |
+
update_option('cleantalk_data', $ct_data);
|
659 |
+
return;
|
660 |
+
} //OK
|
661 |
+
elseif(!empty($result['data']))
|
662 |
+
{
|
663 |
+
$result = $result['data']['stat'];
|
664 |
+
if(isset($ct_data['errors'][__FUNCTION__])){
|
665 |
+
unset($ct_data['errors'][__FUNCTION__]);
|
666 |
+
update_option('cleantalk_data', $ct_data);
|
667 |
+
}
|
668 |
+
}
|
669 |
+
|
670 |
+
//Comple mail
|
671 |
+
include_once("templates/daily_report.php");
|
672 |
+
|
673 |
+
$title = sprintf(__('%d spam attacks have been blocked', 'cleantalk'), $result['Deny_comments'] + $result['Deny_registrations'] + $result['Deny_contacts']);
|
674 |
+
$events = sprintf($events,
|
675 |
+
$result['Allow_comments'], $result['Deny_comments'],
|
676 |
+
$result['Allow_registrations'], $result['Deny_registrations'],
|
677 |
+
$result['Allow_contacts'], $result['Deny_contacts']
|
678 |
+
);
|
679 |
+
|
680 |
+
$href_for_network_admin = (is_network_admin() ? "settings" : "options-general");
|
681 |
+
|
682 |
+
$message = sprintf($msg_template,
|
683 |
+
$style, //Headers and styles
|
684 |
+
$title, //Title
|
685 |
+
$events, //Result table
|
686 |
+
$site_url, $href_for_network_admin, __('Complete setup', 'cleantalk'), //Right link to cleantalk's settings
|
687 |
+
__('To see the anti-spam log and complete the setup, please get the Access key.', 'cleantalk'),
|
688 |
+
'Antispam by CleanTalk'
|
689 |
+
);
|
690 |
+
|
691 |
+
$admin_email = get_option('admin_email');
|
692 |
+
$site_url = preg_replace('/http[s]?:\/\//', '', $site_url, 1);
|
693 |
+
$subject = sprintf(__("%s spam attacks report", "cleantalk"), $site_url);
|
694 |
+
$headers[] = 'content-type: text/html';
|
695 |
+
$headers[] = 'From: Antispam by CleanTalk <info@'.preg_replace('/\/[\S]*$/', '', $site_url, 1).'>';
|
696 |
+
|
697 |
+
$send_mail_result = wp_mail(
|
698 |
+
$admin_email,
|
699 |
+
$subject,
|
700 |
+
$message,
|
701 |
+
$headers
|
702 |
+
);
|
703 |
+
}
|
704 |
+
|
705 |
+
}
|
706 |
+
|
707 |
/*
|
708 |
function myplugin_update_field( $new_value, $old_value ) {
|
709 |
error_log('cleantalk_data dump: '. strlen(serialize($new_value)));
|
inc/cleantalk-admin.js
CHANGED
@@ -30,6 +30,8 @@ jQuery(document).ready(function(){
|
|
30 |
// jQuery('.form-table').first().before("<br /><a href='#' style='font-size:10pt;' id='cleantalk_access_key_link'>Show the access key</a>");
|
31 |
jQuery('.form-table').first().before(cleantalk_support_links);
|
32 |
}
|
|
|
|
|
33 |
}
|
34 |
|
35 |
jQuery('#cleantalk_access_key_link').click(function(){
|
30 |
// jQuery('.form-table').first().before("<br /><a href='#' style='font-size:10pt;' id='cleantalk_access_key_link'>Show the access key</a>");
|
31 |
jQuery('.form-table').first().before(cleantalk_support_links);
|
32 |
}
|
33 |
+
}else{
|
34 |
+
jQuery('#ct_admin_timezone').val(d.getTimezoneOffset()/60*(-1));
|
35 |
}
|
36 |
|
37 |
jQuery('#cleantalk_access_key_link').click(function(){
|
inc/cleantalk-admin.php
CHANGED
@@ -7,6 +7,9 @@ $ct_data=ct_get_data();
|
|
7 |
// How many days we use an IP to detect spam.
|
8 |
$ct_ip_penalty_days = 30;
|
9 |
|
|
|
|
|
|
|
10 |
add_filter( 'activity_box_end', 'cleantalk_custom_glance_items', 10, 1 );
|
11 |
function cleantalk_custom_glance_items( )
|
12 |
{
|
@@ -32,15 +35,9 @@ function cleantalk_custom_glance_items( )
|
|
32 |
}
|
33 |
}
|
34 |
|
35 |
-
|
36 |
-
// Timeout to get app server
|
37 |
-
$ct_server_timeout = 10;
|
38 |
-
|
39 |
-
|
40 |
/**
|
41 |
* Admin action 'wp_ajax_ajax_get_timezone' - Ajax method for getting timezone offset
|
42 |
-
*/
|
43 |
-
|
44 |
function ct_ajax_get_timezone()
|
45 |
{
|
46 |
global $ct_data;
|
@@ -122,14 +119,12 @@ function ct_enqueue_scripts($hook) {
|
|
122 |
* Admin action 'admin_menu' - Add the admin options page
|
123 |
*/
|
124 |
function ct_admin_add_page() {
|
|
|
125 |
if(is_network_admin())
|
126 |
-
{
|
127 |
add_submenu_page("settings.php", __('CleanTalk settings', 'cleantalk'), 'Antispam by CleanTalk', 'manage_options', 'cleantalk', 'ct_settings_page');
|
128 |
-
}
|
129 |
else
|
130 |
-
{
|
131 |
add_options_page(__('CleanTalk settings', 'cleantalk'), 'Antispam by CleanTalk', 'manage_options', 'cleantalk', 'ct_settings_page');
|
132 |
-
|
133 |
}
|
134 |
|
135 |
/**
|
@@ -138,10 +133,20 @@ function ct_admin_add_page() {
|
|
138 |
function ct_admin_init()
|
139 |
{
|
140 |
global $ct_server_timeout, $show_ct_notice_autokey, $ct_notice_autokey_label, $ct_notice_autokey_value, $show_ct_notice_renew, $ct_notice_renew_label, $show_ct_notice_trial, $ct_notice_trial_label, $show_ct_notice_online, $ct_notice_online_label, $renew_notice_showtime, $trial_notice_showtime, $ct_plugin_name, $ct_options, $ct_data, $trial_notice_check_timeout, $account_notice_check_timeout, $ct_user_token_label, $cleantalk_plugin_version, $notice_check_timeout, $renew_notice_check_timeout, $ct_agent_version;
|
141 |
-
|
142 |
$ct_options = ct_get_options();
|
143 |
$ct_data = ct_get_data();
|
144 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
$current_version=@trim($ct_data['current_version']);
|
146 |
if($current_version!=$cleantalk_plugin_version)
|
147 |
{
|
@@ -179,132 +184,106 @@ function ct_admin_init()
|
|
179 |
$show_ct_notice_autokey = false;
|
180 |
if (isset($_COOKIE[$ct_notice_autokey_label]) && !empty($_COOKIE[$ct_notice_autokey_label]))
|
181 |
{
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
$ct_notice_autokey_value = base64_decode($_COOKIE[$ct_notice_autokey_label]);
|
186 |
-
setcookie($ct_notice_autokey_label, '', 1, '/');
|
187 |
-
}
|
188 |
}
|
189 |
|
|
|
190 |
if (isset($_POST['get_apikey_auto']))
|
191 |
{
|
192 |
$website = parse_url(get_option('siteurl'),PHP_URL_HOST);
|
193 |
$platform = 'wordpress';
|
|
|
194 |
|
195 |
if(!function_exists('getAutoKey'))
|
196 |
-
{
|
197 |
require_once('cleantalk.class.php');
|
198 |
-
}
|
199 |
|
200 |
-
$result = getAutoKey(ct_get_admin_email(), $website, $platform);
|
201 |
|
202 |
if ($result)
|
203 |
{
|
204 |
$ct_data['next_account_status_check']=0;
|
205 |
update_option('cleantalk_data', $ct_data);
|
206 |
$result = json_decode($result, true);
|
|
|
207 |
if (isset($result['data']) && is_array($result['data']))
|
208 |
-
{
|
209 |
$result = $result['data'];
|
210 |
-
|
211 |
-
if(isset($result['user_token']))
|
212 |
-
{
|
213 |
$ct_data['user_token'] = $result['user_token'];
|
214 |
update_option('cleantalk_data', $ct_data);
|
215 |
}
|
216 |
-
|
217 |
-
{
|
218 |
$_POST['cleantalk_settings']['apikey'] = $result['auth_key'];
|
219 |
$ct_options['apikey']=$result['auth_key'];
|
220 |
update_option('cleantalk_settings', $ct_options);
|
221 |
-
}
|
222 |
-
else
|
223 |
-
{
|
224 |
setcookie($ct_notice_autokey_label, (string) base64_encode($result['error_message']), 0, '/');
|
225 |
}
|
226 |
-
}
|
227 |
-
else
|
228 |
-
{
|
229 |
setcookie($ct_notice_autokey_label, (string) base64_encode(sprintf(__('Unable to connect to %s.', 'cleantalk'), 'api.cleantalk.org')), 0, '/');
|
230 |
}
|
231 |
}
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
{
|
236 |
$result = false;
|
237 |
$notice_check_timeout = $account_notice_check_timeout;
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
$result=noticePaidTill($_POST['cleantalk_settings']['apikey']);
|
247 |
-
}
|
248 |
-
else
|
249 |
-
{
|
250 |
-
$result=noticePaidTill($ct_options['apikey']);
|
251 |
-
}
|
252 |
|
253 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
254 |
{
|
255 |
-
$result
|
256 |
-
|
257 |
-
|
258 |
-
$
|
259 |
-
}
|
260 |
-
if(isset($result['spam_count']))
|
261 |
-
{
|
262 |
-
$ct_data['admin_blocked']=$result['spam_count'];
|
263 |
}
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
{
|
269 |
-
$notice_check_timeout = $trial_notice_check_timeout;
|
270 |
-
$show_ct_notice_trial = true;
|
271 |
-
$ct_data['show_ct_notice_trial']=1;
|
272 |
-
}
|
273 |
-
if ($result['show_notice'] == 1 && isset($result['renew']) && $result['renew'] == 1)
|
274 |
-
{
|
275 |
-
$notice_check_timeout = $renew_notice_check_timeout;
|
276 |
-
$show_ct_notice_renew = true;
|
277 |
-
$ct_data['show_ct_notice_renew']=1;
|
278 |
-
}
|
279 |
-
|
280 |
-
if ($result['show_notice'] == 0)
|
281 |
-
{
|
282 |
-
$notice_check_timeout = $account_notice_check_timeout;
|
283 |
-
}
|
284 |
-
$ct_data['show_ct_notice_trial']=(int) $show_ct_notice_trial;
|
285 |
-
$ct_data['show_ct_notice_renew']= (int) $show_ct_notice_renew;
|
286 |
}
|
287 |
|
288 |
-
if (
|
289 |
-
|
290 |
-
$ct_data['moderate_ip'] = 1;
|
291 |
-
$ct_data['ip_license'] = $result['ip_license'];
|
292 |
-
}
|
293 |
-
else
|
294 |
-
{
|
295 |
-
$ct_data['moderate_ip'] = 0;
|
296 |
-
$ct_data['ip_license'] = 0;
|
297 |
-
}
|
298 |
|
299 |
-
|
300 |
-
|
301 |
-
$ct_data['user_token'] = $result['user_token'];
|
302 |
-
}
|
303 |
}
|
304 |
-
|
305 |
-
$
|
306 |
-
|
307 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
308 |
|
309 |
/*if ($result)
|
310 |
{
|
@@ -632,6 +611,22 @@ function ct_add_admin_menu( $wp_admin_bar ) {
|
|
632 |
}
|
633 |
|
634 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
635 |
/**
|
636 |
* Admin callback function - Displays description of 'state' plugin parameters section
|
637 |
*/
|
@@ -641,6 +636,28 @@ function ct_section_settings_state() {
|
|
641 |
$ct_options = ct_get_options();
|
642 |
$ct_data = ct_get_data();
|
643 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
644 |
if(!isset($ct_data['moderate_ip']))
|
645 |
{
|
646 |
$ct_data['moderate_ip'] = 0;
|
@@ -684,8 +701,9 @@ function ct_section_settings_state() {
|
|
684 |
print ' <img src="'.(($ct_options['comments_test']==1 || $ct_moderate) ? $img : $img_no).'" alt="" height="" /> '.__('Comments forms', 'cleantalk');
|
685 |
print ' <img src="'.(($ct_options['contact_forms_test']==1 || $ct_moderate) ? $img : $img_no).'" alt="" height="" /> '.__('Contact forms', 'cleantalk');
|
686 |
print ' <img src="'.(($ct_options['general_contact_forms_test']==1 || $ct_moderate) ? $img : $img_no).'" alt="" height="" /> '.__('Custom contact forms', 'cleantalk');
|
687 |
-
print ' <img src="'.(($ct_options['spam_firewall']==1 || $ct_moderate) ? $img : $img_no).'" alt="" height="" /> '.__('SpamFireWall', 'cleantalk');
|
688 |
print ' <img src="'.(($ct_options['wc_checkout_test']==1 || $ct_moderate) ? $img : $img_no).'" alt="" height="" /> '.__('WooCommerce checkout form', 'cleantalk');
|
|
|
|
|
689 |
|
690 |
if($ct_data['moderate_ip'] == 1)
|
691 |
print "<br /><br />The anti-spam service is paid by your hosting provider. License #".$ct_data['ip_license'].".<br />";
|
@@ -765,6 +783,7 @@ function ct_input_apikey() {
|
|
765 |
echo "<a target='__blank' style='' href='https://cleantalk.org/register?platform=wordpress&email=".urlencode(ct_get_admin_email())."&website=".urlencode(parse_url(get_option('siteurl'),PHP_URL_HOST))."'><input type='button' class='cleantalk_auto_link' value='".__('Get access key manually', 'cleantalk')."' /></a>";
|
766 |
echo " " . __("or") . " ";
|
767 |
echo '<input name="get_apikey_auto" type="submit" class="cleantalk_manual_link" value="' . __('Get access key automatically', 'cleantalk') . '" />';
|
|
|
768 |
echo "<br />";
|
769 |
echo "<br />";
|
770 |
|
@@ -1361,23 +1380,43 @@ function ct_settings_page() {
|
|
1361 |
<?php
|
1362 |
}
|
1363 |
?>
|
1364 |
-
|
1365 |
</form>
|
1366 |
</div>
|
1367 |
<?php
|
1368 |
-
|
1369 |
-
|
1370 |
-
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
1375 |
-
|
1376 |
-
|
1377 |
-
|
1378 |
-
|
1379 |
-
|
1380 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1381 |
}
|
1382 |
|
1383 |
/**
|
@@ -1389,77 +1428,58 @@ function cleantalk_admin_notice_message(){
|
|
1389 |
|
1390 |
$ct_options = ct_get_options();
|
1391 |
$ct_data = ct_get_data();
|
|
|
1392 |
|
1393 |
if(!isset($ct_data['moderate_ip']))
|
1394 |
-
{
|
1395 |
$ct_data['moderate_ip'] = 0;
|
1396 |
-
}
|
1397 |
-
|
1398 |
-
$user_token = '';
|
1399 |
-
if (isset($ct_data['user_token']) && $ct_data['user_token'] != '') {
|
1400 |
-
$user_token = '&user_token=' . $ct_data['user_token'];
|
1401 |
-
}
|
1402 |
|
1403 |
$show_notice = true;
|
1404 |
-
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
}
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1412 |
}
|
1413 |
-
|
|
|
1414 |
if ($show_notice && $show_ct_notice_autokey && $value==1 && (is_network_admin() || (!defined('WP_ALLOW_MULTISITE')||defined('WP_ALLOW_MULTISITE')&&WP_ALLOW_MULTISITE==false) && is_admin())) {
|
1415 |
echo '<div class="error"><h3>' . sprintf(__("Unable to get Access key automatically: %s", 'cleantalk'), $ct_notice_autokey_value);
|
1416 |
echo " <a target='__blank' style='margin-left: 10px' href='https://cleantalk.org/register?platform=wordpress&email=".urlencode(ct_get_admin_email())."&website=".urlencode(parse_url(get_option('siteurl'),PHP_URL_HOST))."'>".__('Get the Access key', 'cleantalk').'</a></h3></div>';
|
1417 |
}
|
1418 |
-
|
|
|
1419 |
if ($ct_data['moderate_ip'] == 0 && $show_notice && ct_valid_key($ct_options['apikey']) === false && $value==1 &&
|
1420 |
-
(is_network_admin() || (!defined('WP_ALLOW_MULTISITE')||defined('WP_ALLOW_MULTISITE')&&WP_ALLOW_MULTISITE==false) && is_admin())
|
1421 |
-
|
|
|
|
|
|
|
1422 |
$show_notice = false;
|
1423 |
}
|
1424 |
|
1425 |
-
|
1426 |
-
{
|
1427 |
-
$show_ct_notice_trial = intval($ct_data['show_ct_notice_trial']);
|
1428 |
-
}
|
1429 |
-
else
|
1430 |
-
{
|
1431 |
-
$show_ct_notice_trial = 0;
|
1432 |
-
}
|
1433 |
-
|
1434 |
if ($show_notice && $show_ct_notice_trial ==1 && $value==1 && (is_network_admin() || is_admin()) && $ct_data['moderate_ip'] == 0) {
|
1435 |
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&cp_mode=antispam\" target=\"_blank\"><b>premium version</b></a>") . '</h3></div>';
|
1436 |
$show_notice = false;
|
1437 |
}
|
1438 |
|
1439 |
-
|
1440 |
-
{
|
1441 |
-
$next_notice_show=$ct_data['next_notice_show'];
|
1442 |
-
}
|
1443 |
-
else
|
1444 |
-
{
|
1445 |
-
$next_notice_show=0;
|
1446 |
-
}
|
1447 |
-
|
1448 |
-
if(isset($ct_data['show_ct_notice_renew']))
|
1449 |
-
{
|
1450 |
-
$show_ct_notice_renew = intval($ct_data['show_ct_notice_renew']);
|
1451 |
-
}
|
1452 |
-
else
|
1453 |
-
{
|
1454 |
-
$show_ct_notice_renew = 0;
|
1455 |
-
}
|
1456 |
-
|
1457 |
if ($show_notice && $show_ct_notice_renew == 1 && $value==1 && (is_network_admin() || is_admin()) && $ct_data['moderate_ip'] != 1) {
|
1458 |
$button_html = "<a href=\"http://cleantalk.org/my/bill/recharge?utm_source=wp-backend&utm_medium=cpc&utm_campaign=WP%20backend%20renew$user_token&cp_mode=antispam\" target=\"_blank\">" . '<input type="button" class="button button-primary" value="' . __('RENEW ANTI-SPAM', 'cleantalk') . '" />' . "</a>";
|
1459 |
echo '<div class="updated"><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&cp_mode=antispam\" target=\"_blank\"><b>" . __('next year', 'cleantalk') ."</b></a>") . '<br /><br />' . $button_html . '</h3></div>';
|
1460 |
$show_notice = false;
|
1461 |
}
|
1462 |
-
|
|
|
1463 |
if ($show_notice && $show_ct_notice_online != '' && $value==1 && (is_network_admin() || is_admin()) && $ct_data['moderate_ip'] != 1) {
|
1464 |
if($show_ct_notice_online === 'N' && $value==1 && (is_network_admin() || (!defined('WP_ALLOW_MULTISITE')||defined('WP_ALLOW_MULTISITE')&&WP_ALLOW_MULTISITE==false) && is_admin()) && $ct_data['moderate_ip'] != 1){
|
1465 |
echo '<div class="error"><h3><b>';
|
@@ -1693,8 +1713,6 @@ function ct_update_option($option_name) {
|
|
1693 |
$app_server_error = true;
|
1694 |
$ct_data['testing_failed']=1;
|
1695 |
}
|
1696 |
-
|
1697 |
-
update_option('cleantalk_data', $ct_data);
|
1698 |
|
1699 |
if ($key_valid) {
|
1700 |
// Removes cookie for server errors
|
@@ -1705,9 +1723,16 @@ function ct_update_option($option_name) {
|
|
1705 |
setcookie($ct_notice_online_label, (string) time(), strtotime("+14 days"), '/');
|
1706 |
}
|
1707 |
setcookie($ct_notice_trial_label, '0', strtotime("+$trial_notice_showtime minutes"), '/');
|
|
|
|
|
|
|
|
|
1708 |
} else {
|
1709 |
setcookie($ct_notice_online_label, 'BAD_KEY', 0, '/');
|
1710 |
}
|
|
|
|
|
|
|
1711 |
return null;
|
1712 |
}
|
1713 |
|
7 |
// How many days we use an IP to detect spam.
|
8 |
$ct_ip_penalty_days = 30;
|
9 |
|
10 |
+
// Timeout to get app server
|
11 |
+
$ct_server_timeout = 10;
|
12 |
+
|
13 |
add_filter( 'activity_box_end', 'cleantalk_custom_glance_items', 10, 1 );
|
14 |
function cleantalk_custom_glance_items( )
|
15 |
{
|
35 |
}
|
36 |
}
|
37 |
|
|
|
|
|
|
|
|
|
|
|
38 |
/**
|
39 |
* Admin action 'wp_ajax_ajax_get_timezone' - Ajax method for getting timezone offset
|
40 |
+
*/
|
|
|
41 |
function ct_ajax_get_timezone()
|
42 |
{
|
43 |
global $ct_data;
|
119 |
* Admin action 'admin_menu' - Add the admin options page
|
120 |
*/
|
121 |
function ct_admin_add_page() {
|
122 |
+
|
123 |
if(is_network_admin())
|
|
|
124 |
add_submenu_page("settings.php", __('CleanTalk settings', 'cleantalk'), 'Antispam by CleanTalk', 'manage_options', 'cleantalk', 'ct_settings_page');
|
|
|
125 |
else
|
|
|
126 |
add_options_page(__('CleanTalk settings', 'cleantalk'), 'Antispam by CleanTalk', 'manage_options', 'cleantalk', 'ct_settings_page');
|
127 |
+
|
128 |
}
|
129 |
|
130 |
/**
|
133 |
function ct_admin_init()
|
134 |
{
|
135 |
global $ct_server_timeout, $show_ct_notice_autokey, $ct_notice_autokey_label, $ct_notice_autokey_value, $show_ct_notice_renew, $ct_notice_renew_label, $show_ct_notice_trial, $ct_notice_trial_label, $show_ct_notice_online, $ct_notice_online_label, $renew_notice_showtime, $trial_notice_showtime, $ct_plugin_name, $ct_options, $ct_data, $trial_notice_check_timeout, $account_notice_check_timeout, $ct_user_token_label, $cleantalk_plugin_version, $notice_check_timeout, $renew_notice_check_timeout, $ct_agent_version;
|
136 |
+
|
137 |
$ct_options = ct_get_options();
|
138 |
$ct_data = ct_get_data();
|
139 |
+
|
140 |
+
// if(isset($_GET['from_report']) && $_GET['from_report']){
|
141 |
+
// $ct_data['ct_show_notice_from_report'] = true;
|
142 |
+
// update_option('cleantalk_data', $ct_data);
|
143 |
+
// }
|
144 |
+
|
145 |
+
if(isset($_POST['ct_debug_reset']) && $_POST['ct_debug_reset']){
|
146 |
+
$ct_data['ct_debug_reset'] = true;
|
147 |
+
update_option('cleantalk_data', $ct_data);
|
148 |
+
}
|
149 |
+
|
150 |
$current_version=@trim($ct_data['current_version']);
|
151 |
if($current_version!=$cleantalk_plugin_version)
|
152 |
{
|
184 |
$show_ct_notice_autokey = false;
|
185 |
if (isset($_COOKIE[$ct_notice_autokey_label]) && !empty($_COOKIE[$ct_notice_autokey_label]))
|
186 |
{
|
187 |
+
$show_ct_notice_autokey = true;
|
188 |
+
$ct_notice_autokey_value = base64_decode($_COOKIE[$ct_notice_autokey_label]);
|
189 |
+
setcookie($ct_notice_autokey_label, '', 1, '/');
|
|
|
|
|
|
|
190 |
}
|
191 |
|
192 |
+
//Auto getting key
|
193 |
if (isset($_POST['get_apikey_auto']))
|
194 |
{
|
195 |
$website = parse_url(get_option('siteurl'),PHP_URL_HOST);
|
196 |
$platform = 'wordpress';
|
197 |
+
$timezone = $_POST['ct_admin_timezone'];
|
198 |
|
199 |
if(!function_exists('getAutoKey'))
|
|
|
200 |
require_once('cleantalk.class.php');
|
|
|
201 |
|
202 |
+
$result = getAutoKey(ct_get_admin_email(), $website, $platform, $timezone);
|
203 |
|
204 |
if ($result)
|
205 |
{
|
206 |
$ct_data['next_account_status_check']=0;
|
207 |
update_option('cleantalk_data', $ct_data);
|
208 |
$result = json_decode($result, true);
|
209 |
+
|
210 |
if (isset($result['data']) && is_array($result['data']))
|
|
|
211 |
$result = $result['data'];
|
212 |
+
|
213 |
+
if(isset($result['user_token'])){
|
|
|
214 |
$ct_data['user_token'] = $result['user_token'];
|
215 |
update_option('cleantalk_data', $ct_data);
|
216 |
}
|
217 |
+
|
218 |
+
if (isset($result['auth_key']) && !empty($result['auth_key'])){
|
219 |
$_POST['cleantalk_settings']['apikey'] = $result['auth_key'];
|
220 |
$ct_options['apikey']=$result['auth_key'];
|
221 |
update_option('cleantalk_settings', $ct_options);
|
222 |
+
}else{
|
|
|
|
|
223 |
setcookie($ct_notice_autokey_label, (string) base64_encode($result['error_message']), 0, '/');
|
224 |
}
|
225 |
+
}else{
|
|
|
|
|
226 |
setcookie($ct_notice_autokey_label, (string) base64_encode(sprintf(__('Unable to connect to %s.', 'cleantalk'), 'api.cleantalk.org')), 0, '/');
|
227 |
}
|
228 |
}
|
229 |
+
|
230 |
+
//Account's status check cron job
|
231 |
+
if (time() > $ct_data['next_account_status_check'] || isset($_POST['cleantalk_settings']['apikey']))
|
232 |
{
|
233 |
$result = false;
|
234 |
$notice_check_timeout = $account_notice_check_timeout;
|
235 |
+
|
236 |
+
if(!function_exists('noticePaidTill'))
|
237 |
+
require_once('cleantalk.class.php');
|
238 |
+
|
239 |
+
if(isset($_POST['cleantalk_settings']['apikey']))
|
240 |
+
$result=noticePaidTill($_POST['cleantalk_settings']['apikey']);
|
241 |
+
else
|
242 |
+
$result=noticePaidTill($ct_options['apikey']);
|
|
|
|
|
|
|
|
|
|
|
|
|
243 |
|
244 |
+
if ($result)
|
245 |
+
{
|
246 |
+
$result = json_decode($result, true);
|
247 |
+
if (isset($result['data']) && is_array($result['data']))
|
248 |
+
$result = $result['data'];
|
249 |
+
|
250 |
+
if(isset($result['spam_count']))
|
251 |
+
$ct_data['admin_blocked']=$result['spam_count'];
|
252 |
+
|
253 |
+
if (isset($result['show_notice']))
|
254 |
{
|
255 |
+
if ($result['show_notice'] == 1 && isset($result['trial']) && $result['trial'] == 1){
|
256 |
+
$notice_check_timeout = $trial_notice_check_timeout;
|
257 |
+
$show_ct_notice_trial = true;
|
258 |
+
$ct_data['show_ct_notice_trial']=1;
|
|
|
|
|
|
|
|
|
259 |
}
|
260 |
+
if ($result['show_notice'] == 1 && isset($result['renew']) && $result['renew'] == 1){
|
261 |
+
$notice_check_timeout = $renew_notice_check_timeout;
|
262 |
+
$show_ct_notice_renew = true;
|
263 |
+
$ct_data['show_ct_notice_renew']=1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
264 |
}
|
265 |
|
266 |
+
if ($result['show_notice'] == 0)
|
267 |
+
$notice_check_timeout = $account_notice_check_timeout;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
268 |
|
269 |
+
$ct_data['show_ct_notice_trial']=(int) $show_ct_notice_trial;
|
270 |
+
$ct_data['show_ct_notice_renew']= (int) $show_ct_notice_renew;
|
|
|
|
|
271 |
}
|
272 |
+
|
273 |
+
if (isset($result['moderate_ip']) && $result['moderate_ip'] == 1){
|
274 |
+
$ct_data['moderate_ip'] = 1;
|
275 |
+
$ct_data['ip_license'] = $result['ip_license'];
|
276 |
+
}else{
|
277 |
+
$ct_data['moderate_ip'] = 0;
|
278 |
+
$ct_data['ip_license'] = 0;
|
279 |
+
}
|
280 |
+
|
281 |
+
if (isset($result['user_token']))
|
282 |
+
$ct_data['user_token'] = $result['user_token'];
|
283 |
+
}
|
284 |
+
// Save next status request time
|
285 |
+
$ct_data['next_account_status_check'] = time() + $notice_check_timeout * 3600;
|
286 |
+
update_option('cleantalk_data', $ct_data);
|
287 |
|
288 |
/*if ($result)
|
289 |
{
|
611 |
}
|
612 |
|
613 |
|
614 |
+
// Prints debug information. Support function.
|
615 |
+
function ct_debug_print($arr, $iter = 1){
|
616 |
+
|
617 |
+
foreach($arr as $key => $value){
|
618 |
+
|
619 |
+
if(is_array($value) || $key == 'ct' || $key == 'ct_result'){
|
620 |
+
echo str_repeat(' ', $iter)."<b style='font-size: 15px;'>$key: </b><br>";
|
621 |
+
ct_debug_print($value, $iter + 1);
|
622 |
+
}else
|
623 |
+
echo str_repeat(' ', $iter)."$key => $value<br>";
|
624 |
+
|
625 |
+
}
|
626 |
+
|
627 |
+
unset($key, $value);
|
628 |
+
}
|
629 |
+
|
630 |
/**
|
631 |
* Admin callback function - Displays description of 'state' plugin parameters section
|
632 |
*/
|
636 |
$ct_options = ct_get_options();
|
637 |
$ct_data = ct_get_data();
|
638 |
|
639 |
+
if(isset($ct_data['ct_debug_reset']) && $ct_data['ct_debug_reset']){
|
640 |
+
unset($ct_data['debug'], $ct_data['ct_debug_reset']);
|
641 |
+
update_option('cleantalk_data', $ct_data);
|
642 |
+
}
|
643 |
+
|
644 |
+
if(!empty($ct_data['debug'])){
|
645 |
+
|
646 |
+
echo "<input type='submit' value='Drop debug data' name='ct_debug_reset'><br>";
|
647 |
+
|
648 |
+
echo 'CLEANTALK_AJAX_USE_BUFFER '.(defined('CLEANTALK_AJAX_USE_BUFFER') ? (CLEANTALK_AJAX_USE_BUFFER ? 'true' : 'flase') : 'NOT_DEFINED')."<br>";
|
649 |
+
echo 'CLEANTALK_AJAX_USE_FOOTER_HEADER '.(defined('CLEANTALK_AJAX_USE_FOOTER_HEADER') ? (CLEANTALK_AJAX_USE_FOOTER_HEADER ? 'true' : 'flase') : 'NOT_DEFINED');
|
650 |
+
|
651 |
+
echo "<h3>DEBUG:</h3>";
|
652 |
+
// ct_debug_print($ct_data['debug']);
|
653 |
+
$output = print_r($ct_data['debug'], true);
|
654 |
+
$output = str_replace("\n", "<br>", $output);
|
655 |
+
$output = preg_replace("/[^\S]{4}/", " ", $output);
|
656 |
+
echo "$output";
|
657 |
+
|
658 |
+
echo "<br>";
|
659 |
+
}
|
660 |
+
|
661 |
if(!isset($ct_data['moderate_ip']))
|
662 |
{
|
663 |
$ct_data['moderate_ip'] = 0;
|
701 |
print ' <img src="'.(($ct_options['comments_test']==1 || $ct_moderate) ? $img : $img_no).'" alt="" height="" /> '.__('Comments forms', 'cleantalk');
|
702 |
print ' <img src="'.(($ct_options['contact_forms_test']==1 || $ct_moderate) ? $img : $img_no).'" alt="" height="" /> '.__('Contact forms', 'cleantalk');
|
703 |
print ' <img src="'.(($ct_options['general_contact_forms_test']==1 || $ct_moderate) ? $img : $img_no).'" alt="" height="" /> '.__('Custom contact forms', 'cleantalk');
|
|
|
704 |
print ' <img src="'.(($ct_options['wc_checkout_test']==1 || $ct_moderate) ? $img : $img_no).'" alt="" height="" /> '.__('WooCommerce checkout form', 'cleantalk');
|
705 |
+
if($ct_options['spam_firewall']==1 || $ct_moderate)
|
706 |
+
print ' <img src="'.$img.'" alt="" height="" /> '.__('SpamFireWall', 'cleantalk');
|
707 |
|
708 |
if($ct_data['moderate_ip'] == 1)
|
709 |
print "<br /><br />The anti-spam service is paid by your hosting provider. License #".$ct_data['ip_license'].".<br />";
|
783 |
echo "<a target='__blank' style='' href='https://cleantalk.org/register?platform=wordpress&email=".urlencode(ct_get_admin_email())."&website=".urlencode(parse_url(get_option('siteurl'),PHP_URL_HOST))."'><input type='button' class='cleantalk_auto_link' value='".__('Get access key manually', 'cleantalk')."' /></a>";
|
784 |
echo " " . __("or") . " ";
|
785 |
echo '<input name="get_apikey_auto" type="submit" class="cleantalk_manual_link" value="' . __('Get access key automatically', 'cleantalk') . '" />';
|
786 |
+
echo '<input id="ct_admin_timezone" name="ct_admin_timezone" type="hidden" value="null" />';
|
787 |
echo "<br />";
|
788 |
echo "<br />";
|
789 |
|
1380 |
<?php
|
1381 |
}
|
1382 |
?>
|
1383 |
+
|
1384 |
</form>
|
1385 |
</div>
|
1386 |
<?php
|
1387 |
+
|
1388 |
+
$ct_data = get_option('cleantalk_data');
|
1389 |
+
|
1390 |
+
if (ct_valid_key() === false){
|
1391 |
+
|
1392 |
+
// $page = get_current_screen();
|
1393 |
+
// $trial_time = get_option('cleantalk_sends_reports_till');
|
1394 |
+
// $trial_days_left = ($trial_time ? ceil(($trial_time - time()) / 86400) : false);
|
1395 |
+
|
1396 |
+
// Trial days
|
1397 |
+
// if ((is_network_admin() || is_admin()) && $trial_days_left && $page->id == 'settings_page_cleantalk' && $ct_data['moderate_ip'] == 0){
|
1398 |
+
// $trial_days_left = 7;
|
1399 |
+
// echo ($trial_days_left == 1 ? "<span style='color:red;'>" : "");
|
1400 |
+
// echo '<br>' . sprintf(__("You have <b>%d</b> days free trial to test the anti-spam protection.", 'cleantalk'), $trial_days_left) . '';
|
1401 |
+
// echo ($trial_days_left == 1 ? "</span>" : "");
|
1402 |
+
// }
|
1403 |
+
|
1404 |
+
}else{
|
1405 |
+
|
1406 |
+
$user_token = (!empty($ct_data['user_token']) ? $ct_data['user_token'] : false);
|
1407 |
+
echo "<br /><br /><br />";
|
1408 |
+
echo "<div>";
|
1409 |
+
|
1410 |
+
echo __('Plugin Homepage at', 'cleantalk').' <a href="http://cleantalk.org" target="_blank">cleantalk.org</a>.<br />';
|
1411 |
+
echo __("CleanTalk's tech support:", 'cleantalk')
|
1412 |
+
.' <a href="https://community.cleantalk.org/viewforum.php?f=25" target="_blank">'.__("Tech forum", 'cleantalk').'</a>'
|
1413 |
+
.($user_token ? ", <a href='https://cleantalk.org/my/support?user_token=$user_token&cp_mode=antispam' target='_blank'>".__("Service support ", 'cleantalk').'</a>' : '').'.<br>';
|
1414 |
+
echo __('Use s@cleantalk.org to test plugin in any WordPress form.', 'cleantalk').'<br>';
|
1415 |
+
echo __('CleanTalk is registered Trademark. All rights reserved.', 'cleantalk');
|
1416 |
+
|
1417 |
+
echo "</div>";
|
1418 |
+
|
1419 |
+
}
|
1420 |
}
|
1421 |
|
1422 |
/**
|
1428 |
|
1429 |
$ct_options = ct_get_options();
|
1430 |
$ct_data = ct_get_data();
|
1431 |
+
$page = get_current_screen();
|
1432 |
|
1433 |
if(!isset($ct_data['moderate_ip']))
|
|
|
1434 |
$ct_data['moderate_ip'] = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
1435 |
|
1436 |
$show_notice = true;
|
1437 |
+
$value = (current_user_can('activate_plugins') ? 1 : 0);
|
1438 |
+
$show_ct_notice_trial = (isset($ct_data['show_ct_notice_trial']) ? intval($ct_data['show_ct_notice_trial']) : 0);
|
1439 |
+
$show_ct_notice_renew = (isset($ct_data['show_ct_notice_renew']) ? intval($ct_data['show_ct_notice_renew']) : 0);
|
1440 |
+
$next_notice_show = (isset($ct_data['next_notice_show']) ? $ct_data['next_notice_show'] : 0); //inactive
|
1441 |
+
$user_token = (isset($ct_data['user_token']) && $ct_data['user_token'] != '' ? "&user_token={$ct_data['user_token']}" : "");
|
1442 |
+
$notice_from_report = (isset($ct_data['ct_show_notice_from_report']) ? $ct_data['ct_show_notice_from_report'] : 0); //inactive
|
1443 |
+
|
1444 |
+
//Notice when users came from the daily report letter
|
1445 |
+
if ($ct_data['moderate_ip'] == 0 && $show_notice && $notice_from_report && !ct_valid_key() && $value==1 && (is_network_admin() || is_admin())) {
|
1446 |
+
|
1447 |
+
if($page->id == 'settings_page_cleantalk')
|
1448 |
+
echo '<div class="error"><h3>' .__("To see the anti-spam log and complete the setup, please get the Access key.", 'cleantalk'). '</h3></div>';
|
1449 |
+
|
1450 |
+
$show_notice = false;
|
1451 |
}
|
1452 |
+
|
1453 |
+
//Unable to get key automatically (if ct_admin_init().getAutoKey() returns error)
|
1454 |
if ($show_notice && $show_ct_notice_autokey && $value==1 && (is_network_admin() || (!defined('WP_ALLOW_MULTISITE')||defined('WP_ALLOW_MULTISITE')&&WP_ALLOW_MULTISITE==false) && is_admin())) {
|
1455 |
echo '<div class="error"><h3>' . sprintf(__("Unable to get Access key automatically: %s", 'cleantalk'), $ct_notice_autokey_value);
|
1456 |
echo " <a target='__blank' style='margin-left: 10px' href='https://cleantalk.org/register?platform=wordpress&email=".urlencode(ct_get_admin_email())."&website=".urlencode(parse_url(get_option('siteurl'),PHP_URL_HOST))."'>".__('Get the Access key', 'cleantalk').'</a></h3></div>';
|
1457 |
}
|
1458 |
+
|
1459 |
+
//key == "" || "enter key"
|
1460 |
if ($ct_data['moderate_ip'] == 0 && $show_notice && ct_valid_key($ct_options['apikey']) === false && $value==1 &&
|
1461 |
+
(is_network_admin() || (!defined('WP_ALLOW_MULTISITE')||defined('WP_ALLOW_MULTISITE')&&WP_ALLOW_MULTISITE==false) && is_admin())) {
|
1462 |
+
|
1463 |
+
if($page->id == 'settings_page_cleantalk')
|
1464 |
+
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>';
|
1465 |
+
|
1466 |
$show_notice = false;
|
1467 |
}
|
1468 |
|
1469 |
+
//"Trial period ends" notice from ct_admin_init().noticePaidTill()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1470 |
if ($show_notice && $show_ct_notice_trial ==1 && $value==1 && (is_network_admin() || is_admin()) && $ct_data['moderate_ip'] == 0) {
|
1471 |
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&cp_mode=antispam\" target=\"_blank\"><b>premium version</b></a>") . '</h3></div>';
|
1472 |
$show_notice = false;
|
1473 |
}
|
1474 |
|
1475 |
+
//Renew notice from ct_admin_init().noticePaidTill()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1476 |
if ($show_notice && $show_ct_notice_renew == 1 && $value==1 && (is_network_admin() || is_admin()) && $ct_data['moderate_ip'] != 1) {
|
1477 |
$button_html = "<a href=\"http://cleantalk.org/my/bill/recharge?utm_source=wp-backend&utm_medium=cpc&utm_campaign=WP%20backend%20renew$user_token&cp_mode=antispam\" target=\"_blank\">" . '<input type="button" class="button button-primary" value="' . __('RENEW ANTI-SPAM', 'cleantalk') . '" />' . "</a>";
|
1478 |
echo '<div class="updated"><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&cp_mode=antispam\" target=\"_blank\"><b>" . __('next year', 'cleantalk') ."</b></a>") . '<br /><br />' . $button_html . '</h3></div>';
|
1479 |
$show_notice = false;
|
1480 |
}
|
1481 |
+
|
1482 |
+
//"Wrong access key" notice (if ct_update_option().METHOD_notice_validate_key returns a error)
|
1483 |
if ($show_notice && $show_ct_notice_online != '' && $value==1 && (is_network_admin() || is_admin()) && $ct_data['moderate_ip'] != 1) {
|
1484 |
if($show_ct_notice_online === 'N' && $value==1 && (is_network_admin() || (!defined('WP_ALLOW_MULTISITE')||defined('WP_ALLOW_MULTISITE')&&WP_ALLOW_MULTISITE==false) && is_admin()) && $ct_data['moderate_ip'] != 1){
|
1485 |
echo '<div class="error"><h3><b>';
|
1713 |
$app_server_error = true;
|
1714 |
$ct_data['testing_failed']=1;
|
1715 |
}
|
|
|
|
|
1716 |
|
1717 |
if ($key_valid) {
|
1718 |
// Removes cookie for server errors
|
1723 |
setcookie($ct_notice_online_label, (string) time(), strtotime("+14 days"), '/');
|
1724 |
}
|
1725 |
setcookie($ct_notice_trial_label, '0', strtotime("+$trial_notice_showtime minutes"), '/');
|
1726 |
+
|
1727 |
+
//Deleting update flag
|
1728 |
+
unset($ct_data['ct_show_notice_from_report']);
|
1729 |
+
|
1730 |
} else {
|
1731 |
setcookie($ct_notice_online_label, 'BAD_KEY', 0, '/');
|
1732 |
}
|
1733 |
+
|
1734 |
+
update_option('cleantalk_data', $ct_data);
|
1735 |
+
|
1736 |
return null;
|
1737 |
}
|
1738 |
|
inc/cleantalk-ajax.php
CHANGED
@@ -12,6 +12,8 @@ $cleantalk_ajax_actions_to_check[] = 'amoforms_submit'; //amoForms
|
|
12 |
|
13 |
//cleantalk_hooked_actions[] - array for POST 'actions' which were direct hooked.
|
14 |
|
|
|
|
|
15 |
/* MailChimp Premium*/
|
16 |
add_filter('mc4wp_form_errors', 'ct_ajax_hook', 1, 2);
|
17 |
|
@@ -134,7 +136,7 @@ function ct_validate_email_ajaxlogin($email=null, $is_ajax=true)
|
|
134 |
|
135 |
$ct_options = ct_get_options();
|
136 |
$ct_data = ct_get_data();
|
137 |
-
|
138 |
$email = is_null( $email ) ? $email : $_POST['email'];
|
139 |
$email=sanitize_email($email);
|
140 |
$is_good=true;
|
@@ -394,15 +396,18 @@ function ct_ajax_hook($message_obj = false, $additional = false)
|
|
394 |
$post_info = '';
|
395 |
|
396 |
|
397 |
-
$ct_base_call_result = ct_base_call(
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
|
|
|
|
|
|
406 |
$ct = $ct_base_call_result['ct'];
|
407 |
$ct_result = $ct_base_call_result['ct_result'];
|
408 |
if ($ct_result->allow == 0)
|
12 |
|
13 |
//cleantalk_hooked_actions[] - array for POST 'actions' which were direct hooked.
|
14 |
|
15 |
+
$cleantalk_hooked_actions[] = 'rwp_ajax_action_rating'; //Don't check Reviewer plugin
|
16 |
+
|
17 |
/* MailChimp Premium*/
|
18 |
add_filter('mc4wp_form_errors', 'ct_ajax_hook', 1, 2);
|
19 |
|
136 |
|
137 |
$ct_options = ct_get_options();
|
138 |
$ct_data = ct_get_data();
|
139 |
+
|
140 |
$email = is_null( $email ) ? $email : $_POST['email'];
|
141 |
$email=sanitize_email($email);
|
142 |
$is_good=true;
|
396 |
$post_info = '';
|
397 |
|
398 |
|
399 |
+
$ct_base_call_result = ct_base_call(
|
400 |
+
array(
|
401 |
+
'message' => $message,
|
402 |
+
'example' => null,
|
403 |
+
'sender_email' => $sender_email,
|
404 |
+
'sender_nickname' => $nickname,
|
405 |
+
'sender_info' => $sender_info,
|
406 |
+
'post_info'=> $post_info,
|
407 |
+
'checkjs' => $checkjs
|
408 |
+
)
|
409 |
+
);
|
410 |
+
|
411 |
$ct = $ct_base_call_result['ct'];
|
412 |
$ct_result = $ct_base_call_result['ct_result'];
|
413 |
if ($ct_result->allow == 0)
|
inc/cleantalk-common.php
CHANGED
@@ -19,6 +19,9 @@ $ct_comment_done = false;
|
|
19 |
// Comment already proccessed
|
20 |
$ct_signup_done = false;
|
21 |
|
|
|
|
|
|
|
22 |
// Default value for JS test
|
23 |
$ct_checkjs_def = 0;
|
24 |
|
@@ -158,11 +161,13 @@ function ct_base_call($params = array()) {
|
|
158 |
if (array_key_exists('sender_info', $params)) {
|
159 |
$sender_info = array_merge($sender_info, (array) $params['sender_info']);
|
160 |
}
|
161 |
-
|
|
|
|
|
162 |
$sender_info = json_encode($sender_info);
|
163 |
if ($sender_info === false)
|
164 |
$sender_info = '';
|
165 |
-
|
166 |
$config = ct_get_server();
|
167 |
|
168 |
$ct = new Cleantalk();
|
@@ -735,7 +740,7 @@ function ct_get_fields_any($arr, $message=array(), $email=null, $nickname=null,
|
|
735 |
if(@array_key_exists($value,$_GET)||@array_key_exists($value,$_POST))
|
736 |
$contact = false;
|
737 |
} unset($value);
|
738 |
-
|
739 |
if(count($arr)){
|
740 |
foreach($arr as $key => $value){
|
741 |
if(!is_array($value) && !is_object($value) && @get_class($value)!='WP_User'){
|
@@ -752,7 +757,7 @@ function ct_get_fields_any($arr, $message=array(), $email=null, $nickname=null,
|
|
752 |
continue;
|
753 |
}
|
754 |
}unset($needle);
|
755 |
-
|
756 |
// Removes shortcodes to do better spam filtration on server side.
|
757 |
$value = strip_shortcodes($value);
|
758 |
|
@@ -788,6 +793,10 @@ function ct_get_fields_any($arr, $message=array(), $email=null, $nickname=null,
|
|
788 |
}
|
789 |
} unset($key, $value);
|
790 |
}
|
|
|
|
|
|
|
|
|
791 |
// Reset $message if we have a sign-up data
|
792 |
$skip_message_post = array(
|
793 |
'edd_action', // Easy Digital Downloads
|
@@ -877,37 +886,36 @@ function ct_get_fields_any_postdata($arr, $message=array()){
|
|
877 |
|
878 |
$ct_check_post_result=false;
|
879 |
|
880 |
-
function ct_check_array_keys_loop($key)
|
881 |
-
|
882 |
global $ct_check_post_result;
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
|
|
890 |
}
|
891 |
}
|
892 |
|
893 |
-
function ct_check_array_keys($arr)
|
894 |
-
|
895 |
global $ct_check_post_result;
|
|
|
896 |
if(!is_array($arr))
|
897 |
-
{
|
898 |
return $ct_check_post_result;
|
899 |
-
|
900 |
-
foreach($arr as $key=>$value)
|
901 |
-
|
902 |
if(!is_array($value))
|
903 |
-
{
|
904 |
ct_check_array_keys_loop($key);
|
905 |
-
}
|
906 |
else
|
907 |
-
{
|
908 |
ct_check_array_keys($value);
|
909 |
-
|
910 |
}
|
|
|
911 |
return $ct_check_post_result;
|
912 |
}
|
913 |
|
19 |
// Comment already proccessed
|
20 |
$ct_signup_done = false;
|
21 |
|
22 |
+
//Contains registration error
|
23 |
+
$ct_registration_error_comment = false;
|
24 |
+
|
25 |
// Default value for JS test
|
26 |
$ct_checkjs_def = 0;
|
27 |
|
161 |
if (array_key_exists('sender_info', $params)) {
|
162 |
$sender_info = array_merge($sender_info, (array) $params['sender_info']);
|
163 |
}
|
164 |
+
|
165 |
+
$sender_info['page_hits'] = (isset($_SESSION['ct_page_hits']) ? $_SESSION['ct_page_hits'] : 0);
|
166 |
+
|
167 |
$sender_info = json_encode($sender_info);
|
168 |
if ($sender_info === false)
|
169 |
$sender_info = '';
|
170 |
+
|
171 |
$config = ct_get_server();
|
172 |
|
173 |
$ct = new Cleantalk();
|
740 |
if(@array_key_exists($value,$_GET)||@array_key_exists($value,$_POST))
|
741 |
$contact = false;
|
742 |
} unset($value);
|
743 |
+
|
744 |
if(count($arr)){
|
745 |
foreach($arr as $key => $value){
|
746 |
if(!is_array($value) && !is_object($value) && @get_class($value)!='WP_User'){
|
757 |
continue;
|
758 |
}
|
759 |
}unset($needle);
|
760 |
+
|
761 |
// Removes shortcodes to do better spam filtration on server side.
|
762 |
$value = strip_shortcodes($value);
|
763 |
|
793 |
}
|
794 |
} unset($key, $value);
|
795 |
}
|
796 |
+
|
797 |
+
// Deleting repeats values
|
798 |
+
$message = array_unique($message);
|
799 |
+
|
800 |
// Reset $message if we have a sign-up data
|
801 |
$skip_message_post = array(
|
802 |
'edd_action', // Easy Digital Downloads
|
886 |
|
887 |
$ct_check_post_result=false;
|
888 |
|
889 |
+
function ct_check_array_keys_loop($key){
|
890 |
+
|
891 |
global $ct_check_post_result;
|
892 |
+
|
893 |
+
$strict = Array('members_search_submit');
|
894 |
+
|
895 |
+
for($i=0;$i<sizeof($strict);$i++){
|
896 |
+
|
897 |
+
if(stripos($key,$strict[$i])!== false)
|
898 |
+
$ct_check_post_result = true;
|
899 |
+
|
900 |
}
|
901 |
}
|
902 |
|
903 |
+
function ct_check_array_keys($arr){
|
904 |
+
|
905 |
global $ct_check_post_result;
|
906 |
+
|
907 |
if(!is_array($arr))
|
|
|
908 |
return $ct_check_post_result;
|
909 |
+
|
910 |
+
foreach($arr as $key=>$value){
|
911 |
+
|
912 |
if(!is_array($value))
|
|
|
913 |
ct_check_array_keys_loop($key);
|
|
|
914 |
else
|
|
|
915 |
ct_check_array_keys($value);
|
916 |
+
|
917 |
}
|
918 |
+
|
919 |
return $ct_check_post_result;
|
920 |
}
|
921 |
|
inc/cleantalk-public.php
CHANGED
@@ -49,7 +49,7 @@ function ct_init() {
|
|
49 |
die();
|
50 |
}
|
51 |
|
52 |
-
if(isset($ct_options['general_postdata_test']) && $ct_options['general_postdata_test'] == 1
|
53 |
{
|
54 |
$ct_general_postdata_test = @intval($ct_options['general_postdata_test']);
|
55 |
//hook for Anonymous Post
|
@@ -149,6 +149,7 @@ function ct_init() {
|
|
149 |
if(class_exists('BuddyPress')){
|
150 |
add_action('bp_before_registration_submit_buttons','ct_register_form',1);
|
151 |
add_filter('bp_signup_validate', 'ct_registration_errors',1);
|
|
|
152 |
add_action('messages_message_before_save','ct_bp_private_msg_check', 1);
|
153 |
}
|
154 |
|
@@ -216,6 +217,7 @@ function ct_init() {
|
|
216 |
//
|
217 |
if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)) {
|
218 |
add_action('wp_footer', 'ct_footer_add_cookie', 1);
|
|
|
219 |
}
|
220 |
|
221 |
if ($ct_options['protect_logged_in'] != 1 && is_user_logged_in()) {
|
@@ -226,12 +228,11 @@ function ct_init() {
|
|
226 |
if (ct_is_user_enable()) {
|
227 |
ct_cookies_test();
|
228 |
|
229 |
-
if (isset($ct_options['general_contact_forms_test']) && $ct_options['general_contact_forms_test'] == 1 && !isset($_POST['comment_post_ID']) && !isset($_GET['for']))
|
230 |
$ct_check_post_result=false;
|
231 |
ct_contact_form_validate();
|
232 |
}
|
233 |
-
if(isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST' && $ct_general_postdata_test==1 && !is_admin()
|
234 |
-
{
|
235 |
$ct_check_post_result=false;
|
236 |
ct_contact_form_validate_postdata();
|
237 |
}
|
@@ -628,6 +629,14 @@ function ct_footer_add_cookie() {
|
|
628 |
return null;
|
629 |
}
|
630 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
631 |
/**
|
632 |
* Adds hidden filed to define avaialbility of client's JavaScript
|
633 |
* @param bool $random_key switch on generation random key for every page load
|
@@ -696,7 +705,7 @@ function ct_add_mouse_tracking($return_string = false){
|
|
696 |
ctSetCookie("ct_timezone", "0");
|
697 |
|
698 |
setTimeout(function(){
|
699 |
-
ctSetCookie("ct_timezone", d.getTimezoneOffset()/60);
|
700 |
},1000);
|
701 |
|
702 |
//Stop observing function
|
@@ -802,9 +811,8 @@ function ct_is_user_enable() {
|
|
802 |
function ct_frm_entries_footer_scripts($fields, $form) {
|
803 |
global $ct_options, $ct_checkjs_frm;
|
804 |
|
805 |
-
if ($ct_options['contact_forms_test'] == 0)
|
806 |
return false;
|
807 |
-
}
|
808 |
|
809 |
$ct_checkjs_key = ct_get_checkjs_value();
|
810 |
$ct_frm_base_name = 'form_';
|
@@ -812,24 +820,20 @@ function ct_frm_entries_footer_scripts($fields, $form) {
|
|
812 |
|
813 |
ct_setup_page_timer();
|
814 |
|
815 |
-
|
816 |
-
|
817 |
-
input.setAttribute(
|
818 |
-
input.setAttribute(
|
819 |
-
input.setAttribute("value", "<?php echo $ct_checkjs_key; ?>");
|
820 |
|
821 |
for (i = 0; i < document.forms.length; i++) {
|
822 |
-
if (document.forms[i].id && document.forms[i].id.search(
|
823 |
document.forms[i].appendChild(input);
|
824 |
}
|
825 |
-
}
|
826 |
-
|
827 |
$js_code = ct_add_hidden_fields(true, 'ct_checkjs', true, true);
|
828 |
$js_code = strip_tags($js_code); // Removing <script> tag
|
829 |
-
|
830 |
-
?>
|
831 |
-
<?php echo $js_code; ?>
|
832 |
-
<?php
|
833 |
}
|
834 |
|
835 |
/**
|
@@ -1546,7 +1550,7 @@ function ct_test_registration($nickname, $email, $ip){
|
|
1546 |
* @return array with errors
|
1547 |
*/
|
1548 |
function ct_registration_errors($errors, $sanitized_user_login = null, $user_email = null) {
|
1549 |
-
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;
|
1550 |
|
1551 |
$ct_options=ct_get_options();
|
1552 |
$ct_data=ct_get_data();
|
@@ -1616,7 +1620,7 @@ function ct_registration_errors($errors, $sanitized_user_login = null, $user_ema
|
|
1616 |
//First key down timestamp
|
1617 |
$first_key_press_timestamp = isset($_COOKIE['ct_fkp_timestamp']) ? $_COOKIE['ct_fkp_timestamp'] : 0;
|
1618 |
$page_set_timestamp = (isset($_COOKIE['ct_ps_timestamp']) ? $_COOKIE['ct_ps_timestamp'] : 0);
|
1619 |
-
|
1620 |
$sender_info['mouse_cursor_positions'] = $pointer_data;
|
1621 |
$sender_info['js_timezone'] = $js_timezone;
|
1622 |
$sender_info['key_press_timestamp'] = $first_key_press_timestamp;
|
@@ -1673,26 +1677,55 @@ function ct_registration_errors($errors, $sanitized_user_login = null, $user_ema
|
|
1673 |
|
1674 |
// Restart submit form counter for failed requests
|
1675 |
$_SESSION[$ct_formtime_label] = time();
|
1676 |
-
|
1677 |
if ($buddypress === true) {
|
1678 |
$bp->signup->errors['signup_username'] = $ct_result->comment;
|
1679 |
-
}
|
1680 |
-
|
1681 |
-
|
1682 |
-
|
1683 |
}
|
|
|
|
|
|
|
1684 |
} else {
|
1685 |
if ($ct_result->id !== null) {
|
1686 |
$_SESSION[$ct_session_request_id_label] = $ct_result->id;
|
1687 |
$_SESSION[$ct_session_register_ok_label] = $ct_result->id;
|
1688 |
}
|
1689 |
}
|
1690 |
-
|
1691 |
ct_add_event($ct_result->allow);
|
1692 |
|
1693 |
return $errors;
|
1694 |
}
|
1695 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1696 |
/**
|
1697 |
* Set user meta
|
1698 |
* @return null
|
@@ -2341,10 +2374,10 @@ function ct_s2member_registration_test() {
|
|
2341 |
*/
|
2342 |
function ct_contact_form_validate () {
|
2343 |
global $pagenow,$cleantalk_executed, $cleantalk_url_exclusions,$ct_options, $ct_data, $ct_checkjs_frm;
|
2344 |
-
|
2345 |
$ct_options = ct_get_options();
|
2346 |
$ct_data = ct_get_data();
|
2347 |
-
|
2348 |
if($cleantalk_executed)
|
2349 |
{
|
2350 |
return null;
|
@@ -2383,11 +2416,12 @@ function ct_contact_form_validate () {
|
|
2383 |
isset($_POST[$ct_checkjs_frm]) && (@intval($ct_options['contact_forms_test']) == 1) ||// Formidable forms
|
2384 |
isset($_POST['comment_post_ID']) || // The comment form
|
2385 |
isset($_GET['for']) ||
|
2386 |
-
(isset($_POST['log']
|
2387 |
-
(isset($_POST['_wpcf7']
|
2388 |
-
(isset($_POST['hash']
|
2389 |
isset($_POST['gform_submit']) || //Gravity form
|
2390 |
-
(isset($_POST['wc_reset_password']
|
|
|
2391 |
(isset($_POST['ccf_form']) && intval($_POST['ccf_form']) == 1)
|
2392 |
) {
|
2393 |
return null;
|
@@ -2559,21 +2593,16 @@ function ct_contact_form_validate_postdata () {
|
|
2559 |
$ct_data = ct_get_data();
|
2560 |
|
2561 |
if($cleantalk_executed)
|
2562 |
-
{
|
2563 |
return null;
|
2564 |
-
|
2565 |
if ((defined( 'DOING_AJAX' ) && DOING_AJAX))
|
2566 |
-
{
|
2567 |
return null;
|
2568 |
-
|
2569 |
if(isset($cleantalk_url_exclusions))
|
2570 |
-
{
|
2571 |
$ct_cnt=sizeof($cleantalk_url_exclusions);
|
2572 |
-
}
|
2573 |
else
|
2574 |
-
{
|
2575 |
$ct_cnt=0;
|
2576 |
-
|
2577 |
//@header("CtExclusions: ".$ct_cnt);
|
2578 |
cleantalk_debug("CtExclusions", $ct_cnt);
|
2579 |
|
49 |
die();
|
50 |
}
|
51 |
|
52 |
+
if(isset($ct_options['general_postdata_test']) && $ct_options['general_postdata_test'] == 1 && !@isset($_POST['ct_checkjs_cf7']))
|
53 |
{
|
54 |
$ct_general_postdata_test = @intval($ct_options['general_postdata_test']);
|
55 |
//hook for Anonymous Post
|
149 |
if(class_exists('BuddyPress')){
|
150 |
add_action('bp_before_registration_submit_buttons','ct_register_form',1);
|
151 |
add_filter('bp_signup_validate', 'ct_registration_errors',1);
|
152 |
+
add_filter('bp_signup_validate', 'ct_check_registration_erros', 999999);
|
153 |
add_action('messages_message_before_save','ct_bp_private_msg_check', 1);
|
154 |
}
|
155 |
|
217 |
//
|
218 |
if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)) {
|
219 |
add_action('wp_footer', 'ct_footer_add_cookie', 1);
|
220 |
+
add_action('wp_footer', 'ct_page_count', 1);
|
221 |
}
|
222 |
|
223 |
if ($ct_options['protect_logged_in'] != 1 && is_user_logged_in()) {
|
228 |
if (ct_is_user_enable()) {
|
229 |
ct_cookies_test();
|
230 |
|
231 |
+
if (isset($ct_options['general_contact_forms_test']) && $ct_options['general_contact_forms_test'] == 1 && !isset($_POST['comment_post_ID']) && !isset($_GET['for'])){
|
232 |
$ct_check_post_result=false;
|
233 |
ct_contact_form_validate();
|
234 |
}
|
235 |
+
if(isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST' && $ct_general_postdata_test==1 && !is_admin() && !@isset($_POST['ct_checkjs_cf7'])){
|
|
|
236 |
$ct_check_post_result=false;
|
237 |
ct_contact_form_validate_postdata();
|
238 |
}
|
629 |
return null;
|
630 |
}
|
631 |
|
632 |
+
function ct_page_count(){
|
633 |
+
|
634 |
+
ct_init_session();
|
635 |
+
|
636 |
+
$_SESSION['ct_page_hits'] = (!isset($_SESSION['ct_page_hits']) ? 1 : $_SESSION['ct_page_hits'] + 1);
|
637 |
+
|
638 |
+
}
|
639 |
+
|
640 |
/**
|
641 |
* Adds hidden filed to define avaialbility of client's JavaScript
|
642 |
* @param bool $random_key switch on generation random key for every page load
|
705 |
ctSetCookie("ct_timezone", "0");
|
706 |
|
707 |
setTimeout(function(){
|
708 |
+
ctSetCookie("ct_timezone", d.getTimezoneOffset()/60*(-1));
|
709 |
},1000);
|
710 |
|
711 |
//Stop observing function
|
811 |
function ct_frm_entries_footer_scripts($fields, $form) {
|
812 |
global $ct_options, $ct_checkjs_frm;
|
813 |
|
814 |
+
if ($ct_options['contact_forms_test'] == 0)
|
815 |
return false;
|
|
|
816 |
|
817 |
$ct_checkjs_key = ct_get_checkjs_value();
|
818 |
$ct_frm_base_name = 'form_';
|
820 |
|
821 |
ct_setup_page_timer();
|
822 |
|
823 |
+
echo "var input = document.createElement('input');
|
824 |
+
input.setAttribute('type', 'hidden');
|
825 |
+
input.setAttribute('name', '$ct_checkjs_frm');
|
826 |
+
input.setAttribute('value', '$ct_checkjs_key');
|
|
|
827 |
|
828 |
for (i = 0; i < document.forms.length; i++) {
|
829 |
+
if (document.forms[i].id && document.forms[i].id.search('$ct_frm_name') != -1) {
|
830 |
document.forms[i].appendChild(input);
|
831 |
}
|
832 |
+
}";
|
833 |
+
|
834 |
$js_code = ct_add_hidden_fields(true, 'ct_checkjs', true, true);
|
835 |
$js_code = strip_tags($js_code); // Removing <script> tag
|
836 |
+
echo $js_code;
|
|
|
|
|
|
|
837 |
}
|
838 |
|
839 |
/**
|
1550 |
* @return array with errors
|
1551 |
*/
|
1552 |
function ct_registration_errors($errors, $sanitized_user_login = null, $user_email = null) {
|
1553 |
+
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, $ct_registration_error_comment;
|
1554 |
|
1555 |
$ct_options=ct_get_options();
|
1556 |
$ct_data=ct_get_data();
|
1620 |
//First key down timestamp
|
1621 |
$first_key_press_timestamp = isset($_COOKIE['ct_fkp_timestamp']) ? $_COOKIE['ct_fkp_timestamp'] : 0;
|
1622 |
$page_set_timestamp = (isset($_COOKIE['ct_ps_timestamp']) ? $_COOKIE['ct_ps_timestamp'] : 0);
|
1623 |
+
|
1624 |
$sender_info['mouse_cursor_positions'] = $pointer_data;
|
1625 |
$sender_info['js_timezone'] = $js_timezone;
|
1626 |
$sender_info['key_press_timestamp'] = $first_key_press_timestamp;
|
1677 |
|
1678 |
// Restart submit form counter for failed requests
|
1679 |
$_SESSION[$ct_formtime_label] = time();
|
1680 |
+
|
1681 |
if ($buddypress === true) {
|
1682 |
$bp->signup->errors['signup_username'] = $ct_result->comment;
|
1683 |
+
}else{
|
1684 |
+
if(is_wp_error($errors))
|
1685 |
+
$errors->add('ct_error', $ct_result->comment);
|
1686 |
+
$ct_negative_comment = $ct_result->comment;
|
1687 |
}
|
1688 |
+
|
1689 |
+
$ct_registration_error_comment = $ct_result->comment;
|
1690 |
+
|
1691 |
} else {
|
1692 |
if ($ct_result->id !== null) {
|
1693 |
$_SESSION[$ct_session_request_id_label] = $ct_result->id;
|
1694 |
$_SESSION[$ct_session_register_ok_label] = $ct_result->id;
|
1695 |
}
|
1696 |
}
|
1697 |
+
|
1698 |
ct_add_event($ct_result->allow);
|
1699 |
|
1700 |
return $errors;
|
1701 |
}
|
1702 |
|
1703 |
+
/**
|
1704 |
+
* Checks registration error and set it if it was dropped
|
1705 |
+
* @return errors
|
1706 |
+
*/
|
1707 |
+
function ct_check_registration_erros($errors, $sanitized_user_login = null, $user_email = null) {
|
1708 |
+
global $bp, $ct_registration_error_comment;
|
1709 |
+
|
1710 |
+
if($ct_registration_error_comment){
|
1711 |
+
|
1712 |
+
if(isset($bp))
|
1713 |
+
if(method_exists($bp, 'signup'))
|
1714 |
+
if(method_exists($bp->signup, 'errors'))
|
1715 |
+
if(isset($bp->signup->errors['signup_username']))
|
1716 |
+
if($bp->signup->errors['signup_username'] != $ct_registration_error_comment)
|
1717 |
+
$bp->signup->errors['signup_username'] = $ct_registration_error_comment;
|
1718 |
+
|
1719 |
+
if(isset($errors))
|
1720 |
+
if(method_exists($errors, 'errors'))
|
1721 |
+
if(isset($errors->errors['ct_error']))
|
1722 |
+
if($errors->errors['ct_error'][0] != $ct_registration_error_comment)
|
1723 |
+
$errors->add('ct_error', $ct_registration_error_comment);
|
1724 |
+
|
1725 |
+
}
|
1726 |
+
return $errors;
|
1727 |
+
}
|
1728 |
+
|
1729 |
/**
|
1730 |
* Set user meta
|
1731 |
* @return null
|
2374 |
*/
|
2375 |
function ct_contact_form_validate () {
|
2376 |
global $pagenow,$cleantalk_executed, $cleantalk_url_exclusions,$ct_options, $ct_data, $ct_checkjs_frm;
|
2377 |
+
|
2378 |
$ct_options = ct_get_options();
|
2379 |
$ct_data = ct_get_data();
|
2380 |
+
|
2381 |
if($cleantalk_executed)
|
2382 |
{
|
2383 |
return null;
|
2416 |
isset($_POST[$ct_checkjs_frm]) && (@intval($ct_options['contact_forms_test']) == 1) ||// Formidable forms
|
2417 |
isset($_POST['comment_post_ID']) || // The comment form
|
2418 |
isset($_GET['for']) ||
|
2419 |
+
(isset($_POST['log'], $_POST['pwd'])) || //WooCommerce Sensei login form fix
|
2420 |
+
(isset($_POST['_wpcf7'], $_POST['_wpcf7_version'], $_POST['_wpcf7_locale'])) || //CF7 fix)
|
2421 |
+
(isset($_POST['hash'], $_POST['device_unique_id'], $_POST['device_name'])) ||//Mobile Assistant Connector fix
|
2422 |
isset($_POST['gform_submit']) || //Gravity form
|
2423 |
+
(isset($_POST['wc_reset_password'], $_POST['_wpnonce'], $_POST['_wp_http_referer'])) || //WooCommerce recovery password form
|
2424 |
+
(isset($_POST['woocommerce-login-nonce'], $_POST['login'], $_POST['password'], $_POST['_wp_http_referer'])) || //WooCommerce login form
|
2425 |
(isset($_POST['ccf_form']) && intval($_POST['ccf_form']) == 1)
|
2426 |
) {
|
2427 |
return null;
|
2593 |
$ct_data = ct_get_data();
|
2594 |
|
2595 |
if($cleantalk_executed)
|
|
|
2596 |
return null;
|
2597 |
+
|
2598 |
if ((defined( 'DOING_AJAX' ) && DOING_AJAX))
|
|
|
2599 |
return null;
|
2600 |
+
|
2601 |
if(isset($cleantalk_url_exclusions))
|
|
|
2602 |
$ct_cnt=sizeof($cleantalk_url_exclusions);
|
|
|
2603 |
else
|
|
|
2604 |
$ct_cnt=0;
|
2605 |
+
|
2606 |
//@header("CtExclusions: ".$ct_cnt);
|
2607 |
cleantalk_debug("CtExclusions", $ct_cnt);
|
2608 |
|
inc/cleantalk-users.php
CHANGED
@@ -1,12 +1,19 @@
|
|
1 |
<?php
|
2 |
add_action('admin_menu', 'ct_add_users_menu');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
-
function ct_add_users_menu()
|
5 |
-
|
6 |
if(current_user_can('activate_plugins'))
|
7 |
-
{
|
8 |
add_users_page( __("Check for spam", 'cleantalk'), __("Check for spam", 'cleantalk'), 'read', 'ct_check_users', 'ct_show_users_page');
|
9 |
-
|
10 |
}
|
11 |
|
12 |
function ct_show_users_page()
|
@@ -224,16 +231,12 @@ $cnt_spam1=$r[0]['cnt'];
|
|
224 |
<?php
|
225 |
}
|
226 |
|
227 |
-
add_action('admin_print_footer_scripts','ct_add_users_button');
|
228 |
function ct_add_users_button()
|
229 |
{
|
230 |
global $cleantalk_plugin_version;
|
231 |
|
232 |
}
|
233 |
|
234 |
-
|
235 |
-
add_action( 'wp_ajax_ajax_check_users', 'ct_ajax_check_users' );
|
236 |
-
|
237 |
function ct_ajax_check_users()
|
238 |
{
|
239 |
global $ct_options,$ct_ip_penalty_days;
|
@@ -374,7 +377,6 @@ function ct_ajax_check_users()
|
|
374 |
die;
|
375 |
}
|
376 |
|
377 |
-
add_action( 'wp_ajax_ajax_info_users', 'ct_ajax_info_users' );
|
378 |
function ct_ajax_info_users($direct_call = false)
|
379 |
{
|
380 |
if (!$direct_call) {
|
@@ -411,7 +413,6 @@ function ct_ajax_info_users($direct_call = false)
|
|
411 |
return null;
|
412 |
}
|
413 |
|
414 |
-
add_action( 'wp_ajax_ajax_insert_users', 'ct_ajax_insert_users' );
|
415 |
function ct_ajax_insert_users()
|
416 |
{
|
417 |
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
@@ -466,7 +467,6 @@ function ct_ajax_insert_users()
|
|
466 |
die();
|
467 |
}
|
468 |
|
469 |
-
add_action( 'wp_ajax_ajax_delete_checked_users', 'ct_ajax_delete_checked_users' );
|
470 |
function ct_ajax_delete_checked_users()
|
471 |
{
|
472 |
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
@@ -477,7 +477,6 @@ function ct_ajax_delete_checked_users()
|
|
477 |
die();
|
478 |
}
|
479 |
|
480 |
-
add_action( 'wp_ajax_ajax_delete_all_users', 'ct_ajax_delete_all_users' );
|
481 |
function ct_ajax_delete_all_users()
|
482 |
{
|
483 |
global $wpdb;
|
@@ -504,7 +503,6 @@ function ct_ajax_delete_all_users()
|
|
504 |
die();
|
505 |
}
|
506 |
|
507 |
-
add_action( 'wp_ajax_ajax_clear_users', 'ct_ajax_clear_users' );
|
508 |
function ct_ajax_clear_users()
|
509 |
{
|
510 |
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
@@ -516,7 +514,6 @@ function ct_ajax_clear_users()
|
|
516 |
/**
|
517 |
* Admin action 'user_unapproved_to_approved' - Approve user, delete from the deleting list
|
518 |
*/
|
519 |
-
add_action( 'wp_ajax_ajax_ct_approve_user', 'ct_usercheck_approve_user' );
|
520 |
function ct_usercheck_approve_user() {
|
521 |
|
522 |
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
1 |
<?php
|
2 |
add_action('admin_menu', 'ct_add_users_menu');
|
3 |
+
add_action('admin_print_footer_scripts','ct_add_users_button');
|
4 |
+
add_action( 'wp_ajax_ajax_check_users', 'ct_ajax_check_users' );
|
5 |
+
add_action( 'wp_ajax_ajax_info_users', 'ct_ajax_info_users' );
|
6 |
+
add_action( 'wp_ajax_ajax_insert_users', 'ct_ajax_insert_users' );
|
7 |
+
add_action( 'wp_ajax_ajax_delete_checked_users', 'ct_ajax_delete_checked_users' );
|
8 |
+
add_action( 'wp_ajax_ajax_delete_all_users', 'ct_ajax_delete_all_users' );
|
9 |
+
add_action( 'wp_ajax_ajax_clear_users', 'ct_ajax_clear_users' );
|
10 |
+
add_action( 'wp_ajax_ajax_ct_approve_user', 'ct_usercheck_approve_user' );
|
11 |
|
12 |
+
function ct_add_users_menu(){
|
13 |
+
|
14 |
if(current_user_can('activate_plugins'))
|
|
|
15 |
add_users_page( __("Check for spam", 'cleantalk'), __("Check for spam", 'cleantalk'), 'read', 'ct_check_users', 'ct_show_users_page');
|
16 |
+
|
17 |
}
|
18 |
|
19 |
function ct_show_users_page()
|
231 |
<?php
|
232 |
}
|
233 |
|
|
|
234 |
function ct_add_users_button()
|
235 |
{
|
236 |
global $cleantalk_plugin_version;
|
237 |
|
238 |
}
|
239 |
|
|
|
|
|
|
|
240 |
function ct_ajax_check_users()
|
241 |
{
|
242 |
global $ct_options,$ct_ip_penalty_days;
|
377 |
die;
|
378 |
}
|
379 |
|
|
|
380 |
function ct_ajax_info_users($direct_call = false)
|
381 |
{
|
382 |
if (!$direct_call) {
|
413 |
return null;
|
414 |
}
|
415 |
|
|
|
416 |
function ct_ajax_insert_users()
|
417 |
{
|
418 |
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
467 |
die();
|
468 |
}
|
469 |
|
|
|
470 |
function ct_ajax_delete_checked_users()
|
471 |
{
|
472 |
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
477 |
die();
|
478 |
}
|
479 |
|
|
|
480 |
function ct_ajax_delete_all_users()
|
481 |
{
|
482 |
global $wpdb;
|
503 |
die();
|
504 |
}
|
505 |
|
|
|
506 |
function ct_ajax_clear_users()
|
507 |
{
|
508 |
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
514 |
/**
|
515 |
* Admin action 'user_unapproved_to_approved' - Approve user, delete from the deleting list
|
516 |
*/
|
|
|
517 |
function ct_usercheck_approve_user() {
|
518 |
|
519 |
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
inc/cleantalk.class.php
CHANGED
@@ -688,7 +688,7 @@ class Cleantalk {
|
|
688 |
$context = stream_context_create($opts);
|
689 |
$result = @file_get_contents($url, false, $context);
|
690 |
}
|
691 |
-
}
|
692 |
|
693 |
if (!$result || !cleantalk_is_JSON($result)) {
|
694 |
$response = null;
|
@@ -729,7 +729,7 @@ class Cleantalk {
|
|
729 |
*/
|
730 |
private function httpRequest($msg) {
|
731 |
$result = false;
|
732 |
-
|
733 |
if($msg->method_name != 'send_feedback'){
|
734 |
$ct_tmp = apache_request_headers();
|
735 |
|
@@ -1092,13 +1092,14 @@ class Cleantalk {
|
|
1092 |
|
1093 |
if(!function_exists('getAutoKey'))
|
1094 |
{
|
1095 |
-
function getAutoKey($email, $host, $platform)
|
1096 |
{
|
1097 |
$request=Array();
|
1098 |
$request['method_name'] = 'get_api_key';
|
1099 |
$request['email'] = $email;
|
1100 |
$request['website'] = $host;
|
1101 |
$request['platform'] = $platform;
|
|
|
1102 |
$url='https://api.cleantalk.org';
|
1103 |
$result=sendRawRequest($url,$request);
|
1104 |
return $result;
|
@@ -1122,6 +1123,29 @@ function noticePaidTill($api_key)
|
|
1122 |
return $result;
|
1123 |
}
|
1124 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1125 |
/**
|
1126 |
* Function sends raw request to API server
|
1127 |
*
|
688 |
$context = stream_context_create($opts);
|
689 |
$result = @file_get_contents($url, false, $context);
|
690 |
}
|
691 |
+
}
|
692 |
|
693 |
if (!$result || !cleantalk_is_JSON($result)) {
|
694 |
$response = null;
|
729 |
*/
|
730 |
private function httpRequest($msg) {
|
731 |
$result = false;
|
732 |
+
|
733 |
if($msg->method_name != 'send_feedback'){
|
734 |
$ct_tmp = apache_request_headers();
|
735 |
|
1092 |
|
1093 |
if(!function_exists('getAutoKey'))
|
1094 |
{
|
1095 |
+
function getAutoKey($email, $host, $platform, $timezone = null)
|
1096 |
{
|
1097 |
$request=Array();
|
1098 |
$request['method_name'] = 'get_api_key';
|
1099 |
$request['email'] = $email;
|
1100 |
$request['website'] = $host;
|
1101 |
$request['platform'] = $platform;
|
1102 |
+
$request['timezone'] = $timezone;
|
1103 |
$url='https://api.cleantalk.org';
|
1104 |
$result=sendRawRequest($url,$request);
|
1105 |
return $result;
|
1123 |
return $result;
|
1124 |
}
|
1125 |
|
1126 |
+
/**
|
1127 |
+
* Function gets spam report
|
1128 |
+
*
|
1129 |
+
* @param string website host
|
1130 |
+
* @param integer report days
|
1131 |
+
* @return type
|
1132 |
+
*/
|
1133 |
+
|
1134 |
+
if(!function_exists('getAntispamReport'))
|
1135 |
+
{
|
1136 |
+
function getAntispamReport($host, $period = 1)
|
1137 |
+
{
|
1138 |
+
$url='https://api.cleantalk.org';
|
1139 |
+
$request=Array(
|
1140 |
+
'method_name' => 'get_antispam_report',
|
1141 |
+
'hostname' => $host,
|
1142 |
+
'period' => $period
|
1143 |
+
);
|
1144 |
+
$result=sendRawRequest($url,$request);
|
1145 |
+
return $result;
|
1146 |
+
}
|
1147 |
+
}
|
1148 |
+
|
1149 |
/**
|
1150 |
* Function sends raw request to API server
|
1151 |
*
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: znaeff, shagimuratov, serge00, sartemd174
|
|
3 |
Tags: spam, anti-spam, antispam, anti spam, bbpress, buddypress, captcha, capcha, captha, catcha, cf7 spam, comments, contact form spam, signup, spammers, spammy, woocommerce, wordpress spam, subscription, gravity spam, jetpack, bots, contact form 7, contact form, registrations, ninja, Fast Secure Contact, Gravity forms, formidable, mailchimp, s2member, protection, protect, email, plugin, contact, recaptcha, google captcha, google recaptcha, blacklist, prevent spam comments, wordpress, User Frontend, bulk delete, bulk remove, widget, review, firewall, cleantalk, mailpoet, profile builder, comment spam, registration spam, spam comments, comment moderation, spam bots, block spam, signup spam, spam blocker, spam filter, user registration spam,pingback,trackback, anti-spam plugin, varnish, amp, spam free, userpro,honeypot,puzzle,quiz,survey,poll,security, amo forms, caldera forms, visual form builder, contact form clean and simple
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 4.7.1
|
6 |
-
Stable tag: 5.
|
7 |
License: GPLv2
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -386,6 +386,9 @@ To close the notice please save the plugin settings again or it will be closed a
|
|
386 |
= I'm using PHP 4.2 version and i'm getting errors related with JSON. Why does it happens? =
|
387 |
СleanTalk is no longer supports PHP lower than 5.2 version because the support code have incompatibility with PHP 7 version. Please, upgrade your PHP. If you couldn't perform that, let us know about it via support ticket here: https://cleantalk.org/my/support.
|
388 |
|
|
|
|
|
|
|
389 |
== Other notes ==
|
390 |
|
391 |
= Troubleshooting Guide =
|
@@ -483,10 +486,17 @@ WordPress 3.0 at least. PHP 5 with CURL or file_get_contents() function and enab
|
|
483 |
1. The Dashboard with a map of most spam active countries per your account.
|
484 |
|
485 |
== Changelog ==
|
486 |
-
= 5.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
487 |
* Minor fixes
|
488 |
|
489 |
-
= 5.56 January 19
|
490 |
* Integrations: MailChimp Premium, Profile Press.
|
491 |
* Changes comments flow.
|
492 |
* FireWall updater fix.
|
@@ -1225,11 +1235,17 @@ WordPress 3.0 at least. PHP 5 with CURL or file_get_contents() function and enab
|
|
1225 |
* First version
|
1226 |
|
1227 |
== Upgrade Notice ==
|
1228 |
-
|
1229 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1230 |
* Minor fixes
|
1231 |
|
1232 |
-
= 5.56 January 19
|
1233 |
* Integrations: MailChimp Premium, Profile Press.
|
1234 |
* Changes comments flow.
|
1235 |
* FireWall updater fix.
|
3 |
Tags: spam, anti-spam, antispam, anti spam, bbpress, buddypress, captcha, capcha, captha, catcha, cf7 spam, comments, contact form spam, signup, spammers, spammy, woocommerce, wordpress spam, subscription, gravity spam, jetpack, bots, contact form 7, contact form, registrations, ninja, Fast Secure Contact, Gravity forms, formidable, mailchimp, s2member, protection, protect, email, plugin, contact, recaptcha, google captcha, google recaptcha, blacklist, prevent spam comments, wordpress, User Frontend, bulk delete, bulk remove, widget, review, firewall, cleantalk, mailpoet, profile builder, comment spam, registration spam, spam comments, comment moderation, spam bots, block spam, signup spam, spam blocker, spam filter, user registration spam,pingback,trackback, anti-spam plugin, varnish, amp, spam free, userpro,honeypot,puzzle,quiz,survey,poll,security, amo forms, caldera forms, visual form builder, contact form clean and simple
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 4.7.1
|
6 |
+
Stable tag: 5.57
|
7 |
License: GPLv2
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
386 |
= I'm using PHP 4.2 version and i'm getting errors related with JSON. Why does it happens? =
|
387 |
СleanTalk is no longer supports PHP lower than 5.2 version because the support code have incompatibility with PHP 7 version. Please, upgrade your PHP. If you couldn't perform that, let us know about it via support ticket here: https://cleantalk.org/my/support.
|
388 |
|
389 |
+
= Should I change anything in the plugin's settings or in my CleanTalk Control Panel when I switch my website from HTTP to HTTPS or vice versa?
|
390 |
+
No. You don't need to change anything in the plugin's settings or in your CleanTalk Control Panel. The plugin will work regardless of the protocol.
|
391 |
+
|
392 |
== Other notes ==
|
393 |
|
394 |
= Troubleshooting Guide =
|
486 |
1. The Dashboard with a map of most spam active countries per your account.
|
487 |
|
488 |
== Changelog ==
|
489 |
+
= 5.57 February 8 2017 =
|
490 |
+
* Setting page changes.
|
491 |
+
* Bug fixes for WooCommerce.
|
492 |
+
* SpamFireWall filters only GET requests.
|
493 |
+
* Optimization.
|
494 |
+
* Minor and major fixes.
|
495 |
+
|
496 |
+
= 5.56.1 January 25 2017 =
|
497 |
* Minor fixes
|
498 |
|
499 |
+
= 5.56 January 19 2017 =
|
500 |
* Integrations: MailChimp Premium, Profile Press.
|
501 |
* Changes comments flow.
|
502 |
* FireWall updater fix.
|
1235 |
* First version
|
1236 |
|
1237 |
== Upgrade Notice ==
|
1238 |
+
= 5.57 February 8 2017 =
|
1239 |
+
* Setting page changes.
|
1240 |
+
* Bug fixes for WooCommerce.
|
1241 |
+
* SpamFireWall filters only GET requests.
|
1242 |
+
* Optimization.
|
1243 |
+
* Minor and major fixes.
|
1244 |
+
|
1245 |
+
= 5.56.1 January 25 2017 =
|
1246 |
* Minor fixes
|
1247 |
|
1248 |
+
= 5.56 January 19 2017 =
|
1249 |
* Integrations: MailChimp Premium, Profile Press.
|
1250 |
* Changes comments flow.
|
1251 |
* FireWall updater fix.
|
templates/daily_report.php
ADDED
@@ -0,0 +1,181 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$msg_template = <<<EOT
|
3 |
+
<html>
|
4 |
+
<head>
|
5 |
+
%s
|
6 |
+
</head>
|
7 |
+
<body>
|
8 |
+
<center>
|
9 |
+
<div>
|
10 |
+
<h1>%s</h1>
|
11 |
+
</div>
|
12 |
+
<div>
|
13 |
+
%s
|
14 |
+
</div>
|
15 |
+
<br />
|
16 |
+
<div>
|
17 |
+
<a class='ct_settings_button' href='%s/wp-admin/%s.php?page=cleantalk&from_report=1' target="_blank">%s</a>.
|
18 |
+
</div>
|
19 |
+
<span>%s</span>
|
20 |
+
<br />
|
21 |
+
<br />
|
22 |
+
<div style="color: #666;">
|
23 |
+
The report is provided by <a href="https://wordpress.org/plugins/cleantalk-spam-protect/">%s</a>.
|
24 |
+
</div>
|
25 |
+
</center>
|
26 |
+
</body>
|
27 |
+
</html>
|
28 |
+
EOT;
|
29 |
+
|
30 |
+
$style = <<<EOT
|
31 |
+
<meta charset="utf-8"> <!-- utf-8 works for most cases -->
|
32 |
+
<meta name="viewport" content="width=device-width"> <!-- Forcing initial-scale shouldn't be necessary -->
|
33 |
+
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <!-- Use the latest (edge) version of IE rendering engine -->
|
34 |
+
<title></title> <!-- The title tag shows in email notifications, like Android 4.4. -->
|
35 |
+
|
36 |
+
<!-- Web Font / @font-face : BEGIN -->
|
37 |
+
<!-- NOTE: If web fonts are not required, lines 9 - 26 can be safely removed. -->
|
38 |
+
|
39 |
+
<!-- Desktop Outlook chokes on web font references and defaults to Times New Roman, so we force a safe fallback font. -->
|
40 |
+
<!--[if mso]>
|
41 |
+
<style>
|
42 |
+
* {
|
43 |
+
font-family: sans-serif !important;
|
44 |
+
}
|
45 |
+
</style>
|
46 |
+
<![endif]-->
|
47 |
+
|
48 |
+
<!-- All other clients get the webfont reference; some will render the font and others will silently fail to the fallbacks. More on that here: http://stylecampaign.com/blog/2015/02/webfont-support-in-email/ -->
|
49 |
+
<!--[if !mso]><!-->
|
50 |
+
<!-- insert web font reference, eg: <link href='https://fonts.googleapis.com/css?family=Roboto:400,700' rel='stylesheet' type='text/css'> -->
|
51 |
+
<!--<![endif]-->
|
52 |
+
|
53 |
+
<!-- Web Font / @font-face : END -->
|
54 |
+
|
55 |
+
<!-- CSS Reset -->
|
56 |
+
<style>
|
57 |
+
/* What it does: Remove spaces around the email design added by some email clients. */
|
58 |
+
/* Beware: It can remove the padding / margin and add a background color to the compose a reply window. */
|
59 |
+
html,
|
60 |
+
body {
|
61 |
+
margin: 0 auto !important;
|
62 |
+
padding: 0 !important;
|
63 |
+
height: 100% !important;
|
64 |
+
width: 100% !important;
|
65 |
+
}
|
66 |
+
|
67 |
+
/* What it does: Stops email clients resizing small text. */
|
68 |
+
* {
|
69 |
+
-ms-text-size-adjust: 100%;
|
70 |
+
-webkit-text-size-adjust: 100%;
|
71 |
+
}
|
72 |
+
|
73 |
+
/* What is does: Centers email on Android 4.4 */
|
74 |
+
div[style*="margin: 16px 0"] {
|
75 |
+
margin:0 !important;
|
76 |
+
}
|
77 |
+
|
78 |
+
/* What it does: Stops Outlook from adding extra spacing to tables. */
|
79 |
+
table,
|
80 |
+
td {
|
81 |
+
mso-table-lspace: 0pt !important;
|
82 |
+
mso-table-rspace: 0pt !important;
|
83 |
+
}
|
84 |
+
|
85 |
+
/* What it does: Fixes webkit padding issue. Fix for Yahoo mail table alignment bug. Applies table-layout to the first 2 tables then removes for anything nested deeper. */
|
86 |
+
table {
|
87 |
+
border-spacing: 0 !important;
|
88 |
+
border-collapse: collapse !important;
|
89 |
+
table-layout: fixed !important;
|
90 |
+
margin: 0 auto !important;
|
91 |
+
}
|
92 |
+
table table table {
|
93 |
+
table-layout: auto;
|
94 |
+
}
|
95 |
+
|
96 |
+
td {
|
97 |
+
border: 1px solid #ccc;
|
98 |
+
text-align: center;
|
99 |
+
}
|
100 |
+
|
101 |
+
/* What it does: Uses a better rendering method when resizing images in IE. */
|
102 |
+
img {
|
103 |
+
-ms-interpolation-mode:bicubic;
|
104 |
+
}
|
105 |
+
|
106 |
+
/* What it does: A work-around for iOS meddling in triggered links. */
|
107 |
+
.mobile-link--footer a,
|
108 |
+
a[x-apple-data-detectors] {
|
109 |
+
color:inherit !important;
|
110 |
+
text-decoration: underline !important;
|
111 |
+
}
|
112 |
+
.ct_settings_button{
|
113 |
+
display: inline-block;
|
114 |
+
margin: 20px;
|
115 |
+
padding: 12px 24px;
|
116 |
+
border: 1px solid #216298;
|
117 |
+
border-radius: 8px;
|
118 |
+
background: #35a0f7;
|
119 |
+
background: -webkit-gradient(linear, left top, left bottom, from(#35a0f7), to(#216298));
|
120 |
+
background: -moz-linear-gradient(top, #35a0f7, #216298);
|
121 |
+
background: linear-gradient(to bottom, #35a0f7, #216298);
|
122 |
+
text-shadow: #153e5f 1px 1px 1px;
|
123 |
+
font: normal normal bold 16px verdana;
|
124 |
+
color: #ffffff;
|
125 |
+
text-decoration: none;
|
126 |
+
}
|
127 |
+
.ct_type{
|
128 |
+
font-weight: 300;
|
129 |
+
text-align: center;
|
130 |
+
border: 1px solid #ccc;
|
131 |
+
padding: 3px;
|
132 |
+
}
|
133 |
+
.ct_hat{
|
134 |
+
border: 2px solid #ccc;
|
135 |
+
padding: 5px;
|
136 |
+
}
|
137 |
+
.allowed_hat{
|
138 |
+
color: green;
|
139 |
+
}
|
140 |
+
.blocked_hat{
|
141 |
+
color: red;
|
142 |
+
}
|
143 |
+
|
144 |
+
</style>
|
145 |
+
EOT;
|
146 |
+
|
147 |
+
$events = <<<EOT
|
148 |
+
<table width="400px" border="1" padding="1">
|
149 |
+
<thead>
|
150 |
+
<tr>
|
151 |
+
<th class="ct_hat">
|
152 |
+
Type
|
153 |
+
</th>
|
154 |
+
<th class="ct_hat allowed_hat">
|
155 |
+
Allowed
|
156 |
+
</th>
|
157 |
+
<th class="ct_hat blocked_hat">
|
158 |
+
Blocked
|
159 |
+
</th>
|
160 |
+
</tr>
|
161 |
+
</thead>
|
162 |
+
<tbody>
|
163 |
+
<tr>
|
164 |
+
<td class="ct_type">Comments</td>
|
165 |
+
<td>%u</td>
|
166 |
+
<td>%u</td>
|
167 |
+
</tr>
|
168 |
+
<tr>
|
169 |
+
<td class="ct_type">Registrations</td>
|
170 |
+
<td>%u</td>
|
171 |
+
<td>%u</td>
|
172 |
+
</tr>
|
173 |
+
<tr>
|
174 |
+
<td class="ct_type">Contacts</td>
|
175 |
+
<td>%u</td>
|
176 |
+
<td>%u</td>
|
177 |
+
</tr>
|
178 |
+
</tbody>
|
179 |
+
</table>
|
180 |
+
EOT;
|
181 |
+
?>
|