Spam protection, AntiSpam, FireWall by CleanTalk - Version 5.43.2

Version Description

June 30 2016 = * Optimized anti-spam code for AJAX based contact forms. * Fixed CSS layout of counters in Admin bar (issue with layout in IE11).

Download this release

Release Info

Developer shagimuratov
Plugin Icon 128x128 Spam protection, AntiSpam, FireWall by CleanTalk
Version 5.43.2
Comparing to
See all releases

Code changes from version 5.43.1 to 5.43.2

Files changed (56) hide show
  1. cleantalk.php +3 -3
  2. inc/cleantalk-admin.php +1 -1
  3. inc/cleantalk-ajax.php +11 -3
  4. inc/cleantalk-common.php +5 -0
  5. inc/cleantalk-public.php +1 -1
  6. readme.txt +22 -6
  7. trunk/cleantalk.php +0 -578
  8. trunk/i18n/cleantalk-da_DK.mo +0 -0
  9. trunk/i18n/cleantalk-de_DE.mo +0 -0
  10. trunk/i18n/cleantalk-en_US.mo +0 -0
  11. trunk/i18n/cleantalk-es_ES.mo +0 -0
  12. trunk/i18n/cleantalk-fr_FR.mo +0 -0
  13. trunk/i18n/cleantalk-it_IT.mo +0 -0
  14. trunk/i18n/cleantalk-pl_PL.mo +0 -0
  15. trunk/i18n/cleantalk-pt_PT.mo +0 -0
  16. trunk/i18n/cleantalk-ru_RU.mo +0 -0
  17. trunk/i18n/cleantalk.pot +0 -115
  18. trunk/inc/JSON.php +0 -804
  19. trunk/inc/cleantalk-admin.js +0 -66
  20. trunk/inc/cleantalk-admin.php +0 -1440
  21. trunk/inc/cleantalk-admin_old.php +0 -1219
  22. trunk/inc/cleantalk-ajax.php +0 -501
  23. trunk/inc/cleantalk-ajax_old.php +0 -775
  24. trunk/inc/cleantalk-comments-checkspam.js +0 -244
  25. trunk/inc/cleantalk-comments-editscreen.js +0 -17
  26. trunk/inc/cleantalk-comments.php +0 -477
  27. trunk/inc/cleantalk-common.php +0 -851
  28. trunk/inc/cleantalk-public.php +0 -2141
  29. trunk/inc/cleantalk-rel.js +0 -11
  30. trunk/inc/cleantalk-sfw.class.php +0 -157
  31. trunk/inc/cleantalk-sfw.php +0 -42
  32. trunk/inc/cleantalk-users-checkspam.js +0 -267
  33. trunk/inc/cleantalk-users-editscreen.js +0 -17
  34. trunk/inc/cleantalk-users.php +0 -455
  35. trunk/inc/cleantalk-widget.php +0 -87
  36. trunk/inc/cleantalk.class.php +0 -1196
  37. trunk/inc/cleantalk_api.php +0 -127
  38. trunk/inc/cleantalk_external.js +0 -34
  39. trunk/inc/cleantalk_nocache.js +0 -216
  40. trunk/inc/images/logo.png +0 -0
  41. trunk/inc/images/logo_color.png +0 -0
  42. trunk/inc/images/logo_small.png +0 -0
  43. trunk/inc/images/logo_small1.png +0 -0
  44. trunk/inc/images/no.png +0 -0
  45. trunk/inc/images/no_gray.png +0 -0
  46. trunk/inc/images/preloader.gif +0 -0
  47. trunk/inc/images/yes.png +0 -0
  48. trunk/inc/images/yes2.png +0 -0
  49. trunk/inc/images/yes_gray.png +0 -0
  50. trunk/inc/sfw_die_page.html +0 -65
  51. trunk/readme.txt +0 -1508
  52. trunk/screenshot-1.png +0 -0
  53. trunk/screenshot-2.png +0 -0
  54. trunk/screenshot-3.png +0 -0
  55. trunk/screenshot-4.png +0 -0
  56. trunk/screenshot-5.png +0 -0
cleantalk.php CHANGED
@@ -3,12 +3,12 @@
3
  Plugin Name: Spam Protection by CleanTalk
4
  Plugin URI: http://cleantalk.org
5
  Description: Max power, all-in-one, captcha less, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms. Formerly Anti-Spam by CleanTalk.
6
- Version: 5.43.1
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
10
- $cleantalk_plugin_version='5.43.1';
11
- $ct_agent_version = 'wordpress-5431';
12
  $cleantalk_executed=false;
13
  $ct_sfw_updated = false;
14
 
3
  Plugin Name: Spam Protection by CleanTalk
4
  Plugin URI: http://cleantalk.org
5
  Description: Max power, all-in-one, captcha less, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms. Formerly Anti-Spam by CleanTalk.
6
+ Version: 5.43.2
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
10
+ $cleantalk_plugin_version='5.43.2';
11
+ $ct_agent_version = 'wordpress-5432';
12
  $cleantalk_executed=false;
13
  $ct_sfw_updated = false;
14
 
inc/cleantalk-admin.php CHANGED
@@ -419,7 +419,7 @@ function ct_add_admin_menu( $wp_admin_bar ) {
419
 
420
  $args = array(
421
  'id' => 'ct_parent_node',
422
- 'title' => '<img src="' . plugin_dir_url(__FILE__) . 'images/logo_small1.png" alt="" height="" style="margin-top:9px;" /><div style="margin: auto 7px;" class="ab-item alignright"><div class="ab-label" id="ct_stats"><span style="color: white;" title="'.__('All / Allowed / Blocked submissions. The number of submissions is being counted since ', 'cleantalk').' '.$user_counter['since'].'">'.$user_counter_str.'</span></div></div>' //You could change widget string here by simply deleting variables
423
  );
424
  $wp_admin_bar->add_node( $args );
425
 
419
 
420
  $args = array(
421
  'id' => 'ct_parent_node',
422
+ 'title' => '<img src="' . plugin_dir_url(__FILE__) . 'images/logo_small1.png" alt="" height="" style="margin-top:9px; float: left;" /><div style="margin: auto 7px;" class="ab-item alignright"><div class="ab-label" id="ct_stats"><span style="color: white;" title="'.__('All / Allowed / Blocked submissions. The number of submissions is being counted since ', 'cleantalk').' '.$user_counter['since'].'">'.$user_counter_str.'</span></div></div>' //You could change widget string here by simply deleting variables
423
  );
424
  $wp_admin_bar->add_node( $args );
425
 
inc/cleantalk-ajax.php CHANGED
@@ -105,6 +105,8 @@ add_action( 'template_redirect', 'ct_ajax_hook',1 );
105
  /* hooks for ninja forms ajax*/
106
  add_action( 'wp_ajax_nopriv_ninja_forms_ajax_submit', 'ct_ajax_hook',1 );
107
  add_action( 'wp_ajax_ninja_forms_ajax_submit', 'ct_ajax_hook',1 );
 
 
108
  $cleantalk_hooked_actions[]='ninja_forms_ajax_submit';
109
 
110
  function ct_validate_email_ajaxlogin($email=null, $is_ajax=true)
@@ -281,7 +283,7 @@ function ct_ajax_hook()
281
  $nickname=null;
282
  $contact = true;
283
  $subject = '';
284
-
285
  //
286
  // Skip test if Custom contact forms is disabled.
287
  //
@@ -331,11 +333,17 @@ function ct_ajax_hook()
331
  $tmp=$_POST['target'];
332
  $_POST['target']=1;
333
  }
334
-
335
- ct_get_fields_any($sender_email, $message, $nickname, $subject, $contact, $_POST);
 
 
 
 
 
336
  if ($subject != '') {
337
  $message = array_merge(array('subject' => $subject), $message);
338
  }
 
339
  $message = json_encode($message);
340
 
341
  if(isset($_POST['cscf']['confirm-email']))
105
  /* hooks for ninja forms ajax*/
106
  add_action( 'wp_ajax_nopriv_ninja_forms_ajax_submit', 'ct_ajax_hook',1 );
107
  add_action( 'wp_ajax_ninja_forms_ajax_submit', 'ct_ajax_hook',1 );
108
+
109
+ add_action( 'ninja_forms_process', 'ct_ajax_hook',1 );
110
  $cleantalk_hooked_actions[]='ninja_forms_ajax_submit';
111
 
112
  function ct_validate_email_ajaxlogin($email=null, $is_ajax=true)
283
  $nickname=null;
284
  $contact = true;
285
  $subject = '';
286
+
287
  //
288
  // Skip test if Custom contact forms is disabled.
289
  //
333
  $tmp=$_POST['target'];
334
  $_POST['target']=1;
335
  }
336
+
337
+ $temp = ct_get_fields_any2($_POST);
338
+
339
+ $sender_email = ($temp['email'] ? $temp['email'] : '');
340
+ $nickname = ($temp['nickname'] ? $temp['nickname'] : '');
341
+ $subject = ($temp['subject'] ? $temp['subject'] : '');
342
+ $message = ($temp['message'] ? $temp['message'] : array());
343
  if ($subject != '') {
344
  $message = array_merge(array('subject' => $subject), $message);
345
  }
346
+
347
  $message = json_encode($message);
348
 
349
  if(isset($_POST['cscf']['confirm-email']))
inc/cleantalk-common.php CHANGED
@@ -718,6 +718,11 @@ function ct_get_fields_any2($arr, $message=array(), $email=NULL, $nickname=NULL,
718
  {
719
  if(!is_array($value)&&!is_object($value)&&@get_class($value)!='WP_User')
720
  {
 
 
 
 
 
721
  if (in_array($key, $skip_params) && $key!=0 && $key!='' || preg_match("/^ct_checkjs/", $key)) {
722
  $contact = false;
723
  }
718
  {
719
  if(!is_array($value)&&!is_object($value)&&@get_class($value)!='WP_User')
720
  {
721
+ //
722
+ // Removes shortcodes to do better spam filtration on server side.
723
+ //
724
+ $value = strip_shortcodes($value);
725
+
726
  if (in_array($key, $skip_params) && $key!=0 && $key!='' || preg_match("/^ct_checkjs/", $key)) {
727
  $contact = false;
728
  }
inc/cleantalk-public.php CHANGED
@@ -170,7 +170,7 @@ function ct_init() {
170
  add_filter('gform_get_form_filter', 'ct_gforms_hidden_field', 10, 2);
171
  add_filter('gform_entry_is_spam', 'ct_gforms_spam_test', 1, 3);
172
  }
173
-
174
  //
175
  // Load JS code to website footer
176
  //
170
  add_filter('gform_get_form_filter', 'ct_gforms_hidden_field', 10, 2);
171
  add_filter('gform_entry_is_spam', 'ct_gforms_spam_test', 1, 3);
172
  }
173
+
174
  //
175
  // Load JS code to website footer
176
  //
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: znaeff, shagimuratov, serge00
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, booking, order, subscription, gravity spam, jetpack, bots, contact form 7, contact form, registrations, ninja, Fast Secure Contact, Gravity forms, formidable, mailchimp, s2member, protection, protect, email, akismet, plugin, contact, recaptcha, google captcha, google recaptcha, math, security, login, blacklist, prevent spam comments, wordpress, User Frontend, bulk delete, bulk remove, cloudflare, widget, review, auth forms, firewall, ddos, 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
4
  Requires at least: 3.0
5
  Tested up to: 4.5.3
6
- Stable tag: 5.43.1
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -45,7 +45,7 @@ Anti-spam by CleanTalk filters spam subscriptions for MailPoet, MailChimp, Popup
45
  The plugin blocks spam emails via any theme (built-in ones included) contact forms. The plugin filters spam emails silently (without any error notices on WordPress frontend) in AJAX forms as well.
46
 
47
  = bbPress spam filter =
48
- Protects everything about bbPress: registrations, topics, replies.
49
 
50
  = Other spam filters =
51
  * WordPress Landing Pages.
@@ -69,10 +69,10 @@ Automatically block comments and registrations from the countries you have set a
69
  You can block comments which contain "stop words" to enhance spam filtering and messages with obscene words blocking. You can add particular words or phrases.
70
 
71
  = Private black lists for anti-spam service =
72
- Automatically block comments and registrations from your private black IP/email address list. This option helps to strengthen the protection from a manual spam or block unwanted comments from users.
73
 
74
  = Private black list for SpamFireWall =
75
- It allows you to add individual IP addresses and subnets to SpamFireWall. It blocks the attacks from IP addresses which are not included in the SFW base yet. This option can help to block HTTP/HTTPS DDoS, SQL, brute force attacks and any others that made it through the HTTP/HTTPS.
76
 
77
  = Low false/positive rate =
78
  This plugin uses multiple anti-spam tests to filter spam bots having as low false/positive rate as possible. Multiple anti-spam tests help to avoid false/positive blocks of the real website visitors even if one of the tests failed.
@@ -224,6 +224,8 @@ Yes, it is. The plugin doesn't block mobile visitors as well as desktop website
224
  Spam comments are being moved to SPAM folder by default or you can set the option to ban spam comments silently.
225
 
226
  = How does the plugin stop spam? =
 
 
227
  The plugin uses several simple tests to stop spammers:
228
 
229
  1. **JavaScript anti-spam test.** 99% of spam bots don't have full JavaScript functions support. So, the plugin has the code which can be run by normal visitor and can't be run by the spam bot.
@@ -467,6 +469,13 @@ WordPress 3.0 at least. PHP 5 with CURL or file_get_contents() function and enab
467
  1. CleanTalk works faster than most of other anti-spam plugins.
468
 
469
  == Changelog ==
 
 
 
 
 
 
 
470
  = 5.43.1 June 23 2016 =
471
  * Added agent version in requests to test a connection between the website and servers.
472
  * Fixed issue with PHP notices in cleantalk-admin.php.
@@ -968,7 +977,7 @@ WordPress 3.0 at least. PHP 5 with CURL or file_get_contents() function and enab
968
 
969
  = 2.5.18 2013-11-01 =
970
  * Fixed: Bug with selection of the last comments for post
971
- * New: Antispam protection for Formiadble feedback forms
972
  * New: Automatic deletion of outdated spam comments
973
  * New: On/Off option for comments spam filtration
974
  * Tested with WordPress 3.7.1
@@ -1077,6 +1086,13 @@ WordPress 3.0 at least. PHP 5 with CURL or file_get_contents() function and enab
1077
  * First version
1078
 
1079
  == Upgrade Notice ==
 
 
 
 
 
 
 
1080
  = 5.43.1 June 23 2016 =
1081
  * Added agent version in requests to test a connection between the website and servers.
1082
  * Fixed issue with PHP notices in cleantalk-admin.php.
@@ -1528,7 +1544,7 @@ Minor changes in spam filtration logic.
1528
 
1529
  = 2.5.18 2013-11-01 =
1530
  * Fixed: Bug with selection of the last comments for post
1531
- * New: Antispam protection for Formiadble feedback forms
1532
  * New: Automatic deletion of outdated spam comments
1533
  * New: On/Off option for comments spam filtration
1534
  * Tested with WordPress 3.7.1
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, booking, order, subscription, gravity spam, jetpack, bots, contact form 7, contact form, registrations, ninja, Fast Secure Contact, Gravity forms, formidable, mailchimp, s2member, protection, protect, email, akismet, plugin, contact, recaptcha, google captcha, google recaptcha, math, security, login, blacklist, prevent spam comments, wordpress, User Frontend, bulk delete, bulk remove, cloudflare, widget, review, auth forms, firewall, ddos, 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
4
  Requires at least: 3.0
5
  Tested up to: 4.5.3
6
+ Stable tag: 5.43.2
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
45
  The plugin blocks spam emails via any theme (built-in ones included) contact forms. The plugin filters spam emails silently (without any error notices on WordPress frontend) in AJAX forms as well.
46
 
47
  = bbPress spam filter =
48
+ Protects everything about bbPress: logins, registrations, forums, topics and replies.
49
 
50
  = Other spam filters =
51
  * WordPress Landing Pages.
69
  You can block comments which contain "stop words" to enhance spam filtering and messages with obscene words blocking. You can add particular words or phrases.
70
 
71
  = Private black lists for anti-spam service =
72
+ Automatically block comments and registrations from your private black IP/email address list. This option helps to strengthen the protection from a manual spam or block unwanted comments from users. You can add not only the certain IP addresses, but also a separate subnet to your personal black list.
73
 
74
  = Private black list for SpamFireWall =
75
+ It allows you to add individual IP addresses and subnets to SpamFireWall. It blocks the attacks from IP addresses which are not included in the SFW base yet. This option can help to block HTTP/HTTPS DDoS, SQL, brute force attacks and any others that made it through the HTTP/HTTPS. You can add not only the certain IP addresses, but also a separate subnet to your personal black list.
76
 
77
  = Low false/positive rate =
78
  This plugin uses multiple anti-spam tests to filter spam bots having as low false/positive rate as possible. Multiple anti-spam tests help to avoid false/positive blocks of the real website visitors even if one of the tests failed.
224
  Spam comments are being moved to SPAM folder by default or you can set the option to ban spam comments silently.
225
 
226
  = How does the plugin stop spam? =
227
+ Please, note — administrator's actions are NOT being checked.
228
+
229
  The plugin uses several simple tests to stop spammers:
230
 
231
  1. **JavaScript anti-spam test.** 99% of spam bots don't have full JavaScript functions support. So, the plugin has the code which can be run by normal visitor and can't be run by the spam bot.
469
  1. CleanTalk works faster than most of other anti-spam plugins.
470
 
471
  == Changelog ==
472
+ = 5.44 July 08 2016 =
473
+ * Optimized options getting code.
474
+
475
+ = 5.43.2 June 30 2016 =
476
+ * Optimized anti-spam code for AJAX based contact forms.
477
+ * Fixed CSS layout of counters in Admin bar (issue with layout in IE11).
478
+
479
  = 5.43.1 June 23 2016 =
480
  * Added agent version in requests to test a connection between the website and servers.
481
  * Fixed issue with PHP notices in cleantalk-admin.php.
977
 
978
  = 2.5.18 2013-11-01 =
979
  * Fixed: Bug with selection of the last comments for post
980
+ * New: Antispam protection for Formidable feedback forms
981
  * New: Automatic deletion of outdated spam comments
982
  * New: On/Off option for comments spam filtration
983
  * Tested with WordPress 3.7.1
1086
  * First version
1087
 
1088
  == Upgrade Notice ==
1089
+ = 5.44 July 08 2016 =
1090
+ * Optimized options getting code.
1091
+
1092
+ = 5.43.2 June 30 2016 =
1093
+ * Optimized anti-spam code for AJAX based contact forms.
1094
+ * Fixed CSS layout of counters in Admin bar (issue with layout in IE11).
1095
+
1096
  = 5.43.1 June 23 2016 =
1097
  * Added agent version in requests to test a connection between the website and servers.
1098
  * Fixed issue with PHP notices in cleantalk-admin.php.
1544
 
1545
  = 2.5.18 2013-11-01 =
1546
  * Fixed: Bug with selection of the last comments for post
1547
+ * New: Antispam protection for Formidable feedback forms
1548
  * New: Automatic deletion of outdated spam comments
1549
  * New: On/Off option for comments spam filtration
1550
  * Tested with WordPress 3.7.1
trunk/cleantalk.php DELETED
@@ -1,578 +0,0 @@
1
- <?php
2
- /*
3
- Plugin Name: Spam Protection by CleanTalk
4
- Plugin URI: http://cleantalk.org
5
- Description: Max power, all-in-one, captcha less, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms. Formerly Anti-Spam by CleanTalk.
6
- Version: 5.43.1
7
- Author: СleanTalk <welcome@cleantalk.org>
8
- Author URI: http://cleantalk.org
9
- */
10
- $cleantalk_plugin_version='5.43.1';
11
- $ct_agent_version = 'wordpress-5431';
12
- $cleantalk_executed=false;
13
- $ct_sfw_updated = false;
14
-
15
- $ct_redirects_label = 'ct_redirects';
16
-
17
- if(defined('CLEANTALK_AJAX_USE_BUFFER'))
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
- define('CLEANTALK_PLUGIN_DIR', plugin_dir_path(__FILE__));
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
- if(@stripos($_SERVER['REQUEST_URI'],'admin-ajax.php')!==false && sizeof($_POST)>0 && isset($_GET['action']) && $_GET['action']=='ninja_forms_ajax_submit')
43
- {
44
- $_POST['action']='ninja_forms_ajax_submit';
45
- }
46
-
47
- if(isset($ct_options['spam_firewall']))
48
- {
49
- $value = @intval($ct_options['spam_firewall']);
50
- }
51
- else
52
- {
53
- $value=0;
54
- }
55
-
56
- /*
57
- Turn off the SpamFireWall if current url in the exceptions list.
58
- */
59
- if ($value == 1 && isset($cleantalk_url_exclusions) && is_array($cleantalk_url_exclusions)) {
60
- foreach ($cleantalk_url_exclusions as $v) {
61
- if (stripos($_SERVER['REQUEST_URI'], $v) !== false) {
62
- $value = 0;
63
- break;
64
- }
65
- }
66
- }
67
-
68
- /*
69
- Turn off the SpamFireWall for WordPress core pages
70
- */
71
- $ct_wordpress_core_pages = array(
72
- '/wp-admin',
73
- '/feed'
74
- );
75
- if ($value == 1) {
76
- foreach ($ct_wordpress_core_pages as $v) {
77
- if (stripos($_SERVER['REQUEST_URI'], $v) !== false) {
78
- $value = 0;
79
- break;
80
- }
81
- }
82
- }
83
-
84
- if($value==1 && !is_admin() || $value==1 && defined( 'DOING_AJAX' ) && DOING_AJAX)
85
- {
86
- $is_sfw_check=true;
87
- $ip=cleantalk_get_ip();
88
-
89
- for($i=0;$i<sizeof($ip);$i++)
90
- {
91
- if(isset($_COOKIE['ct_sfw_pass_key']) && $_COOKIE['ct_sfw_pass_key']==md5($ip[$i].$ct_options['apikey']))
92
- {
93
- $is_sfw_check=false;
94
- if(isset($_COOKIE['ct_sfw_passed']))
95
- {
96
- if(isset($ct_data['sfw_log']))
97
- {
98
- $sfw_log=$ct_data['sfw_log'];
99
- }
100
- else
101
- {
102
- $sfw_log=array();
103
- $sfw_log[$ip[$i]]=Array();
104
- }
105
- $sfw_log[$ip[$i]]['allow']++;
106
- $ct_data['sfw_log'] = $sfw_log;
107
- update_option('cleantalk_data', $ct_data);
108
- @setcookie ('ct_sfw_passed', '0', 1, "/");
109
- }
110
- //@$ct_data['sfw_log'][cleantalk_get_ip()]['all']++;
111
- //update_option('cleantalk_data', $ct_data);
112
- }
113
- }
114
- if($is_sfw_check)
115
- {
116
- //include_once("cleantalk-sfw.php");
117
- include_once("inc/cleantalk-sfw.class.php");
118
- $sfw = new CleanTalkSFW();
119
- $sfw->cleantalk_get_real_ip();
120
- $sfw->check_ip();
121
- if($sfw->result)
122
- {
123
- $sfw->sfw_die();
124
- }
125
- }
126
-
127
- //cron start
128
- if(isset($ct_data['last_sfw_send']))
129
- {
130
- $last_sfw_send=$ct_data['last_sfw_send'];
131
- }
132
- else
133
- {
134
- $last_sfw_send=0;
135
- }
136
- if(time()-$last_sfw_send>3600)
137
- {
138
- ct_send_sfw_log();
139
- $ct_data['last_sfw_send']=time();
140
- update_option('cleantalk_data', $ct_data);
141
- }
142
- //cron end
143
- }
144
-
145
- if(isset($ct_options['check_external']))
146
- {
147
- if(@intval($ct_options['check_external'])==1)
148
- {
149
- $test_external_forms=true;
150
- }
151
- else
152
- {
153
- $test_external_forms=false;
154
- }
155
- }
156
- else
157
- {
158
- $test_external_forms=false;
159
- }
160
-
161
- // Activation/deactivation functions must be in main plugin file.
162
- // http://codex.wordpress.org/Function_Reference/register_activation_hook
163
- register_activation_hook( __FILE__, 'ct_activation' );
164
- register_deactivation_hook( __FILE__, 'ct_deactivation' );
165
-
166
- //
167
- // Redirect admin to plugin settings.
168
- //
169
- if(!defined('WP_ALLOW_MULTISITE') || defined('WP_ALLOW_MULTISITE') && WP_ALLOW_MULTISITE == false)
170
- {
171
- add_action('admin_init', 'ct_plugin_redirect');
172
- }
173
-
174
- // After plugin loaded - to load locale as described in manual
175
- add_action( 'ct_init', 'ct_plugin_loaded' );
176
- ct_plugin_loaded();
177
-
178
- if(isset($ct_options['use_ajax']))
179
- {
180
- $use_ajax = @intval($ct_options['use_ajax']);
181
- }
182
- else
183
- {
184
- $use_ajax=1;
185
- }
186
-
187
- if($use_ajax==1 &&
188
- stripos($_SERVER['REQUEST_URI'],'.xml')===false &&
189
- stripos($_SERVER['REQUEST_URI'],'.xsl')===false)
190
- {
191
- if($cleantalk_use_buffer)
192
- {
193
- add_action('wp_loaded', 'ct_add_nocache_script', 1);
194
- }
195
- if($cleantalk_use_footer_header)
196
- {
197
- add_action('wp_footer', 'ct_add_nocache_script_footer', 1);
198
- add_action('wp_head', 'ct_add_nocache_script_header', 1);
199
- }
200
- add_action( 'wp_ajax_nopriv_ct_get_cookie', 'ct_get_cookie',1 );
201
- add_action( 'wp_ajax_ct_get_cookie', 'ct_get_cookie',1 );
202
- }
203
-
204
-
205
- if(isset($ct_options['show_link']))
206
- {
207
- $value = @intval($ct_options['show_link']);
208
- }
209
- else
210
- {
211
- $value=0;
212
- }
213
- if($value==1)
214
- {
215
- add_action('comment_form_after', 'ct_show_comment_link');
216
- }
217
-
218
- if (is_admin()||is_network_admin())
219
- {
220
- require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-admin.php');
221
- if (!(defined( 'DOING_AJAX' ) && DOING_AJAX))
222
- {
223
- add_action('admin_init', 'ct_admin_init', 1);
224
- add_action('admin_menu', 'ct_admin_add_page');
225
- if(is_network_admin())
226
- {
227
- add_action('network_admin_menu', 'ct_admin_add_page');
228
- }
229
- add_action('admin_notices', 'cleantalk_admin_notice_message');
230
- }
231
- if (defined( 'DOING_AJAX' ) && DOING_AJAX||isset($_POST['cma-action']))
232
- {
233
- $cleantalk_hooked_actions=Array();
234
- require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
235
- require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-ajax.php');
236
- if(isset($_POST['action'])&&!in_array($_POST['action'],$cleantalk_hooked_actions)&&!isset($_COOKIE[LOGGED_IN_COOKIE]))
237
- {
238
- ct_ajax_hook();
239
- }
240
-
241
- //
242
- // Some of plugins to register a users use AJAX context.
243
- //
244
- add_filter('registration_errors', 'ct_registration_errors', 1, 3);
245
- add_action('user_register', 'ct_user_register');
246
-
247
- }
248
-
249
- add_action('admin_enqueue_scripts', 'ct_enqueue_scripts');
250
- if($pagenow=='edit-comments.php')
251
- {
252
- add_action('comment_unapproved_to_approvecomment', 'ct_comment_approved'); // param - comment object
253
- add_action('comment_unapproved_to_approved', 'ct_comment_approved'); // param - comment object
254
- add_action('comment_approved_to_unapproved', 'ct_comment_unapproved'); // param - comment object
255
- add_action('comment_unapproved_to_spam', 'ct_comment_spam'); // param - comment object
256
- add_action('comment_approved_to_spam', 'ct_comment_spam'); // param - comment object
257
- //add_filter('get_comment_text', 'ct_get_comment_text'); // param - current comment text
258
- add_filter('unspam_comment', 'ct_unspam_comment');
259
- }
260
- if($pagenow=='users.php')
261
- {
262
- add_action('delete_user', 'ct_delete_user');
263
- }
264
- if($pagenow=='plugins.php' || @strpos($_SERVER['REQUEST_URI'],'plugins.php')!==false)
265
- {
266
- add_filter('plugin_row_meta', 'ct_register_plugin_links', 10, 2);
267
- add_filter('plugin_action_links', 'ct_plugin_action_links', 10, 2);
268
- }
269
- add_action('updated_option', 'ct_update_option'); // param - option name, i.e. 'cleantalk_settings'
270
- }else{
271
- require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
272
-
273
- // Init action.
274
- add_action('init', 'ct_init_after_all', 100);
275
- add_action('plugins_loaded', 'ct_init', 1);
276
-
277
- // Hourly run hook
278
- add_action('ct_hourly_event_hook', 'ct_do_this_hourly');
279
-
280
- // Comments
281
- add_filter('preprocess_comment', 'ct_preprocess_comment', 1, 1); // param - comment data array
282
- add_filter('comment_text', 'ct_comment_text' );
283
-
284
- // Registrations
285
- add_action('register_form','ct_register_form');
286
- add_filter('registration_errors', 'ct_registration_errors', 1, 3);
287
- add_action('user_register', 'ct_user_register');
288
-
289
- // Multisite registrations
290
- add_action('signup_extra_fields','ct_register_form');
291
- add_filter('wpmu_validate_user_signup', 'ct_registration_errors_wpmu', 10, 3);
292
-
293
- // Login form - for notifications only
294
- add_filter('login_message', 'ct_login_message');
295
- }
296
- }
297
-
298
- /**
299
- * On activation, set a time, frequency and name of an action hook to be scheduled.
300
- */
301
- if (!function_exists ( 'ct_activation')) {
302
- function ct_activation() {
303
- wp_schedule_event(time(), 'hourly', 'ct_hourly_event_hook' );
304
- //wp_schedule_event(time(), 'hourly', 'ct_send_sfw_log' );
305
- wp_schedule_event(time(), 'daily', 'cleantalk_update_sfw' );
306
-
307
- cleantalk_update_sfw();
308
- add_option('ct_plugin_do_activation_redirect', true);
309
- }
310
- }
311
- /**
312
- * On deactivation, clear schedule.
313
- */
314
- if (!function_exists ( 'ct_deactivation')) {
315
- function ct_deactivation() {
316
- wp_clear_scheduled_hook( 'ct_hourly_event_hook' );
317
- @wp_clear_scheduled_hook( 'ct_send_sfw_log' );
318
- wp_clear_scheduled_hook( 'cleantalk_update_sfw' );
319
- }
320
- }
321
-
322
- /**
323
- * Redirects admin to plugin settings after activation.
324
- */
325
- function ct_plugin_redirect()
326
- {
327
- global $ct_redirects_label;
328
- if (get_option('ct_plugin_do_activation_redirect', false))
329
- {
330
- delete_option('ct_plugin_do_activation_redirect');
331
- if(!isset($_GET['activate-multi']) && !isset($_COOKIE[$ct_redirects_label]))
332
- {
333
- setcookie($ct_redirects_label, 1, null, '/');
334
- wp_redirect("options-general.php?page=cleantalk");
335
- }
336
- }
337
- }
338
-
339
- function ct_add_event($event_type)
340
- {
341
- global $ct_data,$cleantalk_executed;
342
-
343
- //
344
- // To migrate on the new version of ct_add_event().
345
- //
346
- switch ($event_type) {
347
- case '0': $event_type = 'no';break;
348
- case '1': $event_type = 'yes';break;
349
- }
350
-
351
- $ct_data = ct_get_data();
352
- $current_date=date('d M');
353
-
354
- //User counter
355
- if(!isset($ct_data['user_counter'])){
356
- $ct_data['user_counter']['accepted']=0;
357
- $ct_data['user_counter']['blocked']=0;
358
- $ct_data['user_counter']['since']=$current_date;
359
- }
360
-
361
- //Add 1 to counters
362
- if($event_type=='yes'){
363
- @$ct_data['user_counter']['accepted']++;
364
- }
365
- if($event_type=='no'){
366
- @$ct_data['user_counter']['blocked']++;
367
- }
368
-
369
- update_option('cleantalk_data', $ct_data);
370
- $cleantalk_executed=true;
371
- }
372
-
373
- /**
374
- * return new cookie value
375
- */
376
- function ct_get_cookie()
377
- {
378
- global $ct_checkjs_def;
379
- $ct_checkjs_key = ct_get_checkjs_value(true);
380
- print $ct_checkjs_key;
381
- die();
382
- }
383
-
384
- /**
385
- * adds nocache script
386
- */
387
- function ct_add_nocache_script()
388
- {
389
- ob_start('ct_inject_nocache_script');
390
- }
391
-
392
- function ct_add_nocache_script_footer()
393
- {
394
- if(strpos($_SERVER['REQUEST_URI'],'jm-ajax')===false)
395
- {
396
- global $test_external_forms, $cleantalk_plugin_version;
397
- print "<script async type='text/javascript' src='".plugins_url( '/inc/cleantalk_nocache.js' , __FILE__ )."?random=".$cleantalk_plugin_version."'></script>\n";
398
- if($test_external_forms)
399
- {
400
- print "\n<script type='text/javascript'>var ct_blog_home = '".get_home_url()."';</script>\n";
401
- print "<script async type='text/javascript' src='".plugins_url( '/inc/cleantalk_external.js' , __FILE__ )."?random=".$cleantalk_plugin_version."'></script>\n";
402
- }
403
- //print "<script async type='text/javascript' src='".plugins_url( '/inc/cleantalk-info.js' , __FILE__ )."?random=".$cleantalk_plugin_version."'></script>\n";
404
- }
405
- }
406
-
407
- /**
408
- * Function prepares values to manage JavaScript code
409
- * @return string
410
- */
411
- function ct_set_info_flag () {
412
- global $ct_options;
413
-
414
- $ct_options=ct_get_options();
415
-
416
- $result = 'false';
417
- if(@intval($ct_options['collect_details'])==1
418
- && @intval($ct_options['set_cookies']) == 1
419
- ) {
420
- $result = 'true';
421
- }
422
-
423
- $ct_info_flag = "var ct_info_flag=$result;\n";
424
-
425
- $result = 'true';
426
- if (@intval($ct_options['set_cookies']) == 0) {
427
- $result = 'false';
428
- }
429
-
430
- $ct_set_cookies_flag = "var ct_set_cookies_flag=$result;\n";
431
-
432
- return $ct_info_flag . $ct_set_cookies_flag;
433
- }
434
-
435
- function ct_add_nocache_script_header()
436
- {
437
- if(strpos($_SERVER['REQUEST_URI'],'jm-ajax')===false)
438
- {
439
- $ct_info_flag = ct_set_info_flag();
440
- print "\n<script type='text/javascript'>\nvar ct_ajaxurl = '".admin_url('admin-ajax.php')."';\n $ct_info_flag </script>\n";
441
- }
442
- }
443
-
444
- function ct_inject_nocache_script($html)
445
- {
446
- if(strpos($_SERVER['REQUEST_URI'],'jm-ajax')===false)
447
- {
448
- global $test_external_forms, $cleantalk_plugin_version, $ct_options;
449
-
450
- $ct_info_flag = ct_set_info_flag();
451
-
452
- if(!is_admin()&&stripos($html,"</body")!==false)
453
- {
454
- //$ct_replace.="\n<script type='text/javascript'>var ajaxurl = '".admin_url('admin-ajax.php')."';\n $ct_info_flag </script>\n";
455
- $ct_replace="<script async type='text/javascript' src='".plugins_url( '/inc/cleantalk_nocache.js' , __FILE__ )."?random=".$cleantalk_plugin_version."'></script>\n";
456
- if($test_external_forms)
457
- {
458
- $ct_replace.="\n<script type='text/javascript'>var ct_blog_home = '".get_home_url()."';</script>\n";
459
- $ct_replace.="<script async type='text/javascript' src='".plugins_url( '/inc/cleantalk_external.js' , __FILE__ )."?random=".$cleantalk_plugin_version."'></script>\n";
460
- }
461
-
462
- //$html=str_ireplace("</body",$ct_replace."</body",$html);
463
- $html=substr_replace($html,$ct_replace."</body",strripos($html,"</body"),6);
464
- }
465
- }
466
- return $html;
467
- }
468
- if(is_admin())
469
- {
470
- require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-comments.php');
471
- require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-users.php');
472
- }
473
- if(isset($_GET['ait-action'])&&$_GET['ait-action']=='register')
474
- {
475
- $tmp=$_POST['redirect_to'];
476
- unset($_POST['redirect_to']);
477
- ct_contact_form_validate();
478
- $_POST['redirect_to']=$tmp;
479
- }
480
-
481
- function ct_show_comment_link()
482
- {
483
- 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>";
484
- }
485
-
486
- add_action( 'right_now_content_table_end', 'my_add_counts_to_dashboard' );
487
-
488
- function cleantalk_update_sfw()
489
- {
490
- global $wpdb, $ct_sfw_updated;
491
-
492
- if(!function_exists('sendRawRequest'))
493
- {
494
- require_once('inc/cleantalk.class.php');
495
- }
496
- global $ct_options, $ct_data;
497
- if(isset($ct_options['spam_firewall']))
498
- {
499
- $value = @intval($ct_options['spam_firewall']);
500
- }
501
- else
502
- {
503
- $value=0;
504
- }
505
-
506
- if($value==1 && $ct_sfw_updated === false)
507
- {
508
- $data = Array( 'auth_key' => $ct_options['apikey'],
509
- 'method_name' => '2s_blacklists_db'
510
- );
511
-
512
- $result=sendRawRequest('https://api.cleantalk.org', $data);
513
- $result=json_decode($result, true);
514
- if(isset($result['data']))
515
- {
516
- $wpdb->query("drop table if exists `".$wpdb->base_prefix."cleantalk_sfw`;");
517
- $wpdb->query("CREATE TABLE IF NOT EXISTS `".$wpdb->base_prefix."cleantalk_sfw` (
518
- `network` int(11) unsigned NOT NULL,
519
- `mask` int(11) unsigned NOT NULL,
520
- INDEX ( `network` , `mask` )
521
- ) ENGINE = MYISAM ;");
522
- $result=$result['data'];
523
- $query="INSERT INTO `".$wpdb->base_prefix."cleantalk_sfw` VALUES ";
524
- //$wpdb->query("TRUNCATE TABLE `".$wpdb->base_prefix."cleantalk_sfw`;");
525
- for($i=0;$i<sizeof($result);$i++)
526
- {
527
- if($i==sizeof($result)-1)
528
- {
529
- $query.="(".$result[$i][0].",".$result[$i][1].");";
530
- }
531
- else
532
- {
533
- $query.="(".$result[$i][0].",".$result[$i][1]."), ";
534
- }
535
- }
536
- $wpdb->query($query);
537
- $ct_sfw_updated = true;
538
- }
539
- }
540
- }
541
-
542
- function cleantalk_get_ip()
543
- {
544
- $result=Array();
545
- if ( function_exists( 'apache_request_headers' ) )
546
- {
547
- $headers = apache_request_headers();
548
- }
549
- else
550
- {
551
- $headers = $_SERVER;
552
- }
553
- if ( array_key_exists( 'X-Forwarded-For', $headers ) )
554
- {
555
- $the_ip=explode(",", trim($headers['X-Forwarded-For']));
556
- $result[] = trim($the_ip[0]);
557
- }
558
- if ( array_key_exists( 'HTTP_X_FORWARDED_FOR', $headers ))
559
- {
560
- $the_ip=explode(",", trim($headers['HTTP_X_FORWARDED_FOR']));
561
- $result[] = trim($the_ip[0]);
562
- }
563
- $result[] = filter_var( $_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 );
564
-
565
- if(isset($_GET['sfw_test_ip']))
566
- {
567
- $result[]=$_GET['sfw_test_ip'];
568
- }
569
- return $result;
570
- }
571
-
572
- function ct_send_sfw_log()
573
- {
574
- include_once("inc/cleantalk-sfw.class.php");
575
- $sfw = new CleanTalkSFW();
576
- $sfw->send_logs();
577
- }
578
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/i18n/cleantalk-da_DK.mo DELETED
Binary file
trunk/i18n/cleantalk-de_DE.mo DELETED
Binary file
trunk/i18n/cleantalk-en_US.mo DELETED
Binary file
trunk/i18n/cleantalk-es_ES.mo DELETED
Binary file
trunk/i18n/cleantalk-fr_FR.mo DELETED
Binary file
trunk/i18n/cleantalk-it_IT.mo DELETED
Binary file
trunk/i18n/cleantalk-pl_PL.mo DELETED
Binary file
trunk/i18n/cleantalk-pt_PT.mo DELETED
Binary file
trunk/i18n/cleantalk-ru_RU.mo DELETED
Binary file
trunk/i18n/cleantalk.pot DELETED
@@ -1,115 +0,0 @@
1
- # Copyright (C) 2012 CleanTalk
2
- # This file is distributed under the same license as the Cleantalk. Spam protection package.
3
- msgid ""
4
- msgstr ""
5
- "Project-Id-Version: Cleantalk. Spam protection \n"
6
- "Report-Msgid-Bugs-To: http://wordpress.org/tag/cleantalk\n"
7
- "POT-Creation-Date: 2014-03-12 08:04:56+00:00\n"
8
- "MIME-Version: 1.0\n"
9
- "Content-Type: text/plain; charset=UTF-8\n"
10
- "Content-Transfer-Encoding: 8bit\n"
11
- "PO-Revision-Date: 2014-03-12 08:04:56+00:00\n"
12
- "Last-Translator: Denis Shagimuratov <shagimuratov@cleantalk.org>\n"
13
- "Language-Team: CleanTalk Team <welcome@cleantalk.org>\n"
14
-
15
- msgid "Cleantalk settings"
16
- msgstr ""
17
-
18
- msgid "Main settings"
19
- msgstr ""
20
-
21
- msgid "Access key"
22
- msgstr ""
23
-
24
- msgid "Spam protection"
25
- msgstr ""
26
-
27
- msgid "Click here to get access key"
28
- msgstr ""
29
-
30
- #. Notice if key is empty
31
- msgid "Please enter Access Key in %s settings to enable anti spam protection!"
32
- msgstr ""
33
-
34
- #. Publish options
35
- msgid "Publish relevant comments"
36
- msgstr ""
37
-
38
- #. Publish descrtipion
39
- msgid "Relevant (not spam) comments from new authors will be automatic published at the blog"
40
- msgstr ""
41
-
42
- msgid "Automatically delete spam comments"
43
- msgstr ""
44
-
45
- msgid "Delete spam comments older than %d days."
46
- msgstr ""
47
-
48
- msgid "Anti-spam settings"
49
- msgstr ""
50
-
51
- msgid "Registration forms"
52
- msgstr ""
53
-
54
- msgid "Comments form"
55
- msgstr ""
56
-
57
- msgid "Contact forms"
58
- msgstr ""
59
-
60
- msgid "Plugin Homepage at"
61
- msgstr ""
62
-
63
- msgid "Comment approved. Anti-spam by CleanTalk."
64
- msgstr ""
65
-
66
- msgid "%s trial period ends, please upgrade to %s!"
67
- msgstr ""
68
-
69
- msgid "Don’t forget to disable CAPTCHA if you have it!"
70
- msgstr ""
71
-
72
- msgid "Registration is approved by %s."
73
- msgstr ""
74
-
75
- msgid "Attention, please!"
76
- msgstr ""
77
-
78
- msgid "\"Anti-spam by CleanTalk\" plugin error on your site %s:"
79
- msgstr ""
80
-
81
- msgid "[%s] Anti-spam by CleanTalk error!"
82
- msgstr ""
83
-
84
- msgid "Use secure (SSL) connection to CleanTalk cloud"
85
- msgstr ""
86
-
87
- msgid "Custom contact forms"
88
- msgstr ""
89
-
90
- msgid "Anti spam test for any WordPress or themes contacts forms"
91
- msgstr ""
92
-
93
- msgid "Find spam comments"
94
- msgstr ""
95
-
96
- msgid "Total comments %s, checked %s, found %s spam comments."
97
- msgstr ""
98
-
99
- msgid "Done. All comments tested via blacklists database, please see result bellow."
100
- msgstr ""
101
-
102
- msgid "Delete selected"
103
- msgstr ""
104
-
105
- msgid "Check for spam"
106
- msgstr ""
107
-
108
- msgid "Anti-spam by CleanTalk"
109
- msgstr ""
110
-
111
- msgid "Anti-spam by CleanTalk will check all not spam comments against blacklists database and show you senders that have spam activity on other websites. Just click 'Find spam comments' to start."
112
- msgstr ""
113
-
114
- msgid "Please wait for a while. CleanTalk is checking all approved and pending comments via blacklist database at cleantalk.org. You will have option to delete found spam comments after plugin finish."
115
- msgstr ""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/inc/JSON.php DELETED
@@ -1,804 +0,0 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * Converts to and from JSON format.
6
- *
7
- * JSON (JavaScript Object Notation) is a lightweight data-interchange
8
- * format. It is easy for humans to read and write. It is easy for machines
9
- * to parse and generate. It is based on a subset of the JavaScript
10
- * Programming Language, Standard ECMA-262 3rd Edition - December 1999.
11
- * This feature can also be found in Python. JSON is a text format that is
12
- * completely language independent but uses conventions that are familiar
13
- * to programmers of the C-family of languages, including C, C++, C#, Java,
14
- * JavaScript, Perl, TCL, and many others. These properties make JSON an
15
- * ideal data-interchange language.
16
- *
17
- * This package provides a simple encoder and decoder for JSON notation. It
18
- * is intended for use with client-side Javascript applications that make
19
- * use of HTTPRequest to perform server communication functions - data can
20
- * be encoded into JSON notation for use in a client-side javascript, or
21
- * decoded from incoming Javascript requests. JSON format is native to
22
- * Javascript, and can be directly eval()'ed with no further parsing
23
- * overhead
24
- *
25
- * All strings should be in ASCII or UTF-8 format!
26
- *
27
- * LICENSE: Redistribution and use in source and binary forms, with or
28
- * without modification, are permitted provided that the following
29
- * conditions are met: Redistributions of source code must retain the
30
- * above copyright notice, this list of conditions and the following
31
- * disclaimer. Redistributions in binary form must reproduce the above
32
- * copyright notice, this list of conditions and the following disclaimer
33
- * in the documentation and/or other materials provided with the
34
- * distribution.
35
- *
36
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
37
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
38
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
39
- * NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
40
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
41
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
42
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
43
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
44
- * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
45
- * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
46
- * DAMAGE.
47
- *
48
- * @category
49
- * @package Services_JSON
50
- * @author Michal Migurski <mike-json@teczno.com>
51
- * @author Matt Knapp <mdknapp[at]gmail[dot]com>
52
- * @author Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
53
- * @copyright 2005 Michal Migurski
54
- * @version CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $
55
- * @license http://www.opensource.org/licenses/bsd-license.php
56
- * @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198
57
- */
58
-
59
- /**
60
- * Marker constant for Services_JSON::decode(), used to flag stack state
61
- */
62
- define('SERVICES_JSON_SLICE', 1);
63
-
64
- /**
65
- * Marker constant for Services_JSON::decode(), used to flag stack state
66
- */
67
- define('SERVICES_JSON_IN_STR', 2);
68
-
69
- /**
70
- * Marker constant for Services_JSON::decode(), used to flag stack state
71
- */
72
- define('SERVICES_JSON_IN_ARR', 3);
73
-
74
- /**
75
- * Marker constant for Services_JSON::decode(), used to flag stack state
76
- */
77
- define('SERVICES_JSON_IN_OBJ', 4);
78
-
79
- /**
80
- * Marker constant for Services_JSON::decode(), used to flag stack state
81
- */
82
- define('SERVICES_JSON_IN_CMT', 5);
83
-
84
- /**
85
- * Behavior switch for Services_JSON::decode()
86
- */
87
- define('SERVICES_JSON_LOOSE_TYPE', 16);
88
-
89
- /**
90
- * Behavior switch for Services_JSON::decode()
91
- */
92
- define('SERVICES_JSON_SUPPRESS_ERRORS', 32);
93
-
94
- /**
95
- * Converts to and from JSON format.
96
- *
97
- * Brief example of use:
98
- *
99
- * <code>
100
- * // create a new instance of Services_JSON
101
- * $json = new Services_JSON();
102
- *
103
- * // convert a complexe value to JSON notation, and send it to the browser
104
- * $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4)));
105
- * $output = $json->encode($value);
106
- *
107
- * print($output);
108
- * // prints: ["foo","bar",[1,2,"baz"],[3,[4]]]
109
- *
110
- * // accept incoming POST data, assumed to be in JSON notation
111
- * $input = file_get_contents('php://input', 1000000);
112
- * $value = $json->decode($input);
113
- * </code>
114
- */
115
- class Services_JSON
116
- {
117
- /**
118
- * constructs a new JSON instance
119
- *
120
- * @param int $use object behavior flags; combine with boolean-OR
121
- *
122
- * possible values:
123
- * - SERVICES_JSON_LOOSE_TYPE: loose typing.
124
- * "{...}" syntax creates associative arrays
125
- * instead of objects in decode().
126
- * - SERVICES_JSON_SUPPRESS_ERRORS: error suppression.
127
- * Values which can't be encoded (e.g. resources)
128
- * appear as NULL instead of throwing errors.
129
- * By default, a deeply-nested resource will
130
- * bubble up with an error, so all return values
131
- * from encode() should be checked with isError()
132
- */
133
- function Services_JSON($use = 0)
134
- {
135
- $this->use = $use;
136
- }
137
-
138
- /**
139
- * convert a string from one UTF-16 char to one UTF-8 char
140
- *
141
- * Normally should be handled by mb_convert_encoding, but
142
- * provides a slower PHP-only method for installations
143
- * that lack the multibye string extension.
144
- *
145
- * @param string $utf16 UTF-16 character
146
- * @return string UTF-8 character
147
- * @access private
148
- */
149
- function utf162utf8($utf16)
150
- {
151
- // oh please oh please oh please oh please oh please
152
- if(function_exists('mb_convert_encoding')) {
153
- return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
154
- }
155
-
156
- $bytes = (ord($utf16{0}) << 8) | ord($utf16{1});
157
-
158
- switch(true) {
159
- case ((0x7F & $bytes) == $bytes):
160
- // this case should never be reached, because we are in ASCII range
161
- // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
162
- return chr(0x7F & $bytes);
163
-
164
- case (0x07FF & $bytes) == $bytes:
165
- // return a 2-byte UTF-8 character
166
- // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
167
- return chr(0xC0 | (($bytes >> 6) & 0x1F))
168
- . chr(0x80 | ($bytes & 0x3F));
169
-
170
- case (0xFFFF & $bytes) == $bytes:
171
- // return a 3-byte UTF-8 character
172
- // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
173
- return chr(0xE0 | (($bytes >> 12) & 0x0F))
174
- . chr(0x80 | (($bytes >> 6) & 0x3F))
175
- . chr(0x80 | ($bytes & 0x3F));
176
- }
177
-
178
- // ignoring UTF-32 for now, sorry
179
- return '';
180
- }
181
-
182
- /**
183
- * convert a string from one UTF-8 char to one UTF-16 char
184
- *
185
- * Normally should be handled by mb_convert_encoding, but
186
- * provides a slower PHP-only method for installations
187
- * that lack the multibye string extension.
188
- *
189
- * @param string $utf8 UTF-8 character
190
- * @return string UTF-16 character
191
- * @access private
192
- */
193
- function utf82utf16($utf8)
194
- {
195
- // oh please oh please oh please oh please oh please
196
- if(function_exists('mb_convert_encoding')) {
197
- return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
198
- }
199
-
200
- switch(strlen($utf8)) {
201
- case 1:
202
- // this case should never be reached, because we are in ASCII range
203
- // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
204
- return $utf8;
205
-
206
- case 2:
207
- // return a UTF-16 character from a 2-byte UTF-8 char
208
- // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
209
- return chr(0x07 & (ord($utf8{0}) >> 2))
210
- . chr((0xC0 & (ord($utf8{0}) << 6))
211
- | (0x3F & ord($utf8{1})));
212
-
213
- case 3:
214
- // return a UTF-16 character from a 3-byte UTF-8 char
215
- // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
216
- return chr((0xF0 & (ord($utf8{0}) << 4))
217
- | (0x0F & (ord($utf8{1}) >> 2)))
218
- . chr((0xC0 & (ord($utf8{1}) << 6))
219
- | (0x7F & ord($utf8{2})));
220
- }
221
-
222
- // ignoring UTF-32 for now, sorry
223
- return '';
224
- }
225
-
226
- /**
227
- * encodes an arbitrary variable into JSON format
228
- *
229
- * @param mixed $var any number, boolean, string, array, or object to be encoded.
230
- * see argument 1 to Services_JSON() above for array-parsing behavior.
231
- * if var is a strng, note that encode() always expects it
232
- * to be in ASCII or UTF-8 format!
233
- *
234
- * @return mixed JSON string representation of input var or an error if a problem occurs
235
- * @access public
236
- */
237
- function encode($var)
238
- {
239
- switch (gettype($var)) {
240
- case 'boolean':
241
- return $var ? 'true' : 'false';
242
-
243
- case 'NULL':
244
- return 'null';
245
-
246
- case 'integer':
247
- return (int) $var;
248
-
249
- case 'double':
250
- case 'float':
251
- return (float) $var;
252
-
253
- case 'string':
254
- // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT
255
- $ascii = '';
256
- $strlen_var = strlen($var);
257
-
258
- /*
259
- * Iterate over every character in the string,
260
- * escaping with a slash or encoding to UTF-8 where necessary
261
- */
262
- for ($c = 0; $c < $strlen_var; ++$c) {
263
-
264
- $ord_var_c = ord($var{$c});
265
-
266
- switch (true) {
267
- case $ord_var_c == 0x08:
268
- $ascii .= '\b';
269
- break;
270
- case $ord_var_c == 0x09:
271
- $ascii .= '\t';
272
- break;
273
- case $ord_var_c == 0x0A:
274
- $ascii .= '\n';
275
- break;
276
- case $ord_var_c == 0x0C:
277
- $ascii .= '\f';
278
- break;
279
- case $ord_var_c == 0x0D:
280
- $ascii .= '\r';
281
- break;
282
-
283
- case $ord_var_c == 0x22:
284
- case $ord_var_c == 0x2F:
285
- case $ord_var_c == 0x5C:
286
- // double quote, slash, slosh
287
- $ascii .= '\\'.$var{$c};
288
- break;
289
-
290
- case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
291
- // characters U-00000000 - U-0000007F (same as ASCII)
292
- $ascii .= $var{$c};
293
- break;
294
-
295
- case (($ord_var_c & 0xE0) == 0xC0):
296
- // characters U-00000080 - U-000007FF, mask 110XXXXX
297
- // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
298
- $char = pack('C*', $ord_var_c, ord($var{$c + 1}));
299
- $c += 1;
300
- $utf16 = $this->utf82utf16($char);
301
- $ascii .= sprintf('\u%04s', bin2hex($utf16));
302
- break;
303
-
304
- case (($ord_var_c & 0xF0) == 0xE0):
305
- // characters U-00000800 - U-0000FFFF, mask 1110XXXX
306
- // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
307
- $char = pack('C*', $ord_var_c,
308
- ord($var{$c + 1}),
309
- ord($var{$c + 2}));
310
- $c += 2;
311
- $utf16 = $this->utf82utf16($char);
312
- $ascii .= sprintf('\u%04s', bin2hex($utf16));
313
- break;
314
-
315
- case (($ord_var_c & 0xF8) == 0xF0):
316
- // characters U-00010000 - U-001FFFFF, mask 11110XXX
317
- // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
318
- $char = pack('C*', $ord_var_c,
319
- ord($var{$c + 1}),
320
- ord($var{$c + 2}),
321
- ord($var{$c + 3}));
322
- $c += 3;
323
- $utf16 = $this->utf82utf16($char);
324
- $ascii .= sprintf('\u%04s', bin2hex($utf16));
325
- break;
326
-
327
- case (($ord_var_c & 0xFC) == 0xF8):
328
- // characters U-00200000 - U-03FFFFFF, mask 111110XX
329
- // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
330
- $char = pack('C*', $ord_var_c,
331
- ord($var{$c + 1}),
332
- ord($var{$c + 2}),
333
- ord($var{$c + 3}),
334
- ord($var{$c + 4}));
335
- $c += 4;
336
- $utf16 = $this->utf82utf16($char);
337
- $ascii .= sprintf('\u%04s', bin2hex($utf16));
338
- break;
339
-
340
- case (($ord_var_c & 0xFE) == 0xFC):
341
- // characters U-04000000 - U-7FFFFFFF, mask 1111110X
342
- // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
343
- $char = pack('C*', $ord_var_c,
344
- ord($var{$c + 1}),
345
- ord($var{$c + 2}),
346
- ord($var{$c + 3}),
347
- ord($var{$c + 4}),
348
- ord($var{$c + 5}));
349
- $c += 5;
350
- $utf16 = $this->utf82utf16($char);
351
- $ascii .= sprintf('\u%04s', bin2hex($utf16));
352
- break;
353
- }
354
- }
355
-
356
- return '"'.$ascii.'"';
357
-
358
- case 'array':
359
- /*
360
- * As per JSON spec if any array key is not an integer
361
- * we must treat the the whole array as an object. We
362
- * also try to catch a sparsely populated associative
363
- * array with numeric keys here because some JS engines
364
- * will create an array with empty indexes up to
365
- * max_index which can cause memory issues and because
366
- * the keys, which may be relevant, will be remapped
367
- * otherwise.
368
- *
369
- * As per the ECMA and JSON specification an object may
370
- * have any string as a property. Unfortunately due to
371
- * a hole in the ECMA specification if the key is a
372
- * ECMA reserved word or starts with a digit the
373
- * parameter is only accessible using ECMAScript's
374
- * bracket notation.
375
- */
376
-
377
- // treat as a JSON object
378
- if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) {
379
- $properties = array_map(array($this, 'name_value'),
380
- array_keys($var),
381
- array_values($var));
382
-
383
- foreach($properties as $property) {
384
- if(Services_JSON::isError($property)) {
385
- return $property;
386
- }
387
- }
388
-
389
- return '{' . join(',', $properties) . '}';
390
- }
391
-
392
- // treat it like a regular array
393
- $elements = array_map(array($this, 'encode'), $var);
394
-
395
- foreach($elements as $element) {
396
- if(Services_JSON::isError($element)) {
397
- return $element;
398
- }
399
- }
400
-
401
- return '[' . join(',', $elements) . ']';
402
-
403
- case 'object':
404
- $vars = get_object_vars($var);
405
-
406
- $properties = array_map(array($this, 'name_value'),
407
- array_keys($vars),
408
- array_values($vars));
409
-
410
- foreach($properties as $property) {
411
- if(Services_JSON::isError($property)) {
412
- return $property;
413
- }
414
- }
415
-
416
- return '{' . join(',', $properties) . '}';
417
-
418
- default:
419
- return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
420
- ? 'null'
421
- : new Services_JSON_Error(gettype($var)." can not be encoded as JSON string");
422
- }
423
- }
424
-
425
- /**
426
- * array-walking function for use in generating JSON-formatted name-value pairs
427
- *
428
- * @param string $name name of key to use
429
- * @param mixed $value reference to an array element to be encoded
430
- *
431
- * @return string JSON-formatted name-value pair, like '"name":value'
432
- * @access private
433
- */
434
- function name_value($name, $value)
435
- {
436
- $encoded_value = $this->encode($value);
437
-
438
- if(Services_JSON::isError($encoded_value)) {
439
- return $encoded_value;
440
- }
441
-
442
- return $this->encode(strval($name)) . ':' . $encoded_value;
443
- }
444
-
445
- /**
446
- * reduce a string by removing leading and trailing comments and whitespace
447
- *
448
- * @param $str string string value to strip of comments and whitespace
449
- *
450
- * @return string string value stripped of comments and whitespace
451
- * @access private
452
- */
453
- function reduce_string($str)
454
- {
455
- $str = preg_replace(array(
456
-
457
- // eliminate single line comments in '// ...' form
458
- '#^\s*//(.+)$#m',
459
-
460
- // eliminate multi-line comments in '/* ... */' form, at start of string
461
- '#^\s*/\*(.+)\*/#Us',
462
-
463
- // eliminate multi-line comments in '/* ... */' form, at end of string
464
- '#/\*(.+)\*/\s*$#Us'
465
-
466
- ), '', $str);
467
-
468
- // eliminate extraneous space
469
- return trim($str);
470
- }
471
-
472
- /**
473
- * decodes a JSON string into appropriate variable
474
- *
475
- * @param string $str JSON-formatted string
476
- *
477
- * @return mixed number, boolean, string, array, or object
478
- * corresponding to given JSON input string.
479
- * See argument 1 to Services_JSON() above for object-output behavior.
480
- * Note that decode() always returns strings
481
- * in ASCII or UTF-8 format!
482
- * @access public
483
- */
484
- function decode($str)
485
- {
486
- $str = $this->reduce_string($str);
487
-
488
- switch (strtolower($str)) {
489
- case 'true':
490
- return true;
491
-
492
- case 'false':
493
- return false;
494
-
495
- case 'null':
496
- return null;
497
-
498
- default:
499
- $m = array();
500
-
501
- if (is_numeric($str)) {
502
- // Lookie-loo, it's a number
503
-
504
- // This would work on its own, but I'm trying to be
505
- // good about returning integers where appropriate:
506
- // return (float)$str;
507
-
508
- // Return float or int, as appropriate
509
- return ((float)$str == (integer)$str)
510
- ? (integer)$str
511
- : (float)$str;
512
-
513
- } elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) {
514
- // STRINGS RETURNED IN UTF-8 FORMAT
515
- $delim = substr($str, 0, 1);
516
- $chrs = substr($str, 1, -1);
517
- $utf8 = '';
518
- $strlen_chrs = strlen($chrs);
519
-
520
- for ($c = 0; $c < $strlen_chrs; ++$c) {
521
-
522
- $substr_chrs_c_2 = substr($chrs, $c, 2);
523
- $ord_chrs_c = ord($chrs{$c});
524
-
525
- switch (true) {
526
- case $substr_chrs_c_2 == '\b':
527
- $utf8 .= chr(0x08);
528
- ++$c;
529
- break;
530
- case $substr_chrs_c_2 == '\t':
531
- $utf8 .= chr(0x09);
532
- ++$c;
533
- break;
534
- case $substr_chrs_c_2 == '\n':
535
- $utf8 .= chr(0x0A);
536
- ++$c;
537
- break;
538
- case $substr_chrs_c_2 == '\f':
539
- $utf8 .= chr(0x0C);
540
- ++$c;
541
- break;
542
- case $substr_chrs_c_2 == '\r':
543
- $utf8 .= chr(0x0D);
544
- ++$c;
545
- break;
546
-
547
- case $substr_chrs_c_2 == '\\"':
548
- case $substr_chrs_c_2 == '\\\'':
549
- case $substr_chrs_c_2 == '\\\\':
550
- case $substr_chrs_c_2 == '\\/':
551
- if (($delim == '"' && $substr_chrs_c_2 != '\\\'') ||
552
- ($delim == "'" && $substr_chrs_c_2 != '\\"')) {
553
- $utf8 .= $chrs{++$c};
554
- }
555
- break;
556
-
557
- case preg_match('/\\\u[0-9A-F]{4}/i', substr($chrs, $c, 6)):
558
- // single, escaped unicode character
559
- $utf16 = chr(hexdec(substr($chrs, ($c + 2), 2)))
560
- . chr(hexdec(substr($chrs, ($c + 4), 2)));
561
- $utf8 .= $this->utf162utf8($utf16);
562
- $c += 5;
563
- break;
564
-
565
- case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F):
566
- $utf8 .= $chrs{$c};
567
- break;
568
-
569
- case ($ord_chrs_c & 0xE0) == 0xC0:
570
- // characters U-00000080 - U-000007FF, mask 110XXXXX
571
- //see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
572
- $utf8 .= substr($chrs, $c, 2);
573
- ++$c;
574
- break;
575
-
576
- case ($ord_chrs_c & 0xF0) == 0xE0:
577
- // characters U-00000800 - U-0000FFFF, mask 1110XXXX
578
- // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
579
- $utf8 .= substr($chrs, $c, 3);
580
- $c += 2;
581
- break;
582
-
583
- case ($ord_chrs_c & 0xF8) == 0xF0:
584
- // characters U-00010000 - U-001FFFFF, mask 11110XXX
585
- // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
586
- $utf8 .= substr($chrs, $c, 4);
587
- $c += 3;
588
- break;
589
-
590
- case ($ord_chrs_c & 0xFC) == 0xF8:
591
- // characters U-00200000 - U-03FFFFFF, mask 111110XX
592
- // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
593
- $utf8 .= substr($chrs, $c, 5);
594
- $c += 4;
595
- break;
596
-
597
- case ($ord_chrs_c & 0xFE) == 0xFC:
598
- // characters U-04000000 - U-7FFFFFFF, mask 1111110X
599
- // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
600
- $utf8 .= substr($chrs, $c, 6);
601
- $c += 5;
602
- break;
603
-
604
- }
605
-
606
- }
607
-
608
- return $utf8;
609
-
610
- } elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) {
611
- // array, or object notation
612
-
613
- if ($str{0} == '[') {
614
- $stk = array(SERVICES_JSON_IN_ARR);
615
- $arr = array();
616
- } else {
617
- if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
618
- $stk = array(SERVICES_JSON_IN_OBJ);
619
- $obj = array();
620
- } else {
621
- $stk = array(SERVICES_JSON_IN_OBJ);
622
- $obj = new stdClass();
623
- }
624
- }
625
-
626
- array_push($stk, array('what' => SERVICES_JSON_SLICE,
627
- 'where' => 0,
628
- 'delim' => false));
629
-
630
- $chrs = substr($str, 1, -1);
631
- $chrs = $this->reduce_string($chrs);
632
-
633
- if ($chrs == '') {
634
- if (reset($stk) == SERVICES_JSON_IN_ARR) {
635
- return $arr;
636
-
637
- } else {
638
- return $obj;
639
-
640
- }
641
- }
642
-
643
- //print("\nparsing {$chrs}\n");
644
-
645
- $strlen_chrs = strlen($chrs);
646
-
647
- for ($c = 0; $c <= $strlen_chrs; ++$c) {
648
-
649
- $top = end($stk);
650
- $substr_chrs_c_2 = substr($chrs, $c, 2);
651
-
652
- if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) {
653
- // found a comma that is not inside a string, array, etc.,
654
- // OR we've reached the end of the character list
655
- $slice = substr($chrs, $top['where'], ($c - $top['where']));
656
- array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false));
657
- //print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
658
-
659
- if (reset($stk) == SERVICES_JSON_IN_ARR) {
660
- // we are in an array, so just push an element onto the stack
661
- array_push($arr, $this->decode($slice));
662
-
663
- } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
664
- // we are in an object, so figure
665
- // out the property name and set an
666
- // element in an associative array,
667
- // for now
668
- $parts = array();
669
-
670
- if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
671
- // "name":value pair
672
- $key = $this->decode($parts[1]);
673
- $val = $this->decode($parts[2]);
674
-
675
- if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
676
- $obj[$key] = $val;
677
- } else {
678
- $obj->$key = $val;
679
- }
680
- } elseif (preg_match('/^\s*(\w+)\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
681
- // name:value pair, where name is unquoted
682
- $key = $parts[1];
683
- $val = $this->decode($parts[2]);
684
-
685
- if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
686
- $obj[$key] = $val;
687
- } else {
688
- $obj->$key = $val;
689
- }
690
- }
691
-
692
- }
693
-
694
- } elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) {
695
- // found a quote, and we are not inside a string
696
- array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c}));
697
- //print("Found start of string at {$c}\n");
698
-
699
- } elseif (($chrs{$c} == $top['delim']) &&
700
- ($top['what'] == SERVICES_JSON_IN_STR) &&
701
- ((strlen(substr($chrs, 0, $c)) - strlen(rtrim(substr($chrs, 0, $c), '\\'))) % 2 != 1)) {
702
- // found a quote, we're in a string, and it's not escaped
703
- // we know that it's not escaped becase there is _not_ an
704
- // odd number of backslashes at the end of the string so far
705
- array_pop($stk);
706
- //print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");
707
-
708
- } elseif (($chrs{$c} == '[') &&
709
- in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
710
- // found a left-bracket, and we are in an array, object, or slice
711
- array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false));
712
- //print("Found start of array at {$c}\n");
713
-
714
- } elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) {
715
- // found a right-bracket, and we're in an array
716
- array_pop($stk);
717
- //print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
718
-
719
- } elseif (($chrs{$c} == '{') &&
720
- in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
721
- // found a left-brace, and we are in an array, object, or slice
722
- array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false));
723
- //print("Found start of object at {$c}\n");
724
-
725
- } elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) {
726
- // found a right-brace, and we're in an object
727
- array_pop($stk);
728
- //print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
729
-
730
- } elseif (($substr_chrs_c_2 == '/*') &&
731
- in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
732
- // found a comment start, and we are in an array, object, or slice
733
- array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false));
734
- $c++;
735
- //print("Found start of comment at {$c}\n");
736
-
737
- } elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) {
738
- // found a comment end, and we're in one now
739
- array_pop($stk);
740
- $c++;
741
-
742
- for ($i = $top['where']; $i <= $c; ++$i)
743
- $chrs = substr_replace($chrs, ' ', $i, 1);
744
-
745
- //print("Found end of comment at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
746
-
747
- }
748
-
749
- }
750
-
751
- if (reset($stk) == SERVICES_JSON_IN_ARR) {
752
- return $arr;
753
-
754
- } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
755
- return $obj;
756
-
757
- }
758
-
759
- }
760
- }
761
- }
762
-
763
- /**
764
- * @todo Ultimately, this should just call PEAR::isError()
765
- */
766
- function isError($data, $code = null)
767
- {
768
- if (class_exists('pear')) {
769
- return PEAR::isError($data, $code);
770
- } elseif (is_object($data) && (get_class($data) == 'services_json_error' ||
771
- is_subclass_of($data, 'services_json_error'))) {
772
- return true;
773
- }
774
-
775
- return false;
776
- }
777
- }
778
-
779
- if (class_exists('PEAR_Error')) {
780
-
781
- class Services_JSON_Error extends PEAR_Error
782
- {
783
- function Services_JSON_Error($message = 'unknown error', $code = null,
784
- $mode = null, $options = null, $userinfo = null)
785
- {
786
- parent::PEAR_Error($message, $code, $mode, $options, $userinfo);
787
- }
788
- }
789
-
790
- } else {
791
-
792
- /**
793
- * @todo Ultimately, this class shall be descended from PEAR_Error
794
- */
795
- class Services_JSON_Error
796
- {
797
- function Services_JSON_Error($message = 'unknown error', $code = null,
798
- $mode = null, $options = null, $userinfo = null)
799
- {
800
-
801
- }
802
- }
803
-
804
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/inc/cleantalk-admin.js DELETED
@@ -1,66 +0,0 @@
1
- var ct_adv_settings=null;
2
- var ct_adv_settings_title=null;
3
- var ct_adv_settings_show=false;
4
- jQuery(document).ready(function(){
5
- var d = new Date();
6
- var n = d.getTimezoneOffset();
7
- var data = {
8
- 'action': 'ajax_get_timezone',
9
- 'security': ajax_nonce,
10
- 'offset': n
11
- };
12
- jQuery.ajax({
13
- type: "POST",
14
- url: ajaxurl,
15
- data: data,
16
- success: function(msg){
17
- //
18
- }
19
- });
20
-
21
- if(cleantalk_good_key)
22
- {
23
- jQuery('.form-table').first().hide();
24
-
25
- banner_html="<div id='ct_stats_banner'>"+cleantalk_blocked_message;
26
- banner_html+=cleantalk_statistics_link+'</div>';
27
- jQuery('.form-table').first().before(banner_html);
28
- if(!cleantalk_wpmu)
29
- {
30
- jQuery('.form-table').first().before("<br /><a href='#' style='font-size:10pt;' id='cleantalk_access_key_link'>Show the access key</a>");
31
- }
32
- }
33
-
34
- jQuery('#cleantalk_access_key_link').click(function(){
35
- if(jQuery('.form-table').first().is(":visible"))
36
- {
37
- jQuery('.form-table').first().hide();
38
- }
39
- else
40
- {
41
- jQuery('.form-table').first().show();
42
- }
43
- });
44
-
45
- ct_adv_settings=jQuery('#cleantalk_registrations_test1').parent().parent().parent().parent();
46
- ct_adv_settings.hide();
47
- ct_adv_settings_title=ct_adv_settings.prev();
48
- ct_adv_settings.wrap("<div id='ct_advsettings_hide'>");
49
- ct_adv_settings_title.append(" <span id='ct_adv_showhide' style='cursor:pointer'><b><a href='#' style='text-decoration:none;'></a></b></span>");
50
- ct_adv_settings_title.css('cursor','pointer');
51
- ct_adv_settings_title.click(function(){
52
- if(ct_adv_settings_show)
53
- {
54
- ct_adv_settings.hide();
55
- ct_adv_settings_show=false;
56
- jQuery('#ct_adv_showhide').html("<b><a href='#' style='text-decoration:none;'></a></b>");
57
- }
58
- else
59
- {
60
- ct_adv_settings.show();
61
- ct_adv_settings_show=true;
62
- jQuery('#ct_adv_showhide').html("<b><a href='#' style='text-decoration:none;'></a></b>");
63
- }
64
-
65
- });
66
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/inc/cleantalk-admin.php DELETED
@@ -1,1440 +0,0 @@
1
- <?php
2
-
3
- $ct_plugin_basename = 'cleantalk-spam-protect/cleantalk.php';
4
- $ct_options=ct_get_options();
5
- $ct_data=ct_get_data();
6
-
7
- add_filter( 'activity_box_end', 'cleantalk_custom_glance_items', 10, 1 );
8
- function cleantalk_custom_glance_items( )
9
- {
10
- global $ct_data;
11
- $ct_data=ct_get_data();
12
- if(!isset($ct_data['admin_blocked']))
13
- {
14
- $blocked=0;
15
- }
16
- else
17
- {
18
- $blocked=$ct_data['admin_blocked'];
19
- }
20
- if($blocked>0)
21
- {
22
- $blocked = number_format($blocked, 0, ',', ' ');
23
- print "<div style='height:24px;width:100%;display:table-cell; vertical-align:middle;'><img src='" . plugin_dir_url(__FILE__) . "images/logo_color.png' style='margin-right:1em;vertical-align:middle;'/><span><a href='https://cleantalk.org/my/?user_token=".@$ct_data['user_token']."&utm_source=wp-backend&utm_medium=dashboard_widget' target='_blank'>CleanTalk</a> ";
24
- printf(
25
- /* translators: %s: Number of spam messages */
26
- __( 'has blocked %s spam', 'cleantalk' ),
27
- $blocked
28
- );
29
- print "</span></div>";
30
- }
31
- }
32
-
33
-
34
- // Timeout to get app server
35
- $ct_server_timeout = 10;
36
-
37
-
38
- /**
39
- * Admin action 'wp_ajax_ajax_get_timezone' - Ajax method for getting timezone offset
40
- */
41
-
42
- function ct_ajax_get_timezone()
43
- {
44
- global $ct_data;
45
- check_ajax_referer( 'ct_secret_nonce', 'security' );
46
- $ct_data = ct_get_data();
47
- if(isset($_POST['offset']))
48
- {
49
- $ct_data['timezone'] = intval($_POST['offset']);
50
- update_option('cleantalk_data', $ct_data);
51
- }
52
- }
53
-
54
- add_action( 'wp_ajax_ajax_get_timezone', 'ct_ajax_get_timezone' );
55
-
56
-
57
- /**
58
- * Admin action 'admin_enqueue_scripts' - Enqueue admin script of reloading admin page after needed AJAX events
59
- * @param string $hook URL of hooked page
60
- */
61
- function ct_enqueue_scripts($hook) {
62
- if ($hook == 'edit-comments.php')
63
- wp_enqueue_script('ct_reload_script', plugins_url('/cleantalk-rel.js', __FILE__));
64
- }
65
-
66
- /**
67
- * Admin action 'admin_menu' - Add the admin options page
68
- */
69
- function ct_admin_add_page() {
70
- if(is_network_admin())
71
- {
72
- add_submenu_page("settings.php", __('CleanTalk settings', 'cleantalk'), 'CleanTalk', 'manage_options', 'cleantalk', 'ct_settings_page');
73
- }
74
- else
75
- {
76
- add_options_page(__('CleanTalk settings', 'cleantalk'), 'CleanTalk', 'manage_options', 'cleantalk', 'ct_settings_page');
77
- }
78
- }
79
-
80
- /**
81
- * Admin action 'admin_init' - Add the admin settings and such
82
- */
83
- function ct_admin_init()
84
- {
85
- 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;
86
-
87
- $ct_options = ct_get_options();
88
- $ct_data = ct_get_data();
89
-
90
- $current_version=@trim($ct_data['current_version']);
91
- if($current_version!=$cleantalk_plugin_version)
92
- {
93
- $ct_data['current_version']=$cleantalk_plugin_version;
94
- update_option('cleantalk_data', $ct_data);
95
- $ct_base_call_result = ct_base_call(array(
96
- 'message' => 'This message is a test to check the connection to the CleanTalk servers. ',
97
- 'example' => null,
98
- 'sender_email' => 'good@cleantalk.org',
99
- 'sender_nickname' => 'CleanTalk',
100
- 'post_info' => '',
101
- 'checkjs' => 1
102
- ));
103
- }
104
- if(isset($_POST['option_page'])&&$_POST['option_page']=='cleantalk_settings'&&isset($_POST['cleantalk_settings']['apikey']))
105
- {
106
- $ct_options['apikey']=$_POST['cleantalk_settings']['apikey'];
107
- update_option('cleantalk_settings', $ct_options);
108
- $ct_base_call_result = ct_base_call(array(
109
- 'message' => 'This message is a test to check the connection to the CleanTalk servers. ',
110
- 'example' => null,
111
- 'sender_email' => 'good@cleantalk.org',
112
- 'sender_nickname' => 'CleanTalk',
113
- 'post_info' => '',
114
- 'checkjs' => 1
115
- ));
116
- }
117
-
118
- if(@isset($_POST['cleantalk_settings']['spam_firewall']) && $_POST['cleantalk_settings']['spam_firewall']==1)
119
- {
120
- cleantalk_update_sfw();
121
- }
122
-
123
- /*$show_ct_notice_trial = false;
124
- if (isset($_COOKIE[$ct_notice_trial_label]))
125
- {
126
- if ($_COOKIE[$ct_notice_trial_label] == 1)
127
- {
128
- $show_ct_notice_trial = true;
129
- }
130
- }
131
- $show_ct_notice_renew = false;
132
- if (isset($_COOKIE[$ct_notice_renew_label]))
133
- {
134
- if ($_COOKIE[$ct_notice_renew_label] == 1)
135
- {
136
- $show_ct_notice_renew = true;
137
- }
138
- }*/
139
- $show_ct_notice_autokey = false;
140
- if (isset($_COOKIE[$ct_notice_autokey_label]) && !empty($_COOKIE[$ct_notice_autokey_label]))
141
- {
142
- if (!empty($_COOKIE[$ct_notice_autokey_label]))
143
- {
144
- $show_ct_notice_autokey = true;
145
- $ct_notice_autokey_value = base64_decode($_COOKIE[$ct_notice_autokey_label]);
146
- setcookie($ct_notice_autokey_label, '', 1, '/');
147
- }
148
- }
149
-
150
- if (isset($_POST['get_apikey_auto']))
151
- {
152
- $email = get_option('admin_email');
153
- $website = parse_url(get_option('siteurl'),PHP_URL_HOST);
154
- $platform = 'wordpress';
155
-
156
- if(!function_exists('getAutoKey'))
157
- {
158
- require_once('cleantalk.class.php');
159
- }
160
-
161
- $result = getAutoKey($email, $website, $platform);
162
-
163
- if ($result)
164
- {
165
- $ct_data['next_account_status_check']=0;
166
- update_option('cleantalk_data', $ct_data);
167
- $result = json_decode($result, true);
168
- if (isset($result['data']) && is_array($result['data']))
169
- {
170
- $result = $result['data'];
171
- }
172
- if(isset($result['user_token']))
173
- {
174
- $ct_data['user_token'] = $result['user_token'];
175
- update_option('cleantalk_data', $ct_data);
176
- }
177
- if (isset($result['auth_key']) && !empty($result['auth_key']))
178
- {
179
- $_POST['cleantalk_settings']['apikey'] = $result['auth_key'];
180
- $ct_options['apikey']=$result['auth_key'];
181
- update_option('cleantalk_settings', $ct_options);
182
- /*$ct_base_call_result = ct_base_call(array(
183
- 'message' => 'CleanTalk setup test',
184
- 'example' => null,
185
- 'sender_email' => 'good@cleantalk.org',
186
- 'sender_nickname' => 'CleanTalk',
187
- 'post_info' => '',
188
- 'checkjs' => 1
189
- )); */
190
- }
191
- else
192
- {
193
- setcookie($ct_notice_autokey_label, (string) base64_encode($result['error_message']), 0, '/');
194
- }
195
- }
196
- else
197
- {
198
- setcookie($ct_notice_autokey_label, (string) base64_encode(sprintf(__('Unable to connect to %s.', 'cleantalk'), 'api.cleantalk.org')), 0, '/');
199
- }
200
- }
201
-
202
- if (time() > $ct_data['next_account_status_check']||
203
- isset($_POST['cleantalk_settings']['apikey']))
204
- {
205
- $result = false;
206
- $notice_check_timeout = $account_notice_check_timeout;
207
- //if (true)
208
- //{
209
- if(!function_exists('noticePaidTill'))
210
- {
211
- require_once('cleantalk.class.php');
212
- }
213
- if(@isset($_POST['cleantalk_settings']['apikey']))
214
- {
215
- $result=noticePaidTill($_POST['cleantalk_settings']['apikey']);
216
- }
217
- else
218
- {
219
- $result=noticePaidTill($ct_options['apikey']);
220
- }
221
-
222
- if ($result)
223
- {
224
- $result = json_decode($result, true);
225
- if (isset($result['data']) && is_array($result['data']))
226
- {
227
- $result = $result['data'];
228
- }
229
- if(isset($result['spam_count']))
230
- {
231
- $ct_data['admin_blocked']=$result['spam_count'];
232
- }
233
-
234
- if (isset($result['show_notice']))
235
- {
236
- if ($result['show_notice'] == 1 && isset($result['trial']) && $result['trial'] == 1)
237
- {
238
- $notice_check_timeout = $trial_notice_check_timeout;
239
- $show_ct_notice_trial = true;
240
- $ct_data['show_ct_notice_trial']=1;
241
- }
242
- if ($result['show_notice'] == 1 && isset($result['renew']) && $result['renew'] == 1)
243
- {
244
- $notice_check_timeout = $renew_notice_check_timeout;
245
- $show_ct_notice_renew = true;
246
- $ct_data['show_ct_notice_renew']=1;
247
- }
248
-
249
- if ($result['show_notice'] == 0)
250
- {
251
- $notice_check_timeout = $account_notice_check_timeout;
252
- }
253
- $ct_data['show_ct_notice_trial']=(int) $show_ct_notice_trial;
254
- $ct_data['show_ct_notice_renew']= (int) $show_ct_notice_renew;
255
- }
256
-
257
- if (isset($result['moderate_ip']) && $result['moderate_ip'] == 1)
258
- {
259
- $ct_data['moderate_ip'] = 1;
260
- $ct_data['ip_license'] = $result['ip_license'];
261
- }
262
- else
263
- {
264
- $ct_data['moderate_ip'] = 0;
265
- $ct_data['ip_license'] = 0;
266
- }
267
-
268
- if (isset($result['user_token']))
269
- {
270
- $ct_data['user_token'] = $result['user_token'];
271
- }
272
- }
273
- // Save next status request time
274
- $ct_data['next_account_status_check'] = time() + $notice_check_timeout * 3600;
275
- update_option('cleantalk_data', $ct_data);
276
- //}
277
-
278
- /*if ($result)
279
- {
280
- if($show_ct_notice_trial == true)
281
- {
282
- setcookie($ct_notice_trial_label, (string) $show_ct_notice_trial, strtotime("+$trial_notice_showtime minutes"), '/');
283
- }
284
- if($show_ct_notice_renew == true)
285
- {
286
- setcookie($ct_notice_renew_label, (string) $show_ct_notice_renew, strtotime("+$renew_notice_showtime minutes"), '/');
287
- }
288
- }*/
289
- }
290
-
291
- $show_ct_notice_online = '';
292
- if (isset($_COOKIE[$ct_notice_online_label]))
293
- {
294
- if ($_COOKIE[$ct_notice_online_label] === 'BAD_KEY')
295
- {
296
- $show_ct_notice_online = 'N';
297
- }
298
- else if (time() - $_COOKIE[$ct_notice_online_label] <= 5)
299
- {
300
- $show_ct_notice_online = 'Y';
301
- }
302
- }
303
-
304
- //ct_init_session();
305
-
306
- if(stripos($_SERVER['REQUEST_URI'],'options.php')!==false || stripos($_SERVER['REQUEST_URI'],'options-general.php')!==false || stripos($_SERVER['REQUEST_URI'],'network/settings.php')!==false)
307
- {
308
-
309
- if(isset($ct_data['testing_failed'])&&$ct_data['testing_failed']==1)
310
- {
311
- $buttons_html='
312
- <style type="text/css">
313
- #ct_button_check_comments, #ct_button_check_users {background: #999999;}
314
-
315
- ';
316
- }
317
- else
318
- {
319
- $buttons_html='
320
- <style type="text/css">
321
- #ct_button_check_comments, #ct_button_check_users {background: #69dd69;}
322
-
323
- ';
324
- }
325
-
326
- $buttons_html.='
327
- #ct_button_check_comments, #ct_button_check_users {padding: 10px; color: #fff; border:0 none;
328
- cursor:pointer;
329
- -webkit-border-radius: 5px;
330
- border-radius: 5px;
331
- font-size: 12pt;
332
- text-decoration:none;
333
- margin-bottom:5px;
334
- display:inline-block;
335
- }
336
-
337
- #ct_stats_banner
338
- {
339
- padding: 0px;
340
- color: #000;
341
- /*border:2px solid #e5e5e5;*/
342
- font-size: 10pt;
343
- text-decoration:none;
344
- margin-bottom:5px;
345
- display:inline-block;
346
- }
347
- </style>';
348
- if(isset($ct_data['testing_failed'])&&$ct_data['testing_failed']==1)
349
- {
350
- /*$buttons_html.='<a href="#" id="ct_button_check_comments" onclick="alert('."'".__('Feature is disabled, because testing of access key is failed!', 'cleantalk')."'".')">'.__('Check comments', 'cleantalk').'</a>
351
- <a href="#" id="ct_button_check_users" onclick="alert('."'".__('Feature is disabled, because testing of access key is failed!', 'cleantalk')."'".')">'.__('Check users', 'cleantalk').'</a><div class="clear"></div>';*/
352
- }
353
- else
354
- {
355
- /*$buttons_html.='<a href="edit-comments.php?page=ct_check_spam&do_check=1" style="font-size:10pt;font-weight:400;">'.__('Check comments', 'cleantalk').'</a><br />
356
- <a href="users.php?page=ct_check_users&do_check=1" style="font-size:10pt;font-weight:400;">'.__('Check users', 'cleantalk').'</a><div class="clear"></div>';*/
357
- }
358
- register_setting('cleantalk_settings', 'cleantalk_settings', 'ct_settings_validate');
359
- add_settings_section('cleantalk_settings_main', __($ct_plugin_name, 'cleantalk'), 'ct_section_settings_main', 'cleantalk');
360
- add_settings_section('cleantalk_settings_state', "<hr>".__('Protection is active', 'cleantalk'), 'ct_section_settings_state', 'cleantalk');
361
- //add_settings_section('cleantalk_settings_autodel', "<hr>", 'ct_section_settings_autodel', 'cleantalk');
362
- add_settings_section('cleantalk_settings_banner', "<hr></h3>", '', 'cleantalk');
363
- add_settings_section('cleantalk_settings_anti_spam', "<a href='#' style='text-decoration:underline;font-size:10pt;font-weight:400;'>".__('Advanced settings', 'cleantalk')."</a>", 'ct_section_settings_anti_spam', 'cleantalk');
364
-
365
- if(!defined('CLEANTALK_ACCESS_KEY'))
366
- {
367
- add_settings_field('cleantalk_apikey', __('Access key', 'cleantalk'), 'ct_input_apikey', 'cleantalk', 'cleantalk_settings_main');
368
- }
369
- else
370
- {
371
- add_settings_field('cleantalk_apikey', '', 'ct_input_apikey', 'cleantalk', 'cleantalk_settings_main');
372
- }
373
- add_settings_field('cleantalk_remove_old_spam', __('Automatically delete spam comments', 'cleantalk'), 'ct_input_remove_old_spam', 'cleantalk', 'cleantalk_settings_anti_spam');
374
-
375
- add_settings_field('cleantalk_registrations_test', __('Registration forms', 'cleantalk'), 'ct_input_registrations_test', 'cleantalk', 'cleantalk_settings_anti_spam');
376
- add_settings_field('cleantalk_comments_test', __('Comments form', 'cleantalk'), 'ct_input_comments_test', 'cleantalk', 'cleantalk_settings_anti_spam');
377
- add_settings_field('cleantalk_contact_forms_test', __('Contact forms', 'cleantalk'), 'ct_input_contact_forms_test', 'cleantalk', 'cleantalk_settings_anti_spam');
378
- add_settings_field('cleantalk_general_contact_forms_test', __('Custom contact forms', 'cleantalk'), 'ct_input_general_contact_forms_test', 'cleantalk', 'cleantalk_settings_anti_spam');
379
- add_settings_field('cleantalk_general_postdata_test', __('Check all post data', 'cleantalk'), 'ct_input_general_postdata_test', 'cleantalk', 'cleantalk_settings_anti_spam');
380
- add_settings_field('cleantalk_show_adminbar', __('Show statistics in admin bar', 'cleantalk'), 'ct_input_show_adminbar', 'cleantalk', 'cleantalk_settings_anti_spam');
381
- add_settings_field('cleantalk_use_ajax', __('Use AJAX for JavaScript check', 'cleantalk'), 'ct_input_use_ajax', 'cleantalk', 'cleantalk_settings_anti_spam');
382
- add_settings_field('cleantalk_check_external', __('Protect external forms', 'cleantalk'), 'ct_input_check_external', 'cleantalk', 'cleantalk_settings_anti_spam');
383
- add_settings_field('cleantalk_check_comments_number', __("Don't check comments", 'cleantalk'), 'ct_input_check_comments_number', 'cleantalk', 'cleantalk_settings_anti_spam');
384
- add_settings_field('cleantalk_set_cookies', __("Set cookies", 'cleantalk'), 'ct_input_set_cookies', 'cleantalk', 'cleantalk_settings_anti_spam');
385
- add_settings_field('cleantalk_ssl_on', __("Use SSL", 'cleantalk'), 'ct_input_ssl_on', 'cleantalk', 'cleantalk_settings_anti_spam');
386
-
387
- add_settings_field('cleantalk_spam_firewall', __('', 'cleantalk'), 'ct_input_spam_firewall', 'cleantalk', 'cleantalk_settings_banner');
388
- add_settings_field('cleantalk_collect_details', __('Collect details about browsers', 'cleantalk'), 'ct_input_collect_details', 'cleantalk', 'cleantalk_settings_anti_spam');
389
- add_settings_field('cleantalk_show_link', __('', 'cleantalk'), 'ct_input_show_link', 'cleantalk', 'cleantalk_settings_banner');
390
- }
391
- }
392
-
393
- /**
394
- * Admin callback function - Displays description of 'main' plugin parameters section
395
- */
396
- function ct_section_settings_main() {
397
- return true;
398
- }
399
-
400
- /**
401
- * Admin callback function - Displays description of 'anti-spam' plugin parameters section
402
- */
403
- function ct_section_settings_anti_spam() {
404
- return true;
405
- }
406
-
407
- add_action( 'admin_bar_menu', 'ct_add_admin_menu', 999 );
408
-
409
- function ct_add_admin_menu( $wp_admin_bar ) {
410
- // add a parent item
411
- global $ct_options, $ct_data;
412
-
413
- $ct_options = ct_get_options();
414
- $ct_data = ct_get_data();
415
-
416
- if(isset($ct_options['show_adminbar']))
417
- {
418
- $value = @intval($ct_options['show_adminbar']);
419
- }
420
- else
421
- {
422
- $value=1;
423
- }
424
-
425
- if ( current_user_can('activate_plugins')&&$value==1 )
426
- {
427
- //$ct_data=ct_get_data();
428
- $ct_data=ct_get_data();
429
-
430
- if(!isset($ct_data['array_accepted']))
431
- {
432
- $ct_data['array_accepted']=Array();
433
- $ct_data['array_blocked']=Array();
434
- $ct_data['current_hour']=0;
435
- update_option('cleantalk_data', $ct_data);
436
- }
437
-
438
- $ret=Array('stat_accepted'=>@array_sum($ct_data['array_accepted']), 'stat_blocked'=>@array_sum($ct_data['array_blocked']), 'stat_all'=>@array_sum($ct_data['array_accepted']) + @array_sum($ct_data['array_blocked']));
439
- $args = array(
440
- 'id' => 'ct_parent_node',
441
- 'title' => '<img src="' . plugin_dir_url(__FILE__) . 'images/logo_small1.png" alt="" height="" style="margin-top:9px;" /><a href="#" class="ab-item alignright" title="Allowed/Blocked submissions. The number of submissions is being counted for past 24 hours." alt="allowed / blocked"><span class="ab-label" id="ct_stats"><span>' . $ret['stat_accepted'] . '</span> / <span>' . $ret['stat_blocked'] . '</span></span></a>'
442
- );
443
- $wp_admin_bar->add_node( $args );
444
-
445
- // add a child item to our parent item
446
- $args = array(
447
- 'id' => 'ct_dashboard_link',
448
- 'title' => '<a href="https://cleantalk.org/my/?user_token='.@$ct_data['user_token'].'&utm_source=wp-backend&utm_medium=admin-bar" target="_blank">CleanTalk '.__('dashboard', 'cleantalk').'</a>',
449
- 'parent' => 'ct_parent_node'
450
- );
451
- $wp_admin_bar->add_node( $args );
452
-
453
- // add another child item to our parent item (not to our first group)
454
- $args = array(
455
- 'id' => 'ct_settings_link',
456
- 'title' => '<a href="options-general.php?page=cleantalk">'.__('Settings', 'cleantalk').'</a>',
457
- 'parent' => 'ct_parent_node'
458
- );
459
- $wp_admin_bar->add_node( $args );
460
- }
461
- }
462
-
463
- /**
464
- * Admin callback function - Displays description of 'state' plugin parameters section
465
- */
466
- function ct_section_settings_state() {
467
- global $ct_options, $ct_data;
468
-
469
- $ct_options = ct_get_options();
470
- $ct_data = ct_get_data();
471
-
472
- if(!isset($ct_data['moderate_ip']))
473
- {
474
- $ct_data['moderate_ip'] = 0;
475
- }
476
-
477
- $img="yes.png";
478
- $img_no="no.png";
479
- $color="black";
480
- $test_failed=false;
481
- //if(isset($ct_data['testing_failed'])&&$ct_data['testing_failed']==1)
482
- if(trim($ct_options['apikey'])=='')
483
- {
484
- $img="yes_gray.png";
485
- $img_no="no_gray.png";
486
- $color="gray";
487
- }
488
- if(isset($ct_data['testing_failed'])&&$ct_data['testing_failed']==1)
489
- {
490
- $img="no.png";
491
- $img_no="no.png";
492
- $color="black";
493
- $test_failed=true;
494
- }
495
- if($ct_data['moderate_ip'] == 1)
496
- {
497
- $img="yes.png";
498
- $img_no="no.png";
499
- $color="black";
500
- $test_failed=false;
501
- }
502
- print "<div style='color:$color'>";
503
- if($ct_options['registrations_test']==1 || isset($ct_data['moderate_ip']) && $ct_data['moderate_ip'] == 1)
504
- {
505
- print '<img src="' . plugin_dir_url(__FILE__) . 'images/'.$img.'" alt="" height="" /> '.__('Registration forms', 'cleantalk');
506
- }
507
- else
508
- {
509
- print '<img src="' . plugin_dir_url(__FILE__) . 'images/'.$img_no.'" alt="" height="" /> '.__('Registration forms', 'cleantalk');
510
- }
511
-
512
- if($ct_options['comments_test']==1 || isset($ct_data['moderate_ip']) && $ct_data['moderate_ip'] == 1)
513
- {
514
- print ' &nbsp; <img src="' . plugin_dir_url(__FILE__) . 'images/'.$img.'" alt="" height="" /> '.__('Comments form', 'cleantalk');
515
- }
516
- else
517
- {
518
- print ' &nbsp; <img src="' . plugin_dir_url(__FILE__) . 'images/'.$img_no.'" alt="" height="" /> '.__('Comments form', 'cleantalk');
519
- }
520
-
521
- if($ct_options['contact_forms_test']==1 || isset($ct_data['moderate_ip']) && $ct_data['moderate_ip'] == 1)
522
- {
523
- print ' &nbsp; <img src="' . plugin_dir_url(__FILE__) . 'images/'.$img.'" alt="" height="" /> '.__('Contact forms', 'cleantalk');
524
- }
525
- else
526
- {
527
- print ' &nbsp; <img src="' . plugin_dir_url(__FILE__) . 'images/'.$img_no.'" alt="" height="" /> '.__('Contact forms', 'cleantalk');
528
- }
529
-
530
- if($ct_options['general_contact_forms_test']==1 || isset($ct_data['moderate_ip']) && $ct_data['moderate_ip'] == 1)
531
- {
532
- print ' &nbsp; <img src="' . plugin_dir_url(__FILE__) . 'images/'.$img.'" alt="" height="" /> '.__('Custom contact forms', 'cleantalk');
533
- }
534
- else
535
- {
536
- print ' &nbsp; <img src="' . plugin_dir_url(__FILE__) . 'images/'.$img_no.'" alt="" height="" /> '.__('Custom contact forms', 'cleantalk');
537
- }
538
- if($ct_data['moderate_ip'] == 1)
539
- {
540
- print "<br /><br />The anti-spam service is paid by your hosting provider. License #".$ct_data['ip_license'].".<br />";
541
- }
542
-
543
- print "</div>";
544
- if($test_failed && $ct_data['moderate_ip'] != 1)
545
- {
546
- //print "Testing is failed, check settings. Tech support <a target=_blank href='mailto:support@cleantalk.org'>support@cleantalk.org</a>";
547
- print __("Testing is failed, check settings. Tech support <a target=_blank href='mailto:support@cleantalk.org'>support@cleantalk.org</a>", 'cleantalk');
548
- }
549
- return true;
550
- }
551
-
552
- /**
553
- * Admin callback function - Displays description of 'autodel' plugin parameters section
554
- */
555
- function ct_section_settings_autodel() {
556
- return true;
557
- }
558
-
559
- /**
560
- * Admin callback function - Displays inputs of 'apikey' plugin parameter
561
- */
562
- function ct_input_apikey() {
563
- global $ct_options, $ct_data, $ct_notice_online_label;
564
- $ct_options=ct_get_options();
565
- $ct_data=ct_get_data();
566
-
567
- if(!isset($ct_data['admin_blocked']))
568
- {
569
- $blocked=0;
570
- }
571
- else
572
- {
573
- $blocked=$ct_data['admin_blocked'];
574
- }
575
-
576
- if($blocked>0)
577
- {
578
- $blocked = number_format($blocked, 0, ',', ' ');
579
-
580
- echo "<script>var cleantalk_blocked_message=\"<div style='height:24px;width:100%;display:table-cell; vertical-align:middle;'><span>CleanTalk ";
581
- printf(
582
- /* translators: %s: Number of spam messages */
583
- __( 'has blocked <b>%s</b> spam.', 'cleantalk' ),
584
- $blocked
585
- );
586
- print "</span></div><br />\";\n";
587
- }
588
- else
589
- {
590
- echo "<script>var cleantalk_blocked_message=\"\";\n";
591
- }
592
- echo "var cleantalk_statistics_link=\"<a class='cleantalk_manual_link' target='__blank' href='https://cleantalk.org/my?user_token=".@$ct_data['user_token']."'>".__('Click here to get anti-spam statistics', 'cleantalk')."</a>\";
593
- </script>";
594
-
595
- $value = $ct_options['apikey'];
596
- $def_value = '';
597
- $is_wpmu=false;
598
- if(!defined('CLEANTALK_ACCESS_KEY'))
599
- {
600
- echo "<input id='cleantalk_apikey' name='cleantalk_settings[apikey]' size='20' type='text' value='$value' style=\"font-size: 14pt;\"/>";
601
- echo "<script>var cleantalk_wpmu=false;</script>";
602
- }
603
- else
604
- {
605
- echo "<script>var cleantalk_wpmu=true;</script>";
606
- $is_wpmu=true;
607
- }
608
- echo "<script src='".plugins_url( 'cleantalk-admin.js', __FILE__ )."'></script>\n";
609
- if (ct_valid_key($value) === false && !$is_wpmu) {
610
- echo "<script>var cleantalk_good_key=false;</script>";
611
- if (function_exists('curl_init') && function_exists('json_decode')) {
612
- echo "<a target='__blank' style='' href='https://cleantalk.org/register?platform=wordpress&email=".urlencode(get_option('admin_email'))."&website=".urlencode(parse_url(get_option('siteurl'),PHP_URL_HOST))."'>".__('Click here to get access key manually', 'cleantalk')."</a>";
613
- echo '<br /><br /><input name="get_apikey_auto" type="submit" class="cleantalk_manual_link" value="' . __('Get access key automatically', 'cleantalk') . '" />';
614
-
615
- admin_addDescriptionsFields(sprintf(__('Admin e-mail (%s) will be used for registration', 'cleantalk'), get_option('admin_email')));
616
- admin_addDescriptionsFields(sprintf('<a target="__blank" style="color:#BBB;" href="https://cleantalk.org/publicoffer">%s</a>', __('License agreement', 'cleantalk')));
617
- }
618
- } else {
619
- echo "<script>var cleantalk_good_key=true;</script>";
620
- if (isset($_COOKIE[$ct_notice_online_label]) && $_COOKIE[$ct_notice_online_label] > 0) {
621
- //echo '&nbsp;&nbsp;<span style="text-decoration: underline;">The key accepted!</span>&nbsp;';
622
- }
623
- //echo "<br /><br /><a class='cleantalk_manual_link' target='__blank' href='https://cleantalk.org/my?user_token=".@$ct_data['user_token']."'>".__('Click here to get anti-spam statistics', 'cleantalk')."</a>";
624
- }
625
- }
626
-
627
- /**
628
- * Admin callback function - Displays inputs of 'comments_test' plugin parameter
629
- */
630
- function ct_input_comments_test() {
631
- global $ct_options, $ct_data;
632
-
633
- $ct_options = ct_get_options();
634
- $ct_data = ct_get_data();
635
-
636
- $value = $ct_options['comments_test'];
637
- echo "<input type='radio' id='cleantalk_comments_test1' name='cleantalk_settings[comments_test]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_comments_test1'> " . __('Yes') . "</label>";
638
- echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
639
- echo "<input type='radio' id='cleantalk_comments_test0' name='cleantalk_settings[comments_test]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_comments_test0'> " . __('No') . "</label>";
640
- admin_addDescriptionsFields(__('WordPress, JetPack, WooCommerce', 'cleantalk'));
641
- }
642
-
643
- /**
644
- * Admin callback function - Displays inputs of 'comments_test' plugin parameter
645
- */
646
- function ct_input_registrations_test() {
647
- global $ct_options, $ct_data;
648
-
649
- $ct_options = ct_get_options();
650
- $ct_data = ct_get_data();
651
-
652
- $value = $ct_options['registrations_test'];
653
- echo "<input type='radio' id='cleantalk_registrations_test1' name='cleantalk_settings[registrations_test]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_registrations_test1'> " . __('Yes') . "</label>";
654
- echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
655
- echo "<input type='radio' id='cleantalk_registrations_test0' name='cleantalk_settings[registrations_test]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_registrations_test0'> " . __('No') . "</label>";
656
- admin_addDescriptionsFields(__('WordPress, BuddyPress, bbPress, S2Member, WooCommerce', 'cleantalk'));
657
- }
658
-
659
- /**
660
- * Admin callback function - Displays inputs of 'contact_forms_test' plugin parameter
661
- */
662
- function ct_input_contact_forms_test() {
663
- global $ct_options, $ct_data;
664
-
665
- $ct_options = ct_get_options();
666
- $ct_data = ct_get_data();
667
-
668
- $value = $ct_options['contact_forms_test'];
669
- echo "<input type='radio' id='cleantalk_contact_forms_test1' name='cleantalk_settings[contact_forms_test]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_contact_forms_test1'> " . __('Yes') . "</label>";
670
- echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
671
- echo "<input type='radio' id='cleantalk_contact_forms_test0' name='cleantalk_settings[contact_forms_test]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_contact_forms_test0'> " . __('No') . "</label>";
672
- admin_addDescriptionsFields(__('Contact Form 7, Formiadble forms, JetPack, Fast Secure Contact Form, WordPress Landing Pages', 'cleantalk'));
673
- }
674
-
675
- /**
676
- * Admin callback function - Displays inputs of 'general_contact_forms_test' plugin parameter
677
- */
678
- function ct_input_general_contact_forms_test() {
679
- global $ct_options, $ct_data;
680
-
681
- $ct_options = ct_get_options();
682
- $ct_data = ct_get_data();
683
-
684
- $value = $ct_options['general_contact_forms_test'];
685
- echo "<input type='radio' id='cleantalk_general_contact_forms_test1' name='cleantalk_settings[general_contact_forms_test]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_general_contact_forms_test1'> " . __('Yes') . "</label>";
686
- echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
687
- echo "<input type='radio' id='cleantalk_general_contact_forms_test0' name='cleantalk_settings[general_contact_forms_test]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_general_contact_forms_test0'> " . __('No') . "</label>";
688
- admin_addDescriptionsFields(__('Anti spam test for any WordPress or themes contacts forms', 'cleantalk'));
689
- }
690
-
691
- /**
692
- * @author Artem Leontiev
693
- * Admin callback function - Displays inputs of 'Publicate relevant comments' plugin parameter
694
- *
695
- * @return null
696
- */
697
- function ct_input_remove_old_spam() {
698
- global $ct_options, $ct_data;
699
-
700
- $ct_options = ct_get_options();
701
- $ct_data = ct_get_data();
702
-
703
- $value = $ct_options['remove_old_spam'];
704
- echo "<input type='radio' id='cleantalk_remove_old_spam1' name='cleantalk_settings[remove_old_spam]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_remove_old_spam1'> " . __('Yes') . "</label>";
705
- echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
706
- echo "<input type='radio' id='cleantalk_remove_old_spam0' name='cleantalk_settings[remove_old_spam]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_remove_old_spam0'> " . __('No') . "</label>";
707
- admin_addDescriptionsFields(sprintf(__('Delete spam comments older than %d days.', 'cleantalk'), $ct_options['spam_store_days']));
708
- }
709
-
710
- /**
711
- * Admin callback function - Displays inputs of 'Show statistics in adminbar' plugin parameter
712
- *
713
- * @return null
714
- */
715
- function ct_input_show_adminbar() {
716
- global $ct_options, $ct_data;
717
-
718
- $ct_options = ct_get_options();
719
- $ct_data = ct_get_data();
720
-
721
- if(isset($ct_options['show_adminbar']))
722
- {
723
- $value = @intval($ct_options['show_adminbar']);
724
- }
725
- else
726
- {
727
- $value=1;
728
- }
729
- echo "<input type='radio' id='cleantalk_show_adminbar1' name='cleantalk_settings[show_adminbar]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_show_adminbar1'> " . __('Yes') . "</label>";
730
- echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
731
- echo "<input type='radio' id='cleantalk_show_adminbar0' name='cleantalk_settings[show_adminbar]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_show_adminbar0'> " . __('No') . "</label>";
732
- admin_addDescriptionsFields(sprintf(__('Show/hide CleanTalk icon in top level menu in WordPress backend. The number of submissions is being counted for past 24 hours.', 'cleantalk'), $ct_options['show_adminbar']));
733
- }
734
-
735
- /**
736
- * Admin callback function - Displays inputs of 'Show statistics in adminbar' plugin parameter
737
- *
738
- * @return null
739
- */
740
- function ct_input_general_postdata_test() {
741
- global $ct_options, $ct_data;
742
-
743
- $ct_options = ct_get_options();
744
- $ct_data = ct_get_data();
745
-
746
- if(isset($ct_options['general_postdata_test']))
747
- {
748
- $value = @intval($ct_options['general_postdata_test']);
749
- }
750
- else
751
- {
752
- $value=0;
753
- }
754
- echo "<input type='radio' id='cleantalk_general_postdata_test1' name='cleantalk_settings[general_postdata_test]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_general_postdata_test1'> " . __('Yes') . "</label>";
755
- echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
756
- echo "<input type='radio' id='cleantalk_general_postdata_test0' name='cleantalk_settings[general_postdata_test]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_general_postdata_test0'> " . __('No') . "</label>";
757
- @admin_addDescriptionsFields(sprintf(__('Check all POST submissions from website visitors. Enable this option if you have spam misses on website or you don`t have records about missed spam in <a href="https://cleantalk.org/my/?user_token='.@$ct_data['user_token'].'&utm_source=wp-backend&utm_medium=admin-bar" target="_blank">CleanTalk dashboard</a>.<br />СAUTION! Option can catch POST requests in WordPress backend', 'cleantalk'), $ct_options['general_postdata_test']));
758
- }
759
-
760
- function ct_input_use_ajax() {
761
- global $ct_options, $ct_data;
762
-
763
- $ct_options = ct_get_options();
764
- $ct_data = ct_get_data();
765
-
766
- if(isset($ct_options['use_ajax']))
767
- {
768
- $value = @intval($ct_options['use_ajax']);
769
- }
770
- else
771
- {
772
- $value=1;
773
- }
774
- echo "<input type='radio' id='cleantalk_use_ajax1' name='cleantalk_settings[use_ajax]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_use_ajax1'> " . __('Yes') . "</label>";
775
- echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
776
- echo "<input type='radio' id='cleantalk_use_ajax0' name='cleantalk_settings[use_ajax]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_use_ajax0'> " . __('No') . "</label>";
777
- @admin_addDescriptionsFields(sprintf(__('', 'cleantalk'), $ct_options['use_ajax']));
778
- }
779
-
780
- function ct_input_check_comments_number() {
781
- global $ct_options, $ct_data;
782
-
783
- $ct_options = ct_get_options();
784
- $ct_data = ct_get_data();
785
-
786
- if(isset($ct_options['check_comments_number']))
787
- {
788
- $value = @intval($ct_options['check_comments_number']);
789
- }
790
- else
791
- {
792
- $value=1;
793
- }
794
-
795
- if(defined('CLEANTALK_CHECK_COMMENTS_NUMBER'))
796
- {
797
- $comments_check_number = CLEANTALK_CHECK_COMMENTS_NUMBER;
798
- }
799
- else
800
- {
801
- $comments_check_number = 3;
802
- }
803
-
804
- echo "<input type='radio' id='cleantalk_check_comments_number1' name='cleantalk_settings[check_comments_number]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_check_comments_number1'> " . __('Yes') . "</label>";
805
- echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
806
- echo "<input type='radio' id='cleantalk_check_comments_number0' name='cleantalk_settings[check_comments_number]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_check_comments_number0'> " . __('No') . "</label>";
807
- @admin_addDescriptionsFields(sprintf(__("Dont't check comments for users with above $comments_check_number comments", 'cleantalk'), $ct_options['check_comments_number']));
808
- }
809
-
810
- function ct_input_collect_details() {
811
- global $ct_options, $ct_data;
812
-
813
- $ct_options = ct_get_options();
814
- $ct_data = ct_get_data();
815
-
816
- if(isset($ct_options['collect_details']))
817
- {
818
- $value = @intval($ct_options['collect_details']);
819
- }
820
- else
821
- {
822
- $value=0;
823
- }
824
-
825
- echo "<div id='cleantalk_anchor2' style='display:none'></div><input type=hidden name='cleantalk_settings[collect_details]' value='0' />";
826
- echo "<input type='checkbox' id='collect_details1' name='cleantalk_settings[collect_details]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='collect_details1'> " . __('Collect details about browsers') . "</label>";
827
- @admin_addDescriptionsFields(sprintf(__("Checking this box you allow plugin store information about screen size and browser plugins of website visitors. The option in a beta state.", 'cleantalk'), $ct_options['spam_firewall']));
828
- echo "<script>
829
- jQuery(document).ready(function(){
830
- jQuery('#cleantalk_anchor2').parent().parent().children().first().hide();
831
- jQuery('#cleantalk_anchor2').parent().css('padding-left','0px');
832
- jQuery('#cleantalk_anchor2').parent().attr('colspan', '2');
833
- });
834
- </script>";
835
- }
836
-
837
- function ct_input_check_messages_number() {
838
- global $ct_options, $ct_data;
839
-
840
- $ct_options = ct_get_options();
841
- $ct_data = ct_get_data();
842
-
843
- if(isset($ct_options['check_messages_number']))
844
- {
845
- $value = @intval($ct_options['check_messages_number']);
846
- }
847
- else
848
- {
849
- $value=0;
850
- }
851
-
852
- if(defined('CLEANTALK_CHECK_MESSAGES_NUMBER'))
853
- {
854
- $messages_check_number = CLEANTALK_CHECK_MESSAGES_NUMBER;
855
- }
856
- else
857
- {
858
- $messages_check_number = 3;
859
- }
860
-
861
- echo "<input type='radio' id='cleantalk_check_messages_number1' name='cleantalk_settings[check_messages_number]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_check_messages_number1'> " . __('Yes') . "</label>";
862
- echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
863
- echo "<input type='radio' id='cleantalk_check_messages_number0' name='cleantalk_settings[check_messages_number]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_check_messages_number0'> " . __('No') . "</label>";
864
- @admin_addDescriptionsFields(sprintf(__("Dont't check messages for users with above $messages_check_number messages", 'cleantalk'), $ct_options['check_messages_number']));
865
- }
866
-
867
- function ct_input_check_external() {
868
- global $ct_options, $ct_data;
869
-
870
- $ct_options = ct_get_options();
871
- $ct_data = ct_get_data();
872
-
873
- if(isset($ct_options['check_external']))
874
- {
875
- $value = @intval($ct_options['check_external']);
876
- }
877
- else
878
- {
879
- $value=0;
880
- }
881
- echo "<input type='radio' id='cleantalk_check_external1' name='cleantalk_settings[check_external]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_check_external1'> " . __('Yes') . "</label>";
882
- echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
883
- echo "<input type='radio' id='cleantalk_check_external0' name='cleantalk_settings[check_external]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_check_external0'> " . __('No') . "</label>";
884
- @admin_addDescriptionsFields(sprintf(__('', 'cleantalk'), $ct_options['check_external']));
885
- }
886
-
887
- function ct_input_set_cookies() {
888
- global $ct_options, $ct_data;
889
-
890
- $ct_options = ct_get_options();
891
- $ct_data = ct_get_data();
892
-
893
- if(isset($ct_options['set_cookies']))
894
- {
895
- $value = @intval($ct_options['set_cookies']);
896
- }
897
- else
898
- {
899
- $value=0;
900
- }
901
- echo "<input type='radio' id='cleantalk_set_cookies1' name='cleantalk_settings[set_cookies]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_set_cookies1'> " . __('Yes') . "</label>";
902
- echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
903
- echo "<input type='radio' id='cleantalk_set_cookies0' name='cleantalk_settings[set_cookies]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_set_cookies0'> " . __('No') . "</label>";
904
- @admin_addDescriptionsFields(sprintf(__('Turn this option off to deny plugin generates any cookies on website front-end. This option is helpful if you use Varnish. But most of contact forms will not be protected by CleanTalk if the option is turned off!', 'cleantalk')));
905
- }
906
-
907
- function ct_input_ssl_on() {
908
- global $ct_options, $ct_data;
909
-
910
- $ct_options = ct_get_options();
911
- $ct_data = ct_get_data();
912
-
913
- if(isset($ct_options['ssl_on']))
914
- {
915
- $value = @intval($ct_options['ssl_on']);
916
- }
917
- else
918
- {
919
- $value=0;
920
- }
921
- echo "<input type='radio' id='cleantalk_ssl_on1' name='cleantalk_settings[ssl_on]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_ssl_on1'> " . __('Yes') . "</label>";
922
- echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
923
- echo "<input type='radio' id='cleantalk_ssl_on0' name='cleantalk_settings[ssl_on]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_ssl_on0'> " . __('No') . "</label>";
924
- @admin_addDescriptionsFields(sprintf(__('Turn this option on to use encrypted (SSL) connection with CleanTalk servers.', 'cleantalk')));
925
- }
926
-
927
- function ct_input_show_link() {
928
- global $ct_options, $ct_data;
929
-
930
- $ct_options = ct_get_options();
931
- $ct_data = ct_get_data();
932
-
933
- if(isset($ct_options['show_link']))
934
- {
935
- $value = @intval($ct_options['show_link']);
936
- }
937
- else
938
- {
939
- $value=0;
940
- }
941
-
942
- /* echo "<input type='radio' id='cleantalk_show_link1' name='cleantalk_settings[show_link]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_show_link1'> " . __('Yes') . "</label>";
943
- echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
944
- echo "<input type='radio' id='cleantalk_show_link0' name='cleantalk_settings[show_link]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_show_link0'> " . __('No') . "</label>";*/
945
-
946
- echo "<div id='cleantalk_anchor' style='display:none'></div><input type=hidden name='cleantalk_settings[show_link]' value='0' />";
947
- echo "<input type='checkbox' id='cleantalk_show_link1' name='cleantalk_settings[show_link]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_show_link1'> " . __('Tell others about CleanTalk') . "</label>";
948
- @admin_addDescriptionsFields(sprintf(__("Checking this box places a small link under the comment form that lets others know what anti-spam tool protects your site.", 'cleantalk'), $ct_options['show_link']));
949
- echo "<script>
950
- jQuery(document).ready(function(){
951
- jQuery('#cleantalk_anchor').parent().parent().children().first().hide();
952
- jQuery('#cleantalk_anchor').parent().css('padding-left','0px');
953
- });
954
- </script>";
955
- }
956
-
957
- function ct_input_spam_firewall() {
958
- global $ct_options, $ct_data;
959
-
960
- $ct_options = ct_get_options();
961
- $ct_data = ct_get_data();
962
-
963
- if(isset($ct_options['spam_firewall']))
964
- {
965
- $value = @intval($ct_options['spam_firewall']);
966
- }
967
- else
968
- {
969
- $value=0;
970
- }
971
-
972
- echo "<div id='cleantalk_anchor1' style='display:none'></div><input type=hidden name='cleantalk_settings[spam_firewall]' value='0' />";
973
- echo "<input type='checkbox' id='cleantalk_spam_firewall1' name='cleantalk_settings[spam_firewall]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_spam_firewall1'> " . __('SpamFireWall') . "</label>";
974
- @admin_addDescriptionsFields(sprintf(__("This option allows to filter spam bots before they access website. Also reduces CPU usage on hosting server and accelerates pages load time.", 'cleantalk'), $ct_options['spam_firewall']) .
975
- " " .
976
- '<a href="https://cleantalk.org/cleantalk-spam-firewall" style="font-size: 10pt; color: #666 !important" target="_blank">' . __('Learn more') . '</a>.'
977
- );
978
- echo "<script>
979
- jQuery(document).ready(function(){
980
- jQuery('#cleantalk_anchor1').parent().parent().children().first().hide();
981
- jQuery('#cleantalk_anchor1').parent().css('padding-left','0px');
982
- jQuery('#cleantalk_anchor1').parent().attr('colspan', '2');
983
- });
984
- </script>";
985
- }
986
-
987
-
988
- /**
989
- * Admin callback function - Plugin parameters validator
990
- */
991
- function ct_settings_validate($input) {
992
- return $input;
993
- }
994
-
995
-
996
- /**
997
- * Admin callback function - Displays plugin options page
998
- */
999
- function ct_settings_page() {
1000
- ?>
1001
- <style type="text/css">
1002
- .cleantalk_manual_link {padding: 10px; background: #3399FF; color: #fff; border:0 none;
1003
- cursor:pointer;
1004
- -webkit-border-radius: 5px;
1005
- border-radius: 5px;
1006
- font-size: 12pt;
1007
- }
1008
- .cleantalk_manual_link
1009
- {
1010
- background: #2ea2cc;
1011
- border-color: #0074a2;
1012
- -webkit-box-shadow: inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);
1013
- box-shadow: inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);
1014
- color: #fff;
1015
- text-decoration: none;
1016
- display: inline-block;
1017
- text-decoration: none;
1018
- font-size: 13px;
1019
- line-height: 26px;
1020
- height: 28px;
1021
- margin: 0;
1022
- padding: 0 10px 1px;
1023
- cursor: pointer;
1024
- border-width: 1px;
1025
- border-style: solid;
1026
- -webkit-appearance: none;
1027
- -webkit-border-radius: 3px;
1028
- border-radius: 3px;
1029
- white-space: nowrap;
1030
- -webkit-box-sizing: border-box;
1031
- -moz-box-sizing: border-box;
1032
- box-sizing: border-box;
1033
- }
1034
- .cleantalk_manual_link:hover
1035
- {
1036
- color:white;
1037
- }
1038
-
1039
- </style>
1040
-
1041
- <div>
1042
- <?php
1043
- if(is_network_admin())
1044
- {
1045
- print '<form method="post">';
1046
- if(defined('CLEANTALK_ACCESS_KEY'))
1047
- {
1048
- print "<br />Your CleanTalk access key is: <b>".CLEANTALK_ACCESS_KEY."</b><br />
1049
- You can change it in your wp-config.php file.<br />";
1050
- }
1051
- else
1052
- {
1053
- print "<br />To set up global CleanTalk access key for all websites, define constant in your wp-config.php file before defining database constants:<br />
1054
- <pre>define('CLEANTALK_ACCESS_KEY', 'place your key here');</pre>";
1055
- }
1056
- }
1057
- else
1058
- {
1059
- ?>
1060
- <form action="options.php" method="post">
1061
- <?php settings_fields('cleantalk_settings'); ?>
1062
- <?php do_settings_sections('cleantalk'); ?>
1063
- <br>
1064
- <input name="Submit" type="submit" class='cleantalk_manual_link' value="<?php esc_attr_e('Save Changes'); ?>" />
1065
- <?php
1066
- }
1067
- ?>
1068
-
1069
- </form>
1070
- </div>
1071
- <?php
1072
-
1073
- if (ct_valid_key() === false)
1074
- return null;
1075
- ?>
1076
- <br />
1077
- <br />
1078
- <br />
1079
- <div>
1080
- <?php echo __('Plugin Homepage at', 'cleantalk'); ?> <a href="http://cleantalk.org" target="_blank">cleantalk.org</a>.<br />
1081
- <?php echo __('Tech support CleanTalk:', 'cleantalk'); ?> <a href="https://cleantalk.org/forum/viewforum.php?f=25" target="_blank"><?php echo __('CleanTalk tech forum', 'cleantalk'); ?></a>.<br /><?php echo __('Use s@cleantalk.org to test plugin in any WordPress form.', 'cleantalk'); ?><br />
1082
- </div>
1083
- <?php
1084
- }
1085
-
1086
- /**
1087
- * Notice blog owner if plugin is used without Access key
1088
- * @return bool
1089
- */
1090
- function cleantalk_admin_notice_message(){
1091
- global $show_ct_notice_trial, $show_ct_notice_renew, $show_ct_notice_online, $show_ct_notice_autokey, $ct_notice_autokey_value, $ct_plugin_name, $ct_options, $ct_data;
1092
-
1093
- $ct_options = ct_get_options();
1094
- $ct_data = ct_get_data();
1095
-
1096
- if(!isset($ct_data['moderate_ip']))
1097
- {
1098
- $ct_data['moderate_ip'] = 0;
1099
- }
1100
-
1101
- $user_token = '';
1102
- if (isset($ct_data['user_token']) && $ct_data['user_token'] != '') {
1103
- $user_token = '&user_token=' . $ct_data['user_token'];
1104
- }
1105
-
1106
- $show_notice = true;
1107
-
1108
- if(current_user_can('activate_plugins'))
1109
- {
1110
- $value = 1;
1111
- }
1112
- else
1113
- {
1114
- $value = 0;
1115
- }
1116
-
1117
- 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())) {
1118
- echo '<div class="error"><h3>' . sprintf(__("Unable to get Access key automatically: %s", 'cleantalk'), $ct_notice_autokey_value);
1119
- echo " <a target='__blank' style='margin-left: 10px' href='https://cleantalk.org/register?platform=wordpress&email=".urlencode(get_option('admin_email'))."&website=".urlencode(parse_url(get_option('siteurl'),PHP_URL_HOST))."'>".__('Get the Access key', 'cleantalk').'</a></h3></div>';
1120
- }
1121
-
1122
- if ($ct_data['moderate_ip'] == 0 && $show_notice && ct_valid_key($ct_options['apikey']) === false && $value==1 &&
1123
- (is_network_admin() || (!defined('WP_ALLOW_MULTISITE')||defined('WP_ALLOW_MULTISITE')&&WP_ALLOW_MULTISITE==false) && is_admin()) ) {
1124
- 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>';
1125
- $show_notice = false;
1126
- }
1127
-
1128
- if(isset($ct_data['show_ct_notice_trial']))
1129
- {
1130
- $show_ct_notice_trial = intval($ct_data['show_ct_notice_trial']);
1131
- }
1132
- else
1133
- {
1134
- $show_ct_notice_trial = 0;
1135
- }
1136
-
1137
- if ($show_notice && $show_ct_notice_trial ==1 && $value==1 && (is_network_admin() || is_admin()) && $ct_data['moderate_ip'] == 0) {
1138
- echo '<div class="error"><h3>' . sprintf(__("%s trial period ends, please upgrade to %s!", 'cleantalk'), "<a href=\"options-general.php?page=cleantalk\">$ct_plugin_name</a>", "<a href=\"http://cleantalk.org/my/bill/recharge?utm_source=wp-backend&utm_medium=cpc&utm_campaign=WP%20backend%20trial$user_token\" target=\"_blank\"><b>premium version</b></a>") . '</h3></div>';
1139
- $show_notice = false;
1140
- }
1141
-
1142
- if(isset($ct_data['next_notice_show']))
1143
- {
1144
- $next_notice_show=$ct_data['next_notice_show'];
1145
- }
1146
- else
1147
- {
1148
- $next_notice_show=0;
1149
- }
1150
-
1151
- if(isset($ct_data['show_ct_notice_renew']))
1152
- {
1153
- $show_ct_notice_renew = intval($ct_data['show_ct_notice_renew']);
1154
- }
1155
- else
1156
- {
1157
- $show_ct_notice_renew = 0;
1158
- }
1159
-
1160
- if ($show_notice && $show_ct_notice_renew == 1 && $value==1 && (is_network_admin() || is_admin()) && $ct_data['moderate_ip'] != 1) {
1161
- $button_html = "<a href=\"http://cleantalk.org/my/bill/recharge?utm_source=wp-backend&utm_medium=cpc&utm_campaign=WP%20backend%20renew$user_token\" target=\"_blank\">" . '<input type="button" class="button button-primary" value="' . __('RENEW ANTI-SPAM', 'cleantalk') . '" />' . "</a>";
1162
- 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\" target=\"_blank\"><b>" . __('next year', 'cleantalk') ."</b></a>") . '<br /><br />' . $button_html . '</h3></div>';
1163
- $show_notice = false;
1164
- }
1165
-
1166
- if ($show_notice && $show_ct_notice_online != '' && $value==1 && (is_network_admin() || is_admin()) && $ct_data['moderate_ip'] != 1) {
1167
- 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){
1168
- echo '<div class="error"><h3><b>';
1169
- echo __("Wrong <a href=\"options-general.php?page=cleantalk\"><b style=\"color: #49C73B;\">Clean</b><b style=\"color: #349ebf;\">Talk</b> access key</a>! Please check it or ask <a target=\"_blank\" href=\"https://cleantalk.org/forum/\">support</a>.", 'cleantalk');
1170
- echo '</b></h3></div>';
1171
- }
1172
- }
1173
-
1174
- //ct_send_feedback(); -- removed to ct_do_this_hourly()
1175
-
1176
- return true;
1177
- }
1178
-
1179
- /**
1180
- * @author Artem Leontiev
1181
- *
1182
- * Add descriptions for field
1183
- */
1184
- function admin_addDescriptionsFields($descr = '') {
1185
- echo "<div style='font-size: 10pt; color: #666 !important'>$descr</div>";
1186
- }
1187
-
1188
- /**
1189
- * Test API key
1190
- */
1191
- function ct_valid_key($apikey = null) {
1192
- global $ct_options, $ct_data;
1193
-
1194
- $ct_options = ct_get_options();
1195
- $ct_data = ct_get_data();
1196
-
1197
- if ($apikey === null) {
1198
- $apikey = $ct_options['apikey'];
1199
- }
1200
-
1201
- return ($apikey === 'enter key' || $apikey === '') ? false : true;
1202
- }
1203
-
1204
- /**
1205
- * Admin action 'comment_unapproved_to_approved' - Approve comment, sends good feedback to cleantalk, removes cleantalk resume
1206
- * @param object $comment_object Comment object
1207
- * @return boolean TRUE
1208
- */
1209
- function ct_comment_approved($comment_object) {
1210
- $comment = get_comment($comment_object->comment_ID, 'ARRAY_A');
1211
- $hash = get_comment_meta($comment_object->comment_ID, 'ct_hash', true);
1212
-
1213
- $comment['comment_content'] = ct_unmark_red($comment['comment_content']);
1214
- $comment['comment_content'] = ct_feedback($hash, $comment['comment_content'], 1);
1215
- $comment['comment_approved'] = 1;
1216
- wp_update_comment($comment);
1217
-
1218
- return true;
1219
- }
1220
-
1221
- /**
1222
- * Admin action 'comment_approved_to_unapproved' - Unapprove comment, sends bad feedback to cleantalk
1223
- * @param object $comment_object Comment object
1224
- * @return boolean TRUE
1225
- */
1226
- function ct_comment_unapproved($comment_object) {
1227
- $comment = get_comment($comment_object->comment_ID, 'ARRAY_A');
1228
- $hash = get_comment_meta($comment_object->comment_ID, 'ct_hash', true);
1229
- ct_feedback($hash, $comment['comment_content'], 0);
1230
- $comment['comment_approved'] = 0;
1231
- wp_update_comment($comment);
1232
-
1233
- return true;
1234
- }
1235
-
1236
- /**
1237
- * Admin actions 'comment_unapproved_to_spam', 'comment_approved_to_spam' - Mark comment as spam, sends bad feedback to cleantalk
1238
- * @param object $comment_object Comment object
1239
- * @return boolean TRUE
1240
- */
1241
- function ct_comment_spam($comment_object) {
1242
- $comment = get_comment($comment_object->comment_ID, 'ARRAY_A');
1243
- $hash = get_comment_meta($comment_object->comment_ID, 'ct_hash', true);
1244
- ct_feedback($hash, $comment['comment_content'], 0);
1245
- $comment['comment_approved'] = 'spam';
1246
- wp_update_comment($comment);
1247
-
1248
- return true;
1249
- }
1250
-
1251
-
1252
- /**
1253
- * Unspam comment
1254
- * @param type $comment_id
1255
- */
1256
- function ct_unspam_comment($comment_id) {
1257
- update_comment_meta($comment_id, '_wp_trash_meta_status', 1);
1258
- $comment = get_comment($comment_id, 'ARRAY_A');
1259
- $hash = get_comment_meta($comment_id, 'ct_hash', true);
1260
- $comment['comment_content'] = ct_unmark_red($comment['comment_content']);
1261
- $comment['comment_content'] = ct_feedback($hash, $comment['comment_content'], 1);
1262
-
1263
- wp_update_comment($comment);
1264
- }
1265
-
1266
- /**
1267
- * Admin filter 'get_comment_text' - Adds some info to comment text to display
1268
- * @param string $current_text Current comment text
1269
- * @return string New comment text
1270
- */
1271
- function ct_get_comment_text($current_text) {
1272
- global $comment;
1273
- $new_text = $current_text;
1274
- if (isset($comment) && is_object($comment)) {
1275
- $hash = get_comment_meta($comment->comment_ID, 'ct_hash', true);
1276
- if (!empty($hash)) {
1277
- $new_text .= '<hr>Cleantalk ID = ' . $hash;
1278
- }
1279
- }
1280
- return $new_text;
1281
- }
1282
-
1283
- /**
1284
- * Send feedback for user deletion
1285
- * @return null
1286
- */
1287
- function ct_delete_user($user_id) {
1288
- $hash = get_user_meta($user_id, 'ct_hash', true);
1289
- if ($hash !== '') {
1290
- ct_feedback($hash, null, 0);
1291
- }
1292
- }
1293
-
1294
- /**
1295
- * Manage links and plugins page
1296
- * @return array
1297
- */
1298
- if (!function_exists ( 'ct_register_plugin_links')) {
1299
- function ct_register_plugin_links($links, $file) {
1300
- global $ct_plugin_basename;
1301
- if ($file == $ct_plugin_basename ) {
1302
- if(!is_network_admin())
1303
- {
1304
- $links[] = '<a href="options-general.php?page=cleantalk">' . __( 'Settings' ) . '</a>';
1305
- }
1306
- else
1307
- {
1308
- $links[] = '<a href="settings.php?page=cleantalk">' . __( 'Settings' ) . '</a>';
1309
- }
1310
-
1311
- $links[] = '<a href="http://wordpress.org/plugins/cleantalk-spam-protect/faq/" target="_blank">' . __( 'FAQ','cleantalk' ) . '</a>';
1312
- $links[] = '<a href="http://cleantalk.org/forum" target="_blank">' . __( 'Support','cleantalk' ) . '</a>';
1313
- }
1314
- return $links;
1315
- }
1316
- }
1317
-
1318
- /**
1319
- * Manage links in plugins list
1320
- * @return array
1321
- */
1322
- if (!function_exists ( 'ct_plugin_action_links')) {
1323
- function ct_plugin_action_links($links, $file) {
1324
- global $ct_plugin_basename;
1325
-
1326
- if ($file == $ct_plugin_basename) {
1327
- if(!is_network_admin())
1328
- {
1329
- $settings_link = '<a href="options-general.php?page=cleantalk">' . __( 'Settings' ) . '</a>';
1330
- }
1331
- else
1332
- {
1333
- $settings_link = '<a href="settings.php?page=cleantalk">' . __( 'Settings' ) . '</a>';
1334
- }
1335
- array_unshift( $links, $settings_link ); // before other links
1336
- }
1337
- return $links;
1338
- }
1339
- }
1340
-
1341
- /**
1342
- * After options update
1343
- * @return array
1344
- */
1345
- function ct_update_option($option_name) {
1346
- global $show_ct_notice_online, $ct_notice_online_label, $ct_notice_trial_label, $trial_notice_showtime, $ct_options, $ct_data, $ct_server_timeout;
1347
-
1348
- $ct_options = ct_get_options(true);
1349
- $ct_data = ct_get_data(true);
1350
-
1351
- if($option_name !== 'cleantalk_settings') {
1352
- return;
1353
- }
1354
-
1355
- $api_key = $ct_options['apikey'];
1356
- if (isset($_POST['cleantalk_settings']['apikey'])) {
1357
- $api_key = trim($_POST['cleantalk_settings']['apikey']);
1358
- $ct_options['apikey'] = $api_key;
1359
- }
1360
-
1361
- if(@isset($_POST['cleantalk_settings']['spam_firewall']) && $_POST['cleantalk_settings']['spam_firewall']==1)
1362
- {
1363
- cleantalk_update_sfw();
1364
- }
1365
-
1366
- if (!ct_valid_key($api_key)) {
1367
- return;
1368
- }
1369
-
1370
- /*$ct_base_call_result = ct_base_call(array(
1371
- 'message' => 'CleanTalk setup test',
1372
- 'example' => null,
1373
- 'sender_email' => 'good@cleantalk.org',
1374
- 'sender_nickname' => 'CleanTalk',
1375
- 'post_info' => '',
1376
- 'checkjs' => 1
1377
- ));*/
1378
-
1379
- $key_valid = true;
1380
- $app_server_error = false;
1381
- $ct_data['testing_failed']=0;
1382
-
1383
-
1384
- if(!function_exists('sendRawRequest'))
1385
- {
1386
- require_once('cleantalk.class.php');
1387
- }
1388
-
1389
- $request=Array();
1390
- $request['method_name'] = 'notice_validate_key';
1391
- $request['auth_key'] = $api_key;
1392
- $url='https://api.cleantalk.org';
1393
- if(!function_exists('sendRawRequest'))
1394
- {
1395
- require_once('cleantalk.class.php');
1396
- }
1397
- $result=sendRawRequest($url, $request);
1398
-
1399
- if ($result)
1400
- {
1401
- $result = json_decode($result, true);
1402
- if (isset($result['valid']) && $result['valid'] == 0) {
1403
- $key_valid = false;
1404
- $ct_data['testing_failed']=1;
1405
- }
1406
- }
1407
- if (!$result || !isset($result['valid']))
1408
- {
1409
- $app_server_error = true;
1410
- $ct_data['testing_failed']=1;
1411
- }
1412
-
1413
- update_option('cleantalk_data', $ct_data);
1414
-
1415
- if ($key_valid) {
1416
- // Removes cookie for server errors
1417
- if ($app_server_error) {
1418
- setcookie($ct_notice_online_label, '', 1, '/'); // time 1 is exactly in past even clients time() is wrong
1419
- unset($_COOKIE[$ct_notice_online_label]);
1420
- } else {
1421
- setcookie($ct_notice_online_label, (string) time(), strtotime("+14 days"), '/');
1422
- }
1423
- setcookie($ct_notice_trial_label, '0', strtotime("+$trial_notice_showtime minutes"), '/');
1424
- } else {
1425
- setcookie($ct_notice_online_label, 'BAD_KEY', 0, '/');
1426
- }
1427
- }
1428
-
1429
- /**
1430
- * Unmark bad words
1431
- * @param string $message
1432
- * @return string Cleat comment
1433
- */
1434
- function ct_unmark_red($message) {
1435
- $message = preg_replace("/\<font rel\=\"cleantalk\" color\=\"\#FF1000\"\>(\S+)\<\/font>/iu", '$1', $message);
1436
-
1437
- return $message;
1438
- }
1439
-
1440
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/inc/cleantalk-admin_old.php DELETED
@@ -1,1219 +0,0 @@
1
- <?php
2
-
3
- $ct_plugin_basename = 'cleantalk-spam-protect/cleantalk.php';
4
- $ct_options=ct_get_options();
5
- $ct_data=ct_get_data();
6
-
7
- add_filter( 'activity_box_end', 'cleantalk_custom_glance_items', 10, 1 );
8
- function cleantalk_custom_glance_items( )
9
- {
10
- global $ct_data;
11
- $ct_data=ct_get_data();
12
- if(!isset($ct_data['admin_blocked']))
13
- {
14
- $blocked=0;
15
- }
16
- else
17
- {
18
- $blocked=$ct_data['admin_blocked'];
19
- }
20
- if($blocked>0)
21
- {
22
- $blocked = number_format($blocked, 0, ',', ' ');
23
- print "<div style='height:24px;width:100%;display:table-cell; vertical-align:middle;'><img src='" . plugin_dir_url(__FILE__) . "images/logo_color.png' style='margin-right:1em;vertical-align:middle;'/><span><a href='options-general.php?page=cleantalk'>CleanTalk</a> ";
24
- printf(
25
- /* translators: %s: Number of spam messages */
26
- __( 'has blocked %s spam', 'cleantalk' ),
27
- $blocked
28
- );
29
- print "</span></div>";
30
- }
31
- }
32
-
33
- if(isset($_GET['close_notice']))
34
- {
35
- global $ct_data, $pagenow;
36
- $ct_data=ct_get_data();
37
- $ct_data['next_notice_show']=time()+86400;
38
- update_option('cleantalk_data', $ct_data);
39
- $_SERVER["QUERY_STRING"]=str_replace("close_notice=1","",$_SERVER["QUERY_STRING"]);
40
- header("Location: $pagenow?".$_SERVER["QUERY_STRING"]);
41
- }
42
-
43
- // Timeout to get app server
44
- $ct_server_timeout = 10;
45
-
46
-
47
- /**
48
- * Admin action 'admin_print_footer_scripts' - Enqueue admin script for checking if timezone offset is saved in settings
49
- */
50
-
51
- add_action( 'admin_print_footer_scripts', 'ct_add_stats_js' );
52
-
53
- function ct_add_stats_js()
54
- {
55
- echo "<script src='".plugins_url( 'cleantalk-stats.js', __FILE__ )."'></script>\n";
56
- }
57
-
58
-
59
-
60
-
61
- /**
62
- * Admin action 'wp_ajax_ajax_get_timezone' - Ajax method for getting timezone offset
63
- */
64
-
65
- function ct_ajax_get_timezone()
66
- {
67
- global $ct_data;
68
- check_ajax_referer( 'ct_secret_nonce', 'security' );
69
- $ct_data = ct_get_data();
70
- if(isset($_POST['offset']))
71
- {
72
- $ct_data['timezone'] = intval($_POST['offset']);
73
- update_option('cleantalk_data', $ct_data);
74
- }
75
- }
76
-
77
- add_action( 'wp_ajax_ajax_get_timezone', 'ct_ajax_get_timezone' );
78
-
79
-
80
- /**
81
- * Admin action 'admin_enqueue_scripts' - Enqueue admin script of reloading admin page after needed AJAX events
82
- * @param string $hook URL of hooked page
83
- */
84
- function ct_enqueue_scripts($hook) {
85
- if ($hook == 'edit-comments.php')
86
- wp_enqueue_script('ct_reload_script', plugins_url('/cleantalk-rel.js', __FILE__));
87
- }
88
-
89
- /**
90
- * Admin action 'admin_menu' - Add the admin options page
91
- */
92
- function ct_admin_add_page() {
93
- add_options_page(__('CleanTalk settings', 'cleantalk'), 'CleanTalk', 'manage_options', 'cleantalk', 'ct_settings_page');
94
- }
95
-
96
- /**
97
- * Admin action 'admin_init' - Add the admin settings and such
98
- */
99
- function ct_admin_init() {
100
- global $ct_server_timeout, $show_ct_notice_autokey, $ct_notice_autokey_label, $ct_notice_autokey_value, $show_ct_notice_renew, $ct_notice_renew_label, $show_ct_notice_trial, $ct_notice_trial_label, $show_ct_notice_online, $ct_notice_online_label, $renew_notice_showtime, $trial_notice_showtime, $ct_plugin_name, $ct_options, $ct_data, $trial_notice_check_timeout, $account_notice_check_timeout, $ct_user_token_label, $cleantalk_plugin_version, $notice_check_timeout;
101
-
102
- $ct_options = ct_get_options();
103
- $ct_data = ct_get_data();
104
-
105
- $current_version=@trim($ct_data['current_version']);
106
- if($current_version!=$cleantalk_plugin_version)
107
- {
108
- $ct_data['current_version']=$cleantalk_plugin_version;
109
- update_option('cleantalk_data', $ct_data);
110
- /*$ct_base_call_result = ct_base_call(array(
111
- 'message' => 'CleanTalk setup test',
112
- 'example' => null,
113
- 'sender_email' => 'good@cleantalk.org',
114
- 'sender_nickname' => 'CleanTalk',
115
- 'post_info' => '',
116
- 'checkjs' => 1
117
- ));*/
118
- }
119
- if(isset($_POST['option_page'])&&$_POST['option_page']=='cleantalk_settings')
120
- {
121
- /*$ct_base_call_result = ct_base_call(array(
122
- 'message' => 'CleanTalk setup test',
123
- 'example' => null,
124
- 'sender_email' => 'good@cleantalk.org',
125
- 'sender_nickname' => 'CleanTalk',
126
- 'post_info' => '',
127
- 'checkjs' => 1
128
- ));*/
129
- }
130
-
131
- if(@isset($_POST['cleantalk_settings']['spam_firewall']) && $_POST['cleantalk_settings']['spam_firewall']==1 || isset($ct_options['spam_firewall']) && intval($ct_options['spam_firewall'])==1)
132
- {
133
- cleantalk_update_sfw();
134
- }
135
-
136
- $show_ct_notice_trial = false;
137
- if (isset($_COOKIE[$ct_notice_trial_label])) {
138
- if ($_COOKIE[$ct_notice_trial_label] == 1) {
139
- $show_ct_notice_trial = true;
140
- }
141
- }
142
- $show_ct_notice_renew = false;
143
- if (isset($_COOKIE[$ct_notice_renew_label])) {
144
- if ($_COOKIE[$ct_notice_renew_label] == 1) {
145
- $show_ct_notice_renew = true;
146
- }
147
- }
148
- $show_ct_notice_autokey = false;
149
- if (isset($_COOKIE[$ct_notice_autokey_label]) && !empty($_COOKIE[$ct_notice_autokey_label])) {
150
- if (!empty($_COOKIE[$ct_notice_autokey_label])) {
151
- $show_ct_notice_autokey = true;
152
- $ct_notice_autokey_value = base64_decode($_COOKIE[$ct_notice_autokey_label]);
153
- setcookie($ct_notice_autokey_label, '', 1, '/');
154
- }
155
- }
156
-
157
- if (isset($_POST['get_apikey_auto'])){
158
- $email = get_option('admin_email');
159
- $website = parse_url(get_option('siteurl'),PHP_URL_HOST);
160
- $platform = 'wordpress';
161
-
162
- if(!function_exists('getAutoKey'))
163
- {
164
- require_once('cleantalk.class.php');
165
- }
166
-
167
- $result = getAutoKey($email, $website, $platform);
168
-
169
- if ($result)
170
- {
171
- $ct_data['next_account_status_check']=0;
172
- update_option('cleantalk_data', $ct_data);
173
- $result = json_decode($result, true);
174
- if (isset($result['data']) && is_array($result['data']))
175
- {
176
- $result = $result['data'];
177
- }
178
- if(isset($result['user_token']))
179
- {
180
- $ct_data['user_token'] = $result['user_token'];
181
- update_option('cleantalk_data', $ct_data);
182
- }
183
- if (isset($result['auth_key']) && !empty($result['auth_key']))
184
- {
185
- $_POST['cleantalk_settings']['apikey'] = $result['auth_key'];
186
- $ct_options['apikey']=$result['auth_key'];
187
- update_option('cleantalk_settings', $ct_options);
188
- /*$ct_base_call_result = ct_base_call(array(
189
- 'message' => 'CleanTalk setup test',
190
- 'example' => null,
191
- 'sender_email' => 'good@cleantalk.org',
192
- 'sender_nickname' => 'CleanTalk',
193
- 'post_info' => '',
194
- 'checkjs' => 1
195
- )); */
196
- } else {
197
- setcookie($ct_notice_autokey_label, (string) base64_encode($result['error_message']), 0, '/');
198
- }
199
- } else {
200
- setcookie($ct_notice_autokey_label, (string) base64_encode(sprintf(__('Unable to connect to %s.', 'cleantalk'), 'api.cleantalk.org')), 0, '/');
201
- }
202
- }
203
-
204
- if (time() > $ct_data['next_account_status_check']||
205
- isset($_POST['option_page'])&&$_POST['option_page']=='cleantalk_settings'&&$ct_options['apikey']!=$_POST['cleantalk_settings']['apikey']) {
206
- $result = false;
207
- if (function_exists('curl_init') && function_exists('json_decode') && ct_valid_key($ct_options['apikey'])) {
208
- if(!function_exists('noticePaidTill'))
209
- {
210
- require_once('cleantalk.class.php');
211
- }
212
- if(@isset($_POST['cleantalk_settings']['apikey']))
213
- {
214
- $result=noticePaidTill($_POST['cleantalk_settings']['apikey']);
215
- }
216
- else
217
- {
218
- $result=noticePaidTill($ct_options['apikey']);
219
- }
220
-
221
- if ($result) {
222
- $result = json_decode($result, true);
223
- if (isset($result['data']) && is_array($result['data'])) {
224
- $result = $result['data'];
225
- }
226
- if(isset($result['spam_count']))
227
- {
228
- $ct_data['admin_blocked']=$result['spam_count'];
229
- }
230
-
231
- if (isset($result['show_notice'])) {
232
- if ($result['show_notice'] == 1 && isset($result['trial']) && $result['trial'] == 1) {
233
- $notice_check_timeout = $trial_notice_check_timeout;
234
- $show_ct_notice_trial = true;
235
- }
236
- if ($result['show_notice'] == 1 && isset($result['renew']) && $result['renew'] == 1) {
237
- $notice_check_timeout = $account_notice_check_timeout;
238
- $show_ct_notice_renew = true;
239
- }
240
-
241
- if ($result['show_notice'] == 0) {
242
- $notice_check_timeout = $account_notice_check_timeout;
243
- }
244
- }
245
-
246
- if (isset($result['user_token'])) {
247
- $ct_data['user_token'] = $result['user_token'];
248
- }
249
- }
250
-
251
- // Save next status request time
252
- $ct_data['next_account_status_check'] = strtotime("+$notice_check_timeout hours", time());
253
- update_option('cleantalk_data', $ct_data);
254
- }
255
-
256
- if ($result) {
257
- if($show_ct_notice_trial == true){
258
- setcookie($ct_notice_trial_label, (string) $show_ct_notice_trial, strtotime("+$trial_notice_showtime minutes"), '/');
259
- }
260
- if($show_ct_notice_renew == true){
261
- setcookie($ct_notice_renew_label, (string) $show_ct_notice_renew, strtotime("+$renew_notice_showtime minutes"), '/');
262
- }
263
- }
264
- }
265
-
266
- $show_ct_notice_online = '';
267
- if (isset($_COOKIE[$ct_notice_online_label])) {
268
- if ($_COOKIE[$ct_notice_online_label] === 'BAD_KEY') {
269
- $show_ct_notice_online = 'N';
270
- } else if (time() - $_COOKIE[$ct_notice_online_label] <= 5) {
271
- $show_ct_notice_online = 'Y';
272
- }
273
- }
274
-
275
- //ct_init_session();
276
-
277
- if(stripos($_SERVER['REQUEST_URI'],'options.php')!==false || stripos($_SERVER['REQUEST_URI'],'options-general.php')!==false)
278
- {
279
-
280
- if(isset($ct_data['testing_failed'])&&$ct_data['testing_failed']==1)
281
- {
282
- $buttons_html='
283
- <style type="text/css">
284
- #ct_button_check_comments, #ct_button_check_users {background: #999999;}
285
-
286
- ';
287
- }
288
- else
289
- {
290
- $buttons_html='
291
- <style type="text/css">
292
- #ct_button_check_comments, #ct_button_check_users {background: #69dd69;}
293
-
294
- ';
295
- }
296
-
297
- $buttons_html.='
298
- #ct_button_check_comments, #ct_button_check_users {padding: 10px; color: #fff; border:0 none;
299
- cursor:pointer;
300
- -webkit-border-radius: 5px;
301
- border-radius: 5px;
302
- font-size: 12pt;
303
- text-decoration:none;
304
- margin-bottom:5px;
305
- display:inline-block;
306
- }
307
-
308
- #ct_stats_banner
309
- {
310
- padding: 0px;
311
- color: #000;
312
- /*border:2px solid #e5e5e5;*/
313
- font-size: 10pt;
314
- text-decoration:none;
315
- margin-bottom:5px;
316
- display:inline-block;
317
- }
318
- </style>';
319
- if(isset($ct_data['testing_failed'])&&$ct_data['testing_failed']==1)
320
- {
321
- $buttons_html.='<a href="#" id="ct_button_check_comments" onclick="alert('."'".__('Feature is disabled, because testing of access key is failed!', 'cleantalk')."'".')">'.__('Check comments', 'cleantalk').'</a>
322
- <a href="#" id="ct_button_check_users" onclick="alert('."'".__('Feature is disabled, because testing of access key is failed!', 'cleantalk')."'".')">'.__('Check users', 'cleantalk').'</a><div class="clear"></div>';
323
- }
324
- else
325
- {
326
- $buttons_html.='<a href="edit-comments.php?page=ct_check_spam&do_check=1" style="font-size:10pt;font-weight:400;">'.__('Check comments', 'cleantalk').'</a><br />
327
- <a href="users.php?page=ct_check_users&do_check=1" style="font-size:10pt;font-weight:400;">'.__('Check users', 'cleantalk').'</a><div class="clear"></div>';
328
- }
329
-
330
- register_setting('cleantalk_settings', 'cleantalk_settings', 'ct_settings_validate');
331
- add_settings_section('cleantalk_settings_main', __($ct_plugin_name, 'cleantalk'), 'ct_section_settings_main', 'cleantalk');
332
- add_settings_section('cleantalk_settings_state', "<hr>".__('Protection is active', 'cleantalk'), 'ct_section_settings_state', 'cleantalk');
333
- //add_settings_section('cleantalk_settings_autodel', "<hr>", 'ct_section_settings_autodel', 'cleantalk');
334
- add_settings_section('cleantalk_settings_banner', "<hr>Check existing comments and users <br /><br />$buttons_html<hr></h3>", '', 'cleantalk');
335
- add_settings_section('cleantalk_settings_anti_spam', "<a href='#' style='text-decoration:underline;font-size:10pt;font-weight:400;'>".__('Advanced settings', 'cleantalk')."</a>", 'ct_section_settings_anti_spam', 'cleantalk');
336
-
337
- add_settings_field('cleantalk_apikey', __('Access key', 'cleantalk'), 'ct_input_apikey', 'cleantalk', 'cleantalk_settings_main');
338
- add_settings_field('cleantalk_remove_old_spam', __('Automatically delete spam comments', 'cleantalk'), 'ct_input_remove_old_spam', 'cleantalk', 'cleantalk_settings_anti_spam');
339
-
340
- add_settings_field('cleantalk_registrations_test', __('Registration forms', 'cleantalk'), 'ct_input_registrations_test', 'cleantalk', 'cleantalk_settings_anti_spam');
341
- add_settings_field('cleantalk_comments_test', __('Comments form', 'cleantalk'), 'ct_input_comments_test', 'cleantalk', 'cleantalk_settings_anti_spam');
342
- add_settings_field('cleantalk_contact_forms_test', __('Contact forms', 'cleantalk'), 'ct_input_contact_forms_test', 'cleantalk', 'cleantalk_settings_anti_spam');
343
- add_settings_field('cleantalk_general_contact_forms_test', __('Custom contact forms', 'cleantalk'), 'ct_input_general_contact_forms_test', 'cleantalk', 'cleantalk_settings_anti_spam');
344
- add_settings_field('cleantalk_general_postdata_test', __('Check all post data', 'cleantalk'), 'ct_input_general_postdata_test', 'cleantalk', 'cleantalk_settings_anti_spam');
345
- add_settings_field('cleantalk_show_adminbar', __('Show statistics in admin bar', 'cleantalk'), 'ct_input_show_adminbar', 'cleantalk', 'cleantalk_settings_anti_spam');
346
- add_settings_field('cleantalk_use_ajax', __('Use AJAX for JavaScript check', 'cleantalk'), 'ct_input_use_ajax', 'cleantalk', 'cleantalk_settings_anti_spam');
347
- add_settings_field('cleantalk_check_external', __('Protect external forms', 'cleantalk'), 'ct_input_check_external', 'cleantalk', 'cleantalk_settings_anti_spam');
348
- add_settings_field('cleantalk_check_comments_number', __("Don't check comments", 'cleantalk'), 'ct_input_check_comments_number', 'cleantalk', 'cleantalk_settings_anti_spam');
349
- //add_settings_field('cleantalk_check_messages_number', __("Don't check messages", 'cleantalk'), 'ct_input_check_messages_number', 'cleantalk', 'cleantalk_settings_anti_spam');
350
- add_settings_field('cleantalk_show_link', __('', 'cleantalk'), 'ct_input_show_link', 'cleantalk', 'cleantalk_settings_banner');
351
- add_settings_field('cleantalk_spam_firewall', __('', 'cleantalk'), 'ct_input_spam_firewall', 'cleantalk', 'cleantalk_settings_banner');
352
- }
353
- }
354
-
355
- /**
356
- * Admin callback function - Displays description of 'main' plugin parameters section
357
- */
358
- function ct_section_settings_main() {
359
- return true;
360
- }
361
-
362
- /**
363
- * Admin callback function - Displays description of 'anti-spam' plugin parameters section
364
- */
365
- function ct_section_settings_anti_spam() {
366
- return true;
367
- }
368
-
369
- add_action( 'admin_bar_menu', 'ct_add_admin_menu', 999 );
370
-
371
- function ct_add_admin_menu( $wp_admin_bar ) {
372
- // add a parent item
373
- global $ct_options, $ct_data;
374
-
375
- $ct_options = ct_get_options();
376
- $ct_data = ct_get_data();
377
-
378
- if(isset($ct_options['show_adminbar']))
379
- {
380
- $value = @intval($ct_options['show_adminbar']);
381
- }
382
- else
383
- {
384
- $value=1;
385
- }
386
-
387
- if ( current_user_can('activate_plugins')&&$value==1 )
388
- {
389
- //$ct_data=ct_get_data();
390
- $args = array(
391
- 'id' => 'ct_parent_node',
392
- 'title' => '<img src="' . plugin_dir_url(__FILE__) . 'images/logo_small1.png" alt="" height="" style="margin-top:9px;" /><a href="#" class="ab-item alignright" title="allowed / blocked" alt="allowed / blocked"><span class="ab-label" id="ct_stats"><span>0</span> / <span>0</span></span></a>'
393
- );
394
- $wp_admin_bar->add_node( $args );
395
-
396
- // add a child item to our parent item
397
- $args = array(
398
- 'id' => 'ct_dashboard_link',
399
- 'title' => '<a href="https://cleantalk.org/my/?user_token='.@$ct_data['user_token'].'&utm_source=wp-backend&utm_medium=admin-bar" target="_blank">CleanTalk '.__('dashboard', 'cleantalk').'</a>',
400
- 'parent' => 'ct_parent_node'
401
- );
402
- $wp_admin_bar->add_node( $args );
403
-
404
- // add another child item to our parent item (not to our first group)
405
- $args = array(
406
- 'id' => 'ct_settings_link',
407
- 'title' => '<a href="options-general.php?page=cleantalk">'.__('Settings', 'cleantalk').'</a>',
408
- 'parent' => 'ct_parent_node'
409
- );
410
- $wp_admin_bar->add_node( $args );
411
- }
412
- }
413
-
414
- /**
415
- * Admin callback function - Displays description of 'state' plugin parameters section
416
- */
417
- function ct_section_settings_state() {
418
- global $ct_options, $ct_data;
419
-
420
- $ct_options = ct_get_options();
421
- $ct_data = ct_get_data();
422
-
423
- $img="yes.png";
424
- $img_no="no.png";
425
- $color="black";
426
- $test_failed=false;
427
- //if(isset($ct_data['testing_failed'])&&$ct_data['testing_failed']==1)
428
- if(trim($ct_options['apikey'])=='')
429
- {
430
- $img="yes_gray.png";
431
- $img_no="no_gray.png";
432
- $color="gray";
433
- }
434
- if(isset($ct_data['testing_failed'])&&$ct_data['testing_failed']==1)
435
- {
436
- $img="no.png";
437
- $img_no="no.png";
438
- $color="black";
439
- $test_failed=true;
440
- }
441
- print "<div style='color:$color'>";
442
- if($ct_options['registrations_test']==1)
443
- {
444
- print '<img src="' . plugin_dir_url(__FILE__) . 'images/'.$img.'" alt="" height="" /> '.__('Registration forms', 'cleantalk');
445
- }
446
- else
447
- {
448
- print '<img src="' . plugin_dir_url(__FILE__) . 'images/'.$img_no.'" alt="" height="" /> '.__('Registration forms', 'cleantalk');
449
- }
450
-
451
- if($ct_options['comments_test']==1)
452
- {
453
- print ' &nbsp; <img src="' . plugin_dir_url(__FILE__) . 'images/'.$img.'" alt="" height="" /> '.__('Comments form', 'cleantalk');
454
- }
455
- else
456
- {
457
- print ' &nbsp; <img src="' . plugin_dir_url(__FILE__) . 'images/'.$img_no.'" alt="" height="" /> '.__('Comments form', 'cleantalk');
458
- }
459
-
460
- if($ct_options['contact_forms_test']==1)
461
- {
462
- print ' &nbsp; <img src="' . plugin_dir_url(__FILE__) . 'images/'.$img.'" alt="" height="" /> '.__('Contact forms', 'cleantalk');
463
- }
464
- else
465
- {
466
- print ' &nbsp; <img src="' . plugin_dir_url(__FILE__) . 'images/'.$img_no.'" alt="" height="" /> '.__('Contact forms', 'cleantalk');
467
- }
468
-
469
- if($ct_options['general_contact_forms_test']==1)
470
- {
471
- print ' &nbsp; <img src="' . plugin_dir_url(__FILE__) . 'images/'.$img.'" alt="" height="" /> '.__('Custom contact forms', 'cleantalk');
472
- }
473
- else
474
- {
475
- print ' &nbsp; <img src="' . plugin_dir_url(__FILE__) . 'images/'.$img_no.'" alt="" height="" /> '.__('Custom contact forms', 'cleantalk');
476
- }
477
-
478
- print "</div>";
479
- if($test_failed)
480
- {
481
- //print "Testing is failed, check settings. Tech support <a target=_blank href='mailto:support@cleantalk.org'>support@cleantalk.org</a>";
482
- print __("Testing is failed, check settings. Tech support <a target=_blank href='mailto:support@cleantalk.org'>support@cleantalk.org</a>", 'cleantalk');
483
- }
484
- return true;
485
- }
486
-
487
- /**
488
- * Admin callback function - Displays description of 'autodel' plugin parameters section
489
- */
490
- function ct_section_settings_autodel() {
491
- return true;
492
- }
493
-
494
- /**
495
- * Admin callback function - Displays inputs of 'apikey' plugin parameter
496
- */
497
- function ct_input_apikey() {
498
- global $ct_options, $ct_data, $ct_notice_online_label;
499
- $ct_options=ct_get_options();
500
- $ct_data=ct_get_data();
501
-
502
- if(!isset($ct_data['admin_blocked']))
503
- {
504
- $blocked=0;
505
- }
506
- else
507
- {
508
- $blocked=$ct_data['admin_blocked'];
509
- }
510
-
511
- if($blocked>0)
512
- {
513
- $blocked = number_format($blocked, 0, ',', ' ');
514
-
515
- echo "<script>var cleantalk_blocked_message=\"<div style='height:24px;width:100%;display:table-cell; vertical-align:middle;'><span>CleanTalk ";
516
- printf(
517
- /* translators: %s: Number of spam messages */
518
- __( 'has blocked <b>%s</b> spam.', 'cleantalk' ),
519
- $blocked
520
- );
521
- print "</span></div><br />\";\n";
522
- }
523
- else
524
- {
525
- echo "<script>var cleantalk_blocked_message=\"\";\n";
526
- }
527
- echo "var cleantalk_statistics_link=\"<a target='__blank' href='https://cleantalk.org/my?user_token=".@$ct_data['user_token']."'>".__('Click here to get anti-spam statistics', 'cleantalk')."</a>\";
528
- </script>";
529
-
530
- echo "<script src='".plugins_url( 'cleantalk-admin.js', __FILE__ )."'></script>\n";
531
-
532
- $value = $ct_options['apikey'];
533
- $def_value = '';
534
- echo "<input id='cleantalk_apikey' name='cleantalk_settings[apikey]' size='20' type='text' value='$value' style=\"font-size: 14pt;\"/>";
535
- if (ct_valid_key($value) === false) {
536
- echo "<script>var cleantalk_good_key=false;</script>";
537
- echo "<a target='__blank' style='margin-left: 10px' href='https://cleantalk.org/register?platform=wordpress&email=".urlencode(get_option('admin_email'))."&website=".urlencode(parse_url(get_option('siteurl'),PHP_URL_HOST))."'>".__('Click here to get access key manually', 'cleantalk')."</a>";
538
- if (function_exists('curl_init') && function_exists('json_decode')) {
539
- echo '<br /><br /><input name="get_apikey_auto" type="submit" value="' . __('Get access key automatically', 'cleantalk') . '" />';
540
- admin_addDescriptionsFields(sprintf(__('Admin e-mail (%s) will be used for registration', 'cleantalk'), get_option('admin_email')));
541
- admin_addDescriptionsFields(sprintf('<a target="__blank" style="color:#BBB;" href="https://cleantalk.org/publicoffer">%s</a>', __('License agreement', 'cleantalk')));
542
- }
543
- } else {
544
- echo "<script>var cleantalk_good_key=true;</script>";
545
- if (isset($_COOKIE[$ct_notice_online_label]) && $_COOKIE[$ct_notice_online_label] > 0) {
546
- //echo '&nbsp;&nbsp;<span style="text-decoration: underline;">The key accepted!</span>&nbsp;';
547
- }
548
- //echo "<br /><br /><a target='__blank' href='https://cleantalk.org/my?user_token=".@$ct_data['user_token']."'>".__('Click here to get anti-spam statistics', 'cleantalk')."</a>";
549
- }
550
- }
551
-
552
- /**
553
- * Admin callback function - Displays inputs of 'comments_test' plugin parameter
554
- */
555
- function ct_input_comments_test() {
556
- global $ct_options, $ct_data;
557
-
558
- $ct_options = ct_get_options();
559
- $ct_data = ct_get_data();
560
-
561
- $value = $ct_options['comments_test'];
562
- echo "<input type='radio' id='cleantalk_comments_test1' name='cleantalk_settings[comments_test]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_comments_test1'> " . __('Yes') . "</label>";
563
- echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
564
- echo "<input type='radio' id='cleantalk_comments_test0' name='cleantalk_settings[comments_test]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_comments_test0'> " . __('No') . "</label>";
565
- admin_addDescriptionsFields(__('WordPress, JetPack, WooCommerce', 'cleantalk'));
566
- }
567
-
568
- /**
569
- * Admin callback function - Displays inputs of 'comments_test' plugin parameter
570
- */
571
- function ct_input_registrations_test() {
572
- global $ct_options, $ct_data;
573
-
574
- $ct_options = ct_get_options();
575
- $ct_data = ct_get_data();
576
-
577
- $value = $ct_options['registrations_test'];
578
- echo "<input type='radio' id='cleantalk_registrations_test1' name='cleantalk_settings[registrations_test]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_registrations_test1'> " . __('Yes') . "</label>";
579
- echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
580
- echo "<input type='radio' id='cleantalk_registrations_test0' name='cleantalk_settings[registrations_test]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_registrations_test0'> " . __('No') . "</label>";
581
- admin_addDescriptionsFields(__('WordPress, BuddyPress, bbPress, S2Member, WooCommerce', 'cleantalk'));
582
- }
583
-
584
- /**
585
- * Admin callback function - Displays inputs of 'contact_forms_test' plugin parameter
586
- */
587
- function ct_input_contact_forms_test() {
588
- global $ct_options, $ct_data;
589
-
590
- $ct_options = ct_get_options();
591
- $ct_data = ct_get_data();
592
-
593
- $value = $ct_options['contact_forms_test'];
594
- echo "<input type='radio' id='cleantalk_contact_forms_test1' name='cleantalk_settings[contact_forms_test]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_contact_forms_test1'> " . __('Yes') . "</label>";
595
- echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
596
- echo "<input type='radio' id='cleantalk_contact_forms_test0' name='cleantalk_settings[contact_forms_test]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_contact_forms_test0'> " . __('No') . "</label>";
597
- admin_addDescriptionsFields(__('Contact Form 7, Formiadble forms, JetPack, Fast Secure Contact Form, WordPress Landing Pages', 'cleantalk'));
598
- }
599
-
600
- /**
601
- * Admin callback function - Displays inputs of 'general_contact_forms_test' plugin parameter
602
- */
603
- function ct_input_general_contact_forms_test() {
604
- global $ct_options, $ct_data;
605
-
606
- $ct_options = ct_get_options();
607
- $ct_data = ct_get_data();
608
-
609
- $value = $ct_options['general_contact_forms_test'];
610
- echo "<input type='radio' id='cleantalk_general_contact_forms_test1' name='cleantalk_settings[general_contact_forms_test]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_general_contact_forms_test1'> " . __('Yes') . "</label>";
611
- echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
612
- echo "<input type='radio' id='cleantalk_general_contact_forms_test0' name='cleantalk_settings[general_contact_forms_test]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_general_contact_forms_test0'> " . __('No') . "</label>";
613
- admin_addDescriptionsFields(__('Anti spam test for any WordPress or themes contacts forms', 'cleantalk'));
614
- }
615
-
616
- /**
617
- * @author Artem Leontiev
618
- * Admin callback function - Displays inputs of 'Publicate relevant comments' plugin parameter
619
- *
620
- * @return null
621
- */
622
- function ct_input_remove_old_spam() {
623
- global $ct_options, $ct_data;
624
-
625
- $ct_options = ct_get_options();
626
- $ct_data = ct_get_data();
627
-
628
- $value = $ct_options['remove_old_spam'];
629
- echo "<input type='radio' id='cleantalk_remove_old_spam1' name='cleantalk_settings[remove_old_spam]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_remove_old_spam1'> " . __('Yes') . "</label>";
630
- echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
631
- echo "<input type='radio' id='cleantalk_remove_old_spam0' name='cleantalk_settings[remove_old_spam]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_remove_old_spam0'> " . __('No') . "</label>";
632
- admin_addDescriptionsFields(sprintf(__('Delete spam comments older than %d days.', 'cleantalk'), $ct_options['spam_store_days']));
633
- }
634
-
635
- /**
636
- * Admin callback function - Displays inputs of 'Show statistics in adminbar' plugin parameter
637
- *
638
- * @return null
639
- */
640
- function ct_input_show_adminbar() {
641
- global $ct_options, $ct_data;
642
-
643
- $ct_options = ct_get_options();
644
- $ct_data = ct_get_data();
645
-
646
- if(isset($ct_options['show_adminbar']))
647
- {
648
- $value = @intval($ct_options['show_adminbar']);
649
- }
650
- else
651
- {
652
- $value=1;
653
- }
654
- echo "<input type='radio' id='cleantalk_show_adminbar1' name='cleantalk_settings[show_adminbar]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_show_adminbar1'> " . __('Yes') . "</label>";
655
- echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
656
- echo "<input type='radio' id='cleantalk_show_adminbar0' name='cleantalk_settings[show_adminbar]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_show_adminbar0'> " . __('No') . "</label>";
657
- admin_addDescriptionsFields(sprintf(__('Show/hide CleanTalk icon in top level menu in WordPress backend.', 'cleantalk'), $ct_options['show_adminbar']));
658
- }
659
-
660
- /**
661
- * Admin callback function - Displays inputs of 'Show statistics in adminbar' plugin parameter
662
- *
663
- * @return null
664
- */
665
- function ct_input_general_postdata_test() {
666
- global $ct_options, $ct_data;
667
-
668
- $ct_options = ct_get_options();
669
- $ct_data = ct_get_data();
670
-
671
- if(isset($ct_options['general_postdata_test']))
672
- {
673
- $value = @intval($ct_options['general_postdata_test']);
674
- }
675
- else
676
- {
677
- $value=0;
678
- }
679
- echo "<input type='radio' id='cleantalk_general_postdata_test1' name='cleantalk_settings[general_postdata_test]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_general_postdata_test1'> " . __('Yes') . "</label>";
680
- echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
681
- echo "<input type='radio' id='cleantalk_general_postdata_test0' name='cleantalk_settings[general_postdata_test]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_general_postdata_test0'> " . __('No') . "</label>";
682
- @admin_addDescriptionsFields(sprintf(__('Check all POST submissions from website visitors. Enable this option if you have spam misses on website or you don`t have records about missed spam in <a href="https://cleantalk.org/my/?user_token='.@$ct_data['user_token'].'&utm_source=wp-backend&utm_medium=admin-bar" target="_blank">CleanTalk dashboard</a>.', 'cleantalk'), $ct_options['general_postdata_test']));
683
- }
684
-
685
- function ct_input_use_ajax() {
686
- global $ct_options, $ct_data;
687
-
688
- $ct_options = ct_get_options();
689
- $ct_data = ct_get_data();
690
-
691
- if(isset($ct_options['use_ajax']))
692
- {
693
- $value = @intval($ct_options['use_ajax']);
694
- }
695
- else
696
- {
697
- $value=1;
698
- }
699
- echo "<input type='radio' id='cleantalk_use_ajax1' name='cleantalk_settings[use_ajax]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_use_ajax1'> " . __('Yes') . "</label>";
700
- echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
701
- echo "<input type='radio' id='cleantalk_use_ajax0' name='cleantalk_settings[use_ajax]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_use_ajax0'> " . __('No') . "</label>";
702
- @admin_addDescriptionsFields(sprintf(__('', 'cleantalk'), $ct_options['use_ajax']));
703
- }
704
-
705
- function ct_input_check_comments_number() {
706
- global $ct_options, $ct_data;
707
-
708
- $ct_options = ct_get_options();
709
- $ct_data = ct_get_data();
710
-
711
- if(isset($ct_options['check_comments_number']))
712
- {
713
- $value = @intval($ct_options['check_comments_number']);
714
- }
715
- else
716
- {
717
- $value=1;
718
- }
719
-
720
- if(defined('CLEANTALK_CHECK_COMMENTS_NUMBER'))
721
- {
722
- $comments_check_number = CLEANTALK_CHECK_COMMENTS_NUMBER;
723
- }
724
- else
725
- {
726
- $comments_check_number = 3;
727
- }
728
-
729
- echo "<input type='radio' id='cleantalk_check_comments_number1' name='cleantalk_settings[check_comments_number]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_check_comments_number1'> " . __('Yes') . "</label>";
730
- echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
731
- echo "<input type='radio' id='cleantalk_check_comments_number0' name='cleantalk_settings[check_comments_number]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_check_comments_number0'> " . __('No') . "</label>";
732
- @admin_addDescriptionsFields(sprintf(__("Dont't check comments for users with above $comments_check_number comments", 'cleantalk'), $ct_options['check_comments_number']));
733
- }
734
-
735
- function ct_input_check_messages_number() {
736
- global $ct_options, $ct_data;
737
-
738
- $ct_options = ct_get_options();
739
- $ct_data = ct_get_data();
740
-
741
- if(isset($ct_options['check_messages_number']))
742
- {
743
- $value = @intval($ct_options['check_messages_number']);
744
- }
745
- else
746
- {
747
- $value=0;
748
- }
749
-
750
- if(defined('CLEANTALK_CHECK_MESSAGES_NUMBER'))
751
- {
752
- $messages_check_number = CLEANTALK_CHECK_MESSAGES_NUMBER;
753
- }
754
- else
755
- {
756
- $messages_check_number = 3;
757
- }
758
-
759
- echo "<input type='radio' id='cleantalk_check_messages_number1' name='cleantalk_settings[check_messages_number]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_check_messages_number1'> " . __('Yes') . "</label>";
760
- echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
761
- echo "<input type='radio' id='cleantalk_check_messages_number0' name='cleantalk_settings[check_messages_number]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_check_messages_number0'> " . __('No') . "</label>";
762
- @admin_addDescriptionsFields(sprintf(__("Dont't check messages for users with above $messages_check_number messages", 'cleantalk'), $ct_options['check_messages_number']));
763
- }
764
-
765
- function ct_input_check_external() {
766
- global $ct_options, $ct_data;
767
-
768
- $ct_options = ct_get_options();
769
- $ct_data = ct_get_data();
770
-
771
- if(isset($ct_options['check_external']))
772
- {
773
- $value = @intval($ct_options['check_external']);
774
- }
775
- else
776
- {
777
- $value=0;
778
- }
779
- echo "<input type='radio' id='cleantalk_check_external1' name='cleantalk_settings[check_external]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_check_external1'> " . __('Yes') . "</label>";
780
- echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
781
- echo "<input type='radio' id='cleantalk_check_external0' name='cleantalk_settings[check_external]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_check_external0'> " . __('No') . "</label>";
782
- @admin_addDescriptionsFields(sprintf(__('', 'cleantalk'), $ct_options['check_external']));
783
- }
784
-
785
- function ct_input_show_link() {
786
- global $ct_options, $ct_data;
787
-
788
- $ct_options = ct_get_options();
789
- $ct_data = ct_get_data();
790
-
791
- if(isset($ct_options['show_link']))
792
- {
793
- $value = @intval($ct_options['show_link']);
794
- }
795
- else
796
- {
797
- $value=0;
798
- }
799
-
800
- /* echo "<input type='radio' id='cleantalk_show_link1' name='cleantalk_settings[show_link]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_show_link1'> " . __('Yes') . "</label>";
801
- echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
802
- echo "<input type='radio' id='cleantalk_show_link0' name='cleantalk_settings[show_link]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_show_link0'> " . __('No') . "</label>";*/
803
-
804
- echo "<div id='cleantalk_anchor' style='display:none'></div><input type=hidden name='cleantalk_settings[show_link]' value='0' />";
805
- echo "<input type='checkbox' id='cleantalk_show_link1' name='cleantalk_settings[show_link]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_show_link1'> " . __('Tell others about CleanTalk') . "</label>";
806
- @admin_addDescriptionsFields(sprintf(__("Checking this box places a small link under the comment form that lets others know what anti-spam tool protects your site.", 'cleantalk'), $ct_options['show_link']));
807
- echo "<script>
808
- jQuery(document).ready(function(){
809
- jQuery('#cleantalk_anchor').parent().parent().children().first().hide();
810
- jQuery('#cleantalk_anchor').parent().css('padding-left','0px');
811
- });
812
- </script>";
813
- }
814
-
815
- function ct_input_spam_firewall() {
816
- global $ct_options, $ct_data;
817
-
818
- $ct_options = ct_get_options();
819
- $ct_data = ct_get_data();
820
-
821
- if(isset($ct_options['spam_firewall']))
822
- {
823
- $value = @intval($ct_options['spam_firewall']);
824
- }
825
- else
826
- {
827
- $value=0;
828
- }
829
-
830
- echo "<div id='cleantalk_anchor1' style='display:none'></div><input type=hidden name='cleantalk_settings[spam_firewall]' value='0' />";
831
- echo "<input type='checkbox' id='cleantalk_spam_firewall1' name='cleantalk_settings[spam_firewall]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_spam_firewall1'> " . __('SpamFireWall') . "</label>";
832
- @admin_addDescriptionsFields(sprintf(__("This option allows to filter spam bots before they access website. Also reduces CPU usage on hosting server and accelerates pages load time.", 'cleantalk'), $ct_options['spam_firewall']));
833
- echo "<script>
834
- jQuery(document).ready(function(){
835
- jQuery('#cleantalk_anchor1').parent().parent().children().first().hide();
836
- jQuery('#cleantalk_anchor1').parent().css('padding-left','0px');
837
- });
838
- </script>";
839
- }
840
-
841
-
842
- /**
843
- * Admin callback function - Plugin parameters validator
844
- */
845
- function ct_settings_validate($input) {
846
- return $input;
847
- }
848
-
849
-
850
- /**
851
- * Admin callback function - Displays plugin options page
852
- */
853
- function ct_settings_page() {
854
- ?>
855
- <style type="text/css">
856
- input[type=submit] {padding: 10px; background: #3399FF; color: #fff; border:0 none;
857
- cursor:pointer;
858
- -webkit-border-radius: 5px;
859
- border-radius: 5px;
860
- font-size: 12pt;
861
- }
862
- </style>
863
-
864
- <div>
865
- <form action="options.php" method="post">
866
- <?php settings_fields('cleantalk_settings'); ?>
867
- <?php do_settings_sections('cleantalk'); ?>
868
- <br>
869
- <input name="Submit" type="submit" value="<?php esc_attr_e('Save Changes'); ?>" />
870
- </form>
871
- </div>
872
- <?php
873
-
874
- if (ct_valid_key() === false)
875
- return null;
876
- ?>
877
- <br />
878
- <br />
879
- <br />
880
- <div>
881
- <?php echo __('Plugin Homepage at', 'cleantalk'); ?> <a href="http://cleantalk.org" target="_blank">cleantalk.org</a>.<br />
882
- <?php echo __('Tech support CleanTalk:', 'cleantalk'); ?> <a href="https://cleantalk.org/forum/viewforum.php?f=25" target="_blank"><?php echo __('CleanTalk tech forum', 'cleantalk'); ?></a>.<br /><?php echo __('Use s@cleantalk.org to test plugin in any WordPress form.', 'cleantalk'); ?><br />
883
- </div>
884
- <?php
885
- }
886
-
887
- /**
888
- * Notice blog owner if plugin is used without Access key
889
- * @return bool
890
- */
891
- function cleantalk_admin_notice_message(){
892
- global $show_ct_notice_trial, $show_ct_notice_renew, $show_ct_notice_online, $show_ct_notice_autokey, $ct_notice_autokey_value, $ct_plugin_name, $ct_options, $ct_data;
893
-
894
- $ct_options = ct_get_options();
895
- $ct_data = ct_get_data();
896
-
897
- $user_token = '';
898
- if (isset($ct_data['user_token']) && $ct_data['user_token'] != '') {
899
- $user_token = '&user_token=' . $ct_data['user_token'];
900
- }
901
-
902
- $show_notice = true;
903
-
904
- if(current_user_can('activate_plugins'))
905
- {
906
- $value = 1;
907
- }
908
- else
909
- {
910
- $value = 0;
911
- }
912
-
913
- if ($show_notice && $show_ct_notice_autokey && $value==1) {
914
- echo '<div class="error"><h3>' . sprintf(__("Unable to get Access key automatically: %s", 'cleantalk'), $ct_notice_autokey_value);
915
- echo " <a target='__blank' style='margin-left: 10px' href='https://cleantalk.org/register?platform=wordpress&email=".urlencode(get_option('admin_email'))."&website=".urlencode(parse_url(get_option('siteurl'),PHP_URL_HOST))."'>".__('Click here to get access key manually', 'cleantalk').'</a></h3></div>';
916
- }
917
-
918
- if ($show_notice && ct_valid_key($ct_options['apikey']) === false && $value==1) {
919
- echo '<div class="error"><h3>' . sprintf(__("Please enter Access Key in %s settings to enable anti spam protection!", 'cleantalk'), "<a href=\"options-general.php?page=cleantalk\">CleanTalk plugin</a>") . '</h3></div>';
920
- $show_notice = false;
921
- }
922
-
923
- if ($show_notice && $show_ct_notice_trial && $value==1) {
924
- echo '<div class="error"><h3>' . sprintf(__("%s trial period ends, please upgrade to %s!", 'cleantalk'), "<a href=\"options-general.php?page=cleantalk\">$ct_plugin_name</a>", "<a href=\"http://cleantalk.org/my/bill/recharge?utm_source=wp-backend&utm_medium=cpc&utm_campaign=WP%20backend%20trial$user_token\" target=\"_blank\"><b>premium version</b></a>") . '</h3></div>';
925
- $show_notice = false;
926
- }
927
-
928
- if(isset($ct_data['next_notice_show']))
929
- {
930
- $next_notice_show=$ct_data['next_notice_show'];
931
- }
932
- else
933
- {
934
- $next_notice_show=0;
935
- }
936
-
937
- $link=@$_SERVER["QUERY_STRING"];
938
- if($link!='')
939
- {
940
- $link="?".$link."&close_notice=1";
941
- }
942
- else
943
- {
944
- $link="?close_notice=1";
945
- }
946
-
947
- if ($show_notice && $show_ct_notice_renew && $value==1 && time()>$next_notice_show) {
948
- $button_html = "<a href=\"http://cleantalk.org/my/bill/recharge?utm_source=wp-backend&utm_medium=cpc&utm_campaign=WP%20backend%20renew$user_token\" target=\"_blank\">" . '<input type="button" class="button button-primary" value="' . __('RENEW ANTI-SPAM', 'cleantalk') . '" />' . "</a>";
949
- echo '<div class="updated"><a href="'.$link.'" style="text-decoration:none;float:right;font-size:16px;margin-top:5px;"><b>X</b></a><h3>' . sprintf(__("Please renew your anti-spam license for %s.", 'cleantalk'), "<a href=\"http://cleantalk.org/my/bill/recharge?utm_source=wp-backend&utm_medium=cpc&utm_campaign=WP%20backend%20renew$user_token\" target=\"_blank\"><b>" . __('next year', 'cleantalk') ."</b></a>") . '<br /><br />' . $button_html . '</h3></div>';
950
- $show_notice = false;
951
- }
952
-
953
- if ($show_notice && $show_ct_notice_online != '' && $value==1) {
954
- if($show_ct_notice_online === 'Y'){
955
- echo '<div class="updated"><h3><b>';
956
- //echo __("Don’t forget to disable CAPTCHA if you have it!", 'cleantalk');
957
- echo __("Settings updated!", 'cleantalk');
958
- echo '</b></h3></div>';
959
- }
960
-
961
- if($show_ct_notice_online === 'N' && $value==1){
962
- echo '<div class="error"><h3><b>';
963
- echo __("Wrong <a href=\"options-general.php?page=cleantalk\"><b style=\"color: #49C73B;\">Clean</b><b style=\"color: #349ebf;\">Talk</b> access key</a>! Please check it or ask <a target=\"_blank\" href=\"https://cleantalk.org/forum/\">support</a>.", 'cleantalk');
964
- echo '</b></h3></div>';
965
- }
966
- }
967
-
968
- //ct_send_feedback(); -- removed to ct_do_this_hourly()
969
-
970
- return true;
971
- }
972
-
973
- /**
974
- * @author Artem Leontiev
975
- *
976
- * Add descriptions for field
977
- */
978
- function admin_addDescriptionsFields($descr = '') {
979
- echo "<div style='font-size: 10pt; color: #666 !important'>$descr</div>";
980
- }
981
-
982
- /**
983
- * Test API key
984
- */
985
- function ct_valid_key($apikey = null) {
986
- global $ct_options, $ct_data;
987
-
988
- $ct_options = ct_get_options();
989
- $ct_data = ct_get_data();
990
-
991
- if ($apikey === null) {
992
- $apikey = $ct_options['apikey'];
993
- }
994
-
995
- return ($apikey === 'enter key' || $apikey === '') ? false : true;
996
- }
997
-
998
- /**
999
- * Admin action 'comment_unapproved_to_approved' - Approve comment, sends good feedback to cleantalk, removes cleantalk resume
1000
- * @param object $comment_object Comment object
1001
- * @return boolean TRUE
1002
- */
1003
- function ct_comment_approved($comment_object) {
1004
- $comment = get_comment($comment_object->comment_ID, 'ARRAY_A');
1005
- $hash = get_comment_meta($comment_object->comment_ID, 'ct_hash', true);
1006
-
1007
- $comment['comment_content'] = ct_unmark_red($comment['comment_content']);
1008
- $comment['comment_content'] = ct_feedback($hash, $comment['comment_content'], 1);
1009
- $comment['comment_approved'] = 1;
1010
- wp_update_comment($comment);
1011
-
1012
- return true;
1013
- }
1014
-
1015
- /**
1016
- * Admin action 'comment_approved_to_unapproved' - Unapprove comment, sends bad feedback to cleantalk
1017
- * @param object $comment_object Comment object
1018
- * @return boolean TRUE
1019
- */
1020
- function ct_comment_unapproved($comment_object) {
1021
- $comment = get_comment($comment_object->comment_ID, 'ARRAY_A');
1022
- $hash = get_comment_meta($comment_object->comment_ID, 'ct_hash', true);
1023
- ct_feedback($hash, $comment['comment_content'], 0);
1024
- $comment['comment_approved'] = 0;
1025
- wp_update_comment($comment);
1026
-
1027
- return true;
1028
- }
1029
-
1030
- /**
1031
- * Admin actions 'comment_unapproved_to_spam', 'comment_approved_to_spam' - Mark comment as spam, sends bad feedback to cleantalk
1032
- * @param object $comment_object Comment object
1033
- * @return boolean TRUE
1034
- */
1035
- function ct_comment_spam($comment_object) {
1036
- $comment = get_comment($comment_object->comment_ID, 'ARRAY_A');
1037
- $hash = get_comment_meta($comment_object->comment_ID, 'ct_hash', true);
1038
- ct_feedback($hash, $comment['comment_content'], 0);
1039
- $comment['comment_approved'] = 'spam';
1040
- wp_update_comment($comment);
1041
-
1042
- return true;
1043
- }
1044
-
1045
-
1046
- /**
1047
- * Unspam comment
1048
- * @param type $comment_id
1049
- */
1050
- function ct_unspam_comment($comment_id) {
1051
- update_comment_meta($comment_id, '_wp_trash_meta_status', 1);
1052
- $comment = get_comment($comment_id, 'ARRAY_A');
1053
- $hash = get_comment_meta($comment_id, 'ct_hash', true);
1054
- $comment['comment_content'] = ct_unmark_red($comment['comment_content']);
1055
- $comment['comment_content'] = ct_feedback($hash, $comment['comment_content'], 1);
1056
-
1057
- wp_update_comment($comment);
1058
- }
1059
-
1060
- /**
1061
- * Admin filter 'get_comment_text' - Adds some info to comment text to display
1062
- * @param string $current_text Current comment text
1063
- * @return string New comment text
1064
- */
1065
- function ct_get_comment_text($current_text) {
1066
- global $comment;
1067
- $new_text = $current_text;
1068
- if (isset($comment) && is_object($comment)) {
1069
- $hash = get_comment_meta($comment->comment_ID, 'ct_hash', true);
1070
- if (!empty($hash)) {
1071
- $new_text .= '<hr>Cleantalk ID = ' . $hash;
1072
- }
1073
- }
1074
- return $new_text;
1075
- }
1076
-
1077
- /**
1078
- * Send feedback for user deletion
1079
- * @return null
1080
- */
1081
- function ct_delete_user($user_id) {
1082
- $hash = get_user_meta($user_id, 'ct_hash', true);
1083
- if ($hash !== '') {
1084
- ct_feedback($hash, null, 0);
1085
- }
1086
- }
1087
-
1088
- /**
1089
- * Manage links and plugins page
1090
- * @return array
1091
- */
1092
- if (!function_exists ( 'ct_register_plugin_links')) {
1093
- function ct_register_plugin_links($links, $file) {
1094
- global $ct_plugin_basename;
1095
-
1096
- if ($file == $ct_plugin_basename) {
1097
- $links[] = '<a href="options-general.php?page=cleantalk">' . __( 'Settings' ) . '</a>';
1098
- $links[] = '<a href="http://wordpress.org/plugins/cleantalk-spam-protect/faq/" target="_blank">' . __( 'FAQ','cleantalk' ) . '</a>';
1099
- $links[] = '<a href="http://cleantalk.org/forum" target="_blank">' . __( 'Support','cleantalk' ) . '</a>';
1100
- }
1101
- return $links;
1102
- }
1103
- }
1104
-
1105
- /**
1106
- * Manage links in plugins list
1107
- * @return array
1108
- */
1109
- if (!function_exists ( 'ct_plugin_action_links')) {
1110
- function ct_plugin_action_links($links, $file) {
1111
- global $ct_plugin_basename;
1112
-
1113
- if ($file == $ct_plugin_basename) {
1114
- $settings_link = '<a href="options-general.php?page=cleantalk">' . __( 'Settings' ) . '</a>';
1115
- array_unshift( $links, $settings_link ); // before other links
1116
- }
1117
- return $links;
1118
- }
1119
- }
1120
-
1121
- /**
1122
- * After options update
1123
- * @return array
1124
- */
1125
- function ct_update_option($option_name) {
1126
- global $show_ct_notice_online, $ct_notice_online_label, $ct_notice_trial_label, $trial_notice_showtime, $ct_options, $ct_data, $ct_server_timeout;
1127
-
1128
- $ct_options = ct_get_options(true);
1129
- $ct_data = ct_get_data(true);
1130
-
1131
- if($option_name !== 'cleantalk_settings') {
1132
- return;
1133
- }
1134
-
1135
- $api_key = $ct_options['apikey'];
1136
- if (isset($_POST['cleantalk_settings']['apikey'])) {
1137
- $api_key = trim($_POST['cleantalk_settings']['apikey']);
1138
- $ct_options['apikey'] = $api_key;
1139
- }
1140
-
1141
- if(@isset($_POST['cleantalk_settings']['spam_firewall']) && $_POST['cleantalk_settings']['spam_firewall']==1 || isset($ct_options['spam_firewall']) && intval($ct_options['spam_firewall'])==1)
1142
- {
1143
- cleantalk_update_sfw();
1144
- }
1145
-
1146
- if (!ct_valid_key($api_key)) {
1147
- return;
1148
- }
1149
-
1150
- /*$ct_base_call_result = ct_base_call(array(
1151
- 'message' => 'CleanTalk setup test',
1152
- 'example' => null,
1153
- 'sender_email' => 'good@cleantalk.org',
1154
- 'sender_nickname' => 'CleanTalk',
1155
- 'post_info' => '',
1156
- 'checkjs' => 1
1157
- ));*/
1158
-
1159
- $key_valid = true;
1160
- $app_server_error = false;
1161
- $ct_data['testing_failed']=0;
1162
-
1163
-
1164
- if(!function_exists('sendRawRequest'))
1165
- {
1166
- require_once('cleantalk.class.php');
1167
- }
1168
-
1169
- $request=Array();
1170
- $request['method_name'] = 'notice_validate_key';
1171
- $request['auth_key'] = $api_key;
1172
- $url='https://api.cleantalk.org';
1173
- if(!function_exists('sendRawRequest'))
1174
- {
1175
- require_once('cleantalk.class.php');
1176
- }
1177
- $result=sendRawRequest($url, $request);
1178
- if ($result)
1179
- {
1180
- $result = json_decode($result, true);
1181
- if (isset($result['valid']) && $result['valid'] == 0) {
1182
- $key_valid = false;
1183
- $ct_data['testing_failed']=1;
1184
- }
1185
- }
1186
- if (!$result || !isset($result['valid']))
1187
- {
1188
- $app_server_error = true;
1189
- $ct_data['testing_failed']=1;
1190
- }
1191
-
1192
- update_option('cleantalk_data', $ct_data);
1193
-
1194
- if ($key_valid) {
1195
- // Removes cookie for server errors
1196
- if ($app_server_error) {
1197
- setcookie($ct_notice_online_label, '', 1, '/'); // time 1 is exactly in past even clients time() is wrong
1198
- unset($_COOKIE[$ct_notice_online_label]);
1199
- } else {
1200
- setcookie($ct_notice_online_label, (string) time(), strtotime("+14 days"), '/');
1201
- }
1202
- setcookie($ct_notice_trial_label, '0', strtotime("+$trial_notice_showtime minutes"), '/');
1203
- } else {
1204
- setcookie($ct_notice_online_label, 'BAD_KEY', 0, '/');
1205
- }
1206
- }
1207
-
1208
- /**
1209
- * Unmark bad words
1210
- * @param string $message
1211
- * @return string Cleat comment
1212
- */
1213
- function ct_unmark_red($message) {
1214
- $message = preg_replace("/\<font rel\=\"cleantalk\" color\=\"\#FF1000\"\>(\S+)\<\/font>/iu", '$1', $message);
1215
-
1216
- return $message;
1217
- }
1218
-
1219
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/inc/cleantalk-ajax.php DELETED
@@ -1,501 +0,0 @@
1
- <?php
2
- global $cleantalk_hooked_actions;
3
- /*
4
- AJAX functions
5
- */
6
-
7
- /*hooks for AJAX Login & Register email validation*/
8
- add_action( 'wp_ajax_nopriv_validate_email', 'ct_validate_email_ajaxlogin',1 );
9
- add_action( 'wp_ajax_validate_email', 'ct_validate_email_ajaxlogin',1 );
10
- $cleantalk_hooked_actions[]='validate_email';
11
-
12
- /*hooks for user registration*/
13
- add_action( 'user_register', 'ct_user_register_ajaxlogin',1 );
14
-
15
- /*hooks for WPUF pro */
16
- //add_action( 'wp_ajax_nopriv_wpuf_submit_register', 'ct_wpuf_submit_register',1 );
17
- //add_action( 'wp_ajax_wpuf_submit_register', 'ct_wpuf_submit_register',1 );
18
- add_action( 'wp_ajax_nopriv_wpuf_submit_register', 'ct_ajax_hook',1 );
19
- add_action( 'wp_ajax_wpuf_submit_register', 'ct_ajax_hook',1 );
20
- $cleantalk_hooked_actions[]='submit_register';
21
-
22
- /*hooks for MyMail */
23
- //add_action( 'wp_ajax_nopriv_mymail_form_submit', 'ct_mymail_form_submit',1 );
24
- //add_action( 'wp_ajax_mymail_form_submit', 'ct_mymail_form_submit',1 );
25
- add_action( 'wp_ajax_nopriv_mymail_form_submit', 'ct_ajax_hook',1 );
26
- add_action( 'wp_ajax_mymail_form_submit', 'ct_ajax_hook',1 );
27
- $cleantalk_hooked_actions[]='form_submit';
28
-
29
- /*hooks for MailPoet */
30
- //add_action( 'wp_ajax_nopriv_wysija_ajax', 'ct_wysija_ajax',1 );
31
- //add_action( 'wp_ajax_wysija_ajax', 'ct_wysija_ajax',1 );
32
- add_action( 'wp_ajax_nopriv_wysija_ajax', 'ct_ajax_hook',1 );
33
- add_action( 'wp_ajax_wysija_ajax', 'ct_ajax_hook',1 );
34
- $cleantalk_hooked_actions[]='wysija_ajax';
35
-
36
- /*hooks for cs_registration_validation */
37
- //add_action( 'wp_ajax_nopriv_cs_registration_validation', 'ct_cs_registration_validation',1 );
38
- //add_action( 'wp_ajax_cs_registration_validation', 'ct_cs_registration_validation',1 );
39
- add_action( 'wp_ajax_nopriv_cs_registration_validation', 'ct_ajax_hook',1 );
40
- add_action( 'wp_ajax_cs_registration_validation', 'ct_ajax_hook',1 );
41
- $cleantalk_hooked_actions[]='cs_registration_validation';
42
-
43
- /*hooks for send_message and request_appointment */
44
- //add_action( 'wp_ajax_nopriv_send_message', 'ct_sm_ra',1 );
45
- //add_action( 'wp_ajax_send_message', 'ct_sm_ra',1 );
46
- //add_action( 'wp_ajax_nopriv_request_appointment', 'ct_sm_ra',1 );
47
- //add_action( 'wp_ajax_request_appointment', 'ct_sm_ra',1 );
48
- add_action( 'wp_ajax_nopriv_send_message', 'ct_ajax_hook',1 );
49
- add_action( 'wp_ajax_send_message', 'ct_ajax_hook',1 );
50
- add_action( 'wp_ajax_nopriv_request_appointment', 'ct_ajax_hook',1 );
51
- add_action( 'wp_ajax_request_appointment', 'ct_ajax_hook',1 );
52
- $cleantalk_hooked_actions[]='send_message';
53
- $cleantalk_hooked_actions[]='request_appointment';
54
-
55
- /*hooks for zn_do_login */
56
- //add_action( 'wp_ajax_nopriv_zn_do_login', 'ct_zn_do_login',1 );
57
- //add_action( 'wp_ajax_zn_do_login', 'ct_zn_do_login',1 );
58
- add_action( 'wp_ajax_nopriv_zn_do_login', 'ct_ajax_hook',1 );
59
- add_action( 'wp_ajax_zn_do_login', 'ct_ajax_hook',1 );
60
- $cleantalk_hooked_actions[]='zn_do_login';
61
-
62
- /*hooks for zn_do_login */
63
- //add_action( 'wp_ajax_nopriv_cscf-submitform', 'ct_cscf_submitform',1 );
64
- //add_action( 'wp_ajax_cscf-submitform', 'ct_cscf_submitform',1 );
65
- add_action( 'wp_ajax_nopriv_cscf-submitform', 'ct_ajax_hook',1 );
66
- add_action( 'wp_ajax_cscf-submitform', 'ct_ajax_hook',1 );
67
- $cleantalk_hooked_actions[]='cscf-submitform';
68
-
69
- /*hooks for visual form builder */
70
- //add_action( 'wp_ajax_nopriv_vfb_submit', 'ct_vfb_submit',1 );
71
- //add_action( 'wp_ajax_vfb_submit', 'ct_vfb_submit',1 );
72
- add_action( 'wp_ajax_nopriv_vfb_submit', 'ct_ajax_hook',1 );
73
- add_action( 'wp_ajax_vfb_submit', 'ct_ajax_hook',1 );
74
- $cleantalk_hooked_actions[]='vfb_submit';
75
-
76
- /*hooks for woocommerce_checkout*/
77
- add_action( 'wp_ajax_nopriv_woocommerce_checkout', 'ct_ajax_hook',1 );
78
- add_action( 'wp_ajax_woocommerce_checkout', 'ct_ajax_hook',1 );
79
- $cleantalk_hooked_actions[]='woocommerce_checkout';
80
-
81
- /*hooks for frm_action*/
82
- add_action( 'wp_ajax_nopriv_frm_entries_create', 'ct_ajax_hook',1 );
83
- add_action( 'wp_ajax_frm_entries_create', 'ct_ajax_hook',1 );
84
- $cleantalk_hooked_actions[]='frm_entries_create';
85
-
86
- add_action( 'wp_ajax_nopriv_td_mod_register', 'ct_ajax_hook',1 );
87
- add_action( 'wp_ajax_td_mod_register', 'ct_ajax_hook',1 );
88
- $cleantalk_hooked_actions[]='td_mod_register';
89
-
90
- /*hooks for tevolution theme*/
91
- add_action( 'wp_ajax_nopriv_tmpl_ajax_check_user_email', 'ct_ajax_hook',1 );
92
- add_action( 'wp_ajax_tmpl_ajax_check_user_email', 'ct_ajax_hook',1 );
93
- add_action( 'wp_ajax_nopriv_tevolution_submit_from_preview', 'ct_ajax_hook',1 );
94
- add_action( 'wp_ajax_tevolution_submit_from_preview', 'ct_ajax_hook',1 );
95
- add_action( 'wp_ajax_nopriv_submit_form_recaptcha_validation', 'ct_ajax_hook',1 );
96
- add_action( 'wp_ajax_tmpl_submit_form_recaptcha_validation', 'ct_ajax_hook',1 );
97
- $cleantalk_hooked_actions[]='tmpl_ajax_check_user_email';
98
- $cleantalk_hooked_actions[]='tevolution_submit_from_preview';
99
- $cleantalk_hooked_actions[]='submit_form_recaptcha_validation';
100
-
101
- /**hooks for cm answers pro */
102
- add_action( 'template_redirect', 'ct_ajax_hook',1 );
103
-
104
- /* hooks for ninja forms ajax*/
105
- add_action( 'wp_ajax_nopriv_ninja_forms_ajax_submit', 'ct_ajax_hook',1 );
106
- add_action( 'wp_ajax_ninja_forms_ajax_submit', 'ct_ajax_hook',1 );
107
- $cleantalk_hooked_actions[]='ninja_forms_ajax_submit';
108
-
109
- function ct_validate_email_ajaxlogin($email=null, $is_ajax=true)
110
- {
111
- require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
112
- 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;
113
-
114
- $ct_options = ct_get_options();
115
- $ct_data = ct_get_data();
116
-
117
- $email = is_null( $email ) ? $email : $_POST['email'];
118
- $email=sanitize_email($email);
119
- $is_good=true;
120
- if ( ! filter_var( $email, FILTER_VALIDATE_EMAIL )||email_exists( $email ) )
121
- {
122
- $is_good=false;
123
- }
124
-
125
- if(class_exists('AjaxLogin')&&isset($_POST['action'])&&$_POST['action']=='validate_email')
126
- {
127
-
128
- //$ct_options=ct_get_options();
129
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
130
- $submit_time = submit_time_test();
131
- $sender_info = get_sender_info();
132
- $sender_info['post_checkjs_passed']=$checkjs;
133
-
134
- if ($checkjs === null)
135
- {
136
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
137
- $sender_info['cookie_checkjs_passed'] = $checkjs;
138
- }
139
-
140
- $sender_info = json_encode($sender_info);
141
- if ($sender_info === false)
142
- {
143
- $sender_info= '';
144
- }
145
-
146
- require_once('cleantalk.class.php');
147
- $config = get_option('cleantalk_server');
148
- $ct = new Cleantalk();
149
- $ct->work_url = $config['ct_work_url'];
150
- $ct->server_url = $ct_options['server'];
151
-
152
- $ct->server_ttl = $config['ct_server_ttl'];
153
- $ct->server_changed = $config['ct_server_changed'];
154
- $ct->ssl_on = $ct_options['ssl_on'];
155
-
156
- $ct_request = new CleantalkRequest();
157
- $ct_request->auth_key = $ct_options['apikey'];
158
- $ct_request->sender_email = $email;
159
- $ct_request->sender_ip = $ct->ct_session_ip($_SERVER['REMOTE_ADDR']);
160
- $ct_request->sender_nickname = '';
161
- $ct_request->agent = $ct_agent_version;
162
- $ct_request->sender_info = $sender_info;
163
- $ct_request->js_on = $checkjs;
164
- $ct_request->submit_time = $submit_time;
165
-
166
- $ct_result = $ct->isAllowUser($ct_request);
167
-
168
- if ($ct->server_change)
169
- {
170
- update_option(
171
- 'cleantalk_server', array(
172
- 'ct_work_url' => $ct->work_url,
173
- 'ct_server_ttl' => $ct->server_ttl,
174
- 'ct_server_changed' => time()
175
- )
176
- );
177
- }
178
- if ($ct_result->allow===0)
179
- {
180
- $is_good=false;
181
- }
182
- }
183
- if($is_good)
184
- {
185
- $ajaxresult=array(
186
- 'description' => null,
187
- 'cssClass' => 'noon',
188
- 'code' => 'success'
189
- );
190
- }
191
- else
192
- {
193
- $ajaxresult=array(
194
- 'description' => 'Invalid Email',
195
- 'cssClass' => 'error-container',
196
- 'code' => 'error'
197
- );
198
- }
199
- $ajaxresult=json_encode($ajaxresult);
200
- print $ajaxresult;
201
- wp_die();
202
- }
203
-
204
- function ct_user_register_ajaxlogin($user_id)
205
- {
206
- require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
207
- 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;
208
-
209
- $ct_options = ct_get_options();
210
- $ct_data = ct_get_data();
211
-
212
- if(class_exists('AjaxLogin')&&isset($_POST['action'])&&$_POST['action']=='register_submit')
213
- {
214
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
215
- $submit_time = submit_time_test();
216
- $sender_info = get_sender_info();
217
- $sender_info['post_checkjs_passed']=$checkjs;
218
-
219
- if ($checkjs === null)
220
- {
221
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
222
- $sender_info['cookie_checkjs_passed'] = $checkjs;
223
- }
224
-
225
- $sender_info = json_encode($sender_info);
226
- if ($sender_info === false)
227
- {
228
- $sender_info= '';
229
- }
230
-
231
- require_once('cleantalk.class.php');
232
- $config = get_option('cleantalk_server');
233
- $ct = new Cleantalk();
234
- $ct->work_url = $config['ct_work_url'];
235
- $ct->server_url = $ct_options['server'];
236
-
237
- $ct->server_ttl = $config['ct_server_ttl'];
238
- $ct->server_changed = $config['ct_server_changed'];
239
- $ct->ssl_on = $ct_options['ssl_on'];
240
-
241
- $ct_request = new CleantalkRequest();
242
- $ct_request->auth_key = $ct_options['apikey'];
243
- $ct_request->sender_email = sanitize_email($_POST['email']);
244
- $ct_request->sender_ip = $ct->ct_session_ip($_SERVER['REMOTE_ADDR']);
245
- $ct_request->sender_nickname = sanitize_email($_POST['login']); ;
246
- $ct_request->agent = $ct_agent_version;
247
- $ct_request->sender_info = $sender_info;
248
- $ct_request->js_on = $checkjs;
249
- $ct_request->submit_time = $submit_time;
250
-
251
- $ct_result = $ct->isAllowUser($ct_request);
252
-
253
- if ($ct->server_change)
254
- {
255
- update_option(
256
- 'cleantalk_server', array(
257
- 'ct_work_url' => $ct->work_url,
258
- 'ct_server_ttl' => $ct->server_ttl,
259
- 'ct_server_changed' => time()
260
- )
261
- );
262
- }
263
- if ($ct_result->allow===0)
264
- {
265
- wp_delete_user($user_id);
266
- }
267
- }
268
- return $user_id;
269
- }
270
-
271
- function ct_ajax_hook()
272
- {
273
- require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
274
- global $ct_agent_version, $ct_checkjs_register_form, $ct_session_request_id_label, $ct_session_register_ok_label, $bp, $ct_signup_done, $ct_formtime_label, $ct_negative_comment, $ct_options, $ct_data, $current_user;
275
-
276
- $ct_options = ct_get_options();
277
- $ct_data = ct_get_data();
278
- $sender_email = null;
279
- $message = '';
280
- $nickname=null;
281
- $contact = true;
282
- $subject = '';
283
-
284
- //
285
- // Skip test if Custom contact forms is disabled.
286
- //
287
- if (intval($ct_options['general_contact_forms_test'])==0 ) {
288
- return false;
289
- }
290
-
291
- //
292
- // Go out because we call it on backend.
293
- //
294
- if (ct_is_user_enable() === false || (function_exists('get_current_user_id') && get_current_user_id() != 0)) {
295
- return false;
296
- }
297
-
298
- //
299
- // Go out because of not spam data
300
- //
301
- $skip_post = array(
302
- 'gmaps_display_info_window', // Geo My WP pop-up windows.
303
- 'gmw_ps_display_info_window', // Geo My WP pop-up windows.
304
- 'the_champ_user_auth', // Super Socializer
305
- );
306
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
307
- if ($checkjs && // Spammers usually fail the JS test
308
- (isset($_POST['action']) && in_array($_POST['action'], $skip_post))
309
- ) {
310
- return false;
311
- }
312
-
313
- if(isset($_POST['user_login']))
314
- {
315
- $nickname=$_POST['user_login'];
316
- }
317
- else
318
- {
319
- $nickname='';
320
- }
321
-
322
- if(isset($_POST['cscf']['confirm-email']))
323
- {
324
- $tmp=$_POST['cscf']['confirm-email'];
325
- $_POST['cscf']['confirm-email']=1;
326
- }
327
-
328
- if(($_POST['action']=='request_appointment'||$_POST['action']=='send_message')&&isset($_POST['target']))
329
- {
330
- $tmp=$_POST['target'];
331
- $_POST['target']=1;
332
- }
333
-
334
- ct_get_fields_any($sender_email, $message, $nickname, $subject, $contact, $_POST);
335
- if ($subject != '') {
336
- $message = array_merge(array('subject' => $subject), $message);
337
- }
338
- $message = json_encode($message);
339
-
340
- if(isset($_POST['cscf']['confirm-email']))
341
- {
342
- $_POST['cscf']['confirm-email']=$tmp;
343
- }
344
-
345
- if(($_POST['action']=='request_appointment'||$_POST['action']=='send_message')&&isset($_POST['target']))
346
- {
347
- $_POST['target']=$tmp;
348
- }
349
-
350
- if($sender_email!=null)
351
- {
352
- $submit_time = submit_time_test();
353
- $sender_info = get_sender_info();
354
- $sender_info['post_checkjs_passed']=$checkjs;
355
-
356
- $sender_info = json_encode($sender_info);
357
- if ($sender_info === false)
358
- {
359
- $sender_info= '';
360
- }
361
-
362
- $post_info['comment_type'] = 'feedback_ajax';
363
- $post_info = json_encode($post_info);
364
- if ($post_info === false)
365
- $post_info = '';
366
-
367
-
368
- $ct_base_call_result = ct_base_call(array(
369
- 'message' => $message,
370
- 'example' => null,
371
- 'sender_email' => $sender_email,
372
- 'sender_nickname' => $nickname,
373
- 'sender_info' => $sender_info,
374
- 'post_info'=> $post_info,
375
- 'checkjs' => $checkjs));
376
-
377
- $ct = $ct_base_call_result['ct'];
378
- $ct_result = $ct_base_call_result['ct_result'];
379
- if ($ct_result->allow == 0)
380
- {
381
- if($_POST['action']=='wpuf_submit_register')
382
- {
383
- $result=Array('success'=>false,'error'=>$ct_result->comment);
384
- @header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
385
- print json_encode($result);
386
- die();
387
- }
388
- else if($_POST['action']=='mymail_form_submit')
389
- {
390
- $result=Array('success'=>false,'html'=>$ct_result->comment);
391
- @header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
392
- print json_encode($result);
393
- die();
394
- }
395
- else if($_POST['action']=='wysija_ajax'&&$_POST['task']!='send_preview')
396
- {
397
- $result=Array('result'=>false,'msgs'=>Array('updated'=>Array($ct_result->comment)));
398
- //@header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
399
- print $_GET['callback'].'('.json_encode($result).');';
400
- die();
401
- }
402
- else if($_POST['action']=='cs_registration_validation')
403
- {
404
- $result=Array("type"=>"error","message"=>$ct_result->comment);
405
- print json_encode($result);
406
- die();
407
- }
408
- else if($_POST['action']=='request_appointment'||$_POST['action']=='send_message')
409
- {
410
- print $ct_result->comment;
411
- die();
412
- }
413
- else if($_POST['action']=='zn_do_login')
414
- {
415
- print '<div id="login_error">'.$ct_result->comment.'</div>';
416
- die();
417
- }
418
- else if($_POST['action']=='vfb_submit')
419
- {
420
- $result=Array('result'=>false,'message'=>$ct_result->comment);
421
- @header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
422
- print json_encode($result);
423
- die();
424
- }
425
- else if($_POST['action']=='cscf-submitform')
426
- {
427
- $result=Array('sent'=>true,'valid'=>false,'errorlist'=>Array('name'=>$ct_result->comment));
428
- print json_encode($result);
429
- die();
430
- }
431
- else if($_POST['action']=='woocommerce_checkout')
432
- {
433
- print $ct_result->comment;
434
- die();
435
- }
436
- else if($_POST['action']=='frm_entries_create')
437
- {
438
- $result=Array('112'=>$ct_result->comment);
439
- print json_encode($result);
440
- die();
441
- }
442
- else if(isset($_POST['cma-action'])&&$_POST['cma-action']=='add')
443
- {
444
- $result=Array('success'=>0, 'thread_id'=>null,'messages'=>Array($ct_result->comment));
445
- print json_encode($result);
446
- die();
447
- }
448
- else if($_POST['action']=='td_mod_register')
449
- {
450
- print json_encode(array('register', 0, $ct_result->comment));
451
- die();
452
- }
453
- else if($_POST['action']=='tmpl_ajax_check_user_email')
454
- {
455
- print "17,email";
456
- die();
457
- }
458
- else if($_POST['action']=='tevolution_submit_from_preview'||$_POST['action']=='submit_form_recaptcha_validation')
459
- {
460
- print $ct_result->comment;
461
- die();
462
- }
463
- else if($_POST['action']=='ninja_forms_ajax_submit')
464
- {
465
- print '{"form_id":'.$_POST['_form_id'].',"errors":false,"success":{"success_msg-Success":"'.$ct_result->comment.'"}}';
466
- die();
467
- }
468
- //
469
- // WooWaitList
470
- // http://codecanyon.net/item/woowaitlist-woocommerce-back-in-stock-notifier/7103373
471
- //
472
- else if($_POST['action']=='wew_save_to_db_callback')
473
- {
474
- $result = array();
475
- $result['error'] = 1;
476
- $result['message'] = $ct_result->comment;
477
- $result['code'] = 5; // Unused code number in WooWaitlist
478
- print json_encode($result);
479
- die();
480
- }
481
- //UserPro
482
- else if($_POST['action']=='userpro_process_form' && $_POST['template']=='register')
483
- {
484
- foreach($_POST as $key => $value){
485
- $output[$key]=$value;
486
- }unset($key, $value);
487
- $output['template'] = $ct_result->comment;
488
- $output=json_encode($output);
489
- print_r($output);
490
- die;
491
- }
492
- else
493
- {
494
- print $ct_result->comment;
495
- die();
496
- }
497
- }
498
- }
499
- }
500
-
501
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/inc/cleantalk-ajax_old.php DELETED
@@ -1,775 +0,0 @@
1
- <?php
2
-
3
- /*
4
- AJAX functions
5
- */
6
-
7
- /*hooks for AJAX Login & Register email validation*/
8
- add_action( 'wp_ajax_nopriv_validate_email', 'ct_validate_email_ajaxlogin',1 );
9
- add_action( 'wp_ajax_validate_email', 'ct_validate_email_ajaxlogin',1 );
10
-
11
- /*hooks for user registration*/
12
- add_action( 'user_register', 'ct_user_register_ajaxlogin',1 );
13
-
14
- /*hooks for WPUF pro */
15
- add_action( 'wp_ajax_nopriv_wpuf_submit_register', 'ct_wpuf_submit_register',1 );
16
- add_action( 'wp_ajax_wpuf_submit_register', 'ct_wpuf_submit_register',1 );
17
-
18
- /*hooks for MyMail */
19
- add_action( 'wp_ajax_nopriv_mymail_form_submit', 'ct_mymail_form_submit',1 );
20
- add_action( 'wp_ajax_mymail_form_submit', 'ct_mymail_form_submit',1 );
21
-
22
- /*hooks for MailPoet */
23
- add_action( 'wp_ajax_nopriv_wysija_ajax', 'ct_wysija_ajax',1 );
24
- add_action( 'wp_ajax_wysija_ajax', 'ct_wysija_ajax',1 );
25
-
26
- /*hooks for cs_registration_validation */
27
- add_action( 'wp_ajax_nopriv_cs_registration_validation', 'ct_cs_registration_validation',1 );
28
- add_action( 'wp_ajax_cs_registration_validation', 'ct_cs_registration_validation',1 );
29
-
30
- /*hooks for cs_registration_validation */
31
- add_action( 'wp_ajax_nopriv_cs_registration_validation', 'ct_cs_registration_validation',1 );
32
- add_action( 'wp_ajax_cs_registration_validation', 'ct_cs_registration_validation',1 );
33
-
34
- /*hooks for send_message and request_appointment */
35
- add_action( 'wp_ajax_nopriv_send_message', 'ct_sm_ra',1 );
36
- add_action( 'wp_ajax_send_message', 'ct_sm_ra',1 );
37
- add_action( 'wp_ajax_nopriv_request_appointment', 'ct_sm_ra',1 );
38
- add_action( 'wp_ajax_request_appointment', 'ct_sm_ra',1 );
39
-
40
- /*hooks for zn_do_login */
41
- add_action( 'wp_ajax_nopriv_zn_do_login', 'ct_zn_do_login',1 );
42
- add_action( 'wp_ajax_zn_do_login', 'ct_zn_do_login',1 );
43
-
44
- /*hooks for zn_do_login */
45
- add_action( 'wp_ajax_nopriv_cscf-submitform', 'ct_cscf_submitform',1 );
46
- add_action( 'wp_ajax_cscf-submitform', 'ct_cscf_submitform',1 );
47
-
48
- /*hooks for stats */
49
- add_action( 'wp_ajax_nopriv_ajax_get_stats', 'ct_get_stats',1 );
50
- add_action( 'wp_ajax_ajax_get_stats', 'ct_get_stats',1 );
51
-
52
- /*hooks for visual form builder */
53
- add_action( 'wp_ajax_nopriv_vfb_submit', 'ct_vfb_submit',1 );
54
- add_action( 'wp_ajax_vfb_submit', 'ct_vfb_submit',1 );
55
-
56
- function ct_get_stats()
57
- {
58
- check_ajax_referer( 'ct_secret_nonce', 'security' );
59
- global $ct_data;
60
- $ct_data=ct_get_data();
61
- $t=time();
62
-
63
- if(!isset($ct_data['stat_accepted']))
64
- {
65
- $ct_data['stat_accepted']=0;
66
- $ct_data['stat_blocked']=0;
67
- $ct_data['stat_all']=0;
68
- $ct_data['last_time']=$t;
69
- update_option('cleantalk_data', $ct_data);
70
- }
71
-
72
- $last_time=intval($ct_data['last_time']);
73
- if($t-$last_time>86400)
74
- {
75
- $ct_data['stat_accepted']=0;
76
- $ct_data['stat_blocked']=0;
77
- $ct_data['stat_all']=0;
78
- $ct_data['last_time']=$t;
79
- update_option('cleantalk_data', $ct_data);
80
- }
81
-
82
- $ret=Array('stat_accepted'=>$ct_data['stat_accepted'],'stat_blocked'=>$ct_data['stat_blocked'],'stat_all'=>$ct_data['stat_all']);
83
- print json_encode($ret);
84
- die();
85
- }
86
-
87
- function ct_validate_email_ajaxlogin($email=null, $is_ajax=true)
88
- {
89
- require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
90
- global $ct_agent_version, $ct_checkjs_register_form, $ct_session_request_id_label, $ct_session_register_ok_label, $bp, $ct_signup_done, $ct_formtime_label, $ct_negative_comment, $ct_options, $ct_data;
91
-
92
- $ct_options=ct_get_options();
93
- $ct_data=ct_get_data();
94
-
95
- $email = is_null( $email ) ? $email : $_POST['email'];
96
- $email=sanitize_email($email);
97
- $is_good=true;
98
- if ( ! filter_var( $email, FILTER_VALIDATE_EMAIL )||email_exists( $email ) )
99
- {
100
- $is_good=false;
101
- }
102
-
103
- if(class_exists('AjaxLogin')&&isset($_POST['action'])&&$_POST['action']=='validate_email')
104
- {
105
-
106
- $ct_options=ct_get_options();
107
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
108
- $submit_time = submit_time_test();
109
- $sender_info = get_sender_info();
110
- $sender_info['post_checkjs_passed']=$checkjs;
111
-
112
- if ($checkjs === null)
113
- {
114
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
115
- $sender_info['cookie_checkjs_passed'] = $checkjs;
116
- }
117
-
118
- $sender_info = json_encode($sender_info);
119
- if ($sender_info === false)
120
- {
121
- $sender_info= '';
122
- }
123
-
124
- require_once('cleantalk.class.php');
125
- $config = get_option('cleantalk_server');
126
- $ct = new Cleantalk();
127
- $ct->work_url = $config['ct_work_url'];
128
- $ct->server_url = $ct_options['server'];
129
-
130
- $ct->server_ttl = $config['ct_server_ttl'];
131
- $ct->server_changed = $config['ct_server_changed'];
132
- $ct->ssl_on = $ct_options['ssl_on'];
133
-
134
- $ct_request = new CleantalkRequest();
135
- $ct_request->auth_key = $ct_options['apikey'];
136
- $ct_request->sender_email = $email;
137
- $ct_request->sender_ip = $ct->ct_session_ip($_SERVER['REMOTE_ADDR']);
138
- $ct_request->sender_nickname = '';
139
- $ct_request->agent = $ct_agent_version;
140
- $ct_request->sender_info = $sender_info;
141
- $ct_request->js_on = $checkjs;
142
- $ct_request->submit_time = $submit_time;
143
-
144
- $ct_result = $ct->isAllowUser($ct_request);
145
-
146
- if ($ct->server_change)
147
- {
148
- update_option(
149
- 'cleantalk_server', array(
150
- 'ct_work_url' => $ct->work_url,
151
- 'ct_server_ttl' => $ct->server_ttl,
152
- 'ct_server_changed' => time()
153
- )
154
- );
155
- }
156
- if ($ct_result->allow===0)
157
- {
158
- $is_good=false;
159
- }
160
- }
161
- if($is_good)
162
- {
163
- $ajaxresult=array(
164
- 'description' => null,
165
- 'cssClass' => 'noon',
166
- 'code' => 'success'
167
- );
168
- }
169
- else
170
- {
171
- $ajaxresult=array(
172
- 'description' => 'Invalid Email',
173
- 'cssClass' => 'error-container',
174
- 'code' => 'error'
175
- );
176
- }
177
- $ajaxresult=json_encode($ajaxresult);
178
- print $ajaxresult;
179
- wp_die();
180
- }
181
-
182
- function ct_user_register_ajaxlogin($user_id)
183
- {
184
- require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
185
- global $ct_agent_version, $ct_checkjs_register_form, $ct_session_request_id_label, $ct_session_register_ok_label, $bp, $ct_signup_done, $ct_formtime_label, $ct_negative_comment, $ct_options, $ct_data;
186
-
187
- $ct_options=ct_get_options();
188
- $ct_data=ct_get_data();
189
-
190
- if(class_exists('AjaxLogin')&&isset($_POST['action'])&&$_POST['action']=='register_submit')
191
- {
192
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
193
- $submit_time = submit_time_test();
194
- $sender_info = get_sender_info();
195
- $sender_info['post_checkjs_passed']=$checkjs;
196
-
197
- if ($checkjs === null)
198
- {
199
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
200
- $sender_info['cookie_checkjs_passed'] = $checkjs;
201
- }
202
-
203
- $sender_info = json_encode($sender_info);
204
- if ($sender_info === false)
205
- {
206
- $sender_info= '';
207
- }
208
-
209
- require_once('cleantalk.class.php');
210
- $config = get_option('cleantalk_server');
211
- $ct = new Cleantalk();
212
- $ct->work_url = $config['ct_work_url'];
213
- $ct->server_url = $ct_options['server'];
214
-
215
- $ct->server_ttl = $config['ct_server_ttl'];
216
- $ct->server_changed = $config['ct_server_changed'];
217
- $ct->ssl_on = $ct_options['ssl_on'];
218
-
219
- $ct_request = new CleantalkRequest();
220
- $ct_request->auth_key = $ct_options['apikey'];
221
- $ct_request->sender_email = sanitize_email($_POST['email']);
222
- $ct_request->sender_ip = $ct->ct_session_ip($_SERVER['REMOTE_ADDR']);
223
- $ct_request->sender_nickname = sanitize_email($_POST['login']); ;
224
- $ct_request->agent = $ct_agent_version;
225
- $ct_request->sender_info = $sender_info;
226
- $ct_request->js_on = $checkjs;
227
- $ct_request->submit_time = $submit_time;
228
-
229
- $ct_result = $ct->isAllowUser($ct_request);
230
-
231
- if ($ct->server_change)
232
- {
233
- update_option(
234
- 'cleantalk_server', array(
235
- 'ct_work_url' => $ct->work_url,
236
- 'ct_server_ttl' => $ct->server_ttl,
237
- 'ct_server_changed' => time()
238
- )
239
- );
240
- }
241
- if ($ct_result->allow===0)
242
- {
243
- wp_delete_user($user_id);
244
- }
245
- }
246
- return $user_id;
247
- }
248
-
249
- function ct_wpuf_submit_register()
250
- {
251
- require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
252
- global $ct_agent_version, $ct_checkjs_register_form, $ct_session_request_id_label, $ct_session_register_ok_label, $bp, $ct_signup_done, $ct_formtime_label, $ct_negative_comment, $ct_options, $ct_data;
253
-
254
- $ct_data=ct_get_data();
255
-
256
- $ct_options=ct_get_options();
257
-
258
- $sender_email = null;
259
- $message = '';
260
-
261
- foreach ($_POST as $key => $value)
262
- {
263
- if ($sender_email === null && preg_match("/^\S+@\S+\.\S+$/", $value))
264
- {
265
- $sender_email = $value;
266
- }
267
- else
268
- {
269
- $message.="$value\n";
270
- }
271
- }
272
-
273
- if($sender_email!=null)
274
- {
275
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
276
- $submit_time = submit_time_test();
277
- $sender_info = get_sender_info();
278
- $sender_info['post_checkjs_passed']=$checkjs;
279
-
280
- $sender_info = json_encode($sender_info);
281
- if ($sender_info === false)
282
- {
283
- $sender_info= '';
284
- }
285
-
286
- $ct_base_call_result = ct_base_call(array(
287
- 'message' => $message,
288
- 'example' => null,
289
- 'sender_email' => $sender_email,
290
- 'sender_nickname' => null,
291
- 'sender_info' => $sender_info,
292
- 'post_info'=>null,
293
- 'checkjs' => $checkjs));
294
-
295
- $ct = $ct_base_call_result['ct'];
296
- $ct_result = $ct_base_call_result['ct_result'];
297
- if ($ct_result->allow == 0)
298
- {
299
- $result=Array('success'=>false,'error'=>$ct_result->comment);
300
- @header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
301
- print json_encode($result);
302
- die();
303
- }
304
- }
305
- }
306
-
307
- function ct_mymail_form_submit()
308
- {
309
- require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
310
- global $ct_agent_version, $ct_checkjs_register_form, $ct_session_request_id_label, $ct_session_register_ok_label, $bp, $ct_signup_done, $ct_formtime_label, $ct_negative_comment, $ct_options, $ct_data;
311
-
312
- $ct_data=ct_get_data();
313
-
314
- $ct_options=ct_get_options();
315
-
316
- $sender_email = null;
317
- $message = '';
318
-
319
- ct_get_fields($sender_email,$message,$_POST);
320
-
321
- if($sender_email!=null)
322
- {
323
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
324
- $submit_time = submit_time_test();
325
- $sender_info = get_sender_info();
326
- $sender_info['post_checkjs_passed']=$checkjs;
327
-
328
- $sender_info = json_encode($sender_info);
329
- if ($sender_info === false)
330
- {
331
- $sender_info= '';
332
- }
333
-
334
- $ct_base_call_result = ct_base_call(array(
335
- 'message' => $message,
336
- 'example' => null,
337
- 'sender_email' => $sender_email,
338
- 'sender_nickname' => null,
339
- 'sender_info' => $sender_info,
340
- 'post_info'=>null,
341
- 'checkjs' => $checkjs));
342
-
343
- $ct = $ct_base_call_result['ct'];
344
- $ct_result = $ct_base_call_result['ct_result'];
345
- if ($ct_result->allow == 0)
346
- {
347
- $result=Array('success'=>false,'html'=>$ct_result->comment);
348
- @header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
349
- print json_encode($result);
350
- die();
351
- }
352
- }
353
- }
354
-
355
- function ct_wysija_ajax()
356
- {
357
- require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
358
- global $ct_agent_version, $ct_checkjs_register_form, $ct_session_request_id_label, $ct_session_register_ok_label, $bp, $ct_signup_done, $ct_formtime_label, $ct_negative_comment, $ct_options, $ct_data;
359
-
360
- $ct_data=ct_get_data();
361
-
362
- $ct_options=ct_get_options();
363
-
364
- $sender_email = null;
365
- $message = '';
366
-
367
- ct_get_fields($sender_email,$message,$_POST);
368
-
369
-
370
- if($sender_email!=null&&isset($_GET['callback']))
371
- {
372
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
373
- $submit_time = submit_time_test();
374
- $sender_info = get_sender_info();
375
- $sender_info['post_checkjs_passed']=$checkjs;
376
-
377
- $sender_info = json_encode($sender_info);
378
- if ($sender_info === false)
379
- {
380
- $sender_info= '';
381
- }
382
-
383
- $ct_base_call_result = ct_base_call(array(
384
- 'message' => $message,
385
- 'example' => null,
386
- 'sender_email' => $sender_email,
387
- 'sender_nickname' => null,
388
- 'sender_info' => $sender_info,
389
- 'post_info'=>null,
390
- 'checkjs' => $checkjs));
391
-
392
- $ct = $ct_base_call_result['ct'];
393
- $ct_result = $ct_base_call_result['ct_result'];
394
- if ($ct_result->allow == 0)
395
- {
396
- $result=Array('result'=>false,'msgs'=>Array('updated'=>Array($ct_result->comment)));
397
- //@header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
398
- print $_GET['callback'].'('.json_encode($result).');';
399
- die();
400
- }
401
- }
402
- }
403
-
404
- function ct_cs_registration_validation()
405
- {
406
-
407
- require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
408
- global $ct_agent_version, $ct_checkjs_register_form, $ct_session_request_id_label, $ct_session_register_ok_label, $bp, $ct_signup_done, $ct_formtime_label, $ct_negative_comment, $ct_options, $ct_data;
409
-
410
- $ct_data=ct_get_data();
411
-
412
- $ct_options=ct_get_options();
413
-
414
- $sender_email = null;
415
- $message = '';
416
-
417
- ct_get_fields($sender_email,$message,$_POST);
418
-
419
- if($sender_email!=null)
420
- {
421
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
422
- $submit_time = submit_time_test();
423
- $sender_info = get_sender_info();
424
- $sender_info['post_checkjs_passed']=$checkjs;
425
-
426
- $sender_info = json_encode($sender_info);
427
- if ($sender_info === false)
428
- {
429
- $sender_info = '';
430
- }
431
- if(isset($_POST['user_login']))
432
- {
433
- $nickname=$_POST['user_login'];
434
- }
435
- else
436
- {
437
- $nickname='';
438
- }
439
- require_once('cleantalk.class.php');
440
-
441
- $config = get_option('cleantalk_server');
442
- $ct = new Cleantalk();
443
- $ct->work_url = $config['ct_work_url'];
444
- $ct->server_url = $ct_options['server'];
445
-
446
- $ct->server_ttl = $config['ct_server_ttl'];
447
- $ct->server_changed = $config['ct_server_changed'];
448
- $ct->ssl_on = $ct_options['ssl_on'];
449
-
450
-
451
- $ct_request = new CleantalkRequest();
452
- $ct_request->auth_key = $ct_options['apikey'];
453
- $ct_request->sender_email = $sender_email;
454
- $ct_request->sender_ip = $_SERVER['REMOTE_ADDR'];
455
- $ct_request->sender_nickname = $nickname;
456
- $ct_request->agent = $ct_agent_version;
457
- $ct_request->sender_info = $sender_info;
458
- $ct_request->js_on = $checkjs;
459
- $ct_request->submit_time = $submit_time;
460
-
461
- $ct_result = $ct->isAllowUser($ct_request);
462
-
463
- if ($ct_result->allow == 0)
464
- {
465
- $result=Array("type"=>"error","message"=>$ct_result->comment);
466
- print json_encode($result);
467
- die();
468
- }
469
- }
470
- }
471
-
472
- function ct_sm_ra()
473
- {
474
- require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
475
- global $ct_agent_version, $ct_checkjs_register_form, $ct_session_request_id_label, $ct_session_register_ok_label, $bp, $ct_signup_done, $ct_formtime_label, $ct_negative_comment, $ct_options, $ct_data;
476
-
477
- $ct_data=ct_get_data();
478
-
479
- $ct_options=ct_get_options();
480
-
481
- $sender_email = null;
482
- $message = '';
483
-
484
- if(isset($_POST['target']))
485
- {
486
- $tmp=$_POST['target'];
487
- $_POST['target']=1;
488
- }
489
-
490
- ct_get_fields($sender_email,$message,$_POST);
491
-
492
- if(isset($_POST['target']))
493
- {
494
- $_POST['target']=$tmp;
495
- }
496
-
497
-
498
- if($sender_email!=null)
499
- {
500
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
501
- $submit_time = submit_time_test();
502
- $sender_info = get_sender_info();
503
- $sender_info['post_checkjs_passed']=$checkjs;
504
-
505
- $sender_info = json_encode($sender_info);
506
- if ($sender_info === false)
507
- {
508
- $sender_info= '';
509
- }
510
-
511
- $ct_base_call_result = ct_base_call(array(
512
- 'message' => $message,
513
- 'example' => null,
514
- 'sender_email' => $sender_email,
515
- 'sender_nickname' => null,
516
- 'sender_info' => $sender_info,
517
- 'post_info'=>null,
518
- 'checkjs' => $checkjs));
519
-
520
- $ct = $ct_base_call_result['ct'];
521
- $ct_result = $ct_base_call_result['ct_result'];
522
- if ($ct_result->allow == 0)
523
- {
524
- print $ct_result->comment;
525
- die();
526
- }
527
- }
528
- }
529
-
530
- function ct_zn_do_login()
531
- {
532
- require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
533
- global $ct_agent_version, $ct_checkjs_register_form, $ct_session_request_id_label, $ct_session_register_ok_label, $bp, $ct_signup_done, $ct_formtime_label, $ct_negative_comment, $ct_options, $ct_data;
534
-
535
- $ct_data=ct_get_data();
536
-
537
- $ct_options=ct_get_options();
538
-
539
- $sender_email = null;
540
- $message = '';
541
-
542
- ct_get_fields($sender_email,$message,$_POST);
543
-
544
-
545
- if($sender_email!=null&&$_POST['zn_form_action']=='register')
546
- {
547
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
548
- $submit_time = submit_time_test();
549
- $sender_info = get_sender_info();
550
- $sender_info['post_checkjs_passed']=$checkjs;
551
-
552
- $sender_info = json_encode($sender_info);
553
- if ($sender_info === false)
554
- {
555
- $sender_info= '';
556
- }
557
-
558
- $ct_base_call_result = ct_base_call(array(
559
- 'message' => $message,
560
- 'example' => null,
561
- 'sender_email' => $sender_email,
562
- 'sender_nickname' => null,
563
- 'sender_info' => $sender_info,
564
- 'post_info'=>null,
565
- 'checkjs' => $checkjs));
566
-
567
- $ct = $ct_base_call_result['ct'];
568
- $ct_result = $ct_base_call_result['ct_result'];
569
- if ($ct_result->allow == 0)
570
- {
571
- print '<div id="login_error">'.$ct_result->comment.'</div>';
572
- die();
573
- }
574
- }
575
- }
576
-
577
- function ct_vfb_submit()
578
- {
579
- require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
580
- global $ct_agent_version, $ct_checkjs_register_form, $ct_session_request_id_label, $ct_session_register_ok_label, $bp, $ct_signup_done, $ct_formtime_label, $ct_negative_comment, $ct_options, $ct_data;
581
-
582
- $ct_data=ct_get_data();
583
-
584
- $ct_options=ct_get_options();
585
-
586
- $sender_email = null;
587
- $message = '';
588
-
589
- foreach ($_POST as $key => $value)
590
- {
591
- if ($sender_email === null && preg_match("/^\S+@\S+\.\S+$/", $value))
592
- {
593
- $sender_email = $value;
594
- }
595
- else
596
- {
597
- $message.="$value\n";
598
- }
599
- }
600
-
601
- if($sender_email!=null)
602
- {
603
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
604
- $submit_time = submit_time_test();
605
- $sender_info = get_sender_info();
606
- $sender_info['post_checkjs_passed']=$checkjs;
607
-
608
- $sender_info = json_encode($sender_info);
609
- if ($sender_info === false)
610
- {
611
- $sender_info= '';
612
- }
613
-
614
- $ct_base_call_result = ct_base_call(array(
615
- 'message' => $message,
616
- 'example' => null,
617
- 'sender_email' => $sender_email,
618
- 'sender_nickname' => null,
619
- 'sender_info' => $sender_info,
620
- 'post_info'=>null,
621
- 'checkjs' => $checkjs));
622
-
623
- $ct = $ct_base_call_result['ct'];
624
- $ct_result = $ct_base_call_result['ct_result'];
625
- if ($ct_result->allow == 0)
626
- {
627
- $result=Array('result'=>false,'message'=>$ct_result->comment);
628
- @header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
629
- print json_encode($result);
630
- die();
631
- }
632
- }
633
- }
634
-
635
- function ct_cscf_submitform()
636
- {
637
- require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
638
- global $ct_agent_version, $ct_checkjs_register_form, $ct_session_request_id_label, $ct_session_register_ok_label, $bp, $ct_signup_done, $ct_formtime_label, $ct_negative_comment, $ct_options, $ct_data;
639
-
640
- $ct_data=ct_get_data();
641
-
642
- $ct_options=ct_get_options();
643
-
644
- $sender_email = null;
645
- $message = '';
646
-
647
- if(isset($_POST['cscf']['confirm-email']))
648
- {
649
- $tmp=$_POST['cscf']['confirm-email'];
650
- $_POST['cscf']['confirm-email']=1;
651
- }
652
-
653
- ct_get_fields($sender_email,$message,$_POST);
654
-
655
- if(isset($_POST['cscf']['confirm-email']))
656
- {
657
- $_POST['cscf']['confirm-email']=$tmp;
658
- }
659
-
660
-
661
- if($sender_email!=null)
662
- {
663
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
664
- $submit_time = submit_time_test();
665
- $sender_info = get_sender_info();
666
- $sender_info['post_checkjs_passed']=$checkjs;
667
-
668
- $sender_info = json_encode($sender_info);
669
- if ($sender_info === false)
670
- {
671
- $sender_info= '';
672
- }
673
-
674
- $ct_base_call_result = ct_base_call(array(
675
- 'message' => $message,
676
- 'example' => null,
677
- 'sender_email' => $sender_email,
678
- 'sender_nickname' => null,
679
- 'sender_info' => $sender_info,
680
- 'post_info'=>null,
681
- 'checkjs' => $checkjs));
682
-
683
- $ct = $ct_base_call_result['ct'];
684
- $ct_result = $ct_base_call_result['ct_result'];
685
- if ($ct_result->allow == 0)
686
- {
687
- $result=Array('sent'=>true,'valid'=>false,'errorlist'=>Array('name'=>$ct_result->comment));
688
- print json_encode($result);
689
- die();
690
- }
691
- }
692
- }
693
-
694
- function ct_theme_submit()
695
- {
696
- require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
697
- global $ct_agent_version, $ct_checkjs_register_form, $ct_session_request_id_label, $ct_session_register_ok_label, $bp, $ct_signup_done, $ct_formtime_label, $ct_negative_comment, $ct_options, $ct_data;
698
-
699
- $ct_data=ct_get_data();
700
-
701
- $ct_options=ct_get_options();
702
-
703
- $sender_email = null;
704
- $message = '';
705
-
706
- if(isset($_POST['cscf']['confirm-email']))
707
- {
708
- $tmp=$_POST['cscf']['confirm-email'];
709
- $_POST['cscf']['confirm-email']=1;
710
- }
711
-
712
- ct_get_fields($sender_email,$message,$_POST);
713
-
714
- if(isset($_POST['cscf']['confirm-email']))
715
- {
716
- $_POST['cscf']['confirm-email']=$tmp;
717
- }
718
-
719
-
720
- if($sender_email!=null)
721
- {
722
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
723
- $submit_time = submit_time_test();
724
- $sender_info = get_sender_info();
725
- $sender_info['post_checkjs_passed']=$checkjs;
726
-
727
- $sender_info = json_encode($sender_info);
728
- if ($sender_info === false)
729
- {
730
- $sender_info= '';
731
- }
732
-
733
- $ct_base_call_result = ct_base_call(array(
734
- 'message' => $message,
735
- 'example' => null,
736
- 'sender_email' => $sender_email,
737
- 'sender_nickname' => null,
738
- 'sender_info' => $sender_info,
739
- 'post_info'=>null,
740
- 'checkjs' => $checkjs));
741
-
742
- $ct = $ct_base_call_result['ct'];
743
- $ct_result = $ct_base_call_result['ct_result'];
744
- if ($ct_result->allow == 0)
745
- {
746
- $result=Array('sent'=>true,'valid'=>false,'errorlist'=>Array('name'=>$ct_result->comment));
747
- print json_encode($result);
748
- die();
749
- }
750
- }
751
- }
752
-
753
- function ct_get_fields(&$email,&$message,$arr)
754
- {
755
- foreach($arr as $key=>$value)
756
- {
757
- if(!is_array($value))
758
- {
759
- if ($email === null && preg_match("/^\S+@\S+\.\S+$/", $value))
760
- {
761
- $email = $value;
762
- }
763
- else
764
- {
765
- $message.="$value\n";
766
- }
767
- }
768
- else
769
- {
770
- ct_get_fields($email,$message,$value);
771
- }
772
- }
773
- }
774
-
775
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/inc/cleantalk-comments-checkspam.js DELETED
@@ -1,244 +0,0 @@
1
- var working=false;
2
-
3
- String.prototype.format = String.prototype.f = function ()
4
- {
5
- var args = arguments;
6
- return this.replace(/\{\{|\}\}|\{(\d+)\}/g, function (m, n)
7
- {
8
- if (m == "{{") { return "{"; }
9
- if (m == "}}") { return "}"; }
10
- return args[n];
11
- });
12
- };
13
- var close_animate=true;
14
- function animate_comment(to,id)
15
- {
16
- if(close_animate)
17
- {
18
- if(to==0.3)
19
- {
20
- jQuery('#comment-'+id).fadeTo(200,to,function(){
21
- animate_comment(1,id)
22
- });
23
- }
24
- else
25
- {
26
- jQuery('#comment-'+id).fadeTo(200,to,function(){
27
- animate_comment(0.3,id)
28
- });
29
- }
30
- }
31
- else
32
- {
33
- close_animate=true;
34
- }
35
- }
36
-
37
- function ct_clear_comments()
38
- {
39
- var data = {
40
- 'action': 'ajax_clear_comments',
41
- 'security': ajax_nonce
42
- };
43
-
44
- jQuery.ajax({
45
- type: "POST",
46
- url: ajaxurl,
47
- data: data,
48
- success: function(msg){
49
- ct_send_comments();
50
- }
51
- });
52
- }
53
-
54
- function ct_send_comments()
55
- {
56
- var data = {
57
- 'action': 'ajax_check_comments',
58
- 'security': ajax_nonce
59
- };
60
-
61
- jQuery.ajax({
62
- type: "POST",
63
- url: ajaxurl,
64
- data: data,
65
- success: function(msg){
66
- if(parseInt(msg)==1)
67
- {
68
- ct_send_comments();
69
- }
70
- else if(parseInt(msg)==0)
71
- {
72
- working=false;
73
- jQuery('#ct_working_message').hide();
74
- //alert('finish!');
75
- location.href='edit-comments.php?page=ct_check_spam';
76
- }
77
- else
78
- {
79
- working=false;
80
- alert(msg);
81
- }
82
- }
83
- });
84
- }
85
- function ct_show_info()
86
- {
87
- if(working)
88
- {
89
- var data = {
90
- 'action': 'ajax_info_comments',
91
- 'security': ajax_nonce
92
- };
93
- jQuery.ajax({
94
- type: "POST",
95
- url: ajaxurl,
96
- data: data,
97
- success: function(msg){
98
- jQuery('#ct_checking_status').html(msg);
99
- setTimeout(ct_show_info, 1000);
100
- }
101
- });
102
- }
103
- }
104
- function ct_insert_comments()
105
- {
106
- var data = {
107
- 'action': 'ajax_insert_comments',
108
- 'security': ajax_nonce
109
- };
110
-
111
- jQuery.ajax({
112
- type: "POST",
113
- url: ajaxurl,
114
- data: data,
115
- success: function(msg){
116
- if(msg=='ok')
117
- {
118
- alert('Added 500 comments');
119
- }
120
- }
121
- });
122
- }
123
- function ct_delete_all()
124
- {
125
- var data = {
126
- 'action': 'ajax_delete_all',
127
- 'security': ajax_nonce
128
- };
129
-
130
- jQuery.ajax({
131
- type: "POST",
132
- url: ajaxurl,
133
- data: data,
134
- success: function(msg){
135
- if(msg>0)
136
- {
137
- jQuery('#cleantalk_comments_left').html(msg);
138
- ct_delete_all();
139
- }
140
- else
141
- {
142
- location.href='edit-comments.php?page=ct_check_spam';
143
- }
144
- }
145
- });
146
- }
147
- function ct_delete_checked()
148
- {
149
- ids=Array();
150
- var cnt=0;
151
- jQuery('input[id^=cb-select-][id!=cb-select-all-1]').each(function(){
152
- if(jQuery(this).prop('checked'))
153
- {
154
- ids[cnt]=jQuery(this).attr('id').substring(10);
155
- cnt++;
156
- }
157
- });
158
- var data = {
159
- 'action': 'ajax_delete_checked',
160
- 'security': ajax_nonce,
161
- 'ids':ids
162
- };
163
-
164
- jQuery.ajax({
165
- type: "POST",
166
- url: ajaxurl,
167
- data: data,
168
- success: function(msg){
169
- location.href='edit-comments.php?page=ct_check_spam';
170
- //alert(msg);
171
- }
172
- });
173
- }
174
- jQuery("#ct_check_spam_button").click(function(){
175
- jQuery('#ct_working_message').show();
176
- jQuery('#ct_check_spam_button').hide();
177
- jQuery('#ct_info_message').hide();
178
- working=true;
179
- ct_clear_comments();
180
- });
181
- jQuery("#ct_check_spam_button").click(function(){
182
- jQuery('#ct_checking_status').html('');
183
- jQuery('#ct_check_comments_table').hide();
184
- jQuery('#ct_delete_all').hide();
185
- jQuery('#ct_delete_checked').hide();
186
- jQuery('#ct_preloader').show();
187
- working=true;
188
- ct_show_info();
189
- });
190
- jQuery("#ct_insert_comments").click(function(){
191
- ct_insert_comments();
192
- });
193
- jQuery("#ct_delete_all").click(function(){
194
- jQuery('#ct_check_comments_table').hide();
195
- jQuery('#ct_deleting_message').show();
196
- jQuery("html, body").animate({ scrollTop: 0 }, "slow");
197
- ct_delete_all();
198
- });
199
- jQuery("#ct_delete_checked").click(function(){
200
- ct_delete_checked();
201
- });
202
- jQuery(".cleantalk_comment").mouseover(function(){
203
- id = jQuery(this).attr("data-id");
204
- jQuery("#cleantalk_delete_"+id).show();
205
- });
206
- jQuery(".cleantalk_comment").mouseout(function(){
207
- id = jQuery(this).attr("data-id");
208
- jQuery("#cleantalk_delete_"+id).hide();
209
- });
210
- jQuery(".cleantalk_delete_button").click(function(){
211
- id = jQuery(this).attr("data-id");
212
- ids=Array();
213
- ids[0]=id;
214
- var data = {
215
- 'action': 'ajax_delete_checked',
216
- 'security': ajax_nonce,
217
- 'ids':ids
218
- };
219
- jQuery.ajax({
220
- type: "POST",
221
- url: ajaxurl,
222
- data: data,
223
- success: function(msg){
224
- close_animate=false;
225
- jQuery("#comment-"+id).hide();
226
- jQuery("#comment-"+id).remove();
227
- close_animate=true;
228
- }
229
- });
230
- });
231
- jQuery(".cleantalk_delete_button").click(function(){
232
- id = jQuery(this).attr("data-id");
233
- animate_comment(0.3, id);
234
- });
235
-
236
- jQuery(document).ready(function(){
237
- working=true;
238
- ct_show_info();
239
- working=false;
240
- if(location.href.match(/do_check/))
241
- {
242
- jQuery("#ct_check_spam_button").click();
243
- }
244
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/inc/cleantalk-comments-editscreen.js DELETED
@@ -1,17 +0,0 @@
1
- jQuery('#post-query-submit').after('<a href="edit-comments.php?page=ct_check_spam" class="button">'+spambutton_text+'</a>');
2
- jQuery("#ct_check_spam_button").click(function(){
3
- var data = {
4
- 'action': 'ajax_check_comments',
5
- security: ajax_nonce
6
- };
7
-
8
- jQuery.ajax({
9
- type: "POST",
10
- url: ajaxurl,
11
- data: data,
12
- success: function(msg){
13
- alert(msg);
14
- }
15
- });
16
-
17
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/inc/cleantalk-comments.php DELETED
@@ -1,477 +0,0 @@
1
- <?php
2
-
3
- add_action('admin_menu', 'ct_add_comments_menu');
4
-
5
- function ct_add_comments_menu()
6
- {
7
- if(current_user_can('activate_plugins'))
8
- {
9
- add_comments_page( __("Check for spam", 'cleantalk'), __("Check for spam", 'cleantalk'), 'read', 'ct_check_spam', 'ct_show_checkspam_page');
10
- }
11
- }
12
-
13
- function ct_show_checkspam_page()
14
- {
15
- ?>
16
- <div class="wrap">
17
- <h2><?php _e("Anti-spam by CleanTalk", 'cleantalk'); ?></h2><br />
18
-
19
- <h3 id="ct_checking_status" style="text-align:center;width:90%;"></h3>
20
- <div style="text-align:center;width:100%;display:none;" id="ct_preloader"><img border=0 src="<?php print plugin_dir_url(__FILE__); ?>images/preloader.gif" /></div>
21
- <?php
22
- $args_spam = array(
23
- 'meta_query' => array(
24
- Array(
25
- 'key' => 'ct_marked_as_spam',
26
- 'compare' => 'EXISTS'
27
- )
28
- ),
29
- 'count'=>true
30
- );
31
- $cnt_spam=get_comments($args_spam);
32
-
33
-
34
- $page=1;
35
- if(isset($_GET['spam_page']))
36
- {
37
- $page=intval($_GET['spam_page']);
38
- }
39
- $args_spam = array(
40
- 'meta_query' => array(
41
- Array(
42
- 'key' => 'ct_marked_as_spam',
43
- 'value' => '1',
44
- 'compare' => 'NUMERIC'
45
- )
46
- ),
47
- 'number'=>30,
48
- 'offset'=>($page-1)*30
49
- );
50
-
51
- $c_spam=get_comments($args_spam);
52
- if($cnt_spam>0)
53
- {
54
- ?>
55
- <table class="widefat fixed comments" id="ct_check_comments_table">
56
- <thead>
57
- <th scope="col" id="cb" class="manage-column column-cb check-column">
58
- <label class="screen-reader-text" for="cb-select-all-1">Select All</label>
59
- <input id="cb-select-all-1" type="checkbox" style="margin-top:0;"/>
60
- </th>
61
- <th scope="col" id="author" class="manage-column column-slug"><?php print _e('Author');?></th>
62
- <th scope="col" id="comment" class="manage-column column-comment"><?php print _x( 'Comment', 'column name' );;?></th>
63
- <th scope="col" id="response" class="manage-column column-response sortable desc"><?php print _x( 'In Response To', 'column name' );?></th>
64
- </thead>
65
- <tbody id="the-comment-list" data-wp-lists="list:comment">
66
- <?php
67
- for($i=0;$i<sizeof($c_spam);$i++)
68
- {
69
- ?>
70
- <tr id="comment-<?php print $c_spam[$i]->comment_ID; ?>" class="comment even thread-even depth-1 approved cleantalk_comment" data-id="<?php print $c_spam[$i]->comment_ID; ?>">
71
- <th scope="row" class="check-column">
72
- <label class="screen-reader-text" for="cb-select-<?php print $c_spam[$i]->comment_ID; ?>">Select comment</label>
73
- <input id="cb-select-<?php print $c_spam[$i]->comment_ID; ?>" type="checkbox" name="del_comments[]" value="<?php print $c_spam[$i]->comment_ID; ?>"/>
74
- </th>
75
- <td class="author column-author" nowrap>
76
- <strong>
77
- <?php echo get_avatar( $c_spam[$i]->comment_author_email , 32); ?>
78
- <?php print $c_spam[$i]->comment_author; ?>
79
- </strong>
80
- <br/>
81
- <a href="mailto:<?php print $c_spam[$i]->comment_author_email; ?>"><?php print $c_spam[$i]->comment_author_email; ?></a> <a href="https://cleantalk.org/blacklists/<?php print $c_spam[$i]->comment_author_email ; ?>" target="_blank"><img src="https://cleantalk.ru/images/icons/new_window.gif" border="0" style="float:none"/></a>
82
- <br/>
83
- <a href="edit-comments.php?s=<?php print $c_spam[$i]->comment_author_IP ; ?>&mode=detail"><?php print $c_spam[$i]->comment_author_IP ; ?></a>
84
- <a href="https://cleantalk.org/blacklists/<?php print $c_spam[$i]->comment_author_IP ; ?>" target="_blank"><img src="https://cleantalk.ru/images/icons/new_window.gif" border="0" style="float:none"/></a>
85
- </td>
86
- <td class="comment column-comment">
87
- <div class="submitted-on">
88
- <?php printf( __( 'Submitted on <a href="%1$s">%2$s at %3$s</a>' ), get_comment_link($c_spam[$i]->comment_ID),
89
- /* translators: comment date format. See http://php.net/date */
90
- get_comment_date( __( 'Y/m/d' ),$c_spam[$i]->comment_ID ),
91
- get_comment_date( get_option( 'time_format' ),$c_spam[$i]->comment_ID )
92
- );
93
- ?>
94
-
95
- </div>
96
- <p>
97
- <?php print $c_spam[$i]->comment_content; ?>
98
- </p>
99
- <div style="height:16px;">
100
- <a href="#" class="cleantalk_delete_button" id="cleantalk_delete_<?php print $c_spam[$i]->comment_ID; ?>" data-id="<?php print $c_spam[$i]->comment_ID; ?>" style="color:#a00;display:none;" onclick="return false;">Delete</a>
101
- </div>
102
- </td>
103
- <td class="response column-response">
104
- <div>
105
- <span>
106
- <a href="http://ct_wp/wp-admin/post.php?post=<?php print $c_spam[$i]->comment_post_ID; ?>&action=edit"><?php print get_the_title($c_spam[$i]->comment_post_ID); ?></a>
107
- <br/>
108
- <a href="http://ct_wp/wp-admin/edit-comments.php?p=<?php print $c_spam[$i]->comment_post_ID; ?>" class="post-com-count">
109
- <span class="comment-count"><?php
110
- $p_cnt=wp_count_comments();
111
- print $p_cnt->total_comments;
112
- ?></span>
113
- </a>
114
- </span>
115
- <a href="<?php print get_permalink($c_spam[$i]->comment_post_ID); ?>"><?php print _e('View Post');?></a>
116
- </div>
117
- </td>
118
- </tr>
119
- <?php
120
- }
121
- $args_spam = array(
122
- 'meta_query' => array(
123
- Array(
124
- 'key' => 'ct_marked_as_spam',
125
- 'value' => '1',
126
- 'compare' => 'NUMERIC'
127
- )
128
-
129
- ),
130
- 'count'=>true
131
- );
132
- $cnt_spam=get_comments($args_spam);
133
- if($cnt_spam>30)
134
- {
135
- ?>
136
- <tr class="comment even thread-even depth-1 approved">
137
- <td colspan="4">
138
- <?php
139
-
140
- $pages=ceil(intval($cnt_spam)/30);
141
- for($i=1;$i<=$pages;$i++)
142
- {
143
- if($i==$page)
144
- {
145
- print "<a href='edit-comments.php?page=ct_check_spam&spam_page=$i'><b>$i</b></a> ";
146
- }
147
- else
148
- {
149
- print "<a href='edit-comments.php?page=ct_check_spam&spam_page=$i'>$i</a> ";
150
- }
151
- }
152
- ?>
153
- </td>
154
- </tr>
155
- <?php
156
- }
157
- ?>
158
- </tbody>
159
- </table>
160
- <button class="button" id="ct_delete_all"><?php _e('Delete all comments from the list'); ?></button>
161
- <button class="button" id="ct_delete_checked"><?php _e('Delete selected', 'cleantalk'); ?></button><br /><br />
162
- <?php
163
- }
164
- ?>
165
- <?php
166
- $args_unchecked = array(
167
- 'meta_query' => array(
168
- 'relation' => 'AND',
169
- Array(
170
- 'key' => 'ct_checked',
171
- 'value' => '1',
172
- 'compare' => 'NOT EXISTS'
173
- ),
174
- Array(
175
- 'key' => 'ct_hash',
176
- 'value' => '1',
177
- 'compare' => 'NOT EXISTS'
178
- )
179
- ),
180
- 'count'=>true
181
- );
182
- $cnt_unchecked=get_comments($args_unchecked);
183
-
184
- $args_spam = array(
185
- 'meta_query' => array(
186
- Array(
187
- 'key' => 'ct_marked_as_spam',
188
- 'compare' => 'EXISTS'
189
- )
190
- ),
191
- 'count'=>true
192
- );
193
- $cnt_spam=get_comments($args_spam);
194
- //if($cnt_unchecked>0)
195
- {
196
- ?>
197
- <div id="ct_info_message"><?php _e("Anti-spam by CleanTalk checks all not spam comments against blacklists database and show you senders that have spam activity on other websites.", 'cleantalk'); ?>
198
- <?php
199
- if($cnt_spam>0)
200
- {
201
- print "<br />
202
- There is some differencies between blacklists database and our API mechanisms. Blacklists shows all history of spam activity, but our API (that used in spam checking) used another parameters, too: last day of activity, number of spam attacks during last days etc. This mechanisms help us to reduce number of false positivitie. So, there is nothing strange, if some emails/IPs will be not found by this checking.";
203
- }
204
- ?></div>
205
- <?php
206
- }
207
- ?>
208
- <?php
209
- if($_SERVER['REMOTE_ADDR']=='127.0.0.1')print '<button class="button" id="ct_insert_comments">Insert comments</button><br />';
210
- ?>
211
-
212
- <div id="ct_working_message" style="margin:auto;padding:3px;width:70%;border:2px dotted gray;display:none;background:#ffff99;">
213
- <?php _e("Please wait for a while. CleanTalk is checking all approved and pending comments via blacklist database at cleantalk.org. You will have option to delete found spam comments after plugin finish.", 'cleantalk'); ?>
214
- </div>
215
- <div id="ct_deleting_message" style="display:none;">
216
- <?php _e("Please wait for a while. CleanTalk is deleting spam comments. Comments left: ", 'cleantalk'); ?> <span id="cleantalk_comments_left"></span>
217
- </div>
218
- <div id="ct_done_message" <?php if($cnt_unchecked>0) print 'style="display:none"'; ?>>
219
- <?php //_e("Done. All comments tested via blacklists database, please see result bellow.", 'cleantalk');
220
- ?>
221
- </div><br />
222
- <button class="button" id="ct_check_spam_button"><?php _e("Check for spam again", 'cleantalk'); ?></button><br /><br />
223
- </div>
224
- <br /><a href="options-general.php?page=cleantalk">&laquo;<?php print __('Back to CleanTalk settings', 'cleantalk'); ?></a>
225
- <?php
226
- }
227
-
228
- add_action('admin_print_footer_scripts','ct_add_checkspam_button');
229
- function ct_add_checkspam_button()
230
- {
231
- $screen = get_current_screen();
232
- $ajax_nonce = wp_create_nonce( "ct_secret_nonce" );
233
- ?>
234
- <script>
235
- var ajax_nonce='<?php echo $ajax_nonce; ?>';
236
- var spambutton_text='<?php _e("Find spam comments", 'cleantalk'); ?>';
237
- </script>
238
- <?php
239
- if( $screen->id == 'edit-comments' ){
240
- ?>
241
- <script src="<?php print plugins_url( 'cleantalk-comments-editscreen.js', __FILE__ ); ?>"></script>
242
- <?php
243
- }
244
- if($screen->id == 'comments_page_ct_check_spam')
245
- {
246
- ?>
247
- <script src="<?php print plugins_url( 'cleantalk-comments-checkspam.js', __FILE__ ); ?>"></script>
248
- <?php
249
- }
250
- }
251
-
252
-
253
- add_action( 'wp_ajax_ajax_check_comments', 'ct_ajax_check_comments' );
254
-
255
- function ct_ajax_check_comments()
256
- {
257
- check_ajax_referer( 'ct_secret_nonce', 'security' );
258
- global $ct_options;
259
- $ct_options = ct_get_options();
260
-
261
- $args_unchecked = array(
262
- 'meta_query' => array(
263
- //'relation' => 'AND',
264
- Array(
265
- 'key' => 'ct_checked',
266
- 'value' => '1',
267
- 'compare' => 'NOT EXISTS'
268
- ),
269
- /*Array(
270
- 'key' => 'ct_hash',
271
- 'value' => '1',
272
- 'compare' => 'NOT EXISTS'
273
- )*/
274
- ),
275
- 'number'=>500,
276
- 'status' => 'all'
277
- );
278
-
279
- $u=get_comments($args_unchecked);
280
- $u=array_slice($u,0,500);
281
- $u=array_values($u);
282
- if(sizeof($u)>0)
283
- {
284
- //print_r($u);
285
- //die();
286
- $data=Array();
287
- for($i=0;$i<sizeof($u);$i++)
288
- {
289
- $data[]=$u[$i]->comment_author_IP;
290
- $data[]=$u[$i]->comment_author_email;
291
- }
292
- $data=implode(',',$data);
293
-
294
- $request="data=$data";
295
-
296
- $opts = array(
297
- 'http'=>array(
298
- 'method'=>"POST",
299
- 'content'=>$request,
300
- )
301
- );
302
-
303
- $context = stream_context_create($opts);
304
- $result = @file_get_contents("https://api.cleantalk.org/?method_name=spam_check&auth_key=".$ct_options['apikey'], 0, $context);
305
- $result=json_decode($result);
306
- if(isset($result->error_message))
307
- {
308
- print $result->error_message;
309
- }
310
- else
311
- {
312
- for($i=0;$i<sizeof($u);$i++)
313
- {
314
- add_comment_meta($u[$i]->comment_ID,'ct_checked',date("Y-m-d H:m:s"),true);
315
- $uip=$u[$i]->comment_author_IP;
316
- if(empty($uip))continue;
317
- $uim=$u[$i]->comment_author_email;
318
- if(empty($uim))continue;
319
- if(isset($result->data->$uip) && $result->data->$uip->appears==1 || isset($result->data->$uim) && $result->data->$uim->appears==1)
320
- {
321
- add_comment_meta($u[$i]->comment_ID,'ct_marked_as_spam','1',true);
322
- }
323
- }
324
- print 1;
325
- }
326
- }
327
- else
328
- {
329
- print 0;
330
- }
331
-
332
- die;
333
- }
334
-
335
- add_action( 'wp_ajax_ajax_info_comments', 'ct_ajax_info_comments' );
336
- function ct_ajax_info_comments()
337
- {
338
- check_ajax_referer( 'ct_secret_nonce', 'security' );
339
- $cnt=get_comments(Array('count'=>true));
340
-
341
- $args_spam = array(
342
- 'meta_query' => array(
343
- Array(
344
- 'key' => 'ct_marked_as_spam',
345
- 'value' => '1',
346
- 'compare' => 'NUMERIC'
347
- )
348
- ),
349
- 'count'=>true
350
- );
351
-
352
- $cnt_spam=get_comments($args_spam);
353
-
354
- $args_checked1=array(
355
- 'meta_query' => array(
356
- Array(
357
- 'key' => 'ct_hash',
358
- //'value'=>'1',
359
- 'compare' => 'EXISTS'
360
- )
361
- ),
362
- 'count'=>true
363
- );
364
- $args_checked2=array(
365
- 'meta_query' => array(
366
- Array(
367
- 'key' => 'ct_checked',
368
- //'value'=>'1',
369
- 'compare' => 'EXISTS'
370
- )
371
- ),
372
- 'count'=>true
373
- );
374
-
375
- $cnt_checked1=get_comments($args_checked1);
376
- $cnt_checked2=get_comments($args_checked2);
377
- $cnt_checked=$cnt_checked1+$cnt_checked2;
378
-
379
- printf (__("Total comments %s, checked %s, found %s spam comments.", 'cleantalk'), $cnt, $cnt_checked, $cnt_spam);
380
- die();
381
- }
382
-
383
- add_action( 'wp_ajax_ajax_insert_comments', 'ct_ajax_insert_comments' );
384
- function ct_ajax_insert_comments()
385
- {
386
- check_ajax_referer( 'ct_secret_nonce', 'security' );
387
- $time = current_time('mysql');
388
-
389
- for($i=0;$i<500;$i++)
390
- {
391
- $rnd=mt_rand(1,100);
392
- if($rnd<20)
393
- {
394
- $email="stop_email@example.com";
395
- }
396
- else
397
- {
398
- $email="stop_email_$rnd@example.com";
399
- }
400
- $data = array(
401
- 'comment_post_ID' => 1,
402
- 'comment_author' => "author_$rnd",
403
- 'comment_author_email' => $email,
404
- 'comment_author_url' => 'http://',
405
- 'comment_content' => "comment content ".mt_rand(1,10000)." ".mt_rand(1,10000)." ".mt_rand(1,10000),
406
- 'comment_type' => '',
407
- 'comment_parent' => 0,
408
- 'user_id' => 1,
409
- 'comment_author_IP' => '127.0.0.1',
410
- 'comment_agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 3.5.30729)',
411
- 'comment_date' => $time,
412
- 'comment_approved' => 1,
413
- );
414
-
415
- wp_insert_comment($data);
416
- }
417
- print "ok";
418
- die();
419
- }
420
-
421
- add_action( 'wp_ajax_ajax_delete_checked', 'ct_ajax_delete_checked' );
422
- function ct_ajax_delete_checked()
423
- {
424
- check_ajax_referer( 'ct_secret_nonce', 'security' );
425
- foreach($_POST['ids'] as $key=>$value)
426
- {
427
- wp_delete_comment($value, false);
428
- }
429
- die();
430
- }
431
-
432
- add_action( 'wp_ajax_ajax_delete_all', 'ct_ajax_delete_all' );
433
- function ct_ajax_delete_all()
434
- {
435
- check_ajax_referer( 'ct_secret_nonce', 'security' );
436
- $args_spam = array(
437
- 'number'=>100,
438
- 'meta_query' => array(
439
- Array(
440
- 'key' => 'ct_marked_as_spam',
441
- 'value' => '1',
442
- 'compare' => 'NUMERIC'
443
- )
444
- )
445
- );
446
- $c_spam=get_comments($args_spam);
447
- $cnt=sizeof($c_spam);
448
-
449
- $args_spam = array(
450
- 'count'=>true,
451
- 'meta_query' => array(
452
- Array(
453
- 'key' => 'ct_marked_as_spam',
454
- 'value' => '1',
455
- 'compare' => 'NUMERIC'
456
- )
457
- )
458
- );
459
- $cnt_all=get_comments($args_spam);
460
- for($i=0;$i<sizeof($c_spam);$i++)
461
- {
462
- wp_delete_comment($c_spam[$i]->comment_ID, false);
463
- usleep(10000);
464
- }
465
- print $cnt_all;
466
- die();
467
- }
468
-
469
- add_action( 'wp_ajax_ajax_clear_comments', 'ct_ajax_clear_comments' );
470
- function ct_ajax_clear_comments()
471
- {
472
- check_ajax_referer( 'ct_secret_nonce', 'security' );
473
- global $wpdb;
474
- $wpdb->query("delete from $wpdb->commentmeta where meta_key='ct_hash' or meta_key='ct_checked' or meta_key='ct_marked_as_spam';");
475
- die();
476
- }
477
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/inc/cleantalk-common.php DELETED
@@ -1,851 +0,0 @@
1
- <?php
2
-
3
- $ct_plugin_name = 'Spam Protection by CleanTalk';
4
- $ct_checkjs_frm = 'ct_checkjs_frm';
5
- $ct_checkjs_register_form = 'ct_checkjs_register_form';
6
- $ct_session_request_id_label = 'request_id';
7
- $ct_session_register_ok_label = 'register_ok';
8
-
9
- $ct_checkjs_cf7 = 'ct_checkjs_cf7';
10
- $ct_cf7_comment = '';
11
-
12
- $ct_checkjs_jpcf = 'ct_checkjs_jpcf';
13
- $ct_jpcf_patched = false;
14
- $ct_jpcf_fields = array('name', 'email');
15
-
16
- // Comment already proccessed
17
- $ct_comment_done = false;
18
-
19
- // Comment already proccessed
20
- $ct_signup_done = false;
21
-
22
- // Default value for JS test
23
- $ct_checkjs_def = 0;
24
-
25
- // COOKIE label to store request id for last approved
26
- $ct_approved_request_id_label = 'ct_approved_request_id';
27
-
28
- // Last request id approved for publication
29
- $ct_approved_request_id = null;
30
-
31
- // COOKIE label for trial notice flag
32
- $ct_notice_trial_label = 'ct_notice_trial';
33
-
34
- // Flag to show trial notice
35
- $show_ct_notice_trial = false;
36
-
37
- // COOKIE label for renew notice flag
38
- $ct_notice_renew_label = 'ct_notice_renew';
39
-
40
- // Flag to show renew notice
41
- $show_ct_notice_renew = false;
42
-
43
- // COOKIE label for online notice flag
44
- $ct_notice_online_label = 'ct_notice_online';
45
-
46
- // Flag to show online notice - 'Y' or 'N'
47
- $show_ct_notice_online = '';
48
-
49
- // Timeout before new check for trial notice in hours
50
- $trial_notice_check_timeout = 1;
51
-
52
- // Timeout before new check account notice in hours
53
- $account_notice_check_timeout = 24;
54
-
55
- // Timeout before new check account notice in hours
56
- $renew_notice_check_timeout = 0.5;
57
-
58
- // Trial notice show time in minutes
59
- $trial_notice_showtime = 10;
60
-
61
- // Renew notice show time in minutes
62
- $renew_notice_showtime = 10;
63
-
64
- // COOKIE label for WP Landing Page proccessing result
65
- $ct_wplp_result_label = 'ct_wplp_result';
66
-
67
- // Flag indicates active JetPack comments
68
- $ct_jp_comments = false;
69
-
70
- // S2member PayPal post data label
71
- $ct_post_data_label = 's2member_pro_paypal_registration';
72
-
73
- // S2member Auth.Net post data label
74
- $ct_post_data_authnet_label = 's2member_pro_authnet_registration';
75
-
76
- // Form time load label
77
- $ct_formtime_label = 'ct_formtime';
78
-
79
- // Post without page load
80
- $ct_direct_post = 0;
81
-
82
- // WP admin email notice interval in seconds
83
- $ct_admin_notoice_period = 10800;
84
-
85
- // Sevice negative comment to visitor.
86
- // It uses for BuddyPress registrations to avoid double checks
87
- $ct_negative_comment = null;
88
-
89
- // Flag to show apikey automatic getting error
90
- $show_ct_notice_autokey = false;
91
-
92
- // Apikey automatic getting label
93
- $ct_notice_autokey_label = 'ct_autokey';
94
-
95
- // Apikey automatic getting error text
96
- $ct_notice_autokey_value = '';
97
-
98
- $ct_options=ct_get_options();
99
- $ct_data=ct_get_data();
100
-
101
-
102
- /**
103
- * Public action 'plugins_loaded' - Loads locale, see http://codex.wordpress.org/Function_Reference/load_plugin_textdomain
104
- */
105
- function ct_plugin_loaded() {
106
- $dir=plugin_basename( dirname( __FILE__ ) ) . '/../i18n';
107
- $loaded=load_plugin_textdomain('cleantalk', false, $dir);
108
- }
109
-
110
- /**
111
- * Session init
112
- * @return null;
113
- */
114
- function ct_init_session() {
115
- $session_id = session_id();
116
- if(empty($session_id) && !headers_sent()) {
117
- $result = @session_start();
118
- if(!$result){
119
- session_regenerate_id(true); // replace the Session ID, bug report https://bugs.php.net/bug.php?id=68063
120
- @session_start();
121
- }
122
- }
123
-
124
- return null;
125
- }
126
-
127
- /**
128
- * Inner function - Common part of request sending
129
- * @param array Array of parameters:
130
- * 'message' - string
131
- * 'example' - string
132
- * 'checkjs' - int
133
- * 'sender_email' - string
134
- * 'sender_nickname' - string
135
- * 'sender_info' - array
136
- * 'post_info' - string
137
- * @return array array('ct'=> Cleantalk, 'ct_result' => CleantalkResponse)
138
- */
139
- function ct_base_call($params = array()) {
140
- global $wpdb, $ct_agent_version, $ct_formtime_label, $ct_options, $ct_data;
141
-
142
- $ct_options=ct_get_options();
143
- $ct_data=ct_get_data();
144
-
145
- require_once('cleantalk.class.php');
146
-
147
- $submit_time = submit_time_test();
148
-
149
- $sender_info = get_sender_info();
150
- if (array_key_exists('sender_info', $params)) {
151
- $sender_info = array_merge($sender_info, (array) $params['sender_info']);
152
- }
153
-
154
- $sender_info = json_encode($sender_info);
155
- if ($sender_info === false)
156
- $sender_info = '';
157
-
158
- $config = get_option('cleantalk_server');
159
-
160
- $ct = new Cleantalk();
161
- $ct->work_url = $config['ct_work_url'];
162
- $ct->server_url = $ct_options['server'];
163
-
164
- $ct->server_ttl = $config['ct_server_ttl'];
165
- $ct->server_changed = $config['ct_server_changed'];
166
- $ct->ssl_on = $ct_options['ssl_on'];
167
-
168
- $ct_request = new CleantalkRequest();
169
-
170
- $ct_request->auth_key = $ct_options['apikey'];
171
- $ct_request->message = $params['message'];
172
- $ct_request->example = $params['example'];
173
- $ct_request->sender_email = $params['sender_email'];
174
- $ct_request->sender_nickname = $params['sender_nickname'];
175
- $ct_request->sender_ip = $ct->ct_session_ip($_SERVER['REMOTE_ADDR']);
176
- $ct_request->agent = $ct_agent_version;
177
- $ct_request->sender_info = $sender_info;
178
- $ct_request->js_on = $params['checkjs'];
179
- $ct_request->submit_time = $submit_time;
180
- $ct_request->post_info = $params['post_info'];
181
- if(isset($ct_data['last_error_no']))
182
- {
183
- $ct_request->last_error_no=$ct_data['last_error_no'];
184
- $ct_request->last_error_time=$ct_data['last_error_time'];
185
- $ct_request->last_error_text=$ct_data['last_error_text'];
186
- }
187
-
188
-
189
- $ct_result = @$ct->isAllowMessage($ct_request);
190
- if ($ct->server_change) {
191
- update_option(
192
- 'cleantalk_server', array(
193
- 'ct_work_url' => $ct->work_url,
194
- 'ct_server_ttl' => $ct->server_ttl,
195
- 'ct_server_changed' => time()
196
- )
197
- );
198
- }
199
-
200
- $ct_result = ct_change_plugin_resonse($ct_result, $params['checkjs']);
201
-
202
- // Restart submit form counter for failed requests
203
- if ($ct_result->allow == 0) {
204
- ct_init_session();
205
-
206
- $_SESSION[$ct_formtime_label] = time();
207
- ct_add_event('no');
208
- }
209
- else
210
- {
211
- ct_add_event('yes');
212
- }
213
- return array('ct' => $ct, 'ct_result' => $ct_result);
214
- }
215
-
216
- /**
217
- * Validate form submit time
218
- *
219
- */
220
- function submit_time_test() {
221
- global $ct_formtime_label;
222
-
223
- ct_init_session();
224
-
225
- $submit_time = null;
226
- if (isset($_SESSION[$ct_formtime_label])) {
227
- $submit_time = time() - (int) $_SESSION[$ct_formtime_label];
228
- }
229
-
230
- return $submit_time;
231
- }
232
-
233
- /**
234
- * Inner function - Default data array for senders
235
- * @return array
236
- */
237
- function get_sender_info() {
238
- global $ct_direct_post, $ct_options, $ct_data, $wp_rewrite;
239
-
240
- $ct_options = ct_get_options();
241
- $ct_data = ct_get_data();
242
-
243
- $php_session = session_id() != '' ? 1 : 0;
244
-
245
- // Raw data to validated JavaScript test in the cloud
246
- $checkjs_data_cookies = null;
247
- if (isset($_COOKIE['ct_checkjs'])) {
248
- $checkjs_data_cookies = $_COOKIE['ct_checkjs'];
249
- }
250
-
251
-
252
- $checkjs_data_post = null;
253
- if (count($_POST) > 0) {
254
- foreach ($_POST as $k => $v) {
255
- if (preg_match("/^ct_check.+/", $k)) {
256
- $checkjs_data_post = $v;
257
- }
258
- }
259
- }
260
-
261
- $options2server=$ct_options;
262
- $js_info='';
263
- if(isset($_COOKIE['ct_user_info']) && function_exists('mb_convert_encoding'))
264
- {
265
- $js_info=stripslashes(rawurldecode($_COOKIE['ct_user_info']));
266
- $js_info=mb_convert_encoding($js_info, "UTF-8", "Windows-1252");
267
- }
268
-
269
- return $sender_info = array(
270
- 'page_url' => htmlspecialchars(@$_SERVER['SERVER_NAME'].@$_SERVER['REQUEST_URI']),
271
- 'cms_lang' => substr(get_locale(), 0, 2),
272
- 'REFFERRER' => htmlspecialchars(@$_SERVER['HTTP_REFERER']),
273
- 'USER_AGENT' => htmlspecialchars(@$_SERVER['HTTP_USER_AGENT']),
274
- 'php_session' => $php_session,
275
- 'cookies_enabled' => ct_cookies_test(true),
276
- 'direct_post' => $ct_direct_post,
277
- 'checkjs_data_post' => $checkjs_data_post,
278
- 'checkjs_data_cookies' => $checkjs_data_cookies,
279
- 'ct_options' => json_encode($options2server),
280
- 'fields_number' => sizeof($_POST),
281
- 'js_info' => $js_info,
282
- );
283
- }
284
-
285
- /**
286
- * Cookies test for sender
287
- * @return null|0|1;
288
- */
289
- function ct_cookies_test ($test = false) {
290
- $ct_options = ct_get_options();
291
-
292
- $cookie_label = 'ct_cookies_test';
293
- $secret_hash = ct_get_checkjs_value();
294
-
295
- $result = null;
296
- if (isset($_COOKIE[$cookie_label])) {
297
- if ($_COOKIE[$cookie_label] == $secret_hash) {
298
- $result = 1;
299
- } else {
300
- $result = 0;
301
- }
302
- } else {
303
- //
304
- // Do not generate if admin turned off the cookies.
305
- //
306
- if (isset($ct_options['set_cookies']) && $ct_options['set_cookies'] == 1) {
307
- @setcookie($cookie_label, $secret_hash, 0, '/');
308
- }
309
-
310
- if ($test) {
311
- $result = 0;
312
- }
313
- }
314
-
315
- return $result;
316
- }
317
-
318
- /**
319
- * Get ct_get_checkjs_value
320
- * @return string
321
- */
322
- function ct_get_checkjs_value($random_key = false) {
323
- global $ct_options, $ct_data;
324
- $ct_options = ct_get_options();
325
- $ct_data = ct_get_data();
326
-
327
- if ($random_key) {
328
- $keys = $ct_data['js_keys'];
329
- $keys_checksum = md5(json_encode($keys));
330
-
331
- $key = null;
332
- $latest_key_time = 0;
333
- foreach ($keys as $k => $t) {
334
-
335
- // Removing key if it's to old
336
- if (time() - $t > $ct_data['js_keys_store_days'] * 86400) {
337
- unset($keys[$k]);
338
- continue;
339
- }
340
-
341
- if ($t > $latest_key_time) {
342
- $latest_key_time = $t;
343
- $key = $k;
344
- }
345
- }
346
-
347
- // Get new key if the latest key is too old
348
- if (time() - $latest_key_time > $ct_data['js_key_lifetime']) {
349
- $key = rand();
350
- $keys[$key] = time();
351
- }
352
-
353
- if (md5(json_encode($keys)) != $keys_checksum) {
354
- $ct_data['js_keys'] = $keys;
355
- update_option('cleantalk_data', $ct_data);
356
- }
357
- } else {
358
- $key = md5($ct_options['apikey'] . '+' . get_option('admin_email'));
359
- }
360
-
361
- return $key;
362
- }
363
-
364
- /**
365
- * Inner function - Current Cleantalk options
366
- * @return mixed[] Array of options
367
- */
368
- function ct_get_options($force=false) {
369
- global $ct_options;
370
- if(!$force && isset($ct_options) && isset($ct_options['apikey']) && strlen($ct_options['apikey'])>3)
371
- {
372
- if(defined('CLEANTALK_ACCESS_KEY'))
373
- {
374
- $options['apikey']=CLEANTALK_ACCESS_KEY;
375
- }
376
- return $ct_options;
377
- }
378
- else
379
- {
380
- $options = get_option('cleantalk_settings');
381
- if (!is_array($options)){
382
- $options = array();
383
- }else{
384
- if(array_key_exists('apikey', $options))
385
- $options['apikey'] = trim($options['apikey']);
386
- }
387
- if(defined('CLEANTALK_ACCESS_KEY'))
388
- {
389
- $options['apikey']=CLEANTALK_ACCESS_KEY;
390
- }
391
- return array_merge(ct_def_options(), (array) $options);
392
- }
393
- }
394
-
395
- /**
396
- * Inner function - Default Cleantalk options
397
- * @return mixed[] Array of default options
398
- */
399
- function ct_def_options() {
400
- return array(
401
- 'server' => 'http://moderate.cleantalk.org',
402
- 'apikey' => __('enter key', 'cleantalk'),
403
- 'autoPubRevelantMess' => '0',
404
- 'registrations_test' => '1',
405
- 'comments_test' => '1',
406
- 'contact_forms_test' => '1',
407
- 'general_contact_forms_test' => '1', // Antispam test for unsupported and untested contact forms
408
- 'remove_old_spam' => '0',
409
- 'spam_store_days' => '15', // Days before delete comments from folder Spam
410
- 'ssl_on' => 0, // Secure connection to servers
411
- 'relevance_test' => 0, // Test comment for relevance
412
- 'notice_api_errors' => 0, // Send API error notices to WP admin
413
- 'user_token'=>'', //user token for auto login into spam statistics
414
- 'set_cookies'=> 1, // Disable cookies generatation to be compatible with Varnish.
415
- 'collect_details' => 0 // Collect details about browser of the visitor.
416
- );
417
- }
418
-
419
- /**
420
- * Inner function - Current Cleantalk data
421
- * @return mixed[] Array of options
422
- */
423
- function ct_get_data($force=false) {
424
- global $ct_data;
425
- if(!$force && isset($ct_data) && isset($ct_data['js_keys']))
426
- {
427
- return $ct_data;
428
- }
429
- else
430
- {
431
- $data = get_option('cleantalk_data');
432
- if (!is_array($data)){
433
- $data = array();
434
- }
435
- return array_merge(ct_def_data(), (array) $data);
436
- }
437
- }
438
-
439
- /**
440
- * Inner function - Default Cleantalk data
441
- * @return mixed[] Array of default options
442
- */
443
- function ct_def_data() {
444
- return array(
445
- 'next_account_status_check' => 0, // Time label when the plugin should check account status
446
- 'user_token' => '', // User token
447
- 'js_keys' => array(), // Keys to do JavaScript antispam test
448
- 'js_keys_store_days' => 14, // JavaScript keys store days - 8 days now
449
- 'js_key_lifetime' => 86400, // JavaScript key life time in seconds - 1 day now
450
- );
451
- }
452
-
453
- /**
454
- * Inner function - Stores ang returns cleantalk hash of current comment
455
- * @param string New hash or NULL
456
- * @return string New hash or current hash depending on parameter
457
- */
458
- function ct_hash($new_hash = '') {
459
- /**
460
- * Current hash
461
- */
462
- static $hash;
463
-
464
- if (!empty($new_hash)) {
465
- $hash = $new_hash;
466
- }
467
- return $hash;
468
- }
469
-
470
- /**
471
- * Inner function - Write manual moderation results to PHP sessions
472
- * @param string $hash Cleantalk comment hash
473
- * @param string $message comment_content
474
- * @param int $allow flag good comment (1) or bad (0)
475
- * @return string comment_content w\o cleantalk resume
476
- */
477
- function ct_feedback($hash, $message = null, $allow) {
478
- global $ct_options, $ct_data;
479
-
480
- $ct_options = ct_get_options();
481
- $ct_data = ct_get_data();
482
-
483
- require_once('cleantalk.class.php');
484
-
485
- $config = get_option('cleantalk_server');
486
-
487
- $ct = new Cleantalk();
488
- $ct->work_url = $config['ct_work_url'];
489
- $ct->server_url = $ct_options['server'];
490
- $ct->server_ttl = $config['ct_server_ttl'];
491
- $ct->server_changed = $config['ct_server_changed'];
492
-
493
- if (empty($hash)) {
494
- $hash = $ct->getCleantalkCommentHash($message);
495
- }
496
-
497
- $resultMessage = null;
498
- if ($message !== null) {
499
- $resultMessage = $ct->delCleantalkComment($message);
500
- }
501
-
502
- ct_init_session();
503
-
504
- $ct_feedback = $hash . ':' . $allow . ';';
505
- if (empty($_SESSION['feedback_request'])) {
506
- $_SESSION['feedback_request'] = $ct_feedback;
507
- } else {
508
- $_SESSION['feedback_request'] .= $ct_feedback;
509
- }
510
-
511
- return $resultMessage;
512
- }
513
-
514
- /**
515
- * Inner function - Sends the results of moderation
516
- * @param string $feedback_request
517
- * @return bool
518
- */
519
- function ct_send_feedback($feedback_request = null) {
520
- global $ct_options, $ct_data;
521
-
522
- $ct_options = ct_get_options();
523
- $ct_data = ct_get_data();
524
-
525
- ct_init_session();
526
-
527
- if (empty($feedback_request) && isset($_SESSION['feedback_request']) && preg_match("/^[a-z0-9\;\:]+$/", $_SESSION['feedback_request'])) {
528
- $feedback_request = $_SESSION['feedback_request'];
529
- unset($_SESSION['feedback_request']);
530
- }
531
-
532
- if ($feedback_request !== null) {
533
- require_once('cleantalk.class.php');
534
- $config = get_option('cleantalk_server');
535
-
536
- $ct = new Cleantalk();
537
- $ct->work_url = $config['ct_work_url'];
538
- $ct->server_url = $ct_options['server'];
539
- $ct->server_ttl = $config['ct_server_ttl'];
540
- $ct->server_changed = $config['ct_server_changed'];
541
-
542
- $ct_request = new CleantalkRequest();
543
- $ct_request->auth_key = $ct_options['apikey'];
544
- $ct_request->feedback = $feedback_request;
545
-
546
- $ct->sendFeedback($ct_request);
547
-
548
- if ($ct->server_change) {
549
- update_option(
550
- 'cleantalk_server', array(
551
- 'ct_work_url' => $ct->work_url,
552
- 'ct_server_ttl' => $ct->server_ttl,
553
- 'ct_server_changed' => time()
554
- )
555
- );
556
- }
557
- return true;
558
- }
559
-
560
- return false;
561
- }
562
-
563
- /**
564
- * On the scheduled action hook, run the function.
565
- */
566
- function ct_do_this_hourly() {
567
- global $ct_options, $ct_data;
568
-
569
- $ct_options = ct_get_options();
570
- $ct_data = ct_get_data();
571
- // do something every hour
572
-
573
- if (!isset($ct_options))
574
- $ct_options = ct_get_options();
575
-
576
- if (!isset($ct_data))
577
- $ct_data = ct_get_data();
578
-
579
- delete_spam_comments();
580
- ct_send_feedback();
581
- }
582
-
583
- /**
584
- * Delete old spam comments
585
- * @return null
586
- */
587
- function delete_spam_comments() {
588
- global $pagenow, $ct_options, $ct_data;
589
-
590
- $ct_options = ct_get_options();
591
- $ct_data = ct_get_data();
592
-
593
- if ($ct_options['remove_old_spam'] == 1) {
594
- $last_comments = get_comments(array('status' => 'spam', 'number' => 1000, 'order' => 'ASC'));
595
- foreach ($last_comments as $c) {
596
- if (time() - strtotime($c->comment_date_gmt) > 86400 * $ct_options['spam_store_days']) {
597
- // Force deletion old spam comments
598
- wp_delete_comment($c->comment_ID, true);
599
- }
600
- }
601
- }
602
-
603
- return null;
604
- }
605
-
606
- /*
607
- * Get data from submit recursively
608
- */
609
-
610
- function ct_get_fields_any(&$email,&$message,&$nickname,&$subject, &$contact,$arr)
611
- {
612
- $skip_params = array(
613
- 'ipn_track_id', // PayPal IPN #
614
- 'txn_type', // PayPal transaction type
615
- 'payment_status', // PayPal payment status
616
- 'ccbill_ipn' //CCBill IPN
617
- );
618
- $obfuscate_params = array(
619
- 'password',
620
- 'password0',
621
- 'password1',
622
- 'password2',
623
- 'pass',
624
- 'pwd',
625
- 'user_pass'
626
- );
627
- foreach($skip_params as $key=>$value)
628
- {
629
- if(@array_key_exists($value,$_GET)||@array_key_exists($value,$_POST))
630
- {
631
- $contact = false;
632
- }
633
- }
634
- foreach($arr as $key=>$value)
635
- {
636
- if(!is_array($value)&&!is_object($value)&&@get_class($value)!='WP_User')
637
- {
638
- if (in_array($key, $skip_params) && $key!=0 && $key!='' || preg_match("/^ct_checkjs/", $key)) {
639
- $contact = false;
640
- }
641
- if (!$email && @preg_match("/^\S+@\S+\.\S+$/", $value))
642
- {
643
- $email = $value;
644
- }
645
- else if ($nickname === '' && ct_get_data_from_submit($key, 'name'))
646
- {
647
- $nickname = $value;
648
- }
649
- else if ($subject === '' && ct_get_data_from_submit($key, 'subject'))
650
- {
651
- $subject = $value;
652
- }
653
- else
654
- {
655
- //
656
- // Obfuscate private data
657
- //
658
- if (in_array($key, $obfuscate_params)) {
659
- $value = ct_obfuscate_param($value);
660
- }
661
- $message[$key] = $value;
662
- }
663
- }
664
- else if(!is_object($value)&&@get_class($value)!='WP_User')
665
- {
666
- @ct_get_fields_any($email, $message, $nickname, $subject, $contact, $value);
667
- }
668
- }
669
- //
670
- // Reset $message if we have a sign-up data
671
- //
672
- $skip_message_post = array(
673
- 'edd_action', // Easy Digital Downloads
674
- );
675
- foreach ($skip_message_post as $v) {
676
- if (isset($_POST[$v])) {
677
- $message = null;
678
- break;
679
- }
680
- }
681
- }
682
-
683
- /**
684
- * Masks a value with asterisks (*)
685
- * @return string
686
- */
687
- function ct_obfuscate_param ($value = null) {
688
- if ($value && is_string($value)) {
689
- $length = strlen($value);
690
- $value = str_repeat('*', $length);
691
- }
692
-
693
- return $value;
694
- }
695
-
696
- function ct_get_fields_any_postdata(&$message,$arr)
697
- {
698
- $skip_params = array(
699
- 'ipn_track_id', // PayPal IPN #
700
- 'txn_type', // PayPal transaction type
701
- 'payment_status', // PayPal payment status
702
- );
703
- foreach($arr as $key=>$value)
704
- {
705
- if(!is_array($value))
706
- {
707
- if (in_array($key, $skip_params) || preg_match("/^ct_checkjs/", $key)) {
708
- //$contact = false;
709
- }
710
- else
711
- {
712
- $message.="$value\n";
713
- }
714
- }
715
- else
716
- {
717
- @ct_get_fields_any_postdata($message, $value);
718
- }
719
- }
720
- }
721
-
722
- /*
723
- * Check if Array has keys with restricted names
724
- */
725
-
726
- $ct_check_post_result=false;
727
-
728
- function ct_check_array_keys_loop($key)
729
- {
730
- global $ct_check_post_result;
731
- $strict=Array('members_search_submit');
732
- for($i=0;$i<sizeof($strict);$i++)
733
- {
734
- if(stripos($key,$strict[$i])!==false)
735
- {
736
- $ct_check_post_result=true;
737
- }
738
- }
739
- }
740
-
741
- function ct_check_array_keys($arr)
742
- {
743
- global $ct_check_post_result;
744
- if(!is_array($arr))
745
- {
746
- return $ct_check_post_result;
747
- }
748
- foreach($arr as $key=>$value)
749
- {
750
- if(!is_array($value))
751
- {
752
- ct_check_array_keys_loop($key);
753
- }
754
- else
755
- {
756
- ct_check_array_keys($value);
757
- }
758
- }
759
- return $ct_check_post_result;
760
- }
761
-
762
- function check_url_exclusions()
763
- {
764
- global $cleantalk_url_exclusions;
765
- $result=false;
766
- if(isset($cleantalk_url_exclusions) && sizeof($cleantalk_url_exclusions)>0)
767
- {
768
- foreach($cleantalk_url_exclusions as $key=>$value)
769
- {
770
- if(stripos($_SERVER['REQUEST_URI'], $value)!==false)
771
- {
772
- $result=true;
773
- }
774
- }
775
- }
776
- else
777
- {
778
- $result=false;
779
- }
780
- return $result;
781
- }
782
-
783
- function ct_filter_array(&$array)
784
- {
785
- global $cleantalk_key_exclusions;
786
- if(isset($cleantalk_key_exclusions) && sizeof($cleantalk_key_exclusions)>0)
787
- {
788
- foreach($array as $key=>$value)
789
- {
790
- if(!is_array($value))
791
- {
792
- if(in_array($key,$cleantalk_key_exclusions))
793
- {
794
- unset($array[$key]);
795
- }
796
- }
797
- else
798
- {
799
- $array[$key]=ct_filter_array($value);
800
- }
801
- }
802
- return $array;
803
- }
804
- else
805
- {
806
- return $array;
807
- }
808
- }
809
-
810
-
811
- function cleantalk_debug($key,$value)
812
- {
813
- if(isset($_COOKIE) && isset($_COOKIE['cleantalk_debug']))
814
- {
815
- @header($key.": ".$value);
816
- }
817
- }
818
-
819
- /**
820
- * Function changes CleanTalk result object if an error occured.
821
- * @return object
822
- */
823
- function ct_change_plugin_resonse($ct_result = null, $checkjs = null) {
824
- global $ct_plugin_name;
825
-
826
- if (!$ct_result) {
827
- return $ct_result;
828
- }
829
-
830
- if(@intval($ct_result->errno) != 0)
831
- {
832
- if($checkjs === null || $checkjs != 1)
833
- {
834
- $ct_result->allow = 0;
835
- $ct_result->spam = 1;
836
- $ct_result->comment = sprintf('We\'ve got an issue: %s. Forbidden. Please, enable Javascript. %s.',
837
- $ct_result->comment,
838
- $ct_plugin_name
839
- );
840
- }
841
- else
842
- {
843
- $ct_result->allow = 1;
844
- $ct_result->comment = 'Allow';
845
- }
846
- }
847
-
848
- return $ct_result;
849
- }
850
-
851
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/inc/cleantalk-public.php DELETED
@@ -1,2141 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Init functions
5
- * @return mixed[] Array of options
6
- */
7
- function ct_init() {
8
- global $ct_wplp_result_label, $ct_jp_comments, $ct_post_data_label, $ct_post_data_authnet_label, $ct_formtime_label, $ct_direct_post, $ct_options, $ct_data, $ct_check_post_result, $test_external_forms, $cleantalk_executed;
9
-
10
- $ct_options=ct_get_options();
11
- $ct_data=ct_get_data();
12
-
13
- //fix for EPM registration form
14
- if(isset($_POST) && isset($_POST['reg_email']) && shortcode_exists( 'epm_registration_form' ))
15
- {
16
- unset($_POST['ct_checkjs_register_form']);
17
- }
18
-
19
- if(isset($_POST['_wpnonce-et-pb-contact-form-submitted']))
20
- {
21
- add_shortcode( 'et_pb_contact_form', 'ct_contact_form_validate' );
22
- }
23
-
24
- if($test_external_forms && $_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['cleantalk_hidden_method']) && isset($_POST['cleantalk_hidden_action']))
25
- {
26
- $action=htmlspecialchars($_POST['cleantalk_hidden_action']);
27
- $method=htmlspecialchars($_POST['cleantalk_hidden_method']);
28
- unset($_POST['cleantalk_hidden_action']);
29
- unset($_POST['cleantalk_hidden_method']);
30
- ct_contact_form_validate();
31
- print "<html><body><form method='$method' action='$action'>";
32
- ct_print_form($_POST,'');
33
- print "</form><center>Redirecting to ".$action."... Anti-spam by CleanTalk.</center></body></html>";
34
- print "<script>document.forms[0].submit();</script>";
35
- die();
36
- }
37
-
38
- if(isset($ct_options['general_postdata_test']) && $ct_options['general_postdata_test'] == 1 &&!@isset($_POST['ct_checkjs_cf7']))
39
- {
40
- $ct_general_postdata_test = @intval($ct_options['general_postdata_test']);
41
- //hook for Anonymous Post
42
- add_action('template_redirect','ct_contact_form_validate_postdata',1);
43
- }
44
- else
45
- {
46
- $ct_general_postdata_test=0;
47
- }
48
-
49
- if (isset($ct_options['general_contact_forms_test']) && $ct_options['general_contact_forms_test'] == 1&&!@isset($_POST['ct_checkjs_cf7']))
50
- {
51
- add_action('CMA_custom_post_type_nav','ct_contact_form_validate_postdata',1);
52
- add_action('template_redirect','ct_contact_form_validate',1);
53
- if(isset($_POST['reg_redirect_link'])&&isset($_POST['tmpl_registration_nonce_field']))
54
- {
55
- unset($_POST['ct_checkjs_register_form']);
56
- ct_contact_form_validate();
57
- }
58
- /*if(isset($_GET['ait-action'])&&$_GET['ait-action']=='register')
59
- {
60
- $tmp=$_POST['redirect_to'];
61
- unset($_POST['redirect_to']);
62
- ct_contact_form_validate();
63
- $_POST['redirect_to']=$tmp;
64
- }*/
65
- }
66
-
67
- if($ct_general_postdata_test==1&&!@isset($_POST['ct_checkjs_cf7']))
68
- {
69
- add_action('CMA_custom_post_type_nav','ct_contact_form_validate_postdata',1);
70
- }
71
-
72
- //add_action('wp_footer','ct_ajaxurl');
73
-
74
- // Fast Secure contact form
75
- if(defined('FSCF_VERSION')){
76
- add_filter('si_contact_display_after_fields', 'ct_si_contact_display_after_fields');
77
- add_filter('si_contact_form_validate', 'ct_si_contact_form_validate');
78
- }
79
-
80
- // WooCoomerse signups
81
- if(class_exists('WooCommerce')){
82
- add_filter('woocommerce_register_post', 'ct_register_post', 1, 3);
83
- }
84
-
85
- // JetPack Contact form
86
- $jetpack_active_modules = false;
87
- if(defined('JETPACK__VERSION') && isset($_POST['comment_post_ID']))
88
- {
89
- add_filter('grunion_contact_form_field_html', 'ct_grunion_contact_form_field_html', 10, 2);
90
- if(JETPACK__VERSION=='3.4-beta')
91
- {
92
- add_filter('contact_form_is_spam', 'ct_contact_form_is_spam');
93
- }
94
- else if(JETPACK__VERSION=='3.4-beta2'||JETPACK__VERSION>='3.4')
95
- {
96
- add_filter('jetpack_contact_form_is_spam', 'ct_contact_form_is_spam_jetpack',1,2);
97
- }
98
- else
99
- {
100
- add_filter('contact_form_is_spam', 'ct_contact_form_is_spam');
101
- }
102
- $jetpack_active_modules = get_option('jetpack_active_modules');
103
- if ((class_exists( 'Jetpack', false) && $jetpack_active_modules && in_array('comments', $jetpack_active_modules)))
104
- {
105
- $ct_jp_comments = true;
106
- }
107
- }
108
-
109
- // Contact Form7
110
- if(defined('WPCF7_VERSION')){
111
- add_filter('wpcf7_form_elements', 'ct_wpcf7_form_elements');
112
- if(WPCF7_VERSION >= '3.0.0')
113
- {
114
- add_filter('wpcf7_spam', 'ct_wpcf7_spam');
115
- }
116
- else
117
- {
118
- add_filter('wpcf7_acceptance', 'ct_wpcf7_spam');
119
- }
120
- }
121
-
122
- // Formidable
123
- if(class_exists('FrmSettings')){
124
- add_action('frm_validate_entry', 'ct_frm_validate_entry', 1, 2);
125
- add_action('frm_entries_footer_scripts', 'ct_frm_entries_footer_scripts', 20, 2);
126
- }
127
-
128
- // BuddyPress
129
- if(class_exists('BuddyPress')){
130
- add_action('bp_before_registration_submit_buttons','ct_register_form',1);
131
- add_filter('bp_signup_validate', 'ct_registration_errors',1);
132
- }
133
-
134
- // bbPress
135
- if(class_exists('bbPress')){
136
- add_filter('bbp_new_topic_pre_content', 'ct_bbp_new_pre_content', 1);
137
- add_filter('bbp_new_reply_pre_content', 'ct_bbp_new_pre_content', 1);
138
- add_action('bbp_theme_before_topic_form_content', 'ct_comment_form');
139
- add_action('bbp_theme_before_reply_form_content', 'ct_comment_form');
140
- }
141
-
142
- add_action('comment_form', 'ct_comment_form');
143
-
144
- //intercept WordPress Landing Pages POST
145
- if (defined('LANDINGPAGES_CURRENT_VERSION') && !empty($_POST)){
146
- if(array_key_exists('action', $_POST) && $_POST['action'] === 'inbound_store_lead'){ // AJAX action(s)
147
- ct_check_wplp();
148
- }else if(array_key_exists('inbound_submitted', $_POST) && $_POST['inbound_submitted'] == '1'){ // Final submit
149
- ct_check_wplp();
150
- }
151
- }
152
-
153
- // intercept S2member POST
154
- if (defined('WS_PLUGIN__S2MEMBER_PRO_VERSION') && (isset($_POST[$ct_post_data_label]['email']) || isset($_POST[$ct_post_data_authnet_label]['email']))){
155
- ct_s2member_registration_test();
156
- }
157
-
158
- //
159
- // New user approve hack
160
- // https://wordpress.org/plugins/new-user-approve/
161
- //
162
- if (ct_plugin_active('new-user-approve/new-user-approve.php')) {
163
- add_action('register_post', 'ct_register_post', 1, 3);
164
- }
165
-
166
- //
167
- // Gravity forms
168
- //
169
- if (defined('GF_MIN_WP_VERSION')) {
170
- add_filter('gform_get_form_filter', 'ct_gforms_hidden_field', 10, 2);
171
- add_filter('gform_entry_is_spam', 'ct_gforms_spam_test', 1, 3);
172
- }
173
-
174
- //
175
- // Load JS code to website footer
176
- //
177
- if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)) {
178
- add_action('wp_footer', 'ct_footer_add_cookie', 1);
179
- }
180
- if (ct_is_user_enable()) {
181
- ct_cookies_test();
182
-
183
- if (isset($ct_options['general_contact_forms_test']) && $ct_options['general_contact_forms_test'] == 1 && !isset($_POST['comment_post_ID']) && !isset($_GET['for'])) {
184
- $ct_check_post_result=false;
185
- ct_contact_form_validate();
186
- }
187
- if($_SERVER['REQUEST_METHOD'] == 'POST' && $ct_general_postdata_test==1 && !is_admin()&&!@isset($_POST['ct_checkjs_cf7']))// || isset($_POST['url']) && isset($_POST['title']) && $_POST['excerpt'])
188
- {
189
- $ct_check_post_result=false;
190
- ct_contact_form_validate_postdata();
191
- }
192
- }
193
- }
194
-
195
- /**
196
- * Init functions
197
- * @return mixed[] Array of options
198
- */
199
- function ct_init_after_all() {
200
- global $ct_direct_post, $ct_formtime_label;
201
- ct_init_session();
202
-
203
- if ($_SERVER['REQUEST_METHOD'] == 'POST') {
204
- if (isset($_SESSION) && is_array($_SESSION) && !array_key_exists($ct_formtime_label, $_SESSION) && session_id() != '') {
205
- $ct_direct_post = 1;
206
- }
207
- } else {
208
- $_SESSION[$ct_formtime_label] = time();
209
- }
210
- };
211
-
212
- function ct_ajaxurl() {
213
- ?>
214
- <script type="text/javascript">
215
- var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>';
216
- </script>
217
- <?php
218
- wp_enqueue_script('ct_nocache_js',plugins_url( '/cleantalk_nocache.js' , __FILE__ ));
219
- }
220
-
221
- /**
222
- * Adds hidden filed to comment form
223
- */
224
- function ct_comment_form($post_id) {
225
- global $ct_options, $ct_data;
226
- $ct_options = ct_get_options();
227
- $ct_data = ct_get_data();
228
-
229
- if (ct_is_user_enable() === false) {
230
- return false;
231
- }
232
-
233
- if ($ct_options['comments_test'] == 0) {
234
- return false;
235
- }
236
-
237
- ct_add_hidden_fields(true, 'ct_checkjs', false, false);
238
-
239
- return null;
240
- }
241
-
242
- /**
243
- * Adds cookie script filed to footer
244
- */
245
- function ct_footer_add_cookie() {
246
- if (ct_is_user_enable() === false) {
247
- # return false;
248
- }
249
-
250
- ct_add_hidden_fields(true, 'ct_checkjs', false, true);
251
-
252
- return null;
253
- }
254
-
255
- /**
256
- * Adds hidden filed to define avaialbility of client's JavaScript
257
- * @param bool $random_key switch on generation random key for every page load
258
- */
259
- function ct_add_hidden_fields($random_key = false, $field_name = 'ct_checkjs', $return_string = false, $cookie_check = false) {
260
- global $ct_checkjs_def, $ct_plugin_name, $ct_options, $ct_data;
261
- $ct_options = ct_get_options();
262
-
263
- $ct_checkjs_key = ct_get_checkjs_value($random_key);
264
- $field_id_hash = md5(rand(0, 1000));
265
-
266
- if ($cookie_check && isset($ct_options['set_cookies']) && $ct_options['set_cookies'] == 1) {
267
- $html = '
268
- <script type="text/javascript">
269
- function ctSetCookie(c_name, value, def_value) {
270
- document.cookie = c_name + "=" + escape(value.replace(/^def_value$/, value)) + "; path=/";
271
- }
272
- ctSetCookie("%s", "%s", "%s");
273
- </script>
274
- ';
275
- $html = sprintf($html, $field_name, $ct_checkjs_key, $ct_checkjs_def);
276
- } else {
277
- $ct_input_challenge = sprintf("'%s'", $ct_checkjs_key);
278
-
279
- $field_id = $field_name . '_' . $field_id_hash;
280
- $html = '
281
- <input type="hidden" id="%s" name="%s" value="%s" />
282
- <script type="text/javascript">
283
- setTimeout(function(){
284
- var ct_input_name = \'%s\';
285
- if (document.getElementById(ct_input_name) !== null) {
286
- var ct_input_value = document.getElementById(ct_input_name).value;
287
- document.getElementById(ct_input_name).value = document.getElementById(ct_input_name).value.replace(ct_input_value, %s);
288
- }
289
- }, 1000);
290
- </script>
291
- ';
292
- $html = sprintf($html, $field_id, $field_name, $ct_checkjs_def, $field_id, $ct_input_challenge);
293
- };
294
-
295
- // Simplify JS code
296
- // and fixing issue with wpautop()
297
- $html = str_replace(array("\n","\r"),'', $html);
298
-
299
- if ($return_string === true) {
300
- return $html;
301
- } else {
302
- echo $html;
303
- }
304
- }
305
-
306
- /**
307
- * Is enable for user group
308
- * @return boolean
309
- */
310
- function ct_is_user_enable() {
311
- global $current_user;
312
-
313
- if (!isset($current_user->roles)) {
314
- return true;
315
- }
316
-
317
- $disable_roles = array('administrator', 'editor', 'author');
318
- foreach ($current_user->roles as $k => $v) {
319
- if (in_array($v, $disable_roles))
320
- return false;
321
- }
322
-
323
- return true;
324
- //return !current_user_can('publish_posts');
325
- }
326
-
327
- /**
328
- * Public function - Insert JS code for spam tests
329
- * return null;
330
- */
331
- function ct_frm_entries_footer_scripts($fields, $form) {
332
- global $ct_options, $ct_checkjs_frm;
333
-
334
- if ($ct_options['contact_forms_test'] == 0) {
335
- return false;
336
- }
337
-
338
- $ct_checkjs_key = ct_get_checkjs_value();
339
- $ct_frm_name = 'form_' . $form->form_key;
340
-
341
- ?>
342
-
343
- var input = document.createElement("input");
344
- input.setAttribute("type", "hidden");
345
- input.setAttribute("name", "<?php echo $ct_checkjs_frm; ?>");
346
- input.setAttribute("value", "<?php echo $ct_checkjs_key; ?>");
347
- document.getElementById("<?php echo $ct_frm_name; ?>").appendChild(input);
348
-
349
- <?php
350
- $js_code = ct_add_hidden_fields(true, 'ct_checkjs', true, true);
351
- $js_code = strip_tags($js_code); // Removing <script> tag
352
-
353
- ?>
354
- <?php echo $js_code; ?>
355
- <?php
356
- }
357
-
358
- /**
359
- * Public function - Test Formidable data for spam activity
360
- * return @array with errors if spam has found
361
- */
362
- function ct_frm_validate_entry ($errors, $values) {
363
- global $wpdb, $current_user, $ct_agent_version, $ct_checkjs_frm, $ct_options, $ct_data;
364
-
365
- $ct_options = ct_get_options();
366
- $ct_data = ct_get_data();
367
-
368
- if ($ct_options['contact_forms_test'] == 0 || ct_is_user_enable() === false || is_user_logged_in()) {
369
- return false;
370
- }
371
-
372
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
373
- if($checkjs != 1){
374
- $checkjs = js_test($ct_checkjs_frm, $_POST, true);
375
- }
376
-
377
- $post_info['comment_type'] = 'feedback';
378
- $post_info = json_encode($post_info);
379
- if ($post_info === false)
380
- $post_info = '';
381
-
382
- $sender_email = null;
383
- $message = '';
384
- $subject = '';
385
- $nickname = '';
386
- $contact_form = true;
387
- @ct_get_fields_any($sender_email, $message, $subject, $nickname, $contact_form, $values['item_meta']);
388
- $message = json_encode($message);
389
-
390
- $ct_base_call_result = ct_base_call(array(
391
- 'message' => $message,
392
- 'example' => null,
393
- 'sender_email' => $sender_email,
394
- 'sender_nickname' => null,
395
- 'post_info' => $post_info,
396
- 'checkjs' => $checkjs
397
- ));
398
- $ct = $ct_base_call_result['ct'];
399
- $ct_result = $ct_base_call_result['ct_result'];
400
-
401
- if ($ct_result->spam == 1) {
402
- $errors['ct_error'] = '<br /><b>' . $ct_result->comment . '</b><br /><br />';
403
- }
404
-
405
- return $errors;
406
- }
407
-
408
- /**
409
- * Public filter 'bbp_*' - Checks topics, replies by cleantalk
410
- * @param mixed[] $comment Comment string
411
- * @return mixed[] $comment Comment string
412
- */
413
- function ct_bbp_new_pre_content ($comment) {
414
- global $ct_options, $ct_data;
415
-
416
- $ct_options = ct_get_options();
417
- $ct_data = ct_get_data();
418
-
419
- if (ct_is_user_enable() === false || $ct_options['comments_test'] == 0 || is_user_logged_in()) {
420
- return $comment;
421
- }
422
-
423
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
424
- if ($checkjs === null) {
425
- $checkjs = js_test('ct_checkjs', $_POST, true);
426
- }
427
-
428
- $example = null;
429
-
430
- $sender_info = array(
431
- 'sender_url' => isset($_POST['bbp_anonymous_website']) ? $_POST['bbp_anonymous_website'] : null
432
- );
433
-
434
- $post_info['comment_type'] = 'bbpress_comment';
435
- $post_info['post_url'] = bbp_get_topic_permalink();
436
-
437
- $post_info = json_encode($post_info);
438
- if ($post_info === false) {
439
- $post_info = '';
440
- }
441
-
442
- $ct_base_call_result = ct_base_call(array(
443
- 'message' => $comment,
444
- 'example' => $example,
445
- 'sender_email' => isset($_POST['bbp_anonymous_email']) ? $_POST['bbp_anonymous_email'] : null,
446
- 'sender_nickname' => isset($_POST['bbp_anonymous_name']) ? $_POST['bbp_anonymous_name'] : null,
447
- 'post_info' => $post_info,
448
- 'checkjs' => $checkjs,
449
- 'sender_info' => $sender_info
450
- ));
451
- $ct = $ct_base_call_result['ct'];
452
- $ct_result = $ct_base_call_result['ct_result'];
453
-
454
- if ($ct_result->stop_queue == 1 || $ct_result->spam == 1 || ($ct_result->allow == 0 && $ct_result->stop_words !== null)) {
455
- bbp_add_error('bbp_reply_content', $ct_result->comment);
456
- }
457
-
458
- return $comment;
459
- }
460
-
461
- /**
462
- * Public filter 'preprocess_comment' - Checks comment by cleantalk server
463
- * @param mixed[] $comment Comment data array
464
- * @return mixed[] New data array of comment
465
- */
466
- function ct_preprocess_comment($comment) {
467
- // this action is called just when WP process POST request (adds new comment)
468
- // this action is called by wp-comments-post.php
469
- // after processing WP makes redirect to post page with comment's form by GET request (see above)
470
- global $wpdb, $current_user, $comment_post_id, $ct_agent_version, $ct_comment_done, $ct_approved_request_id_label, $ct_jp_comments, $ct_options, $ct_data;
471
-
472
- $ct_options = ct_get_options();
473
- $ct_data = ct_get_data();
474
-
475
- if(defined('CLEANTALK_CHECK_COMMENTS_NUMBER'))
476
- {
477
- $comments_check_number = CLEANTALK_CHECK_COMMENTS_NUMBER;
478
- }
479
- else
480
- {
481
- $comments_check_number = 3;
482
- }
483
-
484
- $is_max_comments = false;
485
- if(isset($ct_options['check_comments_number']))
486
- {
487
- $value = @intval($ct_options['check_comments_number']);
488
- }
489
- else
490
- {
491
- $value=1;
492
- }
493
-
494
- if($value == 1)
495
- {
496
- $args=Array('author_email' => $comment['comment_author_email'],
497
- 'status' => 'approve',
498
- 'count' => false,
499
- 'number' => $comments_check_number
500
- );
501
- $cnt = sizeof(get_comments( $args ));
502
- if($cnt >= $comments_check_number)
503
- {
504
- $is_max_comments = true;
505
- }
506
- }
507
-
508
- if (($comment['comment_type']!='trackback') && (ct_is_user_enable() === false || $ct_options['comments_test'] == 0 || $ct_comment_done || (isset($_SERVER['HTTP_REFERER']) && stripos($_SERVER['HTTP_REFERER'],'page=wysija_campaigns&action=editTemplate')!==false) || $is_max_comments || strpos($_SERVER['REQUEST_URI'],'/wp-admin/')!==false)) {
509
- return $comment;
510
- }
511
-
512
- $local_blacklists = wp_blacklist_check(
513
- $comment['comment_author'],
514
- $comment['comment_author_email'],
515
- $comment['comment_author_url'],
516
- $comment['comment_content'],
517
- @$_SERVER['REMOTE_ADDR'],
518
- @$_SERVER['HTTP_USER_AGENT']
519
- );
520
-
521
- // Go out if author in local blacklists
522
- if ($comment['comment_type']!='trackback' && $local_blacklists === true) {
523
- return $comment;
524
- }
525
-
526
- // Skip pingback anti-spam test
527
- /*if ($comment['comment_type'] == 'pingback') {
528
- return $comment;
529
- }*/
530
-
531
- $ct_comment_done = true;
532
-
533
- $comment_post_id = $comment['comment_post_ID'];
534
-
535
- $sender_info = array(
536
- 'sender_url' => @$comment['comment_author_url']
537
- );
538
-
539
- //
540
- // JetPack comments logic
541
- //
542
- $checkjs = 0;
543
- if ($ct_jp_comments) {
544
- $post_info['comment_type'] = 'jetpack_comment';
545
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
546
- } else {
547
- $post_info['comment_type'] = $comment['comment_type'];
548
- $checkjs = js_test('ct_checkjs', $_POST, true);
549
- }
550
- if($checkjs==0)
551
- {
552
- $checkjs = js_test('ct_checkjs', $_POST, true);
553
- }
554
- if($checkjs==0)
555
- {
556
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
557
- }
558
-
559
- $post_info['post_url'] = ct_post_url(null, $comment_post_id);
560
- $post_info = json_encode($post_info);
561
- if ($post_info === false) {
562
- $post_info = '';
563
- }
564
-
565
- $example = null;
566
- if ($ct_options['relevance_test']) {
567
- $post = get_post($comment_post_id);
568
- if ($post !== null){
569
- $example['title'] = $post->post_title;
570
- $example['body'] = $post->post_content;
571
- $example['comments'] = null;
572
-
573
- $last_comments = get_comments(array('status' => 'approve', 'number' => 10, 'post_id' => $comment_post_id));
574
- foreach ($last_comments as $post_comment){
575
- $example['comments'] .= "\n\n" . $post_comment->comment_content;
576
- }
577
-
578
- $example = json_encode($example);
579
- }
580
-
581
- // Use plain string format if've failed with JSON
582
- if ($example === false || $example === null){
583
- $example = ($post->post_title !== null) ? $post->post_title : '';
584
- $example .= ($post->post_content !== null) ? "\n\n" . $post->post_content : '';
585
- }
586
- }
587
-
588
- $ct_base_call_result = ct_base_call(array(
589
- 'message' => $comment['comment_content'],
590
- 'example' => $example,
591
- 'sender_email' => $comment['comment_author_email'],
592
- 'sender_nickname' => $comment['comment_author'],
593
- 'post_info' => $post_info,
594
- 'checkjs' => $checkjs,
595
- 'sender_info' => $sender_info
596
- ));
597
- $ct = $ct_base_call_result['ct'];
598
- $ct_result = $ct_base_call_result['ct_result'];
599
-
600
- if ($ct_result->stop_queue == 1) {
601
- $err_text = '<center><b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk.</b> ' . __('Spam protection', 'cleantalk') . "</center><br><br>\n" . $ct_result->comment;
602
- $err_text .= '<script>setTimeout("history.back()", 5000);</script>';
603
- wp_die($err_text, 'Blacklisted', array('back_link' => true));
604
-
605
- return $comment;
606
- }
607
-
608
- ct_hash($ct_result->id);
609
- if ($ct_result->spam == 1) {
610
- add_filter('pre_comment_approved', 'ct_set_comment_spam');
611
-
612
- global $ct_comment;
613
- $ct_comment = $ct_result->comment;
614
- add_action('comment_post', 'ct_die', 12, 2);
615
- add_action('comment_post', 'ct_set_meta', 10, 2);
616
-
617
- return $comment;
618
- }
619
-
620
- if (isset($comment['comment_author_email'])) {
621
- $approved_comments = get_comments(array('status' => 'approve', 'count' => true, 'author_email' => $comment['comment_author_email']));
622
-
623
- // Change comment flow only for new authors
624
- if ((int) $approved_comments == 0 || $ct_result->stop_words !== null) {
625
-
626
- if ($ct_result->allow == 1 && get_option('comment_moderation') !== '1') {
627
- add_filter('pre_comment_approved', 'ct_set_approved', 99, 2);
628
- }
629
- if ($ct_result->allow == 0) {
630
- if (isset($ct_result->stop_words)) {
631
- global $ct_stop_words;
632
- $ct_stop_words = $ct_result->stop_words;
633
- add_action('comment_post', 'ct_mark_red', 11, 2);
634
- }
635
-
636
- add_filter('pre_comment_approved', 'ct_set_not_approved');
637
- }
638
-
639
- add_action('comment_post', 'ct_set_meta', 10, 2);
640
- }
641
- }
642
-
643
- return $comment;
644
- }
645
-
646
- /**
647
- * Set die page with Cleantalk comment.
648
- * @global type $ct_comment
649
- $err_text = '<center><b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk.</b> ' . __('Spam protection', 'cleantalk') . "</center><br><br>\n" . $ct_comment;
650
- * @param type $comment_status
651
- */
652
- function ct_die($comment_id, $comment_status) {
653
- global $ct_comment;
654
- $err_text = '<center><b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk.</b> ' . __('Spam protection', 'cleantalk') . "</center><br><br>\n" . $ct_comment;
655
- $err_text .= '<script>setTimeout("history.back()", 5000);</script>';
656
- if(isset($_POST['et_pb_contact_email']))
657
- {
658
- $mes='<div id="et_pb_contact_form_1" class="et_pb_contact_form_container clearfix"><h1 class="et_pb_contact_main_title">Blacklisted</h1><div class="et-pb-contact-message"><p>'.$ct_comment.'</p></div></div>';
659
- wp_die($mes, 'Blacklisted', array('back_link' => true,'response'=>200));
660
- }
661
- else
662
- {
663
- wp_die($err_text, 'Blacklisted', array('back_link' => true));
664
- }
665
- }
666
-
667
- /**
668
- * Set die page with Cleantalk comment from parameter.
669
- * @param type $comment_body
670
- */
671
- function ct_die_extended($comment_body) {
672
- $err_text = '<center><b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk.</b> ' . __('Spam protection', 'cleantalk') . "</center><br><br>\n" . $comment_body;
673
- $err_text .= '<script>setTimeout("history.back()", 5000);</script>';
674
- wp_die($err_text, 'Blacklisted', array('back_link' => true));
675
- }
676
-
677
- /**
678
- * Validates JavaScript anti-spam test
679
- *
680
- */
681
- function js_test($field_name = 'ct_checkjs', $data = null, $random_key = false) {
682
- global $ct_options, $ct_data;
683
-
684
- $ct_options = ct_get_options();
685
- $ct_data = ct_get_data();
686
-
687
- $checkjs = null;
688
- $js_post_value = null;
689
-
690
- if (!$data)
691
- return $checkjs;
692
-
693
- if (isset($data[$field_name])) {
694
- $js_post_value = $data[$field_name];
695
-
696
- //
697
- // Random key check
698
- //
699
- if ($random_key) {
700
-
701
- $keys = $ct_data['js_keys'];
702
- if (isset($keys[$js_post_value])) {
703
- $checkjs = 1;
704
- } else {
705
- $checkjs = 0;
706
- }
707
- } else {
708
- $ct_challenge = ct_get_checkjs_value();
709
-
710
- if(preg_match("/$ct_challenge/", $js_post_value)) {
711
- $checkjs = 1;
712
- } else {
713
- $checkjs = 0;
714
- }
715
- }
716
-
717
-
718
- }
719
-
720
- return $checkjs;
721
- }
722
-
723
- /**
724
- * Get post url
725
- * @param int $comment_id
726
- * @param int $comment_post_id
727
- * @return string|bool
728
- */
729
- function ct_post_url($comment_id = null, $comment_post_id) {
730
-
731
- if (empty($comment_post_id))
732
- return null;
733
-
734
- if ($comment_id === null) {
735
- $last_comment = get_comments('number=1');
736
- $comment_id = isset($last_comment[0]->comment_ID) ? (int) $last_comment[0]->comment_ID + 1 : 1;
737
- }
738
- $permalink = get_permalink($comment_post_id);
739
-
740
- $post_url = null;
741
- if ($permalink !== null)
742
- $post_url = $permalink . '#comment-' . $comment_id;
743
-
744
- return $post_url;
745
- }
746
-
747
- /**
748
- * Public filter 'pre_comment_approved' - Mark comment unapproved always
749
- * @return int Zero
750
- */
751
- function ct_set_not_approved() {
752
- return 0;
753
- }
754
-
755
- /**
756
- * @author Artem Leontiev
757
- * Public filter 'pre_comment_approved' - Mark comment approved if it's not 'spam' only
758
- * @return int 1
759
- */
760
- function ct_set_approved($approved, $comment) {
761
- if ($approved == 'spam'){
762
- return $approved;
763
- }else {
764
- return 1;
765
- }
766
- }
767
-
768
- /**
769
- * Public filter 'pre_comment_approved' - Mark comment unapproved always
770
- * @return int Zero
771
- */
772
- function ct_set_comment_spam() {
773
- return 'spam';
774
- }
775
-
776
- /**
777
- * Public action 'comment_post' - Store cleantalk hash in comment meta 'ct_hash'
778
- * @param int $comment_id Comment ID
779
- * @param mixed $comment_status Approval status ("spam", or 0/1), not used
780
- */
781
- function ct_set_meta($comment_id, $comment_status) {
782
- global $comment_post_id;
783
- $hash1 = ct_hash();
784
- if (!empty($hash1)) {
785
- update_comment_meta($comment_id, 'ct_hash', $hash1);
786
- if (function_exists('base64_encode') && isset($comment_status) && $comment_status != 'spam') {
787
- $post_url = ct_post_url($comment_id, $comment_post_id);
788
- $post_url = base64_encode($post_url);
789
- if ($post_url === false)
790
- return false;
791
- // 01 - URL to approved comment
792
- $feedback_request = $hash1 . ':' . '01' . ':' . $post_url . ';';
793
- ct_send_feedback($feedback_request);
794
- }
795
- }
796
- return true;
797
- }
798
-
799
- /**
800
- * Mark bad words
801
- * @global string $ct_stop_words
802
- * @param int $comment_id
803
- * @param int $comment_status Not use
804
- */
805
- function ct_mark_red($comment_id, $comment_status) {
806
- global $ct_stop_words;
807
-
808
- $comment = get_comment($comment_id, 'ARRAY_A');
809
- $message = $comment['comment_content'];
810
- foreach (explode(':', $ct_stop_words) as $word) {
811
- $message = preg_replace("/($word)/ui", '<font rel="cleantalk" color="#FF1000">' . "$1" . '</font>', $message);
812
-
813
- }
814
- $comment['comment_content'] = $message;
815
- kses_remove_filters();
816
- wp_update_comment($comment);
817
- }
818
-
819
- /**
820
- * Tests plugin activation status
821
- * @return bool
822
- */
823
- function ct_plugin_active($plugin_name){
824
- foreach (get_option('active_plugins') as $k => $v) {
825
- if ($plugin_name == $v)
826
- return true;
827
- }
828
- return false;
829
- }
830
-
831
- /**
832
- * Insert a hidden field to registration form
833
- * @return null
834
- */
835
- function ct_register_form() {
836
- global $ct_checkjs_register_form, $ct_options, $ct_data;
837
-
838
- $ct_options = ct_get_options();
839
- $ct_data = ct_get_data();
840
-
841
- if ($ct_options['registrations_test'] == 0) {
842
- return false;
843
- }
844
-
845
- ct_add_hidden_fields(true, $ct_checkjs_register_form, false);
846
-
847
- return null;
848
- }
849
-
850
- /**
851
- * Adds notification text to login form - to inform about approced registration
852
- * @return null
853
- */
854
- function ct_login_message($message) {
855
- global $errors, $ct_session_register_ok_label, $ct_options, $ct_data;
856
-
857
- $ct_options = ct_get_options();
858
- $ct_data = ct_get_data();
859
-
860
- if ($ct_options['registrations_test'] != 0) {
861
- ct_init_session();
862
-
863
- if( isset($_GET['checkemail']) && 'registered' == $_GET['checkemail'] ) {
864
- if (isset($_SESSION[$ct_session_register_ok_label])) {
865
- unset($_SESSION[$ct_session_register_ok_label]);
866
- if(is_wp_error($errors))
867
- $errors->add('ct_message','<br />' . sprintf(__('Registration is approved by %s.', 'cleantalk'), '<b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk</b>'), 'message');
868
- }
869
- }
870
- }
871
- return $message;
872
- }
873
-
874
- /**
875
- * Test users registration for multisite enviroment
876
- * @return array with errors
877
- */
878
- function ct_registration_errors_wpmu($errors) {
879
- global $ct_signup_done;
880
-
881
- //
882
- // Multisite actions
883
- //
884
- $sanitized_user_login = null;
885
- if (isset($errors['user_name'])) {
886
- $sanitized_user_login = $errors['user_name'];
887
- $wpmu = true;
888
- }
889
- $user_email = null;
890
- if (isset($errors['user_email'])) {
891
- $user_email = $errors['user_email'];
892
- $wpmu = true;
893
- }
894
-
895
- if ($wpmu && isset($errors['errors']->errors) && count($errors['errors']->errors) > 0) {
896
- return $errors;
897
- }
898
-
899
- $errors['errors'] = ct_registration_errors($errors['errors'], $sanitized_user_login, $user_email);
900
-
901
- // Show CleanTalk errors in user_name field
902
- if (isset($errors['errors']->errors['ct_error'])) {
903
- $errors['errors']->errors['user_name'] = $errors['errors']->errors['ct_error'];
904
- unset($errors['errors']->errors['ct_error']);
905
- }
906
-
907
- return $errors;
908
- }
909
-
910
- /**
911
- * Shell for action register_post
912
- * @return array with errors
913
- */
914
- function ct_register_post($sanitized_user_login = null, $user_email = null, $errors) {
915
- return ct_registration_errors($errors, $sanitized_user_login, $user_email);
916
- }
917
-
918
- /**
919
- * Check messages for external plugins
920
- * @return array with checking result;
921
- */
922
-
923
- function ct_test_message($nickname, $email, $ip, $text){
924
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
925
-
926
- $post_info['comment_type'] = 'feedback_plugin_check';
927
- $post_info = json_encode($post_info);
928
-
929
- $ct_base_call_result = ct_base_call(array(
930
- 'message' => $text,
931
- 'example' => null,
932
- 'sender_email' => $email,
933
- 'sender_nickname' => $nickname,
934
- 'post_info' => $post_info,
935
- 'sender_info' => get_sender_info(),
936
- 'checkjs' => $checkjs
937
- ));
938
-
939
- $ct_result = $ct_base_call_result['ct_result'];
940
-
941
- $result=Array(
942
- 'allow' => $ct_result->allow,
943
- 'comment' => $ct_result->comment,
944
- );
945
- return $result;
946
- }
947
-
948
- /**
949
- * Check registrations for external plugins
950
- * @return array with checking result;
951
- */
952
- function ct_test_registration($nickname, $email, $ip){
953
- global $ct_checkjs_register_form, $ct_agent_version, $ct_options, $ct_data;
954
-
955
- $ct_options = ct_get_options();
956
- $ct_data = ct_get_data();
957
-
958
- $submit_time = submit_time_test();
959
-
960
- $sender_info = get_sender_info();
961
-
962
- $checkjs=0;
963
-
964
- $checkjs = js_test($ct_checkjs_register_form, $_POST, true);
965
- $sender_info['post_checkjs_passed'] = $checkjs;
966
-
967
- //
968
- // This hack can be helpfull when plugin uses with untested themes&signups plugins.
969
- //
970
- if ($checkjs == 0) {
971
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
972
- $sender_info['cookie_checkjs_passed'] = $checkjs;
973
- }
974
-
975
- $sender_info = json_encode($sender_info);
976
- if ($sender_info === false) {
977
- $sender_info= '';
978
- }
979
-
980
- require_once('cleantalk.class.php');
981
- $config = get_option('cleantalk_server');
982
- $ct = new Cleantalk();
983
- $ct->work_url = $config['ct_work_url'];
984
- $ct->server_url = $ct_options['server'];
985
-
986
- $ct->server_ttl = $config['ct_server_ttl'];
987
- $ct->server_changed = $config['ct_server_changed'];
988
- $ct->ssl_on = $ct_options['ssl_on'];
989
-
990
- $ct_request = new CleantalkRequest();
991
- $ct_request->auth_key = $ct_options['apikey'];
992
- $ct_request->sender_email = $email;
993
- $ct_request->sender_ip = $ip;
994
- $ct_request->sender_nickname = $nickname;
995
- $ct_request->agent = $ct_agent_version;
996
- $ct_request->sender_info = $sender_info;
997
- $ct_request->js_on = $checkjs;
998
- $ct_request->submit_time = $submit_time;
999
-
1000
- $ct_result = $ct->isAllowUser($ct_request);
1001
-
1002
- $ct_result = ct_change_plugin_resonse($ct_result, $checkjs);
1003
-
1004
- $result=Array(
1005
- 'allow' => $ct_result->allow,
1006
- 'comment' => $ct_result->comment,
1007
- );
1008
- return $result;
1009
- }
1010
-
1011
- /**
1012
- * Test users registration
1013
- * @return array with errors
1014
- */
1015
- function ct_registration_errors($errors, $sanitized_user_login = null, $user_email = null) {
1016
- 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;
1017
-
1018
- $ct_options=ct_get_options();
1019
- $ct_data=ct_get_data();
1020
-
1021
- // Go out if a registrered user action
1022
- if (ct_is_user_enable() === false) {
1023
- return $errors;
1024
- }
1025
-
1026
- if ($ct_options['registrations_test'] == 0) {
1027
- return $errors;
1028
- }
1029
-
1030
- //
1031
- // The function already executed
1032
- // It happens when used ct_register_post();
1033
- //
1034
- if ($ct_signup_done && is_object($errors) && count($errors->errors) > 0) {
1035
- return $errors;
1036
- }
1037
-
1038
- //
1039
- // BuddyPress actions
1040
- //
1041
- $buddypress = false;
1042
- if ($sanitized_user_login === null && isset($_POST['signup_username'])) {
1043
- $sanitized_user_login = $_POST['signup_username'];
1044
- $buddypress = true;
1045
- }
1046
- if ($user_email === null && isset($_POST['signup_email'])) {
1047
- $user_email = $_POST['signup_email'];
1048
- $buddypress = true;
1049
- }
1050
-
1051
- //
1052
- // Break tests because we already have servers response
1053
- //
1054
- if ($buddypress && $ct_signup_done) {
1055
- if ($ct_negative_comment) {
1056
- $bp->signup->errors['signup_username'] = $ct_negative_comment;
1057
- }
1058
- return $errors;
1059
- }
1060
-
1061
- $submit_time = submit_time_test();
1062
-
1063
- $sender_info = get_sender_info();
1064
-
1065
- $checkjs=0;
1066
-
1067
- $checkjs = js_test($ct_checkjs_register_form, $_POST, true);
1068
- $sender_info['post_checkjs_passed'] = $checkjs;
1069
- //
1070
- // This hack can be helpfull when plugin uses with untested themes&signups plugins.
1071
- //
1072
- if ($checkjs == 0) {
1073
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
1074
- $sender_info['cookie_checkjs_passed'] = $checkjs;
1075
- }
1076
-
1077
- $sender_info = json_encode($sender_info);
1078
- if ($sender_info === false) {
1079
- $sender_info= '';
1080
- }
1081
-
1082
- require_once('cleantalk.class.php');
1083
- $config = get_option('cleantalk_server');
1084
- $ct = new Cleantalk();
1085
- $ct->work_url = $config['ct_work_url'];
1086
- $ct->server_url = $ct_options['server'];
1087
-
1088
- $ct->server_ttl = $config['ct_server_ttl'];
1089
- $ct->server_changed = $config['ct_server_changed'];
1090
- $ct->ssl_on = $ct_options['ssl_on'];
1091
-
1092
- $ct_request = new CleantalkRequest();
1093
- $ct_request->auth_key = $ct_options['apikey'];
1094
- $ct_request->sender_email = $user_email;
1095
- $ct_request->sender_ip = $ct->ct_session_ip($_SERVER['REMOTE_ADDR']);
1096
- $ct_request->sender_nickname = $sanitized_user_login;
1097
- $ct_request->agent = $ct_agent_version;
1098
- $ct_request->sender_info = $sender_info;
1099
- $ct_request->js_on = $checkjs;
1100
- $ct_request->submit_time = $submit_time;
1101
-
1102
- $ct_result = $ct->isAllowUser($ct_request);
1103
- if ($ct->server_change) {
1104
- update_option(
1105
- 'cleantalk_server', array(
1106
- 'ct_work_url' => $ct->work_url,
1107
- 'ct_server_ttl' => $ct->server_ttl,
1108
- 'ct_server_changed' => time()
1109
- )
1110
- );
1111
- }
1112
-
1113
- $ct_signup_done = true;
1114
-
1115
- $ct_result = ct_change_plugin_resonse($ct_result, $checkjs);
1116
-
1117
- if ($ct_result->inactive != 0) {
1118
- ct_send_error_notice($ct_result->comment);
1119
- return $errors;
1120
- }
1121
-
1122
- ct_init_session();
1123
-
1124
- if ($ct_result->allow == 0) {
1125
-
1126
- // Restart submit form counter for failed requests
1127
- $_SESSION[$ct_formtime_label] = time();
1128
-
1129
- if ($buddypress === true) {
1130
- $bp->signup->errors['signup_username'] = $ct_result->comment;
1131
- } else {
1132
- if(is_wp_error($errors))
1133
- $errors->add('ct_error', $ct_result->comment);
1134
- $ct_negative_comment = $ct_result->comment;
1135
- }
1136
- } else {
1137
- if ($ct_result->id !== null) {
1138
- $_SESSION[$ct_session_request_id_label] = $ct_result->id;
1139
- $_SESSION[$ct_session_register_ok_label] = $ct_result->id;
1140
- }
1141
- }
1142
-
1143
- return $errors;
1144
- }
1145
-
1146
- /**
1147
- * Set user meta
1148
- * @return null
1149
- */
1150
- function ct_user_register($user_id) {
1151
- global $ct_session_request_id_label;
1152
-
1153
- ct_init_session();
1154
-
1155
- if (isset($_SESSION[$ct_session_request_id_label])) {
1156
- update_user_meta($user_id, 'ct_hash', $_SESSION[$ct_session_request_id_label]);
1157
- unset($_SESSION[$ct_session_request_id_label]);
1158
- }
1159
- }
1160
-
1161
-
1162
- /**
1163
- * Test for JetPack contact form
1164
- */
1165
- function ct_grunion_contact_form_field_html($r, $field_label) {
1166
- global $ct_checkjs_jpcf, $ct_jpcf_patched, $ct_jpcf_fields, $ct_options, $ct_data;
1167
-
1168
- $ct_options = ct_get_options();
1169
- $ct_data = ct_get_data();
1170
-
1171
- if ($ct_options['contact_forms_test'] == 1 && $ct_jpcf_patched === false && preg_match("/[text|email]/i", $r)) {
1172
-
1173
- // Looking for element name prefix
1174
- $name_patched = false;
1175
- foreach ($ct_jpcf_fields as $v) {
1176
- if ($name_patched === false && preg_match("/(g\d-)$v/", $r, $matches)) {
1177
- $ct_checkjs_jpcf = $matches[1] . $ct_checkjs_jpcf;
1178
- $name_patched = true;
1179
- }
1180
- }
1181
-
1182
- $r .= ct_add_hidden_fields(true, $ct_checkjs_jpcf, true);
1183
- $ct_jpcf_patched = true;
1184
- }
1185
-
1186
- return $r;
1187
- }
1188
- /**
1189
- * Test for JetPack contact form
1190
- */
1191
- function ct_contact_form_is_spam($form) {
1192
- global $ct_checkjs_jpcf, $ct_options, $ct_data;
1193
-
1194
- $ct_options = ct_get_options();
1195
- $ct_data = ct_get_data();
1196
-
1197
- if ($ct_options['contact_forms_test'] == 0) {
1198
- return null;
1199
- }
1200
-
1201
- $js_field_name = $ct_checkjs_jpcf;
1202
- foreach ($_POST as $k => $v) {
1203
- if (preg_match("/^.+$ct_checkjs_jpcf$/", $k))
1204
- $js_field_name = $k;
1205
- }
1206
-
1207
- $checkjs = js_test($js_field_name, $_POST, true);
1208
-
1209
- $sender_info = array(
1210
- 'sender_url' => @$form['comment_author_url']
1211
- );
1212
-
1213
- $post_info['comment_type'] = 'feedback';
1214
- $post_info = json_encode($post_info);
1215
- if ($post_info === false)
1216
- $post_info = '';
1217
-
1218
- $sender_email = null;
1219
- $sender_nickname = null;
1220
- $message = '';
1221
- if (isset($form['comment_author_email']))
1222
- $sender_email = $form['comment_author_email'];
1223
-
1224
- if (isset($form['comment_author']))
1225
- $sender_nickname = $form['comment_author'];
1226
-
1227
- if (isset($form['comment_content']))
1228
- $message = $form['comment_content'];
1229
-
1230
- $ct_base_call_result = ct_base_call(array(
1231
- 'message' => $message,
1232
- 'example' => null,
1233
- 'sender_email' => $sender_email,
1234
- 'sender_nickname' => $sender_nickname,
1235
- 'post_info' => $post_info,
1236
- 'sender_info' => $sender_info,
1237
- 'checkjs' => $checkjs
1238
- ));
1239
- $ct = $ct_base_call_result['ct'];
1240
- $ct_result = $ct_base_call_result['ct_result'];
1241
-
1242
- if ($ct_result->spam == 1) {
1243
- global $ct_comment;
1244
- $ct_comment = $ct_result->comment;
1245
- ct_die(null, null);
1246
- exit;
1247
- }
1248
-
1249
- return (bool) $ct_result->spam;
1250
- }
1251
-
1252
- function ct_contact_form_is_spam_jetpack($is_spam,$form) {
1253
- global $ct_checkjs_jpcf, $ct_options, $ct_data;
1254
-
1255
- $ct_options = ct_get_options();
1256
- $ct_data = ct_get_data();
1257
-
1258
- if ($ct_options['contact_forms_test'] == 0) {
1259
- return null;
1260
- }
1261
-
1262
- $js_field_name = $ct_checkjs_jpcf;
1263
- foreach ($_POST as $k => $v) {
1264
- if (preg_match("/^.+$ct_checkjs_jpcf$/", $k))
1265
- $js_field_name = $k;
1266
- }
1267
-
1268
- $checkjs = js_test($js_field_name, $_POST, true);
1269
-
1270
- $sender_info = array(
1271
- 'sender_url' => @$form['comment_author_url']
1272
- );
1273
-
1274
- $post_info['comment_type'] = 'feedback';
1275
- $post_info = json_encode($post_info);
1276
- if ($post_info === false)
1277
- $post_info = '';
1278
-
1279
- $sender_email = null;
1280
- $sender_nickname = null;
1281
- $message = '';
1282
- if (isset($form['comment_author_email']))
1283
- $sender_email = $form['comment_author_email'];
1284
-
1285
- if (isset($form['comment_author']))
1286
- $sender_nickname = $form['comment_author'];
1287
-
1288
- if (isset($form['comment_content']))
1289
- $message = $form['comment_content'];
1290
-
1291
- $ct_base_call_result = ct_base_call(array(
1292
- 'message' => $message,
1293
- 'example' => null,
1294
- 'sender_email' => $sender_email,
1295
- 'sender_nickname' => $sender_nickname,
1296
- 'post_info' => $post_info,
1297
- 'sender_info' => $sender_info,
1298
- 'checkjs' => $checkjs
1299
- ));
1300
- $ct = $ct_base_call_result['ct'];
1301
- $ct_result = $ct_base_call_result['ct_result'];
1302
-
1303
- if ($ct_result->spam == 1) {
1304
- global $ct_comment;
1305
- $ct_comment = $ct_result->comment;
1306
- ct_die(null, null);
1307
- exit;
1308
- }
1309
-
1310
- return (bool) $ct_result->spam;
1311
- }
1312
-
1313
-
1314
-
1315
- /**
1316
- * Inserts anti-spam hidden to CF7
1317
- */
1318
- function ct_wpcf7_form_elements($html) {
1319
- global $wpdb, $current_user, $ct_checkjs_cf7, $ct_options, $ct_data;
1320
-
1321
- $ct_options = ct_get_options();
1322
- $ct_data = ct_get_data();
1323
-
1324
- if ($ct_options['contact_forms_test'] == 0) {
1325
- return $html;
1326
- }
1327
-
1328
- $html .= ct_add_hidden_fields(true, $ct_checkjs_cf7, true);
1329
-
1330
- return $html;
1331
- }
1332
-
1333
- /**
1334
- * Test CF7 message for spam
1335
- */
1336
- function ct_wpcf7_spam($param) {
1337
- global $wpdb, $current_user, $ct_agent_version, $ct_checkjs_cf7, $ct_cf7_comment, $ct_options, $ct_data;
1338
-
1339
- $ct_options = ct_get_options();
1340
- $ct_data = ct_get_data();
1341
-
1342
- if (WPCF7_VERSION >= '3.0.0') {
1343
- if($param === true)
1344
- return $param;
1345
- }else{
1346
- if($param == false)
1347
- return $param;
1348
- }
1349
-
1350
- if ($ct_options['contact_forms_test'] == 0) {
1351
- return $param;
1352
- }
1353
-
1354
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
1355
- if($checkjs != 1){
1356
- $checkjs = js_test($ct_checkjs_cf7, $_POST, true);
1357
- }
1358
-
1359
- $post_info['comment_type'] = 'feedback';
1360
- $post_info = json_encode($post_info);
1361
- if ($post_info === false)
1362
- $post_info = '';
1363
-
1364
- $sender_email = null;
1365
- $sender_nickname = null;
1366
- $message = '';
1367
- $subject = '';
1368
- foreach ($_POST as $k => $v) {
1369
- if(is_array($v))
1370
- {
1371
- continue;
1372
- }
1373
- if ($sender_email === null && preg_match("/^\S+@\S+\.\S+$/", $v)) {
1374
- $sender_email = $v;
1375
- }
1376
- else if ($sender_nickname === null && preg_match("/-name$/", $k)) {
1377
- $sender_nickname = $v;
1378
- }
1379
- else if ($subject === '' && ct_get_data_from_submit($k, 'subject')) {
1380
- $subject = $v;
1381
- }
1382
- else if (preg_match("/(\-message|\w*message\w*|contact|comment|contact\-)$/", $k))
1383
- {
1384
- $message.= $v."\n";
1385
- }
1386
-
1387
- }
1388
-
1389
- if ($subject != '') {
1390
- if ($message != '') {
1391
- $message = "\n\n" . $message;
1392
- }
1393
- $message = sprintf("%s%s", $subject, $message);
1394
- }
1395
-
1396
- $ct_base_call_result = ct_base_call(array(
1397
- 'message' => $message,
1398
- 'example' => null,
1399
- 'sender_email' => $sender_email,
1400
- 'sender_nickname' => $sender_nickname,
1401
- 'post_info' => $post_info,
1402
- 'checkjs' => $checkjs
1403
- ));
1404
- $ct = $ct_base_call_result['ct'];
1405
- $ct_result = $ct_base_call_result['ct_result'];
1406
-
1407
- if ($ct_result->spam == 1) {
1408
- if (WPCF7_VERSION >= '3.0.0') {
1409
- $param = true;
1410
- }else{
1411
- $param = false;
1412
- }
1413
- $ct_cf7_comment = $ct_result->comment;
1414
- add_filter('wpcf7_display_message', 'ct_wpcf7_display_message', 10, 2);
1415
-
1416
- }
1417
-
1418
- return $param;
1419
- }
1420
-
1421
- /**
1422
- * Changes CF7 status message
1423
- * @param string $hook URL of hooked page
1424
- */
1425
- function ct_wpcf7_display_message($message, $status = 'spam') {
1426
- global $ct_cf7_comment;
1427
-
1428
- if ($status == 'spam') {
1429
- $message = $ct_cf7_comment;
1430
- }
1431
-
1432
- return $message;
1433
- }
1434
-
1435
- /**
1436
- * Inserts anti-spam hidden to Fast Secure contact form
1437
- */
1438
- function ct_si_contact_display_after_fields($string = '', $style = '', $form_errors = array(), $form_id_num = 0) {
1439
- $string .= ct_add_hidden_fields(true, 'ct_checkjs', true);
1440
- return $string;
1441
- }
1442
-
1443
- /**
1444
- * Test for Fast Secure contact form
1445
- */
1446
- function ct_si_contact_form_validate($form_errors = array(), $form_id_num = 0) {
1447
- global $ct_options, $ct_data, $cleantalk_executed;
1448
-
1449
- $ct_options = ct_get_options();
1450
- $ct_data = ct_get_data();
1451
-
1452
- if (!empty($form_errors))
1453
- return $form_errors;
1454
-
1455
- if ($ct_options['contact_forms_test'] == 0)
1456
- return $form_errors;
1457
-
1458
- // Skip processing because data already processed.
1459
- if ($cleantalk_executed) {
1460
- return $form_errors;
1461
- }
1462
-
1463
-
1464
- $sender_info='';
1465
-
1466
- $checkjs = js_test('ct_checkjs', $_POST, true);
1467
-
1468
- $post_info['comment_type'] = 'feedback';
1469
- $post_info = json_encode($post_info);
1470
- if ($post_info === false)
1471
- $post_info = '';
1472
-
1473
- $sender_email = null;
1474
- $sender_nickname = null;
1475
- $subject = '';
1476
- $message = array();
1477
- $contact_form = null;
1478
- //getting info from custom fields
1479
- @ct_get_fields_any($sender_email, $message, $sender_nickname, $subject, $contact_form, $_POST);
1480
- //setting fields if they with defaults names
1481
-
1482
- if ($subject != '') {
1483
- $message = array_merge(array('subject' => $subject), $message);
1484
- }
1485
- $message = json_encode($message);
1486
-
1487
-
1488
- $ct_base_call_result = ct_base_call(array(
1489
- 'message' => $message,
1490
- 'example' => null,
1491
- 'sender_email' => $sender_email,
1492
- 'sender_nickname' => $sender_nickname,
1493
- 'post_info' => $post_info,
1494
- 'sender_info' => $sender_info,
1495
- 'checkjs' => $checkjs
1496
- ));
1497
- $ct = $ct_base_call_result['ct'];
1498
- $ct_result = $ct_base_call_result['ct_result'];
1499
-
1500
- $cleantalk_executed = true;
1501
-
1502
- if ($ct_result->spam == 1) {
1503
- global $ct_comment;
1504
- $ct_comment = $ct_result->comment;
1505
- ct_die(null, null);
1506
- exit;
1507
- }
1508
-
1509
- return $form_errors;
1510
- }
1511
-
1512
- /**
1513
- * Notice for commentators which comment has automatically approved by plugin
1514
- * @param string $hook URL of hooked page
1515
- */
1516
- function ct_comment_text($comment_text) {
1517
- global $comment, $ct_approved_request_id_label;
1518
-
1519
- if (isset($_COOKIE[$ct_approved_request_id_label]) && isset($comment->comment_ID)) {
1520
- $ct_hash = get_comment_meta($comment->comment_ID, 'ct_hash', true);
1521
-
1522
- if ($ct_hash !== '' && $_COOKIE[$ct_approved_request_id_label] == $ct_hash) {
1523
- $comment_text .= '<br /><br /> <em class="comment-awaiting-moderation">' . __('Comment approved. Anti-spam by CleanTalk.', 'cleantalk') . '</em>';
1524
- }
1525
- }
1526
-
1527
- return $comment_text;
1528
- }
1529
-
1530
-
1531
- /**
1532
- * Checks WordPress Landing Pages raw $_POST values
1533
- */
1534
- function ct_check_wplp(){
1535
- global $ct_wplp_result_label, $ct_options, $ct_data;
1536
-
1537
- $ct_options = ct_get_options();
1538
- $ct_data = ct_get_data();
1539
- if (!isset($_COOKIE[$ct_wplp_result_label])) {
1540
- // First AJAX submit of WPLP form
1541
- if ($ct_options['contact_forms_test'] == 0)
1542
- return;
1543
-
1544
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
1545
-
1546
- $post_info['comment_type'] = 'feedback';
1547
- $post_info = json_encode($post_info);
1548
- if ($post_info === false)
1549
- $post_info = '';
1550
-
1551
- $sender_email = '';
1552
- foreach ($_POST as $v) {
1553
- if (preg_match("/^\S+@\S+\.\S+$/", $v)) {
1554
- $sender_email = $v;
1555
- break;
1556
- }
1557
- }
1558
-
1559
- $message = '';
1560
- if(array_key_exists('form_input_values', $_POST)){
1561
- $form_input_values = json_decode(stripslashes($_POST['form_input_values']), true);
1562
- if (is_array($form_input_values) && array_key_exists('null', $form_input_values))
1563
- $message = $form_input_values['null'];
1564
- } else if (array_key_exists('null', $_POST)) {
1565
- $message = $_POST['null'];
1566
- }
1567
-
1568
- $ct_base_call_result = ct_base_call(array(
1569
- 'message' => $message,
1570
- 'example' => null,
1571
- 'sender_email' => $sender_email,
1572
- 'sender_nickname' => null,
1573
- 'post_info' => $post_info,
1574
- 'checkjs' => $checkjs
1575
- ));
1576
- $ct = $ct_base_call_result['ct'];
1577
- $ct_result = $ct_base_call_result['ct_result'];
1578
-
1579
- if ($ct_result->spam == 1) {
1580
- $cleantalk_comment = $ct_result->comment;
1581
- } else {
1582
- $cleantalk_comment = 'OK';
1583
- }
1584
-
1585
- setcookie($ct_wplp_result_label, $cleantalk_comment, strtotime("+5 seconds"), '/');
1586
- } else {
1587
- // Next POST/AJAX submit(s) of same WPLP form
1588
- $cleantalk_comment = $_COOKIE[$ct_wplp_result_label];
1589
- }
1590
- if ($cleantalk_comment !== 'OK')
1591
- ct_die_extended($cleantalk_comment);
1592
- }
1593
-
1594
- /**
1595
- * Places a hidding field to Gravity.
1596
- * @return string
1597
- */
1598
- function ct_gforms_hidden_field ( $form_string, $form ) {
1599
- $ct_hidden_field = 'ct_checkjs';
1600
-
1601
- // Do not add a hidden field twice.
1602
- if (preg_match("/$ct_hidden_field/", $form_string)) {
1603
- return $form_string;
1604
- }
1605
-
1606
- $search = "</form>";
1607
- $js_code = ct_add_hidden_fields(true, $ct_hidden_field, true, false);
1608
- $form_string = str_replace($search, $js_code . $search, $form_string);
1609
-
1610
- return $form_string;
1611
- }
1612
-
1613
- /**
1614
- * Gravity forms anti-spam test.
1615
- * @return boolean
1616
- */
1617
- function ct_gforms_spam_test ($is_spam, $form, $entry) {
1618
- global $ct_options, $ct_data, $cleantalk_executed;
1619
-
1620
- $ct_options = ct_get_options();
1621
- $ct_data = ct_get_data();
1622
-
1623
- if ($is_spam) {
1624
- return $is_spam;
1625
- }
1626
-
1627
- if ($ct_options['contact_forms_test'] == 0) {
1628
- return $is_spam;
1629
- }
1630
-
1631
- // Return unchanged result if the submission was already tested.
1632
- if ($cleantalk_executed) {
1633
- return $is_spam;
1634
- }
1635
-
1636
- $sender_info='';
1637
-
1638
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
1639
- if (!$checkjs) {
1640
- $checkjs = js_test('ct_checkjs', $_POST, true);
1641
- }
1642
-
1643
- $post_info['comment_type'] = 'feedback_gravity';
1644
- $post_info = json_encode($post_info);
1645
- if ($post_info === false)
1646
- $post_info = '';
1647
-
1648
- $sender_email = null;
1649
- $sender_nickname = null;
1650
- $subject = '';
1651
- $message = '';
1652
-
1653
- @ct_get_fields_any($sender_email, $message, $sender_nickname, $subject, $contact_form, $_POST);
1654
-
1655
- if ($subject != '') {
1656
- $message = array_merge(array('subject' => $subject), $message);
1657
- }
1658
- $message = json_encode($message);
1659
-
1660
- $ct_base_call_result = ct_base_call(array(
1661
- 'message' => $message,
1662
- 'example' => null,
1663
- 'sender_email' => $sender_email,
1664
- 'sender_nickname' => $sender_nickname,
1665
- 'post_info' => $post_info,
1666
- 'sender_info' => $sender_info,
1667
- 'checkjs' => $checkjs
1668
- ));
1669
- $ct_result = $ct_base_call_result['ct_result'];
1670
-
1671
- if ($ct_result->allow == 0) {
1672
- $is_spam = true;
1673
- }
1674
-
1675
- return $is_spam;
1676
- }
1677
-
1678
- /**
1679
- * Test S2member registration
1680
- * @return array with errors
1681
- */
1682
- function ct_s2member_registration_test() {
1683
- global $ct_agent_version, $ct_post_data_label, $ct_post_data_authnet_label, $ct_formtime_label, $ct_options, $ct_data;
1684
-
1685
- $ct_options = ct_get_options();
1686
- $ct_data = ct_get_data();
1687
-
1688
- if ($ct_options['registrations_test'] == 0) {
1689
- return null;
1690
- }
1691
-
1692
- $submit_time = submit_time_test();
1693
-
1694
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
1695
-
1696
- require_once('cleantalk.class.php');
1697
-
1698
- $sender_info = get_sender_info();
1699
- $sender_info = json_encode($sender_info);
1700
- if ($sender_info === false) {
1701
- $sender_info= '';
1702
- }
1703
-
1704
- $sender_email = null;
1705
- if (isset($_POST[$ct_post_data_label]['email']))
1706
- $sender_email = $_POST[$ct_post_data_label]['email'];
1707
-
1708
- if (isset($_POST[$ct_post_data_authnet_label]['email']))
1709
- $sender_email = $_POST[$ct_post_data_authnet_label]['email'];
1710
-
1711
- $sender_nickname = null;
1712
- if (isset($_POST[$ct_post_data_label]['username']))
1713
- $sender_nickname = $_POST[$ct_post_data_label]['username'];
1714
-
1715
- if (isset($_POST[$ct_post_data_authnet_label]['username']))
1716
- $sender_nickname = $_POST[$ct_post_data_authnet_label]['username'];
1717
-
1718
- $config = get_option('cleantalk_server');
1719
-
1720
- $ct = new Cleantalk();
1721
- $ct->work_url = $config['ct_work_url'];
1722
- $ct->server_url = $ct_options['server'];
1723
- $ct->server_ttl = $config['ct_server_ttl'];
1724
- $ct->server_changed = $config['ct_server_changed'];
1725
- $ct->ssl_on = $ct_options['ssl_on'];
1726
-
1727
- $ct_request = new CleantalkRequest();
1728
-
1729
- $ct_request->auth_key = $ct_options['apikey'];
1730
- $ct_request->sender_email = $sender_email;
1731
- $ct_request->sender_ip = $ct->ct_session_ip($_SERVER['REMOTE_ADDR']);
1732
- $ct_request->sender_nickname = $sender_nickname;
1733
- $ct_request->agent = $ct_agent_version;
1734
- $ct_request->sender_info = $sender_info;
1735
- $ct_request->js_on = $checkjs;
1736
- $ct_request->submit_time = $submit_time;
1737
-
1738
- $ct_result = $ct->isAllowUser($ct_request);
1739
- if ($ct->server_change) {
1740
- update_option(
1741
- 'cleantalk_server', array(
1742
- 'ct_work_url' => $ct->work_url,
1743
- 'ct_server_ttl' => $ct->server_ttl,
1744
- 'ct_server_changed' => time()
1745
- )
1746
- );
1747
- }
1748
-
1749
- $ct_result = ct_change_plugin_resonse($ct_result, $checkjs);
1750
-
1751
- // Restart submit form counter for failed requests
1752
- if ($ct_result->allow == 0) {
1753
- ct_init_session();
1754
- $_SESSION[$ct_formtime_label] = time();
1755
- }
1756
-
1757
- if ($ct_result->allow == 0) {
1758
- ct_die_extended($ct_result->comment);
1759
- }
1760
-
1761
- return true;
1762
- }
1763
-
1764
- /**
1765
- * General test for any contact form
1766
- */
1767
- function ct_contact_form_validate () {
1768
- global $pagenow,$cleantalk_executed, $cleantalk_url_exclusions,$ct_options, $ct_data, $ct_checkjs_frm;
1769
-
1770
- $ct_options = ct_get_options();
1771
- $ct_data = ct_get_data();
1772
-
1773
- if($cleantalk_executed)
1774
- {
1775
- return null;
1776
- }
1777
- if(isset($cleantalk_url_exclusions))
1778
- {
1779
- $ct_cnt=sizeof($cleantalk_url_exclusions);
1780
- }
1781
- else
1782
- {
1783
- $ct_cnt=0;
1784
- }
1785
- //@header("CtExclusions: ".$ct_cnt);
1786
- cleantalk_debug("CtExclusions", $ct_cnt);
1787
-
1788
- if (@sizeof($_POST)==0 ||
1789
- (isset($_POST['signup_username']) && isset($_POST['signup_email']) && isset($_POST['signup_password'])) ||
1790
- (isset($pagenow) && $pagenow == 'wp-login.php') || // WordPress log in form
1791
- (isset($pagenow) && $pagenow == 'wp-login.php' && isset($_GET['action']) && $_GET['action']=='lostpassword') ||
1792
- strpos($_SERVER['REQUEST_URI'],'/checkout/')!==false ||
1793
- strpos($_SERVER['REQUEST_URI'],'/wp-admin/')!==false ||
1794
- strpos($_SERVER['REQUEST_URI'],'wp-login.php')!==false||
1795
- strpos($_SERVER['REQUEST_URI'],'wp-comments-post.php')!==false ||
1796
- @strpos($_SERVER['HTTP_REFERER'],'/wp-admin/')!==false ||
1797
- strpos($_SERVER['REQUEST_URI'],'/login/')!==false||
1798
- isset($_GET['ptype']) && $_GET['ptype']=='login' ||
1799
- check_url_exclusions() ||
1800
- ct_check_array_keys($_POST) ||
1801
- isset($_POST['ct_checkjs_register_form']) ||
1802
- (isset($_POST['signup_username']) && isset($_POST['signup_password_confirm']) && isset($_POST['signup_submit']) ) ||
1803
- @intval($ct_options['general_contact_forms_test'])==0 ||
1804
- isset($_POST['bbp_topic_content']) ||
1805
- isset($_POST['bbp_reply_content']) ||
1806
- isset($_COOKIE[LOGGED_IN_COOKIE]) ||
1807
- isset($_POST['fscf_submitted']) ||
1808
- strpos($_SERVER['REQUEST_URI'],'/wc-api/')!==false ||
1809
- isset($_POST['log']) && isset($_POST['pwd']) && isset($_POST['wp-submit']) ||
1810
- isset($_POST[$ct_checkjs_frm]) && (@intval($ct_options['contact_forms_test']) == 1) // Formidable forms
1811
- ) {
1812
- return null;
1813
- }
1814
-
1815
- //@header("CtConditions: Passed");
1816
- cleantalk_debug("CtConditions", "Passed");
1817
-
1818
- $_POST=ct_filter_array($_POST);
1819
- //@header("CtFilterArray: Passed");
1820
- cleantalk_debug("CtFilterArray", "Passed");
1821
-
1822
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
1823
-
1824
- $post_info['comment_type'] = 'feedback_general_contact_form';
1825
- $post_info = json_encode($post_info);
1826
- if ($post_info === false) {
1827
- $post_info = '';
1828
- }
1829
-
1830
- $sender_email = '';
1831
- $sender_nickname = '';
1832
- $subject = '';
1833
- $contact_form = true;
1834
- $message = array();
1835
-
1836
- @ct_get_fields_any($sender_email, $message, $sender_nickname, $subject, $contact_form, $_POST);
1837
-
1838
- if ($subject != '') {
1839
- $message = array_merge(array('subject' => $subject), $message);
1840
- }
1841
- $message = json_encode($message);
1842
-
1843
- //@header("CtGetFieldsAny: Passed");
1844
- cleantalk_debug("CtGetFieldsAny", "Passed");
1845
- //@header("CtSenderEmail: $sender_email");
1846
- cleantalk_debug("CtSenderEmail", $sender_email);
1847
- if($contact_form)
1848
- {
1849
- //@header("CtContactForm: true");
1850
- cleantalk_debug("CtContactForm", "true");
1851
- }
1852
- else
1853
- {
1854
- //@header("CtContactForm: false");
1855
- cleantalk_debug("CtContactForm", "false");
1856
- }
1857
-
1858
-
1859
-
1860
- // Skip submission if no data found
1861
- if ($sender_email===''|| !$contact_form) {
1862
- return false;
1863
- }
1864
- $cleantalk_executed=true;
1865
-
1866
- if(isset($_POST['TellAFriend_Link']))
1867
- {
1868
- $tmp=$_POST['TellAFriend_Link'];
1869
- unset($_POST['TellAFriend_Link']);
1870
- }
1871
-
1872
- //@header("CtBaseCallBefore: 1");
1873
- cleantalk_debug("CtBaseCallBefore", "1");
1874
-
1875
-
1876
- $ct_base_call_result = ct_base_call(array(
1877
- 'message' => $message,
1878
- 'example' => null,
1879
- 'sender_email' => $sender_email,
1880
- 'sender_nickname' => $sender_nickname,
1881
- 'post_info' => $post_info,
1882
- 'sender_info' => get_sender_info(),
1883
- 'checkjs' => $checkjs
1884
- ));
1885
-
1886
- //@header("CtBaseCall: Executed");
1887
- cleantalk_debug("CtBaseCall", "Executed");
1888
-
1889
- if(isset($_POST['TellAFriend_Link']))
1890
- {
1891
- $_POST['TellAFriend_Link']=$tmp;
1892
- }
1893
-
1894
- $ct = $ct_base_call_result['ct'];
1895
- $ct_result = $ct_base_call_result['ct_result'];
1896
-
1897
- if ($ct_result->allow == 0) {
1898
- //@header("CtResult: Not Allow");
1899
- cleantalk_debug("CtResult", "Not Allow");
1900
-
1901
- $ajax_call = false;
1902
- if ((defined( 'DOING_AJAX' ) && DOING_AJAX)
1903
- ) {
1904
- $ajax_call = true;
1905
- }
1906
- if ($ajax_call) {
1907
- //@header("AJAX: Yes");
1908
- cleantalk_debug("AJAX", "Yes");
1909
- echo $ct_result->comment;
1910
- } else {
1911
- //@header("AJAX: No");
1912
- cleantalk_debug("AJAX", "No");
1913
- global $ct_comment;
1914
- $ct_comment = $ct_result->comment;
1915
- if(isset($_POST['cma-action'])&&$_POST['cma-action']=='add')
1916
- {
1917
- $result=Array('success'=>0, 'thread_id'=>null,'messages'=>Array($ct_result->comment));
1918
- header("Content-Type: application/json");
1919
- print json_encode($result);
1920
- die();
1921
- }
1922
- else if(isset($_POST['TellAFriend_email']))
1923
- {
1924
- echo $ct_result->comment;
1925
- die();
1926
- }
1927
- //
1928
- // Gravity forms submission
1929
- //
1930
- else if(isset($_POST['gform_submit']))
1931
- {
1932
- $response = sprintf("<!DOCTYPE html><html><head><meta charset='UTF-8' /></head><body class='GF_AJAX_POSTBACK'><div id='gform_confirmation_wrapper_1' class='gform_confirmation_wrapper '><div id='gform_confirmation_message_1' class='gform_confirmation_message_1
1933
- gform_confirmation_message'>%s</div></div></body></html>",
1934
- $ct_result->comment
1935
- );
1936
- echo $response;
1937
- die();
1938
- }
1939
- else
1940
- {
1941
- ct_die(null, null);
1942
- }
1943
- }
1944
- exit;
1945
- }
1946
- //@header("CtResult: Allow");
1947
- cleantalk_debug("CtResult", "Allow");
1948
-
1949
- return null;
1950
- }
1951
-
1952
- /**
1953
- * General test for any post data
1954
- */
1955
- function ct_contact_form_validate_postdata () {
1956
- global $pagenow,$cleantalk_executed, $cleantalk_url_exclusions, $ct_options, $ct_data;
1957
-
1958
- $ct_options = ct_get_options();
1959
- $ct_data = ct_get_data();
1960
-
1961
- if($cleantalk_executed)
1962
- {
1963
- return null;
1964
- }
1965
- if ((defined( 'DOING_AJAX' ) && DOING_AJAX))
1966
- {
1967
- return null;
1968
- }
1969
- if(isset($cleantalk_url_exclusions))
1970
- {
1971
- $ct_cnt=sizeof($cleantalk_url_exclusions);
1972
- }
1973
- else
1974
- {
1975
- $ct_cnt=0;
1976
- }
1977
- //@header("CtExclusions: ".$ct_cnt);
1978
- cleantalk_debug("CtExclusions", $ct_cnt);
1979
-
1980
- if (@sizeof($_POST)==0 ||
1981
- (isset($_POST['signup_username']) && isset($_POST['signup_email']) && isset($_POST['signup_password'])) ||
1982
- (isset($pagenow) && $pagenow == 'wp-login.php') || // WordPress log in form
1983
- (isset($pagenow) && $pagenow == 'wp-login.php' && isset($_GET['action']) && $_GET['action']=='lostpassword') ||
1984
- strpos($_SERVER['REQUEST_URI'],'/checkout/')!==false ||
1985
- strpos($_SERVER['REQUEST_URI'],'/wp-admin/')!==false ||
1986
- strpos($_SERVER['REQUEST_URI'],'wp-login.php')!==false||
1987
- strpos($_SERVER['REQUEST_URI'],'wp-comments-post.php')!==false ||
1988
- @strpos($_SERVER['HTTP_REFERER'],'/wp-admin/')!==false ||
1989
- strpos($_SERVER['REQUEST_URI'],'/login/')!==false||
1990
- isset($_GET['ptype']) && $_GET['ptype']=='login' ||
1991
- check_url_exclusions() ||
1992
- ct_check_array_keys($_POST) ||
1993
- isset($_POST['ct_checkjs_register_form']) ||
1994
- (isset($_POST['signup_username']) && isset($_POST['signup_password_confirm']) && isset($_POST['signup_submit']) ) ||
1995
- @intval($ct_options['general_contact_forms_test'])==0 ||
1996
- isset($_POST['bbp_topic_content']) ||
1997
- isset($_POST['bbp_reply_content']) ||
1998
- isset($_POST['fscf_submitted']) ||
1999
- isset($_POST['log']) && isset($_POST['pwd']) && isset($_POST['wp-submit'])||
2000
- strpos($_SERVER['REQUEST_URI'],'/wc-api/')!==false
2001
- ) {
2002
- return null;
2003
- }
2004
-
2005
- $_POST=ct_filter_array($_POST);
2006
-
2007
- $checkjs = js_test('ct_checkjs', $_COOKIE, true);
2008
-
2009
- $post_info['comment_type'] = 'feedback_general_postdata';
2010
- $post_info = json_encode($post_info);
2011
- if ($post_info === false) {
2012
- $post_info = '';
2013
- }
2014
-
2015
- @ct_get_fields_any_postdata($message, $_POST);
2016
-
2017
- $message = json_encode($message);
2018
-
2019
- if(strlen(trim($message))<10)
2020
- {
2021
- return null;
2022
- }
2023
- $skip_params = array(
2024
- 'ipn_track_id', // PayPal IPN #
2025
- 'txn_type', // PayPal transaction type
2026
- 'payment_status', // PayPal payment status
2027
- );
2028
-
2029
- foreach($skip_params as $key=>$value)
2030
- {
2031
- if(@array_key_exists($value,$_GET)||@array_key_exists($value,$_POST))
2032
- {
2033
- return null;
2034
- }
2035
- }
2036
-
2037
- $ct_base_call_result = ct_base_call(array(
2038
- 'message' => $message,
2039
- 'example' => null,
2040
- 'sender_email' => '',
2041
- 'sender_nickname' => '',
2042
- 'post_info' => $post_info,
2043
- 'sender_info' => get_sender_info(),
2044
- 'checkjs' => $checkjs
2045
- ));
2046
-
2047
- $cleantalk_executed=true;
2048
-
2049
- $ct = $ct_base_call_result['ct'];
2050
- $ct_result = $ct_base_call_result['ct_result'];
2051
-
2052
- if ($ct_result->allow == 0) {
2053
-
2054
- if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)) {
2055
- global $ct_comment;
2056
- $ct_comment = $ct_result->comment;
2057
- if(isset($_POST['cma-action'])&&$_POST['cma-action']=='add')
2058
- {
2059
- $result=Array('success'=>0, 'thread_id'=>null,'messages'=>Array($ct_result->comment));
2060
- header("Content-Type: application/json");
2061
- print json_encode($result);
2062
- die();
2063
- }
2064
- else
2065
- {
2066
- ct_die(null, null);
2067
- }
2068
- } else {
2069
- echo $ct_result->comment;
2070
- }
2071
- exit;
2072
- }
2073
-
2074
- return null;
2075
- }
2076
-
2077
-
2078
- /**
2079
- * Inner function - Finds and returns pattern in string
2080
- * @return null|bool
2081
- */
2082
- function ct_get_data_from_submit($value = null, $field_name = null) {
2083
- if (!$value || !$field_name || !is_string($value)) {
2084
- return false;
2085
- }
2086
- if (preg_match("/[a-z0-9_\-]*" . $field_name. "[a-z0-9_\-]*$/", $value)) {
2087
- return true;
2088
- }
2089
- }
2090
-
2091
- /**
2092
- * Sends error notice to admin
2093
- * @return null
2094
- */
2095
- function ct_send_error_notice ($comment = '') {
2096
- global $ct_plugin_name, $ct_admin_notoice_period;
2097
-
2098
- $timelabel_reg = intval( get_option('cleantalk_timelabel_reg') );
2099
- if(time() - $ct_admin_notoice_period > $timelabel_reg){
2100
- update_option('cleantalk_timelabel_reg', time());
2101
-
2102
- $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
2103
- $message = __('Attention, please!', 'cleantalk') . "\r\n\r\n";
2104
- $message .= sprintf(__('"%s" plugin error on your site %s:', 'cleantalk'), $ct_plugin_name, $blogname) . "\r\n\r\n";
2105
- $message .= $comment . "\r\n\r\n";
2106
- @wp_mail(get_option('admin_email'), sprintf(__('[%s] %s error!', 'cleantalk'), $ct_plugin_name, $blogname), $message);
2107
- }
2108
-
2109
- return null;
2110
- }
2111
-
2112
- function ct_print_form($arr,$k)
2113
- {
2114
- foreach($arr as $key=>$value)
2115
- {
2116
- if(!is_array($value))
2117
- {
2118
- if($k=='')
2119
- {
2120
- print '<textarea name="'.$key.'" style="display:none;">'.htmlspecialchars($value).'</textarea>';
2121
- }
2122
- else
2123
- {
2124
- print '<textarea name="'.$k.'['.$key.']" style="display:none;">'.htmlspecialchars($value).'</textarea>';
2125
- }
2126
- }
2127
- else
2128
- {
2129
- if($k=='')
2130
- {
2131
- ct_print_form($value,$key);
2132
- }
2133
- else
2134
- {
2135
- ct_print_form($value,$k.'['.$key.']');
2136
- }
2137
- }
2138
- }
2139
- }
2140
-
2141
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/inc/cleantalk-rel.js DELETED
@@ -1,11 +0,0 @@
1
- //< target : http://wp2.host/wp-admin/comment.php?c=26&action=approvecomment&_wpnonce=338ed90533
2
- //> target : http://wp2.host/wp-admin/comment.php?c=26&action=unapprovecomment&_wpnonce=338ed90533
3
-
4
- //< data : action=dim-comment&id=26&dimClass=unapproved&_ajax_nonce=338ed90533&new=approved
5
- //> data : action=dim-comment&id=26&dimClass=unapproved&_ajax_nonce=338ed90533&new=unapproved
6
-
7
- jQuery(document).ajaxSuccess(function(e, xhr, settings) {
8
- if(settings['target'].toString().indexOf('action=approvecomment') > -1){
9
- window.location.reload();
10
- }
11
- });
 
 
 
 
 
 
 
 
 
 
 
trunk/inc/cleantalk-sfw.class.php DELETED
@@ -1,157 +0,0 @@
1
- <?php
2
- class CleanTalkSFW
3
- {
4
- public $ip = 0;
5
- public $ip_str = '';
6
- public $ip_array = Array();
7
- public $ip_str_array = Array();
8
- public $blocked_ip = '';
9
- public $result = false;
10
-
11
- public function cleantalk_get_real_ip()
12
- {
13
- if ( function_exists( 'apache_request_headers' ) )
14
- {
15
- $headers = apache_request_headers();
16
- }
17
- else
18
- {
19
- $headers = $_SERVER;
20
- }
21
- if ( array_key_exists( 'X-Forwarded-For', $headers ) )
22
- {
23
- $the_ip=explode(",", trim($headers['X-Forwarded-For']));
24
- $the_ip = trim($the_ip[0]);
25
- $this->ip_str_array[]=$the_ip;
26
- $this->ip_array[]=sprintf("%u", ip2long($the_ip));
27
- }
28
- if ( array_key_exists( 'HTTP_X_FORWARDED_FOR', $headers ))
29
- {
30
- $the_ip=explode(",", trim($headers['HTTP_X_FORWARDED_FOR']));
31
- $the_ip = trim($the_ip[0]);
32
- $this->ip_str_array[]=$the_ip;
33
- $this->ip_array[]=sprintf("%u", ip2long($the_ip));
34
- }
35
- $the_ip = filter_var( $_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 );
36
- $this->ip_str_array[]=$the_ip;
37
- $this->ip_array[]=sprintf("%u", ip2long($the_ip));
38
-
39
- if(isset($_GET['sfw_test_ip']))
40
- {
41
- $the_ip=$_GET['sfw_test_ip'];
42
- $this->ip_str_array[]=$the_ip;
43
- $this->ip_array[]=sprintf("%u", ip2long($the_ip));
44
- }
45
- //$this->ip_str=$the_ip;
46
- //$this->ip=sprintf("%u", ip2long($the_ip));
47
- //print sprintf("%u", ip2long($the_ip));
48
- }
49
-
50
- public function check_ip()
51
- {
52
- global $wpdb,$ct_options, $ct_data;
53
- $passed_ip='';
54
- for($i=0;$i<sizeof($this->ip_array);$i++)
55
- {
56
- //print "select network from `".$wpdb->base_prefix."cleantalk_sfw` where ".$this->ip." & mask = network;";
57
- //$r = $wpdb->get_results("select network from `".$wpdb->base_prefix."cleantalk_sfw` where network = ".$this->ip." & mask;", ARRAY_A);
58
- $r = $wpdb->get_results("select network from `".$wpdb->base_prefix."cleantalk_sfw` where network = ".$this->ip_array[$i]." & mask;", ARRAY_A);
59
-
60
- if(isset($ct_data['sfw_log']))
61
- {
62
- $sfw_log=$ct_data['sfw_log'];
63
- }
64
- else
65
- {
66
- $sfw_log=array();
67
- }
68
-
69
- if(sizeof($r)>0)
70
- {
71
- $this->result=true;
72
- $this->blocked_ip=$this->ip_str_array[$i];
73
- if(isset($sfw_log[$this->ip_str_array[$i]]))
74
- {
75
- $sfw_log[$this->ip_str_array[$i]]['all']++;
76
- }
77
- else
78
- {
79
- $sfw_log[$this->ip_str_array[$i]] = Array('datetime'=>time(), 'all' => 1, 'allow' => 0);
80
- }
81
- }
82
- else
83
- {
84
- //$sfw_log[$this->ip_str]['allow']++;
85
- //@setcookie ('ct_sfw_pass_key', md5($this->ip_str.$ct_options['apikey']), 0, "/");
86
- $passed_ip = $this->ip_str_array[$i];
87
- }
88
- //if($this->result)break;
89
- }
90
- if($passed_ip!='')
91
- {
92
- @setcookie ('ct_sfw_pass_key', md5($passed_ip.$ct_options['apikey']), 0, "/");
93
- }
94
- $ct_data['sfw_log'] = $sfw_log;
95
- update_option('cleantalk_data', $ct_data);
96
- }
97
-
98
- public function sfw_die()
99
- {
100
- global $ct_options, $ct_data;
101
- $sfw_die_page=file_get_contents(dirname(__FILE__)."/sfw_die_page.html");
102
- $sfw_die_page=str_replace("{REMOTE_ADDRESS}",$this->blocked_ip,$sfw_die_page);
103
- $sfw_die_page=str_replace("{REQUEST_URI}",$_SERVER['REQUEST_URI'],$sfw_die_page);
104
- $sfw_die_page=str_replace("{SFW_COOKIE}",md5($this->blocked_ip.$ct_options['apikey']),$sfw_die_page);
105
- @header('Cache-Control: no-cache');
106
- @header('Expires: 0');
107
- @header('HTTP/1.0 403 Forbidden');
108
- wp_die( $sfw_die_page, "Blacklisted", Array('response'=>403) );
109
- }
110
-
111
- public function send_logs()
112
- {
113
- global $ct_options, $ct_data;
114
- $ct_options = ct_get_options();
115
- $ct_data = ct_get_data();
116
-
117
- if(isset($ct_options['spam_firewall']))
118
- {
119
- $value = @intval($ct_options['spam_firewall']);
120
- }
121
- else
122
- {
123
- $value=0;
124
- }
125
-
126
- if($value==1 && isset($ct_data['sfw_log']))
127
- {
128
- $sfw_log=$ct_data['sfw_log'];
129
- $data=Array();
130
- foreach($sfw_log as $key=>$value)
131
- {
132
- $data[]=Array($key, $value['all'], $value['allow'], $value['datetime']);
133
- }
134
- $qdata = array (
135
- 'data' => json_encode($data),
136
- 'rows' => count($data),
137
- 'timestamp' => time()
138
- );
139
- if(!function_exists('sendRawRequest'))
140
- {
141
- require_once('cleantalk.class.php');
142
- }
143
-
144
- $result = sendRawRequest('https://api.cleantalk.org/?method_name=sfw_logs&auth_key='.$ct_options['apikey'],$qdata);
145
- $result = json_decode($result);
146
- if(isset($result->data) && isset($result->data->rows))
147
- {
148
- if($result->data->rows == count($data))
149
- {
150
- $ct_data['sfw_log']=Array();
151
- update_option('cleantalk_data', $ct_data);
152
- }
153
- }
154
-
155
- }
156
- }
157
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/inc/cleantalk-sfw.php DELETED
@@ -1,42 +0,0 @@
1
- <?php
2
-
3
- $ip=(int)sprintf("%u", ip2long(cleantalk_get_ip()));
4
- $ip_str=cleantalk_get_ip();
5
- //$ip=(int)sprintf("%u", ip2long("2.11.242.8"));
6
- if(isset($_GET['sfw_test_ip']))
7
- {
8
- $ip=(int)sprintf("%u", ip2long($_GET['sfw_test_ip']));
9
- $ip_str=$_GET['sfw_test_ip'];
10
- }
11
-
12
- global $wpdb;
13
- $r = $wpdb->get_results("select * from `".$wpdb->base_prefix."cleantalk_sfw` where $ip & mask = network & mask;", ARRAY_A);
14
- if(sizeof($r)>0)
15
- {
16
- global $ct_options, $ct_data;
17
- $sfw_die_page=file_get_contents(dirname(__FILE__)."/sfw_die_page.html");
18
- $sfw_die_page=str_replace("{REMOTE_ADDRESS}",$ip_str,$sfw_die_page);
19
- $sfw_die_page=str_replace("{REQUEST_URI}",$_SERVER['REQUEST_URI'],$sfw_die_page);
20
- $sfw_die_page=str_replace("{SFW_COOKIE}",md5(cleantalk_get_ip().$ct_options['apikey']),$sfw_die_page);
21
- if(isset($ct_data['sfw_log']))
22
- {
23
- $sfw_log=$ct_data['sfw_log'];
24
- }
25
- else
26
- {
27
- $sfw_log=array();
28
- }
29
- if(isset($sfw_log[$r[0]['network']]))
30
- {
31
- $sfw_log[$r[0]['network']]['block']++;
32
- }
33
- else
34
- {
35
- $sfw_log[$r[0]['network']] = Array('block' => 1, 'allow' => 0);
36
- }
37
- $ct_data['sfw_log'] = $sfw_log;
38
- update_option('cleantalk_data', $ct_data);
39
- wp_die( $sfw_die_page, "Blacklisted", Array('response'=>403) );
40
- }
41
-
42
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/inc/cleantalk-users-checkspam.js DELETED
@@ -1,267 +0,0 @@
1
- var working=false;
2
-
3
- String.prototype.format = String.prototype.f = function ()
4
- {
5
- var args = arguments;
6
- return this.replace(/\{\{|\}\}|\{(\d+)\}/g, function (m, n)
7
- {
8
- if (m == "{{") { return "{"; }
9
- if (m == "}}") { return "}"; }
10
- return args[n];
11
- });
12
- };
13
-
14
- var close_animate=true;
15
- function animate_comment(to,id)
16
- {
17
- if(close_animate)
18
- {
19
- if(to==0.3)
20
- {
21
- jQuery('#comment-'+id).fadeTo(200,to,function(){
22
- animate_comment(1,id)
23
- });
24
- }
25
- else
26
- {
27
- jQuery('#comment-'+id).fadeTo(200,to,function(){
28
- animate_comment(0.3,id)
29
- });
30
- }
31
- }
32
- else
33
- {
34
- close_animate=true;
35
- }
36
- }
37
-
38
- function ct_clear_users()
39
- {
40
- var data = {
41
- 'action': 'ajax_clear_users',
42
- 'security': ajax_nonce
43
- };
44
-
45
- jQuery.ajax({
46
- type: "POST",
47
- url: ajaxurl,
48
- data: data,
49
- success: function(msg){
50
- ct_send_users();
51
- }
52
- });
53
- }
54
-
55
- function ct_send_users()
56
- {
57
- var data = {
58
- 'action': 'ajax_check_users',
59
- 'security': ajax_nonce
60
- };
61
-
62
- jQuery.ajax({
63
- type: "POST",
64
- url: ajaxurl,
65
- data: data,
66
- success: function(msg){
67
- if(parseInt(msg)==1)
68
- {
69
- ct_send_users();
70
- }
71
- else if(parseInt(msg)==0)
72
- {
73
- working=false;
74
- jQuery('#ct_working_message').hide();
75
- //alert('finish!');
76
- location.href='users.php?page=ct_check_users';
77
- }
78
- else
79
- {
80
- working=false;
81
- alert(msg);
82
- }
83
- }
84
- });
85
- }
86
- function ct_show_users_info()
87
- {
88
- if(working)
89
- {
90
- var data = {
91
- 'action': 'ajax_info_users',
92
- 'security': ajax_nonce
93
- };
94
- jQuery.ajax({
95
- type: "POST",
96
- url: ajaxurl,
97
- data: data,
98
- success: function(msg){
99
- jQuery('#ct_checking_users_status').html(msg);
100
- setTimeout(ct_show_users_info, 1000);
101
- }
102
- });
103
- }
104
- }
105
- function ct_insert_users()
106
- {
107
- var data = {
108
- 'action': 'ajax_insert_users',
109
- 'security': ajax_nonce
110
- };
111
-
112
- jQuery.ajax({
113
- type: "POST",
114
- url: ajaxurl,
115
- data: data,
116
- success: function(msg){
117
- alert('Inserted ' + msg + ' users.');
118
- }
119
- });
120
- }
121
- function ct_delete_all_users()
122
- {
123
- var data = {
124
- 'action': 'ajax_delete_all_users',
125
- 'security': ajax_nonce
126
- };
127
-
128
- jQuery.ajax({
129
- type: "POST",
130
- url: ajaxurl,
131
- data: data,
132
- success: function(msg){
133
- if(msg>0)
134
- {
135
- jQuery('#cleantalk_users_left').html(msg);
136
- ct_delete_all_users();
137
- }
138
- else
139
- {
140
- location.href='users.php?page=ct_check_users';
141
- }
142
- }
143
- });
144
- }
145
- function ct_delete_checked_users()
146
- {
147
- ids=Array();
148
- var cnt=0;
149
- jQuery('input[id^=cb-select-][id!=cb-select-all-1]').each(function(){
150
- if(jQuery(this).prop('checked'))
151
- {
152
- ids[cnt]=jQuery(this).attr('id').substring(10);
153
- cnt++;
154
- }
155
- });
156
- var data = {
157
- 'action': 'ajax_delete_checked_users',
158
- 'security': ajax_nonce,
159
- 'ids':ids
160
- };
161
-
162
- jQuery.ajax({
163
- type: "POST",
164
- url: ajaxurl,
165
- data: data,
166
- success: function(msg){
167
- location.href='users.php?page=ct_check_users';
168
- //alert(msg);
169
- }
170
- });
171
- return false;
172
- }
173
-
174
- jQuery(".cleantalk_delete_user_button").click(function(){
175
- id = jQuery(this).attr("data-id");
176
- ids=Array();
177
- ids[0]=id;
178
- var data = {
179
- 'action': 'ajax_delete_checked_users',
180
- 'security': ajax_nonce,
181
- 'ids':ids
182
- };
183
- jQuery.ajax({
184
- type: "POST",
185
- url: ajaxurl,
186
- data: data,
187
- success: function(msg){
188
- close_animate=false;
189
- jQuery("#comment-"+id).hide();
190
- jQuery("#comment-"+id).remove();
191
- close_animate=true;
192
- }
193
- });
194
- });
195
- jQuery(".cleantalk_delete_user_button").click(function(){
196
- id = jQuery(this).attr("data-id");
197
- animate_comment(0.3, id);
198
- });
199
-
200
- jQuery("#ct_check_users_button").click(function(){
201
- jQuery('#ct_working_message').show();
202
- jQuery('#ct_check_users_button').hide();
203
- jQuery('#ct_info_message').hide();
204
- working=true;
205
- ct_clear_users();
206
- });
207
- jQuery("#ct_check_users_button").click(function(){
208
-
209
- // jQuery('#ct_checking_users_status').html('');
210
- jQuery('#ct_check_users_table').hide();
211
- jQuery('#ct_delete_all_users').hide();
212
- jQuery('#ct_delete_checked_users').hide();
213
- jQuery('#ct_preloader').show();
214
- working=true;
215
- ct_show_users_info();
216
- });
217
- jQuery("#ct_insert_users").click(function(){
218
- ct_insert_users();
219
- });
220
-
221
- jQuery("#ct_stop_deletion").click(function(){
222
- window.location.reload();
223
- });
224
- jQuery("#ct_delete_all_users").click(function(){
225
- if (!confirm('Delete all spam users?')) {
226
- return false;
227
- }
228
-
229
- jQuery('#ct_checking_users_status').hide();
230
- jQuery('#ct_check_users_table').hide();
231
- jQuery('#ct_tools_buttons').hide();
232
- jQuery('#ct_info_message').hide();
233
- jQuery('#ct_ajax_info_users').hide();
234
- jQuery('#ct_check_users_table').hide();
235
- jQuery('#ct_check_users_button').hide();
236
- jQuery('#ct_search_info').hide();
237
- jQuery('#ct_deleting_message').show();
238
- jQuery('#ct_preloader').show();
239
- jQuery('#ct_stop_deletion').show();
240
- jQuery("html, body").animate({ scrollTop: 0 }, "slow");
241
- ct_delete_all_users();
242
- });
243
- jQuery("#ct_delete_checked_users").click(function(){
244
- if (!confirm('Delete selected users?')) {
245
- return false;
246
- }
247
-
248
- ct_delete_checked_users();
249
- });
250
- jQuery(".cleantalk_user").mouseover(function(){
251
- id = jQuery(this).attr("data-id");
252
- jQuery("#cleantalk_delete_user_"+id).show();
253
- });
254
- jQuery(".cleantalk_user").mouseout(function(){
255
- id = jQuery(this).attr("data-id");
256
- jQuery("#cleantalk_delete_user_"+id).hide();
257
- });
258
-
259
- jQuery(document).ready(function(){
260
- working=true;
261
- ct_show_users_info();
262
- working=false;
263
- if(location.href.match(/do_check/))
264
- {
265
- jQuery("#ct_check_users_button").click();
266
- }
267
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/inc/cleantalk-users-editscreen.js DELETED
@@ -1,17 +0,0 @@
1
- jQuery('#changeit').after(' <a href="users.php?page=ct_check_users" class="button" style="margin-top:1px;">'+spambutton_users_text+'</a>');
2
- jQuery("#ct_check_users_button").click(function(){
3
- var data = {
4
- 'action': 'ajax_check_users',
5
- security: ajax_nonce
6
- };
7
-
8
- jQuery.ajax({
9
- type: "POST",
10
- url: ajaxurl,
11
- data: data,
12
- success: function(msg){
13
- alert(msg);
14
- }
15
- });
16
-
17
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/inc/cleantalk-users.php DELETED
@@ -1,455 +0,0 @@
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()
13
- {
14
- global $ct_plugin_name;
15
- ?>
16
- <div class="wrap">
17
- <h2><?php echo $ct_plugin_name; ?></h2><br />
18
- <?php
19
- global $wpdb;
20
- $r=$wpdb->get_results("select distinct count($wpdb->users.ID) as cnt from $wpdb->users inner join $wpdb->usermeta on $wpdb->users.ID=$wpdb->usermeta.user_id where $wpdb->usermeta.meta_key='ct_checked' or $wpdb->usermeta.meta_key='ct_hash';");
21
- $cnt_checked=$r[0]->cnt;
22
- $r=$wpdb->get_results("select count(ID) as cnt from $wpdb->users;");
23
- $cnt_all=$r[0]->cnt;
24
-
25
- $cnt_unchecked=$cnt_all-$cnt_checked;
26
- /*$args_spam = array(
27
- 'meta_query' => array(
28
- Array(
29
- 'key' => 'ct_marked_as_spam',
30
- 'compare' => 'EXISTS'
31
- )
32
- )
33
- );*/
34
- $r=$wpdb->get_results("select distinct count($wpdb->users.ID) as cnt from $wpdb->users inner join $wpdb->usermeta on $wpdb->users.ID=$wpdb->usermeta.user_id where $wpdb->usermeta.meta_key='ct_marked_as_spam';", ARRAY_A);
35
- $cnt_spam1=$r[0]['cnt'];
36
- ?>
37
- <div id="ct_deleting_message" style="display:none">
38
- <?php _e("Please wait for a while. CleanTalk is deleting spam users. Users left: ", 'cleantalk'); ?> <span id="cleantalk_users_left">
39
- <?php echo $cnt_spam1;?>
40
- </span>
41
- </div>
42
- <div id="ct_done_message" <?php if($cnt_unchecked>0) print 'style="display:none"'; ?>>
43
- <?php //_e("Done. All comments tested via blacklists database, please see result bellow.", 'cleantalk');
44
- ?>
45
- </div>
46
- <h3 id="ct_checking_users_status" style="text-align:center;width:90%;"></h3>
47
- <div style="text-align:center;width:100%;display:none;" id="ct_preloader"><img border=0 src="<?php print plugin_dir_url(__FILE__); ?>images/preloader.gif" /></div>
48
- <div id="ct_working_message" style="margin:auto;padding:3px;width:70%;border:2px dotted gray;display:none;background:#ffff99;margin-top: 1em;">
49
- <?php _e("Please wait for a while. CleanTalk is checking all users via blacklist database at cleantalk.org. You will have option to delete found spam users after plugin finish.", 'cleantalk'); ?>
50
- </div>
51
- <?php
52
- $page=1;
53
- if(isset($_GET['spam_page']))
54
- {
55
- $page=intval($_GET['spam_page']);
56
- }
57
- $args_spam = array(
58
- 'meta_query' => array(
59
- Array(
60
- 'key' => 'ct_marked_as_spam',
61
- 'value' => '1',
62
- 'compare' => 'NUMERIC'
63
- )
64
- ),
65
- 'number'=>30,
66
- 'offset'=>($page-1)*30
67
- );
68
-
69
- $c_spam=get_users($args_spam);
70
- if($cnt_spam1>0)
71
- {
72
- ?>
73
- <table class="widefat fixed comments" id="ct_check_users_table">
74
- <thead>
75
- <th scope="col" id="cb" class="manage-column column-cb check-column">
76
- <label class="screen-reader-text" for="cb-select-all-1">Select All</label>
77
- <input id="cb-select-all-1" type="checkbox"/>
78
- </th>
79
- <th scope="col" id="author" class="manage-column column-slug"><?php print _e('Username');?></th>
80
- <th scope="col" id="comment" class="manage-column column-comment"><?php print _x( 'Name', 'column name' );;?></th>
81
- <th scope="col" id="response" class="manage-column column-comment"><?php print _x( 'E-mail', 'column name' );?></th>
82
- <th scope="col" id="role" class="manage-column column-response sortable desc"><?php print _x( 'Role', 'column name' );?></th>
83
- <th scope="col" id="posts" class="manage-column column-response sortable desc"><?php print _x( 'Posts', 'column name' );?></th>
84
- </thead>
85
- <tbody id="the-comment-list" data-wp-lists="list:comment">
86
- <?php
87
- for($i=0;$i<sizeof($c_spam);$i++)
88
- {
89
- ?>
90
- <tr id="comment-<?php print $c_spam[$i]->ID; ?>" class="comment even thread-even depth-1 approved cleantalk_user" data-id="<?php print $c_spam[$i]->ID; ?>">
91
- <th scope="row" class="check-column">
92
- <label class="screen-reader-text" for="cb-select-<?php print $c_spam[$i]->ID; ?>">Select user</label>
93
- <input id="cb-select-<?php print $c_spam[$i]->ID; ?>" type="checkbox" name="del_comments[]" value="<?php print $c_spam[$i]->comment_ID; ?>"/>
94
- </th>
95
- <td class="author column-author" nowrap>
96
- <strong>
97
- <?php echo get_avatar( $c_spam[$i]->data->user_email , 32); ?>
98
- <?php print $c_spam[$i]->data->user_login; ?>
99
- </strong>
100
- <br/>
101
- <a href="mailto:<?php print $c_spam[$i]->data->user_email; ?>"><?php print $c_spam[$i]->data->user_email; ?></a> <a href="https://cleantalk.org/blacklists/<?php print $c_spam[$i]->data->user_email ; ?>" target="_blank"><img src="https://cleantalk.ru/images/icons/new_window.gif" border="0" style="float:none"/></a>
102
- <br/>
103
- <?php
104
- $user_meta=get_user_meta($c_spam[$i]->ID, 'session_tokens', true);
105
- if(is_array($user_meta))
106
- {
107
- $user_meta=array_values($user_meta);
108
- }
109
- $ip='';
110
- if(@isset($user_meta[0]['ip']))
111
- {
112
- $ip=$user_meta[0]['ip'];
113
- ?>
114
- <a href="user-edit.php?user_id=<?php print $c_spam[$i]->ID ; ?>"><?php print $ip ; ?></a>
115
- <a href="https://cleantalk.org/blacklists/<?php print $ip ; ?>" target="_blank"><img src="https://cleantalk.ru/images/icons/new_window.gif" border="0" style="float:none"/></a>
116
- <?php
117
- }
118
- ?>
119
- </td>
120
- <td class="comment column-comment">
121
- <div class="submitted-on">
122
- <?php print $c_spam[$i]->data->display_name; ?>
123
- <div style="height:16px;">
124
- <a href="#" class="cleantalk_delete_user_button" id="cleantalk_delete_user_<?php print $c_spam[$i]->ID; ?>" data-id="<?php print $c_spam[$i]->ID; ?>" style="color:#a00;display:none;" onclick="return false;">Delete</a>
125
- </div>
126
- </div>
127
- </td>
128
- <td class="comment column-comment">
129
- <?php print $c_spam[$i]->data->user_email; ?>
130
- </td>
131
- <td class="comment column-comment">
132
- <?php
133
- $info=get_userdata( $c_spam[$i]->ID );
134
- print implode(', ', $info->roles);
135
- ?>
136
- </td>
137
- <td class="comment column-comment">
138
- <?php
139
- print count_user_posts($c_spam[$i]->ID);
140
- ?>
141
- </td>
142
- </tr>
143
- <?php
144
- }
145
- if($cnt_spam1>30)
146
- {
147
- ?>
148
- <tr class="comment even thread-even depth-1 approved">
149
- <td colspan="4">
150
- <?php
151
-
152
- $pages=ceil(intval($cnt_spam1)/30);
153
- for($i=1;$i<=$pages;$i++)
154
- {
155
- if($i==$page)
156
- {
157
- print "<a href='users.php?page=ct_check_users&spam_page=$i'><b>$i</b></a> ";
158
- }
159
- else
160
- {
161
- print "<a href='users.php?page=ct_check_users&spam_page=$i'>$i</a> ";
162
- }
163
- }
164
- ?>
165
- </td>
166
- </tr>
167
- <?php
168
- }
169
- ?>
170
- </tbody>
171
- </table>
172
- <div id="ct_tools_buttons">
173
- <button class="button" id="ct_delete_all_users"><?php _e('Delete all users from list'); ?></button>
174
- <button class="button" id="ct_delete_checked_users"><?php _e('Delete selected', 'cleantalk'); ?></button>
175
- <?php
176
- }
177
- if($_SERVER['REMOTE_ADDR']=='127.0.0.1')print '<button class="button" id="ct_insert_users">Insert accounts</button><br />';
178
- ?>
179
- </div>
180
- <br /><br />
181
- <table>
182
- <tr>
183
- <td>
184
- <button class="button" id="ct_check_users_button"><?php _e("Check for spam again", 'cleantalk'); ?></button>
185
- </td>
186
- <td style="padding-left: 2em;">
187
- <div id="ct_info_message" class="wrap"><?php _e("The plugin will check all users against blacklists database and show you senders that have spam activity on other websites. Just click 'Find spam users' to start.", 'cleantalk'); ?>
188
- </td>
189
- </tr>
190
- </table>
191
- <?php
192
- if($cnt_spam1>0)
193
- {
194
- print "
195
- <div id=\"ct_search_info\">
196
- <br />
197
- There is some differencies between blacklists database and our API mechanisms. Blacklists shows all history of spam activity, but our API (that used in spam checking) used another parameters, too: last day of activity, number of spam attacks during last days etc. This mechanisms help us to reduce number of false positivitie. So, there is nothing strange, if some emails/IPs will be not found by this checking.
198
- </div>";
199
- }
200
- ?>
201
-
202
- </div>
203
-
204
- <div>
205
- <button class="button" id="ct_stop_deletion" style="display:none;"><?php _e("Stop deletion", 'cleantalk'); ?></button>
206
- </div>
207
- <?php
208
- }
209
-
210
- add_action('admin_print_footer_scripts','ct_add_users_button');
211
- function ct_add_users_button()
212
- {
213
- global $cleantalk_plugin_version;
214
-
215
- $screen = get_current_screen();
216
- $ajax_nonce = wp_create_nonce( "ct_secret_nonce" );
217
- ?>
218
- <script>
219
- var ajax_nonce='<?php echo $ajax_nonce; ?>';
220
- var spambutton_users_text='<?php _e("Find spam users", 'cleantalk'); ?>';
221
- </script>
222
- <?php
223
- if( $screen->id == 'users' ){
224
- ?>
225
- <script src="<?php print plugins_url( 'cleantalk-users-editscreen.js?v=' . $cleantalk_plugin_version, __FILE__ ); ?>"></script>
226
- <?php
227
- }
228
- if($screen->id == 'users_page_ct_check_users')
229
- {
230
- ?>
231
- <script src="<?php print plugins_url( 'cleantalk-users-checkspam.js?v=' . $cleantalk_plugin_version, __FILE__ ); ?>"></script>
232
- <?php
233
- }
234
- }
235
-
236
-
237
- add_action( 'wp_ajax_ajax_check_users', 'ct_ajax_check_users' );
238
-
239
- function ct_ajax_check_users()
240
- {
241
- global $ct_options;
242
-
243
- check_ajax_referer('ct_secret_nonce', 'security');
244
-
245
- $ct_options = ct_get_options();
246
-
247
- $skip_roles = array(
248
- 'administrator'
249
- );
250
-
251
- $args_unchecked = array(
252
- 'meta_query' => array(
253
- Array(
254
- 'key' => 'ct_checked',
255
- 'value' => '1',
256
- 'compare' => 'NOT EXISTS'
257
- ),
258
- ),
259
- 'number' => 100
260
- );
261
-
262
- $u=get_users($args_unchecked);
263
-
264
- if(sizeof($u)>0)
265
- {
266
- $data=Array();
267
- for($i=0;$i<sizeof($u);$i++)
268
- {
269
- $user_meta=get_user_meta($u[$i]->ID, 'session_tokens', true);
270
- if(is_array($user_meta))
271
- {
272
- $user_meta=array_values($user_meta);
273
- }
274
- if(isset($user_meta[0]['ip']))
275
- {
276
- $data[]=$user_meta[0]['ip'];
277
- $u[$i]->data->user_ip = $user_meta[0]['ip'];
278
- } else {
279
- $u[$i]->data->user_ip = null;
280
- }
281
- $data[]=$u[$i]->data->user_email;
282
- }
283
- $data=implode(',',$data);
284
-
285
- $request="data=$data";
286
-
287
- $opts = array(
288
- 'http'=>array(
289
- 'method'=>"POST",
290
- 'content'=>$request,
291
- )
292
- );
293
-
294
- $context = stream_context_create($opts);
295
-
296
- $url = sprintf("https://api.cleantalk.org/?method_name=spam_check&auth_key=%s",
297
- $ct_options['apikey']
298
- );
299
- $result = file_get_contents($url, 0, $context);
300
-
301
- $result=json_decode($result);
302
- if(isset($result->error_message))
303
- {
304
- print $result->error_message;
305
- }
306
- else
307
- {
308
- for($i=0;$i<sizeof($u);$i++)
309
- {
310
- update_user_meta($u[$i]->ID,'ct_checked',date("Y-m-d H:m:s"),true);
311
- //
312
- // Do not display forbidden roles.
313
- //
314
- $skip_user = false;
315
- foreach ($skip_roles as $role) {
316
- if (!$skip_user && in_array($role, $u[$i]->roles)) {
317
- delete_user_meta($u[$i]->ID, 'ct_marked_as_spam');
318
- $skip_user = true;
319
- continue;
320
- }
321
- }
322
- if ($skip_user) {
323
- continue;
324
- }
325
-
326
- $uip = $u[$i]->data->user_ip;
327
- $uim = $u[$i]->data->user_email;
328
-
329
- if((isset($result->data->$uip) && $result->data->$uip->appears==1) || (isset($result->data->$uim) && $result->data->$uim->appears==1))
330
- {
331
- update_user_meta($u[$i]->ID,'ct_marked_as_spam','1',true);
332
- }
333
- }
334
- print 1;
335
- }
336
- }
337
- else
338
- {
339
- print 0;
340
- }
341
-
342
- die;
343
- }
344
-
345
- add_action( 'wp_ajax_ajax_info_users', 'ct_ajax_info_users' );
346
- function ct_ajax_info_users()
347
- {
348
- check_ajax_referer( 'ct_secret_nonce', 'security' );
349
- global $wpdb;
350
- $r=$wpdb->get_results("select distinct count($wpdb->users.ID) as cnt from $wpdb->users inner join $wpdb->usermeta on $wpdb->users.ID=$wpdb->usermeta.user_id where $wpdb->usermeta.meta_key='ct_checked' or $wpdb->usermeta.meta_key='ct_hash';");
351
- $cnt_checked=$r[0]->cnt;
352
- $r=$wpdb->get_results("select count(ID) as cnt from $wpdb->users;");
353
- $cnt=$r[0]->cnt;
354
-
355
- $cnt_unchecked=$cnt_all-$cnt_checked;
356
-
357
- $r=$wpdb->get_results("select distinct count($wpdb->users.ID) as cnt from $wpdb->users inner join $wpdb->usermeta on $wpdb->users.ID=$wpdb->usermeta.user_id where $wpdb->usermeta.meta_key='ct_marked_as_spam';", ARRAY_A);
358
- $cnt_spam1=$r[0]['cnt'];
359
-
360
- printf (__("Total users %s, checked %s, found %s spam users", 'cleantalk'), $cnt, $cnt_checked, $cnt_spam1);
361
- $backup_notice = '&nbsp;';
362
- if ($cnt_spam1 > 0) {
363
- $backup_notice = __("Please do backup of WordPress database before delete any accounts!", 'cleantalk');
364
- }
365
- print "<p>$backup_notice</p>";
366
-
367
- die();
368
- }
369
-
370
- add_action( 'wp_ajax_ajax_insert_users', 'ct_ajax_insert_users' );
371
- function ct_ajax_insert_users()
372
- {
373
- check_ajax_referer( 'ct_secret_nonce', 'security' );
374
-
375
- $inserted = 0;
376
- $use_id = 0;
377
- for($i=0; $i<5000 ;$i++)
378
- {
379
- $rnd=mt_rand(1,10000000);
380
-
381
- $user_name = "user_$rnd";
382
- $email="stop_email_$rnd@example.com";
383
-
384
- $user_id = wp_create_user(
385
- $user_name,
386
- $email,
387
- rand()
388
- );
389
-
390
- if (is_int($user_id)) {
391
- $inserted++;
392
- } else {
393
- error_log(print_r($user_id, true));
394
- }
395
- }
396
-
397
- print "$inserted";
398
- die();
399
- }
400
-
401
- add_action( 'wp_ajax_ajax_delete_checked_users', 'ct_ajax_delete_checked_users' );
402
- function ct_ajax_delete_checked_users()
403
- {
404
- check_ajax_referer( 'ct_secret_nonce', 'security' );
405
- foreach($_POST['ids'] as $key=>$value)
406
- {
407
- wp_delete_user($value);
408
- }
409
- die();
410
- }
411
-
412
- add_action( 'wp_ajax_ajax_delete_all_users', 'ct_ajax_delete_all_users' );
413
- function ct_ajax_delete_all_users()
414
- {
415
- check_ajax_referer( 'ct_secret_nonce', 'security' );
416
- $args_spam = array(
417
- 'number' => 100,
418
- 'meta_query' => array(
419
- Array(
420
- 'key' => 'ct_marked_as_spam',
421
- 'value' => '1',
422
- 'compare' => 'NUMERIC'
423
- )
424
- )
425
- );
426
- $c_spam=get_users($args_spam);
427
- $cnt=sizeof($c_spam);
428
-
429
- $args = array(
430
- 'meta_key' => 'ct_marked_as_spam',
431
- 'meta_value' => '1',
432
- 'meta_comparecompare' => 'NUMERIC'
433
- );
434
-
435
- $user_query = new WP_User_Query( $args );
436
- $cnt_all = $user_query->get_total();
437
-
438
- for($i=0;$i<sizeof($c_spam);$i++)
439
- {
440
- wp_delete_user($c_spam[$i]->ID);
441
- usleep(5000);
442
- }
443
- print $cnt_all;
444
- die();
445
- }
446
-
447
- add_action( 'wp_ajax_ajax_clear_users', 'ct_ajax_clear_users' );
448
- function ct_ajax_clear_users()
449
- {
450
- check_ajax_referer( 'ct_secret_nonce', 'security' );
451
- global $wpdb;
452
- $wpdb->query("delete from $wpdb->usermeta where meta_key='ct_hash' or meta_key='ct_checked' or meta_key='ct_marked_as_spam';");
453
- die();
454
- }
455
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/inc/cleantalk-widget.php DELETED
@@ -1,87 +0,0 @@
1
- <?php
2
-
3
- class cleantalk_widget extends WP_Widget
4
- {
5
-
6
- function __construct()
7
- {
8
- parent::__construct(
9
- // Base ID of your widget
10
- 'cleantalk_widget',
11
-
12
- // Widget name will appear in UI
13
- __('CleanTalk Widget', 'cleantalk'),
14
-
15
- // Widget description
16
- array( 'description' => __( 'CleanTalk widget', 'cleantalk' ), )
17
- );
18
- }
19
-
20
- // Creating widget front-end
21
- // This is where the action happens
22
- public function widget( $args, $instance )
23
- {
24
- $title = apply_filters( 'widget_title', $instance['title'] );
25
- // before and after widget arguments are defined by themes
26
- echo $args['before_widget'];
27
- if ( ! empty( $title ) )
28
- {
29
- echo $args['before_title'] . $title . $args['after_title'];
30
- }
31
- global $ct_data;
32
- $ct_data=ct_get_data();
33
- if(!isset($ct_data['admin_blocked']))
34
- {
35
- $blocked=0;
36
- }
37
- else
38
- {
39
- $blocked=$ct_data['admin_blocked'];
40
- }
41
- $blocked = number_format($blocked, 0, ',', ' ');
42
-
43
- // This is where you run the code and display the output
44
- ?>
45
- <div style="width:auto;">
46
- <a href="http://cleantalk.org" target="_blank" title="" style="background: #3090C7; background-image: -moz-linear-gradient(0% 100% 90deg,#2060a7,#3090C7); background-image: -webkit-gradient(linear,0% 0,0% 100%,from(#3090C7),to(#2060A7)); border: 1px solid #33eeee; border-radius: 5px; color: #AFCA63; cursor: pointer; display: block; font-weight: normal; height: 100%; -moz-border-radius: 5px; padding: 5px 0 5px; text-align: center; text-decoration: none; -webkit-border-radius: 5px; width: 100%;"><strong style="color: #FFF;display: block;font-size: 15px; line-height: 16px; padding: 0 13px; white-space: nowrap;"><b><?php print $blocked; ?></b> spam</strong> blocked by <strong>CleanTalk</strong></a>
47
- </div>
48
- <?php
49
- echo $args['after_widget'];
50
- }
51
-
52
- // Widget Backend
53
- public function form( $instance )
54
- {
55
- if ( isset( $instance[ 'title' ] ) )
56
- {
57
- $title = $instance[ 'title' ];
58
- }
59
- else
60
- {
61
- $title = __( 'Spam blocked', 'cleantalk' );
62
- }
63
- // Widget admin form
64
- ?>
65
- <p>
66
- <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
67
- <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
68
- </p>
69
- <?php
70
- }
71
-
72
- // Updating widget replacing old instances with new
73
- public function update( $new_instance, $old_instance )
74
- {
75
- $instance = array();
76
- $instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
77
- return $instance;
78
- }
79
- } // Class cleantalk_widget ends here
80
-
81
- // Register and load the widget
82
- function cleantalk_load_widget()
83
- {
84
- register_widget( 'cleantalk_widget' );
85
- }
86
- add_action( 'widgets_init', 'cleantalk_load_widget' );
87
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/inc/cleantalk.class.php DELETED
@@ -1,1196 +0,0 @@
1
- <?php
2
- /**
3
- * Cleantalk base class
4
- *
5
- * @version 2.1.1
6
- * @package Cleantalk
7
- * @subpackage Base
8
- * @author Cleantalk team (welcome@cleantalk.org)
9
- * @copyright (C) 2014 CleanTalk team (http://cleantalk.org)
10
- * @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
11
- * @see https://github.com/CleanTalk/php-antispam
12
- *
13
- */
14
-
15
- /**
16
- * Load JSON functions if they are not exists
17
- */
18
- if(!function_exists('json_encode')) {
19
- require_once 'JSON.php';
20
-
21
- function json_encode($data) {
22
- $json = new Services_JSON();
23
- return( $json->encode($data) );
24
- }
25
-
26
- }
27
- if(!function_exists('json_decode')) {
28
- require_once 'JSON.php';
29
-
30
- function json_decode($data) {
31
- $json = new Services_JSON();
32
- return( $json->decode($data) );
33
- }
34
- }
35
-
36
- /**
37
- * Response class
38
- */
39
- class CleantalkResponse {
40
-
41
- /**
42
- * Is stop words
43
- * @var int
44
- */
45
- public $stop_words = null;
46
-
47
- /**
48
- * Cleantalk comment
49
- * @var string
50
- */
51
- public $comment = null;
52
-
53
- /**
54
- * Is blacklisted
55
- * @var int
56
- */
57
- public $blacklisted = null;
58
-
59
- /**
60
- * Is allow, 1|0
61
- * @var int
62
- */
63
- public $allow = null;
64
-
65
- /**
66
- * Request ID
67
- * @var int
68
- */
69
- public $id = null;
70
-
71
- /**
72
- * Request errno
73
- * @var int
74
- */
75
- public $errno = null;
76
-
77
- /**
78
- * Error string
79
- * @var string
80
- */
81
- public $errstr = null;
82
-
83
- /**
84
- * Is fast submit, 1|0
85
- * @var string
86
- */
87
- public $fast_submit = null;
88
-
89
- /**
90
- * Is spam comment
91
- * @var string
92
- */
93
- public $spam = null;
94
-
95
- /**
96
- * Is JS
97
- * @var type
98
- */
99
- public $js_disabled = null;
100
-
101
- /**
102
- * Sms check
103
- * @var type
104
- */
105
- public $sms_allow = null;
106
-
107
- /**
108
- * Sms code result
109
- * @var type
110
- */
111
- public $sms = null;
112
-
113
- /**
114
- * Sms error code
115
- * @var type
116
- */
117
- public $sms_error_code = null;
118
-
119
- /**
120
- * Sms error code
121
- * @var type
122
- */
123
- public $sms_error_text = null;
124
-
125
- /**
126
- * Stop queue message, 1|0
127
- * @var int
128
- */
129
- public $stop_queue = null;
130
-
131
- /**
132
- * Account shuld by deactivated after registration, 1|0
133
- * @var int
134
- */
135
- public $inactive = null;
136
-
137
- /**
138
- * Account status
139
- * @var int
140
- */
141
- public $account_status = -1;
142
-
143
- /**
144
- * Create server response
145
- *
146
- * @param type $response
147
- * @param type $obj
148
- */
149
- function __construct($response = null, $obj = null) {
150
- if ($response && is_array($response) && count($response) > 0) {
151
- foreach ($response as $param => $value) {
152
- $this->{$param} = $value;
153
- }
154
- } else {
155
- $this->errno = $obj->errno;
156
- $this->errstr = $obj->errstr;
157
-
158
- $this->errstr = preg_replace("/.+(\*\*\*.+\*\*\*).+/", "$1", $this->errstr);
159
-
160
- $this->stop_words = isset($obj->stop_words) ? utf8_decode($obj->stop_words) : null;
161
- $this->comment = isset($obj->comment) ? utf8_decode($obj->comment) : null;
162
- $this->blacklisted = (isset($obj->blacklisted)) ? $obj->blacklisted : null;
163
- $this->allow = (isset($obj->allow)) ? $obj->allow : 0;
164
- $this->id = (isset($obj->id)) ? $obj->id : null;
165
- $this->fast_submit = (isset($obj->fast_submit)) ? $obj->fast_submit : 0;
166
- $this->spam = (isset($obj->spam)) ? $obj->spam : 0;
167
- $this->js_disabled = (isset($obj->js_disabled)) ? $obj->js_disabled : 0;
168
- $this->sms_allow = (isset($obj->sms_allow)) ? $obj->sms_allow : null;
169
- $this->sms = (isset($obj->sms)) ? $obj->sms : null;
170
- $this->sms_error_code = (isset($obj->sms_error_code)) ? $obj->sms_error_code : null;
171
- $this->sms_error_text = (isset($obj->sms_error_text)) ? $obj->sms_error_text : null;
172
- $this->stop_queue = (isset($obj->stop_queue)) ? $obj->stop_queue : 0;
173
- $this->inactive = (isset($obj->inactive)) ? $obj->inactive : 0;
174
- $this->account_status = (isset($obj->account_status)) ? $obj->account_status : -1;
175
-
176
- if ($this->errno !== 0 && $this->errstr !== null && $this->comment === null)
177
- $this->comment = '*** ' . $this->errstr . ' Antispam service cleantalk.org ***';
178
- }
179
- }
180
-
181
- }
182
-
183
- /**
184
- * Request class
185
- */
186
- class CleantalkRequest {
187
-
188
- /**
189
- * All http request headers
190
- * @var string
191
- */
192
- public $all_headers = null;
193
-
194
- /**
195
- * IP address of connection
196
- * @var string
197
- */
198
- //public $remote_addr = null;
199
-
200
- /**
201
- * Last error number
202
- * @var integer
203
- */
204
- public $last_error_no = null;
205
-
206
- /**
207
- * Last error time
208
- * @var integer
209
- */
210
- public $last_error_time = null;
211
-
212
- /**
213
- * Last error text
214
- * @var string
215
- */
216
- public $last_error_text = null;
217
-
218
- /**
219
- * User message
220
- * @var string
221
- */
222
- public $message = null;
223
-
224
- /**
225
- * Post example with last comments
226
- * @var string
227
- */
228
- public $example = null;
229
-
230
- /**
231
- * Auth key
232
- * @var string
233
- */
234
- public $auth_key = null;
235
-
236
- /**
237
- * Engine
238
- * @var string
239
- */
240
- public $agent = null;
241
-
242
- /**
243
- * Is check for stoplist,
244
- * valid are 0|1
245
- * @var int
246
- */
247
- public $stoplist_check = null;
248
-
249
- /**
250
- * Language server response,
251
- * valid are 'en' or 'ru'
252
- * @var string
253
- */
254
- public $response_lang = null;
255
-
256
- /**
257
- * User IP
258
- * @var strings
259
- */
260
- public $sender_ip = null;
261
-
262
- /**
263
- * User email
264
- * @var strings
265
- */
266
- public $sender_email = null;
267
-
268
- /**
269
- * User nickname
270
- * @var string
271
- */
272
- public $sender_nickname = null;
273
-
274
- /**
275
- * Sender info JSON string
276
- * @var string
277
- */
278
- public $sender_info = null;
279
-
280
- /**
281
- * Post info JSON string
282
- * @var string
283
- */
284
- public $post_info = null;
285
-
286
- /**
287
- * Is allow links, email and icq,
288
- * valid are 1|0
289
- * @var int
290
- */
291
- public $allow_links = null;
292
-
293
- /**
294
- * Time form filling
295
- * @var int
296
- */
297
- public $submit_time = null;
298
-
299
- public $x_forwarded_for = '';
300
- public $x_real_ip = '';
301
-
302
- /**
303
- * Is enable Java Script,
304
- * valid are 0|1|2
305
- * Status:
306
- * null - JS html code not inserted into phpBB templates
307
- * 0 - JS disabled at the client browser
308
- * 1 - JS enabled at the client broswer
309
- * @var int
310
- */
311
- public $js_on = null;
312
-
313
- /**
314
- * user time zone
315
- * @var string
316
- */
317
- public $tz = null;
318
-
319
- /**
320
- * Feedback string,
321
- * valid are 'requset_id:(1|0)'
322
- * @var string
323
- */
324
- public $feedback = null;
325
-
326
- /**
327
- * Phone number
328
- * @var type
329
- */
330
- public $phone = null;
331
-
332
- /**
333
- * Method name
334
- * @var string
335
- */
336
- public $method_name = 'check_message';
337
-
338
- /**
339
- * Fill params with constructor
340
- * @param type $params
341
- */
342
- public function __construct($params = null) {
343
- if (is_array($params) && count($params) > 0) {
344
- foreach ($params as $param => $value) {
345
- $this->{$param} = $value;
346
- }
347
- }
348
- }
349
-
350
- }
351
-
352
- /**
353
- * Cleantalk class create request
354
- */
355
- class Cleantalk {
356
-
357
- /**
358
- * Debug level
359
- * @var int
360
- */
361
- public $debug = 0;
362
-
363
- /**
364
- * Maximum data size in bytes
365
- * @var int
366
- */
367
- private $dataMaxSise = 32768;
368
-
369
- /**
370
- * Data compression rate
371
- * @var int
372
- */
373
- private $compressRate = 6;
374
-
375
- /**
376
- * Server connection timeout in seconds
377
- * @var int
378
- */
379
- private $server_timeout = 6;
380
-
381
- /**
382
- * Cleantalk server url
383
- * @var string
384
- */
385
- public $server_url = null;
386
-
387
- /**
388
- * Last work url
389
- * @var string
390
- */
391
- public $work_url = null;
392
-
393
- /**
394
- * WOrk url ttl
395
- * @var int
396
- */
397
- public $server_ttl = null;
398
-
399
- /**
400
- * Time wotk_url changer
401
- * @var int
402
- */
403
- public $server_changed = null;
404
-
405
- /**
406
- * Flag is change server url
407
- * @var bool
408
- */
409
- public $server_change = false;
410
-
411
- /**
412
- * Use TRUE when need stay on server. Example: send feedback
413
- * @var bool
414
- */
415
- public $stay_on_server = false;
416
-
417
- /**
418
- * Codepage of the data
419
- * @var bool
420
- */
421
- public $data_codepage = null;
422
-
423
- /**
424
- * API version to use
425
- * @var string
426
- */
427
- public $api_version = '/api2.0';
428
-
429
- /**
430
- * Use https connection to servers
431
- * @var bool
432
- */
433
- public $ssl_on = false;
434
-
435
- /**
436
- * Path to SSL certificate
437
- * @var string
438
- */
439
- public $ssl_path = '';
440
-
441
- /**
442
- * Minimal server response in miliseconds to catch the server
443
- *
444
- */
445
- public $min_server_timeout = 50;
446
-
447
- /**
448
- * Function checks whether it is possible to publish the message
449
- * @param CleantalkRequest $request
450
- * @return type
451
- */
452
- public function isAllowMessage(CleantalkRequest $request) {
453
- $this->filterRequest($request);
454
- $msg = $this->createMsg('check_message', $request);
455
- return $this->httpRequest($msg);
456
- }
457
-
458
- /**
459
- * Function checks whether it is possible to publish the message
460
- * @param CleantalkRequest $request
461
- * @return type
462
- */
463
- public function isAllowUser(CleantalkRequest $request) {
464
- $this->filterRequest($request);
465
- $msg = $this->createMsg('check_newuser', $request);
466
- return $this->httpRequest($msg);
467
- }
468
-
469
- /**
470
- * Function sends the results of manual moderation
471
- *
472
- * @param CleantalkRequest $request
473
- * @return type
474
- */
475
- public function sendFeedback(CleantalkRequest $request) {
476
- $this->filterRequest($request);
477
- $msg = $this->createMsg('send_feedback', $request);
478
- return $this->httpRequest($msg);
479
- }
480
-
481
- /**
482
- * Filter request params
483
- * @param CleantalkRequest $request
484
- * @return type
485
- */
486
- private function filterRequest(CleantalkRequest &$request) {
487
- // general and optional
488
- foreach ($request as $param => $value) {
489
- if (in_array($param, array('message', 'example', 'agent',
490
- 'sender_info', 'sender_nickname', 'post_info', 'phone')) && !empty($value)) {
491
- if (!is_string($value) && !is_integer($value)) {
492
- $request->$param = NULL;
493
- }
494
- }
495
-
496
- if (in_array($param, array('stoplist_check', 'allow_links')) && !empty($value)) {
497
- if (!in_array($value, array(1, 2))) {
498
- $request->$param = NULL;
499
- }
500
- }
501
-
502
- if (in_array($param, array('js_on')) && !empty($value)) {
503
- if (!is_integer($value)) {
504
- $request->$param = NULL;
505
- }
506
- }
507
-
508
- if ($param == 'sender_ip' && !empty($value)) {
509
- if (!is_string($value)) {
510
- $request->$param = NULL;
511
- }
512
- }
513
-
514
- if ($param == 'sender_email' && !empty($value)) {
515
- if (!is_string($value)) {
516
- $request->$param = NULL;
517
- }
518
- }
519
-
520
- if ($param == 'submit_time' && !empty($value)) {
521
- if (!is_int($value)) {
522
- $request->$param = NULL;
523
- }
524
- }
525
- }
526
- }
527
-
528
- /**
529
- * Compress data and encode to base64
530
- * @param type string
531
- * @return string
532
- */
533
- private function compressData($data = null){
534
-
535
- if (strlen($data) > $this->dataMaxSise && function_exists('gzencode') && function_exists('base64_encode')){
536
-
537
- $localData = gzencode($data, $this->compressRate, FORCE_GZIP);
538
-
539
- if ($localData === false)
540
- return $data;
541
-
542
- $localData = base64_encode($localData);
543
-
544
- if ($localData === false)
545
- return $data;
546
-
547
- return $localData;
548
- }
549
-
550
- return $data;
551
- }
552
-
553
- /**
554
- * Create msg for cleantalk server
555
- * @param type $method
556
- * @param CleantalkRequest $request
557
- * @return \xmlrpcmsg
558
- */
559
- private function createMsg($method, CleantalkRequest $request) {
560
- switch ($method) {
561
- case 'check_message':
562
- // Convert strings to UTF8
563
- $request->message = $this->stringToUTF8($request->message, $this->data_codepage);
564
- $request->example = $this->stringToUTF8($request->example, $this->data_codepage);
565
- $request->sender_email = $this->stringToUTF8($request->sender_email, $this->data_codepage);
566
- $request->sender_nickname = $this->stringToUTF8($request->sender_nickname, $this->data_codepage);
567
-
568
- $request->message = $this->compressData($request->message);
569
- $request->example = $this->compressData($request->example);
570
- break;
571
-
572
- case 'check_newuser':
573
- // Convert strings to UTF8
574
- $request->sender_email = $this->stringToUTF8($request->sender_email, $this->data_codepage);
575
- $request->sender_nickname = $this->stringToUTF8($request->sender_nickname, $this->data_codepage);
576
- break;
577
-
578
- case 'send_feedback':
579
- if (is_array($request->feedback)) {
580
- $request->feedback = implode(';', $request->feedback);
581
- }
582
- break;
583
- }
584
-
585
- $request->method_name = $method;
586
-
587
- //
588
- // Removing non UTF8 characters from request, because non UTF8 or malformed characters break json_encode().
589
- //
590
- foreach ($request as $param => $value) {
591
- if (!preg_match('//u', $value)) {
592
- $request->{$param} = 'Nulled. Not UTF8 encoded or malformed.';
593
- }
594
- }
595
-
596
- return $request;
597
- }
598
-
599
- /**
600
- * Send JSON request to servers
601
- * @param $msg
602
- * @return boolean|\CleantalkResponse
603
- */
604
- private function sendRequest($data = null, $url, $server_timeout = 3) {
605
- // Convert to array
606
- $data = (array)json_decode(json_encode($data), true);
607
-
608
- // Convert to JSON
609
- $data = json_encode($data);
610
-
611
- if (isset($this->api_version)) {
612
- $url = $url . $this->api_version;
613
- }
614
-
615
- // Switching to secure connection
616
- if ($this->ssl_on && !preg_match("/^https:/", $url)) {
617
- $url = preg_replace("/^(http)/i", "$1s", $url);
618
- }
619
-
620
- $result = false;
621
- $curl_error = null;
622
- if(function_exists('curl_init')) {
623
- $ch = curl_init();
624
- curl_setopt($ch, CURLOPT_URL, $url);
625
- curl_setopt($ch, CURLOPT_TIMEOUT, $server_timeout);
626
- curl_setopt($ch, CURLOPT_POST, 1);
627
- curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
628
- // receive server response ...
629
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
630
- // resolve 'Expect: 100-continue' issue
631
- curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
632
- // see http://stackoverflow.com/a/23322368
633
- curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
634
-
635
- // Disabling CA cert verivication
636
- // Disabling common name verification
637
- if ($this->ssl_on && $this->ssl_path=='') {
638
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
639
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
640
- }
641
- else if ($this->ssl_on && $this->ssl_path!='') {
642
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
643
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, true);
644
- curl_setopt($ch, CURLOPT_CAINFO, $this->ssl_path);
645
- }
646
-
647
- $result = curl_exec($ch);
648
- if (!$result) {
649
- $curl_error = curl_error($ch);
650
- }
651
-
652
- curl_close($ch);
653
- }
654
-
655
- if (!$result) {
656
- $allow_url_fopen = ini_get('allow_url_fopen');
657
- if (function_exists('file_get_contents') && isset($allow_url_fopen) && $allow_url_fopen == '1') {
658
- $opts = array('http' =>
659
- array(
660
- 'method' => 'POST',
661
- 'header' => "Content-Type: text/html\r\n",
662
- 'content' => $data,
663
- 'timeout' => $server_timeout
664
- )
665
- );
666
-
667
- $context = stream_context_create($opts);
668
- $result = @file_get_contents($url, false, $context);
669
- }
670
- }
671
-
672
- if (!$result || !cleantalk_is_JSON($result)) {
673
- $response = null;
674
- $response['errno'] = 1;
675
- if ($curl_error) {
676
- $response['errstr'] = sprintf("CURL error: '%s'", $curl_error);
677
- } else {
678
- $response['errstr'] = 'No CURL support compiled in';
679
- }
680
- $response['errstr'] .= ' or disabled allow_url_fopen in php.ini.';
681
- $response = json_decode(json_encode($response));
682
-
683
- return $response;
684
- }
685
-
686
- $errstr = null;
687
- $response = json_decode($result);
688
- if ($result !== false && is_object($response)) {
689
- $response->errno = 0;
690
- $response->errstr = $errstr;
691
- } else {
692
- $errstr = 'Unknown response from ' . $url . '.' . ' ' . $result;
693
-
694
- $response = null;
695
- $response['errno'] = 1;
696
- $response['errstr'] = $errstr;
697
- $response = json_decode(json_encode($response));
698
- }
699
-
700
-
701
- return $response;
702
- }
703
-
704
- /**
705
- * httpRequest
706
- * @param $msg
707
- * @return boolean|\CleantalkResponse
708
- */
709
- private function httpRequest($msg) {
710
- $result = false;
711
- $msg->all_headers=json_encode(apache_request_headers());
712
- //$msg->remote_addr=$_SERVER['REMOTE_ADDR'];
713
- //$msg->sender_info['remote_addr']=$_SERVER['REMOTE_ADDR'];
714
- $si=(array)json_decode($msg->sender_info,true);
715
- if(defined('IN_PHPBB'))
716
- {
717
- global $request;
718
- if(method_exists($request,'server'))
719
- {
720
- $si['remote_addr']=$request->server('REMOTE_ADDR');
721
- $msg->x_forwarded_for=$request->server('X_FORWARDED_FOR');
722
- $msg->x_real_ip=$request->server('X_REAL_IP');
723
- }
724
- }
725
- else
726
- {
727
- $si['remote_addr']=$_SERVER['REMOTE_ADDR'];
728
- $msg->x_forwarded_for=@$_SERVER['X_FORWARDED_FOR'];
729
- $msg->x_real_ip=@$_SERVER['X_REAL_IP'];
730
- }
731
- $msg->sender_info=json_encode($si);
732
- if (((isset($this->work_url) && $this->work_url !== '') && ($this->server_changed + $this->server_ttl > time()))
733
- || $this->stay_on_server == true) {
734
-
735
- $url = (!empty($this->work_url)) ? $this->work_url : $this->server_url;
736
-
737
- $result = $this->sendRequest($msg, $url, $this->server_timeout);
738
- }
739
-
740
- if (($result === false || $result->errno != 0) && $this->stay_on_server == false) {
741
- // Split server url to parts
742
- preg_match("@^(https?://)([^/:]+)(.*)@i", $this->server_url, $matches);
743
- $url_prefix = '';
744
- if (isset($matches[1]))
745
- $url_prefix = $matches[1];
746
-
747
- $pool = null;
748
- if (isset($matches[2]))
749
- $pool = $matches[2];
750
-
751
- $url_suffix = '';
752
- if (isset($matches[3]))
753
- $url_suffix = $matches[3];
754
-
755
- if ($url_prefix === '')
756
- $url_prefix = 'http://';
757
-
758
- if (empty($pool)) {
759
- return false;
760
- } else {
761
- // Loop until find work server
762
- foreach ($this->get_servers_ip($pool) as $server) {
763
- if ($server['host'] === 'localhost' || $server['ip'] === null) {
764
- $work_url = $server['host'];
765
- } else {
766
- $server_host = $server['ip'];
767
- $work_url = $server_host;
768
- }
769
- $work_url = $url_prefix . $work_url;
770
- if (isset($url_suffix))
771
- $work_url = $work_url . $url_suffix;
772
-
773
- $this->work_url = $work_url;
774
- $this->server_ttl = $server['ttl'];
775
-
776
- $result = $this->sendRequest($msg, $this->work_url, $this->server_timeout);
777
-
778
- if ($result !== false && $result->errno === 0) {
779
- $this->server_change = true;
780
- break;
781
- }
782
- }
783
- }
784
- }
785
-
786
- $response = new CleantalkResponse(null, $result);
787
-
788
- if (!empty($this->data_codepage) && $this->data_codepage !== 'UTF-8') {
789
- if (!empty($response->comment))
790
- $response->comment = $this->stringFromUTF8($response->comment, $this->data_codepage);
791
- if (!empty($response->errstr))
792
- $response->errstr = $this->stringFromUTF8($response->errstr, $this->data_codepage);
793
- if (!empty($response->sms_error_text))
794
- $response->sms_error_text = $this->stringFromUTF8($response->sms_error_text, $this->data_codepage);
795
- }
796
-
797
- return $response;
798
- }
799
-
800
- /**
801
- * Function DNS request
802
- * @param $host
803
- * @return array
804
- */
805
- public function get_servers_ip($host) {
806
- $response = null;
807
- if (!isset($host))
808
- return $response;
809
-
810
- if (function_exists('dns_get_record')) {
811
- $records = dns_get_record($host, DNS_A);
812
-
813
- if ($records !== FALSE) {
814
- foreach ($records as $server) {
815
- $response[] = $server;
816
- }
817
- }
818
- }
819
-
820
- if (count($response) == 0 && function_exists('gethostbynamel')) {
821
- $records = gethostbynamel($host);
822
-
823
- if ($records !== FALSE) {
824
- foreach ($records as $server) {
825
- $response[] = array("ip" => $server,
826
- "host" => $host,
827
- "ttl" => $this->server_ttl
828
- );
829
- }
830
- }
831
- }
832
-
833
- if (count($response) == 0) {
834
- $response[] = array("ip" => null,
835
- "host" => $host,
836
- "ttl" => $this->server_ttl
837
- );
838
- } else {
839
- // $i - to resolve collisions with localhost
840
- $i = 0;
841
- $r_temp = null;
842
- $fast_server_found = false;
843
- foreach ($response as $server) {
844
-
845
- // Do not test servers because fast work server found
846
- if ($fast_server_found) {
847
- $ping = $this->min_server_timeout;
848
- } else {
849
- $ping = $this->httpPing($server['ip']);
850
- $ping = $ping * 1000;
851
- }
852
-
853
- // -1 server is down, skips not reachable server
854
- if ($ping != -1) {
855
- $r_temp[$ping + $i] = $server;
856
- }
857
- $i++;
858
-
859
- if ($ping < $this->min_server_timeout) {
860
- $fast_server_found = true;
861
- }
862
- }
863
- if (count($r_temp)){
864
- ksort($r_temp);
865
- $response = $r_temp;
866
- }
867
- }
868
-
869
- return $response;
870
- }
871
-
872
- /**
873
- * Function to get the message hash from Cleantalk.ru comment
874
- * @param $message
875
- * @return null
876
- */
877
- public function getCleantalkCommentHash($message) {
878
- $matches = array();
879
- if (preg_match('/\n\n\*\*\*.+([a-z0-9]{32}).+\*\*\*$/', $message, $matches))
880
- return $matches[1];
881
- else if (preg_match('/\<br.*\>[\n]{0,1}\<br.*\>[\n]{0,1}\*\*\*.+([a-z0-9]{32}).+\*\*\*$/', $message, $matches))
882
- return $matches[1];
883
-
884
- return NULL;
885
- }
886
-
887
- /**
888
- * Function adds to the post comment Cleantalk.ru
889
- * @param $message
890
- * @param $comment
891
- * @return string
892
- */
893
- public function addCleantalkComment($message, $comment) {
894
- $comment = preg_match('/\*\*\*(.+)\*\*\*/', $comment, $matches) ? $comment : '*** ' . $comment . ' ***';
895
- return $message . "\n\n" . $comment;
896
- }
897
-
898
- /**
899
- * Function deletes the comment Cleantalk.ru
900
- * @param $message
901
- * @return mixed
902
- */
903
- public function delCleantalkComment($message) {
904
- $message = preg_replace('/\n\n\*\*\*.+\*\*\*$/', '', $message);
905
-
906
- // DLE sign cut
907
- $message = preg_replace('/<br\s?\/><br\s?\/>\*\*\*.+\*\*\*$/', '', $message);
908
-
909
- $message = preg_replace('/\<br.*\>[\n]{0,1}\<br.*\>[\n]{0,1}\*\*\*.+\*\*\*$/', '', $message);
910
-
911
- return $message;
912
- }
913
-
914
- /**
915
- * Get user IP behind proxy server
916
- */
917
- public function ct_session_ip( $data_ip ) {
918
- if (!$data_ip || !preg_match("/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/", $data_ip)) {
919
- return $data_ip;
920
- }
921
- /*if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
922
-
923
- $forwarded_ip = explode(",", $_SERVER['HTTP_X_FORWARDED_FOR']);
924
-
925
- // Looking for first value in the list, it should be sender real IP address
926
- if (!preg_match("/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/", $forwarded_ip[0])) {
927
- return $data_ip;
928
- }
929
-
930
- $private_src_ip = false;
931
- $private_nets = array(
932
- '10.0.0.0/8',
933
- '127.0.0.0/8',
934
- '176.16.0.0/12',
935
- '192.168.0.0/16',
936
- );
937
-
938
- foreach ($private_nets as $v) {
939
-
940
- // Private IP found
941
- if ($private_src_ip) {
942
- continue;
943
- }
944
-
945
- if ($this->net_match($v, $data_ip)) {
946
- $private_src_ip = true;
947
- }
948
- }
949
- if ($private_src_ip) {
950
- // Taking first IP from the list HTTP_X_FORWARDED_FOR
951
- $data_ip = $forwarded_ip[0];
952
- }
953
- }
954
-
955
- return $data_ip;*/
956
- return cleantalk_get_real_ip();
957
- }
958
-
959
- /**
960
- * From http://php.net/manual/en/function.ip2long.php#82397
961
- */
962
- public function net_match($CIDR,$IP) {
963
- list ($net, $mask) = explode ('/', $CIDR);
964
- return ( ip2long ($IP) & ~((1 << (32 - $mask)) - 1) ) == ip2long ($net);
965
- }
966
-
967
- /**
968
- * Function to check response time
969
- * param string
970
- * @return int
971
- */
972
- function httpPing($host){
973
-
974
- // Skip localhost ping cause it raise error at fsockopen.
975
- // And return minimun value
976
- if ($host == 'localhost')
977
- return 0.001;
978
-
979
- $starttime = microtime(true);
980
- $file = @fsockopen ($host, 80, $errno, $errstr, $this->server_timeout);
981
- $stoptime = microtime(true);
982
- $status = 0;
983
- if (!$file) {
984
- $status = -1; // Site is down
985
- } else {
986
- fclose($file);
987
- $status = ($stoptime - $starttime);
988
- $status = round($status, 4);
989
- }
990
-
991
- return $status;
992
- }
993
-
994
- /**
995
- * Function convert string to UTF8 and removes non UTF8 characters
996
- * param string
997
- * param string
998
- * @return string
999
- */
1000
- function stringToUTF8($str, $data_codepage = null){
1001
- if (!preg_match('//u', $str) && function_exists('mb_detect_encoding') && function_exists('mb_convert_encoding')) {
1002
-
1003
- if ($data_codepage !== null)
1004
- return mb_convert_encoding($str, 'UTF-8', $data_codepage);
1005
-
1006
- $encoding = mb_detect_encoding($str);
1007
- if ($encoding)
1008
- return mb_convert_encoding($str, 'UTF-8', $encoding);
1009
- }
1010
-
1011
- return $str;
1012
- }
1013
-
1014
- /**
1015
- * Function convert string from UTF8
1016
- * param string
1017
- * param string
1018
- * @return string
1019
- */
1020
- function stringFromUTF8($str, $data_codepage = null){
1021
- if (preg_match('//u', $str) && function_exists('mb_convert_encoding') && $data_codepage !== null) {
1022
- return mb_convert_encoding($str, $data_codepage, 'UTF-8');
1023
- }
1024
-
1025
- return $str;
1026
- }
1027
-
1028
- /**
1029
- * Function gets information about spam active networks
1030
- *
1031
- * @param string api_key
1032
- * @return JSON/array
1033
- */
1034
- public function get_2s_blacklists_db ($api_key) {
1035
- $request=Array();
1036
- $request['method_name'] = '2s_blacklists_db';
1037
- $request['auth_key'] = $api_key;
1038
- $url='https://api.cleantalk.org';
1039
- $result=sendRawRequest($url,$request);
1040
- return $result;
1041
- }
1042
- }
1043
-
1044
- /**
1045
- * Function gets access key automatically
1046
- *
1047
- * @param string website admin email
1048
- * @param string website host
1049
- * @param string website platform
1050
- * @return type
1051
- */
1052
-
1053
- function getAutoKey($email, $host, $platform)
1054
- {
1055
- $request=Array();
1056
- $request['method_name'] = 'get_api_key';
1057
- $request['email'] = $email;
1058
- $request['website'] = $host;
1059
- $request['platform'] = $platform;
1060
- $url='https://api.cleantalk.org';
1061
- $result=sendRawRequest($url,$request);
1062
- return $result;
1063
- }
1064
-
1065
- /**
1066
- * Function gets information about renew notice
1067
- *
1068
- * @param string api_key
1069
- * @return type
1070
- */
1071
-
1072
- function noticePaidTill($api_key)
1073
- {
1074
- $request=Array();
1075
- $request['method_name'] = 'notice_paid_till';
1076
- $request['auth_key'] = $api_key;
1077
- $url='https://api.cleantalk.org';
1078
- $result=sendRawRequest($url,$request);
1079
- return $result;
1080
- }
1081
-
1082
- /**
1083
- * Function sends raw request to API server
1084
- *
1085
- * @param string url of API server
1086
- * @param array data to send
1087
- * @param boolean is data have to be JSON encoded or not
1088
- * @param integer connect timeout
1089
- * @return type
1090
- */
1091
-
1092
- function sendRawRequest($url,$data,$isJSON=false,$timeout=3)
1093
- {
1094
- $result=null;
1095
- if(!$isJSON)
1096
- {
1097
- $data=http_build_query($data);
1098
- }
1099
- else
1100
- {
1101
- $data= json_encode($data);
1102
- }
1103
- $curl_exec=false;
1104
- if (function_exists('curl_init') && function_exists('json_decode'))
1105
- {
1106
-
1107
- $ch = curl_init();
1108
- curl_setopt($ch, CURLOPT_URL, $url);
1109
- curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
1110
- curl_setopt($ch, CURLOPT_POST, true);
1111
- curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
1112
-
1113
- // receive server response ...
1114
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
1115
- // resolve 'Expect: 100-continue' issue
1116
- curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
1117
-
1118
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
1119
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
1120
-
1121
- $result = @curl_exec($ch);
1122
- if($result!==false)
1123
- {
1124
- $curl_exec=true;
1125
- }
1126
- @curl_close($ch);
1127
- }
1128
- if(!$curl_exec)
1129
- {
1130
- $opts = array(
1131
- 'http'=>array(
1132
- 'method'=>"POST",
1133
- 'content'=>$data)
1134
- );
1135
- $context = stream_context_create($opts);
1136
- $result = @file_get_contents($url, 0, $context);
1137
- }
1138
- return $result;
1139
- }
1140
-
1141
- if( !function_exists('apache_request_headers') )
1142
- {
1143
- function apache_request_headers()
1144
- {
1145
- $arh = array();
1146
- $rx_http = '/\AHTTP_/';
1147
- foreach($_SERVER as $key => $val)
1148
- {
1149
- if( preg_match($rx_http, $key) )
1150
- {
1151
- $arh_key = preg_replace($rx_http, '', $key);
1152
- $rx_matches = array();
1153
- $rx_matches = explode('_', $arh_key);
1154
- if( count($rx_matches) > 0 and strlen($arh_key) > 2 )
1155
- {
1156
- foreach($rx_matches as $ak_key => $ak_val) $rx_matches[$ak_key] = ucfirst($ak_val);
1157
- $arh_key = implode('-', $rx_matches);
1158
- }
1159
- $arh[$arh_key] = $val;
1160
- }
1161
- }
1162
- return( $arh );
1163
- }
1164
- }
1165
-
1166
- function cleantalk_get_real_ip()
1167
- {
1168
- if ( function_exists( 'apache_request_headers' ) )
1169
- {
1170
- $headers = apache_request_headers();
1171
- }
1172
- else
1173
- {
1174
- $headers = $_SERVER;
1175
- }
1176
- if ( array_key_exists( 'X-Forwarded-For', $headers ) )
1177
- {
1178
- $the_ip=explode(",", trim($headers['X-Forwarded-For']));
1179
- $the_ip = trim($the_ip[0]);
1180
- }
1181
- elseif ( array_key_exists( 'HTTP_X_FORWARDED_FOR', $headers ))
1182
- {
1183
- $the_ip=explode(",", trim($headers['HTTP_X_FORWARDED_FOR']));
1184
- $the_ip = trim($the_ip[0]);
1185
- }
1186
- else
1187
- {
1188
- $the_ip = filter_var( $_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 );
1189
- }
1190
- return $the_ip;
1191
- }
1192
-
1193
- function cleantalk_is_JSON($string)
1194
- {
1195
- return ((is_string($string) && (is_object(json_decode($string)) || is_array(json_decode($string))))) ? true : false;
1196
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/inc/cleantalk_api.php DELETED
@@ -1,127 +0,0 @@
1
- <?php
2
- require_once("cleantalk.class.php");
3
- require_once("JSON.php");
4
-
5
-
6
- /**
7
- * Get ct_get_checkjs_value
8
- * @return string
9
- */
10
- function ct_get_checkjs_value_plugin($random_key = false) {
11
-
12
- $ct_data=get_option("cleantalk_data");
13
-
14
- if ($random_key) {
15
- $keys = $ct_data['js_keys'];
16
- $keys_checksum = md5(json_encode($keys));
17
-
18
- $key = null;
19
- $latest_key_time = 0;
20
- foreach ($keys as $k => $t) {
21
-
22
- // Removing key if it's to old
23
- if (time() - $t > $ct_data['js_keys_store_days'] * 86400) {
24
- unset($keys[$k]);
25
- continue;
26
- }
27
-
28
- if ($t > $latest_key_time) {
29
- $latest_key_time = $t;
30
- $key = $k;
31
- }
32
- }
33
-
34
- // Get new key if the latest key is too old
35
- if (time() - $latest_key_time > $ct_data['js_key_lifetime']) {
36
- $key = rand();
37
- $keys[$key] = time();
38
- }
39
-
40
- if (md5(json_encode($keys)) != $keys_checksum) {
41
- $ct_data['js_keys'] = $keys;
42
- update_option('cleantalk_data', $ct_data);
43
- }
44
- } else {
45
- $key = md5($ct_options['apikey'] . '+' . get_option('admin_email'));
46
- }
47
-
48
- return $key;
49
- }
50
-
51
- /**
52
- * Validates JavaScript anti-spam test
53
- *
54
- */
55
- function js_test_plugin($field_name = 'ct_checkjs', $data = null, $random_key = false) {
56
-
57
- $ct_data=get_option("cleantalk_data");
58
-
59
- $checkjs = null;
60
- $js_post_value = null;
61
-
62
- if (!$data)
63
- return $checkjs;
64
-
65
- if (isset($data[$field_name])) {
66
- $js_post_value = $data[$field_name];
67
- if (isset($keys[$js_post_value])) {
68
-
69
- //
70
- // Random key check
71
- //
72
- if ($random_key) {
73
-
74
- $keys = $ct_data['js_keys'];
75
- $checkjs = 1;
76
- } else {
77
- $checkjs = 0;
78
- }
79
- } else {
80
- $ct_challenge = ct_get_checkjs_value();
81
-
82
- if(preg_match("/$ct_challenge/", $js_post_value)) {
83
- $checkjs = 1;
84
- } else {
85
- $checkjs = 0;
86
- }
87
- }
88
-
89
-
90
- }
91
-
92
- return $checkjs;
93
- }
94
-
95
- /**
96
- * Check messages for external plugins
97
- * @return array with checking result;
98
- */
99
-
100
- function ct_test_message($nickname, $email, $ip, $text){
101
- $checkjs = js_test_plugin('ct_checkjs', $_COOKIE, true);
102
-
103
- $post_info['comment_type'] = 'feedback_plugin_check';
104
- $post_info = json_encode($post_info);
105
-
106
- $ct_base_call_result = ct_base_call(array(
107
- 'message' => $text,
108
- 'example' => null,
109
- 'sender_email' => $email,
110
- 'sender_nickname' => $nickname,
111
- 'post_info' => $post_info,
112
- 'sender_info' => get_sender_info(),
113
- 'checkjs' => $checkjs
114
- ));
115
-
116
- $ct_result = $ct_base_call_result['ct_result'];
117
-
118
- $result=Array(
119
- 'allow' => $ct_result->allow,
120
- 'comment' => $ct_result->comment,
121
- );
122
- return $result;
123
- }
124
-
125
-
126
-
127
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/inc/cleantalk_external.js DELETED
@@ -1,34 +0,0 @@
1
- if(ct_external_executed==undefined)
2
- {
3
- var ct_external_executed=true;
4
- for(i=0;i<document.forms.length;i++)
5
- {
6
- if(typeof(document.forms[i].action)=='string')
7
- {
8
- action=document.forms[i].action;
9
- if(action.indexOf('http://')!=-1||action.indexOf('https://')!=-1)
10
- {
11
- tmp=action.split('//');
12
- tmp=tmp[1].split('/');
13
- host=tmp[0].toLowerCase();
14
- if(host!=location.hostname.toLowerCase())
15
- {
16
- var ct_action = document.createElement("input");
17
- ct_action.name='cleantalk_hidden_action';
18
- ct_action.value=action;
19
- ct_action.type='hidden';
20
- document.forms[i].appendChild(ct_action);
21
-
22
- var ct_method = document.createElement("input");
23
- ct_method.name='cleantalk_hidden_method';
24
- ct_method.value=document.forms[i].method;
25
- ct_method.type='hidden';
26
- document.forms[i].method='POST';
27
- document.forms[i].appendChild(ct_method);
28
-
29
- document.forms[i].action=ct_blog_home;
30
- }
31
- }
32
- }
33
- }
34
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/inc/cleantalk_nocache.js DELETED
@@ -1,216 +0,0 @@
1
- /*
2
- Assign default values for backend variables.
3
- */
4
- if (typeof ct_set_cookies_flag === 'undefined') {
5
- ct_set_cookies_flag = true;
6
- }
7
-
8
- if (typeof ct_ajaxurl === 'undefined') {
9
- ct_ajaxurl = '/wp-admin/admin-ajax.php';
10
- }
11
-
12
- function sendRequest(url,callback,postData) {
13
- var req = createXMLHTTPObject();
14
- if (!req) return;
15
- var method = (postData) ? "POST" : "GET";
16
-
17
- var protocol = location.protocol;
18
- if (protocol === 'https:') {
19
- url = url.replace('http:', 'https:');
20
- } else {
21
- url = url.replace('https:', 'http:');
22
- }
23
-
24
- req.open(method,url,true);
25
- if (postData)
26
- req.setRequestHeader('Content-type','application/x-www-form-urlencoded');
27
- req.onreadystatechange = function () {
28
- if (req.readyState != 4) return;
29
- if (req.status != 200 && req.status != 304) {
30
- // alert('HTTP error ' + req.status);
31
- return;
32
- }
33
- callback(req);
34
- };
35
- if (req.readyState == 4) return;
36
- req.send(postData);
37
- }
38
-
39
- var XMLHttpFactories = [
40
- function () {return new XMLHttpRequest()},
41
- function () {return new ActiveXObject("Msxml2.XMLHTTP")},
42
- function () {return new ActiveXObject("Msxml3.XMLHTTP")},
43
- function () {return new ActiveXObject("Microsoft.XMLHTTP")}
44
- ];
45
-
46
- function createXMLHTTPObject() {
47
- var xmlhttp = false;
48
- for (var i=0;i<XMLHttpFactories.length;i++) {
49
- try {
50
- xmlhttp = XMLHttpFactories[i]();
51
- }
52
- catch (e) {
53
- continue;
54
- }
55
- break;
56
- }
57
- return xmlhttp;
58
- }
59
-
60
- function ct_getCookie(name) {
61
- var matches = document.cookie.match(new RegExp(
62
- "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
63
- ));
64
- return matches ? decodeURIComponent(matches[1]) : undefined;
65
- }
66
-
67
- function ct_setCookie(name, value)
68
- {
69
- if (ct_set_cookies_flag) {
70
- document.cookie = name+" =; expires=Thu, 01 Jan 1970 00:00:01 GMT; path = /";
71
- document.cookie = name+" =; expires=Thu, 01 Jan 1970 00:00:01 GMT";
72
-
73
- var date = new Date;
74
- date.setDate(date.getDate() + 1);
75
- setTimeout(function() { document.cookie = name+"=" + value + "; expires=" + date.toUTCString() + "; path = /;"}, 500);
76
- }
77
-
78
- return null;
79
- }
80
-
81
- function ct_callback(req)
82
- {
83
- ct_cookie=req.responseText.trim();
84
- //alert('Key value: ' + ct_cookie);
85
-
86
- ct_setCookie('ct_checkjs', ct_cookie);
87
-
88
- for(i=0;i<document.forms.length;i++)
89
- {
90
- f=document.forms[i];
91
- for(j=0;j<f.elements.length;j++)
92
- {
93
- e=f.elements[j];
94
- if(e.name!==undefined&&e.name.indexOf('ct_checkjs')!=-1)
95
- {
96
- e.value=ct_cookie;
97
- //alert('Form #' + i + ', field ' + e.name + ' = ' + ct_cookie);
98
- }
99
- }
100
- }
101
-
102
- //alert('Set cookie: \n' + document.cookie);
103
- }
104
-
105
- if (!Date.now) {
106
- Date.now = function() { return new Date().getTime(); }
107
- }
108
-
109
- if(ct_nocache_executed==undefined)
110
- {
111
- var ct_nocache_executed=true;
112
- var new_timestamp=Math.floor(Date.now() / 1000);
113
-
114
- var old_timestamp=ct_getCookie('ct_timestamp');
115
-
116
- var checkjs_cookie=ct_getCookie('ct_checkjs');
117
-
118
- if(checkjs_cookie!=undefined)
119
- {
120
- for(i=0;i<document.forms.length;i++)
121
- {
122
- f=document.forms[i];
123
- for(j=0;j<f.elements.length;j++)
124
- {
125
- e=f.elements[j];
126
- if(e.name!==undefined&&e.name.indexOf('ct_checkjs')!=-1)
127
- {
128
- e.value=checkjs_cookie;
129
- //alert('Form #' + i + ', field ' + e.name + ' = ' + ct_cookie);
130
- }
131
- }
132
- }
133
- }
134
-
135
- if((old_timestamp==undefined||new_timestamp-old_timestamp>86400||checkjs_cookie==undefined)) //86400 is 24 hours
136
- {
137
- ct_setCookie('ct_timestamp', new_timestamp);
138
- sendRequest(ct_ajaxurl+'?'+Math.random(),ct_callback,'action=ct_get_cookie');
139
- }
140
-
141
- if(typeof ct_info_flag !== 'undefined' && ct_info_flag)
142
- {
143
-
144
- var cleantalk_user_info={};
145
-
146
- var cleantalk_screen_info={};
147
- for(var prop in screen)
148
- {
149
- if (navigator[prop] instanceof Object || screen[prop]==='') continue
150
- cleantalk_screen_info[prop]=screen[prop];
151
- }
152
-
153
- cleantalk_user_info.screen=cleantalk_screen_info;
154
-
155
- var cleantalk_plugins=Array();
156
- var prev
157
- var cnt=0;
158
- for(var i=0;i<navigator.plugins.length;i++)
159
- {
160
- var plugin = navigator.plugins[i];
161
- var plugin = plugin.name+" "+(plugin.version || '')
162
- if (prev == plugin ) continue;
163
- cleantalk_plugins[cnt]=plugin;
164
- cnt++;
165
- prev = plugin
166
- }
167
- cleantalk_user_info.plugins=cleantalk_plugins;
168
-
169
- cleantalk_user_info.timezone_offset = -new Date().getTimezoneOffset()/60;
170
- cleantalk_user_info.datetime = Math.round((new Date().getTime())/1000);
171
-
172
- cleantalk_user_info.browser_x=document.documentElement.clientWidth;
173
- cleantalk_user_info.browser_y=document.documentElement.clientHeight;
174
-
175
- var ua = navigator.userAgent.toLowerCase();
176
- var flashInstalled = 0;
177
- if (typeof(navigator.plugins)!="undefined"&&typeof(navigator.plugins["Shockwave Flash"])=="object")
178
- {
179
- flashInstalled = 1;
180
- }
181
- else if (typeof window.ActiveXObject != "undefined")
182
- {
183
- try
184
- {
185
- if (new ActiveXObject("ShockwaveFlash.ShockwaveFlash"))
186
- {
187
- flashInstalled = 1;
188
- }
189
- } catch(e) {};
190
- };
191
-
192
- cleantalk_user_info.is_flash=flashInstalled;
193
-
194
- isVisitedMain=-1;
195
- if(location.href=='http://'+location.hostname+'/' || location.href=='https://'+location.hostname+'/')
196
- {
197
- isVisitedMain=1;
198
- setTimeout(function() { document.cookie = "ct_visited_main = 1; path = /;"}, 500);
199
- }
200
-
201
-
202
- ct_visited_main = ct_getCookie('ct_visited_main');
203
- if(ct_visited_main==undefined && isVisitedMain==-1)
204
- {
205
- isVisitedMain=0;
206
- }
207
- else
208
- {
209
- isVisitedMain=1;
210
- }
211
-
212
- cleantalk_user_info.is_main=isVisitedMain;
213
-
214
- setTimeout(function() { document.cookie = "ct_user_info = "+escape(JSON.stringify(cleantalk_user_info))+"; path = /;"}, 500);
215
- }
216
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/inc/images/logo.png DELETED
Binary file
trunk/inc/images/logo_color.png DELETED
Binary file
trunk/inc/images/logo_small.png DELETED
Binary file
trunk/inc/images/logo_small1.png DELETED
Binary file
trunk/inc/images/no.png DELETED
Binary file
trunk/inc/images/no_gray.png DELETED
Binary file
trunk/inc/images/preloader.gif DELETED
Binary file
trunk/inc/images/yes.png DELETED
Binary file
trunk/inc/images/yes2.png DELETED
Binary file
trunk/inc/images/yes_gray.png DELETED
Binary file
trunk/inc/sfw_die_page.html DELETED
@@ -1,65 +0,0 @@
1
- <!doctype html>
2
-
3
- <html lang="en">
4
- <head>
5
- <meta charset="utf-8" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1" />
7
-
8
- <!-- <title></title> -->
9
-
10
- <!--[if lt IE 9]>
11
- <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
12
- <![endif]-->
13
- <style>
14
- html{font-size: 14pt;}
15
- h1{text-align:center}
16
- h1.main{margin-top: 1em;margin-bottom: 3em;}
17
- div.container {text-align:center;}
18
- div.container p.js_notice{width: 60%; display: inline-block;}
19
- div.footer {color: #666; position: absolute; bottom: 1em; text-align: center; width: 100%;}
20
- div.footer a {color: #666; vertical-align:bottom; text-align: center;}
21
- div#js_passed {display:none;}
22
-
23
- @media (max-width: 600px) {
24
- }
25
- </style>
26
- <script>
27
- var reload_timeout = 3000;
28
- function set_spamFireWallCookie(cookie_name, cookie_value) {
29
- document.cookie = cookie_name + "=" + escape(cookie_value) + "; path=/;";
30
- return null;
31
- }
32
- function get_current_url() {
33
- document.write(window.location.href);
34
- return null;
35
- }
36
- </script>
37
- </head>
38
-
39
- <body>
40
- <div class="container">
41
- <h1 class="main">SpamFireWall is activated for your IP <a href="https://cleantalk.org/blacklists/{REMOTE_ADDRESS}" target="_blank">{REMOTE_ADDRESS}</a></h1>
42
-
43
- <div id="js_info"><br />To continue working with web site, please make sure that you have enabled JavaScript.</div>
44
-
45
- <div id="js_passed">
46
- <h3>Please click bellow to pass protection,</h3>
47
- <a href="{REQUEST_URI}"><script>get_current_url();</script></a>
48
- <br /><br /><br />
49
- <p class="js_notice">Or you will be automatically redirected to the requested page after 3 seconds.</p>
50
- </div>
51
- </div>
52
- <div class="footer">
53
- <a href="https://cleantalk.org" target="_blank">Anti-Spam by CleanTalk</a>
54
- </div>
55
- <script type="text/javascript">
56
- document.getElementById('js_info').style.display = 'none';
57
- document.getElementById('js_passed').style.display = 'block';
58
- set_spamFireWallCookie('ct_sfw_pass_key','{SFW_COOKIE}');
59
- set_spamFireWallCookie('ct_sfw_passed','1');
60
- setTimeout(function(){
61
- window.location.reload(1);
62
- }, reload_timeout);
63
- </script>
64
- </body>
65
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/readme.txt DELETED
@@ -1,1508 +0,0 @@
1
- === Spam Protection by CleanTalk ===
2
- Contributors: znaeff, shagimuratov
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, booking, order, subscription, gravity spam, jetpack, bots, contact form 7, contact form, registrations, ninja, Fast Secure Contact, Gravity forms, formidable, mailchimp, s2member, protection, protect, email, akismet, plugin, contact, recaptcha, google captcha, google recaptcha, math, security, login, blacklist, prevent spam comments, wordpress, User Frontend, bulk delete, bulk remove, cloudflare, widget, review, auth forms, firewall, ddos, 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, spam trackbacks, anti-spam plugin, varnish, amp, spam free
4
- Requires at least: 3.0
5
- Tested up to: 4.5.2
6
- Stable tag: 5.41
7
- License: GPLv2
8
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
-
10
- Max power spam protection, all-in-one, premium anti-spam. No comments spam & registrations spam, no email spam, protects any forms. Forget spam.
11
-
12
- == Description ==
13
- No CAPTCHA, no questions, no animal counting, no puzzles, no math and no spam bots. Formerly 'Anti-Spam by CleanTalk'.
14
-
15
- = AntiSpam features =
16
- 1. Stops spam comments.
17
- 1. Stops spam registrations.
18
- 1. Stops spam contact emails.
19
- 1. Stops spam orders.
20
- 1. Stops spam bookings.
21
- 1. Stops spam subscriptions.
22
- 1. Stops spam in widgets.
23
- 1. Check existing comments for spam.
24
-
25
- = Public reviews =
26
- > Using CleanTalk on WPLift was a great test as we receive huge amounts of spam.
27
- > *Oliver Dale, <a href="http://wplift.com/wordpress-anti-spam-plugin" target="_blank">WPLift.com</a>.*
28
-
29
- = Comments spam protection =
30
- Supports native WordPress, JetPack comments and any other comments plugins. Plugin moves spam comments to SPAM folder or you can set options to silently ban spam comments. You can enable options in the plugin settings to auto delete comments from SPAM folder.
31
-
32
- = Spam bots registrations filter =
33
- Filters spam bots on registration forms WordPress, BuddyPress, bbPress, S2Member, WooCommerce, Profile builder and any other registrations plugins.
34
-
35
- = Protection against contact form spam =
36
- Plugin is tested and ready to protect against spam emails via Formidable forms, Contact form 7, JetPack Contact form, Fast Secure Contact form, Ninja forms, Landing pages, Gravity forms and any themes/custom contact forms.
37
-
38
- = WooCommerce spam filter =
39
- Anti-spam by CleanTalk filters spam registrations and spam reviews for WooCommerce. Plugin is fully compatible with WooCommerce 2.1 and higher.
40
-
41
- = Newsletters filter =
42
- Anti-spam by CleanTalk filters spam subscriptions for MailPoet, MailChimp, PopupAlly and many other newsletters plugins.
43
-
44
- = Spam filter for themes contact forms =
45
- Plugin blocks spam emails via any themes (built-in) contact forms. With AJAX forms plugin silently (without any error notices on WordPress frontend) filters spam emails.
46
-
47
- = bbPress spam filter =
48
- Protects everything about bbPress: registrations, topics, replies.
49
-
50
- = Other spam filters =
51
- * WordPress Landing Pages.
52
- * WP User Frontend.
53
- * Any WordPress form (options for 'Custom contact forms').
54
- * Any submission to site (options for 'Check all POST data')
55
-
56
- = Compatible with WordPress cache plugins =
57
- * W3 Total Cache, Quick Cache, WP Fastest Cache, Hyper Cache, WP Super cache and any other cache plugins.
58
-
59
- = Check existing comments for spam. Bulk comment removal =
60
- With the help of anti-spam by CleanTalk you can check existing comments to find and quickly delete spam comments at once. To use this function, go to WP Console->Comments->Find spam comments.
61
-
62
- = Check existing users for spam. Bulk account removal =
63
- With the help of anti-spam by CleanTalk you can check existing accounts to find and quickly delete spam users at once. For use this function, go to WP Console->Users->Check for spam.
64
-
65
- = Blocking users by country =
66
- Automatically block comments and registration from the countries for which you have set a ban. This option is useful in cases of protection from manual spam and gains protection. If your site is not aimed at an international audience and you do not expect comments/users from other countries.
67
-
68
- = Blocking comments by "stop words" =
69
- You can block comments containing "stop words" to enhance spam filtering and blocking messages containing obscene words. You can add a certain words or phrases.
70
-
71
- = Private Black Lists for Anti-Spam service =
72
- Automatically block comments and registrations from your private black IP/email address list. This option helps to strengthen the protection of a manual spam or block unwanted comments from users.
73
-
74
- = Private Black List for Spam FireWall =
75
- It allows you to add individual IP addresses and subnets to Spam FireWall. It blocks attacks from IP addresses are not included in the SFW base yet. This option can help to block HTTP/HTTPS DDoS, SQL, brute force attacks and any others that are made through the HTTP/HTTPS.
76
-
77
- = Low false/positive rate =
78
- This plugin uses multiple anti-spam tests to filter spam bots with as lower false/positive rate as possible. Multiple anti-spam tests avoid false/positive blocks for real website visitors even if one of the tests fail.
79
-
80
- = How CleanTalk improves SEO for your website? =
81
- So, you already know that the speed of the site has a direct impact on SEO.
82
-
83
- *CleanTalk works faster than most of the other anti-spam plugins.* It is common knowledge that the faster your site loads, the better your customer experience is, the better your SEO will be, and the better your site will convert. Speed is becoming increasingly important in SEO, conversion and user experience. Today, site speed is one of the most important ranking factors on Google. A site that loads slowly will lose visitors and potential revenue.
84
-
85
- There are different ways of improving your site's loading performance. One important parameter for site performance is to install well-developed plugins from a reputable source.
86
-
87
- Among anti-spam plugins CleanTalk Anti-Spam is one of the fastest. Despite the large plug-in functionality, the developers have optimized the performance of the plugin so that CleanTalk is faster than most analogs. This contributes to the cloud service architecture, as all calculations take place in the cloud, not on the server, the server receives the finished result for further action.
88
-
89
- https://s.w.org/plugins/cleantalk-spam-protect/screenshot-5.png?r=1288723
90
-
91
- = How CleanTalk works? =
92
- * A visitor writes a comment or registers
93
- * CleanTalk plugin sends action parameters into the CleanTalk cloud
94
- * Service analyzes the parameters
95
- * If this is a visitor, the comment will be published. If it’s a spam bot, then CleanTalk blocks this comment or registration.
96
- * Parameters are written to the log which can be viewed in the Control Panel service.
97
-
98
- The CleanTalk team has been developing cloud-based spam protection for 5 years and has created a truly reliable anti-spam service designed for you to ensure your safety.
99
-
100
- = Spam attacks log =
101
- Service CleanTalk (this plugin is a client application for CleanTalk anti-spam service) records all filtered comments, registration and other spam attacks in the "Log of spam attacks" and stores the data in the log for up to 45 days. Using the log, you can ensure reliable protection of your website from spam and no false/positive filtering.
102
-
103
- = SpamFireWall =
104
- CleanTalk has an advanced option "SpamFireWall". This option allows blocking the most active spam bots before they get access to your website. It prevents
105
- spam bots from loading website pages so your web server doesn't have to perform all scripts on these pages. Also it prevents scanning of pages of the
106
- website by spam bots. Therefore SpamFireWall significantly reduces the load on your web server.
107
- SpamFireWall also makes CleanTalk the two-step protection from spam bots.
108
- SpamFireWall is the first step and it blocks the most active spam bots.
109
- CleanTalk Anti-Spam is the second step and checks all other requests on the website in the moment of submitting comments/registers etc.
110
-
111
- = How SpamFireWall works? =
112
- * The visitor enters to your web site.
113
- * HTTP request data is checked against the nearly 5.8 million identified IP spam bots.
114
- * If it is an active spam bot, the bot gets a blank page, if it is a visitor then they receive the site page. This is completely transparent to the visitors.
115
-
116
- All the CleanTalk SpamFireWall activity is being logged in the process of filtering.
117
-
118
- = SpamFireWall DDoS Protection (Experimentally option) =
119
- SpamFireWall can mitigate HTTP/HTTPS DDoS attacks. When an intruder makes GET requests to attack your website, SpamFireWall blocks all requests from bad IP addresses. Your website gives the intruder a special page with description of DDoS rejection instead of the website pages. Therefore SpamFireWall can help to reduce CPU usage on your server.
120
-
121
- = XML-RPC brute force protection =
122
- SpamFireWall can mitigate XML-RPC brute force attacks. It blocks XML-RPC attacks from bad IP addresses. This helps to prevent bruteforce attacks by a Remote Procedure Call.
123
-
124
- = No spam comments, no spam registrations, no spam contact emails, no spam trackbacks. CAPTCHA-less anti-spam for WordPress =
125
- Spam is one of the most irritating elements. Rates for spam increases every year and conventional anti-spam can no longer handle all the spam bots. CleanTalk prevents and automatically blocks spam. You'll be surprised how effective CleanTalk is in protecting against spam.
126
-
127
- = AntiSpam plugin info =
128
- CleanTalk is an all-in-one anti-spam solution for WordPress that protects login, comments, contact and WooCommerce forms at once. You don't need to install separate anti-spam plugins for each form. This allows your blog to work faster and save resources. After installation you will forget about spam; your CleanTalk plugin will do all the work. You won't have to deal with spam as CleanTalk does this for you automatically.
129
-
130
- CleanTalk is a transparent anti-spam tool, we provide detailed statistics of all entering comments and logins. You can always be sure that **there are no errors**. We have developed a mobile app for you to see anti-spam statistics wherever.
131
-
132
- We have developed anti-spam for WordPress that provides maximum protection from spam bots, allowing you to provide your visitors a simple and convenient form of comments/registrations without annoying CAPTCHAs and puzzles. CleanTalk detects spam in multistage tests allowing us to block up to 99.998% of spam bots.
133
-
134
- The anti-spam method offered by CleanTalk avoids methods that inconvenience the communication (CAPTCHA, question-answer etc.), and offers your site visitors a more convenient one.
135
-
136
- CleanTalk is a premium anti-spam service for WordPress and the plugin works with our cloud anti-spam CleanTalk Service. CleanTalk offers a free trial and you can look at the <a href="https://cleantalk.org/price">pricing</a> here. We provide anti-spam services at the highest level. To maintain this level we cannot afford to offer a free version of our service, as this will immediately affect the quality of providing anti-spam protection. Paying for a year of anti-spam service, you save a lot more and receive:
137
-
138
- * Up to 99.998% protection against spam bots.
139
- * Time and resources saving.
140
- * More registrations/comments/visitors.
141
- * Protect several websites at once at different CMS.
142
- * Easy to install and use.
143
- * Traffic acquisition and user loyalty.
144
- * 24/7 technical support.
145
- * Clear statistics.
146
- * No captcha (reCaptcha), puzzles, etc.
147
- * Free mobile app to control anti-spam function at your website.
148
-
149
- = Additional features =
150
- * Online, daily and weekly anti-spam reports traffic VS spam.
151
- * Apps for iPhone, Android to control anti-spam service, comments, signups, contacts, with traffic and spam statistics for last 7 days.
152
- * AntiSpam apps for most popular CMS on cleantalk.org.
153
-
154
- = How to protect sites from spam bots without CAPTCHA? =
155
- The most popular method is CAPTCHA - the annoying picture with curved and sloping symbols, which are presented to the visitor to decipher and fill in. It is supposed that spam bots won't discern these CAPTCHA, but a visitor will. CAPTCHA provokes great irritation, but if the visitor wants to comment, he has to fill in these symbols time after time, making mistakes and starting once again.
156
- Sometimes CAPTCHA reminds us of the doodles of a two year old child. For users with vision problems CAPTCHA is an insurmountable obstacle. Users hate captcha. Captcha for users means "hate". Unreadable CAPTCHA stops about 80% of site visitors. After 2 failed attempts to decipher CAPTCHA 95% of visitors reject further attempts. At the sight of CAPTCHA and after input errors, many visitors leave the resource. Thus, CAPTCHA helps to protect the resource both from bots and visitors. CAPTCHA is not a panacea from spam. Doubts concerning the Need for CAPTCHA?
157
-
158
- *“Ultimately, CAPTCHAs are useless for spam because they’re designed to tell you if someone is ‘human’ or not, but not whether something is spam or not.” Matt Mullenweg*
159
-
160
- You do not have to work in IT to know what spam is. Besides piles of unwanted email, there are spam bots, or special software programs designed to act as human website visitors that post unwelcome messages over the Internet to advertise dubious services. More often than not spam messages do not even make sense. Similar to bacteria and virus mutations developing antibiotic resistance, spam bots are becoming more resilient in penetrating Internet firewalls and security layers.
161
-
162
- *Why are they spamming me?*
163
-
164
- Spammers want to get backlinks from your site to improve their site's PageRank or redirect your visitors to malicious sites.This level of spam can damage your reputation with readers and commentators if you fail to tackle it. It is not uncommon for some WordPress websites to receive hundreds or even thousands of comments every week. However, by using a CleanTalk plugin, spam can be easily handled by your WordPress website.
165
-
166
- = CleanTalk's features =
167
- CleanTalk is one of the fastest plugins that allows you to lower the server load. One of the important parameters for each web master is the speed of the site, so we make sure that our plugin consumes as little as possible of server resources. Cloud service provides the advantage that all the checks take place in the cloud.
168
-
169
- CleanTalk has developed unique algorithms to assess visitor behavior. CleanTalk analyzes user behavior and parameters of completed forms. Our anti-spam module, installed on your website, sends the behavior parameters of either a visitor or spam bot. These parameters are estimated, and the CleanTalk service makes a decision – to post a message or to define it as spam and reject. On the basis of such checks, the service forms its own list of email addresses used by spam bots.
170
-
171
- The registrations of visitors are checked in a similar manner. The service adds not only email addresses to the blacklist, but also IP addresses and domains of websites that are promoted through spam mailout. All of this happens automatically and requires no action from the administration of the website. At 2.5 million queries the service makes a mistake in 40-45 cases, i.e. CleanTalk detects spam with 99.9982% accuracy. We constantly monitor these errors and make adjustments to our algorithms, Even with this exceptional accuracy our team is aiming to improve figures over time.
172
-
173
- All-in-one. CleanTalk immediately protects all forms – comments, registration, feedback, contacts. No need to install additional plugins for each form. You save resources and increase performance of your website.
174
-
175
- Spam attacks log. Service CleanTalk records all filtered comments, registration and other spam attacks in the “Log of spam attacks” and stores the data in the log for up to 45 days. Using the log, you can ensure reliable protection of your website from spam and experience no false/positive filtering.
176
-
177
- With the help of anti-spam by CleanTalk you can check existing comments and users, to find and quickly delete spam comments at once. This allows administrators of websites to automatically check and identify spam bots, comments and users, which were not detected by conventional anti-spam tools. Checking existing comments and users is made against a database of the nearly 2 million certain spam bots. Detailed statistic allows CleanTalk customers to control the whole process.
178
-
179
- CleanTalk has an advanced option “SpamFireWall”. This option allows you to block the most active spam bots before they get access to your website. It prevents website pages loading when attempted by by spam bots, so your web server doesn’t perform unnecessary scripts on these pages. Also it prevents scanning of website pages by spam bots. Subsequently SpamFireWall significantly reduces the load on your web server. SpamFireWall can mitigate HTTP/HTTPS DDoS attacks. When an intruder makes GET requests to attack your website, SpamFireWall will block requests from bad IP addresses. Your website gives the intruder a special page with a description of DDoS rejection instead of the website pages. SpamFireWall can help to reduce of CPU usage on your server for this reason.
180
-
181
- “CleanTalk team has been developing a cloud spam protection system for five years and has created a truly reliable anti-spam service designed for you to guarantee your safety”.
182
-
183
- = We recommend =
184
- Audience engagement plugin <a href="http://wordpress.org/plugins/feedweb/">Feedweb</a>
185
-
186
- > Max power, all-in-one, premium anti-spam WordPress plugin. No comments & registrations spam, no contact spam, protects any forms. Just install and forget spam.
187
-
188
- == Installation ==
189
- = Spam protection plugin setup =
190
- 1. Download, install and activate Anti-spam by CleanTalk.
191
- 1. Get Access key <a href="https://cleantalk.org/register?platform=wordpress" target="_blank">https://cleantalk.org/register</a>
192
- 1. Enter Access key in the settings,
193
-
194
- > WordPress console -> Settings -> CleanTalk
195
-
196
- 1. Do dummy spam comment (registration or contact message) with email **stop_email@example.com**. You should see notice,
197
-
198
- > *** Forbidden. Sender blacklisted. ***
199
-
200
- **Important**
201
- To test spam protection you must post a dummy submissions as website visitor (use must logged out from WordPress console), because the plugin doesn't filter submissions from WordPress administrators.
202
-
203
- Done! The plugin is ready to use.
204
-
205
- = How can setup plugin in WPMU version? =
206
- In WordPress multisite version you can switch the plugin to use Global Access key. In this way the plugin doesn't show any options to enter Access key in plugin settings and doesn't show Trial banner in WordPress backend. To setup global CleanTalk access key for all websites in WPMU, define constant in your wp-config.php file before defining database constants:
207
-
208
- define('CLEANTALK_ACCESS_KEY', 'place your key here');
209
-
210
- Now, all subsites will have this access key.
211
-
212
- = Manage and control spam protection =
213
- Go to <a href="https://cleantalk.org/my" target="_blank">Dashboard</a> at the cleantalk.org or use <a href="https://play.google.com/store/apps/details?id=org.cleantalk.app">Android</a>, <a href="https://itunes.apple.com/us/app/cleantalk/id825479913?mt=8">iPhone</a> anti-spam app to manage and control spam protection.
214
-
215
- == Frequently Asked Questions ==
216
- = Does the plugin protect from brute force, DoS attacks and spam attacks? =
217
- Yes, it does. Please turn the option 'SpamFireWall' on in the plugin settings to protect your website from DoS/DDoS, XML-RPC attacks.
218
-
219
- = Is the anti-spam protection safe for mobile visitors? =
220
- Yes, it is. The plugin doesn't block mobile visitors as well as desktop website visitors. It uses several independent anti-spam tests to decrease the number of false outcomes and to have as low false-positive rate as possible. Multiple anti-spam tests help to avoid false/positive blocks for real website visitors even if one of the tests failed.
221
-
222
- = What does the plugin do with spam comments? =
223
- Spam comments are being moved to SPAM folder by default or you can set the option to ban spam comments silently.
224
-
225
- = How does the plugin stop spam? =
226
- The plugin uses several simple tests to stop spammers:
227
-
228
- 1. **JavaScript anti-spam test.** 99% of spam bots don't have full JavaScript functions support. So, the plugin has the code which can be run by normal visitor and can't be run by the spam bot.
229
- 1. **Email, IP, domain spam activity list entries check.** The plugin uses spam activity database online at cleantalk.org, consisting of more than 20 billion spam activity records of IPs, Emails, Domains and ASN. If the sender's IP or Email is in the database, the sender gets some spam scores. To reduce false/positive rate the plugin not only uses the blacklist test to ban spammers, the sender will be banned when and only when multiple spam tests have been failed.
230
- 1. **Comment submit time.** Spam bots usually submit the info immediately after the page has been loaded, this happens because spam bots don't actually fill the web form, they just send $_POST data to the blog. The normal visitor sends the data after several seconds or minutes.
231
-
232
- = Will the anti-spam plugin protect my theme? =
233
- Yes, it will. The Anti-spam by CleanTalk is compatible with any WordPress theme.
234
-
235
- = How can I test the anti-spam protection? =
236
- Please use the email **stop_email@example.com** for comments, contacts or signups to see how the anti-spam protection works. Also you can see the logs for the last 7 days at the <a href="http://cleantalk.org/my/show_requests">Control panel</a> or look at the folder "Spam" for banned comments.
237
-
238
- = Is the plugin effective against spam bots? =
239
- The plugin Anti-Spam by CleanTalk stops up to 99.998% of spam comments, spam signups (registrations), spam contact emails, spam subscriptions, spam bookings or spam orders.
240
-
241
- = What about pingback, trackback spam? =
242
- The plugin passes pingbacks without any checks by default. All trackbacks will be blocked if the sender had spam activity.
243
-
244
- = Can I use CleanTalk with Akismet? =
245
- Sure, you can use CleanTalk with Akismet. In this case you will probably have higher false/positive rate (when legitimate comments/signups are being denied), but you will have stronger antispam protection on your website.
246
-
247
- = Is CleanTalk better than Akismet? =
248
- Please look at this features comparison here https://cleantalk.org/cleantalk-vs-akismet
249
-
250
- = Can I use CleanTalk to remove pending spam comments? =
251
- Yes, you can. The plugin has the option to test all pending comments via database of <a href="https://cleantalk.org/blacklists">spam active IP/Email</a>, found spam comments will be moved to Trash folder.
252
-
253
- = How does the plugin find spam in pending comments or registered accounts? =
254
- The plugin checks all non-spam comments in the blacklist database and shows you those senders who have spam activity on other websites.
255
- There are some differences between blacklist database and API to protect you from spam bot registrations/comments online. Blacklists show all history of spam activity, but our API (which is used in spam tests) relies on other parameters too: last day of activity, number of spam attacks during the last days etc. These mechanisms help us to reduce the number of false outcomes. So, there is nothing strange, if some emails/IPs are not found by bulk comments/accounts test.
256
-
257
- To check comments please go here:
258
- > WordPress console -> Comments -> Find spam comments
259
-
260
- To check users please go here:
261
- > WordPress console -> Users -> Find spam users
262
-
263
- = Should I use other anti-spam tools (Captcha, reCaptcha and etc.)? =
264
- CleanTalk stops up to 99.998% of spam bots, so you can disable other anti-spam plugins (especially CAPTCHA-type anti-spam plugins). In some cases several anti-spam plugins could conflict with each other, so it would be better to use just one plugin.
265
-
266
- = Is the plugin compatible with WordPress MultiUser (WPMU or WordPress network)? =
267
- Yes, the plugin is compatible with WordPress MultiUser. Each blog in multisite environment has individual anti-spam options for the protection from spam bots.
268
-
269
- = After the installation I noticed that the number of spam attacks has been increased in the statistics =
270
- There are a few reasons for this:
271
-
272
- * With the indexing of your web-site by the search systems, appearance of external links and better search results position, your web-site attracts more and more spambots.
273
- * Non-transparent protection systems like CAPTCHA or question/answer, that don't have spam attacks statistics, don't let you see the whole picture, or the picture is incomplete.
274
- * Counting methods for spam attacks and spam bots are different for different systems, thus the diversity appears. We seek to provide detailed statistics.
275
-
276
- = Why my dummy "spam" comment passed to the WordPress? =
277
- The plugin has several options to detect spam bots and humans. If you just post spammy text like this:
278
-
279
- "I want to sell something", "Buy something here.." and etc
280
-
281
- the comments will be passed, because the plugin detects sender as a human. So, use special email *stop_email@example.com* to test the anti-spam functionality or wait a few days to see how the plugin works.
282
-
283
- = Is it free or paid? =
284
- The plugin is free. But the plugin uses CleanTalk cloud service to filter spam bots. You have to register an account and then you will receive a free trial to test anti-spam for comments, registrations, bookings, contacts or orders. When the trial (on CleanTalk account) is finished, you can renew the subscription for 1 year or deactivate anti-spam plugin.
285
-
286
- = Can I use CleanTalk with cache plugins? =
287
- Anti-spam by CleanTalk doesn't use static HTML code in its templates, so all anti-spam functions work correctly with any WordPress cache plugins.
288
-
289
- = Does the plugin protect from spam bots if I use forms with third-party services? =
290
- Yes, it does. Plugin protects web-forms on your websites which send data to third-party servers (like MailChimp). To enable this protection set the option 'Protect external forms' in the plugin settings.
291
-
292
- = Does CleanTalk compatible with Cloudflare? =
293
- CleanTalk is fully compatible with CloudFlare. Service doesn't filter CloudFlares IP's (AS13335) through blacklists database, so in this case plugin/service filters spam bots using other anti-spam tests.
294
-
295
- = Is CleanTalk compatible with a content delivery network (CDN)? =
296
- Yes, it is. CleanTalk works with any CDN system, i.e. CloudFlare, MaxCDN, Akamai.
297
-
298
- = Can I use CleanTalk functionality in my plugins? =
299
- Yes, you can. Just use following snippet:
300
-
301
- <?php
302
- if(!function_exists('ct_test_message')){
303
- include_once( ABSPATH . '/wp-content/plugins/cleantalk-spam-protect/cleantalk.php' );
304
- }
305
- //for registration test:
306
- $res=ct_test_registration("nickname", "stop_email@example.com", "127.0.0.1");
307
- //or for some other messages (contact forms, comments etc.)
308
- $res=ct_test_message("nickname", "stop_email@example.com", "127.0.0.1", "test message");
309
-
310
-
311
- $res now contents array with two parameters:
312
- * $res['allow'] - is request allowed (1) or not (0)
313
- * $res['comment'] - comment for our server's decision.
314
-
315
- = I see two loads of script cleantalk_nocache.js. Why do you use it twice? =
316
- This script is used for AJAX JavaScript checking. Different themes use different mechanisms of loading, so we use two methods for loading our script. If you absolutely know what you are doing, you can switch one of the methods off by defining constants in your wp-config.php file:
317
-
318
- define('CLEANTALK_AJAX_USE_BUFFER', false); //false - don't use output buffering to include AJAX script, true - use it
319
-
320
- or
321
-
322
- define('CLEANTALK_AJAX_USE_FOOTER_HEADER', false); //false - don't use wp_footer() and wp_header() for including AJAX script, true - use it
323
-
324
- = Can I add exclusions for some pages of my site? =
325
- Yes, you can. Add this string in your wp-config.php file before defining database constants:
326
-
327
- $cleantalk_url_exclusions = Array('url1', 'url2', 'url3');
328
-
329
- Now, all pages containing strings 'url1', 'url2', or 'url3' will be excluded from anti-spam checking. Remember, that this option will not be applied in registration and comment checking — they are always protected from spam.
330
-
331
- = Can I not send my personal data to CleanTalk servers? =
332
- Yes, you can exclude your data. Add this string in your wp-config.php file before defining database constants:
333
-
334
- $cleantalk_key_exclusions = Array('key1', 'key2', 'key3');
335
-
336
- Now all fields in your submissions with the keys named 'key1', 'key2' or 'key3' will be excluded from spam checking.
337
-
338
- = How to test SpamFireWall? =
339
- Use special IP 10.10.10.10 in URL to test SpamFireWall. For example,
340
-
341
- https://cleantalk.org/blog/?sfw_test_ip=10.10.10.10
342
-
343
- = How can I enter access key in WPMU version? =
344
- To set up global CleanTalk access key for all websites in WPMU, define constant in your wp-config.php file before defining database constants:
345
-
346
- define('CLEANTALK_ACCESS_KEY', 'place your key here');
347
-
348
- Now, all subsites will have this access key.
349
-
350
- = Why is CleanTalk faster and more reliable than stand-alone solutions? =
351
- All anti-spam checks are held in the cloud and don't overload the web server. The cloud solutions have a huge advantage since the parameters are being compared with information from more than 100,000 websites.
352
-
353
- = I see a lot of blocked messages with the reason "Forbidden. Please enable JavaScript. Spam sender name." in my logs =
354
- A lot of spam bots can't perform JavaScript code, so it is one of the important checks and most of the spam bots will be blocked with the reason **"Forbidden. Please enable JavaScript. Spam sender name."** All browsers can perform JS code, so real visitors won't be blocked.
355
-
356
- If you or some of your visitors have the error **"Forbidden. Enable JavaScript."** please check JavaScript support in your browser and do this JavaScript test at this page: https://cleantalk.org/checkout-javascript-support.
357
-
358
- If you think that there is something wrong in the messages blocking, let us know about it. Please submit a support request here: https://cleantalk.org/my/support.
359
-
360
- = Does the plugin work with Varnish? =
361
- CleanTalk works with Varnish, it protects WordPress against spam, but by default the plugin generates a few cookies for the protection from spam bots and it also disables Varnish cache on pages where CleanTalk's cookies have been stored. To get rid of the issue with cache turn off the option 'Set cookies' in the plugin settings.
362
-
363
- WordPress console -> Settings -> CleanTalk -> Advanced settings
364
-
365
- Now the plugin will protect WordPress comments, registrations and most of popular contact forms, but will not protect some of rarely used contact forms.
366
-
367
- = Does the anti-spam plugin work with Accelerated Mobile Pages (AMP)? =
368
- Yes, it does. But you have to turn off the option 'Use AJAX for JavaScript check' in Advanced settigns of the plugin to be fully compatible with Accelerated Mobile Pages.
369
-
370
- = How to close renewal or trial notice in the WordPress backend? =
371
- To close the notice please save the plugin settings again or it will be closed automatically within 60 minutes after the renewal.
372
-
373
- == Other notes ==
374
-
375
- = Troubleshooting Guide =
376
- <a href="http://wordpress.org/support/plugin/cleantalk-spam-protect">Anti-spam by CleanTalk support forum</a> | <a href="http://wordpress.org/plugins/cleantalk-spam-protect/faq/">Plugin FAQ</a>
377
-
378
- You can contact to technical support for any questions at any time. If you have questions or suggestions, we will be happy to help you. Please note that we accept requests in English only.
379
-
380
- Technical Support 24/7 to help you get accustomed to the work of the anti-spam service.
381
-
382
- If you have specific needs, you can contact our Cleantalk customer support team at any time, day or night.
383
- We strive to answer all emails within 1-2 hours, and most are answered in substantially less time.
384
-
385
- When you contact CleanTalk technical support, we recommend to give us following:
386
-
387
- 1. Site URL.
388
- 1. CMS name and version.
389
- 1. URL of page with the comments / registration / feedback form.
390
- This will help us give you a faster response. Please write us here https://cleantalk.org/my/support.
391
-
392
- If you're having trouble getting things to work after installing the plugin, here are a few things to check:
393
-
394
- 1. If you haven't yet, please upgrade plugin to the latest version.
395
- 1. If you have error '*** Forbidden. Enable JavaScript. Anti-spam service cleantalk.org. ***' please check JavaScript support in your browser and do JavaScript test at this page <a href="http://cleantalk.org/checkout-javascript-support">Check out JavaScript support</a>.
396
- 1. If you have spam comments, signups or contacts please check the Access key at plugin settings. The key should be same as you can find in service <a href="https://cleantalk.org/my/">Dashboard</a>.
397
-
398
- = Spam protection, backend and frontend perfomance =
399
- We develop plugin to do it as optimized as possible, CleanTalk doesn't downgrade response time in backend or frontend. The plugin proccess only POST requests to WordPress core, it tackes less than 1 second to return results. Here are some P3 Profiler results from a real WordPress blog,
400
-
401
- > WordPress Plugin Profile Report
402
- > ===========================================
403
- > Report date: July 9, 2015
404
- > Theme name: amongsthumans (Canvas child theme)
405
- > Pages browsed: 24
406
- > Avg. load time: 2.1155 sec
407
- > Number of plugins: 28
408
- > Plugin impact: 45.25% of load time
409
- > Avg. plugin time: 0.9573 sec
410
- > Avg. core time: 0.1093 sec
411
- > Avg. theme time: 0.9339 sec
412
- > Avg. mem usage: 44.94 MB
413
- > Avg. ticks: 9,890
414
- > Avg. db queries : 65.00
415
- > Margin of error : 0.1149 sec
416
-
417
- > Plugin list:
418
- > ===========================================
419
- > P3 (Plugin Performance Profiler) - 0.1290 sec - 13.48%
420
- > Advanced Code Editor - 0.0045 sec - 0.47%
421
- > Bulk Comment Remove - 0.0029 sec - 0.30%
422
- > Bulk Delete - 0.0275 sec - 2.87%
423
- > Cleantalk Spam Protect - 0.0187 sec - 1.95%
424
- > Custom Share Buttons with Floating Sidebar - 0.0173 sec - 1.81%
425
- > Exclude Pages - 0.0009 sec - 0.10%
426
- > Google Sitemap Generator - 0.0032 sec - 0.34%
427
- > Jetpack by WordPress.com - 0.3644 sec - 38.06%
428
- > Last Modified Timestamp - 0.0031 sec - 0.32%
429
- > Le Petite Url - 0.0112 sec - 1.17%
430
- > Onenote Publisher - 0.0015 sec - 0.16%
431
- > Popups Premium Plugin - 0.0074 sec - 0.77%
432
- > Popups - WordPress Popup - 0.0419 sec - 4.37%
433
- > Post Duplicator - 0.0059 sec - 0.62%
434
- > Post Teaser - 0.0237 sec - 2.48%
435
- > Q2W3 Fixed Widget - 0.0017 sec - 0.18%
436
- > SSL Insecure Content Fixer - 0.0111 sec - 1.16%
437
- > TinyMCE Advanced - 0.0022 sec - 0.22%
438
- > Ultimate Follow Me Plugin by Free Blog Factory - 0.0008 sec - 0.08%
439
- > WooThemes Helper - 0.0282 sec - 2.95%
440
- > Wp Social Avatar - 0.0013 sec - 0.13%
441
- > WP User Avatar - 0.0559 sec - 5.84%
442
- > Wpcommentcleaner - 0.0119 sec - 1.24%
443
- > Wpdiscuz - 0.0369 sec - 3.85%
444
- > Online Backup for WordPress - 0.0039 sec - 0.41%
445
- > WPSSO Pro Update Manager (WPSSO UM) - 0.0114 sec - 1.19%
446
- > WordPress Social Sharing Optimization (WPSSO) Pro - 0.1288 sec - 13.45%
447
-
448
- = Translations =
449
- * Danish (da_DK)
450
- * French (fr_FR) - thanks to Gilles Santacreu <a href="http://net-ik.net">http://net-ik.net</a>
451
- * German (de_DE)
452
- * Italian (it_IT)
453
- * Polish (pl_PL)
454
- * Portuguese (pt_PT)
455
- * Spanish (es_ES) - thanks to Andrew Kurtis and <a href="http://www.webhostinghub.com/index-c.html">WebHostingHub</a>
456
- * Russian (ru_RU)
457
-
458
- = Requirements =
459
- WordPress 3.0 at least. PHP 5 with CURL or file_get_contents() function and enabled 'allow_url_fopen' setting. <a href="http://cleantalk.org/register?platform=wordpress">Sign up</a> to get an Access key.
460
-
461
- == Screenshots ==
462
- 1. AntiSpam settings.
463
- 1. AntiSpam stopped spam bot at the CAPTCHA less registration form. The plugin provide explanation to visitor and websites about eache rejected comment/registration or contact message.
464
- 1. Use AntiSpam analytics tool for each website in service Dashboard to have information about spam/legitimate statistics.
465
- 1. Use AntiSpam log to control anti-spam plugin.
466
- 1. CleanTalk works faster than most of other anti-spam plugins.
467
-
468
- == Changelog ==
469
- = 5.41 2016-05-31 =
470
- * Added HTTP response in plugin response if an network issue was happend.
471
- * Optimized JavaScript anti-spam test for Formidable forms.
472
- * Re-stored the option to auto redirect to plugn settings after plugin activation.
473
- * Updated Spanish, Russian translations.
474
- * Fixed issue with nasted fields in Formidable forms.
475
-
476
- = 5.40.3 2016-05-26 =
477
- * Added option to encrypt (SSL) connection to CleanTalk anti-spam servers.
478
- * Added JSON encoding for AJAX forms.
479
- * Obfuscated private data for Custom contact forms option.
480
- * Optimized bulk users check for spam over blacklists database.
481
- * Fixed issue with lost connection to servers and JavaScript anti-spam test.
482
- * Fixed issue with WordFence and collect_details.
483
-
484
- = 5.40.2 2016-05-11 =
485
- * Improved account status check logic.
486
- * Fixed issue with double anti-spam tests for FastSecure contact forms.
487
- * Fixed issue with nulled JavaScript variables assigned from backend. This issue might me occured on standart WordPress registration form and with failed JavaScript spam test.
488
- * Fixed issue with session_start() with PHP sessions stored in memcache.
489
-
490
- = 5.40.1 2016-04-28 =
491
- * Fixed issue with Super Socializer.
492
- * Fixed issue with spam filtration for logged in users and Formidable forms.
493
- * Added logging of all submitted fields for FastSecure contact form.
494
-
495
- = 5.40 2016-04-19 =
496
- * Added JSON encoding for posts that were protected via Custom contact forms option. It allows show anti-spam logs in the Dashboard in more comfortable view.
497
- * Minor fix in plugin settings.
498
- * Fixed pagination for bulk users spam test.
499
- * Fixed issue with unknown _SESSION.
500
- * Fixed issue with double SpamFireWall database upload.
501
-
502
- = 5.39.1 2016-04-04 =
503
- * Improved AJAX based anti-spam test with HTTPS backends.
504
- * Added fix to avoid issue with empty ct_info_flag on JavaScript side.
505
- * Added logic to exclude caching for SpamFireWall.
506
- * Removed a condition to skip accounts with 127.0.0.1 IP in spam test for registered acconts.
507
-
508
- = 5.38.1 2016-03-24 =
509
- * Fixed issue with PHP sessions and 'The session id is too long or contains illegal characters'.
510
- * Removed SpamFireWall protection on /feed page.
511
- * Disabled anti-spam tests for AJAX calls if the option 'Custom contact forms' is turned off.
512
- * Added reject notice for spam submissions on Gravity forms with AJAX calls.
513
-
514
- = 5.37.3 2016-03-10 =
515
- * Fixed bug with broken MailPoet previews.
516
- * Fixed bug with broken Geo My WP pop-up windows.
517
- * Fixed issue with mb_convert_encoding() function.
518
- * Removed double JavaScript code in front-end.
519
- * Removed unused variables in anti spam logic.
520
- * Added option 'Set cookies' (turned on by default). If the option turned off, the plugin will not generate cookies, but in this case plugin will not protect some rarely used contact forms. Any way, turn this option off be compatible with Varnish in spam protection for WordPress core comments, registrations and most popular contact forms.
521
- * Added anti-spam protection for Gravity forms via option 'Contact forms' with hook gform_entry_is_spam().
522
-
523
- = 5.36.1 2016-02-05 =
524
- * Fixed bug, when users receive error after logging in
525
- * Improve anti-spam filters for contact forms.
526
-
527
- = 5.36 2016-02-04 =
528
- * Improved JavaScript anti spam protection
529
- * Improvements for avoiding blocking requests from payment systems
530
-
531
- = 5.35 2016-01-14 =
532
- * Added support for IP licensing
533
- * Some anti-spam protection improvements
534
- * Small backend interface fixes
535
-
536
- = 5.34.1 2015-12-17 =
537
- * Fixed trackback antispam protection: improved checking mechanism
538
- * Fixed problem with blocking MailPoet: added exclusions in spam checking algorithm
539
-
540
- = 5.34 2015-12-10 =
541
- * Improved spam checking mechanism
542
- * Added "Collect browser details" option for better antispam protection
543
- * Fixed custom contact forms checking for AJAX requests
544
- * Minor translations fixes
545
-
546
- = 5.33.1 2015-12-04 =
547
- * Fixed issue with BBPress: restored old user permission checking mechanism
548
- * Fixed anti-spam comments checking: sometimes get_comments returned wrong comments number
549
- * Fixed bulk checking: made numeric indexes in users and comments arrays
550
- * Fixed trackback and pingback checking: removed exception for checking
551
-
552
- = 5.33 2015-12-01 =
553
- * Backend interface fixes
554
- * Improved SpamFireWall efficiency
555
- * Improved performance of anti spam checking
556
-
557
- = 5.32 2015-11-26 =
558
- * Added improvements for manual spam detection
559
- * Fixed errors in backend
560
- * Fixed bulk users anti spam checking
561
- * Added indicator for bulk spam checking
562
- * Added "Get access key automatically" button
563
-
564
- = 5.31 2015-11-11 =
565
- * Improved backend performance
566
- * Fixed counter of approved/blocked spam attacks
567
- * Fixed SpamFireWall logging
568
-
569
- = 5.30 2015-11-05 =
570
- * Improved anti-spam checking
571
- * Optimized performance
572
- * Fixed blocking email preview in MailPoet
573
- * Interface fixes
574
- * WPMU interface fixes
575
-
576
- = 5.29 2015-10-27 =
577
- * Optimized performance
578
- * Fixed bugs in custom contact forms spam checking
579
-
580
- = 5.28.7 2015-10-23 =
581
- * Optimized PHP sessions creation algorithm. This fix should increase plugin perfomance on hostings without retenion of PHP sessions files.
582
- * Removed autoredirection to plugin settings after plugin activation.
583
-
584
- = 5.28 2015-10-16 =
585
- * Fixed errors in anti-spam checking
586
- * Restored options for spam checking registrations and cpmmon contact forms
587
- * Improved spam protection
588
- * Fixed problems with AJAX functionality in MailPoet, WooCommerce and other AJAX plugins
589
-
590
- = 5.27 2015-10-13 =
591
- * Improvements in SpamFireWall feature
592
- * Code optimization
593
- * Backend interface fixes
594
-
595
- = 5.26 2015-10-05 =
596
- * Added WordPress Language Pack support
597
- * Removed spam checking for some autorisation plugins
598
- * New experimental feature: SpamFireWall
599
-
600
- = 5.25.2 2015-09-28 =
601
- * Fixed backend bug
602
-
603
- = 5.25.1 2015-09-28 =
604
- * Added widget with anti-spam statistics
605
- * Added information about blocked spam attacks in admin dashboard and CleanTalk settings
606
- * Added ability not to check comments for users with 3 or above allowed comments
607
- * Added an option 'Help others known CleanTalk' to show information for site visitors, that your site is protected from spam by us
608
- * Some backend interface settings
609
-
610
- = 5.24.1 2015-09-16 =
611
- * Fixed some errors in frontend
612
- * Fixed access key saving
613
-
614
- = 5.24 2015-09-14 =
615
- * Backend interface fixes
616
- * Improvement for AJAX JavaScript spam checking
617
-
618
- = 5.23 2015-09-01 =
619
- * Fixed BuddyPress profile search false positivities of anti-spam protection.
620
- * Some interface fixes of bulk users & comments spam checking
621
-
622
- = 5.22 2015-08-26 =
623
- * Fixed possible XSS issue for anti-spam test on third-party forms.
624
-
625
- = 5.21 2015-08-21 =
626
- * Fixed bug with skipping spam submissions
627
- * Fixed bug with receiving old user_token for viewing anti-spam statistics
628
- * Small backend fixes
629
-
630
- = 5.20 2015-08-15 =
631
- * Fixed anti-spam stats in admin bar - now statistics updates every hour
632
- * Fixed issue with skipping spam submissions
633
- * Added some PHP-constants for advanced users - CLEANTALK_AJAX_USE_BUFFER and CLEANTALK_AJAX_USE_FOOTER_HEADER can be defined to true or false in wp-config.php to control method, which will be used for injection of AJAX script.
634
-
635
- = 5.19 2015-08-11 =
636
- * New feature: anti-spam checking for registered users
637
- * Fixed issue with AJAX JavaScript anti-spam test.
638
- * Fixed issue with SEO Yoast xml sitemaps and JavaScript anti-spam test.
639
-
640
- = 5.18 2015-08-04 =
641
- * Fixed issue with user_token
642
- * Added anti-spam API, see our FAQ
643
-
644
- = 5.17 2015-07-23 =
645
- * Fixed infinite redirection after activation
646
- * Minor backend fixes
647
-
648
- = 5.16 2015-07-22 =
649
- * Fixed external services checking
650
- * Fixed mass comments deletion
651
- * Fixed AJAX anti-spam protection
652
-
653
- = 5.15 2015-07-16 =
654
- * New feature: anti-spam protection for forms, that uses external services
655
-
656
- = 5.14 2015-07-03 =
657
- * Added anti-spam protection for some themes and plugins
658
- * Some backend fixes
659
-
660
- = 5.13 2015-06-12 =
661
- * Closing notification for anti-spam renew
662
- * Fixed bulk anti spam comment checking
663
-
664
- = 5.12 2015-06-01 =
665
- * Added option for checking all post data for spam
666
- * Some JavaScript protection improvements
667
- * Added option for old JavaScript check (without AJAX)
668
-
669
- = 5.10 2015-05-25 =
670
- * Fixed Javascript error on some forms
671
-
672
- = 5.9 2015-05-21 =
673
- * Fixed Javascript error on CF7 and JetPack
674
- * Some backend and frontent fixes
675
-
676
- = 5.8 2015-05-18 =
677
- * Minor fixes
678
-
679
- = 5.7 2015-05-18 =
680
- * Fixed French translation
681
- * Fixed protection algorithm
682
-
683
- = 5.6 2015-05-11 =
684
- * Fixed translation
685
- * Fixed bulk comments anti-spam checking
686
- * Added option for disabling anti spam statistics in adminbar
687
- * Some security fixes
688
-
689
- = 5.5 2015-04-29 =
690
- * Fixed security issue
691
- * Some interface fixes
692
-
693
- = 5.4 2015-04-27 =
694
- * Some interface and functionality changes in plugin settings page
695
- * Added counter for anti-spam statistics in admin bar
696
-
697
- = 5.3 2015-04-13 =
698
- * Added anti-spam protection for Divi theme contact forms
699
- * Added anti-spam protection for MyMail contact forms
700
- * Added anti-spam protection for MailPoet Newsletters
701
- * Some interface and functionality changes in backend
702
-
703
- = 5.2 2015-04-01 =
704
- * Added link for anti-spam statistics
705
- * Added WP User Frontend Pro registration form protection
706
-
707
- = 5.1 2015-03-24 =
708
- * Fixed site crash after installing 5.0 on some websites
709
-
710
- = 5.0 2015-03-24 =
711
- * Added bulk comments checking for spam via CleanTalk blacklists
712
- * Added anti-spam form protection for 'Ajax Login & Register'
713
- * Fixed JetPack form protection
714
-
715
- = 4.24 2015-03-20 =
716
- * Added immediate spam protection activation.
717
-
718
- = 4.22 2015-03-17 =
719
- * Added button for automatic spam protection key getting.
720
-
721
- = 4.21 2015-03-11 =
722
- * Added license renew notification.
723
-
724
- = 4.20 2015-03-03 =
725
- * Added German, Italian, Polish, Portuguese translations.
726
- * Minor code fixes.
727
-
728
- = 4.19 2015-02-24 =
729
- * Increased keys lifetime for JS spam test.
730
-
731
- = 4.18 2015-02-17 =
732
- * Fixed bug with comments approvement - moved ct_unmark_red() to cleantalk-admin.php
733
- * Added PayPal 'payment_status' in skip list.
734
- * Added Akismet 'spam' status processing.
735
-
736
- = 4.17 2015-02-12 =
737
- * New base class.
738
- * Divided code to 3 separate files - common, public and admin.
739
-
740
- = 4.16 2015-02-05 =
741
- * New base class.
742
- * Fixed JetPack spam filters logics.
743
- * Optimized Formidable, bbPress, BuddyPress spam filters.
744
-
745
- = 4.15 2015-01-29 =
746
- * Support spam test for Contact Form 7 versions before 3.0.0.
747
- * Fixed global JS-vars for JS spam test.
748
- * Fixed online notice cookie logics.
749
- * Optimized spam filters for FSCF, WooCommerce, JetPack.
750
- * Optimized option getting.
751
-
752
- = 4.14 2015-01-19 =
753
- * Removed deprecated option from comment approvement code.
754
- * New API key URL.
755
- * Trimmed API key in admin panel.
756
- * Added current options to array sended to CleanTalk servers.
757
- = 4.13 2014-12-29 =
758
- * Fixed bug with autimatically aprovement not spam comments. Now this option disabled and do not override local WordPress policy.
759
-
760
- = 4.12 2014-12-29 =
761
- * Fixed bug with 'Wrong Access key...' notice in WordPress dashboard.
762
- * Fixed filtration bug in WordPress dashboard login form.
763
-
764
- = 4.11 2014-12-22 =
765
- * Improved anti-spam protection for custom contact/registration/subscribe forms.
766
- * Improved anti-spam protection for comments.
767
- * Accelerated plugin speed for comments, regirstrations and contacts.
768
- * Added translation to French.
769
-
770
- = 4.10 2014-12-10 =
771
- * Improved anti-spam protection for custom contact/registration/subscribe forms.
772
- * Option 'Custom contact forms' enabled by default for new setups.
773
- * Removed settings "Publish relevant comments", "Use encrypted (SSL) connection".
774
- * Added translation to Danish (thank you for Mikkel at KreativJul.dk).
775
-
776
- = 4.9 2014-11-24 =
777
- * Fixed spam test for Contact Form 7.
778
-
779
- = 4.8 2014-11-19 =
780
- * Improved anti-spam protection for BuddyPress registrations and custom contact forms.
781
-
782
- = 4.7 2014-11-16 =
783
- * Fixed JavaScript spam test for FastSecure contact form.
784
-
785
- = 4.6 2014-11-11 =
786
- * Improved anti-spam protection on BuddyPress registrations.
787
- * Improved anti-spam protection on contact forms.
788
- * Removed plugin sign from pending, spam comments. To get details about a comment please use Dashboard at cleantalk.org.
789
- * Improved Access key validation function.
790
- * Added protection for bbPress comments via stop list. Stop list function is a list to reject comments by prefiled words. To fill the list please use Dashboard at cleantalk.org.
791
-
792
- = 4.5 2014-11-04 =
793
- * Fixed CF7 JavaScript bug.
794
- * Fixed rejects in bbPress guests comments.
795
-
796
- = 4.4 2014-10-29 =
797
- * Improved anti-spam JS test for CF7.
798
- * Fixed 'noscript' text in FaceBook Like preview in Valenti theme.
799
-
800
- = 4.2 2014-10-20 =
801
- * Fixed double checks issue for BuddyPress registrations.
802
- * Increased timeout limits to find the work server.
803
-
804
- = 4.1 2014-10-13 =
805
- * Optimized code for manual moderation feedback sending.
806
- * Optimized anti-spam algorithms for comments, contacts and signups.
807
-
808
- = 4.0 2014-10-06 =
809
- * Improved anti-spam protection for custom contact forms.
810
- * Improved anti-spam protection for registration forms.
811
-
812
- = 3.9 2014-10-01 =
813
- * Did exception to do not break to create new user in WordPress backend.
814
-
815
- = 3.8 2014-09-19 =
816
- * Fixed json_encode() + malformed characters.
817
- * Fixed JavaScript issue with wpautop().
818
-
819
- = 3.6 2014-09-15 =
820
- * Fixed preg_match() issue for Formidable forms and Custom contact forms.
821
- * Improved anti-spam protection for Custom contact forms.
822
-
823
- = 3.4 2014-09-04 =
824
- * We've added anti-spam for themes contact forms and any untested contact forms plugins. To use this test enable option "Custom contact forms" in plugin settings.
825
- * We've added auto rotation for spam comments. Now the plugin removes comments in SPAM folder older then 15 days. This option is enabled by default.
826
-
827
- = 3.2 2014-08-27 =
828
- * Fixed submit_time() logic for failed submits (comments/registrations). Now form fill time resets after every failed submit.
829
-
830
- = 3.1 2014-08-19 =
831
- * Added anti-spam test over senders Cookies.
832
- * Improved form fill anti-spam test.
833
- * Improved speed selection of the nearest server to website.
834
- * Improved anti-spam speed for comments.
835
- * Relevance anti-spam test disabled by default. To enable test should be used option 'relevance_test'.
836
-
837
- = 2.58 2014-08-06 =
838
- * Added anti-spam protection for signups posted via WooCommerce order form.
839
- * Improved anti-spam protection for Contact Form 7.
840
- * Improved anti-spam protection for registrations. Now the plugin looking for JavaScript anti spam test results not only in POST array, but in COOKIES array too. This improvement allows protect signup forms for any untested signups plugins and themes.
841
- * Updated PHP API. Now the plugin can resolve sender IP for websites behind proxy servers. If the proxy servers uses private IP address.
842
-
843
- = 2.57 2014-07-29 =
844
- * Improved anti-spam protection for comments. The plugin now proccessing website url in the comments form.
845
- * Fixed sign remove logic for approved comments. Previous version doesn't cut sign for comments approved via AJAX call in WordPress backend.
846
- * Fixed switching to SSL for comments. Previous version doesn't use secured connection for comments.
847
-
848
- = 2.56 2014-07-21 =
849
- * Fixed account status check logic. Previous version makes unnecessary test API calls when the plugin asks account status check.
850
-
851
- = 2.55 2014-07-11 =
852
- * Fixed bug with account status function. In backend the plugin showed notice 'Please don’t forget to disable CAPTCHA if you have it!' on every page.
853
-
854
- = 2.54 2014-07-11 =
855
- * Fixed signup anti-spam protection logic for BuddyPress registrations.
856
- * Fixed anti-spam protection for JetPack contact form.
857
- * Changed account status check logic.
858
-
859
- = 2.53 2014-06-27 =
860
- * Fixed anit-spam protection bug for signups.
861
- * Changed anti-spam functions (comments and signups) priority.
862
-
863
- = 2.52 2014-06-25 =
864
- * Fixed 'Fatal error: Call to a member function get_error_code()' issue with signups via BuddyPress.
865
-
866
- = 2.51 2014-06-23 =
867
- * Added spam protection for registrations via plugin New User Approve by Josh Harrison. If the CleanTalk matched signup as spam this signup will be denied to placing in pending queue.
868
- * Added option "Use secure (SSL) connection to CleanTalk cloud". If the option enabled plugin will communicate with CleanTalk severs via 128bit encrypted data channel. So, if you have SSL protected webforms on website you can use this option to be sure that visitors personal data safely transmits to CleanTalk servers.
869
- * Fixed minor bug with loading backend functions.
870
-
871
- = 2.49 2014-06-10 =
872
- * Added spam protection for S2Member Auth.net forms.
873
- * Added spam protection for multisite signup form.
874
- * Optimized account status check function.
875
-
876
- = 2.46 2014-05-19 =
877
- * Added: HTML notice about the need to enable JavaScript.
878
- * Fixed: Fixed pingbacks anti-spam test.
879
-
880
- = 2.44 2014-05-12 =
881
- * Added: Anti-spam protection for S2Member framework.
882
- * Improved: JavaScript anti-spam test.
883
- * Improved: Plugin load time for backend and frontend.
884
- * Fixed: PHP warning mb_convert_encoding()
885
-
886
- = 2.42 2014-04-29 =
887
- * Fixed: JavaScript anti-spam test for comments.
888
-
889
- = 2.40 2014-04-25 =
890
- * New: Fast Secure Contact form support.
891
- * New: WordPress Landing Pages support
892
-
893
- = 2.38 2014-03-27 =
894
- * Fixed: Registraion form submit time spam test.
895
-
896
- = 2.36 2014-03-12 =
897
- * Reversed to patches from old revisions.
898
-
899
- = 2.35 2014-03-12 =
900
- * New: Notifications about disabled account
901
- * New: Improved JavaScript spam test.
902
- * Fixed: Code optimization
903
- * Fixed: JavaScript test for signups.
904
-
905
- = 2.33 2014-02-12 =
906
- * Fixed: CURLOPT_FOLLOWLOCATION bug at admin notice
907
-
908
- = 2.32 2014-02-04 =
909
- * New: Added notice about automatically approved comment. The notice shows only for first approved comment and only for new commentators (without approved comments) of the blog.
910
- * New: At WordPress console added banner for notices.
911
- * Changed: Screenshots updated.
912
-
913
- = 2.31 2014-01-24 =
914
- * New: Added spam protection for JetPack comments
915
- * Fixed: cURL connection issue "Expect: 100-continue"
916
-
917
- = 2.30 2014-01-13 =
918
- * Changed: Improved servers connection logic.
919
- * Fixed: Antispam test for Fomidable forms.
920
-
921
- = 2.28 2013-12-19 =
922
- * New: Added protection against spam bots for WooCommerce review form.
923
- * Fixed: JavaScript anti-spam logic for WooCommerce review form.
924
-
925
- = 2.27 2013-12-06 =
926
- * New: Added protection against spam bots for JetPack Contact form.
927
- * Fixed: JavaScript anti-spam logic for registrations and Contact form 7.
928
-
929
- = 2.25 2013-11-27 =
930
- * New: Added protection against spam bots for BuddyPress registrations.
931
- * New: Added protection against spam bots for Contact form 7.
932
- * New: Added Spanish (es_ES) translation.
933
-
934
- = 2.23 2013-11-20 =
935
- * New: Added automatic training blacklists on spam bot account deletion.
936
- * New: Added URL to project homepage at plugin options.
937
- * Changed: Improved anti-spam logic.
938
-
939
- = 2.21 2013-11-13 =
940
- * Changed: WordPress blacklists settings get priority over plugin's anti-spam settings
941
- * Changed: Disabled management approval comments for regular commentators of the blog. Automatically approved for publication only the comments of the new blog authors.
942
- * Changed: Removed form submit time test. Imporved JavaScript spam test.
943
- * Changed: PHP code optimizations
944
-
945
- = 2.19 2013-11-08 =
946
- * New: Antispam protection from spam bots at the registration form
947
- * Changed: Russian localization for admin panel
948
- * Changed: PHP code optimizations
949
-
950
- = 2.5.18 2013-11-01 =
951
- * Fixed: Bug with selection of the last comments for post
952
- * New: Antispam protection for Formiadble feedback forms
953
- * New: Automatic deletion of outdated spam comments
954
- * New: On/Off option for comments spam filtration
955
- * Tested with WordPress 3.7.1
956
-
957
- = 2.4.15 2013-09-26 =
958
- * Fixed: Bug with mass comments deletion
959
- * Changed: Russian localization for admin panel
960
- * Tested with mulitsite setup (WordPress network or WPMU)
961
-
962
- = 2.4.14 2013-08-29 =
963
- * Changed: Removed feedback requests to the servers for banned (spam) comments.
964
-
965
- = 2.4.13 2013-08-19 =
966
- * Changed: Switched HTTP requests from file_get_contents() to CURL. Added file_get_contens() as backup connection to the servers.
967
- * Changed: Removed feedback requests for comments moved to trash.
968
- * Fixed: "Fail connect to servers..." error on hostings with disabled 'allow_url_fopen' PHP option.
969
-
970
- = 2.4.12 2013-08-12 =
971
- * Removed RPC::XML library from plugin.
972
- * Switched plugin to HTTP+JSON connection with servers.
973
- * Fixed bug with comments anti-spam tests with non UTF8 codepage.
974
-
975
- = 2.4.11 2013-08-02 =
976
- * Removed spam tests for self-made pingbacks
977
- * Tested up to WP 3.6
978
-
979
- = 2.4.10 2013-07-24 =
980
- * Fixed warning in PHP 5.4
981
- * Fixed bug with disabling comments test for Administrators, Authors and Editors
982
- * "Stop words" settings moved to <a href="http://cleantalk.org/my">Control panel</a> of the service
983
- * "Response language" settings moved <a href="http://cleantalk.org/my">Control panel</a> of the service
984
-
985
- = 2.4.9 =
986
- * Fixed extra debugging in base class
987
-
988
- = 2.4.8 =
989
- * Enabled convertion to UTF8 for comment and example text
990
- * Optimized PHP code
991
-
992
- = 2.3.8 =
993
- * Enabled selection the fastest server in the pool
994
- * Fixed work server in plugin's config
995
-
996
- = 2.2.3 =
997
- * Secured md5 string for JavaScript test
998
- * Added requests's timestamp to calculate request work time
999
- * Update base CleanTalk's PHP class
1000
-
1001
- = 2.1.2 =
1002
- * Improved perfomance for processing large comments (over 32kb size)
1003
- * Improved perfomance for bulk operations with comments in Comments panel
1004
- * Added feedback request with URL to approved comment
1005
-
1006
- = 2.0.2 =
1007
- * Fixed bug with JavaScript test and WordPress cache plugins
1008
-
1009
- = 2.0.1 =
1010
- * Added option "Publicate relevant comments" to plugin's options.
1011
- * Added descriptions to plugin options
1012
-
1013
- = 1.5.4 =
1014
- * Fixed HTTP_REFERER transmission to the servers
1015
- * Improved JavaScript spam test
1016
- * Optimized PHP code
1017
-
1018
- = 1.4.4 =
1019
- * Pingback, trackback comments has moved to manual moderataion
1020
- * Added transmission to the serves comment type and URL
1021
- * Post title, body and comments separated into individual data elements
1022
- * Added priority for matched words in the comment with post title
1023
- * Enabled stop words filtration as default option
1024
-
1025
- = 1.3.4 =
1026
- * Removed PHP debugging.
1027
-
1028
- = 1.3.3 =
1029
- * Added notice at admin panel about empty Access key in plugin settings
1030
- * Removed HTTP link to the site project from post page
1031
- * Removed unused options from settings page
1032
- * Tested up to WordPress 3.5
1033
-
1034
- = 1.2.3 =
1035
- * Fixed bug with session_start.
1036
-
1037
- = 1.2.2 =
1038
- * Plugin rename to CleanTalk. Spam prevent plugin
1039
- * Integration Base Class version 0.7
1040
- * Added fast submit check
1041
- * Added check website in form
1042
- * Added feedbacks for change comment status (Not spam, unapprove)
1043
- * Added function move comment in spam folder if CleanTalk say is spam
1044
- * Disable checking for user groups Administrator, Author, Editor
1045
- * Marked red color bad words
1046
-
1047
- = 1.1.2 =
1048
- * Addition: Title of the post attached to the example text in auto publication tool.
1049
- * Tested with WordPress 3.4.1.
1050
-
1051
- = 1.1.1 =
1052
- * HTTP_REFERER bug fixed
1053
-
1054
- = 1.1.1 =
1055
- * Added user locale support, tested up to WP 3.4
1056
-
1057
- = 1.1.0 =
1058
- * First version
1059
-
1060
- == Upgrade Notice ==
1061
- = 5.41 2016-05-31 =
1062
- * Added HTTP response in plugin response if an network issue was happend.
1063
- * Optimized JavaScript anti-spam test for Formidable forms.
1064
- * Re-stored the option to auto redirect to plugn settings after plugin activation.
1065
- * Fixed issue with nasted fields in Formidable forms.
1066
-
1067
- = 5.40.3 2016-05-26 =
1068
- * Added option to encrypt (SSL) connection to CleanTalk anti-spam servers.
1069
- * Added JSON encoding for AJAX forms.
1070
- * Obfuscated private data for Custom contact forms option.
1071
- * Optimized bulk users check for spam over blacklists database.
1072
- * Fixed issue with lost connection to servers and JavaScript anti-spam test.
1073
- * Fixed issue with WordFence and collect_details.
1074
-
1075
- = 5.40.2 2016-05-11 =
1076
- * Improved account status check logic.
1077
- * Fixed issue with double anti-spam tests for FastSecure contact forms.
1078
- * Fixed issue with nulled JavaScript variables assigned from backend. This issue might me occured on standart WordPress registration form and with failed JavaScript spam test.
1079
- * Fixed issue with session_start() with PHP sessions stored in memcache.
1080
-
1081
- = 5.40.1 2016-04-28 =
1082
- * Fixed issue with Super Socializer.
1083
- * Fixed issue with spam filtration for logged in users and Formidable forms.
1084
- * Added logging of all submitted fields for FastSecure contact form.
1085
-
1086
- = 5.40 2016-04-19 =
1087
- * Added JSON encoding for posts that were protected via Custom contact forms option. It allows show anti-spam logs in the Dashboard in more comfortable view.
1088
- * Minor fix in plugin settings.
1089
- * Fixed pagination for bulk users spam test.
1090
- * Fixed issue with unknown _SESSION.
1091
- * Fixed issue with double SpamFireWall database upload.
1092
-
1093
- = 5.39.1 2016-04-04 =
1094
- * Improved AJAX based anti-spam test with HTTPS backends.
1095
- * Added fix to avoid issue with empty ct_info_flag on JavaScript side.
1096
- * Added logic to exclude caching for SpamFireWall.
1097
- * Removed a condition to skip accounts with 127.0.0.1 IP in spam test for registered acconts.
1098
-
1099
- = 5.38.1 2016-03-24 =
1100
- * Fixed issue with PHP sessions and 'The session id is too long or contains illegal characters'.
1101
- * Removed SpamFireWall protection on /feed page.
1102
- * Disabled anti-spam tests for AJAX calls if the option 'Custom contact forms' is turned off.
1103
- * Added reject notice for spam submissions on Gravity forms with AJAX calls.
1104
-
1105
- = 5.37.3 2016-03-10 =
1106
- * Minor bug fixes. Added an option to support Varnish cache.
1107
-
1108
- = 5.36.1 2016-02-05 =
1109
- * Fixed bug, when users receive error after logging in
1110
-
1111
- = 5.36 2016-02-04 =
1112
- * Improved JavaScript anti spam protection
1113
- * Improvements for avoiding blocking requests from payment systems
1114
-
1115
- = 5.35 2016-01-14 =
1116
- * Added support for IP licensing
1117
- * Some anti-spam protection improvements
1118
- * Small backend interface fixes
1119
-
1120
- = 5.34.1 2015-12-17 =
1121
- * Fixed trackback antispam protection: improved checking mechanism
1122
- * Fixed problem with blocking MailPoet: added exclusions in spam checking algorithm
1123
-
1124
- = 5.34 2015-12-10 =
1125
- * Improved spam checking mechanism
1126
- * Added "Collect browser details" option for better antispam protection
1127
- * Fixed custom contact forms checking
1128
- * Minor translations fixes
1129
-
1130
- = 5.33.1 2015-12-04 =
1131
- * Fixed issue with BBPress
1132
- * Fixed anti-spam comments checking
1133
- * Fixed bulk checking
1134
- * Fixed trackback and pingback checking
1135
-
1136
- = 5.33 2015-12-01 =
1137
- * Backend interface fixes
1138
- * Improved SpamFireWall efficiency
1139
- * Improved performance of anti spam checking
1140
-
1141
- = 5.32 2015-11-26 =
1142
- * Added improvements for manual spam detection
1143
- * Fixed errors in backend
1144
- * Fixed bulk users anti spam checking
1145
- * Added indicator for bulk spam checking
1146
- * Added "Get access key automatically" feature
1147
-
1148
- = 5.31 2015-11-11 =
1149
- * Improved backend performance
1150
- * Fixed counter of approved/blocked spam attacks
1151
- * Fixed Spam Firewall logging
1152
-
1153
- = 5.30 2015-11-05 =
1154
- * Improved anti-spam checking
1155
- * Optimized performance
1156
- * Fixed blocking email preview in MailPoet
1157
- * Interface fixes
1158
- * WPMU interface fixes
1159
-
1160
- = 5.29 2015-10-27 =
1161
- * Optimized performance
1162
- * Fixed bugs in custom contact forms spam checking
1163
-
1164
- = 5.28.7 2015-10-23 =
1165
- * Major backend peromance fix.
1166
-
1167
- = 5.28 2015-10-16 =
1168
- * Fixed errors in anti-spam checking
1169
- * Restored options for spam checking registrations and cpmmon contact forms
1170
- * Improved anti spam defence
1171
- * Fixed problems with AJAX functionality in MailPoet, WooCommerce and other AJAX plugins
1172
-
1173
- = 5.27 2015-10-13 =
1174
- * Improvements in SpamFireWall feature
1175
- * Code optimization
1176
- * Backend interface fixes
1177
-
1178
- = 5.26 2015-10-05 =
1179
- * Added WordPress Language Pack support
1180
- * Removed spam checking for some autorisation plugins
1181
- * New experimental feature: SpamFireWall
1182
-
1183
- = 5.25.2 2015-09-28 =
1184
- * Fixed backend bug
1185
-
1186
- = 5.25.1 2015-09-28 =
1187
- * Added widget with anti-spam statistics
1188
- * Added information about blocked spam attacks in admin dashboard and CleanTalk settings
1189
- * Added ability not to check comments for users with 3 or above allowed comments
1190
- * Added an option 'Help others known CleanTalk' to show information for site visitors, that your site is protected from spam by us
1191
- * Some backend interface settings
1192
- * Removed "CleanTalk connection test" query
1193
-
1194
- = 5.24.1 2015-09-16 =
1195
- * Fixed some errors in frontend
1196
- * Fixed access key saving
1197
-
1198
- = 5.24 2015-09-14 =
1199
- * Backend interface fixes
1200
- * Improvement for AJAX JavaScript spam checking
1201
-
1202
- = 5.23 2015-09-01 =
1203
- * Fixed BuddyPress profile search false positivities of anti-spam protection.
1204
- * Some interface fixes of bulk users & comments spam checking
1205
-
1206
- = 5.22 2015-08-26 =
1207
- * Fixed possible XSS issue for anti-spam test on third-party forms.
1208
-
1209
- = 5.21 2015-08-21 =
1210
- * Fixed bug with skipping spam submissions
1211
- * Fixed bug with receiving old user_token for viewing anti-spam statistics
1212
- * Small backend fixes
1213
-
1214
- = 5.20 2015-08-15 =
1215
- * Fixed anti-spam stats in admin bar
1216
- * Fixed issue with skipping spam submissions
1217
- * Added some PHP-constants for advanced users
1218
-
1219
- = 5.19 2015-08-11 =
1220
- * New feature: anti-spam checking for registered users
1221
- * Fixed issue with AJAX JavaScript checking
1222
- * Fixed issue with SEO Yoast xml sitemaps.
1223
-
1224
- = 5.18 2015-08-04 =
1225
- * Fixed issue with user_token
1226
- * Added anti-spam API, see our FAQ
1227
-
1228
- = 5.17 2015-07-23 =
1229
- * Fixed infinite redirection after activation
1230
- * Minor backend fixes
1231
-
1232
- = 5.16 2015-07-22 =
1233
- * Fixed external services checking
1234
- * Fixed mass comments deletion
1235
- * Fixed AJAX anti-spam protection
1236
-
1237
- = 5.15 2015-07-16 =
1238
- * New feature: anti-spam protection for forms, that uses external services
1239
-
1240
- = 5.14 2015-07-03 =
1241
- * Added anti-spam protection for some themes and plugins
1242
- * Some backend fixes
1243
-
1244
- = 5.13 2015-06-12 =
1245
- * Closing notification for anti-spam renew
1246
- * Fixed bulk anti spam comment checking
1247
-
1248
- = 5.12 2015-06-01 =
1249
- * Added option for checking all post data for spam
1250
- * Some JavaScript protection improvements
1251
- * Added option for old JavaScript check (without AJAX)
1252
-
1253
- = 5.10 2015-05-25 =
1254
- * Fixed Javascript error on some forms
1255
-
1256
- = 5.9 2015-05-21 =
1257
- * Fixed Javascript error on CF7 and JetPack
1258
- * Some backend and frontent fixes
1259
-
1260
- = 5.8 2015-05-18 =
1261
- * Minor fixes
1262
-
1263
- = 5.7 2015-05-18 =
1264
- * Fixed French translation
1265
- * Fixed protection algorithm
1266
-
1267
- = 5.6 2015-05-11 =
1268
- * Fixed translation
1269
- * Fixed bulk comments anti-spam checking
1270
- * Added option for disabling anti spam statistics in adminbar
1271
- * Some security fixes
1272
-
1273
- = 5.5 2015-04-29
1274
- * Fixed security issue
1275
-
1276
- = 5.4 2015-04-27 =
1277
- * Some interface and functionality changes in plugin settings page
1278
- * Added counter for anti-spam statistics in admin bar
1279
-
1280
- = 5.3 2015-04-13 =
1281
- * Added anti-spam protection for Divi theme contact forms
1282
- * Added anti-spam protection for MyMail contact forms
1283
- * Added anti-spam protection for MailPoet Newsletters
1284
- * Some interface and functionality changes in backend
1285
-
1286
- = 5.2 2015-04-01 =
1287
- * Added link for anti-spam statistics
1288
- * Added WP User Frontend Pro registration form protection
1289
-
1290
- = 5.10 2015-03-24 =
1291
- * Fixed site crash after installing 5.0 on some websites
1292
-
1293
- = 5.00 2015-03-24 =
1294
- * Added bulk comments checking for spam via CleanTalk blacklists
1295
- * Added anti-spam form protection for 'Ajax Login & Register'
1296
- * Fixed JetPack form protection
1297
-
1298
- = 4.24 2015-03-20 =
1299
- Added immediate spam protection activation.
1300
-
1301
- = 4.22 2015-03-17 =
1302
- Added button for automatic spam protection key getting.
1303
-
1304
- = 4.21 2015-03-11 =
1305
- Added license renew notification.
1306
-
1307
- = 4.20 2015-03-03 =
1308
- German, Italian, Polish, Portuguese translations, minor code fixes.
1309
-
1310
- = 4.19 2015-02-24 =
1311
- Increased JS keys lifetime.
1312
-
1313
- = 4.18 2015-02-17 =
1314
- Bugfix - fixed bug with comments approvement, PayPal 'payment_status' and Akismet 'spam' status processing.
1315
-
1316
- = 4.17 2015-02-12 =
1317
- New base class, divided code to 3 separate files - common, public and admin.
1318
-
1319
- = 4.16 2015-02-05 =
1320
- New base class, fixed JetPack filters logics, optimized Formidable, bbPress, BuddyPress filters.
1321
-
1322
- = 4.15 2015-01-29 =
1323
- Support of Contact Form 7 versions before 3.0.0, fixed global JS-vars and online notice cookie logics.
1324
-
1325
- = 4.14 2015-01-19 =
1326
- Removed deprecated option from comment approvement code.
1327
-
1328
- = 4.13 2014-12-29 =
1329
- Not spam comments auto approvement bug fix.
1330
-
1331
- = 4.12 2014-12-29 =
1332
- Plugin backend minfor bug fixes.
1333
-
1334
- = 4.11 2014-12-22 =
1335
- Major changes in spam protection algorithms.
1336
-
1337
- = 4.10 2014-12-10 =
1338
- Minor improvements for custom contact/registration/subscribe forms.
1339
-
1340
- = 4.9 2014-11-24 =
1341
- Minor bug fix for Contact form 7.
1342
-
1343
- = 4.8 2014-11-19 =
1344
- Improved anti-spam protection for BuddyPress registrations and custom contact forms.
1345
-
1346
- = 4.7 2014-11-16 =
1347
- Fixed JavaScript antispam test for FastSecure contact form.
1348
-
1349
- = 4.6 2014-11-11 =
1350
- Minor changes in anti-spam logic for BuddyPress registrations, contact forms and bbPress guest posting.
1351
-
1352
- = 4.5 2014-11-04 =
1353
- Bug fixes for Contact form 7 and bbPress guests posting.
1354
-
1355
- = 4.4 2014-10-29 =
1356
- Improved JS checking for CF7.
1357
-
1358
- = 4.2 2014-10-20 =
1359
- Increased plugin perfomance for BuddyPress registrations.
1360
-
1361
- = 4.1 2014-10-13 =
1362
- Minor anti-spam improvements for contacts, registration and contact forms.
1363
-
1364
- = 4.0 2014-10-06 =
1365
- Major anti-spam improvements for registration and contact forms.
1366
-
1367
- = 3.9 2014-10-01 =
1368
- Did exception to do not break to create new user in WordPress backend.
1369
-
1370
- = 3.8 2014-09-19 =
1371
- Bug fix release. Minor fixes in API class and JavaScript anti-spam test.
1372
-
1373
- = 3.6 2014-09-15 =
1374
- Minor fixes in anti-spam protection for Formidable and custom contact forms.
1375
-
1376
- = 3.4 2014-09-04 =
1377
- Spam comments rotation. Custom (themes) contact forms support.
1378
-
1379
- = 3.2 2014-08-27 =
1380
- Minor changes in spam filtration logic.
1381
-
1382
- = 3.1 2014-08-19 =
1383
- Major changes for comments antispam logic. Improved plugin speed.
1384
-
1385
- = 2.59 2014-08-14 =
1386
- Antispam protection for bbPress guests posts. Improvement for JetPack comments and PHP API update.
1387
-
1388
- = 2.58 2014-08-06 =
1389
- * Added anti-spam protection for signups posted via WooCommerce order form.
1390
- * Improved anti-spam protection for Contact Form 7.
1391
- * Improved anti-spam protection for registrations. Now the plugin looking for JavaScript antispam test results not only in POST array, but in COOKIES array too. This improvement allows protect signup forms for any untested signups plugins and themes.
1392
- * Updated PHP API. No the plugin can resolve sender IP for websites behind proxy servers. If the proxy servers uses private IP address.
1393
-
1394
- = 2.57 2014-07-29 =
1395
- * Improved anti-spam protection for comments. The plugin now proccessing website url in the comments form.
1396
- * Fixed sign remove logic for approved comments. Previous version doesn't cut sign for comments approved via AJAX call in WordPress backend.
1397
- * Fixed switching to SSL for comments. Previous version doesn't use secured connection for comments.
1398
-
1399
- = 2.56 2014-07-21 =
1400
- * Fixed account status check logic. Previous version makes unnecessary test API calls when the plugin asks account status check.
1401
-
1402
- = 2.55 2014-07-11 =
1403
- * Fixed bug with account status function. In backend the plugin showed notice 'Please don’t forget to disable CAPTCHA if you have it!' on every page.
1404
-
1405
- = 2.54 2014-07-11 =
1406
- * Fixed signup anti-spam protection logic for BuddyPress registrations.
1407
- * Fixed anti-spam protection for JetPack contact form.
1408
- * Changed account status check logic.
1409
-
1410
- = 2.53 2014-06-27 =
1411
- * Fixed anit-spam protection bug for signups.
1412
- * Changed anti-spam functions (comments and signups) priority.
1413
-
1414
- = 2.52 2014-06-25 =
1415
- * Fixed 'Fatal error: Call to a member function get_error_code()' issue with signups via BuddyPress.
1416
-
1417
- = 2.51 2014-06-23 =
1418
- * Added spam protection for registrations via plugin New User Approve by Josh Harrison. If the CleanTalk matched signup as spam this signup will be denied to placing in pending queue.
1419
- * Added option "Use secure (SSL) connection to CleanTalk cloud". If the option enabled plugin will communicate with CleanTalk severs via 128bit encrypted data channel. So, if you have SSL protected webforms on website you can use this option to be sure that visitors personal data safely transmits to CleanTalk servers.
1420
- * Fixed minor bug with loading backend functions.
1421
-
1422
- = 2.49 2014-06-10 =
1423
- * Added spam protection for S2Member Auth.net forms.
1424
- * Added spam protection for multisite signup form.
1425
- * Optimized account status check function.
1426
-
1427
- = 2.46 2014-05-19 =
1428
- * Added: HTML notice about the need to enable JavaScript.
1429
- * Fixed: Fixed pingbacks anti-spam test.
1430
-
1431
- = 2.44 2014-05-12 =
1432
- * Added: Anti-spam protection for S2Member framework.
1433
- * Improved: Plugin load time for backend and frontend.
1434
- * Improved: JavaScript anti-spam test.
1435
- * Fixed: PHP warning mb_convert_encoding()
1436
-
1437
- = 2.42 2014-04-29 =
1438
- * Fixed: JavaScript anti-spam test for comments.
1439
-
1440
- = 2.38 2014-03-27 =
1441
- * Fixed: Registraion form submit time spam test.
1442
-
1443
- = 2.36 2014-03-12 =
1444
- * Reversed to patches from old revisions.
1445
-
1446
- = 2.35 2014-03-12 =
1447
- * New: Notifications about disabled account
1448
- * New: Improved JavaScript spam test.
1449
- * Fixed: Code optimization
1450
- * Fixed: JavaScript test for signups.
1451
-
1452
- = 2.33 2014-02-12 =
1453
- * Fixed: CURLOPT_FOLLOWLOCATION bug at admin notice
1454
-
1455
- = 2.32 2014-02-04 =
1456
- * New: Added notice about automatically approved comment. The notice shows only for first approved comment and only for new commentators (without approved comments) of the blog.
1457
- * New: At WordPress console added banner for notices.
1458
- * Changed: Screenshots updated.
1459
-
1460
- = 2.31 2014-01-24 =
1461
- * New: Added spam protection for JetPack comments
1462
- * Fixed: CURL connection issue "Expect: 100-continue"
1463
-
1464
- = 2.30 2014-01-13 =
1465
- * Changed: Improved servers connection logic.
1466
- * Fixed: Antispam test for Fomidable forms.
1467
-
1468
- = 2.27 2013-12-06 =
1469
- * New: Added protection against spam bots for JetPack Contact form.
1470
- * Fixed: JavaScript anti-spam logic for registrations and Contact form 7.
1471
-
1472
- = 2.25 2013-11-27 =
1473
- * New: Added protection against spam bots for BuddyPress registrations.
1474
- * New: Added protection against spam bots for Contact form 7.
1475
- * New: Added Spanish (es_ES) translation.
1476
-
1477
- = 2.23 2013-11-20 =
1478
- * New: Added automatic training blacklists on spam bot account deletion.
1479
- * New: Added URL to project homepage at plugin options.
1480
- * Changed: Improved anti-spam logic.
1481
-
1482
- = 2.21 2013-11-13 =
1483
- * Changed: WordPress blacklists settings get priority over plugin's anti-spam settings
1484
- * Changed: Disabled management approval comments for regular commentators of the blog. Automatically approved for publication only the comments of the new blog authors.
1485
- * Changed: PHP code optimizations
1486
-
1487
- = 2.19 2013-11-08 =
1488
- * New: Antispam protection from spam bots at the registration form
1489
- * Changed: Russian localization for admin panel
1490
- * Changed: PHP code optimizations
1491
-
1492
- = 2.5.18 2013-11-01 =
1493
- * Fixed: Bug with selection of the last comments for post
1494
- * New: Antispam protection for Formiadble feedback forms
1495
- * New: Automatic deletion of outdated spam comments
1496
- * New: On/Off option for comments spam filtration
1497
- * Tested with WordPress 3.7.1
1498
-
1499
- = 2.4.15 2013-09-26 =
1500
- * Fixed: Bug with mass comments deletion
1501
- * Changed: Russian localization for admin panel
1502
- * Tested with mulitsite setup (WordPress network or WPMU)
1503
-
1504
- = 2.4.14 2013-08-29 =
1505
- * Changed: Removed feedback requests to the servers for banned (spam) comments.
1506
-
1507
- = 2.4.13 2013-08-19 =
1508
- * Fixed: "Fail connect to servers..." error on hostings with disabled 'allow_url_fopen' PHP option.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/screenshot-1.png DELETED
Binary file
trunk/screenshot-2.png DELETED
Binary file
trunk/screenshot-3.png DELETED
Binary file
trunk/screenshot-4.png DELETED
Binary file
trunk/screenshot-5.png DELETED
Binary file