Spam protection, AntiSpam, FireWall by CleanTalk - Version 5.26

Version Description

2015-10-05 = * Added WordPress Language Pack support * Removed spam checking for some autorisation plugins * New experimental feature: Spam FireWall

Download this release

Release Info

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

Code changes from version 5.27-classes to 5.26

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