Spam protection, AntiSpam, FireWall by CleanTalk - Version 5.122

Version Description

July 10 2019 = * Spam Protection improved. * Fix: Error while checking account status. * Fix: Conflict with Elementor Pro. * Fix: Integration with Ninja Forms. * Fix: Integration with Formidable. * New: Detecting mobile devices. * New: Integration for Easy Forms for Mailchimp.

Download this release

Release Info

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

Code changes from version 5.121 to 5.122

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.121
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  Text Domain: cleantalk
@@ -1271,7 +1271,7 @@ function ct_account_status_check($api_key = null, $process_errors = true){
1271
 
1272
  $result = CleantalkAPI::method__notice_paid_till($api_key, preg_replace('/http[s]?:\/\//', '', get_option('siteurl'), 1));
1273
 
1274
- if(empty($result['error'])){
1275
 
1276
  // Notices
1277
  $apbct->data['notice_show'] = isset($result['show_notice']) ? (int)$result['show_notice'] : 0;
@@ -1303,20 +1303,20 @@ function ct_account_status_check($api_key = null, $process_errors = true){
1303
 
1304
  $apbct->error_delete('account_check', 'save');
1305
 
1306
- if($result['service_id'] && $result['service_id']){
1307
- $apbct->data['key_is_ok'] = true;
1308
- $result = true;
1309
- }else{
1310
- $apbct->data['key_is_ok'] = false;
1311
- $result = false;
1312
- }
1313
-
1314
  $apbct->saveData();
1315
 
1316
  }elseif($process_errors){
1317
  $apbct->error_add('account_check', $result);
1318
  }
1319
 
 
 
 
 
 
 
 
 
1320
  return $result;
1321
  }
1322
 
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.122
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  Text Domain: cleantalk
1271
 
1272
  $result = CleantalkAPI::method__notice_paid_till($api_key, preg_replace('/http[s]?:\/\//', '', get_option('siteurl'), 1));
1273
 
1274
+ if(empty($result['error']) || (isset($result['error_no']) && $result['error_no'] == 12)){
1275
 
1276
  // Notices
1277
  $apbct->data['notice_show'] = isset($result['show_notice']) ? (int)$result['show_notice'] : 0;
1303
 
1304
  $apbct->error_delete('account_check', 'save');
1305
 
 
 
 
 
 
 
 
 
1306
  $apbct->saveData();
1307
 
1308
  }elseif($process_errors){
1309
  $apbct->error_add('account_check', $result);
1310
  }
1311
 
1312
+ if(isset($result['service_id']) && is_int($result['service_id'])){
1313
+ $apbct->data['key_is_ok'] = true;
1314
+ $result = true;
1315
+ }else{
1316
+ $apbct->data['key_is_ok'] = false;
1317
+ $result = false;
1318
+ }
1319
+
1320
  return $result;
1321
  }
1322
 
inc/cleantalk-ajax.php CHANGED
@@ -277,6 +277,8 @@ function ct_ajax_hook($message_obj = false, $additional = false)
277
  'admin:saveThemeOptions', //Ait-theme admin checking
278
  'save_tourmaster_option', //Tourmaster admin save
279
  'validate_register_email', // Service id #313320
 
 
280
  );
281
 
282
  // Skip test if
@@ -347,6 +349,22 @@ function ct_ajax_hook($message_obj = false, $additional = false)
347
  if(isset($_POST['action']) && $_POST['action']=='woocommerce_checkout'){
348
  $post_info['comment_type'] = 'order';
349
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
350
  $ct_temp_msg_data = isset($ct_post_temp)
351
  ? ct_get_fields_any($ct_post_temp)
352
  : ct_get_fields_any($_POST);
@@ -661,6 +679,15 @@ function ct_ajax_hook($message_obj = false, $additional = false)
661
  print json_encode($result);
662
  die();
663
  }
 
 
 
 
 
 
 
 
 
664
  else
665
  {
666
  die(json_encode(array('apbct' => array('blocked' => true, 'comment' => $ct_result->comment,))));
277
  'admin:saveThemeOptions', //Ait-theme admin checking
278
  'save_tourmaster_option', //Tourmaster admin save
279
  'validate_register_email', // Service id #313320
280
+ 'elementor_pro_forms_send_form', //Elementor Pro
281
+ 'phone-orders-for-woocommerce', //Phone orders for woocommerce backend
282
  );
283
 
284
  // Skip test if
349
  if(isset($_POST['action']) && $_POST['action']=='woocommerce_checkout'){
350
  $post_info['comment_type'] = 'order';
351
  }
352
+ //Easy Forms for Mailchimp
353
+ if( isset($_POST['action']) && $_POST['action']=='process_form_submission' ){
354
+ $post_info['comment_type'] = 'contact_enquire_wordpress_easy_forms_for_mailchimp';
355
+ if( isset($_POST['form_data']) ) {
356
+ $form_data = explode( '&', $_POST['form_data'] );
357
+ $form_data_arr = array();
358
+ foreach ( $form_data as $val ) {
359
+ $form_data_element = explode( '=', $val );
360
+ $form_data_arr[$form_data_element[0]] = @$form_data_element[1];
361
+ }
362
+ if( isset( $form_data_arr['EMAIL'] ) ) {
363
+ $ct_post_temp['email'] = $form_data_arr['EMAIL'];
364
+ }
365
+ }
366
+ }
367
+
368
  $ct_temp_msg_data = isset($ct_post_temp)
369
  ? ct_get_fields_any($ct_post_temp)
370
  : ct_get_fields_any($_POST);
679
  print json_encode($result);
680
  die();
681
  }
682
+ //Easy Forms for Mailchimp
683
+ elseif( isset($_POST['action']) && $_POST['action']=='process_form_submission' ) {
684
+ wp_send_json_error(
685
+ array(
686
+ 'error' => 1,
687
+ 'response' => $ct_result->comment
688
+ )
689
+ );
690
+ }
691
  else
692
  {
693
  die(json_encode(array('apbct' => array('blocked' => true, 'comment' => $ct_result->comment,))));
inc/cleantalk-common.php CHANGED
@@ -261,6 +261,7 @@ function apbct_get_sender_info() {
261
  'headers_sent__hook' => !empty($apbct->headers_sent__hook) ? $apbct->headers_sent__hook : false,
262
  'headers_sent__where' => !empty($apbct->headers_sent__where) ? $apbct->headers_sent__where : false,
263
  'request_type' => isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'UNKNOWN',
 
264
  );
265
  }
266
 
261
  'headers_sent__hook' => !empty($apbct->headers_sent__hook) ? $apbct->headers_sent__hook : false,
262
  'headers_sent__where' => !empty($apbct->headers_sent__where) ? $apbct->headers_sent__where : false,
263
  'request_type' => isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'UNKNOWN',
264
+ 'abpct_hyro_acc_collect' => !empty($_COOKIE['abpct_hyro_acc_collect']) ? json_decode(stripslashes($_COOKIE['abpct_hyro_acc_collect']), true): null,
265
  );
266
  }
267
 
inc/cleantalk-public.php CHANGED
@@ -150,10 +150,11 @@ function apbct_init() {
150
  }
151
 
152
  // Formidable
153
- if(class_exists('FrmSettings')){
154
- add_action('frm_validate_entry', 'ct_frm_validate_entry', 1, 2);
155
- add_action('frm_entries_footer_scripts', 'ct_frm_entries_footer_scripts', 20, 2);
156
- }
 
157
 
158
  // BuddyPress
159
  if(class_exists('BuddyPress')){
@@ -817,13 +818,16 @@ function ct_frm_entries_footer_scripts($fields, $form) {
817
  }
818
 
819
  /**
820
- * Public function - Test Formidable data for spam activity
821
- * return @array with errors if spam has found
822
- */
823
- function ct_frm_validate_entry ($errors, $values) {
824
-
825
- global $wpdb, $current_user, $ct_checkjs_frm, $apbct;
 
826
 
 
 
827
  if ( !$apbct->settings['contact_forms_test']) {
828
  return $errors;
829
  }
@@ -833,7 +837,7 @@ function ct_frm_validate_entry ($errors, $values) {
833
  return $errors;
834
  }
835
 
836
- $ct_temp_msg_data = ct_get_fields_any($values['item_meta']);
837
 
838
  $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
839
  $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
@@ -2143,18 +2147,38 @@ function apbct_form__ninjaForms__testSpam() {
2143
 
2144
  if ($ct_result->allow == 0) {
2145
 
2146
- die(json_encode(
2147
- array(
2148
- 'apbct' => array(
2149
- 'blocked' => true,
2150
- 'comment' => $ct_result->comment,
2151
- )
2152
- )
2153
- ));
2154
-
2155
  }
2156
  }
2157
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2158
  /**
2159
  * Changes email notification for succes subscription for Ninja Forms
2160
  *
150
  }
151
 
152
  // Formidable
153
+ if(class_exists('FrmSettings')){
154
+ //add_action('frm_validate_entry', 'ct_frm_validate_entry', 1, 2);
155
+ add_filter( 'frm_entries_before_create', 'ct_frm_validate_entry', 10, 2 );
156
+ add_action('frm_entries_footer_scripts', 'ct_frm_entries_footer_scripts', 20, 2);
157
+ }
158
 
159
  // BuddyPress
160
  if(class_exists('BuddyPress')){
818
  }
819
 
820
  /**
821
+ * Public function - Test Formidable data for spam activity
822
+ * @param $errors
823
+ * @param $form
824
+ *
825
+ * @return array with errors if spam has found
826
+ */
827
+ function ct_frm_validate_entry ( $errors, $form ) {
828
 
829
+ global $apbct;
830
+
831
  if ( !$apbct->settings['contact_forms_test']) {
832
  return $errors;
833
  }
837
  return $errors;
838
  }
839
 
840
+ $ct_temp_msg_data = ct_get_fields_any($_POST['item_meta']);
841
 
842
  $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
843
  $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
2147
 
2148
  if ($ct_result->allow == 0) {
2149
 
2150
+ // We have to use GLOBAL variable to transfer the comment to apbct_form__ninjaForms__changeResponse() function :(
2151
+ $apbct->response = $ct_result->comment;
2152
+ add_action( 'ninja_forms_before_response', 'apbct_form__ninjaForms__changeResponse', 10, 1 );
 
 
 
 
 
 
2153
  }
2154
  }
2155
 
2156
+ function apbct_form__ninjaForms__changeResponse( $data ) {
2157
+
2158
+ global $apbct;
2159
+
2160
+ // Show error message below field found by ID
2161
+ if(array_key_exists('email', $data['fields_by_key'])){
2162
+ // Find ID of EMAIL field
2163
+ $nf_field_id = $data['fields_by_key']['email']['id'];
2164
+ }else{
2165
+ // Find ID of last field (usually SUBMIT)
2166
+ $nf_field_id = array_pop(array_keys($data['fields']));
2167
+ }
2168
+
2169
+ // Below is modified NJ logic
2170
+ $error = array(
2171
+ 'fields' => array(
2172
+ $nf_field_id => $apbct->response,
2173
+ ),
2174
+ );
2175
+
2176
+ $response = array( 'data' => $data, 'errors' => $error, 'debug' => '' );
2177
+
2178
+ die(wp_json_encode( $response, JSON_FORCE_OBJECT ));
2179
+
2180
+ }
2181
+
2182
  /**
2183
  * Changes email notification for succes subscription for Ninja Forms
2184
  *
js/apbct-public.min.js CHANGED
@@ -1,2 +1,2 @@
1
- var ct_date=new Date,ctTimeMs=(new Date).getTime(),ctMouseEventTimerFlag=!0,ctMouseData=[],ctMouseDataCounter=0;function ctSetCookieSec(e,t){document.cookie=e+"="+encodeURIComponent(t)+"; path=/"}function apbct_attach_event_handler(e,t,n){"function"==typeof window.addEventListener?e.addEventListener(t,n):e.attachEvent(t,n)}function apbct_remove_event_handler(e,t,n){"function"==typeof window.removeEventListener?e.removeEventListener(t,n):e.detachEvent(t,n)}ctSetCookieSec("ct_ps_timestamp",Math.floor((new Date).getTime()/1e3)),ctSetCookieSec("ct_fkp_timestamp","0"),ctSetCookieSec("ct_pointer_data","0"),ctSetCookieSec("ct_timezone","0"),setTimeout(function(){ctSetCookieSec("ct_timezone",ct_date.getTimezoneOffset()/60*-1)},1e3);var ctFunctionFirstKey=function(e){ctSetCookieSec("ct_fkp_timestamp",Math.floor((new Date).getTime()/1e3)),ctKeyStopStopListening()},ctMouseReadInterval=setInterval(function(){ctMouseEventTimerFlag=!0},150),ctMouseWriteDataInterval=setInterval(function(){ctSetCookieSec("ct_pointer_data",JSON.stringify(ctMouseData))},1200),ctFunctionMouseMove=function(e){!0===ctMouseEventTimerFlag&&(ctMouseData.push([Math.round(e.clientY),Math.round(e.clientX),Math.round((new Date).getTime()-ctTimeMs)]),ctMouseEventTimerFlag=!1,50<=++ctMouseDataCounter&&ctMouseStopData())};function ctMouseStopData(){apbct_remove_event_handler(window,"mousemove",ctFunctionMouseMove),clearInterval(ctMouseReadInterval),clearInterval(ctMouseWriteDataInterval)}function ctKeyStopStopListening(){apbct_remove_event_handler(window,"mousedown",ctFunctionFirstKey),apbct_remove_event_handler(window,"keydown",ctFunctionFirstKey)}function apbct_ready(){ctSetCookieSec("apbct_visible_fields",0),ctSetCookieSec("apbct_visible_fields_count",0),setTimeout(function(){for(var e=0;e<document.forms.length;e++){var t=document.forms[e];t.onsubmit_prev=t.onsubmit,t.onsubmit=function(e){var t=[];for(var n in this.elements)isNaN(+n)||(t[n]=this.elements[n]);var o=(t=t.filter(function(o){return"none"!==getComputedStyle(o).display&&"hidden"!==getComputedStyle(o).visibility&&"0"!==getComputedStyle(o).opacity&&"hidden"!==o.getAttribute("type")&&"submit"!==o.getAttribute("type")&&""!==o.value&&("radio"===o.getAttribute("type")&&t.forEach(function(e,t,n){o.getAttribute("name")!==e.getAttribute("name")||!1}),!0)})).length,c="";t.forEach(function(e,t,n){c+=" "+e.getAttribute("name")}),ctSetCookieSec("apbct_visible_fields",c=c.trim()),ctSetCookieSec("apbct_visible_fields_count",o),e.target.onsubmit_prev instanceof Function&&setTimeout(function(){e.target.onsubmit_prev.call(e.target,e)},500)}}},1e3)}function apbct_js_keys__set_input_value(e,t,n,o){if(null!==document.getElementById(n.input_name)){var c=document.getElementById(n.input_name).value;document.getElementById(n.input_name).value=document.getElementById(n.input_name).value.replace(c,e.js_key)}}function apbct_sendAJAXRequest(o,t,n){var c=t.callback||null,a=t.notJson||null,e=t.timeout||15e3;n=n||null;o._ajax_nonce=ctPublic._ajax_nonce,jQuery.ajax({type:"POST",url:ctPublic._ajax_url,data:o,success:function(e){a||(e=JSON.parse(e)),e.error||c&&c(e,o,t,n)},error:function(e,t,n){console.log("APBCT_AJAX_ERROR"),console.log(o),console.log(e),console.log(t),console.log(n)},timeout:e})}apbct_attach_event_handler(window,"mousemove",ctFunctionMouseMove),apbct_attach_event_handler(window,"mousedown",ctFunctionFirstKey),apbct_attach_event_handler(window,"keydown",ctFunctionFirstKey),apbct_attach_event_handler(window,"DOMContentLoaded",apbct_ready),jQuery(document).ajaxComplete(function(e,t,n){var o;t.responseText&&-1!==t.responseText.indexOf('"apbct')&&void 0!==(o=JSON.parse(t.responseText)).apbct&&(o=o.apbct).blocked&&alert(o.comment)});
2
  //# sourceMappingURL=apbct-public.min.js.map
1
+ function apbct_js_keys__set_input_value(e,t,n,o){if(null!==document.getElementById(n.input_name)){var i=document.getElementById(n.input_name).value;document.getElementById(n.input_name).value=document.getElementById(n.input_name).value.replace(i,e.js_key)}}function apbct_sendAJAXRequest(o,t,n){var i=t.callback||null,a=t.notJson||null,e=t.timeout||15e3;n=n||null;o._ajax_nonce=ctPublic._ajax_nonce,jQuery.ajax({type:"POST",url:ctPublic._ajax_url,data:o,success:function(e){a||(e=JSON.parse(e)),e.error||i&&i(e,o,t,n)},error:function(e,t,n){console.log("APBCT_AJAX_ERROR"),console.log(o),console.log(e),console.log(t),console.log(n)},timeout:e})}!function(){var e=new Date,t=(new Date).getTime(),n=!0,o=[],i=0;function a(e,t){document.cookie=e+"="+encodeURIComponent(t)+"; path=/"}function c(e,t,n){"function"==typeof window.addEventListener?e.addEventListener(t,n):e.attachEvent(t,n)}function r(e,t,n){"function"==typeof window.removeEventListener?e.removeEventListener(t,n):e.detachEvent(t,n)}a("ct_ps_timestamp",Math.floor((new Date).getTime()/1e3)),a("ct_fkp_timestamp","0"),a("ct_pointer_data","0"),a("ct_timezone","0"),setTimeout(function(){a("ct_timezone",e.getTimezoneOffset()/60*-1)},1e3);var u=function(e){a("ct_fkp_timestamp",Math.floor((new Date).getTime()/1e3)),r(window,"mousedown",u),r(window,"keydown",u)},l=setInterval(function(){n=!0},150),m=setInterval(function(){a("ct_pointer_data",JSON.stringify(o))},1200),s=function(e){!0===n&&(o.push([Math.round(e.clientY),Math.round(e.clientX),Math.round((new Date).getTime()-t)]),n=!1,50<=++i&&(r(window,"mousemove",s),clearInterval(l),clearInterval(m)))};c(window,"mousemove",s),c(window,"mousedown",u),c(window,"keydown",u);var d,p,v,f,_,g,w=!0,b={orientation:{alpha:{},beta:{},gamma:{}},motion:{x:{},y:{},z:{}}};var y=setInterval(function(){var e=+new Date;b.orientation.alpha[e]=d,b.orientation.beta[e]=p,b.orientation.gamma[e]=v,b.motion.x[e]=f,b.motion.y[e]=_,b.motion.z[e]=g,a("abpct_hyro_acc_collect",JSON.stringify(b))},1e3);setTimeout(function(){clearInterval(y)},1e4),window.DeviceOrientationEvent&&c(window,"deviceorientation",function(e){var t,n,o,i=0,a=0,c=0;if(w)return i=e.alpha,a=e.beta,c=e.gamma,void(w=!1);t=e.alpha-i,n=e.beta-a,o=e.gamma-c,d=parseInt(t,10),p=parseInt(n,10),v=parseInt(o,10)}),window.DeviceMotionEvent&&c(window,"devicemotion",function(e){f=parseInt(e.accelerationIncludingGravity.x,10),_=parseInt(e.accelerationIncludingGravity.y,10),g=parseInt(e.accelerationIncludingGravity.z,10)}),c(window,"DOMContentLoaded",function(){a("apbct_visible_fields",0),a("apbct_visible_fields_count",0),setTimeout(function(){for(var e=0;e<document.forms.length;e++){var t=document.forms[e];t.onsubmit_prev=t.onsubmit,t.onsubmit=function(e){var t=[];for(var n in this.elements)isNaN(+n)||(t[n]=this.elements[n]);var o=(t=t.filter(function(o){return"none"!==getComputedStyle(o).display&&"hidden"!==getComputedStyle(o).visibility&&"0"!==getComputedStyle(o).opacity&&"hidden"!==o.getAttribute("type")&&"submit"!==o.getAttribute("type")&&""!==o.value&&("radio"===o.getAttribute("type")&&t.forEach(function(e,t,n){o.getAttribute("name")!==e.getAttribute("name")||!1}),!0)})).length,i="";t.forEach(function(e,t,n){i+=" "+e.getAttribute("name")}),a("apbct_visible_fields",i=i.trim()),a("apbct_visible_fields_count",o),e.target.onsubmit_prev instanceof Function&&setTimeout(function(){e.target.onsubmit_prev.call(e.target,e)},500)}}},1e3)})}(),jQuery(document).ajaxComplete(function(e,t,n){var o;t.responseText&&-1!==t.responseText.indexOf('"apbct')&&void 0!==(o=JSON.parse(t.responseText)).apbct&&(o=o.apbct).blocked&&alert(o.comment)});
2
  //# sourceMappingURL=apbct-public.min.js.map
js/apbct-public.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["apbct-public.js"],"names":["ct_date","Date","ctTimeMs","getTime","ctMouseEventTimerFlag","ctMouseData","ctMouseDataCounter","ctSetCookieSec","c_name","value","document","cookie","encodeURIComponent","apbct_attach_event_handler","elem","event","callback","window","addEventListener","attachEvent","apbct_remove_event_handler","removeEventListener","detachEvent","Math","floor","setTimeout","getTimezoneOffset","ctFunctionFirstKey","ctKeyStopStopListening","ctMouseReadInterval","setInterval","ctMouseWriteDataInterval","JSON","stringify","ctFunctionMouseMove","push","round","clientY","clientX","ctMouseStopData","clearInterval","apbct_ready","i","forms","length","form","onsubmit_prev","onsubmit","elements","key","this","isNaN","visible_fields_count","filter","getComputedStyle","display","visibility","opacity","getAttribute","forEach","el","j","els","visible_fields","trim","target","Function","call","apbct_js_keys__set_input_value","result","data","params","obj","getElementById","input_name","ct_input_value","replace","js_key","apbct_sendAJAXRequest","notJson","timeout","_ajax_nonce","ctPublic","jQuery","ajax","type","url","_ajax_url","success","parse","error","jqXHR","textStatus","errorThrown","console","log","ajaxComplete","xhr","settings","response","responseText","indexOf","apbct","blocked","alert","comment"],"mappings":"AAAA,IAAIA,QAAU,IAAIC,KACjBC,UAAW,IAAID,MAAOE,UACtBC,uBAAwB,EACxBC,YAAc,GACdC,mBAAqB,EAEtB,SAASC,eAAeC,EAAQC,GAC/BC,SAASC,OAASH,EAAS,IAAMI,mBAAmBH,GAAS,WAG9D,SAASI,2BAA2BC,EAAMC,EAAOC,GACV,mBAA5BC,OAAOC,iBAAiCJ,EAAKI,iBAAiBH,EAAOC,GAC7BF,EAAKK,YAAYJ,EAAOC,GAG3E,SAASI,2BAA2BN,EAAMC,EAAOC,GACP,mBAA/BC,OAAOI,oBAAoCP,EAAKO,oBAAoBN,EAAOC,GAChCF,EAAKQ,YAAYP,EAAOC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I,oBACZD,QAAQC,IAAIzB,GACZwB,QAAQC,IAAIJ,GACZG,QAAQC,IAAIH,GACZE,QAAQC,IAAIF,IAEbb,QAASA,IA9HXnE,2BAA2BI,OAAQ,YAAaiB,qBAChDrB,2BAA2BI,OAAQ,YAAaU,oBAChDd,2BAA2BI,OAAQ,UAAWU,oBAwE9Cd,2BAA2BI,OAAQ,mBAAoBwB,aAGvD0C,OAAOzE,UAAUsF,aAAa,SAASjF,EAAOkF,EAAKC,GAEjD,IAEKC,EAHHF,EAAIG,eAAwD,IAAxCH,EAAIG,aAAaC,QAAQ,gBAElB,KADzBF,EAAWnE,KAAKyD,MAAMQ,EAAIG,eACXE,QACdH,EAAWA,EAASG,OACZC,SACXC,MAAML,EAASM","file":"apbct-public.min.js","sourcesContent":["var ct_date = new Date(), \r\n\tctTimeMs = new Date().getTime(),\r\n\tctMouseEventTimerFlag = true, //Reading interval flag\r\n\tctMouseData = [],\r\n\tctMouseDataCounter = 0;\r\n\r\nfunction ctSetCookieSec(c_name, value) {\r\n\tdocument.cookie = c_name + \"=\" + encodeURIComponent(value) + \"; path=/\";\r\n}\r\n\r\nfunction apbct_attach_event_handler(elem, event, callback){\r\n\tif(typeof window.addEventListener === \"function\") elem.addEventListener(event, callback);\r\n\telse elem.attachEvent(event, callback);\r\n}\r\n\r\nfunction apbct_remove_event_handler(elem, event, callback){\r\n\tif(typeof window.removeEventListener === \"function\") elem.removeEventListener(event, callback);\r\n\telse elem.detachEvent(event, callback);\r\n}\r\n\r\nctSetCookieSec(\"ct_ps_timestamp\", Math.floor(new Date().getTime()/1000));\r\nctSetCookieSec(\"ct_fkp_timestamp\", \"0\");\r\nctSetCookieSec(\"ct_pointer_data\", \"0\");\r\nctSetCookieSec(\"ct_timezone\", \"0\");\r\n\r\nsetTimeout(function(){\r\n\tctSetCookieSec(\"ct_timezone\", ct_date.getTimezoneOffset()/60*(-1));\r\n},1000);\r\n\r\n//Writing first key press timestamp\r\nvar ctFunctionFirstKey = function output(event){\r\n\tvar KeyTimestamp = Math.floor(new Date().getTime()/1000);\r\n\tctSetCookieSec(\"ct_fkp_timestamp\", KeyTimestamp);\r\n\tctKeyStopStopListening();\r\n};\r\n\r\n//Reading interval\r\nvar ctMouseReadInterval = setInterval(function(){\r\n\tctMouseEventTimerFlag = true;\r\n}, 150);\r\n\t\r\n//Writting interval\r\nvar ctMouseWriteDataInterval = setInterval(function(){\r\n\tctSetCookieSec(\"ct_pointer_data\", JSON.stringify(ctMouseData));\r\n}, 1200);\r\n\r\n//Logging mouse position each 150 ms\r\nvar ctFunctionMouseMove = function output(event){\r\n\tif(ctMouseEventTimerFlag === true){\r\n\t\t\r\n\t\tctMouseData.push([\r\n\t\t\tMath.round(event.clientY),\r\n\t\t\tMath.round(event.clientX),\r\n\t\t\tMath.round(new Date().getTime() - ctTimeMs)\r\n\t\t]);\r\n\t\t\r\n\t\tctMouseDataCounter++;\r\n\t\tctMouseEventTimerFlag = false;\r\n\t\tif(ctMouseDataCounter >= 50){\r\n\t\t\tctMouseStopData();\r\n\t\t}\r\n\t}\r\n};\r\n\r\n//Stop mouse observing function\r\nfunction ctMouseStopData(){\r\n\tapbct_remove_event_handler(window, \"mousemove\", ctFunctionMouseMove);\r\n\tclearInterval(ctMouseReadInterval);\r\n\tclearInterval(ctMouseWriteDataInterval);\t\t\t\t\r\n}\r\n\r\n//Stop key listening function\r\nfunction ctKeyStopStopListening(){\r\n\tapbct_remove_event_handler(window, \"mousedown\", ctFunctionFirstKey);\r\n\tapbct_remove_event_handler(window, \"keydown\", ctFunctionFirstKey);\r\n}\r\n\r\napbct_attach_event_handler(window, \"mousemove\", ctFunctionMouseMove);\r\napbct_attach_event_handler(window, \"mousedown\", ctFunctionFirstKey);\r\napbct_attach_event_handler(window, \"keydown\", ctFunctionFirstKey);\r\n\r\n// Ready function\r\nfunction apbct_ready(){\r\n\tctSetCookieSec(\"apbct_visible_fields\", 0);\r\n\tctSetCookieSec(\"apbct_visible_fields_count\", 0);\r\n\tsetTimeout(function(){\r\n\t\tfor(var i = 0; i < document.forms.length; i++){\r\n\t\t\tvar form = document.forms[i];\r\n\r\n\t\t\tform.onsubmit_prev = form.onsubmit;\r\n\t\t\tform.onsubmit = function(event){\r\n\t\t\t\t\r\n\t\t\t\t// Get only fields\r\n\t\t\t\tvar elements = [];\r\n\t\t\t\tfor(var key in this.elements){\r\n\t\t\t\t\tif(!isNaN(+key))\r\n\t\t\t\t\t\telements[key] = this.elements[key];\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t// Filter fields\r\n\t\t\t\telements = elements.filter(function(elem){\r\n\t\t\t\t\t\r\n\t\t\t\t\tvar pass = true;\r\n\t\t\t\t\t\r\n\t\t\t\t\t// Filter fields\r\n\t\t\t\t\tif( getComputedStyle(elem).display === \"none\" || // hidden\r\n\t\t\t\t\t\tgetComputedStyle(elem).visibility === \"hidden\" || // hidden\r\n\t\t\t\t\t\tgetComputedStyle(elem).opacity === \"0\" || // hidden\r\n\t\t\t\t\t\telem.getAttribute(\"type\") === \"hidden\" || // type == hidden\r\n\t\t\t\t\t\telem.getAttribute(\"type\") === \"submit\" || // type == submit\r\n\t\t\t\t\t\telem.value === \"\" // empty value\r\n\t\t\t\t\t){\r\n\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t// Filter elements with same names for type == radio\r\n\t\t\t\t\tif(elem.getAttribute(\"type\") === \"radio\"){\r\n\t\t\t\t\t\telements.forEach(function(el, j, els){\r\n\t\t\t\t\t\t\tif(elem.getAttribute('name') === el.getAttribute('name')){\r\n\t\t\t\t\t\t\t\tpass = false;\r\n\t\t\t\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t});\r\n\t\t\t\t\r\n\t\t\t\t// Visible fields count\r\n\t\t\t\tvar visible_fields_count = elements.length;\r\n\t\t\t\t\r\n\t\t\t\t// Visible fields\r\n\t\t\t\tvar visible_fields = '';\r\n\t\t\t\telements.forEach(function(elem, i, elements){\r\n\t\t\t\t\tvisible_fields += \" \" + elem.getAttribute(\"name\");\r\n\t\t\t\t});\r\n\t\t\t\tvisible_fields = visible_fields.trim();\r\n\t\t\t\t\r\n\t\t\t\tctSetCookieSec(\"apbct_visible_fields\", visible_fields);\r\n\t\t\t\tctSetCookieSec(\"apbct_visible_fields_count\", visible_fields_count);\r\n\t\t\t\t\r\n\t\t\t\t// Call previous submit action\r\n\t\t\t\tif(event.target.onsubmit_prev instanceof Function){\r\n\t\t\t\t\tsetTimeout(function(){\r\n\t\t\t\t\t\tevent.target.onsubmit_prev.call(event.target, event);\r\n\t\t\t\t\t}, 500);\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t}\r\n\t}, 1000);\r\n}\r\napbct_attach_event_handler(window, \"DOMContentLoaded\", apbct_ready);\r\n\r\n// Capturing responses and output block message for unknown AJAX forms\r\njQuery(document).ajaxComplete(function(event, xhr, settings) {\r\n\tif(xhr.responseText && xhr.responseText.indexOf('\"apbct') !== -1){\r\n\t\tvar response = JSON.parse(xhr.responseText);\r\n\t\tif(typeof response.apbct !== 'undefined'){\r\n\t\t\tvar response = response.apbct;\r\n\t\t\tif(response.blocked){\r\n\t\t\t\talert(response.comment);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n});\r\n\r\nfunction apbct_js_keys__set_input_value(result, data, params, obj){\r\n\tif (document.getElementById(params.input_name) !== null) {\r\n\t\tvar ct_input_value = document.getElementById(params.input_name).value;\r\n\t\tdocument.getElementById(params.input_name).value = document.getElementById(params.input_name).value.replace(ct_input_value, result.js_key);\r\n\t}\r\n}\r\n\r\nfunction apbct_sendAJAXRequest(data, params, obj){\r\n\t\r\n\t// Default params\r\n\tvar callback = params.callback || null;\r\n\tvar notJson = params.notJson || null;\r\n\tvar timeout = params.timeout || 15000;\r\n\tvar obj = obj || null;\r\n\t\r\n\tdata._ajax_nonce = ctPublic._ajax_nonce;\r\n\t\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ctPublic._ajax_url,\r\n\t\tdata: data,\r\n\t\tsuccess: function(result){\r\n\t\t\tif(!notJson) result = JSON.parse(result);\r\n\t\t\tif(result.error){\r\n\t\t\t\t\r\n\t\t\t}else{\r\n\t\t\t\tif(callback)\r\n\t\t\t\t\tcallback(result, data, params, obj);\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: function(jqXHR, textStatus, errorThrown){\r\n\t\t\tconsole.log('APBCT_AJAX_ERROR');\r\n\t\t\tconsole.log(data);\r\n\t\t\tconsole.log(jqXHR);\r\n\t\t\tconsole.log(textStatus);\r\n\t\t\tconsole.log(errorThrown);\r\n\t\t},\r\n\t\ttimeout: timeout\r\n\t});\r\n}\r\n\r\n//(function(open) {\r\n// XMLHttpRequest.prototype.open = function(method, url, async, user, pass) {\r\n// this.addEventListener(\"readystatechange\", function() {\r\n// }, false);\r\n// open.call(this, method, url, async, user, pass);\r\n// };\r\n//})(XMLHttpRequest.prototype.open);"]}
1
+ {"version":3,"sources":["apbct-public.js"],"names":["apbct_js_keys__set_input_value","result","data","params","obj","document","getElementById","input_name","ct_input_value","value","replace","js_key","apbct_sendAJAXRequest","callback","notJson","timeout","_ajax_nonce","ctPublic","jQuery","ajax","type","url","_ajax_url","success","JSON","parse","error","jqXHR","textStatus","errorThrown","console","log","ct_date","Date","ctTimeMs","getTime","ctMouseEventTimerFlag","ctMouseData","ctMouseDataCounter","ctSetCookieSec","c_name","cookie","encodeURIComponent","apbct_attach_event_handler","elem","event","window","addEventListener","attachEvent","apbct_remove_event_handler","removeEventListener","detachEvent","Math","floor","setTimeout","getTimezoneOffset","ctFunctionFirstKey","ctMouseReadInterval","setInterval","ctMouseWriteDataInterval","stringify","ctFunctionMouseMove","push","round","clientY","clientX","clearInterval","globalAlpha","globalBeta","globalGamma","globalAccX","globalAccY","globalAccZ","isFirstTimeHyro","output","orientation","alpha","beta","gamma","motion","x","y","z","collect","timestamp","DeviceOrientationEvent","alphaOffset","betaOffset","gammaOffset","parseInt","DeviceMotionEvent","accelerationIncludingGravity","i","forms","length","form","onsubmit_prev","onsubmit","elements","key","this","isNaN","visible_fields_count","filter","getComputedStyle","display","visibility","opacity","getAttribute","forEach","el","j","els","visible_fields","trim","target","Function","call","ajaxComplete","xhr","settings","response","responseText","indexOf","apbct","blocked","alert","comment"],"mappings":"AA2PA,SAASA,+BAA+BC,EAAQC,EAAMC,EAAQC,GAC7D,GAAmD,OAA/CC,SAASC,eAAeH,EAAOI,YAAsB,CACxD,IAAIC,EAAiBH,SAASC,eAAeH,EAAOI,YAAYE,MAChEJ,SAASC,eAAeH,EAAOI,YAAYE,MAAQJ,SAASC,eAAeH,EAAOI,YAAYE,MAAMC,QAAQF,EAAgBP,EAAOU,SAIrI,SAASC,sBAAsBV,EAAMC,EAAQC,GAG5C,IAAIS,EAAcV,EAAOU,UAAe,KACpCC,EAAcX,EAAOW,SAAe,KACpCC,EAAcZ,EAAOY,SAAe,KACpCX,EAAcA,GAAsB,KAExCF,EAAKc,YAAcC,SAASD,YAE5BE,OAAOC,KAAK,CACXC,KAAM,OACNC,IAAKJ,SAASK,UACdpB,KAAMA,EACNqB,QAAS,SAAStB,GACba,IAASb,EAASuB,KAAKC,MAAMxB,IAC9BA,EAAOyB,OAGNb,GACFA,EAASZ,EAAQC,EAAMC,EAAQC,IAGlCsB,MAAO,SAASC,EAAOC,EAAYC,GAClCC,QAAQC,IAAI,oBACZD,QAAQC,IAAI7B,GACZ4B,QAAQC,IAAIJ,GACZG,QAAQC,IAAIH,GACZE,QAAQC,IAAIF,IAEbd,QAASA,KAhSV,WAEA,IAAIiB,EAAU,IAAIC,KACjBC,GAAW,IAAID,MAAOE,UACtBC,GAAwB,EACxBC,EAAc,GACdC,EAAqB,EAEtB,SAASC,EAAeC,EAAQ/B,GAC/BJ,SAASoC,OAASD,EAAS,IAAME,mBAAmBjC,GAAS,WAG9D,SAASk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AIqD,EAAW,GACf,IAAI,IAAIC,KAAOC,KAAKF,SACfG,OAAOF,KACVD,EAASC,GAAOC,KAAKF,SAASC,IAiChC,IAAIG,GA7BJJ,EAAWA,EAASK,OAAO,SAAS3D,GAKnC,MAA0C,SAAtC4D,iBAAiB5D,GAAM6D,SACY,WAAtCD,iBAAiB5D,GAAM8D,YACe,MAAtCF,iBAAiB5D,GAAM+D,SACe,WAAtC/D,EAAKgE,aAAa,SACoB,WAAtChE,EAAKgE,aAAa,SACoB,KAAtChE,EAAKnC,QAM2B,UAA9BmC,EAAKgE,aAAa,SACpBV,EAASW,QAAQ,SAASC,EAAIC,EAAGC,GAC7BpE,EAAKgE,aAAa,UAAYE,EAAGF,aAAa,UACzC,KAMH,MAI4Bd,OAGhCmB,EAAiB,GACrBf,EAASW,QAAQ,SAASjE,EAAMgD,EAAGM,GAClCe,GAAkB,IAAMrE,EAAKgE,aAAa,UAI3CrE,EAAe,uBAFf0E,EAAiBA,EAAeC,QAGhC3E,EAAe,6BAA8B+D,GAG1CzD,EAAMsE,OAAOnB,yBAAyBoB,UACxC9D,WAAW,WACVT,EAAMsE,OAAOnB,cAAcqB,KAAKxE,EAAMsE,OAAQtE,IAC5C,QAIJ,OAhOL,GA+OA3B,OAAOb,UAAUiH,aAAa,SAASzE,EAAO0E,EAAKC,GAEjD,IAEKC,EAHHF,EAAIG,eAAwD,IAAxCH,EAAIG,aAAaC,QAAQ,gBAElB,KADzBF,EAAWjG,KAAKC,MAAM8F,EAAIG,eACXE,QACdH,EAAWA,EAASG,OACZC,SACXC,MAAML,EAASM","file":"apbct-public.min.js","sourcesContent":["(function() {\r\n\r\n\tvar ct_date = new Date(),\r\n\t\tctTimeMs = new Date().getTime(),\r\n\t\tctMouseEventTimerFlag = true, //Reading interval flag\r\n\t\tctMouseData = [],\r\n\t\tctMouseDataCounter = 0;\r\n\r\n\tfunction ctSetCookieSec(c_name, value) {\r\n\t\tdocument.cookie = c_name + \"=\" + encodeURIComponent(value) + \"; path=/\";\r\n\t}\r\n\r\n\tfunction apbct_attach_event_handler(elem, event, callback){\r\n\t\tif(typeof window.addEventListener === \"function\") elem.addEventListener(event, callback);\r\n\t\telse elem.attachEvent(event, callback);\r\n\t}\r\n\r\n\tfunction apbct_remove_event_handler(elem, event, callback){\r\n\t\tif(typeof window.removeEventListener === \"function\") elem.removeEventListener(event, callback);\r\n\t\telse elem.detachEvent(event, callback);\r\n\t}\r\n\r\n\tctSetCookieSec(\"ct_ps_timestamp\", Math.floor(new Date().getTime()/1000));\r\n\tctSetCookieSec(\"ct_fkp_timestamp\", \"0\");\r\n\tctSetCookieSec(\"ct_pointer_data\", \"0\");\r\n\tctSetCookieSec(\"ct_timezone\", \"0\");\r\n\r\n\tsetTimeout(function(){\r\n\t\tctSetCookieSec(\"ct_timezone\", ct_date.getTimezoneOffset()/60*(-1));\r\n\t},1000);\r\n\r\n\t//Writing first key press timestamp\r\n\tvar ctFunctionFirstKey = function output(event){\r\n\t\tvar KeyTimestamp = Math.floor(new Date().getTime()/1000);\r\n\t\tctSetCookieSec(\"ct_fkp_timestamp\", KeyTimestamp);\r\n\t\tctKeyStopStopListening();\r\n\t};\r\n\r\n\t//Reading interval\r\n\tvar ctMouseReadInterval = setInterval(function(){\r\n\t\tctMouseEventTimerFlag = true;\r\n\t}, 150);\r\n\r\n\t//Writting interval\r\n\tvar ctMouseWriteDataInterval = setInterval(function(){\r\n\t\tctSetCookieSec(\"ct_pointer_data\", JSON.stringify(ctMouseData));\r\n\t}, 1200);\r\n\r\n\t//Logging mouse position each 150 ms\r\n\tvar ctFunctionMouseMove = function output(event){\r\n\t\tif(ctMouseEventTimerFlag === true){\r\n\r\n\t\t\tctMouseData.push([\r\n\t\t\t\tMath.round(event.clientY),\r\n\t\t\t\tMath.round(event.clientX),\r\n\t\t\t\tMath.round(new Date().getTime() - ctTimeMs)\r\n\t\t\t]);\r\n\r\n\t\t\tctMouseDataCounter++;\r\n\t\t\tctMouseEventTimerFlag = false;\r\n\t\t\tif(ctMouseDataCounter >= 50){\r\n\t\t\t\tctMouseStopData();\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\t//Stop mouse observing function\r\n\tfunction ctMouseStopData(){\r\n\t\tapbct_remove_event_handler(window, \"mousemove\", ctFunctionMouseMove);\r\n\t\tclearInterval(ctMouseReadInterval);\r\n\t\tclearInterval(ctMouseWriteDataInterval);\r\n\t}\r\n\r\n\t//Stop key listening function\r\n\tfunction ctKeyStopStopListening(){\r\n\t\tapbct_remove_event_handler(window, \"mousedown\", ctFunctionFirstKey);\r\n\t\tapbct_remove_event_handler(window, \"keydown\", ctFunctionFirstKey);\r\n\t}\r\n\r\n\tapbct_attach_event_handler(window, \"mousemove\", ctFunctionMouseMove);\r\n\tapbct_attach_event_handler(window, \"mousedown\", ctFunctionFirstKey);\r\n\tapbct_attach_event_handler(window, \"keydown\", ctFunctionFirstKey);\r\n\r\n\t// Hyroscope && Accelerometer data\r\n\r\n var isFirstTimeHyro = true;\r\n\r\n var output = {\r\n 'orientation' : {\r\n 'alpha' : {},\r\n 'beta' : {},\r\n 'gamma' : {}\r\n },\r\n 'motion' : {\r\n 'x' : {},\r\n 'y' : {},\r\n 'z' : {}\r\n }\r\n };\r\n\r\n var globalAlpha, globalBeta, globalGamma, globalAccX, globalAccY, globalAccZ;\r\n\r\n function handleOrientation(event) {\r\n\r\n var alphaOffset = 0;\r\n var betaOffset = 0;\r\n var gammaOffset = 0;\r\n var alpha = 0;\r\n var beta = 0;\r\n var gamma = 0;\r\n if(isFirstTimeHyro){\r\n alphaOffset = event.alpha;\r\n betaOffset = event.beta;\r\n gammaOffset = event.gamma;\r\n isFirstTimeHyro = false;\r\n return;\r\n }\r\n\r\n alpha = event.alpha - alphaOffset;\r\n beta = event.beta - betaOffset;\r\n gamma = event.gamma - gammaOffset;\r\n globalAlpha = parseInt( alpha, 10 );\r\n globalBeta = parseInt( beta, 10 );\r\n globalGamma = parseInt( gamma, 10 );\r\n\r\n }\r\n\r\n function handleMotion(event) {\r\n\r\n globalAccX = parseInt( event.accelerationIncludingGravity.x, 10 );\r\n globalAccY = parseInt( event.accelerationIncludingGravity.y, 10 );\r\n globalAccZ = parseInt( event.accelerationIncludingGravity.z, 10 );\r\n\r\n }\r\n\r\n var collect = setInterval( function(){\r\n var timestamp = ( + new Date() );\r\n output.orientation.alpha[timestamp] = globalAlpha;\r\n output.orientation.beta[timestamp] = globalBeta;\r\n output.orientation.gamma[timestamp] = globalGamma;\r\n output.motion.x[timestamp] = globalAccX;\r\n output.motion.y[timestamp] = globalAccY;\r\n output.motion.z[timestamp] = globalAccZ;\r\n ctSetCookieSec(\"abpct_hyro_acc_collect\", JSON.stringify(output))\r\n }, 1000 );\r\n setTimeout( function(){\r\n clearInterval( collect );\r\n }, 10000 );\r\n\r\n if (window.DeviceOrientationEvent) {\r\n apbct_attach_event_handler(window, \"deviceorientation\", handleOrientation);\r\n }\r\n if (window.DeviceMotionEvent) {\r\n apbct_attach_event_handler(window, \"devicemotion\", handleMotion);\r\n }\r\n\r\n\t// Ready function\r\n\tfunction apbct_ready(){\r\n\t\tctSetCookieSec(\"apbct_visible_fields\", 0);\r\n\t\tctSetCookieSec(\"apbct_visible_fields_count\", 0);\r\n\t\tsetTimeout(function(){\r\n\t\t\tfor(var i = 0; i < document.forms.length; i++){\r\n\t\t\t\tvar form = document.forms[i];\r\n\r\n\t\t\t\tform.onsubmit_prev = form.onsubmit;\r\n\t\t\t\tform.onsubmit = function(event){\r\n\r\n\t\t\t\t\t// Get only fields\r\n\t\t\t\t\tvar elements = [];\r\n\t\t\t\t\tfor(var key in this.elements){\r\n\t\t\t\t\t\tif(!isNaN(+key))\r\n\t\t\t\t\t\t\telements[key] = this.elements[key];\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// Filter fields\r\n\t\t\t\t\telements = elements.filter(function(elem){\r\n\r\n\t\t\t\t\t\tvar pass = true;\r\n\r\n\t\t\t\t\t\t// Filter fields\r\n\t\t\t\t\t\tif( getComputedStyle(elem).display === \"none\" || // hidden\r\n\t\t\t\t\t\t\tgetComputedStyle(elem).visibility === \"hidden\" || // hidden\r\n\t\t\t\t\t\t\tgetComputedStyle(elem).opacity === \"0\" || // hidden\r\n\t\t\t\t\t\t\telem.getAttribute(\"type\") === \"hidden\" || // type == hidden\r\n\t\t\t\t\t\t\telem.getAttribute(\"type\") === \"submit\" || // type == submit\r\n\t\t\t\t\t\t\telem.value === \"\" // empty value\r\n\t\t\t\t\t\t){\r\n\t\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t// Filter elements with same names for type == radio\r\n\t\t\t\t\t\tif(elem.getAttribute(\"type\") === \"radio\"){\r\n\t\t\t\t\t\t\telements.forEach(function(el, j, els){\r\n\t\t\t\t\t\t\t\tif(elem.getAttribute('name') === el.getAttribute('name')){\r\n\t\t\t\t\t\t\t\t\tpass = false;\r\n\t\t\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t});\r\n\r\n\t\t\t\t\t// Visible fields count\r\n\t\t\t\t\tvar visible_fields_count = elements.length;\r\n\r\n\t\t\t\t\t// Visible fields\r\n\t\t\t\t\tvar visible_fields = '';\r\n\t\t\t\t\telements.forEach(function(elem, i, elements){\r\n\t\t\t\t\t\tvisible_fields += \" \" + elem.getAttribute(\"name\");\r\n\t\t\t\t\t});\r\n\t\t\t\t\tvisible_fields = visible_fields.trim();\r\n\r\n\t\t\t\t\tctSetCookieSec(\"apbct_visible_fields\", visible_fields);\r\n\t\t\t\t\tctSetCookieSec(\"apbct_visible_fields_count\", visible_fields_count);\r\n\r\n\t\t\t\t\t// Call previous submit action\r\n\t\t\t\t\tif(event.target.onsubmit_prev instanceof Function){\r\n\t\t\t\t\t\tsetTimeout(function(){\r\n\t\t\t\t\t\t\tevent.target.onsubmit_prev.call(event.target, event);\r\n\t\t\t\t\t\t}, 500);\r\n\t\t\t\t\t}\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t}, 1000);\r\n\t}\r\n\tapbct_attach_event_handler(window, \"DOMContentLoaded\", apbct_ready);\r\n\r\n\t//(function(open) {\r\n\t// XMLHttpRequest.prototype.open = function(method, url, async, user, pass) {\r\n\t// this.addEventListener(\"readystatechange\", function() {\r\n\t// }, false);\r\n\t// open.call(this, method, url, async, user, pass);\r\n\t// };\r\n\t//})(XMLHttpRequest.prototype.open);\r\n\r\n}());\r\n\r\n// Capturing responses and output block message for unknown AJAX forms\r\njQuery(document).ajaxComplete(function(event, xhr, settings) {\r\n\tif(xhr.responseText && xhr.responseText.indexOf('\"apbct') !== -1){\r\n\t\tvar response = JSON.parse(xhr.responseText);\r\n\t\tif(typeof response.apbct !== 'undefined'){\r\n\t\t\tvar response = response.apbct;\r\n\t\t\tif(response.blocked){\r\n\t\t\t\talert(response.comment);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n});\r\n\r\nfunction apbct_js_keys__set_input_value(result, data, params, obj){\r\n\tif (document.getElementById(params.input_name) !== null) {\r\n\t\tvar ct_input_value = document.getElementById(params.input_name).value;\r\n\t\tdocument.getElementById(params.input_name).value = document.getElementById(params.input_name).value.replace(ct_input_value, result.js_key);\r\n\t}\r\n}\r\n\r\nfunction apbct_sendAJAXRequest(data, params, obj){\r\n\r\n\t// Default params\r\n\tvar callback = params.callback || null;\r\n\tvar notJson = params.notJson || null;\r\n\tvar timeout = params.timeout || 15000;\r\n\tvar obj = obj || null;\r\n\r\n\tdata._ajax_nonce = ctPublic._ajax_nonce;\r\n\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ctPublic._ajax_url,\r\n\t\tdata: data,\r\n\t\tsuccess: function(result){\r\n\t\t\tif(!notJson) result = JSON.parse(result);\r\n\t\t\tif(result.error){\r\n\r\n\t\t\t}else{\r\n\t\t\t\tif(callback)\r\n\t\t\t\t\tcallback(result, data, params, obj);\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: function(jqXHR, textStatus, errorThrown){\r\n\t\t\tconsole.log('APBCT_AJAX_ERROR');\r\n\t\t\tconsole.log(data);\r\n\t\t\tconsole.log(jqXHR);\r\n\t\t\tconsole.log(textStatus);\r\n\t\t\tconsole.log(errorThrown);\r\n\t\t},\r\n\t\ttimeout: timeout\r\n\t});\r\n}"]}
lib/CleantalkAPI_base.php CHANGED
@@ -506,8 +506,11 @@ class CleantalkAPI_base
506
  );
507
  $context = stream_context_create($opts);
508
  $result = @file_get_contents($url, 0, $context);
509
- if($result === false)
510
- $errors .= '_FAILED_TO_USE_FILE_GET_CONTENTS';
 
 
 
511
  }else
512
  $errors .= '_AND_ALLOW_URL_FOPEN_IS_DISABLED';
513
  }
506
  );
507
  $context = stream_context_create($opts);
508
  $result = @file_get_contents($url, 0, $context);
509
+
510
+ $errors = $result === false
511
+ ? $errors . '_FAILED_TO_USE_FILE_GET_CONTENTS'
512
+ : false;
513
+
514
  }else
515
  $errors .= '_AND_ALLOW_URL_FOPEN_IS_DISABLED';
516
  }
lib/CleantalkDB_Wordpress.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
 
3
  /*
4
- * CleanTalk Wordpress Data Base class
5
  * Compatible only with Wordpress.
6
- * Version 1.0
7
  * author Cleantalk team (welcome@cleantalk.org)
8
  * copyright (C) 2014 CleanTalk team (http://cleantalk.org)
9
  * license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
@@ -11,15 +11,35 @@
11
  */
12
 
13
  class CleantalkDB_Wordpress
14
- {
15
-
 
 
16
  public $prefix;
17
- public $result = array();
18
 
 
 
 
19
  private $db;
 
 
 
 
20
  private $query;
 
 
 
 
21
  private $db_result;
22
 
 
 
 
 
 
 
 
 
23
  public function __construct()
24
  {
25
  global $wpdb, $apbct;
@@ -27,25 +47,84 @@ class CleantalkDB_Wordpress
27
  $this->prefix = $apbct->db_prefix;
28
  }
29
 
30
- public function query($query, $straight_query = false)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  {
32
- if($straight_query)
33
- $this->db_result = $this->db->query($query);
34
- else
35
- $this->query = $query;
 
36
 
37
  return $this;
38
  }
39
 
40
- public function fetch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  {
42
- $this->result = $this->db->get_row($this->query, ARRAY_A);
 
 
 
43
  return $this->result;
44
  }
45
 
46
- public function fetch_all()
 
 
 
 
 
 
 
 
 
47
  {
48
- $this->result = $this->db->get_results($this->query, ARRAY_A);
 
 
 
49
  return $this->result;
50
  }
51
- }
1
  <?php
2
 
3
  /*
4
+ * CleanTalk Wordpress Data Base driver
5
  * Compatible only with Wordpress.
6
+ * Version 2.0
7
  * author Cleantalk team (welcome@cleantalk.org)
8
  * copyright (C) 2014 CleanTalk team (http://cleantalk.org)
9
  * license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
11
  */
12
 
13
  class CleantalkDB_Wordpress
14
+ {
15
+ /**
16
+ * @var string tables prefix
17
+ */
18
  public $prefix;
 
19
 
20
+ /**
21
+ * @var wpdb instance of WPDB
22
+ */
23
  private $db;
24
+
25
+ /**
26
+ * @var string Query string
27
+ */
28
  private $query;
29
+
30
+ /**
31
+ * @var Raw DB result
32
+ */
33
  private $db_result;
34
 
35
+ /**
36
+ * @var array Processed result
37
+ */
38
+ public $result = array();
39
+
40
+ /**
41
+ * CleantalkDB_Wordpress constructor.
42
+ */
43
  public function __construct()
44
  {
45
  global $wpdb, $apbct;
47
  $this->prefix = $apbct->db_prefix;
48
  }
49
 
50
+ /**
51
+ * Set $this->query string for next uses
52
+ *
53
+ * @param $query
54
+ * @return $this
55
+ */
56
+ public function set_query($query)
57
+ {
58
+ $this->query = $query;
59
+ return $this;
60
+ }
61
+
62
+ /**
63
+ * @todo finish in two weaks! (09.07.2019)
64
+ * Safely replace place holders
65
+ *
66
+ * @param string $query
67
+ * @param array $vars
68
+ *
69
+ * @return $this
70
+ */
71
+ public function prepare__incomplete__($query, $vars = array())
72
  {
73
+ $query = $query ? $query : $this->query;
74
+ $vars = $vars ? $vars : array();
75
+ array_unshift($vars, $query);
76
+
77
+ $this->query = call_user_func_array('$this->db->prepare', $vars);
78
 
79
  return $this;
80
  }
81
 
82
+ /**
83
+ * Run any raw request
84
+ *
85
+ * @param $query
86
+ *
87
+ * @return bool|int|Raw
88
+ */
89
+ public function execute($query)
90
+ {
91
+ $this->db_result = $this->db->query($query);
92
+ return $this->db_result;
93
+ }
94
+
95
+ /**
96
+ * Fetchs first column from query.
97
+ * May receive raw or prepared query.
98
+ *
99
+ * @param bool $query
100
+ * @param bool $response_type
101
+ *
102
+ * @return array|object|void|null
103
+ */
104
+ public function fetch($query = false, $response_type = false)
105
  {
106
+ $query = $query ? $query : $this->query;
107
+ $response_type = $response_type ? $response_type : ARRAY_A;
108
+
109
+ $this->result = $this->db->get_row($query, $response_type);
110
  return $this->result;
111
  }
112
 
113
+ /**
114
+ * Fetchs all result from query.
115
+ * May receive raw or prepared query.
116
+ *
117
+ * @param bool $query
118
+ * @param bool $response_type
119
+ *
120
+ * @return array|object|null
121
+ */
122
+ public function fetch_all($query = false, $response_type = false)
123
  {
124
+ $query = $query ? $query : $this->query;
125
+ $response_type = $response_type ? $response_type : ARRAY_A;
126
+
127
+ $this->result = $this->db->get_results($query, $response_type);
128
  return $this->result;
129
  }
130
+ }
lib/CleantalkHelper.php CHANGED
@@ -373,6 +373,8 @@ class CleantalkHelper
373
  CURLOPT_SSL_VERIFYPEER => false,
374
  CURLOPT_SSL_VERIFYHOST => 0,
375
  CURLOPT_HTTPHEADER => array('Expect:'), // Fix for large data and old servers http://php.net/manual/ru/function.curl-setopt.php#82418
 
 
376
  ),
377
  $opts
378
  );
@@ -383,6 +385,12 @@ class CleantalkHelper
383
 
384
  switch($preset){
385
 
 
 
 
 
 
 
386
  // Get headers only
387
  case 'get_code':
388
  $opts[CURLOPT_HEADER] = true;
373
  CURLOPT_SSL_VERIFYPEER => false,
374
  CURLOPT_SSL_VERIFYHOST => 0,
375
  CURLOPT_HTTPHEADER => array('Expect:'), // Fix for large data and old servers http://php.net/manual/ru/function.curl-setopt.php#82418
376
+ CURLOPT_FOLLOWLOCATION => true,
377
+ CURLOPT_MAXREDIRS => 5,
378
  ),
379
  $opts
380
  );
385
 
386
  switch($preset){
387
 
388
+ // Do not follow redirects
389
+ case 'dont_follow_redirects':
390
+ $opts[CURLOPT_FOLLOWLOCATION] = false;
391
+ $opts[CURLOPT_MAXREDIRS] = 0;
392
+ break;
393
+
394
  // Get headers only
395
  case 'get_code':
396
  $opts[CURLOPT_HEADER] = true;
lib/CleantalkSFW_Base.php CHANGED
@@ -89,7 +89,7 @@ class CleantalkSFW_Base
89
  FROM ".$this->data_table."
90
  WHERE network = ".sprintf("%u", ip2long($current_ip))." & mask;";
91
 
92
- $this->db->query($query)->fetch();
93
 
94
  if($this->db->result['cnt']){
95
  $this->pass = false;
@@ -140,7 +140,7 @@ class CleantalkSFW_Base
140
  blocked_entries = blocked_entries".strval($blocked).",
141
  entries_timestamp = '".intval($time)."'";
142
 
143
- $this->db->query($query, true);
144
  }
145
 
146
  /*
@@ -152,7 +152,7 @@ class CleantalkSFW_Base
152
 
153
  //Getting logs
154
  $query = "SELECT * FROM ".$this->log_table.";";
155
- $this->db->query($query)->fetch_all();
156
 
157
  if(count($this->db->result)){
158
 
@@ -169,7 +169,7 @@ class CleantalkSFW_Base
169
  //Checking answer and deleting all lines from the table
170
  if(empty($result['error'])){
171
  if($result['rows'] == count($data)){
172
- $this->db->query("DELETE FROM ".$this->log_table.";", true);
173
  return $result;
174
  }
175
  }else{
@@ -230,7 +230,7 @@ class CleantalkSFW_Base
230
 
231
  if(!gzeof($gf)){
232
 
233
- $this->db->query("DELETE FROM ".$this->data_table.";", true);
234
 
235
  for($count_result = 0; !gzeof($gf); ){
236
 
@@ -256,7 +256,7 @@ class CleantalkSFW_Base
256
 
257
  if(!empty($values)){
258
  $query = sprintf($query, implode(',', $values).';');
259
- $this->db->query($query, true);
260
  }
261
 
262
  }
89
  FROM ".$this->data_table."
90
  WHERE network = ".sprintf("%u", ip2long($current_ip))." & mask;";
91
 
92
+ $this->db->set_query($query)->fetch();
93
 
94
  if($this->db->result['cnt']){
95
  $this->pass = false;
140
  blocked_entries = blocked_entries".strval($blocked).",
141
  entries_timestamp = '".intval($time)."'";
142
 
143
+ $this->db->execute($query);
144
  }
145
 
146
  /*
152
 
153
  //Getting logs
154
  $query = "SELECT * FROM ".$this->log_table.";";
155
+ $this->db->set_query($query)->fetch_all();
156
 
157
  if(count($this->db->result)){
158
 
169
  //Checking answer and deleting all lines from the table
170
  if(empty($result['error'])){
171
  if($result['rows'] == count($data)){
172
+ $this->db->execute("DELETE FROM ".$this->log_table.";");
173
  return $result;
174
  }
175
  }else{
230
 
231
  if(!gzeof($gf)){
232
 
233
+ $this->db->execute("DELETE FROM ".$this->data_table.";");
234
 
235
  for($count_result = 0; !gzeof($gf); ){
236
 
256
 
257
  if(!empty($values)){
258
  $query = sprintf($query, implode(',', $values).';');
259
+ $this->db->execute($query);
260
  }
261
 
262
  }
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.3
6
- Stable tag: 5.121
7
  License: GPLv2
8
 
9
  Spam protection, antispam, all-in-one, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
@@ -575,6 +575,15 @@ If your website has forms that send data to external sources, you can enable opt
575
  10. Website's options.
576
 
577
  == Changelog ==
 
 
 
 
 
 
 
 
 
578
  = 5.121 June 26 2019 =
579
  * Fix: Translation typos.
580
  * Fix: Woocommerce integration.
@@ -1938,6 +1947,15 @@ If your website has forms that send data to external sources, you can enable opt
1938
  * First version
1939
 
1940
  == Upgrade Notice ==
 
 
 
 
 
 
 
 
 
1941
  = 5.121 June 26 2019 =
1942
  * Fix: Translation typos.
1943
  * Fix: Woocommerce integration.
3
  Tags: spam, antispam, protection, comments, firewall
4
  Requires at least: 3.0
5
  Tested up to: 5.3
6
+ Stable tag: 5.122
7
  License: GPLv2
8
 
9
  Spam protection, antispam, all-in-one, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
575
  10. Website's options.
576
 
577
  == Changelog ==
578
+ = 5.122 July 10 2019 =
579
+ * Spam Protection improved.
580
+ * Fix: Error while checking account status.
581
+ * Fix: Conflict with Elementor Pro.
582
+ * Fix: Integration with Ninja Forms.
583
+ * Fix: Integration with Formidable.
584
+ * New: Detecting mobile devices.
585
+ * New: Integration for Easy Forms for Mailchimp.
586
+
587
  = 5.121 June 26 2019 =
588
  * Fix: Translation typos.
589
  * Fix: Woocommerce integration.
1947
  * First version
1948
 
1949
  == Upgrade Notice ==
1950
+ = 5.122 July 10 2019 =
1951
+ * Spam Protection improved.
1952
+ * Fix: Error while checking account status.
1953
+ * Fix: Conflict with Elementor Pro.
1954
+ * Fix: Integration with Ninja Forms.
1955
+ * Fix: Integration with Formidable.
1956
+ * New: Detecting mobile devices.
1957
+ * New: Integration for Easy Forms for Mailchimp.
1958
+
1959
  = 5.121 June 26 2019 =
1960
  * Fix: Translation typos.
1961
  * Fix: Woocommerce integration.