Spam protection, AntiSpam, FireWall by CleanTalk - Version 2.36

Version Description

2014-03-12 = * Reversed to patches from old revisions.

Download this release

Release Info

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

Code changes from version 2.34 to 2.36

Files changed (2) hide show
  1. cleantalk.php +91 -49
  2. readme.txt +8 -3
cleantalk.php CHANGED
@@ -3,15 +3,16 @@
3
  Plugin Name: Anti-spam by CleanTalk
4
  Plugin URI: http://cleantalk.org/my
5
  Description: Cloud antispam for comments, registrations and contacts. The plugin doesn't use CAPTCHA, Q&A, math, counting animals or quiz to stop spam bots.
6
- Version: 2.34
7
  Author: СleanTalk <welcome@cleantalk.ru>
8
  Author URI: http://cleantalk.org
9
  */
10
 
11
- $ct_agent_version = 'wordpress-234';
12
  $ct_checkjs_frm = 'ct_checkjs_frm';
13
  $ct_checkjs_register_form = 'ct_checkjs_register_form';
14
  $ct_session_request_id_label = 'request_id';
 
15
 
16
  $ct_checkjs_cf7 = 'ct_checkjs_cf7';
17
  $ct_cf7_comment = 'This is a spam!';
@@ -44,8 +45,12 @@ $show_ct_notice_trial = false;
44
  // Timeout before new check for trial notice in minutes
45
  $trial_notice_check_timeout = 10;
46
 
 
47
  add_action('init', 'ct_init');
48
 
 
 
 
49
  // Comments
50
  add_filter('preprocess_comment', 'ct_preprocess_comment'); // param - comment data array
51
  add_filter( 'comment_text', 'ct_comment_text' );
@@ -71,6 +76,10 @@ add_filter('wpcf7_spam', 'ct_wpcf7_spam');
71
  add_filter('grunion_contact_form_field_html', 'ct_grunion_contact_form_field_html', 10, 2);
72
  add_filter('contact_form_is_spam', 'ct_contact_form_is_spam');
73
 
 
 
 
 
74
  if (is_admin()) {
75
  add_action('admin_init', 'ct_admin_init', 1);
76
  add_action('admin_menu', 'ct_admin_add_page');
@@ -104,6 +113,13 @@ function ct_init() {
104
  }
105
  }
106
 
 
 
 
 
 
 
 
107
  /**
108
  * Inner function - Current Cleantalk options
109
  * @return mixed[] Array of options
@@ -178,6 +194,7 @@ function ct_feedback($hash, $message = null, $allow) {
178
  }
179
 
180
  $ct_feedback = $hash . ':' . $allow . ';';
 
181
  if (empty($_SESSION['feedback_request'])) {
182
  $_SESSION['feedback_request'] = $ct_feedback;
183
  } else {
@@ -194,6 +211,7 @@ function ct_feedback($hash, $message = null, $allow) {
194
  */
195
  function ct_send_feedback($feedback_request = null) {
196
 
 
197
  if (empty($feedback_request) && isset($_SESSION['feedback_request']) && preg_match("/^[a-z0-9\;\:]+$/", $_SESSION['feedback_request'])) {
198
  $feedback_request = $_SESSION['feedback_request'];
199
  unset($_SESSION['feedback_request']);
@@ -232,13 +250,6 @@ function ct_send_feedback($feedback_request = null) {
232
  return false;
233
  }
234
 
235
- /**
236
- * Public action 'init' - Inits locale
237
- */
238
- function ct_init_locale() {
239
- load_plugin_textdomain('cleantalk', false, basename(dirname(__FILE__)) . '/i18n');
240
- }
241
-
242
  /**
243
  * Session init
244
  * @return null;
@@ -257,11 +268,10 @@ function ct_init_session() {
257
  * @param array Array of parameters:
258
  * 'message' - string
259
  * 'example' - string
260
- * 'checkjs_field' -string
261
  * 'sender_email' - string
262
  * 'sender_nickname' - string
263
  * 'sender_info' - array
264
- * 'checkjs_field' - string
265
  * 'post_info' - string
266
  * @return array array('ct'=> Cleantalk, 'ct_result' => CleantalkResponse)
267
  */
@@ -308,7 +318,7 @@ function ct_base_call($params = array()) {
308
  $ct_request->sender_ip = $ct->ct_session_ip($_SERVER['REMOTE_ADDR']);
309
  $ct_request->agent = $ct_agent_version;
310
  $ct_request->sender_info = $sender_info;
311
- $ct_request->js_on = js_test($params['checkjs_field']);
312
  $ct_request->submit_time = $submit_time;
313
  $ct_request->post_info = $params['post_info'];
314
 
@@ -330,7 +340,7 @@ function ct_base_call($params = array()) {
330
  * Adds hidden filed to comment form
331
  */
332
  function ct_comment_form() {
333
- global $ct_jp_active;
334
 
335
  if (ct_is_user_enable() === false) {
336
  return false;
@@ -341,7 +351,7 @@ function ct_comment_form() {
341
  return false;
342
  }
343
 
344
- ct_add_hidden_fields(0, 'ct_checkjs', false, $ct_jp_active);
345
 
346
  return null;
347
  }
@@ -350,14 +360,15 @@ function ct_comment_form() {
350
  * Adds hidden filed to define avaialbility of client's JavaScript
351
  * @param int $post_id Post ID, not used
352
  */
353
- function ct_add_hidden_fields($post_id = 0, $field_name = 'ct_checkjs', $return_string = false, $cookie_check = false) {
 
354
  global $ct_jp_active, $ct_checkjs_def;
355
 
356
  $ct_checkjs_key = ct_get_checkjs_value();
357
  ct_init_session();
358
  $_SESSION['formtime'] = time();
359
 
360
- if ($cookie_check) {
361
  $html = '
362
  <script type="text/javascript">
363
  // <![CDATA[
@@ -378,7 +389,7 @@ function ct_add_hidden_fields($post_id = 0, $field_name = 'ct_checkjs', $return_
378
  <input type="hidden" id="%s" name="%s" value="0" />
379
  <script type="text/javascript">
380
  // <![CDATA[
381
- document.getElementById("%s").value = document.getElementById("%s").value.replace(/^%s$/, "%s");
382
  // ]]>
383
  </script>
384
  ';
@@ -449,11 +460,14 @@ function ct_frm_validate_entry ($errors, $values) {
449
  return false;
450
  }
451
 
 
 
452
  $post_info['comment_type'] = 'feedback';
453
  $post_info = json_encode($post_info);
454
  if ($post_info === false)
455
  $post_info = '';
456
 
 
457
  $message = '';
458
  foreach ($values['item_meta'] as $v) {
459
  if (preg_match("/^\S+@\S+\.\S+$/", $v)) {
@@ -466,10 +480,10 @@ function ct_frm_validate_entry ($errors, $values) {
466
  $ct_base_call_result = ct_base_call(array(
467
  'message' => $message,
468
  'example' => null,
469
- 'sender_email' => null,
470
  'sender_nickname' => null,
471
  'post_info' => $post_info,
472
- 'checkjs_field' => $ct_checkjs_frm
473
  ));
474
  $ct = $ct_base_call_result['ct'];
475
  $ct_result = $ct_base_call_result['ct_result'];
@@ -530,6 +544,8 @@ function ct_preprocess_comment($comment) {
530
 
531
  $post = get_post($comment_post_id);
532
 
 
 
533
  $example = null;
534
 
535
  $post_info['comment_type'] = $comment['comment_type'];
@@ -564,7 +580,7 @@ function ct_preprocess_comment($comment) {
564
  'sender_email' => $comment['comment_author_email'],
565
  'sender_nickname' => $comment['comment_author'],
566
  'post_info' => $post_info,
567
- 'checkjs_field' => 'ct_checkjs'
568
  ));
569
  $ct = $ct_base_call_result['ct'];
570
  $ct_result = $ct_base_call_result['ct_result'];
@@ -595,7 +611,7 @@ function ct_preprocess_comment($comment) {
595
  $approved_comments = get_comments(array('status' => 'approve', 'count' => true, 'author_email' => $comment['comment_author_email']));
596
 
597
  // Change comment flow only for new authors
598
- if ((int) $approved_comments == 0 || $ct_result->stop_words !== null) {
599
 
600
  if ($ct_result->allow == 1 && $options['autoPubRevelantMess'] == 1) {
601
  add_filter('pre_comment_approved', 'ct_set_approved');
@@ -919,8 +935,7 @@ function ct_plugin_active($plugin_name){
919
  */
920
  function ct_get_checkjs_value() {
921
  $options = ct_get_options();
922
-
923
- return md5($options['apikey'] . '+' . get_settings('admin_email'));
924
  }
925
 
926
  /**
@@ -961,12 +976,33 @@ function ct_register_form() {
961
  return null;
962
  }
963
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
964
  /**
965
  * Test users registration
966
  * @return array with errors
967
  */
968
  function ct_registration_errors($errors, $sanitized_user_login = null, $user_email = null) {
969
- global $ct_agent_version, $ct_checkjs_register_form, $ct_session_request_id_label, $bp;
970
 
971
  //
972
  // BuddyPress actions
@@ -986,7 +1022,7 @@ function ct_registration_errors($errors, $sanitized_user_login = null, $user_ema
986
  return $errors;
987
  }
988
 
989
- $checkjs = js_test($ct_checkjs_register_form);
990
 
991
  require_once('cleantalk.class.php');
992
 
@@ -1001,13 +1037,6 @@ function ct_registration_errors($errors, $sanitized_user_login = null, $user_ema
1001
  $user_info = '';
1002
 
1003
  $sender_email = $user_email;
1004
-
1005
- ct_init_session();
1006
- if (array_key_exists('formtime', $_SESSION)) {
1007
- $submit_time = time() - (int) $_SESSION['formtime'];
1008
- } else {
1009
- $submit_time = null;
1010
- }
1011
 
1012
  $config = get_option('cleantalk_server');
1013
 
@@ -1026,7 +1055,7 @@ function ct_registration_errors($errors, $sanitized_user_login = null, $user_ema
1026
  $ct_request->agent = $ct_agent_version;
1027
  $ct_request->sender_info = $user_info;
1028
  $ct_request->js_on = $checkjs;
1029
- $ct_request->submit_time = $submit_time;
1030
 
1031
  $ct_result = $ct->isAllowUser($ct_request);
1032
  if ($ct->server_change) {
@@ -1042,18 +1071,32 @@ function ct_registration_errors($errors, $sanitized_user_login = null, $user_ema
1042
  if ($ct_result->errno != 0) {
1043
  return $errors;
1044
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1045
 
1046
  if ($ct_result->allow == 0) {
1047
- $wordpress_domain = preg_replace("/^https?:\/\//", "", site_url());
1048
  if ($buddypress === true) {
1049
  $bp->signup->errors['signup_username'] = $ct_result->comment;
1050
  } else {
1051
- $errors->add('ct_error', __($ct_result->comment, $wordpress_domain));
1052
  }
1053
  } else {
1054
  if ($ct_result->id !== null) {
1055
- ct_init_session();
1056
  $_SESSION[$ct_session_request_id_label] = $ct_result->id;
 
1057
  }
1058
  }
1059
 
@@ -1067,9 +1110,10 @@ function ct_registration_errors($errors, $sanitized_user_login = null, $user_ema
1067
  function ct_user_register($user_id) {
1068
  global $ct_session_request_id_label;
1069
 
 
1070
  if (isset($_SESSION[$ct_session_request_id_label])) {
1071
  update_user_meta($user_id, 'ct_hash', $_SESSION[$ct_session_request_id_label]);
1072
- unset($_SESSION[$ct_session_request_id_label]);
1073
  }
1074
  }
1075
 
@@ -1089,10 +1133,6 @@ function ct_delete_user($user_id) {
1089
  */
1090
  function ct_grunion_contact_form_field_html($r, $field_label) {
1091
  global $ct_checkjs_jpcf, $ct_jpcf_patched, $ct_jpcf_fields;
1092
-
1093
- // Skip proccessing if form submited
1094
- if (count($_POST) > 0)
1095
- return $r;
1096
 
1097
  $options = ct_get_options();
1098
  if ($options['contact_forms_test'] == 1 && $ct_jpcf_patched === false && preg_match("/[text|email]/i", $r)) {
@@ -1105,6 +1145,7 @@ function ct_grunion_contact_form_field_html($r, $field_label) {
1105
  $name_patched = true;
1106
  }
1107
  }
 
1108
  $r .= ct_add_hidden_fields(0, $ct_checkjs_jpcf, true);
1109
  $ct_jpcf_patched = true;
1110
  }
@@ -1128,6 +1169,7 @@ function ct_contact_form_is_spam($form) {
1128
  if (preg_match("/^.+$ct_checkjs_jpcf$/", $k))
1129
  $js_field_name = $k;
1130
  }
 
1131
 
1132
  $sender_info = array(
1133
  'sender_url' => @$form['comment_author_url']
@@ -1152,12 +1194,12 @@ function ct_contact_form_is_spam($form) {
1152
 
1153
  $ct_base_call_result = ct_base_call(array(
1154
  'message' => $message,
1155
- 'example' => $example,
1156
  'sender_email' => $sender_email,
1157
  'sender_nickname' => $sender_nickname,
1158
  'post_info' => $post_info,
1159
  'sender_info' => $sender_info,
1160
- 'checkjs_field' => $js_field_name
1161
  ));
1162
  $ct = $ct_base_call_result['ct'];
1163
  $ct_result = $ct_base_call_result['ct_result'];
@@ -1203,7 +1245,8 @@ function ct_wpcf7_spam($spam) {
1203
  return $spam;
1204
  }
1205
 
1206
- $example = null;
 
1207
  $post_info['comment_type'] = 'feedback';
1208
  $post_info = json_encode($post_info);
1209
  if ($post_info === false)
@@ -1226,11 +1269,11 @@ function ct_wpcf7_spam($spam) {
1226
 
1227
  $ct_base_call_result = ct_base_call(array(
1228
  'message' => $message,
1229
- 'example' => $example,
1230
  'sender_email' => $sender_email,
1231
  'sender_nickname' => $sender_nickname,
1232
  'post_info' => $post_info,
1233
- 'checkjs_field' => $ct_checkjs_cf7
1234
  ));
1235
  $ct = $ct_base_call_result['ct'];
1236
  $ct_result = $ct_base_call_result['ct_result'];
@@ -1321,7 +1364,6 @@ function ct_admin_init() {
1321
  setcookie($ct_notice_trial_label, (int) $show_ct_notice_trial, strtotime("+$trial_notice_check_timeout minutes"));
1322
  }
1323
 
1324
- ct_init_locale();
1325
  ct_init_session();
1326
 
1327
  register_setting('cleantalk_settings', 'cleantalk_settings', 'ct_settings_validate');
@@ -1475,8 +1517,7 @@ function ct_comment_text($comment_text) {
1475
  $ct_hash = get_comment_meta($comment->comment_ID, 'ct_hash', true);
1476
 
1477
  if ($ct_hash !== '' && $_COOKIE[$ct_approved_request_id_label] == $ct_hash) {
1478
- ct_init_locale();
1479
- $comment_text .= '<br /><br /> <em class="comment-awaiting-moderation">' . __('Comment approved. Anti-spam by CleanTalk.', 'cleantalk') . '</em>';
1480
  }
1481
  }
1482
 
@@ -1500,4 +1541,5 @@ if (!function_exists ( 'ct_register_plugin_links')) {
1500
  }
1501
  }
1502
 
 
1503
  ?>
3
  Plugin Name: Anti-spam by CleanTalk
4
  Plugin URI: http://cleantalk.org/my
5
  Description: Cloud antispam for comments, registrations and contacts. The plugin doesn't use CAPTCHA, Q&A, math, counting animals or quiz to stop spam bots.
6
+ Version: 2.36
7
  Author: СleanTalk <welcome@cleantalk.ru>
8
  Author URI: http://cleantalk.org
9
  */
10
 
11
+ $ct_agent_version = 'wordpress-236';
12
  $ct_checkjs_frm = 'ct_checkjs_frm';
13
  $ct_checkjs_register_form = 'ct_checkjs_register_form';
14
  $ct_session_request_id_label = 'request_id';
15
+ $ct_session_register_ok_label = 'register_ok';
16
 
17
  $ct_checkjs_cf7 = 'ct_checkjs_cf7';
18
  $ct_cf7_comment = 'This is a spam!';
45
  // Timeout before new check for trial notice in minutes
46
  $trial_notice_check_timeout = 10;
47
 
48
+ // Init action.
49
  add_action('init', 'ct_init');
50
 
51
+ // After plugin loaded - to load locale as described in manual
52
+ add_action( 'plugins_loaded', 'ct_plugin_loaded' );
53
+
54
  // Comments
55
  add_filter('preprocess_comment', 'ct_preprocess_comment'); // param - comment data array
56
  add_filter( 'comment_text', 'ct_comment_text' );
76
  add_filter('grunion_contact_form_field_html', 'ct_grunion_contact_form_field_html', 10, 2);
77
  add_filter('contact_form_is_spam', 'ct_contact_form_is_spam');
78
 
79
+ // Login form - for notifications only
80
+ add_filter('login_message', 'ct_login_message');
81
+
82
+
83
  if (is_admin()) {
84
  add_action('admin_init', 'ct_admin_init', 1);
85
  add_action('admin_menu', 'ct_admin_add_page');
113
  }
114
  }
115
 
116
+ /**
117
+ * Public action 'plugins_loaded' - Loads locale, see http://codex.wordpress.org/Function_Reference/load_plugin_textdomain
118
+ */
119
+ function ct_plugin_loaded() {
120
+ load_plugin_textdomain('cleantalk', false, basename(dirname(__FILE__)) . '/i18n');
121
+ }
122
+
123
  /**
124
  * Inner function - Current Cleantalk options
125
  * @return mixed[] Array of options
194
  }
195
 
196
  $ct_feedback = $hash . ':' . $allow . ';';
197
+ ct_init_session();
198
  if (empty($_SESSION['feedback_request'])) {
199
  $_SESSION['feedback_request'] = $ct_feedback;
200
  } else {
211
  */
212
  function ct_send_feedback($feedback_request = null) {
213
 
214
+ ct_init_session();
215
  if (empty($feedback_request) && isset($_SESSION['feedback_request']) && preg_match("/^[a-z0-9\;\:]+$/", $_SESSION['feedback_request'])) {
216
  $feedback_request = $_SESSION['feedback_request'];
217
  unset($_SESSION['feedback_request']);
250
  return false;
251
  }
252
 
 
 
 
 
 
 
 
253
  /**
254
  * Session init
255
  * @return null;
268
  * @param array Array of parameters:
269
  * 'message' - string
270
  * 'example' - string
271
+ * 'checkjs' - int
272
  * 'sender_email' - string
273
  * 'sender_nickname' - string
274
  * 'sender_info' - array
 
275
  * 'post_info' - string
276
  * @return array array('ct'=> Cleantalk, 'ct_result' => CleantalkResponse)
277
  */
318
  $ct_request->sender_ip = $ct->ct_session_ip($_SERVER['REMOTE_ADDR']);
319
  $ct_request->agent = $ct_agent_version;
320
  $ct_request->sender_info = $sender_info;
321
+ $ct_request->js_on = $params['checkjs'];
322
  $ct_request->submit_time = $submit_time;
323
  $ct_request->post_info = $params['post_info'];
324
 
340
  * Adds hidden filed to comment form
341
  */
342
  function ct_comment_form() {
343
+ global $ct_jp_active;
344
 
345
  if (ct_is_user_enable() === false) {
346
  return false;
351
  return false;
352
  }
353
 
354
+ ct_add_hidden_fields(0, 'ct_checkjs', false, $ct_jp_active);
355
 
356
  return null;
357
  }
360
  * Adds hidden filed to define avaialbility of client's JavaScript
361
  * @param int $post_id Post ID, not used
362
  */
363
+ function ct_add_hidden_fields($post_id = 0, $field_name = 'ct_checkjs', $return_string = false, $cookie_check = false) {
364
+
365
  global $ct_jp_active, $ct_checkjs_def;
366
 
367
  $ct_checkjs_key = ct_get_checkjs_value();
368
  ct_init_session();
369
  $_SESSION['formtime'] = time();
370
 
371
+ if ($cookie_check) {
372
  $html = '
373
  <script type="text/javascript">
374
  // <![CDATA[
389
  <input type="hidden" id="%s" name="%s" value="0" />
390
  <script type="text/javascript">
391
  // <![CDATA[
392
+ document.getElementById("%s").value = document.getElementById("%s").value.replace(/^%s$/, "%s");
393
  // ]]>
394
  </script>
395
  ';
460
  return false;
461
  }
462
 
463
+ $checkjs = js_test($ct_checkjs_frm);
464
+
465
  $post_info['comment_type'] = 'feedback';
466
  $post_info = json_encode($post_info);
467
  if ($post_info === false)
468
  $post_info = '';
469
 
470
+ $sender_email = null;
471
  $message = '';
472
  foreach ($values['item_meta'] as $v) {
473
  if (preg_match("/^\S+@\S+\.\S+$/", $v)) {
480
  $ct_base_call_result = ct_base_call(array(
481
  'message' => $message,
482
  'example' => null,
483
+ 'sender_email' => $sender_email,
484
  'sender_nickname' => null,
485
  'post_info' => $post_info,
486
+ 'checkjs' => $checkjs
487
  ));
488
  $ct = $ct_base_call_result['ct'];
489
  $ct_result = $ct_base_call_result['ct_result'];
544
 
545
  $post = get_post($comment_post_id);
546
 
547
+ $checkjs = js_test('ct_checkjs');
548
+
549
  $example = null;
550
 
551
  $post_info['comment_type'] = $comment['comment_type'];
580
  'sender_email' => $comment['comment_author_email'],
581
  'sender_nickname' => $comment['comment_author'],
582
  'post_info' => $post_info,
583
+ 'checkjs' => $checkjs
584
  ));
585
  $ct = $ct_base_call_result['ct'];
586
  $ct_result = $ct_base_call_result['ct_result'];
611
  $approved_comments = get_comments(array('status' => 'approve', 'count' => true, 'author_email' => $comment['comment_author_email']));
612
 
613
  // Change comment flow only for new authors
614
+ if ((int) $approved_comments == 0 || $ct_result->stop_words !== null) {
615
 
616
  if ($ct_result->allow == 1 && $options['autoPubRevelantMess'] == 1) {
617
  add_filter('pre_comment_approved', 'ct_set_approved');
935
  */
936
  function ct_get_checkjs_value() {
937
  $options = ct_get_options();
938
+ return md5($options['apikey'] . '+' . get_option('admin_email'));
 
939
  }
940
 
941
  /**
976
  return null;
977
  }
978
 
979
+ /**
980
+ * Adds notification text to login form - to inform about approced registration
981
+ * @return null
982
+ */
983
+ function ct_login_message($message) {
984
+ global $errors, $ct_session_register_ok_label;
985
+
986
+ $options = ct_get_options();
987
+ if ($options['registrations_test'] != 0) {
988
+ if( isset($_GET['checkemail']) && 'registered' == $_GET['checkemail'] ) {
989
+ ct_init_session();
990
+ if (isset($_SESSION[$ct_session_register_ok_label])) {
991
+ unset($_SESSION[$ct_session_register_ok_label]);
992
+ if(is_wp_error($errors))
993
+ $errors->add('ct_message','<br />' . sprintf(__('Registration is approved by %s.', 'cleantalk'), '<b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk</b>'), 'message');
994
+ }
995
+ }
996
+ }
997
+ return $message;
998
+ }
999
+
1000
  /**
1001
  * Test users registration
1002
  * @return array with errors
1003
  */
1004
  function ct_registration_errors($errors, $sanitized_user_login = null, $user_email = null) {
1005
+ global $ct_agent_version, $ct_checkjs_register_form, $ct_session_request_id_label, $ct_session_register_ok_label, $bp;
1006
 
1007
  //
1008
  // BuddyPress actions
1022
  return $errors;
1023
  }
1024
 
1025
+ $checkjs = js_test($ct_checkjs_register_form);
1026
 
1027
  require_once('cleantalk.class.php');
1028
 
1037
  $user_info = '';
1038
 
1039
  $sender_email = $user_email;
 
 
 
 
 
 
 
1040
 
1041
  $config = get_option('cleantalk_server');
1042
 
1055
  $ct_request->agent = $ct_agent_version;
1056
  $ct_request->sender_info = $user_info;
1057
  $ct_request->js_on = $checkjs;
1058
+ $ct_request->submit_time = $submit_time;
1059
 
1060
  $ct_result = $ct->isAllowUser($ct_request);
1061
  if ($ct->server_change) {
1071
  if ($ct_result->errno != 0) {
1072
  return $errors;
1073
  }
1074
+
1075
+ if ($ct_result->inactive != 0) {
1076
+ $timelabel_reg = intval( get_option('cleantalk_timelabel_reg') );
1077
+ if(time() - 900 > $timelabel_reg){
1078
+ update_option('cleantalk_timelabel_reg', time());
1079
+
1080
+ $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
1081
+ $message = __('Attention, please!', 'cleantalk') . "\r\n\r\n";
1082
+ $message .= sprintf(__('"Anti-spam by CleanTalk" plugin error on your site %s:', 'cleantalk'), $blogname) . "\r\n\r\n";
1083
+ $message .= $ct_result->comment . "\r\n\r\n";
1084
+ @wp_mail(get_option('admin_email'), sprintf(__('[%s] Anti-spam by CleanTalk error!', 'cleantalk'), $blogname), $message);
1085
+ }
1086
+ return $errors;
1087
+ }
1088
 
1089
  if ($ct_result->allow == 0) {
 
1090
  if ($buddypress === true) {
1091
  $bp->signup->errors['signup_username'] = $ct_result->comment;
1092
  } else {
1093
+ $errors->add('ct_error', $ct_result->comment);
1094
  }
1095
  } else {
1096
  if ($ct_result->id !== null) {
1097
+ ct_init_session();
1098
  $_SESSION[$ct_session_request_id_label] = $ct_result->id;
1099
+ $_SESSION[$ct_session_register_ok_label] = $ct_result->id;
1100
  }
1101
  }
1102
 
1110
  function ct_user_register($user_id) {
1111
  global $ct_session_request_id_label;
1112
 
1113
+ ct_init_session();
1114
  if (isset($_SESSION[$ct_session_request_id_label])) {
1115
  update_user_meta($user_id, 'ct_hash', $_SESSION[$ct_session_request_id_label]);
1116
+ unset($_SESSION[$ct_session_request_id_label]);
1117
  }
1118
  }
1119
 
1133
  */
1134
  function ct_grunion_contact_form_field_html($r, $field_label) {
1135
  global $ct_checkjs_jpcf, $ct_jpcf_patched, $ct_jpcf_fields;
 
 
 
 
1136
 
1137
  $options = ct_get_options();
1138
  if ($options['contact_forms_test'] == 1 && $ct_jpcf_patched === false && preg_match("/[text|email]/i", $r)) {
1145
  $name_patched = true;
1146
  }
1147
  }
1148
+
1149
  $r .= ct_add_hidden_fields(0, $ct_checkjs_jpcf, true);
1150
  $ct_jpcf_patched = true;
1151
  }
1169
  if (preg_match("/^.+$ct_checkjs_jpcf$/", $k))
1170
  $js_field_name = $k;
1171
  }
1172
+ $checkjs = js_test($js_field_name);
1173
 
1174
  $sender_info = array(
1175
  'sender_url' => @$form['comment_author_url']
1194
 
1195
  $ct_base_call_result = ct_base_call(array(
1196
  'message' => $message,
1197
+ 'example' => null,
1198
  'sender_email' => $sender_email,
1199
  'sender_nickname' => $sender_nickname,
1200
  'post_info' => $post_info,
1201
  'sender_info' => $sender_info,
1202
+ 'checkjs' => $checkjs
1203
  ));
1204
  $ct = $ct_base_call_result['ct'];
1205
  $ct_result = $ct_base_call_result['ct_result'];
1245
  return $spam;
1246
  }
1247
 
1248
+ $checkjs = js_test($ct_checkjs_cf7);
1249
+
1250
  $post_info['comment_type'] = 'feedback';
1251
  $post_info = json_encode($post_info);
1252
  if ($post_info === false)
1269
 
1270
  $ct_base_call_result = ct_base_call(array(
1271
  'message' => $message,
1272
+ 'example' => null,
1273
  'sender_email' => $sender_email,
1274
  'sender_nickname' => $sender_nickname,
1275
  'post_info' => $post_info,
1276
+ 'checkjs' => $checkjs
1277
  ));
1278
  $ct = $ct_base_call_result['ct'];
1279
  $ct_result = $ct_base_call_result['ct_result'];
1364
  setcookie($ct_notice_trial_label, (int) $show_ct_notice_trial, strtotime("+$trial_notice_check_timeout minutes"));
1365
  }
1366
 
 
1367
  ct_init_session();
1368
 
1369
  register_setting('cleantalk_settings', 'cleantalk_settings', 'ct_settings_validate');
1517
  $ct_hash = get_comment_meta($comment->comment_ID, 'ct_hash', true);
1518
 
1519
  if ($ct_hash !== '' && $_COOKIE[$ct_approved_request_id_label] == $ct_hash) {
1520
+ $comment_text .= '<br /><br /> <em class="comment-awaiting-moderation">' . __('Comment is approved. Anti-spam by CleanTalk.', 'cleantalk') . '</em>';
 
1521
  }
1522
  }
1523
 
1541
  }
1542
  }
1543
 
1544
+
1545
  ?>
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: znaeff, shagimuratov
3
  Tags: antispam, anti-spam, anti spam, spam, captcha, comment, comments, wpmu, network, multisite, forms, registration, login, contact form, buddypress, bbpress, admin, user, users, post, posts, wordpress, javascript, plugin, blacklists, cloud, math, signup, akismet, JetPack, WooCommerce, ios, iphone, ipad
4
  Requires at least: 3.0
5
  Tested up to: 3.8.1
6
- Stable tag: 2.35
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -56,7 +56,7 @@ Plugin uses several simple tests to stop spammers.
56
  Spam comments moves to SPAM folder. First comment from a new author plugin compares with post and previous comments. If the relevance of the comment is good enough it gets approval at the blog without manual approval.
57
 
58
  = Will plugin works with my theme? =
59
- Plugin works with all WordPress themes. With some themes may not works JavaScript anti-spam method, but it's not crucial to protect your blog from spam bots.
60
 
61
  = How can I test anti-spam protection? =
62
  Please use email **stop_email@example.com** for comments, contacts or signups. Also you can see comments proccessed by plugin for last 7 days at <a href="http://cleantalk.org/my/show_requests">Control panel</a> or look at folder "Spam" for banned comments.
@@ -94,6 +94,9 @@ WordPress 3.0 at least. PHP 4, 5 with CURL or file_get_contents() function and e
94
 
95
  == Changelog ==
96
 
 
 
 
97
  = 2.35 2014-03-12 =
98
  * New: Notifications about disabled account
99
  * New: Improved JavaScript spam test.
@@ -256,6 +259,9 @@ WordPress 3.0 at least. PHP 4, 5 with CURL or file_get_contents() function and e
256
  * First version
257
 
258
  == Upgrade Notice ==
 
 
 
259
  = 2.35 2014-03-12 =
260
  * New: Notifications about disabled account
261
  * New: Improved JavaScript spam test.
@@ -319,4 +325,3 @@ WordPress 3.0 at least. PHP 4, 5 with CURL or file_get_contents() function and e
319
 
320
  = 2.4.13 2013-08-19 =
321
  * Fixed: "Fail connect to servers..." error on hostings with disabled 'allow_url_fopen' PHP option.
322
-
3
  Tags: antispam, anti-spam, anti spam, spam, captcha, comment, comments, wpmu, network, multisite, forms, registration, login, contact form, buddypress, bbpress, admin, user, users, post, posts, wordpress, javascript, plugin, blacklists, cloud, math, signup, akismet, JetPack, WooCommerce, ios, iphone, ipad
4
  Requires at least: 3.0
5
  Tested up to: 3.8.1
6
+ Stable tag: 2.36
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
56
  Spam comments moves to SPAM folder. First comment from a new author plugin compares with post and previous comments. If the relevance of the comment is good enough it gets approval at the blog without manual approval.
57
 
58
  = Will plugin works with my theme? =
59
+ Plugin works with all WordPress themes, for example - Responsive, Twenty Eleven, Twenty Twelve, Twenty Ten, Twenty Thirteen, Sixteen, Radiate, Alexandria, Swift Basic, Ridizain, Customizr, Catch Box, Twenty Fourteen, Virtue, Tempera, Pinboard, hemingway, Vantage, Weaver II, Buzz, Omega, iFeature, Simple Catch and etc. With some themes may not works JavaScript anti-spam method, but it's not crucial to protect your blog from spam bots.
60
 
61
  = How can I test anti-spam protection? =
62
  Please use email **stop_email@example.com** for comments, contacts or signups. Also you can see comments proccessed by plugin for last 7 days at <a href="http://cleantalk.org/my/show_requests">Control panel</a> or look at folder "Spam" for banned comments.
94
 
95
  == Changelog ==
96
 
97
+ = 2.36 2014-03-12 =
98
+ * Reversed to patches from old revisions.
99
+
100
  = 2.35 2014-03-12 =
101
  * New: Notifications about disabled account
102
  * New: Improved JavaScript spam test.
259
  * First version
260
 
261
  == Upgrade Notice ==
262
+ = 2.36 2014-03-12 =
263
+ * Reversed to patches from old revisions.
264
+
265
  = 2.35 2014-03-12 =
266
  * New: Notifications about disabled account
267
  * New: Improved JavaScript spam test.
325
 
326
  = 2.4.13 2013-08-19 =
327
  * Fixed: "Fail connect to servers..." error on hostings with disabled 'allow_url_fopen' PHP option.