Spam protection, AntiSpam, FireWall by CleanTalk - Version 5.118.2

Version Description

April 25 2019 = * Mod: Spam filtration quality improved. * Mod: Store SFW cookie for 30 days. * Mod: Server IP added to connection report. * Fix: spam_stat is not defined.

Download this release

Release Info

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

Code changes from version 5.118.1 to 5.118.2

cleantalk.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Anti-Spam by CleanTalk
4
  Plugin URI: http://cleantalk.org
5
  Description: Max power, all-in-one, no Captcha, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms.
6
- Version: 5.118.1
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
@@ -39,7 +39,7 @@ define('APBCT_SEESION__LIVE_TIME', 86400*3);
39
  define('APBCT_SEESION__CHANCE_TO_CLEAN', 50);
40
 
41
  // Different params
42
- define('APBCT_REMOTE_CALL_SLEEP', 10); // Minimum time between remote call
43
 
44
  if(!defined('CLEANTALK_PLUGIN_DIR')){
45
 
@@ -389,8 +389,15 @@ function apbct_remote_call__perform()
389
  // SFW update
390
  case 'sfw_update':
391
  $result = ct_sfw_update(true);
 
 
 
 
 
 
 
392
  die(empty($result['error']) ? 'OK' : 'FAIL '.json_encode(array('error' => $result['error_string'])));
393
- break;
394
 
395
  // SFW send logs
396
  case 'sfw_send_logs':
@@ -500,7 +507,7 @@ function apbct_sfw__check()
500
  $sfw->sfw_die($apbct->api_key);
501
  }else{
502
  if(!empty($apbct->settings['set_cookies']) && !headers_sent())
503
- setcookie ('ct_sfw_pass_key', md5($sfw->passed_ip.$apbct->api_key), time()+86400*3, '/', parse_url(get_option('siteurl'),PHP_URL_HOST) ,false, true);
504
  }
505
  }
506
  unset($is_sfw_check, $sfw, $sfw_ip, $ct_cur_ip);
@@ -1199,22 +1206,27 @@ function ct_mail_send_connection_report() {
1199
  <td><b>Date</b></td>
1200
  <td><b>Page URL</b></td>
1201
  <td><b>Library report</b></td>
 
1202
  </tr>
1203
  ';
1204
- foreach ($apbct->connection_reports['negative_report'] as $key=>$report)
1205
  {
1206
- $message.= "<tr><td>".($key+1).".</td><td>".$report['date']."</td><td>".$report['page_url']."</td><td>".$report['lib_report']."</td></tr>";
1207
- }
1208
- $message.='</table></body></html>';
1209
-
1210
- $headers = "Content-type: text/html; charset=windows-1251 \r\n";
1211
- $headers .= "From: ".get_option('admin_email');
1212
- mail($to, $subject, $message, $headers);
 
 
 
 
 
 
1213
  }
1214
 
1215
- $apbct->data['connection_reports']['success'] = 0;
1216
- $apbct->data['connection_reports']['negative'] = 0;
1217
- $apbct->data['connection_reports']['negative_report'] = array();
1218
  $apbct->data['connection_reports']['since'] = date('d M');
1219
  $apbct->saveData();
1220
  }
3
  Plugin Name: Anti-Spam by CleanTalk
4
  Plugin URI: http://cleantalk.org
5
  Description: Max power, all-in-one, no Captcha, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms.
6
+ Version: 5.118.2
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
39
  define('APBCT_SEESION__CHANCE_TO_CLEAN', 50);
40
 
41
  // Different params
42
+ define('APBCT_REMOTE_CALL_SLEEP', 5); // Minimum time between remote call
43
 
44
  if(!defined('CLEANTALK_PLUGIN_DIR')){
45
 
389
  // SFW update
390
  case 'sfw_update':
391
  $result = ct_sfw_update(true);
392
+ /**
393
+ * @todo CRUNCH
394
+ */
395
+ if(is_string($result) && strpos($result, 'FAIL') !== false){
396
+ $result = json_decode(substr($result, 5), true);
397
+ $result['error_string'] = $result['error'];
398
+ }
399
  die(empty($result['error']) ? 'OK' : 'FAIL '.json_encode(array('error' => $result['error_string'])));
400
+ break;
401
 
402
  // SFW send logs
403
  case 'sfw_send_logs':
507
  $sfw->sfw_die($apbct->api_key);
508
  }else{
509
  if(!empty($apbct->settings['set_cookies']) && !headers_sent())
510
+ setcookie ('ct_sfw_pass_key', md5($sfw->passed_ip.$apbct->api_key), time()+86400*30, '/', parse_url(get_option('siteurl'),PHP_URL_HOST) ,false, true);
511
  }
512
  }
513
  unset($is_sfw_check, $sfw, $sfw_ip, $ct_cur_ip);
1206
  <td><b>Date</b></td>
1207
  <td><b>Page URL</b></td>
1208
  <td><b>Library report</b></td>
1209
+ <td><b>Server IP</b></td>
1210
  </tr>
1211
  ';
1212
+ foreach ($apbct->connection_reports['negative_report'] as $key => $report)
1213
  {
1214
+ $message.= '<tr>'
1215
+ . '<td>'.($key+1).'.</td>'
1216
+ . '<td>'.$report['date'].'</td>'
1217
+ . '<td>'.$report['page_url'].'</td>'
1218
+ . '<td>'.$report['lib_report'].'</td>'
1219
+ . '<td>'.$report['work_url'].'</td>'
1220
+ . '</tr>';
1221
+ }
1222
+ $message.='</table></body></html>';
1223
+
1224
+ $headers = 'Content-type: text/html; charset=windows-1251 \r\n';
1225
+ $headers .= 'From: '.get_option('admin_email');
1226
+ mail($to, $subject, $message, $headers);
1227
  }
1228
 
1229
+ $apbct->data['connection_reports'] = $apbct->def_data['connection_reports'];
 
 
1230
  $apbct->data['connection_reports']['since'] = date('d M');
1231
  $apbct->saveData();
1232
  }
inc/cleantalk-admin.php CHANGED
@@ -241,6 +241,11 @@ function apbct_admin__enqueue_scripts($hook){
241
  // Preparing widget data
242
  // Parsing brief data 'spam_stat' {"yyyy-mm-dd": spam_count, "yyyy-mm-dd": spam_count} to [["yyyy-mm-dd", "spam_count"], ["yyyy-mm-dd", "spam_count"]]
243
  $to_chart = array();
 
 
 
 
 
244
  foreach( $apbct->data['brief_data']['spam_stat'] as $key => $value ){
245
  $to_chart[] = array( $key, $value );
246
  } unset( $key, $value );
241
  // Preparing widget data
242
  // Parsing brief data 'spam_stat' {"yyyy-mm-dd": spam_count, "yyyy-mm-dd": spam_count} to [["yyyy-mm-dd", "spam_count"], ["yyyy-mm-dd", "spam_count"]]
243
  $to_chart = array();
244
+
245
+ // Crunch. Response contains error.
246
+ if(!empty($apbct->data['brief_data']['error']))
247
+ $apbct->data['brief_data'] = array_merge($apbct->data['brief_data'], $apbct->def_data['brief_data']);
248
+
249
  foreach( $apbct->data['brief_data']['spam_stat'] as $key => $value ){
250
  $to_chart[] = array( $key, $value );
251
  } unset( $key, $value );
inc/cleantalk-ajax.php CHANGED
@@ -280,6 +280,7 @@ function ct_ajax_hook($message_obj = false, $additional = false)
280
  'updraft_savesettings', // UpdraftPlus
281
  'wpdUpdateAutomatically', //Comments update
282
  'upload-attachment', // Skip ulpload attachments
 
283
  );
284
 
285
  //General post_info for all ajax calls
280
  'updraft_savesettings', // UpdraftPlus
281
  'wpdUpdateAutomatically', //Comments update
282
  'upload-attachment', // Skip ulpload attachments
283
+ 'iwj_update_profile', //Skip profile page checker
284
  );
285
 
286
  //General post_info for all ajax calls
inc/cleantalk-common.php CHANGED
@@ -128,12 +128,18 @@ function apbct_base_call($params = array(), $reg_flag = false){
128
  else
129
  {
130
  $apbct->data['connection_reports']['negative']++;
131
- $apbct->data['connection_reports']['negative_report'][] = array('date'=>date("Y-m-d H:i:s"),'page_url'=>$_SERVER['REQUEST_URI'],'lib_report'=>$ct_result->errstr);
 
 
 
 
 
132
 
133
  if(count($apbct->data['connection_reports']['negative_report']) > 20)
134
  $apbct->data['connection_reports']['negative_report'] = array_slice($apbct->data['connection_reports']['negative_report'], -20, 20);
135
 
136
  }
 
137
  if ($ct->server_change) {
138
  update_option(
139
  'cleantalk_server',
128
  else
129
  {
130
  $apbct->data['connection_reports']['negative']++;
131
+ $apbct->data['connection_reports']['negative_report'][] = array(
132
+ 'date' => date("Y-m-d H:i:s"),
133
+ 'page_url' => $_SERVER['REQUEST_URI'],
134
+ 'lib_report' => $ct_result->errstr,
135
+ 'work_url' => $ct->work_url,
136
+ );
137
 
138
  if(count($apbct->data['connection_reports']['negative_report']) > 20)
139
  $apbct->data['connection_reports']['negative_report'] = array_slice($apbct->data['connection_reports']['negative_report'], -20, 20);
140
 
141
  }
142
+
143
  if ($ct->server_change) {
144
  update_option(
145
  'cleantalk_server',
inc/cleantalk-public.php CHANGED
@@ -2582,7 +2582,9 @@ function ct_contact_form_validate() {
2582
  (isset($_GET['cookie-state-change'])) || //skip GDPR plugin
2583
  (isset($_SERVER['HTTP_USER_AGENT']) && $_SERVER['HTTP_USER_AGENT'] == 'MailChimp' && strpos($_SERVER['REQUEST_URI'], 'mc4wp-sync-api/webhook-listener') !== false) || // Mailchimp webhook skip
2584
  (strpos($_SERVER['REQUEST_URI'],'researcher-log-in')!==false ) || // Skip login form
2585
- (strpos($_SERVER['REQUEST_URI'],'admin_aspcms/_system/AspCms_SiteSetting.asp?action=saves')!==false ) // Skip admin save callback
 
 
2586
  ) {
2587
  return null;
2588
  }
2582
  (isset($_GET['cookie-state-change'])) || //skip GDPR plugin
2583
  (isset($_SERVER['HTTP_USER_AGENT']) && $_SERVER['HTTP_USER_AGENT'] == 'MailChimp' && strpos($_SERVER['REQUEST_URI'], 'mc4wp-sync-api/webhook-listener') !== false) || // Mailchimp webhook skip
2584
  (strpos($_SERVER['REQUEST_URI'],'researcher-log-in')!==false ) || // Skip login form
2585
+ (strpos($_SERVER['REQUEST_URI'],'admin_aspcms/_system/AspCms_SiteSetting.asp?action=saves')!==false ) || // Skip admin save callback
2586
+ (strpos($_SERVER['REQUEST_URI'],'?profile_tab=postjobs')!==false ) || // Skip post vacancies
2587
+ (isset($_POST['btn_insert_post_type_hotel']) && $_POST['btn_insert_post_type_hotel'] == 'SUBMIT HOTEL') // Skip adding hotel
2588
  ) {
2589
  return null;
2590
  }
inc/cleantalk-settings.php CHANGED
@@ -770,19 +770,37 @@ function apbct_settings__field__connection_reports() {
770
  if ($apbct->connection_reports['negative'] == 0){
771
  _e('There are no failed connections to server.', 'cleantalk');
772
  }else{
773
- echo "<table id='negative_reports_table' style='display: none;'>
774
  <tr>
775
  <td>#</td>
776
  <td><b>Date</b></td>
777
  <td><b>Page URL</b></td>
778
  <td><b>Report</b></td>
 
779
  </tr>";
780
  foreach($apbct->connection_reports['negative_report'] as $key => $report){
781
- echo "<tr><td>".($key+1).".</td><td>".$report['date']."</td><td>".$report['page_url']."</td><td>".$report['lib_report']."</td></tr>";
 
 
 
 
 
 
782
  }
783
  echo "</table>";
784
- echo '<br/>'
785
- .'<button name="submit" class="cleantalk_manual_link" value="ct_send_connection_report">'.__('Send report', 'cleantalk').'</button>';
 
 
 
 
 
 
 
 
 
 
 
786
  }
787
 
788
  }
770
  if ($apbct->connection_reports['negative'] == 0){
771
  _e('There are no failed connections to server.', 'cleantalk');
772
  }else{
773
+ echo "<table id='negative_reports_table''>
774
  <tr>
775
  <td>#</td>
776
  <td><b>Date</b></td>
777
  <td><b>Page URL</b></td>
778
  <td><b>Report</b></td>
779
+ <td><b>Server IP</b></td>
780
  </tr>";
781
  foreach($apbct->connection_reports['negative_report'] as $key => $report){
782
+ echo '<tr>'
783
+ . '<td>'.($key+1).'.</td>'
784
+ . '<td>'.$report['date'].'</td>'
785
+ . '<td>'.$report['page_url'].'</td>'
786
+ . '<td>'.$report['lib_report'].'</td>'
787
+ . '<td>'.$report['work_url'].'</td>'
788
+ . '</tr>';
789
  }
790
  echo "</table>";
791
+ echo '<br/>';
792
+ echo '<button'
793
+ . ' name="submit"'
794
+ . ' class="cleantalk_manual_link"'
795
+ . ' value="ct_send_connection_report"'
796
+ . (!$apbct->settings['send_connection_reports'] ? ' disabled="disabled"' : '')
797
+ . '>'
798
+ .__('Send report', 'cleantalk')
799
+ .'</button>';
800
+ if (!$apbct->settings['send_connection_reports']){
801
+ echo '<br><br>';
802
+ _e('Please, enable "Send connection reports" setting to be able to send reports', 'cleantalk');
803
+ }
804
  }
805
 
806
  }
inc/cleantalk-updater.php CHANGED
@@ -214,4 +214,11 @@ function apbct_update_to_5_118_0(){
214
  WHERE last_update < NOW() - INTERVAL '. APBCT_SEESION__LIVE_TIME .' SECOND;'
215
  );
216
  delete_option('cleantalk_server');
 
 
 
 
 
 
 
217
  }
214
  WHERE last_update < NOW() - INTERVAL '. APBCT_SEESION__LIVE_TIME .' SECOND;'
215
  );
216
  delete_option('cleantalk_server');
217
+ }
218
+
219
+ function apbct_update_to_5_118_2(){
220
+ global $apbct;
221
+ $apbct->data['connection_reports'] = $apbct->def_data['connection_reports'];
222
+ $apbct->data['connection_reports']['since'] = date('d M');
223
+ $apbct->saveData();
224
  }
inc/sfw_die_page.html CHANGED
@@ -25,7 +25,9 @@
25
  var reload_timeout = 1000;
26
  var ct_date = new Date;
27
  function set_spamFireWallCookie(cookie_name, cookie_value) {
28
- document.cookie = cookie_name + '=' + escape(cookie_value) + '; path=/;{COOKIE_DOMAIN}';
 
 
29
  return null;
30
  }
31
  function get_current_url() {
25
  var reload_timeout = 1000;
26
  var ct_date = new Date;
27
  function set_spamFireWallCookie(cookie_name, cookie_value) {
28
+ var date = new Date;
29
+ date.setDate(date.getDate() + 30);
30
+ document.cookie = cookie_name + '=' + escape(cookie_value) + '; path=/;{COOKIE_DOMAIN}; expires=' + date.toUTCString();
31
  return null;
32
  }
33
  function get_current_url() {
js/apbct-public.js CHANGED
@@ -10,12 +10,12 @@ function ctSetCookieSec(c_name, value) {
10
 
11
  function apbct_attach_event_handler(elem, event, callback){
12
  if(typeof window.addEventListener === "function") elem.addEventListener(event, callback);
13
- else elem.attachEvent(event, callback);
14
  }
15
 
16
  function apbct_remove_event_handler(elem, event, callback){
17
  if(typeof window.removeEventListener === "function") elem.removeEventListener(event, callback);
18
- else elem.detachEvent(event, callback);
19
  }
20
 
21
  ctSetCookieSec("ct_ps_timestamp", Math.floor(new Date().getTime()/1000));
10
 
11
  function apbct_attach_event_handler(elem, event, callback){
12
  if(typeof window.addEventListener === "function") elem.addEventListener(event, callback);
13
+ else elem.attachEvent(event, callback);
14
  }
15
 
16
  function apbct_remove_event_handler(elem, event, callback){
17
  if(typeof window.removeEventListener === "function") elem.removeEventListener(event, callback);
18
+ else elem.detachEvent(event, callback);
19
  }
20
 
21
  ctSetCookieSec("ct_ps_timestamp", Math.floor(new Date().getTime()/1000));
lib/CleantalkHelper.php CHANGED
@@ -355,7 +355,7 @@ class CleantalkHelper
355
 
356
  if($result){
357
 
358
- if(!in_array('dont_split_to_array', $presets))
359
  $result = explode(PHP_EOL, $result);
360
 
361
  // Get code crossPHP method
355
 
356
  if($result){
357
 
358
+ if(strpos($result, PHP_EOL) !== false && !in_array('dont_split_to_array', $presets))
359
  $result = explode(PHP_EOL, $result);
360
 
361
  // Get code crossPHP method
lib/CleantalkResponse.php CHANGED
@@ -130,10 +130,8 @@ class CleantalkResponse {
130
  $this->{$param} = $value;
131
  }
132
  } else {
133
- $this->errno = $obj->errno;
134
- $this->errstr = $obj->errstr;
135
-
136
- $this->errstr = preg_replace("/.+(\*\*\*.+\*\*\*).+/", "$1", $this->errstr);
137
 
138
  $this->stop_words = isset($obj->stop_words) ? utf8_decode($obj->stop_words) : null;
139
  $this->comment = isset($obj->comment) ? utf8_decode($obj->comment) : null;
130
  $this->{$param} = $value;
131
  }
132
  } else {
133
+ $this->errno = (isset($obj->errno)) ? $obj->errno : 0;
134
+ $this->errstr = (isset($obj->errstr)) ? preg_replace("/.+(\*\*\*.+\*\*\*).+/", "$1", $obj->errstr) : null;
 
 
135
 
136
  $this->stop_words = isset($obj->stop_words) ? utf8_decode($obj->stop_words) : null;
137
  $this->comment = isset($obj->comment) ? utf8_decode($obj->comment) : null;
lib/CleantalkSFW_Base.php CHANGED
@@ -171,14 +171,14 @@ class CleantalkSFW_Base
171
  // Getting remote file name
172
  if(!$file_url){
173
 
 
 
174
  $result = CleantalkAPI::method__get_2s_blacklists_db($ct_key, 'file');
175
 
176
  if(empty($result['error'])){
177
 
178
  if( !empty($result['file_url']) ){
179
 
180
- $file_url = $result['file_url'];
181
-
182
  $pattenrs = array();
183
  $pattenrs[] = 'get';
184
  if(!$immediate) $pattenrs[] = 'dont_wait_for_answer';
@@ -199,17 +199,15 @@ class CleantalkSFW_Base
199
  }else
200
  return $result;
201
  }else{
202
-
203
- sleep(3);
204
-
205
  if(CleantalkHelper::http__request($file_url, array(), 'get_code') === 200){ // Check if it's there
206
 
207
- $this->db->query("DELETE FROM ".$this->data_table.";", true);
208
-
209
  $gf = gzopen($file_url, 'rb');
210
 
211
  if($gf){
212
 
 
 
213
  for($count_result = 0; !gzeof($gf); ){
214
 
215
 
171
  // Getting remote file name
172
  if(!$file_url){
173
 
174
+ sleep(6);
175
+
176
  $result = CleantalkAPI::method__get_2s_blacklists_db($ct_key, 'file');
177
 
178
  if(empty($result['error'])){
179
 
180
  if( !empty($result['file_url']) ){
181
 
 
 
182
  $pattenrs = array();
183
  $pattenrs[] = 'get';
184
  if(!$immediate) $pattenrs[] = 'dont_wait_for_answer';
199
  }else
200
  return $result;
201
  }else{
202
+
 
 
203
  if(CleantalkHelper::http__request($file_url, array(), 'get_code') === 200){ // Check if it's there
204
 
 
 
205
  $gf = gzopen($file_url, 'rb');
206
 
207
  if($gf){
208
 
209
+ $this->db->query("DELETE FROM ".$this->data_table.";", true);
210
+
211
  for($count_result = 0; !gzeof($gf); ){
212
 
213
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: safronik
3
  Tags: spam, antispam, protection, comments, firewall
4
  Requires at least: 3.0
5
  Tested up to: 5.2
6
- Stable tag: 5.118.1
7
  License: GPLv2
8
 
9
  Spam protection, antispam, all-in-one, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
@@ -558,6 +558,12 @@ If your website has forms that send data to external sources, you can enable opt
558
  10. Website's options.
559
 
560
  == Changelog ==
 
 
 
 
 
 
561
  = 5.118.1 April 19 2019 =
562
  * Fix: Fatal error.
563
  * Mod: Spam protection improved on registrations.
@@ -1859,6 +1865,12 @@ If your website has forms that send data to external sources, you can enable opt
1859
  * First version
1860
 
1861
  == Upgrade Notice ==
 
 
 
 
 
 
1862
  = 5.118.1 April 19 2019 =
1863
  * Fix: Fatal error.
1864
  * Mod: Spam protection improved on registrations.
3
  Tags: spam, antispam, protection, comments, firewall
4
  Requires at least: 3.0
5
  Tested up to: 5.2
6
+ Stable tag: 5.118.2
7
  License: GPLv2
8
 
9
  Spam protection, antispam, all-in-one, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
558
  10. Website's options.
559
 
560
  == Changelog ==
561
+ = 5.118.2 April 25 2019 =
562
+ * Mod: Spam filtration quality improved.
563
+ * Mod: Store SFW cookie for 30 days.
564
+ * Mod: Server IP added to connection report.
565
+ * Fix: spam_stat is not defined.
566
+
567
  = 5.118.1 April 19 2019 =
568
  * Fix: Fatal error.
569
  * Mod: Spam protection improved on registrations.
1865
  * First version
1866
 
1867
  == Upgrade Notice ==
1868
+ = 5.118.2 April 25 2019 =
1869
+ * Mod: Spam filtration quality improved.
1870
+ * Mod: Store SFW cookie for 30 days.
1871
+ * Mod: Server IP added to connection report.
1872
+ * Fix: spam_stat is not defined.
1873
+
1874
  = 5.118.1 April 19 2019 =
1875
  * Fix: Fatal error.
1876
  * Mod: Spam protection improved on registrations.