Spam protection, AntiSpam, FireWall by CleanTalk - Version 5.157

Version Description

Apr 28 2021 = * New: Invisible fields collecting implemented. * New: A dev and a fix version suffix support. * New: Variables. Cookie::set() method added. * New: Split Cleantalk\Common\DB::method_private_list_addsfw_wl() in two Cleantalk\Common\DB::methodprivate_list_add() and Cleantalk\ApbctWP\DB::methodprivate_list_addsfw_wl(). * New: Split Cleantalk\ApbctWP\Helper::httprequestrc_to_host() in two Cleantalk\ApbctWP\Helper::httprequestrc_to_host() and Cleantalk\ApbctWP\Helper::httprequestrc_to_hosttest(). * New: Updater script for 5.157. * New: Update/delete SpamFireWall database when it enable/disable. Improvements. * New: \Cleantalk\ApbctWP\Variables::AltSessions class. * New: "Set cookies" setting now has 3 options "On", "Off" and "Use alternative mechanism for cookies". * New: REST API route '/alt_sessions' and callbacks. * Mod: Compatibility with Thrive Leads - remove deleted the modal window about successful sending when blocking the user. * Mod: changed the handling of gravityform fields, added a check for the visibility of the field when processing the name. * Mod: Added a setting for Woocommerce, which includes checking the un-logged user when adding an item to the cart. If the user does not pass the verification, the product is not added to the cart. * Mod: Added a settings for Woocommerce - correction. * Mod: WC add to cart - change settings description. * Mod: Cleantalk\ApbctWP\RemoteCalls::debug() improved. * Mod: SpaFirewall update. * Mod: add buddypress integration for user account personal data. * Mod: Moving \Cleantalk\Common\Helper::apbct_cookieset() to \Cleantalk\ApbctWP\Variables::set() function. * Mod: Using \Cleantalk\ApbctWP\Variables::set() instead of \Cleantalk\Common\Helper::apbct_cookieset(). * Mod: Extend \Cleantalk\ApbctWP\Variables to use alternative sessions. * Mod: Using \Cleantalk\ApbctWP\Variables\AltSessions class instead of set of "apbct_alt_sessions" functions. * Mod: added loading of country flags from the plugin. * Mod: added styles for the widget with anti-spam statistics. * Mod: Improving ct_enqueue_scripts_public(). * Mod: Update for JS ctSetCookie(). * Mod: AltSessions and Cookie using 'dataset_cookies' and 'dataset_cookies' settings. * Mod: Minified JS updated. * Upd: Setting cookies updating. * Upd: Setting cookies by JS updating. * Fix: SFW. DB result handling. * Fix: Integration. Avada theme settings saving fixed. * Fix: Cleantalk modal. Layout fixed. * Fix: Possible use an html on ajax forms blocking message. * Fix: Include JS logic fixed. * Fix: Refactoring. Collecting details about browser refactored. * Fix: Refactoring. Alert replacing by console log on REST request handling. * Fix: Integration. Gravity Forms integration fixed. * Fix: ignoring the hidden fields with name if visible fields exists. * Fix: Integration. Formidable multi-step form protection fixed. * Fix: add max z-index for #cleantalk-modal-overlay. * Fix: Cannot read property 'response_type' of undefined - xhr.responseJSON - undefined where action wc_add_to_cart_block. * Fix: Helper. Set cookies method is deprecated now. * Fix: Adding admin IP to whitelist during the login in and plugin activation. * Fix: SpamFirewall. Don't set cookies if option is disabled. * Fix: Sorting methods modifiers in \Cleantalk\Common\Helper and \Cleantalk\ApbctWP\Helper classes. * Fix: Using \Cleantalk\ApbctWP\Variables\Cookies. * Fix: A dev and a fix version suffix support. * Fix: Adding admin IP to whitelist during the login in and plugin activation. * Fix: New setting 'Alternative cookies handler type'. * Fix: senderinfo params. * Fix: SpamFirewall deleting 127.0.0.1 from local base during update on local website. * Fix: apbct_js_test() considering "Alternative cookie" setting. * Fix: Cleantalk\ApbctWP\VariablesCookie::set() automatically set secure flag if null passed. * Fix: Check JS via Cookie with the Alternative Cookie on. * Fix: Automatically set "secure" param when setcookie() called. * Fix: 'Alternative cookies handler type' setting layout. * Fix: For legacy apbct_hookwp_logoutdelete_trial_notice_cookie(). * Fix: Cleantalk\ApbctWP\Variables::set_fromRemote(), Cleantalk\ApbctWP\Variables::get_fromRemote() fix parameter type. * Fix: SpamFirewall add admin IP when login in or activate plugin. * Fix: Dashboard widget. Showing default Cleantalk's flag if country not found. * Fix: Dashboard widget. Showing 'Unknown' country name if country not found. * Del: Unused apbctcookie__set() function. * Del: "Use alternative mechanism for cookies" setting. * Del: "Use cookies less sessions" setting.

Download this release

Release Info

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

Code changes from version 5.156 to 5.157

Files changed (291) hide show
  1. cleantalk.php +259 -336
  2. css/cleantalk-dashboard-widget.min.css +1 -1
  3. inc/cleantalk-admin.php +36 -9
  4. inc/cleantalk-ajax.php +3 -3
  5. inc/cleantalk-common.php +96 -74
  6. inc/cleantalk-pluggable.php +15 -4
  7. inc/cleantalk-public.php +276 -83
  8. inc/cleantalk-settings.php +44 -33
  9. inc/cleantalk-updater.php +17 -1
  10. inc/images/flags/a1.png +0 -0
  11. inc/images/flags/ad.png +0 -0
  12. inc/images/flags/ae.png +0 -0
  13. inc/images/flags/af.png +0 -0
  14. inc/images/flags/ag.png +0 -0
  15. inc/images/flags/ai.png +0 -0
  16. inc/images/flags/al.png +0 -0
  17. inc/images/flags/am.png +0 -0
  18. inc/images/flags/an.png +0 -0
  19. inc/images/flags/ao.png +0 -0
  20. inc/images/flags/ar.png +0 -0
  21. inc/images/flags/as.png +0 -0
  22. inc/images/flags/at.png +0 -0
  23. inc/images/flags/au.png +0 -0
  24. inc/images/flags/aw.png +0 -0
  25. inc/images/flags/ax.png +0 -0
  26. inc/images/flags/az.png +0 -0
  27. inc/images/flags/ba.png +0 -0
  28. inc/images/flags/bb.png +0 -0
  29. inc/images/flags/bd.png +0 -0
  30. inc/images/flags/be.png +0 -0
  31. inc/images/flags/bf.png +0 -0
  32. inc/images/flags/bg.png +0 -0
  33. inc/images/flags/bh.png +0 -0
  34. inc/images/flags/bi.png +0 -0
  35. inc/images/flags/bj.png +0 -0
  36. inc/images/flags/bm.png +0 -0
  37. inc/images/flags/bn.png +0 -0
  38. inc/images/flags/bo.png +0 -0
  39. inc/images/flags/br.png +0 -0
  40. inc/images/flags/bs.png +0 -0
  41. inc/images/flags/bt.png +0 -0
  42. inc/images/flags/bv.png +0 -0
  43. inc/images/flags/bw.png +0 -0
  44. inc/images/flags/by.png +0 -0
  45. inc/images/flags/bz.png +0 -0
  46. inc/images/flags/ca.png +0 -0
  47. inc/images/flags/catalonia.png +0 -0
  48. inc/images/flags/cc.png +0 -0
  49. inc/images/flags/cd.png +0 -0
  50. inc/images/flags/cf.png +0 -0
  51. inc/images/flags/cg.png +0 -0
  52. inc/images/flags/ch.png +0 -0
  53. inc/images/flags/ci.png +0 -0
  54. inc/images/flags/ck.png +0 -0
  55. inc/images/flags/cl.png +0 -0
  56. inc/images/flags/cleantalk.png +0 -0
  57. inc/images/flags/cm.png +0 -0
  58. inc/images/flags/cn.png +0 -0
  59. inc/images/flags/co.png +0 -0
  60. inc/images/flags/cr.png +0 -0
  61. inc/images/flags/cs.png +0 -0
  62. inc/images/flags/cu.png +0 -0
  63. inc/images/flags/cv.png +0 -0
  64. inc/images/flags/cw.png +0 -0
  65. inc/images/flags/cx.png +0 -0
  66. inc/images/flags/cy.png +0 -0
  67. inc/images/flags/cz.png +0 -0
  68. inc/images/flags/de.png +0 -0
  69. inc/images/flags/dj.png +0 -0
  70. inc/images/flags/dk.png +0 -0
  71. inc/images/flags/dm.png +0 -0
  72. inc/images/flags/do.png +0 -0
  73. inc/images/flags/dz.png +0 -0
  74. inc/images/flags/ec.png +0 -0
  75. inc/images/flags/ee.png +0 -0
  76. inc/images/flags/eg.png +0 -0
  77. inc/images/flags/eh.png +0 -0
  78. inc/images/flags/england.png +0 -0
  79. inc/images/flags/er.png +0 -0
  80. inc/images/flags/es.png +0 -0
  81. inc/images/flags/et.png +0 -0
  82. inc/images/flags/eu.png +0 -0
  83. inc/images/flags/europeanunion.png +0 -0
  84. inc/images/flags/fam.png +0 -0
  85. inc/images/flags/fi.png +0 -0
  86. inc/images/flags/fj.png +0 -0
  87. inc/images/flags/fk.png +0 -0
  88. inc/images/flags/fm.png +0 -0
  89. inc/images/flags/fo.png +0 -0
  90. inc/images/flags/fr.png +0 -0
  91. inc/images/flags/ga.png +0 -0
  92. inc/images/flags/gb.png +0 -0
  93. inc/images/flags/gd.png +0 -0
  94. inc/images/flags/ge.png +0 -0
  95. inc/images/flags/gf.png +0 -0
  96. inc/images/flags/gh.png +0 -0
  97. inc/images/flags/gi.png +0 -0
  98. inc/images/flags/gl.png +0 -0
  99. inc/images/flags/gm.png +0 -0
  100. inc/images/flags/gn.png +0 -0
  101. inc/images/flags/gp.png +0 -0
  102. inc/images/flags/gq.png +0 -0
  103. inc/images/flags/gr.png +0 -0
  104. inc/images/flags/gs.png +0 -0
  105. inc/images/flags/gt.png +0 -0
  106. inc/images/flags/gu.png +0 -0
  107. inc/images/flags/gw.png +0 -0
  108. inc/images/flags/gy.png +0 -0
  109. inc/images/flags/hk.png +0 -0
  110. inc/images/flags/hm.png +0 -0
  111. inc/images/flags/hn.png +0 -0
  112. inc/images/flags/hr.png +0 -0
  113. inc/images/flags/ht.png +0 -0
  114. inc/images/flags/hu.png +0 -0
  115. inc/images/flags/id.png +0 -0
  116. inc/images/flags/ie.png +0 -0
  117. inc/images/flags/il.png +0 -0
  118. inc/images/flags/in.png +0 -0
  119. inc/images/flags/io.png +0 -0
  120. inc/images/flags/iq.png +0 -0
  121. inc/images/flags/ir.png +0 -0
  122. inc/images/flags/is.png +0 -0
  123. inc/images/flags/it.png +0 -0
  124. inc/images/flags/jm.png +0 -0
  125. inc/images/flags/jo.png +0 -0
  126. inc/images/flags/jp.png +0 -0
  127. inc/images/flags/ke.png +0 -0
  128. inc/images/flags/kg.png +0 -0
  129. inc/images/flags/kh.png +0 -0
  130. inc/images/flags/ki.png +0 -0
  131. inc/images/flags/km.png +0 -0
  132. inc/images/flags/kn.png +0 -0
  133. inc/images/flags/kp.png +0 -0
  134. inc/images/flags/kr.png +0 -0
  135. inc/images/flags/kw.png +0 -0
  136. inc/images/flags/ky.png +0 -0
  137. inc/images/flags/kz.png +0 -0
  138. inc/images/flags/la.png +0 -0
  139. inc/images/flags/lb.png +0 -0
  140. inc/images/flags/lc.png +0 -0
  141. inc/images/flags/li.png +0 -0
  142. inc/images/flags/lk.png +0 -0
  143. inc/images/flags/lr.png +0 -0
  144. inc/images/flags/ls.png +0 -0
  145. inc/images/flags/lt.png +0 -0
  146. inc/images/flags/lu.png +0 -0
  147. inc/images/flags/lv.png +0 -0
  148. inc/images/flags/ly.png +0 -0
  149. inc/images/flags/ma.png +0 -0
  150. inc/images/flags/mc.png +0 -0
  151. inc/images/flags/md.png +0 -0
  152. inc/images/flags/me.png +0 -0
  153. inc/images/flags/mg.png +0 -0
  154. inc/images/flags/mh.png +0 -0
  155. inc/images/flags/mk.png +0 -0
  156. inc/images/flags/ml.png +0 -0
  157. inc/images/flags/mm.png +0 -0
  158. inc/images/flags/mn.png +0 -0
  159. inc/images/flags/mo.png +0 -0
  160. inc/images/flags/mp.png +0 -0
  161. inc/images/flags/mq.png +0 -0
  162. inc/images/flags/mr.png +0 -0
  163. inc/images/flags/ms.png +0 -0
  164. inc/images/flags/mt.png +0 -0
  165. inc/images/flags/mu.png +0 -0
  166. inc/images/flags/mv.png +0 -0
  167. inc/images/flags/mw.png +0 -0
  168. inc/images/flags/mx.png +0 -0
  169. inc/images/flags/my.png +0 -0
  170. inc/images/flags/mz.png +0 -0
  171. inc/images/flags/na.png +0 -0
  172. inc/images/flags/nc.png +0 -0
  173. inc/images/flags/ne.png +0 -0
  174. inc/images/flags/nf.png +0 -0
  175. inc/images/flags/ng.png +0 -0
  176. inc/images/flags/ni.png +0 -0
  177. inc/images/flags/nl.png +0 -0
  178. inc/images/flags/no.png +0 -0
  179. inc/images/flags/np.png +0 -0
  180. inc/images/flags/nr.png +0 -0
  181. inc/images/flags/nu.png +0 -0
  182. inc/images/flags/nz.png +0 -0
  183. inc/images/flags/om.png +0 -0
  184. inc/images/flags/pa.png +0 -0
  185. inc/images/flags/pe.png +0 -0
  186. inc/images/flags/pf.png +0 -0
  187. inc/images/flags/pg.png +0 -0
  188. inc/images/flags/ph.png +0 -0
  189. inc/images/flags/pk.png +0 -0
  190. inc/images/flags/pl.png +0 -0
  191. inc/images/flags/pm.png +0 -0
  192. inc/images/flags/pn.png +0 -0
  193. inc/images/flags/pr.png +0 -0
  194. inc/images/flags/ps.png +0 -0
  195. inc/images/flags/pt.png +0 -0
  196. inc/images/flags/pw.png +0 -0
  197. inc/images/flags/py.png +0 -0
  198. inc/images/flags/qa.png +0 -0
  199. inc/images/flags/re.png +0 -0
  200. inc/images/flags/ro.png +0 -0
  201. inc/images/flags/rs.png +0 -0
  202. inc/images/flags/ru.png +0 -0
  203. inc/images/flags/rw.png +0 -0
  204. inc/images/flags/sa.png +0 -0
  205. inc/images/flags/sb.png +0 -0
  206. inc/images/flags/sc.png +0 -0
  207. inc/images/flags/scotland.png +0 -0
  208. inc/images/flags/sd.png +0 -0
  209. inc/images/flags/se.png +0 -0
  210. inc/images/flags/sg.png +0 -0
  211. inc/images/flags/sh.png +0 -0
  212. inc/images/flags/si.png +0 -0
  213. inc/images/flags/sj.png +0 -0
  214. inc/images/flags/sk.png +0 -0
  215. inc/images/flags/sl.png +0 -0
  216. inc/images/flags/sm.png +0 -0
  217. inc/images/flags/sn.png +0 -0
  218. inc/images/flags/so.png +0 -0
  219. inc/images/flags/sr.png +0 -0
  220. inc/images/flags/st.png +0 -0
  221. inc/images/flags/sv.png +0 -0
  222. inc/images/flags/sy.png +0 -0
  223. inc/images/flags/sz.png +0 -0
  224. inc/images/flags/tc.png +0 -0
  225. inc/images/flags/td.png +0 -0
  226. inc/images/flags/tf.png +0 -0
  227. inc/images/flags/tg.png +0 -0
  228. inc/images/flags/th.png +0 -0
  229. inc/images/flags/tj.png +0 -0
  230. inc/images/flags/tk.png +0 -0
  231. inc/images/flags/tl.png +0 -0
  232. inc/images/flags/tm.png +0 -0
  233. inc/images/flags/tn.png +0 -0
  234. inc/images/flags/to.png +0 -0
  235. inc/images/flags/tr.png +0 -0
  236. inc/images/flags/tt.png +0 -0
  237. inc/images/flags/tv.png +0 -0
  238. inc/images/flags/tw.png +0 -0
  239. inc/images/flags/tz.png +0 -0
  240. inc/images/flags/ua.png +0 -0
  241. inc/images/flags/ug.png +0 -0
  242. inc/images/flags/um.png +0 -0
  243. inc/images/flags/us.png +0 -0
  244. inc/images/flags/uy.png +0 -0
  245. inc/images/flags/uz.png +0 -0
  246. inc/images/flags/va.png +0 -0
  247. inc/images/flags/vc.png +0 -0
  248. inc/images/flags/ve.png +0 -0
  249. inc/images/flags/vg.png +0 -0
  250. inc/images/flags/vi.png +0 -0
  251. inc/images/flags/vn.png +0 -0
  252. inc/images/flags/vu.png +0 -0
  253. inc/images/flags/wales.png +0 -0
  254. inc/images/flags/wf.png +0 -0
  255. inc/images/flags/ws.png +0 -0
  256. inc/images/flags/ye.png +0 -0
  257. inc/images/flags/yt.png +0 -0
  258. inc/images/flags/za.png +0 -0
  259. inc/images/flags/zm.png +0 -0
  260. inc/images/flags/zw.png +0 -0
  261. js/apbct-public.min.js +1 -1
  262. js/apbct-public.min.js.map +1 -1
  263. js/cleantalk-admin.min.js +1 -1
  264. js/cleantalk-admin.min.js.map +1 -1
  265. js/cleantalk-modal.min.js +1 -1
  266. js/cleantalk-modal.min.js.map +1 -1
  267. js/cleantalk_collect_details.min.js +2 -0
  268. js/cleantalk_collect_details.min.js.map +1 -0
  269. js/cleantalk_nocache.min.js +1 -1
  270. js/cleantalk_nocache.min.js.map +1 -1
  271. lib/Cleantalk/Antispam/Integrations/ContactBank.php +1 -1
  272. lib/Cleantalk/ApbctWP/API.php +29 -1
  273. lib/Cleantalk/ApbctWP/Firewall/AntiCrawler.php +9 -7
  274. lib/Cleantalk/ApbctWP/Firewall/AntiFlood.php +7 -5
  275. lib/Cleantalk/ApbctWP/Firewall/SFW.php +103 -51
  276. lib/Cleantalk/ApbctWP/Firewall/die_page_anticrawler.html +109 -1
  277. lib/Cleantalk/ApbctWP/Firewall/die_page_antiflood.html +108 -1
  278. lib/Cleantalk/ApbctWP/Firewall/die_page_sfw.html +108 -1
  279. lib/Cleantalk/ApbctWP/Helper.php +79 -34
  280. lib/Cleantalk/ApbctWP/RemoteCalls.php +49 -6
  281. lib/Cleantalk/ApbctWP/RestController.php +25 -0
  282. lib/Cleantalk/ApbctWP/State.php +16 -15
  283. lib/Cleantalk/ApbctWP/Variables/AltSessions.php +126 -0
  284. lib/Cleantalk/ApbctWP/Variables/Cookie.php +105 -16
  285. lib/Cleantalk/Common/API.php +42 -9
  286. lib/Cleantalk/Common/DB.php +11 -0
  287. lib/Cleantalk/Common/Firewall.php +1 -1
  288. lib/Cleantalk/Common/Helper.php +24 -65
  289. lib/Cleantalk/Common/Schema.php +4 -2
  290. lib/Cleantalk/Variables/Cookie.php +46 -0
  291. readme.txt +70 -3
cleantalk.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Anti-Spam by CleanTalk
4
  Plugin URI: https://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.156
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: https://cleantalk.org
9
  Text Domain: cleantalk-spam-protect
@@ -15,17 +15,25 @@ use Cleantalk\ApbctWP\CleantalkUpgraderSkin;
15
  use Cleantalk\ApbctWP\CleantalkUpgraderSkin_Deprecated;
16
  use Cleantalk\ApbctWP\Cron;
17
  use Cleantalk\ApbctWP\DB;
 
18
  use Cleantalk\ApbctWP\Firewall\SFW;
19
  use Cleantalk\ApbctWP\Helper;
20
  use Cleantalk\ApbctWP\RemoteCalls;
21
  use Cleantalk\ApbctWP\RestController;
22
  use Cleantalk\Common\Schema;
23
  use Cleantalk\Variables\Get;
 
24
 
25
  $cleantalk_executed = false;
26
 
27
  // Getting version form main file (look above)
28
  $plugin_info = get_file_data(__FILE__, array('Version' => 'Version', 'Name' => 'Plugin Name',));
 
 
 
 
 
 
29
 
30
  // Common params
31
  define('APBCT_NAME', $plugin_info['Name']);
@@ -36,7 +44,7 @@ define('APBCT_PLUGIN_BASE_NAME', plugin_basename(__FILE__)); //Plugin b
36
  define('APBCT_CASERT_PATH', file_exists(ABSPATH . WPINC . '/certificates/ca-bundle.crt') ? ABSPATH . WPINC . '/certificates/ca-bundle.crt' : ''); // SSL Serttificate path
37
 
38
  // API params
39
- define('APBCT_AGENT', 'wordpress-'.str_replace('.', '', $plugin_info['Version']));
40
  define('APBCT_MODERATE_URL', 'http://moderate.cleantalk.org'); //Api URL
41
 
42
  // Option names
@@ -110,10 +118,10 @@ if( !defined( 'CLEANTALK_PLUGIN_DIR' ) ){
110
  add_action('wp_ajax_apbct_js_keys__get', 'apbct_js_keys__get__ajax');
111
  add_action('wp_ajax_nopriv_apbct_js_keys__get', 'apbct_js_keys__get__ajax');
112
 
113
- // Alt sessions
114
- if( $apbct->settings['data__set_cookies__sessions'] ){
115
- add_action( 'wp_ajax_nopriv_apbct_alt_session__get__AJAX', 'apbct_alt_session__get__AJAX' );
116
- add_action( 'wp_ajax_nopriv_apbct_alt_session__save__AJAX', 'apbct_alt_session__save__AJAX' );
117
  }
118
 
119
  add_action( 'rest_api_init', 'apbct_register_my_rest_routes' );
@@ -489,8 +497,8 @@ function apbct_sfw__check()
489
  $spbc_settings = get_option('spbc_settings');
490
  $spbc_key = !empty($spbc_settings['spbc_key']) ? $spbc_settings['spbc_key'] : false;
491
  if($_GET['access'] === $apbct->api_key || ($spbc_key !== false && $_GET['access'] === $spbc_key)){
492
- \Cleantalk\Common\Helper::apbct_cookie__set('spbc_firewall_pass_key', md5(apbct_get_server_variable( 'REMOTE_ADDR' ) . $spbc_key), time()+1200, '/', '');
493
- \Cleantalk\Common\Helper::apbct_cookie__set('ct_sfw_pass_key', md5(apbct_get_server_variable( 'REMOTE_ADDR' ) . $apbct->api_key), time()+1200, '/', null);
494
  return;
495
  }
496
  unset($spbc_settings, $spbc_key);
@@ -568,7 +576,7 @@ function apbct_activation( $network = false ) {
568
  Cron::addTask('check_account_status', 'ct_account_status_check', 3600, time() + 1800); // Checks account status
569
  Cron::addTask('delete_spam_comments', 'ct_delete_spam_comments', 3600, time() + 3500); // Formerly ct_hourly_event_hook()
570
  Cron::addTask('send_feedback', 'ct_send_feedback', 3600, time() + 3500); // Formerly ct_hourly_event_hook()
571
- Cron::addTask('sfw_update', 'apbct_sfw_update__init', 86400, time() + 30); // SFW update
572
  Cron::addTask('send_sfw_logs', 'ct_sfw_send_logs', 3600, time() + 1800); // SFW send logs
573
  Cron::addTask('get_brief_data', 'cleantalk_get_brief_data', 86400, time() + 3500); // Get data for dashboard widget
574
  Cron::addTask('send_connection_report','ct_mail_send_connection_report', 86400, time() + 3500); // Send connection report to welcome@cleantalk.org
@@ -581,7 +589,7 @@ function apbct_activation( $network = false ) {
581
  Cron::addTask('check_account_status', 'ct_account_status_check', 3600, time() + 1800); // Checks account status
582
  Cron::addTask('delete_spam_comments', 'ct_delete_spam_comments', 3600, time() + 3500); // Formerly ct_hourly_event_hook()
583
  Cron::addTask('send_feedback', 'ct_send_feedback', 3600, time() + 3500); // Formerly ct_hourly_event_hook()
584
- Cron::addTask('sfw_update', 'apbct_sfw_update__init', 86400, time() + 30); // SFW update
585
  Cron::addTask('send_sfw_logs', 'ct_sfw_send_logs', 3600, time() + 1800); // SFW send logs
586
  Cron::addTask('get_brief_data', 'cleantalk_get_brief_data', 86400, time() + 3500); // Get data for dashboard widget
587
  Cron::addTask('send_connection_report','ct_mail_send_connection_report', 86400, time() + 3500); // Send connection report to welcome@cleantalk.org
@@ -593,6 +601,7 @@ function apbct_activation( $network = false ) {
593
 
594
  // Additional options
595
  add_option( 'ct_plugin_do_activation_redirect', true );
 
596
 
597
  }
598
 
@@ -638,7 +647,7 @@ function apbct_activation__new_blog($blog_id, $user_id, $domain, $path, $site_id
638
  Cron::addTask('send_connection_report','ct_mail_send_connection_report', 86400, time() + 3500); // Send connection report to welcome@cleantalk.org
639
  Cron::addTask('antiflood__clear_table', 'apbct_antiflood__clear_table', 86400, time() + 300); // Clear Anti-Flood table
640
  apbct_activation__create_tables($sqls);
641
- apbct_sfw_update__init(); // Updating SFW
642
  ct_account_status_check(null, false);
643
 
644
  if (isset($settings['multisite__use_settings_template_apply_for_new']) && $settings['multisite__use_settings_template_apply_for_new'] == 1) {
@@ -763,7 +772,7 @@ function apbct_plugin_redirect()
763
  if (get_option('ct_plugin_do_activation_redirect', false) && !isset($_GET['activate-multi'])){
764
  delete_option('ct_plugin_do_activation_redirect');
765
  ct_account_status_check(null, false);
766
- apbct_sfw_update__init(); // Updating SFW
767
  wp_redirect($apbct->settings_link);
768
  }
769
  }
@@ -832,177 +841,252 @@ function apbct_sfw__clear(){
832
  // This action triggered by wp_schedule_single_event( time() + 900, 'ct_sfw_update' );
833
  add_action( 'apbct_sfw_update__init', 'apbct_sfw_update__init' );
834
 
835
- function apbct_sfw_update__init( $api_key = null ){
836
-
 
 
 
 
 
 
 
 
837
  global $apbct;
838
 
839
- $api_key = ! empty( $api_key ) ? $api_key : $apbct->api_key;
 
 
 
 
 
 
 
 
 
 
 
840
 
841
- if( ! empty( $api_key ) ){
842
-
843
- return \Cleantalk\ApbctWP\Helper::http__request__rc_to_host(
844
- 'sfw_update',
845
- array(),
846
- array( 'async' )
847
- );
848
-
849
- }else
850
- return array('error' => 'KEY_EMPTY');
 
 
 
851
  }
852
 
853
  /**
854
- * @param string $api_key
855
- * @param bool $immediate
856
  *
857
  * @return array|bool|int|string[]
858
  */
859
- function ct_sfw_update( $api_key = '', $immediate = false ){
860
 
861
- global $apbct, $wpdb;
 
 
 
 
 
 
 
 
862
 
863
- // Delay for too fast servers
864
- sleep(1);
865
-
866
- // Prevent start another update at a time
867
- if(
868
- ! Get::get('firewall_updating_id') &&
869
- $apbct->fw_stats['firewall_updating_id'] &&
870
- time() - $apbct->fw_stats['firewall_updating_last_start'] < 60
871
- ){
872
- return array( 'error' => 'FIREWALL_IS_UPDATING' );
873
- }
874
-
875
  // Check if the update performs right now. Blocks remote calls with different ID
876
- if( Get::get('firewall_updating_id') &&
877
- Get::get('firewall_updating_id') !== $apbct->fw_stats['firewall_updating_id']
878
- ) {
879
- return array( 'error' => 'FIREWALL_IS_UPDATING 2' );
 
 
 
 
880
  }
881
 
 
 
 
 
 
 
 
 
 
 
 
882
 
883
- // Set new update ID
884
- if( ! $apbct->fw_stats['firewall_updating_id'] || time() - $apbct->fw_stats['firewall_updating_last_start'] > 300 ){
885
- $apbct->fw_stats['firewall_updating_id'] = md5( rand( 0, 100000 ) );
886
- $apbct->fw_stats['firewall_updating_last_start'] = time();
887
  $apbct->save( 'fw_stats' );
888
- }
889
-
890
- $api_key = !empty($apbct->api_key) ? $apbct->api_key : $api_key;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
891
 
892
- if( empty( $api_key ) || $apbct->settings['sfw__enabled'] != 1 ){
893
  return true;
 
894
  }
 
895
 
896
- // Remote call is in process, do updating
897
- if( RemoteCalls::check() ) {
898
-
899
- $multifile_url = Get::get( 'multifile_url' );
900
- $url_count = Get::get( 'url_count' );
901
- $current_url = Get::get( 'current_url' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
902
 
903
- // First call. Getting files URL ( multifile )
904
- if( ! $multifile_url ){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
905
 
906
- // @todo We have to handle errors here
907
- SFW::create_temp_tables( DB::getInstance() );
908
 
909
- $result = SFW::update__get_multifile( $api_key );
910
-
911
- if( empty( $result['error'] ) && isset( $result['multifile_url'] ) ){
912
 
913
- return Helper::http__request__rc_to_host(
914
- 'sfw_update',
915
- array(
916
- 'multifile_url' => str_replace( array( 'http://', 'https://' ), '', $result['multifile_url'] ),
917
- 'url_count' => count( $result['file_urls'] ),
918
- 'current_url' => 0,
919
- 'firewall_updating_id' => $apbct->fw_stats['firewall_updating_id'],
920
- ),
921
- array( 'async' )
922
- );
923
-
924
- }else
925
- return $result;
926
-
927
- // Writing data form URL gz file
928
- }elseif( $url_count > $current_url ){
929
-
930
- $result = SFW::update__write_to_db(
931
- DB::getInstance(),
932
- APBCT_TBL_FIREWALL_DATA . '_temp',
933
- 'https://' . str_replace( 'multifiles', $current_url, $multifile_url )
934
- );
935
-
936
- if( empty( $result['error'] ) && is_int( $result ) ){
937
 
938
- $apbct->fw_stats['firewall_update_percent'] = round( ( ( (int) $current_url + 1 ) / (int) $url_count ), 2 ) * 100;
939
- $apbct->save( 'fw_stats' );
940
-
941
- return Helper::http__request__rc_to_host(
942
- 'sfw_update',
943
- array(
944
- 'multifile_url' => str_replace( array( 'http://', 'https://' ), '', $multifile_url ),
945
- 'url_count' => $url_count,
946
- 'current_url' => ++ $current_url,
947
- 'firewall_updating_id' => $apbct->fw_stats['firewall_updating_id'],
948
- ),
949
- array( 'async' )
950
- );
951
- }else
952
- return $result;
953
-
954
- // Main update is complete. Adding exclusions
955
- }else{
956
-
957
- $result = SFW::firewall_update__write_to_db__exclusions(
958
- DB::getInstance(),
959
- APBCT_TBL_FIREWALL_DATA . '_temp'
960
- );
961
-
962
- if( empty( $result['error'] ) && is_int( $result ) ) {
963
 
964
- // REMOVE AND RENAME
965
- // @todo We have to handle errors here
966
- SFW::delete_main_data_tables( DB::getInstance() );
967
- // @todo We have to handle errors here
968
- SFW::rename_data_tables( DB::getInstance() );
969
-
970
- // Increment firewall entries
971
- $apbct->fw_stats['firewall_update_percent'] = 0;
972
- $apbct->fw_stats['firewall_updating_id'] = null;
973
- $apbct->fw_stats['last_firewall_updated'] = time();
974
- $apbct->save( 'fw_stats' );
975
-
976
- $apbct->stats['sfw']['entries'] = $wpdb->get_var('SELECT COUNT(*) FROM ' . APBCT_TBL_FIREWALL_DATA );
977
- $apbct->stats['sfw']['last_update_time'] = time();
978
- $apbct->save( 'stats' );
979
-
980
- $apbct->data['last_firewall_updated'] = current_time('timestamp');
981
- $apbct->save('data'); // Unused
982
-
983
- // Running sfw update once again in 12 min if entries is < 4000
984
- if( ! $apbct->stats['sfw']['last_update_time'] &&
985
- $apbct->stats['sfw']['entries'] < 4000
986
- ){
987
- wp_schedule_single_event( time() + 720, 'apbct_sfw_update__init' );
988
- }
989
-
990
- // Delete update errors
991
- $apbct->error_delete( 'sfw_update', 'save_settings' );
992
-
993
- // Get update period for server
994
- $update_period = \Cleantalk\Common\DNS::getServerTTL( 'spamfirewall-ttl.cleantalk.org' );
995
- $update_period = (int)$update_period > 14400 ? (int) $update_period : 14400;
996
- Cron::updateTask('sfw_update', 'apbct_sfw_update__init', $update_period );
997
-
998
- return $result;
999
-
1000
- }else
1001
- return array( 'error' => 'SFW_UPDATE: EXCLUSIONS: ' . $result['error'] );
1002
- }
1003
  }
1004
 
1005
- return true;
 
 
 
 
 
 
 
1006
  }
1007
 
1008
  function ct_sfw_send_logs($api_key = '')
@@ -1490,108 +1574,7 @@ function cleantalk_get_brief_data(){
1490
  //Delete cookie for admin trial notice
1491
  function apbct__hook__wp_logout__delete_trial_notice_cookie(){
1492
  if(!headers_sent())
1493
- setcookie('ct_trial_banner_closed', '', time()-3600);
1494
- }
1495
-
1496
- function apbct_alt_session__id__get(){
1497
- $id = Helper::ip__get('real')
1498
- .apbct_get_server_variable( 'HTTP_USER_AGENT' )
1499
- .apbct_get_server_variable( 'HTTP_ACCEPT_LANGUAGE' );
1500
- return hash('sha256', $id);
1501
- }
1502
-
1503
- function apbct_alt_sessions__remove_old(){
1504
- if(rand(0, 1000) < APBCT_SEESION__CHANCE_TO_CLEAN){
1505
- global $wpdb;
1506
- $wpdb->query(
1507
- 'DELETE
1508
- FROM `'. APBCT_TBL_SESSIONS .'`
1509
- WHERE last_update < NOW() - INTERVAL '. APBCT_SEESION__LIVE_TIME .' SECOND
1510
- LIMIT 100000;'
1511
- );
1512
- }
1513
- }
1514
- function apbct_alt_sessions__clear( $full_clear = true ) {
1515
- global $wpdb;
1516
- if( $full_clear ) {
1517
- $res = $wpdb->query(
1518
- 'TRUNCATE TABLE '. APBCT_TBL_SESSIONS .';'
1519
- );
1520
- } else {
1521
- $res = $wpdb->query(
1522
- 'DELETE FROM `'. APBCT_TBL_SESSIONS .'`
1523
- WHERE name NOT IN ( "apbct_urls", "apbct_site_referer" )
1524
- LIMIT 100000;'
1525
- );
1526
- }
1527
- return $res;
1528
- }
1529
-
1530
- function apbct_alt_session__save($name, $value){
1531
-
1532
- // Bad incoming data
1533
- if( ! $name || ! $value )
1534
- return;
1535
-
1536
- global $wpdb;
1537
-
1538
- $session_id = apbct_alt_session__id__get();
1539
-
1540
- $wpdb->query(
1541
- $wpdb->prepare(
1542
- 'INSERT INTO '. APBCT_TBL_SESSIONS .'
1543
- (id, name, value, last_update)
1544
- VALUES (%s, %s, %s, %s)
1545
- ON DUPLICATE KEY UPDATE
1546
- value = %s,
1547
- last_update = %s',
1548
- $session_id, $name, $value, date('Y-m-d H:i:s'), $value, date('Y-m-d H:i:s')
1549
- )
1550
- );
1551
-
1552
- }
1553
-
1554
- function apbct_alt_session__get($name){
1555
-
1556
- // Bad incoming data
1557
- if( ! $name )
1558
- return;
1559
-
1560
- global $wpdb;
1561
-
1562
- $session_id = apbct_alt_session__id__get();
1563
- $result = $wpdb->get_row(
1564
- $wpdb->prepare(
1565
- 'SELECT value
1566
- FROM `'. APBCT_TBL_SESSIONS .'`
1567
- WHERE id = %s AND name = %s;',
1568
- $session_id, $name
1569
- ),
1570
- ARRAY_A
1571
- );
1572
-
1573
- $result = isset($result['value'])
1574
- ? (strpos($result['value'], '{') === 0
1575
- ? (array)json_decode($result['value'], true) // JSON
1576
- : $result['value'])
1577
- : false;
1578
-
1579
- return $result ?: null;
1580
- }
1581
-
1582
- function apbct_alt_session__save__AJAX(){
1583
- check_ajax_referer( 'ct_secret_stuff' );
1584
- apbct_alt_session__save(
1585
- \Cleantalk\Variables\Post::get( 'name' ),
1586
- \Cleantalk\Variables\Post::get( 'value' )
1587
- );
1588
- }
1589
-
1590
- function apbct_alt_session__get__AJAX(){
1591
- check_ajax_referer( 'ct_secret_stuff' );
1592
- apbct_alt_session__get(
1593
- \Cleantalk\Variables\Post::get( 'name' )
1594
- );
1595
  }
1596
 
1597
  function apbct_store__urls(){
@@ -1602,15 +1585,11 @@ function apbct_store__urls(){
1602
 
1603
  // URLs HISTORY
1604
  // Get current url
1605
- $current_url = apbct_get_server_variable( 'HTTP_HOST' ) . apbct_get_server_variable( 'REQUEST_URI' );
1606
-
1607
  $current_url = $current_url ? substr($current_url, 0,256) : 'UNKNOWN';
1608
 
1609
  // Get already stored URLs
1610
- $urls = $apbct->settings['misc__store_urls__sessions']
1611
- ? (array)apbct_alt_session__get('apbct_urls')
1612
- : (array)json_decode(filter_input(INPUT_COOKIE, 'apbct_urls'), true);
1613
-
1614
  $urls[$current_url][] = time();
1615
 
1616
  // Rotating. Saving only latest 10
@@ -1618,9 +1597,7 @@ function apbct_store__urls(){
1618
  $urls = count($urls) > 10 ? array_slice($urls, 1, 10) : $urls;
1619
 
1620
  // Saving
1621
- $apbct->settings['misc__store_urls__sessions']
1622
- ? apbct_alt_session__save('apbct_urls', json_encode($urls))
1623
- : \Cleantalk\Common\Helper::apbct_cookie__set('apbct_urls', json_encode($urls), time()+86400*3, '/', parse_url(get_option('siteurl'),PHP_URL_HOST), false, true, 'Lax');
1624
 
1625
  // REFERER
1626
  // Get current fererer
@@ -1628,16 +1605,11 @@ function apbct_store__urls(){
1628
  $new_site_referer = $new_site_referer ? $new_site_referer : 'UNKNOWN';
1629
 
1630
  // Get already stored referer
1631
- $site_referer = $apbct->settings['misc__store_urls__sessions']
1632
- ? apbct_alt_session__get('apbct_site_referer')
1633
- : filter_input(INPUT_COOKIE, 'apbct_site_referer');
1634
 
1635
  // Save if empty
1636
  if( !$site_referer || parse_url($new_site_referer, PHP_URL_HOST) !== apbct_get_server_variable( 'HTTP_HOST' ) ){
1637
-
1638
- $apbct->settings['misc__store_urls__sessions']
1639
- ? apbct_alt_session__save('apbct_site_referer', $new_site_referer)
1640
- : \Cleantalk\Common\Helper::apbct_cookie__set('apbct_site_referer', $new_site_referer, time()+86400*3, '/', parse_url(get_option('siteurl'),PHP_URL_HOST), false, true, 'Lax');
1641
  }
1642
 
1643
  $apbct->flags__url_stored = true;
@@ -1645,38 +1617,6 @@ function apbct_store__urls(){
1645
  }
1646
  }
1647
 
1648
- /**
1649
- * Universal method to adding cookies.
1650
- * Use \Cleantalk\Common\Helper::apbct_cookie__set() instead.
1651
- * @deprecated
1652
- */
1653
- function apbct_cookie__set($name, $value = '', $expires = 0, $path = '', $domain = null, $secure = false, $httponly = false, $samesite = 'Lax' ){
1654
-
1655
- // For PHP 7.3+ and above
1656
- if( version_compare( phpversion(), '7.3.0', '>=' ) ){
1657
-
1658
- $params = array(
1659
- 'expires' => $expires,
1660
- 'path' => $path,
1661
- 'domain' => $domain,
1662
- 'secure' => $secure,
1663
- 'httponly' => $httponly,
1664
- );
1665
-
1666
- if($samesite)
1667
- $params['samesite'] = $samesite;
1668
-
1669
- setcookie( $name, $value, $params );
1670
-
1671
- // For PHP 5.6 - 7.2
1672
- }else {
1673
- if($samesite)
1674
- $path = $path . '; samesite=' . $samesite;
1675
- setcookie( $name, $value, $expires, $path, $domain, $secure, $httponly );
1676
- }
1677
-
1678
- }
1679
-
1680
  /*
1681
  * Set Cookies test for cookie test
1682
  * Sets cookies with pararms timestamp && landing_timestamp && pervious_referer
@@ -1686,9 +1626,6 @@ function apbct_cookie(){
1686
 
1687
  global $apbct;
1688
 
1689
- if($apbct->settings['misc__store_urls__sessions'] || $apbct->settings['data__set_cookies__sessions'])
1690
- apbct_alt_sessions__remove_old();
1691
-
1692
  if(
1693
  empty($apbct->settings['data__set_cookies']) || // Do not set cookies if option is disabled (for Varnish cache).
1694
  !empty($apbct->flags__cookies_setuped) || // Cookies already set
@@ -1717,54 +1654,42 @@ function apbct_cookie(){
1717
  // Submit time
1718
  if(empty($_POST['ct_multipage_form'])){ // Do not start/reset page timer if it is multipage form (Gravitiy forms))
1719
  $apbct_timestamp = time();
1720
- $apbct->settings['data__set_cookies__sessions']
1721
- ? apbct_alt_session__save('apbct_timestamp', $apbct_timestamp)
1722
- : \Cleantalk\Common\Helper::apbct_cookie__set('apbct_timestamp', $apbct_timestamp, 0, '/', $domain, false, true, 'Lax' );
1723
  $cookie_test_value['cookies_names'][] = 'apbct_timestamp';
1724
  $cookie_test_value['check_value'] .= $apbct_timestamp;
1725
  }
1726
 
1727
  // Pervious referer
1728
- if(apbct_get_server_variable( 'HTTP_REFERER' )){
1729
- $apbct->settings['data__set_cookies__sessions']
1730
- ? apbct_alt_session__save('apbct_prev_referer', apbct_get_server_variable( 'HTTP_REFERER' ))
1731
- : \Cleantalk\Common\Helper::apbct_cookie__set('apbct_prev_referer', apbct_get_server_variable( 'HTTP_REFERER' ), 0, '/', $domain, false, true, 'Lax' );
1732
  $cookie_test_value['cookies_names'][] = 'apbct_prev_referer';
1733
  $cookie_test_value['check_value'] .= apbct_get_server_variable( 'HTTP_REFERER' );
1734
  }
1735
 
1736
  // Landing time
1737
- $site_landing_timestamp = $apbct->settings['data__set_cookies__sessions']
1738
- ? apbct_alt_session__get('apbct_site_landing_ts')
1739
- : filter_input(INPUT_COOKIE, 'apbct_site_landing_ts');
1740
  if(!$site_landing_timestamp){
1741
  $site_landing_timestamp = time();
1742
- $apbct->settings['data__set_cookies__sessions']
1743
- ? apbct_alt_session__save('apbct_site_landing_ts', $site_landing_timestamp)
1744
- : \Cleantalk\Common\Helper::apbct_cookie__set('apbct_site_landing_ts', $site_landing_timestamp, 0, '/', $domain, false, true, 'Lax' );
1745
  }
1746
  $cookie_test_value['cookies_names'][] = 'apbct_site_landing_ts';
1747
  $cookie_test_value['check_value'] .= $site_landing_timestamp;
1748
 
1749
  // Page hits
1750
  // Get
1751
- $page_hits = $apbct->settings['data__set_cookies__sessions']
1752
- ? apbct_alt_session__get('apbct_page_hits')
1753
- : filter_input(INPUT_COOKIE, 'apbct_page_hits');
1754
  // Set / Increase
1755
  $page_hits = intval($page_hits) ? $page_hits + 1 : 1;
1756
 
1757
- $apbct->settings['data__set_cookies__sessions']
1758
- ? apbct_alt_session__save('apbct_page_hits', $page_hits)
1759
- : \Cleantalk\Common\Helper::apbct_cookie__set('apbct_page_hits', $page_hits, 0, '/', $domain, false, true, 'Lax' );
1760
 
1761
  $cookie_test_value['cookies_names'][] = 'apbct_page_hits';
1762
  $cookie_test_value['check_value'] .= $page_hits;
1763
 
1764
  // Cookies test
1765
  $cookie_test_value['check_value'] = md5($cookie_test_value['check_value']);
1766
- if(!$apbct->settings['data__set_cookies__sessions'])
1767
- \Cleantalk\Common\Helper::apbct_cookie__set('apbct_cookies_test', urlencode(json_encode($cookie_test_value)), 0, '/', $domain, false, true, 'Lax' );
1768
 
1769
  $apbct->flags__cookies_setuped = true;
1770
 
@@ -1779,8 +1704,9 @@ function apbct_cookies_test()
1779
  {
1780
  global $apbct;
1781
 
1782
- if($apbct->settings['data__set_cookies__sessions'])
1783
- return 1;
 
1784
 
1785
  if(isset($_COOKIE['apbct_cookies_test'])){
1786
 
@@ -1810,11 +1736,8 @@ function apbct_cookies_test()
1810
  * @return null|int;
1811
  */
1812
  function apbct_get_submit_time()
1813
- {
1814
- global $apbct;
1815
- $apbct_timestamp = $apbct->settings['data__set_cookies__sessions']
1816
- ? (int)apbct_alt_session__get('apbct_timestamp')
1817
- : (int)filter_input(INPUT_COOKIE, 'apbct_timestamp');
1818
  return apbct_cookies_test() === 1 && $apbct_timestamp !== 0 ? time() - $apbct_timestamp : null;
1819
  }
1820
 
3
  Plugin Name: Anti-Spam by CleanTalk
4
  Plugin URI: https://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.157
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: https://cleantalk.org
9
  Text Domain: cleantalk-spam-protect
15
  use Cleantalk\ApbctWP\CleantalkUpgraderSkin_Deprecated;
16
  use Cleantalk\ApbctWP\Cron;
17
  use Cleantalk\ApbctWP\DB;
18
+ use Cleantalk\ApbctWP\Firewall\AntiCrawler;
19
  use Cleantalk\ApbctWP\Firewall\SFW;
20
  use Cleantalk\ApbctWP\Helper;
21
  use Cleantalk\ApbctWP\RemoteCalls;
22
  use Cleantalk\ApbctWP\RestController;
23
  use Cleantalk\Common\Schema;
24
  use Cleantalk\Variables\Get;
25
+ use Cleantalk\Variables\Server;
26
 
27
  $cleantalk_executed = false;
28
 
29
  // Getting version form main file (look above)
30
  $plugin_info = get_file_data(__FILE__, array('Version' => 'Version', 'Name' => 'Plugin Name',));
31
+ $plugin_version__agent = $plugin_info['Version'];
32
+ // Converts xxx.xxx.xx-dev to xxx.xxx.2xx
33
+ // And xxx.xxx.xx-fix to xxx.xxx.1xx
34
+ if( preg_match( '@^(\d+)\.(\d+)\.(\d{1,2})-(dev|fix)$@', $plugin_version__agent, $m ) ){
35
+ $plugin_version__agent = $m[1] . '.' . $m[2] . '.' . ( $m[4] === 'dev' ? '2' : '1' ) . str_pad( $m[3], 2, '0', STR_PAD_LEFT );
36
+ }
37
 
38
  // Common params
39
  define('APBCT_NAME', $plugin_info['Name']);
44
  define('APBCT_CASERT_PATH', file_exists(ABSPATH . WPINC . '/certificates/ca-bundle.crt') ? ABSPATH . WPINC . '/certificates/ca-bundle.crt' : ''); // SSL Serttificate path
45
 
46
  // API params
47
+ define('APBCT_AGENT', 'wordpress-' . $plugin_version__agent );
48
  define('APBCT_MODERATE_URL', 'http://moderate.cleantalk.org'); //Api URL
49
 
50
  // Option names
118
  add_action('wp_ajax_apbct_js_keys__get', 'apbct_js_keys__get__ajax');
119
  add_action('wp_ajax_nopriv_apbct_js_keys__get', 'apbct_js_keys__get__ajax');
120
 
121
+ // Using alternative sessions with ajax
122
+ if( $apbct->settings['data__set_cookies'] == 2 && $apbct->settings['data__set_cookies__alt_sessions_type'] == 2 ){
123
+ add_action( 'wp_ajax_nopriv_apbct_alt_session__get__AJAX', array( \Cleantalk\ApbctWP\Variables\AltSessions::class, 'get_fromRemote' ) );
124
+ add_action( 'wp_ajax_nopriv_apbct_alt_session__save__AJAX', array( \Cleantalk\ApbctWP\Variables\AltSessions::class, 'set_fromRemote' ) );
125
  }
126
 
127
  add_action( 'rest_api_init', 'apbct_register_my_rest_routes' );
497
  $spbc_settings = get_option('spbc_settings');
498
  $spbc_key = !empty($spbc_settings['spbc_key']) ? $spbc_settings['spbc_key'] : false;
499
  if($_GET['access'] === $apbct->api_key || ($spbc_key !== false && $_GET['access'] === $spbc_key)){
500
+ \Cleantalk\Variables\Cookie::set('spbc_firewall_pass_key', md5(apbct_get_server_variable( 'REMOTE_ADDR' ) . $spbc_key), time()+1200, '/', '');
501
+ \Cleantalk\Variables\Cookie::set('ct_sfw_pass_key', md5(apbct_get_server_variable( 'REMOTE_ADDR' ) . $apbct->api_key), time()+1200, '/', null);
502
  return;
503
  }
504
  unset($spbc_settings, $spbc_key);
576
  Cron::addTask('check_account_status', 'ct_account_status_check', 3600, time() + 1800); // Checks account status
577
  Cron::addTask('delete_spam_comments', 'ct_delete_spam_comments', 3600, time() + 3500); // Formerly ct_hourly_event_hook()
578
  Cron::addTask('send_feedback', 'ct_send_feedback', 3600, time() + 3500); // Formerly ct_hourly_event_hook()
579
+ Cron::addTask('sfw_update', 'apbct_sfw_update__init', 86400 ); // SFW update
580
  Cron::addTask('send_sfw_logs', 'ct_sfw_send_logs', 3600, time() + 1800); // SFW send logs
581
  Cron::addTask('get_brief_data', 'cleantalk_get_brief_data', 86400, time() + 3500); // Get data for dashboard widget
582
  Cron::addTask('send_connection_report','ct_mail_send_connection_report', 86400, time() + 3500); // Send connection report to welcome@cleantalk.org
589
  Cron::addTask('check_account_status', 'ct_account_status_check', 3600, time() + 1800); // Checks account status
590
  Cron::addTask('delete_spam_comments', 'ct_delete_spam_comments', 3600, time() + 3500); // Formerly ct_hourly_event_hook()
591
  Cron::addTask('send_feedback', 'ct_send_feedback', 3600, time() + 3500); // Formerly ct_hourly_event_hook()
592
+ Cron::addTask('sfw_update', 'apbct_sfw_update__init', 86400 ); // SFW update
593
  Cron::addTask('send_sfw_logs', 'ct_sfw_send_logs', 3600, time() + 1800); // SFW send logs
594
  Cron::addTask('get_brief_data', 'cleantalk_get_brief_data', 86400, time() + 3500); // Get data for dashboard widget
595
  Cron::addTask('send_connection_report','ct_mail_send_connection_report', 86400, time() + 3500); // Send connection report to welcome@cleantalk.org
601
 
602
  // Additional options
603
  add_option( 'ct_plugin_do_activation_redirect', true );
604
+ apbct_add_admin_ip_to_swf_whitelist( null, null );
605
 
606
  }
607
 
647
  Cron::addTask('send_connection_report','ct_mail_send_connection_report', 86400, time() + 3500); // Send connection report to welcome@cleantalk.org
648
  Cron::addTask('antiflood__clear_table', 'apbct_antiflood__clear_table', 86400, time() + 300); // Clear Anti-Flood table
649
  apbct_activation__create_tables($sqls);
650
+ apbct_sfw_update__init( 3 ); // Updating SFW
651
  ct_account_status_check(null, false);
652
 
653
  if (isset($settings['multisite__use_settings_template_apply_for_new']) && $settings['multisite__use_settings_template_apply_for_new'] == 1) {
772
  if (get_option('ct_plugin_do_activation_redirect', false) && !isset($_GET['activate-multi'])){
773
  delete_option('ct_plugin_do_activation_redirect');
774
  ct_account_status_check(null, false);
775
+ apbct_sfw_update__init( 3 ); // Updating SFW
776
  wp_redirect($apbct->settings_link);
777
  }
778
  }
841
  // This action triggered by wp_schedule_single_event( time() + 900, 'ct_sfw_update' );
842
  add_action( 'apbct_sfw_update__init', 'apbct_sfw_update__init' );
843
 
844
+
845
+ /**
846
+ * Called by sfw_update remote call
847
+ * Starts SFW update and could use a delay before start
848
+ *
849
+ * @param int $delay
850
+ *
851
+ * @return bool|string|string[]
852
+ */
853
+ function apbct_sfw_update__init( $delay = 0 ){
854
  global $apbct;
855
 
856
+ // Prevent start an update if update is already running and started less than 2 minutes ago
857
+ if(
858
+ $apbct->fw_stats['firewall_updating_id'] &&
859
+ time() - $apbct->fw_stats['firewall_updating_last_start'] < 120
860
+ ){
861
+ return array( 'error' => 'SFW UPDATE INIT: FIREWALL_IS_ALREADY_UPDATING' );
862
+ }
863
+
864
+ // Key is empty
865
+ if( ! $apbct->api_key ){
866
+ return array( 'error' => 'SFW UPDATE INIT: KEY_EMPTY' );
867
+ }
868
 
869
+ // Set a new update ID and an update time start
870
+ $apbct->fw_stats['firewall_updating_id'] = md5( rand( 0, 100000 ) );
871
+ $apbct->fw_stats['firewall_updating_last_start'] = time();
872
+ $apbct->save( 'fw_stats' );
873
+
874
+ return \Cleantalk\ApbctWP\Helper::http__request__rc_to_host(
875
+ 'sfw_update__worker',
876
+ array(
877
+ 'delay' => $delay,
878
+ 'firewall_updating_id' => $apbct->fw_stats['firewall_updating_id'],
879
+ ),
880
+ array( 'async' )
881
+ );
882
  }
883
 
884
  /**
885
+ * Called by sfw_update__worker remote call
886
+ * gather all process about SFW updating
887
  *
888
  * @return array|bool|int|string[]
889
  */
890
+ function apbct_sfw_update__worker(){
891
 
892
+ global $apbct;
893
+
894
+ $updating_id = Get::get( 'firewall_updating_id' );
895
+ $multifile_url = Get::get( 'multifile_url' );
896
+ $url_count = Get::get( 'url_count' );
897
+ $current_url = Get::get( 'current_url' );
898
+ $useragent_url = Get::get( 'useragent_url' );
899
+
900
+ $api_key = $apbct->api_key;
901
 
 
 
 
 
 
 
 
 
 
 
 
 
902
  // Check if the update performs right now. Blocks remote calls with different ID
903
+ // This was done to make sure that we won't have multiple updates at a time
904
+ if( $updating_id !== $apbct->fw_stats['firewall_updating_id'] ){
905
+ return array( 'error' => 'WRONG_UPDATE_ID' );
906
+ }
907
+
908
+ // Key is empty
909
+ if( empty( $api_key ) ){
910
+ return array( 'error' => 'KEY_EMPTY' );
911
  }
912
 
913
+ // First call. Getting files URL ( multifile )
914
+ if( ! $multifile_url ){
915
+
916
+ // Preparing database infrastructure
917
+ apbct_activation__create_tables( Schema::getSchema( 'sfw' ), $apbct->db_prefix );
918
+ SFW::create_temp_tables( DB::getInstance(), APBCT_TBL_FIREWALL_DATA );
919
+
920
+ return apbct_sfw_update__get_multifiles( $api_key, $updating_id );
921
+
922
+ // User-Agents blacklist
923
+ }elseif( $useragent_url && ( $apbct->settings['sfw__anti_crawler'] || $apbct->settings['sfw__anti_flood'] ) ){
924
 
925
+ $apbct->fw_stats['firewall_update_percent'] = 10;
 
 
 
926
  $apbct->save( 'fw_stats' );
927
+
928
+ return apbct_sfw_update__process_ua( $multifile_url, $url_count, $current_url, $updating_id, $useragent_url );
929
+
930
+ // Writing data form URL gz file
931
+ }elseif( $url_count && $url_count > $current_url ){
932
+
933
+ // Maximum is 90% because there are User-Agents to update. Leaving them 10% of all percents.
934
+ $apbct->fw_stats['firewall_update_percent'] = round( ( ( (int) $current_url + 1 ) / (int) $url_count ), 2 ) * 90 + 10;
935
+ $apbct->save( 'fw_stats' );
936
+
937
+ return apbct_sfw_update__process_file( $multifile_url, $url_count, $current_url, $updating_id );
938
+
939
+ // Main update is complete. Adding exclusions.
940
+ }elseif( $url_count && $url_count === $current_url ){
941
+
942
+ return apbct_sfw_update__process_exclusions( $multifile_url, $updating_id );
943
+
944
+ // End of update
945
+ }else{
946
+
947
+ global $wpdb;
948
+
949
+ // REMOVE AND RENAME
950
+ $result = SFW::data_tables__delete( DB::getInstance(), APBCT_TBL_FIREWALL_DATA );
951
+ if( ! empty( $result['error'] ) )
952
+ return $result;
953
+ $result = SFW::rename_data_tables__from_temp_to_main( DB::getInstance(), APBCT_TBL_FIREWALL_DATA );
954
+ if( ! empty( $result['error'] ) )
955
+ return $result;
956
+
957
+ // Increment firewall entries
958
+ $apbct->fw_stats['firewall_update_percent'] = 0;
959
+ $apbct->fw_stats['firewall_updating_id'] = null;
960
+ $apbct->fw_stats['last_firewall_updated'] = time();
961
+ $apbct->save( 'fw_stats' );
962
+
963
+ $apbct->stats['sfw']['entries'] = $wpdb->get_var('SELECT COUNT(*) FROM ' . APBCT_TBL_FIREWALL_DATA );
964
+ $apbct->stats['sfw']['last_update_time'] = time();
965
+ $apbct->save( 'stats' );
966
+
967
+ $apbct->data['last_firewall_updated'] = current_time('timestamp');
968
+ $apbct->save('data'); // Unused
969
+
970
+ // Running sfw update once again in 12 min if entries is < 4000
971
+ if( ! $apbct->stats['sfw']['last_update_time'] &&
972
+ $apbct->stats['sfw']['entries'] < 4000
973
+ ){
974
+ wp_schedule_single_event( time() + 720, 'apbct_sfw_update__init' );
975
+ }
976
+
977
+ // Delete update errors
978
+ $apbct->error_delete( 'sfw_update', 'save_settings' );
979
+
980
+ // Get update period for server
981
+ $update_period = \Cleantalk\Common\DNS::getServerTTL( 'spamfirewall-ttl.cleantalk.org' );
982
+ $update_period = (int)$update_period > 14400 ? (int) $update_period : 14400;
983
+ Cron::updateTask('sfw_update', 'apbct_sfw_update__init', $update_period );
984
 
 
985
  return true;
986
+
987
  }
988
+ }
989
 
990
+ function apbct_sfw_update__get_multifiles( $api_key, $updating_id ){
991
+
992
+ $result = SFW::update__get_multifile( $api_key );
993
+
994
+ if( ! empty( $result['error'] ) ){
995
+ return array( 'error' => 'GET MULTIFILE: ' . $result['error'] );
996
+ }
997
+
998
+ return Helper::http__request__rc_to_host(
999
+ 'sfw_update__worker',
1000
+ array(
1001
+ 'multifile_url' => str_replace( array( 'http://', 'https://' ), '', $result['multifile_url'] ),
1002
+ 'url_count' => count( $result['file_urls'] ),
1003
+ 'useragent_url' => str_replace( array( 'http://', 'https://' ), '', $result['useragent_url'] ),
1004
+ 'current_url' => 0,
1005
+ 'firewall_updating_id' => $updating_id,
1006
+ ),
1007
+ array( 'async' )
1008
+ );
1009
+ }
1010
 
1011
+ function apbct_sfw_update__process_ua( $multifile_url, $url_count, $current_url, $updating_id, $useragent_url ){
1012
+
1013
+
1014
+ $result = AntiCrawler::update( 'https://' . $useragent_url );
1015
+
1016
+ if( ! empty( $result['error'] ) ){
1017
+ array( 'error' => 'UPDATING UA LIST: ' . $result['error'] );
1018
+ }
1019
+
1020
+ if( ! is_int( $result ) ){
1021
+ return array( 'error' => 'UPDATING UA LIST: : WRONG_RESPONSE AntiCrawler::update' );
1022
+ }
1023
+
1024
+ return Helper::http__request__rc_to_host(
1025
+ 'sfw_update__worker',
1026
+ array(
1027
+ 'multifile_url' => str_replace( array( 'http://', 'https://' ), '', $multifile_url ),
1028
+ 'url_count' => $url_count,
1029
+ 'current_url' => $current_url,
1030
+ 'firewall_updating_id' => $updating_id,
1031
+ ),
1032
+ array( 'async' )
1033
+ );
1034
+
1035
+ }
1036
 
 
 
1037
 
1038
+ function apbct_sfw_update__process_file( $multifile_url, $url_count, $current_url, $updating_id ){
 
 
1039
 
1040
+ $result = SFW::update__write_to_db(
1041
+ DB::getInstance(),
1042
+ APBCT_TBL_FIREWALL_DATA . '_temp',
1043
+ 'https://' . str_replace( 'multifiles', $current_url, $multifile_url )
1044
+ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1045
 
1046
+ if( ! empty( $result['error'] ) ){
1047
+ array( 'error' => 'PROCESS FILE: ' . $result['error'] );
1048
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1049
 
1050
+ if( ! is_int( $result ) ){
1051
+ return array( 'error' => 'PROCESS FILE: WRONG RESPONSE FROM update__write_to_db' );
1052
+ }
1053
+
1054
+ return Helper::http__request__rc_to_host(
1055
+ 'sfw_update__worker',
1056
+ array(
1057
+ 'multifile_url' => str_replace( array( 'http://', 'https://' ), '', $multifile_url ),
1058
+ 'url_count' => $url_count,
1059
+ 'current_url' => ++ $current_url,
1060
+ 'firewall_updating_id' => $updating_id,
1061
+ ),
1062
+ array( 'async' )
1063
+ );
1064
+
1065
+ }
1066
+
1067
+ function apbct_sfw_update__process_exclusions( $multifile_url, $updating_id ){
1068
+
1069
+ $result = SFW::update__write_to_db__exclusions(
1070
+ DB::getInstance(),
1071
+ APBCT_TBL_FIREWALL_DATA . '_temp'
1072
+ );
1073
+
1074
+ if( ! empty( $result['error'] ) ){
1075
+ array( 'error' => 'EXCLUSIONS: ' . $result['error'] );
1076
+ }
1077
+
1078
+ if( ! is_int( $result ) ){
1079
+ return array( 'error' => 'EXCLUSIONS: WRONG_RESPONSE update__write_to_db__exclusions' );
 
 
 
 
 
 
 
 
 
1080
  }
1081
 
1082
+ return Helper::http__request__rc_to_host(
1083
+ 'sfw_update__worker',
1084
+ array(
1085
+ 'multifile_url' => str_replace( array( 'http://', 'https://' ), '', $multifile_url ),
1086
+ 'firewall_updating_id' => $updating_id,
1087
+ ),
1088
+ array( 'async' )
1089
+ );
1090
  }
1091
 
1092
  function ct_sfw_send_logs($api_key = '')
1574
  //Delete cookie for admin trial notice
1575
  function apbct__hook__wp_logout__delete_trial_notice_cookie(){
1576
  if(!headers_sent())
1577
+ Cleantalk\ApbctWP\Variables\Cookie::setNativeCookie('ct_trial_banner_closed', '', time()-3600);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1578
  }
1579
 
1580
  function apbct_store__urls(){
1585
 
1586
  // URLs HISTORY
1587
  // Get current url
1588
+ $current_url = Server::get( 'HTTP_HOST' ) . Server::get( 'REQUEST_URI' );
 
1589
  $current_url = $current_url ? substr($current_url, 0,256) : 'UNKNOWN';
1590
 
1591
  // Get already stored URLs
1592
+ $urls = \Cleantalk\ApbctWP\Variables\Cookie::get( 'apbct_urls', array() );
 
 
 
1593
  $urls[$current_url][] = time();
1594
 
1595
  // Rotating. Saving only latest 10
1597
  $urls = count($urls) > 10 ? array_slice($urls, 1, 10) : $urls;
1598
 
1599
  // Saving
1600
+ \Cleantalk\ApbctWP\Variables\Cookie::set('apbct_urls', json_encode($urls), time()+86400*3, '/', parse_url(get_option('siteurl'),PHP_URL_HOST), null, true, 'Lax');
 
 
1601
 
1602
  // REFERER
1603
  // Get current fererer
1605
  $new_site_referer = $new_site_referer ? $new_site_referer : 'UNKNOWN';
1606
 
1607
  // Get already stored referer
1608
+ $site_referer = \Cleantalk\ApbctWP\Variables\Cookie::get('apbct_site_referer' );
 
 
1609
 
1610
  // Save if empty
1611
  if( !$site_referer || parse_url($new_site_referer, PHP_URL_HOST) !== apbct_get_server_variable( 'HTTP_HOST' ) ){
1612
+ \Cleantalk\ApbctWP\Variables\Cookie::set('apbct_site_referer', $new_site_referer, time()+86400*3, '/', parse_url(get_option('siteurl'),PHP_URL_HOST), null, true, 'Lax');
 
 
 
1613
  }
1614
 
1615
  $apbct->flags__url_stored = true;
1617
  }
1618
  }
1619
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1620
  /*
1621
  * Set Cookies test for cookie test
1622
  * Sets cookies with pararms timestamp && landing_timestamp && pervious_referer
1626
 
1627
  global $apbct;
1628
 
 
 
 
1629
  if(
1630
  empty($apbct->settings['data__set_cookies']) || // Do not set cookies if option is disabled (for Varnish cache).
1631
  !empty($apbct->flags__cookies_setuped) || // Cookies already set
1654
  // Submit time
1655
  if(empty($_POST['ct_multipage_form'])){ // Do not start/reset page timer if it is multipage form (Gravitiy forms))
1656
  $apbct_timestamp = time();
1657
+ \Cleantalk\ApbctWP\Variables\Cookie::set('apbct_timestamp', $apbct_timestamp, 0, '/', $domain, null, true, 'Lax' );
 
 
1658
  $cookie_test_value['cookies_names'][] = 'apbct_timestamp';
1659
  $cookie_test_value['check_value'] .= $apbct_timestamp;
1660
  }
1661
 
1662
  // Pervious referer
1663
+ if( Server::get( 'HTTP_REFERER' ) ){
1664
+ \Cleantalk\ApbctWP\Variables\Cookie::set('apbct_prev_referer', Server::get( 'HTTP_REFERER' ), 0, '/', $domain, null, true, 'Lax' );
 
 
1665
  $cookie_test_value['cookies_names'][] = 'apbct_prev_referer';
1666
  $cookie_test_value['check_value'] .= apbct_get_server_variable( 'HTTP_REFERER' );
1667
  }
1668
 
1669
  // Landing time
1670
+ $site_landing_timestamp = \Cleantalk\ApbctWP\Variables\Cookie::get( 'apbct_site_landing_ts' );
 
 
1671
  if(!$site_landing_timestamp){
1672
  $site_landing_timestamp = time();
1673
+ \Cleantalk\ApbctWP\Variables\Cookie::set('apbct_site_landing_ts', $site_landing_timestamp, 0, '/', $domain, null, true, 'Lax' );
 
 
1674
  }
1675
  $cookie_test_value['cookies_names'][] = 'apbct_site_landing_ts';
1676
  $cookie_test_value['check_value'] .= $site_landing_timestamp;
1677
 
1678
  // Page hits
1679
  // Get
1680
+ $page_hits = \Cleantalk\ApbctWP\Variables\Cookie::get( 'apbct_page_hits' );
 
 
1681
  // Set / Increase
1682
  $page_hits = intval($page_hits) ? $page_hits + 1 : 1;
1683
 
1684
+ \Cleantalk\ApbctWP\Variables\Cookie::set('apbct_page_hits', $page_hits, 0, '/', $domain, null, true, 'Lax' );
 
 
1685
 
1686
  $cookie_test_value['cookies_names'][] = 'apbct_page_hits';
1687
  $cookie_test_value['check_value'] .= $page_hits;
1688
 
1689
  // Cookies test
1690
  $cookie_test_value['check_value'] = md5($cookie_test_value['check_value']);
1691
+ if( $apbct->settings['data__set_cookies'] == 1 )
1692
+ \Cleantalk\ApbctWP\Variables\Cookie::set('apbct_cookies_test', urlencode(json_encode($cookie_test_value)), 0, '/', $domain, null, true, 'Lax' );
1693
 
1694
  $apbct->flags__cookies_setuped = true;
1695
 
1704
  {
1705
  global $apbct;
1706
 
1707
+ if( $apbct->settings['data__set_cookies'] == 2 ){
1708
+ return 1;
1709
+ }
1710
 
1711
  if(isset($_COOKIE['apbct_cookies_test'])){
1712
 
1736
  * @return null|int;
1737
  */
1738
  function apbct_get_submit_time()
1739
+ {
1740
+ $apbct_timestamp = (int) \Cleantalk\ApbctWP\Variables\Cookie::get( 'apbct_timestamp' );
 
 
 
1741
  return apbct_cookies_test() === 1 && $apbct_timestamp !== 0 ? time() - $apbct_timestamp : null;
1742
  }
1743
 
css/cleantalk-dashboard-widget.min.css CHANGED
@@ -1 +1 @@
1
- #ct_widget_wrapper{position:relative;width:100%;height:100%}.ct_widget_top_links{text-align:right;padding:0 12px;height:32px}.ct_widget_settings_link{margin:0 0 0 10px}.ct_preloader{display:none;float:left;width:20px;height:20px;margin:0 10px}.ct_widget_hr{width:100%}.ct_widget_block_header{font-size:18px!important;margin-left:12px!important}.ct_widget_block{display:block;position:relative;padding:12px}.ct_widget_chart_wrapper{height:300px;margin-right:10px}.bar{fill:#4682b4}.bar:nth-child(odd){fill:rgba(50,50,250,.9)}.bar:hover{fill:brown}.axis--x path{display:none}.ct_widget_block table{width:100%;text-align:left}.ct_widget_block table tr{margin-bottom:10px}.ct_widget_activate_button,.ct_widget_button{display:block;margin:10px auto}.ct_widget_block table th{text-align:left;padding:10px 0 5px 10px;border-bottom:2px solid gray}.ct_widget_block table td{text-align:left;padding:10px 0 5px 10px;border-bottom:1px solid gray}.ct_widget_activate_button{padding:7px 15px;font-weight:600;border-radius:3px;border:2px solid #aaa;background:rgba(250,50,50,.9)}.ct_widget_resolve_button{background:rgba(50,250,50,.9)}.ct_widget_activate_header{display:inline-block;width:100%;text-align:center;font-size:18px!important}.ct_widget_wprapper_total_blocked{padding:10px 0 10px 10px;background:#f1f1f1}.ct_widget_wprapper_total_blocked span{position:relative;top:2px}.ct_widget_small_logo{margin-right:1em;vertical-align:middle}#ct_widget_button_view_all{cursor:pointer;border:1px solid #0074a2;-webkit-appearance:none;-webkit-border-radius:2px;border-radius:2px;white-space:nowrap;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;background:#0085ba;-webkit-box-shadow:inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);color:#fff}#ct_widget_button_view_all:hover{color:#000!important}
1
+ #ct_widget_wrapper{position:relative;width:100%;height:100%}.ct_widget_top_links{text-align:right;padding:0 12px;height:32px}.ct_widget_settings_link{margin:0 0 0 10px}.ct_preloader{display:none;float:left;width:20px;height:20px;margin:0 10px}.ct_widget_hr{width:100%}.ct_widget_block_header{font-size:18px!important;margin-left:12px!important}.ct_widget_block{display:block;position:relative;padding:12px}.ct_widget_chart_wrapper{height:300px;margin-right:10px}.bar{fill:#4682b4}.bar:nth-child(odd){fill:rgba(50,50,250,.9)}.bar:hover{fill:brown}.axis--x path{display:none}.ct_widget_block table{width:100%;text-align:left}.ct_widget_block table tr{margin-bottom:10px}.ct_widget_activate_button,.ct_widget_button{display:block;margin:10px auto}.ct_widget_block table th{text-align:left;padding:10px 0 5px 10px;border-bottom:2px solid gray}.ct_widget_block table td{text-align:left;padding:10px 0 5px 10px;border-bottom:1px solid gray}.ct_widget_activate_button{padding:7px 15px;font-weight:600;border-radius:3px;border:2px solid #aaa;background:rgba(250,50,50,.9)}.ct_widget_resolve_button{background:rgba(50,250,50,.9)}.ct_widget_activate_header{display:inline-block;width:100%;text-align:center;font-size:18px!important}.ct_widget_wprapper_total_blocked{padding:10px 0 10px 10px;background:#f1f1f1}.ct_widget_wprapper_total_blocked span{position:relative;top:2px}.ct_widget_small_logo{margin-right:1em;vertical-align:middle}#ct_widget_button_view_all{cursor:pointer;border:1px solid #0074a2;-webkit-appearance:none;-webkit-border-radius:2px;border-radius:2px;white-space:nowrap;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;background:#0085ba;-webkit-box-shadow:inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);color:#fff}#ct_widget_button_view_all:hover{color:#000!important}.ct_widget_block__country_cell{display:flex;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;align-items:center;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center}.ct_widget_block__country_cell img{margin-right:5px}
inc/cleantalk-admin.php CHANGED
@@ -16,7 +16,7 @@ add_action( 'admin_head','apbct_admin_set_cookie_for_anti_bot' );
16
 
17
  function apbct_admin_set_cookie_for_anti_bot(){
18
  global $apbct;
19
- echo '<script ' . ( class_exists('Cookiebot_WP') ? 'data-cookieconsent="ignore"' : '' ) . '>document.cookie = "apbct_antibot=' . hash( 'sha256', $apbct->api_key . $apbct->data['salt'] ) . '; path=/; expires=0; samesite=lax";</script>';
20
  }
21
 
22
  function apbct_add_buttons_to_comments_and_users( $unused_argument ) {
@@ -117,10 +117,12 @@ function ct_dashboard_statistics_widget_output( $post, $callback_args ) {
117
  <?php foreach($apbct->brief_data['top5_spam_ip'] as $val){ ?>
118
  <tr>
119
  <td><?php echo $val[0]; ?></td>
120
- <td><?php echo $val[1] ? "<img src='https://cleantalk.org/images/flags/".strtolower($val[1]).".png'>" : ''; ?>&nbsp;<?php
121
- echo $val[1]
122
- ? locale_get_display_region('sl-Latn-'.$val[1].'-nedis', substr(get_locale(), 0, 2))
123
- : 'Unknown'; ?></td>
 
 
124
  <td style='text-align: center;'><?php echo $val[2]; ?></td>
125
  </tr>
126
  <?php } ?>
@@ -171,15 +173,40 @@ function ct_dashboard_statistics_widget_output( $post, $callback_args ) {
171
  * Admin action 'admin_init' - Add the admin settings and such
172
  */
173
  function apbct_admin__init(){
174
-
175
  global $apbct;
176
-
177
  // Getting dashboard widget statistics
178
- if(!empty($_POST['ct_brief_refresh'])){
179
  $apbct->data['brief_data'] = \Cleantalk\ApbctWP\API::method__get_antispam_report_breif($apbct->api_key);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
180
  $apbct->saveData();
181
  }
182
-
183
  // Getting key like hoster. Only once!
184
  if(!is_main_site() && $apbct->white_label && ( empty($apbct->api_key) || $apbct->settings['apikey'] == $apbct->network_settings['apikey'] ) ){
185
  $res = apbct_settings__get_key_auto( true );
16
 
17
  function apbct_admin_set_cookie_for_anti_bot(){
18
  global $apbct;
19
+ echo '<script ' . ( class_exists('Cookiebot_WP') ? 'data-cookieconsent="ignore"' : '' ) . '>var ctSecure = location.protocol === "https:" ? "; secure" : ""; document.cookie = "apbct_antibot=' . hash( 'sha256', $apbct->api_key . $apbct->data['salt'] ) . '; path=/; expires=0; samesite=lax" + ctSecure;</script>';
20
  }
21
 
22
  function apbct_add_buttons_to_comments_and_users( $unused_argument ) {
117
  <?php foreach($apbct->brief_data['top5_spam_ip'] as $val){ ?>
118
  <tr>
119
  <td><?php echo $val[0]; ?></td>
120
+
121
+ <td class="ct_widget_block__country_cell">
122
+ <?php echo $val[1] ? "<img src='" . APBCT_URL_PATH . "/inc/images/flags/".strtolower( isset( $val[1]['country_code'] ) ? $val[1]['country_code'] : 'a1' ).".png'>" : ''; ?>
123
+ <?php echo isset( $val[1]['country_name'] ) ? $val[1]['country_name'] : 'Unknown'; ?>
124
+ </td>
125
+
126
  <td style='text-align: center;'><?php echo $val[2]; ?></td>
127
  </tr>
128
  <?php } ?>
173
  * Admin action 'admin_init' - Add the admin settings and such
174
  */
175
  function apbct_admin__init(){
 
176
  global $apbct;
177
+
178
  // Getting dashboard widget statistics
179
+ if(!empty($_POST['ct_brief_refresh'])){
180
  $apbct->data['brief_data'] = \Cleantalk\ApbctWP\API::method__get_antispam_report_breif($apbct->api_key);
181
+
182
+ # expanding data about the country
183
+ if(isset($apbct->data['brief_data']['top5_spam_ip']) && !empty($apbct->data['brief_data']['top5_spam_ip'])) {
184
+ foreach ($apbct->data['brief_data']['top5_spam_ip'] as $key => $ip_data) {
185
+ $ip = $ip_data[0];
186
+ $ip_data[1] = array(
187
+ 'country_name' => 'Unknown',
188
+ 'country_code' => 'cleantalk'
189
+ );
190
+
191
+ if(isset($ip)) {
192
+ $country_data = \Cleantalk\ApbctWP\API::method__ip_info($ip);
193
+ $country_data_clear = current($country_data);
194
+
195
+ if(is_array($country_data_clear) && isset($country_data_clear['country_name']) && isset($country_data_clear['country_code'])) {
196
+ $ip_data[1] = array(
197
+ 'country_name' => $country_data_clear['country_name'],
198
+ 'country_code' => (!preg_match('/[^A-Za-z0-9]/', $country_data_clear['country_code'])) ? $country_data_clear['country_code'] : 'cleantalk'
199
+ );
200
+ }
201
+ }
202
+
203
+ $apbct->data['brief_data']['top5_spam_ip'][$key] = $ip_data;
204
+ }
205
+ }
206
+
207
  $apbct->saveData();
208
  }
209
+
210
  // Getting key like hoster. Only once!
211
  if(!is_main_site() && $apbct->white_label && ( empty($apbct->api_key) || $apbct->settings['apikey'] == $apbct->network_settings['apikey'] ) ){
212
  $res = apbct_settings__get_key_auto( true );
inc/cleantalk-ajax.php CHANGED
@@ -164,7 +164,7 @@ function ct_validate_email_ajaxlogin($email=null, $is_ajax=true){
164
  $checkjs = apbct_js_test('ct_checkjs', $_POST);
165
  $sender_info['post_checkjs_passed'] = $checkjs;
166
  if ($checkjs === null){
167
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
168
  $sender_info['cookie_checkjs_passed'] = $checkjs;
169
  }
170
 
@@ -213,7 +213,7 @@ function ct_user_register_ajaxlogin($user_id)
213
  $checkjs = apbct_js_test('ct_checkjs', $_POST);
214
  $sender_info['post_checkjs_passed'] = $checkjs;
215
  if ($checkjs === null){
216
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
217
  $sender_info['cookie_checkjs_passed'] = $checkjs;
218
  }
219
 
@@ -368,7 +368,7 @@ function ct_ajax_hook($message_obj = false, $additional = false)
368
  $post_info['comment_type'] = 'feedback_ajax_external_form';
369
  }
370
 
371
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
372
 
373
  if(isset($_POST['user_login']))
374
  $sender_nickname = $_POST['user_login'];
164
  $checkjs = apbct_js_test('ct_checkjs', $_POST);
165
  $sender_info['post_checkjs_passed'] = $checkjs;
166
  if ($checkjs === null){
167
+ $checkjs = apbct_js_test('ct_checkjs', $_COOKIE, true);
168
  $sender_info['cookie_checkjs_passed'] = $checkjs;
169
  }
170
 
213
  $checkjs = apbct_js_test('ct_checkjs', $_POST);
214
  $sender_info['post_checkjs_passed'] = $checkjs;
215
  if ($checkjs === null){
216
+ $checkjs = apbct_js_test('ct_checkjs', $_COOKIE, true);
217
  $sender_info['cookie_checkjs_passed'] = $checkjs;
218
  }
219
 
368
  $post_info['comment_type'] = 'feedback_ajax_external_form';
369
  }
370
 
371
+ $checkjs = apbct_js_test('ct_checkjs', $_COOKIE, true);
372
 
373
  if(isset($_POST['user_login']))
374
  $sender_nickname = $_POST['user_login'];
inc/cleantalk-common.php CHANGED
@@ -66,7 +66,7 @@ $ct_negative_comment = null;
66
  $ct_server = NULL;
67
  $admin_email = NULL;
68
 
69
- add_action( 'wp_login', 'apbct_wp_login', 10, 2 );
70
 
71
  /**
72
  * Public action 'plugins_loaded' - Loads locale, see http://codex.wordpress.org/Function_Reference/load_plugin_textdomain
@@ -161,7 +161,7 @@ function apbct_base_call($params = array(), $reg_flag = false){
161
 
162
  // Misc
163
  'auth_key' => $apbct->api_key,
164
- 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE) ? 1 : apbct_js_test('ct_checkjs', $_POST),
165
 
166
  'agent' => APBCT_AGENT,
167
  'sender_info' => $sender_info,
@@ -408,17 +408,20 @@ function apbct_get_sender_info() {
408
  'checkjs_data_post' => !empty($checkjs_data_post) ? $checkjs_data_post : null,
409
  // PHP cookies
410
  'cookies_enabled' => $cookie_is_ok,
 
411
  'REFFERRER_PREVIOUS' => Cookie::get( 'apbct_prev_referer' ) && $cookie_is_ok ? Cookie::get( 'apbct_prev_referer' ) : null,
412
  'site_landing_ts' => Cookie::get( 'apbct_site_landing_ts' ) && $cookie_is_ok ? Cookie::get( 'apbct_site_landing_ts' ) : null,
413
  'page_hits' => Cookie::get( 'apbct_page_hits' ) ?: null,
414
  // JS cookies
415
- 'js_info' => !empty(Cookie::get( 'ct_user_info' )) ? json_decode(stripslashes(urldecode( Cookie::get( 'ct_user_info' ) )), true) : null,
416
- 'mouse_cursor_positions' => !empty(Cookie::get( 'ct_pointer_data' )) ? json_decode(stripslashes(Cookie::get( 'ct_pointer_data' )), true) : null,
417
  'js_timezone' => Cookie::get( 'ct_timezone' ) ?: null,
418
  'key_press_timestamp' => Cookie::get( 'ct_fkp_timestamp' ) ?: null,
419
  'page_set_timestamp' => Cookie::get( 'ct_ps_timestamp' ) ?: null,
420
  'form_visible_inputs' => !empty($visible_fields['visible_fields_count']) ? $visible_fields['visible_fields_count'] : null,
421
  'apbct_visible_fields' => !empty($visible_fields['visible_fields']) ? $visible_fields['visible_fields'] : null,
 
 
422
  // Misc
423
  'site_referer' => Cookie::get( 'apbct_site_referer' ) ?: null,
424
  'source_url' => Cookie::get( 'apbct_urls' ) ? json_encode( Cookie::get( 'apbct_urls' ) ) : null,
@@ -489,12 +492,9 @@ function apbct_visible_fields__process( $visible_fields ) {
489
  /*
490
  * Outputs JS key for AJAX-use only. Stops script.
491
  */
492
- function apbct_js_keys__get__ajax( $direct_call = false ){
493
-
494
- die(json_encode(array(
495
- 'js_key' => ct_get_checkjs_value()
496
- )));
497
-
498
  }
499
 
500
  /**
@@ -742,8 +742,8 @@ function ct_delete_spam_comments() {
742
  * @return array
743
  */
744
  function ct_get_fields_any($arr, $message=array(), $email = null, $nickname = array('nick' => '', 'first' => '', 'last' => ''), $subject = null, $contact = true, $prev_name = ''){
745
-
746
- //Skip request if fields exists
747
  $skip_params = array(
748
  'ipn_track_id', // PayPal IPN #
749
  'txn_type', // PayPal transaction type
@@ -824,55 +824,69 @@ function ct_get_fields_any($arr, $message=array(), $email = null, $nickname = ar
824
 
825
  if( apbct_array( array( $_POST, $_GET ) )->get_keys( $skip_params )->result() )
826
  $contact = false;
827
-
 
 
 
828
  if(count($arr)){
829
-
830
  foreach($arr as $key => $value){
831
-
832
  if( is_string( $value ) ){
833
-
834
  $tmp = strpos($value, '\\') !== false ? stripslashes($value) : $value;
835
-
 
 
 
836
  $decoded_json_value = json_decode($tmp, true); // Try parse JSON from the string
837
- parse_str( urldecode( $tmp ), $decoded_url_value ); // Try parse URL from the string
 
 
 
838
 
839
  // If there is "JSON data" set is it as a value
840
  if($decoded_json_value !== null){
 
 
 
 
 
841
  $value = $decoded_json_value;
842
-
843
  // If there is "URL data" set is it as a value
844
- }elseif( ! ( count( $decoded_url_value ) === 1 && reset( $decoded_url_value ) === '' ) ){
845
  $value = $decoded_url_value;
846
-
847
  // Ajax Contact Forms. Get data from such strings:
848
  // acfw30_name %% Blocked~acfw30_email %% s@cleantalk.org
849
  // acfw30_textarea %% msg
850
  }elseif(preg_match('/^\S+\s%%\s\S+.+$/', $value)){
851
-
852
  $value = explode('~', $value);
853
  foreach ($value as &$val){
854
  $tmp = explode(' %% ', $val);
855
  $val = array($tmp[0] => $tmp[1]);
856
  }unset( $val );
857
-
858
  }
859
  }
860
-
861
  if(!is_array($value) && !is_object($value)){
862
-
863
  if (in_array($key, $skip_params, true) && $key != 0 && $key != '' || preg_match("/^ct_checkjs/", $key))
864
  $contact = false;
865
-
866
  if($value === '')
867
  continue;
868
-
869
  // Skipping fields names with strings from (array)skip_fields_with_strings
870
  foreach($skip_fields_with_strings as $needle){
871
  if (preg_match("/".$needle."/", $prev_name.$key) == 1){
872
  continue(2);
873
  }
874
  }unset($needle);
875
-
876
  // Obfuscating params
877
  foreach($obfuscate_params as $needle){
878
  if (strpos($key, $needle) !== false){
@@ -882,21 +896,28 @@ function ct_get_fields_any($arr, $message=array(), $email = null, $nickname = ar
882
  }unset($needle);
883
 
884
  $value_for_email = trim( strip_shortcodes( $value ) ); // Removes shortcodes to do better spam filtration on server side.
885
-
886
  // Email
887
  if ( ! $email && preg_match( "/^\S+@\S+\.\S+$/", $value_for_email ) ) {
888
  $email = $value_for_email;
889
 
890
  // Removes whitespaces
891
  $value = urldecode( trim( strip_shortcodes( $value ) ) ); // Fully cleaned message
892
-
893
  // Names
894
- }elseif (preg_match("/name/i", $key)){
895
-
 
 
 
 
 
 
 
896
  preg_match("/((name.?)?(your|first|for)(.?name)?)/", $key, $match_forename);
897
  preg_match("/((name.?)?(last|family|second|sur)(.?name)?)/", $key, $match_surname);
898
  preg_match("/(name.?)?(nick|user)(.?name)?/", $key, $match_nickname);
899
-
900
  if(count($match_forename) > 1)
901
  $nickname['first'] = $value;
902
  elseif(count($match_surname) > 1)
@@ -905,26 +926,24 @@ function ct_get_fields_any($arr, $message=array(), $email = null, $nickname = ar
905
  $nickname['nick'] = $value;
906
  else
907
  $message[$prev_name.$key] = $value;
908
-
909
  // Subject
910
  }elseif ($subject === null && preg_match("/subject/i", $key)){
911
  $subject = $value;
912
-
913
  // Message
914
  }else{
915
- $message[$prev_name.$key] = $value;
916
  }
917
-
918
  }elseif(!is_object($value)){
919
-
920
  $prev_name_original = $prev_name;
921
  $prev_name = ($prev_name === '' ? $key.'_' : $prev_name.$key.'_');
922
-
923
  $temp = ct_get_fields_any($value, $message, $email, $nickname, $subject, $contact, $prev_name);
924
-
925
  $message = $temp['message'];
926
  $email = ($temp['email'] ? $temp['email'] : null);
927
- $nickname = ($temp['nickname'] ? $temp['nickname'] : null);
928
  $subject = ($temp['subject'] ? $temp['subject'] : null);
929
  if($contact === true)
930
  $contact = ($temp['contact'] === false ? false : true);
@@ -957,7 +976,7 @@ function ct_get_fields_any($arr, $message=array(), $email = null, $nickname = ar
957
  'subject' => $subject,
958
  'contact' => $contact,
959
  'message' => $message
960
- );
961
  return $return_param;
962
  }
963
 
@@ -1083,42 +1102,45 @@ function apbct_add_async_attribute($tag, $handle, $src) {
1083
  return $tag;
1084
  }
1085
 
1086
- function apbct_wp_login( $user_login, $user ) {
1087
 
1088
  global $apbct;
1089
-
1090
- // Break if the SpamFireWall is inactive
1091
- if( $apbct->settings['sfw__enabled'] != 1 &&
1092
- ! apbct_is_get() &&
1093
- apbct_wp_doing_cron()
1094
- ){
1095
- return;
1096
- }
1097
-
1098
  $ip = Helper::ip__get( 'real', true );
1099
-
1100
- if( Cookie::get( 'ct_sfw_ip_wl' ) && Cookie::get( 'ct_sfw_ip_wl' ) === md5( $ip . $apbct->api_key ) ) {
1101
- return;
1102
- }
1103
-
1104
- if( in_array( 'administrator', (array) $user->roles ) ) {
1105
- $res = apbct_private_list_add( $ip );
1106
- if( $res ) {
1107
- if( ! headers_sent() ) {
1108
- $cookie_val = md5( $ip . $apbct->api_key );
1109
- \Cleantalk\Common\Helper::apbct_cookie__set( 'ct_sfw_ip_wl', $cookie_val, time() + 86400 * 30, '/', null, false, true, 'Lax' );
1110
- }
1111
- apbct_sfw_update__init();
1112
- }
1113
- }
 
 
 
 
 
 
 
1114
 
1115
  }
1116
 
1117
- function apbct_private_list_add( $ip ) {
1118
- global $apbct;
1119
- if( Helper::ip__validate( $ip ) !== false ) {
1120
- $res = API::method__private_list_add__sfw_wl( $apbct->data['user_token'], $ip, $apbct->data['service_id'] );
1121
- return isset( $res['records'][0]['operation_status'] ) && $res['records'][0]['operation_status'] === 'SUCCESS';
1122
- }
1123
- return false;
 
 
 
1124
  }
66
  $ct_server = NULL;
67
  $admin_email = NULL;
68
 
69
+ add_action( 'wp_login', 'apbct_add_admin_ip_to_swf_whitelist', 10, 2 );
70
 
71
  /**
72
  * Public action 'plugins_loaded' - Loads locale, see http://codex.wordpress.org/Function_Reference/load_plugin_textdomain
161
 
162
  // Misc
163
  'auth_key' => $apbct->api_key,
164
+ 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE, true) ? 1 : apbct_js_test('ct_checkjs', $_POST),
165
 
166
  'agent' => APBCT_AGENT,
167
  'sender_info' => $sender_info,
408
  'checkjs_data_post' => !empty($checkjs_data_post) ? $checkjs_data_post : null,
409
  // PHP cookies
410
  'cookies_enabled' => $cookie_is_ok,
411
+ 'data__set_cookies' => $apbct->settings['data__set_cookies'],
412
  'REFFERRER_PREVIOUS' => Cookie::get( 'apbct_prev_referer' ) && $cookie_is_ok ? Cookie::get( 'apbct_prev_referer' ) : null,
413
  'site_landing_ts' => Cookie::get( 'apbct_site_landing_ts' ) && $cookie_is_ok ? Cookie::get( 'apbct_site_landing_ts' ) : null,
414
  'page_hits' => Cookie::get( 'apbct_page_hits' ) ?: null,
415
  // JS cookies
416
+ 'js_info' => Cookie::get( 'ct_user_info', null ),
417
+ 'mouse_cursor_positions' => Cookie::get( 'ct_pointer_data', null ),
418
  'js_timezone' => Cookie::get( 'ct_timezone' ) ?: null,
419
  'key_press_timestamp' => Cookie::get( 'ct_fkp_timestamp' ) ?: null,
420
  'page_set_timestamp' => Cookie::get( 'ct_ps_timestamp' ) ?: null,
421
  'form_visible_inputs' => !empty($visible_fields['visible_fields_count']) ? $visible_fields['visible_fields_count'] : null,
422
  'apbct_visible_fields' => !empty($visible_fields['visible_fields']) ? $visible_fields['visible_fields'] : null,
423
+ 'form_invisible_inputs' => !empty($visible_fields['invisible_fields_count']) ? $visible_fields['invisible_fields_count'] : null,
424
+ 'apbct_invisible_fields' => !empty($visible_fields['invisible_fields']) ? $visible_fields['invisible_fields'] : null,
425
  // Misc
426
  'site_referer' => Cookie::get( 'apbct_site_referer' ) ?: null,
427
  'source_url' => Cookie::get( 'apbct_urls' ) ? json_encode( Cookie::get( 'apbct_urls' ) ) : null,
492
  /*
493
  * Outputs JS key for AJAX-use only. Stops script.
494
  */
495
+ function apbct_js_keys__get__ajax( $request ){
496
+
497
+ die( json_encode( array( 'js_key' => ct_get_checkjs_value() ) ) );
 
 
 
498
  }
499
 
500
  /**
742
  * @return array
743
  */
744
  function ct_get_fields_any($arr, $message=array(), $email = null, $nickname = array('nick' => '', 'first' => '', 'last' => ''), $subject = null, $contact = true, $prev_name = ''){
745
+
746
+ //Skip request if fields exists
747
  $skip_params = array(
748
  'ipn_track_id', // PayPal IPN #
749
  'txn_type', // PayPal transaction type
824
 
825
  if( apbct_array( array( $_POST, $_GET ) )->get_keys( $skip_params )->result() )
826
  $contact = false;
827
+
828
+ $visible_fields = apbct_visible_fields__process( Cookie::get( 'apbct_visible_fields' ) );
829
+ $visible_fields_arr = isset( $visible_fields['visible_fields'] ) ? explode( ' ', $visible_fields['visible_fields'] ) : array();
830
+
831
  if(count($arr)){
832
+
833
  foreach($arr as $key => $value){
834
+
835
  if( is_string( $value ) ){
836
+
837
  $tmp = strpos($value, '\\') !== false ? stripslashes($value) : $value;
838
+
839
+ # Remove html tags from $value
840
+ $tmp = preg_replace( '@<.*?>@', '', $tmp);
841
+
842
  $decoded_json_value = json_decode($tmp, true); // Try parse JSON from the string
843
+ if( strpos( $value, "\n" ) === false || strpos( $value, "\r" ) === false ) {
844
+ // Parse an only single-lined string
845
+ parse_str( urldecode( $tmp ), $decoded_url_value ); // Try parse URL from the string
846
+ }
847
 
848
  // If there is "JSON data" set is it as a value
849
  if($decoded_json_value !== null){
850
+
851
+ if(isset($arr['action']) && $arr['action'] === 'nf_ajax_submit') {
852
+ unset($decoded_json_value['settings']);
853
+ }
854
+
855
  $value = $decoded_json_value;
856
+
857
  // If there is "URL data" set is it as a value
858
+ }elseif( isset( $decoded_url_value ) && ! ( count( $decoded_url_value ) === 1 && reset( $decoded_url_value ) === '' ) ){
859
  $value = $decoded_url_value;
860
+
861
  // Ajax Contact Forms. Get data from such strings:
862
  // acfw30_name %% Blocked~acfw30_email %% s@cleantalk.org
863
  // acfw30_textarea %% msg
864
  }elseif(preg_match('/^\S+\s%%\s\S+.+$/', $value)){
865
+
866
  $value = explode('~', $value);
867
  foreach ($value as &$val){
868
  $tmp = explode(' %% ', $val);
869
  $val = array($tmp[0] => $tmp[1]);
870
  }unset( $val );
871
+
872
  }
873
  }
874
+
875
  if(!is_array($value) && !is_object($value)){
876
+
877
  if (in_array($key, $skip_params, true) && $key != 0 && $key != '' || preg_match("/^ct_checkjs/", $key))
878
  $contact = false;
879
+
880
  if($value === '')
881
  continue;
882
+
883
  // Skipping fields names with strings from (array)skip_fields_with_strings
884
  foreach($skip_fields_with_strings as $needle){
885
  if (preg_match("/".$needle."/", $prev_name.$key) == 1){
886
  continue(2);
887
  }
888
  }unset($needle);
889
+
890
  // Obfuscating params
891
  foreach($obfuscate_params as $needle){
892
  if (strpos($key, $needle) !== false){
896
  }unset($needle);
897
 
898
  $value_for_email = trim( strip_shortcodes( $value ) ); // Removes shortcodes to do better spam filtration on server side.
899
+
900
  // Email
901
  if ( ! $email && preg_match( "/^\S+@\S+\.\S+$/", $value_for_email ) ) {
902
  $email = $value_for_email;
903
 
904
  // Removes whitespaces
905
  $value = urldecode( trim( strip_shortcodes( $value ) ) ); // Fully cleaned message
906
+
907
  // Names
908
+ // if there is an visible fields array then we take the name from it,
909
+ // ignoring the hidden fields with name
910
+ }elseif (
911
+ preg_match("/name/i", $key) !== false &&
912
+ (
913
+ empty($visible_fields_arr) ||
914
+ in_array($key, $visible_fields_arr)
915
+ )
916
+ ) {
917
  preg_match("/((name.?)?(your|first|for)(.?name)?)/", $key, $match_forename);
918
  preg_match("/((name.?)?(last|family|second|sur)(.?name)?)/", $key, $match_surname);
919
  preg_match("/(name.?)?(nick|user)(.?name)?/", $key, $match_nickname);
920
+
921
  if(count($match_forename) > 1)
922
  $nickname['first'] = $value;
923
  elseif(count($match_surname) > 1)
926
  $nickname['nick'] = $value;
927
  else
928
  $message[$prev_name.$key] = $value;
 
929
  // Subject
930
  }elseif ($subject === null && preg_match("/subject/i", $key)){
931
  $subject = $value;
932
+
933
  // Message
934
  }else{
935
+ $message[$prev_name.$key] = $value;
936
  }
937
+
938
  }elseif(!is_object($value)){
 
939
  $prev_name_original = $prev_name;
940
  $prev_name = ($prev_name === '' ? $key.'_' : $prev_name.$key.'_');
941
+
942
  $temp = ct_get_fields_any($value, $message, $email, $nickname, $subject, $contact, $prev_name);
943
+
944
  $message = $temp['message'];
945
  $email = ($temp['email'] ? $temp['email'] : null);
946
+ $nickname = ($temp['nickname'] ? $temp['nickname'] : null);
947
  $subject = ($temp['subject'] ? $temp['subject'] : null);
948
  if($contact === true)
949
  $contact = ($temp['contact'] === false ? false : true);
976
  'subject' => $subject,
977
  'contact' => $contact,
978
  'message' => $message
979
+ );
980
  return $return_param;
981
  }
982
 
1102
  return $tag;
1103
  }
1104
 
1105
+ function apbct_add_admin_ip_to_swf_whitelist( $user_login, $user ) {
1106
 
1107
  global $apbct;
1108
+
1109
+ $user = ! $user instanceof WP_User ? apbct_wp_get_current_user() : $user;
 
 
 
 
 
 
 
1110
  $ip = Helper::ip__get( 'real', true );
1111
+
1112
+ if(
1113
+ $apbct->settings['sfw__enabled'] && // Break if the SpamFireWall is inactive
1114
+ Server::isGet() &&
1115
+ ! apbct_wp_doing_cron() &&
1116
+ in_array( 'administrator', (array) $user->roles, true ) &&
1117
+ Cookie::get( 'ct_sfw_ip_wl' ) !== md5( $ip . $apbct->api_key ) &&
1118
+ \Cleantalk\ApbctWP\Firewall\SFW::update__write_to_db__exclusions( \Cleantalk\Common\DB::getInstance(), APBCT_TBL_FIREWALL_DATA, array( $ip ) ) &&
1119
+ apbct_private_list_add( $ip ) &&
1120
+ ! headers_sent()
1121
+ ) {
1122
+ \Cleantalk\ApbctWP\Variables\Cookie::set(
1123
+ 'ct_sfw_ip_wl',
1124
+ md5( $ip . $apbct->api_key ),
1125
+ time() + 86400 * 30,
1126
+ '/',
1127
+ null,
1128
+ null,
1129
+ true,
1130
+ 'Lax'
1131
+ );
1132
+ }
1133
 
1134
  }
1135
 
1136
+ function apbct_private_list_add( $ip ){
1137
+
1138
+ global $apbct;
1139
+
1140
+ if( Helper::ip__validate( $ip ) ){
1141
+ $result = API::method__private_list_add__sfw_wl( $apbct->data['user_token'], $ip, $apbct->data['service_id'] );
1142
+ return empty( $result['error'] );
1143
+ }
1144
+
1145
+ return false;
1146
  }
inc/cleantalk-pluggable.php CHANGED
@@ -404,12 +404,12 @@ function apbct_is_skip_request( $ajax = false ) {
404
  {
405
  return 'injob_theme_plugin';
406
  }
407
- // Divi builder save epanel
408
  if ( apbct_is_theme_active( 'Divi' ) &&
409
  isset( $_POST['action'] ) &&
410
- $_POST['action'] == 'save_epanel' )
411
  {
412
- return 'divi_builder_save_epanel';
413
  }
414
  // Email Before Download plugin https://wordpress.org/plugins/email-before-download/ action skip
415
  if ( apbct_is_plugin_active( 'email-before-download/email-before-download.php' ) &&
@@ -465,7 +465,18 @@ function apbct_is_skip_request( $ajax = false ) {
465
  {
466
  return 'emember_ajax_login';
467
  }
468
-
 
 
 
 
 
 
 
 
 
 
 
469
  break;
470
 
471
  case false :
404
  {
405
  return 'injob_theme_plugin';
406
  }
407
+ // Divi builder skip
408
  if ( apbct_is_theme_active( 'Divi' ) &&
409
  isset( $_POST['action'] ) &&
410
+ ( $_POST['action'] === 'save_epanel' || $_POST['action'] === 'et_fb_ajax_save' ) )
411
  {
412
+ return 'divi_builder_skip';
413
  }
414
  // Email Before Download plugin https://wordpress.org/plugins/email-before-download/ action skip
415
  if ( apbct_is_plugin_active( 'email-before-download/email-before-download.php' ) &&
465
  {
466
  return 'emember_ajax_login';
467
  }
468
+ // Avada theme saving settings
469
+ if ( apbct_is_theme_active( 'Avada' ) &&
470
+ Post::get('action') === 'fusion_options_ajax_save' )
471
+ {
472
+ return 'Avada_theme_saving_settings';
473
+ }
474
+ // Formidable skip - this is the durect integration
475
+ if ( apbct_is_plugin_active( 'formidable/formidable.php' ) &&
476
+ Post::get( 'action' ) === 'frm_entries_update' )
477
+ {
478
+ return 'formidable_skip';
479
+ }
480
  break;
481
 
482
  case false :
inc/cleantalk-public.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  /**
4
  * Init functions
5
  * @return mixed[] Array of options
@@ -135,6 +137,9 @@ function apbct_init() {
135
  if( isset($_REQUEST['wc-ajax']) && $_REQUEST['wc-ajax'] == 'checkout' && empty( $apbct->settings['forms__wc_register_from_order'] ) ){
136
  remove_filter( 'woocommerce_registration_errors', 'ct_registration_errors', 1 );
137
  }
 
 
 
138
  }
139
 
140
  // WooCommerce whishlist
@@ -348,11 +353,61 @@ function apbct_buffer__end(){
348
  */
349
  function apbct_buffer__output(){
350
 
351
- global $apbct, $wp;
352
 
353
- if(empty($apbct->buffer))
354
  return;
355
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
356
  $site_url = get_option('siteurl');
357
  $site__host = parse_url($site_url, PHP_URL_HOST);
358
 
@@ -395,13 +450,11 @@ function apbct_buffer__output(){
395
  } unset($form);
396
 
397
  $html = $dom->getElementsByTagName('html');
398
-
399
- $output = gettype($html) == 'object' && isset($html[0], $html[0]->childNodes, $html[0]->childNodes[0]) && $dom->getElementsByTagName('rss')->length == 0
400
  ? $dom->saveHTML()
401
  : $apbct->buffer;
402
-
403
- echo $output;
404
- die();
405
  }
406
 
407
  // MailChimp Premium for Wordpress
@@ -485,8 +538,8 @@ function ct_validate_ccf_submission($value, $field_id, $required){
485
  $post_info['comment_type'] = 'feedback_custom_contact_forms';
486
  $post_info['post_url'] = apbct_get_server_variable( 'HTTP_REFERER' );
487
 
488
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
489
- ? apbct_js_test('ct_checkjs', $_COOKIE)
490
  : apbct_js_test('ct_checkjs', $_POST);
491
 
492
  //Making a call
@@ -539,8 +592,8 @@ function ct_woocommerce_wishlist_check($args){
539
  $post_info['comment_type'] = 'feedback';
540
  $post_info['post_url'] = apbct_get_server_variable( 'HTTP_REFERER' );
541
 
542
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
543
- ? apbct_js_test('ct_checkjs', $_COOKIE)
544
  : apbct_js_test('ct_checkjs', $_POST);
545
 
546
  //Making a call
@@ -605,7 +658,7 @@ function apbct_integration__buddyPres__activityWall( $is_spam, $activity_obj = n
605
  'post_url' => apbct_get_server_variable( 'HTTP_REFERER' ),
606
  'comment_type' => 'buddypress_activitywall',
607
  ),
608
- 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE),
609
  'sender_info' => array('sender_url' => null),
610
  )
611
  );
@@ -707,8 +760,8 @@ function apbct_integration__buddyPres__private_msg_check( $bp_message_obj){
707
  'comment_type' => 'buddypress_comment',
708
  'post_url' => apbct_get_server_variable( 'HTTP_REFERER' ),
709
  ),
710
- 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE)
711
- ? apbct_js_test('ct_checkjs', $_COOKIE)
712
  : apbct_js_test('ct_checkjs', $_POST),
713
  'sender_info' => array('sender_url' => null),
714
  )
@@ -825,7 +878,7 @@ function ct_woocommerce_checkout_check() {
825
  'sender_email' => $sender_email,
826
  'sender_nickname' => $sender_nickname,
827
  'post_info' => $post_info,
828
- 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE),
829
  'sender_info' => array('sender_url' => null),
830
  )
831
  );
@@ -846,6 +899,62 @@ function ct_woocommerce_checkout_check() {
846
  }
847
  }
848
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
849
  /**
850
  * Public function - Tests for Pirate contact froms
851
  * return NULL
@@ -883,7 +992,7 @@ function apbct_form__piratesForm__testSpam(){
883
  'sender_email' => $sender_email,
884
  'sender_nickname' => $sender_nickname,
885
  'post_info' => $post_info,
886
- 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE),
887
  'sender_info' => array('sender_url' => null),
888
  )
889
  );
@@ -974,15 +1083,14 @@ function ct_add_hidden_fields($field_name = 'ct_checkjs', $return_string = false
974
  $field_id_hash = md5(rand(0, 1000));
975
 
976
  // Using only cookies
977
- if ($cookie_check && $apbct->settings['data__set_cookies'] == 1) {
978
-
979
  $html = "<script type=\"text/javascript\" " . ( class_exists('Cookiebot_WP') ? 'data-cookieconsent="ignore"' : '' ) . ">
980
  function apbct_attach_event_handler__backend(elem, event, callback){
981
  if(typeof window.addEventListener === \"function\") elem.addEventListener(event, callback);
982
  else elem.attachEvent(event, callback);
983
  }
984
  apbct_attach_event_handler__backend(window, 'load', function(){
985
- ctSetCookie('{$field_name}', '{$ct_checkjs_key}', '{$ct_checkjs_def}');
986
  });
987
  </script>";
988
 
@@ -1113,8 +1221,8 @@ function apbct_rorm__formidable__testSpam ( $errors, $form ) {
1113
  // Combine it with non-scalar values
1114
  $message = array_merge( $tmp_message, $tmp_message2 );
1115
 
1116
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
1117
- ? apbct_js_test('ct_checkjs', $_COOKIE)
1118
  : apbct_js_test('ct_checkjs', $_POST);
1119
 
1120
  $base_call_result = apbct_base_call(
@@ -1171,8 +1279,8 @@ function ct_bbp_new_pre_content ($comment) {
1171
  }
1172
 
1173
 
1174
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
1175
- ? apbct_js_test('ct_checkjs', $_COOKIE)
1176
  : apbct_js_test('ct_checkjs', $_POST);
1177
 
1178
  $post_info['comment_type'] = 'bbpress_comment';
@@ -1359,8 +1467,8 @@ function ct_preprocess_comment($comment) {
1359
  // Comment type
1360
  $post_info['comment_type'] = empty($post_info['comment_type']) ? 'general_comment' : $post_info['comment_type'];
1361
 
1362
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
1363
- ? apbct_js_test('ct_checkjs', $_COOKIE)
1364
  : apbct_js_test('ct_checkjs', $_POST);
1365
 
1366
 
@@ -1633,15 +1741,20 @@ function ct_die_extended($comment_body) {
1633
  *
1634
  * @return int|null
1635
  */
1636
- function apbct_js_test($field_name = 'ct_checkjs', $data = null) {
1637
 
1638
  global $apbct;
1639
-
1640
  $out = null;
1641
 
1642
- if($data && isset($data[$field_name])){
1643
-
1644
- $js_key = trim($data[$field_name]);
 
 
 
 
 
1645
 
1646
  // Check static key
1647
  if(
@@ -1908,7 +2021,7 @@ function ct_test_message($nickname, $email, $ip, $text){
1908
  'sender_email' => $email,
1909
  'sender_nickname' => $nickname,
1910
  'post_info' => array('comment_type' => 'feedback_plugin_check'),
1911
- 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE),
1912
  )
1913
  );
1914
 
@@ -1933,7 +2046,7 @@ function ct_test_registration($nickname, $email, $ip = null){
1933
  $checkjs = apbct_js_test($ct_checkjs_register_form, $_POST);
1934
  $sender_info['post_checkjs_passed'] = $checkjs;
1935
  }else{
1936
- $checkjs = $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
1937
  $sender_info['cookie_checkjs_passed'] = $checkjs;
1938
  }
1939
 
@@ -2022,13 +2135,13 @@ function ct_registration_errors($errors, $sanitized_user_login = null, $user_ema
2022
 
2023
 
2024
  if(current_filter() == 'woocommerce_registration_errors'){
2025
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
2026
  $checkjs_post = null;
2027
  $checkjs_cookie = $checkjs;
2028
  }else{
2029
  // This hack can be helpfull when plugin uses with untested themes&signups plugins.
2030
  $checkjs_post = apbct_js_test($ct_checkjs_register_form, $_POST);
2031
- $checkjs_cookie = apbct_js_test('ct_checkjs', $_COOKIE);
2032
  $checkjs = $checkjs_cookie ? $checkjs_cookie : $checkjs_post;
2033
  }
2034
 
@@ -2095,8 +2208,8 @@ function ct_registration_errors($errors, $sanitized_user_login = null, $user_ema
2095
  } else {
2096
  if ($ct_result->id !== null) {
2097
  $apbct_cookie_request_id = $ct_result->id;
2098
- \Cleantalk\Common\Helper::apbct_cookie__set($apbct_cookie_register_ok_label, $ct_result->id, time()+10, '/');
2099
- \Cleantalk\Common\Helper::apbct_cookie__set($apbct_cookie_request_id_label, $ct_result->id, time()+10, '/');
2100
  }
2101
  }
2102
 
@@ -2164,7 +2277,7 @@ function apbct_registration__UltimateMembers__check( $args ){
2164
 
2165
  // This hack can be helpfull when plugin uses with untested themes&signups plugins.
2166
  if ($checkjs == 0) {
2167
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
2168
  $sender_info['cookie_checkjs_passed'] = $checkjs;
2169
  }
2170
 
@@ -2233,7 +2346,7 @@ function apbct_user_register($user_id) {
2233
 
2234
  if ( isset($_COOKIE[$apbct_cookie_request_id_label]) ) {
2235
  if(update_user_meta($user_id, 'ct_hash', $_COOKIE[$apbct_cookie_request_id_label])){
2236
- \Cleantalk\Common\Helper::apbct_cookie__set($apbct_cookie_request_id_label, '0', 1, '/');
2237
  }
2238
  return;
2239
  }
@@ -2420,7 +2533,7 @@ function apbct_form__contactForm7__testSpam( $spam, $submission = null ) {
2420
 
2421
  $checkjs = apbct_js_test($ct_checkjs_cf7, $_POST)
2422
  ? apbct_js_test($ct_checkjs_cf7, $_POST)
2423
- : apbct_js_test('ct_checkjs', $_COOKIE);
2424
 
2425
  $ct_temp_msg_data = ct_get_fields_any($_POST);
2426
 
@@ -2541,7 +2654,7 @@ function apbct_form__ninjaForms__testSpam() {
2541
  return;
2542
  }
2543
 
2544
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
2545
 
2546
  // Choosing between POST and GET
2547
  $params = ct_get_fields_any(isset($_GET['ninja_forms_ajax_submit']) || isset($_GET['nf_ajax_submit']) ? $_GET : $_POST);
@@ -2878,7 +2991,7 @@ function ct_quform_post_validate($result, $form) {
2878
  // @ToDo If we have several emails at the form - will be used only the first detected!
2879
  $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
2880
 
2881
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
2882
  $base_call_result = apbct_base_call(
2883
  array(
2884
  'message' => $form->getValues(),
@@ -2890,7 +3003,7 @@ function ct_quform_post_validate($result, $form) {
2890
 
2891
  $ct_result = $base_call_result['ct_result'];
2892
  if ($ct_result->allow == 0) {
2893
- die(json_encode(array('type' => 'error', 'apbct' => array('blocked' => true, 'comment' => $ct_result->comment))));
2894
  } else {
2895
  return $result;
2896
  }
@@ -3037,7 +3150,7 @@ function ct_check_wplp(){
3037
  $cleantalk_comment = 'OK';
3038
  }
3039
 
3040
- \Cleantalk\Common\Helper::apbct_cookie__set($ct_wplp_result_label, $cleantalk_comment, strtotime("+5 seconds"), '/');
3041
  } else {
3042
  // Next POST/AJAX submit(s) of same WPLP form
3043
  $cleantalk_comment = $_COOKIE[$ct_wplp_result_label];
@@ -3087,13 +3200,69 @@ function apbct_form__gravityForms__testSpam($is_spam, $form, $entry) {
3087
  return $is_spam;
3088
  }
3089
 
3090
- $ct_temp = array();
3091
- foreach($entry as $key => $value){
3092
- if(is_numeric($key))
3093
- $ct_temp[$key]=$value;
3094
- } unset($key, $value);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3095
 
3096
- $ct_temp_msg_data = ct_get_fields_any($ct_temp);
3097
  $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
3098
  $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
3099
  $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
@@ -3112,7 +3281,7 @@ function apbct_form__gravityForms__testSpam($is_spam, $form, $entry) {
3112
 
3113
  $checkjs = apbct_js_test('ct_checkjs', $_POST)
3114
  ? apbct_js_test('ct_checkjs', $_POST)
3115
- : apbct_js_test('ct_checkjs', $_COOKIE);
3116
 
3117
  $base_call_result = apbct_base_call(
3118
  array(
@@ -3320,7 +3489,7 @@ function apbct_form__inevio__testSpam() {
3320
  $ct_result = $base_call_result['ct_result'];
3321
 
3322
  if ( $ct_result->allow == 0 ) {
3323
- die(json_encode(array('apbct' => array('blocked' => true, 'comment' => $ct_result->comment,))));
3324
  }
3325
 
3326
  return true;
@@ -3417,7 +3586,13 @@ function ct_contact_form_validate() {
3417
  \Cleantalk\Variables\Post::get('action') === 'frm_get_lookup_text_value' || // Exception for Formidable multilevel form
3418
  ( isset( $_POST['ihcaction'] ) && $_POST['ihcaction'] == 'reset_pass') || //Reset pass exclusion
3419
  ( isset( $_POST['action'], $_POST['register_unspecified_nonce_field'] ) && $_POST['action'] == 'register' ) || // Profile Builder have a direct integration
3420
- ( isset( $_POST['_wpmem_register_nonce'] ) && wp_verify_nonce( $_POST['_wpmem_register_nonce'], 'wpmem_longform_nonce' ) ) // WP Members have a direct integration
 
 
 
 
 
 
3421
  /* !! Do not add actions here. Use apbct_is_skip_request() function below !! */
3422
  ) {
3423
  do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
@@ -3794,7 +3969,17 @@ function ct_enqueue_scripts_public($hook){
3794
  return;
3795
  }
3796
 
3797
- if($apbct->settings['forms__registrations_test'] || $apbct->settings['forms__comments_test'] || $apbct->settings['forms__contact_forms_test'] || $apbct->settings['forms__general_contact_forms_test'] || $apbct->settings['forms__wc_checkout_test'] || $apbct->settings['forms__check_external'] || $apbct->settings['forms__check_internal'] || $apbct->settings['comments__bp_private_messages'] || $apbct->settings['data__general_postdata_test']){
 
 
 
 
 
 
 
 
 
 
3798
 
3799
  if( ! $apbct->public_script_loaded ) {
3800
 
@@ -3808,9 +3993,36 @@ function ct_enqueue_scripts_public($hook){
3808
  '_ajax_url' => admin_url('admin-ajax.php'),
3809
  '_rest_url' => esc_url( get_rest_url() ),
3810
  'data__set_cookies' => $apbct->settings['data__set_cookies'],
3811
- 'data__set_cookies__sessions' => $apbct->settings['data__set_cookies__sessions'],
3812
  ));
3813
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3814
 
3815
  // GDPR script
3816
  if($apbct->settings['gdpr__enabled']){
@@ -3824,35 +4036,16 @@ function ct_enqueue_scripts_public($hook){
3824
  }
3825
 
3826
  }
3827
-
3828
- if(!defined('CLEANTALK_AJAX_USE_FOOTER_HEADER') || (defined('CLEANTALK_AJAX_USE_FOOTER_HEADER') && CLEANTALK_AJAX_USE_FOOTER_HEADER)){
3829
- if($apbct->settings['data__use_ajax'] && ! apbct_is_in_uri('.xml') && ! apbct_is_in_uri('.xsl')){
3830
- if( ! apbct_is_in_uri('jm-ajax') ){
3831
-
3832
- // Use AJAX for JavaScript check
3833
- if($apbct->settings['data__use_ajax']){
3834
-
3835
- wp_enqueue_script('ct_nocache', plugins_url('/cleantalk-spam-protect/js/cleantalk_nocache.min.js'), array(), APBCT_VERSION, false /*in header*/);
3836
-
3837
- wp_localize_script('ct_nocache', 'ctNocache', array(
3838
- 'ajaxurl' => admin_url('admin-ajax.php'),
3839
- 'info_flag' => $apbct->settings['misc__collect_details'] && $apbct->settings['data__set_cookies'] ? true : false,
3840
- 'set_cookies_flag' => $apbct->settings['data__set_cookies'] ? false : true,
3841
- 'blog_home' => get_home_url().'/',
3842
- ));
3843
- }
3844
-
3845
- // External forms check
3846
- if($apbct->settings['forms__check_external'])
3847
- wp_enqueue_script('ct_external', plugins_url('/cleantalk-spam-protect/js/cleantalk_external.min.js'), array('jquery'), APBCT_VERSION, false /*in header*/);
3848
-
3849
- // Internal forms check
3850
- if($apbct->settings['forms__check_internal'])
3851
- wp_enqueue_script('ct_internal', plugins_url('/cleantalk-spam-protect/js/cleantalk_internal.min.js'), array('jquery'), APBCT_VERSION, false /*in header*/);
3852
-
3853
- }
3854
- }
3855
- }
3856
 
3857
  // Show controls for commentaries
3858
  if(in_array("administrator", $current_user->roles)){
1
  <?php
2
 
3
+ use Cleantalk\Variables\Server;
4
+
5
  /**
6
  * Init functions
7
  * @return mixed[] Array of options
137
  if( isset($_REQUEST['wc-ajax']) && $_REQUEST['wc-ajax'] == 'checkout' && empty( $apbct->settings['forms__wc_register_from_order'] ) ){
138
  remove_filter( 'woocommerce_registration_errors', 'ct_registration_errors', 1 );
139
  }
140
+
141
+ //Woocommerce add_to_cart action
142
+ add_action( 'woocommerce_add_to_cart', 'apbct_wc__add_to_cart_unlogged_user', 10, 6 );
143
  }
144
 
145
  // WooCommerce whishlist
353
  */
354
  function apbct_buffer__output(){
355
 
356
+ global $apbct;
357
 
358
+ if( empty( $apbct->buffer ) )
359
  return;
360
 
361
+ if( apbct_is_plugin_active( 'flow-flow/flow-flow.php' ) ) {
362
+ $output = apbct_buffer_modify_by_string();
363
+ } else {
364
+ $output = apbct_buffer_modify_by_dom();
365
+ }
366
+
367
+ echo $output;
368
+ die();
369
+ }
370
+
371
+ function apbct_buffer_modify_by_string() {
372
+
373
+ global $apbct, $wp;
374
+
375
+ $site_url = get_option('siteurl');
376
+ $site__host = parse_url($site_url, PHP_URL_HOST);
377
+
378
+ preg_match_all( '/<form\s*.*>\s*.*<\/form>/', $apbct->buffer, $matches, PREG_SET_ORDER );
379
+
380
+ if( count( $matches ) > 0 ) {
381
+ foreach( $matches as $match ) {
382
+
383
+ preg_match( '/action="(\S*)"/', $match[0], $group_action );
384
+ $action = count( $group_action ) > 0 ? $group_action[1] : $site_url;
385
+
386
+ $action__host = parse_url($action, PHP_URL_HOST);
387
+ if( $site__host != $action__host ) {
388
+
389
+ preg_match( '/method="(\S*)"/', $match[0], $group_method );
390
+ $method = count( $group_method ) > 0 ? $group_method[1] : 'get';
391
+
392
+ $hidden_fields = '<input type="hidden" name="cleantalk_hidden_action" value="' . $action . '">';
393
+ $hidden_fields .= '<input type="hidden" name="cleantalk_hidden_method" value="' . $method . '">';
394
+
395
+ $modified_match = preg_replace( '/action="\S*"/', 'action="' . home_url(add_query_arg(array(), $wp->request)) . '"', $match[0] );
396
+ $modified_match = preg_replace( '/method="\S*"/', 'method="POST"', $modified_match );
397
+ $modified_match = str_replace( '</form>', $hidden_fields . '</form>', $modified_match );
398
+ $apbct->buffer = str_replace( $match[0], $modified_match, $apbct->buffer );
399
+ }
400
+ }
401
+ }
402
+
403
+ return $apbct->buffer;
404
+
405
+ }
406
+
407
+ function apbct_buffer_modify_by_dom() {
408
+
409
+ global $apbct, $wp;
410
+
411
  $site_url = get_option('siteurl');
412
  $site__host = parse_url($site_url, PHP_URL_HOST);
413
 
450
  } unset($form);
451
 
452
  $html = $dom->getElementsByTagName('html');
453
+
454
+ return is_object( $html ) && isset( $html[0], $html[0]->childNodes, $html[0]->childNodes[0] ) && $dom->getElementsByTagName( 'rss' )->length == 0
455
  ? $dom->saveHTML()
456
  : $apbct->buffer;
457
+
 
 
458
  }
459
 
460
  // MailChimp Premium for Wordpress
538
  $post_info['comment_type'] = 'feedback_custom_contact_forms';
539
  $post_info['post_url'] = apbct_get_server_variable( 'HTTP_REFERER' );
540
 
541
+ $checkjs = apbct_js_test('ct_checkjs', $_COOKIE, true)
542
+ ? apbct_js_test('ct_checkjs', $_COOKIE, true)
543
  : apbct_js_test('ct_checkjs', $_POST);
544
 
545
  //Making a call
592
  $post_info['comment_type'] = 'feedback';
593
  $post_info['post_url'] = apbct_get_server_variable( 'HTTP_REFERER' );
594
 
595
+ $checkjs = apbct_js_test('ct_checkjs', $_COOKIE, true)
596
+ ? apbct_js_test('ct_checkjs', $_COOKIE, true)
597
  : apbct_js_test('ct_checkjs', $_POST);
598
 
599
  //Making a call
658
  'post_url' => apbct_get_server_variable( 'HTTP_REFERER' ),
659
  'comment_type' => 'buddypress_activitywall',
660
  ),
661
+ 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE, true),
662
  'sender_info' => array('sender_url' => null),
663
  )
664
  );
760
  'comment_type' => 'buddypress_comment',
761
  'post_url' => apbct_get_server_variable( 'HTTP_REFERER' ),
762
  ),
763
+ 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE, true)
764
+ ? apbct_js_test('ct_checkjs', $_COOKIE, true)
765
  : apbct_js_test('ct_checkjs', $_POST),
766
  'sender_info' => array('sender_url' => null),
767
  )
878
  'sender_email' => $sender_email,
879
  'sender_nickname' => $sender_nickname,
880
  'post_info' => $post_info,
881
+ 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE, true),
882
  'sender_info' => array('sender_url' => null),
883
  )
884
  );
899
  }
900
  }
901
 
902
+ /**
903
+ * Triggered when adding an item to the shopping cart
904
+ * for un-logged users
905
+ *
906
+ * @param $cart_item_key
907
+ * @param $product_id
908
+ * @param $quantity
909
+ * @param $variation_id
910
+ * @param $variation
911
+ * @param $cart_item_data
912
+ * @return void
913
+ */
914
+
915
+ function apbct_wc__add_to_cart_unlogged_user($cart_item_key, $product_id, $quantity, $variation_id, $variation, $cart_item_data) {
916
+ global $apbct;
917
+
918
+ if(! apbct_is_user_logged_in() && $apbct->settings['forms__wc_add_to_cart']) {
919
+ /**
920
+ * Getting request params
921
+ * POST contains an array of product information
922
+ * Example: Array
923
+ *(
924
+ * [product_sku] => woo-beanie
925
+ * [product_id] => 15
926
+ * [quantity] => 1
927
+ *)
928
+ */
929
+ $message = $_POST ?: array();
930
+
931
+ $post_info['comment_type'] = 'order__add_to_cart';
932
+ $post_info['post_url'] = Server::get('HTTP_REFERER');
933
+
934
+ //Making a call
935
+ $base_call_result = apbct_base_call(
936
+ array(
937
+ 'message' => $message,
938
+ 'post_info' => $post_info,
939
+ 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE, true),
940
+ 'sender_info' => array('sender_url' => null),
941
+ )
942
+ );
943
+
944
+ $ct_result = $base_call_result['ct_result'];
945
+
946
+ if ($ct_result->allow == 0) {
947
+ wp_send_json(array(
948
+ 'result' => 'failure',
949
+ 'messages' => "<ul class=\"woocommerce-error\"><li>" . $ct_result->comment . "</li></ul>",
950
+ 'refresh' => 'false',
951
+ 'reload' => 'false',
952
+ 'response_type' => 'wc_add_to_cart_block'
953
+ ));
954
+ }
955
+ }
956
+ }
957
+
958
  /**
959
  * Public function - Tests for Pirate contact froms
960
  * return NULL
992
  'sender_email' => $sender_email,
993
  'sender_nickname' => $sender_nickname,
994
  'post_info' => $post_info,
995
+ 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE, true),
996
  'sender_info' => array('sender_url' => null),
997
  )
998
  );
1083
  $field_id_hash = md5(rand(0, 1000));
1084
 
1085
  // Using only cookies
1086
+ if ($cookie_check && $apbct->settings['data__set_cookies'] ) {
 
1087
  $html = "<script type=\"text/javascript\" " . ( class_exists('Cookiebot_WP') ? 'data-cookieconsent="ignore"' : '' ) . ">
1088
  function apbct_attach_event_handler__backend(elem, event, callback){
1089
  if(typeof window.addEventListener === \"function\") elem.addEventListener(event, callback);
1090
  else elem.attachEvent(event, callback);
1091
  }
1092
  apbct_attach_event_handler__backend(window, 'load', function(){
1093
+ ctSetCookie('{$field_name}', '{$ct_checkjs_key}' );
1094
  });
1095
  </script>";
1096
 
1221
  // Combine it with non-scalar values
1222
  $message = array_merge( $tmp_message, $tmp_message2 );
1223
 
1224
+ $checkjs = apbct_js_test('ct_checkjs', $_COOKIE, true)
1225
+ ? apbct_js_test('ct_checkjs', $_COOKIE, true)
1226
  : apbct_js_test('ct_checkjs', $_POST);
1227
 
1228
  $base_call_result = apbct_base_call(
1279
  }
1280
 
1281
 
1282
+ $checkjs = apbct_js_test('ct_checkjs', $_COOKIE, true)
1283
+ ? apbct_js_test('ct_checkjs', $_COOKIE, true)
1284
  : apbct_js_test('ct_checkjs', $_POST);
1285
 
1286
  $post_info['comment_type'] = 'bbpress_comment';
1467
  // Comment type
1468
  $post_info['comment_type'] = empty($post_info['comment_type']) ? 'general_comment' : $post_info['comment_type'];
1469
 
1470
+ $checkjs = apbct_js_test('ct_checkjs', $_COOKIE, true)
1471
+ ? apbct_js_test('ct_checkjs', $_COOKIE, true)
1472
  : apbct_js_test('ct_checkjs', $_POST);
1473
 
1474
 
1741
  *
1742
  * @return int|null
1743
  */
1744
+ function apbct_js_test($field_name = 'ct_checkjs', $data = null, $is_cookie = false ) {
1745
 
1746
  global $apbct;
1747
+
1748
  $out = null;
1749
 
1750
+ if(
1751
+ ($data && isset($data[$field_name])) ||
1752
+ ($is_cookie && $apbct->settings['data__set_cookies'] == 2 && \Cleantalk\ApbctWP\Variables\Cookie::get( $field_name ))
1753
+ ){
1754
+
1755
+ $js_key = $is_cookie && $apbct->settings['data__set_cookies'] == 2
1756
+ ? \Cleantalk\ApbctWP\Variables\Cookie::get( $field_name )
1757
+ : trim($data[$field_name]);
1758
 
1759
  // Check static key
1760
  if(
2021
  'sender_email' => $email,
2022
  'sender_nickname' => $nickname,
2023
  'post_info' => array('comment_type' => 'feedback_plugin_check'),
2024
+ 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE, true),
2025
  )
2026
  );
2027
 
2046
  $checkjs = apbct_js_test($ct_checkjs_register_form, $_POST);
2047
  $sender_info['post_checkjs_passed'] = $checkjs;
2048
  }else{
2049
+ $checkjs = $checkjs = apbct_js_test('ct_checkjs', $_COOKIE, true);
2050
  $sender_info['cookie_checkjs_passed'] = $checkjs;
2051
  }
2052
 
2135
 
2136
 
2137
  if(current_filter() == 'woocommerce_registration_errors'){
2138
+ $checkjs = apbct_js_test('ct_checkjs', $_COOKIE, true);
2139
  $checkjs_post = null;
2140
  $checkjs_cookie = $checkjs;
2141
  }else{
2142
  // This hack can be helpfull when plugin uses with untested themes&signups plugins.
2143
  $checkjs_post = apbct_js_test($ct_checkjs_register_form, $_POST);
2144
+ $checkjs_cookie = apbct_js_test('ct_checkjs', $_COOKIE, true);
2145
  $checkjs = $checkjs_cookie ? $checkjs_cookie : $checkjs_post;
2146
  }
2147
 
2208
  } else {
2209
  if ($ct_result->id !== null) {
2210
  $apbct_cookie_request_id = $ct_result->id;
2211
+ \Cleantalk\ApbctWP\Variables\Cookie::set($apbct_cookie_register_ok_label, $ct_result->id, time()+10, '/');
2212
+ \Cleantalk\ApbctWP\Variables\Cookie::set($apbct_cookie_request_id_label, $ct_result->id, time()+10, '/');
2213
  }
2214
  }
2215
 
2277
 
2278
  // This hack can be helpfull when plugin uses with untested themes&signups plugins.
2279
  if ($checkjs == 0) {
2280
+ $checkjs = apbct_js_test('ct_checkjs', $_COOKIE, true);
2281
  $sender_info['cookie_checkjs_passed'] = $checkjs;
2282
  }
2283
 
2346
 
2347
  if ( isset($_COOKIE[$apbct_cookie_request_id_label]) ) {
2348
  if(update_user_meta($user_id, 'ct_hash', $_COOKIE[$apbct_cookie_request_id_label])){
2349
+ \Cleantalk\ApbctWP\Variables\Cookie::set($apbct_cookie_request_id_label, '0', 1, '/');
2350
  }
2351
  return;
2352
  }
2533
 
2534
  $checkjs = apbct_js_test($ct_checkjs_cf7, $_POST)
2535
  ? apbct_js_test($ct_checkjs_cf7, $_POST)
2536
+ : apbct_js_test('ct_checkjs', $_COOKIE, true);
2537
 
2538
  $ct_temp_msg_data = ct_get_fields_any($_POST);
2539
 
2654
  return;
2655
  }
2656
 
2657
+ $checkjs = apbct_js_test('ct_checkjs', $_COOKIE, true);
2658
 
2659
  // Choosing between POST and GET
2660
  $params = ct_get_fields_any(isset($_GET['ninja_forms_ajax_submit']) || isset($_GET['nf_ajax_submit']) ? $_GET : $_POST);
2991
  // @ToDo If we have several emails at the form - will be used only the first detected!
2992
  $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
2993
 
2994
+ $checkjs = apbct_js_test('ct_checkjs', $_COOKIE, true);
2995
  $base_call_result = apbct_base_call(
2996
  array(
2997
  'message' => $form->getValues(),
3003
 
3004
  $ct_result = $base_call_result['ct_result'];
3005
  if ($ct_result->allow == 0) {
3006
+ die(json_encode(array('type' => 'error', 'apbct' => array('blocked' => true, 'comment' => $ct_result->comment)), JSON_HEX_QUOT | JSON_HEX_TAG));
3007
  } else {
3008
  return $result;
3009
  }
3150
  $cleantalk_comment = 'OK';
3151
  }
3152
 
3153
+ \Cleantalk\ApbctWP\Variables\Cookie::set($ct_wplp_result_label, $cleantalk_comment, strtotime("+5 seconds"), '/');
3154
  } else {
3155
  // Next POST/AJAX submit(s) of same WPLP form
3156
  $cleantalk_comment = $_COOKIE[$ct_wplp_result_label];
3200
  return $is_spam;
3201
  }
3202
 
3203
+ $form_fields = (isset($form['fields'])) ? $form['fields'] : false;
3204
+ $form_fields_for_ct = array();
3205
+ $form_fields_intermediate = array();
3206
+ $email = '';
3207
+ $nickname = array();
3208
+
3209
+ if($form_fields) {
3210
+ foreach ($form_fields as $field) {
3211
+ $field_id = $field['id'];
3212
+ $field_visibility = $field['visibility'];
3213
+ $field_type = $field['type'];
3214
+ $field_inputs = $field['inputs'];
3215
+
3216
+ if($field_inputs) {
3217
+ foreach ($field_inputs as $input) {
3218
+ $input_id = $input['id'];
3219
+
3220
+ if(isset($entry[$input_id]) && $entry[$input_id]) {
3221
+ $form_fields_intermediate[] = array(
3222
+ 'f_name' => 'input_' . $input_id,
3223
+ 'f_visibility' => $field_visibility,
3224
+ 'f_type' => $field_type,
3225
+ 'f_data' => $entry[$input_id]
3226
+ );
3227
+ $form_fields_for_ct['input_' . $input_id] = $entry[$input_id];
3228
+ }
3229
+ }
3230
+ } else {
3231
+ if(isset($entry[$field_id]) && $entry[$field_id]) {
3232
+ $form_fields_intermediate[] = array(
3233
+ 'f_name' => 'input_' . $field_id,
3234
+ 'f_visibility' => $field_visibility,
3235
+ 'f_type' => $field_type,
3236
+ 'f_data' => $entry[$field_id]
3237
+ );
3238
+ $form_fields_for_ct['input_' . $field_id] = $entry[$field_id];
3239
+ }
3240
+ }
3241
+ }
3242
+ }
3243
+
3244
+ # Search nickname and email
3245
+ if($form_fields_intermediate) {
3246
+ foreach ($form_fields_intermediate as $field) {
3247
+ if($field['f_type'] === 'email') {
3248
+ $email = $field['f_data'];
3249
+ }
3250
+
3251
+ if($field['f_type'] === 'name') {
3252
+ $nickname[] = $field['f_data'];
3253
+ }
3254
+ }
3255
+ }
3256
+
3257
+ if(!$form_fields_for_ct) {
3258
+ foreach($entry as $key => $value){
3259
+ if(is_numeric($key))
3260
+ $form_fields_for_ct[$key]=$value;
3261
+ } unset($key, $value);
3262
+ }
3263
+
3264
+ $ct_temp_msg_data = ct_get_fields_any($form_fields_for_ct, array(), $email, $nickname);
3265
 
 
3266
  $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
3267
  $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
3268
  $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
3281
 
3282
  $checkjs = apbct_js_test('ct_checkjs', $_POST)
3283
  ? apbct_js_test('ct_checkjs', $_POST)
3284
+ : apbct_js_test('ct_checkjs', $_COOKIE, true);
3285
 
3286
  $base_call_result = apbct_base_call(
3287
  array(
3489
  $ct_result = $base_call_result['ct_result'];
3490
 
3491
  if ( $ct_result->allow == 0 ) {
3492
+ die(json_encode(array('apbct' => array('blocked' => true, 'comment' => $ct_result->comment,)), JSON_HEX_QUOT | JSON_HEX_TAG));
3493
  }
3494
 
3495
  return true;
3586
  \Cleantalk\Variables\Post::get('action') === 'frm_get_lookup_text_value' || // Exception for Formidable multilevel form
3587
  ( isset( $_POST['ihcaction'] ) && $_POST['ihcaction'] == 'reset_pass') || //Reset pass exclusion
3588
  ( isset( $_POST['action'], $_POST['register_unspecified_nonce_field'] ) && $_POST['action'] == 'register' ) || // Profile Builder have a direct integration
3589
+ ( isset( $_POST['_wpmem_register_nonce'] ) && wp_verify_nonce( $_POST['_wpmem_register_nonce'], 'wpmem_longform_nonce' ) ) || // WP Members have a direct integration
3590
+ apbct_is_in_uri('/settings/') && isset($_POST['submit']) || // Buddypress integration
3591
+ apbct_is_in_uri('/settings/notifications/') && isset($_POST['submit']) || // Buddypress integration
3592
+ apbct_is_in_uri('/settings/profile/') && isset($_POST['submit']) || // Buddypress integration
3593
+ apbct_is_in_uri('/settings/data/') && isset($_POST['submit']) || // Buddypress integration
3594
+ apbct_is_in_uri('/settings/delete-account/') && isset($_POST['submit']) || // Buddypress integration
3595
+ apbct_is_in_uri('/profile/') && isset($_POST['submit']) // Buddypress integration
3596
  /* !! Do not add actions here. Use apbct_is_skip_request() function below !! */
3597
  ) {
3598
  do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
3969
  return;
3970
  }
3971
 
3972
+ if(
3973
+ $apbct->settings['forms__registrations_test'] ||
3974
+ $apbct->settings['forms__comments_test'] ||
3975
+ $apbct->settings['forms__contact_forms_test'] ||
3976
+ $apbct->settings['forms__general_contact_forms_test'] ||
3977
+ $apbct->settings['forms__wc_checkout_test'] ||
3978
+ $apbct->settings['forms__check_external'] ||
3979
+ $apbct->settings['forms__check_internal'] ||
3980
+ $apbct->settings['comments__bp_private_messages'] ||
3981
+ $apbct->settings['data__general_postdata_test']
3982
+ ){
3983
 
3984
  if( ! $apbct->public_script_loaded ) {
3985
 
3993
  '_ajax_url' => admin_url('admin-ajax.php'),
3994
  '_rest_url' => esc_url( get_rest_url() ),
3995
  'data__set_cookies' => $apbct->settings['data__set_cookies'],
3996
+ 'data__set_cookies__alt_sessions_type' => $apbct->settings['data__set_cookies__alt_sessions_type'],
3997
  ));
3998
  }
3999
+
4000
+ // ct_nocache
4001
+ // @todo needs to be refactored
4002
+ if(
4003
+ ( !defined('CLEANTALK_AJAX_USE_FOOTER_HEADER') || (defined('CLEANTALK_AJAX_USE_FOOTER_HEADER') && CLEANTALK_AJAX_USE_FOOTER_HEADER) ) &&
4004
+ $apbct->settings['data__use_ajax'] && // Use AJAX for JavaScript check
4005
+ ! apbct_is_in_uri( '.xml' ) &&
4006
+ ! apbct_is_in_uri( '.xsl' ) &&
4007
+ ! apbct_is_in_uri( 'jm-ajax' )
4008
+ ){
4009
+
4010
+ // Collect details about browsers
4011
+ if($apbct->settings['misc__collect_details']){
4012
+ wp_enqueue_script('ct_collect_details', plugins_url('/cleantalk-spam-protect/js/cleantalk_collect_details.min.js'), array(), APBCT_VERSION, false /*in header*/);
4013
+ wp_localize_script('ct_collect_details', 'ctCollectDetails', array(
4014
+ 'set_cookies_flag' => $apbct->settings['data__set_cookies'] ? false : true,
4015
+ ));
4016
+ }
4017
+
4018
+ wp_enqueue_script('ct_nocache', plugins_url('/cleantalk-spam-protect/js/cleantalk_nocache.min.js'), array(), APBCT_VERSION, false /*in header*/);
4019
+ wp_localize_script('ct_nocache', 'ctNocache', array(
4020
+ 'ajaxurl' => admin_url('admin-ajax.php'),
4021
+ 'info_flag' => $apbct->settings['misc__collect_details'] && $apbct->settings['data__set_cookies'],
4022
+ 'set_cookies_flag' => (bool) $apbct->settings['data__set_cookies'],
4023
+ 'blog_home' => get_home_url().'/',
4024
+ ));
4025
+ }
4026
 
4027
  // GDPR script
4028
  if($apbct->settings['gdpr__enabled']){
4036
  }
4037
 
4038
  }
4039
+
4040
+ // External forms check
4041
+ if($apbct->settings['forms__check_external']){
4042
+ wp_enqueue_script( 'ct_external', plugins_url( '/cleantalk-spam-protect/js/cleantalk_external.min.js' ), array( 'jquery' ), APBCT_VERSION, false /*in header*/ );
4043
+ }
4044
+
4045
+ // Internal forms check
4046
+ if($apbct->settings['forms__check_internal']){
4047
+ wp_enqueue_script( 'ct_internal', plugins_url( '/cleantalk-spam-protect/js/cleantalk_internal.min.js' ), array( 'jquery' ), APBCT_VERSION, false /*in header*/ );
4048
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4049
 
4050
  // Show controls for commentaries
4051
  if(in_array("administrator", $current_user->roles)){
inc/cleantalk-settings.php CHANGED
@@ -39,7 +39,7 @@ function apbct_settings__set_fileds( $fields ){
39
 
40
  $additional_ac_title = '';
41
  if( $apbct->api_key && is_null( $apbct->fw_stats['firewall_updating_id'] ) ) {
42
- if( ! $apbct->stats['sfw']['entries'] ) {
43
  $additional_ac_title = ' <span style="color:red">' . esc_html__( 'The functionality was disabled because SpamFireWall database is empty. Please, do the synchronization or', 'cleantalk-spam-protect' ) . ' ' . '<a href="https://cleantalk.org/my/support/open" target="_blank" style="color:red">'. esc_html__( 'contact to our support.', 'cleantalk-spam-protect' ) .'</a></span>';
44
  }
45
  }
@@ -198,6 +198,16 @@ function apbct_settings__set_fileds( $fields ){
198
  'class' => 'apbct_settings-field_wrapper--sub',
199
  'reverse_trigger' => true,
200
  ),
 
 
 
 
 
 
 
 
 
 
201
  ),
202
  ),
203
 
@@ -295,17 +305,32 @@ function apbct_settings__set_fileds( $fields ){
295
  )
296
  .'<br />' . __('СAUTION! Option can catch POST requests in WordPress backend', 'cleantalk-spam-protect'),
297
  ),
298
- 'data__set_cookies' => array(
299
- 'title' => __("Set cookies", 'cleantalk-spam-protect'),
300
- 'description' => __('Turn this option off to deny plugin generates any cookies on website front-end. This option is helpful if you use Varnish. But most of contact forms will not be protected if the option is turned off! <b>Warning: We strongly recommend you to enable this otherwise it could cause false positives spam detection.</b>', 'cleantalk-spam-protect'),
301
- 'childrens' => array('data__set_cookies__sessions'),
302
- ),
303
- 'data__set_cookies__sessions' => array(
304
- 'title' => __('Use alternative mechanism for cookies', 'cleantalk-spam-protect'),
305
- 'description' => __('Doesn\'t use cookie or PHP sessions. Collect data for all types of bots.', 'cleantalk-spam-protect'),
306
- 'parent' => 'data__set_cookies',
307
- 'class' => 'apbct_settings-field_wrapper--sub',
308
- ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
309
  'data__ssl_on' => array(
310
  'title' => __("Use SSL", 'cleantalk-spam-protect'),
311
  'description' => __('Turn this option on to use encrypted (SSL) connection with servers.', 'cleantalk-spam-protect'),
@@ -424,14 +449,6 @@ function apbct_settings__set_fileds( $fields ){
424
  'type' => 'checkbox',
425
  'title' => __('Store visited URLs', 'cleantalk-spam-protect'),
426
  'description' => __("Plugin stores last 10 visited URLs (HTTP REFFERERS) before visitor submits form on the site. You can see stored visited URLS for each visitor in your Dashboard. Turn the option on to improve Anti-Spam protection.", 'cleantalk-spam-protect'),
427
- 'childrens' => array('misc__store_urls__sessions'),
428
- ),
429
- 'misc__store_urls__sessions' => array(
430
- 'type' => 'checkbox',
431
- 'title' => __('Use cookies less sessions', 'cleantalk-spam-protect'),
432
- 'description' => __('Doesn\'t use cookie or PHP sessions. Collect data for all types of bots.', 'cleantalk-spam-protect'),
433
- 'parent' => 'misc__store_urls',
434
- 'class' => 'apbct_settings-field_wrapper--sub',
435
  ),
436
  'wp__comment_notify' => array(
437
  'type' => 'checkbox',
@@ -1412,13 +1429,11 @@ function apbct_settings__validate($settings) {
1412
 
1413
  // Actions with toggle SFW settings
1414
  // SFW was enabled
1415
- if( ! (int)$apbct->settings['sfw__enabled'] && (int)$settings['sfw__enabled'] ){
1416
- // Needs to be fired only after option was updated
1417
- add_action('update_option_cleantalk_settings' ,'apbct_sfw_update__init' );
1418
- add_action('add_option_cleantalk_settings' ,'apbct_sfw_update__init' );
1419
- }
1420
  // SFW was disabled
1421
- if( (int)$apbct->settings['sfw__enabled'] && ! (int)$settings['sfw__enabled'] ){
1422
  apbct_sfw__clear();
1423
  }
1424
 
@@ -1525,12 +1540,8 @@ function apbct_settings__validate($settings) {
1525
  }
1526
 
1527
  // Alt sessions table clearing
1528
- if( empty( $settings['data__set_cookies__sessions'] ) ) {
1529
- if( empty( $settings['misc__store_urls__sessions'] ) ) {
1530
- apbct_alt_sessions__clear();
1531
- } else {
1532
- apbct_alt_sessions__clear( false );
1533
- }
1534
  }
1535
 
1536
  return $settings;
@@ -1569,7 +1580,7 @@ function apbct_settings__sync( $direct_call = false ){
1569
  delete_option( 'sfw_update_first' );
1570
  }
1571
 
1572
- $result = apbct_sfw_update__init( $apbct->settings['apikey'] );
1573
  if( ! empty( $result['error'] ) )
1574
  $apbct->error_add( 'sfw_update', $result['error'] );
1575
 
39
 
40
  $additional_ac_title = '';
41
  if( $apbct->api_key && is_null( $apbct->fw_stats['firewall_updating_id'] ) ) {
42
+ if( $apbct->settings['sfw__enabled'] && ! $apbct->stats['sfw']['entries'] ) {
43
  $additional_ac_title = ' <span style="color:red">' . esc_html__( 'The functionality was disabled because SpamFireWall database is empty. Please, do the synchronization or', 'cleantalk-spam-protect' ) . ' ' . '<a href="https://cleantalk.org/my/support/open" target="_blank" style="color:red">'. esc_html__( 'contact to our support.', 'cleantalk-spam-protect' ) .'</a></span>';
44
  }
45
  }
198
  'class' => 'apbct_settings-field_wrapper--sub',
199
  'reverse_trigger' => true,
200
  ),
201
+ 'forms__wc_add_to_cart' => array(
202
+ 'title' => __('Check anonymous users when they add new items to the cart', 'cleantalk-spam-protect'),
203
+ 'description' => __('All anonymous users will be checked for spam if they add a new item to their shopping cart.', 'cleantalk-spam-protect'),
204
+ 'reverse_trigger' => false,
205
+ 'class' => 'apbct_settings-field_wrapper--sub',
206
+ 'options' => array(
207
+ array( 'val' => 1, 'label' => __( 'On' ) ),
208
+ array( 'val' => 0, 'label' => __( 'Off' ) ),
209
+ ),
210
+ ),
211
  ),
212
  ),
213
 
305
  )
306
  .'<br />' . __('СAUTION! Option can catch POST requests in WordPress backend', 'cleantalk-spam-protect'),
307
  ),
308
+ 'data__set_cookies' => array(
309
+ 'title' => __( "Set cookies", 'cleantalk-spam-protect' ),
310
+ 'description' => __( 'Turn this option off or use alternative mechanism for cookies to forbid the plugin generate any cookies on website\'s front-end.', 'cleantalk-spam-protect' )
311
+ . '<br>' . __( 'This option is helpful if you are using Varnish. Most contact forms will have poor protection if the option is turned off!', 'cleantalk-spam-protect' )
312
+ . '<br>' . __( 'Alternative mechanism will store data in database and will not set cookies in browser, so the cache solutions will work just fine.', 'cleantalk-spam-protect' )
313
+ . '<br><b>' . __( 'Warning: We strongly recommend you keep the setting on, otherwise it could cause false positives spam detection.', 'cleantalk-spam-protect' ) . '</b>',
314
+ 'input_type' => 'radio',
315
+ 'options' => array(
316
+ array( 'val' => 1, 'label' => __( 'On', 'cleantalk-spam-protect' ), 'childrens_enable' => 0, ),
317
+ array( 'val' => 0, 'label' => __( 'Off', 'cleantalk-spam-protect' ), 'childrens_enable' => 0, ),
318
+ array( 'val' => 2, 'label' => __( 'Use alternative mechanism for cookies', 'cleantalk-spam-protect' ), 'childrens_enable' => 1, ),
319
+ ),
320
+ 'childrens' => array( 'data__set_cookies__alt_sessions_type' )
321
+ ),
322
+ 'data__set_cookies__alt_sessions_type' => array(
323
+ 'title' => __( 'Alternative cookies handler type', 'cleantalk-spam-protect' ),
324
+ 'description' => __( 'This could be helpful if you are using alternative mechanism for cookies and have REST API disabled. REST works faster.', 'cleantalk-spam-protect' ),
325
+ 'class' => 'apbct_settings-field_wrapper--sub',
326
+ 'input_type' => 'radio',
327
+ 'options' => array(
328
+ array( 'val' => 1, 'label' => __( 'Use REST API', 'cleantalk-spam-protect' ), ),
329
+ array( 'val' => 2, 'label' => __( 'Use AJAX handler', 'cleantalk-spam-protect' ), ),
330
+ ),
331
+ 'parent' => 'data__set_cookies',
332
+ 'disabled' => $apbct->settings['data__set_cookies'] != 2,
333
+ ),
334
  'data__ssl_on' => array(
335
  'title' => __("Use SSL", 'cleantalk-spam-protect'),
336
  'description' => __('Turn this option on to use encrypted (SSL) connection with servers.', 'cleantalk-spam-protect'),
449
  'type' => 'checkbox',
450
  'title' => __('Store visited URLs', 'cleantalk-spam-protect'),
451
  'description' => __("Plugin stores last 10 visited URLs (HTTP REFFERERS) before visitor submits form on the site. You can see stored visited URLS for each visitor in your Dashboard. Turn the option on to improve Anti-Spam protection.", 'cleantalk-spam-protect'),
 
 
 
 
 
 
 
 
452
  ),
453
  'wp__comment_notify' => array(
454
  'type' => 'checkbox',
1429
 
1430
  // Actions with toggle SFW settings
1431
  // SFW was enabled
1432
+ if( ! $apbct->settings['sfw__enabled'] && $settings['sfw__enabled'] ){
1433
+ apbct_sfw_update__init( 3 );
1434
+
 
 
1435
  // SFW was disabled
1436
+ }elseif( $apbct->settings['sfw__enabled'] && ! $settings['sfw__enabled'] ){
1437
  apbct_sfw__clear();
1438
  }
1439
 
1540
  }
1541
 
1542
  // Alt sessions table clearing
1543
+ if( $settings['data__set_cookies'] != 2 ) {
1544
+ \Cleantalk\ApbctWP\Variables\AltSessions::wipe();
 
 
 
 
1545
  }
1546
 
1547
  return $settings;
1580
  delete_option( 'sfw_update_first' );
1581
  }
1582
 
1583
+ $result = apbct_sfw_update__init( 5 );
1584
  if( ! empty( $result['error'] ) )
1585
  $apbct->error_add( 'sfw_update', $result['error'] );
1586
 
inc/cleantalk-updater.php CHANGED
@@ -905,6 +905,22 @@ function apbct_update_to_5_156_0(){
905
  $apbct->remote_calls['debug_sfw'] = array( 'last_call' => 0, 'cooldown' => 0 );
906
  $apbct->save('remote_calls');
907
 
908
- Cron::updateTask('sfw_update', 'apbct_sfw_update__init', 86400, rand( 0, 86400 ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
909
 
910
  }
905
  $apbct->remote_calls['debug_sfw'] = array( 'last_call' => 0, 'cooldown' => 0 );
906
  $apbct->save('remote_calls');
907
 
908
+ Cron::updateTask('sfw_update', 'apbct_sfw_update__init', 86400, time() + 42300 );
909
+
910
+ }
911
+
912
+ function apbct_update_to_5_157_0(){
913
+
914
+ global $apbct;
915
+
916
+ $apbct->remote_calls['sfw_update__worker'] = array( 'last_call' => 0, 'cooldown' => 0 );
917
+ $apbct->save( 'remote_calls' );
918
+
919
+ if( $apbct->settings['data__set_cookies__sessions'] ){
920
+ $apbct->settings['data__set_cookies'] = 2;
921
+ }
922
+ $apbct->settings['data__set_cookies__alt_sessions_type'] = 1;
923
+
924
+ $apbct->save( 'settings' );
925
 
926
  }
inc/images/flags/a1.png ADDED
Binary file
inc/images/flags/ad.png ADDED
Binary file
inc/images/flags/ae.png ADDED
Binary file
inc/images/flags/af.png ADDED
Binary file
inc/images/flags/ag.png ADDED
Binary file
inc/images/flags/ai.png ADDED
Binary file
inc/images/flags/al.png ADDED
Binary file
inc/images/flags/am.png ADDED
Binary file
inc/images/flags/an.png ADDED
Binary file
inc/images/flags/ao.png ADDED
Binary file
inc/images/flags/ar.png ADDED
Binary file
inc/images/flags/as.png ADDED
Binary file
inc/images/flags/at.png ADDED
Binary file
inc/images/flags/au.png ADDED
Binary file
inc/images/flags/aw.png ADDED
Binary file
inc/images/flags/ax.png ADDED
Binary file
inc/images/flags/az.png ADDED
Binary file
inc/images/flags/ba.png ADDED
Binary file
inc/images/flags/bb.png ADDED
Binary file
inc/images/flags/bd.png ADDED
Binary file
inc/images/flags/be.png ADDED
Binary file
inc/images/flags/bf.png ADDED
Binary file
inc/images/flags/bg.png ADDED
Binary file
inc/images/flags/bh.png ADDED
Binary file
inc/images/flags/bi.png ADDED
Binary file
inc/images/flags/bj.png ADDED
Binary file
inc/images/flags/bm.png ADDED
Binary file
inc/images/flags/bn.png ADDED
Binary file
inc/images/flags/bo.png ADDED
Binary file
inc/images/flags/br.png ADDED
Binary file
inc/images/flags/bs.png ADDED
Binary file
inc/images/flags/bt.png ADDED
Binary file
inc/images/flags/bv.png ADDED
Binary file
inc/images/flags/bw.png ADDED
Binary file
inc/images/flags/by.png ADDED
Binary file
inc/images/flags/bz.png ADDED
Binary file
inc/images/flags/ca.png ADDED
Binary file
inc/images/flags/catalonia.png ADDED
Binary file
inc/images/flags/cc.png ADDED
Binary file
inc/images/flags/cd.png ADDED
Binary file
inc/images/flags/cf.png ADDED
Binary file
inc/images/flags/cg.png ADDED
Binary file
inc/images/flags/ch.png ADDED
Binary file
inc/images/flags/ci.png ADDED
Binary file
inc/images/flags/ck.png ADDED
Binary file
inc/images/flags/cl.png ADDED
Binary file
inc/images/flags/cleantalk.png ADDED
Binary file
inc/images/flags/cm.png ADDED
Binary file
inc/images/flags/cn.png ADDED
Binary file
inc/images/flags/co.png ADDED
Binary file
inc/images/flags/cr.png ADDED
Binary file
inc/images/flags/cs.png ADDED
Binary file
inc/images/flags/cu.png ADDED
Binary file
inc/images/flags/cv.png ADDED
Binary file
inc/images/flags/cw.png ADDED
Binary file
inc/images/flags/cx.png ADDED
Binary file
inc/images/flags/cy.png ADDED
Binary file
inc/images/flags/cz.png ADDED
Binary file
inc/images/flags/de.png ADDED
Binary file
inc/images/flags/dj.png ADDED
Binary file
inc/images/flags/dk.png ADDED
Binary file
inc/images/flags/dm.png ADDED
Binary file
inc/images/flags/do.png ADDED
Binary file
inc/images/flags/dz.png ADDED
Binary file
inc/images/flags/ec.png ADDED
Binary file
inc/images/flags/ee.png ADDED
Binary file
inc/images/flags/eg.png ADDED
Binary file
inc/images/flags/eh.png ADDED
Binary file
inc/images/flags/england.png ADDED
Binary file
inc/images/flags/er.png ADDED
Binary file
inc/images/flags/es.png ADDED
Binary file
inc/images/flags/et.png ADDED
Binary file
inc/images/flags/eu.png ADDED
Binary file
inc/images/flags/europeanunion.png ADDED
Binary file
inc/images/flags/fam.png ADDED
Binary file
inc/images/flags/fi.png ADDED
Binary file
inc/images/flags/fj.png ADDED
Binary file
inc/images/flags/fk.png ADDED
Binary file
inc/images/flags/fm.png ADDED
Binary file
inc/images/flags/fo.png ADDED
Binary file
inc/images/flags/fr.png ADDED
Binary file
inc/images/flags/ga.png ADDED
Binary file
inc/images/flags/gb.png ADDED
Binary file
inc/images/flags/gd.png ADDED
Binary file
inc/images/flags/ge.png ADDED
Binary file
inc/images/flags/gf.png ADDED
Binary file
inc/images/flags/gh.png ADDED
Binary file
inc/images/flags/gi.png ADDED
Binary file
inc/images/flags/gl.png ADDED
Binary file
inc/images/flags/gm.png ADDED
Binary file
inc/images/flags/gn.png ADDED
Binary file
inc/images/flags/gp.png ADDED
Binary file
inc/images/flags/gq.png ADDED
Binary file
inc/images/flags/gr.png ADDED
Binary file
inc/images/flags/gs.png ADDED
Binary file
inc/images/flags/gt.png ADDED
Binary file
inc/images/flags/gu.png ADDED
Binary file
inc/images/flags/gw.png ADDED
Binary file
inc/images/flags/gy.png ADDED
Binary file
inc/images/flags/hk.png ADDED
Binary file
inc/images/flags/hm.png ADDED
Binary file
inc/images/flags/hn.png ADDED
Binary file
inc/images/flags/hr.png ADDED
Binary file
inc/images/flags/ht.png ADDED
Binary file
inc/images/flags/hu.png ADDED
Binary file
inc/images/flags/id.png ADDED
Binary file
inc/images/flags/ie.png ADDED
Binary file
inc/images/flags/il.png ADDED
Binary file
inc/images/flags/in.png ADDED
Binary file
inc/images/flags/io.png ADDED
Binary file
inc/images/flags/iq.png ADDED
Binary file
inc/images/flags/ir.png ADDED
Binary file
inc/images/flags/is.png ADDED
Binary file
inc/images/flags/it.png ADDED
Binary file
inc/images/flags/jm.png ADDED
Binary file
inc/images/flags/jo.png ADDED
Binary file
inc/images/flags/jp.png ADDED
Binary file
inc/images/flags/ke.png ADDED
Binary file
inc/images/flags/kg.png ADDED
Binary file
inc/images/flags/kh.png ADDED
Binary file
inc/images/flags/ki.png ADDED
Binary file
inc/images/flags/km.png ADDED
Binary file
inc/images/flags/kn.png ADDED
Binary file
inc/images/flags/kp.png ADDED
Binary file
inc/images/flags/kr.png ADDED
Binary file
inc/images/flags/kw.png ADDED
Binary file
inc/images/flags/ky.png ADDED
Binary file
inc/images/flags/kz.png ADDED
Binary file
inc/images/flags/la.png ADDED
Binary file
inc/images/flags/lb.png ADDED
Binary file
inc/images/flags/lc.png ADDED
Binary file
inc/images/flags/li.png ADDED
Binary file
inc/images/flags/lk.png ADDED
Binary file
inc/images/flags/lr.png ADDED
Binary file
inc/images/flags/ls.png ADDED
Binary file
inc/images/flags/lt.png ADDED
Binary file
inc/images/flags/lu.png ADDED
Binary file
inc/images/flags/lv.png ADDED
Binary file
inc/images/flags/ly.png ADDED
Binary file
inc/images/flags/ma.png ADDED
Binary file
inc/images/flags/mc.png ADDED
Binary file
inc/images/flags/md.png ADDED
Binary file
inc/images/flags/me.png ADDED
Binary file
inc/images/flags/mg.png ADDED
Binary file
inc/images/flags/mh.png ADDED
Binary file
inc/images/flags/mk.png ADDED
Binary file
inc/images/flags/ml.png ADDED
Binary file
inc/images/flags/mm.png ADDED
Binary file
inc/images/flags/mn.png ADDED
Binary file
inc/images/flags/mo.png ADDED
Binary file
inc/images/flags/mp.png ADDED
Binary file
inc/images/flags/mq.png ADDED
Binary file
inc/images/flags/mr.png ADDED
Binary file
inc/images/flags/ms.png ADDED
Binary file
inc/images/flags/mt.png ADDED
Binary file
inc/images/flags/mu.png ADDED
Binary file
inc/images/flags/mv.png ADDED
Binary file
inc/images/flags/mw.png ADDED
Binary file
inc/images/flags/mx.png ADDED
Binary file
inc/images/flags/my.png ADDED
Binary file
inc/images/flags/mz.png ADDED
Binary file
inc/images/flags/na.png ADDED
Binary file
inc/images/flags/nc.png ADDED
Binary file
inc/images/flags/ne.png ADDED
Binary file
inc/images/flags/nf.png ADDED
Binary file
inc/images/flags/ng.png ADDED
Binary file
inc/images/flags/ni.png ADDED
Binary file
inc/images/flags/nl.png ADDED
Binary file
inc/images/flags/no.png ADDED
Binary file
inc/images/flags/np.png ADDED
Binary file
inc/images/flags/nr.png ADDED
Binary file
inc/images/flags/nu.png ADDED
Binary file
inc/images/flags/nz.png ADDED
Binary file
inc/images/flags/om.png ADDED
Binary file
inc/images/flags/pa.png ADDED
Binary file
inc/images/flags/pe.png ADDED
Binary file
inc/images/flags/pf.png ADDED
Binary file
inc/images/flags/pg.png ADDED
Binary file
inc/images/flags/ph.png ADDED
Binary file
inc/images/flags/pk.png ADDED
Binary file
inc/images/flags/pl.png ADDED
Binary file
inc/images/flags/pm.png ADDED
Binary file
inc/images/flags/pn.png ADDED
Binary file
inc/images/flags/pr.png ADDED
Binary file
inc/images/flags/ps.png ADDED
Binary file
inc/images/flags/pt.png ADDED
Binary file
inc/images/flags/pw.png ADDED
Binary file
inc/images/flags/py.png ADDED
Binary file
inc/images/flags/qa.png ADDED
Binary file
inc/images/flags/re.png ADDED
Binary file
inc/images/flags/ro.png ADDED
Binary file
inc/images/flags/rs.png ADDED
Binary file
inc/images/flags/ru.png ADDED
Binary file
inc/images/flags/rw.png ADDED
Binary file
inc/images/flags/sa.png ADDED
Binary file
inc/images/flags/sb.png ADDED
Binary file
inc/images/flags/sc.png ADDED
Binary file
inc/images/flags/scotland.png ADDED
Binary file
inc/images/flags/sd.png ADDED
Binary file
inc/images/flags/se.png ADDED
Binary file
inc/images/flags/sg.png ADDED
Binary file
inc/images/flags/sh.png ADDED
Binary file
inc/images/flags/si.png ADDED
Binary file
inc/images/flags/sj.png ADDED
Binary file
inc/images/flags/sk.png ADDED
Binary file
inc/images/flags/sl.png ADDED
Binary file
inc/images/flags/sm.png ADDED
Binary file
inc/images/flags/sn.png ADDED
Binary file
inc/images/flags/so.png ADDED
Binary file
inc/images/flags/sr.png ADDED
Binary file
inc/images/flags/st.png ADDED
Binary file
inc/images/flags/sv.png ADDED
Binary file
inc/images/flags/sy.png ADDED
Binary file
inc/images/flags/sz.png ADDED
Binary file
inc/images/flags/tc.png ADDED
Binary file
inc/images/flags/td.png ADDED
Binary file
inc/images/flags/tf.png ADDED
Binary file
inc/images/flags/tg.png ADDED
Binary file
inc/images/flags/th.png ADDED
Binary file
inc/images/flags/tj.png ADDED
Binary file
inc/images/flags/tk.png ADDED
Binary file
inc/images/flags/tl.png ADDED
Binary file
inc/images/flags/tm.png ADDED
Binary file
inc/images/flags/tn.png ADDED
Binary file
inc/images/flags/to.png ADDED
Binary file
inc/images/flags/tr.png ADDED
Binary file
inc/images/flags/tt.png ADDED
Binary file
inc/images/flags/tv.png ADDED
Binary file
inc/images/flags/tw.png ADDED
Binary file
inc/images/flags/tz.png ADDED
Binary file
inc/images/flags/ua.png ADDED
Binary file
inc/images/flags/ug.png ADDED
Binary file
inc/images/flags/um.png ADDED
Binary file
inc/images/flags/us.png ADDED
Binary file
inc/images/flags/uy.png ADDED
Binary file
inc/images/flags/uz.png ADDED
Binary file
inc/images/flags/va.png ADDED
Binary file
inc/images/flags/vc.png ADDED
Binary file
inc/images/flags/ve.png ADDED
Binary file
inc/images/flags/vg.png ADDED
Binary file
inc/images/flags/vi.png ADDED
Binary file
inc/images/flags/vn.png ADDED
Binary file
inc/images/flags/vu.png ADDED
Binary file
inc/images/flags/wales.png ADDED
Binary file
inc/images/flags/wf.png ADDED
Binary file
inc/images/flags/ws.png ADDED
Binary file
inc/images/flags/ye.png ADDED
Binary file
inc/images/flags/yt.png ADDED
Binary file
inc/images/flags/za.png ADDED
Binary file
inc/images/flags/zm.png ADDED
Binary file
inc/images/flags/zw.png ADDED
Binary file
js/apbct-public.min.js CHANGED
@@ -1,2 +1,2 @@
1
- function ctSetCookie(e,t){0==+ctPublic.data__set_cookies||(document.cookie=e+"="+encodeURIComponent(t)+"; path=/; samesite=lax")}function apbct_collect_visible_fields(e){var t,n=[],o="",i=0,c=[];for(t in e.elements)isNaN(+t)||(n[t]=e.elements[t]);return(n=n.filter(function(e){return"none"!==getComputedStyle(e).display&&"hidden"!==getComputedStyle(e).visibility&&"0"!==getComputedStyle(e).opacity&&"hidden"!==e.getAttribute("type")&&"submit"!==e.getAttribute("type")&&null!==e.getAttribute("name")&&-1===c.indexOf(e.getAttribute("name"))&&(i++,-1===["radio","checkbox"].indexOf(e.getAttribute("type"))||(c.push(e.getAttribute("name")),!1))})).forEach(function(e,t,n){o+=" "+e.getAttribute("name")}),{visible_fields:o=o.trim(),visible_fields_count:i}}function apbct_visible_fields_set_cookie(e){e="object"==typeof e&&null!==e?e:{};ctSetCookie("apbct_visible_fields",JSON.stringify(e))}function apbct_js_keys__set_input_value(e,t,n,o){if(0<document.querySelectorAll("[name^=ct_checkjs]").length)for(var i=document.querySelectorAll("[name^=ct_checkjs]"),c=0;c<i.length;c++)i[c].value=e.js_key}function apbct_public_sendAJAX(t,n,o){var i=n.callback||null,c=n.callback_context||null,a=n.callback_params||null,e=n.async||!0,s=n.notJson||null,l=n.timeout||15e3,o=o||null,r=n.button||null,u=n.spinner||null,p=n.progressbar||null,d=n.silent||null,_=n.no_nonce||null;"string"==typeof t?t=(t=!_?t+"&_ajax_nonce="+ctPublic._ajax_nonce:t)+"&no_cache="+Math.random():(_||(t._ajax_nonce=ctPublic._ajax_nonce),t.no_cache=Math.random()),r&&(r.setAttribute("disabled","disabled"),r.style.cursor="not-allowed"),u&&jQuery(u).css("display","inline"),jQuery.ajax({type:"POST",url:ctPublic._ajax_url,data:t,async:e,success:function(e){r&&(r.removeAttribute("disabled"),r.style.cursor="pointer"),u&&jQuery(u).css("display","none"),(e=!s?JSON.parse(e):e).error?(setTimeout(function(){p&&p.fadeOut("slow")},1e3),console.log("Error happens: "+(e.error||"Unkown"))):i&&(a?i.apply(c,a.concat(e,t,n,o)):i(e,t,n,o))},error:function(e,t,n){r&&(r.removeAttribute("disabled"),r.style.cursor="pointer"),u&&jQuery(u).css("display","none"),n&&!d&&(console.log("APBCT_AJAX_ERROR"),console.log(e),console.log(t),console.log("Anti-spam by Cleantalk plugin error: "+n+"Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/"))},timeout:l})}function apbct_public_sendREST(t,n){var o=n.callback||null;jQuery.ajax({type:"POST",url:ctPublic._rest_url+"cleantalk-antispam/v1/"+t,beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",ctPublic._rest_nonce)},success:function(e){e.error?alert("Error happens: "+(e.error||"Unknown")):o&&o(e,t,n,null)},error:function(e,t,n){n&&(console.log("APBCT_REST_ERROR"),console.log(e),console.log(t),console.log("Anti-spam by Cleantalk plugin REST API error: "+n+" Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/"))}})}!function(){var e=new Date,t=(new Date).getTime(),n=!0,o=[],i=0;function c(e,t,n){"function"==typeof window.addEventListener?e.addEventListener(t,n):e.attachEvent(t,n)}function a(e,t,n){"function"==typeof window.removeEventListener?e.removeEventListener(t,n):e.detachEvent(t,n)}ctSetCookie("ct_ps_timestamp",Math.floor((new Date).getTime()/1e3)),ctSetCookie("ct_fkp_timestamp","0"),ctSetCookie("ct_pointer_data","0"),ctSetCookie("ct_timezone","0"),setTimeout(function(){ctSetCookie("ct_timezone",e.getTimezoneOffset()/60*-1)},1e3);var s=function(e){ctSetCookie("ct_fkp_timestamp",Math.floor((new Date).getTime()/1e3)),a(window,"mousedown",s),a(window,"keydown",s)},l=setInterval(function(){n=!0},150),r=setInterval(function(){ctSetCookie("ct_pointer_data",JSON.stringify(o))},1200),u=function(e){!0===n&&(o.push([Math.round(e.clientY),Math.round(e.clientX),Math.round((new Date).getTime()-t)]),n=!1,50<=++i&&(a(window,"mousemove",u),clearInterval(l),clearInterval(r)))};c(window,"mousemove",u),c(window,"mousedown",s),c(window,"keydown",s),c(window,"DOMContentLoaded",function(){ctSetCookie("apbct_visible_fields",0),setTimeout(function(){for(var e={},t=0;t<document.forms.length;t++){var n=document.forms[t];n.classList.contains("slp_search_form")||n.parentElement.classList.contains("mec-booking")||-1!==n.action.toString().indexOf("activehosted.com")||n.id&&"caspioform"==n.id||n.name.classList&&n.name.classList.contains("tinkoffPayRow")||n.name.classList&&n.name.classList.contains("give-form ")||(e[t]=apbct_collect_visible_fields(n),n.onsubmit_prev=n.onsubmit,n.onsubmit=function(e){var t={};t[0]=apbct_collect_visible_fields(this),apbct_visible_fields_set_cookie(t),e.target.onsubmit_prev instanceof Function&&setTimeout(function(){e.target.onsubmit_prev.call(e.target,e)},500)})}apbct_visible_fields_set_cookie(e)},1e3)})}(),"undefined"!=typeof jQuery&&jQuery(document).ajaxComplete(function(e,t,n){!t.responseText||-1===t.responseText.indexOf('"apbct')||void 0!==(t=JSON.parse(t.responseText)).apbct&&(t=t.apbct).blocked&&(document.dispatchEvent(new CustomEvent("apbctAjaxBockAlert",{bubbles:!0,detail:{message:t.comment}})),cleantalkModal.loaded=t.comment,cleantalkModal.open(),1==+t.stop_script&&window.stop())});
2
  //# sourceMappingURL=apbct-public.min.js.map
1
+ function ctSetCookie(e,t,n){var o;("string"==typeof e&&"string"==typeof t||"number"==typeof t)&&(o="ct_pointer_data"===e||"ct_user_info"===e,e=[[e,t,n]]),0==+ctPublic.data__set_cookies||(1==+ctPublic.data__set_cookies?e.forEach(function(e,t,n){var o=void 0!==e[2]?"expires="+o+"; ":"";document.cookie=e[0]+"="+encodeURIComponent(e[1])+"; "+o+"path=/; samesite=lax"}):2!=+ctPublic.data__set_cookies||o||(1==+ctPublic.data__set_cookies__alt_sessions_type?apbct_public_sendREST("alt_sessions",{method:"POST",data:{cookies:e}}):2==+ctPublic.data__set_cookies__alt_sessions_type&&apbct_public_sendAJAX({action:"apbct_alt_session__save__AJAX",cookies:e},{})))}function apbct_collect_visible_fields(e){var t,n=[],o="",i=0,s=[];for(t in e.elements)isNaN(+t)||(n[t]=e.elements[t]);return(n=n.filter(function(e){return"none"!==getComputedStyle(e).display&&"hidden"!==getComputedStyle(e).visibility&&"0"!==getComputedStyle(e).opacity&&"hidden"!==e.getAttribute("type")&&"submit"!==e.getAttribute("type")&&null!==e.getAttribute("name")&&-1===s.indexOf(e.getAttribute("name"))&&(i++,-1===["radio","checkbox"].indexOf(e.getAttribute("type"))||(s.push(e.getAttribute("name")),!1))})).forEach(function(e,t,n){o+=" "+e.getAttribute("name")}),{visible_fields:o=o.trim(),visible_fields_count:i}}function apbct_visible_fields_set_cookie(e){e="object"==typeof e&&null!==e?e:{};ctSetCookie("apbct_visible_fields",JSON.stringify(e))}function apbct_js_keys__set_input_value(e,t,n,o){if(0<document.querySelectorAll("[name^=ct_checkjs]").length)for(var i=document.querySelectorAll("[name^=ct_checkjs]"),s=0;s<i.length;s++)i[s].value=e.js_key}function apbct_public_sendAJAX(t,n,o){var i=n.callback||null,s=n.callback_context||null,a=n.callback_params||null,e=n.async||!0,c=n.notJson||null,l=n.timeout||15e3,o=o||null,r=n.button||null,u=n.spinner||null,_=n.progressbar||null,p=n.silent||null,d=n.no_nonce||null;"string"==typeof t?t=(t=!d?t+"&_ajax_nonce="+ctPublic._ajax_nonce:t)+"&no_cache="+Math.random():(d||(t._ajax_nonce=ctPublic._ajax_nonce),t.no_cache=Math.random()),r&&(r.setAttribute("disabled","disabled"),r.style.cursor="not-allowed"),u&&jQuery(u).css("display","inline"),jQuery.ajax({type:"POST",url:ctPublic._ajax_url,data:t,async:e,success:function(e){r&&(r.removeAttribute("disabled"),r.style.cursor="pointer"),u&&jQuery(u).css("display","none"),(e=!c?JSON.parse(e):e).error?(setTimeout(function(){_&&_.fadeOut("slow")},1e3),console.log("Error happens: "+(e.error||"Unkown"))):i&&(a?i.apply(s,a.concat(e,t,n,o)):i(e,t,n,o))},error:function(e,t,n){r&&(r.removeAttribute("disabled"),r.style.cursor="pointer"),u&&jQuery(u).css("display","none"),n&&!p&&(console.log("APBCT_AJAX_ERROR"),console.log(e),console.log(t),console.log("Anti-spam by Cleantalk plugin error: "+n+"Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/"))},timeout:l})}function apbct_public_sendREST(t,n){var o=n.callback||null,e=n.data||[],i=n.method||"POST";jQuery.ajax({type:i,url:ctPublic._rest_url+"cleantalk-antispam/v1/"+t,data:e,beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",ctPublic._rest_nonce)},success:function(e){e.error?alert("Error happens: "+(e.error||"Unknown")):o&&o(e,t,n,null)},error:function(e,t,n){n&&(console.log("APBCT_REST_ERROR"),console.log(e),console.log(t),console.log("Anti-spam by Cleantalk plugin REST API error: "+n+" Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/"))}})}!function(){var e=new Date,t=(new Date).getTime(),n=!0,o=[],i=0;function s(e,t,n){"function"==typeof window.addEventListener?e.addEventListener(t,n):e.attachEvent(t,n)}function a(e,t,n){"function"==typeof window.removeEventListener?e.removeEventListener(t,n):e.detachEvent(t,n)}ctSetCookie([["ct_ps_timestamp",Math.floor((new Date).getTime()/1e3)],["ct_fkp_timestamp","0"],["ct_pointer_data","0"],["ct_timezone",e.getTimezoneOffset()/60*-1],["apbct_visible_fields","0"]]);var c=function(e){ctSetCookie("ct_fkp_timestamp",Math.floor((new Date).getTime()/1e3)),a(window,"mousedown",c),a(window,"keydown",c)},l=setInterval(function(){n=!0},150),r=setInterval(function(){ctSetCookie("ct_pointer_data",JSON.stringify(o))},1200),u=function(e){!0===n&&(o.push([Math.round(e.clientY),Math.round(e.clientX),Math.round((new Date).getTime()-t)]),n=!1,50<=++i&&(a(window,"mousemove",u),clearInterval(l),clearInterval(r)))};s(window,"mousemove",u),s(window,"mousedown",c),s(window,"keydown",c),s(window,"DOMContentLoaded",function(){setTimeout(function(){for(var e={},t=0;t<document.forms.length;t++){var n=document.forms[t];n.classList.contains("slp_search_form")||n.parentElement.classList.contains("mec-booking")||-1!==n.action.toString().indexOf("activehosted.com")||n.id&&"caspioform"==n.id||n.name.classList&&n.name.classList.contains("tinkoffPayRow")||n.name.classList&&n.name.classList.contains("give-form ")||(e[t]=apbct_collect_visible_fields(n),n.onsubmit_prev=n.onsubmit,n.onsubmit=function(e){var t={};t[0]=apbct_collect_visible_fields(this),apbct_visible_fields_set_cookie(t),e.target.onsubmit_prev instanceof Function&&setTimeout(function(){e.target.onsubmit_prev.call(e.target,e)},500)})}apbct_visible_fields_set_cookie(e)},1e3)})}(),"undefined"!=typeof jQuery&&jQuery(document).ajaxComplete(function(e,t,n){!t.responseText||-1===t.responseText.indexOf('"apbct')||void 0!==(t=JSON.parse(t.responseText)).apbct&&(t=t.apbct).blocked&&(document.dispatchEvent(new CustomEvent("apbctAjaxBockAlert",{bubbles:!0,detail:{message:t.comment}})),cleantalkModal.loaded=t.comment,cleantalkModal.open(),1==+t.stop_script&&window.stop())});
2
  //# sourceMappingURL=apbct-public.min.js.map
js/apbct-public.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"apbct-public.min.js","sources":["apbct-public.js"],"sourcesContent":["(function() {\n\n\tvar ct_date = new Date(),\n\t\tctTimeMs = new Date().getTime(),\n\t\tctMouseEventTimerFlag = true, //Reading interval flag\n\t\tctMouseData = [],\n\t\tctMouseDataCounter = 0;\n\n\tfunction apbct_attach_event_handler(elem, event, callback){\n\t\tif(typeof window.addEventListener === \"function\") elem.addEventListener(event, callback);\n\t\telse elem.attachEvent(event, callback);\n\t}\n\n\tfunction apbct_remove_event_handler(elem, event, callback){\n\t\tif(typeof window.removeEventListener === \"function\") elem.removeEventListener(event, callback);\n\t\telse elem.detachEvent(event, callback);\n\t}\n\n\tctSetCookie(\"ct_ps_timestamp\", Math.floor(new Date().getTime()/1000));\n\tctSetCookie(\"ct_fkp_timestamp\", \"0\");\n\tctSetCookie(\"ct_pointer_data\", \"0\");\n\tctSetCookie(\"ct_timezone\", \"0\");\n\n\tsetTimeout(function(){\n\t\tctSetCookie(\"ct_timezone\", ct_date.getTimezoneOffset()/60*(-1));\n\t},1000);\n\n\t//Writing first key press timestamp\n\tvar ctFunctionFirstKey = function output(event){\n\t\tvar KeyTimestamp = Math.floor(new Date().getTime()/1000);\n\t\tctSetCookie(\"ct_fkp_timestamp\", KeyTimestamp);\n\t\tctKeyStopStopListening();\n\t};\n\n\t//Reading interval\n\tvar ctMouseReadInterval = setInterval(function(){\n\t\tctMouseEventTimerFlag = true;\n\t}, 150);\n\n\t//Writting interval\n\tvar ctMouseWriteDataInterval = setInterval(function(){\n\t\tctSetCookie(\"ct_pointer_data\", JSON.stringify(ctMouseData));\n\t}, 1200);\n\n\t//Logging mouse position each 150 ms\n\tvar ctFunctionMouseMove = function output(event){\n\t\tif(ctMouseEventTimerFlag === true){\n\n\t\t\tctMouseData.push([\n\t\t\t\tMath.round(event.clientY),\n\t\t\t\tMath.round(event.clientX),\n\t\t\t\tMath.round(new Date().getTime() - ctTimeMs)\n\t\t\t]);\n\n\t\t\tctMouseDataCounter++;\n\t\t\tctMouseEventTimerFlag = false;\n\t\t\tif(ctMouseDataCounter >= 50){\n\t\t\t\tctMouseStopData();\n\t\t\t}\n\t\t}\n\t};\n\n\t//Stop mouse observing function\n\tfunction ctMouseStopData(){\n\t\tapbct_remove_event_handler(window, \"mousemove\", ctFunctionMouseMove);\n\t\tclearInterval(ctMouseReadInterval);\n\t\tclearInterval(ctMouseWriteDataInterval);\n\t}\n\n\t//Stop key listening function\n\tfunction ctKeyStopStopListening(){\n\t\tapbct_remove_event_handler(window, \"mousedown\", ctFunctionFirstKey);\n\t\tapbct_remove_event_handler(window, \"keydown\", ctFunctionFirstKey);\n\t}\n\n\tapbct_attach_event_handler(window, \"mousemove\", ctFunctionMouseMove);\n\tapbct_attach_event_handler(window, \"mousedown\", ctFunctionFirstKey);\n\tapbct_attach_event_handler(window, \"keydown\", ctFunctionFirstKey);\n\n\t// Ready function\n\tfunction apbct_ready(){\n\n\t\tctSetCookie(\"apbct_visible_fields\", 0);\n\n\t\tsetTimeout(function(){\n\n\t\t\tvar visible_fields_collection = {};\n\n\t\t\tfor(var i = 0; i < document.forms.length; i++){\n\t\t\t\tvar form = document.forms[i];\n\n\t\t\t\t//Exclusion for forms\n\t\t\t\tif (\n\t\t\t\t\tform.classList.contains('slp_search_form') || //StoreLocatorPlus form\n\t\t\t\t\tform.parentElement.classList.contains('mec-booking') ||\n\t\t\t\t\tform.action.toString().indexOf('activehosted.com') !== -1 || // Active Campaign\n\t\t\t\t\t(form.id && form.id == 'caspioform') || //Caspio Form\n\t\t\t\t\t(form.name.classList && form.name.classList.contains('tinkoffPayRow')) || // TinkoffPayForm\n\t\t\t\t\t(form.name.classList && form.name.classList.contains('give-form ')) // GiveWP\n\t\t\t\t)\n\t\t\t\t\tcontinue;\n\n\t\t\t\tvisible_fields_collection[i] = apbct_collect_visible_fields( form );\n\n\t\t\t\tform.onsubmit_prev = form.onsubmit;\n\t\t\t\tform.onsubmit = function (event) {\n\n\t\t\t\t\tvar visible_fields = {};\n\t\t\t\t\tvisible_fields[0] = apbct_collect_visible_fields(this);\n\t\t\t\t\tapbct_visible_fields_set_cookie( visible_fields );\n\n\t\t\t\t\t// Call previous submit action\n\t\t\t\t\tif (event.target.onsubmit_prev instanceof Function) {\n\t\t\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t\t\tevent.target.onsubmit_prev.call(event.target, event);\n\t\t\t\t\t\t}, 500);\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tapbct_visible_fields_set_cookie( visible_fields_collection );\n\n\t\t}, 1000);\n\t}\n\tapbct_attach_event_handler(window, \"DOMContentLoaded\", apbct_ready);\n\n}());\n\nfunction ctSetCookie(c_name, value) {\n\n\t// Cookies disabled\n\tif( +ctPublic.data__set_cookies === 0 ){\n\t\treturn;\n\n\t// Using alternative cookies\n\t// @todo Deal with high server load\n\t// }else if( +ctPublic.data__set_cookies__sessions === 1 ){\n\t// \tapbct_public_sendAJAX(\n\t// \t\t{\n\t// \t\t\taction: 'apbct_alt_session__save__AJAX',\n\t// \t\t\tname: c_name,\n\t// \t\t\tvalue: value,\n\t// \t\t},\n\t// \t\t{}\n\t// \t);\n\n\t// Using traditional cookies\n\t}else{\n\t\tdocument.cookie = c_name + \"=\" + encodeURIComponent(value) + \"; path=/; samesite=lax\";\n\t}\n}\n\nfunction apbct_collect_visible_fields( form ) {\n\n\t// Get only fields\n\tvar inputs = [],\n\t\tinputs_visible = '',\n\t\tinputs_visible_count = 0,\n\t\tinputs_with_duplicate_names = [];\n\n\tfor(var key in form.elements){\n\t\tif(!isNaN(+key))\n\t\t\tinputs[key] = form.elements[key];\n\t}\n\n\t// Filter fields\n\tinputs = inputs.filter(function(elem){\n\n\t\t// Filter fields\n\t\tif( getComputedStyle(elem).display === \"none\" || // hidden\n\t\t\tgetComputedStyle(elem).visibility === \"hidden\" || // hidden\n\t\t\tgetComputedStyle(elem).opacity === \"0\" || // hidden\n\t\t\telem.getAttribute(\"type\") === \"hidden\" || // type == hidden\n\t\t\telem.getAttribute(\"type\") === \"submit\" || // type == submit\n\t\t\t//elem.value === \"\" || // empty value\n\t\t\telem.getAttribute('name') === null ||\n\t\t\tinputs_with_duplicate_names.indexOf( elem.getAttribute('name') ) !== -1 // name already added\n\t\t){\n\t\t\treturn false;\n\t\t}\n\n\t\t// Visible fields count\n\t\tinputs_visible_count++;\n\n\t\t// Filter inputs with same names for type == radio\n\t\tif( -1 !== ['radio', 'checkbox'].indexOf( elem.getAttribute(\"type\") )){\n\t\t\tinputs_with_duplicate_names.push( elem.getAttribute('name') );\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t});\n\n\t// Visible fields\n\tinputs.forEach(function(elem, i, elements){\n\t\tinputs_visible += \" \" + elem.getAttribute(\"name\");\n\t});\n\tinputs_visible = inputs_visible.trim();\n\n\treturn {\n\t\tvisible_fields : inputs_visible,\n\t\tvisible_fields_count : inputs_visible_count,\n\t}\n\n}\n\nfunction apbct_visible_fields_set_cookie( visible_fields_collection ) {\n\n\tvar collection = typeof visible_fields_collection === 'object' && visible_fields_collection !== null ? visible_fields_collection : {};\n\n\tctSetCookie(\"apbct_visible_fields\", JSON.stringify( collection ) );\n\n}\n\nfunction apbct_js_keys__set_input_value(result, data, params, obj){\n\tif( document.querySelectorAll('[name^=ct_checkjs]').length > 0 ) {\n\t\tvar elements = document.querySelectorAll('[name^=ct_checkjs]');\n\t\tfor ( var i = 0; i < elements.length; i++ ) {\n\t\t\telements[i].value = result.js_key;\n\t\t}\n\t}\n}\n\nfunction apbct_public_sendAJAX(data, params, obj){\n\n\t// Default params\n\tvar callback = params.callback || null;\n\tvar callback_context = params.callback_context || null;\n\tvar callback_params = params.callback_params || null;\n\tvar async = params.async || true;\n\tvar notJson = params.notJson || null;\n\tvar timeout = params.timeout || 15000;\n\tvar obj = obj || null;\n\tvar button = params.button || null;\n\tvar spinner = params.spinner || null;\n\tvar progressbar = params.progressbar || null;\n\tvar silent = params.silent || null;\n\tvar no_nonce = params.no_nonce || null;\n\n\tif(typeof (data) === 'string') {\n\t\tif( ! no_nonce )\n\t\t\tdata = data + '&_ajax_nonce=' + ctPublic._ajax_nonce;\n\t\tdata = data + '&no_cache=' + Math.random()\n\t} else {\n\t\tif( ! no_nonce )\n\t\t\tdata._ajax_nonce = ctPublic._ajax_nonce;\n\t\tdata.no_cache = Math.random();\n\t}\n\t// Button and spinner\n\tif(button) {button.setAttribute('disabled', 'disabled'); button.style.cursor = 'not-allowed'; }\n\tif(spinner) jQuery(spinner).css('display', 'inline');\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ctPublic._ajax_url,\n\t\tdata: data,\n\t\tasync: async,\n\t\tsuccess: function(result){\n\t\t\tif(button){ button.removeAttribute('disabled'); button.style.cursor = 'pointer'; }\n\t\t\tif(spinner) jQuery(spinner).css('display', 'none');\n\t\t\tif(!notJson) result = JSON.parse(result);\n\t\t\tif(result.error){\n\t\t\t\tsetTimeout(function(){ if(progressbar) progressbar.fadeOut('slow'); }, 1000);\n\t\t\t\tconsole.log('Error happens: ' + (result.error || 'Unkown'));\n\t\t\t}else{\n\t\t\t\tif(callback) {\n\t\t\t\t\tif (callback_params)\n\t\t\t\t\t\tcallback.apply( callback_context, callback_params.concat( result, data, params, obj ) );\n\t\t\t\t\telse\n\t\t\t\t\t\tcallback(result, data, params, obj);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\terror: function(jqXHR, textStatus, errorThrown){\n\t\t\tif(button){ button.removeAttribute('disabled'); button.style.cursor = 'pointer'; }\n\t\t\tif(spinner) jQuery(spinner).css('display', 'none');\n\t\t\tif( errorThrown && ! silent ) {\n\t\t\t\tconsole.log('APBCT_AJAX_ERROR');\n\t\t\t\tconsole.log(jqXHR);\n\t\t\t\tconsole.log(textStatus);\n\t\t\t\tconsole.log('Anti-spam by Cleantalk plugin error: ' + errorThrown + 'Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/');\n\t\t\t}\n\t\t},\n\t\ttimeout: timeout,\n\t});\n}\n\nfunction apbct_public_sendREST( route, params ) {\n\n\tvar callback = params.callback || null;\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ctPublic._rest_url + 'cleantalk-antispam/v1/' + route,\n\t\tbeforeSend : function ( xhr ) {\n\t\t\txhr.setRequestHeader( 'X-WP-Nonce', ctPublic._rest_nonce );\n\t\t},\n\t\tsuccess: function(result){\n\t\t\tif(result.error){\n\t\t\t\talert('Error happens: ' + (result.error || 'Unknown'));\n\t\t\t}else{\n\t\t\t\tif(callback) {\n\t\t\t\t\tvar obj = null;\n\t\t\t\t\tcallback(result, route, params, obj);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\terror: function(jqXHR, textStatus, errorThrown){\n\t\t\tif( errorThrown ) {\n\t\t\t\tconsole.log('APBCT_REST_ERROR');\n\t\t\t\tconsole.log(jqXHR);\n\t\t\t\tconsole.log(textStatus);\n\t\t\t\tconsole.log('Anti-spam by Cleantalk plugin REST API error: ' + errorThrown + ' Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/');\n\t\t\t}\n\t\t},\n\t});\n\n}\n\nif(typeof jQuery !== 'undefined') {\n\n\t// Capturing responses and output block message for unknown AJAX forms\n\tjQuery(document).ajaxComplete(function (event, xhr, settings) {\n\t\tif (xhr.responseText && xhr.responseText.indexOf('\"apbct') !== -1) {\n\t\t\tvar response = JSON.parse(xhr.responseText);\n\t\t\tif (typeof response.apbct !== 'undefined') {\n\t\t\t\tresponse = response.apbct;\n\t\t\t\tif (response.blocked) {\n\t\t\t\t\tdocument.dispatchEvent(\n\t\t\t\t\t\tnew CustomEvent( \"apbctAjaxBockAlert\", {\n\t\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\t\tdetail: { message: response.comment }\n\t\t\t\t\t\t} )\n\t\t\t\t\t);\n\n\t\t\t\t\t// Show the result by modal\n\t\t\t\t\tcleantalkModal.loaded = response.comment;\n\t\t\t\t\tcleantalkModal.open();\n\n\t\t\t\t\tif(+response.stop_script == 1)\n\t\t\t\t\t\twindow.stop();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n}"],"names":["ctSetCookie","c_name","value","ctPublic","data__set_cookies","document","cookie","encodeURIComponent","apbct_collect_visible_fields","form","key","inputs","inputs_visible","inputs_visible_count","inputs_with_duplicate_names","elements","isNaN","filter","elem","getComputedStyle","display","visibility","opacity","getAttribute","indexOf","push","forEach","i","visible_fields","trim","visible_fields_count","apbct_visible_fields_set_cookie","visible_fields_collection","collection","JSON","stringify","apbct_js_keys__set_input_value","result","data","params","obj","querySelectorAll","length","js_key","apbct_public_sendAJAX","callback","callback_context","callback_params","async","notJson","timeout","button","spinner","progressbar","silent","no_nonce","_ajax_nonce","Math","random","no_cache","setAttribute","style","cursor","jQuery","css","ajax","type","url","_ajax_url","success","removeAttribute","parse","error","setTimeout","fadeOut","console","log","apply","concat","jqXHR","textStatus","errorThrown","apbct_public_sendREST","route","_rest_url","beforeSend","xhr","setRequestHeader","_rest_nonce","alert","ct_date","Date","ctTimeMs","getTime","ctMouseEventTimerFlag","ctMouseData","ctMouseDataCounter","apbct_attach_event_handler","event","window","addEventListener","attachEvent","apbct_remove_event_handler","removeEventListener","detachEvent","floor","getTimezoneOffset","ctFunctionFirstKey","ctMouseReadInterval","setInterval","ctMouseWriteDataInterval","ctFunctionMouseMove","round","clientY","clientX","clearInterval","forms","classList","contains","parentElement","action","toString","id","name","onsubmit_prev","onsubmit","this","target","Function","call","ajaxComplete","settings","responseText","response","apbct","blocked","dispatchEvent","CustomEvent","bubbles","detail","message","comment","cleantalkModal","loaded","open","stop_script","stop"],"mappings":"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"}
1
+ {"version":3,"file":"apbct-public.min.js","sources":["apbct-public.js"],"sourcesContent":["(function() {\n\n\tvar ct_date = new Date(),\n\t\tctTimeMs = new Date().getTime(),\n\t\tctMouseEventTimerFlag = true, //Reading interval flag\n\t\tctMouseData = [],\n\t\tctMouseDataCounter = 0;\n\n\tfunction apbct_attach_event_handler(elem, event, callback){\n\t\tif(typeof window.addEventListener === \"function\") elem.addEventListener(event, callback);\n\t\telse elem.attachEvent(event, callback);\n\t}\n\n\tfunction apbct_remove_event_handler(elem, event, callback){\n\t\tif(typeof window.removeEventListener === \"function\") elem.removeEventListener(event, callback);\n\t\telse elem.detachEvent(event, callback);\n\t}\n\n\tctSetCookie(\n\t\t[\n\t\t\t[ \"ct_ps_timestamp\", Math.floor(new Date().getTime() / 1000) ],\n\t\t\t[ \"ct_fkp_timestamp\", \"0\" ],\n\t\t\t[ \"ct_pointer_data\", \"0\" ],\n\t\t\t[ \"ct_timezone\", ct_date.getTimezoneOffset()/60*(-1) ],\n\t\t\t[ \"apbct_visible_fields\", \"0\" ],\n\t\t]\n\t);\n\n\t//Writing first key press timestamp\n\tvar ctFunctionFirstKey = function output(event){\n\t\tvar KeyTimestamp = Math.floor(new Date().getTime()/1000);\n\t\tctSetCookie(\"ct_fkp_timestamp\", KeyTimestamp);\n\t\tctKeyStopStopListening();\n\t};\n\n\t//Reading interval\n\tvar ctMouseReadInterval = setInterval(function(){\n\t\tctMouseEventTimerFlag = true;\n\t}, 150);\n\n\t//Writting interval\n\tvar ctMouseWriteDataInterval = setInterval(function(){\n\t\tctSetCookie(\"ct_pointer_data\", JSON.stringify(ctMouseData));\n\t}, 1200);\n\n\t//Logging mouse position each 150 ms\n\tvar ctFunctionMouseMove = function output(event){\n\t\tif(ctMouseEventTimerFlag === true){\n\n\t\t\tctMouseData.push([\n\t\t\t\tMath.round(event.clientY),\n\t\t\t\tMath.round(event.clientX),\n\t\t\t\tMath.round(new Date().getTime() - ctTimeMs)\n\t\t\t]);\n\n\t\t\tctMouseDataCounter++;\n\t\t\tctMouseEventTimerFlag = false;\n\t\t\tif(ctMouseDataCounter >= 50){\n\t\t\t\tctMouseStopData();\n\t\t\t}\n\t\t}\n\t};\n\n\t//Stop mouse observing function\n\tfunction ctMouseStopData(){\n\t\tapbct_remove_event_handler(window, \"mousemove\", ctFunctionMouseMove);\n\t\tclearInterval(ctMouseReadInterval);\n\t\tclearInterval(ctMouseWriteDataInterval);\n\t}\n\n\t//Stop key listening function\n\tfunction ctKeyStopStopListening(){\n\t\tapbct_remove_event_handler(window, \"mousedown\", ctFunctionFirstKey);\n\t\tapbct_remove_event_handler(window, \"keydown\", ctFunctionFirstKey);\n\t}\n\n\tapbct_attach_event_handler(window, \"mousemove\", ctFunctionMouseMove);\n\tapbct_attach_event_handler(window, \"mousedown\", ctFunctionFirstKey);\n\tapbct_attach_event_handler(window, \"keydown\", ctFunctionFirstKey);\n\n\t// Ready function\n\tfunction apbct_ready(){\n\n\t\tsetTimeout(function(){\n\n\t\t\tvar visible_fields_collection = {};\n\n\t\t\tfor(var i = 0; i < document.forms.length; i++){\n\t\t\t\tvar form = document.forms[i];\n\n\t\t\t\t//Exclusion for forms\n\t\t\t\tif (\n\t\t\t\t\tform.classList.contains('slp_search_form') || //StoreLocatorPlus form\n\t\t\t\t\tform.parentElement.classList.contains('mec-booking') ||\n\t\t\t\t\tform.action.toString().indexOf('activehosted.com') !== -1 || // Active Campaign\n\t\t\t\t\t(form.id && form.id == 'caspioform') || //Caspio Form\n\t\t\t\t\t(form.name.classList && form.name.classList.contains('tinkoffPayRow')) || // TinkoffPayForm\n\t\t\t\t\t(form.name.classList && form.name.classList.contains('give-form ')) // GiveWP\n\t\t\t\t)\n\t\t\t\t\tcontinue;\n\n\t\t\t\tvisible_fields_collection[i] = apbct_collect_visible_fields( form );\n\n\t\t\t\tform.onsubmit_prev = form.onsubmit;\n\t\t\t\tform.onsubmit = function (event) {\n\n\t\t\t\t\tvar visible_fields = {};\n\t\t\t\t\tvisible_fields[0] = apbct_collect_visible_fields(this);\n\t\t\t\t\tapbct_visible_fields_set_cookie( visible_fields );\n\n\t\t\t\t\t// Call previous submit action\n\t\t\t\t\tif (event.target.onsubmit_prev instanceof Function) {\n\t\t\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t\t\tevent.target.onsubmit_prev.call(event.target, event);\n\t\t\t\t\t\t}, 500);\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tapbct_visible_fields_set_cookie( visible_fields_collection );\n\n\t\t}, 1000);\n\t}\n\tapbct_attach_event_handler(window, \"DOMContentLoaded\", apbct_ready);\n\n}());\n\nfunction ctSetCookie( cookies, value, expires ){\n\n\tif( typeof cookies === 'string' && typeof value === 'string' || typeof value === 'number'){\n\t\tvar skip_alt = cookies === 'ct_pointer_data' || cookies === 'ct_user_info';\n\t\tcookies = [ [ cookies, value, expires ] ];\n\t}\n\n\t// Cookies disabled\n\tif( +ctPublic.data__set_cookies === 0 ){\n\t\treturn;\n\n\t// Using traditional cookies\n\t}else if( +ctPublic.data__set_cookies === 1 ){\n\t\tcookies.forEach( function (item, i, arr\t) {\n\t\t\tvar expires = typeof item[2] !== 'undefined' ? \"expires=\" + expires + '; ' : '';\n\t\t\tdocument.cookie = item[0] + \"=\" + encodeURIComponent(item[1]) + \"; \" + expires + \"path=/; samesite=lax\";\n\t\t});\n\n\t// Using alternative cookies\n\t}else if( +ctPublic.data__set_cookies === 2 && ! skip_alt ){\n\n\t\t// Using REST API handler\n\t\tif( +ctPublic.data__set_cookies__alt_sessions_type === 1 ){\n\t\t\tapbct_public_sendREST(\n\t\t\t\t'alt_sessions',\n\t\t\t\t{\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\tdata: { cookies: cookies }\n\t\t\t\t}\n\t\t\t);\n\n\t\t// Using AJAX request and handler\n\t\t}else if( +ctPublic.data__set_cookies__alt_sessions_type === 2 ) {\n\t\t\tapbct_public_sendAJAX(\n\t\t\t\t{\n\t\t\t\t\taction: 'apbct_alt_session__save__AJAX',\n\t\t\t\t\tcookies: cookies,\n\t\t\t\t},\n\t\t\t\t{}\n\t\t\t);\n\t\t}\n\t}\n}\n\nfunction apbct_collect_visible_fields( form ) {\n\n\t// Get only fields\n\tvar inputs = [],\n\t\tinputs_visible = '',\n\t\tinputs_visible_count = 0,\n\t\tinputs_with_duplicate_names = [];\n\n\tfor(var key in form.elements){\n\t\tif(!isNaN(+key))\n\t\t\tinputs[key] = form.elements[key];\n\t}\n\n\t// Filter fields\n\tinputs = inputs.filter(function(elem){\n\n\t\t// Filter fields\n\t\tif( getComputedStyle(elem).display === \"none\" || // hidden\n\t\t\tgetComputedStyle(elem).visibility === \"hidden\" || // hidden\n\t\t\tgetComputedStyle(elem).opacity === \"0\" || // hidden\n\t\t\telem.getAttribute(\"type\") === \"hidden\" || // type == hidden\n\t\t\telem.getAttribute(\"type\") === \"submit\" || // type == submit\n\t\t\t//elem.value === \"\" || // empty value\n\t\t\telem.getAttribute('name') === null ||\n\t\t\tinputs_with_duplicate_names.indexOf( elem.getAttribute('name') ) !== -1 // name already added\n\t\t){\n\t\t\treturn false;\n\t\t}\n\n\t\t// Visible fields count\n\t\tinputs_visible_count++;\n\n\t\t// Filter inputs with same names for type == radio\n\t\tif( -1 !== ['radio', 'checkbox'].indexOf( elem.getAttribute(\"type\") )){\n\t\t\tinputs_with_duplicate_names.push( elem.getAttribute('name') );\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t});\n\n\t// Visible fields\n\tinputs.forEach(function(elem, i, elements){\n\t\tinputs_visible += \" \" + elem.getAttribute(\"name\");\n\t});\n\tinputs_visible = inputs_visible.trim();\n\n\treturn {\n\t\tvisible_fields : inputs_visible,\n\t\tvisible_fields_count : inputs_visible_count,\n\t}\n\n}\n\nfunction apbct_visible_fields_set_cookie( visible_fields_collection ) {\n\n\tvar collection = typeof visible_fields_collection === 'object' && visible_fields_collection !== null ? visible_fields_collection : {};\n\n\tctSetCookie(\"apbct_visible_fields\", JSON.stringify( collection ) );\n\n}\n\nfunction apbct_js_keys__set_input_value(result, data, params, obj){\n\tif( document.querySelectorAll('[name^=ct_checkjs]').length > 0 ) {\n\t\tvar elements = document.querySelectorAll('[name^=ct_checkjs]');\n\t\tfor ( var i = 0; i < elements.length; i++ ) {\n\t\t\telements[i].value = result.js_key;\n\t\t}\n\t}\n}\n\nfunction apbct_public_sendAJAX(data, params, obj){\n\n\t// Default params\n\tvar callback = params.callback || null;\n\tvar callback_context = params.callback_context || null;\n\tvar callback_params = params.callback_params || null;\n\tvar async = params.async || true;\n\tvar notJson = params.notJson || null;\n\tvar timeout = params.timeout || 15000;\n\tvar obj = obj || null;\n\tvar button = params.button || null;\n\tvar spinner = params.spinner || null;\n\tvar progressbar = params.progressbar || null;\n\tvar silent = params.silent || null;\n\tvar no_nonce = params.no_nonce || null;\n\n\tif(typeof (data) === 'string') {\n\t\tif( ! no_nonce )\n\t\t\tdata = data + '&_ajax_nonce=' + ctPublic._ajax_nonce;\n\t\tdata = data + '&no_cache=' + Math.random()\n\t} else {\n\t\tif( ! no_nonce )\n\t\t\tdata._ajax_nonce = ctPublic._ajax_nonce;\n\t\tdata.no_cache = Math.random();\n\t}\n\t// Button and spinner\n\tif(button) {button.setAttribute('disabled', 'disabled'); button.style.cursor = 'not-allowed'; }\n\tif(spinner) jQuery(spinner).css('display', 'inline');\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ctPublic._ajax_url,\n\t\tdata: data,\n\t\tasync: async,\n\t\tsuccess: function(result){\n\t\t\tif(button){ button.removeAttribute('disabled'); button.style.cursor = 'pointer'; }\n\t\t\tif(spinner) jQuery(spinner).css('display', 'none');\n\t\t\tif(!notJson) result = JSON.parse(result);\n\t\t\tif(result.error){\n\t\t\t\tsetTimeout(function(){ if(progressbar) progressbar.fadeOut('slow'); }, 1000);\n\t\t\t\tconsole.log('Error happens: ' + (result.error || 'Unkown'));\n\t\t\t}else{\n\t\t\t\tif(callback) {\n\t\t\t\t\tif (callback_params)\n\t\t\t\t\t\tcallback.apply( callback_context, callback_params.concat( result, data, params, obj ) );\n\t\t\t\t\telse\n\t\t\t\t\t\tcallback(result, data, params, obj);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\terror: function(jqXHR, textStatus, errorThrown){\n\t\t\tif(button){ button.removeAttribute('disabled'); button.style.cursor = 'pointer'; }\n\t\t\tif(spinner) jQuery(spinner).css('display', 'none');\n\t\t\tif( errorThrown && ! silent ) {\n\t\t\t\tconsole.log('APBCT_AJAX_ERROR');\n\t\t\t\tconsole.log(jqXHR);\n\t\t\t\tconsole.log(textStatus);\n\t\t\t\tconsole.log('Anti-spam by Cleantalk plugin error: ' + errorThrown + 'Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/');\n\t\t\t}\n\t\t},\n\t\ttimeout: timeout,\n\t});\n}\n\nfunction apbct_public_sendREST( route, params ) {\n\n\tvar callback = params.callback || null;\n\tvar data = params.data || [];\n\tvar method = params.method || 'POST';\n\n\tjQuery.ajax({\n\t\ttype: method,\n\t\turl: ctPublic._rest_url + 'cleantalk-antispam/v1/' + route,\n\t\tdata: data,\n\t\tbeforeSend : function ( xhr ) {\n\t\t\txhr.setRequestHeader( 'X-WP-Nonce', ctPublic._rest_nonce );\n\t\t},\n\t\tsuccess: function(result){\n\t\t\tif(result.error){\n\t\t\t\talert('Error happens: ' + (result.error || 'Unknown'));\n\t\t\t}else{\n\t\t\t\tif(callback) {\n\t\t\t\t\tvar obj = null;\n\t\t\t\t\tcallback(result, route, params, obj);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\terror: function(jqXHR, textStatus, errorThrown){\n\t\t\tif( errorThrown ) {\n\t\t\t\tconsole.log('APBCT_REST_ERROR');\n\t\t\t\tconsole.log(jqXHR);\n\t\t\t\tconsole.log(textStatus);\n\t\t\t\tconsole.log('Anti-spam by Cleantalk plugin REST API error: ' + errorThrown + ' Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/');\n\t\t\t}\n\t\t},\n\t});\n\n}\n\nif(typeof jQuery !== 'undefined') {\n\n\t// Capturing responses and output block message for unknown AJAX forms\n\tjQuery(document).ajaxComplete(function (event, xhr, settings) {\n\t\tif (xhr.responseText && xhr.responseText.indexOf('\"apbct') !== -1) {\n\t\t\tvar response = JSON.parse(xhr.responseText);\n\t\t\tif (typeof response.apbct !== 'undefined') {\n\t\t\t\tresponse = response.apbct;\n\t\t\t\tif (response.blocked) {\n\t\t\t\t\tdocument.dispatchEvent(\n\t\t\t\t\t\tnew CustomEvent( \"apbctAjaxBockAlert\", {\n\t\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\t\tdetail: { message: response.comment }\n\t\t\t\t\t\t} )\n\t\t\t\t\t);\n\n\t\t\t\t\t// Show the result by modal\n\t\t\t\t\tcleantalkModal.loaded = response.comment;\n\t\t\t\t\tcleantalkModal.open();\n\n\t\t\t\t\tif(+response.stop_script == 1)\n\t\t\t\t\t\twindow.stop();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n}"],"names":["ctSetCookie","cookies","value","expires","skip_alt","ctPublic","data__set_cookies","forEach","item","i","arr","document","cookie","encodeURIComponent","data__set_cookies__alt_sessions_type","apbct_public_sendREST","method","data","apbct_public_sendAJAX","action","apbct_collect_visible_fields","form","key","inputs","inputs_visible","inputs_visible_count","inputs_with_duplicate_names","elements","isNaN","filter","elem","getComputedStyle","display","visibility","opacity","getAttribute","indexOf","push","visible_fields","trim","visible_fields_count","apbct_visible_fields_set_cookie","visible_fields_collection","collection","JSON","stringify","apbct_js_keys__set_input_value","result","params","obj","querySelectorAll","length","js_key","callback","callback_context","callback_params","async","notJson","timeout","button","spinner","progressbar","silent","no_nonce","_ajax_nonce","Math","random","no_cache","setAttribute","style","cursor","jQuery","css","ajax","type","url","_ajax_url","success","removeAttribute","parse","error","setTimeout","fadeOut","console","log","apply","concat","jqXHR","textStatus","errorThrown","route","_rest_url","beforeSend","xhr","setRequestHeader","_rest_nonce","alert","ct_date","Date","ctTimeMs","getTime","ctMouseEventTimerFlag","ctMouseData","ctMouseDataCounter","apbct_attach_event_handler","event","window","addEventListener","attachEvent","apbct_remove_event_handler","removeEventListener","detachEvent","floor","getTimezoneOffset","ctFunctionFirstKey","ctMouseReadInterval","setInterval","ctMouseWriteDataInterval","ctFunctionMouseMove","round","clientY","clientX","clearInterval","forms","classList","contains","parentElement","toString","id","name","onsubmit_prev","onsubmit","this","target","Function","call","ajaxComplete","settings","responseText","response","apbct","blocked","dispatchEvent","CustomEvent","bubbles","detail","message","comment","cleantalkModal","loaded","open","stop_script","stop"],"mappings":"AA+HA,SAASA,YAAaC,EAASC,EAAOC,GAErC,IACKC,GADkB,iBAAZH,GAAyC,iBAAVC,GAAuC,iBAAVA,KAClEE,EAAuB,oBAAZH,GAA6C,iBAAZA,EAChDA,EAAU,CAAE,CAAEA,EAASC,EAAOC,KAIK,IAA/BE,SAASC,oBAI4B,IAA/BD,SAASC,kBACnBL,EAAQM,QAAS,SAAUC,EAAMC,EAAGC,GACnC,IAAIP,OAA6B,IAAZK,EAAK,GAAqB,WAAaL,EAAU,KAAO,GAC7EQ,SAASC,OAASJ,EAAK,GAAK,IAAMK,mBAAmBL,EAAK,IAAM,KAAOL,EAAU,yBAIzC,IAA/BE,SAASC,mBAA6BF,IAGO,IAAlDC,SAASS,qCACbC,sBACC,eACA,CACCC,OAAQ,OACRC,KAAM,CAAEhB,QAASA,KAKyC,IAAlDI,SAASS,sCACnBI,sBACC,CACCC,OAAQ,gCACRlB,QAASA,GAEV,MAMJ,SAASmB,6BAA8BC,GAGtC,IAKQC,EALJC,EAAS,GACZC,EAAiB,GACjBC,EAAuB,EACvBC,EAA8B,GAE/B,IAAQJ,KAAOD,EAAKM,SACfC,OAAON,KACVC,EAAOD,GAAOD,EAAKM,SAASL,IAqC9B,OAjCAC,EAASA,EAAOM,OAAO,SAASC,GAG/B,MAA0C,SAAtCC,iBAAiBD,GAAME,SACY,WAAtCD,iBAAiBD,GAAMG,YACe,MAAtCF,iBAAiBD,GAAMI,SACe,WAAtCJ,EAAKK,aAAa,SACoB,WAAtCL,EAAKK,aAAa,SAEoB,OAAtCL,EAAKK,aAAa,UACoD,IAAtET,EAA4BU,QAASN,EAAKK,aAAa,WAMxDV,KAGK,IAAM,CAAC,QAAS,YAAYW,QAASN,EAAKK,aAAa,WAC3DT,EAA4BW,KAAMP,EAAKK,aAAa,UAC7C,OAOF5B,QAAQ,SAASuB,EAAMrB,EAAGkB,GAChCH,GAAkB,IAAMM,EAAKK,aAAa,UAIpC,CACNG,eAHDd,EAAiBA,EAAee,OAI/BC,qBAAuBf,GAKzB,SAASgB,gCAAiCC,GAErCC,EAAkD,iBAA9BD,GAAwE,OAA9BA,EAAsCA,EAA4B,GAEpI1C,YAAY,uBAAwB4C,KAAKC,UAAWF,IAIrD,SAASG,+BAA+BC,EAAQ9B,EAAM+B,EAAQC,GAC7D,GAA6D,EAAzDtC,SAASuC,iBAAiB,sBAAsBC,OAEnD,IADA,IAAIxB,EAAWhB,SAASuC,iBAAiB,sBAC/BzC,EAAI,EAAGA,EAAIkB,EAASwB,OAAQ1C,IACrCkB,EAASlB,GAAGP,MAAQ6C,EAAOK,OAK9B,SAASlC,sBAAsBD,EAAM+B,EAAQC,GAG5C,IAAII,EAAcL,EAAOK,UAAe,KACpCC,EAAmBN,EAAOM,kBAAoB,KAC9CC,EAAkBP,EAAOO,iBAAmB,KAC5CC,EAAQR,EAAOQ,QAAS,EACxBC,EAAcT,EAAOS,SAAe,KACpCC,EAAcV,EAAOU,SAAe,KACpCT,EAAcA,GAAsB,KACpCU,EAAcX,EAAOW,QAAe,KACpCC,EAAcZ,EAAOY,SAAe,KACpCC,EAAcb,EAAOa,aAAe,KACpCC,EAAcd,EAAOc,QAAe,KACpCC,EAAcf,EAAOe,UAAe,KAEnB,iBAAX,EAGT9C,GADCA,GADK8C,EACE9C,EAAO,gBAAkBZ,SAAS2D,YACnC/C,GAAO,aAAegD,KAAKC,UAE5BH,IACL9C,EAAK+C,YAAc3D,SAAS2D,aAC7B/C,EAAKkD,SAAWF,KAAKC,UAGnBP,IAAUA,EAAOS,aAAa,WAAY,YAAaT,EAAOU,MAAMC,OAAS,eAC7EV,GAASW,OAAOX,GAASY,IAAI,UAAW,UAE3CD,OAAOE,KAAK,CACXC,KAAM,OACNC,IAAKtE,SAASuE,UACd3D,KAAMA,EACNuC,MAAOA,EACPqB,QAAS,SAAS9B,GACdY,IAAUA,EAAOmB,gBAAgB,YAAanB,EAAOU,MAAMC,OAAS,WACpEV,GAAUW,OAAOX,GAASY,IAAI,UAAW,SAC/BzB,GAATU,EAAkBb,KAAKmC,MAAMhC,GAC9BA,GAAOiC,OACTC,WAAW,WAAepB,GAAaA,EAAYqB,QAAQ,SAAY,KACvEC,QAAQC,IAAI,mBAAqBrC,EAAOiC,OAAS,YAE9C3B,IACEE,EACHF,EAASgC,MAAO/B,EAAkBC,EAAgB+B,OAAQvC,EAAQ9B,EAAM+B,EAAQC,IAEhFI,EAASN,EAAQ9B,EAAM+B,EAAQC,KAInC+B,MAAO,SAASO,EAAOC,EAAYC,GAC/B9B,IAAUA,EAAOmB,gBAAgB,YAAanB,EAAOU,MAAMC,OAAS,WACpEV,GAASW,OAAOX,GAASY,IAAI,UAAW,QACvCiB,IAAiB3B,IACpBqB,QAAQC,IAAI,oBACZD,QAAQC,IAAIG,GACZJ,QAAQC,IAAII,GACZL,QAAQC,IAAI,wCAA0CK,EAAc,yGAGtE/B,QAASA,IAIX,SAAS3C,sBAAuB2E,EAAO1C,GAEtC,IAAIK,EAAWL,EAAOK,UAAY,KAC9BpC,EAAW+B,EAAO/B,MAAQ,GAC1BD,EAAWgC,EAAOhC,QAAU,OAEhCuD,OAAOE,KAAK,CACXC,KAAM1D,EACN2D,IAAKtE,SAASsF,UAAY,yBAA2BD,EACrDzE,KAAMA,EACN2E,WAAa,SAAWC,GACvBA,EAAIC,iBAAkB,aAAczF,SAAS0F,cAE9ClB,QAAS,SAAS9B,GACdA,EAAOiC,MACTgB,MAAM,mBAAqBjD,EAAOiC,OAAS,YAExC3B,GAEFA,EAASN,EAAQ2C,EAAO1C,EADd,OAKbgC,MAAO,SAASO,EAAOC,EAAYC,GAC9BA,IACHN,QAAQC,IAAI,oBACZD,QAAQC,IAAIG,GACZJ,QAAQC,IAAII,GACZL,QAAQC,IAAI,iDAAmDK,EAAc,6GA9UhF,WAEA,IAAIQ,EAAU,IAAIC,KACjBC,GAAW,IAAID,MAAOE,UACtBC,GAAwB,EACxBC,EAAc,GACdC,EAAqB,EAEtB,SAASC,EAA2B1E,EAAM2E,EAAOpD,GACV,mBAA5BqD,OAAOC,iBAAiC7E,EAAK6E,iBAAiBF,EAAOpD,GAC7BvB,EAAK8E,YAAYH,EAAOpD,GAG3E,SAASwD,EAA2B/E,EAAM2E,EAAOpD,GACP,mBAA/BqD,OAAOI,oBAAoChF,EAAKgF,oBAAoBL,EAAOpD,GAChCvB,EAAKiF,YAAYN,EAAOpD,GAG9ErD,YACC,CACC,CAAE,kBAAmBiE,KAAK+C,OAAM,IAAId,MAAOE,UAAY,MACvD,CAAE,mBAAoB,KACtB,CAAE,kBAAmB,KACrB,CAAE,cAAeH,EAAQgB,oBAAoB,IAAK,GAClD,CAAE,uBAAwB,OAK5B,IAAIC,EAAqB,SAAgBT,GAExCzG,YAAY,mBADOiE,KAAK+C,OAAM,IAAId,MAAOE,UAAU,MA0CnDS,EAA2BH,OAAQ,YAAaQ,GAChDL,EAA2BH,OAAQ,UAAWQ,IArC3CC,EAAsBC,YAAY,WACrCf,GAAwB,GACtB,KAGCgB,EAA2BD,YAAY,WAC1CpH,YAAY,kBAAmB4C,KAAKC,UAAUyD,KAC5C,MAGCgB,EAAsB,SAAgBb,IACZ,IAA1BJ,IAEFC,EAAYjE,KAAK,CAChB4B,KAAKsD,MAAMd,EAAMe,SACjBvD,KAAKsD,MAAMd,EAAMgB,SACjBxD,KAAKsD,OAAM,IAAIrB,MAAOE,UAAYD,KAInCE,GAAwB,EACC,MAFzBE,IAUDM,EAA2BH,OAAQ,YAAaY,GAChDI,cAAcP,GACdO,cAAcL,MASfb,EAA2BE,OAAQ,YAAaY,GAChDd,EAA2BE,OAAQ,YAAaQ,GAChDV,EAA2BE,OAAQ,UAAWQ,GA6C9CV,EAA2BE,OAAQ,mBA1CnC,WAECzB,WAAW,WAIV,IAFA,IAAIvC,EAA4B,GAExBjC,EAAI,EAAGA,EAAIE,SAASgH,MAAMxE,OAAQ1C,IAAI,CAC7C,IAAIY,EAAOV,SAASgH,MAAMlH,GAIzBY,EAAKuG,UAAUC,SAAS,oBACxBxG,EAAKyG,cAAcF,UAAUC,SAAS,iBACkB,IAAxDxG,EAAKF,OAAO4G,WAAW3F,QAAQ,qBAC9Bf,EAAK2G,IAAiB,cAAX3G,EAAK2G,IAChB3G,EAAK4G,KAAKL,WAAavG,EAAK4G,KAAKL,UAAUC,SAAS,kBACpDxG,EAAK4G,KAAKL,WAAavG,EAAK4G,KAAKL,UAAUC,SAAS,gBAItDnF,EAA0BjC,GAAKW,6BAA8BC,GAE7DA,EAAK6G,cAAgB7G,EAAK8G,SAC1B9G,EAAK8G,SAAW,SAAU1B,GAEzB,IAAInE,EAAiB,GACrBA,EAAe,GAAKlB,6BAA6BgH,MACjD3F,gCAAiCH,GAG7BmE,EAAM4B,OAAOH,yBAAyBI,UACzCrD,WAAW,WACVwB,EAAM4B,OAAOH,cAAcK,KAAK9B,EAAM4B,OAAQ5B,IAC5C,OAKNhE,gCAAiCC,IAE/B,OAzHL,GAqVqB,oBAAX6B,QAGTA,OAAO5D,UAAU6H,aAAa,SAAU/B,EAAOZ,EAAK4C,IAC/C5C,EAAI6C,eAAwD,IAAxC7C,EAAI6C,aAAatG,QAAQ,gBAElB,KAD1BuG,EAAW/F,KAAKmC,MAAMc,EAAI6C,eACVE,QACnBD,EAAWA,EAASC,OACPC,UACZlI,SAASmI,cACR,IAAIC,YAAa,qBAAsB,CACtCC,SAAS,EACTC,OAAQ,CAAEC,QAASP,EAASQ,YAK9BC,eAAeC,OAASV,EAASQ,QACjCC,eAAeE,OAEa,IAAxBX,EAASY,aACZ7C,OAAO8C"}
js/cleantalk-admin.min.js CHANGED
@@ -1,2 +1,2 @@
1
- function apbct_admin_sendAJAX(n,o,a){var t=o.callback||null,l=o.callback_context||null,c=o.callback_params||null,e=o.async||!0,r=o.notJson||null,s=o.timeout||15e3,a=a||null,u=o.button||null,i=o.spinner||null,p=o.progressbar||null;"string"==typeof n?n=n+"&_ajax_nonce="+ctAdminCommon._ajax_nonce+"&no_cache="+Math.random():(n._ajax_nonce=ctAdminCommon._ajax_nonce,n.no_cache=Math.random()),u&&(u.setAttribute("disabled","disabled"),u.style.cursor="not-allowed"),i&&jQuery(i).css("display","inline"),jQuery.ajax({type:"POST",url:ctAdminCommon._ajax_url,data:n,async:e,success:function(e){u&&(u.removeAttribute("disabled"),u.style.cursor="pointer"),i&&jQuery(i).css("display","none"),(e=!r?JSON.parse(e):e).error?(setTimeout(function(){p&&p.fadeOut("slow")},1e3),alert("Error happens: "+(e.error||"Unkown"))):t&&(c?t.apply(l,c.concat(e,n,o,a)):t(e,n,o,a))},error:function(e,n,o){u&&(u.removeAttribute("disabled"),u.style.cursor="pointer"),i&&jQuery(i).css("display","none"),console.log("APBCT_AJAX_ERROR"),console.log(e),console.log(n),console.log(o)},timeout:s})}jQuery(document).ready(function(){jQuery(".apbct_update_notice").on("click","button",function(){var e=new Date((new Date).getTime()+2592e6);document.cookie="apbct_update_banner_closed=1; path=/; expires="+e.toUTCString()+"; samesite=lax"}),jQuery('li a[href="options-general.php?page=cleantalk"]').css("white-space","nowrap")});
2
  //# sourceMappingURL=cleantalk-admin.min.js.map
1
+ function apbct_admin_sendAJAX(n,o,t){var a=o.callback||null,l=o.callback_context||null,c=o.callback_params||null,e=o.async||!0,r=o.notJson||null,s=o.timeout||15e3,t=t||null,u=o.button||null,i=o.spinner||null,p=o.progressbar||null;"string"==typeof n?n=n+"&_ajax_nonce="+ctAdminCommon._ajax_nonce+"&no_cache="+Math.random():(n._ajax_nonce=ctAdminCommon._ajax_nonce,n.no_cache=Math.random()),u&&(u.setAttribute("disabled","disabled"),u.style.cursor="not-allowed"),i&&jQuery(i).css("display","inline"),jQuery.ajax({type:"POST",url:ctAdminCommon._ajax_url,data:n,async:e,success:function(e){u&&(u.removeAttribute("disabled"),u.style.cursor="pointer"),i&&jQuery(i).css("display","none"),(e=!r?JSON.parse(e):e).error?(setTimeout(function(){p&&p.fadeOut("slow")},1e3),alert("Error happens: "+(e.error||"Unkown"))):a&&(c?a.apply(l,c.concat(e,n,o,t)):a(e,n,o,t))},error:function(e,n,o){u&&(u.removeAttribute("disabled"),u.style.cursor="pointer"),i&&jQuery(i).css("display","none"),console.log("APBCT_AJAX_ERROR"),console.log(e),console.log(n),console.log(o)},timeout:s})}jQuery(document).ready(function(){jQuery(".apbct_update_notice").on("click","button",function(){var e=new Date((new Date).getTime()+2592e6),n="https:"===location.protocol?"; secure":"";document.cookie="apbct_update_banner_closed=1; path=/; expires="+e.toUTCString()+"; samesite=lax"+n}),jQuery('li a[href="options-general.php?page=cleantalk"]').css("white-space","nowrap")});
2
  //# sourceMappingURL=cleantalk-admin.min.js.map
js/cleantalk-admin.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cleantalk-admin.min.js","sources":["cleantalk-admin.js"],"sourcesContent":["jQuery(document).ready(function(){\n\t\n\t// Auto update banner close handler\n\tjQuery('.apbct_update_notice').on('click', 'button', function(){\n\t\tvar ct_date = new Date(new Date().getTime() + 1000 * 86400 * 30 );\n\t\tdocument.cookie = \"apbct_update_banner_closed=1; path=/; expires=\" + ct_date.toUTCString() + \"; samesite=lax\";\n\t});\n\t\n\tjQuery('li a[href=\"options-general.php?page=cleantalk\"]').css('white-space','nowrap');\n\t\n});\nfunction apbct_admin_sendAJAX(data, params, obj){\n\n\t// Default params\n\tvar callback = params.callback || null;\n\tvar callback_context = params.callback_context || null;\n\tvar callback_params = params.callback_params || null;\n\tvar async = params.async || true;\n\tvar notJson = params.notJson || null;\n\tvar timeout = params.timeout || 15000;\n\tvar obj = obj || null;\n\tvar button = params.button || null;\n\tvar spinner = params.spinner || null;\n\tvar progressbar = params.progressbar || null;\n\n\tif(typeof (data) === 'string') {\n\t\tdata = data + '&_ajax_nonce=' + ctAdminCommon._ajax_nonce + '&no_cache=' + Math.random();\n\t} else {\n\t\tdata._ajax_nonce = ctAdminCommon._ajax_nonce;\n\t\tdata.no_cache = Math.random();\n\t}\n\t// Button and spinner\n\tif(button) {button.setAttribute('disabled', 'disabled'); button.style.cursor = 'not-allowed'; }\n\tif(spinner) jQuery(spinner).css('display', 'inline');\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ctAdminCommon._ajax_url,\n\t\tdata: data,\n\t\tasync: async,\n\t\tsuccess: function(result){\n\t\t\tif(button){ button.removeAttribute('disabled'); button.style.cursor = 'pointer'; }\n\t\t\tif(spinner) jQuery(spinner).css('display', 'none');\n\t\t\tif(!notJson) result = JSON.parse(result);\n\t\t\tif(result.error){\n\t\t\t\tsetTimeout(function(){ if(progressbar) progressbar.fadeOut('slow'); }, 1000);\n\t\t\t\talert('Error happens: ' + (result.error || 'Unkown'));\n\t\t\t}else{\n\t\t\t\tif(callback) {\n\t\t\t\t\tif (callback_params)\n\t\t\t\t\t\tcallback.apply( callback_context, callback_params.concat( result, data, params, obj ) );\n\t\t\t\t\telse\n\t\t\t\t\t\tcallback(result, data, params, obj);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\terror: function(jqXHR, textStatus, errorThrown){\n\t\t\tif(button){ button.removeAttribute('disabled'); button.style.cursor = 'pointer'; }\n\t\t\tif(spinner) jQuery(spinner).css('display', 'none');\n\t\t\tconsole.log('APBCT_AJAX_ERROR');\n\t\t\tconsole.log(jqXHR);\n\t\t\tconsole.log(textStatus);\n\t\t\tconsole.log(errorThrown);\n\t\t},\n\t\ttimeout: timeout,\n\t});\n}"],"names":["apbct_admin_sendAJAX","data","params","obj","callback","callback_context","callback_params","async","notJson","timeout","button","spinner","progressbar","ctAdminCommon","_ajax_nonce","Math","random","no_cache","setAttribute","style","cursor","jQuery","css","ajax","type","url","_ajax_url","success","result","removeAttribute","JSON","parse","error","setTimeout","fadeOut","alert","apply","concat","jqXHR","textStatus","errorThrown","console","log","document","ready","on","ct_date","Date","getTime","cookie","toUTCString"],"mappings":"AAWA,SAASA,qBAAqBC,EAAMC,EAAQC,GAG3C,IAAIC,EAAcF,EAAOE,UAAe,KACpCC,EAAmBH,EAAOG,kBAAoB,KAC9CC,EAAkBJ,EAAOI,iBAAmB,KAC5CC,EAAQL,EAAOK,QAAS,EACxBC,EAAcN,EAAOM,SAAe,KACpCC,EAAcP,EAAOO,SAAe,KACpCN,EAAcA,GAAsB,KACpCO,EAAcR,EAAOQ,QAAe,KACpCC,EAAcT,EAAOS,SAAe,KACpCC,EAAcV,EAAOU,aAAe,KAEnB,iBAAX,EACTX,EAAOA,EAAO,gBAAkBY,cAAcC,YAAc,aAAeC,KAAKC,UAEhFf,EAAKa,YAAcD,cAAcC,YACjCb,EAAKgB,SAAWF,KAAKC,UAGnBN,IAAUA,EAAOQ,aAAa,WAAY,YAAaR,EAAOS,MAAMC,OAAS,eAC7ET,GAASU,OAAOV,GAASW,IAAI,UAAW,UAE3CD,OAAOE,KAAK,CACXC,KAAM,OACNC,IAAKZ,cAAca,UACnBzB,KAAMA,EACNM,MAAOA,EACPoB,QAAS,SAASC,GACdlB,IAAUA,EAAOmB,gBAAgB,YAAanB,EAAOS,MAAMC,OAAS,WACpET,GAAUU,OAAOV,GAASW,IAAI,UAAW,SAC/BM,GAATpB,EAAkBsB,KAAKC,MAAMH,GAC9BA,GAAOI,OACTC,WAAW,WAAerB,GAAaA,EAAYsB,QAAQ,SAAY,KACvEC,MAAM,mBAAqBP,EAAOI,OAAS,YAExC5B,IACEE,EACHF,EAASgC,MAAO/B,EAAkBC,EAAgB+B,OAAQT,EAAQ3B,EAAMC,EAAQC,IAEhFC,EAASwB,EAAQ3B,EAAMC,EAAQC,KAInC6B,MAAO,SAASM,EAAOC,EAAYC,GAC/B9B,IAAUA,EAAOmB,gBAAgB,YAAanB,EAAOS,MAAMC,OAAS,WACpET,GAASU,OAAOV,GAASW,IAAI,UAAW,QAC3CmB,QAAQC,IAAI,oBACZD,QAAQC,IAAIJ,GACZG,QAAQC,IAAIH,GACZE,QAAQC,IAAIF,IAEb/B,QAASA,IAhEXY,OAAOsB,UAAUC,MAAM,WAGtBvB,OAAO,wBAAwBwB,GAAG,QAAS,SAAU,WACpD,IAAIC,EAAU,IAAIC,MAAK,IAAIA,MAAOC,UAAY,QAC9CL,SAASM,OAAS,iDAAmDH,EAAQI,cAAgB,mBAG9F7B,OAAO,mDAAmDC,IAAI,cAAc"}
1
+ {"version":3,"file":"cleantalk-admin.min.js","sources":["cleantalk-admin.js"],"sourcesContent":["jQuery(document).ready(function(){\n\t\n\t// Auto update banner close handler\n\tjQuery('.apbct_update_notice').on('click', 'button', function(){\n\t\tvar ct_date = new Date(new Date().getTime() + 1000 * 86400 * 30 );\n\t\tvar ctSecure = location.protocol === 'https:' ? '; secure' : '';\n\t\tdocument.cookie = \"apbct_update_banner_closed=1; path=/; expires=\" + ct_date.toUTCString() + \"; samesite=lax\" + ctSecure;\n\t});\n\t\n\tjQuery('li a[href=\"options-general.php?page=cleantalk\"]').css('white-space','nowrap');\n\t\n});\nfunction apbct_admin_sendAJAX(data, params, obj){\n\n\t// Default params\n\tvar callback = params.callback || null;\n\tvar callback_context = params.callback_context || null;\n\tvar callback_params = params.callback_params || null;\n\tvar async = params.async || true;\n\tvar notJson = params.notJson || null;\n\tvar timeout = params.timeout || 15000;\n\tvar obj = obj || null;\n\tvar button = params.button || null;\n\tvar spinner = params.spinner || null;\n\tvar progressbar = params.progressbar || null;\n\n\tif(typeof (data) === 'string') {\n\t\tdata = data + '&_ajax_nonce=' + ctAdminCommon._ajax_nonce + '&no_cache=' + Math.random();\n\t} else {\n\t\tdata._ajax_nonce = ctAdminCommon._ajax_nonce;\n\t\tdata.no_cache = Math.random();\n\t}\n\t// Button and spinner\n\tif(button) {button.setAttribute('disabled', 'disabled'); button.style.cursor = 'not-allowed'; }\n\tif(spinner) jQuery(spinner).css('display', 'inline');\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ctAdminCommon._ajax_url,\n\t\tdata: data,\n\t\tasync: async,\n\t\tsuccess: function(result){\n\t\t\tif(button){ button.removeAttribute('disabled'); button.style.cursor = 'pointer'; }\n\t\t\tif(spinner) jQuery(spinner).css('display', 'none');\n\t\t\tif(!notJson) result = JSON.parse(result);\n\t\t\tif(result.error){\n\t\t\t\tsetTimeout(function(){ if(progressbar) progressbar.fadeOut('slow'); }, 1000);\n\t\t\t\talert('Error happens: ' + (result.error || 'Unkown'));\n\t\t\t}else{\n\t\t\t\tif(callback) {\n\t\t\t\t\tif (callback_params)\n\t\t\t\t\t\tcallback.apply( callback_context, callback_params.concat( result, data, params, obj ) );\n\t\t\t\t\telse\n\t\t\t\t\t\tcallback(result, data, params, obj);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\terror: function(jqXHR, textStatus, errorThrown){\n\t\t\tif(button){ button.removeAttribute('disabled'); button.style.cursor = 'pointer'; }\n\t\t\tif(spinner) jQuery(spinner).css('display', 'none');\n\t\t\tconsole.log('APBCT_AJAX_ERROR');\n\t\t\tconsole.log(jqXHR);\n\t\t\tconsole.log(textStatus);\n\t\t\tconsole.log(errorThrown);\n\t\t},\n\t\ttimeout: timeout,\n\t});\n}"],"names":["apbct_admin_sendAJAX","data","params","obj","callback","callback_context","callback_params","async","notJson","timeout","button","spinner","progressbar","ctAdminCommon","_ajax_nonce","Math","random","no_cache","setAttribute","style","cursor","jQuery","css","ajax","type","url","_ajax_url","success","result","removeAttribute","JSON","parse","error","setTimeout","fadeOut","alert","apply","concat","jqXHR","textStatus","errorThrown","console","log","document","ready","on","ct_date","Date","getTime","ctSecure","location","protocol","cookie","toUTCString"],"mappings":"AAYA,SAASA,qBAAqBC,EAAMC,EAAQC,GAG3C,IAAIC,EAAcF,EAAOE,UAAe,KACpCC,EAAmBH,EAAOG,kBAAoB,KAC9CC,EAAkBJ,EAAOI,iBAAmB,KAC5CC,EAAQL,EAAOK,QAAS,EACxBC,EAAcN,EAAOM,SAAe,KACpCC,EAAcP,EAAOO,SAAe,KACpCN,EAAcA,GAAsB,KACpCO,EAAcR,EAAOQ,QAAe,KACpCC,EAAcT,EAAOS,SAAe,KACpCC,EAAcV,EAAOU,aAAe,KAEnB,iBAAX,EACTX,EAAOA,EAAO,gBAAkBY,cAAcC,YAAc,aAAeC,KAAKC,UAEhFf,EAAKa,YAAcD,cAAcC,YACjCb,EAAKgB,SAAWF,KAAKC,UAGnBN,IAAUA,EAAOQ,aAAa,WAAY,YAAaR,EAAOS,MAAMC,OAAS,eAC7ET,GAASU,OAAOV,GAASW,IAAI,UAAW,UAE3CD,OAAOE,KAAK,CACXC,KAAM,OACNC,IAAKZ,cAAca,UACnBzB,KAAMA,EACNM,MAAOA,EACPoB,QAAS,SAASC,GACdlB,IAAUA,EAAOmB,gBAAgB,YAAanB,EAAOS,MAAMC,OAAS,WACpET,GAAUU,OAAOV,GAASW,IAAI,UAAW,SAC/BM,GAATpB,EAAkBsB,KAAKC,MAAMH,GAC9BA,GAAOI,OACTC,WAAW,WAAerB,GAAaA,EAAYsB,QAAQ,SAAY,KACvEC,MAAM,mBAAqBP,EAAOI,OAAS,YAExC5B,IACEE,EACHF,EAASgC,MAAO/B,EAAkBC,EAAgB+B,OAAQT,EAAQ3B,EAAMC,EAAQC,IAEhFC,EAASwB,EAAQ3B,EAAMC,EAAQC,KAInC6B,MAAO,SAASM,EAAOC,EAAYC,GAC/B9B,IAAUA,EAAOmB,gBAAgB,YAAanB,EAAOS,MAAMC,OAAS,WACpET,GAASU,OAAOV,GAASW,IAAI,UAAW,QAC3CmB,QAAQC,IAAI,oBACZD,QAAQC,IAAIJ,GACZG,QAAQC,IAAIH,GACZE,QAAQC,IAAIF,IAEb/B,QAASA,IAjEXY,OAAOsB,UAAUC,MAAM,WAGtBvB,OAAO,wBAAwBwB,GAAG,QAAS,SAAU,WACpD,IAAIC,EAAU,IAAIC,MAAK,IAAIA,MAAOC,UAAY,QAC1CC,EAAiC,WAAtBC,SAASC,SAAwB,WAAa,GAC7DR,SAASS,OAAS,iDAAmDN,EAAQO,cAAgB,iBAAmBJ,IAGjH5B,OAAO,mDAAmDC,IAAI,cAAc"}
js/cleantalk-modal.min.js CHANGED
@@ -1,2 +1,2 @@
1
- cleantalkModal={loaded:!1,loading:!1,opened:!1,opening:!1,load:function(e){this.loaded||(this.loading=!0,callback=function(e,t,a,n){cleantalkModal.loading=!1,cleantalkModal.loaded=e,document.dispatchEvent(new CustomEvent("cleantalkModalContentLoaded",{bubbles:!0}))},("function"==typeof apbct_admin_sendAJAX?apbct_admin_sendAJAX:apbct_public_sendAJAX)({action:e},{callback:callback,notJson:!0}))},open:function(){var e=function(){var e="";for(key in this.styles)e+=key+":"+this.styles[key]+";";return e},t={styles:{"z-index":"9999",position:"fixed",top:"0",left:"0",width:"100%",height:"100%",background:"rgba(0,0,0,0.5)",display:"flex","justify-content":"center","align-items":"center"},toString:e},a={styles:{position:"relative",padding:"30px",background:"#FFF",border:"1px solid rgba(0,0,0,0.75)","border-radius":"4px","box-shadow":"7px 7px 5px 0px rgba(50,50,50,0.75)"},toString:e},n={styles:{position:"absolute",background:"#FFF",width:"20px",height:"20px",border:"2px solid rgba(0,0,0,0.75)","border-radius":"15px",cursor:"pointer",top:"-8px",right:"-8px"},toString:e},o={styles:{content:'""',display:"block",position:"absolute",background:"#000","border-radius":"1px",width:"2px",height:"16px",top:"2px",left:"9px",transform:"rotate(45deg)"},toString:e},l={styles:{content:'""',display:"block",position:"absolute",background:"#000","border-radius":"1px",width:"2px",height:"16px",top:"2px",left:"9px",transform:"rotate(-45deg)"},toString:e},d={styles:{overflow:"hidden"},toString:e},e=document.createElement("style");e.setAttribute("id","cleantalk-modal-styles"),e.innerHTML="body.cleantalk-modal-opened{"+d+"}",e.innerHTML+="#cleantalk-modal-overlay{"+t+"}",e.innerHTML+="#cleantalk-modal-close{"+n+"}",e.innerHTML+="#cleantalk-modal-close:before{"+o+"}",e.innerHTML+="#cleantalk-modal-close:after{"+l+"}",document.body.append(e);l=document.createElement("div");l.setAttribute("id","cleantalk-modal-overlay"),document.body.append(l),document.body.classList.add("cleantalk-modal-opened");e=document.createElement("div");e.setAttribute("id","cleantalk-modal-inner"),e.setAttribute("style",a),l.append(e);l=document.createElement("div");l.setAttribute("id","cleantalk-modal-close"),e.append(l);l=document.createElement("div");this.loaded?l.innerHTML=this.loaded:(l.innerHTML="Loading...",this.load("get_options_template")),l.setAttribute("id","cleantalk-modal-content"),e.append(l),this.opened=!0},close:function(){document.body.classList.remove("cleantalk-modal-opened"),document.getElementById("cleantalk-modal-overlay").remove(),document.getElementById("cleantalk-modal-styles").remove(),document.dispatchEvent(new CustomEvent("cleantalkModalClosed",{bubbles:!0}))}},document.addEventListener("click",function(e){(e.target&&"cleantalk-modal-overlay"===e.target.id||"cleantalk-modal-close"===e.target.id)&&cleantalkModal.close()}),document.addEventListener("cleantalkModalContentLoaded",function(e){cleantalkModal.opened&&cleantalkModal.loaded&&(document.getElementById("cleantalk-modal-content").innerHTML=cleantalkModal.loaded)});
2
  //# sourceMappingURL=cleantalk-modal.min.js.map
1
+ cleantalkModal={loaded:!1,loading:!1,opened:!1,opening:!1,load:function(e){this.loaded||(this.loading=!0,callback=function(e,t,a,n){cleantalkModal.loading=!1,cleantalkModal.loaded=e,document.dispatchEvent(new CustomEvent("cleantalkModalContentLoaded",{bubbles:!0}))},("function"==typeof apbct_admin_sendAJAX?apbct_admin_sendAJAX:apbct_public_sendAJAX)({action:e},{callback:callback,notJson:!0}))},open:function(){function e(){var e="";for(key in this.styles)e+=key+":"+this.styles[key]+";";return e}var t={styles:{"z-index":"9999",position:"fixed",top:"0",left:"0",width:"100%",height:"100%",background:"rgba(0,0,0,0.5)",display:"flex","justify-content":"center","align-items":"center"},toString:e},a={styles:{position:"relative",padding:"30px",background:"#FFF",border:"1px solid rgba(0,0,0,0.75)","border-radius":"4px","box-shadow":"7px 7px 5px 0px rgba(50,50,50,0.75)"},toString:e},n={styles:{position:"absolute",background:"#FFF",width:"20px",height:"20px",border:"2px solid rgba(0,0,0,0.75)","border-radius":"15px",cursor:"pointer",top:"-8px",right:"-8px","box-sizing":"content-box"},toString:e},o={styles:{content:'""',display:"block",position:"absolute",background:"#000","border-radius":"1px",width:"2px",height:"16px",top:"2px",left:"9px",transform:"rotate(45deg)"},toString:e},l={styles:{content:'""',display:"block",position:"absolute",background:"#000","border-radius":"1px",width:"2px",height:"16px",top:"2px",left:"9px",transform:"rotate(-45deg)"},toString:e},d={styles:{overflow:"hidden"},toString:e},i=document.createElement("style");i.setAttribute("id","cleantalk-modal-styles"),i.innerHTML="body.cleantalk-modal-opened{"+d+"}",i.innerHTML+="#cleantalk-modal-overlay{"+t+"}",i.innerHTML+="#cleantalk-modal-close{"+n+"}",i.innerHTML+="#cleantalk-modal-close:before{"+o+"}",i.innerHTML+="#cleantalk-modal-close:after{"+l+"}",document.body.append(i);var c=document.createElement("div");c.setAttribute("id","cleantalk-modal-overlay"),document.body.append(c),document.body.classList.add("cleantalk-modal-opened");var r=document.createElement("div");r.setAttribute("id","cleantalk-modal-inner"),r.setAttribute("style",a),c.append(r);var s=document.createElement("div");s.setAttribute("id","cleantalk-modal-close"),r.append(s);var p=document.createElement("div");this.loaded?p.innerHTML=this.loaded:(p.innerHTML="Loading...",this.load("get_options_template")),p.setAttribute("id","cleantalk-modal-content"),r.append(p),this.opened=!0},close:function(){document.body.classList.remove("cleantalk-modal-opened"),document.getElementById("cleantalk-modal-overlay").remove(),document.getElementById("cleantalk-modal-styles").remove(),document.dispatchEvent(new CustomEvent("cleantalkModalClosed",{bubbles:!0}))}},document.addEventListener("click",function(e){(e.target&&"cleantalk-modal-overlay"===e.target.id||"cleantalk-modal-close"===e.target.id)&&cleantalkModal.close()}),document.addEventListener("cleantalkModalContentLoaded",function(e){cleantalkModal.opened&&cleantalkModal.loaded&&(document.getElementById("cleantalk-modal-content").innerHTML=cleantalkModal.loaded)});
2
  //# sourceMappingURL=cleantalk-modal.min.js.map
js/cleantalk-modal.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cleantalk-modal.min.js","sources":["cleantalk-modal.js"],"sourcesContent":["/* Cleantalk Modal object */\ncleantalkModal = {\n\n // Flags\n loaded: false,\n loading: false,\n opened: false,\n opening: false,\n\n // Methods\n load: function( action ) {\n if( ! this.loaded ) {\n this.loading = true;\n callback = function( result, data, params, obj ) {\n cleantalkModal.loading = false;\n cleantalkModal.loaded = result;\n document.dispatchEvent(\n new CustomEvent( \"cleantalkModalContentLoaded\", {\n bubbles: true,\n } )\n );\n };\n if( typeof apbct_admin_sendAJAX === \"function\" ) {\n apbct_admin_sendAJAX( { 'action' : action }, { 'callback': callback, 'notJson': true } );\n } else {\n apbct_public_sendAJAX( { 'action' : action }, { 'callback': callback, 'notJson': true } );\n }\n\n }\n },\n\n open: function () {\n /* Cleantalk Modal CSS start */\n var renderCss = function () {\n var cssStr = '';\n for ( key in this.styles ) {\n cssStr += key + ':' + this.styles[key] + ';';\n }\n return cssStr;\n };\n var overlayCss = {\n styles: {\n \"z-index\": \"9999\",\n \"position\": \"fixed\",\n \"top\": \"0\",\n \"left\": \"0\",\n \"width\": \"100%\",\n \"height\": \"100%\",\n \"background\": \"rgba(0,0,0,0.5)\",\n \"display\": \"flex\",\n \"justify-content\" : \"center\",\n \"align-items\" : \"center\",\n },\n toString: renderCss\n };\n var innerCss = {\n styles: {\n \"position\" : \"relative\",\n \"padding\" : \"30px\",\n \"background\" : \"#FFF\",\n \"border\" : \"1px solid rgba(0,0,0,0.75)\",\n \"border-radius\" : \"4px\",\n \"box-shadow\" : \"7px 7px 5px 0px rgba(50,50,50,0.75)\",\n },\n toString: renderCss\n };\n var closeCss = {\n styles: {\n \"position\" : \"absolute\",\n \"background\" : \"#FFF\",\n \"width\" : \"20px\",\n \"height\" : \"20px\",\n \"border\" : \"2px solid rgba(0,0,0,0.75)\",\n \"border-radius\" : \"15px\",\n \"cursor\" : \"pointer\",\n \"top\" : \"-8px\",\n \"right\" : \"-8px\",\n },\n toString: renderCss\n };\n var closeCssBefore = {\n styles: {\n \"content\" : \"\\\"\\\"\",\n \"display\" : \"block\",\n \"position\" : \"absolute\",\n \"background\" : \"#000\",\n \"border-radius\" : \"1px\",\n \"width\" : \"2px\",\n \"height\" : \"16px\",\n \"top\" : \"2px\",\n \"left\" : \"9px\",\n \"transform\" : \"rotate(45deg)\",\n },\n toString: renderCss\n };\n var closeCssAfter = {\n styles: {\n \"content\" : \"\\\"\\\"\",\n \"display\" : \"block\",\n \"position\" : \"absolute\",\n \"background\" : \"#000\",\n \"border-radius\" : \"1px\",\n \"width\" : \"2px\",\n \"height\" : \"16px\",\n \"top\" : \"2px\",\n \"left\" : \"9px\",\n \"transform\" : \"rotate(-45deg)\",\n },\n toString: renderCss\n };\n var bodyCss = {\n styles: {\n \"overflow\" : \"hidden\",\n },\n toString: renderCss\n };\n var cleantalkModalStyle = document.createElement( 'style' );\n cleantalkModalStyle.setAttribute( 'id', 'cleantalk-modal-styles' );\n cleantalkModalStyle.innerHTML = 'body.cleantalk-modal-opened{' + bodyCss + '}';\n cleantalkModalStyle.innerHTML += '#cleantalk-modal-overlay{' + overlayCss + '}';\n cleantalkModalStyle.innerHTML += '#cleantalk-modal-close{' + closeCss + '}';\n cleantalkModalStyle.innerHTML += '#cleantalk-modal-close:before{' + closeCssBefore + '}';\n cleantalkModalStyle.innerHTML += '#cleantalk-modal-close:after{' + closeCssAfter + '}';\n document.body.append( cleantalkModalStyle );\n /* Cleantalk Modal CSS end */\n\n var overlay = document.createElement( 'div' );\n overlay.setAttribute( 'id', 'cleantalk-modal-overlay' );\n document.body.append( overlay );\n\n document.body.classList.add( 'cleantalk-modal-opened' );\n\n var inner = document.createElement( 'div' );\n inner.setAttribute( 'id', 'cleantalk-modal-inner' );\n inner.setAttribute( 'style', innerCss );\n overlay.append( inner );\n\n var close = document.createElement( 'div' );\n close.setAttribute( 'id', 'cleantalk-modal-close' );\n inner.append( close );\n\n var content = document.createElement( 'div' );\n if ( this.loaded ) {\n content.innerHTML = this.loaded;\n } else {\n content.innerHTML = 'Loading...';\n // @ToDo Here is hardcoded parameter. Have to get this from a 'data-' attribute.\n this.load( 'get_options_template' );\n }\n content.setAttribute( 'id', 'cleantalk-modal-content' );\n inner.append( content );\n\n this.opened = true;\n },\n\n close: function () {\n document.body.classList.remove( 'cleantalk-modal-opened' );\n document.getElementById( 'cleantalk-modal-overlay' ).remove();\n document.getElementById( 'cleantalk-modal-styles' ).remove();\n document.dispatchEvent(\n new CustomEvent( \"cleantalkModalClosed\", {\n bubbles: true,\n } )\n );\n }\n\n};\n\n/* Cleantalk Modal helpers */\ndocument.addEventListener('click',function( e ){\n if( e.target && e.target.id === 'cleantalk-modal-overlay' || e.target.id === 'cleantalk-modal-close' ){\n cleantalkModal.close();\n }\n});\ndocument.addEventListener(\"cleantalkModalContentLoaded\", function( e ) {\n if( cleantalkModal.opened && cleantalkModal.loaded ) {\n document.getElementById( 'cleantalk-modal-content' ).innerHTML = cleantalkModal.loaded;\n }\n});"],"names":["cleantalkModal","loaded","loading","opened","opening","load","action","this","callback","result","data","params","obj","document","dispatchEvent","CustomEvent","bubbles","apbct_admin_sendAJAX","apbct_public_sendAJAX","notJson","open","renderCss","cssStr","key","styles","overlayCss","z-index","position","top","left","width","height","background","display","justify-content","align-items","toString","innerCss","padding","border","border-radius","box-shadow","closeCss","cursor","right","closeCssBefore","content","transform","closeCssAfter","bodyCss","overflow","cleantalkModalStyle","createElement","setAttribute","innerHTML","body","append","overlay","classList","add","inner","close","remove","getElementById","addEventListener","e","target","id"],"mappings":"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"}
1
+ {"version":3,"file":"cleantalk-modal.min.js","sources":["cleantalk-modal.js"],"sourcesContent":["/* Cleantalk Modal object */\ncleantalkModal = {\n\n // Flags\n loaded: false,\n loading: false,\n opened: false,\n opening: false,\n\n // Methods\n load: function( action ) {\n if( ! this.loaded ) {\n this.loading = true;\n callback = function( result, data, params, obj ) {\n cleantalkModal.loading = false;\n cleantalkModal.loaded = result;\n document.dispatchEvent(\n new CustomEvent( \"cleantalkModalContentLoaded\", {\n bubbles: true,\n } )\n );\n };\n if( typeof apbct_admin_sendAJAX === \"function\" ) {\n apbct_admin_sendAJAX( { 'action' : action }, { 'callback': callback, 'notJson': true } );\n } else {\n apbct_public_sendAJAX( { 'action' : action }, { 'callback': callback, 'notJson': true } );\n }\n\n }\n },\n\n open: function () {\n /* Cleantalk Modal CSS start */\n var renderCss = function () {\n var cssStr = '';\n for ( key in this.styles ) {\n cssStr += key + ':' + this.styles[key] + ';';\n }\n return cssStr;\n };\n var overlayCss = {\n styles: {\n \"z-index\": \"9999\",\n \"position\": \"fixed\",\n \"top\": \"0\",\n \"left\": \"0\",\n \"width\": \"100%\",\n \"height\": \"100%\",\n \"background\": \"rgba(0,0,0,0.5)\",\n \"display\": \"flex\",\n \"justify-content\" : \"center\",\n \"align-items\" : \"center\",\n },\n toString: renderCss\n };\n var innerCss = {\n styles: {\n \"position\" : \"relative\",\n \"padding\" : \"30px\",\n \"background\" : \"#FFF\",\n \"border\" : \"1px solid rgba(0,0,0,0.75)\",\n \"border-radius\" : \"4px\",\n \"box-shadow\" : \"7px 7px 5px 0px rgba(50,50,50,0.75)\",\n },\n toString: renderCss\n };\n var closeCss = {\n styles: {\n \"position\" : \"absolute\",\n \"background\" : \"#FFF\",\n \"width\" : \"20px\",\n \"height\" : \"20px\",\n \"border\" : \"2px solid rgba(0,0,0,0.75)\",\n \"border-radius\" : \"15px\",\n \"cursor\" : \"pointer\",\n \"top\" : \"-8px\",\n \"right\" : \"-8px\",\n \"box-sizing\" : \"content-box\",\n },\n toString: renderCss\n };\n var closeCssBefore = {\n styles: {\n \"content\" : \"\\\"\\\"\",\n \"display\" : \"block\",\n \"position\" : \"absolute\",\n \"background\" : \"#000\",\n \"border-radius\" : \"1px\",\n \"width\" : \"2px\",\n \"height\" : \"16px\",\n \"top\" : \"2px\",\n \"left\" : \"9px\",\n \"transform\" : \"rotate(45deg)\",\n },\n toString: renderCss\n };\n var closeCssAfter = {\n styles: {\n \"content\" : \"\\\"\\\"\",\n \"display\" : \"block\",\n \"position\" : \"absolute\",\n \"background\" : \"#000\",\n \"border-radius\" : \"1px\",\n \"width\" : \"2px\",\n \"height\" : \"16px\",\n \"top\" : \"2px\",\n \"left\" : \"9px\",\n \"transform\" : \"rotate(-45deg)\",\n },\n toString: renderCss\n };\n var bodyCss = {\n styles: {\n \"overflow\" : \"hidden\",\n },\n toString: renderCss\n };\n var cleantalkModalStyle = document.createElement( 'style' );\n cleantalkModalStyle.setAttribute( 'id', 'cleantalk-modal-styles' );\n cleantalkModalStyle.innerHTML = 'body.cleantalk-modal-opened{' + bodyCss + '}';\n cleantalkModalStyle.innerHTML += '#cleantalk-modal-overlay{' + overlayCss + '}';\n cleantalkModalStyle.innerHTML += '#cleantalk-modal-close{' + closeCss + '}';\n cleantalkModalStyle.innerHTML += '#cleantalk-modal-close:before{' + closeCssBefore + '}';\n cleantalkModalStyle.innerHTML += '#cleantalk-modal-close:after{' + closeCssAfter + '}';\n document.body.append( cleantalkModalStyle );\n /* Cleantalk Modal CSS end */\n\n var overlay = document.createElement( 'div' );\n overlay.setAttribute( 'id', 'cleantalk-modal-overlay' );\n document.body.append( overlay );\n\n document.body.classList.add( 'cleantalk-modal-opened' );\n\n var inner = document.createElement( 'div' );\n inner.setAttribute( 'id', 'cleantalk-modal-inner' );\n inner.setAttribute( 'style', innerCss );\n overlay.append( inner );\n\n var close = document.createElement( 'div' );\n close.setAttribute( 'id', 'cleantalk-modal-close' );\n inner.append( close );\n\n var content = document.createElement( 'div' );\n if ( this.loaded ) {\n content.innerHTML = this.loaded;\n } else {\n content.innerHTML = 'Loading...';\n // @ToDo Here is hardcoded parameter. Have to get this from a 'data-' attribute.\n this.load( 'get_options_template' );\n }\n content.setAttribute( 'id', 'cleantalk-modal-content' );\n inner.append( content );\n\n this.opened = true;\n },\n\n close: function () {\n document.body.classList.remove( 'cleantalk-modal-opened' );\n document.getElementById( 'cleantalk-modal-overlay' ).remove();\n document.getElementById( 'cleantalk-modal-styles' ).remove();\n document.dispatchEvent(\n new CustomEvent( \"cleantalkModalClosed\", {\n bubbles: true,\n } )\n );\n }\n\n};\n\n/* Cleantalk Modal helpers */\ndocument.addEventListener('click',function( e ){\n if( e.target && e.target.id === 'cleantalk-modal-overlay' || e.target.id === 'cleantalk-modal-close' ){\n cleantalkModal.close();\n }\n});\ndocument.addEventListener(\"cleantalkModalContentLoaded\", function( e ) {\n if( cleantalkModal.opened && cleantalkModal.loaded ) {\n document.getElementById( 'cleantalk-modal-content' ).innerHTML = cleantalkModal.loaded;\n }\n});"],"names":["cleantalkModal","loaded","loading","opened","opening","load","action","this","callback","result","data","params","obj","document","dispatchEvent","CustomEvent","bubbles","apbct_admin_sendAJAX","apbct_public_sendAJAX","notJson","open","renderCss","cssStr","key","styles","overlayCss","z-index","position","top","left","width","height","background","display","justify-content","align-items","toString","innerCss","padding","border","border-radius","box-shadow","closeCss","cursor","right","box-sizing","closeCssBefore","content","transform","closeCssAfter","bodyCss","overflow","cleantalkModalStyle","createElement","setAttribute","innerHTML","body","append","overlay","classList","add","inner","close","remove","getElementById","addEventListener","e","target","id"],"mappings":"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"}
js/cleantalk_collect_details.min.js ADDED
@@ -0,0 +1,2 @@
 
 
1
+ var ctCollectDetails;function ct_getCookie(e){e=document.cookie.match(new RegExp("(?:^|; )"+e.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,"\\$1")+"=([^;]*)"));return e?decodeURIComponent(e[1]):void 0}function ct_setCookie(t,i){var e,n;return ctNocache.set_cookies_flag&&(e="https:"===location.protocol?"; secure":"",document.cookie=t+" =; expires=Thu, 01 Jan 1970 00:00:01 GMT; path = /; samesite=lax"+e,document.cookie=t+" =; expires=Thu, 01 Jan 1970 00:00:01 GMT; samesite=lax"+e,(n=new Date).setDate(n.getDate()+1),setTimeout(function(){var e="https:"===location.protocol?"; secure":"";document.cookie=t+"="+i+"; expires="+n.toUTCString()+"; path = /; samesite=lax"+e},500)),null}if(void 0===ctCollectDetails&&(ctCollectDetails={set_cookies_flag:!0}),Date.now||(Date.now=function(){return(new Date).getTime()}),void 0===ct_collect_details){var prop,ct_collect_details=!0,cleantalk_user_info={},cleantalk_screen_info={};for(prop in screen)navigator[prop]instanceof Object||""===screen[prop]||(cleantalk_screen_info[prop]=screen[prop]);cleantalk_user_info.screen=cleantalk_screen_info;for(var prev,cleantalk_plugins=Array(),cnt=0,i=0;i<navigator.plugins.length;i++){var plugin=navigator.plugins[i];prev!=(plugin=plugin.name+" "+(plugin.version||""))&&(cleantalk_plugins[cnt]=plugin,cnt++,prev=plugin)}cleantalk_user_info.plugins=cleantalk_plugins,cleantalk_user_info.timezone_offset=-(new Date).getTimezoneOffset()/60,cleantalk_user_info.datetime=Math.round((new Date).getTime()/1e3),cleantalk_user_info.browser_x=document.documentElement.clientWidth,cleantalk_user_info.browser_y=document.documentElement.clientHeight;var ua=navigator.userAgent.toLowerCase(),flashInstalled=0;if(void 0!==navigator.plugins&&"object"==typeof navigator.plugins["Shockwave Flash"])flashInstalled=1;else if(void 0!==window.ActiveXObject)try{new ActiveXObject("ShockwaveFlash.ShockwaveFlash")&&(flashInstalled=1)}catch(e){}cleantalk_user_info.is_flash=flashInstalled,isVisitedMain=-1,location.href!="http://"+location.hostname+"/"&&location.href!="https://"+location.hostname+"/"||(isVisitedMain=1,setTimeout(function(){ct_setCookie("ct_visited_main","1")},1500)),ct_visited_main=ct_getCookie("ct_visited_main"),isVisitedMain=null==ct_visited_main&&-1==isVisitedMain?0:1,cleantalk_user_info.is_main=isVisitedMain,setTimeout(function(){ctSetCookie("ct_user_info",escape(JSON.stringify(cleantalk_user_info)))},1500)}
2
+ //# sourceMappingURL=cleantalk_collect_details.min.js.map
js/cleantalk_collect_details.min.js.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"file":"cleantalk_collect_details.min.js","sources":["cleantalk_collect_details.js"],"sourcesContent":["/*\n Assign default values for backend variables.\n*/\nif (typeof ctCollectDetails === 'undefined') {\n var ctCollectDetails = {};\n ctCollectDetails.set_cookies_flag = true;\n}\n\nfunction ct_getCookie(name) {\n var matches = document.cookie.match(new RegExp(\n \"(?:^|; )\" + name.replace(/([\\.$?*|{}\\(\\)\\[\\]\\\\\\/\\+^])/g, '\\\\$1') + \"=([^;]*)\"\n ));\n return matches ? decodeURIComponent(matches[1]) : undefined;\n}\n\nfunction ct_setCookie(name, value)\n{\n if (ctNocache.set_cookies_flag) {\n var ctSecure = location.protocol === 'https:' ? '; secure' : '';\n document.cookie = name+\" =; expires=Thu, 01 Jan 1970 00:00:01 GMT; path = /; samesite=lax\" + ctSecure;\n document.cookie = name+\" =; expires=Thu, 01 Jan 1970 00:00:01 GMT; samesite=lax\" + ctSecure;\n\n var date = new Date;\n date.setDate(date.getDate() + 1);\n setTimeout(function() {\n var ctSecure = location.protocol === 'https:' ? '; secure' : '';\n document.cookie = name+\"=\" + value + \"; expires=\" + date.toUTCString() + \"; path = /; samesite=lax\" + ctSecure;\n }, 500);\n }\n\n return null;\n}\n\nif (!Date.now) {\n Date.now = function() { return new Date().getTime(); }\n}\n\nif( ct_collect_details === undefined )\n{\n var ct_collect_details = true;\n\n var cleantalk_user_info={};\n\n var cleantalk_screen_info={};\n\n for(var prop in screen)\n {\n if (navigator[prop] instanceof Object || screen[prop]==='')\n continue;\n cleantalk_screen_info[prop]=screen[prop];\n }\n\n cleantalk_user_info.screen=cleantalk_screen_info;\n\n var cleantalk_plugins=Array();\n var prev;\n var cnt=0;\n for(var i=0;i<navigator.plugins.length;i++)\n {\n var plugin = navigator.plugins[i];\n var plugin = plugin.name+\" \"+(plugin.version || '')\n if (prev == plugin ) continue;\n cleantalk_plugins[cnt]=plugin;\n cnt++;\n prev = plugin;\n }\n cleantalk_user_info.plugins=cleantalk_plugins;\n\n cleantalk_user_info.timezone_offset = -new Date().getTimezoneOffset()/60;\n cleantalk_user_info.datetime = Math.round((new Date().getTime())/1000);\n\n cleantalk_user_info.browser_x=document.documentElement.clientWidth;\n cleantalk_user_info.browser_y=document.documentElement.clientHeight;\n\n var ua = navigator.userAgent.toLowerCase();\n var flashInstalled = 0;\n if (typeof(navigator.plugins)!=\"undefined\"&&typeof(navigator.plugins[\"Shockwave Flash\"])==\"object\")\n {\n flashInstalled = 1;\n }\n else if (typeof window.ActiveXObject != \"undefined\")\n {\n try\n {\n if (new ActiveXObject(\"ShockwaveFlash.ShockwaveFlash\"))\n {\n flashInstalled = 1;\n }\n } catch(e) {};\n };\n\n cleantalk_user_info.is_flash=flashInstalled;\n\n isVisitedMain=-1;\n if(location.href=='http://'+location.hostname+'/' || location.href=='https://'+location.hostname+'/')\n {\n isVisitedMain=1;\n setTimeout(function () {\n ct_setCookie('ct_visited_main',\n '1')\n }, 1500);\n }\n\n\n ct_visited_main = ct_getCookie('ct_visited_main');\n if(ct_visited_main==undefined && isVisitedMain==-1)\n {\n isVisitedMain=0;\n }\n else\n {\n isVisitedMain=1;\n }\n\n cleantalk_user_info.is_main=isVisitedMain;\n\n setTimeout(function () {\n ctSetCookie(\n 'ct_user_info',\n escape(JSON.stringify(cleantalk_user_info)));\n }, 1500);\n\n}"],"names":["ctCollectDetails","ct_getCookie","name","matches","document","cookie","match","RegExp","replace","decodeURIComponent","undefined","ct_setCookie","value","ctSecure","date","ctNocache","set_cookies_flag","location","protocol","Date","setDate","getDate","setTimeout","toUTCString","now","getTime","ct_collect_details","prop","cleantalk_user_info","cleantalk_screen_info","screen","navigator","Object","prev","cleantalk_plugins","Array","cnt","i","plugins","length","plugin","version","timezone_offset","getTimezoneOffset","datetime","Math","round","browser_x","documentElement","clientWidth","browser_y","clientHeight","ua","userAgent","toLowerCase","flashInstalled","window","ActiveXObject","e","is_flash","isVisitedMain","href","hostname","ct_visited_main","is_main","ctSetCookie","escape","JSON","stringify"],"mappings":"AAGA,IACQA,iBAIR,SAASC,aAAaC,GACdC,EAAUC,SAASC,OAAOC,MAAM,IAAIC,OACpC,WAAaL,EAAKM,QAAQ,+BAAgC,QAAU,aAExE,OAAOL,EAAUM,mBAAmBN,EAAQ,SAAMO,EAGtD,SAASC,aAAaT,EAAMU,GAExB,IACQC,EAIAC,EAQR,OAbIC,UAAUC,mBACNH,EAAiC,WAAtBI,SAASC,SAAwB,WAAa,GAC7Dd,SAASC,OAASH,EAAK,oEAAsEW,EAC7FT,SAASC,OAASH,EAAK,0DAA4DW,GAE/EC,EAAO,IAAIK,MACVC,QAAQN,EAAKO,UAAY,GAC9BC,WAAW,WACP,IAAIT,EAAiC,WAAtBI,SAASC,SAAwB,WAAa,GAC7Dd,SAASC,OAASH,EAAK,IAAMU,EAAQ,aAAeE,EAAKS,cAAgB,2BAA6BV,GACvG,MAGA,KAOX,QAlCgC,IAArBb,mBACHA,iBAAmB,CACvBgB,kBAAoC,IA4BnCG,KAAKK,MACNL,KAAKK,IAAM,WAAa,OAAO,IAAIL,MAAOM,iBAGnBf,IAAvBgB,mBACJ,CACI,IAMQC,KANJD,oBAAqB,EAErBE,oBAAoB,GAEpBC,sBAAsB,GAE1B,IAAQF,QAAQG,OAERC,UAAUJ,gBAAiBK,QAAyB,KAAfF,OAAOH,QAEhDE,sBAAsBF,MAAMG,OAAOH,OAGvCC,oBAAoBE,OAAOD,sBAK3B,IAHA,IACII,KADAC,kBAAkBC,QAElBC,IAAI,EACAC,EAAE,EAAEA,EAAEN,UAAUO,QAAQC,OAAOF,IACvC,CACI,IAAIG,OAAST,UAAUO,QAAQD,GAE3BJ,OADAO,OAASA,OAAOtC,KAAK,KAAKsC,OAAOC,SAAW,OAEhDP,kBAAkBE,KAAKI,OACvBJ,MACAH,KAAOO,QAEXZ,oBAAoBU,QAAQJ,kBAE5BN,oBAAoBc,kBAAmB,IAAIvB,MAAOwB,oBAAoB,GACtEf,oBAAoBgB,SAAWC,KAAKC,OAAO,IAAI3B,MAAOM,UAAW,KAEjEG,oBAAoBmB,UAAU3C,SAAS4C,gBAAgBC,YACvDrB,oBAAoBsB,UAAU9C,SAAS4C,gBAAgBG,aAEvD,IAAIC,GAAKrB,UAAUsB,UAAUC,cACzBC,eAAiB,EACrB,QAA+B,IAApBxB,UAAiB,SAA8D,iBAAvCA,UAAUO,QAAQ,mBAEjEiB,eAAiB,OAEhB,QAAmC,IAAxBC,OAAOC,cAEnB,IAEQ,IAAIA,cAAc,mCAElBF,eAAiB,GAEvB,MAAMG,IAGZ9B,oBAAoB+B,SAASJ,eAE7BK,eAAe,EACZ3C,SAAS4C,MAAM,UAAU5C,SAAS6C,SAAS,KAAO7C,SAAS4C,MAAM,WAAW5C,SAAS6C,SAAS,MAE7FF,cAAc,EACdtC,WAAW,WACPX,aAAa,kBACT,MACL,OAIPoD,gBAAkB9D,aAAa,mBAG3B2D,cAFgBlD,MAAjBqD,kBAA8C,GAAhBH,cAEf,EAIA,EAGlBhC,oBAAoBoC,QAAQJ,cAE5BtC,WAAW,WACP2C,YACI,eACAC,OAAOC,KAAKC,UAAUxC,wBAC3B"}
js/cleantalk_nocache.min.js CHANGED
@@ -1,2 +1,2 @@
1
- var ctNocache;function sendRequest(e,t,n){var c,i=createXMLHTTPObject();i&&(c=n?"POST":"GET",e="https:"===location.protocol?e.replace("http:","https:"):e.replace("https:","http:"),i.open(c,e,!0),n&&i.setRequestHeader("Content-type","application/x-www-form-urlencoded"),i.onreadystatechange=function(){4==i.readyState&&(200!=i.status&&304!=i.status||t(i))},4!=i.readyState&&i.send(n))}void 0===ctNocache&&(ctNocache={set_cookies_flag:!0,ajaxurl:"/wp-admin/admin-ajax.php"});var XMLHttpFactories=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}];function createXMLHTTPObject(){for(var e=!1,t=0;t<XMLHttpFactories.length;t++){try{e=XMLHttpFactories[t]()}catch(e){continue}break}return e}function ct_getCookie(e){e=document.cookie.match(new RegExp("(?:^|; )"+e.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,"\\$1")+"=([^;]*)"));return e?decodeURIComponent(e[1]):void 0}function ct_setCookie(e,t){var n;return ctNocache.set_cookies_flag&&(document.cookie=e+" =; expires=Thu, 01 Jan 1970 00:00:01 GMT; path = /; samesite=lax",document.cookie=e+" =; expires=Thu, 01 Jan 1970 00:00:01 GMT; samesite=lax",(n=new Date).setDate(n.getDate()+1),setTimeout(function(){document.cookie=e+"="+t+"; expires="+n.toUTCString()+"; path = /; samesite=lax"},500)),null}function ct_callback(t){for(ct_cookie=t.responseText.trim(),ct_setCookie("ct_checkjs",ct_cookie),i=0;i<document.forms.length;i++)for(f=document.forms[i],j=0;j<f.elements.length;j++)e=f.elements[j],void 0!==e.name&&-1!=e.name.indexOf("ct_checkjs")&&(e.value=ct_cookie)}if(Date.now||(Date.now=function(){return(new Date).getTime()}),null==ct_nocache_executed){var ct_nocache_executed=!0,checkjs_cookie=ct_getCookie("ct_checkjs");if(null!=checkjs_cookie)for(i=0;i<document.forms.length;i++)for(f=document.forms[i],j=0;j<f.elements.length;j++)e=f.elements[j],void 0!==e.name&&-1!=e.name.indexOf("ct_checkjs")&&(e.value=checkjs_cookie);if(null==checkjs_cookie&&sendRequest(ctNocache.ajaxurl+"?"+Math.random(),ct_callback,"action=ct_get_cookie"),void 0!==ctNocache.info_flag&&ctNocache.info_flag){var prop,cleantalk_user_info={},cleantalk_screen_info={};for(prop in screen)navigator[prop]instanceof Object||""===screen[prop]||(cleantalk_screen_info[prop]=screen[prop]);cleantalk_user_info.screen=cleantalk_screen_info;for(var prev,cleantalk_plugins=Array(),cnt=0,i=0;i<navigator.plugins.length;i++){var plugin=navigator.plugins[i];prev!=(plugin=plugin.name+" "+(plugin.version||""))&&(cleantalk_plugins[cnt]=plugin,cnt++,prev=plugin)}cleantalk_user_info.plugins=cleantalk_plugins,cleantalk_user_info.timezone_offset=-(new Date).getTimezoneOffset()/60,cleantalk_user_info.datetime=Math.round((new Date).getTime()/1e3),cleantalk_user_info.browser_x=document.documentElement.clientWidth,cleantalk_user_info.browser_y=document.documentElement.clientHeight;var ua=navigator.userAgent.toLowerCase(),flashInstalled=0;if(void 0!==navigator.plugins&&"object"==typeof navigator.plugins["Shockwave Flash"])flashInstalled=1;else if(void 0!==window.ActiveXObject)try{new ActiveXObject("ShockwaveFlash.ShockwaveFlash")&&(flashInstalled=1)}catch(e){}cleantalk_user_info.is_flash=flashInstalled,isVisitedMain=-1,location.href!="http://"+location.hostname+"/"&&location.href!="https://"+location.hostname+"/"||(isVisitedMain=1,setTimeout(function(){ct_setCookie("ct_visited_main","1")},1500)),ct_visited_main=ct_getCookie("ct_visited_main"),isVisitedMain=null==ct_visited_main&&-1==isVisitedMain?0:1,cleantalk_user_info.is_main=isVisitedMain,setTimeout(function(){ctSetCookie("ct_user_info",escape(JSON.stringify(cleantalk_user_info)))},1500)}}
2
  //# sourceMappingURL=cleantalk_nocache.min.js.map
1
+ var ctNocache;function sendRequest(e,t,n){var c,i=createXMLHTTPObject();i&&(c=n?"POST":"GET",e="https:"===location.protocol?e.replace("http:","https:"):e.replace("https:","http:"),i.open(c,e,!0),n&&i.setRequestHeader("Content-type","application/x-www-form-urlencoded"),i.onreadystatechange=function(){4==i.readyState&&(200!=i.status&&304!=i.status||t(i))},4!=i.readyState&&i.send(n))}void 0===ctNocache&&(ctNocache={set_cookies_flag:!0,ajaxurl:"/wp-admin/admin-ajax.php"});var XMLHttpFactories=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}];function createXMLHTTPObject(){for(var e=!1,t=0;t<XMLHttpFactories.length;t++){try{e=XMLHttpFactories[t]()}catch(e){continue}break}return e}function ct_getCookie(e){e=document.cookie.match(new RegExp("(?:^|; )"+e.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,"\\$1")+"=([^;]*)"));return e?decodeURIComponent(e[1]):void 0}function ct_callback(t){ct_cookie=t.responseText.trim();t=new Date;for(t.setDate(t.getDate()+1),ctSetCookie("ct_checkjs",ct_cookie,t.toUTCString()),i=0;i<document.forms.length;i++)for(f=document.forms[i],j=0;j<f.elements.length;j++)e=f.elements[j],void 0!==e.name&&-1!=e.name.indexOf("ct_checkjs")&&(e.value=ct_cookie)}if(Date.now||(Date.now=function(){return(new Date).getTime()}),null==ct_nocache_executed){var ct_nocache_executed=!0,checkjs_cookie=ct_getCookie("ct_checkjs");if(null!=checkjs_cookie)for(i=0;i<document.forms.length;i++)for(f=document.forms[i],j=0;j<f.elements.length;j++)e=f.elements[j],void 0!==e.name&&-1!=e.name.indexOf("ct_checkjs")&&(e.value=checkjs_cookie);if(null==checkjs_cookie&&sendRequest(ctNocache.ajaxurl+"?"+Math.random(),ct_callback,"action=ct_get_cookie"),void 0!==ctNocache.info_flag&&ctNocache.info_flag){var prop,cleantalk_user_info={},cleantalk_screen_info={};for(prop in screen)navigator[prop]instanceof Object||""===screen[prop]||(cleantalk_screen_info[prop]=screen[prop]);cleantalk_user_info.screen=cleantalk_screen_info;for(var prev,cleantalk_plugins=Array(),cnt=0,i=0;i<navigator.plugins.length;i++){var plugin=navigator.plugins[i];prev!=(plugin=plugin.name+" "+(plugin.version||""))&&(cleantalk_plugins[cnt]=plugin,cnt++,prev=plugin)}cleantalk_user_info.plugins=cleantalk_plugins,cleantalk_user_info.timezone_offset=-(new Date).getTimezoneOffset()/60,cleantalk_user_info.datetime=Math.round((new Date).getTime()/1e3),cleantalk_user_info.browser_x=document.documentElement.clientWidth,cleantalk_user_info.browser_y=document.documentElement.clientHeight;var ua=navigator.userAgent.toLowerCase(),flashInstalled=0;if(void 0!==navigator.plugins&&"object"==typeof navigator.plugins["Shockwave Flash"])flashInstalled=1;else if(void 0!==window.ActiveXObject)try{new ActiveXObject("ShockwaveFlash.ShockwaveFlash")&&(flashInstalled=1)}catch(e){}cleantalk_user_info.is_flash=flashInstalled,isVisitedMain=-1,location.href!="http://"+location.hostname+"/"&&location.href!="https://"+location.hostname+"/"||(isVisitedMain=1,setTimeout(function(){ctSetCookie("ct_visited_main","1")},1500)),ct_visited_main=ct_getCookie("ct_visited_main"),isVisitedMain=null==ct_visited_main&&-1==isVisitedMain?0:1,cleantalk_user_info.is_main=isVisitedMain,setTimeout(function(){ctSetCookie("ct_user_info",escape(JSON.stringify(cleantalk_user_info)))},1500)}}
2
  //# sourceMappingURL=cleantalk_nocache.min.js.map
js/cleantalk_nocache.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cleantalk_nocache.min.js","sources":["cleantalk_nocache.js"],"sourcesContent":["/*\n Assign default values for backend variables.\n*/\nif (typeof ctNocache === 'undefined') {\n\tvar ctNocache = {};\n\tctNocache.set_cookies_flag = true;\n ctNocache.ajaxurl = '/wp-admin/admin-ajax.php';\n}\n\nfunction sendRequest(url,callback,postData) {\n var req = createXMLHTTPObject();\n if (!req) return;\n var method = (postData) ? \"POST\" : \"GET\";\n \n var protocol = location.protocol;\n if (protocol === 'https:') {\n url = url.replace('http:', 'https:');\n } else {\n url = url.replace('https:', 'http:');\n }\n \n req.open(method,url,true);\n if (postData)\n req.setRequestHeader('Content-type','application/x-www-form-urlencoded');\n req.onreadystatechange = function () {\n if (req.readyState != 4) return;\n if (req.status != 200 && req.status != 304) {\n// alert('HTTP error ' + req.status);\n return;\n }\n callback(req);\n };\n if (req.readyState == 4) return;\n req.send(postData);\n}\n\nvar XMLHttpFactories = [\n function () {return new XMLHttpRequest()},\n function () {return new ActiveXObject(\"Msxml2.XMLHTTP\")},\n function () {return new ActiveXObject(\"Msxml3.XMLHTTP\")},\n function () {return new ActiveXObject(\"Microsoft.XMLHTTP\")}\n];\n\nfunction createXMLHTTPObject() {\n var xmlhttp = false;\n for (var i=0;i<XMLHttpFactories.length;i++) {\n try {\n xmlhttp = XMLHttpFactories[i]();\n }\n catch (e) {\n continue;\n }\n break;\n }\n return xmlhttp;\n}\n\nfunction ct_getCookie(name) {\n var matches = document.cookie.match(new RegExp(\n \"(?:^|; )\" + name.replace(/([\\.$?*|{}\\(\\)\\[\\]\\\\\\/\\+^])/g, '\\\\$1') + \"=([^;]*)\"\n ));\n return matches ? decodeURIComponent(matches[1]) : undefined;\n}\n\nfunction ct_setCookie(name, value)\n{\n if (ctNocache.set_cookies_flag) {\n document.cookie = name+\" =; expires=Thu, 01 Jan 1970 00:00:01 GMT; path = /; samesite=lax\";\n document.cookie = name+\" =; expires=Thu, 01 Jan 1970 00:00:01 GMT; samesite=lax\";\n \n var date = new Date;\n date.setDate(date.getDate() + 1);\n setTimeout(function() { document.cookie = name+\"=\" + value + \"; expires=\" + date.toUTCString() + \"; path = /; samesite=lax\"}, 500);\n }\n\n return null;\n}\n\nfunction ct_callback(req)\n{\n\tct_cookie = req.responseText.trim();\n\t//alert('Key value: ' + ct_cookie);\n\t\n\tct_setCookie('ct_checkjs', ct_cookie);\n\t\n\tfor(i=0;i<document.forms.length;i++)\n\t{\n\t\tf=document.forms[i];\n\t\tfor(j=0;j<f.elements.length;j++)\n\t\t{\n\t\t\te=f.elements[j];\n\t\t\tif(e.name!==undefined&&e.name.indexOf('ct_checkjs')!=-1)\n\t\t\t{\n\t\t\t\te.value=ct_cookie;\n\t\t\t\t//alert('Form #' + i + ', field ' + e.name + ' = ' + ct_cookie);\n\t\t\t}\n\t\t}\n\t}\n\n\t//alert('Set cookie: \\n' + document.cookie);\n}\n\nif (!Date.now) {\n\tDate.now = function() { return new Date().getTime(); }\n}\n\nif(ct_nocache_executed==undefined)\n{\n\tvar ct_nocache_executed=true;\n\t\n\tvar checkjs_cookie=ct_getCookie('ct_checkjs');\n\t\n\tif(checkjs_cookie!=undefined)\n\t{\n\t\tfor(i=0;i<document.forms.length;i++)\n\t\t{\n\t\t\tf=document.forms[i];\n\t\t\tfor(j=0;j<f.elements.length;j++)\n\t\t\t{\n\t\t\t\te=f.elements[j];\n\t\t\t\tif(e.name!==undefined&&e.name.indexOf('ct_checkjs')!=-1)\n\t\t\t\t{\n\t\t\t\t\te.value=checkjs_cookie;\n\t\t\t\t\t//alert('Form #' + i + ', field ' + e.name + ' = ' + ct_cookie);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\t\n\t\n\tif(checkjs_cookie==undefined) //86400 is 24 hours\n\t{\n\t\tsendRequest(ctNocache.ajaxurl+'?'+Math.random(),ct_callback,'action=ct_get_cookie');\n\t}\n\t\n\tif(typeof ctNocache.info_flag !== 'undefined' && ctNocache.info_flag)\n\t{\n\t\n\t\tvar cleantalk_user_info={};\n\t\t\n\t\tvar cleantalk_screen_info={};\n\t\tfor(var prop in screen)\n\t\t{\n\t\t\tif (navigator[prop] instanceof Object || screen[prop]==='')\n\t\t\t\tcontinue;\n\t\t\tcleantalk_screen_info[prop]=screen[prop];\n\t\t}\n\t\t\n\t\tcleantalk_user_info.screen=cleantalk_screen_info;\n\t\t\n\t\tvar cleantalk_plugins=Array();\n\t\tvar prev;\n\t\tvar cnt=0;\n\t\tfor(var i=0;i<navigator.plugins.length;i++)\n\t\t{\n\t\t\tvar plugin = navigator.plugins[i];\n\t\t\tvar plugin = plugin.name+\" \"+(plugin.version || '')\n\t\t\tif (prev == plugin ) continue;\n\t\t\tcleantalk_plugins[cnt]=plugin;\n\t\t\tcnt++;\n\t\t\tprev = plugin;\n\t\t}\n\t\tcleantalk_user_info.plugins=cleantalk_plugins;\n\t\t\n\t\tcleantalk_user_info.timezone_offset = -new Date().getTimezoneOffset()/60;\n\t\tcleantalk_user_info.datetime = Math.round((new Date().getTime())/1000);\n\t\t\n\t\tcleantalk_user_info.browser_x=document.documentElement.clientWidth;\n\t\tcleantalk_user_info.browser_y=document.documentElement.clientHeight;\n\t\t\n\t\tvar ua = navigator.userAgent.toLowerCase();\n\t\tvar flashInstalled = 0;\n\t\tif (typeof(navigator.plugins)!=\"undefined\"&&typeof(navigator.plugins[\"Shockwave Flash\"])==\"object\")\n\t\t{\n\t\t\tflashInstalled = 1;\n\t\t}\n\t\telse if (typeof window.ActiveXObject != \"undefined\")\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tif (new ActiveXObject(\"ShockwaveFlash.ShockwaveFlash\"))\n\t\t\t\t{\n\t\t\t\t\tflashInstalled = 1;\n\t\t\t\t}\n\t\t\t} catch(e) {};\n\t\t};\n\t\t\n\t\tcleantalk_user_info.is_flash=flashInstalled;\n\t\t\n\t\tisVisitedMain=-1;\n\t\tif(location.href=='http://'+location.hostname+'/' || location.href=='https://'+location.hostname+'/')\n\t\t{\n\t\t\tisVisitedMain=1;\n\t\t\tsetTimeout(function () {\n\t\t\t\t\tct_setCookie('ct_visited_main',\n\t\t\t\t\t\t'1')\n\t\t\t\t}, 1500);\n\t\t}\n\t\t\n\t\t\n\t\tct_visited_main = ct_getCookie('ct_visited_main');\n\t\tif(ct_visited_main==undefined && isVisitedMain==-1)\n\t\t{\n\t\t\tisVisitedMain=0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tisVisitedMain=1;\n\t\t}\n\t\t\n\t\tcleantalk_user_info.is_main=isVisitedMain;\n\n\t\tsetTimeout(function () {\n\t\t\tctSetCookie(\n\t\t\t\t'ct_user_info',\n\t\t\t\tescape(JSON.stringify(cleantalk_user_info)));\n\t\t}, 1500);\n\t}\n}"],"names":["ctNocache","sendRequest","url","callback","postData","method","req","createXMLHTTPObject","location","protocol","replace","open","setRequestHeader","onreadystatechange","readyState","status","send","set_cookies_flag","ajaxurl","XMLHttpFactories","XMLHttpRequest","ActiveXObject","xmlhttp","i","length","e","ct_getCookie","name","matches","document","cookie","match","RegExp","decodeURIComponent","undefined","ct_setCookie","value","date","Date","setDate","getDate","setTimeout","toUTCString","ct_callback","ct_cookie","responseText","trim","forms","f","j","elements","indexOf","now","getTime","ct_nocache_executed","checkjs_cookie","Math","random","info_flag","prop","cleantalk_user_info","cleantalk_screen_info","screen","navigator","Object","prev","cleantalk_plugins","Array","cnt","plugins","plugin","version","timezone_offset","getTimezoneOffset","datetime","round","browser_x","documentElement","clientWidth","browser_y","clientHeight","ua","userAgent","toLowerCase","flashInstalled","window","is_flash","isVisitedMain","href","hostname","ct_visited_main","is_main","ctSetCookie","escape","JSON","stringify"],"mappings":"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"}
1
+ {"version":3,"file":"cleantalk_nocache.min.js","sources":["cleantalk_nocache.js"],"sourcesContent":["/*\n Assign default values for backend variables.\n*/\nif (typeof ctNocache === 'undefined') {\n\tvar ctNocache = {};\n\tctNocache.set_cookies_flag = true;\n ctNocache.ajaxurl = '/wp-admin/admin-ajax.php';\n}\n\nfunction sendRequest(url,callback,postData) {\n var req = createXMLHTTPObject();\n if (!req) return;\n var method = (postData) ? \"POST\" : \"GET\";\n \n var protocol = location.protocol;\n if (protocol === 'https:') {\n url = url.replace('http:', 'https:');\n } else {\n url = url.replace('https:', 'http:');\n }\n \n req.open(method,url,true);\n if (postData)\n req.setRequestHeader('Content-type','application/x-www-form-urlencoded');\n req.onreadystatechange = function () {\n if (req.readyState != 4) return;\n if (req.status != 200 && req.status != 304) {\n// alert('HTTP error ' + req.status);\n return;\n }\n callback(req);\n };\n if (req.readyState == 4) return;\n req.send(postData);\n}\n\nvar XMLHttpFactories = [\n function () {return new XMLHttpRequest()},\n function () {return new ActiveXObject(\"Msxml2.XMLHTTP\")},\n function () {return new ActiveXObject(\"Msxml3.XMLHTTP\")},\n function () {return new ActiveXObject(\"Microsoft.XMLHTTP\")}\n];\n\nfunction createXMLHTTPObject() {\n var xmlhttp = false;\n for (var i=0;i<XMLHttpFactories.length;i++) {\n try {\n xmlhttp = XMLHttpFactories[i]();\n }\n catch (e) {\n continue;\n }\n break;\n }\n return xmlhttp;\n}\n\nfunction ct_getCookie(name) {\n var matches = document.cookie.match(new RegExp(\n \"(?:^|; )\" + name.replace(/([\\.$?*|{}\\(\\)\\[\\]\\\\\\/\\+^])/g, '\\\\$1') + \"=([^;]*)\"\n ));\n return matches ? decodeURIComponent(matches[1]) : undefined;\n}\n\nfunction ct_callback(req)\n{\n\tct_cookie = req.responseText.trim();\n\t//alert('Key value: ' + ct_cookie);\n\n\tvar date = new Date;\n\tdate.setDate(date.getDate() + 1);\n\tctSetCookie('ct_checkjs', ct_cookie, date.toUTCString());\n\t\n\tfor(i=0;i<document.forms.length;i++)\n\t{\n\t\tf=document.forms[i];\n\t\tfor(j=0;j<f.elements.length;j++)\n\t\t{\n\t\t\te=f.elements[j];\n\t\t\tif(e.name!==undefined&&e.name.indexOf('ct_checkjs')!=-1)\n\t\t\t{\n\t\t\t\te.value=ct_cookie;\n\t\t\t\t//alert('Form #' + i + ', field ' + e.name + ' = ' + ct_cookie);\n\t\t\t}\n\t\t}\n\t}\n\n\t//alert('Set cookie: \\n' + document.cookie);\n}\n\nif (!Date.now) {\n\tDate.now = function() { return new Date().getTime(); }\n}\n\nif(ct_nocache_executed==undefined)\n{\n\tvar ct_nocache_executed=true;\n\t\n\tvar checkjs_cookie=ct_getCookie('ct_checkjs');\n\t\n\tif(checkjs_cookie!=undefined)\n\t{\n\t\tfor(i=0;i<document.forms.length;i++)\n\t\t{\n\t\t\tf=document.forms[i];\n\t\t\tfor(j=0;j<f.elements.length;j++)\n\t\t\t{\n\t\t\t\te=f.elements[j];\n\t\t\t\tif(e.name!==undefined&&e.name.indexOf('ct_checkjs')!=-1)\n\t\t\t\t{\n\t\t\t\t\te.value=checkjs_cookie;\n\t\t\t\t\t//alert('Form #' + i + ', field ' + e.name + ' = ' + ct_cookie);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\t\n\t\n\tif(checkjs_cookie==undefined) //86400 is 24 hours\n\t{\n\t\tsendRequest(ctNocache.ajaxurl+'?'+Math.random(),ct_callback,'action=ct_get_cookie');\n\t}\n\t\n\tif(typeof ctNocache.info_flag !== 'undefined' && ctNocache.info_flag)\n\t{\n\t\n\t\tvar cleantalk_user_info={};\n\t\t\n\t\tvar cleantalk_screen_info={};\n\t\tfor(var prop in screen)\n\t\t{\n\t\t\tif (navigator[prop] instanceof Object || screen[prop]==='')\n\t\t\t\tcontinue;\n\t\t\tcleantalk_screen_info[prop]=screen[prop];\n\t\t}\n\t\t\n\t\tcleantalk_user_info.screen=cleantalk_screen_info;\n\t\t\n\t\tvar cleantalk_plugins=Array();\n\t\tvar prev;\n\t\tvar cnt=0;\n\t\tfor(var i=0;i<navigator.plugins.length;i++)\n\t\t{\n\t\t\tvar plugin = navigator.plugins[i];\n\t\t\tvar plugin = plugin.name+\" \"+(plugin.version || '')\n\t\t\tif (prev == plugin ) continue;\n\t\t\tcleantalk_plugins[cnt]=plugin;\n\t\t\tcnt++;\n\t\t\tprev = plugin;\n\t\t}\n\t\tcleantalk_user_info.plugins=cleantalk_plugins;\n\t\t\n\t\tcleantalk_user_info.timezone_offset = -new Date().getTimezoneOffset()/60;\n\t\tcleantalk_user_info.datetime = Math.round((new Date().getTime())/1000);\n\t\t\n\t\tcleantalk_user_info.browser_x=document.documentElement.clientWidth;\n\t\tcleantalk_user_info.browser_y=document.documentElement.clientHeight;\n\t\t\n\t\tvar ua = navigator.userAgent.toLowerCase();\n\t\tvar flashInstalled = 0;\n\t\tif (typeof(navigator.plugins)!=\"undefined\"&&typeof(navigator.plugins[\"Shockwave Flash\"])==\"object\")\n\t\t{\n\t\t\tflashInstalled = 1;\n\t\t}\n\t\telse if (typeof window.ActiveXObject != \"undefined\")\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tif (new ActiveXObject(\"ShockwaveFlash.ShockwaveFlash\"))\n\t\t\t\t{\n\t\t\t\t\tflashInstalled = 1;\n\t\t\t\t}\n\t\t\t} catch(e) {};\n\t\t};\n\t\t\n\t\tcleantalk_user_info.is_flash=flashInstalled;\n\t\t\n\t\tisVisitedMain=-1;\n\t\tif(location.href=='http://'+location.hostname+'/' || location.href=='https://'+location.hostname+'/')\n\t\t{\n\t\t\tisVisitedMain=1;\n\t\t\tsetTimeout(function () {\n\t\t\t\tctSetCookie('ct_visited_main', '1');\n\t\t\t}, 1500);\n\t\t}\n\t\t\n\t\t\n\t\tct_visited_main = ct_getCookie('ct_visited_main');\n\t\tif(ct_visited_main==undefined && isVisitedMain==-1)\n\t\t{\n\t\t\tisVisitedMain=0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tisVisitedMain=1;\n\t\t}\n\t\t\n\t\tcleantalk_user_info.is_main=isVisitedMain;\n\n\t\tsetTimeout(function () {\n\t\t\tctSetCookie( 'ct_user_info',\tescape(JSON.stringify(cleantalk_user_info) ) );\n\t\t}, 1500);\n\t}\n}"],"names":["ctNocache","sendRequest","url","callback","postData","method","req","createXMLHTTPObject","location","protocol","replace","open","setRequestHeader","onreadystatechange","readyState","status","send","set_cookies_flag","ajaxurl","XMLHttpFactories","XMLHttpRequest","ActiveXObject","xmlhttp","i","length","e","ct_getCookie","name","matches","document","cookie","match","RegExp","decodeURIComponent","undefined","ct_callback","ct_cookie","responseText","trim","date","Date","setDate","getDate","ctSetCookie","toUTCString","forms","f","j","elements","indexOf","value","now","getTime","ct_nocache_executed","checkjs_cookie","Math","random","info_flag","prop","cleantalk_user_info","cleantalk_screen_info","screen","navigator","Object","prev","cleantalk_plugins","Array","cnt","plugins","plugin","version","timezone_offset","getTimezoneOffset","datetime","round","browser_x","documentElement","clientWidth","browser_y","clientHeight","ua","userAgent","toLowerCase","flashInstalled","window","is_flash","isVisitedMain","href","hostname","setTimeout","ct_visited_main","is_main","escape","JSON","stringify"],"mappings":"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"}
lib/Cleantalk/Antispam/Integrations/ContactBank.php CHANGED
@@ -18,6 +18,6 @@ class ContactBank extends IntegrationBase
18
 
19
  function doBlock( $message )
20
  {
21
- die(json_encode(array('apbct' => array('blocked' => true, 'comment' => $message,))));
22
  }
23
  }
18
 
19
  function doBlock( $message )
20
  {
21
+ die(json_encode(array('apbct' => array('blocked' => true, 'comment' => $message,)), JSON_HEX_QUOT | JSON_HEX_TAG));
22
  }
23
  }
lib/Cleantalk/ApbctWP/API.php CHANGED
@@ -16,7 +16,35 @@ namespace Cleantalk\ApbctWP;
16
  */
17
  class API extends \Cleantalk\Common\API
18
  {
19
- /**
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  * Function sends raw request to API server.
21
  * May use built in Wordpress HTTP-API
22
  *
16
  */
17
  class API extends \Cleantalk\Common\API
18
  {
19
+ /**
20
+ * @param $user_token
21
+ * @param $service_id
22
+ * @param $ip
23
+ * @param $servie_type
24
+ * @param $product_id
25
+ * @param $record_type
26
+ * @param $note
27
+ * @param $status
28
+ *
29
+ * @return array|bool|mixed|string[]
30
+ */
31
+ public static function method__private_list_add__sfw_wl( $user_token, $service_id, $ip ) {
32
+
33
+ return static::method__private_list_add(
34
+ $user_token,
35
+ $service_id,
36
+ $ip,
37
+ 'spamfirewall',
38
+ 1,
39
+ 6,
40
+ 'Website admin IP. Added automatically.',
41
+ 'allow',
42
+ date( 'Y-m-d H:i:s', time() + 86400 * 30 )
43
+ );
44
+ }
45
+
46
+
47
+ /**
48
  * Function sends raw request to API server.
49
  * May use built in Wordpress HTTP-API
50
  *
lib/Cleantalk/ApbctWP/Firewall/AntiCrawler.php CHANGED
@@ -167,7 +167,7 @@ class AntiCrawler extends \Cleantalk\Common\Firewall\FirewallModule{
167
  if( Cookie::get('apbct_antibot') == hash( 'sha256', $this->api_key . $this->apbct->data['salt'] ) ) {
168
  if( Cookie::get( 'apbct_anticrawler_passed' ) == 1 ){
169
  if( ! headers_sent() )
170
- \Cleantalk\Common\Helper::apbct_cookie__set( 'apbct_anticrawler_passed', '0', time() - 86400, '/', null, false, true, 'Lax' );
171
 
172
  // Do logging an one passed request
173
  $this->update_log( $current_ip, 'PASS_ANTICRAWLER' );
@@ -201,7 +201,7 @@ class AntiCrawler extends \Cleantalk\Common\Firewall\FirewallModule{
201
  if( Cookie::get( 'apbct_anticrawler_passed' ) === '1' ){
202
 
203
  if( ! headers_sent() )
204
- \Cleantalk\Common\Helper::apbct_cookie__set( 'apbct_anticrawler_passed', '0', time() - 86400, '/', null, false, true, 'Lax' );
205
 
206
  $results[] = array( 'ip' => $current_ip, 'is_personal' => false, 'status' => 'PASS_ANTICRAWLER', );
207
 
@@ -252,7 +252,7 @@ class AntiCrawler extends \Cleantalk\Common\Firewall\FirewallModule{
252
 
253
  public static function set_cookie(){
254
  global $apbct;
255
- echo '<script>document.cookie = "apbct_antibot=' . hash( 'sha256', $apbct->api_key . $apbct->data['salt'] ) . '; path=/; expires=0; samesite=lax";</script>';
256
  }
257
 
258
  /**
@@ -337,11 +337,13 @@ class AntiCrawler extends \Cleantalk\Common\Firewall\FirewallModule{
337
  $debug = '';
338
  }
339
  $sfw_die_page = str_replace( "{DEBUG}", $debug, $sfw_die_page );
340
-
341
- @wp_die($sfw_die_page, "Blacklisted", Array('response'=>403));
342
-
 
343
  }else{
344
- @wp_die("IP BLACKLISTED. Blocked by AntiCrawler " . $result['ip'], "Blacklisted", Array('response'=>403));
 
345
  }
346
 
347
  }
167
  if( Cookie::get('apbct_antibot') == hash( 'sha256', $this->api_key . $this->apbct->data['salt'] ) ) {
168
  if( Cookie::get( 'apbct_anticrawler_passed' ) == 1 ){
169
  if( ! headers_sent() )
170
+ Cookie::set( 'apbct_anticrawler_passed', '0', time() - 86400, '/', null, null, true, 'Lax' );
171
 
172
  // Do logging an one passed request
173
  $this->update_log( $current_ip, 'PASS_ANTICRAWLER' );
201
  if( Cookie::get( 'apbct_anticrawler_passed' ) === '1' ){
202
 
203
  if( ! headers_sent() )
204
+ \Cleantalk\ApbctWP\Variables\Cookie::set( 'apbct_anticrawler_passed', '0', time() - 86400, '/', null, false, true, 'Lax' );
205
 
206
  $results[] = array( 'ip' => $current_ip, 'is_personal' => false, 'status' => 'PASS_ANTICRAWLER', );
207
 
252
 
253
  public static function set_cookie(){
254
  global $apbct;
255
+ echo '<script>var ctSecure = location.protocol === "https:" ? "; secure" : ""; document.cookie = "apbct_antibot=' . hash( 'sha256', $apbct->api_key . $apbct->data['salt'] ) . '; path=/; expires=0; samesite=lax" + ctSecure;</script>';
256
  }
257
 
258
  /**
337
  $debug = '';
338
  }
339
  $sfw_die_page = str_replace( "{DEBUG}", $debug, $sfw_die_page );
340
+
341
+ http_response_code(403);
342
+ die($sfw_die_page);
343
+
344
  }else{
345
+ http_response_code(403);
346
+ die("IP BLACKLISTED. Blocked by AntiCrawler " . $result['ip']);
347
  }
348
 
349
  }
lib/Cleantalk/ApbctWP/Firewall/AntiFlood.php CHANGED
@@ -86,7 +86,7 @@ class AntiFlood extends \Cleantalk\Common\Firewall\FirewallModule{
86
  if( Cookie::get( 'apbct_antiflood_passed' ) === md5( $current_ip . $this->api_key ) ){
87
 
88
  if( ! headers_sent() ){
89
- \Cleantalk\Common\Helper::apbct_cookie__set( 'apbct_antiflood_passed', '0', time() - 86400, '/', null, false, true, 'Lax' );
90
  }
91
 
92
  // Do logging an one passed request
@@ -223,11 +223,13 @@ class AntiFlood extends \Cleantalk\Common\Firewall\FirewallModule{
223
  foreach( $replaces as $place_holder => $replace ){
224
  $sfw_die_page = str_replace( $place_holder, $replace, $sfw_die_page );
225
  }
226
-
227
- @wp_die( $sfw_die_page, 'Blacklisted', array( 'response' => 403 ) );
228
-
 
229
  } else{
230
- @wp_die( "IP BLACKLISTED. Blocked by AntiFlood " . $result['ip'], 'Blacklisted', array( 'response' => 403 ) );
 
231
  }
232
 
233
  }
86
  if( Cookie::get( 'apbct_antiflood_passed' ) === md5( $current_ip . $this->api_key ) ){
87
 
88
  if( ! headers_sent() ){
89
+ Cookie::set( 'apbct_antiflood_passed', '0', time() - 86400, '/', null, null, true, 'Lax' );
90
  }
91
 
92
  // Do logging an one passed request
223
  foreach( $replaces as $place_holder => $replace ){
224
  $sfw_die_page = str_replace( $place_holder, $replace, $sfw_die_page );
225
  }
226
+
227
+ http_response_code(403);
228
+ die($sfw_die_page);
229
+
230
  } else{
231
+ http_response_code(403);
232
+ die("IP BLACKLISTED. Blocked by AntiFlood " . $result['ip']);
233
  }
234
 
235
  }
lib/Cleantalk/ApbctWP/Firewall/SFW.php CHANGED
@@ -3,8 +3,8 @@
3
  namespace Cleantalk\ApbctWP\Firewall;
4
 
5
  use Cleantalk\ApbctWP\API;
 
6
  use Cleantalk\ApbctWP\Helper;
7
- use Cleantalk\Common\Schema;
8
  use Cleantalk\Variables\Cookie;
9
  use Cleantalk\Variables\Get;
10
  use Cleantalk\Variables\Server;
@@ -20,7 +20,7 @@ class SFW extends \Cleantalk\Common\Firewall\FirewallModule {
20
  private $sfw_counter = false;
21
  private $api_key = false;
22
  private $apbct = array();
23
- private $set_cookies = false;
24
  private $cookie_domain = false;
25
 
26
  public $module_name = 'SFW';
@@ -81,12 +81,12 @@ class SFW extends \Cleantalk\Common\Firewall\FirewallModule {
81
  // Skip by cookie
82
  foreach( $this->ip_array as $current_ip ){
83
 
84
- if( substr( Cookie::get( 'ct_sfw_pass_key' ), 0, 32 ) == md5( $current_ip . $this->api_key ) ){
85
 
86
  if( Cookie::get( 'ct_sfw_passed' ) ){
87
 
88
  if( ! headers_sent() ){
89
- \Cleantalk\Common\Helper::apbct_cookie__set( 'ct_sfw_passed', '0', time() + 86400 * 3, '/', null, false, true, 'Lax' );
90
  } else {
91
  $results[] = array( 'ip' => $current_ip, 'is_personal' => false, 'status' => 'PASS_SFW__BY_COOKIE', );
92
  }
@@ -136,12 +136,12 @@ class SFW extends \Cleantalk\Common\Firewall\FirewallModule {
136
 
137
  foreach( $db_results as $db_result ){
138
 
139
- if( $db_result['status'] == 1 ) {
140
  $results[] = array('ip' => $current_ip, 'is_personal' => false, 'status' => 'PASS_SFW__BY_WHITELIST',);
141
  break;
 
 
142
  }
143
- else
144
- $results[] = array('ip' => $current_ip, 'is_personal' => false, 'status' => 'DENY_SFW',);
145
 
146
  }
147
 
@@ -198,10 +198,16 @@ class SFW extends \Cleantalk\Common\Firewall\FirewallModule {
198
  }
199
 
200
  public function actions_for_passed( $result ){
201
- if( $this->set_cookies && ! headers_sent() ) {
202
  $status = $result['status'] == 'PASS_SFW__BY_WHITELIST' ? '1' : '0';
203
  $cookie_val = md5( $result['ip'] . $this->api_key ) . $status;
204
- \Cleantalk\ApbctWP\Helper::apbct_cookie__set( 'ct_sfw_pass_key', $cookie_val, time() + 86400 * 30, '/', null, false );
 
 
 
 
 
 
205
  }
206
  }
207
 
@@ -289,11 +295,13 @@ class SFW extends \Cleantalk\Common\Firewall\FirewallModule {
289
  foreach( $replaces as $place_holder => $replace ){
290
  $sfw_die_page = str_replace( $place_holder, $replace, $sfw_die_page );
291
  }
292
-
293
- @wp_die($sfw_die_page, "Blacklisted", Array('response'=>403));
294
-
 
295
  }else{
296
- @wp_die("IP BLACKLISTED. Blocked by SFW " . $result['ip'], "Blacklisted", Array('response'=>403));
 
297
  }
298
 
299
  }
@@ -388,15 +396,6 @@ class SFW extends \Cleantalk\Common\Firewall\FirewallModule {
388
  $result = API::method__get_2s_blacklists_db( $api_key, 'multifiles', '3_0' );
389
 
390
  if( empty( $result['error'] ) ){
391
-
392
- // User-Agents blacklist
393
- global $apbct;
394
-
395
- if( ! empty( $result['file_ua_url'] ) && ( $apbct->settings['sfw__anti_crawler'] || $apbct->settings['sfw__anti_flood'] ) ){
396
- $ua_bl_res = AntiCrawler::update( trim( $result['file_ua_url'] ) );
397
- if( ! empty( $ua_bl_res['error'] ) )
398
- $apbct->error_add( 'sfw_update', $ua_bl_res['error'] );
399
- }
400
 
401
  if( ! empty( $result['file_url'] ) ){
402
 
@@ -405,7 +404,8 @@ class SFW extends \Cleantalk\Common\Firewall\FirewallModule {
405
  if( empty( $data['error'] ) ){
406
 
407
  return array(
408
- 'multifile_url' => $result['file_url'],
 
409
  'file_urls' => $data,
410
  );
411
 
@@ -469,20 +469,23 @@ class SFW extends \Cleantalk\Common\Firewall\FirewallModule {
469
  return $data;
470
  }
471
 
472
- public static function firewall_update__write_to_db__exclusions( $db, $db__table__data ) {
473
 
474
  $query = 'INSERT INTO `' . $db__table__data . '` (network, mask, status) VALUES ';
475
-
476
- $exclusions = array();
477
-
478
  //Exclusion for servers IP (SERVER_ADDR)
479
  if ( Server::get('HTTP_HOST') ) {
480
 
481
- // Exceptions for local hosts
482
  if( ! in_array( Server::get_domain(), array( 'lc', 'loc', 'lh' ) ) ){
483
  $exclusions[] = Helper::dns__resolve( Server::get( 'HTTP_HOST' ) );
484
  $exclusions[] = '127.0.0.1';
485
- }
 
 
 
 
 
486
  }
487
 
488
  foreach ( $exclusions as $exclusion ) {
@@ -503,40 +506,89 @@ class SFW extends \Cleantalk\Common\Firewall\FirewallModule {
503
  return 0;
504
 
505
  }
506
-
507
  /**
508
- * Creatin a temporary updating table
 
 
 
509
  *
510
- * @param \wpdb $db database handler
511
  */
512
- public static function create_temp_tables( $db ){
513
- global $wpdb, $apbct;
514
- $sql = 'SHOW TABLES LIKE "%scleantalk_sfw";';
515
- $sql = sprintf( $sql, $wpdb->prefix ); // Adding current blog prefix
516
- $result = $wpdb->get_var( $sql );
517
- if( ! $result ){
518
- apbct_activation__create_tables( Schema::getSchema('sfw'), $apbct->db_prefix );
 
 
 
 
 
 
 
 
 
519
  }
520
- $db->execute( 'CREATE TABLE IF NOT EXISTS `' . APBCT_TBL_FIREWALL_DATA . '_temp` LIKE `' . APBCT_TBL_FIREWALL_DATA . '`;' );
521
- $db->execute( 'TRUNCATE TABLE `' . APBCT_TBL_FIREWALL_DATA . '_temp`;' );
522
  }
523
-
524
  /**
525
- * Removing a temporary updating table
 
 
 
526
  *
527
- * @param \wpdb $db database handler
528
  */
529
- public static function delete_main_data_tables( $db ){
530
- $db->execute( 'DROP TABLE `'. APBCT_TBL_FIREWALL_DATA .'`;' );
 
 
 
 
 
 
 
 
 
 
 
 
 
531
  }
532
-
533
  /**
534
- * Renamin a temporary updating table into production table name
 
 
 
535
  *
536
- * @param \wpdb $db database handler
537
  */
538
- public static function rename_data_tables( $db ){
539
- $db->execute( 'ALTER TABLE `'. APBCT_TBL_FIREWALL_DATA .'_temp` RENAME `'. APBCT_TBL_FIREWALL_DATA .'`;' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
540
  }
541
 
542
  }
3
  namespace Cleantalk\ApbctWP\Firewall;
4
 
5
  use Cleantalk\ApbctWP\API;
6
+ use Cleantalk\ApbctWP\DB;
7
  use Cleantalk\ApbctWP\Helper;
 
8
  use Cleantalk\Variables\Cookie;
9
  use Cleantalk\Variables\Get;
10
  use Cleantalk\Variables\Server;
20
  private $sfw_counter = false;
21
  private $api_key = false;
22
  private $apbct = array();
23
+ private $data__set_cookies = false;
24
  private $cookie_domain = false;
25
 
26
  public $module_name = 'SFW';
81
  // Skip by cookie
82
  foreach( $this->ip_array as $current_ip ){
83
 
84
+ if( strpos( Cookie::get( 'ct_sfw_pass_key' ), md5( $current_ip . $this->api_key ) ) === 0 ){
85
 
86
  if( Cookie::get( 'ct_sfw_passed' ) ){
87
 
88
  if( ! headers_sent() ){
89
+ \Cleantalk\ApbctWP\Variables\Cookie::set( 'ct_sfw_passed', '0', time() + 86400 * 3, '/', null, null, true, 'Lax' );
90
  } else {
91
  $results[] = array( 'ip' => $current_ip, 'is_personal' => false, 'status' => 'PASS_SFW__BY_COOKIE', );
92
  }
136
 
137
  foreach( $db_results as $db_result ){
138
 
139
+ if( (int) $db_result['status'] === 1 ) {
140
  $results[] = array('ip' => $current_ip, 'is_personal' => false, 'status' => 'PASS_SFW__BY_WHITELIST',);
141
  break;
142
+ }else{
143
+ $results[] = array( 'ip' => $current_ip, 'is_personal' => false, 'status' => 'DENY_SFW', );
144
  }
 
 
145
 
146
  }
147
 
198
  }
199
 
200
  public function actions_for_passed( $result ){
201
+ if( $this->data__set_cookies == 1 && ! headers_sent() ) {
202
  $status = $result['status'] == 'PASS_SFW__BY_WHITELIST' ? '1' : '0';
203
  $cookie_val = md5( $result['ip'] . $this->api_key ) . $status;
204
+ \Cleantalk\ApbctWP\Variables\Cookie::setNativeCookie(
205
+ 'ct_sfw_pass_key',
206
+ $cookie_val,
207
+ time() + 86400 * 30,
208
+ '/',
209
+ null,
210
+ null );
211
  }
212
  }
213
 
295
  foreach( $replaces as $place_holder => $replace ){
296
  $sfw_die_page = str_replace( $place_holder, $replace, $sfw_die_page );
297
  }
298
+
299
+ http_response_code(403);
300
+ die($sfw_die_page);
301
+
302
  }else{
303
+ http_response_code(403);
304
+ die("IP BLACKLISTED. Blocked by SFW " . $result['ip']);
305
  }
306
 
307
  }
396
  $result = API::method__get_2s_blacklists_db( $api_key, 'multifiles', '3_0' );
397
 
398
  if( empty( $result['error'] ) ){
 
 
 
 
 
 
 
 
 
399
 
400
  if( ! empty( $result['file_url'] ) ){
401
 
404
  if( empty( $data['error'] ) ){
405
 
406
  return array(
407
+ 'multifile_url' => trim( $result['file_url'] ),
408
+ 'useragent_url' => trim( $result['file_ua_url'] ),
409
  'file_urls' => $data,
410
  );
411
 
469
  return $data;
470
  }
471
 
472
+ public static function update__write_to_db__exclusions( $db, $db__table__data, $exclusions = array() ) {
473
 
474
  $query = 'INSERT INTO `' . $db__table__data . '` (network, mask, status) VALUES ';
475
+
 
 
476
  //Exclusion for servers IP (SERVER_ADDR)
477
  if ( Server::get('HTTP_HOST') ) {
478
 
479
+ // Do not add exceptions for local hosts
480
  if( ! in_array( Server::get_domain(), array( 'lc', 'loc', 'lh' ) ) ){
481
  $exclusions[] = Helper::dns__resolve( Server::get( 'HTTP_HOST' ) );
482
  $exclusions[] = '127.0.0.1';
483
+
484
+ // And delete all 127.0.0.1 entries for local hosts
485
+ }else{
486
+ global $wpdb;
487
+ $wpdb->query( 'DELETE FROM ' . $db__table__data . ' WHERE network = ' . ip2long( '127.0.0.1' ) . ';' );
488
+ }
489
  }
490
 
491
  foreach ( $exclusions as $exclusion ) {
506
  return 0;
507
 
508
  }
509
+
510
  /**
511
+ * Creating a temporary updating table
512
+ *
513
+ * @param DB $db database handler
514
+ * @param array|string $table_names Array with table names to create
515
  *
516
+ * @return bool|array
517
  */
518
+ public static function create_temp_tables( $db, $table_names ){
519
+
520
+ // Cast it to array for simple input
521
+ $table_names = (array) $table_names;
522
+
523
+ foreach( $table_names as $table_name ){
524
+
525
+ $table_name__temp = $table_name . '_temp';
526
+
527
+ if( ! $db->execute( 'CREATE TABLE IF NOT EXISTS `' . $table_name__temp . '` LIKE `' . $table_name . '`;' ) ){
528
+ return array( 'error' => 'CREATE TEMP TABLES: COULD NOT CREATE' . $table_name__temp );
529
+ }
530
+
531
+ if( ! $db->execute( 'TRUNCATE TABLE `' . $table_name__temp . '`;' ) ){
532
+ return array( 'error' => 'CREATE TEMP TABLES: COULD NOT TRUNCATE' . $table_name__temp );
533
+ }
534
  }
535
+
536
+ return true;
537
  }
538
+
539
  /**
540
+ * Delete tables with given names if they exists
541
+ *
542
+ * @param DB $db
543
+ * @param array|string $table_names Array with table names to delete
544
  *
545
+ * @return bool|array
546
  */
547
+ public static function data_tables__delete( $db, $table_names ){
548
+
549
+ // Cast it to array for simple input
550
+ $table_names = (array) $table_names;
551
+
552
+ foreach( $table_names as $table_name ){
553
+
554
+ if( ! $db->isTableExists( $table_name ) ){
555
+ return array( 'error' => 'DELETE TABLE: TABLE IS NOT EXISTS: ' . $table_name);
556
+ }
557
+
558
+ $db->execute( 'DROP TABLE ' . $table_name . ';' );
559
+ }
560
+
561
+ return true;
562
  }
563
+
564
  /**
565
+ * Renaming a temporary updating table into production table name
566
+ *
567
+ * @param DB $db database handler
568
+ * @param array|string $table_names Array with table names to rename
569
  *
570
+ * @return bool|array
571
  */
572
+ public static function rename_data_tables__from_temp_to_main( $db, $table_names ){
573
+
574
+ // Cast it to array for simple input
575
+ $table_names = (array) $table_names;
576
+
577
+ foreach( $table_names as $table_name ){
578
+
579
+ $table_name__temp = $table_name . '_temp';
580
+
581
+ if( ! $db->isTableExists( $table_name__temp ) )
582
+ return array( 'error' => 'RENAME TABLE: TEMPORARY TABLE IS NOT EXISTS: ' . $table_name__temp );
583
+
584
+ if( $db->isTableExists( $table_name ) )
585
+ return array( 'error' => 'RENAME TABLE: MAIN TABLE IS STILL EXISTS: ' . $table_name );
586
+
587
+ $db->execute( 'ALTER TABLE `' . $table_name__temp . '` RENAME `' . $table_name . '`;' );
588
+
589
+ }
590
+
591
+ return true;
592
  }
593
 
594
  }
lib/Cleantalk/ApbctWP/Firewall/die_page_anticrawler.html CHANGED
@@ -69,6 +69,113 @@
69
  transform: scale(1.0);
70
  }
71
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  </style>
73
  <script>
74
  var ct_date = new Date;
@@ -76,7 +183,8 @@
76
  function set_spamFireWallCookie(cookie_name, cookie_value) {
77
  var date = new Date;
78
  date.setDate(date.getDate() + 30);
79
- document.cookie = cookie_name + '=' + escape(cookie_value) + '; path=/; expires=' + date.toUTCString() + '; samesite=lax';
 
80
  return null;
81
  }
82
 
69
  transform: scale(1.0);
70
  }
71
  }
72
+
73
+ html {
74
+ background: #f1f1f1;
75
+ }
76
+ body {
77
+ background: #fff;
78
+ border: 1px solid #ccd0d4;
79
+ color: #444;
80
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
81
+ margin: 2em auto;
82
+ padding: 1em 2em;
83
+ max-width: 700px;
84
+ -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .04);
85
+ box-shadow: 0 1px 1px rgba(0, 0, 0, .04);
86
+ }
87
+ h1 {
88
+ border-bottom: 1px solid #dadada;
89
+ clear: both;
90
+ color: #666;
91
+ font-size: 24px;
92
+ margin: 30px 0 0 0;
93
+ padding: 0;
94
+ padding-bottom: 7px;
95
+ }
96
+ #error-page {
97
+ margin-top: 50px;
98
+ }
99
+ #error-page p,
100
+ #error-page .wp-die-message {
101
+ font-size: 14px;
102
+ line-height: 1.5;
103
+ margin: 25px 0 20px;
104
+ }
105
+ #error-page code {
106
+ font-family: Consolas, Monaco, monospace;
107
+ }
108
+ ul li {
109
+ margin-bottom: 10px;
110
+ font-size: 14px ;
111
+ }
112
+ a {
113
+ color: #0073aa;
114
+ }
115
+ a:hover,
116
+ a:active {
117
+ color: #006799;
118
+ }
119
+ a:focus {
120
+ color: #124964;
121
+ -webkit-box-shadow:
122
+ 0 0 0 1px #5b9dd9,
123
+ 0 0 2px 1px rgba(30, 140, 190, 0.8);
124
+ box-shadow:
125
+ 0 0 0 1px #5b9dd9,
126
+ 0 0 2px 1px rgba(30, 140, 190, 0.8);
127
+ outline: none;
128
+ }
129
+ .button {
130
+ background: #f3f5f6;
131
+ border: 1px solid #016087;
132
+ color: #016087;
133
+ display: inline-block;
134
+ text-decoration: none;
135
+ font-size: 13px;
136
+ line-height: 2;
137
+ height: 28px;
138
+ margin: 0;
139
+ padding: 0 10px 1px;
140
+ cursor: pointer;
141
+ -webkit-border-radius: 3px;
142
+ -webkit-appearance: none;
143
+ border-radius: 3px;
144
+ white-space: nowrap;
145
+ -webkit-box-sizing: border-box;
146
+ -moz-box-sizing: border-box;
147
+ box-sizing: border-box;
148
+
149
+ vertical-align: top;
150
+ }
151
+
152
+ .button.button-large {
153
+ line-height: 2.30769231;
154
+ min-height: 32px;
155
+ padding: 0 12px;
156
+ }
157
+
158
+ .button:hover,
159
+ .button:focus {
160
+ background: #f1f1f1;
161
+ }
162
+
163
+ .button:focus {
164
+ background: #f3f5f6;
165
+ border-color: #007cba;
166
+ -webkit-box-shadow: 0 0 0 1px #007cba;
167
+ box-shadow: 0 0 0 1px #007cba;
168
+ color: #016087;
169
+ outline: 2px solid transparent;
170
+ outline-offset: 0;
171
+ }
172
+
173
+ .button:active {
174
+ background: #f3f5f6;
175
+ border-color: #7e8993;
176
+ -webkit-box-shadow: none;
177
+ box-shadow: none;
178
+ }
179
  </style>
180
  <script>
181
  var ct_date = new Date;
183
  function set_spamFireWallCookie(cookie_name, cookie_value) {
184
  var date = new Date;
185
  date.setDate(date.getDate() + 30);
186
+ var ctSecure = location.protocol === 'https:' ? '; secure' : '';
187
+ document.cookie = cookie_name + '=' + escape(cookie_value) + '; path=/; expires=' + date.toUTCString() + '; samesite=lax' + ctSecure;
188
  return null;
189
  }
190
 
lib/Cleantalk/ApbctWP/Firewall/die_page_antiflood.html CHANGED
@@ -70,6 +70,112 @@
70
  transform: scale(1.0);
71
  }
72
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  </style>
74
  <script>
75
  var ct_date = new Date;
@@ -77,7 +183,8 @@
77
  function set_spamFireWallCookie(cookie_name, cookie_value) {
78
  var date = new Date;
79
  date.setDate(date.getDate() + 30);
80
- document.cookie = cookie_name + '=' + escape(cookie_value) + '; path=/; expires=' + date.toUTCString() + '; samesite=lax';
 
81
  return null;
82
  }
83
 
70
  transform: scale(1.0);
71
  }
72
  }
73
+ html {
74
+ background: #f1f1f1;
75
+ }
76
+ body {
77
+ background: #fff;
78
+ border: 1px solid #ccd0d4;
79
+ color: #444;
80
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
81
+ margin: 2em auto;
82
+ padding: 1em 2em;
83
+ max-width: 700px;
84
+ -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .04);
85
+ box-shadow: 0 1px 1px rgba(0, 0, 0, .04);
86
+ }
87
+ h1 {
88
+ border-bottom: 1px solid #dadada;
89
+ clear: both;
90
+ color: #666;
91
+ font-size: 24px;
92
+ margin: 30px 0 0 0;
93
+ padding: 0;
94
+ padding-bottom: 7px;
95
+ }
96
+ #error-page {
97
+ margin-top: 50px;
98
+ }
99
+ #error-page p,
100
+ #error-page .wp-die-message {
101
+ font-size: 14px;
102
+ line-height: 1.5;
103
+ margin: 25px 0 20px;
104
+ }
105
+ #error-page code {
106
+ font-family: Consolas, Monaco, monospace;
107
+ }
108
+ ul li {
109
+ margin-bottom: 10px;
110
+ font-size: 14px ;
111
+ }
112
+ a {
113
+ color: #0073aa;
114
+ }
115
+ a:hover,
116
+ a:active {
117
+ color: #006799;
118
+ }
119
+ a:focus {
120
+ color: #124964;
121
+ -webkit-box-shadow:
122
+ 0 0 0 1px #5b9dd9,
123
+ 0 0 2px 1px rgba(30, 140, 190, 0.8);
124
+ box-shadow:
125
+ 0 0 0 1px #5b9dd9,
126
+ 0 0 2px 1px rgba(30, 140, 190, 0.8);
127
+ outline: none;
128
+ }
129
+ .button {
130
+ background: #f3f5f6;
131
+ border: 1px solid #016087;
132
+ color: #016087;
133
+ display: inline-block;
134
+ text-decoration: none;
135
+ font-size: 13px;
136
+ line-height: 2;
137
+ height: 28px;
138
+ margin: 0;
139
+ padding: 0 10px 1px;
140
+ cursor: pointer;
141
+ -webkit-border-radius: 3px;
142
+ -webkit-appearance: none;
143
+ border-radius: 3px;
144
+ white-space: nowrap;
145
+ -webkit-box-sizing: border-box;
146
+ -moz-box-sizing: border-box;
147
+ box-sizing: border-box;
148
+
149
+ vertical-align: top;
150
+ }
151
+
152
+ .button.button-large {
153
+ line-height: 2.30769231;
154
+ min-height: 32px;
155
+ padding: 0 12px;
156
+ }
157
+
158
+ .button:hover,
159
+ .button:focus {
160
+ background: #f1f1f1;
161
+ }
162
+
163
+ .button:focus {
164
+ background: #f3f5f6;
165
+ border-color: #007cba;
166
+ -webkit-box-shadow: 0 0 0 1px #007cba;
167
+ box-shadow: 0 0 0 1px #007cba;
168
+ color: #016087;
169
+ outline: 2px solid transparent;
170
+ outline-offset: 0;
171
+ }
172
+
173
+ .button:active {
174
+ background: #f3f5f6;
175
+ border-color: #7e8993;
176
+ -webkit-box-shadow: none;
177
+ box-shadow: none;
178
+ }
179
  </style>
180
  <script>
181
  var ct_date = new Date;
183
  function set_spamFireWallCookie(cookie_name, cookie_value) {
184
  var date = new Date;
185
  date.setDate(date.getDate() + 30);
186
+ var ctSecure = location.protocol === 'https:' ? '; secure' : '';
187
+ document.cookie = cookie_name + '=' + escape(cookie_value) + '; path=/; expires=' + date.toUTCString() + '; samesite=lax' + ctSecure;
188
  return null;
189
  }
190
 
lib/Cleantalk/ApbctWP/Firewall/die_page_sfw.html CHANGED
@@ -70,6 +70,112 @@
70
  transform: scale(1.0);
71
  }
72
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  </style>
74
  <script>
75
  var ct_date = new Date;
@@ -77,7 +183,8 @@
77
  function set_spamFireWallCookie(cookie_name, cookie_value) {
78
  var date = new Date;
79
  date.setDate(date.getDate() + 30);
80
- document.cookie = cookie_name + '=' + escape(cookie_value) + '; path=/; expires=' + date.toUTCString() + '; samesite=lax';
 
81
  return null;
82
  }
83
 
70
  transform: scale(1.0);
71
  }
72
  }
73
+ html {
74
+ background: #f1f1f1;
75
+ }
76
+ body {
77
+ background: #fff;
78
+ border: 1px solid #ccd0d4;
79
+ color: #444;
80
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
81
+ margin: 2em auto;
82
+ padding: 1em 2em;
83
+ max-width: 700px;
84
+ -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .04);
85
+ box-shadow: 0 1px 1px rgba(0, 0, 0, .04);
86
+ }
87
+ h1 {
88
+ border-bottom: 1px solid #dadada;
89
+ clear: both;
90
+ color: #666;
91
+ font-size: 24px;
92
+ margin: 30px 0 0 0;
93
+ padding: 0;
94
+ padding-bottom: 7px;
95
+ }
96
+ #error-page {
97
+ margin-top: 50px;
98
+ }
99
+ #error-page p,
100
+ #error-page .wp-die-message {
101
+ font-size: 14px;
102
+ line-height: 1.5;
103
+ margin: 25px 0 20px;
104
+ }
105
+ #error-page code {
106
+ font-family: Consolas, Monaco, monospace;
107
+ }
108
+ ul li {
109
+ margin-bottom: 10px;
110
+ font-size: 14px ;
111
+ }
112
+ a {
113
+ color: #0073aa;
114
+ }
115
+ a:hover,
116
+ a:active {
117
+ color: #006799;
118
+ }
119
+ a:focus {
120
+ color: #124964;
121
+ -webkit-box-shadow:
122
+ 0 0 0 1px #5b9dd9,
123
+ 0 0 2px 1px rgba(30, 140, 190, 0.8);
124
+ box-shadow:
125
+ 0 0 0 1px #5b9dd9,
126
+ 0 0 2px 1px rgba(30, 140, 190, 0.8);
127
+ outline: none;
128
+ }
129
+ .button {
130
+ background: #f3f5f6;
131
+ border: 1px solid #016087;
132
+ color: #016087;
133
+ display: inline-block;
134
+ text-decoration: none;
135
+ font-size: 13px;
136
+ line-height: 2;
137
+ height: 28px;
138
+ margin: 0;
139
+ padding: 0 10px 1px;
140
+ cursor: pointer;
141
+ -webkit-border-radius: 3px;
142
+ -webkit-appearance: none;
143
+ border-radius: 3px;
144
+ white-space: nowrap;
145
+ -webkit-box-sizing: border-box;
146
+ -moz-box-sizing: border-box;
147
+ box-sizing: border-box;
148
+
149
+ vertical-align: top;
150
+ }
151
+
152
+ .button.button-large {
153
+ line-height: 2.30769231;
154
+ min-height: 32px;
155
+ padding: 0 12px;
156
+ }
157
+
158
+ .button:hover,
159
+ .button:focus {
160
+ background: #f1f1f1;
161
+ }
162
+
163
+ .button:focus {
164
+ background: #f3f5f6;
165
+ border-color: #007cba;
166
+ -webkit-box-shadow: 0 0 0 1px #007cba;
167
+ box-shadow: 0 0 0 1px #007cba;
168
+ color: #016087;
169
+ outline: 2px solid transparent;
170
+ outline-offset: 0;
171
+ }
172
+
173
+ .button:active {
174
+ background: #f3f5f6;
175
+ border-color: #7e8993;
176
+ -webkit-box-shadow: none;
177
+ box-shadow: none;
178
+ }
179
  </style>
180
  <script>
181
  var ct_date = new Date;
183
  function set_spamFireWallCookie(cookie_name, cookie_value) {
184
  var date = new Date;
185
  date.setDate(date.getDate() + 30);
186
+ var ctSecure = location.protocol === 'https:' ? '; secure' : '';
187
+ document.cookie = cookie_name + '=' + escape(cookie_value) + '; path=/; expires=' + date.toUTCString() + '; samesite=lax' + ctSecure;
188
  return null;
189
  }
190
 
lib/Cleantalk/ApbctWP/Helper.php CHANGED
@@ -35,7 +35,7 @@ class Helper extends \Cleantalk\Common\Helper
35
  *
36
  * @return array|bool (array || array('error' => true))
37
  */
38
- static public function http__request($url, $data = array(), $presets = null, $opts = array())
39
  {
40
  // Set APBCT User-Agent and passing data to parent method
41
  $opts = self::array_merge__save_numeric_keys(
@@ -56,7 +56,7 @@ class Helper extends \Cleantalk\Common\Helper
56
  *
57
  * @return array|mixed|string
58
  */
59
- static public function http__request__get_response_code( $url ){
60
  return static::http__request( $url, array(), 'get_code');
61
  }
62
 
@@ -68,53 +68,98 @@ class Helper extends \Cleantalk\Common\Helper
68
  *
69
  * @return array|mixed|string
70
  */
71
- static public function http__request__get_content( $url ){
72
  return static::http__request( $url, array(), 'get dont_split_to_array');
73
  }
74
 
75
- static public function http__request__rc_to_host( $rc_action, $request_params, $patterns = array() ){
 
 
 
 
 
 
 
 
 
 
76
 
77
  global $apbct;
78
-
79
- $request_params__default = array(
80
  'spbc_remote_call_token' => md5( $apbct->api_key ),
81
  'spbc_remote_call_action' => $rc_action,
82
  'plugin_name' => 'apbct',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  );
84
 
85
- $result__rc_check_website = static::http__request(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  get_option( 'siteurl' ),
87
- array_merge( $request_params__default, $request_params, array( 'test' => 'test' ) ),
88
- array( 'get', 'dont_split_to_array' )
89
  );
90
 
91
  // Considering empty response as error
92
- $result__rc_check_website !== '' ?: $result__rc_check_website = array( 'error' => 'EMPTY_RESPONSE' );
93
-
94
- if( empty( $result__rc_check_website['error'] ) ){
 
 
 
95
 
96
- if( preg_match( '@^.*?OK$@', $result__rc_check_website) ){
97
-
98
- static::http__request(
99
- get_option( 'siteurl' ),
100
- array_merge( $request_params__default, $request_params ),
101
- array_merge( array( 'get', ), $patterns )
102
- );
103
-
104
- }else
105
- return array(
106
- 'error' => 'WRONG_SITE_RESPONSE ACTION: ' . $rc_action . ' RESPONSE: ' . htmlspecialchars( substr(
107
- ! is_string( $result__rc_check_website )
108
- ? print_r( $result__rc_check_website, true )
109
- : $result__rc_check_website,
110
- 0,
111
- 400
112
- ) )
113
- );
114
- }else
115
- return array( 'error' => 'WRONG_SITE_RESPONSE TEST ACTION: ' . $rc_action . ' ERROR: ' . $result__rc_check_website['error'] );
116
-
117
- return true;
118
  }
119
 
120
  /**
35
  *
36
  * @return array|bool (array || array('error' => true))
37
  */
38
+ public static function http__request($url, $data = array(), $presets = null, $opts = array())
39
  {
40
  // Set APBCT User-Agent and passing data to parent method
41
  $opts = self::array_merge__save_numeric_keys(
56
  *
57
  * @return array|mixed|string
58
  */
59
+ public static function http__request__get_response_code( $url ){
60
  return static::http__request( $url, array(), 'get_code');
61
  }
62
 
68
  *
69
  * @return array|mixed|string
70
  */
71
+ public static function http__request__get_content( $url ){
72
  return static::http__request( $url, array(), 'get dont_split_to_array');
73
  }
74
 
75
+ /**
76
+ * Performs remote call to the current website
77
+ *
78
+ * @param string $rc_action
79
+ * @param array $request_params
80
+ * @param array $patterns
81
+ * @param bool $do_check Perform check before main remote call or not
82
+ *
83
+ * @return bool|string[]
84
+ */
85
+ public static function http__request__rc_to_host( $rc_action, $request_params, $patterns = array(), $do_check = true ){
86
 
87
  global $apbct;
88
+
89
+ $request_params = array_merge( array(
90
  'spbc_remote_call_token' => md5( $apbct->api_key ),
91
  'spbc_remote_call_action' => $rc_action,
92
  'plugin_name' => 'apbct',
93
+ ), $request_params );
94
+ $patterns = array_merge(
95
+ array(
96
+ 'get',
97
+ 'dont_split_to_array'
98
+ ),
99
+ $patterns );
100
+
101
+ if( $do_check ){
102
+ $result__rc_check_website = static::http__request__rc_to_host__test( $rc_action, $request_params, $patterns );
103
+ if( ! empty( $result__rc_check_website['error'] ) ){
104
+ return $result__rc_check_website;
105
+ }
106
+ }
107
+
108
+ static::http__request(
109
+ get_option( 'siteurl' ),
110
+ $request_params,
111
+ $patterns
112
  );
113
 
114
+ return true;
115
+ }
116
+
117
+ /**
118
+ * Performs test remote call to the current website
119
+ * Expects 'OK' string as good response
120
+ *
121
+ * @param array $request_params
122
+ * @param array $patterns
123
+ *
124
+ * @return array|bool|string
125
+ */
126
+ public static function http__request__rc_to_host__test( $rc_action, $request_params, $patterns = array() ){
127
+
128
+ // Delete async pattern to get the result in this process
129
+ $key = array_search( 'async', $patterns, true );
130
+ if( $key ){
131
+ unset( $patterns[ $key ] );
132
+ }
133
+
134
+ $result = static::http__request(
135
  get_option( 'siteurl' ),
136
+ array_merge( $request_params, array( 'test' => 'test' ) ),
137
+ $patterns
138
  );
139
 
140
  // Considering empty response as error
141
+ if( $result === '' ){
142
+ $result = array( 'error' => 'EMPTY_RESPONSE' );
143
+
144
+ // Wrap and pass error
145
+ }elseif( ! empty( $result['error'] ) ){
146
+ $result = array( 'error' => 'WRONG_SITE_RESPONSE TEST ACTION: ' . $rc_action . ' ERROR: ' . $result['error'] );
147
 
148
+ // Expects 'OK' string as good response otherwise - error
149
+ }elseif( ! preg_match( '@^.*?OK$@', $result ) ){
150
+ $result = array(
151
+ 'error' => 'WRONG_SITE_RESPONSE ACTION: ' . $rc_action . ' RESPONSE: ' . '"' . htmlspecialchars( substr(
152
+ ! is_string( $result )
153
+ ? print_r( $result, true )
154
+ : $result,
155
+ 0,
156
+ 400
157
+ ) )
158
+ . '"'
159
+ );
160
+ }
161
+
162
+ return $result;
 
 
 
 
 
 
 
163
  }
164
 
165
  /**
lib/Cleantalk/ApbctWP/RemoteCalls.php CHANGED
@@ -3,8 +3,8 @@
3
 
4
  namespace Cleantalk\ApbctWP;
5
 
 
6
  use Cleantalk\Variables\Get;
7
- use Cleantalk\ApbctWP\Cron;
8
 
9
  class RemoteCalls
10
  {
@@ -41,8 +41,9 @@ class RemoteCalls
41
  $cooldown = isset($apbct->remote_calls[$action]['cooldown']) ? $apbct->remote_calls[$action]['cooldown'] : self::COOLDOWN;
42
 
43
  // Return OK for test remote calls
44
- if ( Get::get( 'test' ) )
45
  die('OK');
 
46
 
47
  if( time() - $apbct->remote_calls[ $action ]['last_call'] >= $cooldown || ( $action === 'sfw_update' && isset($_GET['file_urls'] ) ) ){
48
 
@@ -60,8 +61,17 @@ class RemoteCalls
60
  if( method_exists( 'Cleantalk\ApbctWP\RemoteCalls', $action ) ){
61
 
62
  // Delay before perform action;
63
- if ( Get::get( 'delay' ) )
64
  sleep( Get::get( 'delay' ) );
 
 
 
 
 
 
 
 
 
65
 
66
  $out = RemoteCalls::$action();
67
 
@@ -105,11 +115,39 @@ class RemoteCalls
105
  */
106
  public static function action__sfw_update(){
107
  global $apbct;
108
- $result = ct_sfw_update( $apbct->api_key, true );
109
  $apbct->error_toggle( ! empty( $result['error'] ), 'sfw_update', $result);
110
  die(empty($result['error']) ? 'OK' : 'FAIL '.json_encode(array('error' => $result['error'])));
111
  }
112
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
  /**
114
  * SFW send logs
115
  *
@@ -178,11 +216,16 @@ class RemoteCalls
178
  $out['fw_stats'] = $apbct->fw_stats;
179
  $out['data'] = $apbct->data;
180
  $out['cron'] = $apbct->cron;
 
 
 
 
 
181
 
182
- // @todo make automatic replacement for timestamp to date
183
  array_walk_recursive( $out, function(&$val, $key){
184
- if( is_string( $val ) && preg_match( '@^\d{9,11}$@', $val ) && preg_match( '@time@', $key ) )
185
  $val = date( 'Y-m-d H:i:s', $val );
 
186
  });
187
 
188
  if( APBCT_WPMS ){
3
 
4
  namespace Cleantalk\ApbctWP;
5
 
6
+ use Cleantalk\ApbctWP\Firewall\SFW;
7
  use Cleantalk\Variables\Get;
 
8
 
9
  class RemoteCalls
10
  {
41
  $cooldown = isset($apbct->remote_calls[$action]['cooldown']) ? $apbct->remote_calls[$action]['cooldown'] : self::COOLDOWN;
42
 
43
  // Return OK for test remote calls
44
+ if ( Get::get( 'test' ) ){
45
  die('OK');
46
+ }
47
 
48
  if( time() - $apbct->remote_calls[ $action ]['last_call'] >= $cooldown || ( $action === 'sfw_update' && isset($_GET['file_urls'] ) ) ){
49
 
61
  if( method_exists( 'Cleantalk\ApbctWP\RemoteCalls', $action ) ){
62
 
63
  // Delay before perform action;
64
+ if ( Get::get( 'delay' ) ){
65
  sleep( Get::get( 'delay' ) );
66
+ $params = $_GET;
67
+ unset( $params['delay'] );
68
+ return Helper::http__request__rc_to_host(
69
+ Get::get( 'spbc_remote_action' ),
70
+ $params,
71
+ array( 'async' ),
72
+ false
73
+ );
74
+ }
75
 
76
  $out = RemoteCalls::$action();
77
 
115
  */
116
  public static function action__sfw_update(){
117
  global $apbct;
118
+ $result = apbct_sfw_update__init();
119
  $apbct->error_toggle( ! empty( $result['error'] ), 'sfw_update', $result);
120
  die(empty($result['error']) ? 'OK' : 'FAIL '.json_encode(array('error' => $result['error'])));
121
  }
122
 
123
+ /**
124
+ * SFW update
125
+ *
126
+ * @return string
127
+ */
128
+ public static function action__sfw_update__worker(){
129
+
130
+ global $apbct;
131
+ $result = apbct_sfw_update__worker();
132
+
133
+ $apbct->error_toggle( ! empty( $result['error'] ), 'sfw_update', $result);
134
+
135
+ if( ! empty( $result['error'] ) ){
136
+
137
+ // Delete temporary tables if error_occurs
138
+ SFW::data_tables__delete( DB::getInstance(), APBCT_TBL_FIREWALL_DATA . '_temp' );
139
+
140
+ $apbct->fw_stats['firewall_update_percent'] = 0;
141
+ $apbct->fw_stats['firewall_updating_id'] = null;
142
+ $apbct->save( 'fw_stats' );
143
+
144
+ die( 'FAIL ' . json_encode( array( 'error' => $result['error'] ) ) );
145
+ }
146
+
147
+ die( 'OK' );
148
+
149
+ }
150
+
151
  /**
152
  * SFW send logs
153
  *
216
  $out['fw_stats'] = $apbct->fw_stats;
217
  $out['data'] = $apbct->data;
218
  $out['cron'] = $apbct->cron;
219
+ $out['errors'] = $apbct->errors;
220
+
221
+ array_walk( $out, function(&$val, $key){
222
+ $val = (array) $val;
223
+ });
224
 
 
225
  array_walk_recursive( $out, function(&$val, $key){
226
+ if( is_int( $val ) && preg_match( '@^\d{9,11}$@', $val ) ){
227
  $val = date( 'Y-m-d H:i:s', $val );
228
+ }
229
  });
230
 
231
  if( APBCT_WPMS ){
lib/Cleantalk/ApbctWP/RestController.php CHANGED
@@ -18,6 +18,31 @@ class RestController extends \WP_REST_Controller {
18
  'permission_callback' => '__return_true',
19
  )
20
  ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  }
22
 
23
  }
18
  'permission_callback' => '__return_true',
19
  )
20
  ) );
21
+
22
+ register_rest_route( $this->namespace, "/alt_sessions", array(
23
+ array(
24
+ 'methods' => 'POST',
25
+ 'callback' => array( \Cleantalk\ApbctWP\Variables\AltSessions::class, 'set_fromRemote' ),
26
+ 'args' => array(
27
+ 'cookies' => array(
28
+ 'type' => 'array',
29
+ 'required' => true,
30
+ ),
31
+ ),
32
+ 'permission_callback' => '__return_true',
33
+ ),
34
+ array(
35
+ 'methods' => 'GET',
36
+ 'callback' => array( \Cleantalk\ApbctWP\Variables\AltSessions::class, 'get_fromRemote' ),
37
+ 'args' => array(
38
+ 'name' => array(
39
+ 'type' => 'string',
40
+ 'required' => true,
41
+ ),
42
+ ),
43
+ 'permission_callback' => '__return_true',
44
+ )
45
+ ) );
46
  }
47
 
48
  }
lib/Cleantalk/ApbctWP/State.php CHANGED
@@ -55,7 +55,7 @@ use ArrayObject;
55
  class State
56
  {
57
  public $user = null;
58
- public $use_rest_api = 0;
59
  public $option_prefix = 'cleantalk';
60
  public $storage = array();
61
  public $integrations = array();
@@ -63,26 +63,27 @@ class State
63
 
64
  'apikey' => '',
65
 
66
- /* SpamFireWall settings */
67
  'sfw__enabled' => 1,
68
  'sfw__anti_flood' => 0,
69
  'sfw__anti_flood__view_limit' => 20,
70
  'sfw__anti_crawler' => 1,
71
  'sfw__use_delete_to_clear_table' => 0,
72
 
73
- /* Forms for protection */
74
  'forms__registrations_test' => 1,
75
  'forms__comments_test' => 1,
76
  'forms__contact_forms_test' => 1,
77
  'forms__general_contact_forms_test' => 1, // Antispam test for unsupported and untested contact forms
78
  'forms__wc_checkout_test' => 1, // WooCommerce checkout default test
79
  'forms__wc_register_from_order' => 1, // Woocommerce registration during checkout
80
- 'forms__search_test' => 1, // Test deafult Wordpress form
 
81
  'forms__check_external' => 0,
82
  'forms__check_external__capture_buffer' => 0,
83
  'forms__check_internal' => 0,
84
 
85
- /* Comments and messages */
86
  'comments__disable_comments__all' => 0,
87
  'comments__disable_comments__posts' => 0,
88
  'comments__disable_comments__pages' => 0,
@@ -94,14 +95,14 @@ class State
94
  'comments__show_check_links' => 1, // Shows check link to Cleantalk's DB.
95
  'comments__manage_comments_on_public_page' => 0, // Allows to control comments on public page.
96
 
97
- /* Data processing */
98
- 'data__protect_logged_in' => 1, // Do anti-spam tests to for logged in users.
99
- 'data__use_ajax' => 1,
100
- 'data__use_static_js_key' => -1,
101
- 'data__general_postdata_test' => 0, //CAPD
102
- 'data__set_cookies' => 1, // Disable cookies generatation to be compatible with Varnish.
103
- 'data__set_cookies__sessions' => 0, // Use alt sessions for cookies.
104
- 'data__ssl_on' => 0, // Secure connection to servers
105
 
106
  // Exclusions
107
  'exclusions__urls' => '',
@@ -125,11 +126,10 @@ class State
125
  'misc__send_connection_reports' => 0, // Send connection reports to Cleantalk servers
126
  'misc__async_js' => 0,
127
  'misc__store_urls' => 1,
128
- 'misc__store_urls__sessions' => 1,
129
  'misc__complete_deactivation' => 0,
130
  'misc__debug_ajax' => 0,
131
 
132
- /* WordPress */
133
  'wp__use_builtin_http_api' => 1, // Using Wordpress HTTP built in API
134
  'wp__comment_notify' => 1,
135
  'wp__comment_notify__roles' => array( 'administrator' ),
@@ -246,6 +246,7 @@ class State
246
 
247
  // Firewall
248
  'sfw_update' => array( 'last_call' => 0, 'cooldown' => 0 ),
 
249
  'sfw_send_logs' => array( 'last_call' => 0, 'cooldown' => 0 ),
250
 
251
  // Installation
55
  class State
56
  {
57
  public $user = null;
58
+ public $use_rest_api = 1;
59
  public $option_prefix = 'cleantalk';
60
  public $storage = array();
61
  public $integrations = array();
63
 
64
  'apikey' => '',
65
 
66
+ // SpamFireWall settings
67
  'sfw__enabled' => 1,
68
  'sfw__anti_flood' => 0,
69
  'sfw__anti_flood__view_limit' => 20,
70
  'sfw__anti_crawler' => 1,
71
  'sfw__use_delete_to_clear_table' => 0,
72
 
73
+ // Forms for protection
74
  'forms__registrations_test' => 1,
75
  'forms__comments_test' => 1,
76
  'forms__contact_forms_test' => 1,
77
  'forms__general_contact_forms_test' => 1, // Antispam test for unsupported and untested contact forms
78
  'forms__wc_checkout_test' => 1, // WooCommerce checkout default test
79
  'forms__wc_register_from_order' => 1, // Woocommerce registration during checkout
80
+ 'forms__wc_add_to_cart' => 0, // Woocommerce add to cart
81
+ 'forms__search_test' => 1, // Test default Wordpress form
82
  'forms__check_external' => 0,
83
  'forms__check_external__capture_buffer' => 0,
84
  'forms__check_internal' => 0,
85
 
86
+ // Comments and messages
87
  'comments__disable_comments__all' => 0,
88
  'comments__disable_comments__posts' => 0,
89
  'comments__disable_comments__pages' => 0,
95
  'comments__show_check_links' => 1, // Shows check link to Cleantalk's DB.
96
  'comments__manage_comments_on_public_page' => 0, // Allows to control comments on public page.
97
 
98
+ // Data processing
99
+ 'data__protect_logged_in' => 1, // Do anti-spam tests to for logged in users.
100
+ 'data__use_ajax' => 1,
101
+ 'data__use_static_js_key' => -1,
102
+ 'data__general_postdata_test' => 0, //CAPD
103
+ 'data__set_cookies' => 1, // Set cookies: Disable - 0 / Enable - 1 / Use Alternative cookies - 2.
104
+ 'data__set_cookies__alt_sessions_type' => 1, // Alternative cookies handler type: REST API - 1 / AJAX - 2
105
+ 'data__ssl_on' => 0, // Secure connection to servers
106
 
107
  // Exclusions
108
  'exclusions__urls' => '',
126
  'misc__send_connection_reports' => 0, // Send connection reports to Cleantalk servers
127
  'misc__async_js' => 0,
128
  'misc__store_urls' => 1,
 
129
  'misc__complete_deactivation' => 0,
130
  'misc__debug_ajax' => 0,
131
 
132
+ // WordPress
133
  'wp__use_builtin_http_api' => 1, // Using Wordpress HTTP built in API
134
  'wp__comment_notify' => 1,
135
  'wp__comment_notify__roles' => array( 'administrator' ),
246
 
247
  // Firewall
248
  'sfw_update' => array( 'last_call' => 0, 'cooldown' => 0 ),
249
+ 'sfw_update__worker' => array( 'last_call' => 0, 'cooldown' => 0 ),
250
  'sfw_send_logs' => array( 'last_call' => 0, 'cooldown' => 0 ),
251
 
252
  // Installation
lib/Cleantalk/ApbctWP/Variables/AltSessions.php ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ namespace Cleantalk\ApbctWP\Variables;
5
+
6
+
7
+ use Cleantalk\ApbctWP\Helper;
8
+ use Cleantalk\Variables\Server;
9
+
10
+ class AltSessions {
11
+
12
+ public static $sessions_already_cleaned = false;
13
+
14
+ public static function getID(){
15
+ $id = Helper::ip__get( 'real' )
16
+ . Server::get( 'HTTP_USER_AGENT' )
17
+ . Server::get( 'HTTP_ACCEPT_LANGUAGE' );
18
+ return hash('sha256', $id);
19
+ }
20
+
21
+ public static function set($name, $value){
22
+
23
+ self::cleanFromOld();
24
+
25
+ // Bad incoming data
26
+ if( ! $name || ! $value ){
27
+ return;
28
+ }
29
+
30
+ global $wpdb;
31
+
32
+ $session_id = self::getID();
33
+
34
+ $wpdb->query(
35
+ $wpdb->prepare(
36
+ 'INSERT INTO '. APBCT_TBL_SESSIONS .'
37
+ (id, name, value, last_update)
38
+ VALUES (%s, %s, %s, %s)
39
+ ON DUPLICATE KEY UPDATE
40
+ value = %s,
41
+ last_update = %s',
42
+ $session_id, $name, $value, date('Y-m-d H:i:s'), $value, date('Y-m-d H:i:s')
43
+ )
44
+ );
45
+
46
+ }
47
+
48
+ public static function set_fromRemote( $request = null ){
49
+
50
+ if( ! $request ){
51
+ check_ajax_referer( 'ct_secret_stuff' );
52
+ $cookies_to_set = (array) \Cleantalk\Variables\Post::get( 'cookies' );
53
+ }else{
54
+ $cookies_to_set = $request->get_param( 'cookies' );
55
+ }
56
+
57
+ foreach( $cookies_to_set as $cookie_to_set ){
58
+ \Cleantalk\ApbctWP\Variables\Cookie::set( $cookie_to_set[0], $cookie_to_set[1] );
59
+ }
60
+
61
+ wp_send_json( array( 'success' => true ) );
62
+ }
63
+
64
+ public static function get( $name ){
65
+
66
+ self::cleanFromOld();
67
+
68
+ // Bad incoming data
69
+ if( ! $name ){
70
+ return;
71
+ }
72
+
73
+ global $wpdb;
74
+
75
+ $session_id = self::getID();
76
+ $result = $wpdb->get_row(
77
+ $wpdb->prepare(
78
+ 'SELECT value
79
+ FROM `'. APBCT_TBL_SESSIONS .'`
80
+ WHERE id = %s AND name = %s;',
81
+ $session_id, $name
82
+ ),
83
+ ARRAY_A
84
+ );
85
+
86
+ return isset( $result['value'] ) ? $result['value'] : '';
87
+ }
88
+
89
+ public static function get_fromRemote( $request = null ){
90
+
91
+ if( ! $request ){
92
+ check_ajax_referer( 'ct_secret_stuff' );
93
+ }
94
+
95
+ $value = \Cleantalk\ApbctWP\Variables\Cookie::get( $request
96
+ ? $request->get_param( 'cookies' )
97
+ : \Cleantalk\Variables\Post::get( 'name' )
98
+ );
99
+
100
+ wp_send_json( array( 'success' => true, 'value' => $value ) );
101
+ }
102
+
103
+ public static function cleanFromOld(){
104
+
105
+ if( ! self::$sessions_already_cleaned && rand(0, 1000) < APBCT_SEESION__CHANCE_TO_CLEAN){
106
+
107
+ global $wpdb;
108
+ self::$sessions_already_cleaned = true;
109
+
110
+ $wpdb->query(
111
+ 'DELETE
112
+ FROM `'. APBCT_TBL_SESSIONS .'`
113
+ WHERE last_update < NOW() - INTERVAL '. APBCT_SEESION__LIVE_TIME .' SECOND
114
+ LIMIT 100000;'
115
+ );
116
+ }
117
+ }
118
+
119
+ public static function wipe( $full_clear = true ) {
120
+ global $wpdb;
121
+ return $wpdb->query(
122
+ 'TRUNCATE TABLE '. APBCT_TBL_SESSIONS .';'
123
+ );
124
+ }
125
+
126
+ }
lib/Cleantalk/ApbctWP/Variables/Cookie.php CHANGED
@@ -3,36 +3,125 @@
3
 
4
  namespace Cleantalk\ApbctWP\Variables;
5
 
 
 
6
 
7
  class Cookie extends \Cleantalk\Variables\Cookie {
8
 
9
- public static function get( $name ){
10
 
11
  global $apbct;
12
 
13
  // Return from memory. From $this->variables
14
- if(isset(static::$instance->variables[$name]))
15
- return static::$instance->variables[$name];
16
 
17
- // Gettings by alternative way if enabled
18
- if( $apbct->settings['data__set_cookies__sessions'] ){
19
- $value = apbct_alt_session__get( $name );
20
-
21
- // The old way
22
  }else{
23
-
24
- if( function_exists( 'filter_input' ) )
25
- $value = filter_input( INPUT_COOKIE, $name );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
- if( empty( $value ) )
28
- $value = isset( $_COOKIE[ $name ] ) ? $_COOKIE[ $name ] : '';
 
 
 
 
 
29
 
 
 
30
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
 
32
- // Remember for further calls
33
- static::getInstance()->remember_variable( $name, $value );
34
 
35
- return $value;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  }
37
 
 
 
38
  }
3
 
4
  namespace Cleantalk\ApbctWP\Variables;
5
 
6
+ use Cleantalk\ApbctWP\Helper;
7
+ use Cleantalk\Variables\Server;
8
 
9
  class Cookie extends \Cleantalk\Variables\Cookie {
10
 
11
+ public static function get( $name, $default = '', $raw = false ){
12
 
13
  global $apbct;
14
 
15
  // Return from memory. From $this->variables
16
+ if( isset( static::$instance->variables[ $name ] ) ){
17
+ $value = static::$instance->variables[ $name ];
18
 
19
+ // Get from GLOBAL variable
 
 
 
 
20
  }else{
21
+
22
+ // Getting by alternative way if enabled
23
+ if( $apbct->settings['data__set_cookies'] == 2 ){
24
+ $value = AltSessions::get( $name );
25
+
26
+ // The old way
27
+ }else{
28
+
29
+ if( function_exists( 'filter_input' ) ){
30
+ $value = filter_input( INPUT_COOKIE, $name );
31
+ }
32
+
33
+ if( empty( $value ) ){
34
+ $value = isset( $_COOKIE[ $name ] ) ? $_COOKIE[ $name ] : '';
35
+ }
36
+
37
+ }
38
+
39
+ // Remember for further calls
40
+ static::getInstance()->remember_variable( $name, $value );
41
+ }
42
+
43
+ // Decoding by default
44
+ if( ! $raw ){
45
+ $value = urldecode( $value ); // URL decode
46
+ $value = Helper::is_json( $value ) ? json_decode( $value, true ) : $value; // JSON decode
47
+ }
48
+
49
+ return ! $value ? $default : $value;
50
+ }
51
+
52
+ /**
53
+ * Universal method to adding cookies
54
+ * Using Alternative Sessions or native cookies depends on settings
55
+ *
56
+ * @param $name
57
+ * @param string $value
58
+ * @param int $expires
59
+ * @param string $path
60
+ * @param null $domain
61
+ * @param bool $secure
62
+ * @param bool $httponly
63
+ * @param string $samesite
64
+ */
65
+ public static function set ($name, $value = '', $expires = 0, $path = '', $domain = '', $secure = null, $httponly = false, $samesite = 'Lax' ) {
66
 
67
+ global $apbct;
68
+
69
+ if( $apbct->settings['data__set_cookies'] == 0 ){
70
+ return;
71
+
72
+ }elseif( $apbct->settings['data__set_cookies'] == 1 ){
73
+ self::setNativeCookie( $name, $value, $expires, $path, $domain, $secure, $httponly, $samesite );
74
 
75
+ }elseif( $apbct->settings['data__set_cookies'] == 2 ){
76
+ AltSessions::set( $name, $value );
77
  }
78
+
79
+ }
80
+
81
+ /**
82
+ * Universal method to adding cookies
83
+ * Wrapper for setcookie() Conisdering PHP version
84
+ *
85
+ * @see https://www.php.net/manual/ru/function.setcookie.php
86
+ *
87
+ * @param string $name Cookie name
88
+ * @param string $value Cookie value
89
+ * @param int $expires Expiration timestamp. 0 - expiration with session
90
+ * @param string $path
91
+ * @param null $domain
92
+ * @param bool $secure
93
+ * @param bool $httponly
94
+ * @param string $samesite
95
+ *
96
+ * @return void
97
+ */
98
+ public static function setNativeCookie ($name, $value = '', $expires = 0, $path = '', $domain = '', $secure = null, $httponly = false, $samesite = 'Lax' ) {
99
 
100
+ // For PHP 7.3+ and above
101
+ if( version_compare( phpversion(), '7.3.0', '>=' ) ){
102
 
103
+ $secure = ! is_null( $secure ) ? $secure : Server::get('HTTPS') || Server::get('SERVER_PORT') == 443;
104
+
105
+ $params = array(
106
+ 'expires' => $expires,
107
+ 'path' => $path,
108
+ 'domain' => $domain,
109
+ 'secure' => $secure,
110
+ 'httponly' => $httponly,
111
+ );
112
+
113
+ if($samesite)
114
+ $params['samesite'] = $samesite;
115
+
116
+ setcookie( $name, $value, $params );
117
+
118
+ // For PHP 5.6 - 7.2
119
+ }else {
120
+ setcookie( $name, $value, $expires, $path, $domain, $secure, $httponly );
121
+ }
122
+
123
  }
124
 
125
+
126
+
127
  }
lib/Cleantalk/Common/API.php CHANGED
@@ -666,24 +666,51 @@ class API
666
 
667
  return $result;
668
  }
669
-
670
- public static function method__private_list_add__sfw_wl( $user_token, $ip, $service_id, $do_check = true ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
671
 
672
  $request = array(
673
  'method_name' => 'private_list_add',
674
  'user_token' => $user_token,
675
  'service_id' => $service_id,
676
  'records' => $ip,
677
- 'service_type' => 'spamfirewall',
678
- 'product_id' => 1,
679
- 'record_type' => 6,
680
- 'note' => 'Website admin IP. Added automatically.',
681
- 'status' => 'allow',
682
- 'expired' => date( 'Y-m-d H:i:s', time() + 86400 * 30 ),
683
  );
684
 
685
  $result = static::send_request( $request );
686
- $result = $do_check ? static::check_response($result) : $result;
687
 
688
  return $result;
689
 
@@ -875,6 +902,12 @@ class API
875
  : array('error' => 'NO_DATA');
876
  break;
877
 
 
 
 
 
 
 
878
  default:
879
  return isset($result['data']) && is_array($result['data'])
880
  ? $result['data']
666
 
667
  return $result;
668
  }
669
+
670
+ /**
671
+ *
672
+ *
673
+ * @param string $user_token
674
+ * @param string $service_id
675
+ * @param string $ip
676
+ * @param string $service_type
677
+ * @param int $product_id
678
+ * @param int $record_type
679
+ * @param string $note Description text
680
+ * @param string $status allow|deny
681
+ * @param string $expired Date Y-m-d H:i:s
682
+ * @param bool $do_check
683
+ *
684
+ * @return array|bool|bool[]|mixed|string[]
685
+ */
686
+ public static function method__private_list_add(
687
+ $user_token,
688
+ $service_id,
689
+ $ip,
690
+ $service_type,
691
+ $product_id,
692
+ $record_type,
693
+ $note,
694
+ $status,
695
+ $expired,
696
+ $do_check = true
697
+ ) {
698
 
699
  $request = array(
700
  'method_name' => 'private_list_add',
701
  'user_token' => $user_token,
702
  'service_id' => $service_id,
703
  'records' => $ip,
704
+ 'service_type' => $service_type,
705
+ 'product_id' => $product_id,
706
+ 'record_type' => $record_type,
707
+ 'note' => $note,
708
+ 'status' => $status,
709
+ 'expired' => $expired,
710
  );
711
 
712
  $result = static::send_request( $request );
713
+ $result = $do_check ? static::check_response( $result, 'private_list_add') : $result;
714
 
715
  return $result;
716
 
902
  : array('error' => 'NO_DATA');
903
  break;
904
 
905
+ case 'private_list_add':
906
+ return isset( $res['records'][0]['operation_status'] ) && $res['records'][0]['operation_status'] === 'SUCCESS'
907
+ ? true
908
+ : array( 'error' => 'COULDNT_ADD_WL_IP');
909
+ break;
910
+
911
  default:
912
  return isset($result['data']) && is_array($result['data'])
913
  ? $result['data']
lib/Cleantalk/Common/DB.php CHANGED
@@ -108,4 +108,15 @@ class DB
108
  * @return array|object|null
109
  */
110
  public function fetch_all($query = false, $response_type = false){ }
 
 
 
 
 
 
 
 
 
 
 
111
  }
108
  * @return array|object|null
109
  */
110
  public function fetch_all($query = false, $response_type = false){ }
111
+
112
+ /**
113
+ * Checks if the table exists
114
+ *
115
+ * @param $table_name
116
+ *
117
+ * @return bool
118
+ */
119
+ public function isTableExists( $table_name ){
120
+ return (bool) $this->execute( 'SHOW TABLES LIKE "' . $table_name . '"' );
121
+ }
122
  }
lib/Cleantalk/Common/Firewall.php CHANGED
@@ -218,7 +218,7 @@ class Firewall
218
  ) {
219
  if( ! headers_sent() ) {
220
  $cookie_val = md5( $fw_result['ip'] . $apbct->api_key );
221
- \Cleantalk\Common\Helper::apbct_cookie__set( 'ct_sfw_ip_wl', $cookie_val, time() + 86400 * 30, '/', null, false, true, 'Lax' );
222
  }
223
  return true;
224
  }
218
  ) {
219
  if( ! headers_sent() ) {
220
  $cookie_val = md5( $fw_result['ip'] . $apbct->api_key );
221
+ \Cleantalk\ApbctWP\Variables\Cookie::set( 'ct_sfw_ip_wl', $cookie_val, time() + 86400 * 30, '/', null, null, true, 'Lax' );
222
  }
223
  return true;
224
  }
lib/Cleantalk/Common/Helper.php CHANGED
@@ -299,7 +299,7 @@ class Helper
299
  *
300
  * @return bool
301
  */
302
- static public function ip__mask_match($ip, $cidr, $ip_type = 'v4', $xtet_count = 0)
303
  {
304
 
305
  if(is_array($cidr)){
@@ -375,7 +375,7 @@ class Helper
375
  *
376
  * @return string|bool
377
  */
378
- static public function ip__validate($ip)
379
  {
380
  if(!$ip) return false; // NULL || FALSE || '' || so on...
381
  if(filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) && $ip != '0.0.0.0') return 'v4'; // IPv4
@@ -402,7 +402,7 @@ class Helper
402
  *
403
  * @return string IPv6
404
  */
405
- static public function ip__v6_normalize($ip)
406
  {
407
  $ip = trim($ip);
408
  // Searching for ::ffff:xx.xx.xx.xx patterns and turn it to IPv6
@@ -430,7 +430,7 @@ class Helper
430
  *
431
  * @return string IPv6
432
  */
433
- static public function ip__v6_reduce($ip)
434
  {
435
  if(strpos($ip, ':') !== false){
436
  $ip = preg_replace('/:0{1,4}/', ':', $ip);
@@ -447,7 +447,7 @@ class Helper
447
  *
448
  * @return false|int|string
449
  */
450
- static public function ip__is_cleantalks($ip)
451
  {
452
  if(self::ip__validate($ip)){
453
  $url = array_search($ip, self::$cleantalks_servers);
@@ -465,7 +465,7 @@ class Helper
465
  *
466
  * @return false|int|string
467
  */
468
- static public function ip__resolve__cleantalks($ip)
469
  {
470
  if(self::ip__validate($ip)){
471
  $url = array_search($ip, self::$cleantalks_servers);
@@ -501,7 +501,7 @@ class Helper
501
  *
502
  * @return bool
503
  */
504
- static public function dns__resolve($host, $out = false)
505
  {
506
 
507
  // Get DNS records about URL
@@ -540,7 +540,7 @@ class Helper
540
  *
541
  * @return array|bool (array || array('error' => true))
542
  */
543
- static public function http__request($url, $data = array(), $presets = null, $opts = array())
544
  {
545
  if(function_exists('curl_init')){
546
 
@@ -615,19 +615,20 @@ class Helper
615
  }
616
 
617
  }
618
- unset($preset);
619
 
620
  curl_setopt_array($ch, $opts);
621
  $result = curl_exec($ch);
622
 
623
  // RETURN if async request
624
- if(in_array('async', $presets))
625
- return true;
626
-
 
627
  if( $result && ! curl_error($ch) ){
628
-
629
- if(strpos($result, PHP_EOL) !== false && !in_array('dont_split_to_array', $presets))
630
- $result = explode(PHP_EOL, $result);
 
631
 
632
  // Get code crossPHP method
633
  if(in_array('get_code', $presets)){
@@ -644,8 +645,8 @@ class Helper
644
  /**
645
  * Getting HTTP-response code without cURL
646
  */
647
- if($presets && ($presets == 'get_code' || (is_array($presets) && in_array('get_code', $presets)))
648
- && isset($out['error']) && $out['error'] == 'CURL_NOT_INSTALLED'
649
  ){
650
  $headers = get_headers($url);
651
  $out = (int)preg_replace('/.*(\d{3}).*/', '$1', $headers[0]);
@@ -789,52 +790,10 @@ class Helper
789
  *
790
  * @return bool
791
  */
792
- static public function is_json($string)
793
- {
794
- return is_string($string) && is_array(json_decode($string, true)) ? true : false;
795
  }
796
-
797
- /**
798
- * Universal method to adding cookies
799
- * Wrapper for setcookie() Conisdering PHP version
800
- *
801
- * @see https://www.php.net/manual/ru/function.setcookie.php
802
- *
803
- * @param string $name Cookie name
804
- * @param string $value Cookie value
805
- * @param int $expires Expiration timestamp. 0 - expiration with session
806
- * @param string $path
807
- * @param null $domain
808
- * @param bool $secure
809
- * @param bool $httponly
810
- * @param string $samesite
811
- *
812
- * @return void
813
- */
814
- public static function apbct_cookie__set ($name, $value = '', $expires = 0, $path = '', $domain = null, $secure = false, $httponly = false, $samesite = 'Lax' ) {
815
-
816
- // For PHP 7.3+ and above
817
- if( version_compare( phpversion(), '7.3.0', '>=' ) ){
818
-
819
- $params = array(
820
- 'expires' => $expires,
821
- 'path' => $path,
822
- 'domain' => $domain,
823
- 'secure' => $secure,
824
- 'httponly' => $httponly,
825
- );
826
-
827
- if($samesite)
828
- $params['samesite'] = $samesite;
829
-
830
- setcookie( $name, $value, $params );
831
-
832
- // For PHP 5.6 - 7.2
833
- }else {
834
- setcookie( $name, $value, $expires, $path, $domain, $secure, $httponly );
835
- }
836
-
837
- }
838
 
839
  public static function time__get_interval_start( $interval = 300 ){
840
  return time() - ( ( time() - strtotime( date( 'd F Y' ) ) ) % $interval );
@@ -887,7 +846,7 @@ class Helper
887
  *
888
  * @return false|string
889
  */
890
- static public function buffer__csv__pop_line( &$csv ){
891
  $pos = strpos( $csv, "\n" );
892
  $line = substr( $csv, 0, $pos );
893
  $csv = substr_replace( $csv, '', 0, $pos + 1 );
@@ -902,7 +861,7 @@ class Helper
902
  *
903
  * @return array|false
904
  */
905
- static public function buffer__csv__get_map( &$csv ){
906
  $line = static::buffer__csv__pop_line( $csv );
907
  return explode( ',', $line );
908
  }
@@ -915,7 +874,7 @@ class Helper
915
  *
916
  * @return array|false
917
  */
918
- static public function buffer__csv__pop_line_to_array( &$csv, $map = array() ){
919
  $line = trim( static::buffer__csv__pop_line( $csv ) );
920
  $line = strpos( $line, '\'' ) === 0
921
  ? str_getcsv($line, ',', '\'')
299
  *
300
  * @return bool
301
  */
302
+ public static function ip__mask_match($ip, $cidr, $ip_type = 'v4', $xtet_count = 0)
303
  {
304
 
305
  if(is_array($cidr)){
375
  *
376
  * @return string|bool
377
  */
378
+ public static function ip__validate($ip)
379
  {
380
  if(!$ip) return false; // NULL || FALSE || '' || so on...
381
  if(filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) && $ip != '0.0.0.0') return 'v4'; // IPv4
402
  *
403
  * @return string IPv6
404
  */
405
+ public static function ip__v6_normalize($ip)
406
  {
407
  $ip = trim($ip);
408
  // Searching for ::ffff:xx.xx.xx.xx patterns and turn it to IPv6
430
  *
431
  * @return string IPv6
432
  */
433
+ public static function ip__v6_reduce($ip)
434
  {
435
  if(strpos($ip, ':') !== false){
436
  $ip = preg_replace('/:0{1,4}/', ':', $ip);
447
  *
448
  * @return false|int|string
449
  */
450
+ public static function ip__is_cleantalks($ip)
451
  {
452
  if(self::ip__validate($ip)){
453
  $url = array_search($ip, self::$cleantalks_servers);
465
  *
466
  * @return false|int|string
467
  */
468
+ public static function ip__resolve__cleantalks($ip)
469
  {
470
  if(self::ip__validate($ip)){
471
  $url = array_search($ip, self::$cleantalks_servers);
501
  *
502
  * @return bool
503
  */
504
+ public static function dns__resolve($host, $out = false)
505
  {
506
 
507
  // Get DNS records about URL
540
  *
541
  * @return array|bool (array || array('error' => true))
542
  */
543
+ public static function http__request($url, $data = array(), $presets = array(), $opts = array())
544
  {
545
  if(function_exists('curl_init')){
546
 
615
  }
616
 
617
  }
 
618
 
619
  curl_setopt_array($ch, $opts);
620
  $result = curl_exec($ch);
621
 
622
  // RETURN if async request
623
+ if( in_array( 'async', $presets, true ) ){
624
+ return true;
625
+ }
626
+
627
  if( $result && ! curl_error($ch) ){
628
+
629
+ if( strpos( $result, PHP_EOL ) !== false && ! in_array( 'dont_split_to_array', $presets ) ){
630
+ $result = explode( PHP_EOL, $result );
631
+ }
632
 
633
  // Get code crossPHP method
634
  if(in_array('get_code', $presets)){
645
  /**
646
  * Getting HTTP-response code without cURL
647
  */
648
+ if( in_array( 'get_code', $presets, true ) &&
649
+ isset( $out['error'] ) && $out['error'] == 'CURL_NOT_INSTALLED'
650
  ){
651
  $headers = get_headers($url);
652
  $out = (int)preg_replace('/.*(\d{3}).*/', '$1', $headers[0]);
790
  *
791
  * @return bool
792
  */
793
+ public static function is_json($string){
794
+
795
+ return is_string( $string ) && is_array( json_decode( $string, true ) );
796
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
797
 
798
  public static function time__get_interval_start( $interval = 300 ){
799
  return time() - ( ( time() - strtotime( date( 'd F Y' ) ) ) % $interval );
846
  *
847
  * @return false|string
848
  */
849
+ public static function buffer__csv__pop_line( &$csv ){
850
  $pos = strpos( $csv, "\n" );
851
  $line = substr( $csv, 0, $pos );
852
  $csv = substr_replace( $csv, '', 0, $pos + 1 );
861
  *
862
  * @return array|false
863
  */
864
+ public static function buffer__csv__get_map( &$csv ){
865
  $line = static::buffer__csv__pop_line( $csv );
866
  return explode( ',', $line );
867
  }
874
  *
875
  * @return array|false
876
  */
877
+ public static function buffer__csv__pop_line_to_array( &$csv, $map = array() ){
878
  $line = trim( static::buffer__csv__pop_line( $csv ) );
879
  $line = strpos( $line, '\'' ) === 0
880
  ? str_getcsv($line, ',', '\'')
lib/Cleantalk/Common/Schema.php CHANGED
@@ -4,8 +4,10 @@ namespace Cleantalk\Common;
4
 
5
  class Schema
6
  {
7
- /*
8
- * Array of schemas
 
 
9
  */
10
  private static $schemas = array(
11
  'sfw' => 'CREATE TABLE IF NOT EXISTS `%scleantalk_sfw` (
4
 
5
  class Schema
6
  {
7
+ /**
8
+ * Set of schemas in array
9
+ *
10
+ * @var array
11
  */
12
  private static $schemas = array(
13
  'sfw' => 'CREATE TABLE IF NOT EXISTS `%scleantalk_sfw` (
lib/Cleantalk/Variables/Cookie.php CHANGED
@@ -49,4 +49,50 @@ class Cookie extends ServerVariables{
49
 
50
  return $value;
51
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  }
49
 
50
  return $value;
51
  }
52
+
53
+ /**
54
+ * Universal method to adding cookies
55
+ * Wrapper for setcookie() Conisdering PHP version
56
+ *
57
+ * @see https://www.php.net/manual/ru/function.setcookie.php
58
+ *
59
+ * @param string $name Cookie name
60
+ * @param string $value Cookie value
61
+ * @param int $expires Expiration timestamp. 0 - expiration with session
62
+ * @param string $path
63
+ * @param null $domain
64
+ * @param bool $secure
65
+ * @param bool $httponly
66
+ * @param string $samesite
67
+ *
68
+ * @return void
69
+ */
70
+ public static function set ( $name, $value = '', $expires = 0, $path = '', $domain = null, $secure = null, $httponly = false, $samesite = 'Lax' ) {
71
+
72
+ $secure = ! is_null( $secure ) ? $secure : Server::get('HTTPS') !== 'off' || Server::get('SERVER_PORT') == 443;
73
+
74
+ // For PHP 7.3+ and above
75
+ if( version_compare( phpversion(), '7.3.0', '>=' ) ){
76
+
77
+ $params = array(
78
+ 'expires' => $expires,
79
+ 'path' => $path,
80
+ 'domain' => $domain,
81
+ 'secure' => $secure,
82
+ 'httponly' => $httponly,
83
+ );
84
+
85
+ if($samesite)
86
+ $params['samesite'] = $samesite;
87
+
88
+ setcookie( $name, $value, $params );
89
+
90
+ // For PHP 5.6 - 7.2
91
+ }else {
92
+ setcookie( $name, $value, $expires, $path, $domain, $secure, $httponly );
93
+ }
94
+
95
+ }
96
+
97
+
98
  }
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Spam protection, AntiSpam, FireWall by CleanTalk ===
2
- Contributors: safronik
3
  Tags: spam, antispam, anti-spam, comments, firewall
4
  Requires at least: 3.0
5
  Tested up to: 5.7
6
  Requires PHP: 5.4
7
- Stable tag: 5.156
8
  License: GPLv2
9
 
10
  Spam protection, anti-spam, firewall, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
@@ -160,7 +160,7 @@ All the CleanTalk Spam FireWall activity is being logged in the process of filte
160
  Spam FireWall can mitigate HTTP/HTTPS DDoS attacks. When an intruder makes GET requests to attack your website, Spam FireWall blocks all requests from bad IP addresses. Your website gives the intruder a special page with the description of DDoS rejection instead of the website pages. Therefore Spam FireWall helps to reduce CPU usage of your server.
161
  [youtube https://www.youtube.com/watch?v=Eu5Zqryvj4k]
162
 
163
- = Spam FireWall: Anti-Flood & Anti-Crawler =
164
  Spam FireWall: Anti-Flood and Anti-Crawler options are intended for blocking unwanted bots, content parsing, shop goods prices parsing or aggressive website scanning bots. Learn more https://cleantalk.org/help/anti-flood-and-anti-crawler
165
 
166
  = XML-RPC brute force protection =
@@ -580,6 +580,73 @@ If your website has forms that send data to external sources, you can enable opt
580
 
581
  == Changelog ==
582
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
583
  = 5.156 Apr 15 2021 =
584
  * New: ApbctWP\RemoteCalls::action__debug().
585
  * New: ApbctWP\Helper::http__get_data_from_remote_gz__and_parse_csv();
1
  === Spam protection, AntiSpam, FireWall by CleanTalk ===
2
+ Contributors: safronik
3
  Tags: spam, antispam, anti-spam, comments, firewall
4
  Requires at least: 3.0
5
  Tested up to: 5.7
6
  Requires PHP: 5.4
7
+ Stable tag: 5.157
8
  License: GPLv2
9
 
10
  Spam protection, anti-spam, firewall, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
160
  Spam FireWall can mitigate HTTP/HTTPS DDoS attacks. When an intruder makes GET requests to attack your website, Spam FireWall blocks all requests from bad IP addresses. Your website gives the intruder a special page with the description of DDoS rejection instead of the website pages. Therefore Spam FireWall helps to reduce CPU usage of your server.
161
  [youtube https://www.youtube.com/watch?v=Eu5Zqryvj4k]
162
 
163
+ = Spam FireWall: Anti-Flood & Anti-Crawler =
164
  Spam FireWall: Anti-Flood and Anti-Crawler options are intended for blocking unwanted bots, content parsing, shop goods prices parsing or aggressive website scanning bots. Learn more https://cleantalk.org/help/anti-flood-and-anti-crawler
165
 
166
  = XML-RPC brute force protection =
580
 
581
  == Changelog ==
582
 
583
+ = 5.157 Apr 28 2021 =
584
+ * New: Invisible fields collecting implemented.
585
+ * New: A dev and a fix version suffix support.
586
+ * New: Variables. Cookie::set() method added.
587
+ * New: Split Cleantalk\Common\DB::method__private_list_add__sfw_wl() in two Cleantalk\Common\DB::method__private_list_add() and Cleantalk\ApbctWP\DB::method__private_list_add__sfw_wl().
588
+ * New: Split Cleantalk\ApbctWP\Helper::http__request__rc_to_host() in two Cleantalk\ApbctWP\Helper::http__request__rc_to_host() and Cleantalk\ApbctWP\Helper::http__request__rc_to_host__test().
589
+ * New: Updater script for 5.157.
590
+ * New: Update/delete SpamFireWall database when it enable/disable. Improvements.
591
+ * New: \Cleantalk\ApbctWP\Variables::AltSessions class.
592
+ * New: "Set cookies" setting now has 3 options "On", "Off" and "Use alternative mechanism for cookies".
593
+ * New: REST API route '/alt_sessions' and callbacks.
594
+ * Mod: Compatibility with Thrive Leads - remove deleted the modal window about successful sending when blocking the user.
595
+ * Mod: changed the handling of gravityform fields, added a check for the visibility of the field when processing the name.
596
+ * Mod: Added a setting for Woocommerce, which includes checking the un-logged user when adding an item to the cart. If the user does not pass the verification, the product is not added to the cart.
597
+ * Mod: Added a settings for Woocommerce - correction.
598
+ * Mod: WC add to cart - change settings description.
599
+ * Mod: Cleantalk\ApbctWP\RemoteCalls::debug() improved.
600
+ * Mod: SpaFirewall update.
601
+ * Mod: add buddypress integration for user account personal data.
602
+ * Mod: Moving \Cleantalk\Common\Helper::apbct_cookie__set() to \Cleantalk\ApbctWP\Variables::set() function.
603
+ * Mod: Using \Cleantalk\ApbctWP\Variables::set() instead of \Cleantalk\Common\Helper::apbct_cookie__set().
604
+ * Mod: Extend \Cleantalk\ApbctWP\Variables to use alternative sessions.
605
+ * Mod: Using \Cleantalk\ApbctWP\Variables\AltSessions class instead of set of "apbct_alt_sessions__" functions.
606
+ * Mod: added loading of country flags from the plugin.
607
+ * Mod: added styles for the widget with anti-spam statistics.
608
+ * Mod: Improving ct_enqueue_scripts_public().
609
+ * Mod: Update for JS ctSetCookie().
610
+ * Mod: AltSessions and Cookie using 'data__set_cookies' and 'data__set_cookies' settings.
611
+ * Mod: Minified JS updated.
612
+ * Upd: Setting cookies updating.
613
+ * Upd: Setting cookies by JS updating.
614
+ * Fix: SFW. DB result handling.
615
+ * Fix: Integration. Avada theme settings saving fixed.
616
+ * Fix: Cleantalk modal. Layout fixed.
617
+ * Fix: Possible use an html on ajax forms blocking message.
618
+ * Fix: Include JS logic fixed.
619
+ * Fix: Refactoring. Collecting details about browser refactored.
620
+ * Fix: Refactoring. Alert replacing by console log on REST request handling.
621
+ * Fix: Integration. Gravity Forms integration fixed.
622
+ * Fix: ignoring the hidden fields with name if visible fields exists.
623
+ * Fix: Integration. Formidable multi-step form protection fixed.
624
+ * Fix: add max z-index for #cleantalk-modal-overlay.
625
+ * Fix: Cannot read property 'response_type' of undefined - xhr.responseJSON - undefined where action wc_add_to_cart_block.
626
+ * Fix: Helper. Set cookies method is deprecated now.
627
+ * Fix: Adding admin IP to whitelist during the login in and plugin activation.
628
+ * Fix: SpamFirewall. Don't set cookies if option is disabled.
629
+ * Fix: Sorting methods modifiers in \Cleantalk\Common\Helper and \Cleantalk\ApbctWP\Helper classes.
630
+ * Fix: Using \Cleantalk\ApbctWP\Variables\Cookies.
631
+ * Fix: A dev and a fix version suffix support.
632
+ * Fix: Adding admin IP to whitelist during the login in and plugin activation.
633
+ * Fix: New setting 'Alternative cookies handler type'.
634
+ * Fix: sender_info params.
635
+ * Fix: SpamFirewall deleting 127.0.0.1 from local base during update on local website.
636
+ * Fix: apbct_js_test() considering "Alternative cookie" setting.
637
+ * Fix: Cleantalk\ApbctWP\VariablesCookie::set() automatically set secure flag if null passed.
638
+ * Fix: Check JS via Cookie with the Alternative Cookie on.
639
+ * Fix: Automatically set "secure" param when setcookie() called.
640
+ * Fix: 'Alternative cookies handler type' setting layout.
641
+ * Fix: For legacy apbct__hook__wp_logout__delete_trial_notice_cookie().
642
+ * Fix: Cleantalk\ApbctWP\Variables::set_fromRemote(), Cleantalk\ApbctWP\Variables::get_fromRemote() fix parameter type.
643
+ * Fix: SpamFirewall add admin IP when login in or activate plugin.
644
+ * Fix: Dashboard widget. Showing default Cleantalk's flag if country not found.
645
+ * Fix: Dashboard widget. Showing 'Unknown' country name if country not found.
646
+ * Del: Unused apbct_cookie__set() function.
647
+ * Del: "Use alternative mechanism for cookies" setting.
648
+ * Del: "Use cookies less sessions" setting.
649
+
650
  = 5.156 Apr 15 2021 =
651
  * New: ApbctWP\RemoteCalls::action__debug().
652
  * New: ApbctWP\Helper::http__get_data_from_remote_gz__and_parse_csv();