Spam protection, AntiSpam, FireWall by CleanTalk - Version 5.145

Version Description

Aug 27 2020 = * Fix: Blocking pages names fixed. * Fix: Logs id modified to prevent the overwriting. * Fix: FireWall checking flow fixed. * Mod: New SpamFirewall, Anti-Crawler, Anti-Flood modules priority. * Upd: Block message updated. * Fix: "The sender has been blacklisted" message removed. * Fix: "The sender has been whitelisted" message removed. * Fix: Integration DW Question & Answer plugin. * Fix: Dashboard widget layout fixed. * Fix: AC & AD skipping checking by roles. * Integration: Estimation Form integration implemented. * Fix: External contact forms check. * Fix: URL, IP and Role exclusions for all requests. * Fix: Exception for WooCommerce adding to cart. * Fix: Exception for PPOM for WooCommerce plugin.

Download this release

Release Info

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

Code changes from version 5.144 to 5.145

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.144
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: https://cleantalk.org
9
  Text Domain: cleantalk-spam-protect
@@ -177,7 +177,8 @@ if( !defined( 'CLEANTALK_PLUGIN_DIR' ) ){
177
  'ContactBank' => array( 'hook' => 'contact_bank_frontend_ajax_call', 'ajax' => true ),
178
  'FluentForm' => array( 'hook' => 'fluentform_before_insert_submission', 'ajax' => false ),
179
  'ElfsightContactForm' => array( 'hook' => 'elfsight_contact_form_mail', 'ajax' => true ),
180
- 'SimpleMembership' => array( 'hook' => 'swpm_front_end_registration_complete_user_data', 'ajax' => false )
 
181
  );
182
  new \Cleantalk\Antispam\Integrations( $apbct_active_integrations );
183
 
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.145
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: https://cleantalk.org
9
  Text Domain: cleantalk-spam-protect
177
  'ContactBank' => array( 'hook' => 'contact_bank_frontend_ajax_call', 'ajax' => true ),
178
  'FluentForm' => array( 'hook' => 'fluentform_before_insert_submission', 'ajax' => false ),
179
  'ElfsightContactForm' => array( 'hook' => 'elfsight_contact_form_mail', 'ajax' => true ),
180
+ 'SimpleMembership' => array( 'hook' => 'swpm_front_end_registration_complete_user_data', 'ajax' => false ),
181
+ 'EstimationForm' => array( 'hook' => 'send_email', 'ajax' => true ),
182
  );
183
  new \Cleantalk\Antispam\Integrations( $apbct_active_integrations );
184
 
css/cleantalk-dashboard-widget.min.css CHANGED
@@ -1 +1 @@
1
- .ct_widget_top_links{position:absolute;top:8px;right:33px}.ct_widget_settings_link{margin:0 0 0 10px}.ct_preloader{display:none;float:left;width:20px;height:20px;margin:0 10px}.ct_widget_wrapper{display:block;position:relative;width:100%;height:100%}.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}
css/fonts/icons/icons.svg CHANGED
@@ -1,240 +1,240 @@
1
- <?xml version="1.0" standalone="no"?>
2
- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
- <svg xmlns="http://www.w3.org/2000/svg">
4
- <metadata>Copyright (C) 2019 by original authors @ fontello.com</metadata>
5
- <defs>
6
- <font id="fontello" horiz-adv-x="1000" >
7
- <font-face font-family="fontello" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
8
- <missing-glyph horiz-adv-x="1000" />
9
- <glyph glyph-name="download" unicode="&#xe800;" d="M714 590q15-15 15-37t-15-36l-245-244-245 244q-15 15-15 36t15 37 36 15q23 0 38-15l118-120 0 349q0 21 16 37t37 16 37-16 15-37l0-349 119 120q14 14 38 14 22 0 36-14z m222-448l2-261q0-21-16-36t-37-16l-832 0q-22 0-37 16t-16 36q0 261 1 261 0 11 2 16l105 312q12 37 48 37l12 0q8-18 18-28l78-76-70 0-86-261 722 0-86 261-70 0 77 76q10 10 19 28l11 0q37 0 49-37l105-312q1-5 1-16z" horiz-adv-x="938" />
10
-
11
- <glyph glyph-name="glass" unicode="&#xe801;" d="M948 746q0-19-24-43l-353-353v-429h179q15 0 25-10t11-25-11-25-25-11h-500q-14 0-25 11t-11 25 11 25 25 10h179v429l-353 353q-24 24-24 43 0 13 10 21t21 9 24 3h786q13 0 24-3t21-9 10-21z" horiz-adv-x="1000" />
12
-
13
- <glyph glyph-name="emo-happy" unicode="&#xe802;" d="M261 800c-60 0-109-65-109-144 0-80 49-145 109-145s110 65 110 145c0 79-49 144-110 144z m477 0c-61 0-110-65-110-144 0-80 49-145 110-145 60 0 110 65 110 145 0 79-50 144-110 144z m208-599c-13 0-27-5-37-16-4-4-8-8-12-12-111-109-253-164-396-165-142-2-285 50-396 155l-3 3-12 12c-21 21-54 20-75-1-20-21-20-55 1-76 3-4 8-8 14-14l3-3c132-124 301-186 469-184 169 1 337 67 468 195 5 5 9 10 14 14 20 22 20 56-1 77-10 10-23 15-37 15z" horiz-adv-x="999" />
14
-
15
- <glyph glyph-name="search" unicode="&#xe803;" d="M643 386q0 103-73 176t-177 74-177-74-73-176 73-177 177-73 177 73 73 177z m286-465q0-29-22-50t-50-21q-30 0-50 21l-191 191q-100-69-223-69-80 0-153 31t-125 84-84 125-31 153 31 152 84 126 125 84 153 31 153-31 125-84 84-126 31-152q0-123-69-223l191-191q21-21 21-51z" horiz-adv-x="928.6" />
16
-
17
- <glyph glyph-name="emo-unhappy" unicode="&#xe804;" d="M261 800c-60 0-109-65-109-144 0-80 49-145 109-145s110 65 110 145c0 79-49 144-110 144z m477 0c-61 0-110-65-110-144 0-80 49-145 110-145 60 0 110 65 110 145 0 79-50 144-110 144z m-244-599c-165 0-331-62-461-184l-3-3c-6-5-11-10-14-14-21-21-21-55-1-76 21-21 54-21 75-1l12 12 3 3c111 105 254 157 396 155 143-1 285-56 396-165 4-4 8-8 12-12 20-21 54-21 74-1 21 21 21 55 1 77-5 5-9 10-14 14-131 129-299 194-468 195-3 0-6 0-8 0z" horiz-adv-x="999" />
18
-
19
- <glyph glyph-name="mail" unicode="&#xe805;" d="M929 11v428q-18-20-39-36-149-115-238-189-28-24-46-37t-48-28-57-13h-2q-26 0-57 13t-48 28-46 37q-88 74-238 189-21 16-39 36v-428q0-7 6-13t12-5h822q7 0 12 5t6 13z m0 586v14t-1 7-1 7-3 5-5 4-8 2h-822q-7 0-12-6t-6-12q0-94 83-159 107-84 223-176 4-3 20-17t25-21 25-17 28-16 24-5h2q11 0 24 5t28 16 25 17 25 21 20 17q116 92 224 176 30 24 56 65t26 73z m71 21v-607q0-37-26-63t-63-27h-822q-36 0-63 27t-26 63v607q0 37 26 63t63 26h822q37 0 63-26t26-63z" horiz-adv-x="1000" />
20
-
21
- <glyph glyph-name="info-circled" unicode="&#xe806;" d="M571 82v89q0 8-5 13t-12 5h-54v286q0 8-5 13t-13 5h-178q-8 0-13-5t-5-13v-89q0-8 5-13t13-5h53v-179h-53q-8 0-13-5t-5-13v-89q0-8 5-13t13-5h250q7 0 12 5t5 13z m-71 500v89q0 8-5 13t-13 5h-107q-8 0-13-5t-5-13v-89q0-8 5-13t13-5h107q8 0 13 5t5 13z m357-232q0-117-57-215t-156-156-215-58-216 58-155 156-58 215 58 215 155 156 216 58 215-58 156-156 57-215z" horiz-adv-x="857.1" />
22
-
23
- <glyph glyph-name="help-circled" unicode="&#xe807;" d="M500 82v107q0 8-5 13t-13 5h-107q-8 0-13-5t-5-13v-107q0-8 5-13t13-5h107q8 0 13 5t5 13z m143 375q0 49-31 91t-77 65-95 23q-136 0-207-119-9-13 4-24l74-55q4-4 10-4 9 0 14 7 30 38 48 51 19 14 48 14 27 0 48-15t21-33q0-21-11-34t-38-25q-35-15-65-48t-29-70v-20q0-8 5-13t13-5h107q8 0 13 5t5 13q0 10 12 27t30 28q18 10 28 16t25 19 25 27 16 34 7 45z m214-107q0-117-57-215t-156-156-215-58-216 58-155 156-58 215 58 215 155 156 216 58 215-58 156-156 57-215z" horiz-adv-x="857.1" />
24
-
25
- <glyph glyph-name="heart" unicode="&#xe808;" d="M500-79q-14 0-25 10l-348 336q-5 5-15 15t-31 37-38 54-30 67-13 77q0 123 71 192t196 70q34 0 70-12t67-33 54-38 42-38q20 20 42 38t54 38 67 33 70 12q125 0 196-70t71-192q0-123-128-251l-347-335q-10-10-25-10z" horiz-adv-x="1000" />
26
-
27
- <glyph glyph-name="heart-empty" unicode="&#xe809;" d="M929 517q0 46-12 80t-31 55-46 33-52 18-55 4-62-14-62-36-48-40-34-34q-10-13-27-13t-27 13q-14 15-34 34t-48 40-62 36-62 14-55-4-52-18-46-33-31-55-12-80q0-93 105-198l324-312 324 312q105 105 105 198z m71 0q0-123-128-251l-347-335q-10-10-25-10t-25 10l-348 336q-5 5-15 15t-31 37-38 54-30 67-13 77q0 123 71 192t196 70q34 0 70-12t67-33 54-38 42-38q20 20 42 38t54 38 67 33 70 12q125 0 196-70t71-192z" horiz-adv-x="1000" />
28
-
29
- <glyph glyph-name="star" unicode="&#xe80a;" d="M929 489q0-12-15-27l-202-197 48-279q0-4 0-12 0-11-6-19t-17-9q-10 0-22 7l-251 132-250-132q-12-7-23-7-11 0-17 9t-6 19q0 4 1 12l48 279-203 197q-14 15-14 27 0 21 31 26l280 40 126 254q11 23 27 23t28-23l125-254 280-40q32-5 32-26z" horiz-adv-x="928.6" />
30
-
31
- <glyph glyph-name="star-empty" unicode="&#xe80b;" d="M635 290l170 166-235 34-106 213-105-213-236-34 171-166-41-235 211 111 211-111z m294 199q0-12-15-27l-202-197 48-279q0-4 0-12 0-28-23-28-10 0-22 7l-251 132-250-132q-12-7-23-7-11 0-17 9t-6 19q0 4 1 12l48 279-203 197q-14 15-14 27 0 21 31 26l280 40 126 254q11 23 27 23t28-23l125-254 280-40q32-5 32-26z" horiz-adv-x="928.6" />
32
-
33
- <glyph glyph-name="user" unicode="&#xe80c;" d="M714 69q0-60-35-104t-84-44h-476q-49 0-84 44t-35 104q0 48 5 90t17 85 33 73 52 50 76 19q73-72 174-72t175 72q42 0 75-19t52-50 33-73 18-85 4-90z m-143 495q0-88-62-151t-152-63-151 63-63 151 63 152 151 63 152-63 62-152z" horiz-adv-x="714.3" />
34
-
35
- <glyph glyph-name="users" unicode="&#xe80d;" d="M331 350q-90-3-148-71h-75q-45 0-77 22t-31 66q0 197 69 197 4 0 25-11t54-24 66-12q38 0 75 13-3-21-3-37 0-78 45-143z m598-356q0-66-41-105t-108-39h-488q-68 0-108 39t-41 105q0 30 2 58t8 61 14 61 24 54 35 45 48 30 62 11q6 0 24-12t41-26 59-27 76-12 75 12 60 27 41 26 24 12q34 0 62-11t47-30 35-45 24-54 15-61 8-61 2-58z m-572 713q0-59-42-101t-101-42-101 42-42 101 42 101 101 42 101-42 42-101z m393-214q0-89-63-152t-151-62-152 62-63 152 63 151 152 63 151-63 63-151z m321-126q0-43-31-66t-77-22h-75q-57 68-147 71 45 65 45 143 0 16-3 37 37-13 74-13 33 0 67 12t54 24 24 11q69 0 69-197z m-71 340q0-59-42-101t-101-42-101 42-42 101 42 101 101 42 101-42 42-101z" horiz-adv-x="1071.4" />
36
-
37
- <glyph glyph-name="th-large" unicode="&#xe80e;" d="M429 279v-215q0-29-22-50t-50-21h-286q-29 0-50 21t-21 50v215q0 29 21 50t50 21h286q29 0 50-21t22-50z m0 428v-214q0-29-22-50t-50-22h-286q-29 0-50 22t-21 50v214q0 29 21 50t50 22h286q29 0 50-22t22-50z m500-428v-215q0-29-22-50t-50-21h-286q-29 0-50 21t-21 50v215q0 29 21 50t50 21h286q29 0 50-21t22-50z m0 428v-214q0-29-22-50t-50-22h-286q-29 0-50 22t-21 50v214q0 29 21 50t50 22h286q29 0 50-22t22-50z" horiz-adv-x="928.6" />
38
-
39
- <glyph glyph-name="th" unicode="&#xe80f;" d="M286 154v-108q0-22-16-37t-38-16h-178q-23 0-38 16t-16 37v108q0 22 16 38t38 15h178q23 0 38-15t16-38z m0 285v-107q0-22-16-38t-38-15h-178q-23 0-38 15t-16 38v107q0 23 16 38t38 16h178q23 0 38-16t16-38z m357-285v-108q0-22-16-37t-38-16h-178q-23 0-38 16t-16 37v108q0 22 16 38t38 15h178q23 0 38-15t16-38z m-357 571v-107q0-22-16-38t-38-16h-178q-23 0-38 16t-16 38v107q0 22 16 38t38 16h178q23 0 38-16t16-38z m357-286v-107q0-22-16-38t-38-15h-178q-23 0-38 15t-16 38v107q0 23 16 38t38 16h178q23 0 38-16t16-38z m357-285v-108q0-22-16-37t-38-16h-178q-22 0-38 16t-16 37v108q0 22 16 38t38 15h178q23 0 38-15t16-38z m-357 571v-107q0-22-16-38t-38-16h-178q-23 0-38 16t-16 38v107q0 22 16 38t38 16h178q23 0 38-16t16-38z m357-286v-107q0-22-16-38t-38-15h-178q-22 0-38 15t-16 38v107q0 23 16 38t38 16h178q23 0 38-16t16-38z m0 286v-107q0-22-16-38t-38-16h-178q-22 0-38 16t-16 38v107q0 22 16 38t38 16h178q23 0 38-16t16-38z" horiz-adv-x="1000" />
40
-
41
- <glyph glyph-name="th-list" unicode="&#xe810;" d="M286 154v-108q0-22-16-37t-38-16h-178q-23 0-38 16t-16 37v108q0 22 16 38t38 15h178q23 0 38-15t16-38z m0 285v-107q0-22-16-38t-38-15h-178q-23 0-38 15t-16 38v107q0 23 16 38t38 16h178q23 0 38-16t16-38z m714-285v-108q0-22-16-37t-38-16h-535q-23 0-38 16t-16 37v108q0 22 16 38t38 15h535q23 0 38-15t16-38z m-714 571v-107q0-22-16-38t-38-16h-178q-23 0-38 16t-16 38v107q0 22 16 38t38 16h178q23 0 38-16t16-38z m714-286v-107q0-22-16-38t-38-15h-535q-23 0-38 15t-16 38v107q0 23 16 38t38 16h535q23 0 38-16t16-38z m0 286v-107q0-22-16-38t-38-16h-535q-23 0-38 16t-16 38v107q0 22 16 38t38 16h535q23 0 38-16t16-38z" horiz-adv-x="1000" />
42
-
43
- <glyph glyph-name="to-end" unicode="&#xe811;" d="M25-71q-10-11-18-8t-7 18v822q0 14 7 18t18-8l396-396q5-5 8-10v378q0 14 10 25t25 11h72q14 0 25-11t10-25v-786q0-14-10-25t-25-11h-72q-14 0-25 11t-10 25v379q-3-6-8-11z" horiz-adv-x="571.4" />
44
-
45
- <glyph glyph-name="to-start" unicode="&#xe812;" d="M546 771q11 11 18 8t7-18v-822q0-14-7-18t-18 8l-396 396q-5 5-7 11v-379q0-14-11-25t-25-11h-71q-15 0-25 11t-11 25v786q0 14 11 25t25 11h71q15 0 25-11t11-25v-378q2 5 7 10z" horiz-adv-x="571.4" />
46
-
47
- <glyph glyph-name="fast-fw" unicode="&#xe813;" d="M25-71q-10-11-18-8t-7 18v822q0 14 7 18t18-8l396-396q5-5 8-10v396q0 14 7 18t18-8l396-396q11-10 11-25t-11-25l-396-396q-11-11-18-8t-7 18v397q-3-6-8-11z" horiz-adv-x="928.6" />
48
-
49
- <glyph glyph-name="fast-bw" unicode="&#xe814;" d="M904 771q10 11 17 8t8-18v-822q0-14-8-18t-17 8l-397 396q-5 5-7 11v-397q0-14-7-18t-18 8l-396 396q-11 11-11 25t11 25l396 396q11 11 18 8t7-18v-396q2 5 7 10z" horiz-adv-x="928.6" />
50
-
51
- <glyph glyph-name="off" unicode="&#xe815;" d="M857 350q0-87-34-166t-91-137-137-92-166-34-167 34-136 92-92 137-34 166q0 102 45 191t126 151q24 18 54 14t46-28q18-23 14-53t-28-47q-54-41-84-101t-30-127q0-58 23-111t61-91 91-61 111-23 110 23 92 61 61 91 22 111q0 68-30 127t-84 101q-23 18-28 47t14 53q17 24 47 28t53-14q81-61 126-151t45-191z m-357 429v-358q0-29-21-50t-50-21-51 21-21 50v358q0 29 21 50t51 21 50-21 21-50z" horiz-adv-x="857.1" />
52
-
53
- <glyph glyph-name="chart-bar" unicode="&#xe816;" d="M357 350v-286h-143v286h143z m214 286v-572h-142v572h142z m572-643v-72h-1143v858h71v-786h1072z m-357 500v-429h-143v429h143z m214 214v-643h-143v643h143z" horiz-adv-x="1142.9" />
54
-
55
- <glyph glyph-name="home" unicode="&#xe817;" d="M786 296v-267q0-15-11-25t-25-11h-214v214h-143v-214h-214q-15 0-25 11t-11 25v267q0 1 0 2t0 2l321 264 321-264q1-1 1-4z m124 39l-34-41q-5-5-12-6h-2q-7 0-12 3l-386 322-386-322q-7-4-13-3-7 1-12 6l-35 41q-4 6-3 13t6 12l401 334q18 15 42 15t43-15l136-113v108q0 8 5 13t13 5h107q8 0 13-5t5-13v-227l122-102q6-4 6-12t-4-13z" horiz-adv-x="928.6" />
56
-
57
- <glyph glyph-name="link-1" unicode="&#xe818;" d="M813 171q0 23-16 38l-116 116q-16 16-38 16-24 0-40-18 1-1 10-10t12-12 9-11 7-14 2-15q0-23-16-38t-38-16q-8 0-15 2t-14 7-11 9-12 12-10 10q-19-17-19-40 0-23 16-38l115-116q15-15 38-15 22 0 38 15l82 81q16 16 16 37z m-393 394q0 22-15 38l-115 115q-16 16-38 16-22 0-38-15l-82-82q-16-15-16-37 0-22 16-38l116-116q15-15 38-15 23 0 40 17-2 2-11 11t-12 12-8 10-7 14-2 16q0 22 15 38t38 15q9 0 16-2t14-7 11-8 12-12 10-11q18 17 18 41z m500-394q0-66-48-113l-82-81q-46-47-113-47-68 0-114 48l-115 115q-46 47-46 114 0 68 49 116l-49 49q-48-49-116-49-67 0-114 47l-116 116q-47 47-47 114t47 113l82 82q47 46 114 46 67 0 114-47l115-116q46-46 46-113 0-69-49-117l49-49q48 49 116 49 67 0 114-47l116-116q47-47 47-114z" horiz-adv-x="928.6" />
58
-
59
- <glyph glyph-name="lock-open" unicode="&#xe819;" d="M929 529v-143q0-15-11-25t-25-11h-36q-14 0-25 11t-11 25v143q0 59-41 101t-101 41-101-41-42-101v-108h53q23 0 38-15t16-38v-322q0-22-16-37t-38-16h-535q-23 0-38 16t-16 37v322q0 22 16 38t38 15h375v108q0 103 73 176t177 74 176-74 74-176z" horiz-adv-x="928.6" />
60
-
61
- <glyph glyph-name="eye" unicode="&#xe81a;" d="M929 314q-85 132-213 197 34-58 34-125 0-103-73-177t-177-73-177 73-73 177q0 67 34 125-128-65-213-197 75-114 187-182t242-68 243 68 186 182z m-402 215q0 11-8 19t-19 7q-70 0-120-50t-50-119q0-11 8-19t19-8 19 8 8 19q0 48 34 82t82 34q11 0 19 8t8 19z m473-215q0-19-11-38-78-129-210-206t-279-77-279 77-210 206q-11 19-11 38t11 39q78 128 210 205t279 78 279-78 210-205q11-20 11-39z" horiz-adv-x="1000" />
62
-
63
- <glyph glyph-name="eye-off" unicode="&#xe81b;" d="M310 105l43 79q-48 35-76 88t-27 114q0 67 34 125-128-65-213-197 94-144 239-209z m217 424q0 11-8 19t-19 7q-70 0-120-50t-50-119q0-11 8-19t19-8 19 8 8 19q0 48 34 82t82 34q11 0 19 8t8 19z m202 106q0-4 0-5-59-105-176-316t-176-316l-28-50q-5-9-15-9-7 0-75 39-9 6-9 16 0 7 25 49-80 36-147 96t-117 137q-11 17-11 38t11 39q86 131 212 207t277 76q50 0 100-10l31 54q5 9 15 9 3 0 10-3t18-9 18-10 18-10 10-7q9-5 9-15z m21-249q0-78-44-142t-117-91l157 280q4-25 4-47z m250-72q0-19-11-38-22-36-61-81-84-96-194-149t-234-53l41 74q119 10 219 76t169 171q-65 100-158 164l35 63q53-36 102-85t81-103q11-19 11-39z" horiz-adv-x="1000" />
64
-
65
- <glyph glyph-name="download-1" unicode="&#xe81c;" d="M714 100q0 15-10 25t-25 11-25-11-11-25 11-25 25-11 25 11 10 25z m143 0q0 15-10 25t-26 11-25-11-10-25 10-25 25-11 26 11 10 25z m72 125v-179q0-22-16-37t-38-16h-821q-23 0-38 16t-16 37v179q0 22 16 38t38 16h259l75-76q33-32 76-32t76 32l76 76h259q22 0 38-16t16-38z m-182 318q10-23-8-39l-250-250q-10-11-25-11t-25 11l-250 250q-17 16-8 39 10 21 33 21h143v250q0 15 11 25t25 11h143q14 0 25-11t10-25v-250h143q24 0 33-21z" horiz-adv-x="928.6" />
66
-
67
- <glyph glyph-name="chat" unicode="&#xe81d;" d="M786 421q0-77-53-143t-143-104-197-38q-48 0-98 9-70-49-155-72-21-5-48-9h-2q-6 0-12 5t-6 12q-1 1-1 3t1 4 1 3l1 3t2 3 2 3 3 3 2 2q3 3 13 14t15 16 12 17 14 21 11 25q-69 40-108 98t-40 125q0 78 53 144t143 104 197 38 197-38 143-104 53-144z m214-142q0-67-40-126t-108-98q5-14 11-25t14-21 13-16 14-17 13-14q0 0 2-2t3-3 2-3 2-3l1-3t1-3 1-4-1-3q-2-8-7-13t-12-4q-28 4-48 9-86 23-156 72-50-9-98-9-151 0-263 74 32-3 49-3 90 0 172 25t148 72q69 52 107 119t37 141q0 43-13 85 72-39 114-99t42-128z" horiz-adv-x="1000" />
68
-
69
- <glyph glyph-name="comment" unicode="&#xe81e;" d="M1000 350q0-97-67-179t-182-130-251-48q-39 0-81 4-110-97-257-135-27-8-63-12-10-1-17 5t-10 16v1q-2 2 0 6t1 6 2 5l4 5t4 5 4 5q4 5 17 19t20 22 17 22 18 28 15 33 15 42q-88 50-138 123t-51 157q0 73 40 139t106 114 160 76 194 28q136 0 251-48t182-130 67-179z" horiz-adv-x="1000" />
70
-
71
- <glyph glyph-name="doc" unicode="&#xe81f;" d="M819 638q16-16 27-42t11-50v-642q0-23-15-38t-38-16h-750q-23 0-38 16t-16 38v892q0 23 16 38t38 16h500q22 0 49-11t42-27z m-248 136v-210h210q-5 17-12 23l-175 175q-6 7-23 12z m215-853v572h-232q-23 0-38 16t-16 37v233h-429v-858h715z" horiz-adv-x="857.1" />
72
-
73
- <glyph glyph-name="lock" unicode="&#xe820;" d="M179 421h285v108q0 59-42 101t-101 41-101-41-41-101v-108z m464-53v-322q0-22-16-37t-38-16h-535q-23 0-38 16t-16 37v322q0 22 16 38t38 15h17v108q0 102 74 176t176 74 177-74 73-176v-108h18q23 0 38-15t16-38z" horiz-adv-x="642.9" />
74
-
75
- <glyph glyph-name="emo-wink2" unicode="&#xe821;" d="M664 800c-61 0-110-65-110-144 0-80 49-145 110-145 60 0 110 65 110 145 0 79-50 144-110 144z m-343-98l-267 0c-30 0-54-24-54-54 0-30 24-54 54-54l267 0c30 0 54 24 54 54 0 30-24 54-54 54z m-262-361c-6 0-13-1-19-3-27-10-41-41-31-68 46-127 136-228 249-289 22-12 45-22 69-31 58-21 120-33 184-33 57 0 113 9 166 27 10 3 20 7 30 11 11 4 22 8 31 12l0 1 0 0 0 0c26 12 38 44 25 71-13 26-44 37-70 25l0 0c-9-4-17-8-24-11-8-3-17-6-25-8-43-14-88-22-133-22-51 0-101 10-148 27-19 7-37 15-55 25-90 48-163 130-200 231-8 21-28 35-49 35z" horiz-adv-x="774" />
76
-
77
- <glyph glyph-name="plus" unicode="&#xe822;" d="M786 439v-107q0-22-16-38t-38-15h-232v-233q0-22-16-37t-38-16h-107q-22 0-38 16t-15 37v233h-232q-23 0-38 15t-16 38v107q0 23 16 38t38 16h232v232q0 22 15 38t38 16h107q23 0 38-16t16-38v-232h232q23 0 38-16t16-38z" horiz-adv-x="785.7" />
78
-
79
- <glyph glyph-name="upload" unicode="&#xe823;" d="M936 128l2-260q0-21-16-37t-37-15l-832 0q-22 0-37 15t-16 37q0 260 1 260 0 12 2 17l105 312q12 36 48 36l209 0 0-103-171 0-86-262 722 0-86 262-171 0 0 103 208 0q37 0 49-36l105-312q1-5 1-17z m-258 423q-24 0-38 14l-119 120 0-348q0-21-15-37t-37-15-37 15-16 37l0 348-118-120q-14-14-38-14-22 0-36 14-15 15-15 36t15 37l245 247 245-247q15-15 15-37t-15-36q-14-14-36-14z" horiz-adv-x="938" />
80
-
81
- <glyph glyph-name="picture" unicode="&#xe824;" d="M357 529q0-45-31-76t-76-32-76 32-31 76 31 76 76 31 76-31 31-76z m572-215v-250h-786v107l178 179 90-89 285 285z m53 393h-893q-7 0-12-5t-6-13v-678q0-7 6-13t12-5h893q7 0 13 5t5 13v678q0 8-5 13t-13 5z m89-18v-678q0-37-26-63t-63-27h-893q-36 0-63 27t-26 63v678q0 37 26 63t63 27h893q37 0 63-27t26-63z" horiz-adv-x="1071.4" />
82
-
83
- <glyph glyph-name="ok" unicode="&#xe825;" d="M933 534q0-22-16-38l-404-404-76-76q-16-15-38-15t-38 15l-76 76-202 202q-15 16-15 38t15 38l76 76q16 16 38 16t38-16l164-165 366 367q16 16 38 16t38-16l76-76q16-15 16-38z" horiz-adv-x="1000" />
84
-
85
- <glyph glyph-name="cancel" unicode="&#xe826;" d="M724 112q0-22-15-38l-76-76q-16-15-38-15t-38 15l-164 165-164-165q-16-15-38-15t-38 15l-76 76q-16 16-16 38t16 38l164 164-164 164q-16 16-16 38t16 38l76 76q16 16 38 16t38-16l164-164 164 164q16 16 38 16t38-16l76-76q15-15 15-38t-15-38l-164-164 164-164q15-15 15-38z" horiz-adv-x="785.7" />
86
-
87
- <glyph glyph-name="pencil" unicode="&#xe827;" d="M203-7l50 51-131 131-51-51v-60h72v-71h60z m291 518q0 12-12 12-5 0-9-4l-303-302q-4-4-4-10 0-12 13-12 5 0 9 4l303 302q3 4 3 10z m-30 107l232-232-464-465h-232v233z m381-54q0-29-20-50l-93-93-232 233 93 92q20 21 50 21 29 0 51-21l131-131q20-22 20-51z" horiz-adv-x="857.1" />
88
-
89
- <glyph glyph-name="edit" unicode="&#xe828;" d="M496 189l64 65-85 85-64-65v-31h53v-54h32z m245 402q-9 9-18 0l-196-196q-9-9 0-18t18 0l196 196q9 9 0 18z m45-331v-106q0-67-47-114t-114-47h-464q-67 0-114 47t-47 114v464q0 66 47 113t114 48h464q35 0 65-14 9-4 10-13 2-10-5-16l-27-28q-8-8-18-4-13 3-25 3h-464q-37 0-63-26t-27-63v-464q0-37 27-63t63-27h464q37 0 63 27t26 63v70q0 7 5 12l36 36q8 8 20 4t11-16z m-54 411l161-160-375-375h-161v160z m248-73l-51-52-161 161 51 52q16 15 38 15t38-15l85-85q16-16 16-38t-16-38z" horiz-adv-x="1000" />
90
-
91
- <glyph glyph-name="forward" unicode="&#xe829;" d="M1000 493q0-15-11-25l-285-286q-11-11-25-11t-25 11-11 25v143h-125q-55 0-98-3t-86-12-74-24-59-39-45-56-27-77-10-101q0-31 3-69 0-4 2-13t1-15q0-8-5-14t-13-6q-9 0-15 10-4 5-8 12t-7 17-6 13q-71 159-71 252 0 111 30 186 90 225 488 225h125v143q0 14 11 25t25 10 25-10l285-286q11-11 11-25z" horiz-adv-x="1000" />
92
-
93
- <glyph glyph-name="export" unicode="&#xe82a;" d="M750 60l0 56 100 82 0-188q0-20-15-35t-35-15l-750 0q-20 0-35 15t-15 35l0 550q0 22 14 36t36 14l288 0q-32-24-59-49t-39-39l-10-12-130 0 0-450 650 0z m-82 348q-166 0-242-41t-160-181q0 8 1 22t9 56 22 79 44 83 70 79 107 56 149 23l0 156 332-250-332-260 0 178z" horiz-adv-x="1000" />
94
-
95
- <glyph glyph-name="trash-empty" unicode="&#xe82b;" d="M286 439v-321q0-8-5-13t-13-5h-36q-8 0-13 5t-5 13v321q0 8 5 13t13 5h36q8 0 13-5t5-13z m143 0v-321q0-8-5-13t-13-5h-36q-8 0-13 5t-5 13v321q0 8 5 13t13 5h36q8 0 13-5t5-13z m142 0v-321q0-8-5-13t-12-5h-36q-8 0-13 5t-5 13v321q0 8 5 13t13 5h36q7 0 12-5t5-13z m72-404v529h-500v-529q0-12 4-22t8-15 6-5h464q2 0 6 5t8 15 4 22z m-375 601h250l-27 65q-4 5-9 6h-177q-6-1-10-6z m518-18v-36q0-8-5-13t-13-5h-54v-529q0-46-26-80t-63-34h-464q-37 0-63 33t-27 79v531h-53q-8 0-13 5t-5 13v36q0 8 5 13t13 5h172l39 93q9 21 31 35t44 15h178q23 0 44-15t30-35l39-93h173q8 0 13-5t5-13z" horiz-adv-x="785.7" />
96
-
97
- <glyph glyph-name="down-dir" unicode="&#xe82c;" d="M571 457q0-14-10-25l-250-250q-11-11-25-11t-25 11l-250 250q-11 11-11 25t11 25 25 11h500q14 0 25-11t10-25z" horiz-adv-x="571.4" />
98
-
99
- <glyph glyph-name="up-dir" unicode="&#xe82d;" d="M571 171q0-14-10-25t-25-10h-500q-15 0-25 10t-11 25 11 26l250 250q10 10 25 10t25-10l250-250q10-11 10-26z" horiz-adv-x="571.4" />
100
-
101
- <glyph glyph-name="left-dir" unicode="&#xe82e;" d="M357 600v-500q0-14-10-25t-26-11-25 11l-250 250q-10 11-10 25t10 25l250 250q11 11 25 11t26-11 10-25z" horiz-adv-x="357.1" />
102
-
103
- <glyph glyph-name="right-dir" unicode="&#xe82f;" d="M321 350q0-14-10-25l-250-250q-11-11-25-11t-25 11-11 25v500q0 15 11 25t25 11 25-11l250-250q10-10 10-25z" horiz-adv-x="357.1" />
104
-
105
- <glyph glyph-name="spin1" unicode="&#xe830;" d="M496 850c-176 0-331-90-421-226-18-27-33-55-46-85-12-29-21-60-28-92 0 0 0-1 0-1l0 0 0 0c0-1 0-2 0-2 0-7 5-12 11-12l101 0c5 0 10 4 11 9 29 113 109 206 214 253 20 10 41 17 63 23 31 7 62 11 95 11l0 0 0 0 0 0c25 0 50-2 74-7 5-1 10-2 14-3 6-1 10-3 14-4l0 0c5-1 11 1 13 6l51 87c0 0 1 1 1 2 2 6-1 13-7 15-22 7-43 13-65 17-5 1-9 1-13 2-27 5-54 7-82 7l0 0 0 0z m327-114c-5 0-9-2-11-6l-50-87c-3-4-2-10 2-14 29-29 54-63 73-101 4-7 7-14 11-22 19-46 30-97 30-151l0 0 0 0c0-77-22-149-62-209-7-11-15-23-24-33-9-11-18-21-28-31l0 0 0 0 0 0c-4-4-5-10-2-14l50-87c0-1 1-2 2-3 4-5 11-5 16-1 58 52 104 117 134 190 6 15 11 29 15 44 14 46 21 94 21 144 0 108-34 209-92 291-11 16-23 31-37 46-13 14-26 28-41 41l0 0c-1 1-1 1-2 1-2 1-4 2-5 2z m-811-468l0 0c-1 0-2 0-3 0-6-1-10-8-9-14 34-166 149-302 302-366 30-12 61-21 93-28 32-6 66-10 100-10l0 0 0 0c40 0 79 5 117 14 7 1 14 3 22 5 6 2 13 5 20 7 1 0 2 1 3 1 6 3 8 10 4 16l-50 87c-3 5-8 7-13 6-14-4-28-7-42-9-3-1-6-1-8-2-18-2-35-3-53-3l0 0 0 0c-128 0-242 63-311 160-1 0-1 0-1 0-13 19-25 40-35 61-10 21-18 43-24 65-1 6-6 10-11 10l-101 0z" horiz-adv-x="1000" />
106
-
107
- <glyph glyph-name="spin2" unicode="&#xe831;" d="M46 144l0 0c0 0-1 0-1 0-8 18-15 37-21 55-6 19-11 38-15 58-19 99-8 203 35 298 3 6 10 8 15 5 1 0 2 0 2-1l0 0 80-59c5-3 6-9 4-14-5-12-9-25-12-37-4-13-7-26-9-40-11-67-3-137 23-201 2-5 0-10-4-13l0 0-80-56c-5-4-12-2-16 3-1 0-1 1-1 2l0 0z m120 574l0 0c0 1 0 1 0 1 15 13 30 25 46 37 16 11 33 22 51 31 89 50 192 72 297 60 6-1 10-6 10-13 0-1-1-1-1-2l0 0-31-94c-2-5-8-8-13-7-13 0-27 0-40 0-14-1-27-2-40-4-68-11-133-40-186-84-4-3-10-3-14 0l0 0-79 58c-5 3-6 11-2 16 0 0 1 1 2 1l0 0z m588 65l0 0c0 0 1 0 1 0 17-10 34-21 50-32 16-12 31-25 46-38 74-69 127-160 148-262 2-6-2-12-9-13-1 0-1 0-2 0l0 0-100 1c-5 0-10 4-11 9-3 13-8 26-12 38-5 12-10 25-17 36-31 61-78 113-137 150-5 3-6 8-5 13l0 0 31 92c2 6 9 9 15 7 1 0 2-1 2-1l0 0z m244-535l0 0c0 0 0 0 0 0-4-20-9-39-15-57-7-19-14-37-22-55-44-92-114-170-205-221-6-3-13-1-16 4 0 1-1 2-1 2l0 0-30 94c-2 6 1 12 6 14 11 7 22 15 32 23 11 9 21 18 30 27 49 48 84 109 101 176 2 5 6 8 11 8l0 0 98-1c6 0 11-5 11-11 0-1 0-2 0-3l0 0z m-438-395l0 0c0 0 0 0 0 0-20-2-40-3-60-3-20 0-40 1-59 4-102 12-198 54-276 125-5 4-5 11 0 16 0 0 1 1 1 1l0 0 81 58c5 3 12 2 16-2 10-8 20-16 32-23 11-7 22-14 34-20 62-31 131-45 200-41 6 0 10-3 12-8l0 0 29-92c2-6-1-12-7-14-1-1-2-1-3-1l0 0z" horiz-adv-x="1000" />
108
-
109
- <glyph glyph-name="mobile" unicode="&#xe832;" d="M480 840q42 0 71-29t29-71l0-780q0-40-29-70t-71-30l-380 0q-40 0-70 30t-30 70l0 780q0 42 30 71t70 29l380 0z m-190-940q30 0 50 15t20 35q0 22-20 36t-50 14q-28 0-49-15t-21-35 21-35 49-15z m210 150l0 660-420 0 0-660 420 0z" horiz-adv-x="580" />
110
-
111
- <glyph glyph-name="bell" unicode="&#xe833;" d="M509-96q0 8-9 8-33 0-57 24t-23 57q0 9-9 9t-9-9q0-41 29-70t69-28q9 0 9 9z m-372 160h726q-149 168-149 465 0 28-13 58t-39 58-67 45-95 17-95-17-67-45-39-58-13-58q0-297-149-465z m827 0q0-29-21-50t-50-21h-250q0-59-42-101t-101-42-101 42-42 101h-250q-29 0-50 21t-21 50q28 24 51 49t47 67 42 89 27 115 11 145q0 84 66 157t171 89q-5 10-5 21 0 23 16 38t38 16 38-16 16-38q0-11-5-21 106-16 171-89t66-157q0-78 11-145t28-115 41-89 48-67 50-49z" horiz-adv-x="1000" />
112
-
113
- <glyph glyph-name="ccw" unicode="&#xe834;" d="M857 350q0-87-34-166t-91-137-137-92-166-34q-96 0-183 41t-147 114q-4 6-4 13t5 11l76 77q6 5 14 5 9-1 13-7 41-53 100-82t126-29q58 0 110 23t92 61 61 91 22 111-22 111-61 91-92 61-110 23q-55 0-105-20t-90-57l77-77q17-16 8-38-10-23-33-23h-250q-15 0-25 11t-11 25v250q0 24 22 33 22 10 39-8l72-72q60 57 137 88t159 31q87 0 166-34t137-92 91-137 34-166z" horiz-adv-x="857.1" />
114
-
115
- <glyph glyph-name="wrench" unicode="&#xe835;" d="M214 29q0 14-10 25t-25 10-25-10-11-25 11-25 25-11 25 11 10 25z m360 234l-381-381q-21-20-50-20-29 0-51 20l-59 61q-21 20-21 50 0 29 21 51l380 380q22-55 64-97t97-64z m354 243q0-22-13-59-27-75-92-122t-144-46q-104 0-177 73t-73 177 73 176 177 74q32 0 67-10t60-26q9-6 9-15t-9-16l-163-94v-125l108-60q2 2 44 27t75 45 40 20q8 0 13-5t5-14z" horiz-adv-x="928.6" />
116
-
117
- <glyph glyph-name="stop-1" unicode="&#xe837;" d="M857 743v-786q0-14-10-25t-26-11h-785q-15 0-25 11t-11 25v786q0 14 11 25t25 11h785q15 0 26-11t10-25z" horiz-adv-x="857.1" />
118
-
119
- <glyph glyph-name="spin5" unicode="&#xe838;" d="M462 850c-6 0-11-5-11-11l0-183 0 0c0-6 5-11 11-11l69 0c1 0 1 0 1 0 7 0 12 5 12 11l0 183 0 0c0 6-5 11-12 11l-69 0c0 0 0 0-1 0z m250-47c-4 1-8-2-10-5l-91-158 0 0c-4-6-2-13 4-16l60-34c0-1 0-1 0-1 6-3 13-1 16 4l91 158c3 6 2 13-4 16l-61 35c-1 1-3 1-5 1z m-428-2c-2 0-4-1-6-2l-61-35c-5-3-7-10-4-16l91-157c0 0 0 0 0 0 3-6 10-8 16-5l61 35c5 4 7 11 4 16l-91 157c0 1 0 1 0 1-2 4-6 6-10 6z m620-163c-2 0-4 0-6-1l-157-91c0 0 0 0 0 0-6-3-8-10-5-16l35-61c4-5 11-7 16-4l157 91c1 0 1 0 1 0 6 3 7 11 4 16l-35 61c-2 4-6 6-10 5z m-810-4c-5 0-9-2-11-6l-35-61c-3-5-1-12 4-15l158-91 0 0c6-4 13-2 16 4l35 60c0 0 0 0 0 0 3 6 1 13-4 16l-158 91c-2 1-4 2-5 2z m712-235l0 0c-6 0-11-5-11-11l0-69c0-1 0-1 0-1 0-7 5-12 11-12l183 0 0 0c6 0 11 5 11 12l0 69c0 0 0 0 0 1 0 6-5 11-11 11l-183 0z m-794-5l0 0c-7 0-12-5-12-12l0-69c0 0 0 0 0-1 0-6 5-11 12-11l182 0 0 0c6 0 11 5 11 11l0 69c0 1 0 1 0 1 0 7-5 12-11 12l-182 0z m772-153c-4 0-8-2-10-6l-34-60c-1 0-1 0-1 0-3-6-1-13 4-16l158-91c6-3 13-1 16 4l35 61c3 5 1 12-4 15l-158 92 0 0c-2 1-4 1-6 1z m-566-5c-1 0-3 0-5-1l-157-91c0 0-1 0-1 0-5-3-7-10-4-16l35-61c3-5 10-7 16-4l157 91c0 0 0 0 0 0 6 3 8 10 5 16l-35 61c-3 3-7 6-11 5z m468-121c-2 0-4 0-6-1l-61-35c-5-4-7-11-4-16l91-157c0-1 0-1 0-1 3-6 11-7 16-4l61 35c5 3 7 10 4 16l-91 157c0 0 0 0 0 0-2 4-6 6-10 6z m-367-2c-4 0-8-2-10-6l-91-158c-3-6-1-13 4-16l61-35c5-3 12-1 15 4l92 158 0 0c3 6 1 13-5 16l-60 35c0 0 0 0 0 0-2 1-4 1-6 2z m149-58c-7 0-12-5-12-11l0-183 0 0c0-6 5-11 12-11l69 0c0 0 0 0 1 0 6 0 11 5 11 11l0 183 0 0c0 6-5 11-11 11l-69 0c-1 0-1 0-1 0z" horiz-adv-x="1000" />
120
-
121
- <glyph glyph-name="pause-1" unicode="&#xe839;" d="M857 743v-786q0-14-10-25t-26-11h-285q-15 0-25 11t-11 25v786q0 14 11 25t25 11h285q15 0 26-11t10-25z m-500 0v-786q0-14-10-25t-26-11h-285q-15 0-25 11t-11 25v786q0 14 11 25t25 11h285q15 0 26-11t10-25z" horiz-adv-x="857.1" />
122
-
123
- <glyph glyph-name="play-1" unicode="&#xe83a;" d="M772 333l-741-412q-13-7-22-2t-9 20v822q0 14 9 20t22-2l741-412q13-7 13-17t-13-17z" horiz-adv-x="785.7" />
124
-
125
- <glyph glyph-name="link-ext" unicode="&#xf08e;" d="M786 332v-178q0-67-47-114t-114-47h-464q-67 0-114 47t-47 114v464q0 66 47 113t114 48h393q7 0 12-5t5-13v-36q0-8-5-13t-12-5h-393q-37 0-63-26t-27-63v-464q0-37 27-63t63-27h464q37 0 63 27t26 63v178q0 8 5 13t13 5h36q8 0 13-5t5-13z m214 482v-285q0-15-11-25t-25-11-25 11l-98 98-364-364q-5-6-13-6t-12 6l-64 64q-6 5-6 12t6 13l364 364-98 98q-11 11-11 25t11 25 25 11h285q15 0 25-11t11-25z" horiz-adv-x="1000" />
126
-
127
- <glyph glyph-name="menu" unicode="&#xf0c9;" d="M857 100v-71q0-15-10-25t-26-11h-785q-15 0-25 11t-11 25v71q0 15 11 25t25 11h785q15 0 26-11t10-25z m0 286v-72q0-14-10-25t-26-10h-785q-15 0-25 10t-11 25v72q0 14 11 25t25 10h785q15 0 26-10t10-25z m0 285v-71q0-14-10-25t-26-11h-785q-15 0-25 11t-11 25v71q0 15 11 26t25 10h785q15 0 26-10t10-26z" horiz-adv-x="857.1" />
128
-
129
- <glyph glyph-name="sort" unicode="&#xf0dc;" d="M571 243q0-15-10-25l-250-250q-11-11-25-11t-25 11l-250 250q-11 10-11 25t11 25 25 11h500q14 0 25-11t10-25z m0 214q0-14-10-25t-25-11h-500q-15 0-25 11t-11 25 11 25l250 250q10 11 25 11t25-11l250-250q10-10 10-25z" horiz-adv-x="571.4" />
130
-
131
- <glyph glyph-name="mail-alt" unicode="&#xf0e0;" d="M1000 454v-443q0-37-26-63t-63-27h-822q-36 0-63 27t-26 63v443q25-27 56-49 202-137 278-192 32-24 51-37t53-27 61-13h2q28 0 61 13t53 27 51 37q95 68 278 192 32 22 56 49z m0 164q0-44-27-84t-68-69q-210-146-262-181-5-4-23-17t-30-22-29-18-32-15-28-5h-2q-12 0-27 5t-32 15-30 18-30 22-23 17q-51 35-147 101t-114 80q-35 23-65 64t-31 77q0 43 23 72t66 29h822q36 0 63-26t26-63z" horiz-adv-x="1000" />
132
-
133
- <glyph glyph-name="lightbulb" unicode="&#xf0eb;" d="M411 529q0-8-6-13t-12-5-13 5-5 13q0 25-30 39t-59 14q-7 0-13 5t-5 13 5 13 13 5q28 0 55-9t49-30 21-50z m89 0q0 40-19 74t-50 57-69 35-76 12-76-12-69-35-50-57-20-74q0-57 38-101 6-6 17-18t17-19q72-85 79-166h127q8 81 79 166 6 6 17 19t17 18q38 44 38 101z m71 0q0-87-57-150-25-27-42-48t-33-54-19-60q26-15 26-46 0-20-13-35 13-15 13-36 0-29-25-45 8-13 8-26 0-26-18-40t-43-14q-11-25-34-39t-48-15-49 15-33 39q-26 0-44 14t-17 40q0 13 7 26-25 16-25 45 0 21 14 36-14 15-14 35 0 31 26 46-2 28-19 60t-33 54-41 48q-58 63-58 150 0 55 25 103t65 79 92 49 104 19 104-19 91-49 66-79 24-103z" horiz-adv-x="571.4" />
134
-
135
- <glyph glyph-name="exchange" unicode="&#xf0ec;" d="M1000 189v-107q0-7-5-12t-13-6h-768v-107q0-7-5-12t-13-6q-6 0-13 6l-178 178q-5 6-5 13 0 8 5 13l179 178q5 5 12 5 8 0 13-5t5-13v-107h768q7 0 13-5t5-13z m0 304q0-8-5-13l-179-178q-5-6-12-6-8 0-13 6t-5 12v107h-768q-7 0-13 6t-5 12v107q0 8 5 13t13 5h768v107q0 8 5 13t13 5q6 0 13-5l178-178q5-5 5-13z" horiz-adv-x="1000" />
136
-
137
- <glyph glyph-name="upload-cloud" unicode="&#xf0ee;" d="M714 368q0 8-5 13l-196 196q-5 5-13 5t-13-5l-196-196q-5-6-5-13 0-8 5-13t13-5h125v-196q0-8 5-13t12-5h108q7 0 12 5t5 13v196h125q8 0 13 5t5 13z m357-161q0-89-62-151t-152-63h-607q-103 0-177 73t-73 177q0 72 39 134t105 92q-1 17-1 24 0 118 84 202t202 84q87 0 159-49t105-129q40 35 93 35 59 0 101-42t42-101q0-43-23-77 72-17 119-76t46-133z" horiz-adv-x="1071.4" />
138
-
139
- <glyph glyph-name="bell-alt" unicode="&#xf0f3;" d="M509-96q0 8-9 8-33 0-57 24t-23 57q0 9-9 9t-9-9q0-41 29-70t69-28q9 0 9 9z m455 160q0-29-21-50t-50-21h-250q0-59-42-101t-101-42-101 42-42 101h-250q-29 0-50 21t-21 50q28 24 51 49t47 67 42 89 27 115 11 145q0 84 66 157t171 89q-5 10-5 21 0 23 16 38t38 16 38-16 16-38q0-11-5-21 106-16 171-89t66-157q0-78 11-145t28-115 41-89 48-67 50-49z" horiz-adv-x="1000" />
140
-
141
- <glyph glyph-name="doc-text" unicode="&#xf0f6;" d="M819 638q16-16 27-42t11-50v-642q0-23-15-38t-38-16h-750q-23 0-38 16t-16 38v892q0 23 16 38t38 16h500q22 0 49-11t42-27z m-248 136v-210h210q-5 17-12 23l-175 175q-6 7-23 12z m215-853v572h-232q-23 0-38 16t-16 37v233h-429v-858h715z m-572 483q0 7 5 12t13 5h393q8 0 13-5t5-12v-36q0-8-5-13t-13-5h-393q-8 0-13 5t-5 13v36z m411-125q8 0 13-5t5-13v-36q0-8-5-13t-13-5h-393q-8 0-13 5t-5 13v36q0 8 5 13t13 5h393z m0-143q8 0 13-5t5-13v-36q0-8-5-13t-13-5h-393q-8 0-13 5t-5 13v36q0 8 5 13t13 5h393z" horiz-adv-x="857.1" />
142
-
143
- <glyph glyph-name="angle-double-left" unicode="&#xf100;" d="M350 82q0-7-6-13l-28-28q-5-5-12-5t-13 5l-260 261q-6 5-6 12t6 13l260 260q5 6 13 6t12-6l28-28q6-5 6-13t-6-12l-219-220 219-219q6-6 6-13z m214 0q0-7-5-13l-28-28q-6-5-13-5t-13 5l-260 261q-6 5-6 12t6 13l260 260q6 6 13 6t13-6l28-28q5-5 5-13t-5-12l-220-220 220-219q5-6 5-13z" horiz-adv-x="571.4" />
144
-
145
- <glyph glyph-name="angle-double-right" unicode="&#xf101;" d="M332 314q0-7-5-12l-261-261q-5-5-12-5t-13 5l-28 28q-6 6-6 13t6 13l219 219-219 220q-6 5-6 12t6 13l28 28q5 6 13 6t12-6l261-260q5-5 5-13z m214 0q0-7-5-12l-260-261q-6-5-13-5t-13 5l-28 28q-5 6-5 13t5 13l219 219-219 220q-5 5-5 12t5 13l28 28q6 6 13 6t13-6l260-260q5-5 5-13z" horiz-adv-x="571.4" />
146
-
147
- <glyph glyph-name="angle-double-up" unicode="&#xf102;" d="M600 118q0-7-6-13l-28-28q-5-5-12-5t-13 5l-220 219-219-219q-5-5-13-5t-12 5l-28 28q-6 6-6 13t6 13l260 260q5 5 12 5t13-5l260-260q6-6 6-13z m0 214q0-7-6-13l-28-28q-5-5-12-5t-13 5l-220 220-219-220q-5-5-13-5t-12 5l-28 28q-6 6-6 13t6 13l260 260q5 6 12 6t13-6l260-260q6-6 6-13z" horiz-adv-x="642.9" />
148
-
149
- <glyph glyph-name="angle-double-down" unicode="&#xf103;" d="M600 368q0-7-6-13l-260-260q-5-6-13-6t-12 6l-260 260q-6 6-6 13t6 13l28 28q5 5 12 5t13-5l219-220 220 220q5 5 13 5t12-5l28-28q6-6 6-13z m0 214q0-7-6-13l-260-260q-5-5-13-5t-12 5l-260 260q-6 6-6 13t6 13l28 28q5 6 12 6t13-6l219-219 220 219q5 6 13 6t12-6l28-28q6-6 6-13z" horiz-adv-x="642.9" />
150
-
151
- <glyph glyph-name="desktop" unicode="&#xf108;" d="M1000 296v465q0 7-5 12t-13 6h-893q-7 0-12-6t-6-12v-465q0-7 6-12t12-5h893q7 0 13 5t5 12z m71 465v-607q0-37-26-63t-63-27h-303q0-20 9-43t17-40 9-24q0-14-10-25t-25-11h-286q-15 0-25 11t-11 25q0 8 9 25t18 39 9 43h-304q-36 0-63 27t-26 63v607q0 37 26 63t63 26h893q37 0 63-26t26-63z" horiz-adv-x="1071.4" />
152
-
153
- <glyph glyph-name="laptop" unicode="&#xf109;" d="M232 136q-37 0-63 26t-26 63v393q0 37 26 63t63 26h607q37 0 63-26t27-63v-393q0-37-27-63t-63-26h-607z m-18 482v-393q0-7 6-13t12-5h607q8 0 13 5t5 13v393q0 7-5 12t-13 6h-607q-7 0-12-6t-6-12z m768-518h89v-54q0-22-26-37t-63-16h-893q-36 0-63 16t-26 37v54h982z m-402-54q9 0 9 9t-9 9h-89q-9 0-9-9t9-9h89z" horiz-adv-x="1071.4" />
154
-
155
- <glyph glyph-name="tablet" unicode="&#xf10a;" d="M357 64q0 15-10 25t-26 11-25-11-10-25 10-25 25-10 26 10 10 25z m214 90v535q0 8-5 13t-12 5h-465q-7 0-12-5t-6-13v-535q0-8 6-13t12-5h465q7 0 12 5t5 13z m72 535v-607q0-37-26-63t-63-26h-465q-36 0-63 26t-26 63v607q0 37 26 63t63 27h465q36 0 63-27t26-63z" horiz-adv-x="642.9" />
156
-
157
- <glyph glyph-name="circle-empty" unicode="&#xf10c;" d="M429 654q-83 0-153-41t-110-111-41-152 41-152 110-111 153-41 152 41 110 111 41 152-41 152-110 111-152 41z m428-304q0-117-57-215t-156-156-215-58-216 58-155 156-58 215 58 215 155 156 216 58 215-58 156-156 57-215z" horiz-adv-x="857.1" />
158
-
159
- <glyph glyph-name="circle" unicode="&#xf111;" d="M857 350q0-117-57-215t-156-156-215-58-216 58-155 156-58 215 58 215 155 156 216 58 215-58 156-156 57-215z" horiz-adv-x="857.1" />
160
-
161
- <glyph glyph-name="unlink" unicode="&#xf127;" d="M245 141l-143-143q-6-5-13-5t-12 5q-6 6-6 13t6 13l142 142q6 5 13 5t13-5q5-5 5-12t-5-13z m94-23v-179q0-8-5-13t-13-5-12 5-5 13v179q0 8 5 13t12 5 13-5 5-13z m-125 125q0-8-5-13t-13-5h-178q-8 0-13 5t-5 13 5 13 13 5h178q8 0 13-5t5-13z m706-72q0-66-48-113l-82-81q-46-47-113-47-68 0-114 48l-186 187q-12 12-24 31l134 10 152-153q15-15 38-15t38 15l82 81q16 16 16 37 0 23-16 38l-153 154 10 133q20-11 31-23l188-188q47-48 47-114z m-345 404l-133-10-152 153q-16 16-38 16-22 0-38-15l-82-82q-16-15-16-37 0-22 16-38l153-153-10-134q-20 12-32 24l-187 187q-47 48-47 114 0 67 47 113l82 82q47 46 114 46 67 0 114-47l186-187q12-12 23-32z m354-46q0-8-5-13t-13-5h-179q-8 0-13 5t-5 13 5 12 13 5h179q8 0 13-5t5-12z m-304 303v-178q0-8-5-13t-13-5-13 5-5 13v178q0 8 5 13t13 5 13-5 5-13z m227-84l-143-143q-6-5-13-5t-12 5q-5 6-5 13t5 13l143 143q5 5 12 5t13-5q5-6 5-13t-5-13z" horiz-adv-x="928.6" />
162
-
163
- <glyph glyph-name="help" unicode="&#xf128;" d="M393 149v-134q0-9-7-15t-15-7h-134q-9 0-16 7t-7 15v134q0 9 7 16t16 6h134q9 0 15-6t7-16z m176 335q0-30-8-56t-20-43-31-33-32-25-34-19q-23-13-38-37t-15-37q0-10-7-18t-16-9h-134q-8 0-14 11t-6 20v26q0 46 37 87t79 60q33 16 47 32t14 42q0 24-26 41t-60 18q-36 0-60-16-20-14-60-64-7-9-17-9-7 0-14 4l-91 70q-8 6-9 14t3 16q89 148 259 148 45 0 90-17t81-46 59-72 23-88z" horiz-adv-x="571.4" />
164
-
165
- <glyph glyph-name="info" unicode="&#xf129;" d="M357 100v-71q0-15-10-25t-26-11h-285q-15 0-25 11t-11 25v71q0 15 11 25t25 11h35v214h-35q-15 0-25 11t-11 25v71q0 15 11 25t25 11h214q15 0 25-11t11-25v-321h35q15 0 26-11t10-25z m-71 643v-107q0-15-11-25t-25-11h-143q-14 0-25 11t-11 25v107q0 14 11 25t25 11h143q15 0 25-11t11-25z" horiz-adv-x="357.1" />
166
-
167
- <glyph glyph-name="attention-alt" unicode="&#xf12a;" d="M286 154v-125q0-15-11-25t-25-11h-143q-14 0-25 11t-11 25v125q0 14 11 25t25 10h143q15 0 25-10t11-25z m17 589l-16-429q-1-14-12-25t-25-10h-143q-14 0-25 10t-12 25l-15 429q-1 14 10 25t24 11h179q14 0 25-11t10-25z" horiz-adv-x="357.1" />
168
-
169
- <glyph glyph-name="ellipsis" unicode="&#xf141;" d="M214 439v-107q0-22-15-38t-38-15h-107q-23 0-38 15t-16 38v107q0 23 16 38t38 16h107q22 0 38-16t15-38z m286 0v-107q0-22-16-38t-38-15h-107q-22 0-38 15t-15 38v107q0 23 15 38t38 16h107q23 0 38-16t16-38z m286 0v-107q0-22-16-38t-38-15h-107q-22 0-38 15t-16 38v107q0 23 16 38t38 16h107q23 0 38-16t16-38z" horiz-adv-x="785.7" />
170
-
171
- <glyph glyph-name="ellipsis-vert" unicode="&#xf142;" d="M214 154v-108q0-22-15-37t-38-16h-107q-23 0-38 16t-16 37v108q0 22 16 38t38 15h107q22 0 38-15t15-38z m0 285v-107q0-22-15-38t-38-15h-107q-23 0-38 15t-16 38v107q0 23 16 38t38 16h107q22 0 38-16t15-38z m0 286v-107q0-22-15-38t-38-16h-107q-23 0-38 16t-16 38v107q0 22 16 38t38 16h107q22 0 38-16t15-38z" horiz-adv-x="214.3" />
172
-
173
- <glyph glyph-name="euro" unicode="&#xf153;" d="M545 121l19-89q2-7-1-13t-10-8l-3 0q-2-1-6-2t-9-3-12-3-14-3-16-2-19-3-21-2-21 0q-131 0-228 73t-133 196h-53q-7 0-13 5t-5 13v63q0 7 5 12t13 6h37q-1 31 0 58h-37q-8 0-13 5t-5 13v64q0 8 5 13t13 5h55q37 117 135 188t224 72q57 0 108-13 6-2 11-9 4-6 2-13l-24-89q-2-7-8-11t-13-1l-2 1q-3 0-7 1l-10 2t-12 2-15 2-16 1-16 1q-71 0-126-36t-84-98h261q9 0 14-7 6-7 4-15l-13-63q-3-15-18-15h-273q-1-20 0-58h257q8 0 13-7 5-7 4-15l-14-63q-1-6-6-10t-11-4h-216q27-65 84-104t127-38q10 0 20 1t19 2 16 2 14 3 10 3l7 1 3 2q7 2 14-2 7-3 9-11z" horiz-adv-x="571.4" />
174
-
175
- <glyph glyph-name="pound" unicode="&#xf154;" d="M569 216v-205q0-8-5-13t-13-5h-533q-8 0-13 5t-5 13v83q0 8 5 13t13 5h54v214h-53q-8 0-13 5t-5 13v73q0 8 5 13t13 5h53v124q0 96 69 158t175 62q104 0 187-70 5-5 6-12t-4-12l-57-71q-5-6-13-7-7-1-13 4-2 3-14 11t-39 18-51 10q-48 0-77-27t-29-68v-120h170q8 0 13-5t5-13v-73q0-7-5-13t-13-5h-170v-211h231v101q0 7 5 12t13 5h90q8 0 13-5t5-12z" horiz-adv-x="571.4" />
176
-
177
- <glyph glyph-name="dollar" unicode="&#xf155;" d="M546 189q0-86-56-147t-144-77v-97q0-8-5-13t-13-5h-75q-7 0-13 5t-5 13v97q-37 5-71 18t-57 25-41 26-26 21-10 10q-9 12-1 23l58 76q3 5 12 6 9 1 14-5l1-1q63-55 135-70 21-4 42-4 45 0 79 24t35 68q0 16-9 30t-18 23-33 21-37 18-45 18q-21 9-34 14t-34 15-35 17-32 20-29 24-25 27-20 32-11 37-5 44q0 77 55 135t142 75v100q0 7 5 13t13 5h75q8 0 13-5t5-13v-98q32-3 62-13t48-19 36-20 21-17 9-7q9-11 3-22l-46-81q-4-9-12-9-8-2-15 4-2 2-9 7t-21 14-33 18-42 15-47 6q-53 0-87-24t-33-62q0-14 4-27t17-23 22-18 31-18 34-15 39-15q30-11 45-17t43-20 42-24 34-28 30-35 18-43 7-52z" horiz-adv-x="571.4" />
178
-
179
- <glyph glyph-name="rupee" unicode="&#xf156;" d="M501 588v-57q0-8-5-13t-13-5h-93q-13-80-72-131t-154-61q93-99 256-299 8-9 2-19-5-10-16-10h-109q-9 0-14 7-171 204-278 318-5 5-5 13v70q0 8 5 13t13 5h62q74 0 119 24t57 70h-238q-8 0-13 5t-5 13v57q0 8 5 13t13 5h230q-31 63-149 63h-81q-7 0-13 5t-5 13v74q0 8 5 13t13 5h464q8 0 13-5t5-13v-57q0-8-5-13t-13-5h-130q26-34 36-80h95q8 0 13-5t5-13z" horiz-adv-x="501.1" />
180
-
181
- <glyph glyph-name="yen" unicode="&#xf157;" d="M337-7h-96q-8 0-13 5t-5 13v184h-161q-7 0-13 5t-5 13v57q0 8 5 13t13 5h161v48h-161q-7 0-13 5t-5 12v58q0 8 5 13t13 5h119l-179 323q-4 9 0 18 6 9 16 9h108q11 0 16-10l120-238q11-21 32-69 5 13 17 38t15 34l107 234q4 11 16 11h106q10 0 15-9 5-8 1-18l-175-323h120q7 0 13-5t5-13v-58q0-7-5-12t-13-5h-162v-48h162q7 0 13-5t5-13v-57q0-8-5-13t-13-5h-162v-184q0-7-5-13t-12-5z" horiz-adv-x="573.1" />
182
-
183
- <glyph glyph-name="rouble" unicode="&#xf158;" d="M582 535q0 56-36 90t-96 35h-178v-250h178q60 0 96 34t36 91z m132 0q0-108-70-176t-182-68h-190v-66h282q7 0 12-5t5-13v-71q0-8-5-13t-12-5h-282v-107q0-8-5-13t-13-5h-93q-8 0-13 5t-5 13v107h-125q-8 0-13 5t-5 13v71q0 8 5 13t13 5h125v66h-125q-8 0-13 5t-5 13v83q0 7 5 12t13 6h125v351q0 8 5 13t13 5h301q111 0 182-68t70-176z" horiz-adv-x="714.3" />
184
-
185
- <glyph glyph-name="won" unicode="&#xf159;" d="M287 183l45 167h-89l42-167q1-1 1-2t0-2q0 1 1 2t0 2z m65 238l19 72h-163l18-72h126z m107 0h77l-19 72h-39z m250-238l44 167h-91l46-167q0 0 0-2t1-2q0 1 0 2t0 2z m62 238l19 72h-166l19-72h128z m229-17v-36q0-8-5-13t-13-5h-119l-91-344q-4-13-17-13h-89q-14 0-18 13l-92 344h-117l-93-344q-4-13-17-13h-89q-6 0-11 4t-6 9l-89 344h-116q-8 0-13 5t-5 13v36q0 7 5 12t13 5h98l-19 72h-79q-8 0-13 5t-5 13v35q0 8 5 13t13 5h61l-50 192q-3 9 3 16 5 7 14 7h77q14 0 17-14l50-201h201l54 201q4 14 17 14h70q14 0 18-14l54-201h204l52 201q3 14 17 14h77q9 0 14-7 6-7 3-16l-51-192h62q8 0 13-5t5-13v-35q0-8-5-13t-13-5h-81l-19-72h100q8 0 13-5t5-12z" horiz-adv-x="1000" />
186
-
187
- <glyph glyph-name="bitcoin" unicode="&#xf15a;" d="M651 493q10-102-73-144 65-16 98-58t25-119q-4-40-18-70t-36-49-54-33-68-19-81-9v-142h-86v140q-45 0-68 1v-141h-86v142q-10 0-30 1t-31 0h-112l18 102h62q27 0 32 28v225h9q-4 0-9 0v161q-7 37-50 37h-62v92l119-1q35 0 54 1v141h86v-138q45 1 68 1v137h86v-141q44-4 78-13t63-25 46-43 20-64z m-120-304q0 20-8 35t-21 26-32 17-36 11-42 5-38 1-36 0-27-1v-189q5 0 21 0t27 0 29 1 33 2 32 5 31 8 26 11 22 17 14 22 5 29z m-39 265q0 19-7 33t-17 23-27 16-31 9-34 5-32 1-31 0-22-1v-171q3 0 20 0t26 0 27 1 31 3 29 6 27 10 21 15 15 22 5 28z" horiz-adv-x="714.3" />
188
-
189
- <glyph glyph-name="sort-alt-up" unicode="&#xf160;" d="M411 46q0-6-6-13l-178-178q-5-5-13-5-6 0-12 5l-179 179q-8 9-4 19 4 11 17 11h107v768q0 8 5 13t13 5h107q8 0 13-5t5-13v-768h107q8 0 13-5t5-13z m589-71v-107q0-8-5-13t-13-5h-464q-8 0-13 5t-5 13v107q0 8 5 13t13 5h464q8 0 13-5t5-13z m-107 286v-107q0-8-5-13t-13-5h-357q-8 0-13 5t-5 13v107q0 8 5 13t13 5h357q8 0 13-5t5-13z m-107 285v-107q0-7-5-12t-13-6h-250q-8 0-13 6t-5 12v107q0 8 5 13t13 5h250q8 0 13-5t5-13z m-107 286v-107q0-8-5-13t-13-5h-143q-8 0-13 5t-5 13v107q0 8 5 13t13 5h143q8 0 13-5t5-13z" horiz-adv-x="1000" />
190
-
191
- <glyph glyph-name="sort-alt-down" unicode="&#xf161;" d="M679-25v-107q0-8-5-13t-13-5h-143q-8 0-13 5t-5 13v107q0 8 5 13t13 5h143q8 0 13-5t5-13z m-268 71q0-6-6-13l-178-178q-5-5-13-5-6 0-12 5l-179 179q-8 9-4 19 4 11 17 11h107v768q0 8 5 13t13 5h107q8 0 13-5t5-13v-768h107q8 0 13-5t5-13z m375 215v-107q0-8-5-13t-13-5h-250q-8 0-13 5t-5 13v107q0 8 5 13t13 5h250q8 0 13-5t5-13z m107 285v-107q0-7-5-12t-13-6h-357q-8 0-13 6t-5 12v107q0 8 5 13t13 5h357q8 0 13-5t5-13z m107 286v-107q0-8-5-13t-13-5h-464q-8 0-13 5t-5 13v107q0 8 5 13t13 5h464q8 0 13-5t5-13z" horiz-adv-x="1000" />
192
-
193
- <glyph glyph-name="bug" unicode="&#xf188;" d="M911 314q0-14-11-25t-25-10h-125q0-96-37-162l116-117q10-11 10-25t-10-25q-10-11-25-11t-25 11l-111 110q-3-3-8-7t-24-16-36-21-46-16-54-7v500h-71v-500q-29 0-57 7t-49 19-36 22-25 18l-8 8-102-116q-11-12-27-12-13 0-24 9-11 10-11 25t8 26l113 127q-32 63-32 153h-125q-15 0-25 10t-11 25 11 25 25 11h125v164l-97 97q-11 10-11 25t11 25 25 10 25-10l97-97h471l96 97q11 10 25 10t26-10 10-25-10-25l-97-97v-164h125q15 0 25-11t11-25z m-268 322h-357q0 74 52 126t126 52 127-52 52-126z" horiz-adv-x="928.6" />
194
-
195
- <glyph glyph-name="try" unicode="&#xf195;" d="M643 386q0-107-53-197t-143-143-197-53h-89q-8 0-13 5t-5 13v341l-120-37q-2-1-5-1-6 0-11 4-7 5-7 14v72q0 12 13 17l130 40v51l-120-36q-2-1-5-1-6 0-11 3-7 6-7 15v71q0 13 13 18l130 39v140q0 8 5 13t13 5h89q8 0 13-5t5-13v-101l209 64q9 3 16-2t7-15v-71q0-13-13-18l-219-67v-52l209 65q9 3 16-3t7-15v-71q0-13-13-17l-219-68v-272q105 8 177 85t73 183q0 8 5 13t13 5h89q8 0 13-5t5-13z" horiz-adv-x="642.9" />
196
-
197
- <glyph glyph-name="wordpress" unicode="&#xf19a;" d="M71 350q0 91 37 175l205-561q-109 53-176 157t-66 229z m719 22q0-11-2-22t-5-27-7-25-9-33-10-32l-43-143-155 461q26 2 49 4 11 2 15 11t-2 17-15 8l-115-6q-42 1-113 6-6 0-11-3t-6-9-1-10 5-9 11-5l44-4 67-183-94-281-156 464q26 2 49 4 11 2 15 11t-2 17-15 8l-115-6q-4 0-13 0t-14 1q58 89 153 141t205 52q82 0 157-29t133-84h-6q-31 0-51-22t-21-53q0-7 1-14t2-12 5-13 5-11 7-13 7-12 8-13 8-13q35-60 35-118z m-283-59l133-361q0-4 2-7-70-24-142-24-62 0-121 18z m369 243q53-97 53-206 0-117-58-215t-156-156l132 379q33 94 33 154 0 23-4 44z m-376 294q102 0 194-40t160-106 106-160 40-194-40-194-106-160-160-106-194-40-194 40-160 106-106 160-40 194 40 194 106 160 160 106 194 40z m0-977q97 0 185 38t152 102 102 152 38 185-38 185-102 152-152 102-185 38-185-38-152-102-102-152-38-185 38-185 102-152 152-102 185-38z" horiz-adv-x="1000" />
198
-
199
- <glyph glyph-name="cubes" unicode="&#xf1b3;" d="M357-61l214 107v176l-214-92v-191z m-36 254l226 96-226 97-225-97z m608-254l214 107v176l-214-92v-191z m-36 254l225 96-225 97-226-97z m-250 163l214 92v149l-214-92v-149z m-36 212l246 105-246 106-246-106z m607-289v-233q0-20-10-37t-29-26l-250-125q-14-8-32-8t-32 8l-250 125q-2 1-4 2-1-1-4-2l-250-125q-14-8-32-8t-31 8l-250 125q-19 9-29 26t-11 37v233q0 21 12 39t32 26l242 104v223q0 22 12 40t31 26l250 107q13 6 28 6t28-6l250-107q20-9 32-26t12-40v-223l242-104q20-8 32-26t11-39z" horiz-adv-x="1285.7" />
200
-
201
- <glyph glyph-name="database" unicode="&#xf1c0;" d="M429 421q132 0 247 24t181 71v-95q0-38-57-71t-157-52-214-19-215 19-156 52-58 71v95q66-47 181-71t248-24z m0-428q132 0 247 24t181 71v-95q0-39-57-72t-157-52-214-19-215 19-156 52-58 72v95q66-47 181-71t248-24z m0 214q132 0 247 24t181 71v-95q0-38-57-71t-157-52-214-20-215 20-156 52-58 71v95q66-47 181-71t248-24z m0 643q116 0 214-19t157-52 57-72v-71q0-39-57-72t-157-52-214-19-215 19-156 52-58 72v71q0 39 58 72t156 52 215 19z" horiz-adv-x="857.1" />
202
-
203
- <glyph glyph-name="circle-thin" unicode="&#xf1db;" d="M429 707q-73 0-139-28t-114-76-76-114-29-139 29-139 76-113 114-77 139-28 138 28 114 77 76 113 29 139-29 139-76 114-114 76-138 28z m428-357q0-117-57-215t-156-156-215-58-216 58-155 156-58 215 58 215 155 156 216 58 215-58 156-156 57-215z" horiz-adv-x="857.1" />
204
-
205
- <glyph glyph-name="sliders" unicode="&#xf1de;" d="M196 64v-71h-196v71h196z m197 72q14 0 25-11t11-25v-143q0-14-11-25t-25-11h-143q-14 0-25 11t-11 25v143q0 15 11 25t25 11h143z m89 214v-71h-482v71h482z m-357 286v-72h-125v72h125z m732-572v-71h-411v71h411z m-536 643q15 0 26-10t10-26v-142q0-15-10-25t-26-11h-142q-15 0-25 11t-11 25v142q0 15 11 26t25 10h142z m358-286q14 0 25-10t10-25v-143q0-15-10-25t-25-11h-143q-15 0-25 11t-11 25v143q0 14 11 25t25 10h143z m178-71v-71h-125v71h125z m0 286v-72h-482v72h482z" horiz-adv-x="857.1" />
206
-
207
- <glyph glyph-name="share" unicode="&#xf1e0;" d="M679 279q74 0 126-53t52-126-52-126-126-53-127 53-52 126q0 7 1 19l-201 100q-51-48-121-48-75 0-127 53t-52 126 52 126 127 53q70 0 121-48l201 100q-1 12-1 19 0 74 52 126t127 53 126-53 52-126-52-126-126-53q-71 0-122 48l-201-100q1-12 1-19t-1-19l201-100q51 48 122 48z" horiz-adv-x="857.1" />
208
-
209
- <glyph glyph-name="plug" unicode="&#xf1e6;" d="M979 597q21-21 21-50t-21-51l-223-223 83-84-89-89q-91-91-217-104t-230 56l-202-202h-101v101l202 202q-69 103-56 230t104 217l89 89 84-83 223 223q21 21 51 21t50-21 21-50-21-51l-223-223 131-131 223 223q22 21 51 21t50-21z" horiz-adv-x="1000" />
210
-
211
- <glyph glyph-name="trash" unicode="&#xf1f8;" d="M286 82v393q0 8-5 13t-13 5h-36q-8 0-13-5t-5-13v-393q0-8 5-13t13-5h36q8 0 13 5t5 13z m143 0v393q0 8-5 13t-13 5h-36q-8 0-13-5t-5-13v-393q0-8 5-13t13-5h36q8 0 13 5t5 13z m142 0v393q0 8-5 13t-12 5h-36q-8 0-13-5t-5-13v-393q0-8 5-13t13-5h36q7 0 12 5t5 13z m-303 554h250l-27 65q-4 5-9 6h-177q-6-1-10-6z m518-18v-36q0-8-5-13t-13-5h-54v-529q0-46-26-80t-63-34h-464q-37 0-63 33t-27 79v531h-53q-8 0-13 5t-5 13v36q0 8 5 13t13 5h172l39 93q9 21 31 35t44 15h178q23 0 44-15t30-35l39-93h173q8 0 13-5t5-13z" horiz-adv-x="785.7" />
212
-
213
- <glyph glyph-name="chart-line" unicode="&#xf201;" d="M1143-7v-72h-1143v858h71v-786h1072z m-72 696v-242q0-12-10-17t-20 4l-68 68-353-353q-6-6-13-6t-13 6l-130 130-232-233-107 108 327 326q5 6 12 6t13-6l130-130 259 259-67 68q-9 8-5 19t17 11h243q7 0 12-5t5-13z" horiz-adv-x="1142.9" />
214
-
215
- <glyph glyph-name="shekel" unicode="&#xf20b;" d="M554 502v-277q0-8-5-13t-13-5h-90q-7 0-12 5t-5 13v277q0 62-45 107t-107 45h-152v-643q0-8-5-13t-13-5h-89q-8 0-13 5t-5 13v750q0 8 5 13t13 5h259q75 0 139-37t101-101 37-139z m214 259v-491q0-76-37-139t-101-101-139-37h-259q-8 0-13 5t-5 13v535q0 8 5 13t13 5h89q8 0 13-5t5-13v-428h152q63 0 107 45t45 107v491q0 8 5 13t13 5h89q8 0 13-5t5-13z" horiz-adv-x="857.1" />
216
-
217
- <glyph glyph-name="user-secret" unicode="&#xf21b;" d="M321-7l54 250-54 71-71 36z m143 0l72 357-72-36-53-71z m90 564q-1 2-3 3-5 4-53 4-39 0-93-10-4-1-12-1t-12 1q-54 10-93 10-48 0-54-4-1-1-2-3 1-11 2-16 2-1 5-3t4-6q1-2 4-11t4-12 4-9 5-10 5-8 7-7 7-6 10-4 12-2 13-1q20 0 33 7t18 16 8 20 7 16 10 7h6q6 0 10-7t6-16 9-20 18-16 33-7q7 0 13 1t12 2 9 4 8 6 7 7 5 8 5 10 4 9 4 12 4 11q1 4 4 6t4 3q2 5 3 16z m232-491q0-68-41-106t-108-39h-488q-67 0-108 39t-41 106q0 34 3 66t10 70 21 69 36 58 52 41l-51 123h120q-12 36-12 71 0 7 1 18-109 23-109 54 0 32 118 55 9 35 28 75t40 63q18 21 42 21 17 0 47-17t47-18 47 18 47 17q24 0 42-21 20-23 39-63t29-75q117-23 117-55 0-31-108-54 4-45-11-89h119l-45-126q35-18 60-54t36-80 16-84 5-83z" horiz-adv-x="857.1" />
218
-
219
- <glyph glyph-name="user-plus" unicode="&#xf234;" d="M393 350q-89 0-152 63t-62 151 62 152 152 63 151-63 63-152-63-151-151-63z m536-71h196q7 0 13-6t5-12v-107q0-8-5-13t-13-5h-196v-197q0-7-6-12t-12-6h-107q-8 0-13 6t-5 12v197h-197q-7 0-12 5t-6 13v107q0 7 6 12t12 6h197v196q0 7 5 13t13 5h107q7 0 12-5t6-13v-196z m-411-125q0-29 21-51t50-21h143v-133q-38-28-95-28h-488q-67 0-108 39t-41 106q0 30 2 58t8 61 15 60 24 55 34 45 48 30 62 11q11 0 22-10 44-34 86-51t92-17 92 17 86 51q11 10 22 10 73 0 121-54h-125q-29 0-50-21t-21-50v-107z" horiz-adv-x="1142.9" />
220
-
221
- <glyph glyph-name="user-times" unicode="&#xf235;" d="M393 350q-89 0-152 63t-62 151 62 152 152 63 151-63 63-152-63-151-151-63z m601-179l139-138q5-5 5-13 0-8-5-13l-76-76q-5-5-12-5-8 0-13 5l-139 139-139-139q-5-5-13-5-7 0-12 5l-76 76q-5 5-5 13 0 8 5 13l139 138-139 139q-5 5-5 13 0 8 5 13l76 75q5 5 12 5 8 0 13-5l139-139 139 139q5 5 13 5 7 0 12-5l76-75q5-5 5-13 0-8-5-13z m-278 0l-101-101q-21-20-21-50 0-30 21-51l46-46q-11-2-24-2h-488q-67 0-108 39t-41 106q0 30 2 58t8 61 15 60 24 55 34 45 48 30 62 11q11 0 22-10 86-68 178-68t178 68q11 10 22 10 15 0 31-4-15-15-22-27t-8-32q0-30 21-51z" horiz-adv-x="1142.9" />
222
-
223
- <glyph glyph-name="viacoin" unicode="&#xf237;" d="M857 850l-107-250h107v-107h-153l-30-72h183v-107h-229l-199-464-200 464h-229v107h184l-31 72h-153v107h107l-107 250h143l180-429h211l180 429h143z m-428-679l60 143h-121z" horiz-adv-x="857.1" />
224
-
225
- <glyph glyph-name="safari" unicode="&#xf267;" d="M530 352q0-15-10-25t-23-11q-14 0-25 9t-10 23q0 15 9 25t23 11 25-9 11-23z m8-33l195 325q-5-5-37-35t-70-65-77-71-65-62-28-29l-195-323q4 4 38 34t70 65 76 71 65 62 28 28z m361 31q0-112-58-207-2 1-9 6t-15 9-9 5q-8 0-8-8 0-5 33-24-41-63-103-107t-135-61l-8 37q-1 6-9 6-3 0-4-3t-1-6l9-38q-41-8-82-8-111 0-208 59 1 1 8 11t12 19 5 10q0 8-7 8-4 0-10-8t-12-20-8-13q-63 42-107 105t-61 137l38 8q6 2 6 8 0 3-3 5t-6 1l-38-9q-8 41-8 78 0 115 61 212 1-1 10-7t17-11 10-4q7 0 7 6 0 4-7 9t-18 12l-11 7q43 62 105 105t136 60l9-37q1-6 8-6 3 0 5 3t1 6l-9 37q40 7 75 7 114 0 212-61-22-31-22-36 0-7 6-7 7 0 27 35 62-41 105-103t60-135l-31-7q-6-1-6-8 0-3 3-5t5-1l32 7q8-40 8-78z m47 0q0 91-35 174t-95 142-142 95-174 35-173-35-143-95-95-142-35-174 35-173 95-143 143-95 173-35 174 35 142 95 95 143 35 173z m54 0q0-102-40-194t-106-160-160-106-194-40-194 40-160 106-106 160-40 194 40 194 106 160 160 106 194 40 194-40 160-106 106-160 40-194z" horiz-adv-x="1000" />
226
-
227
- <glyph glyph-name="chrome" unicode="&#xf268;" d="M498 850q134 1 252-67 130-75 196-208l-414 22q-89 5-164-41t-103-128l-154 236q72 89 174 137t213 49z m-416-226l188-370q40-80 117-121t164-25l-129-252q-118 19-214 88t-152 176-56 230q0 149 82 274z m885-94q32-84 33-174t-27-170-86-152-137-117q-128-74-278-66l226 347q49 73 46 162t-59 155z m-467-11q70 0 119-50t50-119-50-119-119-49-119 49-49 119 49 119 119 50z" horiz-adv-x="1000" />
228
-
229
- <glyph glyph-name="firefox" unicode="&#xf269;" d="M504-150q-158 0-282 84t-183 222q-33 74-38 168t15 186 62 174 100 135l-7-156q7 7 38 8t39-8q24 45 90 77t131 32q-30-25-67-82t-33-92q14-4 35-7t36-4 37-3 29-1q8-3 5-26t-17-42q-3-4-9-10t-32-20-56-19l8-105-77 37q-10-24-5-45t21-38 36-23 45-3q29 5 55 19t47 25 41 10q34-2 50-19t10-36q0-1-1-3t-5-7-10-9-17-5-26-1q-34-53-81-76t-117-16q41-34 91-46t94-3 86 29 71 48 45 58q24 51 22 108t-21 105-44 70q49-21 77-45t43-62q8 95-32 191t-117 159q148-43 230-156t84-289q1-71-23-143t-68-132-106-110-138-75-161-28z" horiz-adv-x="1000" />
230
-
231
- <glyph glyph-name="opera" unicode="&#xf26a;" d="M833 723q-92 61-200 61-87 0-164-41t-134-111q-41-52-66-122t-27-148v-24q2-78 27-148t66-122q57-71 134-111t164-41q108 0 200 61-67-60-153-94t-180-33q-16 0-24 1-98 4-186 45t-152 108-101 157-37 189q0 102 40 194t106 160 160 106 194 40h2q93-1 179-34t152-93z m167-373q0-107-43-202t-119-166q-58-35-124-35-76 0-142 47 86 31 141 130t56 226q0 127-55 225t-141 131q66 46 141 46 67 0 126-36 76-70 118-164t42-202z" horiz-adv-x="1000" />
232
-
233
- <glyph glyph-name="internet-explorer" unicode="&#xf26b;" d="M1000 327q0-31-4-58h-642q0-81 61-136t144-55q55 0 103 26t76 73h236q-31-89-95-157t-149-106-179-37q-105 0-199 47-127-65-220-65-132 0-132 147 0 64 25 153 10 34 61 128 111 201 265 338-103-44-238-197 35 153 158 250t280 98q17 0 25 0 142 65 242 65 35 0 64-7t53-23 37-42 14-65q0-64-42-159 56-102 56-218z m-39 357q0 47-30 74t-76 27q-60 0-142-39 68-26 124-73t96-109q28 75 28 120z m-890-690q0-48 28-74t75-26q64 0 148 46-68 41-119 103t-77 136q-55-114-55-185z m282 398h406q-3 79-63 132t-140 53q-81 0-140-53t-63-132z" horiz-adv-x="1000" />
234
-
235
- <glyph glyph-name="television" unicode="&#xf26c;" d="M1000 154v535q0 8-5 13t-13 5h-893q-7 0-12-5t-6-13v-535q0-8 6-13t12-5h893q7 0 13 5t5 13z m71 535v-535q0-37-26-63t-63-27h-411v-71h197q8 0 13-5t5-13v-36q0-8-5-13t-13-5h-464q-8 0-13 5t-5 13v36q0 8 5 13t13 5h196v71h-411q-36 0-63 27t-26 63v535q0 37 26 63t63 27h893q37 0 63-27t26-63z" horiz-adv-x="1142.9" />
236
-
237
- <glyph glyph-name="percent" unicode="&#xf295;" d="M714 136q0 29-21 50t-50 21-50-21-22-50 22-50 50-22 50 22 21 50z m-428 428q0 29-21 51t-51 21-50-21-21-51 21-50 50-21 51 21 21 50z m571-428q0-89-63-152t-151-63-152 63-62 152 62 151 152 63 151-63 63-151z m-53 607q0-11-8-21l-589-786q-11-15-28-15h-90q-14 0-25 11t-10 25q0 11 7 21l589 786q11 15 29 15h89q14 0 25-11t11-25z m-375-179q0-88-63-151t-152-63-151 63-63 151 63 152 151 63 152-63 63-152z" horiz-adv-x="857.1" />
238
- </font>
239
- </defs>
240
  </svg>
1
+ <?xml version="1.0" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg">
4
+ <metadata>Copyright (C) 2019 by original authors @ fontello.com</metadata>
5
+ <defs>
6
+ <font id="fontello" horiz-adv-x="1000" >
7
+ <font-face font-family="fontello" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
8
+ <missing-glyph horiz-adv-x="1000" />
9
+ <glyph glyph-name="download" unicode="&#xe800;" d="M714 590q15-15 15-37t-15-36l-245-244-245 244q-15 15-15 36t15 37 36 15q23 0 38-15l118-120 0 349q0 21 16 37t37 16 37-16 15-37l0-349 119 120q14 14 38 14 22 0 36-14z m222-448l2-261q0-21-16-36t-37-16l-832 0q-22 0-37 16t-16 36q0 261 1 261 0 11 2 16l105 312q12 37 48 37l12 0q8-18 18-28l78-76-70 0-86-261 722 0-86 261-70 0 77 76q10 10 19 28l11 0q37 0 49-37l105-312q1-5 1-16z" horiz-adv-x="938" />
10
+
11
+ <glyph glyph-name="glass" unicode="&#xe801;" d="M948 746q0-19-24-43l-353-353v-429h179q15 0 25-10t11-25-11-25-25-11h-500q-14 0-25 11t-11 25 11 25 25 10h179v429l-353 353q-24 24-24 43 0 13 10 21t21 9 24 3h786q13 0 24-3t21-9 10-21z" horiz-adv-x="1000" />
12
+
13
+ <glyph glyph-name="emo-happy" unicode="&#xe802;" d="M261 800c-60 0-109-65-109-144 0-80 49-145 109-145s110 65 110 145c0 79-49 144-110 144z m477 0c-61 0-110-65-110-144 0-80 49-145 110-145 60 0 110 65 110 145 0 79-50 144-110 144z m208-599c-13 0-27-5-37-16-4-4-8-8-12-12-111-109-253-164-396-165-142-2-285 50-396 155l-3 3-12 12c-21 21-54 20-75-1-20-21-20-55 1-76 3-4 8-8 14-14l3-3c132-124 301-186 469-184 169 1 337 67 468 195 5 5 9 10 14 14 20 22 20 56-1 77-10 10-23 15-37 15z" horiz-adv-x="999" />
14
+
15
+ <glyph glyph-name="search" unicode="&#xe803;" d="M643 386q0 103-73 176t-177 74-177-74-73-176 73-177 177-73 177 73 73 177z m286-465q0-29-22-50t-50-21q-30 0-50 21l-191 191q-100-69-223-69-80 0-153 31t-125 84-84 125-31 153 31 152 84 126 125 84 153 31 153-31 125-84 84-126 31-152q0-123-69-223l191-191q21-21 21-51z" horiz-adv-x="928.6" />
16
+
17
+ <glyph glyph-name="emo-unhappy" unicode="&#xe804;" d="M261 800c-60 0-109-65-109-144 0-80 49-145 109-145s110 65 110 145c0 79-49 144-110 144z m477 0c-61 0-110-65-110-144 0-80 49-145 110-145 60 0 110 65 110 145 0 79-50 144-110 144z m-244-599c-165 0-331-62-461-184l-3-3c-6-5-11-10-14-14-21-21-21-55-1-76 21-21 54-21 75-1l12 12 3 3c111 105 254 157 396 155 143-1 285-56 396-165 4-4 8-8 12-12 20-21 54-21 74-1 21 21 21 55 1 77-5 5-9 10-14 14-131 129-299 194-468 195-3 0-6 0-8 0z" horiz-adv-x="999" />
18
+
19
+ <glyph glyph-name="mail" unicode="&#xe805;" d="M929 11v428q-18-20-39-36-149-115-238-189-28-24-46-37t-48-28-57-13h-2q-26 0-57 13t-48 28-46 37q-88 74-238 189-21 16-39 36v-428q0-7 6-13t12-5h822q7 0 12 5t6 13z m0 586v14t-1 7-1 7-3 5-5 4-8 2h-822q-7 0-12-6t-6-12q0-94 83-159 107-84 223-176 4-3 20-17t25-21 25-17 28-16 24-5h2q11 0 24 5t28 16 25 17 25 21 20 17q116 92 224 176 30 24 56 65t26 73z m71 21v-607q0-37-26-63t-63-27h-822q-36 0-63 27t-26 63v607q0 37 26 63t63 26h822q37 0 63-26t26-63z" horiz-adv-x="1000" />
20
+
21
+ <glyph glyph-name="info-circled" unicode="&#xe806;" d="M571 82v89q0 8-5 13t-12 5h-54v286q0 8-5 13t-13 5h-178q-8 0-13-5t-5-13v-89q0-8 5-13t13-5h53v-179h-53q-8 0-13-5t-5-13v-89q0-8 5-13t13-5h250q7 0 12 5t5 13z m-71 500v89q0 8-5 13t-13 5h-107q-8 0-13-5t-5-13v-89q0-8 5-13t13-5h107q8 0 13 5t5 13z m357-232q0-117-57-215t-156-156-215-58-216 58-155 156-58 215 58 215 155 156 216 58 215-58 156-156 57-215z" horiz-adv-x="857.1" />
22
+
23
+ <glyph glyph-name="help-circled" unicode="&#xe807;" d="M500 82v107q0 8-5 13t-13 5h-107q-8 0-13-5t-5-13v-107q0-8 5-13t13-5h107q8 0 13 5t5 13z m143 375q0 49-31 91t-77 65-95 23q-136 0-207-119-9-13 4-24l74-55q4-4 10-4 9 0 14 7 30 38 48 51 19 14 48 14 27 0 48-15t21-33q0-21-11-34t-38-25q-35-15-65-48t-29-70v-20q0-8 5-13t13-5h107q8 0 13 5t5 13q0 10 12 27t30 28q18 10 28 16t25 19 25 27 16 34 7 45z m214-107q0-117-57-215t-156-156-215-58-216 58-155 156-58 215 58 215 155 156 216 58 215-58 156-156 57-215z" horiz-adv-x="857.1" />
24
+
25
+ <glyph glyph-name="heart" unicode="&#xe808;" d="M500-79q-14 0-25 10l-348 336q-5 5-15 15t-31 37-38 54-30 67-13 77q0 123 71 192t196 70q34 0 70-12t67-33 54-38 42-38q20 20 42 38t54 38 67 33 70 12q125 0 196-70t71-192q0-123-128-251l-347-335q-10-10-25-10z" horiz-adv-x="1000" />
26
+
27
+ <glyph glyph-name="heart-empty" unicode="&#xe809;" d="M929 517q0 46-12 80t-31 55-46 33-52 18-55 4-62-14-62-36-48-40-34-34q-10-13-27-13t-27 13q-14 15-34 34t-48 40-62 36-62 14-55-4-52-18-46-33-31-55-12-80q0-93 105-198l324-312 324 312q105 105 105 198z m71 0q0-123-128-251l-347-335q-10-10-25-10t-25 10l-348 336q-5 5-15 15t-31 37-38 54-30 67-13 77q0 123 71 192t196 70q34 0 70-12t67-33 54-38 42-38q20 20 42 38t54 38 67 33 70 12q125 0 196-70t71-192z" horiz-adv-x="1000" />
28
+
29
+ <glyph glyph-name="star" unicode="&#xe80a;" d="M929 489q0-12-15-27l-202-197 48-279q0-4 0-12 0-11-6-19t-17-9q-10 0-22 7l-251 132-250-132q-12-7-23-7-11 0-17 9t-6 19q0 4 1 12l48 279-203 197q-14 15-14 27 0 21 31 26l280 40 126 254q11 23 27 23t28-23l125-254 280-40q32-5 32-26z" horiz-adv-x="928.6" />
30
+
31
+ <glyph glyph-name="star-empty" unicode="&#xe80b;" d="M635 290l170 166-235 34-106 213-105-213-236-34 171-166-41-235 211 111 211-111z m294 199q0-12-15-27l-202-197 48-279q0-4 0-12 0-28-23-28-10 0-22 7l-251 132-250-132q-12-7-23-7-11 0-17 9t-6 19q0 4 1 12l48 279-203 197q-14 15-14 27 0 21 31 26l280 40 126 254q11 23 27 23t28-23l125-254 280-40q32-5 32-26z" horiz-adv-x="928.6" />
32
+
33
+ <glyph glyph-name="user" unicode="&#xe80c;" d="M714 69q0-60-35-104t-84-44h-476q-49 0-84 44t-35 104q0 48 5 90t17 85 33 73 52 50 76 19q73-72 174-72t175 72q42 0 75-19t52-50 33-73 18-85 4-90z m-143 495q0-88-62-151t-152-63-151 63-63 151 63 152 151 63 152-63 62-152z" horiz-adv-x="714.3" />
34
+
35
+ <glyph glyph-name="users" unicode="&#xe80d;" d="M331 350q-90-3-148-71h-75q-45 0-77 22t-31 66q0 197 69 197 4 0 25-11t54-24 66-12q38 0 75 13-3-21-3-37 0-78 45-143z m598-356q0-66-41-105t-108-39h-488q-68 0-108 39t-41 105q0 30 2 58t8 61 14 61 24 54 35 45 48 30 62 11q6 0 24-12t41-26 59-27 76-12 75 12 60 27 41 26 24 12q34 0 62-11t47-30 35-45 24-54 15-61 8-61 2-58z m-572 713q0-59-42-101t-101-42-101 42-42 101 42 101 101 42 101-42 42-101z m393-214q0-89-63-152t-151-62-152 62-63 152 63 151 152 63 151-63 63-151z m321-126q0-43-31-66t-77-22h-75q-57 68-147 71 45 65 45 143 0 16-3 37 37-13 74-13 33 0 67 12t54 24 24 11q69 0 69-197z m-71 340q0-59-42-101t-101-42-101 42-42 101 42 101 101 42 101-42 42-101z" horiz-adv-x="1071.4" />
36
+
37
+ <glyph glyph-name="th-large" unicode="&#xe80e;" d="M429 279v-215q0-29-22-50t-50-21h-286q-29 0-50 21t-21 50v215q0 29 21 50t50 21h286q29 0 50-21t22-50z m0 428v-214q0-29-22-50t-50-22h-286q-29 0-50 22t-21 50v214q0 29 21 50t50 22h286q29 0 50-22t22-50z m500-428v-215q0-29-22-50t-50-21h-286q-29 0-50 21t-21 50v215q0 29 21 50t50 21h286q29 0 50-21t22-50z m0 428v-214q0-29-22-50t-50-22h-286q-29 0-50 22t-21 50v214q0 29 21 50t50 22h286q29 0 50-22t22-50z" horiz-adv-x="928.6" />
38
+
39
+ <glyph glyph-name="th" unicode="&#xe80f;" d="M286 154v-108q0-22-16-37t-38-16h-178q-23 0-38 16t-16 37v108q0 22 16 38t38 15h178q23 0 38-15t16-38z m0 285v-107q0-22-16-38t-38-15h-178q-23 0-38 15t-16 38v107q0 23 16 38t38 16h178q23 0 38-16t16-38z m357-285v-108q0-22-16-37t-38-16h-178q-23 0-38 16t-16 37v108q0 22 16 38t38 15h178q23 0 38-15t16-38z m-357 571v-107q0-22-16-38t-38-16h-178q-23 0-38 16t-16 38v107q0 22 16 38t38 16h178q23 0 38-16t16-38z m357-286v-107q0-22-16-38t-38-15h-178q-23 0-38 15t-16 38v107q0 23 16 38t38 16h178q23 0 38-16t16-38z m357-285v-108q0-22-16-37t-38-16h-178q-22 0-38 16t-16 37v108q0 22 16 38t38 15h178q23 0 38-15t16-38z m-357 571v-107q0-22-16-38t-38-16h-178q-23 0-38 16t-16 38v107q0 22 16 38t38 16h178q23 0 38-16t16-38z m357-286v-107q0-22-16-38t-38-15h-178q-22 0-38 15t-16 38v107q0 23 16 38t38 16h178q23 0 38-16t16-38z m0 286v-107q0-22-16-38t-38-16h-178q-22 0-38 16t-16 38v107q0 22 16 38t38 16h178q23 0 38-16t16-38z" horiz-adv-x="1000" />
40
+
41
+ <glyph glyph-name="th-list" unicode="&#xe810;" d="M286 154v-108q0-22-16-37t-38-16h-178q-23 0-38 16t-16 37v108q0 22 16 38t38 15h178q23 0 38-15t16-38z m0 285v-107q0-22-16-38t-38-15h-178q-23 0-38 15t-16 38v107q0 23 16 38t38 16h178q23 0 38-16t16-38z m714-285v-108q0-22-16-37t-38-16h-535q-23 0-38 16t-16 37v108q0 22 16 38t38 15h535q23 0 38-15t16-38z m-714 571v-107q0-22-16-38t-38-16h-178q-23 0-38 16t-16 38v107q0 22 16 38t38 16h178q23 0 38-16t16-38z m714-286v-107q0-22-16-38t-38-15h-535q-23 0-38 15t-16 38v107q0 23 16 38t38 16h535q23 0 38-16t16-38z m0 286v-107q0-22-16-38t-38-16h-535q-23 0-38 16t-16 38v107q0 22 16 38t38 16h535q23 0 38-16t16-38z" horiz-adv-x="1000" />
42
+
43
+ <glyph glyph-name="to-end" unicode="&#xe811;" d="M25-71q-10-11-18-8t-7 18v822q0 14 7 18t18-8l396-396q5-5 8-10v378q0 14 10 25t25 11h72q14 0 25-11t10-25v-786q0-14-10-25t-25-11h-72q-14 0-25 11t-10 25v379q-3-6-8-11z" horiz-adv-x="571.4" />
44
+
45
+ <glyph glyph-name="to-start" unicode="&#xe812;" d="M546 771q11 11 18 8t7-18v-822q0-14-7-18t-18 8l-396 396q-5 5-7 11v-379q0-14-11-25t-25-11h-71q-15 0-25 11t-11 25v786q0 14 11 25t25 11h71q15 0 25-11t11-25v-378q2 5 7 10z" horiz-adv-x="571.4" />
46
+
47
+ <glyph glyph-name="fast-fw" unicode="&#xe813;" d="M25-71q-10-11-18-8t-7 18v822q0 14 7 18t18-8l396-396q5-5 8-10v396q0 14 7 18t18-8l396-396q11-10 11-25t-11-25l-396-396q-11-11-18-8t-7 18v397q-3-6-8-11z" horiz-adv-x="928.6" />
48
+
49
+ <glyph glyph-name="fast-bw" unicode="&#xe814;" d="M904 771q10 11 17 8t8-18v-822q0-14-8-18t-17 8l-397 396q-5 5-7 11v-397q0-14-7-18t-18 8l-396 396q-11 11-11 25t11 25l396 396q11 11 18 8t7-18v-396q2 5 7 10z" horiz-adv-x="928.6" />
50
+
51
+ <glyph glyph-name="off" unicode="&#xe815;" d="M857 350q0-87-34-166t-91-137-137-92-166-34-167 34-136 92-92 137-34 166q0 102 45 191t126 151q24 18 54 14t46-28q18-23 14-53t-28-47q-54-41-84-101t-30-127q0-58 23-111t61-91 91-61 111-23 110 23 92 61 61 91 22 111q0 68-30 127t-84 101q-23 18-28 47t14 53q17 24 47 28t53-14q81-61 126-151t45-191z m-357 429v-358q0-29-21-50t-50-21-51 21-21 50v358q0 29 21 50t51 21 50-21 21-50z" horiz-adv-x="857.1" />
52
+
53
+ <glyph glyph-name="chart-bar" unicode="&#xe816;" d="M357 350v-286h-143v286h143z m214 286v-572h-142v572h142z m572-643v-72h-1143v858h71v-786h1072z m-357 500v-429h-143v429h143z m214 214v-643h-143v643h143z" horiz-adv-x="1142.9" />
54
+
55
+ <glyph glyph-name="home" unicode="&#xe817;" d="M786 296v-267q0-15-11-25t-25-11h-214v214h-143v-214h-214q-15 0-25 11t-11 25v267q0 1 0 2t0 2l321 264 321-264q1-1 1-4z m124 39l-34-41q-5-5-12-6h-2q-7 0-12 3l-386 322-386-322q-7-4-13-3-7 1-12 6l-35 41q-4 6-3 13t6 12l401 334q18 15 42 15t43-15l136-113v108q0 8 5 13t13 5h107q8 0 13-5t5-13v-227l122-102q6-4 6-12t-4-13z" horiz-adv-x="928.6" />
56
+
57
+ <glyph glyph-name="link-1" unicode="&#xe818;" d="M813 171q0 23-16 38l-116 116q-16 16-38 16-24 0-40-18 1-1 10-10t12-12 9-11 7-14 2-15q0-23-16-38t-38-16q-8 0-15 2t-14 7-11 9-12 12-10 10q-19-17-19-40 0-23 16-38l115-116q15-15 38-15 22 0 38 15l82 81q16 16 16 37z m-393 394q0 22-15 38l-115 115q-16 16-38 16-22 0-38-15l-82-82q-16-15-16-37 0-22 16-38l116-116q15-15 38-15 23 0 40 17-2 2-11 11t-12 12-8 10-7 14-2 16q0 22 15 38t38 15q9 0 16-2t14-7 11-8 12-12 10-11q18 17 18 41z m500-394q0-66-48-113l-82-81q-46-47-113-47-68 0-114 48l-115 115q-46 47-46 114 0 68 49 116l-49 49q-48-49-116-49-67 0-114 47l-116 116q-47 47-47 114t47 113l82 82q47 46 114 46 67 0 114-47l115-116q46-46 46-113 0-69-49-117l49-49q48 49 116 49 67 0 114-47l116-116q47-47 47-114z" horiz-adv-x="928.6" />
58
+
59
+ <glyph glyph-name="lock-open" unicode="&#xe819;" d="M929 529v-143q0-15-11-25t-25-11h-36q-14 0-25 11t-11 25v143q0 59-41 101t-101 41-101-41-42-101v-108h53q23 0 38-15t16-38v-322q0-22-16-37t-38-16h-535q-23 0-38 16t-16 37v322q0 22 16 38t38 15h375v108q0 103 73 176t177 74 176-74 74-176z" horiz-adv-x="928.6" />
60
+
61
+ <glyph glyph-name="eye" unicode="&#xe81a;" d="M929 314q-85 132-213 197 34-58 34-125 0-103-73-177t-177-73-177 73-73 177q0 67 34 125-128-65-213-197 75-114 187-182t242-68 243 68 186 182z m-402 215q0 11-8 19t-19 7q-70 0-120-50t-50-119q0-11 8-19t19-8 19 8 8 19q0 48 34 82t82 34q11 0 19 8t8 19z m473-215q0-19-11-38-78-129-210-206t-279-77-279 77-210 206q-11 19-11 38t11 39q78 128 210 205t279 78 279-78 210-205q11-20 11-39z" horiz-adv-x="1000" />
62
+
63
+ <glyph glyph-name="eye-off" unicode="&#xe81b;" d="M310 105l43 79q-48 35-76 88t-27 114q0 67 34 125-128-65-213-197 94-144 239-209z m217 424q0 11-8 19t-19 7q-70 0-120-50t-50-119q0-11 8-19t19-8 19 8 8 19q0 48 34 82t82 34q11 0 19 8t8 19z m202 106q0-4 0-5-59-105-176-316t-176-316l-28-50q-5-9-15-9-7 0-75 39-9 6-9 16 0 7 25 49-80 36-147 96t-117 137q-11 17-11 38t11 39q86 131 212 207t277 76q50 0 100-10l31 54q5 9 15 9 3 0 10-3t18-9 18-10 18-10 10-7q9-5 9-15z m21-249q0-78-44-142t-117-91l157 280q4-25 4-47z m250-72q0-19-11-38-22-36-61-81-84-96-194-149t-234-53l41 74q119 10 219 76t169 171q-65 100-158 164l35 63q53-36 102-85t81-103q11-19 11-39z" horiz-adv-x="1000" />
64
+
65
+ <glyph glyph-name="download-1" unicode="&#xe81c;" d="M714 100q0 15-10 25t-25 11-25-11-11-25 11-25 25-11 25 11 10 25z m143 0q0 15-10 25t-26 11-25-11-10-25 10-25 25-11 26 11 10 25z m72 125v-179q0-22-16-37t-38-16h-821q-23 0-38 16t-16 37v179q0 22 16 38t38 16h259l75-76q33-32 76-32t76 32l76 76h259q22 0 38-16t16-38z m-182 318q10-23-8-39l-250-250q-10-11-25-11t-25 11l-250 250q-17 16-8 39 10 21 33 21h143v250q0 15 11 25t25 11h143q14 0 25-11t10-25v-250h143q24 0 33-21z" horiz-adv-x="928.6" />
66
+
67
+ <glyph glyph-name="chat" unicode="&#xe81d;" d="M786 421q0-77-53-143t-143-104-197-38q-48 0-98 9-70-49-155-72-21-5-48-9h-2q-6 0-12 5t-6 12q-1 1-1 3t1 4 1 3l1 3t2 3 2 3 3 3 2 2q3 3 13 14t15 16 12 17 14 21 11 25q-69 40-108 98t-40 125q0 78 53 144t143 104 197 38 197-38 143-104 53-144z m214-142q0-67-40-126t-108-98q5-14 11-25t14-21 13-16 14-17 13-14q0 0 2-2t3-3 2-3 2-3l1-3t1-3 1-4-1-3q-2-8-7-13t-12-4q-28 4-48 9-86 23-156 72-50-9-98-9-151 0-263 74 32-3 49-3 90 0 172 25t148 72q69 52 107 119t37 141q0 43-13 85 72-39 114-99t42-128z" horiz-adv-x="1000" />
68
+
69
+ <glyph glyph-name="comment" unicode="&#xe81e;" d="M1000 350q0-97-67-179t-182-130-251-48q-39 0-81 4-110-97-257-135-27-8-63-12-10-1-17 5t-10 16v1q-2 2 0 6t1 6 2 5l4 5t4 5 4 5q4 5 17 19t20 22 17 22 18 28 15 33 15 42q-88 50-138 123t-51 157q0 73 40 139t106 114 160 76 194 28q136 0 251-48t182-130 67-179z" horiz-adv-x="1000" />
70
+
71
+ <glyph glyph-name="doc" unicode="&#xe81f;" d="M819 638q16-16 27-42t11-50v-642q0-23-15-38t-38-16h-750q-23 0-38 16t-16 38v892q0 23 16 38t38 16h500q22 0 49-11t42-27z m-248 136v-210h210q-5 17-12 23l-175 175q-6 7-23 12z m215-853v572h-232q-23 0-38 16t-16 37v233h-429v-858h715z" horiz-adv-x="857.1" />
72
+
73
+ <glyph glyph-name="lock" unicode="&#xe820;" d="M179 421h285v108q0 59-42 101t-101 41-101-41-41-101v-108z m464-53v-322q0-22-16-37t-38-16h-535q-23 0-38 16t-16 37v322q0 22 16 38t38 15h17v108q0 102 74 176t176 74 177-74 73-176v-108h18q23 0 38-15t16-38z" horiz-adv-x="642.9" />
74
+
75
+ <glyph glyph-name="emo-wink2" unicode="&#xe821;" d="M664 800c-61 0-110-65-110-144 0-80 49-145 110-145 60 0 110 65 110 145 0 79-50 144-110 144z m-343-98l-267 0c-30 0-54-24-54-54 0-30 24-54 54-54l267 0c30 0 54 24 54 54 0 30-24 54-54 54z m-262-361c-6 0-13-1-19-3-27-10-41-41-31-68 46-127 136-228 249-289 22-12 45-22 69-31 58-21 120-33 184-33 57 0 113 9 166 27 10 3 20 7 30 11 11 4 22 8 31 12l0 1 0 0 0 0c26 12 38 44 25 71-13 26-44 37-70 25l0 0c-9-4-17-8-24-11-8-3-17-6-25-8-43-14-88-22-133-22-51 0-101 10-148 27-19 7-37 15-55 25-90 48-163 130-200 231-8 21-28 35-49 35z" horiz-adv-x="774" />
76
+
77
+ <glyph glyph-name="plus" unicode="&#xe822;" d="M786 439v-107q0-22-16-38t-38-15h-232v-233q0-22-16-37t-38-16h-107q-22 0-38 16t-15 37v233h-232q-23 0-38 15t-16 38v107q0 23 16 38t38 16h232v232q0 22 15 38t38 16h107q23 0 38-16t16-38v-232h232q23 0 38-16t16-38z" horiz-adv-x="785.7" />
78
+
79
+ <glyph glyph-name="upload" unicode="&#xe823;" d="M936 128l2-260q0-21-16-37t-37-15l-832 0q-22 0-37 15t-16 37q0 260 1 260 0 12 2 17l105 312q12 36 48 36l209 0 0-103-171 0-86-262 722 0-86 262-171 0 0 103 208 0q37 0 49-36l105-312q1-5 1-17z m-258 423q-24 0-38 14l-119 120 0-348q0-21-15-37t-37-15-37 15-16 37l0 348-118-120q-14-14-38-14-22 0-36 14-15 15-15 36t15 37l245 247 245-247q15-15 15-37t-15-36q-14-14-36-14z" horiz-adv-x="938" />
80
+
81
+ <glyph glyph-name="picture" unicode="&#xe824;" d="M357 529q0-45-31-76t-76-32-76 32-31 76 31 76 76 31 76-31 31-76z m572-215v-250h-786v107l178 179 90-89 285 285z m53 393h-893q-7 0-12-5t-6-13v-678q0-7 6-13t12-5h893q7 0 13 5t5 13v678q0 8-5 13t-13 5z m89-18v-678q0-37-26-63t-63-27h-893q-36 0-63 27t-26 63v678q0 37 26 63t63 27h893q37 0 63-27t26-63z" horiz-adv-x="1071.4" />
82
+
83
+ <glyph glyph-name="ok" unicode="&#xe825;" d="M933 534q0-22-16-38l-404-404-76-76q-16-15-38-15t-38 15l-76 76-202 202q-15 16-15 38t15 38l76 76q16 16 38 16t38-16l164-165 366 367q16 16 38 16t38-16l76-76q16-15 16-38z" horiz-adv-x="1000" />
84
+
85
+ <glyph glyph-name="cancel" unicode="&#xe826;" d="M724 112q0-22-15-38l-76-76q-16-15-38-15t-38 15l-164 165-164-165q-16-15-38-15t-38 15l-76 76q-16 16-16 38t16 38l164 164-164 164q-16 16-16 38t16 38l76 76q16 16 38 16t38-16l164-164 164 164q16 16 38 16t38-16l76-76q15-15 15-38t-15-38l-164-164 164-164q15-15 15-38z" horiz-adv-x="785.7" />
86
+
87
+ <glyph glyph-name="pencil" unicode="&#xe827;" d="M203-7l50 51-131 131-51-51v-60h72v-71h60z m291 518q0 12-12 12-5 0-9-4l-303-302q-4-4-4-10 0-12 13-12 5 0 9 4l303 302q3 4 3 10z m-30 107l232-232-464-465h-232v233z m381-54q0-29-20-50l-93-93-232 233 93 92q20 21 50 21 29 0 51-21l131-131q20-22 20-51z" horiz-adv-x="857.1" />
88
+
89
+ <glyph glyph-name="edit" unicode="&#xe828;" d="M496 189l64 65-85 85-64-65v-31h53v-54h32z m245 402q-9 9-18 0l-196-196q-9-9 0-18t18 0l196 196q9 9 0 18z m45-331v-106q0-67-47-114t-114-47h-464q-67 0-114 47t-47 114v464q0 66 47 113t114 48h464q35 0 65-14 9-4 10-13 2-10-5-16l-27-28q-8-8-18-4-13 3-25 3h-464q-37 0-63-26t-27-63v-464q0-37 27-63t63-27h464q37 0 63 27t26 63v70q0 7 5 12l36 36q8 8 20 4t11-16z m-54 411l161-160-375-375h-161v160z m248-73l-51-52-161 161 51 52q16 15 38 15t38-15l85-85q16-16 16-38t-16-38z" horiz-adv-x="1000" />
90
+
91
+ <glyph glyph-name="forward" unicode="&#xe829;" d="M1000 493q0-15-11-25l-285-286q-11-11-25-11t-25 11-11 25v143h-125q-55 0-98-3t-86-12-74-24-59-39-45-56-27-77-10-101q0-31 3-69 0-4 2-13t1-15q0-8-5-14t-13-6q-9 0-15 10-4 5-8 12t-7 17-6 13q-71 159-71 252 0 111 30 186 90 225 488 225h125v143q0 14 11 25t25 10 25-10l285-286q11-11 11-25z" horiz-adv-x="1000" />
92
+
93
+ <glyph glyph-name="export" unicode="&#xe82a;" d="M750 60l0 56 100 82 0-188q0-20-15-35t-35-15l-750 0q-20 0-35 15t-15 35l0 550q0 22 14 36t36 14l288 0q-32-24-59-49t-39-39l-10-12-130 0 0-450 650 0z m-82 348q-166 0-242-41t-160-181q0 8 1 22t9 56 22 79 44 83 70 79 107 56 149 23l0 156 332-250-332-260 0 178z" horiz-adv-x="1000" />
94
+
95
+ <glyph glyph-name="trash-empty" unicode="&#xe82b;" d="M286 439v-321q0-8-5-13t-13-5h-36q-8 0-13 5t-5 13v321q0 8 5 13t13 5h36q8 0 13-5t5-13z m143 0v-321q0-8-5-13t-13-5h-36q-8 0-13 5t-5 13v321q0 8 5 13t13 5h36q8 0 13-5t5-13z m142 0v-321q0-8-5-13t-12-5h-36q-8 0-13 5t-5 13v321q0 8 5 13t13 5h36q7 0 12-5t5-13z m72-404v529h-500v-529q0-12 4-22t8-15 6-5h464q2 0 6 5t8 15 4 22z m-375 601h250l-27 65q-4 5-9 6h-177q-6-1-10-6z m518-18v-36q0-8-5-13t-13-5h-54v-529q0-46-26-80t-63-34h-464q-37 0-63 33t-27 79v531h-53q-8 0-13 5t-5 13v36q0 8 5 13t13 5h172l39 93q9 21 31 35t44 15h178q23 0 44-15t30-35l39-93h173q8 0 13-5t5-13z" horiz-adv-x="785.7" />
96
+
97
+ <glyph glyph-name="down-dir" unicode="&#xe82c;" d="M571 457q0-14-10-25l-250-250q-11-11-25-11t-25 11l-250 250q-11 11-11 25t11 25 25 11h500q14 0 25-11t10-25z" horiz-adv-x="571.4" />
98
+
99
+ <glyph glyph-name="up-dir" unicode="&#xe82d;" d="M571 171q0-14-10-25t-25-10h-500q-15 0-25 10t-11 25 11 26l250 250q10 10 25 10t25-10l250-250q10-11 10-26z" horiz-adv-x="571.4" />
100
+
101
+ <glyph glyph-name="left-dir" unicode="&#xe82e;" d="M357 600v-500q0-14-10-25t-26-11-25 11l-250 250q-10 11-10 25t10 25l250 250q11 11 25 11t26-11 10-25z" horiz-adv-x="357.1" />
102
+
103
+ <glyph glyph-name="right-dir" unicode="&#xe82f;" d="M321 350q0-14-10-25l-250-250q-11-11-25-11t-25 11-11 25v500q0 15 11 25t25 11 25-11l250-250q10-10 10-25z" horiz-adv-x="357.1" />
104
+
105
+ <glyph glyph-name="spin1" unicode="&#xe830;" d="M496 850c-176 0-331-90-421-226-18-27-33-55-46-85-12-29-21-60-28-92 0 0 0-1 0-1l0 0 0 0c0-1 0-2 0-2 0-7 5-12 11-12l101 0c5 0 10 4 11 9 29 113 109 206 214 253 20 10 41 17 63 23 31 7 62 11 95 11l0 0 0 0 0 0c25 0 50-2 74-7 5-1 10-2 14-3 6-1 10-3 14-4l0 0c5-1 11 1 13 6l51 87c0 0 1 1 1 2 2 6-1 13-7 15-22 7-43 13-65 17-5 1-9 1-13 2-27 5-54 7-82 7l0 0 0 0z m327-114c-5 0-9-2-11-6l-50-87c-3-4-2-10 2-14 29-29 54-63 73-101 4-7 7-14 11-22 19-46 30-97 30-151l0 0 0 0c0-77-22-149-62-209-7-11-15-23-24-33-9-11-18-21-28-31l0 0 0 0 0 0c-4-4-5-10-2-14l50-87c0-1 1-2 2-3 4-5 11-5 16-1 58 52 104 117 134 190 6 15 11 29 15 44 14 46 21 94 21 144 0 108-34 209-92 291-11 16-23 31-37 46-13 14-26 28-41 41l0 0c-1 1-1 1-2 1-2 1-4 2-5 2z m-811-468l0 0c-1 0-2 0-3 0-6-1-10-8-9-14 34-166 149-302 302-366 30-12 61-21 93-28 32-6 66-10 100-10l0 0 0 0c40 0 79 5 117 14 7 1 14 3 22 5 6 2 13 5 20 7 1 0 2 1 3 1 6 3 8 10 4 16l-50 87c-3 5-8 7-13 6-14-4-28-7-42-9-3-1-6-1-8-2-18-2-35-3-53-3l0 0 0 0c-128 0-242 63-311 160-1 0-1 0-1 0-13 19-25 40-35 61-10 21-18 43-24 65-1 6-6 10-11 10l-101 0z" horiz-adv-x="1000" />
106
+
107
+ <glyph glyph-name="spin2" unicode="&#xe831;" d="M46 144l0 0c0 0-1 0-1 0-8 18-15 37-21 55-6 19-11 38-15 58-19 99-8 203 35 298 3 6 10 8 15 5 1 0 2 0 2-1l0 0 80-59c5-3 6-9 4-14-5-12-9-25-12-37-4-13-7-26-9-40-11-67-3-137 23-201 2-5 0-10-4-13l0 0-80-56c-5-4-12-2-16 3-1 0-1 1-1 2l0 0z m120 574l0 0c0 1 0 1 0 1 15 13 30 25 46 37 16 11 33 22 51 31 89 50 192 72 297 60 6-1 10-6 10-13 0-1-1-1-1-2l0 0-31-94c-2-5-8-8-13-7-13 0-27 0-40 0-14-1-27-2-40-4-68-11-133-40-186-84-4-3-10-3-14 0l0 0-79 58c-5 3-6 11-2 16 0 0 1 1 2 1l0 0z m588 65l0 0c0 0 1 0 1 0 17-10 34-21 50-32 16-12 31-25 46-38 74-69 127-160 148-262 2-6-2-12-9-13-1 0-1 0-2 0l0 0-100 1c-5 0-10 4-11 9-3 13-8 26-12 38-5 12-10 25-17 36-31 61-78 113-137 150-5 3-6 8-5 13l0 0 31 92c2 6 9 9 15 7 1 0 2-1 2-1l0 0z m244-535l0 0c0 0 0 0 0 0-4-20-9-39-15-57-7-19-14-37-22-55-44-92-114-170-205-221-6-3-13-1-16 4 0 1-1 2-1 2l0 0-30 94c-2 6 1 12 6 14 11 7 22 15 32 23 11 9 21 18 30 27 49 48 84 109 101 176 2 5 6 8 11 8l0 0 98-1c6 0 11-5 11-11 0-1 0-2 0-3l0 0z m-438-395l0 0c0 0 0 0 0 0-20-2-40-3-60-3-20 0-40 1-59 4-102 12-198 54-276 125-5 4-5 11 0 16 0 0 1 1 1 1l0 0 81 58c5 3 12 2 16-2 10-8 20-16 32-23 11-7 22-14 34-20 62-31 131-45 200-41 6 0 10-3 12-8l0 0 29-92c2-6-1-12-7-14-1-1-2-1-3-1l0 0z" horiz-adv-x="1000" />
108
+
109
+ <glyph glyph-name="mobile" unicode="&#xe832;" d="M480 840q42 0 71-29t29-71l0-780q0-40-29-70t-71-30l-380 0q-40 0-70 30t-30 70l0 780q0 42 30 71t70 29l380 0z m-190-940q30 0 50 15t20 35q0 22-20 36t-50 14q-28 0-49-15t-21-35 21-35 49-15z m210 150l0 660-420 0 0-660 420 0z" horiz-adv-x="580" />
110
+
111
+ <glyph glyph-name="bell" unicode="&#xe833;" d="M509-96q0 8-9 8-33 0-57 24t-23 57q0 9-9 9t-9-9q0-41 29-70t69-28q9 0 9 9z m-372 160h726q-149 168-149 465 0 28-13 58t-39 58-67 45-95 17-95-17-67-45-39-58-13-58q0-297-149-465z m827 0q0-29-21-50t-50-21h-250q0-59-42-101t-101-42-101 42-42 101h-250q-29 0-50 21t-21 50q28 24 51 49t47 67 42 89 27 115 11 145q0 84 66 157t171 89q-5 10-5 21 0 23 16 38t38 16 38-16 16-38q0-11-5-21 106-16 171-89t66-157q0-78 11-145t28-115 41-89 48-67 50-49z" horiz-adv-x="1000" />
112
+
113
+ <glyph glyph-name="ccw" unicode="&#xe834;" d="M857 350q0-87-34-166t-91-137-137-92-166-34q-96 0-183 41t-147 114q-4 6-4 13t5 11l76 77q6 5 14 5 9-1 13-7 41-53 100-82t126-29q58 0 110 23t92 61 61 91 22 111-22 111-61 91-92 61-110 23q-55 0-105-20t-90-57l77-77q17-16 8-38-10-23-33-23h-250q-15 0-25 11t-11 25v250q0 24 22 33 22 10 39-8l72-72q60 57 137 88t159 31q87 0 166-34t137-92 91-137 34-166z" horiz-adv-x="857.1" />
114
+
115
+ <glyph glyph-name="wrench" unicode="&#xe835;" d="M214 29q0 14-10 25t-25 10-25-10-11-25 11-25 25-11 25 11 10 25z m360 234l-381-381q-21-20-50-20-29 0-51 20l-59 61q-21 20-21 50 0 29 21 51l380 380q22-55 64-97t97-64z m354 243q0-22-13-59-27-75-92-122t-144-46q-104 0-177 73t-73 177 73 176 177 74q32 0 67-10t60-26q9-6 9-15t-9-16l-163-94v-125l108-60q2 2 44 27t75 45 40 20q8 0 13-5t5-14z" horiz-adv-x="928.6" />
116
+
117
+ <glyph glyph-name="stop-1" unicode="&#xe837;" d="M857 743v-786q0-14-10-25t-26-11h-785q-15 0-25 11t-11 25v786q0 14 11 25t25 11h785q15 0 26-11t10-25z" horiz-adv-x="857.1" />
118
+
119
+ <glyph glyph-name="spin5" unicode="&#xe838;" d="M462 850c-6 0-11-5-11-11l0-183 0 0c0-6 5-11 11-11l69 0c1 0 1 0 1 0 7 0 12 5 12 11l0 183 0 0c0 6-5 11-12 11l-69 0c0 0 0 0-1 0z m250-47c-4 1-8-2-10-5l-91-158 0 0c-4-6-2-13 4-16l60-34c0-1 0-1 0-1 6-3 13-1 16 4l91 158c3 6 2 13-4 16l-61 35c-1 1-3 1-5 1z m-428-2c-2 0-4-1-6-2l-61-35c-5-3-7-10-4-16l91-157c0 0 0 0 0 0 3-6 10-8 16-5l61 35c5 4 7 11 4 16l-91 157c0 1 0 1 0 1-2 4-6 6-10 6z m620-163c-2 0-4 0-6-1l-157-91c0 0 0 0 0 0-6-3-8-10-5-16l35-61c4-5 11-7 16-4l157 91c1 0 1 0 1 0 6 3 7 11 4 16l-35 61c-2 4-6 6-10 5z m-810-4c-5 0-9-2-11-6l-35-61c-3-5-1-12 4-15l158-91 0 0c6-4 13-2 16 4l35 60c0 0 0 0 0 0 3 6 1 13-4 16l-158 91c-2 1-4 2-5 2z m712-235l0 0c-6 0-11-5-11-11l0-69c0-1 0-1 0-1 0-7 5-12 11-12l183 0 0 0c6 0 11 5 11 12l0 69c0 0 0 0 0 1 0 6-5 11-11 11l-183 0z m-794-5l0 0c-7 0-12-5-12-12l0-69c0 0 0 0 0-1 0-6 5-11 12-11l182 0 0 0c6 0 11 5 11 11l0 69c0 1 0 1 0 1 0 7-5 12-11 12l-182 0z m772-153c-4 0-8-2-10-6l-34-60c-1 0-1 0-1 0-3-6-1-13 4-16l158-91c6-3 13-1 16 4l35 61c3 5 1 12-4 15l-158 92 0 0c-2 1-4 1-6 1z m-566-5c-1 0-3 0-5-1l-157-91c0 0-1 0-1 0-5-3-7-10-4-16l35-61c3-5 10-7 16-4l157 91c0 0 0 0 0 0 6 3 8 10 5 16l-35 61c-3 3-7 6-11 5z m468-121c-2 0-4 0-6-1l-61-35c-5-4-7-11-4-16l91-157c0-1 0-1 0-1 3-6 11-7 16-4l61 35c5 3 7 10 4 16l-91 157c0 0 0 0 0 0-2 4-6 6-10 6z m-367-2c-4 0-8-2-10-6l-91-158c-3-6-1-13 4-16l61-35c5-3 12-1 15 4l92 158 0 0c3 6 1 13-5 16l-60 35c0 0 0 0 0 0-2 1-4 1-6 2z m149-58c-7 0-12-5-12-11l0-183 0 0c0-6 5-11 12-11l69 0c0 0 0 0 1 0 6 0 11 5 11 11l0 183 0 0c0 6-5 11-11 11l-69 0c-1 0-1 0-1 0z" horiz-adv-x="1000" />
120
+
121
+ <glyph glyph-name="pause-1" unicode="&#xe839;" d="M857 743v-786q0-14-10-25t-26-11h-285q-15 0-25 11t-11 25v786q0 14 11 25t25 11h285q15 0 26-11t10-25z m-500 0v-786q0-14-10-25t-26-11h-285q-15 0-25 11t-11 25v786q0 14 11 25t25 11h285q15 0 26-11t10-25z" horiz-adv-x="857.1" />
122
+
123
+ <glyph glyph-name="play-1" unicode="&#xe83a;" d="M772 333l-741-412q-13-7-22-2t-9 20v822q0 14 9 20t22-2l741-412q13-7 13-17t-13-17z" horiz-adv-x="785.7" />
124
+
125
+ <glyph glyph-name="link-ext" unicode="&#xf08e;" d="M786 332v-178q0-67-47-114t-114-47h-464q-67 0-114 47t-47 114v464q0 66 47 113t114 48h393q7 0 12-5t5-13v-36q0-8-5-13t-12-5h-393q-37 0-63-26t-27-63v-464q0-37 27-63t63-27h464q37 0 63 27t26 63v178q0 8 5 13t13 5h36q8 0 13-5t5-13z m214 482v-285q0-15-11-25t-25-11-25 11l-98 98-364-364q-5-6-13-6t-12 6l-64 64q-6 5-6 12t6 13l364 364-98 98q-11 11-11 25t11 25 25 11h285q15 0 25-11t11-25z" horiz-adv-x="1000" />
126
+
127
+ <glyph glyph-name="menu" unicode="&#xf0c9;" d="M857 100v-71q0-15-10-25t-26-11h-785q-15 0-25 11t-11 25v71q0 15 11 25t25 11h785q15 0 26-11t10-25z m0 286v-72q0-14-10-25t-26-10h-785q-15 0-25 10t-11 25v72q0 14 11 25t25 10h785q15 0 26-10t10-25z m0 285v-71q0-14-10-25t-26-11h-785q-15 0-25 11t-11 25v71q0 15 11 26t25 10h785q15 0 26-10t10-26z" horiz-adv-x="857.1" />
128
+
129
+ <glyph glyph-name="sort" unicode="&#xf0dc;" d="M571 243q0-15-10-25l-250-250q-11-11-25-11t-25 11l-250 250q-11 10-11 25t11 25 25 11h500q14 0 25-11t10-25z m0 214q0-14-10-25t-25-11h-500q-15 0-25 11t-11 25 11 25l250 250q10 11 25 11t25-11l250-250q10-10 10-25z" horiz-adv-x="571.4" />
130
+
131
+ <glyph glyph-name="mail-alt" unicode="&#xf0e0;" d="M1000 454v-443q0-37-26-63t-63-27h-822q-36 0-63 27t-26 63v443q25-27 56-49 202-137 278-192 32-24 51-37t53-27 61-13h2q28 0 61 13t53 27 51 37q95 68 278 192 32 22 56 49z m0 164q0-44-27-84t-68-69q-210-146-262-181-5-4-23-17t-30-22-29-18-32-15-28-5h-2q-12 0-27 5t-32 15-30 18-30 22-23 17q-51 35-147 101t-114 80q-35 23-65 64t-31 77q0 43 23 72t66 29h822q36 0 63-26t26-63z" horiz-adv-x="1000" />
132
+
133
+ <glyph glyph-name="lightbulb" unicode="&#xf0eb;" d="M411 529q0-8-6-13t-12-5-13 5-5 13q0 25-30 39t-59 14q-7 0-13 5t-5 13 5 13 13 5q28 0 55-9t49-30 21-50z m89 0q0 40-19 74t-50 57-69 35-76 12-76-12-69-35-50-57-20-74q0-57 38-101 6-6 17-18t17-19q72-85 79-166h127q8 81 79 166 6 6 17 19t17 18q38 44 38 101z m71 0q0-87-57-150-25-27-42-48t-33-54-19-60q26-15 26-46 0-20-13-35 13-15 13-36 0-29-25-45 8-13 8-26 0-26-18-40t-43-14q-11-25-34-39t-48-15-49 15-33 39q-26 0-44 14t-17 40q0 13 7 26-25 16-25 45 0 21 14 36-14 15-14 35 0 31 26 46-2 28-19 60t-33 54-41 48q-58 63-58 150 0 55 25 103t65 79 92 49 104 19 104-19 91-49 66-79 24-103z" horiz-adv-x="571.4" />
134
+
135
+ <glyph glyph-name="exchange" unicode="&#xf0ec;" d="M1000 189v-107q0-7-5-12t-13-6h-768v-107q0-7-5-12t-13-6q-6 0-13 6l-178 178q-5 6-5 13 0 8 5 13l179 178q5 5 12 5 8 0 13-5t5-13v-107h768q7 0 13-5t5-13z m0 304q0-8-5-13l-179-178q-5-6-12-6-8 0-13 6t-5 12v107h-768q-7 0-13 6t-5 12v107q0 8 5 13t13 5h768v107q0 8 5 13t13 5q6 0 13-5l178-178q5-5 5-13z" horiz-adv-x="1000" />
136
+
137
+ <glyph glyph-name="upload-cloud" unicode="&#xf0ee;" d="M714 368q0 8-5 13l-196 196q-5 5-13 5t-13-5l-196-196q-5-6-5-13 0-8 5-13t13-5h125v-196q0-8 5-13t12-5h108q7 0 12 5t5 13v196h125q8 0 13 5t5 13z m357-161q0-89-62-151t-152-63h-607q-103 0-177 73t-73 177q0 72 39 134t105 92q-1 17-1 24 0 118 84 202t202 84q87 0 159-49t105-129q40 35 93 35 59 0 101-42t42-101q0-43-23-77 72-17 119-76t46-133z" horiz-adv-x="1071.4" />
138
+
139
+ <glyph glyph-name="bell-alt" unicode="&#xf0f3;" d="M509-96q0 8-9 8-33 0-57 24t-23 57q0 9-9 9t-9-9q0-41 29-70t69-28q9 0 9 9z m455 160q0-29-21-50t-50-21h-250q0-59-42-101t-101-42-101 42-42 101h-250q-29 0-50 21t-21 50q28 24 51 49t47 67 42 89 27 115 11 145q0 84 66 157t171 89q-5 10-5 21 0 23 16 38t38 16 38-16 16-38q0-11-5-21 106-16 171-89t66-157q0-78 11-145t28-115 41-89 48-67 50-49z" horiz-adv-x="1000" />
140
+
141
+ <glyph glyph-name="doc-text" unicode="&#xf0f6;" d="M819 638q16-16 27-42t11-50v-642q0-23-15-38t-38-16h-750q-23 0-38 16t-16 38v892q0 23 16 38t38 16h500q22 0 49-11t42-27z m-248 136v-210h210q-5 17-12 23l-175 175q-6 7-23 12z m215-853v572h-232q-23 0-38 16t-16 37v233h-429v-858h715z m-572 483q0 7 5 12t13 5h393q8 0 13-5t5-12v-36q0-8-5-13t-13-5h-393q-8 0-13 5t-5 13v36z m411-125q8 0 13-5t5-13v-36q0-8-5-13t-13-5h-393q-8 0-13 5t-5 13v36q0 8 5 13t13 5h393z m0-143q8 0 13-5t5-13v-36q0-8-5-13t-13-5h-393q-8 0-13 5t-5 13v36q0 8 5 13t13 5h393z" horiz-adv-x="857.1" />
142
+
143
+ <glyph glyph-name="angle-double-left" unicode="&#xf100;" d="M350 82q0-7-6-13l-28-28q-5-5-12-5t-13 5l-260 261q-6 5-6 12t6 13l260 260q5 6 13 6t12-6l28-28q6-5 6-13t-6-12l-219-220 219-219q6-6 6-13z m214 0q0-7-5-13l-28-28q-6-5-13-5t-13 5l-260 261q-6 5-6 12t6 13l260 260q6 6 13 6t13-6l28-28q5-5 5-13t-5-12l-220-220 220-219q5-6 5-13z" horiz-adv-x="571.4" />
144
+
145
+ <glyph glyph-name="angle-double-right" unicode="&#xf101;" d="M332 314q0-7-5-12l-261-261q-5-5-12-5t-13 5l-28 28q-6 6-6 13t6 13l219 219-219 220q-6 5-6 12t6 13l28 28q5 6 13 6t12-6l261-260q5-5 5-13z m214 0q0-7-5-12l-260-261q-6-5-13-5t-13 5l-28 28q-5 6-5 13t5 13l219 219-219 220q-5 5-5 12t5 13l28 28q6 6 13 6t13-6l260-260q5-5 5-13z" horiz-adv-x="571.4" />
146
+
147
+ <glyph glyph-name="angle-double-up" unicode="&#xf102;" d="M600 118q0-7-6-13l-28-28q-5-5-12-5t-13 5l-220 219-219-219q-5-5-13-5t-12 5l-28 28q-6 6-6 13t6 13l260 260q5 5 12 5t13-5l260-260q6-6 6-13z m0 214q0-7-6-13l-28-28q-5-5-12-5t-13 5l-220 220-219-220q-5-5-13-5t-12 5l-28 28q-6 6-6 13t6 13l260 260q5 6 12 6t13-6l260-260q6-6 6-13z" horiz-adv-x="642.9" />
148
+
149
+ <glyph glyph-name="angle-double-down" unicode="&#xf103;" d="M600 368q0-7-6-13l-260-260q-5-6-13-6t-12 6l-260 260q-6 6-6 13t6 13l28 28q5 5 12 5t13-5l219-220 220 220q5 5 13 5t12-5l28-28q6-6 6-13z m0 214q0-7-6-13l-260-260q-5-5-13-5t-12 5l-260 260q-6 6-6 13t6 13l28 28q5 6 12 6t13-6l219-219 220 219q5 6 13 6t12-6l28-28q6-6 6-13z" horiz-adv-x="642.9" />
150
+
151
+ <glyph glyph-name="desktop" unicode="&#xf108;" d="M1000 296v465q0 7-5 12t-13 6h-893q-7 0-12-6t-6-12v-465q0-7 6-12t12-5h893q7 0 13 5t5 12z m71 465v-607q0-37-26-63t-63-27h-303q0-20 9-43t17-40 9-24q0-14-10-25t-25-11h-286q-15 0-25 11t-11 25q0 8 9 25t18 39 9 43h-304q-36 0-63 27t-26 63v607q0 37 26 63t63 26h893q37 0 63-26t26-63z" horiz-adv-x="1071.4" />
152
+
153
+ <glyph glyph-name="laptop" unicode="&#xf109;" d="M232 136q-37 0-63 26t-26 63v393q0 37 26 63t63 26h607q37 0 63-26t27-63v-393q0-37-27-63t-63-26h-607z m-18 482v-393q0-7 6-13t12-5h607q8 0 13 5t5 13v393q0 7-5 12t-13 6h-607q-7 0-12-6t-6-12z m768-518h89v-54q0-22-26-37t-63-16h-893q-36 0-63 16t-26 37v54h982z m-402-54q9 0 9 9t-9 9h-89q-9 0-9-9t9-9h89z" horiz-adv-x="1071.4" />
154
+
155
+ <glyph glyph-name="tablet" unicode="&#xf10a;" d="M357 64q0 15-10 25t-26 11-25-11-10-25 10-25 25-10 26 10 10 25z m214 90v535q0 8-5 13t-12 5h-465q-7 0-12-5t-6-13v-535q0-8 6-13t12-5h465q7 0 12 5t5 13z m72 535v-607q0-37-26-63t-63-26h-465q-36 0-63 26t-26 63v607q0 37 26 63t63 27h465q36 0 63-27t26-63z" horiz-adv-x="642.9" />
156
+
157
+ <glyph glyph-name="circle-empty" unicode="&#xf10c;" d="M429 654q-83 0-153-41t-110-111-41-152 41-152 110-111 153-41 152 41 110 111 41 152-41 152-110 111-152 41z m428-304q0-117-57-215t-156-156-215-58-216 58-155 156-58 215 58 215 155 156 216 58 215-58 156-156 57-215z" horiz-adv-x="857.1" />
158
+
159
+ <glyph glyph-name="circle" unicode="&#xf111;" d="M857 350q0-117-57-215t-156-156-215-58-216 58-155 156-58 215 58 215 155 156 216 58 215-58 156-156 57-215z" horiz-adv-x="857.1" />
160
+
161
+ <glyph glyph-name="unlink" unicode="&#xf127;" d="M245 141l-143-143q-6-5-13-5t-12 5q-6 6-6 13t6 13l142 142q6 5 13 5t13-5q5-5 5-12t-5-13z m94-23v-179q0-8-5-13t-13-5-12 5-5 13v179q0 8 5 13t12 5 13-5 5-13z m-125 125q0-8-5-13t-13-5h-178q-8 0-13 5t-5 13 5 13 13 5h178q8 0 13-5t5-13z m706-72q0-66-48-113l-82-81q-46-47-113-47-68 0-114 48l-186 187q-12 12-24 31l134 10 152-153q15-15 38-15t38 15l82 81q16 16 16 37 0 23-16 38l-153 154 10 133q20-11 31-23l188-188q47-48 47-114z m-345 404l-133-10-152 153q-16 16-38 16-22 0-38-15l-82-82q-16-15-16-37 0-22 16-38l153-153-10-134q-20 12-32 24l-187 187q-47 48-47 114 0 67 47 113l82 82q47 46 114 46 67 0 114-47l186-187q12-12 23-32z m354-46q0-8-5-13t-13-5h-179q-8 0-13 5t-5 13 5 12 13 5h179q8 0 13-5t5-12z m-304 303v-178q0-8-5-13t-13-5-13 5-5 13v178q0 8 5 13t13 5 13-5 5-13z m227-84l-143-143q-6-5-13-5t-12 5q-5 6-5 13t5 13l143 143q5 5 12 5t13-5q5-6 5-13t-5-13z" horiz-adv-x="928.6" />
162
+
163
+ <glyph glyph-name="help" unicode="&#xf128;" d="M393 149v-134q0-9-7-15t-15-7h-134q-9 0-16 7t-7 15v134q0 9 7 16t16 6h134q9 0 15-6t7-16z m176 335q0-30-8-56t-20-43-31-33-32-25-34-19q-23-13-38-37t-15-37q0-10-7-18t-16-9h-134q-8 0-14 11t-6 20v26q0 46 37 87t79 60q33 16 47 32t14 42q0 24-26 41t-60 18q-36 0-60-16-20-14-60-64-7-9-17-9-7 0-14 4l-91 70q-8 6-9 14t3 16q89 148 259 148 45 0 90-17t81-46 59-72 23-88z" horiz-adv-x="571.4" />
164
+
165
+ <glyph glyph-name="info" unicode="&#xf129;" d="M357 100v-71q0-15-10-25t-26-11h-285q-15 0-25 11t-11 25v71q0 15 11 25t25 11h35v214h-35q-15 0-25 11t-11 25v71q0 15 11 25t25 11h214q15 0 25-11t11-25v-321h35q15 0 26-11t10-25z m-71 643v-107q0-15-11-25t-25-11h-143q-14 0-25 11t-11 25v107q0 14 11 25t25 11h143q15 0 25-11t11-25z" horiz-adv-x="357.1" />
166
+
167
+ <glyph glyph-name="attention-alt" unicode="&#xf12a;" d="M286 154v-125q0-15-11-25t-25-11h-143q-14 0-25 11t-11 25v125q0 14 11 25t25 10h143q15 0 25-10t11-25z m17 589l-16-429q-1-14-12-25t-25-10h-143q-14 0-25 10t-12 25l-15 429q-1 14 10 25t24 11h179q14 0 25-11t10-25z" horiz-adv-x="357.1" />
168
+
169
+ <glyph glyph-name="ellipsis" unicode="&#xf141;" d="M214 439v-107q0-22-15-38t-38-15h-107q-23 0-38 15t-16 38v107q0 23 16 38t38 16h107q22 0 38-16t15-38z m286 0v-107q0-22-16-38t-38-15h-107q-22 0-38 15t-15 38v107q0 23 15 38t38 16h107q23 0 38-16t16-38z m286 0v-107q0-22-16-38t-38-15h-107q-22 0-38 15t-16 38v107q0 23 16 38t38 16h107q23 0 38-16t16-38z" horiz-adv-x="785.7" />
170
+
171
+ <glyph glyph-name="ellipsis-vert" unicode="&#xf142;" d="M214 154v-108q0-22-15-37t-38-16h-107q-23 0-38 16t-16 37v108q0 22 16 38t38 15h107q22 0 38-15t15-38z m0 285v-107q0-22-15-38t-38-15h-107q-23 0-38 15t-16 38v107q0 23 16 38t38 16h107q22 0 38-16t15-38z m0 286v-107q0-22-15-38t-38-16h-107q-23 0-38 16t-16 38v107q0 22 16 38t38 16h107q22 0 38-16t15-38z" horiz-adv-x="214.3" />
172
+
173
+ <glyph glyph-name="euro" unicode="&#xf153;" d="M545 121l19-89q2-7-1-13t-10-8l-3 0q-2-1-6-2t-9-3-12-3-14-3-16-2-19-3-21-2-21 0q-131 0-228 73t-133 196h-53q-7 0-13 5t-5 13v63q0 7 5 12t13 6h37q-1 31 0 58h-37q-8 0-13 5t-5 13v64q0 8 5 13t13 5h55q37 117 135 188t224 72q57 0 108-13 6-2 11-9 4-6 2-13l-24-89q-2-7-8-11t-13-1l-2 1q-3 0-7 1l-10 2t-12 2-15 2-16 1-16 1q-71 0-126-36t-84-98h261q9 0 14-7 6-7 4-15l-13-63q-3-15-18-15h-273q-1-20 0-58h257q8 0 13-7 5-7 4-15l-14-63q-1-6-6-10t-11-4h-216q27-65 84-104t127-38q10 0 20 1t19 2 16 2 14 3 10 3l7 1 3 2q7 2 14-2 7-3 9-11z" horiz-adv-x="571.4" />
174
+
175
+ <glyph glyph-name="pound" unicode="&#xf154;" d="M569 216v-205q0-8-5-13t-13-5h-533q-8 0-13 5t-5 13v83q0 8 5 13t13 5h54v214h-53q-8 0-13 5t-5 13v73q0 8 5 13t13 5h53v124q0 96 69 158t175 62q104 0 187-70 5-5 6-12t-4-12l-57-71q-5-6-13-7-7-1-13 4-2 3-14 11t-39 18-51 10q-48 0-77-27t-29-68v-120h170q8 0 13-5t5-13v-73q0-7-5-13t-13-5h-170v-211h231v101q0 7 5 12t13 5h90q8 0 13-5t5-12z" horiz-adv-x="571.4" />
176
+
177
+ <glyph glyph-name="dollar" unicode="&#xf155;" d="M546 189q0-86-56-147t-144-77v-97q0-8-5-13t-13-5h-75q-7 0-13 5t-5 13v97q-37 5-71 18t-57 25-41 26-26 21-10 10q-9 12-1 23l58 76q3 5 12 6 9 1 14-5l1-1q63-55 135-70 21-4 42-4 45 0 79 24t35 68q0 16-9 30t-18 23-33 21-37 18-45 18q-21 9-34 14t-34 15-35 17-32 20-29 24-25 27-20 32-11 37-5 44q0 77 55 135t142 75v100q0 7 5 13t13 5h75q8 0 13-5t5-13v-98q32-3 62-13t48-19 36-20 21-17 9-7q9-11 3-22l-46-81q-4-9-12-9-8-2-15 4-2 2-9 7t-21 14-33 18-42 15-47 6q-53 0-87-24t-33-62q0-14 4-27t17-23 22-18 31-18 34-15 39-15q30-11 45-17t43-20 42-24 34-28 30-35 18-43 7-52z" horiz-adv-x="571.4" />
178
+
179
+ <glyph glyph-name="rupee" unicode="&#xf156;" d="M501 588v-57q0-8-5-13t-13-5h-93q-13-80-72-131t-154-61q93-99 256-299 8-9 2-19-5-10-16-10h-109q-9 0-14 7-171 204-278 318-5 5-5 13v70q0 8 5 13t13 5h62q74 0 119 24t57 70h-238q-8 0-13 5t-5 13v57q0 8 5 13t13 5h230q-31 63-149 63h-81q-7 0-13 5t-5 13v74q0 8 5 13t13 5h464q8 0 13-5t5-13v-57q0-8-5-13t-13-5h-130q26-34 36-80h95q8 0 13-5t5-13z" horiz-adv-x="501.1" />
180
+
181
+ <glyph glyph-name="yen" unicode="&#xf157;" d="M337-7h-96q-8 0-13 5t-5 13v184h-161q-7 0-13 5t-5 13v57q0 8 5 13t13 5h161v48h-161q-7 0-13 5t-5 12v58q0 8 5 13t13 5h119l-179 323q-4 9 0 18 6 9 16 9h108q11 0 16-10l120-238q11-21 32-69 5 13 17 38t15 34l107 234q4 11 16 11h106q10 0 15-9 5-8 1-18l-175-323h120q7 0 13-5t5-13v-58q0-7-5-12t-13-5h-162v-48h162q7 0 13-5t5-13v-57q0-8-5-13t-13-5h-162v-184q0-7-5-13t-12-5z" horiz-adv-x="573.1" />
182
+
183
+ <glyph glyph-name="rouble" unicode="&#xf158;" d="M582 535q0 56-36 90t-96 35h-178v-250h178q60 0 96 34t36 91z m132 0q0-108-70-176t-182-68h-190v-66h282q7 0 12-5t5-13v-71q0-8-5-13t-12-5h-282v-107q0-8-5-13t-13-5h-93q-8 0-13 5t-5 13v107h-125q-8 0-13 5t-5 13v71q0 8 5 13t13 5h125v66h-125q-8 0-13 5t-5 13v83q0 7 5 12t13 6h125v351q0 8 5 13t13 5h301q111 0 182-68t70-176z" horiz-adv-x="714.3" />
184
+
185
+ <glyph glyph-name="won" unicode="&#xf159;" d="M287 183l45 167h-89l42-167q1-1 1-2t0-2q0 1 1 2t0 2z m65 238l19 72h-163l18-72h126z m107 0h77l-19 72h-39z m250-238l44 167h-91l46-167q0 0 0-2t1-2q0 1 0 2t0 2z m62 238l19 72h-166l19-72h128z m229-17v-36q0-8-5-13t-13-5h-119l-91-344q-4-13-17-13h-89q-14 0-18 13l-92 344h-117l-93-344q-4-13-17-13h-89q-6 0-11 4t-6 9l-89 344h-116q-8 0-13 5t-5 13v36q0 7 5 12t13 5h98l-19 72h-79q-8 0-13 5t-5 13v35q0 8 5 13t13 5h61l-50 192q-3 9 3 16 5 7 14 7h77q14 0 17-14l50-201h201l54 201q4 14 17 14h70q14 0 18-14l54-201h204l52 201q3 14 17 14h77q9 0 14-7 6-7 3-16l-51-192h62q8 0 13-5t5-13v-35q0-8-5-13t-13-5h-81l-19-72h100q8 0 13-5t5-12z" horiz-adv-x="1000" />
186
+
187
+ <glyph glyph-name="bitcoin" unicode="&#xf15a;" d="M651 493q10-102-73-144 65-16 98-58t25-119q-4-40-18-70t-36-49-54-33-68-19-81-9v-142h-86v140q-45 0-68 1v-141h-86v142q-10 0-30 1t-31 0h-112l18 102h62q27 0 32 28v225h9q-4 0-9 0v161q-7 37-50 37h-62v92l119-1q35 0 54 1v141h86v-138q45 1 68 1v137h86v-141q44-4 78-13t63-25 46-43 20-64z m-120-304q0 20-8 35t-21 26-32 17-36 11-42 5-38 1-36 0-27-1v-189q5 0 21 0t27 0 29 1 33 2 32 5 31 8 26 11 22 17 14 22 5 29z m-39 265q0 19-7 33t-17 23-27 16-31 9-34 5-32 1-31 0-22-1v-171q3 0 20 0t26 0 27 1 31 3 29 6 27 10 21 15 15 22 5 28z" horiz-adv-x="714.3" />
188
+
189
+ <glyph glyph-name="sort-alt-up" unicode="&#xf160;" d="M411 46q0-6-6-13l-178-178q-5-5-13-5-6 0-12 5l-179 179q-8 9-4 19 4 11 17 11h107v768q0 8 5 13t13 5h107q8 0 13-5t5-13v-768h107q8 0 13-5t5-13z m589-71v-107q0-8-5-13t-13-5h-464q-8 0-13 5t-5 13v107q0 8 5 13t13 5h464q8 0 13-5t5-13z m-107 286v-107q0-8-5-13t-13-5h-357q-8 0-13 5t-5 13v107q0 8 5 13t13 5h357q8 0 13-5t5-13z m-107 285v-107q0-7-5-12t-13-6h-250q-8 0-13 6t-5 12v107q0 8 5 13t13 5h250q8 0 13-5t5-13z m-107 286v-107q0-8-5-13t-13-5h-143q-8 0-13 5t-5 13v107q0 8 5 13t13 5h143q8 0 13-5t5-13z" horiz-adv-x="1000" />
190
+
191
+ <glyph glyph-name="sort-alt-down" unicode="&#xf161;" d="M679-25v-107q0-8-5-13t-13-5h-143q-8 0-13 5t-5 13v107q0 8 5 13t13 5h143q8 0 13-5t5-13z m-268 71q0-6-6-13l-178-178q-5-5-13-5-6 0-12 5l-179 179q-8 9-4 19 4 11 17 11h107v768q0 8 5 13t13 5h107q8 0 13-5t5-13v-768h107q8 0 13-5t5-13z m375 215v-107q0-8-5-13t-13-5h-250q-8 0-13 5t-5 13v107q0 8 5 13t13 5h250q8 0 13-5t5-13z m107 285v-107q0-7-5-12t-13-6h-357q-8 0-13 6t-5 12v107q0 8 5 13t13 5h357q8 0 13-5t5-13z m107 286v-107q0-8-5-13t-13-5h-464q-8 0-13 5t-5 13v107q0 8 5 13t13 5h464q8 0 13-5t5-13z" horiz-adv-x="1000" />
192
+
193
+ <glyph glyph-name="bug" unicode="&#xf188;" d="M911 314q0-14-11-25t-25-10h-125q0-96-37-162l116-117q10-11 10-25t-10-25q-10-11-25-11t-25 11l-111 110q-3-3-8-7t-24-16-36-21-46-16-54-7v500h-71v-500q-29 0-57 7t-49 19-36 22-25 18l-8 8-102-116q-11-12-27-12-13 0-24 9-11 10-11 25t8 26l113 127q-32 63-32 153h-125q-15 0-25 10t-11 25 11 25 25 11h125v164l-97 97q-11 10-11 25t11 25 25 10 25-10l97-97h471l96 97q11 10 25 10t26-10 10-25-10-25l-97-97v-164h125q15 0 25-11t11-25z m-268 322h-357q0 74 52 126t126 52 127-52 52-126z" horiz-adv-x="928.6" />
194
+
195
+ <glyph glyph-name="try" unicode="&#xf195;" d="M643 386q0-107-53-197t-143-143-197-53h-89q-8 0-13 5t-5 13v341l-120-37q-2-1-5-1-6 0-11 4-7 5-7 14v72q0 12 13 17l130 40v51l-120-36q-2-1-5-1-6 0-11 3-7 6-7 15v71q0 13 13 18l130 39v140q0 8 5 13t13 5h89q8 0 13-5t5-13v-101l209 64q9 3 16-2t7-15v-71q0-13-13-18l-219-67v-52l209 65q9 3 16-3t7-15v-71q0-13-13-17l-219-68v-272q105 8 177 85t73 183q0 8 5 13t13 5h89q8 0 13-5t5-13z" horiz-adv-x="642.9" />
196
+
197
+ <glyph glyph-name="wordpress" unicode="&#xf19a;" d="M71 350q0 91 37 175l205-561q-109 53-176 157t-66 229z m719 22q0-11-2-22t-5-27-7-25-9-33-10-32l-43-143-155 461q26 2 49 4 11 2 15 11t-2 17-15 8l-115-6q-42 1-113 6-6 0-11-3t-6-9-1-10 5-9 11-5l44-4 67-183-94-281-156 464q26 2 49 4 11 2 15 11t-2 17-15 8l-115-6q-4 0-13 0t-14 1q58 89 153 141t205 52q82 0 157-29t133-84h-6q-31 0-51-22t-21-53q0-7 1-14t2-12 5-13 5-11 7-13 7-12 8-13 8-13q35-60 35-118z m-283-59l133-361q0-4 2-7-70-24-142-24-62 0-121 18z m369 243q53-97 53-206 0-117-58-215t-156-156l132 379q33 94 33 154 0 23-4 44z m-376 294q102 0 194-40t160-106 106-160 40-194-40-194-106-160-160-106-194-40-194 40-160 106-106 160-40 194 40 194 106 160 160 106 194 40z m0-977q97 0 185 38t152 102 102 152 38 185-38 185-102 152-152 102-185 38-185-38-152-102-102-152-38-185 38-185 102-152 152-102 185-38z" horiz-adv-x="1000" />
198
+
199
+ <glyph glyph-name="cubes" unicode="&#xf1b3;" d="M357-61l214 107v176l-214-92v-191z m-36 254l226 96-226 97-225-97z m608-254l214 107v176l-214-92v-191z m-36 254l225 96-225 97-226-97z m-250 163l214 92v149l-214-92v-149z m-36 212l246 105-246 106-246-106z m607-289v-233q0-20-10-37t-29-26l-250-125q-14-8-32-8t-32 8l-250 125q-2 1-4 2-1-1-4-2l-250-125q-14-8-32-8t-31 8l-250 125q-19 9-29 26t-11 37v233q0 21 12 39t32 26l242 104v223q0 22 12 40t31 26l250 107q13 6 28 6t28-6l250-107q20-9 32-26t12-40v-223l242-104q20-8 32-26t11-39z" horiz-adv-x="1285.7" />
200
+
201
+ <glyph glyph-name="database" unicode="&#xf1c0;" d="M429 421q132 0 247 24t181 71v-95q0-38-57-71t-157-52-214-19-215 19-156 52-58 71v95q66-47 181-71t248-24z m0-428q132 0 247 24t181 71v-95q0-39-57-72t-157-52-214-19-215 19-156 52-58 72v95q66-47 181-71t248-24z m0 214q132 0 247 24t181 71v-95q0-38-57-71t-157-52-214-20-215 20-156 52-58 71v95q66-47 181-71t248-24z m0 643q116 0 214-19t157-52 57-72v-71q0-39-57-72t-157-52-214-19-215 19-156 52-58 72v71q0 39 58 72t156 52 215 19z" horiz-adv-x="857.1" />
202
+
203
+ <glyph glyph-name="circle-thin" unicode="&#xf1db;" d="M429 707q-73 0-139-28t-114-76-76-114-29-139 29-139 76-113 114-77 139-28 138 28 114 77 76 113 29 139-29 139-76 114-114 76-138 28z m428-357q0-117-57-215t-156-156-215-58-216 58-155 156-58 215 58 215 155 156 216 58 215-58 156-156 57-215z" horiz-adv-x="857.1" />
204
+
205
+ <glyph glyph-name="sliders" unicode="&#xf1de;" d="M196 64v-71h-196v71h196z m197 72q14 0 25-11t11-25v-143q0-14-11-25t-25-11h-143q-14 0-25 11t-11 25v143q0 15 11 25t25 11h143z m89 214v-71h-482v71h482z m-357 286v-72h-125v72h125z m732-572v-71h-411v71h411z m-536 643q15 0 26-10t10-26v-142q0-15-10-25t-26-11h-142q-15 0-25 11t-11 25v142q0 15 11 26t25 10h142z m358-286q14 0 25-10t10-25v-143q0-15-10-25t-25-11h-143q-15 0-25 11t-11 25v143q0 14 11 25t25 10h143z m178-71v-71h-125v71h125z m0 286v-72h-482v72h482z" horiz-adv-x="857.1" />
206
+
207
+ <glyph glyph-name="share" unicode="&#xf1e0;" d="M679 279q74 0 126-53t52-126-52-126-126-53-127 53-52 126q0 7 1 19l-201 100q-51-48-121-48-75 0-127 53t-52 126 52 126 127 53q70 0 121-48l201 100q-1 12-1 19 0 74 52 126t127 53 126-53 52-126-52-126-126-53q-71 0-122 48l-201-100q1-12 1-19t-1-19l201-100q51 48 122 48z" horiz-adv-x="857.1" />
208
+
209
+ <glyph glyph-name="plug" unicode="&#xf1e6;" d="M979 597q21-21 21-50t-21-51l-223-223 83-84-89-89q-91-91-217-104t-230 56l-202-202h-101v101l202 202q-69 103-56 230t104 217l89 89 84-83 223 223q21 21 51 21t50-21 21-50-21-51l-223-223 131-131 223 223q22 21 51 21t50-21z" horiz-adv-x="1000" />
210
+
211
+ <glyph glyph-name="trash" unicode="&#xf1f8;" d="M286 82v393q0 8-5 13t-13 5h-36q-8 0-13-5t-5-13v-393q0-8 5-13t13-5h36q8 0 13 5t5 13z m143 0v393q0 8-5 13t-13 5h-36q-8 0-13-5t-5-13v-393q0-8 5-13t13-5h36q8 0 13 5t5 13z m142 0v393q0 8-5 13t-12 5h-36q-8 0-13-5t-5-13v-393q0-8 5-13t13-5h36q7 0 12 5t5 13z m-303 554h250l-27 65q-4 5-9 6h-177q-6-1-10-6z m518-18v-36q0-8-5-13t-13-5h-54v-529q0-46-26-80t-63-34h-464q-37 0-63 33t-27 79v531h-53q-8 0-13 5t-5 13v36q0 8 5 13t13 5h172l39 93q9 21 31 35t44 15h178q23 0 44-15t30-35l39-93h173q8 0 13-5t5-13z" horiz-adv-x="785.7" />
212
+
213
+ <glyph glyph-name="chart-line" unicode="&#xf201;" d="M1143-7v-72h-1143v858h71v-786h1072z m-72 696v-242q0-12-10-17t-20 4l-68 68-353-353q-6-6-13-6t-13 6l-130 130-232-233-107 108 327 326q5 6 12 6t13-6l130-130 259 259-67 68q-9 8-5 19t17 11h243q7 0 12-5t5-13z" horiz-adv-x="1142.9" />
214
+
215
+ <glyph glyph-name="shekel" unicode="&#xf20b;" d="M554 502v-277q0-8-5-13t-13-5h-90q-7 0-12 5t-5 13v277q0 62-45 107t-107 45h-152v-643q0-8-5-13t-13-5h-89q-8 0-13 5t-5 13v750q0 8 5 13t13 5h259q75 0 139-37t101-101 37-139z m214 259v-491q0-76-37-139t-101-101-139-37h-259q-8 0-13 5t-5 13v535q0 8 5 13t13 5h89q8 0 13-5t5-13v-428h152q63 0 107 45t45 107v491q0 8 5 13t13 5h89q8 0 13-5t5-13z" horiz-adv-x="857.1" />
216
+
217
+ <glyph glyph-name="user-secret" unicode="&#xf21b;" d="M321-7l54 250-54 71-71 36z m143 0l72 357-72-36-53-71z m90 564q-1 2-3 3-5 4-53 4-39 0-93-10-4-1-12-1t-12 1q-54 10-93 10-48 0-54-4-1-1-2-3 1-11 2-16 2-1 5-3t4-6q1-2 4-11t4-12 4-9 5-10 5-8 7-7 7-6 10-4 12-2 13-1q20 0 33 7t18 16 8 20 7 16 10 7h6q6 0 10-7t6-16 9-20 18-16 33-7q7 0 13 1t12 2 9 4 8 6 7 7 5 8 5 10 4 9 4 12 4 11q1 4 4 6t4 3q2 5 3 16z m232-491q0-68-41-106t-108-39h-488q-67 0-108 39t-41 106q0 34 3 66t10 70 21 69 36 58 52 41l-51 123h120q-12 36-12 71 0 7 1 18-109 23-109 54 0 32 118 55 9 35 28 75t40 63q18 21 42 21 17 0 47-17t47-18 47 18 47 17q24 0 42-21 20-23 39-63t29-75q117-23 117-55 0-31-108-54 4-45-11-89h119l-45-126q35-18 60-54t36-80 16-84 5-83z" horiz-adv-x="857.1" />
218
+
219
+ <glyph glyph-name="user-plus" unicode="&#xf234;" d="M393 350q-89 0-152 63t-62 151 62 152 152 63 151-63 63-152-63-151-151-63z m536-71h196q7 0 13-6t5-12v-107q0-8-5-13t-13-5h-196v-197q0-7-6-12t-12-6h-107q-8 0-13 6t-5 12v197h-197q-7 0-12 5t-6 13v107q0 7 6 12t12 6h197v196q0 7 5 13t13 5h107q7 0 12-5t6-13v-196z m-411-125q0-29 21-51t50-21h143v-133q-38-28-95-28h-488q-67 0-108 39t-41 106q0 30 2 58t8 61 15 60 24 55 34 45 48 30 62 11q11 0 22-10 44-34 86-51t92-17 92 17 86 51q11 10 22 10 73 0 121-54h-125q-29 0-50-21t-21-50v-107z" horiz-adv-x="1142.9" />
220
+
221
+ <glyph glyph-name="user-times" unicode="&#xf235;" d="M393 350q-89 0-152 63t-62 151 62 152 152 63 151-63 63-152-63-151-151-63z m601-179l139-138q5-5 5-13 0-8-5-13l-76-76q-5-5-12-5-8 0-13 5l-139 139-139-139q-5-5-13-5-7 0-12 5l-76 76q-5 5-5 13 0 8 5 13l139 138-139 139q-5 5-5 13 0 8 5 13l76 75q5 5 12 5 8 0 13-5l139-139 139 139q5 5 13 5 7 0 12-5l76-75q5-5 5-13 0-8-5-13z m-278 0l-101-101q-21-20-21-50 0-30 21-51l46-46q-11-2-24-2h-488q-67 0-108 39t-41 106q0 30 2 58t8 61 15 60 24 55 34 45 48 30 62 11q11 0 22-10 86-68 178-68t178 68q11 10 22 10 15 0 31-4-15-15-22-27t-8-32q0-30 21-51z" horiz-adv-x="1142.9" />
222
+
223
+ <glyph glyph-name="viacoin" unicode="&#xf237;" d="M857 850l-107-250h107v-107h-153l-30-72h183v-107h-229l-199-464-200 464h-229v107h184l-31 72h-153v107h107l-107 250h143l180-429h211l180 429h143z m-428-679l60 143h-121z" horiz-adv-x="857.1" />
224
+
225
+ <glyph glyph-name="safari" unicode="&#xf267;" d="M530 352q0-15-10-25t-23-11q-14 0-25 9t-10 23q0 15 9 25t23 11 25-9 11-23z m8-33l195 325q-5-5-37-35t-70-65-77-71-65-62-28-29l-195-323q4 4 38 34t70 65 76 71 65 62 28 28z m361 31q0-112-58-207-2 1-9 6t-15 9-9 5q-8 0-8-8 0-5 33-24-41-63-103-107t-135-61l-8 37q-1 6-9 6-3 0-4-3t-1-6l9-38q-41-8-82-8-111 0-208 59 1 1 8 11t12 19 5 10q0 8-7 8-4 0-10-8t-12-20-8-13q-63 42-107 105t-61 137l38 8q6 2 6 8 0 3-3 5t-6 1l-38-9q-8 41-8 78 0 115 61 212 1-1 10-7t17-11 10-4q7 0 7 6 0 4-7 9t-18 12l-11 7q43 62 105 105t136 60l9-37q1-6 8-6 3 0 5 3t1 6l-9 37q40 7 75 7 114 0 212-61-22-31-22-36 0-7 6-7 7 0 27 35 62-41 105-103t60-135l-31-7q-6-1-6-8 0-3 3-5t5-1l32 7q8-40 8-78z m47 0q0 91-35 174t-95 142-142 95-174 35-173-35-143-95-95-142-35-174 35-173 95-143 143-95 173-35 174 35 142 95 95 143 35 173z m54 0q0-102-40-194t-106-160-160-106-194-40-194 40-160 106-106 160-40 194 40 194 106 160 160 106 194 40 194-40 160-106 106-160 40-194z" horiz-adv-x="1000" />
226
+
227
+ <glyph glyph-name="chrome" unicode="&#xf268;" d="M498 850q134 1 252-67 130-75 196-208l-414 22q-89 5-164-41t-103-128l-154 236q72 89 174 137t213 49z m-416-226l188-370q40-80 117-121t164-25l-129-252q-118 19-214 88t-152 176-56 230q0 149 82 274z m885-94q32-84 33-174t-27-170-86-152-137-117q-128-74-278-66l226 347q49 73 46 162t-59 155z m-467-11q70 0 119-50t50-119-50-119-119-49-119 49-49 119 49 119 119 50z" horiz-adv-x="1000" />
228
+
229
+ <glyph glyph-name="firefox" unicode="&#xf269;" d="M504-150q-158 0-282 84t-183 222q-33 74-38 168t15 186 62 174 100 135l-7-156q7 7 38 8t39-8q24 45 90 77t131 32q-30-25-67-82t-33-92q14-4 35-7t36-4 37-3 29-1q8-3 5-26t-17-42q-3-4-9-10t-32-20-56-19l8-105-77 37q-10-24-5-45t21-38 36-23 45-3q29 5 55 19t47 25 41 10q34-2 50-19t10-36q0-1-1-3t-5-7-10-9-17-5-26-1q-34-53-81-76t-117-16q41-34 91-46t94-3 86 29 71 48 45 58q24 51 22 108t-21 105-44 70q49-21 77-45t43-62q8 95-32 191t-117 159q148-43 230-156t84-289q1-71-23-143t-68-132-106-110-138-75-161-28z" horiz-adv-x="1000" />
230
+
231
+ <glyph glyph-name="opera" unicode="&#xf26a;" d="M833 723q-92 61-200 61-87 0-164-41t-134-111q-41-52-66-122t-27-148v-24q2-78 27-148t66-122q57-71 134-111t164-41q108 0 200 61-67-60-153-94t-180-33q-16 0-24 1-98 4-186 45t-152 108-101 157-37 189q0 102 40 194t106 160 160 106 194 40h2q93-1 179-34t152-93z m167-373q0-107-43-202t-119-166q-58-35-124-35-76 0-142 47 86 31 141 130t56 226q0 127-55 225t-141 131q66 46 141 46 67 0 126-36 76-70 118-164t42-202z" horiz-adv-x="1000" />
232
+
233
+ <glyph glyph-name="internet-explorer" unicode="&#xf26b;" d="M1000 327q0-31-4-58h-642q0-81 61-136t144-55q55 0 103 26t76 73h236q-31-89-95-157t-149-106-179-37q-105 0-199 47-127-65-220-65-132 0-132 147 0 64 25 153 10 34 61 128 111 201 265 338-103-44-238-197 35 153 158 250t280 98q17 0 25 0 142 65 242 65 35 0 64-7t53-23 37-42 14-65q0-64-42-159 56-102 56-218z m-39 357q0 47-30 74t-76 27q-60 0-142-39 68-26 124-73t96-109q28 75 28 120z m-890-690q0-48 28-74t75-26q64 0 148 46-68 41-119 103t-77 136q-55-114-55-185z m282 398h406q-3 79-63 132t-140 53q-81 0-140-53t-63-132z" horiz-adv-x="1000" />
234
+
235
+ <glyph glyph-name="television" unicode="&#xf26c;" d="M1000 154v535q0 8-5 13t-13 5h-893q-7 0-12-5t-6-13v-535q0-8 6-13t12-5h893q7 0 13 5t5 13z m71 535v-535q0-37-26-63t-63-27h-411v-71h197q8 0 13-5t5-13v-36q0-8-5-13t-13-5h-464q-8 0-13 5t-5 13v36q0 8 5 13t13 5h196v71h-411q-36 0-63 27t-26 63v535q0 37 26 63t63 27h893q37 0 63-27t26-63z" horiz-adv-x="1142.9" />
236
+
237
+ <glyph glyph-name="percent" unicode="&#xf295;" d="M714 136q0 29-21 50t-50 21-50-21-22-50 22-50 50-22 50 22 21 50z m-428 428q0 29-21 51t-51 21-50-21-21-51 21-50 50-21 51 21 21 50z m571-428q0-89-63-152t-151-63-152 63-62 152 62 151 152 63 151-63 63-151z m-53 607q0-11-8-21l-589-786q-11-15-28-15h-90q-14 0-25 11t-10 25q0 11 7 21l589 786q11 15 29 15h89q14 0 25-11t11-25z m-375-179q0-88-63-151t-152-63-151 63-63 151 63 152 151 63 152-63 63-152z" horiz-adv-x="857.1" />
238
+ </font>
239
+ </defs>
240
  </svg>
inc/cleantalk-admin.php CHANGED
@@ -53,7 +53,7 @@ function apbct_add_buttons_to_comments_and_users( $unused_argument ) {
53
 
54
  add_action( 'admin_bar_menu', 'apbct_admin__admin_bar__add', 999 );
55
 
56
- //Adding widjet
57
  function ct_dashboard_statistics_widget() {
58
 
59
  global $apbct;
@@ -61,12 +61,7 @@ function ct_dashboard_statistics_widget() {
61
  if(apbct_is_user_role_in(array('administrator'))){
62
  wp_add_dashboard_widget(
63
  'ct_dashboard_statistics_widget',
64
- $apbct->plugin_name
65
- ."<div class='ct_widget_top_links'>"
66
- ."<img src='".plugins_url('/cleantalk-spam-protect/inc/images/preloader.gif')."' class='ct_preloader'>"
67
- .sprintf(__("%sRefresh%s", 'cleantalk-spam-protect'), "<a href='#ct_widget' class='ct_widget_refresh_link'>", "</a>")
68
- .sprintf(__("%sConfigure%s", 'cleantalk-spam-protect'), "<a href='{$apbct->settings_link}' class='ct_widget_settings_link'>", "</a>")
69
- ."</div>",
70
  'ct_dashboard_statistics_widget_output'
71
  );
72
  }
@@ -79,7 +74,12 @@ function ct_dashboard_statistics_widget_output( $post, $callback_args ) {
79
 
80
  echo "<div id='ct_widget_wrapper'>";
81
  ?>
82
- <form id='ct_refresh_form' method='POST' action='#ct_widget'>
 
 
 
 
 
83
  <input type='hidden' name='ct_brief_refresh' value='1'>
84
  </form>
85
  <h4 class='ct_widget_block_header' style='margin-left: 12px;'><?php _e('7 days anti-spam stats', 'cleantalk-spam-protect'); ?></h4>
53
 
54
  add_action( 'admin_bar_menu', 'apbct_admin__admin_bar__add', 999 );
55
 
56
+ //Adding widget
57
  function ct_dashboard_statistics_widget() {
58
 
59
  global $apbct;
61
  if(apbct_is_user_role_in(array('administrator'))){
62
  wp_add_dashboard_widget(
63
  'ct_dashboard_statistics_widget',
64
+ $apbct->plugin_name,
 
 
 
 
 
65
  'ct_dashboard_statistics_widget_output'
66
  );
67
  }
74
 
75
  echo "<div id='ct_widget_wrapper'>";
76
  ?>
77
+ <div class='ct_widget_top_links'>
78
+ <img src="<?php echo plugins_url('/cleantalk-spam-protect/inc/images/preloader.gif'); ?>" class='ct_preloader'>
79
+ <?php echo sprintf(__("%sRefresh%s", 'cleantalk-spam-protect'), "<a href='#ct_widget' class='ct_widget_refresh_link'>", "</a>"); ?>
80
+ <?php echo sprintf(__("%sConfigure%s", 'cleantalk-spam-protect'), "<a href='{$apbct->settings_link}' class='ct_widget_settings_link'>", "</a>"); ?>
81
+ </div>
82
+ <form id='ct_refresh_form' method='POST' action='#ct_widget'>
83
  <input type='hidden' name='ct_brief_refresh' value='1'>
84
  </form>
85
  <h4 class='ct_widget_block_header' style='margin-left: 12px;'><?php _e('7 days anti-spam stats', 'cleantalk-spam-protect'); ?></h4>
inc/cleantalk-ajax.php CHANGED
@@ -1,784 +1,790 @@
1
- <?php
2
- global $cleantalk_hooked_actions;
3
-
4
- /*
5
- AJAX functions
6
- */
7
-
8
- //$cleantalk_ajax_actions_to_check - array for POST 'actions' we should check.
9
-
10
- $cleantalk_ajax_actions_to_check[] = 'qcf_validate_form'; //Quick Contact Form
11
- $cleantalk_ajax_actions_to_check[] = 'amoforms_submit'; //amoForms
12
-
13
- //cleantalk_hooked_actions[] - array for POST 'actions' which were direct hooked.
14
-
15
- $cleantalk_hooked_actions[] = 'rwp_ajax_action_rating'; //Don't check Reviewer plugin
16
-
17
- $cleantalk_hooked_actions[] = 'ct_feedback_comment';
18
-
19
- /* MailChimp Premium*/
20
- add_filter('mc4wp_form_errors', 'ct_mc4wp_ajax_hook');
21
-
22
- /*hooks for Usernoise Form*/
23
- add_action('un_feedback_form_body', 'ct_add_hidden_fields',1);
24
- add_filter('un_validate_feedback', 'ct_ajax_hook', 1, 2);
25
-
26
- /*hooks for AJAX Login & Register email validation*/
27
- add_action( 'wp_ajax_nopriv_validate_email', 'ct_validate_email_ajaxlogin',1 );
28
- add_action( 'wp_ajax_validate_email', 'ct_validate_email_ajaxlogin',1 );
29
- $cleantalk_hooked_actions[]='validate_email';
30
-
31
- /*hooks for user registration*/
32
- add_action( 'user_register', 'ct_user_register_ajaxlogin',1 );
33
-
34
- /*hooks for WPUF pro */
35
- //add_action( 'wp_ajax_nopriv_wpuf_submit_register', 'ct_wpuf_submit_register',1 );
36
- //add_action( 'wp_ajax_wpuf_submit_register', 'ct_wpuf_submit_register',1 );
37
- add_action( 'wp_ajax_nopriv_wpuf_submit_register', 'ct_ajax_hook',1 );
38
- add_action( 'wp_ajax_wpuf_submit_register', 'ct_ajax_hook',1 );
39
- $cleantalk_hooked_actions[]='submit_register';
40
-
41
- /*hooks for MyMail */
42
- //add_action( 'wp_ajax_nopriv_mymail_form_submit', 'ct_mymail_form_submit',1 );
43
- //add_action( 'wp_ajax_mymail_form_submit', 'ct_mymail_form_submit',1 );
44
- add_action( 'wp_ajax_nopriv_mymail_form_submit', 'ct_ajax_hook',1 );
45
- add_action( 'wp_ajax_mymail_form_submit', 'ct_ajax_hook',1 );
46
- $cleantalk_hooked_actions[]='form_submit';
47
-
48
- /*hooks for MailPoet */
49
- //add_action( 'wp_ajax_nopriv_wysija_ajax', 'ct_wysija_ajax',1 );
50
- //add_action( 'wp_ajax_wysija_ajax', 'ct_wysija_ajax',1 );
51
- add_action( 'wp_ajax_nopriv_wysija_ajax', 'ct_ajax_hook',1 );
52
- add_action( 'wp_ajax_wysija_ajax', 'ct_ajax_hook',1 );
53
- $cleantalk_hooked_actions[]='wysija_ajax';
54
-
55
- /*hooks for cs_registration_validation */
56
- //add_action( 'wp_ajax_nopriv_cs_registration_validation', 'ct_cs_registration_validation',1 );
57
- //add_action( 'wp_ajax_cs_registration_validation', 'ct_cs_registration_validation',1 );
58
- add_action( 'wp_ajax_nopriv_cs_registration_validation', 'ct_ajax_hook',1 );
59
- add_action( 'wp_ajax_cs_registration_validation', 'ct_ajax_hook',1 );
60
- $cleantalk_hooked_actions[]='cs_registration_validation';
61
-
62
- /*hooks for send_message and request_appointment */
63
- //add_action( 'wp_ajax_nopriv_send_message', 'ct_sm_ra',1 );
64
- //add_action( 'wp_ajax_send_message', 'ct_sm_ra',1 );
65
- //add_action( 'wp_ajax_nopriv_request_appointment', 'ct_sm_ra',1 );
66
- //add_action( 'wp_ajax_request_appointment', 'ct_sm_ra',1 );
67
- add_action( 'wp_ajax_nopriv_send_message', 'ct_ajax_hook',1 );
68
- add_action( 'wp_ajax_send_message', 'ct_ajax_hook',1 );
69
- add_action( 'wp_ajax_nopriv_request_appointment', 'ct_ajax_hook',1 );
70
- add_action( 'wp_ajax_request_appointment', 'ct_ajax_hook',1 );
71
- $cleantalk_hooked_actions[]='send_message';
72
- $cleantalk_hooked_actions[]='request_appointment';
73
-
74
- /*hooks for zn_do_login */
75
- //add_action( 'wp_ajax_nopriv_zn_do_login', 'ct_zn_do_login',1 );
76
- //add_action( 'wp_ajax_zn_do_login', 'ct_zn_do_login',1 );
77
- add_action( 'wp_ajax_nopriv_zn_do_login', 'ct_ajax_hook',1 );
78
- add_action( 'wp_ajax_zn_do_login', 'ct_ajax_hook',1 );
79
- $cleantalk_hooked_actions[]='zn_do_login';
80
-
81
- /*hooks for zn_do_login */
82
- //add_action( 'wp_ajax_nopriv_cscf-submitform', 'ct_cscf_submitform',1 );
83
- //add_action( 'wp_ajax_cscf-submitform', 'ct_cscf_submitform',1 );
84
- if(isset($_POST['action']) && $_POST['action'] == 'cscf-submitform'){
85
- add_filter('preprocess_comment', 'ct_ajax_hook', 1);
86
- //add_action( 'wp_ajax_nopriv_cscf-submitform', 'ct_ajax_hook',1 );
87
- //add_action( 'wp_ajax_cscf-submitform', 'ct_ajax_hook',1 );
88
- $cleantalk_hooked_actions[]='cscf-submitform';
89
- }
90
-
91
-
92
- /*hooks for visual form builder */
93
- //add_action( 'wp_ajax_nopriv_vfb_submit', 'ct_vfb_submit',1 );
94
- //add_action( 'wp_ajax_vfb_submit', 'ct_vfb_submit',1 );
95
- add_action( 'wp_ajax_nopriv_vfb_submit', 'ct_ajax_hook',1 );
96
- add_action( 'wp_ajax_vfb_submit', 'ct_ajax_hook',1 );
97
- $cleantalk_hooked_actions[]='vfb_submit';
98
-
99
- /*hooks for woocommerce_checkout*/
100
- add_action( 'wp_ajax_nopriv_woocommerce_checkout', 'ct_ajax_hook',1 );
101
- add_action( 'wp_ajax_woocommerce_checkout', 'ct_ajax_hook',1 );
102
- $cleantalk_hooked_actions[]='woocommerce_checkout';
103
- $cleantalk_hooked_actions[]='wcfm_ajax_controller';
104
-
105
- /*hooks for frm_action*/
106
- add_action( 'wp_ajax_nopriv_frm_entries_create', 'ct_ajax_hook',1 );
107
- add_action( 'wp_ajax_frm_entries_create', 'ct_ajax_hook',1 );
108
- $cleantalk_hooked_actions[]='frm_entries_create';
109
-
110
- add_action( 'wp_ajax_nopriv_td_mod_register', 'ct_ajax_hook',1 );
111
- add_action( 'wp_ajax_td_mod_register', 'ct_ajax_hook',1 );
112
- $cleantalk_hooked_actions[]='td_mod_register';
113
-
114
- /*hooks for tevolution theme*/
115
- add_action( 'wp_ajax_nopriv_tmpl_ajax_check_user_email', 'ct_ajax_hook',1 );
116
- add_action( 'wp_ajax_tmpl_ajax_check_user_email', 'ct_ajax_hook',1 );
117
- add_action( 'wp_ajax_nopriv_tevolution_submit_from_preview', 'ct_ajax_hook',1 );
118
- add_action( 'wp_ajax_tevolution_submit_from_preview', 'ct_ajax_hook',1 );
119
- add_action( 'wp_ajax_nopriv_submit_form_recaptcha_validation', 'ct_ajax_hook',1 );
120
- add_action( 'wp_ajax_tmpl_submit_form_recaptcha_validation', 'ct_ajax_hook',1 );
121
- $cleantalk_hooked_actions[]='tmpl_ajax_check_user_email';
122
- $cleantalk_hooked_actions[]='tevolution_submit_from_preview';
123
- $cleantalk_hooked_actions[]='submit_form_recaptcha_validation';
124
-
125
- /* hooks for contact forms by web settler ajax*/
126
- add_action( 'wp_ajax_nopriv_smuzform-storage', 'ct_ajax_hook',1 );
127
- $cleantalk_hooked_actions[]='smuzform_form_submit';
128
-
129
- /* hooks for reviewer plugin*/
130
- add_action( 'wp_ajax_nopriv_rwp_ajax_action_rating', 'ct_ajax_hook',1 );
131
- $cleantalk_hooked_actions[]='rwp-submit-wrap';
132
-
133
- $cleantalk_hooked_actions[]='post_update';
134
-
135
- /* Ninja Forms hoocked actions */
136
- $cleantalk_hooked_actions[]='ninja_forms_ajax_submit';
137
- $cleantalk_hooked_actions[]='nf_ajax_submit';
138
- $cleantalk_hooked_actions[]='ninja_forms_process'; // Depricated ?
139
-
140
- /* Follow-Up Emails */
141
- $cleantalk_hooked_actions[] = 'fue_wc_set_cart_email'; // Don't check email via this plugin
142
-
143
- /* Follow-Up Emails */
144
- $cleantalk_hooked_actions[] = 'fue_wc_set_cart_email'; // Don't check email via this plugin
145
-
146
- /* The Fluent Form have the direct integration */
147
- $cleantalk_hooked_actions[] = 'fluentform_submit';
148
-
149
- function ct_validate_email_ajaxlogin($email=null, $is_ajax=true){
150
-
151
- $email = is_null( $email ) ? $email : $_POST['email'];
152
- $email = sanitize_email($email);
153
- $is_good = !filter_var($email, FILTER_VALIDATE_EMAIL) || email_exists($email) ? false : true;
154
-
155
- if(class_exists('AjaxLogin')&&isset($_POST['action'])&&$_POST['action']=='validate_email'){
156
-
157
- $checkjs = apbct_js_test('ct_checkjs', $_POST);
158
- $sender_info['post_checkjs_passed'] = $checkjs;
159
- if ($checkjs === null){
160
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
161
- $sender_info['cookie_checkjs_passed'] = $checkjs;
162
- }
163
-
164
- //Making a call
165
- $base_call_result = apbct_base_call(
166
- array(
167
- 'sender_email' => $email,
168
- 'sender_nickname' => '',
169
- 'sender_info' => $sender_info,
170
- 'js_on' => $checkjs,
171
- ),
172
- true
173
- );
174
-
175
- $ct_result = $base_call_result['ct_result'];
176
-
177
- if ($ct_result->allow===0){
178
- $is_good=false;
179
- }
180
- }
181
-
182
- if($is_good){
183
- $ajaxresult=array(
184
- 'description' => null,
185
- 'cssClass' => 'noon',
186
- 'code' => 'success'
187
- );
188
- }else{
189
- $ajaxresult=array(
190
- 'description' => 'Invalid Email',
191
- 'cssClass' => 'error-container',
192
- 'code' => 'error'
193
- );
194
- }
195
-
196
- $ajaxresult = json_encode($ajaxresult);
197
- print $ajaxresult;
198
- wp_die();
199
- }
200
-
201
- function ct_user_register_ajaxlogin($user_id)
202
- {
203
- if(class_exists('AjaxLogin')&&isset($_POST['action'])&&$_POST['action']=='register_submit')
204
- {
205
-
206
- $checkjs = apbct_js_test('ct_checkjs', $_POST);
207
- $sender_info['post_checkjs_passed'] = $checkjs;
208
- if ($checkjs === null){
209
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
210
- $sender_info['cookie_checkjs_passed'] = $checkjs;
211
- }
212
-
213
- //Making a call
214
- $base_call_result = apbct_base_call(
215
- array(
216
- 'sender_email' => sanitize_email($_POST['email']),
217
- 'sender_nickname' => sanitize_email($_POST['login']),
218
- 'sender_info' => $sender_info,
219
- 'js_on' => $checkjs,
220
- ),
221
- true
222
- );
223
-
224
- $ct_result = $base_call_result['ct_result'];
225
-
226
- if ($ct_result->allow === 0)
227
- {
228
- wp_delete_user($user_id);
229
- }
230
- }
231
- return $user_id;
232
- }
233
-
234
- /**
235
- * Hook into MailChimp for WordPress `mc4wp_form_errors` filter.
236
- *
237
- * @param array $errors
238
- * @return array
239
- */
240
- function ct_mc4wp_ajax_hook( array $errors )
241
- {
242
- $result = ct_ajax_hook();
243
-
244
- // only return modified errors array when function returned a string value (the message key)
245
- if( is_string( $result ) ) {
246
- $errors[] = $result;
247
- }
248
-
249
- return $errors;
250
- }
251
-
252
- function ct_ajax_hook($message_obj = false, $additional = false)
253
- {
254
- global $apbct, $current_user;
255
-
256
- $message_obj = (array)$message_obj;
257
-
258
- // Get current_user and set it globaly
259
- apbct_wp_set_current_user($current_user instanceof WP_User ? $current_user : apbct_wp_get_current_user() );
260
-
261
- // $_REQUEST['action'] to skip. Go out because of not spam data
262
- $skip_post = array(
263
- 'apbct_js_keys__get', // Our service code
264
- 'gmaps_display_info_window', // Geo My WP pop-up windows.
265
- 'gmw_ps_display_info_window', // Geo My WP pop-up windows.
266
- 'the_champ_user_auth', // Super Socializer
267
- 'simbatfa-init-otp', //Two-Factor Auth
268
- 'wppb_msf_check_required_fields', //ProfileBuilder skip step checking
269
- 'boss_we_login', //Login form
270
- 'sidebar_login_process', // Login CF7
271
- 'cp_update_style_settings', // Convert Pro. Saving settings
272
- 'updraft_savesettings', // UpdraftPlus
273
- 'wpdUpdateAutomatically', //Comments update
274
- 'upload-attachment', // Skip ulpload attachments
275
- 'iwj_update_profile', //Skip profile page checker
276
- 'st_partner_create_service', //Skip add hotel via admin
277
- 'vp_ajax_vpt_option_save', // https://themeforest.net/item/motor-vehicles-parts-equipments-accessories-wordpress-woocommerce-theme/16829946
278
- 'mailster_send_test', //Mailster send test admin
279
- 'acf/validate_save_post', //ACF validate post admin
280
- 'admin:saveThemeOptions', //Ait-theme admin checking
281
- 'save_tourmaster_option', //Tourmaster admin save
282
- 'validate_register_email', // Service id #313320
283
- 'elementor_pro_forms_send_form', //Elementor Pro
284
- 'phone-orders-for-woocommerce', //Phone orders for woocommerce backend
285
- 'ihc_check_reg_field_ajax', //Ajax check required fields
286
- 'OSTC_lostPassword', //Lost password ajax form
287
- 'check_retina_image_availability', //There are too many ajax requests from mobile
288
- 'uap_check_reg_field_ajax', // Ultimate Affiliate Pro. Form validation.
289
- 'edit-comment', // Edit comments by admin ??? that shouldn't happen
290
- 'formcraft3_save_form_progress', // FormCraft Contact Form Builder for WordPress. Save progress.
291
- 'wpdmpp_save_settings', // PayPal save settings.
292
- 'iwj_login', // Fix for unknown plugin for user #133315
293
- 'custom_user_login', // Fix for unknown plugin for user #466875
294
- 'wordfence_ls_authenticate', //Fix for wordfence auth
295
- 'frm_strp_amount', //Admin stripe form
296
- 'wouCheckOnlineUsers', //Skip updraft admin checking users
297
- 'et_fb_get_shortcode_from_fb_object', //Skip generate shortcode
298
- 'pp_lf_process_login', //Skip login form
299
- 'check_email', //Ajax email checking
300
- 'dflg_do_sign_in_user', // Unknown plugin
301
- 'cartflows_save_cart_abandonment_data', // WooCommerce cartflow
302
- 'rcp_process_register_form', // WordPress Membership Plugin – Restrict Content
303
- 'give_process_donation', // GiveWP
304
- 'apus_ajax_login', // ???? plugin authorization
305
- 'bookly_save_customer', //bookly
306
- 'postmark_test', //Avocet
307
- 'postmark_save', //Avocet
308
- 'ck_get_subscriber', //ConvertKit checking the subscriber
309
- 'metorik_send_cart', //Metorik skip
310
- );
311
-
312
- // Skip test if
313
- if( !$apbct->settings['general_contact_forms_test'] || // Test disabled
314
- !apbct_is_user_enable($apbct->user) || // User is admin, editor, author
315
- // (function_exists('get_current_user_id') && get_current_user_id() != 0) || // Check with default wp_* function if it's admin
316
- (!$apbct->settings['protect_logged_in'] && ($apbct->user instanceof WP_User) && $apbct->user->ID !== 0 ) || // Logged in user
317
- apbct_exclusions_check__url() || // url exclusions
318
- (isset($_POST['action']) && in_array($_POST['action'], $skip_post)) || // Special params
319
- (isset($_GET['action']) && in_array($_GET['action'], $skip_post)) || // Special params
320
- isset($_POST['quform_submit']) || //QForms multi-paged form skip
321
- // QAEngine Theme fix
322
- ( strval(current_action()) != 'et_pre_insert_answer' &&
323
- (
324
- (isset($message_obj['author']) && intval($message_obj['author']) == 0) ||
325
- (isset($message_obj['post_author']) && intval($message_obj['post_author']) == 0)
326
- )
327
- ) ||
328
- (isset($_POST['action'], $_POST['arm_action']) && $_POST['action'] == 'arm_shortcode_form_ajax_action' && $_POST['arm_action'] == 'please-login') //arm forms skip login
329
- )
330
- {
331
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
332
- return false;
333
- }
334
-
335
- //General post_info for all ajax calls
336
- $post_info = array(
337
- 'comment_type' => 'feedback_ajax',
338
- 'post_url' => apbct_get_server_variable( 'HTTP_REFERER' ), // Page URL must be an previous page
339
- );
340
-
341
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
342
-
343
- if(isset($_POST['user_login']))
344
- $sender_nickname = $_POST['user_login'];
345
- else
346
- $sender_nickname = '';
347
-
348
- //QAEngine Theme answers
349
- if( !empty($message_obj) && isset($message_obj['post_type'], $message_obj['post_content']) ){
350
- $curr_user = get_user_by('id', $message_obj['author']);
351
- if (!$curr_user)
352
- $curr_user = get_user_by('id', $message_obj['post_author']);
353
- $ct_post_temp['comment'] = $message_obj['post_content'];
354
- $ct_post_temp['email'] = $curr_user->data->user_email;
355
- $ct_post_temp['name'] = $curr_user->data->user_login;
356
- }
357
-
358
- //CSCF fix
359
- if(isset($_POST['action']) && $_POST['action']== 'cscf-submitform'){
360
- $ct_post_temp[] = $message_obj['comment_author'];
361
- $ct_post_temp[] = $message_obj['comment_author_email'];
362
- $ct_post_temp[] = $message_obj['comment_content'];
363
- }
364
-
365
- //??? fix
366
- if(isset($_POST['action'], $_POST['target']) && ($_POST['action']=='request_appointment'||$_POST['action']=='send_message')){
367
- $ct_post_temp=$_POST;
368
- $ct_post_temp['target']=1;
369
- }
370
-
371
- //UserPro fix
372
- if(isset($_POST['action'], $_POST['template']) && $_POST['action']=='userpro_process_form' && $_POST['template']=='register'){
373
- $ct_post_temp = $_POST;
374
- $ct_post_temp['shortcode'] = '';
375
- }
376
- //Reviewer fix
377
- if(isset($_POST['action']) && $_POST['action'] == 'rwp_ajax_action_rating')
378
- {
379
- $ct_post_temp['name'] = $_POST['user_name'];
380
- $ct_post_temp['email'] = $_POST['user_email'];
381
- $ct_post_temp['comment'] = $_POST['comment'];
382
- }
383
- //Woocommerce checkout
384
- if(isset($_POST['action']) && $_POST['action']=='woocommerce_checkout'){
385
- $post_info['comment_type'] = 'order';
386
- }
387
- //Easy Forms for Mailchimp
388
- if( \Cleantalk\Variables\Post::get('action') == 'process_form_submission' ){
389
- $post_info['comment_type'] = 'contact_enquire_wordpress_easy_forms_for_mailchimp';
390
- if( \Cleantalk\Variables\Post::get('form_data') ) {
391
- $form_data = explode( '&', urldecode( \Cleantalk\Variables\Post::get('form_data') ) );
392
- $form_data_arr = array();
393
- foreach ( $form_data as $val ) {
394
- $form_data_element = explode( '=', $val );
395
- $form_data_arr[$form_data_element[0]] = @$form_data_element[1];
396
- }
397
- if( isset( $form_data_arr['EMAIL'] ) )
398
- $ct_post_temp['email'] = $form_data_arr['EMAIL'];
399
- if( isset( $form_data_arr['FNAME'] ) )
400
- $ct_post_temp['nickname'] = $form_data_arr['FNAME'];
401
- }
402
- }
403
- if (isset($_POST['action']) && $_POST['action'] == 'ufbl_front_form_action'){
404
- $ct_post_temp = $_POST;
405
- foreach ($ct_post_temp as $key => $value) {
406
- if (preg_match('/form_data_\d_name/', $key))
407
- unset($ct_post_temp[$key]);
408
- }
409
- }
410
-
411
- $ct_temp_msg_data = isset($ct_post_temp)
412
- ? ct_get_fields_any($ct_post_temp)
413
- : ct_get_fields_any($_POST);
414
-
415
- $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
416
- $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
417
- $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
418
- $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
419
- $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
420
- if($subject != '') {
421
- $message['subject'] = $subject;
422
- }
423
-
424
- // Skip submission if no data found
425
- if ($sender_email === ''|| !$contact_form) {
426
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
427
- return false;
428
- }
429
-
430
-
431
- // Mailpoet fix
432
- if (isset($message['wysijaData'], $message['wysijaplugin'], $message['task'], $message['controller']) && $message['wysijaplugin'] == 'wysija-newsletters' && $message['controller'] == 'campaigns') {
433
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
434
- return false;
435
- }
436
-
437
- // Mailpoet3 admin skip fix
438
- if (isset($_POST['action'], $_POST['method']) && $_POST['action'] == 'mailpoet' && $_POST['method'] =='save') {
439
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
440
- return false;
441
- }
442
-
443
-
444
- // WP Foto Vote Fix
445
- if (!empty($_FILES)){
446
- foreach($message as $key => $value){
447
- if(strpos($key, 'oje') !== false) {
448
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
449
- return false;
450
- }
451
- } unset($key ,$value);
452
- }
453
-
454
- /**
455
- * @todo Contact form detect
456
- */
457
- // Detect contact form an set it's name to $contact_form to use later
458
- $contact_form = null;
459
- foreach($_POST as $param => $value){
460
- if(strpos($param, 'et_pb_contactform_submit') === 0){
461
- $contact_form = 'contact_form_divi_theme';
462
- $contact_form_additional = str_replace($param, '', $param);
463
- }
464
- if(strpos($param, 'avia_generated_form') === 0){
465
- $contact_form = 'contact_form_enfold_theme';
466
- $contact_form_additional = str_replace('avia_generated_form', '', $param);
467
- }
468
- if(!empty($contact_form))
469
- break;
470
- }
471
-
472
- $base_call_result = apbct_base_call(
473
- array(
474
- 'message' => $message,
475
- 'sender_email' => $sender_email,
476
- 'sender_nickname' => $sender_nickname,
477
- 'sender_info' => array('post_checkjs_passed' => $checkjs),
478
- 'post_info' => $post_info,
479
- 'js_on' => $checkjs,
480
- )
481
- );
482
- $ct_result = $base_call_result['ct_result'];
483
-
484
- if ($ct_result->allow == 0)
485
- {
486
- if(isset($_POST['action']) && $_POST['action']=='wpuf_submit_register'){
487
- $result=Array('success'=>false,'error'=>$ct_result->comment);
488
- @header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
489
- print json_encode($result);
490
- die();
491
- }
492
- else if(isset($_POST['action']) && $_POST['action']=='mymail_form_submit')
493
- {
494
- $result=Array('success'=>false,'html'=>$ct_result->comment);
495
- @header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
496
- print json_encode($result);
497
- die();
498
- }
499
- else if(isset($_POST['action'], $_POST['task']) && $_POST['action'] == 'wysija_ajax' && $_POST['task'] != 'send_preview' && $_POST['task'] != 'send_test_mail')
500
- {
501
- $result=Array('result'=>false,'msgs'=>Array('updated'=>Array($ct_result->comment)));
502
- //@header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
503
- print $_GET['callback'].'('.json_encode($result).');';
504
- die();
505
- }
506
- else if(isset($_POST['action']) && $_POST['action']=='cs_registration_validation')
507
- {
508
- $result=Array("type"=>"error","message"=>$ct_result->comment);
509
- print json_encode($result);
510
- die();
511
- }
512
- else if(isset($_POST['action']) && ($_POST['action']=='request_appointment' || $_POST['action']=='send_message'))
513
- {
514
- print $ct_result->comment;
515
- die();
516
- }
517
- else if(isset($_POST['action']) && $_POST['action']=='zn_do_login')
518
- {
519
- print '<div id="login_error">'.$ct_result->comment.'</div>';
520
- die();
521
- }
522
- else if(isset($_POST['action']) && $_POST['action']=='vfb_submit')
523
- {
524
- $result=Array('result'=>false,'message'=>$ct_result->comment);
525
- @header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
526
- print json_encode($result);
527
- die();
528
- }
529
- else if(isset($_POST['action']) && $_POST['action']=='woocommerce_checkout')
530
- {
531
- print $ct_result->comment;
532
- die();
533
- }
534
- else if(isset($_POST['action']) && $_POST['action']=='frm_entries_create')
535
- {
536
- $result=Array('112'=>$ct_result->comment);
537
- print json_encode($result);
538
- die();
539
- }
540
- else if(isset($_POST['cma-action']) && $_POST['cma-action']=='add')
541
- {
542
- $result=Array('success'=>0, 'thread_id'=>null,'messages'=>Array($ct_result->comment));
543
- print json_encode($result);
544
- die();
545
- }
546
- else if(isset($_POST['action']) && $_POST['action']=='td_mod_register')
547
- {
548
- print json_encode(array('register', 0, $ct_result->comment));
549
- die();
550
- }
551
- else if(isset($_POST['action']) && $_POST['action']=='tmpl_ajax_check_user_email')
552
- {
553
- print "17,email";
554
- die();
555
- }
556
- else if(isset($_POST['action']) && ($_POST['action']=='tevolution_submit_from_preview' || $_POST['action']=='submit_form_recaptcha_validation'))
557
- {
558
- print $ct_result->comment;
559
- die();
560
- }
561
- // WooWaitList
562
- // http://codecanyon.net/item/woowaitlist-woocommerce-back-in-stock-notifier/7103373
563
- else if(isset($_POST['action']) && $_POST['action']=='wew_save_to_db_callback')
564
- {
565
- $result = array();
566
- $result['error'] = 1;
567
- $result['message'] = $ct_result->comment;
568
- $result['code'] = 5; // Unused code number in WooWaitlist
569
- print json_encode($result);
570
- die();
571
- }
572
- // UserPro
573
- else if(isset($_POST['action'], $_POST['template']) && $_POST['action']=='userpro_process_form' && $_POST['template']=='register')
574
- {
575
- foreach($_POST as $key => $value){
576
- $output[$key]=$value;
577
- }unset($key, $value);
578
- $output['template'] = $ct_result->comment;
579
- $output=json_encode($output);
580
- print_r($output);
581
- die;
582
- }
583
- // Quick event manager
584
- else if(isset($_POST['action']) && $_POST['action']=='qem_validate_form'){
585
- $errors[] = 'registration_forbidden';
586
- $result = Array(
587
- 'success' => 'false',
588
- 'errors' => $errors,
589
- 'title' => $ct_result->comment
590
- );
591
- print json_encode($result);
592
- die();
593
- }
594
- // Quick Contact Form
595
- elseif(isset($_POST['action']) && $_POST['action'] == 'qcf_validate_form')
596
- {
597
- $result = Array(
598
- 'blurb' => "<h1>".$ct_result->comment."</h1>",
599
- 'display' => "Oops, got a few problems here",
600
- 'errors' => array(
601
- 0 => array(
602
- 'error' => 'error',
603
- 'name' => 'name'
604
- ),
605
- ),
606
- 'success' => 'false',
607
- );
608
- print json_encode($result);
609
- die();
610
- }
611
- // Usernoise Contact Form
612
- elseif(isset($_POST['title'], $_POST['email'], $_POST['type'], $_POST['ct_checkjs']))
613
- {
614
- return array($ct_result->comment);
615
- die();
616
- }
617
- // amoForms
618
- elseif(isset($_POST['action']) && $_POST['action'] == 'amoforms_submit')
619
- {
620
- $result = Array(
621
- 'result' => true,
622
- 'type' => "html",
623
- 'value' => "<h1 style='font-size: 25px; color: red;'>".$ct_result->comment."</h1>",
624
- 'fast' => false
625
- );
626
- print json_encode($result);
627
- die();
628
- }
629
- // MailChimp for Wordpress Premium
630
- elseif(!empty($_POST['_mc4wp_form_id']))
631
- {
632
- return 'ct_mc4wp_response';
633
- }
634
- // QAEngine Theme answers
635
- elseif ( !empty($message_obj) && isset($message_obj['post_type'], $message_obj['post_content']) ){
636
- throw new Exception($ct_result->comment);
637
- }
638
- //ES Add subscriber
639
- elseif(isset($_POST['action']) && $_POST['action'] == 'es_add_subscriber')
640
- {
641
- $result = Array(
642
- 'error' => 'unexpected-error',
643
- );
644
- print json_encode($result);
645
- die();
646
- }
647
- //Convertplug. Strpos because action value dynamically changes and depends on mailing service
648
- elseif (isset($_POST['action']) && strpos($_POST['action'], '_add_subscriber') !== false){
649
- $result = Array(
650
- 'action' => "message",
651
- 'detailed_msg' => "",
652
- 'email_status' => false,
653
- 'message' => "<h1 style='font-size: 25px; color: red;'>".$ct_result->comment."</h1>",
654
- 'status' => "error",
655
- 'url' => "none"
656
- );
657
- print json_encode($result);
658
- die();
659
- }
660
- // Ultimate Form Builder
661
- elseif (isset($_POST['action']) && $_POST['action'] == 'ufbl_front_form_action'){
662
- $result = Array(
663
- 'error_keys' => array(),
664
- 'error_flag' => 1,
665
- 'response_message' => $ct_result->comment
666
- );
667
- print json_encode($result);
668
- die();
669
- }
670
- // Smart Forms
671
- elseif (isset($_POST['action']) && $_POST['action'] == 'rednao_smart_forms_save_form_values'){
672
- $result = Array(
673
- 'message' => $ct_result->comment,
674
- 'refreshCaptcha' => 'n',
675
- 'success' => 'n'
676
- );
677
- print json_encode($result);
678
- die();
679
- }
680
- //cFormsII
681
- elseif(isset($_POST['action']) && $_POST['action'] == 'submitcform')
682
- {
683
- header('Content-Type: application/json');
684
- $result = Array(
685
- 'no' => isset($_POST['cforms_id']) ? $_POST['cforms_id'] : '',
686
- 'result' => 'failure',
687
- 'html' =>$ct_result->comment,
688
- 'hide' => false,
689
- 'redirection' => null
690
- );
691
- print json_encode($result);
692
- die();
693
- }
694
- //Contact Form by Web-Settler
695
- elseif(isset($_POST['smFieldData']))
696
- {
697
- $result = Array(
698
- 'signal' => true,
699
- 'code' => 0,
700
- 'thanksMsg' => $ct_result->comment,
701
- 'errors' => array(),
702
- 'isMsg' => true,
703
- 'redirectUrl' => null
704
- );
705
- print json_encode($result);
706
- die();
707
- }
708
- //Reviewer
709
- elseif(isset($_POST['action']) && $_POST['action'] == 'rwp_ajax_action_rating')
710
- {
711
- $result = Array(
712
- 'success' => false,
713
- 'data' => array(0=>$ct_result->comment)
714
- );
715
- print json_encode($result);
716
- die();
717
- }
718
- // CouponXXL Theme
719
- elseif(isset($_POST['_wp_http_referer'], $_POST['register_field'], $_POST['action']) && strpos($_POST['_wp_http_referer'],'/register/account') !== false && $_POST['action'] == 'register'){
720
- $result = array(
721
- 'message' => '<div class="alert alert-error">'.$ct_result->comment.'</div>',
722
- );
723
- die(json_encode($result));
724
- }
725
- //ConvertPro
726
- elseif(isset($_POST['action']) && $_POST['action'] == 'cp_v2_notify_admin' || $_POST['action'] == 'cpro_notify_via_email')
727
- {
728
- $result = Array(
729
- 'success' => false,
730
- 'data' => array('error'=>$ct_result->comment,'style_slug'=>'convertprot-form'),
731
- );
732
- print json_encode($result);
733
- die();
734
- }
735
- //Easy Forms for Mailchimp
736
- elseif( isset($_POST['action']) && $_POST['action']=='process_form_submission' ) {
737
- wp_send_json_error(
738
- array(
739
- 'error' => 1,
740
- 'response' => $ct_result->comment
741
- )
742
- );
743
- }
744
- //Optin wheel
745
- elseif( isset($_POST['action']) && ($_POST['action'] == 'wof-lite-email-optin' || $_POST['action'] == 'wof-email-optin')) {
746
- wp_send_json_error(__($ct_result->comment, 'wp-optin-wheel'));
747
- }
748
- // Forminator
749
- elseif( isset($_POST['action']) && strpos($_POST['action'], 'forminator_submit') !== false ){
750
- wp_send_json_error(
751
- array(
752
- 'message' => $ct_result->comment,
753
- 'success' => false,
754
- 'errors' => array(),
755
- 'behav' => 'behaviour-thankyou',
756
- )
757
- );
758
- }
759
- else
760
- {
761
- die(json_encode(array( 'apbct' => array(
762
- 'blocked' => true,
763
- 'comment' => $ct_result->comment,
764
- 'stop_script' => \Cleantalk\Variables\Post::has_string('action', 'tve_leads_ajax_')
765
- ? 1
766
- : 0
767
- ))));
768
- }
769
- }
770
- //Allow == 1
771
- else{
772
- //QAEngine Theme answers
773
- if ( !empty($message_obj) && isset($message_obj['post_type'], $message_obj['post_content']) ){
774
- return $message_obj;
775
- }
776
- // Force AJAX check
777
- if( \Cleantalk\Variables\Post::get('action') == 'cleantalk_force_ajax_check' ){
778
- die(json_encode(array( 'apbct' => array(
779
- 'blocked' => false,
780
- 'allow' => true,
781
- ))));
782
- }
783
- }
784
- }
 
 
 
 
 
 
1
+ <?php
2
+ global $cleantalk_hooked_actions;
3
+
4
+ /*
5
+ AJAX functions
6
+ */
7
+
8
+ //$cleantalk_ajax_actions_to_check - array for POST 'actions' we should check.
9
+
10
+ $cleantalk_ajax_actions_to_check[] = 'qcf_validate_form'; //Quick Contact Form
11
+ $cleantalk_ajax_actions_to_check[] = 'amoforms_submit'; //amoForms
12
+
13
+ //cleantalk_hooked_actions[] - array for POST 'actions' which were direct hooked.
14
+
15
+ $cleantalk_hooked_actions[] = 'rwp_ajax_action_rating'; //Don't check Reviewer plugin
16
+
17
+ $cleantalk_hooked_actions[] = 'ct_feedback_comment';
18
+
19
+ /* MailChimp Premium*/
20
+ add_filter('mc4wp_form_errors', 'ct_mc4wp_ajax_hook');
21
+
22
+ /*hooks for Usernoise Form*/
23
+ add_action('un_feedback_form_body', 'ct_add_hidden_fields',1);
24
+ add_filter('un_validate_feedback', 'ct_ajax_hook', 1, 2);
25
+
26
+ /*hooks for AJAX Login & Register email validation*/
27
+ add_action( 'wp_ajax_nopriv_validate_email', 'ct_validate_email_ajaxlogin',1 );
28
+ add_action( 'wp_ajax_validate_email', 'ct_validate_email_ajaxlogin',1 );
29
+ $cleantalk_hooked_actions[]='validate_email';
30
+
31
+ /*hooks for user registration*/
32
+ add_action( 'user_register', 'ct_user_register_ajaxlogin',1 );
33
+
34
+ /*hooks for WPUF pro */
35
+ //add_action( 'wp_ajax_nopriv_wpuf_submit_register', 'ct_wpuf_submit_register',1 );
36
+ //add_action( 'wp_ajax_wpuf_submit_register', 'ct_wpuf_submit_register',1 );
37
+ add_action( 'wp_ajax_nopriv_wpuf_submit_register', 'ct_ajax_hook',1 );
38
+ add_action( 'wp_ajax_wpuf_submit_register', 'ct_ajax_hook',1 );
39
+ $cleantalk_hooked_actions[]='submit_register';
40
+
41
+ /*hooks for MyMail */
42
+ //add_action( 'wp_ajax_nopriv_mymail_form_submit', 'ct_mymail_form_submit',1 );
43
+ //add_action( 'wp_ajax_mymail_form_submit', 'ct_mymail_form_submit',1 );
44
+ add_action( 'wp_ajax_nopriv_mymail_form_submit', 'ct_ajax_hook',1 );
45
+ add_action( 'wp_ajax_mymail_form_submit', 'ct_ajax_hook',1 );
46
+ $cleantalk_hooked_actions[]='form_submit';
47
+
48
+ /*hooks for MailPoet */
49
+ //add_action( 'wp_ajax_nopriv_wysija_ajax', 'ct_wysija_ajax',1 );
50
+ //add_action( 'wp_ajax_wysija_ajax', 'ct_wysija_ajax',1 );
51
+ add_action( 'wp_ajax_nopriv_wysija_ajax', 'ct_ajax_hook',1 );
52
+ add_action( 'wp_ajax_wysija_ajax', 'ct_ajax_hook',1 );
53
+ $cleantalk_hooked_actions[]='wysija_ajax';
54
+
55
+ /*hooks for cs_registration_validation */
56
+ //add_action( 'wp_ajax_nopriv_cs_registration_validation', 'ct_cs_registration_validation',1 );
57
+ //add_action( 'wp_ajax_cs_registration_validation', 'ct_cs_registration_validation',1 );
58
+ add_action( 'wp_ajax_nopriv_cs_registration_validation', 'ct_ajax_hook',1 );
59
+ add_action( 'wp_ajax_cs_registration_validation', 'ct_ajax_hook',1 );
60
+ $cleantalk_hooked_actions[]='cs_registration_validation';
61
+
62
+ /*hooks for send_message and request_appointment */
63
+ //add_action( 'wp_ajax_nopriv_send_message', 'ct_sm_ra',1 );
64
+ //add_action( 'wp_ajax_send_message', 'ct_sm_ra',1 );
65
+ //add_action( 'wp_ajax_nopriv_request_appointment', 'ct_sm_ra',1 );
66
+ //add_action( 'wp_ajax_request_appointment', 'ct_sm_ra',1 );
67
+ add_action( 'wp_ajax_nopriv_send_message', 'ct_ajax_hook',1 );
68
+ add_action( 'wp_ajax_send_message', 'ct_ajax_hook',1 );
69
+ add_action( 'wp_ajax_nopriv_request_appointment', 'ct_ajax_hook',1 );
70
+ add_action( 'wp_ajax_request_appointment', 'ct_ajax_hook',1 );
71
+ $cleantalk_hooked_actions[]='send_message';
72
+ $cleantalk_hooked_actions[]='request_appointment';
73
+
74
+ /*hooks for zn_do_login */
75
+ //add_action( 'wp_ajax_nopriv_zn_do_login', 'ct_zn_do_login',1 );
76
+ //add_action( 'wp_ajax_zn_do_login', 'ct_zn_do_login',1 );
77
+ add_action( 'wp_ajax_nopriv_zn_do_login', 'ct_ajax_hook',1 );
78
+ add_action( 'wp_ajax_zn_do_login', 'ct_ajax_hook',1 );
79
+ $cleantalk_hooked_actions[]='zn_do_login';
80
+
81
+ /*hooks for zn_do_login */
82
+ //add_action( 'wp_ajax_nopriv_cscf-submitform', 'ct_cscf_submitform',1 );
83
+ //add_action( 'wp_ajax_cscf-submitform', 'ct_cscf_submitform',1 );
84
+ if(isset($_POST['action']) && $_POST['action'] == 'cscf-submitform'){
85
+ add_filter('preprocess_comment', 'ct_ajax_hook', 1);
86
+ //add_action( 'wp_ajax_nopriv_cscf-submitform', 'ct_ajax_hook',1 );
87
+ //add_action( 'wp_ajax_cscf-submitform', 'ct_ajax_hook',1 );
88
+ $cleantalk_hooked_actions[]='cscf-submitform';
89
+ }
90
+
91
+
92
+ /*hooks for visual form builder */
93
+ //add_action( 'wp_ajax_nopriv_vfb_submit', 'ct_vfb_submit',1 );
94
+ //add_action( 'wp_ajax_vfb_submit', 'ct_vfb_submit',1 );
95
+ add_action( 'wp_ajax_nopriv_vfb_submit', 'ct_ajax_hook',1 );
96
+ add_action( 'wp_ajax_vfb_submit', 'ct_ajax_hook',1 );
97
+ $cleantalk_hooked_actions[]='vfb_submit';
98
+
99
+ /*hooks for woocommerce_checkout*/
100
+ add_action( 'wp_ajax_nopriv_woocommerce_checkout', 'ct_ajax_hook',1 );
101
+ add_action( 'wp_ajax_woocommerce_checkout', 'ct_ajax_hook',1 );
102
+ $cleantalk_hooked_actions[]='woocommerce_checkout';
103
+ $cleantalk_hooked_actions[]='wcfm_ajax_controller';
104
+
105
+ /*hooks for frm_action*/
106
+ add_action( 'wp_ajax_nopriv_frm_entries_create', 'ct_ajax_hook',1 );
107
+ add_action( 'wp_ajax_frm_entries_create', 'ct_ajax_hook',1 );
108
+ $cleantalk_hooked_actions[]='frm_entries_create';
109
+
110
+ add_action( 'wp_ajax_nopriv_td_mod_register', 'ct_ajax_hook',1 );
111
+ add_action( 'wp_ajax_td_mod_register', 'ct_ajax_hook',1 );
112
+ $cleantalk_hooked_actions[]='td_mod_register';
113
+
114
+ /*hooks for tevolution theme*/
115
+ add_action( 'wp_ajax_nopriv_tmpl_ajax_check_user_email', 'ct_ajax_hook',1 );
116
+ add_action( 'wp_ajax_tmpl_ajax_check_user_email', 'ct_ajax_hook',1 );
117
+ add_action( 'wp_ajax_nopriv_tevolution_submit_from_preview', 'ct_ajax_hook',1 );
118
+ add_action( 'wp_ajax_tevolution_submit_from_preview', 'ct_ajax_hook',1 );
119
+ add_action( 'wp_ajax_nopriv_submit_form_recaptcha_validation', 'ct_ajax_hook',1 );
120
+ add_action( 'wp_ajax_tmpl_submit_form_recaptcha_validation', 'ct_ajax_hook',1 );
121
+ $cleantalk_hooked_actions[]='tmpl_ajax_check_user_email';
122
+ $cleantalk_hooked_actions[]='tevolution_submit_from_preview';
123
+ $cleantalk_hooked_actions[]='submit_form_recaptcha_validation';
124
+
125
+ /* hooks for contact forms by web settler ajax*/
126
+ add_action( 'wp_ajax_nopriv_smuzform-storage', 'ct_ajax_hook',1 );
127
+ $cleantalk_hooked_actions[]='smuzform_form_submit';
128
+
129
+ /* hooks for reviewer plugin*/
130
+ add_action( 'wp_ajax_nopriv_rwp_ajax_action_rating', 'ct_ajax_hook',1 );
131
+ $cleantalk_hooked_actions[]='rwp-submit-wrap';
132
+
133
+ $cleantalk_hooked_actions[]='post_update';
134
+
135
+ /* Ninja Forms hoocked actions */
136
+ $cleantalk_hooked_actions[]='ninja_forms_ajax_submit';
137
+ $cleantalk_hooked_actions[]='nf_ajax_submit';
138
+ $cleantalk_hooked_actions[]='ninja_forms_process'; // Depricated ?
139
+
140
+ /* Follow-Up Emails */
141
+ $cleantalk_hooked_actions[] = 'fue_wc_set_cart_email'; // Don't check email via this plugin
142
+
143
+ /* Follow-Up Emails */
144
+ $cleantalk_hooked_actions[] = 'fue_wc_set_cart_email'; // Don't check email via this plugin
145
+
146
+ /* The Fluent Form have the direct integration */
147
+ $cleantalk_hooked_actions[] = 'fluentform_submit';
148
+
149
+ /* Estimation Forms have the direct integration */
150
+ if( class_exists('LFB_Core') ) {
151
+ $cleantalk_hooked_actions[] = 'send_email';
152
+ }
153
+
154
+ function ct_validate_email_ajaxlogin($email=null, $is_ajax=true){
155
+
156
+ $email = is_null( $email ) ? $email : $_POST['email'];
157
+ $email = sanitize_email($email);
158
+ $is_good = !filter_var($email, FILTER_VALIDATE_EMAIL) || email_exists($email) ? false : true;
159
+
160
+ if(class_exists('AjaxLogin')&&isset($_POST['action'])&&$_POST['action']=='validate_email'){
161
+
162
+ $checkjs = apbct_js_test('ct_checkjs', $_POST);
163
+ $sender_info['post_checkjs_passed'] = $checkjs;
164
+ if ($checkjs === null){
165
+ $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
166
+ $sender_info['cookie_checkjs_passed'] = $checkjs;
167
+ }
168
+
169
+ //Making a call
170
+ $base_call_result = apbct_base_call(
171
+ array(
172
+ 'sender_email' => $email,
173
+ 'sender_nickname' => '',
174
+ 'sender_info' => $sender_info,
175
+ 'js_on' => $checkjs,
176
+ ),
177
+ true
178
+ );
179
+
180
+ $ct_result = $base_call_result['ct_result'];
181
+
182
+ if ($ct_result->allow===0){
183
+ $is_good=false;
184
+ }
185
+ }
186
+
187
+ if($is_good){
188
+ $ajaxresult=array(
189
+ 'description' => null,
190
+ 'cssClass' => 'noon',
191
+ 'code' => 'success'
192
+ );
193
+ }else{
194
+ $ajaxresult=array(
195
+ 'description' => 'Invalid Email',
196
+ 'cssClass' => 'error-container',
197
+ 'code' => 'error'
198
+ );
199
+ }
200
+
201
+ $ajaxresult = json_encode($ajaxresult);
202
+ print $ajaxresult;
203
+ wp_die();
204
+ }
205
+
206
+ function ct_user_register_ajaxlogin($user_id)
207
+ {
208
+ if(class_exists('AjaxLogin')&&isset($_POST['action'])&&$_POST['action']=='register_submit')
209
+ {
210
+
211
+ $checkjs = apbct_js_test('ct_checkjs', $_POST);
212
+ $sender_info['post_checkjs_passed'] = $checkjs;
213
+ if ($checkjs === null){
214
+ $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
215
+ $sender_info['cookie_checkjs_passed'] = $checkjs;
216
+ }
217
+
218
+ //Making a call
219
+ $base_call_result = apbct_base_call(
220
+ array(
221
+ 'sender_email' => sanitize_email($_POST['email']),
222
+ 'sender_nickname' => sanitize_email($_POST['login']),
223
+ 'sender_info' => $sender_info,
224
+ 'js_on' => $checkjs,
225
+ ),
226
+ true
227
+ );
228
+
229
+ $ct_result = $base_call_result['ct_result'];
230
+
231
+ if ($ct_result->allow === 0)
232
+ {
233
+ wp_delete_user($user_id);
234
+ }
235
+ }
236
+ return $user_id;
237
+ }
238
+
239
+ /**
240
+ * Hook into MailChimp for WordPress `mc4wp_form_errors` filter.
241
+ *
242
+ * @param array $errors
243
+ * @return array
244
+ */
245
+ function ct_mc4wp_ajax_hook( array $errors )
246
+ {
247
+ $result = ct_ajax_hook();
248
+
249
+ // only return modified errors array when function returned a string value (the message key)
250
+ if( is_string( $result ) ) {
251
+ $errors[] = $result;
252
+ }
253
+
254
+ return $errors;
255
+ }
256
+
257
+ function ct_ajax_hook($message_obj = false, $additional = false)
258
+ {
259
+ global $apbct, $current_user;
260
+
261
+ $message_obj = (array)$message_obj;
262
+
263
+ // Get current_user and set it globaly
264
+ apbct_wp_set_current_user($current_user instanceof WP_User ? $current_user : apbct_wp_get_current_user() );
265
+
266
+ // $_REQUEST['action'] to skip. Go out because of not spam data
267
+ $skip_post = array(
268
+ 'apbct_js_keys__get', // Our service code
269
+ 'gmaps_display_info_window', // Geo My WP pop-up windows.
270
+ 'gmw_ps_display_info_window', // Geo My WP pop-up windows.
271
+ 'the_champ_user_auth', // Super Socializer
272
+ 'simbatfa-init-otp', //Two-Factor Auth
273
+ 'wppb_msf_check_required_fields', //ProfileBuilder skip step checking
274
+ 'boss_we_login', //Login form
275
+ 'sidebar_login_process', // Login CF7
276
+ 'cp_update_style_settings', // Convert Pro. Saving settings
277
+ 'updraft_savesettings', // UpdraftPlus
278
+ 'wpdUpdateAutomatically', //Comments update
279
+ 'upload-attachment', // Skip ulpload attachments
280
+ 'iwj_update_profile', //Skip profile page checker
281
+ 'st_partner_create_service', //Skip add hotel via admin
282
+ 'vp_ajax_vpt_option_save', // https://themeforest.net/item/motor-vehicles-parts-equipments-accessories-wordpress-woocommerce-theme/16829946
283
+ 'mailster_send_test', //Mailster send test admin
284
+ 'acf/validate_save_post', //ACF validate post admin
285
+ 'admin:saveThemeOptions', //Ait-theme admin checking
286
+ 'save_tourmaster_option', //Tourmaster admin save
287
+ 'validate_register_email', // Service id #313320
288
+ 'elementor_pro_forms_send_form', //Elementor Pro
289
+ 'phone-orders-for-woocommerce', //Phone orders for woocommerce backend
290
+ 'ihc_check_reg_field_ajax', //Ajax check required fields
291
+ 'OSTC_lostPassword', //Lost password ajax form
292
+ 'check_retina_image_availability', //There are too many ajax requests from mobile
293
+ 'uap_check_reg_field_ajax', // Ultimate Affiliate Pro. Form validation.
294
+ 'edit-comment', // Edit comments by admin ??? that shouldn't happen
295
+ 'formcraft3_save_form_progress', // FormCraft – Contact Form Builder for WordPress. Save progress.
296
+ 'wpdmpp_save_settings', // PayPal save settings.
297
+ 'iwj_login', // Fix for unknown plugin for user #133315
298
+ 'custom_user_login', // Fix for unknown plugin for user #466875
299
+ 'wordfence_ls_authenticate', //Fix for wordfence auth
300
+ 'frm_strp_amount', //Admin stripe form
301
+ 'wouCheckOnlineUsers', //Skip updraft admin checking users
302
+ 'et_fb_get_shortcode_from_fb_object', //Skip generate shortcode
303
+ 'pp_lf_process_login', //Skip login form
304
+ 'check_email', //Ajax email checking
305
+ 'dflg_do_sign_in_user', // Unknown plugin
306
+ 'cartflows_save_cart_abandonment_data', // WooCommerce cartflow
307
+ 'rcp_process_register_form', // WordPress Membership Plugin – Restrict Content
308
+ 'give_process_donation', // GiveWP
309
+ 'apus_ajax_login', // ???? plugin authorization
310
+ 'bookly_save_customer', //bookly
311
+ 'postmark_test', //Avocet
312
+ 'postmark_save', //Avocet
313
+ 'ck_get_subscriber', //ConvertKit checking the subscriber
314
+ 'metorik_send_cart', //Metorik skip
315
+ 'ppom_ajax_validation', // PPOM add to cart validation
316
+ );
317
+
318
+ // Skip test if
319
+ if( !$apbct->settings['general_contact_forms_test'] || // Test disabled
320
+ !apbct_is_user_enable($apbct->user) || // User is admin, editor, author
321
+ // (function_exists('get_current_user_id') && get_current_user_id() != 0) || // Check with default wp_* function if it's admin
322
+ (!$apbct->settings['protect_logged_in'] && ($apbct->user instanceof WP_User) && $apbct->user->ID !== 0 ) || // Logged in user
323
+ apbct_exclusions_check__url() || // url exclusions
324
+ (isset($_POST['action']) && in_array($_POST['action'], $skip_post)) || // Special params
325
+ (isset($_GET['action']) && in_array($_GET['action'], $skip_post)) || // Special params
326
+ isset($_POST['quform_submit']) || //QForms multi-paged form skip
327
+ // QAEngine Theme fix
328
+ ( strval(current_action()) != 'et_pre_insert_answer' &&
329
+ (
330
+ (isset($message_obj['author']) && intval($message_obj['author']) == 0) ||
331
+ (isset($message_obj['post_author']) && intval($message_obj['post_author']) == 0)
332
+ )
333
+ ) ||
334
+ (isset($_POST['action'], $_POST['arm_action']) && $_POST['action'] == 'arm_shortcode_form_ajax_action' && $_POST['arm_action'] == 'please-login') //arm forms skip login
335
+ )
336
+ {
337
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
338
+ return false;
339
+ }
340
+
341
+ //General post_info for all ajax calls
342
+ $post_info = array(
343
+ 'comment_type' => 'feedback_ajax',
344
+ 'post_url' => apbct_get_server_variable( 'HTTP_REFERER' ), // Page URL must be an previous page
345
+ );
346
+
347
+ $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
348
+
349
+ if(isset($_POST['user_login']))
350
+ $sender_nickname = $_POST['user_login'];
351
+ else
352
+ $sender_nickname = '';
353
+
354
+ //QAEngine Theme answers
355
+ if( !empty($message_obj) && isset($message_obj['post_type'], $message_obj['post_content']) ){
356
+ $curr_user = get_user_by('id', $message_obj['author']);
357
+ if (!$curr_user)
358
+ $curr_user = get_user_by('id', $message_obj['post_author']);
359
+ $ct_post_temp['comment'] = $message_obj['post_content'];
360
+ $ct_post_temp['email'] = $curr_user->data->user_email;
361
+ $ct_post_temp['name'] = $curr_user->data->user_login;
362
+ }
363
+
364
+ //CSCF fix
365
+ if(isset($_POST['action']) && $_POST['action']== 'cscf-submitform'){
366
+ $ct_post_temp[] = $message_obj['comment_author'];
367
+ $ct_post_temp[] = $message_obj['comment_author_email'];
368
+ $ct_post_temp[] = $message_obj['comment_content'];
369
+ }
370
+
371
+ //??? fix
372
+ if(isset($_POST['action'], $_POST['target']) && ($_POST['action']=='request_appointment'||$_POST['action']=='send_message')){
373
+ $ct_post_temp=$_POST;
374
+ $ct_post_temp['target']=1;
375
+ }
376
+
377
+ //UserPro fix
378
+ if(isset($_POST['action'], $_POST['template']) && $_POST['action']=='userpro_process_form' && $_POST['template']=='register'){
379
+ $ct_post_temp = $_POST;
380
+ $ct_post_temp['shortcode'] = '';
381
+ }
382
+ //Reviewer fix
383
+ if(isset($_POST['action']) && $_POST['action'] == 'rwp_ajax_action_rating')
384
+ {
385
+ $ct_post_temp['name'] = $_POST['user_name'];
386
+ $ct_post_temp['email'] = $_POST['user_email'];
387
+ $ct_post_temp['comment'] = $_POST['comment'];
388
+ }
389
+ //Woocommerce checkout
390
+ if(isset($_POST['action']) && $_POST['action']=='woocommerce_checkout'){
391
+ $post_info['comment_type'] = 'order';
392
+ }
393
+ //Easy Forms for Mailchimp
394
+ if( \Cleantalk\Variables\Post::get('action') == 'process_form_submission' ){
395
+ $post_info['comment_type'] = 'contact_enquire_wordpress_easy_forms_for_mailchimp';
396
+ if( \Cleantalk\Variables\Post::get('form_data') ) {
397
+ $form_data = explode( '&', urldecode( \Cleantalk\Variables\Post::get('form_data') ) );
398
+ $form_data_arr = array();
399
+ foreach ( $form_data as $val ) {
400
+ $form_data_element = explode( '=', $val );
401
+ $form_data_arr[$form_data_element[0]] = @$form_data_element[1];
402
+ }
403
+ if( isset( $form_data_arr['EMAIL'] ) )
404
+ $ct_post_temp['email'] = $form_data_arr['EMAIL'];
405
+ if( isset( $form_data_arr['FNAME'] ) )
406
+ $ct_post_temp['nickname'] = $form_data_arr['FNAME'];
407
+ }
408
+ }
409
+ if (isset($_POST['action']) && $_POST['action'] == 'ufbl_front_form_action'){
410
+ $ct_post_temp = $_POST;
411
+ foreach ($ct_post_temp as $key => $value) {
412
+ if (preg_match('/form_data_\d_name/', $key))
413
+ unset($ct_post_temp[$key]);
414
+ }
415
+ }
416
+
417
+ $ct_temp_msg_data = isset($ct_post_temp)
418
+ ? ct_get_fields_any($ct_post_temp)
419
+ : ct_get_fields_any($_POST);
420
+
421
+ $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
422
+ $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
423
+ $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
424
+ $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
425
+ $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
426
+ if($subject != '') {
427
+ $message['subject'] = $subject;
428
+ }
429
+
430
+ // Skip submission if no data found
431
+ if ($sender_email === ''|| !$contact_form) {
432
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
433
+ return false;
434
+ }
435
+
436
+
437
+ // Mailpoet fix
438
+ if (isset($message['wysijaData'], $message['wysijaplugin'], $message['task'], $message['controller']) && $message['wysijaplugin'] == 'wysija-newsletters' && $message['controller'] == 'campaigns') {
439
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
440
+ return false;
441
+ }
442
+
443
+ // Mailpoet3 admin skip fix
444
+ if (isset($_POST['action'], $_POST['method']) && $_POST['action'] == 'mailpoet' && $_POST['method'] =='save') {
445
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
446
+ return false;
447
+ }
448
+
449
+
450
+ // WP Foto Vote Fix
451
+ if (!empty($_FILES)){
452
+ foreach($message as $key => $value){
453
+ if(strpos($key, 'oje') !== false) {
454
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
455
+ return false;
456
+ }
457
+ } unset($key ,$value);
458
+ }
459
+
460
+ /**
461
+ * @todo Contact form detect
462
+ */
463
+ // Detect contact form an set it's name to $contact_form to use later
464
+ $contact_form = null;
465
+ foreach($_POST as $param => $value){
466
+ if(strpos($param, 'et_pb_contactform_submit') === 0){
467
+ $contact_form = 'contact_form_divi_theme';
468
+ $contact_form_additional = str_replace($param, '', $param);
469
+ }
470
+ if(strpos($param, 'avia_generated_form') === 0){
471
+ $contact_form = 'contact_form_enfold_theme';
472
+ $contact_form_additional = str_replace('avia_generated_form', '', $param);
473
+ }
474
+ if(!empty($contact_form))
475
+ break;
476
+ }
477
+
478
+ $base_call_result = apbct_base_call(
479
+ array(
480
+ 'message' => $message,
481
+ 'sender_email' => $sender_email,
482
+ 'sender_nickname' => $sender_nickname,
483
+ 'sender_info' => array('post_checkjs_passed' => $checkjs),
484
+ 'post_info' => $post_info,
485
+ 'js_on' => $checkjs,
486
+ )
487
+ );
488
+ $ct_result = $base_call_result['ct_result'];
489
+
490
+ if ($ct_result->allow == 0)
491
+ {
492
+ if(isset($_POST['action']) && $_POST['action']=='wpuf_submit_register'){
493
+ $result=Array('success'=>false,'error'=>$ct_result->comment);
494
+ @header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
495
+ print json_encode($result);
496
+ die();
497
+ }
498
+ else if(isset($_POST['action']) && $_POST['action']=='mymail_form_submit')
499
+ {
500
+ $result=Array('success'=>false,'html'=>$ct_result->comment);
501
+ @header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
502
+ print json_encode($result);
503
+ die();
504
+ }
505
+ else if(isset($_POST['action'], $_POST['task']) && $_POST['action'] == 'wysija_ajax' && $_POST['task'] != 'send_preview' && $_POST['task'] != 'send_test_mail')
506
+ {
507
+ $result=Array('result'=>false,'msgs'=>Array('updated'=>Array($ct_result->comment)));
508
+ //@header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
509
+ print $_GET['callback'].'('.json_encode($result).');';
510
+ die();
511
+ }
512
+ else if(isset($_POST['action']) && $_POST['action']=='cs_registration_validation')
513
+ {
514
+ $result=Array("type"=>"error","message"=>$ct_result->comment);
515
+ print json_encode($result);
516
+ die();
517
+ }
518
+ else if(isset($_POST['action']) && ($_POST['action']=='request_appointment' || $_POST['action']=='send_message'))
519
+ {
520
+ print $ct_result->comment;
521
+ die();
522
+ }
523
+ else if(isset($_POST['action']) && $_POST['action']=='zn_do_login')
524
+ {
525
+ print '<div id="login_error">'.$ct_result->comment.'</div>';
526
+ die();
527
+ }
528
+ else if(isset($_POST['action']) && $_POST['action']=='vfb_submit')
529
+ {
530
+ $result=Array('result'=>false,'message'=>$ct_result->comment);
531
+ @header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
532
+ print json_encode($result);
533
+ die();
534
+ }
535
+ else if(isset($_POST['action']) && $_POST['action']=='woocommerce_checkout')
536
+ {
537
+ print $ct_result->comment;
538
+ die();
539
+ }
540
+ else if(isset($_POST['action']) && $_POST['action']=='frm_entries_create')
541
+ {
542
+ $result=Array('112'=>$ct_result->comment);
543
+ print json_encode($result);
544
+ die();
545
+ }
546
+ else if(isset($_POST['cma-action']) && $_POST['cma-action']=='add')
547
+ {
548
+ $result=Array('success'=>0, 'thread_id'=>null,'messages'=>Array($ct_result->comment));
549
+ print json_encode($result);
550
+ die();
551
+ }
552
+ else if(isset($_POST['action']) && $_POST['action']=='td_mod_register')
553
+ {
554
+ print json_encode(array('register', 0, $ct_result->comment));
555
+ die();
556
+ }
557
+ else if(isset($_POST['action']) && $_POST['action']=='tmpl_ajax_check_user_email')
558
+ {
559
+ print "17,email";
560
+ die();
561
+ }
562
+ else if(isset($_POST['action']) && ($_POST['action']=='tevolution_submit_from_preview' || $_POST['action']=='submit_form_recaptcha_validation'))
563
+ {
564
+ print $ct_result->comment;
565
+ die();
566
+ }
567
+ // WooWaitList
568
+ // http://codecanyon.net/item/woowaitlist-woocommerce-back-in-stock-notifier/7103373
569
+ else if(isset($_POST['action']) && $_POST['action']=='wew_save_to_db_callback')
570
+ {
571
+ $result = array();
572
+ $result['error'] = 1;
573
+ $result['message'] = $ct_result->comment;
574
+ $result['code'] = 5; // Unused code number in WooWaitlist
575
+ print json_encode($result);
576
+ die();
577
+ }
578
+ // UserPro
579
+ else if(isset($_POST['action'], $_POST['template']) && $_POST['action']=='userpro_process_form' && $_POST['template']=='register')
580
+ {
581
+ foreach($_POST as $key => $value){
582
+ $output[$key]=$value;
583
+ }unset($key, $value);
584
+ $output['template'] = $ct_result->comment;
585
+ $output=json_encode($output);
586
+ print_r($output);
587
+ die;
588
+ }
589
+ // Quick event manager
590
+ else if(isset($_POST['action']) && $_POST['action']=='qem_validate_form'){
591
+ $errors[] = 'registration_forbidden';
592
+ $result = Array(
593
+ 'success' => 'false',
594
+ 'errors' => $errors,
595
+ 'title' => $ct_result->comment
596
+ );
597
+ print json_encode($result);
598
+ die();
599
+ }
600
+ // Quick Contact Form
601
+ elseif(isset($_POST['action']) && $_POST['action'] == 'qcf_validate_form')
602
+ {
603
+ $result = Array(
604
+ 'blurb' => "<h1>".$ct_result->comment."</h1>",
605
+ 'display' => "Oops, got a few problems here",
606
+ 'errors' => array(
607
+ 0 => array(
608
+ 'error' => 'error',
609
+ 'name' => 'name'
610
+ ),
611
+ ),
612
+ 'success' => 'false',
613
+ );
614
+ print json_encode($result);
615
+ die();
616
+ }
617
+ // Usernoise Contact Form
618
+ elseif(isset($_POST['title'], $_POST['email'], $_POST['type'], $_POST['ct_checkjs']))
619
+ {
620
+ return array($ct_result->comment);
621
+ die();
622
+ }
623
+ // amoForms
624
+ elseif(isset($_POST['action']) && $_POST['action'] == 'amoforms_submit')
625
+ {
626
+ $result = Array(
627
+ 'result' => true,
628
+ 'type' => "html",
629
+ 'value' => "<h1 style='font-size: 25px; color: red;'>".$ct_result->comment."</h1>",
630
+ 'fast' => false
631
+ );
632
+ print json_encode($result);
633
+ die();
634
+ }
635
+ // MailChimp for Wordpress Premium
636
+ elseif(!empty($_POST['_mc4wp_form_id']))
637
+ {
638
+ return 'ct_mc4wp_response';
639
+ }
640
+ // QAEngine Theme answers
641
+ elseif ( !empty($message_obj) && isset($message_obj['post_type'], $message_obj['post_content']) ){
642
+ throw new Exception($ct_result->comment);
643
+ }
644
+ //ES Add subscriber
645
+ elseif(isset($_POST['action']) && $_POST['action'] == 'es_add_subscriber')
646
+ {
647
+ $result = Array(
648
+ 'error' => 'unexpected-error',
649
+ );
650
+ print json_encode($result);
651
+ die();
652
+ }
653
+ //Convertplug. Strpos because action value dynamically changes and depends on mailing service
654
+ elseif (isset($_POST['action']) && strpos($_POST['action'], '_add_subscriber') !== false){
655
+ $result = Array(
656
+ 'action' => "message",
657
+ 'detailed_msg' => "",
658
+ 'email_status' => false,
659
+ 'message' => "<h1 style='font-size: 25px; color: red;'>".$ct_result->comment."</h1>",
660
+ 'status' => "error",
661
+ 'url' => "none"
662
+ );
663
+ print json_encode($result);
664
+ die();
665
+ }
666
+ // Ultimate Form Builder
667
+ elseif (isset($_POST['action']) && $_POST['action'] == 'ufbl_front_form_action'){
668
+ $result = Array(
669
+ 'error_keys' => array(),
670
+ 'error_flag' => 1,
671
+ 'response_message' => $ct_result->comment
672
+ );
673
+ print json_encode($result);
674
+ die();
675
+ }
676
+ // Smart Forms
677
+ elseif (isset($_POST['action']) && $_POST['action'] == 'rednao_smart_forms_save_form_values'){
678
+ $result = Array(
679
+ 'message' => $ct_result->comment,
680
+ 'refreshCaptcha' => 'n',
681
+ 'success' => 'n'
682
+ );
683
+ print json_encode($result);
684
+ die();
685
+ }
686
+ //cFormsII
687
+ elseif(isset($_POST['action']) && $_POST['action'] == 'submitcform')
688
+ {
689
+ header('Content-Type: application/json');
690
+ $result = Array(
691
+ 'no' => isset($_POST['cforms_id']) ? $_POST['cforms_id'] : '',
692
+ 'result' => 'failure',
693
+ 'html' =>$ct_result->comment,
694
+ 'hide' => false,
695
+ 'redirection' => null
696
+ );
697
+ print json_encode($result);
698
+ die();
699
+ }
700
+ //Contact Form by Web-Settler
701
+ elseif(isset($_POST['smFieldData']))
702
+ {
703
+ $result = Array(
704
+ 'signal' => true,
705
+ 'code' => 0,
706
+ 'thanksMsg' => $ct_result->comment,
707
+ 'errors' => array(),
708
+ 'isMsg' => true,
709
+ 'redirectUrl' => null
710
+ );
711
+ print json_encode($result);
712
+ die();
713
+ }
714
+ //Reviewer
715
+ elseif(isset($_POST['action']) && $_POST['action'] == 'rwp_ajax_action_rating')
716
+ {
717
+ $result = Array(
718
+ 'success' => false,
719
+ 'data' => array(0=>$ct_result->comment)
720
+ );
721
+ print json_encode($result);
722
+ die();
723
+ }
724
+ // CouponXXL Theme
725
+ elseif(isset($_POST['_wp_http_referer'], $_POST['register_field'], $_POST['action']) && strpos($_POST['_wp_http_referer'],'/register/account') !== false && $_POST['action'] == 'register'){
726
+ $result = array(
727
+ 'message' => '<div class="alert alert-error">'.$ct_result->comment.'</div>',
728
+ );
729
+ die(json_encode($result));
730
+ }
731
+ //ConvertPro
732
+ elseif(isset($_POST['action']) && $_POST['action'] == 'cp_v2_notify_admin' || $_POST['action'] == 'cpro_notify_via_email')
733
+ {
734
+ $result = Array(
735
+ 'success' => false,
736
+ 'data' => array('error'=>$ct_result->comment,'style_slug'=>'convertprot-form'),
737
+ );
738
+ print json_encode($result);
739
+ die();
740
+ }
741
+ //Easy Forms for Mailchimp
742
+ elseif( isset($_POST['action']) && $_POST['action']=='process_form_submission' ) {
743
+ wp_send_json_error(
744
+ array(
745
+ 'error' => 1,
746
+ 'response' => $ct_result->comment
747
+ )
748
+ );
749
+ }
750
+ //Optin wheel
751
+ elseif( isset($_POST['action']) && ($_POST['action'] == 'wof-lite-email-optin' || $_POST['action'] == 'wof-email-optin')) {
752
+ wp_send_json_error(__($ct_result->comment, 'wp-optin-wheel'));
753
+ }
754
+ // Forminator
755
+ elseif( isset($_POST['action']) && strpos($_POST['action'], 'forminator_submit') !== false ){
756
+ wp_send_json_error(
757
+ array(
758
+ 'message' => $ct_result->comment,
759
+ 'success' => false,
760
+ 'errors' => array(),
761
+ 'behav' => 'behaviour-thankyou',
762
+ )
763
+ );
764
+ }
765
+ else
766
+ {
767
+ die(json_encode(array( 'apbct' => array(
768
+ 'blocked' => true,
769
+ 'comment' => $ct_result->comment,
770
+ 'stop_script' => \Cleantalk\Variables\Post::has_string('action', 'tve_leads_ajax_')
771
+ ? 1
772
+ : 0
773
+ ))));
774
+ }
775
+ }
776
+ //Allow == 1
777
+ else{
778
+ //QAEngine Theme answers
779
+ if ( !empty($message_obj) && isset($message_obj['post_type'], $message_obj['post_content']) ){
780
+ return $message_obj;
781
+ }
782
+ // Force AJAX check
783
+ if( \Cleantalk\Variables\Post::get('action') == 'cleantalk_force_ajax_check' ){
784
+ die(json_encode(array( 'apbct' => array(
785
+ 'blocked' => false,
786
+ 'allow' => true,
787
+ ))));
788
+ }
789
+ }
790
+ }
inc/cleantalk-common.php CHANGED
@@ -1,1022 +1,1028 @@
1
- <?php
2
-
3
- use Cleantalk\Antispam\Cleantalk;
4
- use Cleantalk\Antispam\CleantalkRequest;
5
- use Cleantalk\Antispam\CleantalkResponse;
6
-
7
- function apbct_array( $array ){
8
- return new \Cleantalk\Common\Arr( $array );
9
- }
10
-
11
- $ct_checkjs_frm = 'ct_checkjs_frm';
12
- $ct_checkjs_register_form = 'ct_checkjs_register_form';
13
-
14
- $apbct_cookie_request_id_label = 'request_id';
15
- $apbct_cookie_register_ok_label = 'register_ok';
16
-
17
- $ct_checkjs_cf7 = 'ct_checkjs_cf7';
18
- $ct_cf7_comment = '';
19
-
20
- $ct_checkjs_jpcf = 'ct_checkjs_jpcf';
21
- $ct_jpcf_patched = false;
22
- $ct_jpcf_fields = array('name', 'email');
23
-
24
- // Comment already proccessed
25
- $ct_comment_done = false;
26
-
27
- // Comment already proccessed
28
- $ct_signup_done = false;
29
-
30
- //Contains registration error
31
- $ct_registration_error_comment = false;
32
-
33
- // Default value for JS test
34
- $ct_checkjs_def = 0;
35
-
36
- // COOKIE label to store request id for last approved
37
- $ct_approved_request_id_label = 'ct_approved_request_id';
38
-
39
- // Last request id approved for publication
40
- $ct_approved_request_id = null;
41
-
42
- // Trial notice show time in minutes
43
- $trial_notice_showtime = 10;
44
-
45
- // Renew notice show time in minutes
46
- $renew_notice_showtime = 10;
47
-
48
- // COOKIE label for WP Landing Page proccessing result
49
- $ct_wplp_result_label = 'ct_wplp_result';
50
-
51
- // Flag indicates active JetPack comments
52
- $ct_jp_comments = false;
53
-
54
- // WP admin email notice interval in seconds
55
- $ct_admin_notoice_period = 21600;
56
-
57
- // Sevice negative comment to visitor.
58
- // It uses for BuddyPress registrations to avoid double checks
59
- $ct_negative_comment = null;
60
-
61
- // Set globals to NULL to avoid massive DB requests. Globals will be set when needed only and by accessors only.
62
- $ct_server = NULL;
63
- $admin_email = NULL;
64
-
65
- /**
66
- * Public action 'plugins_loaded' - Loads locale, see http://codex.wordpress.org/Function_Reference/load_plugin_textdomain
67
- */
68
- function apbct_plugin_loaded() {
69
- $dir=plugin_basename( dirname( __FILE__ ) ) . '/../i18n';
70
- $loaded=load_plugin_textdomain('cleantalk-spam-protect', false, $dir);
71
- }
72
-
73
- /**
74
- * Inner function - Request's wrapper for anything
75
- * @param array Array of parameters:
76
- * 'message' - string
77
- * 'example' - string
78
- * 'checkjs' - int
79
- * 'sender_email' - string
80
- * 'sender_nickname' - string
81
- * 'sender_info' - array
82
- * 'post_info' - string
83
- * @return array array('ct'=> Cleantalk, 'ct_result' => CleantalkResponse)
84
- */
85
- function apbct_base_call($params = array(), $reg_flag = false){
86
-
87
- global $apbct, $cleantalk_executed;
88
-
89
- $cleantalk_executed = true;
90
-
91
- $sender_info = !empty($params['sender_info'])
92
- ? \Cleantalk\ApbctWP\Helper::array_merge__save_numeric_keys__recursive(apbct_get_sender_info(), (array)$params['sender_info'])
93
- : apbct_get_sender_info();
94
-
95
- // Fields exclusions
96
- if( ! empty( $params['message'] ) && is_array( $params['message'] ) ){
97
-
98
- $params['message'] = apbct_array( $params['message'] )
99
- ->get_keys( $apbct->settings['exclusions__fields'], $apbct->settings['exclusions__fields__use_regexp'] )
100
- ->delete();
101
- }
102
-
103
- // Reversed url exclusions. Pass everything except one.
104
- if( ! apbct_exclusions_check__url__reversed() ){
105
- return array(
106
- 'ct' => false,
107
- 'ct_result' => new CleantalkResponse( null, null )
108
- );
109
- }
110
-
111
- $default_params = array(
112
-
113
- // IPs
114
- 'sender_ip' => defined('CT_TEST_IP') ? CT_TEST_IP : (isset($params['sender_ip']) ? $params['sender_ip'] : \Cleantalk\ApbctWP\Helper::ip__get(array('real'), false)),
115
- 'x_forwarded_for' => \Cleantalk\ApbctWP\Helper::ip__get(array('x_forwarded_for'), false),
116
- 'x_real_ip' => \Cleantalk\ApbctWP\Helper::ip__get(array('x_real_ip'), false),
117
-
118
- // Misc
119
- 'auth_key' => $apbct->api_key,
120
- 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE) ? 1 : apbct_js_test('ct_checkjs', $_POST),
121
-
122
- 'agent' => APBCT_AGENT,
123
- 'sender_info' => $sender_info,
124
- 'submit_time' => apbct_get_submit_time(),
125
- );
126
-
127
- // Send $_SERVER if couldn't find IP
128
- if(empty($default_params['sender_ip']))
129
- $default_params['sender_info']['server_info'] = $_SERVER;
130
-
131
- $ct_request = new CleantalkRequest(
132
- \Cleantalk\ApbctWP\Helper::array_merge__save_numeric_keys__recursive($default_params, $params)
133
- );
134
-
135
- $ct = new Cleantalk();
136
-
137
- $ct->use_bultin_api = $apbct->settings['use_buitin_http_api'] ? true : false;
138
- $ct->ssl_on = $apbct->settings['ssl_on'];
139
- $ct->ssl_path = APBCT_CASERT_PATH;
140
-
141
- // Options store url without shceme because of DB error with ''://'
142
- $config = ct_get_server();
143
- $ct->server_url = APBCT_MODERATE_URL;
144
- $ct->work_url = preg_match('/http:\/\/.+/', $config['ct_work_url']) ? $config['ct_work_url'] : null;
145
- $ct->server_ttl = $config['ct_server_ttl'];
146
- $ct->server_changed = $config['ct_server_changed'];
147
-
148
- $start = microtime(true);
149
- $ct_result = $reg_flag
150
- ? @$ct->isAllowUser($ct_request)
151
- : @$ct->isAllowMessage($ct_request);
152
- $exec_time = microtime(true) - $start;
153
-
154
- // Statistics
155
- // Average request time
156
- apbct_statistics__rotate($exec_time);
157
- // Last request
158
- $apbct->stats['last_request']['time'] = time();
159
- $apbct->stats['last_request']['server'] = $ct->work_url;
160
- $apbct->save('stats');
161
-
162
- // Connection reports
163
- if ($ct_result->errno === 0 && empty($ct_result->errstr))
164
- $apbct->data['connection_reports']['success']++;
165
- else
166
- {
167
- $apbct->data['connection_reports']['negative']++;
168
- $apbct->data['connection_reports']['negative_report'][] = array(
169
- 'date' => date("Y-m-d H:i:s"),
170
- 'page_url' => apbct_get_server_variable( 'REQUEST_URI' ),
171
- 'lib_report' => $ct_result->errstr,
172
- 'work_url' => $ct->work_url,
173
- );
174
-
175
- if(count($apbct->data['connection_reports']['negative_report']) > 20)
176
- $apbct->data['connection_reports']['negative_report'] = array_slice($apbct->data['connection_reports']['negative_report'], -20, 20);
177
-
178
- }
179
-
180
- if ($ct->server_change) {
181
- update_option(
182
- 'cleantalk_server',
183
- array(
184
- 'ct_work_url' => $ct->work_url,
185
- 'ct_server_ttl' => $ct->server_ttl,
186
- 'ct_server_changed' => time(),
187
- )
188
- );
189
- }
190
-
191
- $ct_result = ct_change_plugin_resonse($ct_result, $ct_request->js_on);
192
-
193
- // Restart submit form counter for failed requests
194
- if ($ct_result->allow == 0){
195
- apbct_cookie(); // Setting page timer and cookies
196
- ct_add_event('no');
197
- }else{
198
- ct_add_event('yes');
199
- }
200
-
201
- //Strip tags from comment
202
- $ct_result->comment = strip_tags($ct_result->comment, '<p><a><br>');
203
-
204
- // Set cookies if it's not.
205
- if(empty($apbct->flags__cookies_setuped))
206
- apbct_cookie();
207
-
208
- return array('ct' => $ct, 'ct_result' => $ct_result);
209
-
210
- }
211
-
212
- function apbct_exclusions_check($func = null){
213
-
214
- global $apbct, $cleantalk_executed;
215
-
216
- // Common exclusions
217
- if(
218
- apbct_exclusions_check__ip() ||
219
- apbct_exclusions_check__url() ||
220
- apbct_is_user_role_in( $apbct->settings['exclusions__roles'] ) ||
221
- $cleantalk_executed
222
- )
223
- return true;
224
-
225
- // Personal exclusions
226
- switch ($func){
227
- case 'ct_contact_form_validate_postdata':
228
- if(
229
- (defined( 'DOING_AJAX' ) && DOING_AJAX) ||
230
- apbct_array( $_POST )->get_keys( 'members_search_submit' )->result()
231
- )
232
- return true;
233
- break;
234
- case 'ct_contact_form_validate':
235
- if(
236
- apbct_array( $_POST )->get_keys( 'members_search_submit' )->result()
237
- )
238
- return true;
239
- break;
240
- default:
241
- return false;
242
- break;
243
- }
244
-
245
- return false;
246
- }
247
-
248
- function apbct_exclusions_check__url__reversed(){
249
- return defined( 'APBCT_URL_EXCLUSIONS__REVERSED' ) && ! \Cleantalk\Variables\Server::has_string( 'REQUEST_URI', APBCT_URL_EXCLUSIONS__REVERSED )
250
- ? false
251
- : true;
252
- }
253
-
254
- /**
255
- * Checks if reuqest URI is in exclusion list
256
- *
257
- * @return bool
258
- */
259
- function apbct_exclusions_check__url() {
260
-
261
- global $apbct;
262
-
263
- if ( ! empty( $apbct->settings['exclusions__urls'] ) ) {
264
-
265
- $exclusions = explode( ',', $apbct->settings['exclusions__urls'] );
266
-
267
- // Fix for AJAX forms
268
- $haystack = apbct_get_server_variable( 'REQUEST_URI' ) == '/wp-admin/admin-ajax.php' && ! apbct_get_server_variable( 'HTTP_REFERER' )
269
- ? apbct_get_server_variable( 'HTTP_REFERER' )
270
- : apbct_get_server_variable( 'REQUEST_URI' );
271
-
272
- foreach ( $exclusions as $exclusion ) {
273
- if (
274
- ($apbct->settings['exclusions__urls__use_regexp'] && preg_match( '/' . $exclusion . '/', $haystack ) === 1) ||
275
- stripos( $haystack, $exclusion ) !== false
276
- ){
277
- return true;
278
- }
279
- }
280
- return false;
281
- }
282
- }
283
- /**
284
- * @deprecated 5.128 Using IP white-lists instead
285
- * @deprecated since 18.09.2019
286
- * Checks if sender_ip is in exclusion list
287
- *
288
- * @return bool
289
- */
290
- function apbct_exclusions_check__ip(){
291
-
292
- global $cleantalk_ip_exclusions;
293
-
294
- if( apbct_get_server_variable( 'REMOTE_ADDR' ) ){
295
-
296
- if( \Cleantalk\ApbctWP\Helper::ip__is_cleantalks( apbct_get_server_variable( 'REMOTE_ADDR' ) ) ){
297
- return true;
298
- }
299
-
300
- if( ! empty( $cleantalk_ip_exclusions ) && is_array( $cleantalk_ip_exclusions ) ){
301
- foreach ( $cleantalk_ip_exclusions as $exclusion ){
302
- if( stripos( apbct_get_server_variable( 'REMOTE_ADDR' ), $exclusion ) !== false ){
303
- return true;
304
- }
305
- }
306
- }
307
- }
308
-
309
- return false;
310
- }
311
-
312
- /**
313
- * Inner function - Default data array for senders
314
- * @return array
315
- */
316
- function apbct_get_sender_info() {
317
-
318
- global $apbct;
319
-
320
- // Validate cookie from the backend
321
- $cookie_is_ok = apbct_cookies_test();
322
-
323
- $referer_previous = $apbct->settings['set_cookies__sessions']
324
- ? apbct_alt_session__get('apbct_prev_referer')
325
- : filter_input(INPUT_COOKIE, 'apbct_prev_referer');
326
-
327
- $site_landing_ts = $apbct->settings['set_cookies__sessions']
328
- ? apbct_alt_session__get('apbct_site_landing_ts')
329
- : filter_input(INPUT_COOKIE, 'apbct_site_landing_ts');
330
-
331
- $page_hits = $apbct->settings['set_cookies__sessions']
332
- ? apbct_alt_session__get('apbct_page_hits')
333
- : filter_input(INPUT_COOKIE, 'apbct_page_hits');
334
-
335
- if (count($_POST) > 0) {
336
- foreach ($_POST as $k => $v) {
337
- if (preg_match("/^(ct_check|checkjs).+/", $k)) {
338
- $checkjs_data_post = $v;
339
- }
340
- }
341
- }
342
-
343
- // AMP check
344
- $amp_detected = apbct_get_server_variable( 'HTTP_REFERER' )
345
- ? strpos(apbct_get_server_variable( 'HTTP_REFERER' ), '/amp/') !== false || strpos(apbct_get_server_variable( 'HTTP_REFERER' ), '?amp=1') !== false || strpos(apbct_get_server_variable( 'HTTP_REFERER' ), '&amp=1') !== false
346
- ? 1
347
- : 0
348
- : null;
349
-
350
- $site_referer = $apbct->settings['store_urls__sessions']
351
- ? apbct_alt_session__get('apbct_site_referer')
352
- : filter_input(INPUT_COOKIE, 'apbct_site_referer');
353
-
354
- $urls = $apbct->settings['store_urls__sessions']
355
- ? (array)apbct_alt_session__get('apbct_urls')
356
- : (array)json_decode(filter_input(INPUT_COOKIE, 'apbct_urls'), true);
357
-
358
- return array(
359
- 'remote_addr' => \Cleantalk\ApbctWP\Helper::ip__get(array('remote_addr'), false),
360
- 'REFFERRER' => apbct_get_server_variable( 'HTTP_REFERER' ),
361
- 'USER_AGENT' => apbct_get_server_variable( 'HTTP_USER_AGENT' ),
362
- 'page_url' => apbct_get_server_variable( 'SERVER_NAME' ) . apbct_get_server_variable( 'REQUEST_URI' ),
363
- 'cms_lang' => substr(get_locale(), 0, 2),
364
- 'ct_options' => json_encode($apbct->settings),
365
- 'fields_number' => sizeof($_POST),
366
- 'direct_post' => $cookie_is_ok === null && apbct_is_post() ? 1 : 0,
367
- // Raw data to validated JavaScript test in the cloud
368
- 'checkjs_data_cookies' => !empty($_COOKIE['ct_checkjs']) ? $_COOKIE['ct_checkjs'] : null,
369
- 'checkjs_data_post' => !empty($checkjs_data_post) ? $checkjs_data_post : null,
370
- // PHP cookies
371
- 'cookies_enabled' => $cookie_is_ok,
372
- 'REFFERRER_PREVIOUS' => !empty($referer_previous) && $cookie_is_ok ? $referer_previous : null,
373
- 'site_landing_ts' => !empty($site_landing_ts) && $cookie_is_ok ? $site_landing_ts : null,
374
- 'page_hits' => !empty($page_hits) ? $page_hits : null,
375
- // JS cookies
376
- 'js_info' => !empty($_COOKIE['ct_user_info']) ? json_decode(stripslashes($_COOKIE['ct_user_info']), true) : null,
377
- 'mouse_cursor_positions' => !empty($_COOKIE['ct_pointer_data']) ? json_decode(stripslashes($_COOKIE['ct_pointer_data']), true) : null,
378
- 'js_timezone' => !empty($_COOKIE['ct_timezone']) ? $_COOKIE['ct_timezone'] : null,
379
- 'key_press_timestamp' => !empty($_COOKIE['ct_fkp_timestamp']) ? $_COOKIE['ct_fkp_timestamp'] : null,
380
- 'page_set_timestamp' => !empty($_COOKIE['ct_ps_timestamp']) ? $_COOKIE['ct_ps_timestamp'] : null,
381
- 'form_visible_inputs' => !empty($_COOKIE['apbct_visible_fields_count']) ? $_COOKIE['apbct_visible_fields_count'] : null,
382
- 'apbct_visible_fields' => !empty($_COOKIE['apbct_visible_fields']) ? apbct_visibile_fields__process($_COOKIE['apbct_visible_fields']) : null,
383
- // Misc
384
- 'site_referer' => !empty($site_referer) ? $site_referer : null,
385
- 'source_url' => !empty($urls) ? json_encode($urls) : null,
386
- // Debug stuff
387
- 'amp_detected' => $amp_detected,
388
- 'hook' => current_action() ? current_action() : 'no_hook',
389
- 'headers_sent' => !empty($apbct->headers_sent) ? $apbct->headers_sent : false,
390
- 'headers_sent__hook' => !empty($apbct->headers_sent__hook) ? $apbct->headers_sent__hook : 'no_hook',
391
- 'headers_sent__where' => !empty($apbct->headers_sent__where) ? $apbct->headers_sent__where : false,
392
- 'request_type' => apbct_get_server_variable('REQUEST_METHOD') ? apbct_get_server_variable('REQUEST_METHOD') : 'UNKNOWN',
393
- );
394
- }
395
-
396
- /**
397
- * Process visible fields for specific form to match the fields from request
398
- *
399
- * @param string $visible_fields
400
- *
401
- * @return string
402
- */
403
- function apbct_visibile_fields__process($visible_fields) {
404
- if(strpos($visible_fields, 'wpforms') !== false){
405
- $visible_fields = preg_replace(
406
- array('/\[/', '/\]/'),
407
- '',
408
- str_replace(
409
- '][',
410
- '_',
411
- str_replace(
412
- 'wpforms[fields]',
413
- '',
414
- $visible_fields
415
- )
416
- )
417
- );
418
- }
419
-
420
- return $visible_fields;
421
- }
422
-
423
- /*
424
- * Outputs JS key for AJAX-use only. Stops script.
425
- */
426
- function apbct_js_keys__get__ajax( $direct_call = false ){
427
-
428
- global $apbct;
429
-
430
- if( ! $direct_call && $apbct->settings['use_static_js_key'] != 1 ){
431
-
432
- if(isset($_POST['_ajax_nonce'])){
433
- if(!wp_verify_nonce($_POST['_ajax_nonce'], 'ct_secret_stuff')){
434
- wp_doing_ajax()
435
- ? wp_die( -1, 403 )
436
- : die( '-1' );
437
- }
438
- }else{
439
- wp_doing_ajax()
440
- ? wp_die( -1, 403 )
441
- : die( '-1' );
442
- }
443
- }
444
-
445
- die(json_encode(array(
446
- 'js_key' => ct_get_checkjs_value()
447
- )));
448
-
449
- }
450
-
451
- /**
452
- * Get ct_get_checkjs_value
453
- *
454
- * @param bool $random_key
455
- *
456
- * @return int|string|null
457
- */
458
- function ct_get_checkjs_value(){
459
-
460
- global $apbct;
461
-
462
- // Use static JS keys
463
- if($apbct->settings['use_static_js_key'] == 1){
464
-
465
- $key = hash('sha256', $apbct->api_key.ct_get_admin_email().$apbct->salt);
466
-
467
- // Auto detecting. Detected.
468
- }elseif(
469
- $apbct->settings['use_static_js_key'] == - 1 &&
470
- ( apbct_is_cache_plugins_exists() ||
471
- ( apbct_is_post() && $apbct->data['cache_detected'] == 1 )
472
- )
473
- ){
474
- $key = hash('sha256', $apbct->api_key.ct_get_admin_email().$apbct->salt);
475
- if( apbct_is_cache_plugins_exists() )
476
- $apbct->data['cache_detected'] = 1;
477
-
478
- // Using dynamic JS keys
479
- }else{
480
-
481
- $keys = $apbct->data['js_keys'];
482
- $keys_checksum = md5(json_encode($keys));
483
-
484
- $key = null;
485
- $latest_key_time = 0;
486
-
487
- foreach ($keys as $k => $t) {
488
-
489
- // Removing key if it's to old
490
- if (time() - $t > $apbct->data['js_keys_store_days'] * 86400 * 7) {
491
- unset($keys[$k]);
492
- continue;
493
- }
494
-
495
- if ($t > $latest_key_time) {
496
- $latest_key_time = $t;
497
- $key = $k;
498
- }
499
- }
500
-
501
- // Set new key if the latest key is too old
502
- if (time() - $latest_key_time > $apbct->data['js_key_lifetime']) {
503
- $key = rand();
504
- $keys[$key] = time();
505
- }
506
-
507
- // Save keys if they were changed
508
- if (md5(json_encode($keys)) != $keys_checksum) {
509
- $apbct->data['js_keys'] = $keys;
510
- // $apbct->saveData();
511
- }
512
-
513
- $apbct->data['cache_detected'] = 0;
514
- }
515
-
516
- $apbct->saveData();
517
-
518
- return $key;
519
- }
520
-
521
- function apbct_is_cache_plugins_exists(){
522
- return
523
- defined('WP_ROCKET_VERSION') || // WPRocket
524
- defined('LSCWP_DIR') || // LiteSpeed Cache
525
- defined('WPFC_WP_CONTENT_BASENAME') || // WP Fastest Cache
526
- defined('W3TC') || // W3 Total Cache
527
- defined('WPO_VERSION') || // WP-Optimize – Clean, Compress, Cache
528
- defined('AUTOPTIMIZE_PLUGIN_VERSION') || // Autoptimize
529
- defined('WPCACHEHOME') || // WP Super Cache
530
- defined('WPHB_VERSION') || // Hummingbird – Speed up, Cache, Optimize Your CSS and JS
531
- defined('CE_FILE') || // Cache Enabler – WordPress Cache
532
- class_exists('\RedisObjectCache') || // Redis Object Cache
533
- defined('SiteGround_Optimizer\VERSION') || // SG Optimizer
534
- class_exists('\WP_Rest_Cache_Plugin\Includes\Plugin'); // WP REST Cache
535
- }
536
-
537
- /**
538
- * Inner function - Current site admin e-mail
539
- * @return string Admin e-mail
540
- */
541
- function ct_get_admin_email() {
542
- global $admin_email;
543
- if(!isset($admin_email))
544
- {
545
- $admin_email = get_option('admin_email');
546
- }
547
- return $admin_email;
548
- }
549
-
550
- /**
551
- * Inner function - Current Cleantalk working server info
552
- * @return mixed[] Array of server data
553
- */
554
- function ct_get_server($force=false) {
555
- global $ct_server;
556
- if(!$force && isset($ct_server) && isset($ct_server['ct_work_url']) && !empty($ct_server['ct_work_url'])){
557
-
558
- return $ct_server;
559
-
560
- }else{
561
-
562
- $ct_server = get_option('cleantalk_server');
563
- if (!is_array($ct_server)){
564
- $ct_server = array(
565
- 'ct_work_url' => NULL,
566
- 'ct_server_ttl' => NULL,
567
- 'ct_server_changed' => NULL
568
- );
569
- }
570
- return $ct_server;
571
- }
572
- }
573
-
574
- /**
575
- * Inner function - Stores ang returns cleantalk hash of current comment
576
- * @param string New hash or NULL
577
- * @return string New hash or current hash depending on parameter
578
- */
579
- function ct_hash($new_hash = '') {
580
- /**
581
- * Current hash
582
- */
583
- static $hash;
584
-
585
- if (!empty($new_hash)) {
586
- $hash = $new_hash;
587
- }
588
- return $hash;
589
- }
590
-
591
- /**
592
- * Inner function - Write manual moderation results to PHP sessions
593
- * @param string $hash Cleantalk comment hash
594
- * @param string $message comment_content
595
- * @param int $allow flag good comment (1) or bad (0)
596
- * @return string comment_content w\o cleantalk resume
597
- */
598
- function ct_feedback($hash, $allow) {
599
- global $apbct;
600
-
601
- $ct_feedback = $hash . ':' . $allow . ';';
602
- if($apbct->data['feedback_request'])
603
- $apbct->data['feedback_request'] = $ct_feedback;
604
- else
605
- $apbct->data['feedback_request'] .= $ct_feedback;
606
-
607
- $apbct->saveData();
608
- }
609
-
610
- /**
611
- * Inner function - Sends the results of moderation
612
- * Scheduled in 3600 seconds!
613
- * @param string $feedback_request
614
- * @return bool
615
- */
616
- function ct_send_feedback($feedback_request = null) {
617
-
618
- global $apbct;
619
-
620
- if (empty($feedback_request) && isset($apbct->data['feedback_request']) && preg_match("/^[a-z0-9\;\:]+$/", $apbct->data['feedback_request'])){
621
- $feedback_request = $apbct->data['feedback_request'];
622
- $apbct->data['feedback_request'] = '';
623
- $apbct->saveData();
624
- }
625
-
626
- if ($feedback_request !== null) {
627
-
628
- $ct_request = new CleantalkRequest(array(
629
- // General
630
- 'auth_key' => $apbct->api_key,
631
- // Additional
632
- 'feedback' => $feedback_request,
633
- ));
634
-
635
- $ct = new Cleantalk();
636
-
637
- // Server URL handling
638
- $config = ct_get_server();
639
- $ct->server_url = APBCT_MODERATE_URL;
640
- $ct->work_url = preg_match('/http:\/\/.+/', $config['ct_work_url']) ? $config['ct_work_url'] : null;
641
- $ct->server_ttl = $config['ct_server_ttl'];
642
- $ct->server_changed = $config['ct_server_changed'];
643
-
644
- $ct->sendFeedback($ct_request);
645
-
646
- if ($ct->server_change) {
647
- update_option(
648
- 'cleantalk_server',
649
- array(
650
- 'ct_work_url' => $ct->work_url,
651
- 'ct_server_ttl' => $ct->server_ttl,
652
- 'ct_server_changed' => time(),
653
- )
654
- );
655
- }
656
-
657
- return true;
658
- }
659
-
660
- return false;
661
- }
662
-
663
- /**
664
- * Delete old spam comments
665
- * Scheduled in 3600 seconds!
666
- * @return null
667
- */
668
- function ct_delete_spam_comments() {
669
-
670
- global $apbct;
671
-
672
- if ($apbct->settings['remove_old_spam'] == 1) {
673
- $last_comments = get_comments(array('status' => 'spam', 'number' => 1000, 'order' => 'ASC'));
674
- foreach ($last_comments as $c) {
675
- $comment_date_gmt = strtotime($c->comment_date_gmt);
676
- if ($comment_date_gmt && is_numeric($comment_date_gmt)) {
677
- if (time() - $comment_date_gmt > 86400 * $apbct->data['spam_store_days']) {
678
- // Force deletion old spam comments
679
- wp_delete_comment($c->comment_ID, true);
680
- }
681
- }
682
- }
683
- }
684
-
685
- return null;
686
- }
687
-
688
- /*
689
- * Get data from an ARRAY recursively
690
- * @return array
691
- */
692
- function ct_get_fields_any($arr, $message=array(), $email = null, $nickname = array('nick' => '', 'first' => '', 'last' => ''), $subject = null, $contact = true, $prev_name = ''){
693
-
694
- //Skip request if fields exists
695
- $skip_params = array(
696
- 'ipn_track_id', // PayPal IPN #
697
- 'txn_type', // PayPal transaction type
698
- 'payment_status', // PayPal payment status
699
- 'ccbill_ipn', // CCBill IPN
700
- 'ct_checkjs', // skip ct_checkjs field
701
- 'api_mode', // DigiStore-API
702
- 'loadLastCommentId' // Plugin: WP Discuz. ticket_id=5571
703
- );
704
-
705
- // Fields to replace with ****
706
- $obfuscate_params = array(
707
- 'password',
708
- 'pass',
709
- 'pwd',
710
- 'pswd'
711
- );
712
-
713
- // Skip feilds with these strings and known service fields
714
- $skip_fields_with_strings = array(
715
- // Common
716
- 'ct_checkjs', //Do not send ct_checkjs
717
- 'nonce', //nonce for strings such as 'rsvp_nonce_name'
718
- 'security',
719
- // 'action',
720
- 'http_referer',
721
- 'referer-page',
722
- 'timestamp',
723
- 'captcha',
724
- // Formidable Form
725
- 'form_key',
726
- 'submit_entry',
727
- // Custom Contact Forms
728
- 'form_id',
729
- 'ccf_form',
730
- 'form_page',
731
- // Qu Forms
732
- 'iphorm_uid',
733
- 'form_url',
734
- 'post_id',
735
- 'iphorm_ajax',
736
- 'iphorm_id',
737
- // Fast SecureContact Froms
738
- 'fs_postonce_1',
739
- 'fscf_submitted',
740
- 'mailto_id',
741
- 'si_contact_action',
742
- // Ninja Forms
743
- 'formData_id',
744
- 'formData_settings',
745
- 'formData_fields_\d+_id',
746
- 'formData_fields_\d+_files.*',
747
- // E_signature
748
- 'recipient_signature',
749
- 'output_\d+_\w{0,2}',
750
- // Contact Form by Web-Settler protection
751
- '_formId',
752
- '_returnLink',
753
- // Social login and more
754
- '_save',
755
- '_facebook',
756
- '_social',
757
- 'user_login-',
758
- // Contact Form 7
759
- '_wpcf7',
760
- 'ebd_settings',
761
- 'ebd_downloads_',
762
- 'ecole_origine',
763
- 'signature',
764
- // Ultimate Form Builder
765
- 'form_data_%d_name',
766
- );
767
-
768
- // Reset $message if we have a sign-up data
769
- $skip_message_post = array(
770
- 'edd_action', // Easy Digital Downloads
771
- );
772
-
773
- if( apbct_array( array( $_POST, $_GET ) )->get_keys( $skip_params )->result() )
774
- $contact = false;
775
-
776
- if(count($arr)){
777
-
778
- foreach($arr as $key => $value){
779
-
780
- if(gettype($value) == 'string'){
781
-
782
- $tmp = strpos($value, '\\') !== false ? stripslashes($value) : $value;
783
- $decoded_json_value = json_decode($tmp, true);
784
-
785
- // Decoding JSON
786
- if($decoded_json_value !== null){
787
- $value = $decoded_json_value;
788
-
789
- // Ajax Contact Forms. Get data from such strings:
790
- // acfw30_name %% Blocked~acfw30_email %% s@cleantalk.org
791
- // acfw30_textarea %% msg
792
- }elseif(preg_match('/^\S+\s%%\s\S+.+$/', $value)){
793
- $value = explode('~', $value);
794
- foreach ($value as &$val){
795
- $tmp = explode(' %% ', $val);
796
- $val = array($tmp[0] => $tmp[1]);
797
- }
798
- }
799
- }
800
-
801
- if(!is_array($value) && !is_object($value)){
802
-
803
- if (in_array($key, $skip_params, true) && $key != 0 && $key != '' || preg_match("/^ct_checkjs/", $key))
804
- $contact = false;
805
-
806
- if($value === '')
807
- continue;
808
-
809
- // Skipping fields names with strings from (array)skip_fields_with_strings
810
- foreach($skip_fields_with_strings as $needle){
811
- if (preg_match("/".$needle."/", $prev_name.$key) == 1){
812
- continue(2);
813
- }
814
- }unset($needle);
815
-
816
- // Obfuscating params
817
- foreach($obfuscate_params as $needle){
818
- if (strpos($key, $needle) !== false){
819
- $value = ct_obfuscate_param($value);
820
- continue(2);
821
- }
822
- }unset($needle);
823
-
824
- $value_for_email = trim( strip_shortcodes( $value ) ); // Removes shortcodes to do better spam filtration on server side.
825
-
826
- // Email
827
- if ( ! $email && preg_match( "/^\S+@\S+\.\S+$/", $value_for_email ) ) {
828
- $email = $value_for_email;
829
-
830
- // Removes whitespaces
831
- $value = urldecode( trim( strip_shortcodes( $value ) ) ); // Fully cleaned message
832
-
833
- // Names
834
- }elseif (preg_match("/name/i", $key)){
835
-
836
- preg_match("/((name.?)?(your|first|for)(.?name)?)/", $key, $match_forename);
837
- preg_match("/((name.?)?(last|family|second|sur)(.?name)?)/", $key, $match_surname);
838
- preg_match("/(name.?)?(nick|user)(.?name)?/", $key, $match_nickname);
839
-
840
- if(count($match_forename) > 1)
841
- $nickname['first'] = $value;
842
- elseif(count($match_surname) > 1)
843
- $nickname['last'] = $value;
844
- elseif(count($match_nickname) > 1)
845
- $nickname['nick'] = $value;
846
- else
847
- $message[$prev_name.$key] = $value;
848
-
849
- // Subject
850
- }elseif ($subject === null && preg_match("/subject/i", $key)){
851
- $subject = $value;
852
-
853
- // Message
854
- }else{
855
- $message[$prev_name.$key] = $value;
856
- }
857
-
858
- }elseif(!is_object($value)){
859
-
860
- $prev_name_original = $prev_name;
861
- $prev_name = ($prev_name === '' ? $key.'_' : $prev_name.$key.'_');
862
-
863
- $temp = ct_get_fields_any($value, $message, $email, $nickname, $subject, $contact, $prev_name);
864
-
865
- $message = $temp['message'];
866
- $email = ($temp['email'] ? $temp['email'] : null);
867
- $nickname = ($temp['nickname'] ? $temp['nickname'] : null);
868
- $subject = ($temp['subject'] ? $temp['subject'] : null);
869
- if($contact === true)
870
- $contact = ($temp['contact'] === false ? false : true);
871
- $prev_name = $prev_name_original;
872
- }
873
- } unset($key, $value);
874
- }
875
-
876
- foreach ($skip_message_post as $v) {
877
- if (isset($_POST[$v])) {
878
- $message = null;
879
- break;
880
- }
881
- } unset($v);
882
-
883
- //If top iteration, returns compiled name field. Example: "Nickname Firtsname Lastname".
884
- if($prev_name === ''){
885
- if(!empty($nickname)){
886
- $nickname_str = '';
887
- foreach($nickname as $value){
888
- $nickname_str .= ($value ? $value." " : "");
889
- }unset($value);
890
- }
891
- $nickname = $nickname_str;
892
- }
893
-
894
- $return_param = array(
895
- 'email' => $email,
896
- 'nickname' => $nickname,
897
- 'subject' => $subject,
898
- 'contact' => $contact,
899
- 'message' => $message
900
- );
901
- return $return_param;
902
- }
903
-
904
- /**
905
- * Masks a value with asterisks (*)
906
- * @return string
907
- */
908
- function ct_obfuscate_param($value = null) {
909
- if ($value && (!is_object($value) || !is_array($value))) {
910
- $length = strlen($value);
911
- $value = str_repeat('*', $length);
912
- }
913
-
914
- return $value;
915
- }
916
-
917
- //New ct_get_fields_any_postdata
918
- function ct_get_fields_any_postdata($arr, $message=array()){
919
- $skip_params = array(
920
- 'ipn_track_id', // PayPal IPN #
921
- 'txn_type', // PayPal transaction type
922
- 'payment_status', // PayPal payment status
923
- );
924
-
925
- foreach($arr as $key => $value){
926
- if(!is_array($value)){
927
- if($value == '')
928
- continue;
929
- if (!(in_array($key, $skip_params) || preg_match("/^ct_checkjs/", $key)) && $value!='')
930
- $message[$key] = $value;
931
- }else{
932
- $temp = ct_get_fields_any_postdata($value);
933
- $message = (count($temp) == 0 ? $message : array_merge($message, $temp));
934
- }
935
- }
936
- return $message;
937
- }
938
-
939
- /**
940
- * Checks if given string is valid regular expression
941
- *
942
- * @param string $regexp
943
- *
944
- * @return bool
945
- */
946
- function apbct_is_regexp($regexp){
947
- return @preg_match('/' . $regexp . '/', null) !== false;
948
- }
949
-
950
- function cleantalk_debug($key,$value)
951
- {
952
- if(isset($_COOKIE) && isset($_COOKIE['cleantalk_debug']))
953
- {
954
- @header($key.": ".$value);
955
- }
956
- }
957
-
958
- /**
959
- * Function changes CleanTalk result object if an error occurred.
960
- * @return object
961
- */
962
- function ct_change_plugin_resonse($ct_result = null, $checkjs = null) {
963
-
964
- global $apbct;
965
-
966
- if (!$ct_result) {
967
- return $ct_result;
968
- }
969
-
970
- if(@intval($ct_result->errno) != 0)
971
- {
972
- if($checkjs === null || $checkjs != 1)
973
- {
974
- $ct_result->allow = 0;
975
- $ct_result->spam = 1;
976
- $ct_result->comment = sprintf('We\'ve got an issue: %s. Forbidden. Please, enable Javascript. %s.',
977
- $ct_result->comment,
978
- $apbct->plugin_name
979
- );
980
- }
981
- else
982
- {
983
- $ct_result->allow = 1;
984
- $ct_result->comment = 'Allow';
985
- }
986
- }
987
-
988
- return $ct_result;
989
- }
990
-
991
- /**
992
- * Does key has correct symbols? Checks against regexp ^[a-z\d]{3,15}$
993
- * @param api_key
994
- * @return bool
995
- */
996
- function apbct_api_key__is_correct($api_key = null)
997
- {
998
- global $apbct;
999
- $api_key = $api_key !== null ? $api_key : $apbct->api_key;
1000
- return $api_key && preg_match('/^[a-z\d]{3,15}$/', $api_key) ? true : false;
1001
- }
1002
-
1003
- function apbct_add_async_attribute($tag, $handle, $src) {
1004
-
1005
- global $apbct;
1006
-
1007
- if(
1008
- $apbct->settings['async_js'] &&
1009
- (
1010
- $handle === 'ct_public'
1011
- || $handle === 'ct_public_gdpr'
1012
- || $handle === 'ct_debug_js'
1013
- || $handle === 'ct_public_admin_js'
1014
- || $handle === 'ct_internal'
1015
- || $handle === 'ct_external'
1016
- || $handle === 'ct_nocache'
1017
- )
1018
- )
1019
- return str_replace( ' src', ' async="async" src', $tag );
1020
- else
1021
- return $tag;
 
 
 
 
 
 
1022
  }
1
+ <?php
2
+
3
+ use Cleantalk\Antispam\Cleantalk;
4
+ use Cleantalk\Antispam\CleantalkRequest;
5
+ use Cleantalk\Antispam\CleantalkResponse;
6
+
7
+ function apbct_array( $array ){
8
+ return new \Cleantalk\Common\Arr( $array );
9
+ }
10
+
11
+ $ct_checkjs_frm = 'ct_checkjs_frm';
12
+ $ct_checkjs_register_form = 'ct_checkjs_register_form';
13
+
14
+ $apbct_cookie_request_id_label = 'request_id';
15
+ $apbct_cookie_register_ok_label = 'register_ok';
16
+
17
+ $ct_checkjs_cf7 = 'ct_checkjs_cf7';
18
+ $ct_cf7_comment = '';
19
+
20
+ $ct_checkjs_jpcf = 'ct_checkjs_jpcf';
21
+ $ct_jpcf_patched = false;
22
+ $ct_jpcf_fields = array('name', 'email');
23
+
24
+ // Comment already proccessed
25
+ $ct_comment_done = false;
26
+
27
+ // Comment already proccessed
28
+ $ct_signup_done = false;
29
+
30
+ //Contains registration error
31
+ $ct_registration_error_comment = false;
32
+
33
+ // Default value for JS test
34
+ $ct_checkjs_def = 0;
35
+
36
+ // COOKIE label to store request id for last approved
37
+ $ct_approved_request_id_label = 'ct_approved_request_id';
38
+
39
+ // Last request id approved for publication
40
+ $ct_approved_request_id = null;
41
+
42
+ // Trial notice show time in minutes
43
+ $trial_notice_showtime = 10;
44
+
45
+ // Renew notice show time in minutes
46
+ $renew_notice_showtime = 10;
47
+
48
+ // COOKIE label for WP Landing Page proccessing result
49
+ $ct_wplp_result_label = 'ct_wplp_result';
50
+
51
+ // Flag indicates active JetPack comments
52
+ $ct_jp_comments = false;
53
+
54
+ // WP admin email notice interval in seconds
55
+ $ct_admin_notoice_period = 21600;
56
+
57
+ // Sevice negative comment to visitor.
58
+ // It uses for BuddyPress registrations to avoid double checks
59
+ $ct_negative_comment = null;
60
+
61
+ // Set globals to NULL to avoid massive DB requests. Globals will be set when needed only and by accessors only.
62
+ $ct_server = NULL;
63
+ $admin_email = NULL;
64
+
65
+ /**
66
+ * Public action 'plugins_loaded' - Loads locale, see http://codex.wordpress.org/Function_Reference/load_plugin_textdomain
67
+ */
68
+ function apbct_plugin_loaded() {
69
+ $dir=plugin_basename( dirname( __FILE__ ) ) . '/../i18n';
70
+ $loaded=load_plugin_textdomain('cleantalk-spam-protect', false, $dir);
71
+ }
72
+
73
+ /**
74
+ * Inner function - Request's wrapper for anything
75
+ * @param array Array of parameters:
76
+ * 'message' - string
77
+ * 'example' - string
78
+ * 'checkjs' - int
79
+ * 'sender_email' - string
80
+ * 'sender_nickname' - string
81
+ * 'sender_info' - array
82
+ * 'post_info' - string
83
+ * @return array array('ct'=> Cleantalk, 'ct_result' => CleantalkResponse)
84
+ */
85
+ function apbct_base_call($params = array(), $reg_flag = false){
86
+
87
+ global $apbct, $cleantalk_executed;
88
+
89
+ $cleantalk_executed = true;
90
+
91
+ $sender_info = !empty($params['sender_info'])
92
+ ? \Cleantalk\ApbctWP\Helper::array_merge__save_numeric_keys__recursive(apbct_get_sender_info(), (array)$params['sender_info'])
93
+ : apbct_get_sender_info();
94
+
95
+ // Fields exclusions
96
+ if( ! empty( $params['message'] ) && is_array( $params['message'] ) ){
97
+
98
+ $params['message'] = apbct_array( $params['message'] )
99
+ ->get_keys( $apbct->settings['exclusions__fields'], $apbct->settings['exclusions__fields__use_regexp'] )
100
+ ->delete();
101
+ }
102
+
103
+ // URL, IP, Role exclusions
104
+ if( ! $cleantalk_executed && apbct_exclusions_check() ){
105
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
106
+ return false;
107
+ }
108
+
109
+ // Reversed url exclusions. Pass everything except one.
110
+ if( ! apbct_exclusions_check__url__reversed() ){
111
+ return array(
112
+ 'ct' => false,
113
+ 'ct_result' => new CleantalkResponse( null, null )
114
+ );
115
+ }
116
+
117
+ $default_params = array(
118
+
119
+ // IPs
120
+ 'sender_ip' => defined('CT_TEST_IP') ? CT_TEST_IP : (isset($params['sender_ip']) ? $params['sender_ip'] : \Cleantalk\ApbctWP\Helper::ip__get(array('real'), false)),
121
+ 'x_forwarded_for' => \Cleantalk\ApbctWP\Helper::ip__get(array('x_forwarded_for'), false),
122
+ 'x_real_ip' => \Cleantalk\ApbctWP\Helper::ip__get(array('x_real_ip'), false),
123
+
124
+ // Misc
125
+ 'auth_key' => $apbct->api_key,
126
+ 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE) ? 1 : apbct_js_test('ct_checkjs', $_POST),
127
+
128
+ 'agent' => APBCT_AGENT,
129
+ 'sender_info' => $sender_info,
130
+ 'submit_time' => apbct_get_submit_time(),
131
+ );
132
+
133
+ // Send $_SERVER if couldn't find IP
134
+ if(empty($default_params['sender_ip']))
135
+ $default_params['sender_info']['server_info'] = $_SERVER;
136
+
137
+ $ct_request = new CleantalkRequest(
138
+ \Cleantalk\ApbctWP\Helper::array_merge__save_numeric_keys__recursive($default_params, $params)
139
+ );
140
+
141
+ $ct = new Cleantalk();
142
+
143
+ $ct->use_bultin_api = $apbct->settings['use_buitin_http_api'] ? true : false;
144
+ $ct->ssl_on = $apbct->settings['ssl_on'];
145
+ $ct->ssl_path = APBCT_CASERT_PATH;
146
+
147
+ // Options store url without shceme because of DB error with ''://'
148
+ $config = ct_get_server();
149
+ $ct->server_url = APBCT_MODERATE_URL;
150
+ $ct->work_url = preg_match('/http:\/\/.+/', $config['ct_work_url']) ? $config['ct_work_url'] : null;
151
+ $ct->server_ttl = $config['ct_server_ttl'];
152
+ $ct->server_changed = $config['ct_server_changed'];
153
+
154
+ $start = microtime(true);
155
+ $ct_result = $reg_flag
156
+ ? @$ct->isAllowUser($ct_request)
157
+ : @$ct->isAllowMessage($ct_request);
158
+ $exec_time = microtime(true) - $start;
159
+
160
+ // Statistics
161
+ // Average request time
162
+ apbct_statistics__rotate($exec_time);
163
+ // Last request
164
+ $apbct->stats['last_request']['time'] = time();
165
+ $apbct->stats['last_request']['server'] = $ct->work_url;
166
+ $apbct->save('stats');
167
+
168
+ // Connection reports
169
+ if ($ct_result->errno === 0 && empty($ct_result->errstr))
170
+ $apbct->data['connection_reports']['success']++;
171
+ else
172
+ {
173
+ $apbct->data['connection_reports']['negative']++;
174
+ $apbct->data['connection_reports']['negative_report'][] = array(
175
+ 'date' => date("Y-m-d H:i:s"),
176
+ 'page_url' => apbct_get_server_variable( 'REQUEST_URI' ),
177
+ 'lib_report' => $ct_result->errstr,
178
+ 'work_url' => $ct->work_url,
179
+ );
180
+
181
+ if(count($apbct->data['connection_reports']['negative_report']) > 20)
182
+ $apbct->data['connection_reports']['negative_report'] = array_slice($apbct->data['connection_reports']['negative_report'], -20, 20);
183
+
184
+ }
185
+
186
+ if ($ct->server_change) {
187
+ update_option(
188
+ 'cleantalk_server',
189
+ array(
190
+ 'ct_work_url' => $ct->work_url,
191
+ 'ct_server_ttl' => $ct->server_ttl,
192
+ 'ct_server_changed' => time(),
193
+ )
194
+ );
195
+ }
196
+
197
+ $ct_result = ct_change_plugin_resonse($ct_result, $ct_request->js_on);
198
+
199
+ // Restart submit form counter for failed requests
200
+ if ($ct_result->allow == 0){
201
+ apbct_cookie(); // Setting page timer and cookies
202
+ ct_add_event('no');
203
+ }else{
204
+ ct_add_event('yes');
205
+ }
206
+
207
+ //Strip tags from comment
208
+ $ct_result->comment = strip_tags($ct_result->comment, '<p><a><br>');
209
+
210
+ // Set cookies if it's not.
211
+ if(empty($apbct->flags__cookies_setuped))
212
+ apbct_cookie();
213
+
214
+ return array('ct' => $ct, 'ct_result' => $ct_result);
215
+
216
+ }
217
+
218
+ function apbct_exclusions_check($func = null){
219
+
220
+ global $apbct, $cleantalk_executed;
221
+
222
+ // Common exclusions
223
+ if(
224
+ apbct_exclusions_check__ip() ||
225
+ apbct_exclusions_check__url() ||
226
+ apbct_is_user_role_in( $apbct->settings['exclusions__roles'] ) ||
227
+ $cleantalk_executed
228
+ )
229
+ return true;
230
+
231
+ // Personal exclusions
232
+ switch ($func){
233
+ case 'ct_contact_form_validate_postdata':
234
+ if(
235
+ (defined( 'DOING_AJAX' ) && DOING_AJAX) ||
236
+ apbct_array( $_POST )->get_keys( 'members_search_submit' )->result()
237
+ )
238
+ return true;
239
+ break;
240
+ case 'ct_contact_form_validate':
241
+ if(
242
+ apbct_array( $_POST )->get_keys( 'members_search_submit' )->result()
243
+ )
244
+ return true;
245
+ break;
246
+ default:
247
+ return false;
248
+ break;
249
+ }
250
+
251
+ return false;
252
+ }
253
+
254
+ function apbct_exclusions_check__url__reversed(){
255
+ return defined( 'APBCT_URL_EXCLUSIONS__REVERSED' ) && ! \Cleantalk\Variables\Server::has_string( 'REQUEST_URI', APBCT_URL_EXCLUSIONS__REVERSED )
256
+ ? false
257
+ : true;
258
+ }
259
+
260
+ /**
261
+ * Checks if reuqest URI is in exclusion list
262
+ *
263
+ * @return bool
264
+ */
265
+ function apbct_exclusions_check__url() {
266
+
267
+ global $apbct;
268
+
269
+ if ( ! empty( $apbct->settings['exclusions__urls'] ) ) {
270
+
271
+ $exclusions = explode( ',', $apbct->settings['exclusions__urls'] );
272
+
273
+ // Fix for AJAX forms
274
+ $haystack = apbct_get_server_variable( 'REQUEST_URI' ) == '/wp-admin/admin-ajax.php' && ! apbct_get_server_variable( 'HTTP_REFERER' )
275
+ ? apbct_get_server_variable( 'HTTP_REFERER' )
276
+ : apbct_get_server_variable( 'REQUEST_URI' );
277
+
278
+ foreach ( $exclusions as $exclusion ) {
279
+ if (
280
+ ($apbct->settings['exclusions__urls__use_regexp'] && preg_match( '/' . $exclusion . '/', $haystack ) === 1) ||
281
+ stripos( $haystack, $exclusion ) !== false
282
+ ){
283
+ return true;
284
+ }
285
+ }
286
+ return false;
287
+ }
288
+ }
289
+ /**
290
+ * @deprecated 5.128 Using IP white-lists instead
291
+ * @deprecated since 18.09.2019
292
+ * Checks if sender_ip is in exclusion list
293
+ *
294
+ * @return bool
295
+ */
296
+ function apbct_exclusions_check__ip(){
297
+
298
+ global $cleantalk_ip_exclusions;
299
+
300
+ if( apbct_get_server_variable( 'REMOTE_ADDR' ) ){
301
+
302
+ if( \Cleantalk\ApbctWP\Helper::ip__is_cleantalks( apbct_get_server_variable( 'REMOTE_ADDR' ) ) ){
303
+ return true;
304
+ }
305
+
306
+ if( ! empty( $cleantalk_ip_exclusions ) && is_array( $cleantalk_ip_exclusions ) ){
307
+ foreach ( $cleantalk_ip_exclusions as $exclusion ){
308
+ if( stripos( apbct_get_server_variable( 'REMOTE_ADDR' ), $exclusion ) !== false ){
309
+ return true;
310
+ }
311
+ }
312
+ }
313
+ }
314
+
315
+ return false;
316
+ }
317
+
318
+ /**
319
+ * Inner function - Default data array for senders
320
+ * @return array
321
+ */
322
+ function apbct_get_sender_info() {
323
+
324
+ global $apbct;
325
+
326
+ // Validate cookie from the backend
327
+ $cookie_is_ok = apbct_cookies_test();
328
+
329
+ $referer_previous = $apbct->settings['set_cookies__sessions']
330
+ ? apbct_alt_session__get('apbct_prev_referer')
331
+ : filter_input(INPUT_COOKIE, 'apbct_prev_referer');
332
+
333
+ $site_landing_ts = $apbct->settings['set_cookies__sessions']
334
+ ? apbct_alt_session__get('apbct_site_landing_ts')
335
+ : filter_input(INPUT_COOKIE, 'apbct_site_landing_ts');
336
+
337
+ $page_hits = $apbct->settings['set_cookies__sessions']
338
+ ? apbct_alt_session__get('apbct_page_hits')
339
+ : filter_input(INPUT_COOKIE, 'apbct_page_hits');
340
+
341
+ if (count($_POST) > 0) {
342
+ foreach ($_POST as $k => $v) {
343
+ if (preg_match("/^(ct_check|checkjs).+/", $k)) {
344
+ $checkjs_data_post = $v;
345
+ }
346
+ }
347
+ }
348
+
349
+ // AMP check
350
+ $amp_detected = apbct_get_server_variable( 'HTTP_REFERER' )
351
+ ? strpos(apbct_get_server_variable( 'HTTP_REFERER' ), '/amp/') !== false || strpos(apbct_get_server_variable( 'HTTP_REFERER' ), '?amp=1') !== false || strpos(apbct_get_server_variable( 'HTTP_REFERER' ), '&amp=1') !== false
352
+ ? 1
353
+ : 0
354
+ : null;
355
+
356
+ $site_referer = $apbct->settings['store_urls__sessions']
357
+ ? apbct_alt_session__get('apbct_site_referer')
358
+ : filter_input(INPUT_COOKIE, 'apbct_site_referer');
359
+
360
+ $urls = $apbct->settings['store_urls__sessions']
361
+ ? (array)apbct_alt_session__get('apbct_urls')
362
+ : (array)json_decode(filter_input(INPUT_COOKIE, 'apbct_urls'), true);
363
+
364
+ return array(
365
+ 'remote_addr' => \Cleantalk\ApbctWP\Helper::ip__get(array('remote_addr'), false),
366
+ 'REFFERRER' => apbct_get_server_variable( 'HTTP_REFERER' ),
367
+ 'USER_AGENT' => apbct_get_server_variable( 'HTTP_USER_AGENT' ),
368
+ 'page_url' => apbct_get_server_variable( 'SERVER_NAME' ) . apbct_get_server_variable( 'REQUEST_URI' ),
369
+ 'cms_lang' => substr(get_locale(), 0, 2),
370
+ 'ct_options' => json_encode($apbct->settings),
371
+ 'fields_number' => sizeof($_POST),
372
+ 'direct_post' => $cookie_is_ok === null && apbct_is_post() ? 1 : 0,
373
+ // Raw data to validated JavaScript test in the cloud
374
+ 'checkjs_data_cookies' => !empty($_COOKIE['ct_checkjs']) ? $_COOKIE['ct_checkjs'] : null,
375
+ 'checkjs_data_post' => !empty($checkjs_data_post) ? $checkjs_data_post : null,
376
+ // PHP cookies
377
+ 'cookies_enabled' => $cookie_is_ok,
378
+ 'REFFERRER_PREVIOUS' => !empty($referer_previous) && $cookie_is_ok ? $referer_previous : null,
379
+ 'site_landing_ts' => !empty($site_landing_ts) && $cookie_is_ok ? $site_landing_ts : null,
380
+ 'page_hits' => !empty($page_hits) ? $page_hits : null,
381
+ // JS cookies
382
+ 'js_info' => !empty($_COOKIE['ct_user_info']) ? json_decode(stripslashes($_COOKIE['ct_user_info']), true) : null,
383
+ 'mouse_cursor_positions' => !empty($_COOKIE['ct_pointer_data']) ? json_decode(stripslashes($_COOKIE['ct_pointer_data']), true) : null,
384
+ 'js_timezone' => !empty($_COOKIE['ct_timezone']) ? $_COOKIE['ct_timezone'] : null,
385
+ 'key_press_timestamp' => !empty($_COOKIE['ct_fkp_timestamp']) ? $_COOKIE['ct_fkp_timestamp'] : null,
386
+ 'page_set_timestamp' => !empty($_COOKIE['ct_ps_timestamp']) ? $_COOKIE['ct_ps_timestamp'] : null,
387
+ 'form_visible_inputs' => !empty($_COOKIE['apbct_visible_fields_count']) ? $_COOKIE['apbct_visible_fields_count'] : null,
388
+ 'apbct_visible_fields' => !empty($_COOKIE['apbct_visible_fields']) ? apbct_visibile_fields__process($_COOKIE['apbct_visible_fields']) : null,
389
+ // Misc
390
+ 'site_referer' => !empty($site_referer) ? $site_referer : null,
391
+ 'source_url' => !empty($urls) ? json_encode($urls) : null,
392
+ // Debug stuff
393
+ 'amp_detected' => $amp_detected,
394
+ 'hook' => current_action() ? current_action() : 'no_hook',
395
+ 'headers_sent' => !empty($apbct->headers_sent) ? $apbct->headers_sent : false,
396
+ 'headers_sent__hook' => !empty($apbct->headers_sent__hook) ? $apbct->headers_sent__hook : 'no_hook',
397
+ 'headers_sent__where' => !empty($apbct->headers_sent__where) ? $apbct->headers_sent__where : false,
398
+ 'request_type' => apbct_get_server_variable('REQUEST_METHOD') ? apbct_get_server_variable('REQUEST_METHOD') : 'UNKNOWN',
399
+ );
400
+ }
401
+
402
+ /**
403
+ * Process visible fields for specific form to match the fields from request
404
+ *
405
+ * @param string $visible_fields
406
+ *
407
+ * @return string
408
+ */
409
+ function apbct_visibile_fields__process($visible_fields) {
410
+ if(strpos($visible_fields, 'wpforms') !== false){
411
+ $visible_fields = preg_replace(
412
+ array('/\[/', '/\]/'),
413
+ '',
414
+ str_replace(
415
+ '][',
416
+ '_',
417
+ str_replace(
418
+ 'wpforms[fields]',
419
+ '',
420
+ $visible_fields
421
+ )
422
+ )
423
+ );
424
+ }
425
+
426
+ return $visible_fields;
427
+ }
428
+
429
+ /*
430
+ * Outputs JS key for AJAX-use only. Stops script.
431
+ */
432
+ function apbct_js_keys__get__ajax( $direct_call = false ){
433
+
434
+ global $apbct;
435
+
436
+ if( ! $direct_call && $apbct->settings['use_static_js_key'] != 1 ){
437
+
438
+ if(isset($_POST['_ajax_nonce'])){
439
+ if(!wp_verify_nonce($_POST['_ajax_nonce'], 'ct_secret_stuff')){
440
+ wp_doing_ajax()
441
+ ? wp_die( -1, 403 )
442
+ : die( '-1' );
443
+ }
444
+ }else{
445
+ wp_doing_ajax()
446
+ ? wp_die( -1, 403 )
447
+ : die( '-1' );
448
+ }
449
+ }
450
+
451
+ die(json_encode(array(
452
+ 'js_key' => ct_get_checkjs_value()
453
+ )));
454
+
455
+ }
456
+
457
+ /**
458
+ * Get ct_get_checkjs_value
459
+ *
460
+ * @param bool $random_key
461
+ *
462
+ * @return int|string|null
463
+ */
464
+ function ct_get_checkjs_value(){
465
+
466
+ global $apbct;
467
+
468
+ // Use static JS keys
469
+ if($apbct->settings['use_static_js_key'] == 1){
470
+
471
+ $key = hash('sha256', $apbct->api_key.ct_get_admin_email().$apbct->salt);
472
+
473
+ // Auto detecting. Detected.
474
+ }elseif(
475
+ $apbct->settings['use_static_js_key'] == - 1 &&
476
+ ( apbct_is_cache_plugins_exists() ||
477
+ ( apbct_is_post() && $apbct->data['cache_detected'] == 1 )
478
+ )
479
+ ){
480
+ $key = hash('sha256', $apbct->api_key.ct_get_admin_email().$apbct->salt);
481
+ if( apbct_is_cache_plugins_exists() )
482
+ $apbct->data['cache_detected'] = 1;
483
+
484
+ // Using dynamic JS keys
485
+ }else{
486
+
487
+ $keys = $apbct->data['js_keys'];
488
+ $keys_checksum = md5(json_encode($keys));
489
+
490
+ $key = null;
491
+ $latest_key_time = 0;
492
+
493
+ foreach ($keys as $k => $t) {
494
+
495
+ // Removing key if it's to old
496
+ if (time() - $t > $apbct->data['js_keys_store_days'] * 86400 * 7) {
497
+ unset($keys[$k]);
498
+ continue;
499
+ }
500
+
501
+ if ($t > $latest_key_time) {
502
+ $latest_key_time = $t;
503
+ $key = $k;
504
+ }
505
+ }
506
+
507
+ // Set new key if the latest key is too old
508
+ if (time() - $latest_key_time > $apbct->data['js_key_lifetime']) {
509
+ $key = rand();
510
+ $keys[$key] = time();
511
+ }
512
+
513
+ // Save keys if they were changed
514
+ if (md5(json_encode($keys)) != $keys_checksum) {
515
+ $apbct->data['js_keys'] = $keys;
516
+ // $apbct->saveData();
517
+ }
518
+
519
+ $apbct->data['cache_detected'] = 0;
520
+ }
521
+
522
+ $apbct->saveData();
523
+
524
+ return $key;
525
+ }
526
+
527
+ function apbct_is_cache_plugins_exists(){
528
+ return
529
+ defined('WP_ROCKET_VERSION') || // WPRocket
530
+ defined('LSCWP_DIR') || // LiteSpeed Cache
531
+ defined('WPFC_WP_CONTENT_BASENAME') || // WP Fastest Cache
532
+ defined('W3TC') || // W3 Total Cache
533
+ defined('WPO_VERSION') || // WP-Optimize – Clean, Compress, Cache
534
+ defined('AUTOPTIMIZE_PLUGIN_VERSION') || // Autoptimize
535
+ defined('WPCACHEHOME') || // WP Super Cache
536
+ defined('WPHB_VERSION') || // Hummingbird – Speed up, Cache, Optimize Your CSS and JS
537
+ defined('CE_FILE') || // Cache Enabler – WordPress Cache
538
+ class_exists('\RedisObjectCache') || // Redis Object Cache
539
+ defined('SiteGround_Optimizer\VERSION') || // SG Optimizer
540
+ class_exists('\WP_Rest_Cache_Plugin\Includes\Plugin'); // WP REST Cache
541
+ }
542
+
543
+ /**
544
+ * Inner function - Current site admin e-mail
545
+ * @return string Admin e-mail
546
+ */
547
+ function ct_get_admin_email() {
548
+ global $admin_email;
549
+ if(!isset($admin_email))
550
+ {
551
+ $admin_email = get_option('admin_email');
552
+ }
553
+ return $admin_email;
554
+ }
555
+
556
+ /**
557
+ * Inner function - Current Cleantalk working server info
558
+ * @return mixed[] Array of server data
559
+ */
560
+ function ct_get_server($force=false) {
561
+ global $ct_server;
562
+ if(!$force && isset($ct_server) && isset($ct_server['ct_work_url']) && !empty($ct_server['ct_work_url'])){
563
+
564
+ return $ct_server;
565
+
566
+ }else{
567
+
568
+ $ct_server = get_option('cleantalk_server');
569
+ if (!is_array($ct_server)){
570
+ $ct_server = array(
571
+ 'ct_work_url' => NULL,
572
+ 'ct_server_ttl' => NULL,
573
+ 'ct_server_changed' => NULL
574
+ );
575
+ }
576
+ return $ct_server;
577
+ }
578
+ }
579
+
580
+ /**
581
+ * Inner function - Stores ang returns cleantalk hash of current comment
582
+ * @param string New hash or NULL
583
+ * @return string New hash or current hash depending on parameter
584
+ */
585
+ function ct_hash($new_hash = '') {
586
+ /**
587
+ * Current hash
588
+ */
589
+ static $hash;
590
+
591
+ if (!empty($new_hash)) {
592
+ $hash = $new_hash;
593
+ }
594
+ return $hash;
595
+ }
596
+
597
+ /**
598
+ * Inner function - Write manual moderation results to PHP sessions
599
+ * @param string $hash Cleantalk comment hash
600
+ * @param string $message comment_content
601
+ * @param int $allow flag good comment (1) or bad (0)
602
+ * @return string comment_content w\o cleantalk resume
603
+ */
604
+ function ct_feedback($hash, $allow) {
605
+ global $apbct;
606
+
607
+ $ct_feedback = $hash . ':' . $allow . ';';
608
+ if($apbct->data['feedback_request'])
609
+ $apbct->data['feedback_request'] = $ct_feedback;
610
+ else
611
+ $apbct->data['feedback_request'] .= $ct_feedback;
612
+
613
+ $apbct->saveData();
614
+ }
615
+
616
+ /**
617
+ * Inner function - Sends the results of moderation
618
+ * Scheduled in 3600 seconds!
619
+ * @param string $feedback_request
620
+ * @return bool
621
+ */
622
+ function ct_send_feedback($feedback_request = null) {
623
+
624
+ global $apbct;
625
+
626
+ if (empty($feedback_request) && isset($apbct->data['feedback_request']) && preg_match("/^[a-z0-9\;\:]+$/", $apbct->data['feedback_request'])){
627
+ $feedback_request = $apbct->data['feedback_request'];
628
+ $apbct->data['feedback_request'] = '';
629
+ $apbct->saveData();
630
+ }
631
+
632
+ if ($feedback_request !== null) {
633
+
634
+ $ct_request = new CleantalkRequest(array(
635
+ // General
636
+ 'auth_key' => $apbct->api_key,
637
+ // Additional
638
+ 'feedback' => $feedback_request,
639
+ ));
640
+
641
+ $ct = new Cleantalk();
642
+
643
+ // Server URL handling
644
+ $config = ct_get_server();
645
+ $ct->server_url = APBCT_MODERATE_URL;
646
+ $ct->work_url = preg_match('/http:\/\/.+/', $config['ct_work_url']) ? $config['ct_work_url'] : null;
647
+ $ct->server_ttl = $config['ct_server_ttl'];
648
+ $ct->server_changed = $config['ct_server_changed'];
649
+
650
+ $ct->sendFeedback($ct_request);
651
+
652
+ if ($ct->server_change) {
653
+ update_option(
654
+ 'cleantalk_server',
655
+ array(
656
+ 'ct_work_url' => $ct->work_url,
657
+ 'ct_server_ttl' => $ct->server_ttl,
658
+ 'ct_server_changed' => time(),
659
+ )
660
+ );
661
+ }
662
+
663
+ return true;
664
+ }
665
+
666
+ return false;
667
+ }
668
+
669
+ /**
670
+ * Delete old spam comments
671
+ * Scheduled in 3600 seconds!
672
+ * @return null
673
+ */
674
+ function ct_delete_spam_comments() {
675
+
676
+ global $apbct;
677
+
678
+ if ($apbct->settings['remove_old_spam'] == 1) {
679
+ $last_comments = get_comments(array('status' => 'spam', 'number' => 1000, 'order' => 'ASC'));
680
+ foreach ($last_comments as $c) {
681
+ $comment_date_gmt = strtotime($c->comment_date_gmt);
682
+ if ($comment_date_gmt && is_numeric($comment_date_gmt)) {
683
+ if (time() - $comment_date_gmt > 86400 * $apbct->data['spam_store_days']) {
684
+ // Force deletion old spam comments
685
+ wp_delete_comment($c->comment_ID, true);
686
+ }
687
+ }
688
+ }
689
+ }
690
+
691
+ return null;
692
+ }
693
+
694
+ /*
695
+ * Get data from an ARRAY recursively
696
+ * @return array
697
+ */
698
+ function ct_get_fields_any($arr, $message=array(), $email = null, $nickname = array('nick' => '', 'first' => '', 'last' => ''), $subject = null, $contact = true, $prev_name = ''){
699
+
700
+ //Skip request if fields exists
701
+ $skip_params = array(
702
+ 'ipn_track_id', // PayPal IPN #
703
+ 'txn_type', // PayPal transaction type
704
+ 'payment_status', // PayPal payment status
705
+ 'ccbill_ipn', // CCBill IPN
706
+ 'ct_checkjs', // skip ct_checkjs field
707
+ 'api_mode', // DigiStore-API
708
+ 'loadLastCommentId' // Plugin: WP Discuz. ticket_id=5571
709
+ );
710
+
711
+ // Fields to replace with ****
712
+ $obfuscate_params = array(
713
+ 'password',
714
+ 'pass',
715
+ 'pwd',
716
+ 'pswd'
717
+ );
718
+
719
+ // Skip feilds with these strings and known service fields
720
+ $skip_fields_with_strings = array(
721
+ // Common
722
+ 'ct_checkjs', //Do not send ct_checkjs
723
+ 'nonce', //nonce for strings such as 'rsvp_nonce_name'
724
+ 'security',
725
+ // 'action',
726
+ 'http_referer',
727
+ 'referer-page',
728
+ 'timestamp',
729
+ 'captcha',
730
+ // Formidable Form
731
+ 'form_key',
732
+ 'submit_entry',
733
+ // Custom Contact Forms
734
+ 'form_id',
735
+ 'ccf_form',
736
+ 'form_page',
737
+ // Qu Forms
738
+ 'iphorm_uid',
739
+ 'form_url',
740
+ 'post_id',
741
+ 'iphorm_ajax',
742
+ 'iphorm_id',
743
+ // Fast SecureContact Froms
744
+ 'fs_postonce_1',
745
+ 'fscf_submitted',
746
+ 'mailto_id',
747
+ 'si_contact_action',
748
+ // Ninja Forms
749
+ 'formData_id',
750
+ 'formData_settings',
751
+ 'formData_fields_\d+_id',
752
+ 'formData_fields_\d+_files.*',
753
+ // E_signature
754
+ 'recipient_signature',
755
+ 'output_\d+_\w{0,2}',
756
+ // Contact Form by Web-Settler protection
757
+ '_formId',
758
+ '_returnLink',
759
+ // Social login and more
760
+ '_save',
761
+ '_facebook',
762
+ '_social',
763
+ 'user_login-',
764
+ // Contact Form 7
765
+ '_wpcf7',
766
+ 'ebd_settings',
767
+ 'ebd_downloads_',
768
+ 'ecole_origine',
769
+ 'signature',
770
+ // Ultimate Form Builder
771
+ 'form_data_%d_name',
772
+ );
773
+
774
+ // Reset $message if we have a sign-up data
775
+ $skip_message_post = array(
776
+ 'edd_action', // Easy Digital Downloads
777
+ );
778
+
779
+ if( apbct_array( array( $_POST, $_GET ) )->get_keys( $skip_params )->result() )
780
+ $contact = false;
781
+
782
+ if(count($arr)){
783
+
784
+ foreach($arr as $key => $value){
785
+
786
+ if(gettype($value) == 'string'){
787
+
788
+ $tmp = strpos($value, '\\') !== false ? stripslashes($value) : $value;
789
+ $decoded_json_value = json_decode($tmp, true);
790
+
791
+ // Decoding JSON
792
+ if($decoded_json_value !== null){
793
+ $value = $decoded_json_value;
794
+
795
+ // Ajax Contact Forms. Get data from such strings:
796
+ // acfw30_name %% Blocked~acfw30_email %% s@cleantalk.org
797
+ // acfw30_textarea %% msg
798
+ }elseif(preg_match('/^\S+\s%%\s\S+.+$/', $value)){
799
+ $value = explode('~', $value);
800
+ foreach ($value as &$val){
801
+ $tmp = explode(' %% ', $val);
802
+ $val = array($tmp[0] => $tmp[1]);
803
+ }
804
+ }
805
+ }
806
+
807
+ if(!is_array($value) && !is_object($value)){
808
+
809
+ if (in_array($key, $skip_params, true) && $key != 0 && $key != '' || preg_match("/^ct_checkjs/", $key))
810
+ $contact = false;
811
+
812
+ if($value === '')
813
+ continue;
814
+
815
+ // Skipping fields names with strings from (array)skip_fields_with_strings
816
+ foreach($skip_fields_with_strings as $needle){
817
+ if (preg_match("/".$needle."/", $prev_name.$key) == 1){
818
+ continue(2);
819
+ }
820
+ }unset($needle);
821
+
822
+ // Obfuscating params
823
+ foreach($obfuscate_params as $needle){
824
+ if (strpos($key, $needle) !== false){
825
+ $value = ct_obfuscate_param($value);
826
+ continue(2);
827
+ }
828
+ }unset($needle);
829
+
830
+ $value_for_email = trim( strip_shortcodes( $value ) ); // Removes shortcodes to do better spam filtration on server side.
831
+
832
+ // Email
833
+ if ( ! $email && preg_match( "/^\S+@\S+\.\S+$/", $value_for_email ) ) {
834
+ $email = $value_for_email;
835
+
836
+ // Removes whitespaces
837
+ $value = urldecode( trim( strip_shortcodes( $value ) ) ); // Fully cleaned message
838
+
839
+ // Names
840
+ }elseif (preg_match("/name/i", $key)){
841
+
842
+ preg_match("/((name.?)?(your|first|for)(.?name)?)/", $key, $match_forename);
843
+ preg_match("/((name.?)?(last|family|second|sur)(.?name)?)/", $key, $match_surname);
844
+ preg_match("/(name.?)?(nick|user)(.?name)?/", $key, $match_nickname);
845
+
846
+ if(count($match_forename) > 1)
847
+ $nickname['first'] = $value;
848
+ elseif(count($match_surname) > 1)
849
+ $nickname['last'] = $value;
850
+ elseif(count($match_nickname) > 1)
851
+ $nickname['nick'] = $value;
852
+ else
853
+ $message[$prev_name.$key] = $value;
854
+
855
+ // Subject
856
+ }elseif ($subject === null && preg_match("/subject/i", $key)){
857
+ $subject = $value;
858
+
859
+ // Message
860
+ }else{
861
+ $message[$prev_name.$key] = $value;
862
+ }
863
+
864
+ }elseif(!is_object($value)){
865
+
866
+ $prev_name_original = $prev_name;
867
+ $prev_name = ($prev_name === '' ? $key.'_' : $prev_name.$key.'_');
868
+
869
+ $temp = ct_get_fields_any($value, $message, $email, $nickname, $subject, $contact, $prev_name);
870
+
871
+ $message = $temp['message'];
872
+ $email = ($temp['email'] ? $temp['email'] : null);
873
+ $nickname = ($temp['nickname'] ? $temp['nickname'] : null);
874
+ $subject = ($temp['subject'] ? $temp['subject'] : null);
875
+ if($contact === true)
876
+ $contact = ($temp['contact'] === false ? false : true);
877
+ $prev_name = $prev_name_original;
878
+ }
879
+ } unset($key, $value);
880
+ }
881
+
882
+ foreach ($skip_message_post as $v) {
883
+ if (isset($_POST[$v])) {
884
+ $message = null;
885
+ break;
886
+ }
887
+ } unset($v);
888
+
889
+ //If top iteration, returns compiled name field. Example: "Nickname Firtsname Lastname".
890
+ if($prev_name === ''){
891
+ if(!empty($nickname)){
892
+ $nickname_str = '';
893
+ foreach($nickname as $value){
894
+ $nickname_str .= ($value ? $value." " : "");
895
+ }unset($value);
896
+ }
897
+ $nickname = $nickname_str;
898
+ }
899
+
900
+ $return_param = array(
901
+ 'email' => $email,
902
+ 'nickname' => $nickname,
903
+ 'subject' => $subject,
904
+ 'contact' => $contact,
905
+ 'message' => $message
906
+ );
907
+ return $return_param;
908
+ }
909
+
910
+ /**
911
+ * Masks a value with asterisks (*)
912
+ * @return string
913
+ */
914
+ function ct_obfuscate_param($value = null) {
915
+ if ($value && (!is_object($value) || !is_array($value))) {
916
+ $length = strlen($value);
917
+ $value = str_repeat('*', $length);
918
+ }
919
+
920
+ return $value;
921
+ }
922
+
923
+ //New ct_get_fields_any_postdata
924
+ function ct_get_fields_any_postdata($arr, $message=array()){
925
+ $skip_params = array(
926
+ 'ipn_track_id', // PayPal IPN #
927
+ 'txn_type', // PayPal transaction type
928
+ 'payment_status', // PayPal payment status
929
+ );
930
+
931
+ foreach($arr as $key => $value){
932
+ if(!is_array($value)){
933
+ if($value == '')
934
+ continue;
935
+ if (!(in_array($key, $skip_params) || preg_match("/^ct_checkjs/", $key)) && $value!='')
936
+ $message[$key] = $value;
937
+ }else{
938
+ $temp = ct_get_fields_any_postdata($value);
939
+ $message = (count($temp) == 0 ? $message : array_merge($message, $temp));
940
+ }
941
+ }
942
+ return $message;
943
+ }
944
+
945
+ /**
946
+ * Checks if given string is valid regular expression
947
+ *
948
+ * @param string $regexp
949
+ *
950
+ * @return bool
951
+ */
952
+ function apbct_is_regexp($regexp){
953
+ return @preg_match('/' . $regexp . '/', null) !== false;
954
+ }
955
+
956
+ function cleantalk_debug($key,$value)
957
+ {
958
+ if(isset($_COOKIE) && isset($_COOKIE['cleantalk_debug']))
959
+ {
960
+ @header($key.": ".$value);
961
+ }
962
+ }
963
+
964
+ /**
965
+ * Function changes CleanTalk result object if an error occurred.
966
+ * @return object
967
+ */
968
+ function ct_change_plugin_resonse($ct_result = null, $checkjs = null) {
969
+
970
+ global $apbct;
971
+
972
+ if (!$ct_result) {
973
+ return $ct_result;
974
+ }
975
+
976
+ if(@intval($ct_result->errno) != 0)
977
+ {
978
+ if($checkjs === null || $checkjs != 1)
979
+ {
980
+ $ct_result->allow = 0;
981
+ $ct_result->spam = 1;
982
+ $ct_result->comment = sprintf('We\'ve got an issue: %s. Forbidden. Please, enable Javascript. %s.',
983
+ $ct_result->comment,
984
+ $apbct->plugin_name
985
+ );
986
+ }
987
+ else
988
+ {
989
+ $ct_result->allow = 1;
990
+ $ct_result->comment = 'Allow';
991
+ }
992
+ }
993
+
994
+ return $ct_result;
995
+ }
996
+
997
+ /**
998
+ * Does key has correct symbols? Checks against regexp ^[a-z\d]{3,15}$
999
+ * @param api_key
1000
+ * @return bool
1001
+ */
1002
+ function apbct_api_key__is_correct($api_key = null)
1003
+ {
1004
+ global $apbct;
1005
+ $api_key = $api_key !== null ? $api_key : $apbct->api_key;
1006
+ return $api_key && preg_match('/^[a-z\d]{3,15}$/', $api_key) ? true : false;
1007
+ }
1008
+
1009
+ function apbct_add_async_attribute($tag, $handle, $src) {
1010
+
1011
+ global $apbct;
1012
+
1013
+ if(
1014
+ $apbct->settings['async_js'] &&
1015
+ (
1016
+ $handle === 'ct_public'
1017
+ || $handle === 'ct_public_gdpr'
1018
+ || $handle === 'ct_debug_js'
1019
+ || $handle === 'ct_public_admin_js'
1020
+ || $handle === 'ct_internal'
1021
+ || $handle === 'ct_external'
1022
+ || $handle === 'ct_nocache'
1023
+ )
1024
+ )
1025
+ return str_replace( ' src', ' async="async" src', $tag );
1026
+ else
1027
+ return $tag;
1028
  }
inc/cleantalk-public.php CHANGED
@@ -1,3901 +1,3930 @@
1
- <?php
2
-
3
- /**
4
- * Init functions
5
- * @return mixed[] Array of options
6
- */
7
- function apbct_init() {
8
-
9
- global $ct_wplp_result_label, $ct_jp_comments, $ct_post_data_label, $ct_post_data_authnet_label, $apbct, $test_external_forms, $cleantalk_executed, $wpdb;
10
-
11
- //Check internal forms with such "action" http://wordpress.loc/contact-us/some_script.php
12
- if((isset($_POST['action']) && $_POST['action'] == 'ct_check_internal') &&
13
- $apbct->settings['check_internal']
14
- ){
15
- $ct_result = ct_contact_form_validate();
16
- if($ct_result == null){
17
- echo 'true';
18
- die();
19
- }else{
20
- echo $ct_result;
21
- die();
22
- }
23
- }
24
-
25
- //fix for EPM registration form
26
- if(isset($_POST) && isset($_POST['reg_email']) && shortcode_exists( 'epm_registration_form' ))
27
- {
28
- unset($_POST['ct_checkjs_register_form']);
29
- }
30
-
31
- if(isset($_POST['_wpnonce-et-pb-contact-form-submitted']))
32
- {
33
- add_shortcode( 'et_pb_contact_form', 'ct_contact_form_validate' );
34
- }
35
-
36
- if($apbct->settings['check_external']){
37
-
38
- // Fixing form and directs it this site
39
- if($apbct->settings['check_external__capture_buffer'] && !is_admin() && !apbct_is_ajax() && !apbct_is_post() && apbct_is_user_enable() && !(defined('DOING_CRON') && DOING_CRON) && !(defined('XMLRPC_REQUEST') && XMLRPC_REQUEST)){
40
-
41
- if (defined('CLEANTALK_CAPTURE_BUFFER_SPECIFIC_URL') && is_string(CLEANTALK_CAPTURE_BUFFER_SPECIFIC_URL)) {
42
- $catch_buffer = false;
43
- $urls = explode(',', CLEANTALK_CAPTURE_BUFFER_SPECIFIC_URL);
44
- foreach ($urls as $url) {
45
- if (apbct_is_in_uri($url))
46
- $catch_buffer = true;
47
- }
48
- }else{
49
- $catch_buffer = true;
50
- }
51
-
52
- if( $catch_buffer ){
53
- add_action('wp', 'apbct_buffer__start');
54
- add_action('shutdown', 'apbct_buffer__end', 0);
55
- add_action('shutdown', 'apbct_buffer__output', 2);
56
- }
57
- }
58
-
59
- // Check and redirecct
60
- if( apbct_is_post()
61
- && isset($_POST['cleantalk_hidden_method'])
62
- && isset($_POST['cleantalk_hidden_action'])
63
- ){
64
- $action = htmlspecialchars($_POST['cleantalk_hidden_action']);
65
- $method = htmlspecialchars($_POST['cleantalk_hidden_method']);
66
- unset($_POST['cleantalk_hidden_action']);
67
- unset($_POST['cleantalk_hidden_method']);
68
- ct_contact_form_validate();
69
- if(!apbct_is_ajax()){
70
- print "<html><body><form method='$method' action='$action'>";
71
- ct_print_form($_POST, '');
72
- print "</form></body></html>";
73
- print "<script>
74
- if(document.forms[0].submit !== 'undefined'){
75
- var objects = document.getElementsByName('submit');
76
- if(objects.length > 0)
77
- document.forms[0].removeChild(objects[0]);
78
- }
79
- document.forms[0].submit();
80
- </script>";
81
- die();
82
- }
83
- }
84
- }
85
-
86
- if(isset($_POST['quform_ajax'], $_POST['quform_csrf_token'], $_POST['quform_form_id'])){
87
- require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-ajax.php');
88
- ct_ajax_hook();
89
- }
90
-
91
- /**hooks for cm answers pro */
92
- if(defined('CMA_PLUGIN_FILE')){
93
- add_action( 'wp', 'ct_ajax_hook',1 );
94
- }
95
-
96
- //hook for Anonymous Post
97
- if($apbct->settings['general_postdata_test'] == 1 && empty($_POST['ct_checkjs_cf7']))
98
- add_action('wp', 'ct_contact_form_validate_postdata',1);
99
-
100
- if($apbct->settings['general_contact_forms_test'] == 1 && empty($_POST['ct_checkjs_cf7'])){
101
- add_action('CMA_custom_post_type_nav', 'ct_contact_form_validate_postdata',1);
102
- //add_action('init','ct_contact_form_validate',1);
103
- ct_contact_form_validate();
104
- if(isset($_POST['reg_redirect_link'])&&isset($_POST['tmpl_registration_nonce_field']))
105
- {
106
- unset($_POST['ct_checkjs_register_form']);
107
- ct_contact_form_validate();
108
- }
109
- /*if(isset($_GET['ait-action'])&&$_GET['ait-action']=='register')
110
- {
111
- $tmp=$_POST['redirect_to'];
112
- unset($_POST['redirect_to']);
113
- ct_contact_form_validate();
114
- $_POST['redirect_to']=$tmp;
115
- }*/
116
- }
117
-
118
- if($apbct->settings['general_postdata_test'] == 1 && empty($_POST['ct_checkjs_cf7']))
119
- add_action('CMA_custom_post_type_nav', 'ct_contact_form_validate_postdata',1);
120
-
121
- //add_action('wp_footer','ct_ajaxurl');
122
-
123
- // Fast Secure contact form
124
- if(defined('FSCF_VERSION')){
125
- add_filter('si_contact_display_after_fields', 'ct_si_contact_display_after_fields');
126
- add_filter('si_contact_form_validate', 'ct_si_contact_form_validate');
127
- }
128
-
129
- // WooCommerce registration
130
- if(class_exists('WooCommerce')){
131
- add_filter( 'woocommerce_registration_errors', 'ct_registration_errors', 1, 3 );
132
- if ($apbct->settings['wc_checkout_test'] == 1) {
133
- add_filter('woocommerce_checkout_process', 'ct_woocommerce_checkout_check', 1, 3);
134
- }
135
- if( isset($_REQUEST['wc-ajax']) && $_REQUEST['wc-ajax'] == 'checkout' && $apbct->settings['wc_checkout_test'] == 0 && $apbct->settings['wc_register_from_order'] == 0 ){
136
- remove_filter( 'woocommerce_registration_errors', 'ct_registration_errors', 1 );
137
- }
138
- }
139
-
140
- // WooCommerce whishlist
141
- if(class_exists('WC_Wishlists_Wishlist'))
142
- add_filter('wc_wishlists_create_list_args', 'ct_woocommerce_wishlist_check', 1, 1);
143
-
144
-
145
- // JetPack Contact form
146
- $jetpack_active_modules = false;
147
- if(defined('JETPACK__VERSION'))
148
- {
149
- if(isset($_POST['action']) && $_POST['action'] == 'grunion-contact-form' ){
150
- if(JETPACK__VERSION=='3.4-beta')
151
- {
152
- add_filter('contact_form_is_spam', 'ct_contact_form_is_spam');
153
- }
154
- else if(JETPACK__VERSION=='3.4-beta2'||JETPACK__VERSION>='3.4')
155
- {
156
- add_filter('jetpack_contact_form_is_spam', 'ct_contact_form_is_spam_jetpack',50,2);
157
- }
158
- else
159
- {
160
- add_filter('contact_form_is_spam', 'ct_contact_form_is_spam');
161
- }
162
- $jetpack_active_modules = get_option('jetpack_active_modules');
163
- if ((class_exists( 'Jetpack', false) && $jetpack_active_modules && in_array('comments', $jetpack_active_modules)))
164
- {
165
- $ct_jp_comments = true;
166
- }
167
- }else
168
- add_filter('grunion_contact_form_field_html', 'ct_grunion_contact_form_field_html', 10, 2);
169
- }
170
-
171
- // WP Maintenance Mode (wpmm)
172
- add_action('wpmm_head', 'apbct_form__wpmm__addField', 1);
173
-
174
- // Contact Form7
175
- if(defined('WPCF7_VERSION')){
176
- add_filter('wpcf7_form_elements', 'apbct_form__contactForm7__addField');
177
- add_filter('wpcf7_validate', 'apbct_form__contactForm7__tesSpam__before_validate', 999, 2);
178
- add_filter(WPCF7_VERSION >= '3.0.0' ? 'wpcf7_spam' : 'wpcf7_acceptance', 'apbct_form__contactForm7__testSpam');
179
- }
180
-
181
- // Formidable
182
- add_filter( 'frm_entries_before_create', 'apbct_rorm__formidable__testSpam', 10, 2 );
183
- add_action( 'frm_entries_footer_scripts', 'apbct_rorm__formidable__footerScripts', 20, 2 );
184
-
185
- // BuddyPress
186
- if(class_exists('BuddyPress')){
187
- add_action('bp_before_registration_submit_buttons','ct_register_form',1);
188
- add_action('messages_message_before_save', 'apbct_integration__buddyPres__private_msg_check', 1);
189
- add_filter('bp_signup_validate', 'ct_registration_errors',1);
190
- add_filter('bp_signup_validate', 'ct_check_registration_erros', 999999);
191
- }
192
-
193
- if(defined('PROFILEPRESS_SYSTEM_FILE_PATH')){
194
- add_filter('pp_registration_validation', 'ct_registration_errors_ppress', 11, 2);
195
- }
196
-
197
-
198
- // bbPress
199
- if(class_exists('bbPress')){
200
- add_filter('bbp_new_topic_pre_title', 'ct_bbp_get_topic', 1);
201
- add_filter('bbp_new_topic_pre_content', 'ct_bbp_new_pre_content', 1);
202
- add_filter('bbp_new_reply_pre_content', 'ct_bbp_new_pre_content', 1);
203
- add_action('bbp_theme_before_topic_form_content', 'ct_comment_form');
204
- add_action('bbp_theme_before_reply_form_content', 'ct_comment_form');
205
- }
206
-
207
- //Custom Contact Forms
208
- if(defined('CCF_VERSION'))
209
- add_filter('ccf_field_validator', 'ct_ccf', 1, 4);
210
-
211
- add_action('comment_form', 'ct_comment_form');
212
-
213
- // intercept WordPress Landing Pages POST
214
- if (defined('LANDINGPAGES_CURRENT_VERSION') && !empty($_POST)){
215
- if(array_key_exists('action', $_POST) && $_POST['action'] === 'inbound_store_lead'){ // AJAX action(s)
216
- ct_check_wplp();
217
- }else if(array_key_exists('inbound_submitted', $_POST) && $_POST['inbound_submitted'] == '1'){ // Final submit
218
- ct_check_wplp();
219
- }
220
- }
221
-
222
- // S2member. intercept POST
223
- if (defined('WS_PLUGIN__S2MEMBER_PRO_VERSION')){
224
- $post_keys = array_keys($_POST);
225
- foreach($post_keys as $post_key){
226
-
227
- // Detect POST keys like /s2member_pro.*registration/
228
- if(strpos($post_key, 's2member') !== false && strpos($post_key, 'registration') !== false){
229
- ct_s2member_registration_test($post_key);
230
- break;
231
- }
232
- }
233
- }
234
-
235
- // New user approve hack
236
- // https://wordpress.org/plugins/new-user-approve/
237
- if (ct_plugin_active('new-user-approve/new-user-approve.php')) {
238
- add_action('register_post', 'ct_register_post', 1, 3);
239
- }
240
-
241
- // Wilcity theme registration validation fix
242
- add_filter( 'wilcity/filter/wiloke-listing-tools/validate-before-insert-account', 'apbct_wilcity_reg_validation', 10, 2 );
243
-
244
-
245
- // Gravity forms
246
- if (defined('GF_MIN_WP_VERSION')) {
247
- add_filter('gform_get_form_filter', 'apbct_form__gravityForms__addField', 10, 2);
248
- add_filter('gform_entry_is_spam', 'apbct_form__gravityForms__testSpam', 999, 3);
249
- add_filter('gform_confirmation', 'apbct_form__gravityForms__showResponse', 999, 4 );
250
- }
251
-
252
- //Pirate forms
253
- if(defined('PIRATE_FORMS_VERSION')){
254
- if(isset($_POST['pirate-forms-contact-name']) && $_POST['pirate-forms-contact-name'] && isset($_POST['pirate-forms-contact-email']) && $_POST['pirate-forms-contact-email'])
255
- apbct_form__piratesForm__testSpam();
256
- }
257
-
258
- // WPForms
259
- // Adding fields
260
- add_action('wpforms_frontend_output', 'apbct_form__WPForms__addField', 1000, 5);
261
- // Gathering data to validate
262
- add_filter('wpforms_process_before_filter', 'apbct_from__WPForms__gatherData', 100, 2);
263
- // Do spam check
264
- add_filter('wpforms_process_initial_errors', 'apbct_form__WPForms__showResponse', 100, 2);
265
-
266
- // QForms integration
267
- add_filter( 'quform_post_validate', 'ct_quform_post_validate', 10, 2 );
268
-
269
- // Ultimate Members
270
- if (class_exists('UM')) {
271
- add_action('um_main_register_fields','ct_register_form',100); // Add hidden fileds
272
- add_action( 'um_submit_form_register', 'apbct_registration__UltimateMembers__check', 9, 1 ); // Check submition
273
- }
274
-
275
- // Paid Memberships Pro integration
276
- add_filter( 'pmpro_required_user_fields', function( $pmpro_required_user_fields ){
277
-
278
- if(
279
- ! empty( $pmpro_required_user_fields['username'] ) &&
280
- ! empty( $pmpro_required_user_fields['bemail'] ) &&
281
- ! empty( $pmpro_required_user_fields['bconfirmemail'] ) &&
282
- $pmpro_required_user_fields['bemail'] == $pmpro_required_user_fields['bconfirmemail']
283
- ) {
284
- $check = ct_test_registration( $pmpro_required_user_fields['username'], $pmpro_required_user_fields['bemail'], apbct_get_server_variable( 'REMOTE_ADDR' ) );
285
- if( $check['allow'] == 0 ) {
286
- pmpro_setMessage( $check['comment'], 'pmpro_error' );
287
- }
288
- }
289
-
290
- return $pmpro_required_user_fields;
291
-
292
- } );
293
-
294
- //
295
- // Load JS code to website footer
296
- //
297
- if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)) {
298
- add_action('wp_head', 'apbct_hook__wp_head__set_cookie__ct_checkjs', 1);
299
- add_action('wp_footer', 'apbct_hook__wp_footer', 1);
300
- }
301
-
302
- if ($apbct->settings['protect_logged_in'] != 1 && is_user_logged_in()) {
303
- ct_contact_form_validate();
304
- }
305
-
306
- if (apbct_is_user_enable()) {
307
-
308
- if ($apbct->settings['general_contact_forms_test'] == 1 && !isset($_POST['comment_post_ID']) && !isset($_GET['for'])){
309
- add_action( 'init', 'ct_contact_form_validate', 999 );
310
- }
311
- if( apbct_is_post() &&
312
- $apbct->settings['general_postdata_test'] == 1 &&
313
- !isset($_POST['ct_checkjs_cf7']) &&
314
- !is_admin() &&
315
- !apbct_is_user_role_in(array('administrator', 'moderator'))
316
- ){
317
- ct_contact_form_validate_postdata();
318
- }
319
- }
320
- }
321
-
322
- function apbct_buffer__start(){
323
- ob_start();
324
- }
325
-
326
- function apbct_buffer__end(){
327
-
328
- if(!ob_get_level())
329
- return;
330
-
331
- global $apbct;
332
- $apbct->buffer = ob_get_contents();
333
- ob_end_clean();
334
- }
335
-
336
- /**
337
- * Outputs changed buffer
338
- *
339
- * @global $apbct
340
- */
341
- function apbct_buffer__output(){
342
-
343
- global $apbct, $wp;
344
-
345
- if(empty($apbct->buffer))
346
- return;
347
-
348
- $site_url = get_option('siteurl');
349
- $site__host = parse_url($site_url, PHP_URL_HOST);
350
-
351
- $dom = new DOMDocument();
352
- @$dom->loadHTML($apbct->buffer);
353
-
354
- $forms = $dom->getElementsByTagName('form');
355
-
356
- foreach($forms as $form){
357
-
358
- $action = $form->getAttribute('action');
359
- $action = $action ? $action : $site_url;
360
- $action__host = parse_url($action, PHP_URL_HOST);
361
-
362
- // Check if the form directed to the third party site
363
- if($site__host != $action__host){
364
-
365
- $method = $form->getAttribute('method');
366
- $method = $method ? $method : 'get';
367
- // Directs form to our site
368
- $form->setAttribute('method', 'POST');
369
- $form->setAttribute('action', home_url(add_query_arg(array(), $wp->request)));
370
-
371
- // Add cleantalk_hidden_action
372
- $new_input = $dom->createElement('input');
373
- $new_input->setAttribute('type', 'hidden');
374
- $new_input->setAttribute('name', 'cleantalk_hidden_action');
375
- $new_input->setAttribute('value', $action);
376
- $form->appendChild($new_input);
377
-
378
- // Add cleantalk_hidden_method
379
- $new_input = $dom->createElement('input');
380
- $new_input->setAttribute('type', 'hidden');
381
- $new_input->setAttribute('name', 'cleantalk_hidden_method');
382
- $new_input->setAttribute('value', $method);
383
- $form->appendChild($new_input);
384
-
385
- }
386
-
387
- } unset($form);
388
-
389
- $html = $dom->getElementsByTagName('html');
390
-
391
- $output = gettype($html) == 'object' && isset($html[0], $html[0]->childNodes, $html[0]->childNodes[0])
392
- ? $dom->saveHTML()
393
- : $apbct->buffer;
394
-
395
- echo $output;
396
- die();
397
- }
398
-
399
- // MailChimp Premium for Wordpress
400
- function ct_add_mc4wp_error_message($messages){
401
-
402
- $messages['ct_mc4wp_response'] = array(
403
- 'type' => 'error',
404
- 'text' => 'Your message looks like spam.'
405
- );
406
- return $messages;
407
- }
408
- add_filter( 'mc4wp_form_messages', 'ct_add_mc4wp_error_message' );
409
-
410
- /*
411
- * Function to set validate fucntion for CCF form
412
- * Input - Сonsistently each form field
413
- * Returns - String. Validate function
414
- */
415
- function ct_ccf($callback, $value, $field_id, $type){
416
- /*
417
- if($type == 'name')
418
- $ct_global_temporary_data['name'] = $value;
419
- elseif($type == 'email')
420
- $ct_global_temporary_data['email'] = $value;
421
- else
422
- $ct_global_temporary_data[] = $value;
423
- //*/
424
- return 'ct_validate_ccf_submission';
425
- }
426
- /*
427
- * Validate function for CCF form. Gatheering data. Multiple calls.
428
- * Input - void. Global $ct_global_temporary_data
429
- * Returns - String. CleanTalk comment.
430
- */
431
- $ct_global_temporary_data = array();
432
- function ct_validate_ccf_submission($value, $field_id, $required){
433
- global $ct_global_temporary_data, $apbct;
434
-
435
-
436
-
437
- //If the check for contact forms enabled
438
- if(!$apbct->settings['contact_forms_test']) {
439
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
440
- return true;
441
- }
442
-
443
- //If the check for logged in users enabled
444
- if($apbct->settings['protect_logged_in'] == 1 && is_user_logged_in()) {
445
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
446
- return true;
447
- }
448
-
449
-
450
- //Accumulate data
451
- $ct_global_temporary_data[] = $value;
452
-
453
- //If it's the last field of the form
454
- (!isset($ct_global_temporary_data['count']) ? $ct_global_temporary_data['count'] = 1 : $ct_global_temporary_data['count']++);
455
- $form_id = $_POST['form_id'];
456
- if($ct_global_temporary_data['count'] != count(get_post_meta( $form_id, 'ccf_attached_fields', true ))) {
457
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
458
- return true;
459
- }
460
-
461
- unset($ct_global_temporary_data['count']);
462
-
463
- //Getting request params
464
- $ct_temp_msg_data = ct_get_fields_any($_POST);
465
-
466
- unset($ct_global_temporary_data);
467
-
468
- $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
469
- $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
470
- $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
471
- $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
472
- $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
473
-
474
- if ($subject != '')
475
- $message['subject'] = $subject;
476
-
477
- $post_info['comment_type'] = 'feedback_custom_contact_forms';
478
- $post_info['post_url'] = apbct_get_server_variable( 'HTTP_REFERER' );
479
-
480
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
481
- ? apbct_js_test('ct_checkjs', $_COOKIE)
482
- : apbct_js_test('ct_checkjs', $_POST);
483
-
484
- //Making a call
485
- $base_call_result = apbct_base_call(
486
- array(
487
- 'message' => $message,
488
- 'sender_email' => $sender_email,
489
- 'sender_nickname' => $sender_nickname,
490
- 'post_info' => $post_info,
491
- 'js_on' => $checkjs,
492
- 'sender_info' => array('sender_url' => null),
493
- )
494
- );
495
-
496
- $ct_result = $base_call_result['ct_result'];
497
-
498
- return $ct_result->allow == 0 ? $ct_result->comment : true;;
499
- }
500
-
501
- function ct_woocommerce_wishlist_check($args){
502
- global $apbct;
503
-
504
-
505
-
506
- //Protect logged in users
507
- if($args['wishlist_status'])
508
- if($apbct->settings['protect_logged_in'] == 0) {
509
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
510
- return $args;
511
- }
512
-
513
-
514
- //If the IP is a Google bot
515
- $hostname = gethostbyaddr( apbct_get_server_variable( 'REMOTE_ADDR' ) );
516
- if(!strpos($hostname, 'googlebot.com')) {
517
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
518
- return $args;
519
- }
520
-
521
-
522
- //Getting request params
523
- $message = '';
524
- $subject = '';
525
- $email = $args['wishlist_owner_email'];
526
- if($args['wishlist_first_name']!='' || $args['wishlist_last_name']!='')
527
- $nickname = trim($args['wishlist_first_name']." ".$args['wishlist_last_name']);
528
- else
529
- $nickname = '';
530
-
531
- $post_info['comment_type'] = 'feedback';
532
- $post_info['post_url'] = apbct_get_server_variable( 'HTTP_REFERER' );
533
-
534
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
535
- ? apbct_js_test('ct_checkjs', $_COOKIE)
536
- : apbct_js_test('ct_checkjs', $_POST);
537
-
538
- //Making a call
539
- $base_call_result = apbct_base_call(
540
- array(
541
- 'message' => $subject." ".$message,
542
- 'sender_email' => $email,
543
- 'sender_nickname' => $nickname,
544
- 'post_info' => $post_info,
545
- 'js_on' => $checkjs,
546
- 'sender_info' => array('sender_url' => null),
547
- )
548
- );
549
-
550
- $ct_result = $base_call_result['ct_result'];
551
-
552
- if ($ct_result->allow == 0)
553
- wp_die("<h1>".__('Spam protection by CleanTalk', 'cleantalk-spam-protect')."</h1><h2>".$ct_result->comment."</h2>", '', array('response' => 403, "back_link" => true, "text_direction" => 'ltr'));
554
- else
555
- return $args;
556
- }
557
-
558
- function apbct_integration__buddyPres__getTemplateName( $located, $template_name, $template_names, $template_locations, $load, $require_once ) {
559
- global $apbct;
560
- preg_match("/\/([a-z-_]+)\/buddypress-functions\.php$/", $located, $matches);
561
- $apbct->buddy_press_tmpl = isset($matches[1]) ? $matches[1] : 'unknown';
562
- }
563
-
564
- /**
565
- * Test BuddyPress activity for spam (post update only)
566
- *
567
- * @global SpbcState $apbct
568
- * @param bool $is_spam
569
- * @param BP_Activity_Activity $activity_obj Activity object (\plugins\buddypress\bp-activity\classes\class-bp-activity-activity.php)
570
- * @return boolean Spam flag
571
- */
572
- function apbct_integration__buddyPres__activityWall( $is_spam, $activity_obj = null ){
573
-
574
- global $apbct;
575
-
576
- $allowed_post_actions = array('post_update', 'new_activity_comment');
577
-
578
- if( ! in_array(\Cleantalk\Variables\Post::get('action'), $allowed_post_actions) ||
579
- $activity_obj === null ||
580
- ! \Cleantalk\Variables\Post::get('action') ||
581
- $activity_obj->privacy == 'media' ||
582
- apbct_exclusions_check()
583
- ) {
584
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
585
- return false;
586
- }
587
-
588
- $curr_user = get_user_by('id', $activity_obj->user_id);
589
-
590
- //Making a call
591
- $base_call_result = apbct_base_call(
592
- array(
593
- 'message' => is_string($activity_obj->content) ? $activity_obj->content : '',
594
- 'sender_email' => $curr_user->data->user_email,
595
- 'sender_nickname' => $curr_user->data->user_login,
596
- 'post_info' => array(
597
- 'post_url' => apbct_get_server_variable( 'HTTP_REFERER' ),
598
- 'comment_type' => 'buddypress_activitywall',
599
- ),
600
- 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE),
601
- 'sender_info' => array('sender_url' => null),
602
- )
603
- );
604
-
605
- $ct_result = $base_call_result['ct_result'];
606
-
607
- if ($ct_result->allow == 0){
608
- add_action('bp_activity_after_save', 'apbct_integration__buddyPres__activityWall_showResponse', 1, 1);
609
- $apbct->spam_notification = $ct_result->comment;
610
- return true;
611
- }else
612
- return $is_spam;
613
- }
614
-
615
- /**
616
- * Outputs message to AJAX frontend handler
617
- *
618
- * @global SpbcState $apbct
619
- * @param BP_Activity_Activity $activity_obj Activity object (\plugins\buddypress\bp-activity\classes\class-bp-activity-activity.php)
620
- */
621
- function apbct_integration__buddyPres__activityWall_showResponse( $activity_obj ){
622
-
623
- global $apbct;
624
-
625
- // Legacy template
626
- if($apbct->buddy_press_tmpl === 'bp-legacy'){
627
- die('<div id="message" class="error bp-ajax-message"><p>'. $apbct->spam_notification .'</p></div>');
628
- // Nouveau tamplate and others
629
- }else{
630
- @header( 'Content-Type: application/json; charset=' . get_option('blog_charset'));
631
- die(json_encode(array(
632
- 'success' => false,
633
- 'data' => array('message' => $apbct->spam_notification),
634
- )));
635
- }
636
- }
637
-
638
- /**
639
- * Public function - Tests new private messages (dialogs)
640
- *
641
- * @global SpbcState $apbct
642
- * @param type $bp_message_obj
643
- * @return void|array with errors if spam has found
644
- */
645
- function apbct_integration__buddyPres__private_msg_check( $bp_message_obj){
646
-
647
- global $apbct;
648
-
649
- //Check for enabled option
650
- if(
651
- $apbct->settings['bp_private_messages'] == 0 ||
652
- apbct_exclusions_check()
653
- ) {
654
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
655
- return;
656
- }
657
-
658
-
659
- //Check for quantity of comments
660
- $comments_check_number = defined('CLEANTALK_CHECK_COMMENTS_NUMBER')
661
- ? CLEANTALK_CHECK_COMMENTS_NUMBER
662
- : 3;
663
-
664
- if($apbct->settings['check_comments_number']){
665
- $args = array(
666
- 'user_id' => $bp_message_obj->sender_id,
667
- 'box' => 'sentbox',
668
- 'type' => 'all',
669
- 'limit' => $comments_check_number,
670
- 'page' => null,
671
- 'search_terms' => '',
672
- 'meta_query' => array()
673
- );
674
- $sentbox_msgs = BP_Messages_Thread::get_current_threads_for_user($args);
675
- $cnt_sentbox_msgs = $sentbox_msgs['total'];
676
- $args['box'] = 'inbox';
677
- $inbox_msgs = BP_Messages_Thread::get_current_threads_for_user($args);
678
- $cnt_inbox_msgs = $inbox_msgs['total'];
679
-
680
- if(($cnt_inbox_msgs + $cnt_sentbox_msgs) >= $comments_check_number)
681
- $is_max_comments = true;
682
- }
683
-
684
- if(!empty($is_max_comments)) {
685
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
686
- return;
687
- }
688
-
689
-
690
- $sender_user_obj = get_user_by('id', $bp_message_obj->sender_id);
691
-
692
- //Making a call
693
- $base_call_result = apbct_base_call(
694
- array(
695
- 'message' => $bp_message_obj->subject." ".$bp_message_obj->message,
696
- 'sender_email' => $sender_user_obj->data->user_email,
697
- 'sender_nickname' => $sender_user_obj->data->user_login,
698
- 'post_info' => array(
699
- 'comment_type' => 'buddypress_comment',
700
- 'post_url' => apbct_get_server_variable( 'HTTP_REFERER' ),
701
- ),
702
- 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE)
703
- ? apbct_js_test('ct_checkjs', $_COOKIE)
704
- : apbct_js_test('ct_checkjs', $_POST),
705
- 'sender_info' => array('sender_url' => null),
706
- )
707
- );
708
-
709
- $ct_result = $base_call_result['ct_result'];
710
-
711
- if ($ct_result->allow == 0)
712
- wp_die("<h1>".__('Spam protection by CleanTalk', 'cleantalk-spam-protect')."</h1><h2>".$ct_result->comment."</h2>", '', array('response' => 403, "back_link" => true, "text_direction" => 'ltr'));
713
- }
714
-
715
- /**
716
- * Adds hiden filed to deafualt serach form
717
- *
718
- * @param $form string
719
- * @return string
720
- */
721
- function apbct_forms__search__addField( $form ){
722
- global $apbct;
723
- if($apbct->settings['search_test'] == 1){
724
- $js_filed = ct_add_hidden_fields('ct_checkjs_search_default', true, false, false, false);
725
- $form = str_replace('</form>', $js_filed, $form);
726
- }
727
- return $form;
728
- }
729
-
730
- /**
731
- * Test default search string for spam
732
- *
733
- * @param $search string
734
- * @return string
735
- */
736
- function apbct_forms__search__testSpam( $search ){
737
-
738
- global $apbct, $cleantalk_executed;
739
-
740
- if(
741
- empty($search) ||
742
- $cleantalk_executed ||
743
- $apbct->settings['search_test'] == 0 ||
744
- $apbct->settings['protect_logged_in'] != 1 && is_user_logged_in() // Skip processing for logged in users.
745
- ){
746
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
747
- return $search;
748
- }
749
-
750
- if(apbct_is_user_logged_in())
751
- $user = wp_get_current_user();
752
-
753
- $base_call_result = apbct_base_call(
754
- array(
755
- 'message' => $search,
756
- 'sender_email' => !empty($user) ? $user->user_email : null,
757
- 'sender_nickname' => !empty($user) ? $user->user_login : null,
758
- 'post_info' => array('comment_type' => 'site_search_wordpress'),
759
- //'js_on' => apbct_js_test('ct_checkjs_search_default', $_GET, true),
760
- )
761
- );
762
- $ct_result = $base_call_result['ct_result'];
763
-
764
- $cleantalk_executed = true;
765
-
766
- if ($ct_result->allow == 0){
767
- die($ct_result->comment);
768
- }
769
-
770
- return $search;
771
- }
772
-
773
- function apbct_search_add_noindex() {
774
-
775
- global $apbct;
776
-
777
- if(
778
- ! is_search() || // If it is search results
779
- $apbct->settings['search_test'] == 0 ||
780
- $apbct->settings['protect_logged_in'] != 1 && is_user_logged_in() // Skip processing for logged in users.
781
- ){
782
- return ;
783
- }
784
-
785
- echo '<!-- meta by Cleantalk AntiSpam Protection plugin -->' . "\n";
786
- echo '<meta name="robots" content="noindex,nofollow" />' . "\n";
787
-
788
- }
789
-
790
- /**
791
- * Test woocommerce checkout form for spam
792
- *
793
- */
794
- function ct_woocommerce_checkout_check() {
795
-
796
- //Getting request params
797
- $ct_temp_msg_data = ct_get_fields_any($_POST);
798
-
799
- $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
800
- $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
801
- $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
802
- $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
803
- $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
804
-
805
- if($subject != '')
806
- $message = array_merge(array('subject' => $subject), $message);
807
-
808
- $post_info['comment_type'] = 'order';
809
- $post_info['post_url'] = apbct_get_server_variable( 'HTTP_REFERER' );
810
-
811
- //Making a call
812
- $base_call_result = apbct_base_call(
813
- array(
814
- 'message' => $message,
815
- 'sender_email' => $sender_email,
816
- 'sender_nickname' => $sender_nickname,
817
- 'post_info' => $post_info,
818
- 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE),
819
- 'sender_info' => array('sender_url' => null),
820
- )
821
- );
822
-
823
- $ct_result = $base_call_result['ct_result'];
824
-
825
- if ($ct_result->allow == 0) {
826
- wp_send_json(array(
827
- 'result' => 'failure',
828
- 'messages' => "<ul class=\"woocommerce-error\"><li>".$ct_result->comment."</li></ul>",
829
- 'refresh' => 'false',
830
- 'reload' => 'false'
831
- ));
832
- }
833
- }
834
-
835
- /**
836
- * Public function - Tests for Pirate contact froms
837
- * return NULL
838
- */
839
- function apbct_form__piratesForm__testSpam(){
840
-
841
- global $apbct;
842
-
843
- //Check for enabled option
844
- if( !$apbct->settings['contact_forms_test']) {
845
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
846
- return;
847
- }
848
-
849
-
850
- //Getting request params
851
- $ct_temp_msg_data = ct_get_fields_any($_POST);
852
-
853
- $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
854
- $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
855
- $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
856
- $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
857
- $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
858
-
859
- if($subject != '')
860
- $message = array_merge(array('subject' => $subject), $message);
861
-
862
- $post_info['comment_type'] = 'contact_form_wordpress_feedback_pirate';
863
- $post_info['post_url'] = apbct_get_server_variable( 'HTTP_REFERER' );
864
-
865
- //Making a call
866
- $base_call_result = apbct_base_call(
867
- array(
868
- 'message' => $message,
869
- 'sender_email' => $sender_email,
870
- 'sender_nickname' => $sender_nickname,
871
- 'post_info' => $post_info,
872
- 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE),
873
- 'sender_info' => array('sender_url' => null),
874
- )
875
- );
876
-
877
- $ct_result = $base_call_result['ct_result'];
878
-
879
- if ($ct_result->allow == 0)
880
- wp_die("<h1>".__('Spam protection by CleanTalk', 'cleantalk-spam-protect')."</h1><h2>".$ct_result->comment."</h2>", '', array('response' => 403, "back_link" => true, "text_direction" => 'ltr'));
881
- }
882
-
883
- /**
884
- * Adds hidden filed to comment form
885
- */
886
- function ct_comment_form($post_id){
887
-
888
- global $apbct;
889
-
890
- if (apbct_is_user_enable() === false) {
891
- return false;
892
- }
893
-
894
- if ( !$apbct->settings['comments_test']) {
895
- return false;
896
- }
897
-
898
- ct_add_hidden_fields('ct_checkjs', false, false);
899
-
900
- return null;
901
- }
902
-
903
- /**
904
- * Adds cookie script filed to head
905
- */
906
- function apbct_hook__wp_head__set_cookie__ct_checkjs() {
907
-
908
- ct_add_hidden_fields('ct_checkjs', false, true, true);
909
-
910
- return null;
911
- }
912
-
913
- /**
914
- * Adds cookie script filed to footer
915
- */
916
- function apbct_hook__wp_footer() {
917
-
918
- //ct_add_hidden_fields(true, 'ct_checkjs', false, true, true);
919
-
920
- return null;
921
- }
922
-
923
- /**
924
- * Adds hidden filed to define avaialbility of client's JavaScript
925
- * @param bool $random_key switch on generation random key for every page load
926
- */
927
- function ct_add_hidden_fields($field_name = 'ct_checkjs', $return_string = false, $cookie_check = false, $no_print = false, $ajax = true) {
928
-
929
- global $ct_checkjs_def, $apbct;
930
-
931
- $ct_checkjs_key = ct_get_checkjs_value();
932
- $field_id_hash = md5(rand(0, 1000));
933
-
934
- // Using only cookies
935
- if ($cookie_check && $apbct->settings['set_cookies'] == 1) {
936
-
937
- $html = "<script type='text/javascript'>
938
- function ctSetCookie___from_backend(c_name, value) {
939
- document.cookie = c_name + \"=\" + encodeURIComponent(value) + \"; path=/; samesite=lax\";
940
- }
941
- ctSetCookie___from_backend('{$field_name}', '{$ct_checkjs_key}', '{$ct_checkjs_def}');
942
- </script>";
943
-
944
- // Using AJAX to get key
945
- }elseif($apbct->settings['use_ajax'] && $ajax){
946
-
947
- // Fix only for wp_footer -> apbct_hook__wp_head__set_cookie__ct_checkjs()
948
- if($no_print)
949
- return;
950
-
951
- $ct_input_challenge = sprintf("'%s'", $ct_checkjs_key);
952
- $field_id = $field_name . '_' . $field_id_hash;
953
- $html = "<input type='hidden' id='{$field_id}' name='{$field_name}' value='{$ct_checkjs_def}' />
954
- <script type='text/javascript'>
955
- window.addEventListener('load', function () {
956
- setTimeout(function(){
957
- apbct_public_sendAJAX(
958
- {action: 'apbct_js_keys__get'},
959
- {callback: apbct_js_keys__set_input_value, input_name: '{$field_id}'}
960
- );
961
- }, 1000);
962
- });
963
- </script>";
964
-
965
- // Set KEY from backend
966
- }else{
967
- // Fix only for wp_footer -> apbct_hook__wp_head__set_cookie__ct_checkjs()
968
- if($no_print)
969
- return;
970
-
971
- $ct_input_challenge = sprintf("'%s'", $ct_checkjs_key);
972
- $field_id = $field_name . '_' . $field_id_hash;
973
- $html = "<input type='hidden' id='{$field_id}' name='{$field_name}' value='{$ct_checkjs_def}' />
974
- <script type='text/javascript'>
975
- setTimeout(function(){
976
- var ct_input_name = '{$field_id}';
977
- if (document.getElementById(ct_input_name) !== null) {
978
- var ct_input_value = document.getElementById(ct_input_name).value;
979
- document.getElementById(ct_input_name).value = document.getElementById(ct_input_name).value.replace(ct_input_value, {$ct_input_challenge});
980
- }
981
- }, 1000);
982
- </script>";
983
- }
984
-
985
- // Simplify JS code and Fixing issue with wpautop()
986
- $html = str_replace(array("\n","\r","\t"),'', $html);
987
-
988
- if ($return_string === true) {
989
- return $html;
990
- } else {
991
- echo $html;
992
- }
993
- }
994
-
995
- /**
996
- * Public function - Insert JS code for spam tests
997
- * return null;
998
- */
999
- function apbct_rorm__formidable__footerScripts($fields, $form) {
1000
-
1001
- global $apbct, $ct_checkjs_frm;
1002
-
1003
- if ( !$apbct->settings['contact_forms_test'])
1004
- return false;
1005
-
1006
- $ct_checkjs_key = ct_get_checkjs_value();
1007
- $ct_frm_base_name = 'form_';
1008
- $ct_frm_name = $ct_frm_base_name . $form->form_key;
1009
-
1010
- echo "var input = document.createElement('input');
1011
- input.setAttribute('type', 'hidden');
1012
- input.setAttribute('name', '$ct_checkjs_frm');
1013
- input.setAttribute('value', '$ct_checkjs_key');
1014
- for (i = 0; i < document.forms.length; i++) {
1015
- if (typeof document.forms[i].id == 'string'){
1016
- if(document.forms[i].id.search('$ct_frm_name') != -1) {
1017
- document.forms[i].appendChild(input);
1018
- }
1019
- }
1020
- }";
1021
-
1022
- /* Excessive cookie set
1023
- $js_code = ct_add_hidden_fields(true, 'ct_checkjs', true, true);
1024
- $js_code = strip_tags($js_code); // Removing <script> tag
1025
- echo $js_code;
1026
- //*/
1027
- }
1028
-
1029
- /**
1030
- * Public function - Test Formidable data for spam activity
1031
- * @param $errors
1032
- * @param $form
1033
- *
1034
- * @return array with errors if spam has found
1035
- */
1036
- function apbct_rorm__formidable__testSpam ( $errors, $form ) {
1037
-
1038
- global $apbct;
1039
-
1040
- if ( !$apbct->settings['contact_forms_test']) {
1041
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
1042
- return $errors;
1043
- }
1044
-
1045
- // Skip processing for logged in users.
1046
- if ( !$apbct->settings['protect_logged_in'] && is_user_logged_in()) {
1047
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
1048
- return $errors;
1049
- }
1050
-
1051
- $ct_temp_msg_data = ct_get_fields_any($_POST['item_meta']);
1052
-
1053
- $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
1054
- $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
1055
- $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
1056
- $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
1057
- $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
1058
-
1059
- // Adding 'input_meta[]' to every field /Formidable fix/
1060
- $message = array_flip($message);
1061
- foreach($message as &$value){
1062
- $value = 'item_meta['.$value.']';
1063
- } unset($value);
1064
- $message = array_flip($message);
1065
-
1066
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
1067
- ? apbct_js_test('ct_checkjs', $_COOKIE)
1068
- : apbct_js_test('ct_checkjs', $_POST);
1069
-
1070
- $base_call_result = apbct_base_call(
1071
- array(
1072
- 'message' => $message,
1073
- 'sender_email' => $sender_email,
1074
- 'sender_nickname' => $sender_nickname,
1075
- 'post_info' => array('comment_type' => 'contact_form_wordpress_formidable'),
1076
- 'js_on' => $checkjs
1077
- )
1078
- );
1079
- $ct_result = $base_call_result['ct_result'];
1080
-
1081
- if ($ct_result->allow == 0) {
1082
- $errors['ct_error'] = '<br /><b>' . $ct_result->comment . '</b><br /><br />';
1083
- }
1084
-
1085
- return $errors;
1086
- }
1087
-
1088
- /**
1089
- * Public filter 'bbp_*' - Get new topic name to global $ct_bbp_topic
1090
- * @param mixed[] $comment Comment string
1091
- * @return mixed[] $comment Comment string
1092
- */
1093
- function ct_bbp_get_topic($topic){
1094
- global $ct_bbp_topic;
1095
-
1096
- $ct_bbp_topic=$topic;
1097
-
1098
- return $topic;
1099
- }
1100
-
1101
- /**
1102
- * Public filter 'bbp_*' - Checks topics, replies by cleantalk
1103
- * @param mixed[] $comment Comment string
1104
- * @return mixed[] $comment Comment string
1105
- */
1106
- function ct_bbp_new_pre_content ($comment) {
1107
-
1108
- global $apbct, $current_user;
1109
-
1110
- if ( !$apbct->settings['comments_test']) {
1111
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
1112
- return $comment;
1113
- }
1114
-
1115
- // Skip processing for logged in users and admin.
1116
- if ( !$apbct->settings['protect_logged_in'] && is_user_logged_in() ||
1117
- apbct_exclusions_check()
1118
- ) {
1119
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
1120
- return $comment;
1121
- }
1122
-
1123
-
1124
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
1125
- ? apbct_js_test('ct_checkjs', $_COOKIE)
1126
- : apbct_js_test('ct_checkjs', $_POST);
1127
-
1128
- $post_info['comment_type'] = 'bbpress_comment';
1129
- $post_info['post_url'] = bbp_get_topic_permalink();
1130
-
1131
- if( is_user_logged_in() ) {
1132
- $sender_email = $current_user->user_email;
1133
- $sender_nickname = $current_user->display_name;
1134
- } else {
1135
- $sender_email = isset($_POST['bbp_anonymous_email']) ? $_POST['bbp_anonymous_email'] : null;
1136
- $sender_nickname = isset($_POST['bbp_anonymous_name']) ? $_POST['bbp_anonymous_name'] : null;
1137
- }
1138
-
1139
- $base_call_result = apbct_base_call(
1140
- array(
1141
- 'message' => $comment,
1142
- 'sender_email' => $sender_email,
1143
- 'sender_nickname' => $sender_nickname,
1144
- 'post_info' => $post_info,
1145
- 'js_on' => $checkjs,
1146
- 'sender_info' => array('sender_url' => isset($_POST['bbp_anonymous_website']) ? $_POST['bbp_anonymous_website'] : null),
1147
- )
1148
- );
1149
- $ct_result = $base_call_result['ct_result'];
1150
-
1151
- if ($ct_result->allow == 0) {
1152
- bbp_add_error('bbp_reply_content', $ct_result->comment);
1153
- }
1154
-
1155
- return $comment;
1156
- }
1157
-
1158
- function apbct_comment__sanitize_data__before_wp_die($function){
1159
-
1160
- global $apbct;
1161
-
1162
- $comment_data = wp_unslash($_POST);
1163
-
1164
- $user_ID = 0;
1165
-
1166
- $comment_type = '';
1167
-
1168
- $comment_content = isset($comment_data['comment']) ? (string) $comment_data['comment'] : null;
1169
- $comment_parent = isset($comment_data['comment_parent']) ? (int) absint($comment_data['comment_parent']) : null;
1170
-
1171
- $comment_author = isset($comment_data['author']) ? (string) trim(strip_tags($comment_data['author'])) : null;
1172
- $comment_author_email = isset($comment_data['email']) ? (string) trim($comment_data['email']) : null;
1173
- $comment_author_url = isset($comment_data['url']) ? (string) trim($comment_data['url']) : null;
1174
- $comment_post_ID = isset($comment_data['comment_post_ID']) ? (int) $comment_data['comment_post_ID'] : null;
1175
-
1176
- if(isset($comment_content, $comment_parent)){
1177
-
1178
- $user = function_exists('apbct_wp_get_current_user') ? apbct_wp_get_current_user() : null;
1179
-
1180
- if($user && $user->exists()){
1181
- $comment_author = empty($user->display_name) ? $user->user_login : $user->display_name;
1182
- $comment_author_email = $user->user_email;
1183
- $comment_author_url = $user->user_url;
1184
- $user_ID = $user->ID;
1185
- }
1186
-
1187
- $apbct->comment_data = compact(
1188
- 'comment_post_ID',
1189
- 'comment_author',
1190
- 'comment_author_email',
1191
- 'comment_author_url',
1192
- 'comment_content',
1193
- 'comment_type',
1194
- 'comment_parent',
1195
- 'user_ID'
1196
- );
1197
-
1198
- $function = 'apbct_comment__check_via_wp_die';
1199
-
1200
- }
1201
-
1202
- return $function;
1203
- }
1204
-
1205
- function apbct_comment__check_via_wp_die($message, $title, $args){
1206
- if($title == __('Comment Submission Failure')){
1207
- global $apbct;
1208
- $apbct->validation_error = $message;
1209
- ct_preprocess_comment($apbct->comment_data);
1210
- }
1211
- _default_wp_die_handler($message, $title, $args);
1212
- }
1213
-
1214
- /**
1215
- * Public filter 'preprocess_comment' - Checks comment by cleantalk server
1216
- * @param mixed[] $comment Comment data array
1217
- * @return mixed[] New data array of comment
1218
- */
1219
- function ct_preprocess_comment($comment) {
1220
- // this action is called just when WP process POST request (adds new comment)
1221
- // this action is called by wp-comments-post.php
1222
- // after processing WP makes redirect to post page with comment's form by GET request (see above)
1223
- global $current_user, $comment_post_id, $ct_comment_done, $ct_jp_comments, $apbct;
1224
-
1225
- // Send email notification for chosen groups of users
1226
- if($apbct->settings['comment_notify'] && !empty($apbct->settings['comment_notify__roles']) && $apbct->data['moderate']){
1227
-
1228
- add_filter('notify_post_author', 'apbct_comment__Wordpress__doNotify', 100, 2);
1229
-
1230
- $users = get_users(array(
1231
- 'role__in' => $apbct->settings['comment_notify__roles'],
1232
- 'fileds' => array('user_email')
1233
- ));
1234
-
1235
- if($users){
1236
- add_filter('comment_notification_text', 'apbct_comment__Wordpress__changeMailNotificationGroups', 100, 2);
1237
- add_filter('comment_notification_recipients', 'apbct_comment__Wordpress__changeMailNotificationRecipients', 100, 2);
1238
- foreach($users as $user){
1239
- $emails[] = $user->user_email;
1240
- }
1241
- $apbct->comment_notification_recipients = json_encode($emails);
1242
- }
1243
- }
1244
-
1245
- // Skip processing admin.
1246
- if (in_array("administrator", $current_user->roles)){
1247
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
1248
- return $comment;
1249
- }
1250
-
1251
-
1252
- $comments_check_number = defined('CLEANTALK_CHECK_COMMENTS_NUMBER') ? CLEANTALK_CHECK_COMMENTS_NUMBER : 3;
1253
-
1254
- if($apbct->settings['check_comments_number']){
1255
- $args = array(
1256
- 'author_email' => $comment['comment_author_email'],
1257
- 'status' => 'approve',
1258
- 'count' => false,
1259
- 'number' => $comments_check_number,
1260
- );
1261
- $cnt = count(get_comments($args));
1262
- $is_max_comments = $cnt >= $comments_check_number ? true : false;
1263
- }
1264
-
1265
- if (
1266
- ($comment['comment_type']!='trackback') &&
1267
- (
1268
- apbct_is_user_enable() === false ||
1269
- $apbct->settings['comments_test'] == 0 ||
1270
- $ct_comment_done ||
1271
- (isset($_SERVER['HTTP_REFERER']) && stripos($_SERVER['HTTP_REFERER'],'page=wysija_campaigns&action=editTemplate')!==false) ||
1272
- (isset($is_max_comments) && $is_max_comments) ||
1273
- (isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['REQUEST_URI'],'/wp-admin/')!==false)
1274
- )
1275
- )
1276
- {
1277
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
1278
- return $comment;
1279
- }
1280
-
1281
- $local_blacklists = wp_blacklist_check(
1282
- $comment['comment_author'],
1283
- $comment['comment_author_email'],
1284
- $comment['comment_author_url'],
1285
- $comment['comment_content'],
1286
- apbct_get_server_variable( 'REMOTE_ADDR' ),
1287
- apbct_get_server_variable( 'HTTP_USER_AGENT' )
1288
- );
1289
-
1290
- // Go out if author in local blacklists
1291
- if ($comment['comment_type']!='trackback' && $local_blacklists === true) {
1292
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
1293
- return $comment;
1294
- }
1295
-
1296
- // Skip pingback anti-spam test
1297
- /*if ($comment['comment_type'] == 'pingback') {
1298
- return $comment;
1299
- }*/
1300
-
1301
- $ct_comment_done = true;
1302
-
1303
- $comment_post_id = $comment['comment_post_ID'];
1304
-
1305
- // JetPack comments logic
1306
- $post_info['comment_type'] = $ct_jp_comments ? 'jetpack_comment' : $comment['comment_type'];
1307
- $post_info['post_url'] = ct_post_url(null, $comment_post_id);
1308
-
1309
- // Comment type
1310
- $post_info['comment_type'] = empty($post_info['comment_type']) ? 'general_comment' : $post_info['comment_type'];
1311
-
1312
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
1313
- ? apbct_js_test('ct_checkjs', $_COOKIE)
1314
- : apbct_js_test('ct_checkjs', $_POST);
1315
-
1316
-
1317
- $example = null;
1318
- if ($apbct->data['relevance_test']) {
1319
- $post = get_post($comment_post_id);
1320
- if ($post !== null){
1321
- $example['title'] = $post->post_title;
1322
- $example['body'] = $post->post_content;
1323
- $example['comments'] = null;
1324
-
1325
- $last_comments = get_comments(array('status' => 'approve', 'number' => 10, 'post_id' => $comment_post_id));
1326
- foreach ($last_comments as $post_comment){
1327
- $example['comments'] .= "\n\n" . $post_comment->comment_content;
1328
- }
1329
-
1330
- $example = json_encode($example);
1331
- }
1332
-
1333
- // Use plain string format if've failed with JSON
1334
- if ($example === false || $example === null){
1335
- $example = ($post->post_title !== null) ? $post->post_title : '';
1336
- $example .= ($post->post_content !== null) ? "\n\n" . $post->post_content : '';
1337
- }
1338
- }
1339
-
1340
- $base_call_result = apbct_base_call(
1341
- array(
1342
- 'message' => $comment['comment_content'],
1343
- 'example' => $example,
1344
- 'sender_email' => $comment['comment_author_email'],
1345
- 'sender_nickname' => $comment['comment_author'],
1346
- 'post_info' => $post_info,
1347
- 'js_on' => $checkjs,
1348
- 'sender_info' => array(
1349
- 'sender_url' => @$comment['comment_author_url'],
1350
- 'form_validation' => !isset($apbct->validation_error)
1351
- ? null
1352
- : json_encode(array(
1353
- 'validation_notice' => $apbct->validation_error,
1354
- 'page_url' => apbct_get_server_variable( 'HTTP_HOST' ) . apbct_get_server_variable( 'REQUEST_URI' ),
1355
- ))
1356
- ),
1357
- )
1358
- );
1359
- $ct_result = $base_call_result['ct_result'];
1360
-
1361
- ct_hash($ct_result->id);
1362
-
1363
- //Don't check trusted users
1364
- if (isset($comment['comment_author_email'])){
1365
- $approved_comments = get_comments(array('status' => 'approve', 'count' => true, 'author_email' => $comment['comment_author_email']));
1366
- $new_user = $approved_comments == 0 ? true : false;
1367
- }
1368
-
1369
- // Change comment flow only for new authors
1370
- if (!empty($new_user) || $ct_result->stop_words !== null || $ct_result->spam == 1)
1371
- add_action('comment_post', 'ct_set_meta', 10, 2);
1372
-
1373
- if($ct_result->allow){ // Pass if allowed
1374
- if(get_option('comment_moderation') === '1') // Wordpress moderation flag
1375
- add_filter('pre_comment_approved', 'ct_set_not_approved', 999, 2);
1376
- else
1377
- add_filter('pre_comment_approved', 'ct_set_approved', 999, 2);
1378
- // Modify the email notification
1379
- add_filter('comment_notification_text', 'apbct_comment__wordpress__show_blacklists', 100, 2); // Add two blacklist links: by email and IP
1380
- }else{
1381
-
1382
- global $ct_comment, $ct_stop_words;
1383
-
1384
- $ct_comment = $ct_result->comment;
1385
- $ct_stop_words = $ct_result->stop_words;
1386
-
1387
- $err_text = '<center>' . ((defined('CLEANTALK_DISABLE_BLOCKING_TITLE') && CLEANTALK_DISABLE_BLOCKING_TITLE == true) ? '' : '<b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk.</b> ') . __('Spam protection', 'cleantalk-spam-protect') . "</center><br><br>\n" . $ct_result->comment;
1388
- $err_text .= '<script>setTimeout("history.back()", 5000);</script>';
1389
-
1390
- // Terminate. Definitely spam.
1391
- if($ct_result->stop_queue == 1)
1392
- wp_die($err_text, 'Blacklisted', array('response' => 200, 'back_link' => true));
1393
-
1394
- // Terminate by user's setting.
1395
- if($ct_result->spam == 3)
1396
- wp_die($err_text, 'Blacklisted', array('response' => 200, 'back_link' => true));
1397
-
1398
- // Trash comment.
1399
- if($ct_result->spam == 2){
1400
- add_filter('pre_comment_approved', 'ct_set_comment_spam', 997, 2);
1401
- add_action('comment_post', 'ct_wp_trash_comment', 997, 2);
1402
- }
1403
-
1404
- // Spam comment
1405
- if($ct_result->spam == 1)
1406
- add_filter('pre_comment_approved', 'ct_set_comment_spam', 997, 2);
1407
-
1408
- // Move to pending folder. Contains stop_words.
1409
- if($ct_result->stop_words){
1410
- add_filter('pre_comment_approved', 'ct_set_not_approved', 998, 2);
1411
- add_action('comment_post', 'ct_mark_red', 998, 2);
1412
- }
1413
-
1414
- add_action('comment_post', 'ct_die', 999, 2);
1415
- }
1416
-
1417
- if($apbct->settings['remove_comments_links'] == 1){
1418
- $comment['comment_content'] = preg_replace("~(http|https|ftp|ftps)://(.*?)(\s|\n|[,.?!](\s|\n)|$)~", '[Link deleted]', $comment['comment_content']);
1419
- }
1420
-
1421
- // Change mail notification if license is out of date
1422
- if($apbct->data['moderate'] == 0){
1423
- $apbct->sender_email = $comment['comment_author_email'];
1424
- $apbct->sender_ip = \Cleantalk\ApbctWP\Helper::ip__get(array('real'));
1425
- add_filter('comment_moderation_text', 'apbct_comment__Wordpress__changeMailNotification', 100, 2); // Comment sent to moderation
1426
- add_filter('comment_notification_text', 'apbct_comment__Wordpress__changeMailNotification', 100, 2); // Comment approved
1427
- }
1428
-
1429
- return $comment;
1430
- }
1431
-
1432
- /**
1433
- * Changes whether notify admin/athor or not.
1434
- *
1435
- * @param bool $maybe_notify notify flag
1436
- * @param int $comment_ID Comment id
1437
- * @return bool flag
1438
- */
1439
- function apbct_comment__Wordpress__doNotify($maybe_notify, $comment_ID){
1440
- return true;
1441
- }
1442
-
1443
- /**
1444
- * Add notification setting link
1445
- *
1446
- * @param string $notify_message
1447
- * @param integer $comment_id
1448
- *
1449
- * @return string
1450
- */
1451
- function apbct_comment__Wordpress__changeMailNotificationGroups($notify_message, $comment_id){
1452
- return $notify_message
1453
- .PHP_EOL
1454
- .'---'.PHP_EOL
1455
- .'Manage notifications settings: '.get_site_url().'/wp-admin/options-general.php?page=cleantalk';
1456
- }
1457
-
1458
- /**
1459
- * Change email notification recipients
1460
- *
1461
- * @param array $emails
1462
- * @param integer $comment_id
1463
- *
1464
- * @return array
1465
- * @global SpbcState $apbct
1466
- */
1467
- function apbct_comment__Wordpress__changeMailNotificationRecipients($emails, $comment_id){
1468
- global $apbct;
1469
- return array_unique(array_merge($emails, (array)json_decode($apbct->comment_notification_recipients, true)));
1470
- }
1471
-
1472
- /**
1473
- * Changes email notification for spam comment for native Wordpress comment system
1474
- *
1475
- * @param string $notify_message Body of email notification
1476
- * @param int $comment_id Comment id
1477
- * @return string Body for email notification
1478
- */
1479
- function apbct_comment__Wordpress__changeMailNotification($notify_message, $comment_id){
1480
-
1481
- global $apbct;
1482
-
1483
- $notify_message =
1484
- PHP_EOL
1485
- .__('CleanTalk AntiSpam: This message is possible spam.', 'cleantalk-spam-protect')
1486
- ."\n".__('You could check it in CleanTalk\'s anti-spam database:', 'cleantalk-spam-protect')
1487
- ."\n".'IP: https://cleantalk.org/blacklists/' . $apbct->sender_ip
1488
- ."\n".'Email: https://cleantalk.org/blacklists/' . $apbct->sender_email
1489
- ."\n".PHP_EOL . sprintf(
1490
- __('Activate protection in your Anti-Spam Dashboard: %s.', 'clentalk'),
1491
- 'https://cleantalk.org/my/?cp_mode=antispam&utm_source=newsletter&utm_medium=email&utm_campaign=wp_spam_comment_passed'
1492
- .($apbct->data['user_token']
1493
- ? '&iser_token='.$apbct->data['user_token']
1494
- : ''
1495
- )
1496
- )
1497
- .PHP_EOL . '---'
1498
- .PHP_EOL
1499
- .PHP_EOL
1500
- .$notify_message;
1501
-
1502
- return $notify_message;
1503
-
1504
- }
1505
-
1506
- function apbct_comment__wordpress__show_blacklists( $notify_message, $comment_id ) {
1507
-
1508
- $comment_details = get_comments( array( 'comment__in' => $comment_id ) );
1509
- $comment_details = $comment_details[0];
1510
-
1511
- if( isset( $comment_details->comment_author_email ) ) {
1512
-
1513
- $black_list_link = 'https://cleantalk.org/blacklists/';
1514
-
1515
- $links = PHP_EOL;
1516
- $links .= esc_html__( 'Check for spam:', 'cleantalk-spam-protect');
1517
- $links .= PHP_EOL;
1518
- $links .= $black_list_link . $comment_details->comment_author_email;
1519
- $links .= PHP_EOL;
1520
- if( ! empty( $comment_details->comment_author_IP ) ) {
1521
- $links .= $black_list_link . $comment_details->comment_author_IP;
1522
- $links .= PHP_EOL;
1523
- }
1524
-
1525
- return $notify_message . $links;
1526
-
1527
- }
1528
-
1529
- return $notify_message;
1530
-
1531
- }
1532
-
1533
- /**
1534
- * Set die page with Cleantalk comment.
1535
- * @global array $ct_comment
1536
- $err_text = '<center><b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk.</b> ' . __('Spam protection', 'cleantalk-spam-protect') . "</center><br><br>\n" . $ct_comment;
1537
- * @param type $comment_status
1538
- */
1539
- function ct_die($comment_id, $comment_status) {
1540
-
1541
- global $ct_comment;
1542
-
1543
- $err_text = '<center>' . ((defined('CLEANTALK_DISABLE_BLOCKING_TITLE') && CLEANTALK_DISABLE_BLOCKING_TITLE == true) ? '' : '<b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk.</b> ') . __('Spam protection', 'cleantalk-spam-protect') . "</center><br><br>\n" . $ct_comment;
1544
- $err_text .= '<script>setTimeout("history.back()", 5000);</script>';
1545
- if(isset($_POST['et_pb_contact_email']))
1546
- {
1547
- $mes='<div id="et_pb_contact_form_1" class="et_pb_contact_form_container clearfix"><h1 class="et_pb_contact_main_title">Blacklisted</h1><div class="et-pb-contact-message"><p>'.$ct_comment.'</p></div></div>';
1548
- wp_die($mes, 'Blacklisted', array('back_link' => true,'response'=>200));
1549
- }
1550
- else
1551
- {
1552
- wp_die($err_text, 'Blacklisted', array('response' => 200, 'back_link' => true));
1553
- }
1554
- }
1555
-
1556
- /**
1557
- * Set die page with Cleantalk comment from parameter.
1558
- * @param type $comment_body
1559
- */
1560
- function ct_die_extended($comment_body) {
1561
-
1562
- $err_text = '<center>' . ((defined('CLEANTALK_DISABLE_BLOCKING_TITLE') && CLEANTALK_DISABLE_BLOCKING_TITLE == true) ? '' : '<b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk.</b> ') . __('Spam protection', 'cleantalk-spam-protect') . "</center><br><br>\n" . $comment_body;
1563
- $err_text .= '<script>setTimeout("history.back()", 5000);</script>';
1564
- wp_die($err_text, 'Blacklisted', array('response' => 200, 'back_link' => true));
1565
- }
1566
-
1567
- /**
1568
- * Validates JavaScript anti-spam test
1569
- *
1570
- * @param string $field_name filed to serach in data
1571
- * @param null $data Data to search in
1572
- * @param bool $random_key
1573
- *
1574
- * @return int|null
1575
- */
1576
- function apbct_js_test($field_name = 'ct_checkjs', $data = null) {
1577
-
1578
- global $apbct;
1579
-
1580
- $out = null;
1581
-
1582
- if($data && isset($data[$field_name])){
1583
-
1584
- $js_key = trim($data[$field_name]);
1585
-
1586
- // Check static key
1587
- if(
1588
- $apbct->settings['use_static_js_key'] == 1 ||
1589
- ( $apbct->settings['use_static_js_key'] == - 1 &&
1590
- ( apbct_is_cache_plugins_exists() ||
1591
- ( apbct_is_post() && isset($apbct->data['cache_detected']) && $apbct->data['cache_detected'] == 1 )
1592
- )
1593
- )
1594
- ){
1595
- $out = ct_get_checkjs_value() === $js_key ? 1 : 0;
1596
-
1597
- // Random key check
1598
- }else{
1599
- $out = array_key_exists( $js_key, $apbct->js_keys ) ? 1 : 0;
1600
- }
1601
- }
1602
-
1603
- return $out;
1604
- }
1605
-
1606
- /**
1607
- * Get post url
1608
- * @param int $comment_id
1609
- * @param int $comment_post_id
1610
- * @return string|bool
1611
- */
1612
- function ct_post_url($comment_id = null, $comment_post_id) {
1613
-
1614
- if (empty($comment_post_id))
1615
- return null;
1616
-
1617
- if ($comment_id === null) {
1618
- $last_comment = get_comments('number=1');
1619
- $comment_id = isset($last_comment[0]->comment_ID) ? (int) $last_comment[0]->comment_ID + 1 : 1;
1620
- }
1621
- $permalink = get_permalink($comment_post_id);
1622
-
1623
- $post_url = null;
1624
- if ($permalink !== null)
1625
- $post_url = $permalink . '#comment-' . $comment_id;
1626
-
1627
- return $post_url;
1628
- }
1629
-
1630
- /**
1631
- * Public filter 'pre_comment_approved' - Mark comment unapproved always
1632
- * @return int Zero
1633
- */
1634
- function ct_set_not_approved() {
1635
- return 0;
1636
- }
1637
-
1638
- /**
1639
- * @author Artem Leontiev
1640
- * Public filter 'pre_comment_approved' - Mark comment approved if it's not 'spam' only
1641
- * @return int 1
1642
- */
1643
- function ct_set_approved($approved, $comment) {
1644
- if ($approved == 'spam'){
1645
- return $approved;
1646
- } else {
1647
- return 1;
1648
- }
1649
- }
1650
-
1651
- /**
1652
- * Public filter 'pre_comment_approved' - Mark comment unapproved always
1653
- * @return int Zero
1654
- */
1655
- function ct_set_comment_spam() {
1656
- return 'spam';
1657
- }
1658
-
1659
- /**
1660
- * Public action 'comment_post' - Store cleantalk hash in comment meta 'ct_hash'
1661
- * @param int $comment_id Comment ID
1662
- * @param mixed $comment_status Approval status ("spam", or 0/1), not used
1663
- */
1664
- function ct_set_meta($comment_id, $comment_status) {
1665
- global $comment_post_id;
1666
- $hash1 = ct_hash();
1667
- if (!empty($hash1)) {
1668
- update_comment_meta($comment_id, 'ct_hash', $hash1);
1669
- if (function_exists('base64_encode') && isset($comment_status) && $comment_status != 'spam') {
1670
- $post_url = ct_post_url($comment_id, $comment_post_id);
1671
- $post_url = base64_encode($post_url);
1672
- if ($post_url === false)
1673
- return false;
1674
- // 01 - URL to approved comment
1675
- $feedback_request = $hash1 . ':' . '01' . ':' . $post_url . ';';
1676
- ct_send_feedback($feedback_request);
1677
- }
1678
- }
1679
- return true;
1680
- }
1681
-
1682
- /**
1683
- * Mark bad words
1684
- * @global string $ct_stop_words
1685
- * @param int $comment_id
1686
- * @param int $comment_status Not use
1687
- */
1688
- function ct_mark_red($comment_id, $comment_status) {
1689
- global $ct_stop_words;
1690
-
1691
- $comment = get_comment($comment_id, 'ARRAY_A');
1692
- $message = $comment['comment_content'];
1693
- foreach (explode(':', $ct_stop_words) as $word) {
1694
- $message = preg_replace("/($word)/ui", '<font rel="cleantalk" color="#FF1000">' . "$1" . '</font>', $message);
1695
-
1696
- }
1697
- $comment['comment_content'] = $message;
1698
- kses_remove_filters();
1699
- wp_update_comment($comment);
1700
- }
1701
-
1702
- //
1703
- //Send post to trash
1704
- //
1705
- function ct_wp_trash_comment($comment_id, $comment_status){
1706
- wp_trash_comment($comment_id);
1707
- }
1708
-
1709
- /**
1710
- * Tests plugin activation status
1711
- * @return bool
1712
- */
1713
- function ct_plugin_active($plugin_name){
1714
- foreach (get_option('active_plugins') as $k => $v) {
1715
- if ($plugin_name == $v)
1716
- return true;
1717
- }
1718
- return false;
1719
- }
1720
-
1721
- /**
1722
- * Insert a hidden field to registration form
1723
- * @return null
1724
- */
1725
- function ct_register_form() {
1726
-
1727
- global $ct_checkjs_register_form, $apbct;
1728
-
1729
- if ($apbct->settings['registrations_test'] == 0) {
1730
- return false;
1731
- }
1732
-
1733
- ct_add_hidden_fields($ct_checkjs_register_form, false, false, false, false);
1734
-
1735
- return null;
1736
- }
1737
-
1738
- function apbct_login__scripts(){
1739
- global $apbct;
1740
- echo '<script src="'.APBCT_URL_PATH.'/js/apbct-public.min.js"></script>';
1741
- $apbct->public_script_loaded = true;
1742
- }
1743
-
1744
- /**
1745
- * Adds notification text to login form - to inform about approved registration
1746
- * @return null
1747
- */
1748
- function ct_login_message($message) {
1749
-
1750
- global $errors, $apbct, $apbct_cookie_register_ok_label;
1751
-
1752
-
1753
-
1754
- if ($apbct->settings['registrations_test'] != 0){
1755
- if( isset($_GET['checkemail']) && 'registered' == $_GET['checkemail'] ){
1756
- if (isset($_COOKIE[$apbct_cookie_register_ok_label])){
1757
- if(is_wp_error($errors)){
1758
- $errors->add('ct_message',sprintf(__('Registration approved by %s.', 'cleantalk-spam-protect'), '<b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk</b>'), 'message');
1759
- }
1760
- }
1761
- }
1762
- }
1763
- return $message;
1764
- }
1765
-
1766
- /**
1767
- * Test users registration for pPress
1768
- * @return array with errors
1769
- */
1770
- function ct_registration_errors_ppress($reg_errors, $form_id) {
1771
-
1772
- $email = $_POST['reg_email'];
1773
- $login = $_POST['reg_username'];
1774
-
1775
- $reg_errors = ct_registration_errors($reg_errors, $login, $email);
1776
-
1777
- return $reg_errors;
1778
- }
1779
-
1780
- /**
1781
- * Test users registration for multisite enviroment
1782
- * @return array with errors
1783
- */
1784
- function ct_registration_errors_wpmu($errors) {
1785
- global $ct_signup_done;
1786
-
1787
- //
1788
- // Multisite actions
1789
- //
1790
- $sanitized_user_login = null;
1791
- if (isset($errors['user_name'])) {
1792
- $sanitized_user_login = $errors['user_name'];
1793
- $wpmu = true;
1794
- }
1795
- $user_email = null;
1796
- if (isset($errors['user_email'])) {
1797
- $user_email = $errors['user_email'];
1798
- $wpmu = true;
1799
- }
1800
-
1801
- if ($wpmu && isset($errors['errors']->errors) && count($errors['errors']->errors) > 0) {
1802
- return $errors;
1803
- }
1804
-
1805
- $errors['errors'] = ct_registration_errors($errors['errors'], $sanitized_user_login, $user_email);
1806
-
1807
- // Show CleanTalk errors in user_name field
1808
- if (isset($errors['errors']->errors['ct_error'])) {
1809
- $errors['errors']->errors['user_name'] = $errors['errors']->errors['ct_error'];
1810
- unset($errors['errors']->errors['ct_error']);
1811
- }
1812
-
1813
- return $errors;
1814
- }
1815
-
1816
- /**
1817
- * Shell for action register_post
1818
- * @return array with errors
1819
- */
1820
- function ct_register_post($sanitized_user_login = null, $user_email = null, $errors) {
1821
- return ct_registration_errors($errors, $sanitized_user_login, $user_email);
1822
- }
1823
-
1824
- /**
1825
- * Check messages for external plugins
1826
- * @return array with checking result;
1827
- */
1828
-
1829
- function ct_test_message($nickname, $email, $ip, $text){
1830
-
1831
- $base_call_result = apbct_base_call(
1832
- array(
1833
- 'message' => $text,
1834
- 'sender_email' => $email,
1835
- 'sender_nickname' => $nickname,
1836
- 'post_info' => array('comment_type' => 'feedback_plugin_check'),
1837
- 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE),
1838
- )
1839
- );
1840
-
1841
- $ct_result = $base_call_result['ct_result'];
1842
-
1843
- $result=Array(
1844
- 'allow' => $ct_result->allow,
1845
- 'comment' => $ct_result->comment,
1846
- );
1847
- return $result;
1848
- }
1849
-
1850
- /**
1851
- * Check registrations for external plugins
1852
- * @return array with checking result;
1853
- */
1854
- function ct_test_registration($nickname, $email, $ip){
1855
-
1856
- global $ct_checkjs_register_form, $apbct;
1857
-
1858
- if(apbct_js_test($ct_checkjs_register_form, $_POST)){
1859
- $checkjs = apbct_js_test($ct_checkjs_register_form, $_POST);
1860
- $sender_info['post_checkjs_passed'] = $checkjs;
1861
- }else{
1862
- $checkjs = $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
1863
- $sender_info['cookie_checkjs_passed'] = $checkjs;
1864
- }
1865
-
1866
- //Making a call
1867
- $base_call_result = apbct_base_call(
1868
- array(
1869
- 'sender_ip' => $ip,
1870
- 'sender_email' => $email,
1871
- 'sender_nickname' => $nickname,
1872
- 'sender_info' => $sender_info,
1873
- 'js_on' => $checkjs,
1874
- ),
1875
- true
1876
- );
1877
- $ct_result = $base_call_result['ct_result'];
1878
-
1879
- $result = array(
1880
- 'allow' => $ct_result->allow,
1881
- 'comment' => $ct_result->comment,
1882
- );
1883
- return $result;
1884
- }
1885
-
1886
- /**
1887
- * Test users registration
1888
- *
1889
- * @param $errors
1890
- * @param null $sanitized_user_login
1891
- * @param null $user_email
1892
- *
1893
- * @return void with errors
1894
- */
1895
- function ct_registration_errors($errors, $sanitized_user_login = null, $user_email = null) {
1896
-
1897
- global $ct_checkjs_register_form, $apbct_cookie_request_id_label, $apbct_cookie_register_ok_label, $bp, $ct_signup_done, $ct_negative_comment, $apbct, $ct_registration_error_comment, $cleantalk_executed;
1898
-
1899
- // Go out if a registrered user action
1900
- if (apbct_is_user_enable() === false) {
1901
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
1902
- return $errors;
1903
- }
1904
-
1905
- if ($apbct->settings['registrations_test'] == 0) {
1906
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
1907
- return $errors;
1908
- }
1909
-
1910
- // The function already executed
1911
- // It happens when used ct_register_post();
1912
- if ($ct_signup_done && is_object($errors) && count($errors->errors) > 0) {
1913
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
1914
- return $errors;
1915
- }
1916
-
1917
- // Facebook registration
1918
- if ($sanitized_user_login === null && isset($_POST['FB_userdata'])){
1919
- $sanitized_user_login = $_POST['FB_userdata']['name'];
1920
- $facebook = true;
1921
- }
1922
- if ($user_email === null && isset($_POST['FB_userdata'])){
1923
- $user_email = $_POST['FB_userdata']['email'];
1924
- $facebook = true;
1925
- }
1926
-
1927
- // BuddyPress actions
1928
- $buddypress = false;
1929
- if ($sanitized_user_login === null && isset($_POST['signup_username'])) {
1930
- $sanitized_user_login = $_POST['signup_username'];
1931
- $buddypress = true;
1932
- }
1933
- if ($user_email === null && isset($_POST['signup_email'])) {
1934
- $user_email = $_POST['signup_email'];
1935
- $buddypress = true;
1936
- }
1937
-
1938
- //
1939
- // Break tests because we already have servers response
1940
- //
1941
- if ($buddypress && $ct_signup_done) {
1942
- if ($ct_negative_comment) {
1943
- $bp->signup->errors['signup_username'] = $ct_negative_comment;
1944
- }
1945
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
1946
- return $errors;
1947
- }
1948
-
1949
-
1950
- if(current_filter() == 'woocommerce_registration_errors'){
1951
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
1952
- $checkjs_post = null;
1953
- $checkjs_cookie = $checkjs;
1954
- }else{
1955
- // This hack can be helpfull when plugin uses with untested themes&signups plugins.
1956
- $checkjs_post = apbct_js_test($ct_checkjs_register_form, $_POST);
1957
- $checkjs_cookie = apbct_js_test('ct_checkjs', $_COOKIE);
1958
- $checkjs = $checkjs_cookie ? $checkjs_cookie : $checkjs_post;
1959
- }
1960
-
1961
- $sender_info = array(
1962
- 'post_checkjs_passed' => $checkjs_post,
1963
- 'cookie_checkjs_passed' => $checkjs_cookie,
1964
- 'form_validation' => ! empty( $errors )
1965
- ? json_encode( array(
1966
- 'validation_notice' => $errors->get_error_message(),
1967
- 'page_url' => apbct_get_server_variable( 'HTTP_HOST' ) . apbct_get_server_variable( 'REQUEST_URI' ),
1968
- ) )
1969
- : null,
1970
- );
1971
-
1972
- $base_call_result = apbct_base_call(
1973
- array(
1974
- 'sender_email' => $user_email,
1975
- 'sender_nickname' => $sanitized_user_login,
1976
- 'sender_info' => $sender_info,
1977
- 'js_on' => $checkjs,
1978
- ),
1979
- true
1980
- );
1981
- $ct_result = $base_call_result['ct_result'];
1982
-
1983
- // Change mail notification if license is out of date
1984
- if($apbct->data['moderate'] == 0 &&
1985
- ($ct_result->fast_submit == 1 || $ct_result->blacklisted == 1 || $ct_result->js_disabled == 1)
1986
- ){
1987
- $apbct->sender_email = $user_email;
1988
- $apbct->sender_ip = \Cleantalk\ApbctWP\Helper::ip__get(array('real'));
1989
- add_filter('wp_new_user_notification_email_admin', 'apbct_registration__Wordpress__changeMailNotification', 100, 3);
1990
- }
1991
-
1992
- $ct_signup_done = true;
1993
-
1994
- $ct_result = ct_change_plugin_resonse($ct_result, $checkjs);
1995
-
1996
- $cleantalk_executed = true;
1997
-
1998
- if ($ct_result->inactive != 0) {
1999
- ct_send_error_notice($ct_result->comment);
2000
- return $errors;
2001
- }
2002
-
2003
- if ($ct_result->allow == 0) {
2004
-
2005
- if ($buddypress === true) {
2006
- $bp->signup->errors['signup_username'] = $ct_result->comment;
2007
- }elseif(!empty($facebook)){
2008
- $_POST['FB_userdata']['email'] = '';
2009
- $_POST['FB_userdata']['name'] = '';
2010
- return;
2011
- }else{
2012
- if(is_wp_error($errors))
2013
- $errors->add('ct_error', $ct_result->comment);
2014
- $ct_negative_comment = $ct_result->comment;
2015
- }
2016
-
2017
- $ct_registration_error_comment = $ct_result->comment;
2018
-
2019
- } else {
2020
- if ($ct_result->id !== null) {
2021
- \Cleantalk\Common\Helper::apbct_cookie__set($apbct_cookie_register_ok_label, $ct_result->id, time()+10, '/');
2022
- \Cleantalk\Common\Helper::apbct_cookie__set($apbct_cookie_request_id_label, $ct_result->id, time()+10, '/');
2023
- }
2024
- }
2025
-
2026
- return $errors;
2027
- }
2028
-
2029
- /**
2030
- * Changes email notification for newly registred user
2031
- *
2032
- * @param string $wp_new_user_notification_email_admin Body of email notification
2033
- * @param array $user User inof
2034
- * @param string $blogname Blog name
2035
- * @return string Body for email notification
2036
- */
2037
- function apbct_registration__Wordpress__changeMailNotification($wp_new_user_notification_email_admin, $user, $blogname){
2038
-
2039
- global $apbct;
2040
-
2041
- $wp_new_user_notification_email_admin['message'] = PHP_EOL
2042
- .__('CleanTalk AntiSpam: This registration is spam.', 'cleantalk-spam-protect')
2043
- ."\n" . __('CleanTalk\'s anti-spam database:', 'cleantalk-spam-protect')
2044
- ."\n" . 'IP: ' . $apbct->sender_ip
2045
- ."\n" . 'Email: ' . $apbct->sender_email
2046
- .PHP_EOL . PHP_EOL .
2047
- __('Activate protection in your Anti-Spam Dashboard: ', 'clentalk')
2048
- .'https://cleantalk.org/my/?cp_mode=antispam&utm_source=newsletter&utm_medium=email&utm_campaign=wp_spam_registration_passed'
2049
- .($apbct->data['user_token']
2050
- ? '&iser_token='.$apbct->data['user_token']
2051
- : ''
2052
- )
2053
- .PHP_EOL . '---'
2054
- .PHP_EOL
2055
- .$wp_new_user_notification_email_admin['message'];
2056
-
2057
- return $wp_new_user_notification_email_admin;
2058
-
2059
-
2060
- }
2061
-
2062
- /**
2063
- * Checks Ultimate Members registration for spam
2064
- *
2065
- * @param $args forms arguments with names and values
2066
- *
2067
- * @return mixed
2068
- *
2069
- */
2070
- function apbct_registration__UltimateMembers__check( $args ){
2071
-
2072
- if ( isset( UM()->form()->errors ) ) {
2073
- $sender_info['previous_form_validation'] = true;
2074
- $sender_info['validation_notice'] = json_encode( UM()->form()->errors );
2075
- }
2076
-
2077
- global $apbct, $cleantalk_executed;
2078
-
2079
- if ($apbct->settings['registrations_test'] == 0) {
2080
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
2081
- return $args;
2082
- }
2083
-
2084
-
2085
- $checkjs = apbct_js_test('ct_checkjs_register_form', $args);
2086
- $sender_info['post_checkjs_passed'] = $checkjs;
2087
-
2088
- // This hack can be helpfull when plugin uses with untested themes&signups plugins.
2089
- if ($checkjs == 0) {
2090
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
2091
- $sender_info['cookie_checkjs_passed'] = $checkjs;
2092
- }
2093
-
2094
- $base_call_result = apbct_base_call(
2095
- array(
2096
- 'sender_email' => $args['user_email'],
2097
- 'sender_nickname' => $args['user_login'],
2098
- 'sender_info' => $sender_info,
2099
- 'js_on' => $checkjs,
2100
- ),
2101
- true
2102
- );
2103
- $ct_result = $base_call_result['ct_result'];
2104
-
2105
- $cleantalk_executed = true;
2106
-
2107
- if ($ct_result->inactive != 0) {
2108
- ct_send_error_notice($ct_result->comment);
2109
- return $args;
2110
- }
2111
-
2112
- if ($ct_result->allow == 0)
2113
- UM()->form()->add_error('user_password', $ct_result->comment );
2114
-
2115
- return $args;
2116
- }
2117
-
2118
- /**
2119
- * Checks registration error and set it if it was dropped
2120
- * @return errors
2121
- */
2122
- function ct_check_registration_erros($errors, $sanitized_user_login = null, $user_email = null) {
2123
- global $bp, $ct_registration_error_comment;
2124
-
2125
- if($ct_registration_error_comment){
2126
-
2127
- if(isset($bp))
2128
- if(method_exists($bp, 'signup'))
2129
- if(method_exists($bp->signup, 'errors'))
2130
- if(isset($bp->signup->errors['signup_username']))
2131
- if($bp->signup->errors['signup_username'] != $ct_registration_error_comment)
2132
- $bp->signup->errors['signup_username'] = $ct_registration_error_comment;
2133
-
2134
- if(isset($errors))
2135
- if(method_exists($errors, 'errors'))
2136
- if(isset($errors->errors['ct_error']))
2137
- if($errors->errors['ct_error'][0] != $ct_registration_error_comment)
2138
- $errors->add('ct_error', $ct_registration_error_comment);
2139
-
2140
- }
2141
- return $errors;
2142
- }
2143
-
2144
- /**
2145
- * Set user meta (ct_hash) for successed registration
2146
- * @return null
2147
- */
2148
- function apbct_user_register($user_id) {
2149
- global $apbct_cookie_request_id_label;
2150
- if (isset($_COOKIE[$apbct_cookie_request_id_label])) {
2151
- if(update_user_meta($user_id, 'ct_hash', $_COOKIE[$apbct_cookie_request_id_label])){
2152
- \Cleantalk\Common\Helper::apbct_cookie__set($apbct_cookie_request_id_label, '0', 1, '/');
2153
- }
2154
- }
2155
- }
2156
-
2157
-
2158
- /**
2159
- * Test for JetPack contact form
2160
- */
2161
- function ct_grunion_contact_form_field_html($r, $field_label) {
2162
-
2163
- global $ct_checkjs_jpcf, $ct_jpcf_patched, $ct_jpcf_fields, $apbct;
2164
-
2165
- if ($apbct->settings['contact_forms_test'] == 1 && $ct_jpcf_patched === false && preg_match( "/(text|email)/i", $r)) {
2166
-
2167
- // Looking for element name prefix
2168
- $name_patched = false;
2169
- foreach ($ct_jpcf_fields as $v) {
2170
- if ($name_patched === false && preg_match("/(g\d-)$v/", $r, $matches)) {
2171
- $ct_checkjs_jpcf = $matches[1] . $ct_checkjs_jpcf;
2172
- $name_patched = true;
2173
- }
2174
- }
2175
-
2176
- $r .= ct_add_hidden_fields($ct_checkjs_jpcf, true);
2177
- $ct_jpcf_patched = true;
2178
- }
2179
-
2180
- return $r;
2181
- }
2182
- /**
2183
- * Test for JetPack contact form
2184
- */
2185
- function ct_contact_form_is_spam($form) {
2186
-
2187
- global $ct_checkjs_jpcf, $apbct;
2188
-
2189
- if ($apbct->settings['contact_forms_test'] == 0) {
2190
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
2191
- return null;
2192
- }
2193
-
2194
- $js_field_name = $ct_checkjs_jpcf;
2195
- foreach ($_POST as $k => $v) {
2196
- if (preg_match("/^.+$ct_checkjs_jpcf$/", $k))
2197
- $js_field_name = $k;
2198
- }
2199
-
2200
- $sender_email = null;
2201
- $sender_nickname = null;
2202
- $message = '';
2203
- if (isset($form['comment_author_email']))
2204
- $sender_email = $form['comment_author_email'];
2205
-
2206
- if (isset($form['comment_author']))
2207
- $sender_nickname = $form['comment_author'];
2208
-
2209
- if (isset($form['comment_content']))
2210
- $message = $form['comment_content'];
2211
-
2212
- $base_call_result = apbct_base_call(
2213
- array(
2214
- 'message' => $message,
2215
- 'sender_email' => $sender_email,
2216
- 'sender_nickname' => $sender_nickname,
2217
- 'post_info' => array('comment_type' => 'contact_form_wordpress_grunion'),
2218
- 'sender_info' => array('sender_url' => @$form['comment_author_url']),
2219
- 'js_on' => apbct_js_test($js_field_name, $_POST),
2220
- )
2221
- );
2222
- $ct_result = $base_call_result['ct_result'];
2223
-
2224
- if ($ct_result->allow == 0) {
2225
- global $ct_comment;
2226
- $ct_comment = $ct_result->comment;
2227
- ct_die(null, null);
2228
- exit;
2229
- }
2230
-
2231
- return (bool) !$ct_result->allow;
2232
- }
2233
-
2234
- function ct_contact_form_is_spam_jetpack($is_spam,$form) {
2235
- global $ct_checkjs_jpcf, $apbct;
2236
-
2237
- if ($apbct->settings['contact_forms_test'] == 0) {
2238
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
2239
- return null;
2240
- }
2241
-
2242
- $js_field_name = $ct_checkjs_jpcf;
2243
- foreach ($_POST as $k => $v) {
2244
- if (preg_match("/^.+$ct_checkjs_jpcf$/", $k))
2245
- $js_field_name = $k;
2246
- }
2247
-
2248
- $base_call_result = apbct_base_call(
2249
- array(
2250
- 'message' => isset($form['comment_content']) ? $form['comment_content'] : '',
2251
- 'sender_email' => isset($form['comment_author_email']) ? $form['comment_author_email'] : null,
2252
- 'sender_nickname' => isset($form['comment_author']) ? $form['comment_author'] : null,
2253
- 'post_info' => array('comment_type' => 'contact_form_wordpress_grunion'),
2254
- 'sender_info' => array('sender_url' => @$form['comment_author_url']),
2255
- )
2256
- );
2257
- $ct_result = $base_call_result['ct_result'];
2258
-
2259
- if ($ct_result->allow == 0) {
2260
- global $ct_comment;
2261
- $ct_comment = $ct_result->comment;
2262
- ct_die(null, null);
2263
- exit;
2264
- }
2265
-
2266
- return (bool) !$ct_result->allow;
2267
- }
2268
-
2269
- /**
2270
- * Inserts anti-spam hidden to WP Maintenance Mode (wpmm)
2271
- */
2272
- function apbct_form__wpmm__addField(){
2273
- ct_add_hidden_fields('ct_checkjs', false, true, true);
2274
- }
2275
-
2276
- /**
2277
- * Inserts anti-spam hidden to CF7
2278
- */
2279
- function apbct_form__contactForm7__addField($html) {
2280
- global $ct_checkjs_cf7, $apbct;
2281
-
2282
-
2283
-
2284
- if ($apbct->settings['contact_forms_test'] == 0) {
2285
- return $html;
2286
- }
2287
-
2288
- $html .= ct_add_hidden_fields($ct_checkjs_cf7, true);
2289
-
2290
- return $html;
2291
- }
2292
-
2293
- /**
2294
- * Test spam for Contact Fomr 7 (CF7) right before validation
2295
- *
2296
- * @global SpbcState $apbct
2297
- * @param type $result
2298
- * @param type $tags
2299
- * @return type
2300
- */
2301
- function apbct_form__contactForm7__tesSpam__before_validate($result = null, $tags = null) {
2302
- global $apbct;
2303
-
2304
- if ($result && method_exists($result, 'get_invalid_fields')){
2305
- $invalid_fields = $result->get_invalid_fields();
2306
- if(!empty($invalid_fields) && is_array($invalid_fields)){
2307
- $apbct->validation_error = $invalid_fields[key($invalid_fields)]['reason'];
2308
- apbct_form__contactForm7__testSpam(false);
2309
- }
2310
- }
2311
-
2312
- return $result;
2313
- }
2314
-
2315
- /**
2316
- * Test CF7 message for spam
2317
- */
2318
- function apbct_form__contactForm7__testSpam($param) {
2319
-
2320
- global $ct_checkjs_cf7, $apbct;
2321
-
2322
- if(
2323
- $apbct->settings['contact_forms_test'] == 0 ||
2324
- $param == false && WPCF7_VERSION < '3.0.0' ||
2325
- $param === true && WPCF7_VERSION >= '3.0.0' ||
2326
- $apbct->settings['protect_logged_in'] != 1 && is_user_logged_in() || // Skip processing for logged in users.
2327
- apbct_exclusions_check__url() ||
2328
- apbct_exclusions_check__ip() ||
2329
- isset($apbct->cf7_checked)
2330
- ){
2331
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
2332
- return $param;
2333
- }
2334
-
2335
- $checkjs = apbct_js_test($ct_checkjs_cf7, $_POST)
2336
- ? apbct_js_test($ct_checkjs_cf7, $_POST)
2337
- : apbct_js_test('ct_checkjs', $_COOKIE);
2338
-
2339
- $ct_temp_msg_data = ct_get_fields_any($_POST);
2340
-
2341
- $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
2342
- $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
2343
- $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
2344
- $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
2345
- $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
2346
- if ($subject != '') {
2347
- $message = array_merge(array('subject' => $subject), $message);
2348
- }
2349
-
2350
- $base_call_result = apbct_base_call(
2351
- array(
2352
- 'message' => $message,
2353
- 'sender_email' => $sender_email,
2354
- 'sender_nickname' => $sender_nickname,
2355
- 'js_on' => $checkjs,
2356
- 'post_info' => array('comment_type' => 'contact_form_wordpress_cf7'),
2357
- 'sender_info' => array(
2358
- 'form_validation' => !isset($apbct->validation_error)
2359
- ? null
2360
- : json_encode(array(
2361
- 'validation_notice' => $apbct->validation_error,
2362
- 'page_url' => apbct_get_server_variable( 'HTTP_HOST' ) . apbct_get_server_variable( 'REQUEST_URI' ),
2363
- ))
2364
- ),
2365
- )
2366
- );
2367
-
2368
- $ct_result = $base_call_result['ct_result'];
2369
-
2370
- // Change mail notification if license is out of date
2371
- if($apbct->data['moderate'] == 0 &&
2372
- ($ct_result->fast_submit == 1 || $ct_result->blacklisted == 1 || $ct_result->js_disabled == 1)
2373
- ){
2374
- $apbct->sender_email = $sender_email;
2375
- $apbct->sender_ip = \Cleantalk\ApbctWP\Helper::ip__get(array('real'));
2376
- add_filter('wpcf7_mail_components', 'apbct_form__contactForm7__changeMailNotification');
2377
- }
2378
-
2379
- if ($ct_result->allow == 0) {
2380
-
2381
- global $ct_cf7_comment;
2382
- $ct_cf7_comment = $ct_result->comment;
2383
-
2384
- add_filter('wpcf7_display_message', 'apbct_form__contactForm7__showResponse', 10, 2);
2385
-
2386
- $param = WPCF7_VERSION >= '3.0.0' ? true : false;
2387
-
2388
- }
2389
-
2390
- $apbct->cf7_checked = true;
2391
-
2392
- return $param;
2393
- }
2394
-
2395
- /**
2396
- * Changes CF7 status message
2397
- * @param string $hook URL of hooked page
2398
- */
2399
- function apbct_form__contactForm7__showResponse($message, $status = 'spam') {
2400
- global $ct_cf7_comment;
2401
-
2402
- if ($status == 'spam') {
2403
- $message = $ct_cf7_comment;
2404
- }
2405
-
2406
- return $message;
2407
- }
2408
-
2409
- /**
2410
- * Changes email notification for succes subscription for Contact Form 7
2411
- *
2412
- * @param array $component Arguments for email notification
2413
- * @return array Arguments for email notification
2414
- */
2415
- function apbct_form__contactForm7__changeMailNotification($component){
2416
-
2417
- global $apbct;
2418
-
2419
- $component['body'] =
2420
- __('CleanTalk AntiSpam: This message is spam.', 'cleantalk-spam-protect')
2421
- .PHP_EOL . __('CleanTalk\'s anti-spam database:', 'cleantalk-spam-protect')
2422
- .PHP_EOL . 'IP: ' . $apbct->sender_ip
2423
- .PHP_EOL . 'Email: ' . $apbct->sender_email
2424
- .PHP_EOL . sprintf(
2425
- __('Activate protection in your Anti-Spam Dashboard: %s.', 'clentalk'),
2426
- 'https://cleantalk.org/my/?cp_mode=antispam&utm_source=newsletter&utm_medium=email&utm_campaign=cf7_activate_antispam&user_token='.$apbct->user_token
2427
- )
2428
- .PHP_EOL . '---' . PHP_EOL . PHP_EOL
2429
- .$component['body'];
2430
-
2431
- return (array) $component;
2432
- }
2433
-
2434
- /**
2435
- * Test Ninja Forms message for spam
2436
- *
2437
- * @global SpbcState $apbct
2438
- * @return void
2439
- */
2440
- function apbct_form__ninjaForms__testSpam() {
2441
-
2442
- global $apbct;
2443
-
2444
- if(
2445
- $apbct->settings['contact_forms_test'] == 0
2446
- || ($apbct->settings['protect_logged_in'] != 1 && is_user_logged_in()) // Skip processing for logged in users.
2447
- || apbct_exclusions_check__url()
2448
- ){
2449
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
2450
- return;
2451
- }
2452
-
2453
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
2454
-
2455
- // Choosing between POST and GET
2456
- $params = ct_get_fields_any(isset($_GET['ninja_forms_ajax_submit']) || isset($_GET['nf_ajax_submit']) ? $_GET : $_POST);
2457
-
2458
- $sender_email = ($params['email'] ? $params['email'] : '');
2459
- $sender_nickname = ($params['nickname'] ? $params['nickname'] : '');
2460
- $subject = ($params['subject'] ? $params['subject'] : '');
2461
- $message = ($params['message'] ? $params['message'] : array());
2462
- if ($subject != '') {
2463
- $message = array_merge(array('subject' => $subject), $message);
2464
- }
2465
-
2466
- //Ninja Forms xml fix
2467
- foreach ($message as $key => $value){
2468
- if (strpos($value, '<xml>') !== false)
2469
- unset($message[$key]);
2470
- }
2471
-
2472
- $base_call_result = apbct_base_call(
2473
- array(
2474
- 'message' => $message,
2475
- 'sender_email' => $sender_email,
2476
- 'sender_nickname' => $sender_nickname,
2477
- 'post_info' => array('comment_type' => 'contact_form_wordpress_ninja_froms'),
2478
- 'js_on' => $checkjs,
2479
- )
2480
- );
2481
- $ct_result = $base_call_result['ct_result'];
2482
-
2483
- // Change mail notification if license is out of date
2484
- if($apbct->data['moderate'] == 0 &&
2485
- ($ct_result->fast_submit == 1 || $ct_result->blacklisted == 1 || $ct_result->js_disabled == 1)
2486
- ){
2487
- $apbct->sender_email = $sender_email;
2488
- $apbct->sender_ip = \Cleantalk\ApbctWP\Helper::ip__get(array('real'));
2489
- add_filter('ninja_forms_action_email_message', 'apbct_form__ninjaForms__changeMailNotification', 1, 3);
2490
- }
2491
-
2492
- if ($ct_result->allow == 0) {
2493
-
2494
- // We have to use GLOBAL variable to transfer the comment to apbct_form__ninjaForms__changeResponse() function :(
2495
- $apbct->response = $ct_result->comment;
2496
- add_action( 'ninja_forms_before_response', 'apbct_form__ninjaForms__changeResponse', 10, 1 );
2497
- add_action( 'ninja_forms_action_email_send', 'apbct_form__ninjaForms__stopEmail', 1, 5 ); // Prevent mail notification
2498
- add_action( 'ninja_forms_save_submission', 'apbct_form__ninjaForms__preventSubmission', 1, 2 ); // Prevent mail notification
2499
- }
2500
- }
2501
-
2502
- function apbct_form__ninjaForms__preventSubmission($some, $form_id){
2503
- return false;
2504
- }
2505
-
2506
- function apbct_form__ninjaForms__stopEmail($some, $action_settings, $message, $headers, $attachments){
2507
- global $apbct;
2508
- throw new Exception($apbct->response);
2509
- }
2510
-
2511
- function apbct_form__ninjaForms__changeResponse( $data ) {
2512
-
2513
- global $apbct;
2514
-
2515
- // Show error message below field found by ID
2516
- if(array_key_exists('email', $data['fields_by_key'])){
2517
- // Find ID of EMAIL field
2518
- $nf_field_id = $data['fields_by_key']['email']['id'];
2519
- }else{
2520
- // Find ID of last field (usually SUBMIT)
2521
- $nf_field_id = array_pop(array_keys($data['fields']));
2522
- }
2523
-
2524
- // Below is modified NJ logic
2525
- $error = array(
2526
- 'fields' => array(
2527
- $nf_field_id => $apbct->response,
2528
- ),
2529
- );
2530
-
2531
- $response = array( 'data' => $data, 'errors' => $error, 'debug' => '' );
2532
-
2533
- die(wp_json_encode( $response, JSON_FORCE_OBJECT ));
2534
-
2535
- }
2536
-
2537
- function apbct_form__seedprod_coming_soon__testSpam() {
2538
-
2539
- global $apbct;
2540
-
2541
- if(
2542
- $apbct->settings['contact_forms_test'] == 0
2543
- || ($apbct->settings['protect_logged_in'] != 1 && is_user_logged_in()) // Skip processing for logged in users.
2544
- || apbct_exclusions_check__url()
2545
- ){
2546
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
2547
- return;
2548
- }
2549
-
2550
- $ct_temp_msg_data = ct_get_fields_any($_REQUEST);
2551
-
2552
- $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
2553
- $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
2554
- $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
2555
- $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
2556
- if ($subject != '') {
2557
- $message = array_merge(array('subject' => $subject), $message);
2558
- }
2559
-
2560
- $post_info['comment_type'] = 'contact_form_wordpress_seedprod_coming_soon';
2561
-
2562
- $base_call_result = apbct_base_call(
2563
- array(
2564
- 'message' => $message,
2565
- 'sender_email' => $sender_email,
2566
- 'sender_nickname' => $sender_nickname,
2567
- 'post_info' => $post_info,
2568
- )
2569
- );
2570
-
2571
- $ct_result = $base_call_result['ct_result'];
2572
- if ($ct_result->allow == 0) {
2573
- global $ct_comment;
2574
- $ct_comment = $ct_result->comment;
2575
-
2576
- $response = array(
2577
- 'status' => 200,
2578
- 'html' => "<h1>".__('Spam protection by CleanTalk', 'cleantalk-spam-protect')."</h1><h2>".$ct_result->comment."</h2>"
2579
- );
2580
-
2581
- echo sanitize_text_field($_GET['callback']) . '(' . json_encode($response) . ')';
2582
- exit();
2583
- }
2584
-
2585
- }
2586
-
2587
- /**
2588
- * Changes email notification for succes subscription for Ninja Forms
2589
- *
2590
- * @param string $message Body of email notification
2591
- * @return string Body for email notification
2592
- */
2593
- function apbct_form__ninjaForms__changeMailNotification($message, $data, $action_settings){
2594
-
2595
- global $apbct;
2596
-
2597
- if($action_settings['to'] !== $apbct->sender_email){
2598
-
2599
- $message .= wpautop(PHP_EOL . '---'
2600
- .PHP_EOL
2601
- .__('CleanTalk AntiSpam: This message is spam.', 'cleantalk-spam-protect')
2602
- .PHP_EOL . __('CleanTalk\'s anti-spam database:', 'cleantalk-spam-protect')
2603
- .PHP_EOL . 'IP: ' . $apbct->sender_ip
2604
- .PHP_EOL . 'Email: ' . $apbct->sender_email
2605
- .PHP_EOL .
2606
- __('Activate protection in your Anti-Spam Dashboard: ', 'clentalk').
2607
- 'https://cleantalk.org/my/?cp_mode=antispam&utm_source=newsletter&utm_medium=email&utm_campaign=ninjaform_activate_antispam'.$apbct->user_token
2608
- );
2609
- }
2610
-
2611
- return $message;
2612
- }
2613
-
2614
- /**
2615
- * Inserts anti-spam hidden to WPForms
2616
- *
2617
- * @global SpbcState $apbct
2618
- * @return void
2619
- */
2620
- function apbct_form__WPForms__addField($form_data, $some, $title, $description, $errors) {
2621
-
2622
- global $apbct;
2623
-
2624
- if($apbct->settings['contact_forms_test'] == 1)
2625
- ct_add_hidden_fields('checkjs_wpforms', false);
2626
-
2627
- }
2628
-
2629
- /**
2630
- * Gather fields data from submission and store it
2631
- *
2632
- * @param array $entry
2633
- * @param $form
2634
- *
2635
- * @return array
2636
- * @global SpbcState $apbct
2637
- */
2638
- function apbct_from__WPForms__gatherData($entry, $form){
2639
-
2640
- global $apbct;
2641
-
2642
- $data = array();
2643
- foreach($entry['fields'] as $key => $val){
2644
- $true_key = strtolower(str_replace(' ', '_', $form['fields'][$key]['label']));
2645
- $true_key = $true_key ? $true_key : $key;
2646
- $data[$true_key] = $val;
2647
- } unset($key, $val);
2648
-
2649
- $apbct->form_data = $data;
2650
-
2651
- return $entry;
2652
- }
2653
-
2654
- /**
2655
- * Adding error to form entry if message is spam
2656
- * Call spam test from here
2657
- *
2658
- * @param array $errors
2659
- * @param array $form_data
2660
- * @return array
2661
- */
2662
- function apbct_form__WPForms__showResponse($errors, $form_data) {
2663
-
2664
- if(empty($errors) || ( isset($form_data['id'], $errors[$form_data['id']]) && !count($errors[$form_data['id']]) ) ){
2665
-
2666
- $spam_comment = apbct_form__WPForms__testSpam();
2667
-
2668
- $filed_id = $form_data && !empty($form_data['fields']) && is_array($form_data['fields'])
2669
- ? key($form_data['fields'])
2670
- : 0;
2671
-
2672
- if($spam_comment)
2673
- $errors[ $form_data['id'] ][ $filed_id ] = $spam_comment;
2674
-
2675
- }
2676
-
2677
- return $errors;
2678
- }
2679
-
2680
- /**
2681
- * Test WPForms message for spam
2682
- * Doesn't hooked anywhere.
2683
- * Called directly from apbct_form__WPForms__showResponse()
2684
- *
2685
- * @global SpbcState $apbct
2686
- * @global array $apbct->form_data Contains form data
2687
- * @param array $errors Array of errors to write false result in
2688
- * @return void|array|null
2689
- */
2690
- function apbct_form__WPForms__testSpam() {
2691
-
2692
- global $apbct;
2693
-
2694
- if(
2695
- $apbct->settings['contact_forms_test'] == 0 ||
2696
- $apbct->settings['protect_logged_in'] != 1 && is_user_logged_in() // Skip processing for logged in users.
2697
- ){
2698
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
2699
- return;
2700
- }
2701
-
2702
- $checkjs = apbct_js_test('checkjs_wpforms', $_POST);
2703
-
2704
- $params = ct_get_fields_any($apbct->form_data);
2705
-
2706
- $sender_email = ($params['email'] ? $params['email'] : '');
2707
- $sender_nickname = ($params['nickname'] ? $params['nickname'] : '');
2708
- $subject = ($params['subject'] ? $params['subject'] : '');
2709
- $message = ($params['message'] ? $params['message'] : array());
2710
- if ($subject != '') {
2711
- $message = array_merge(array('subject' => $subject), $message);
2712
- }
2713
-
2714
- $base_call_result = apbct_base_call(
2715
- array(
2716
- 'message' => $message,
2717
- 'sender_email' => $sender_email,
2718
- 'sender_nickname' => $sender_nickname,
2719
- 'post_info' => array('comment_type' => 'contact_form_wordpress_wp_forms'),
2720
- 'js_on' => $checkjs,
2721
- )
2722
- );
2723
- $ct_result = $base_call_result['ct_result'];
2724
-
2725
- // Change mail notification if license is out of date
2726
- if($apbct->data['moderate'] == 0 &&
2727
- ($ct_result->fast_submit == 1 || $ct_result->blacklisted == 1 || $ct_result->js_disabled == 1)
2728
- ){
2729
- $apbct->sender_email = $sender_email;
2730
- $apbct->sender_ip = \Cleantalk\ApbctWP\Helper::ip__get(array('real'));
2731
- add_filter('wpforms_email_message', 'apbct_form__WPForms__changeMailNotification', 100, 2);
2732
- }
2733
-
2734
- if ($ct_result->allow == 0){
2735
- return $ct_result->comment;
2736
- }
2737
-
2738
- return null;
2739
-
2740
- }
2741
-
2742
- /**
2743
- * Changes email notification for succes subscription for Ninja Forms
2744
- *
2745
- * @param string $message Body of email notification
2746
- * @param WPForms_WP_Emails $wpforms_email WPForms email class object
2747
- * @return string Body for email notification
2748
- */
2749
- function apbct_form__WPForms__changeMailNotification($message, $wpforms_email){
2750
-
2751
- global $apbct;
2752
-
2753
- $message = str_replace('</html>', '', $message);
2754
- $message = str_replace('</body>', '', $message);
2755
- $message .= wpautop(PHP_EOL . '---'
2756
- .PHP_EOL
2757
- .__('CleanTalk AntiSpam: This message is spam.', 'cleantalk-spam-protect')
2758
- .PHP_EOL . __('CleanTalk\'s anti-spam database:', 'cleantalk-spam-protect')
2759
- .PHP_EOL . 'IP: ' . '<a href="https://cleantalk.org/blacklists/' . $apbct->sender_ip . '?utm_source=newsletter&utm_medium=email&utm_campaign=wpforms_spam_passed" target="_blank">' . $apbct->sender_ip . '</a>'
2760
- .PHP_EOL . 'Email: ' . '<a href="https://cleantalk.org/blacklists/' . $apbct->sender_email . '?utm_source=newsletter&utm_medium=email&utm_campaign=wpforms_spam_passed" target="_blank">' . $apbct->sender_email . '</a>'
2761
- .PHP_EOL . sprintf(
2762
- __('Activate protection in your %sAnti-Spam Dashboard%s.', 'clentalk'),
2763
- '<a href="https://cleantalk.org/my/?cp_mode=antispam&utm_source=newsletter&utm_medium=email&utm_campaign=wpforms_activate_antispam" target="_blank">',
2764
- '</a>'
2765
- ))
2766
- .'</body></html>';
2767
-
2768
- return $message;
2769
-
2770
- }
2771
-
2772
- /*
2773
- * QuForms check spam
2774
- * works with singl-paged forms
2775
- * and with multi-paged forms - check only last step of the forms
2776
- */
2777
- function ct_quform_post_validate($result, $form) {
2778
-
2779
- if ( $form->hasPages() ) {
2780
- $comment_type = 'contact_form_wordpress_quforms_multipage';
2781
- } else {
2782
- $comment_type = 'contact_form_wordpress_quforms_singlepage';
2783
- }
2784
-
2785
- $ct_temp_msg_data = ct_get_fields_any( $form->getValues() );
2786
- // @ToDo If we have several emails at the form - will be used only the first detected!
2787
- $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
2788
-
2789
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
2790
- $base_call_result = apbct_base_call(
2791
- array(
2792
- 'message' => $form->getValues(),
2793
- 'sender_email' => $sender_email,
2794
- 'post_info' => array('comment_type' => $comment_type),
2795
- 'js_on' => $checkjs,
2796
- )
2797
- );
2798
-
2799
- $ct_result = $base_call_result['ct_result'];
2800
- if ($ct_result->allow == 0) {
2801
- die(json_encode(array('type' => 'error', 'apbct' => array('blocked' => true, 'comment' => $ct_result->comment))));
2802
- } else {
2803
- return $result;
2804
- }
2805
-
2806
- return $result;
2807
-
2808
- }
2809
-
2810
- /**
2811
- * Inserts anti-spam hidden to Fast Secure contact form
2812
- */
2813
- function ct_si_contact_display_after_fields($string = '', $style = '', $form_errors = array(), $form_id_num = 0) {
2814
- $string .= ct_add_hidden_fields('ct_checkjs', true);
2815
- return $string;
2816
- }
2817
-
2818
- /**
2819
- * Test for Fast Secure contact form
2820
- */
2821
- function ct_si_contact_form_validate($form_errors = array(), $form_id_num = 0) {
2822
- global $apbct, $cleantalk_executed;
2823
-
2824
- if (!empty($form_errors)) {
2825
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
2826
- return $form_errors;
2827
- }
2828
-
2829
-
2830
- if ($apbct->settings['contact_forms_test'] == 0) {
2831
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
2832
- return $form_errors;
2833
- }
2834
-
2835
- // Skip processing because data already processed.
2836
- if ($cleantalk_executed) {
2837
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
2838
- return $form_errors;
2839
- }
2840
-
2841
- //getting info from custom fields
2842
- $ct_temp_msg_data = ct_get_fields_any($_POST);
2843
-
2844
- $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
2845
- $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
2846
- $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
2847
- $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
2848
- $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
2849
- if($subject != '') {
2850
- $message['subject'] = $subject;
2851
- }
2852
-
2853
- $base_call_result = apbct_base_call(
2854
- array(
2855
- 'message' => $message,
2856
- 'sender_email' => $sender_email,
2857
- 'sender_nickname' => $sender_nickname,
2858
- 'post_info' => array('comment_type' => 'contact_form_wordpress_fscf'),
2859
- 'js_on' => apbct_js_test('ct_checkjs', $_POST),
2860
- )
2861
- );
2862
-
2863
- $ct_result = $base_call_result['ct_result'];
2864
-
2865
- $cleantalk_executed = true;
2866
-
2867
- if ($ct_result->allow == 0) {
2868
- global $ct_comment;
2869
- $ct_comment = $ct_result->comment;
2870
- ct_die(null, null);
2871
- exit;
2872
- }
2873
-
2874
- return $form_errors;
2875
- }
2876
-
2877
- /**
2878
- * Notice for commentators which comment has automatically approved by plugin
2879
- * @param string $hook URL of hooked page
2880
- */
2881
- function ct_comment_text($comment_text) {
2882
- global $comment, $ct_approved_request_id_label;
2883
-
2884
- if (isset($_COOKIE[$ct_approved_request_id_label]) && isset($comment->comment_ID)) {
2885
- $ct_hash = get_comment_meta($comment->comment_ID, 'ct_hash', true);
2886
-
2887
- if ($ct_hash !== '' && $_COOKIE[$ct_approved_request_id_label] == $ct_hash) {
2888
- $comment_text .= '<br /><br /> <em class="comment-awaiting-moderation">' . __('Comment approved. Anti-spam by CleanTalk.', 'cleantalk-spam-protect') . '</em>';
2889
- }
2890
- }
2891
-
2892
- return $comment_text;
2893
- }
2894
-
2895
-
2896
- /**
2897
- * Checks WordPress Landing Pages raw $_POST values
2898
- */
2899
- function ct_check_wplp(){
2900
-
2901
- global $ct_wplp_result_label, $apbct;
2902
-
2903
- if (!isset($_COOKIE[$ct_wplp_result_label])) {
2904
- // First AJAX submit of WPLP form
2905
- if ($apbct->settings['contact_forms_test'] == 0) {
2906
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
2907
- return;
2908
- }
2909
-
2910
- $post_info['comment_type'] = 'feedback';
2911
- $post_info = json_encode($post_info);
2912
- if ($post_info === false)
2913
- $post_info = '';
2914
-
2915
- $sender_email = '';
2916
- foreach ($_POST as $v) {
2917
- if (preg_match("/^\S+@\S+\.\S+$/", $v)) {
2918
- $sender_email = $v;
2919
- break;
2920
- }
2921
- }
2922
-
2923
- $message = '';
2924
- if(array_key_exists('form_input_values', $_POST)){
2925
- $form_input_values = json_decode(stripslashes($_POST['form_input_values']), true);
2926
- if (is_array($form_input_values) && array_key_exists('null', $form_input_values))
2927
- $message = $form_input_values['null'];
2928
- } else if (array_key_exists('null', $_POST)) {
2929
- $message = $_POST['null'];
2930
- }
2931
-
2932
- $base_call_result = apbct_base_call(
2933
- array(
2934
- 'message' => $message,
2935
- 'sender_email' => $sender_email,
2936
- 'post_info' => array('comment_type' => 'contact_form_wordpress_wplp'),
2937
- )
2938
- );
2939
-
2940
- $ct_result = $base_call_result['ct_result'];
2941
-
2942
- if ($ct_result->allow == 0) {
2943
- $cleantalk_comment = $ct_result->comment;
2944
- } else {
2945
- $cleantalk_comment = 'OK';
2946
- }
2947
-
2948
- \Cleantalk\Common\Helper::apbct_cookie__set($ct_wplp_result_label, $cleantalk_comment, strtotime("+5 seconds"), '/');
2949
- } else {
2950
- // Next POST/AJAX submit(s) of same WPLP form
2951
- $cleantalk_comment = $_COOKIE[$ct_wplp_result_label];
2952
- }
2953
- if ($cleantalk_comment !== 'OK')
2954
- ct_die_extended($cleantalk_comment);
2955
- }
2956
-
2957
- /**
2958
- * Places a hidding field to Gravity forms.
2959
- * @return string
2960
- */
2961
- function apbct_form__gravityForms__addField($form_string, $form){
2962
- $ct_hidden_field = 'ct_checkjs';
2963
-
2964
- // Do not add a hidden field twice.
2965
- if (preg_match("/$ct_hidden_field/", $form_string)) {
2966
- return $form_string;
2967
- }
2968
-
2969
- $search = "</form>";
2970
-
2971
- // Adding JS code
2972
- $js_code = ct_add_hidden_fields($ct_hidden_field, true, false);
2973
- $form_string = str_replace($search, $js_code . $search, $form_string);
2974
-
2975
- // Adding field for multipage form. Look for cleantalk.php -> apbct_cookie();
2976
- $append_string = isset($form['lastPageButton']) ? "<input type='hidden' name='ct_multipage_form' value='yes'>" : '';
2977
- $form_string = str_replace($search, $append_string.$search, $form_string);
2978
-
2979
- return $form_string;
2980
- }
2981
-
2982
- /**
2983
- * Gravity forms anti-spam test.
2984
- * @return boolean
2985
- */
2986
- function apbct_form__gravityForms__testSpam($is_spam, $form, $entry) {
2987
-
2988
- global $apbct, $cleantalk_executed, $ct_gform_is_spam, $ct_gform_response;
2989
-
2990
- if (
2991
- $apbct->settings['contact_forms_test'] == 0 ||
2992
- $is_spam ||
2993
- $cleantalk_executed // Return unchanged result if the submission was already tested.
2994
- ) {
2995
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
2996
- return $is_spam;
2997
- }
2998
-
2999
- $ct_temp = array();
3000
- foreach($entry as $key => $value){
3001
- if(is_numeric($key))
3002
- $ct_temp[$key]=$value;
3003
- } unset($key, $value);
3004
-
3005
- $ct_temp_msg_data = ct_get_fields_any($ct_temp);
3006
- $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
3007
- $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
3008
- $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
3009
- $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
3010
- $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
3011
-
3012
- // Adding 'input_' to every field /Gravity Forms fix/
3013
- $tmp = $message;
3014
- $message = array();
3015
- foreach($tmp as $key => $value){
3016
- $message[ 'input_' . $key] = $value;
3017
- } unset( $key, $value, $tmp );
3018
-
3019
- if($subject != '')
3020
- $message['subject'] = $subject;
3021
-
3022
- $checkjs = apbct_js_test('ct_checkjs', $_POST)
3023
- ? apbct_js_test('ct_checkjs', $_POST)
3024
- : apbct_js_test('ct_checkjs', $_COOKIE);
3025
-
3026
- $base_call_result = apbct_base_call(
3027
- array(
3028
- 'message' => $message,
3029
- 'sender_email' => $sender_email,
3030
- 'sender_nickname' => $sender_nickname,
3031
- 'post_info' => array('comment_type' => 'contact_form_wordpress_gravity_forms'),
3032
- 'js_on' => $checkjs,
3033
- )
3034
- );
3035
-
3036
- $ct_result = $base_call_result['ct_result'];
3037
- if ($ct_result->allow == 0) {
3038
- $is_spam = true;
3039
- $ct_gform_is_spam = true;
3040
- $ct_gform_response = $ct_result->comment;
3041
- }
3042
-
3043
- return $is_spam;
3044
- }
3045
-
3046
- function apbct_form__gravityForms__showResponse( $confirmation, $form, $entry, $ajax ){
3047
-
3048
- global $ct_gform_is_spam, $ct_gform_response;
3049
-
3050
- if(!empty($ct_gform_is_spam)){
3051
- $confirmation = '<a id="gf_'.$form['id'].'" class="gform_anchor" ></a><div id="gform_confirmation_wrapper_'.$form['id'].'" class="gform_confirmation_wrapper "><div id="gform_confirmation_message_'.$form['id'].'" class="gform_confirmation_message_'.$form['id'].' gform_confirmation_message"><font style="color: red">'.$ct_gform_response.'</font></div></div>';
3052
- }
3053
-
3054
- return $confirmation;
3055
- }
3056
-
3057
- /**
3058
- * Test S2member registration
3059
- * @return array with errors
3060
- */
3061
- function ct_s2member_registration_test($post_key) {
3062
-
3063
- global $apbct;
3064
-
3065
- if ($apbct->settings['registrations_test'] == 0) {
3066
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
3067
- return null;
3068
- }
3069
-
3070
- $sender_email = isset($_POST[$post_key]['email']) ? sanitize_email($_POST[$post_key]['email']) : null;
3071
- $sender_nickname = isset($_POST[$post_key]['username']) ? sanitize_email($_POST[$post_key]['username']) : null;
3072
-
3073
- //Making a call
3074
- $base_call_result = apbct_base_call(
3075
- array(
3076
- 'sender_email' => $sender_email,
3077
- 'sender_nickname' => $sender_nickname,
3078
- ),
3079
- true
3080
- );
3081
- $ct_result = $base_call_result['ct_result'];
3082
-
3083
- if ($ct_result->allow == 0) {
3084
- ct_die_extended($ct_result->comment);
3085
- }
3086
-
3087
- return true;
3088
- }
3089
-
3090
- function apbct_form__the7_contact_form() {
3091
-
3092
- global $cleantalk_executed;
3093
-
3094
- if ( check_ajax_referer( 'dt_contact_form', 'nonce', false ) && isset($_POST) ) {
3095
-
3096
- $post_info['comment_type'] = 'contact_the7_theme_contact_form';
3097
-
3098
- $ct_temp_msg_data = ct_get_fields_any($_POST);
3099
-
3100
- $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
3101
- $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
3102
- $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
3103
- $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
3104
- $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
3105
- if ($subject != '') {
3106
- $message = array_merge(array('subject' => $subject), $message);
3107
- }
3108
-
3109
- // Skip submission if no data found
3110
- if ($sender_email === ''|| !$contact_form) {
3111
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
3112
- return false;
3113
- }
3114
- $cleantalk_executed = true;
3115
-
3116
- $base_call_result = apbct_base_call(
3117
- array(
3118
- 'message' => $message,
3119
- 'sender_email' => $sender_email,
3120
- 'sender_nickname' => $sender_nickname,
3121
- 'post_info' => $post_info,
3122
- )
3123
- );
3124
-
3125
- $ct_result = $base_call_result['ct_result'];
3126
- if ($ct_result->allow == 0) {
3127
-
3128
- $response = json_encode(
3129
- array(
3130
- 'success' => false ,
3131
- 'errors' => $ct_result->comment,
3132
- 'nonce' => wp_create_nonce( 'dt_contact_form' )
3133
- )
3134
- );
3135
-
3136
- // response output
3137
- header( "Content-Type: application/json" );
3138
- echo $response;
3139
-
3140
- // IMPORTANT: don't forget to "exit"
3141
- exit;
3142
-
3143
- }
3144
-
3145
- }
3146
-
3147
- }
3148
-
3149
- function apbct_form__elementor_pro__testSpam() {
3150
-
3151
- global $apbct, $cleantalk_executed;
3152
-
3153
- if(
3154
- $apbct->settings['contact_forms_test'] == 0
3155
- || ($apbct->settings['protect_logged_in'] != 1 && is_user_logged_in()) // Skip processing for logged in users.
3156
- || apbct_exclusions_check__url()
3157
- ){
3158
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
3159
- return;
3160
- }
3161
-
3162
- $ct_temp_msg_data = ct_get_fields_any($_POST);
3163
-
3164
- $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
3165
- $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
3166
- $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
3167
- $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
3168
- if ($subject != '') {
3169
- $message = array_merge(array('subject' => $subject), $message);
3170
- }
3171
-
3172
- $post_info['comment_type'] = 'contact_form_wordpress_elementor_pro';
3173
-
3174
- $cleantalk_executed = true;
3175
- $base_call_result = apbct_base_call(
3176
- array(
3177
- 'message' => $message,
3178
- 'sender_email' => $sender_email,
3179
- 'sender_nickname' => $sender_nickname,
3180
- 'post_info' => $post_info,
3181
- )
3182
- );
3183
-
3184
- $ct_result = $base_call_result['ct_result'];
3185
-
3186
- if ($ct_result->allow == 0) {
3187
-
3188
- wp_send_json_error( array(
3189
- 'message' => $ct_result->comment,
3190
- 'data' => array()
3191
- ) );
3192
-
3193
- }
3194
-
3195
- }
3196
-
3197
- // INEVIO theme integration
3198
- function apbct_form__inevio__testSpam() {
3199
-
3200
- global $apbct, $cleantalk_executed;
3201
-
3202
- $theme = wp_get_theme();
3203
- if(
3204
- stripos( $theme->get( 'Name' ), 'INEVIO' ) === false ||
3205
- $apbct->settings['contact_forms_test'] == 0 ||
3206
- ($apbct->settings['protect_logged_in'] != 1 && is_user_logged_in()) || // Skip processing for logged in users.
3207
- apbct_exclusions_check__url()
3208
- ) {
3209
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
3210
- return false;
3211
- }
3212
- $form_data = array();
3213
- parse_str($_POST['data'], $form_data);
3214
-
3215
- $name = isset($form_data['name']) ? $form_data['name'] : '';
3216
- $email = isset($form_data['email']) ? $form_data['email'] : '';
3217
- $message = isset($form_data['message']) ? $form_data['message'] : '';
3218
-
3219
- $post_info['comment_type'] = 'contact_form_wordpress_inevio_theme';
3220
-
3221
- $cleantalk_executed = true;
3222
- $base_call_result = apbct_base_call(
3223
- array(
3224
- 'message' => $message,
3225
- 'sender_email' => $email,
3226
- 'sender_nickname' => $name,
3227
- 'post_info' => $post_info,
3228
- )
3229
- );
3230
-
3231
- $ct_result = $base_call_result['ct_result'];
3232
-
3233
- if ( $ct_result->allow == 0 ) {
3234
- die(json_encode(array('apbct' => array('blocked' => true, 'comment' => $ct_result->comment,))));
3235
- }
3236
-
3237
- return true;
3238
-
3239
- }
3240
-
3241
- /**
3242
- * General test for any contact form
3243
- */
3244
- function ct_contact_form_validate() {
3245
-
3246
- global $pagenow,$cleantalk_executed ,$apbct, $ct_checkjs_frm;
3247
-
3248
- // Exclusios common function
3249
- if ( apbct_exclusions_check(__FUNCTION__) ) {
3250
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
3251
- return null;
3252
- }
3253
-
3254
- if (@sizeof($_POST)==0 ||
3255
- (isset($_POST['signup_username']) && isset($_POST['signup_email']) && isset($_POST['signup_password'])) ||
3256
- (isset($pagenow) && $pagenow == 'wp-login.php') || // WordPress log in form
3257
- (isset($pagenow) && $pagenow == 'wp-login.php' && isset($_GET['action']) && $_GET['action']=='lostpassword') ||
3258
- apbct_is_in_referer( 'lostpassword' ) ||
3259
- apbct_is_in_referer( 'lost-password' ) || //Skip lost-password form check
3260
- (apbct_is_in_uri('/wp-admin/') && (empty($_POST['your-phone']) && empty($_POST['your-email']) && empty($_POST['your-message']))) || //Bitrix24 Contact
3261
- apbct_is_in_uri('wp-login.php') ||
3262
- apbct_is_in_uri('wp-comments-post.php') ||
3263
- apbct_is_in_uri('?provider=facebook&') ||
3264
- apbct_is_in_uri('reset-password/') || // Ticket #13668. Password reset.
3265
- apbct_is_in_referer( '/wp-admin/') ||
3266
- apbct_is_in_uri('/login/') ||
3267
- apbct_is_in_uri( '/my-account/edit-account/') || // WooCommerce edit account page
3268
- apbct_is_in_uri( '/my-account/edit-address/') || // WooCommerce edit account page
3269
- (isset($_POST['action']) && $_POST['action'] == 'save_account_details') || // WooCommerce edit account action
3270
- apbct_is_in_uri( '/peepsoajax/profilefieldsajax.validate_register') ||
3271
- isset($_GET['ptype']) && $_GET['ptype']=='login' ||
3272
- isset($_POST['ct_checkjs_register_form']) ||
3273
- (isset($_POST['signup_username']) && isset($_POST['signup_password_confirm']) && isset($_POST['signup_submit']) ) ||
3274
- $apbct->settings['general_contact_forms_test'] == 0 ||
3275
- isset($_POST['bbp_topic_content']) ||
3276
- isset($_POST['bbp_reply_content']) ||
3277
- isset($_POST['fscf_submitted']) ||
3278
- apbct_is_in_uri('/wc-api/') ||
3279
- isset($_POST['log']) && isset($_POST['pwd']) && isset($_POST['wp-submit']) ||
3280
- isset($_POST[$ct_checkjs_frm]) && $apbct->settings['contact_forms_test'] == 1 ||// Formidable forms
3281
- isset($_POST['comment_post_ID']) || // The comment form
3282
- isset($_GET['for']) ||
3283
- (isset($_POST['log'], $_POST['pwd'])) || //WooCommerce Sensei login form fix
3284
- (isset($_POST['wc_reset_password'], $_POST['_wpnonce'], $_POST['_wp_http_referer'])) || // WooCommerce recovery password form
3285
- ((isset($_POST['woocommerce-login-nonce']) || isset($_POST['_wpnonce'])) && isset($_POST['login'], $_POST['password'], $_POST['_wp_http_referer'])) || // WooCommerce login form
3286
- (isset($_POST['wc-api']) && strtolower($_POST['wc-api']) == 'wc_gateway_systempay') || // Woo Systempay payment plugin
3287
- apbct_is_in_uri( 'wc-api=WC_Gateway_Realex_Redirect') || // Woo Realex payment Gateway plugin
3288
- (isset($_POST['_wpcf7'], $_POST['_wpcf7_version'], $_POST['_wpcf7_locale'])) || //CF7 fix)
3289
- (isset($_POST['hash'], $_POST['device_unique_id'], $_POST['device_name'])) ||//Mobile Assistant Connector fix
3290
- isset($_POST['gform_submit']) || //Gravity form
3291
- apbct_is_in_uri( 'wc-ajax=get_refreshed_fragments') ||
3292
- (isset($_POST['ccf_form']) && intval($_POST['ccf_form']) == 1) ||
3293
- (isset($_POST['contact_tags']) && strpos($_POST['contact_tags'], 'MBR:') !== false) ||
3294
- (apbct_is_in_uri( 'bizuno.php') && !empty($_POST['bizPass'])) ||
3295
- apbct_is_in_referer( 'my-dashboard/' ) || // ticket_id=7885
3296
- isset($_POST['slm_action'], $_POST['license_key'], $_POST['secret_key'], $_POST['registered_domain']) || // ticket_id=9122
3297
- (isset($_POST['wpforms']['submit']) && $_POST['wpforms']['submit'] == 'wpforms-submit') || // WPForms
3298
- (isset($_POST['action']) && $_POST['action'] == 'grunion-contact-form') || // JetPack
3299
- (isset($_POST['action']) && $_POST['action'] == 'bbp-update-user') || //BBP update user info page
3300
- apbct_is_in_referer( '?wc-api=WC_Gateway_Transferuj' ) || //WC Gateway
3301
- (isset($_GET['mbr'], $_GET['amp;appname'], $_GET['amp;master'])) || // ticket_id=10773
3302
- (isset($_POST['call_function']) && $_POST['call_function'] == 'push_notification_settings') || // Skip mobile requests (push settings)
3303
- apbct_is_in_uri('membership-login') || // Skip login form
3304
- (isset($_GET['cookie-state-change'])) || //skip GDPR plugin
3305
- ( apbct_get_server_variable( 'HTTP_USER_AGENT' ) == 'MailChimp' && apbct_is_in_uri( 'mc4wp-sync-api/webhook-listener') ) || // Mailchimp webhook skip
3306
- apbct_is_in_uri('researcher-log-in') || // Skip login form
3307
- apbct_is_in_uri('admin_aspcms/_system/AspCms_SiteSetting.asp?action=saves') || // Skip admin save callback
3308
- apbct_is_in_uri('?profile_tab=postjobs') || // Skip post vacancies
3309
- (isset($_POST['btn_insert_post_type_hotel']) && $_POST['btn_insert_post_type_hotel'] == 'SUBMIT HOTEL') || // Skip adding hotel
3310
- (isset($_POST['action']) && $_POST['action'] == 'updraft_savesettings') || // Updraft save settings
3311
- isset($_POST['quform_submit']) || //QForms multi-paged form skip
3312
- (isset($_POST['wpum_form']) && $_POST['wpum_form'] == 'login') || //WPUM login skip
3313
- isset($_POST['password']) || // Exception for login form. From Analysis uid=406596
3314
- (isset($_POST['action']) && $_POST['action'] == 'wilcity_reset_password') || // Exception for reset password form. From Analysis uid=430898
3315
- (isset($_POST['action']) && $_POST['action'] == 'wilcity_login') || // Exception for login form. From Analysis uid=430898
3316
- (isset($_POST['qcfsubmit'])) || //Exception for submit quick forms - duplicates with qcfvalidate
3317
- apbct_is_in_uri('tin-canny-learndash-reporting/src/h5p-xapi/process-xapi-statement.php?v=asd') || //Skip Tin Canny plugin
3318
- ( isset( $_POST['na'], $_POST['ts'], $_POST['nhr'] ) && !apbct_is_in_uri( '?na=s' ) ) || // The Newsletter Plugin double requests fix. Ticket #14772
3319
- (isset($_POST['spl_action']) && $_POST['spl_action'] == 'register') || //Skip interal action with empty params
3320
- (isset($_POST['action']) && $_POST['action'] == 'bwfan_insert_abandoned_cart' && apbct_is_in_uri( 'my-account/edit-address' )) || //Skip edit account
3321
- apbct_is_in_uri('login-1') || //Skip login form
3322
- apbct_is_in_uri('recuperacao-de-senha-2') || //Skip form reset password
3323
- apbct_is_in_uri('membermouse/api/request.php') && isset($_POST['membership_level_id'],$_POST['apikey'],$_POST['apisecret']) || // Membermouse API
3324
- ( isset( $_POST['AppKey'] ) && ( isset( $_POST['cbAP'] ) && $_POST['cbAP'] == 'Caspio' ) ) || // Caspio exclusion (ticket #16444)
3325
- isset($_POST['wpforms_id'], $_POST['wpforms_author']) //Skip wpforms
3326
- ) {
3327
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
3328
- return null;
3329
- }
3330
-
3331
- //Skip woocommerce checkout
3332
- if (apbct_is_in_uri('wc-ajax=update_order_review') || apbct_is_in_uri('wc-ajax=checkout') || !empty($_POST['woocommerce_checkout_place_order']) || apbct_is_in_uri('wc-ajax=wc_ppec_start_checkout') || apbct_is_in_referer('wc-ajax=update_order_review')) {
3333
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
3334
- return null;
3335
- }
3336
- // Do not execute anti-spam test for logged in users.
3337
- if (isset($_COOKIE[LOGGED_IN_COOKIE]) && $apbct->settings['protect_logged_in'] != 1) {
3338
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
3339
- return null;
3340
- }
3341
- //Skip WP Fusion web hooks
3342
- if ( apbct_is_in_uri('wpf_action') && apbct_is_in_uri('access_key') && isset( $_GET['access_key'] ) ) {
3343
- if( function_exists( 'wp_fusion' ) ) {
3344
- $key = wp_fusion()->settings->get('access_key');
3345
- if ( $key == $_GET['access_key'] ) {
3346
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
3347
- return null;
3348
- }
3349
- }
3350
- }
3351
- //Skip system fields for divi
3352
- if (strpos( \Cleantalk\Variables\Post::get('action'), 'et_pb_contactform_submit') === 0) {
3353
- foreach ($_POST as $key => $value) {
3354
- if (strpos($key, 'et_pb_contact_email_fields') === 0) {
3355
- unset($_POST[$key]);
3356
- }
3357
- }
3358
- }
3359
- $post_info['comment_type'] = 'feedback_general_contact_form';
3360
-
3361
- $ct_temp_msg_data = ct_get_fields_any($_POST);
3362
-
3363
- $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
3364
- $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
3365
- $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
3366
- $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
3367
- $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
3368
- if ($subject != '') {
3369
- $message = array_merge(array('subject' => $subject), $message);
3370
- }
3371
-
3372
- // Skip submission if no data found
3373
- if ($sender_email === ''|| !$contact_form) {
3374
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
3375
- return false;
3376
- }
3377
- $cleantalk_executed=true;
3378
-
3379
- if(isset($_POST['TellAFriend_Link'])){
3380
- $tmp = $_POST['TellAFriend_Link'];
3381
- unset($_POST['TellAFriend_Link']);
3382
- }
3383
-
3384
- $base_call_result = apbct_base_call(
3385
- array(
3386
- 'message' => $message,
3387
- 'sender_email' => $sender_email,
3388
- 'sender_nickname' => $sender_nickname,
3389
- 'post_info' => $post_info,
3390
- 'sender_info' => array( 'sender_email' => urlencode( $sender_email ) ),
3391
- )
3392
- );
3393
-
3394
- if(isset($_POST['TellAFriend_Link'])){
3395
- $_POST['TellAFriend_Link']=$tmp;
3396
- }
3397
-
3398
- $ct_result = $base_call_result['ct_result'];
3399
- if ($ct_result->allow == 0) {
3400
-
3401
- // Recognize contact form an set it's name to $contact_form to use later
3402
- $contact_form = null;
3403
- foreach($_POST as $param => $value){
3404
- if(strpos($param, 'et_pb_contactform_submit') === 0){
3405
- $contact_form = 'contact_form_divi_theme';
3406
- $contact_form_additional = str_replace('et_pb_contactform_submit', '', $param);
3407
- }
3408
- if(strpos($param, 'avia_generated_form') === 0){
3409
- $contact_form = 'contact_form_enfold_theme';
3410
- $contact_form_additional = str_replace('avia_generated_form', '', $param);
3411
- }
3412
- if(!empty($contact_form))
3413
- break;
3414
- }
3415
-
3416
- $ajax_call = false;
3417
- if ((defined( 'DOING_AJAX' ) && DOING_AJAX)
3418
- ) {
3419
- $ajax_call = true;
3420
- }
3421
- if ($ajax_call) {
3422
- echo $ct_result->comment;
3423
- } else {
3424
-
3425
- global $ct_comment;
3426
- $ct_comment = $ct_result->comment;
3427
- if(isset($_POST['cma-action'])&&$_POST['cma-action']=='add'){
3428
- $result=Array('success'=>0, 'thread_id'=>null,'messages'=>Array($ct_result->comment));
3429
- header("Content-Type: application/json");
3430
- print json_encode($result);
3431
- die();
3432
-
3433
- }else if(isset($_POST['TellAFriend_email'])){
3434
- echo $ct_result->comment;
3435
- die();
3436
-
3437
- }else if(isset($_POST['gform_submit'])){ // Gravity forms submission
3438
- $response = sprintf("<!DOCTYPE html><html><head><meta charset='UTF-8' /></head><body class='GF_AJAX_POSTBACK'><div id='gform_confirmation_wrapper_1' class='gform_confirmation_wrapper '><div id='gform_confirmation_message_1' class='gform_confirmation_message_1
3439
- gform_confirmation_message'>%s</div></div></body></html>",
3440
- $ct_result->comment
3441
- );
3442
- echo $response;
3443
- die();
3444
-
3445
- }elseif(isset($_POST['action']) && $_POST['action'] == 'ct_check_internal'){
3446
- return $ct_result->comment;
3447
-
3448
- }elseif(isset($_POST['vfb-submit']) && defined('VFB_VERSION')){
3449
- wp_die("<h1>".__('Spam protection by CleanTalk', 'cleantalk-spam-protect')."</h1><h2>".$ct_result->comment."</h2>", '', array('response' => 403, "back_link" => true, "text_direction" => 'ltr'));
3450
- // Caldera Contact Forms
3451
- }elseif(isset($_POST['action']) && $_POST['action'] == 'cf_process_ajax_submit'){
3452
- print json_encode("<h3 style='color: red;'><red>".$ct_result->comment);
3453
- die();
3454
- // Mailster
3455
- }elseif(isset($_POST['_referer'], $_POST['formid'], $_POST['email'])){
3456
- $return = array(
3457
- 'success' => false,
3458
- 'html' => '<p>' . $ct_result->comment . '</p>',
3459
- );
3460
- print json_encode($return);
3461
- die();
3462
- // Divi Theme Contact Form. Using $contact_form
3463
- }elseif(!empty($contact_form) && $contact_form == 'contact_form_divi_theme'){
3464
- echo "<div id='et_pb_contact_form{$contact_form_additional}'><h1>Your request looks like spam.</h1><div><p>{$ct_result->comment}</p></div></div>";
3465
- die();
3466
- // Enfold Theme Contact Form. Using $contact_form
3467
- }elseif(!empty($contact_form) && $contact_form == 'contact_form_enfold_theme'){
3468
- echo "<div id='ajaxresponse_1' class='ajaxresponse ajaxresponse_1' style='display: block;'><div id='ajaxresponse_1' class='ajaxresponse ajaxresponse_1'><h3 class='avia-form-success'>Antispam by CleanTalk: ".$ct_result->comment."</h3><a href='.'><-Back</a></div></div>";
3469
- die();
3470
- }else{
3471
- ct_die(null, null);
3472
- }
3473
- }
3474
- exit;
3475
- }
3476
-
3477
- return null;
3478
- }
3479
-
3480
- /**
3481
- * General test for any post data
3482
- */
3483
- function ct_contact_form_validate_postdata() {
3484
-
3485
- global $apbct, $pagenow,$cleantalk_executed;
3486
-
3487
- // Exclusios common function
3488
- if ( apbct_exclusions_check(__FUNCTION__) ) {
3489
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
3490
- return null;
3491
- }
3492
-
3493
- if (@sizeof($_POST)==0 ||
3494
- (isset($_POST['signup_username']) && isset($_POST['signup_email']) && isset($_POST['signup_password'])) ||
3495
- (isset($pagenow) && $pagenow == 'wp-login.php') || // WordPress log in form
3496
- (isset($pagenow) && $pagenow == 'wp-login.php' && isset($_GET['action']) && $_GET['action']=='lostpassword') ||
3497
- apbct_is_in_uri('/checkout/') ||
3498
- /* WooCommerce Service Requests - skip them */
3499
- isset($_GET['wc-ajax']) && (
3500
- $_GET['wc-ajax']=='checkout' ||
3501
- $_GET['wc-ajax']=='get_refreshed_fragments' ||
3502
- $_GET['wc-ajax']=='apply_coupon' ||
3503
- $_GET['wc-ajax']=='remove_coupon' ||
3504
- $_GET['wc-ajax']=='update_shipping_method' ||
3505
- $_GET['wc-ajax']=='get_cart_totals' ||
3506
- $_GET['wc-ajax']=='update_order_review' ||
3507
- $_GET['wc-ajax']=='add_to_cart' ||
3508
- $_GET['wc-ajax']=='remove_from_cart' ||
3509
- $_GET['wc-ajax']=='get_variation' ||
3510
- $_GET['wc-ajax']=='get_customer_location'
3511
- ) ||
3512
- /* END: WooCommerce Service Requests */
3513
- apbct_is_in_uri('/wp-admin/') ||
3514
- apbct_is_in_uri('wp-login.php') ||
3515
- apbct_is_in_uri('wp-comments-post.php') ||
3516
- apbct_is_in_referer('/wp-admin/') ||
3517
- apbct_is_in_uri('/login/') ||
3518
- apbct_is_in_uri('?provider=facebook&') ||
3519
- isset($_GET['ptype']) && $_GET['ptype']=='login' ||
3520
- isset($_POST['ct_checkjs_register_form']) ||
3521
- (isset($_POST['signup_username']) && isset($_POST['signup_password_confirm']) && isset($_POST['signup_submit']) ) ||
3522
- $apbct->settings['general_contact_forms_test']==0 ||
3523
- isset($_POST['bbp_topic_content']) ||
3524
- isset($_POST['bbp_reply_content']) ||
3525
- isset($_POST['fscf_submitted']) ||
3526
- isset($_POST['log']) && isset($_POST['pwd']) && isset($_POST['wp-submit'])||
3527
- apbct_is_in_uri('/wc-api/') ||
3528
- (isset($_POST['wc_reset_password'], $_POST['_wpnonce'], $_POST['_wp_http_referer'])) || //WooCommerce recovery password form
3529
- (isset($_POST['woocommerce-login-nonce'], $_POST['login'], $_POST['password'], $_POST['_wp_http_referer'])) || //WooCommerce login form
3530
- (isset($_POST['provider'], $_POST['authcode']) && $_POST['provider'] == 'Two_Factor_Totp') || //TwoFactor authorization
3531
- (isset($_GET['wc-ajax']) && $_GET['wc-ajax'] == 'sa_wc_buy_now_get_ajax_buy_now_button') || //BuyNow add to cart
3532
- apbct_is_in_uri('/wp-json/wpstatistics/v1/hit') || //WPStatistics
3533
- (isset($_POST['ihcaction']) && $_POST['ihcaction'] == 'login') || //Skip login form
3534
- (isset($_POST['action']) && $_POST['action'] == 'infinite_scroll') || //Scroll
3535
- isset($_POST['gform_submit']) || //Skip gravity checking because of direct integration
3536
- (isset($_POST['lrm_action']) && $_POST['lrm_action'] == 'login') || //Skip login form
3537
- apbct_is_in_uri( 'xmlrpc.php?for=jetpack' )
3538
- ) {
3539
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
3540
- return null;
3541
- }
3542
-
3543
- $message = ct_get_fields_any_postdata($_POST);
3544
-
3545
- // ???
3546
- if(strlen(json_encode($message))<10) {
3547
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
3548
- return null;
3549
- }
3550
-
3551
-
3552
- // Skip if request contains params
3553
- $skip_params = array(
3554
- 'ipn_track_id', // PayPal IPN #
3555
- 'txn_type', // PayPal transaction type
3556
- 'payment_status', // PayPal payment status
3557
- );
3558
- foreach($skip_params as $key=>$value){
3559
- if(@array_key_exists($value,$_GET)||@array_key_exists($value,$_POST)) {
3560
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
3561
- return null;
3562
- }
3563
- }
3564
-
3565
- $base_call_result = apbct_base_call(
3566
- array(
3567
- 'message' => $message,
3568
- 'post_info' => array('comment_type' => 'feedback_general_postdata'),
3569
- )
3570
- );
3571
-
3572
- $cleantalk_executed=true;
3573
-
3574
- $ct_result = $base_call_result['ct_result'];
3575
-
3576
- if ($ct_result->allow == 0) {
3577
-
3578
- if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)) {
3579
- global $ct_comment;
3580
- $ct_comment = $ct_result->comment;
3581
- if(isset($_POST['cma-action'])&&$_POST['cma-action']=='add')
3582
- {
3583
- $result=Array('success'=>0, 'thread_id'=>null,'messages'=>Array($ct_result->comment));
3584
- header("Content-Type: application/json");
3585
- print json_encode($result);
3586
- die();
3587
- }
3588
- else
3589
- {
3590
- ct_die(null, null);
3591
- }
3592
- } else {
3593
- echo $ct_result->comment;
3594
- }
3595
- exit;
3596
- }
3597
-
3598
- return null;
3599
- }
3600
-
3601
-
3602
- /**
3603
- * Inner function - Finds and returns pattern in string
3604
- * @return null|bool
3605
- */
3606
- function ct_get_data_from_submit($value = null, $field_name = null) {
3607
- if (!$value || !$field_name || !is_string($value)) {
3608
- return false;
3609
- }
3610
- if (preg_match("/[a-z0-9_\-]*" . $field_name. "[a-z0-9_\-]*$/", $value)) {
3611
- return true;
3612
- }
3613
- }
3614
-
3615
- /**
3616
- * Sends error notice to admin
3617
- * @return null
3618
- */
3619
- function ct_send_error_notice ($comment = '') {
3620
- global $ct_admin_notoice_period, $apbct;
3621
-
3622
- $timelabel_reg = intval( get_option('cleantalk_timelabel_reg') );
3623
- if(time() - $ct_admin_notoice_period > $timelabel_reg){
3624
- update_option('cleantalk_timelabel_reg', time());
3625
-
3626
- $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
3627
- $message = __('Attention, please!', 'cleantalk-spam-protect') . "\r\n\r\n";
3628
- $message .= sprintf(__('"%s" plugin error on your site "%s":', 'cleantalk-spam-protect'), $apbct->plugin_name, $blogname) . "\r\n\r\n";
3629
- $message .= preg_replace('/^(.*?)<a.*?"(.*?)".*?>(.*?)<.a>(.*)$/', '$1. $3: $2?user_token='. $apbct->user_token .' $4', $comment) . "\r\n\r\n";
3630
- @wp_mail(ct_get_admin_email(), sprintf(__('[%s] "%s" error!', 'cleantalk-spam-protect'), $apbct->plugin_name, $blogname), $message);
3631
- }
3632
-
3633
- return null;
3634
- }
3635
-
3636
- function ct_print_form($arr, $k)
3637
- {
3638
- foreach($arr as $key => $value){
3639
- if(!is_array($value)){
3640
- if($k == ''){
3641
- print '<textarea name="' . $key . '" style="display:none;">' . htmlspecialchars($value) . '</textarea>';
3642
- }else{
3643
- print '<textarea name="' . $k . '[' . $key . ']" style="display:none;">' . htmlspecialchars($value) . '</textarea>';
3644
- }
3645
- }else{
3646
- if($k == ''){
3647
- ct_print_form($value, $key);
3648
- }else{
3649
- ct_print_form($value, $k . '[' . $key . ']');
3650
- }
3651
- }
3652
- }
3653
- }
3654
-
3655
- /**
3656
- * Attaches public scripts and styles.
3657
- */
3658
- function ct_enqueue_scripts_public($hook){
3659
-
3660
- global $current_user, $apbct;
3661
-
3662
- if (apbct_exclusions_check__url()) {
3663
- return;
3664
- }
3665
-
3666
- if($apbct->settings['registrations_test'] || $apbct->settings['comments_test'] || $apbct->settings['contact_forms_test'] || $apbct->settings['general_contact_forms_test'] || $apbct->settings['wc_checkout_test'] || $apbct->settings['check_external'] || $apbct->settings['check_internal'] || $apbct->settings['bp_private_messages'] || $apbct->settings['general_postdata_test']){
3667
-
3668
- if( ! $apbct->public_script_loaded ) {
3669
-
3670
- // Differnt JS params
3671
- wp_enqueue_script( 'ct_public', APBCT_URL_PATH . '/js/apbct-public.min.js', array( 'jquery' ), APBCT_VERSION, false /*in header*/ );
3672
-
3673
- wp_localize_script('ct_public', 'ctPublic', array(
3674
- '_ajax_nonce' => wp_create_nonce('ct_secret_stuff'),
3675
- '_ajax_url' => admin_url('admin-ajax.php'),
3676
- ));
3677
- }
3678
-
3679
- // GDPR script
3680
- if($apbct->settings['gdpr_enabled']){
3681
-
3682
- wp_enqueue_script('ct_public_gdpr', APBCT_URL_PATH.'/js/apbct-public--gdpr.min.js', array('jquery', 'ct_public'), APBCT_VERSION, false /*in header*/);
3683
-
3684
- wp_localize_script('ct_public_gdpr', 'ctPublicGDPR', array(
3685
- 'gdpr_forms' => array(),
3686
- 'gdpr_text' => $apbct->settings['gdpr_text'] ? $apbct->settings['gdpr_text'] : __('By using this form you agree with the storage and processing of your data by using the Privacy Policy on this website.', 'cleantalk-spam-protect'),
3687
- ));
3688
- }
3689
-
3690
- }
3691
-
3692
- if(!defined('CLEANTALK_AJAX_USE_FOOTER_HEADER') || (defined('CLEANTALK_AJAX_USE_FOOTER_HEADER') && CLEANTALK_AJAX_USE_FOOTER_HEADER)){
3693
- if($apbct->settings['use_ajax'] && ! apbct_is_in_uri('.xml') && ! apbct_is_in_uri('.xsl')){
3694
- if( ! apbct_is_in_uri('jm-ajax') ){
3695
-
3696
- // Use AJAX for JavaScript check
3697
- if($apbct->settings['use_ajax']){
3698
-
3699
- wp_enqueue_script('ct_nocache', plugins_url('/cleantalk-spam-protect/js/cleantalk_nocache.min.js'), array(), APBCT_VERSION, false /*in header*/);
3700
-
3701
- wp_localize_script('ct_nocache', 'ctNocache', array(
3702
- 'ajaxurl' => admin_url('admin-ajax.php'),
3703
- 'info_flag' => $apbct->settings['collect_details'] && $apbct->settings['set_cookies'] ? true : false,
3704
- 'set_cookies_flag' => $apbct->settings['set_cookies'] ? false : true,
3705
- 'blog_home' => get_home_url().'/',
3706
- ));
3707
- }
3708
-
3709
- // External forms check
3710
- if($apbct->settings['check_external'])
3711
- wp_enqueue_script('ct_external', plugins_url('/cleantalk-spam-protect/js/cleantalk_external.min.js'), array('jquery'), APBCT_VERSION, false /*in header*/);
3712
-
3713
- // Internal forms check
3714
- if($apbct->settings['check_internal'])
3715
- wp_enqueue_script('ct_internal', plugins_url('/cleantalk-spam-protect/js/cleantalk_internal.min.js'), array('jquery'), APBCT_VERSION, false /*in header*/);
3716
-
3717
- }
3718
- }
3719
- }
3720
-
3721
- // Show controls for commentaries
3722
- if(in_array("administrator", $current_user->roles)){
3723
-
3724
- if($apbct->settings['manage_comments_on_public_page']){
3725
-
3726
- $ajax_nonce = wp_create_nonce( "ct_secret_nonce" );
3727
-
3728
- wp_enqueue_style ('ct_public_admin_css', plugins_url('/cleantalk-spam-protect/css/cleantalk-public-admin.min.css'), array(), APBCT_VERSION, 'all');
3729
- wp_enqueue_script('ct_public_admin_js', plugins_url('/cleantalk-spam-protect/js/cleantalk-public-admin.min.js'), array('jquery'), APBCT_VERSION, false /*in header*/);
3730
-
3731
- wp_localize_script('ct_public_admin_js', 'ctPublicAdmin', array(
3732
- 'ct_ajax_nonce' => $ajax_nonce,
3733
- 'ajaxurl' => admin_url('admin-ajax.php'),
3734
- 'ct_feedback_error' => __('Error occurred while sending feedback.', 'cleantalk-spam-protect'),
3735
- 'ct_feedback_no_hash' => __('Feedback wasn\'t sent. There is no associated request.', 'cleantalk-spam-protect'),
3736
- 'ct_feedback_msg' => sprintf(__("Feedback has been sent to %sCleanTalk Dashboard%s.", 'cleantalk-spam-protect'), $apbct->user_token ? "<a target='_blank' href=https://cleantalk.org/my/show_requests?user_token={$apbct->user_token}&cp_mode=antispam>" : '', $apbct->user_token ? "</a>" : ''),
3737
- ));
3738
-
3739
- }
3740
- }
3741
-
3742
- // Debug
3743
- if($apbct->settings['debug_ajax']){
3744
- wp_enqueue_script('ct_debug_js', plugins_url('/cleantalk-spam-protect/js/cleantalk-debug-ajax.min.js'), array('jquery'), APBCT_VERSION, false /*in header*/);
3745
-
3746
- wp_localize_script('ct_debug_js', 'apbctDebug', array(
3747
- 'reload' => false,
3748
- 'reload_time' => 10000,
3749
- ));
3750
- }
3751
- }
3752
-
3753
- /**
3754
- * Reassign callbackback function for the bootom of comment output.
3755
- */
3756
- function ct_wp_list_comments_args($options){
3757
-
3758
- global $current_user, $apbct;
3759
-
3760
- if(in_array("administrator", $current_user->roles)){
3761
- if($apbct->settings['manage_comments_on_public_page']) {
3762
- $theme = wp_get_theme();
3763
- $apbct->active_theme = $theme->get( 'Name' );
3764
- $options['end-callback'] = 'ct_comments_output';
3765
- }
3766
- }
3767
-
3768
- return $options;
3769
- }
3770
-
3771
- /**
3772
- * Callback function for the bootom comment output.
3773
- */
3774
- function ct_comments_output($curr_comment, $param2, $wp_list_comments_args){
3775
-
3776
- global $apbct;
3777
-
3778
- $email = $curr_comment->comment_author_email;
3779
- $ip = $curr_comment->comment_author_IP;
3780
- $id = $curr_comment->comment_ID;
3781
-
3782
- $settings_link = '/wp-admin/'.(is_network_admin() ? "settings.php?page=cleantalk" : "options-general.php?page=cleantalk");
3783
-
3784
- echo "<div class='ct_comment_info'><div class ='ct_comment_titles'>";
3785
- echo "<p class='ct_comment_info_title'>".__('Sender info', 'cleantalk-spam-protect')."</p>";
3786
-
3787
- echo "<p class='ct_comment_logo_title'>
3788
- ".__('by', 'cleantalk-spam-protect')
3789
- ." <a href='{$settings_link}' target='_blank'><img class='ct_comment_logo_img' src='".plugins_url()."/cleantalk-spam-protect/inc/images/logo_color.png'></a>"
3790
- ." <a href='{$settings_link}' target='_blank'>CleanTalk</a>"
3791
- ."</p></div>";
3792
- // Outputs email if exists
3793
- if($email)
3794
- echo "<a href='https://cleantalk.org/blacklists/$email' target='_blank' title='https://cleantalk.org/blacklists/$email'>"
3795
- ."$email"
3796
- ."&nbsp;<img src='".plugins_url()."/cleantalk-spam-protect/inc/images/new_window.gif' border='0' style='float:none; box-shadow: transparent 0 0 0 !important;'/>"
3797
- ."</a>";
3798
- else
3799
- echo __('No email', 'cleantalk-spam-protect');
3800
- echo "&nbsp;|&nbsp;";
3801
-
3802
- // Outputs IP if exists
3803
- if($ip)
3804
- echo "<a href='https://cleantalk.org/blacklists/$ip' target='_blank' title='https://cleantalk.org/blacklists/$ip'>"
3805
- ."$ip"
3806
- ."&nbsp;<img src='".plugins_url()."/cleantalk-spam-protect/inc/images/new_window.gif' border='0' style='float:none; box-shadow: transparent 0 0 0 !important;'/>"
3807
- ."</a>";
3808
- else
3809
- echo __('No IP', 'cleantalk-spam-protect');
3810
- echo '&nbsp;|&nbsp;';
3811
-
3812
- echo "<span commentid='$id' class='ct_this_is ct_this_is_spam' href='#'>".__('Mark as spam', 'cleantalk-spam-protect')."</span>";
3813
- echo "<span commentid='$id' class='ct_this_is ct_this_is_not_spam ct_hidden' href='#'>".__('Unspam', 'cleantalk-spam-protect')."</span>";
3814
- echo "<p class='ct_feedback_wrap'>";
3815
- echo "<span class='ct_feedback_result ct_feedback_result_spam'>".__('Marked as spam.', 'cleantalk-spam-protect')."</span>";
3816
- echo "<span class='ct_feedback_result ct_feedback_result_not_spam'>".__('Marked as not spam.', 'cleantalk-spam-protect')."</span>";
3817
- echo "&nbsp;<span class='ct_feedback_msg'><span>";
3818
- echo "</p>";
3819
-
3820
- echo "</div>";
3821
-
3822
- // @todo research what such themes and make exception for them
3823
- $ending_tag = $wp_list_comments_args['style'];
3824
- if( in_array( $apbct->active_theme, array( 'Paperio', 'Twenty Twenty' ) ) ){
3825
- $ending_tag = is_null($wp_list_comments_args['style']) ? 'div' : $wp_list_comments_args['style'];
3826
- };
3827
-
3828
- // Ending comment output
3829
- echo "</{$ending_tag}>";
3830
- }
3831
-
3832
- /**
3833
- * Callback function for the bootom comment output.
3834
- *
3835
- * attrs = array()
3836
- */
3837
- function apbct_shrotcode_handler__GDPR_public_notice__form( $attrs ){
3838
-
3839
- $out = '';
3840
-
3841
- if(isset($attrs['id']))
3842
- $out .= 'ctPublicGDPR.gdpr_forms.push("'.$attrs['id'].'");';
3843
-
3844
- if(isset($attrs['text']))
3845
- $out .= 'ctPublicGDPR.gdpr_text = "'.$attrs['text'].'";';
3846
-
3847
- $out = '<script>'.$out.'</script>';
3848
- return $out;
3849
- }
3850
-
3851
- /**
3852
- * Filters the 'status' array before register the user
3853
- * using only by WICITY theme
3854
- *
3855
- * @param $success array array( 'status' => 'success' )
3856
- * @param $data array ['username'] ['password'] ['email']
3857
- * @return array array( 'status' => 'error' ) or array( 'status' => 'success' ) by default
3858
- */
3859
- function apbct_wilcity_reg_validation( $success, $data ) {
3860
- $check = ct_test_registration( $data['username'], $data['email'], '' );
3861
- if( $check['allow'] == 0 ) {
3862
- return array( 'status' => 'error' );
3863
- }
3864
- return $success;
3865
- }
3866
-
3867
- // Enfold Theme contact form
3868
- function apbct_form__enfold_contact_form__test_spam( $send, $new_post, $form_params, $obj ){
3869
-
3870
- global $cleantalk_executed;
3871
-
3872
- $url_decoded_data = array();
3873
- foreach( $new_post as $key => $value ) {
3874
- $url_decoded_data[$key] = urldecode($value);
3875
- }
3876
-
3877
- $data = ct_get_fields_any( $url_decoded_data );
3878
-
3879
- $base_call_result = apbct_base_call(
3880
- array(
3881
- 'message' => !empty( $data['message'] ) ? json_encode( $data['message'] ) : '',
3882
- 'sender_email' => !empty( $data['email'] ) ? $data['email'] : '',
3883
- 'sender_nickname' => !empty( $data['nickname'] ) ? $data['nickname'] : '',
3884
- 'post_info' => array(
3885
- 'comment_type' => 'contact_form_wordpress_enfold'
3886
- ),
3887
- )
3888
- );
3889
-
3890
- $ct_result = $base_call_result['ct_result'];
3891
-
3892
- $cleantalk_executed = true;
3893
-
3894
- if( $ct_result->allow == 0 ) {
3895
- $obj->submit_error = $ct_result->comment;
3896
- return null;
3897
- }
3898
-
3899
- return $send;
3900
-
3901
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Init functions
5
+ * @return mixed[] Array of options
6
+ */
7
+ function apbct_init() {
8
+
9
+ global $ct_wplp_result_label, $ct_jp_comments, $ct_post_data_label, $ct_post_data_authnet_label, $apbct, $test_external_forms, $cleantalk_executed, $wpdb;
10
+
11
+ //Check internal forms with such "action" http://wordpress.loc/contact-us/some_script.php
12
+ if((isset($_POST['action']) && $_POST['action'] == 'ct_check_internal') &&
13
+ $apbct->settings['check_internal']
14
+ ){
15
+ $ct_result = ct_contact_form_validate();
16
+ if($ct_result == null){
17
+ echo 'true';
18
+ die();
19
+ }else{
20
+ echo $ct_result;
21
+ die();
22
+ }
23
+ }
24
+
25
+ //fix for EPM registration form
26
+ if(isset($_POST) && isset($_POST['reg_email']) && shortcode_exists( 'epm_registration_form' ))
27
+ {
28
+ unset($_POST['ct_checkjs_register_form']);
29
+ }
30
+
31
+ if(isset($_POST['_wpnonce-et-pb-contact-form-submitted']))
32
+ {
33
+ add_shortcode( 'et_pb_contact_form', 'ct_contact_form_validate' );
34
+ }
35
+
36
+ if($apbct->settings['check_external']){
37
+
38
+ // Fixing form and directs it this site
39
+ if($apbct->settings['check_external__capture_buffer'] && !is_admin() && !apbct_is_ajax() && !apbct_is_post() && apbct_is_user_enable() && !(defined('DOING_CRON') && DOING_CRON) && !(defined('XMLRPC_REQUEST') && XMLRPC_REQUEST)){
40
+
41
+ if (defined('CLEANTALK_CAPTURE_BUFFER_SPECIFIC_URL') && is_string(CLEANTALK_CAPTURE_BUFFER_SPECIFIC_URL)) {
42
+ $catch_buffer = false;
43
+ $urls = explode(',', CLEANTALK_CAPTURE_BUFFER_SPECIFIC_URL);
44
+ foreach ($urls as $url) {
45
+ if (apbct_is_in_uri($url))
46
+ $catch_buffer = true;
47
+ }
48
+ }else{
49
+ $catch_buffer = true;
50
+ }
51
+
52
+ if( $catch_buffer ){
53
+ add_action('wp', 'apbct_buffer__start');
54
+ add_action('shutdown', 'apbct_buffer__end', 0);
55
+ add_action('shutdown', 'apbct_buffer__output', 2);
56
+ }
57
+ }
58
+
59
+ // Check and redirecct
60
+ if( apbct_is_post()
61
+ && isset($_POST['cleantalk_hidden_method'])
62
+ && isset($_POST['cleantalk_hidden_action'])
63
+ ){
64
+ $action = htmlspecialchars($_POST['cleantalk_hidden_action']);
65
+ $method = htmlspecialchars($_POST['cleantalk_hidden_method']);
66
+ unset($_POST['cleantalk_hidden_action']);
67
+ unset($_POST['cleantalk_hidden_method']);
68
+ ct_contact_form_validate();
69
+ if(!apbct_is_ajax()){
70
+ print "<html><body><form method='$method' action='$action'>";
71
+ ct_print_form($_POST, '');
72
+ print "</form></body></html>";
73
+ print "<script>
74
+ if(document.forms[0].submit !== 'undefined'){
75
+ var objects = document.getElementsByName('submit');
76
+ if(objects.length > 0)
77
+ document.forms[0].removeChild(objects[0]);
78
+ }
79
+ document.forms[0].submit();
80
+ </script>";
81
+ die();
82
+ }
83
+ }
84
+ }
85
+
86
+ if(isset($_POST['quform_ajax'], $_POST['quform_csrf_token'], $_POST['quform_form_id'])){
87
+ require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-ajax.php');
88
+ ct_ajax_hook();
89
+ }
90
+
91
+ /**hooks for cm answers pro */
92
+ if(defined('CMA_PLUGIN_FILE')){
93
+ add_action( 'wp', 'ct_ajax_hook',1 );
94
+ }
95
+
96
+ //hook for Anonymous Post
97
+ if($apbct->settings['general_postdata_test'] == 1 && empty($_POST['ct_checkjs_cf7']))
98
+ add_action('wp', 'ct_contact_form_validate_postdata',1);
99
+
100
+ if($apbct->settings['general_contact_forms_test'] == 1 && empty($_POST['ct_checkjs_cf7'])){
101
+ add_action('CMA_custom_post_type_nav', 'ct_contact_form_validate_postdata',1);
102
+ //add_action('init','ct_contact_form_validate',1);
103
+ ct_contact_form_validate();
104
+ if(isset($_POST['reg_redirect_link'])&&isset($_POST['tmpl_registration_nonce_field']))
105
+ {
106
+ unset($_POST['ct_checkjs_register_form']);
107
+ ct_contact_form_validate();
108
+ }
109
+ /*if(isset($_GET['ait-action'])&&$_GET['ait-action']=='register')
110
+ {
111
+ $tmp=$_POST['redirect_to'];
112
+ unset($_POST['redirect_to']);
113
+ ct_contact_form_validate();
114
+ $_POST['redirect_to']=$tmp;
115
+ }*/
116
+ }
117
+
118
+ if($apbct->settings['general_postdata_test'] == 1 && empty($_POST['ct_checkjs_cf7']))
119
+ add_action('CMA_custom_post_type_nav', 'ct_contact_form_validate_postdata',1);
120
+
121
+ //add_action('wp_footer','ct_ajaxurl');
122
+
123
+ // Fast Secure contact form
124
+ if(defined('FSCF_VERSION')){
125
+ add_filter('si_contact_display_after_fields', 'ct_si_contact_display_after_fields');
126
+ add_filter('si_contact_form_validate', 'ct_si_contact_form_validate');
127
+ }
128
+
129
+ // WooCommerce registration
130
+ if(class_exists('WooCommerce')){
131
+ add_filter( 'woocommerce_registration_errors', 'ct_registration_errors', 1, 3 );
132
+ if ($apbct->settings['wc_checkout_test'] == 1) {
133
+ add_filter('woocommerce_checkout_process', 'ct_woocommerce_checkout_check', 1, 3);
134
+ }
135
+ if( isset($_REQUEST['wc-ajax']) && $_REQUEST['wc-ajax'] == 'checkout' && $apbct->settings['wc_checkout_test'] == 0 && $apbct->settings['wc_register_from_order'] == 0 ){
136
+ remove_filter( 'woocommerce_registration_errors', 'ct_registration_errors', 1 );
137
+ }
138
+ }
139
+
140
+ // WooCommerce whishlist
141
+ if(class_exists('WC_Wishlists_Wishlist'))
142
+ add_filter('wc_wishlists_create_list_args', 'ct_woocommerce_wishlist_check', 1, 1);
143
+
144
+
145
+ // JetPack Contact form
146
+ $jetpack_active_modules = false;
147
+ if(defined('JETPACK__VERSION'))
148
+ {
149
+ if(isset($_POST['action']) && $_POST['action'] == 'grunion-contact-form' ){
150
+ if(JETPACK__VERSION=='3.4-beta')
151
+ {
152
+ add_filter('contact_form_is_spam', 'ct_contact_form_is_spam');
153
+ }
154
+ else if(JETPACK__VERSION=='3.4-beta2'||JETPACK__VERSION>='3.4')
155
+ {
156
+ add_filter('jetpack_contact_form_is_spam', 'ct_contact_form_is_spam_jetpack',50,2);
157
+ }
158
+ else
159
+ {
160
+ add_filter('contact_form_is_spam', 'ct_contact_form_is_spam');
161
+ }
162
+ $jetpack_active_modules = get_option('jetpack_active_modules');
163
+ if ((class_exists( 'Jetpack', false) && $jetpack_active_modules && in_array('comments', $jetpack_active_modules)))
164
+ {
165
+ $ct_jp_comments = true;
166
+ }
167
+ }else
168
+ add_filter('grunion_contact_form_field_html', 'ct_grunion_contact_form_field_html', 10, 2);
169
+ }
170
+
171
+ // WP Maintenance Mode (wpmm)
172
+ add_action('wpmm_head', 'apbct_form__wpmm__addField', 1);
173
+
174
+ // Contact Form7
175
+ if(defined('WPCF7_VERSION')){
176
+ add_filter('wpcf7_form_elements', 'apbct_form__contactForm7__addField');
177
+ add_filter('wpcf7_validate', 'apbct_form__contactForm7__tesSpam__before_validate', 999, 2);
178
+ add_filter(WPCF7_VERSION >= '3.0.0' ? 'wpcf7_spam' : 'wpcf7_acceptance', 'apbct_form__contactForm7__testSpam');
179
+ }
180
+
181
+ // Formidable
182
+ add_filter( 'frm_entries_before_create', 'apbct_rorm__formidable__testSpam', 10, 2 );
183
+ add_action( 'frm_entries_footer_scripts', 'apbct_rorm__formidable__footerScripts', 20, 2 );
184
+
185
+ // BuddyPress
186
+ if(class_exists('BuddyPress')){
187
+ add_action('bp_before_registration_submit_buttons','ct_register_form',1);
188
+ add_action('messages_message_before_save', 'apbct_integration__buddyPres__private_msg_check', 1);
189
+ add_filter('bp_signup_validate', 'ct_registration_errors',1);
190
+ add_filter('bp_signup_validate', 'ct_check_registration_erros', 999999);
191
+ }
192
+
193
+ if(defined('PROFILEPRESS_SYSTEM_FILE_PATH')){
194
+ add_filter('pp_registration_validation', 'ct_registration_errors_ppress', 11, 2);
195
+ }
196
+
197
+
198
+ // bbPress
199
+ if(class_exists('bbPress')){
200
+ add_filter('bbp_new_topic_pre_title', 'ct_bbp_get_topic', 1);
201
+ add_filter('bbp_new_topic_pre_content', 'ct_bbp_new_pre_content', 1);
202
+ add_filter('bbp_new_reply_pre_content', 'ct_bbp_new_pre_content', 1);
203
+ add_action('bbp_theme_before_topic_form_content', 'ct_comment_form');
204
+ add_action('bbp_theme_before_reply_form_content', 'ct_comment_form');
205
+ }
206
+
207
+ //Custom Contact Forms
208
+ if(defined('CCF_VERSION'))
209
+ add_filter('ccf_field_validator', 'ct_ccf', 1, 4);
210
+
211
+ add_action('comment_form', 'ct_comment_form');
212
+
213
+ // intercept WordPress Landing Pages POST
214
+ if (defined('LANDINGPAGES_CURRENT_VERSION') && !empty($_POST)){
215
+ if(array_key_exists('action', $_POST) && $_POST['action'] === 'inbound_store_lead'){ // AJAX action(s)
216
+ ct_check_wplp();
217
+ }else if(array_key_exists('inbound_submitted', $_POST) && $_POST['inbound_submitted'] == '1'){ // Final submit
218
+ ct_check_wplp();
219
+ }
220
+ }
221
+
222
+ // S2member. intercept POST
223
+ if (defined('WS_PLUGIN__S2MEMBER_PRO_VERSION')){
224
+ $post_keys = array_keys($_POST);
225
+ foreach($post_keys as $post_key){
226
+
227
+ // Detect POST keys like /s2member_pro.*registration/
228
+ if(strpos($post_key, 's2member') !== false && strpos($post_key, 'registration') !== false){
229
+ ct_s2member_registration_test($post_key);
230
+ break;
231
+ }
232
+ }
233
+ }
234
+
235
+ // New user approve hack
236
+ // https://wordpress.org/plugins/new-user-approve/
237
+ if (ct_plugin_active('new-user-approve/new-user-approve.php')) {
238
+ add_action('register_post', 'ct_register_post', 1, 3);
239
+ }
240
+
241
+ // Wilcity theme registration validation fix
242
+ add_filter( 'wilcity/filter/wiloke-listing-tools/validate-before-insert-account', 'apbct_wilcity_reg_validation', 10, 2 );
243
+
244
+
245
+ // Gravity forms
246
+ if (defined('GF_MIN_WP_VERSION')) {
247
+ add_filter('gform_get_form_filter', 'apbct_form__gravityForms__addField', 10, 2);
248
+ add_filter('gform_entry_is_spam', 'apbct_form__gravityForms__testSpam', 999, 3);
249
+ add_filter('gform_confirmation', 'apbct_form__gravityForms__showResponse', 999, 4 );
250
+ }
251
+
252
+ //Pirate forms
253
+ if(defined('PIRATE_FORMS_VERSION')){
254
+ if(isset($_POST['pirate-forms-contact-name']) && $_POST['pirate-forms-contact-name'] && isset($_POST['pirate-forms-contact-email']) && $_POST['pirate-forms-contact-email'])
255
+ apbct_form__piratesForm__testSpam();
256
+ }
257
+
258
+ // WPForms
259
+ // Adding fields
260
+ add_action('wpforms_frontend_output', 'apbct_form__WPForms__addField', 1000, 5);
261
+ // Gathering data to validate
262
+ add_filter('wpforms_process_before_filter', 'apbct_from__WPForms__gatherData', 100, 2);
263
+ // Do spam check
264
+ add_filter('wpforms_process_initial_errors', 'apbct_form__WPForms__showResponse', 100, 2);
265
+
266
+ // QForms integration
267
+ add_filter( 'quform_post_validate', 'ct_quform_post_validate', 10, 2 );
268
+
269
+ // Ultimate Members
270
+ if (class_exists('UM')) {
271
+ add_action('um_main_register_fields','ct_register_form',100); // Add hidden fileds
272
+ add_action( 'um_submit_form_register', 'apbct_registration__UltimateMembers__check', 9, 1 ); // Check submition
273
+ }
274
+
275
+ // Paid Memberships Pro integration
276
+ add_filter( 'pmpro_required_user_fields', function( $pmpro_required_user_fields ){
277
+
278
+ if(
279
+ ! empty( $pmpro_required_user_fields['username'] ) &&
280
+ ! empty( $pmpro_required_user_fields['bemail'] ) &&
281
+ ! empty( $pmpro_required_user_fields['bconfirmemail'] ) &&
282
+ $pmpro_required_user_fields['bemail'] == $pmpro_required_user_fields['bconfirmemail']
283
+ ) {
284
+ $check = ct_test_registration( $pmpro_required_user_fields['username'], $pmpro_required_user_fields['bemail'], apbct_get_server_variable( 'REMOTE_ADDR' ) );
285
+ if( $check['allow'] == 0 ) {
286
+ pmpro_setMessage( $check['comment'], 'pmpro_error' );
287
+ }
288
+ }
289
+
290
+ return $pmpro_required_user_fields;
291
+
292
+ } );
293
+
294
+ //
295
+ // Load JS code to website footer
296
+ //
297
+ if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)) {
298
+ add_action('wp_head', 'apbct_hook__wp_head__set_cookie__ct_checkjs', 1);
299
+ add_action('wp_footer', 'apbct_hook__wp_footer', 1);
300
+ }
301
+
302
+ if ($apbct->settings['protect_logged_in'] != 1 && is_user_logged_in()) {
303
+ ct_contact_form_validate();
304
+ }
305
+
306
+ if (apbct_is_user_enable()) {
307
+
308
+ if ($apbct->settings['general_contact_forms_test'] == 1 && !isset($_POST['comment_post_ID']) && !isset($_GET['for'])){
309
+ add_action( 'init', 'ct_contact_form_validate', 999 );
310
+ }
311
+ if( apbct_is_post() &&
312
+ $apbct->settings['general_postdata_test'] == 1 &&
313
+ !isset($_POST['ct_checkjs_cf7']) &&
314
+ !is_admin() &&
315
+ !apbct_is_user_role_in(array('administrator', 'moderator'))
316
+ ){
317
+ ct_contact_form_validate_postdata();
318
+ }
319
+ }
320
+ }
321
+
322
+ function apbct_buffer__start(){
323
+ ob_start();
324
+ }
325
+
326
+ function apbct_buffer__end(){
327
+
328
+ if(!ob_get_level())
329
+ return;
330
+
331
+ global $apbct;
332
+ $apbct->buffer = ob_get_contents();
333
+ ob_end_clean();
334
+ }
335
+
336
+ /**
337
+ * Outputs changed buffer
338
+ *
339
+ * @global $apbct
340
+ */
341
+ function apbct_buffer__output(){
342
+
343
+ global $apbct, $wp;
344
+
345
+ if(empty($apbct->buffer))
346
+ return;
347
+
348
+ $site_url = get_option('siteurl');
349
+ $site__host = parse_url($site_url, PHP_URL_HOST);
350
+
351
+ $dom = new DOMDocument();
352
+ @$dom->loadHTML($apbct->buffer);
353
+
354
+ $forms = $dom->getElementsByTagName('form');
355
+
356
+ foreach($forms as $form){
357
+
358
+ $action = $form->getAttribute('action');
359
+ $action = $action ? $action : $site_url;
360
+ $action__host = parse_url($action, PHP_URL_HOST);
361
+
362
+ // Check if the form directed to the third party site
363
+ if($site__host != $action__host){
364
+
365
+ $method = $form->getAttribute('method');
366
+ $method = $method ? $method : 'get';
367
+ // Directs form to our site
368
+ $form->setAttribute('method', 'POST');
369
+ $form->setAttribute('action', home_url(add_query_arg(array(), $wp->request)));
370
+
371
+ // Add cleantalk_hidden_action
372
+ $new_input = $dom->createElement('input');
373
+ $new_input->setAttribute('type', 'hidden');
374
+ $new_input->setAttribute('name', 'cleantalk_hidden_action');
375
+ $new_input->setAttribute('value', $action);
376
+ $form->appendChild($new_input);
377
+
378
+ // Add cleantalk_hidden_method
379
+ $new_input = $dom->createElement('input');
380
+ $new_input->setAttribute('type', 'hidden');
381
+ $new_input->setAttribute('name', 'cleantalk_hidden_method');
382
+ $new_input->setAttribute('value', $method);
383
+ $form->appendChild($new_input);
384
+
385
+ }
386
+
387
+ } unset($form);
388
+
389
+ $html = $dom->getElementsByTagName('html');
390
+
391
+ $output = gettype($html) == 'object' && isset($html[0], $html[0]->childNodes, $html[0]->childNodes[0])
392
+ ? $dom->saveHTML()
393
+ : $apbct->buffer;
394
+
395
+ echo $output;
396
+ die();
397
+ }
398
+
399
+ // MailChimp Premium for Wordpress
400
+ function ct_add_mc4wp_error_message($messages){
401
+
402
+ $messages['ct_mc4wp_response'] = array(
403
+ 'type' => 'error',
404
+ 'text' => 'Your message looks like spam.'
405
+ );
406
+ return $messages;
407
+ }
408
+ add_filter( 'mc4wp_form_messages', 'ct_add_mc4wp_error_message' );
409
+
410
+ /*
411
+ * Function to set validate fucntion for CCF form
412
+ * Input - Сonsistently each form field
413
+ * Returns - String. Validate function
414
+ */
415
+ function ct_ccf($callback, $value, $field_id, $type){
416
+ /*
417
+ if($type == 'name')
418
+ $ct_global_temporary_data['name'] = $value;
419
+ elseif($type == 'email')
420
+ $ct_global_temporary_data['email'] = $value;
421
+ else
422
+ $ct_global_temporary_data[] = $value;
423
+ //*/
424
+ return 'ct_validate_ccf_submission';
425
+ }
426
+ /*
427
+ * Validate function for CCF form. Gatheering data. Multiple calls.
428
+ * Input - void. Global $ct_global_temporary_data
429
+ * Returns - String. CleanTalk comment.
430
+ */
431
+ $ct_global_temporary_data = array();
432
+ function ct_validate_ccf_submission($value, $field_id, $required){
433
+ global $ct_global_temporary_data, $apbct;
434
+
435
+
436
+
437
+ //If the check for contact forms enabled
438
+ if(!$apbct->settings['contact_forms_test']) {
439
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
440
+ return true;
441
+ }
442
+
443
+ //If the check for logged in users enabled
444
+ if($apbct->settings['protect_logged_in'] == 1 && is_user_logged_in()) {
445
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
446
+ return true;
447
+ }
448
+
449
+
450
+ //Accumulate data
451
+ $ct_global_temporary_data[] = $value;
452
+
453
+ //If it's the last field of the form
454
+ (!isset($ct_global_temporary_data['count']) ? $ct_global_temporary_data['count'] = 1 : $ct_global_temporary_data['count']++);
455
+ $form_id = $_POST['form_id'];
456
+ if($ct_global_temporary_data['count'] != count(get_post_meta( $form_id, 'ccf_attached_fields', true ))) {
457
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
458
+ return true;
459
+ }
460
+
461
+ unset($ct_global_temporary_data['count']);
462
+
463
+ //Getting request params
464
+ $ct_temp_msg_data = ct_get_fields_any($_POST);
465
+
466
+ unset($ct_global_temporary_data);
467
+
468
+ $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
469
+ $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
470
+ $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
471
+ $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
472
+ $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
473
+
474
+ if ($subject != '')
475
+ $message['subject'] = $subject;
476
+
477
+ $post_info['comment_type'] = 'feedback_custom_contact_forms';
478
+ $post_info['post_url'] = apbct_get_server_variable( 'HTTP_REFERER' );
479
+
480
+ $checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
481
+ ? apbct_js_test('ct_checkjs', $_COOKIE)
482
+ : apbct_js_test('ct_checkjs', $_POST);
483
+
484
+ //Making a call
485
+ $base_call_result = apbct_base_call(
486
+ array(
487
+ 'message' => $message,
488
+ 'sender_email' => $sender_email,
489
+ 'sender_nickname' => $sender_nickname,
490
+ 'post_info' => $post_info,
491
+ 'js_on' => $checkjs,
492
+ 'sender_info' => array('sender_url' => null),
493
+ )
494
+ );
495
+
496
+ $ct_result = $base_call_result['ct_result'];
497
+
498
+ return $ct_result->allow == 0 ? $ct_result->comment : true;;
499
+ }
500
+
501
+ function ct_woocommerce_wishlist_check($args){
502
+ global $apbct;
503
+
504
+
505
+
506
+ //Protect logged in users
507
+ if($args['wishlist_status'])
508
+ if($apbct->settings['protect_logged_in'] == 0) {
509
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
510
+ return $args;
511
+ }
512
+
513
+
514
+ //If the IP is a Google bot
515
+ $hostname = gethostbyaddr( apbct_get_server_variable( 'REMOTE_ADDR' ) );
516
+ if(!strpos($hostname, 'googlebot.com')) {
517
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
518
+ return $args;
519
+ }
520
+
521
+
522
+ //Getting request params
523
+ $message = '';
524
+ $subject = '';
525
+ $email = $args['wishlist_owner_email'];
526
+ if($args['wishlist_first_name']!='' || $args['wishlist_last_name']!='')
527
+ $nickname = trim($args['wishlist_first_name']." ".$args['wishlist_last_name']);
528
+ else
529
+ $nickname = '';
530
+
531
+ $post_info['comment_type'] = 'feedback';
532
+ $post_info['post_url'] = apbct_get_server_variable( 'HTTP_REFERER' );
533
+
534
+ $checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
535
+ ? apbct_js_test('ct_checkjs', $_COOKIE)
536
+ : apbct_js_test('ct_checkjs', $_POST);
537
+
538
+ //Making a call
539
+ $base_call_result = apbct_base_call(
540
+ array(
541
+ 'message' => $subject." ".$message,
542
+ 'sender_email' => $email,
543
+ 'sender_nickname' => $nickname,
544
+ 'post_info' => $post_info,
545
+ 'js_on' => $checkjs,
546
+ 'sender_info' => array('sender_url' => null),
547
+ )
548
+ );
549
+
550
+ $ct_result = $base_call_result['ct_result'];
551
+
552
+ if ($ct_result->allow == 0)
553
+ wp_die("<h1>".__('Spam protection by CleanTalk', 'cleantalk-spam-protect')."</h1><h2>".$ct_result->comment."</h2>", '', array('response' => 403, "back_link" => true, "text_direction" => 'ltr'));
554
+ else
555
+ return $args;
556
+ }
557
+
558
+ function apbct_integration__buddyPres__getTemplateName( $located, $template_name, $template_names, $template_locations, $load, $require_once ) {
559
+ global $apbct;
560
+ preg_match("/\/([a-z-_]+)\/buddypress-functions\.php$/", $located, $matches);
561
+ $apbct->buddy_press_tmpl = isset($matches[1]) ? $matches[1] : 'unknown';
562
+ }
563
+
564
+ /**
565
+ * Test BuddyPress activity for spam (post update only)
566
+ *
567
+ * @global SpbcState $apbct
568
+ * @param bool $is_spam
569
+ * @param BP_Activity_Activity $activity_obj Activity object (\plugins\buddypress\bp-activity\classes\class-bp-activity-activity.php)
570
+ * @return boolean Spam flag
571
+ */
572
+ function apbct_integration__buddyPres__activityWall( $is_spam, $activity_obj = null ){
573
+
574
+ global $apbct;
575
+
576
+ $allowed_post_actions = array('post_update', 'new_activity_comment');
577
+
578
+ if( ! in_array(\Cleantalk\Variables\Post::get('action'), $allowed_post_actions) ||
579
+ $activity_obj === null ||
580
+ ! \Cleantalk\Variables\Post::get('action') ||
581
+ $activity_obj->privacy == 'media' ||
582
+ apbct_exclusions_check()
583
+ ) {
584
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
585
+ return false;
586
+ }
587
+
588
+ $curr_user = get_user_by('id', $activity_obj->user_id);
589
+
590
+ //Making a call
591
+ $base_call_result = apbct_base_call(
592
+ array(
593
+ 'message' => is_string($activity_obj->content) ? $activity_obj->content : '',
594
+ 'sender_email' => $curr_user->data->user_email,
595
+ 'sender_nickname' => $curr_user->data->user_login,
596
+ 'post_info' => array(
597
+ 'post_url' => apbct_get_server_variable( 'HTTP_REFERER' ),
598
+ 'comment_type' => 'buddypress_activitywall',
599
+ ),
600
+ 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE),
601
+ 'sender_info' => array('sender_url' => null),
602
+ )
603
+ );
604
+
605
+ $ct_result = $base_call_result['ct_result'];
606
+
607
+ if ($ct_result->allow == 0){
608
+ add_action('bp_activity_after_save', 'apbct_integration__buddyPres__activityWall_showResponse', 1, 1);
609
+ $apbct->spam_notification = $ct_result->comment;
610
+ return true;
611
+ }else
612
+ return $is_spam;
613
+ }
614
+
615
+ /**
616
+ * Outputs message to AJAX frontend handler
617
+ *
618
+ * @global SpbcState $apbct
619
+ * @param BP_Activity_Activity $activity_obj Activity object (\plugins\buddypress\bp-activity\classes\class-bp-activity-activity.php)
620
+ */
621
+ function apbct_integration__buddyPres__activityWall_showResponse( $activity_obj ){
622
+
623
+ global $apbct;
624
+
625
+ // Legacy template
626
+ if($apbct->buddy_press_tmpl === 'bp-legacy'){
627
+ die('<div id="message" class="error bp-ajax-message"><p>'. $apbct->spam_notification .'</p></div>');
628
+ // Nouveau tamplate and others
629
+ }else{
630
+ @header( 'Content-Type: application/json; charset=' . get_option('blog_charset'));
631
+ die(json_encode(array(
632
+ 'success' => false,
633
+ 'data' => array('message' => $apbct->spam_notification),
634
+ )));
635
+ }
636
+ }
637
+
638
+ /**
639
+ * Public function - Tests new private messages (dialogs)
640
+ *
641
+ * @global SpbcState $apbct
642
+ * @param type $bp_message_obj
643
+ * @return void|array with errors if spam has found
644
+ */
645
+ function apbct_integration__buddyPres__private_msg_check( $bp_message_obj){
646
+
647
+ global $apbct;
648
+
649
+ //Check for enabled option
650
+ if(
651
+ $apbct->settings['bp_private_messages'] == 0 ||
652
+ apbct_exclusions_check()
653
+ ) {
654
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
655
+ return;
656
+ }
657
+
658
+
659
+ //Check for quantity of comments
660
+ $comments_check_number = defined('CLEANTALK_CHECK_COMMENTS_NUMBER')
661
+ ? CLEANTALK_CHECK_COMMENTS_NUMBER
662
+ : 3;
663
+
664
+ if($apbct->settings['check_comments_number']){
665
+ $args = array(
666
+ 'user_id' => $bp_message_obj->sender_id,
667
+ 'box' => 'sentbox',
668
+ 'type' => 'all',
669
+ 'limit' => $comments_check_number,
670
+ 'page' => null,
671
+ 'search_terms' => '',
672
+ 'meta_query' => array()
673
+ );
674
+ $sentbox_msgs = BP_Messages_Thread::get_current_threads_for_user($args);
675
+ $cnt_sentbox_msgs = $sentbox_msgs['total'];
676
+ $args['box'] = 'inbox';
677
+ $inbox_msgs = BP_Messages_Thread::get_current_threads_for_user($args);
678
+ $cnt_inbox_msgs = $inbox_msgs['total'];
679
+
680
+ if(($cnt_inbox_msgs + $cnt_sentbox_msgs) >= $comments_check_number)
681
+ $is_max_comments = true;
682
+ }
683
+
684
+ if(!empty($is_max_comments)) {
685
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
686
+ return;
687
+ }
688
+
689
+
690
+ $sender_user_obj = get_user_by('id', $bp_message_obj->sender_id);
691
+
692
+ //Making a call
693
+ $base_call_result = apbct_base_call(
694
+ array(
695
+ 'message' => $bp_message_obj->subject." ".$bp_message_obj->message,
696
+ 'sender_email' => $sender_user_obj->data->user_email,
697
+ 'sender_nickname' => $sender_user_obj->data->user_login,
698
+ 'post_info' => array(
699
+ 'comment_type' => 'buddypress_comment',
700
+ 'post_url' => apbct_get_server_variable( 'HTTP_REFERER' ),
701
+ ),
702
+ 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE)
703
+ ? apbct_js_test('ct_checkjs', $_COOKIE)
704
+ : apbct_js_test('ct_checkjs', $_POST),
705
+ 'sender_info' => array('sender_url' => null),
706
+ )
707
+ );
708
+
709
+ $ct_result = $base_call_result['ct_result'];
710
+
711
+ if ($ct_result->allow == 0)
712
+ wp_die("<h1>".__('Spam protection by CleanTalk', 'cleantalk-spam-protect')."</h1><h2>".$ct_result->comment."</h2>", '', array('response' => 403, "back_link" => true, "text_direction" => 'ltr'));
713
+ }
714
+
715
+ /**
716
+ * Adds hiden filed to deafualt serach form
717
+ *
718
+ * @param $form string
719
+ * @return string
720
+ */
721
+ function apbct_forms__search__addField( $form ){
722
+ global $apbct;
723
+ if($apbct->settings['search_test'] == 1){
724
+ $js_filed = ct_add_hidden_fields('ct_checkjs_search_default', true, false, false, false);
725
+ $form = str_replace('</form>', $js_filed, $form);
726
+ }
727
+ return $form;
728
+ }
729
+
730
+ /**
731
+ * Test default search string for spam
732
+ *
733
+ * @param $search string
734
+ * @return string
735
+ */
736
+ function apbct_forms__search__testSpam( $search ){
737
+
738
+ global $apbct, $cleantalk_executed;
739
+
740
+ if(
741
+ empty($search) ||
742
+ $cleantalk_executed ||
743
+ $apbct->settings['search_test'] == 0 ||
744
+ $apbct->settings['protect_logged_in'] != 1 && is_user_logged_in() // Skip processing for logged in users.
745
+ ){
746
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
747
+ return $search;
748
+ }
749
+
750
+ if(apbct_is_user_logged_in())
751
+ $user = wp_get_current_user();
752
+
753
+ $base_call_result = apbct_base_call(
754
+ array(
755
+ 'message' => $search,
756
+ 'sender_email' => !empty($user) ? $user->user_email : null,
757
+ 'sender_nickname' => !empty($user) ? $user->user_login : null,
758
+ 'post_info' => array('comment_type' => 'site_search_wordpress'),
759
+ //'js_on' => apbct_js_test('ct_checkjs_search_default', $_GET, true),
760
+ )
761
+ );
762
+ $ct_result = $base_call_result['ct_result'];
763
+
764
+ $cleantalk_executed = true;
765
+
766
+ if ($ct_result->allow == 0){
767
+ die($ct_result->comment);
768
+ }
769
+
770
+ return $search;
771
+ }
772
+
773
+ function apbct_search_add_noindex() {
774
+
775
+ global $apbct;
776
+
777
+ if(
778
+ ! is_search() || // If it is search results
779
+ $apbct->settings['search_test'] == 0 ||
780
+ $apbct->settings['protect_logged_in'] != 1 && is_user_logged_in() // Skip processing for logged in users.
781
+ ){
782
+ return ;
783
+ }
784
+
785
+ echo '<!-- meta by Cleantalk AntiSpam Protection plugin -->' . "\n";
786
+ echo '<meta name="robots" content="noindex,nofollow" />' . "\n";
787
+
788
+ }
789
+
790
+ /**
791
+ * Test woocommerce checkout form for spam
792
+ *
793
+ */
794
+ function ct_woocommerce_checkout_check() {
795
+
796
+ //Getting request params
797
+ $ct_temp_msg_data = ct_get_fields_any($_POST);
798
+
799
+ $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
800
+ $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
801
+ $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
802
+ $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
803
+ $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
804
+
805
+ if($subject != '')
806
+ $message = array_merge(array('subject' => $subject), $message);
807
+
808
+ $post_info['comment_type'] = 'order';
809
+ $post_info['post_url'] = apbct_get_server_variable( 'HTTP_REFERER' );
810
+
811
+ //Making a call
812
+ $base_call_result = apbct_base_call(
813
+ array(
814
+ 'message' => $message,
815
+ 'sender_email' => $sender_email,
816
+ 'sender_nickname' => $sender_nickname,
817
+ 'post_info' => $post_info,
818
+ 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE),
819
+ 'sender_info' => array('sender_url' => null),
820
+ )
821
+ );
822
+
823
+ $ct_result = $base_call_result['ct_result'];
824
+
825
+ if ($ct_result->allow == 0) {
826
+ wp_send_json(array(
827
+ 'result' => 'failure',
828
+ 'messages' => "<ul class=\"woocommerce-error\"><li>".$ct_result->comment."</li></ul>",
829
+ 'refresh' => 'false',
830
+ 'reload' => 'false'
831
+ ));
832
+ }
833
+ }
834
+
835
+ /**
836
+ * Public function - Tests for Pirate contact froms
837
+ * return NULL
838
+ */
839
+ function apbct_form__piratesForm__testSpam(){
840
+
841
+ global $apbct;
842
+
843
+ //Check for enabled option
844
+ if( !$apbct->settings['contact_forms_test']) {
845
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
846
+ return;
847
+ }
848
+
849
+
850
+ //Getting request params
851
+ $ct_temp_msg_data = ct_get_fields_any($_POST);
852
+
853
+ $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
854
+ $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
855
+ $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
856
+ $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
857
+ $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
858
+
859
+ if($subject != '')
860
+ $message = array_merge(array('subject' => $subject), $message);
861
+
862
+ $post_info['comment_type'] = 'contact_form_wordpress_feedback_pirate';
863
+ $post_info['post_url'] = apbct_get_server_variable( 'HTTP_REFERER' );
864
+
865
+ //Making a call
866
+ $base_call_result = apbct_base_call(
867
+ array(
868
+ 'message' => $message,
869
+ 'sender_email' => $sender_email,
870
+ 'sender_nickname' => $sender_nickname,
871
+ 'post_info' => $post_info,
872
+ 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE),
873
+ 'sender_info' => array('sender_url' => null),
874
+ )
875
+ );
876
+
877
+ $ct_result = $base_call_result['ct_result'];
878
+
879
+ if ($ct_result->allow == 0)
880
+ wp_die("<h1>".__('Spam protection by CleanTalk', 'cleantalk-spam-protect')."</h1><h2>".$ct_result->comment."</h2>", '', array('response' => 403, "back_link" => true, "text_direction" => 'ltr'));
881
+ }
882
+
883
+ /**
884
+ * Adds hidden filed to comment form
885
+ */
886
+ function ct_comment_form($post_id){
887
+
888
+ global $apbct;
889
+
890
+ if (apbct_is_user_enable() === false) {
891
+ return false;
892
+ }
893
+
894
+ if ( !$apbct->settings['comments_test']) {
895
+ return false;
896
+ }
897
+
898
+ ct_add_hidden_fields('ct_checkjs', false, false);
899
+
900
+ return null;
901
+ }
902
+
903
+ /**
904
+ * Adds cookie script filed to head
905
+ */
906
+ function apbct_hook__wp_head__set_cookie__ct_checkjs() {
907
+
908
+ ct_add_hidden_fields('ct_checkjs', false, true, true);
909
+
910
+ return null;
911
+ }
912
+
913
+ /**
914
+ * Adds cookie script filed to footer
915
+ */
916
+ function apbct_hook__wp_footer() {
917
+
918
+ //ct_add_hidden_fields(true, 'ct_checkjs', false, true, true);
919
+
920
+ return null;
921
+ }
922
+
923
+ /**
924
+ * Adds hidden filed to define avaialbility of client's JavaScript
925
+ * @param bool $random_key switch on generation random key for every page load
926
+ */
927
+ function ct_add_hidden_fields($field_name = 'ct_checkjs', $return_string = false, $cookie_check = false, $no_print = false, $ajax = true) {
928
+
929
+ global $ct_checkjs_def, $apbct;
930
+
931
+ $ct_checkjs_key = ct_get_checkjs_value();
932
+ $field_id_hash = md5(rand(0, 1000));
933
+
934
+ // Using only cookies
935
+ if ($cookie_check && $apbct->settings['set_cookies'] == 1) {
936
+
937
+ $html = "<script type='text/javascript'>
938
+ function ctSetCookie___from_backend(c_name, value) {
939
+ document.cookie = c_name + \"=\" + encodeURIComponent(value) + \"; path=/; samesite=lax\";
940
+ }
941
+ ctSetCookie___from_backend('{$field_name}', '{$ct_checkjs_key}', '{$ct_checkjs_def}');
942
+ </script>";
943
+
944
+ // Using AJAX to get key
945
+ }elseif($apbct->settings['use_ajax'] && $ajax){
946
+
947
+ // Fix only for wp_footer -> apbct_hook__wp_head__set_cookie__ct_checkjs()
948
+ if($no_print)
949
+ return;
950
+
951
+ $ct_input_challenge = sprintf("'%s'", $ct_checkjs_key);
952
+ $field_id = $field_name . '_' . $field_id_hash;
953
+ $html = "<input type='hidden' id='{$field_id}' name='{$field_name}' value='{$ct_checkjs_def}' />
954
+ <script type='text/javascript'>
955
+ window.addEventListener('load', function () {
956
+ setTimeout(function(){
957
+ apbct_public_sendAJAX(
958
+ {action: 'apbct_js_keys__get'},
959
+ {callback: apbct_js_keys__set_input_value, input_name: '{$field_id}'}
960
+ );
961
+ }, 1000);
962
+ });
963
+ </script>";
964
+
965
+ // Set KEY from backend
966
+ }else{
967
+ // Fix only for wp_footer -> apbct_hook__wp_head__set_cookie__ct_checkjs()
968
+ if($no_print)
969
+ return;
970
+
971
+ $ct_input_challenge = sprintf("'%s'", $ct_checkjs_key);
972
+ $field_id = $field_name . '_' . $field_id_hash;
973
+ $html = "<input type='hidden' id='{$field_id}' name='{$field_name}' value='{$ct_checkjs_def}' />
974
+ <script type='text/javascript'>
975
+ setTimeout(function(){
976
+ var ct_input_name = '{$field_id}';
977
+ if (document.getElementById(ct_input_name) !== null) {
978
+ var ct_input_value = document.getElementById(ct_input_name).value;
979
+ document.getElementById(ct_input_name).value = document.getElementById(ct_input_name).value.replace(ct_input_value, {$ct_input_challenge});
980
+ }
981
+ }, 1000);
982
+ </script>";
983
+ }
984
+
985
+ // Simplify JS code and Fixing issue with wpautop()
986
+ $html = str_replace(array("\n","\r","\t"),'', $html);
987
+
988
+ if ($return_string === true) {
989
+ return $html;
990
+ } else {
991
+ echo $html;
992
+ }
993
+ }
994
+
995
+ /**
996
+ * Public function - Insert JS code for spam tests
997
+ * return null;
998
+ */
999
+ function apbct_rorm__formidable__footerScripts($fields, $form) {
1000
+
1001
+ global $apbct, $ct_checkjs_frm;
1002
+
1003
+ if ( !$apbct->settings['contact_forms_test'])
1004
+ return false;
1005
+
1006
+ $ct_checkjs_key = ct_get_checkjs_value();
1007
+ $ct_frm_base_name = 'form_';
1008
+ $ct_frm_name = $ct_frm_base_name . $form->form_key;
1009
+
1010
+ echo "var input = document.createElement('input');
1011
+ input.setAttribute('type', 'hidden');
1012
+ input.setAttribute('name', '$ct_checkjs_frm');
1013
+ input.setAttribute('value', '$ct_checkjs_key');
1014
+ for (i = 0; i < document.forms.length; i++) {
1015
+ if (typeof document.forms[i].id == 'string'){
1016
+ if(document.forms[i].id.search('$ct_frm_name') != -1) {
1017
+ document.forms[i].appendChild(input);
1018
+ }
1019
+ }
1020
+ }";
1021
+
1022
+ /* Excessive cookie set
1023
+ $js_code = ct_add_hidden_fields(true, 'ct_checkjs', true, true);
1024
+ $js_code = strip_tags($js_code); // Removing <script> tag
1025
+ echo $js_code;
1026
+ //*/
1027
+ }
1028
+
1029
+ /**
1030
+ * Public function - Test Formidable data for spam activity
1031
+ * @param $errors
1032
+ * @param $form
1033
+ *
1034
+ * @return array with errors if spam has found
1035
+ */
1036
+ function apbct_rorm__formidable__testSpam ( $errors, $form ) {
1037
+
1038
+ global $apbct;
1039
+
1040
+ if ( !$apbct->settings['contact_forms_test']) {
1041
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
1042
+ return $errors;
1043
+ }
1044
+
1045
+ // Skip processing for logged in users.
1046
+ if ( !$apbct->settings['protect_logged_in'] && is_user_logged_in()) {
1047
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
1048
+ return $errors;
1049
+ }
1050
+
1051
+ $ct_temp_msg_data = ct_get_fields_any($_POST['item_meta']);
1052
+
1053
+ $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
1054
+ $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
1055
+ $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
1056
+ $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
1057
+ $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
1058
+
1059
+ // Adding 'input_meta[]' to every field /Formidable fix/
1060
+ $message = array_flip($message);
1061
+ foreach($message as &$value){
1062
+ $value = 'item_meta['.$value.']';
1063
+ } unset($value);
1064
+ $message = array_flip($message);
1065
+
1066
+ $checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
1067
+ ? apbct_js_test('ct_checkjs', $_COOKIE)
1068
+ : apbct_js_test('ct_checkjs', $_POST);
1069
+
1070
+ $base_call_result = apbct_base_call(
1071
+ array(
1072
+ 'message' => $message,
1073
+ 'sender_email' => $sender_email,
1074
+ 'sender_nickname' => $sender_nickname,
1075
+ 'post_info' => array('comment_type' => 'contact_form_wordpress_formidable'),
1076
+ 'js_on' => $checkjs
1077
+ )
1078
+ );
1079
+ $ct_result = $base_call_result['ct_result'];
1080
+
1081
+ if ($ct_result->allow == 0) {
1082
+ $errors['ct_error'] = '<br /><b>' . $ct_result->comment . '</b><br /><br />';
1083
+ }
1084
+
1085
+ return $errors;
1086
+ }
1087
+
1088
+ /**
1089
+ * Public filter 'bbp_*' - Get new topic name to global $ct_bbp_topic
1090
+ * @param mixed[] $comment Comment string
1091
+ * @return mixed[] $comment Comment string
1092
+ */
1093
+ function ct_bbp_get_topic($topic){
1094
+ global $ct_bbp_topic;
1095
+
1096
+ $ct_bbp_topic=$topic;
1097
+
1098
+ return $topic;
1099
+ }
1100
+
1101
+ /**
1102
+ * Public filter 'bbp_*' - Checks topics, replies by cleantalk
1103
+ * @param mixed[] $comment Comment string
1104
+ * @return mixed[] $comment Comment string
1105
+ */
1106
+ function ct_bbp_new_pre_content ($comment) {
1107
+
1108
+ global $apbct, $current_user;
1109
+
1110
+ if ( !$apbct->settings['comments_test']) {
1111
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
1112
+ return $comment;
1113
+ }
1114
+
1115
+ // Skip processing for logged in users and admin.
1116
+ if ( !$apbct->settings['protect_logged_in'] && is_user_logged_in() ||
1117
+ apbct_exclusions_check()
1118
+ ) {
1119
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
1120
+ return $comment;
1121
+ }
1122
+
1123
+
1124
+ $checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
1125
+ ? apbct_js_test('ct_checkjs', $_COOKIE)
1126
+ : apbct_js_test('ct_checkjs', $_POST);
1127
+
1128
+ $post_info['comment_type'] = 'bbpress_comment';
1129
+ $post_info['post_url'] = bbp_get_topic_permalink();
1130
+
1131
+ if( is_user_logged_in() ) {
1132
+ $sender_email = $current_user->user_email;
1133
+ $sender_nickname = $current_user->display_name;
1134
+ } else {
1135
+ $sender_email = isset($_POST['bbp_anonymous_email']) ? $_POST['bbp_anonymous_email'] : null;
1136
+ $sender_nickname = isset($_POST['bbp_anonymous_name']) ? $_POST['bbp_anonymous_name'] : null;
1137
+ }
1138
+
1139
+ $base_call_result = apbct_base_call(
1140
+ array(
1141
+ 'message' => $comment,
1142
+ 'sender_email' => $sender_email,
1143
+ 'sender_nickname' => $sender_nickname,
1144
+ 'post_info' => $post_info,
1145
+ 'js_on' => $checkjs,
1146
+ 'sender_info' => array('sender_url' => isset($_POST['bbp_anonymous_website']) ? $_POST['bbp_anonymous_website'] : null),
1147
+ )
1148
+ );
1149
+ $ct_result = $base_call_result['ct_result'];
1150
+
1151
+ if ($ct_result->allow == 0) {
1152
+ bbp_add_error('bbp_reply_content', $ct_result->comment);
1153
+ }
1154
+
1155
+ return $comment;
1156
+ }
1157
+
1158
+ function apbct_comment__sanitize_data__before_wp_die($function){
1159
+
1160
+ global $apbct;
1161
+
1162
+ $comment_data = wp_unslash($_POST);
1163
+
1164
+ $user_ID = 0;
1165
+
1166
+ $comment_type = '';
1167
+
1168
+ $comment_content = isset($comment_data['comment']) ? (string) $comment_data['comment'] : null;
1169
+ $comment_parent = isset($comment_data['comment_parent']) ? (int) absint($comment_data['comment_parent']) : null;
1170
+
1171
+ $comment_author = isset($comment_data['author']) ? (string) trim(strip_tags($comment_data['author'])) : null;
1172
+ $comment_author_email = isset($comment_data['email']) ? (string) trim($comment_data['email']) : null;
1173
+ $comment_author_url = isset($comment_data['url']) ? (string) trim($comment_data['url']) : null;
1174
+ $comment_post_ID = isset($comment_data['comment_post_ID']) ? (int) $comment_data['comment_post_ID'] : null;
1175
+
1176
+ if(isset($comment_content, $comment_parent)){
1177
+
1178
+ $user = function_exists('apbct_wp_get_current_user') ? apbct_wp_get_current_user() : null;
1179
+
1180
+ if($user && $user->exists()){
1181
+ $comment_author = empty($user->display_name) ? $user->user_login : $user->display_name;
1182
+ $comment_author_email = $user->user_email;
1183
+ $comment_author_url = $user->user_url;
1184
+ $user_ID = $user->ID;
1185
+ }
1186
+
1187
+ $apbct->comment_data = compact(
1188
+ 'comment_post_ID',
1189
+ 'comment_author',
1190
+ 'comment_author_email',
1191
+ 'comment_author_url',
1192
+ 'comment_content',
1193
+ 'comment_type',
1194
+ 'comment_parent',
1195
+ 'user_ID'
1196
+ );
1197
+
1198
+ $function = 'apbct_comment__check_via_wp_die';
1199
+
1200
+ }
1201
+
1202
+ return $function;
1203
+ }
1204
+
1205
+ function apbct_comment__check_via_wp_die($message, $title, $args){
1206
+ if($title == __('Comment Submission Failure')){
1207
+ global $apbct;
1208
+ $apbct->validation_error = $message;
1209
+ ct_preprocess_comment($apbct->comment_data);
1210
+ }
1211
+ _default_wp_die_handler($message, $title, $args);
1212
+ }
1213
+
1214
+ /**
1215
+ * Public filter 'preprocess_comment' - Checks comment by cleantalk server
1216
+ * @param mixed[] $comment Comment data array
1217
+ * @return mixed[] New data array of comment
1218
+ */
1219
+ function ct_preprocess_comment($comment) {
1220
+ // this action is called just when WP process POST request (adds new comment)
1221
+ // this action is called by wp-comments-post.php
1222
+ // after processing WP makes redirect to post page with comment's form by GET request (see above)
1223
+ global $current_user, $comment_post_id, $ct_comment_done, $ct_jp_comments, $apbct;
1224
+
1225
+ // Send email notification for chosen groups of users
1226
+ if($apbct->settings['comment_notify'] && !empty($apbct->settings['comment_notify__roles']) && $apbct->data['moderate']){
1227
+
1228
+ add_filter('notify_post_author', 'apbct_comment__Wordpress__doNotify', 100, 2);
1229
+
1230
+ $users = get_users(array(
1231
+ 'role__in' => $apbct->settings['comment_notify__roles'],
1232
+ 'fileds' => array('user_email')
1233
+ ));
1234
+
1235
+ if($users){
1236
+ add_filter('comment_notification_text', 'apbct_comment__Wordpress__changeMailNotificationGroups', 100, 2);
1237
+ add_filter('comment_notification_recipients', 'apbct_comment__Wordpress__changeMailNotificationRecipients', 100, 2);
1238
+ foreach($users as $user){
1239
+ $emails[] = $user->user_email;
1240
+ }
1241
+ $apbct->comment_notification_recipients = json_encode($emails);
1242
+ }
1243
+ }
1244
+
1245
+ // Skip processing admin.
1246
+ if (in_array("administrator", $current_user->roles)){
1247
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
1248
+ return $comment;
1249
+ }
1250
+
1251
+
1252
+ $comments_check_number = defined('CLEANTALK_CHECK_COMMENTS_NUMBER') ? CLEANTALK_CHECK_COMMENTS_NUMBER : 3;
1253
+
1254
+ if($apbct->settings['check_comments_number']){
1255
+ $args = array(
1256
+ 'author_email' => $comment['comment_author_email'],
1257
+ 'status' => 'approve',
1258
+ 'count' => false,
1259
+ 'number' => $comments_check_number,
1260
+ );
1261
+ $cnt = count(get_comments($args));
1262
+ $is_max_comments = $cnt >= $comments_check_number ? true : false;
1263
+ }
1264
+
1265
+ if (
1266
+ ($comment['comment_type']!='trackback') &&
1267
+ (
1268
+ apbct_is_user_enable() === false ||
1269
+ $apbct->settings['comments_test'] == 0 ||
1270
+ $ct_comment_done ||
1271
+ (isset($_SERVER['HTTP_REFERER']) && stripos($_SERVER['HTTP_REFERER'],'page=wysija_campaigns&action=editTemplate')!==false) ||
1272
+ (isset($is_max_comments) && $is_max_comments) ||
1273
+ (isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['REQUEST_URI'],'/wp-admin/')!==false)
1274
+ )
1275
+ )
1276
+ {
1277
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
1278
+ return $comment;
1279
+ }
1280
+
1281
+ $local_blacklists = wp_blacklist_check(
1282
+ $comment['comment_author'],
1283
+ $comment['comment_author_email'],
1284
+ $comment['comment_author_url'],
1285
+ $comment['comment_content'],
1286
+ apbct_get_server_variable( 'REMOTE_ADDR' ),
1287
+ apbct_get_server_variable( 'HTTP_USER_AGENT' )
1288
+ );
1289
+
1290
+ // Go out if author in local blacklists
1291
+ if ($comment['comment_type']!='trackback' && $local_blacklists === true) {
1292
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
1293
+ return $comment;
1294
+ }
1295
+
1296
+ // Skip pingback anti-spam test
1297
+ /*if ($comment['comment_type'] == 'pingback') {
1298
+ return $comment;
1299
+ }*/
1300
+
1301
+ $ct_comment_done = true;
1302
+
1303
+ $comment_post_id = $comment['comment_post_ID'];
1304
+
1305
+ // JetPack comments logic
1306
+ $post_info['comment_type'] = $ct_jp_comments ? 'jetpack_comment' : $comment['comment_type'];
1307
+ $post_info['post_url'] = ct_post_url(null, $comment_post_id);
1308
+
1309
+ // Comment type
1310
+ $post_info['comment_type'] = empty($post_info['comment_type']) ? 'general_comment' : $post_info['comment_type'];
1311
+
1312
+ $checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
1313
+ ? apbct_js_test('ct_checkjs', $_COOKIE)
1314
+ : apbct_js_test('ct_checkjs', $_POST);
1315
+
1316
+
1317
+ $example = null;
1318
+ if ($apbct->data['relevance_test']) {
1319
+ $post = get_post($comment_post_id);
1320
+ if ($post !== null){
1321
+ $example['title'] = $post->post_title;
1322
+ $example['body'] = $post->post_content;
1323
+ $example['comments'] = null;
1324
+
1325
+ $last_comments = get_comments(array('status' => 'approve', 'number' => 10, 'post_id' => $comment_post_id));
1326
+ foreach ($last_comments as $post_comment){
1327
+ $example['comments'] .= "\n\n" . $post_comment->comment_content;
1328
+ }
1329
+
1330
+ $example = json_encode($example);
1331
+ }
1332
+
1333
+ // Use plain string format if've failed with JSON
1334
+ if ($example === false || $example === null){
1335
+ $example = ($post->post_title !== null) ? $post->post_title : '';
1336
+ $example .= ($post->post_content !== null) ? "\n\n" . $post->post_content : '';
1337
+ }
1338
+ }
1339
+
1340
+ $base_call_result = apbct_base_call(
1341
+ array(
1342
+ 'message' => $comment['comment_content'],
1343
+ 'example' => $example,
1344
+ 'sender_email' => $comment['comment_author_email'],
1345
+ 'sender_nickname' => $comment['comment_author'],
1346
+ 'post_info' => $post_info,
1347
+ 'js_on' => $checkjs,
1348
+ 'sender_info' => array(
1349
+ 'sender_url' => @$comment['comment_author_url'],
1350
+ 'form_validation' => !isset($apbct->validation_error)
1351
+ ? null
1352
+ : json_encode(array(
1353
+ 'validation_notice' => $apbct->validation_error,
1354
+ 'page_url' => apbct_get_server_variable( 'HTTP_HOST' ) . apbct_get_server_variable( 'REQUEST_URI' ),
1355
+ ))
1356
+ ),
1357
+ )
1358
+ );
1359
+ $ct_result = $base_call_result['ct_result'];
1360
+
1361
+ ct_hash($ct_result->id);
1362
+
1363
+ //Don't check trusted users
1364
+ if (isset($comment['comment_author_email'])){
1365
+ $approved_comments = get_comments(array('status' => 'approve', 'count' => true, 'author_email' => $comment['comment_author_email']));
1366
+ $new_user = $approved_comments == 0 ? true : false;
1367
+ }
1368
+
1369
+ // Change comment flow only for new authors
1370
+ if (!empty($new_user) || $ct_result->stop_words !== null || $ct_result->spam == 1)
1371
+ add_action('comment_post', 'ct_set_meta', 10, 2);
1372
+
1373
+ if($ct_result->allow){ // Pass if allowed
1374
+ if(get_option('comment_moderation') === '1') // Wordpress moderation flag
1375
+ add_filter('pre_comment_approved', 'ct_set_not_approved', 999, 2);
1376
+ else
1377
+ add_filter('pre_comment_approved', 'ct_set_approved', 999, 2);
1378
+ // Modify the email notification
1379
+ add_filter('comment_notification_text', 'apbct_comment__wordpress__show_blacklists', 100, 2); // Add two blacklist links: by email and IP
1380
+ }else{
1381
+
1382
+ global $ct_comment, $ct_stop_words;
1383
+
1384
+ $ct_comment = $ct_result->comment;
1385
+ $ct_stop_words = $ct_result->stop_words;
1386
+
1387
+ $err_text = '<center>' . ((defined('CLEANTALK_DISABLE_BLOCKING_TITLE') && CLEANTALK_DISABLE_BLOCKING_TITLE == true) ? '' : '<b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk.</b> ') . __('Spam protection', 'cleantalk-spam-protect') . "</center><br><br>\n" . $ct_result->comment;
1388
+ $err_text .= '<script>setTimeout("history.back()", 5000);</script>';
1389
+
1390
+ // Terminate. Definitely spam.
1391
+ if($ct_result->stop_queue == 1)
1392
+ wp_die($err_text, 'Blacklisted', array('response' => 200, 'back_link' => true));
1393
+
1394
+ // Terminate by user's setting.
1395
+ if($ct_result->spam == 3)
1396
+ wp_die($err_text, 'Blacklisted', array('response' => 200, 'back_link' => true));
1397
+
1398
+ // Trash comment.
1399
+ if($ct_result->spam == 2){
1400
+ add_filter('pre_comment_approved', 'ct_set_comment_spam', 997, 2);
1401
+ add_action('comment_post', 'ct_wp_trash_comment', 997, 2);
1402
+ }
1403
+
1404
+ // Spam comment
1405
+ if($ct_result->spam == 1)
1406
+ add_filter('pre_comment_approved', 'ct_set_comment_spam', 997, 2);
1407
+
1408
+ // Move to pending folder. Contains stop_words.
1409
+ if($ct_result->stop_words){
1410
+ add_filter('pre_comment_approved', 'ct_set_not_approved', 998, 2);
1411
+ add_action('comment_post', 'ct_mark_red', 998, 2);
1412
+ }
1413
+
1414
+ add_action('comment_post', 'ct_die', 999, 2);
1415
+ }
1416
+
1417
+ if($apbct->settings['remove_comments_links'] == 1){
1418
+ $comment['comment_content'] = preg_replace("~(http|https|ftp|ftps)://(.*?)(\s|\n|[,.?!](\s|\n)|$)~", '[Link deleted]', $comment['comment_content']);
1419
+ }
1420
+
1421
+ // Change mail notification if license is out of date
1422
+ if($apbct->data['moderate'] == 0){
1423
+ $apbct->sender_email = $comment['comment_author_email'];
1424
+ $apbct->sender_ip = \Cleantalk\ApbctWP\Helper::ip__get(array('real'));
1425
+ add_filter('comment_moderation_text', 'apbct_comment__Wordpress__changeMailNotification', 100, 2); // Comment sent to moderation
1426
+ add_filter('comment_notification_text', 'apbct_comment__Wordpress__changeMailNotification', 100, 2); // Comment approved
1427
+ }
1428
+
1429
+ return $comment;
1430
+ }
1431
+
1432
+ /**
1433
+ * Changes whether notify admin/athor or not.
1434
+ *
1435
+ * @param bool $maybe_notify notify flag
1436
+ * @param int $comment_ID Comment id
1437
+ * @return bool flag
1438
+ */
1439
+ function apbct_comment__Wordpress__doNotify($maybe_notify, $comment_ID){
1440
+ return true;
1441
+ }
1442
+
1443
+ /**
1444
+ * Add notification setting link
1445
+ *
1446
+ * @param string $notify_message
1447
+ * @param integer $comment_id
1448
+ *
1449
+ * @return string
1450
+ */
1451
+ function apbct_comment__Wordpress__changeMailNotificationGroups($notify_message, $comment_id){
1452
+ return $notify_message
1453
+ .PHP_EOL
1454
+ .'---'.PHP_EOL
1455
+ .'Manage notifications settings: '.get_site_url().'/wp-admin/options-general.php?page=cleantalk';
1456
+ }
1457
+
1458
+ /**
1459
+ * Change email notification recipients
1460
+ *
1461
+ * @param array $emails
1462
+ * @param integer $comment_id
1463
+ *
1464
+ * @return array
1465
+ * @global SpbcState $apbct
1466
+ */
1467
+ function apbct_comment__Wordpress__changeMailNotificationRecipients($emails, $comment_id){
1468
+ global $apbct;
1469
+ return array_unique(array_merge($emails, (array)json_decode($apbct->comment_notification_recipients, true)));
1470
+ }
1471
+
1472
+ /**
1473
+ * Changes email notification for spam comment for native Wordpress comment system
1474
+ *
1475
+ * @param string $notify_message Body of email notification
1476
+ * @param int $comment_id Comment id
1477
+ * @return string Body for email notification
1478
+ */
1479
+ function apbct_comment__Wordpress__changeMailNotification($notify_message, $comment_id){
1480
+
1481
+ global $apbct;
1482
+
1483
+ $notify_message =
1484
+ PHP_EOL
1485
+ .__('CleanTalk AntiSpam: This message is possible spam.', 'cleantalk-spam-protect')
1486
+ ."\n".__('You could check it in CleanTalk\'s anti-spam database:', 'cleantalk-spam-protect')
1487
+ ."\n".'IP: https://cleantalk.org/blacklists/' . $apbct->sender_ip
1488
+ ."\n".'Email: https://cleantalk.org/blacklists/' . $apbct->sender_email
1489
+ ."\n".PHP_EOL . sprintf(
1490
+ __('Activate protection in your Anti-Spam Dashboard: %s.', 'clentalk'),
1491
+ 'https://cleantalk.org/my/?cp_mode=antispam&utm_source=newsletter&utm_medium=email&utm_campaign=wp_spam_comment_passed'
1492
+ .($apbct->data['user_token']
1493
+ ? '&iser_token='.$apbct->data['user_token']
1494
+ : ''
1495
+ )
1496
+ )
1497
+ .PHP_EOL . '---'
1498
+ .PHP_EOL
1499
+ .PHP_EOL
1500
+ .$notify_message;
1501
+
1502
+ return $notify_message;
1503
+
1504
+ }
1505
+
1506
+ function apbct_comment__wordpress__show_blacklists( $notify_message, $comment_id ) {
1507
+
1508
+ $comment_details = get_comments( array( 'comment__in' => $comment_id ) );
1509
+ $comment_details = $comment_details[0];
1510
+
1511
+ if( isset( $comment_details->comment_author_email ) ) {
1512
+
1513
+ $black_list_link = 'https://cleantalk.org/blacklists/';
1514
+
1515
+ $links = PHP_EOL;
1516
+ $links .= esc_html__( 'Check for spam:', 'cleantalk-spam-protect');
1517
+ $links .= PHP_EOL;
1518
+ $links .= $black_list_link . $comment_details->comment_author_email;
1519
+ $links .= PHP_EOL;
1520
+ if( ! empty( $comment_details->comment_author_IP ) ) {
1521
+ $links .= $black_list_link . $comment_details->comment_author_IP;
1522
+ $links .= PHP_EOL;
1523
+ }
1524
+
1525
+ return $notify_message . $links;
1526
+
1527
+ }
1528
+
1529
+ return $notify_message;
1530
+
1531
+ }
1532
+
1533
+ /**
1534
+ * Set die page with Cleantalk comment.
1535
+ * @global array $ct_comment
1536
+ $err_text = '<center><b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk.</b> ' . __('Spam protection', 'cleantalk-spam-protect') . "</center><br><br>\n" . $ct_comment;
1537
+ * @param type $comment_status
1538
+ */
1539
+ function ct_die($comment_id, $comment_status) {
1540
+
1541
+ global $ct_comment;
1542
+
1543
+ $err_text = '<center>' . ((defined('CLEANTALK_DISABLE_BLOCKING_TITLE') && CLEANTALK_DISABLE_BLOCKING_TITLE == true) ? '' : '<b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk.</b> ') . __('Spam protection', 'cleantalk-spam-protect') . "</center><br><br>\n" . $ct_comment;
1544
+ $err_text .= '<script>setTimeout("history.back()", 5000);</script>';
1545
+ if(isset($_POST['et_pb_contact_email']))
1546
+ {
1547
+ $mes='<div id="et_pb_contact_form_1" class="et_pb_contact_form_container clearfix"><h1 class="et_pb_contact_main_title">Blacklisted</h1><div class="et-pb-contact-message"><p>'.$ct_comment.'</p></div></div>';
1548
+ wp_die($mes, 'Blacklisted', array('back_link' => true,'response'=>200));
1549
+ }
1550
+ else
1551
+ {
1552
+ wp_die($err_text, 'Blacklisted', array('response' => 200, 'back_link' => true));
1553
+ }
1554
+ }
1555
+
1556
+ /**
1557
+ * Set die page with Cleantalk comment from parameter.
1558
+ * @param type $comment_body
1559
+ */
1560
+ function ct_die_extended($comment_body) {
1561
+
1562
+ $err_text = '<center>' . ((defined('CLEANTALK_DISABLE_BLOCKING_TITLE') && CLEANTALK_DISABLE_BLOCKING_TITLE == true) ? '' : '<b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk.</b> ') . __('Spam protection', 'cleantalk-spam-protect') . "</center><br><br>\n" . $comment_body;
1563
+ $err_text .= '<script>setTimeout("history.back()", 5000);</script>';
1564
+ wp_die($err_text, 'Blacklisted', array('response' => 200, 'back_link' => true));
1565
+ }
1566
+
1567
+ /**
1568
+ * Validates JavaScript anti-spam test
1569
+ *
1570
+ * @param string $field_name filed to serach in data
1571
+ * @param null $data Data to search in
1572
+ * @param bool $random_key
1573
+ *
1574
+ * @return int|null
1575
+ */
1576
+ function apbct_js_test($field_name = 'ct_checkjs', $data = null) {
1577
+
1578
+ global $apbct;
1579
+
1580
+ $out = null;
1581
+
1582
+ if($data && isset($data[$field_name])){
1583
+
1584
+ $js_key = trim($data[$field_name]);
1585
+
1586
+ // Check static key
1587
+ if(
1588
+ $apbct->settings['use_static_js_key'] == 1 ||
1589
+ ( $apbct->settings['use_static_js_key'] == - 1 &&
1590
+ ( apbct_is_cache_plugins_exists() ||
1591
+ ( apbct_is_post() && isset($apbct->data['cache_detected']) && $apbct->data['cache_detected'] == 1 )
1592
+ )
1593
+ )
1594
+ ){
1595
+ $out = ct_get_checkjs_value() === $js_key ? 1 : 0;
1596
+
1597
+ // Random key check
1598
+ }else{
1599
+ $out = array_key_exists( $js_key, $apbct->js_keys ) ? 1 : 0;
1600
+ }
1601
+ }
1602
+
1603
+ return $out;
1604
+ }
1605
+
1606
+ /**
1607
+ * Get post url
1608
+ * @param int $comment_id
1609
+ * @param int $comment_post_id
1610
+ * @return string|bool
1611
+ */
1612
+ function ct_post_url($comment_id = null, $comment_post_id) {
1613
+
1614
+ if (empty($comment_post_id))
1615
+ return null;
1616
+
1617
+ if ($comment_id === null) {
1618
+ $last_comment = get_comments('number=1');
1619
+ $comment_id = isset($last_comment[0]->comment_ID) ? (int) $last_comment[0]->comment_ID + 1 : 1;
1620
+ }
1621
+ $permalink = get_permalink($comment_post_id);
1622
+
1623
+ $post_url = null;
1624
+ if ($permalink !== null)
1625
+ $post_url = $permalink . '#comment-' . $comment_id;
1626
+
1627
+ return $post_url;
1628
+ }
1629
+
1630
+ /**
1631
+ * Public filter 'pre_comment_approved' - Mark comment unapproved always
1632
+ * @return int Zero
1633
+ */
1634
+ function ct_set_not_approved() {
1635
+ return 0;
1636
+ }
1637
+
1638
+ /**
1639
+ * @author Artem Leontiev
1640
+ * Public filter 'pre_comment_approved' - Mark comment approved if it's not 'spam' only
1641
+ * @return int 1
1642
+ */
1643
+ function ct_set_approved($approved, $comment) {
1644
+ if ($approved == 'spam'){
1645
+ return $approved;
1646
+ } else {
1647
+ return 1;
1648
+ }
1649
+ }
1650
+
1651
+ /**
1652
+ * Public filter 'pre_comment_approved' - Mark comment unapproved always
1653
+ * @return int Zero
1654
+ */
1655
+ function ct_set_comment_spam() {
1656
+ return 'spam';
1657
+ }
1658
+
1659
+ /**
1660
+ * Public action 'comment_post' - Store cleantalk hash in comment meta 'ct_hash'
1661
+ * @param int $comment_id Comment ID
1662
+ * @param mixed $comment_status Approval status ("spam", or 0/1), not used
1663
+ */
1664
+ function ct_set_meta($comment_id, $comment_status) {
1665
+ global $comment_post_id;
1666
+ $hash1 = ct_hash();
1667
+ if (!empty($hash1)) {
1668
+ update_comment_meta($comment_id, 'ct_hash', $hash1);
1669
+ if (function_exists('base64_encode') && isset($comment_status) && $comment_status != 'spam') {
1670
+ $post_url = ct_post_url($comment_id, $comment_post_id);
1671
+ $post_url = base64_encode($post_url);
1672
+ if ($post_url === false)
1673
+ return false;
1674
+ // 01 - URL to approved comment
1675
+ $feedback_request = $hash1 . ':' . '01' . ':' . $post_url . ';';
1676
+ ct_send_feedback($feedback_request);
1677
+ }
1678
+ }
1679
+ return true;
1680
+ }
1681
+
1682
+ /**
1683
+ * Mark bad words
1684
+ * @global string $ct_stop_words
1685
+ * @param int $comment_id
1686
+ * @param int $comment_status Not use
1687
+ */
1688
+ function ct_mark_red($comment_id, $comment_status) {
1689
+ global $ct_stop_words;
1690
+
1691
+ $comment = get_comment($comment_id, 'ARRAY_A');
1692
+ $message = $comment['comment_content'];
1693
+ foreach (explode(':', $ct_stop_words) as $word) {
1694
+ $message = preg_replace("/($word)/ui", '<font rel="cleantalk" color="#FF1000">' . "$1" . '</font>', $message);
1695
+
1696
+ }
1697
+ $comment['comment_content'] = $message;
1698
+ kses_remove_filters();
1699
+ wp_update_comment($comment);
1700
+ }
1701
+
1702
+ //
1703
+ //Send post to trash
1704
+ //
1705
+ function ct_wp_trash_comment($comment_id, $comment_status){
1706
+ wp_trash_comment($comment_id);
1707
+ }
1708
+
1709
+ /**
1710
+ * Tests plugin activation status
1711
+ * @return bool
1712
+ */
1713
+ function ct_plugin_active($plugin_name){
1714
+ foreach (get_option('active_plugins') as $k => $v) {
1715
+ if ($plugin_name == $v)
1716
+ return true;
1717
+ }
1718
+ return false;
1719
+ }
1720
+
1721
+ /**
1722
+ * Insert a hidden field to registration form
1723
+ * @return null
1724
+ */
1725
+ function ct_register_form() {
1726
+
1727
+ global $ct_checkjs_register_form, $apbct;
1728
+
1729
+ if ($apbct->settings['registrations_test'] == 0) {
1730
+ return false;
1731
+ }
1732
+
1733
+ ct_add_hidden_fields($ct_checkjs_register_form, false, false, false, false);
1734
+
1735
+ return null;
1736
+ }
1737
+
1738
+ function apbct_login__scripts(){
1739
+ global $apbct;
1740
+ echo '<script src="'.APBCT_URL_PATH.'/js/apbct-public.min.js"></script>';
1741
+ $apbct->public_script_loaded = true;
1742
+ }
1743
+
1744
+ /**
1745
+ * Adds notification text to login form - to inform about approved registration
1746
+ * @return null
1747
+ */
1748
+ function ct_login_message($message) {
1749
+
1750
+ global $errors, $apbct, $apbct_cookie_register_ok_label;
1751
+
1752
+
1753
+
1754
+ if ($apbct->settings['registrations_test'] != 0){
1755
+ if( isset($_GET['checkemail']) && 'registered' == $_GET['checkemail'] ){
1756
+ if (isset($_COOKIE[$apbct_cookie_register_ok_label])){
1757
+ if(is_wp_error($errors)){
1758
+ $errors->add('ct_message',sprintf(__('Registration approved by %s.', 'cleantalk-spam-protect'), '<b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk</b>'), 'message');
1759
+ }
1760
+ }
1761
+ }
1762
+ }
1763
+ return $message;
1764
+ }
1765
+
1766
+ /**
1767
+ * Test users registration for pPress
1768
+ * @return array with errors
1769
+ */
1770
+ function ct_registration_errors_ppress($reg_errors, $form_id) {
1771
+
1772
+ $email = $_POST['reg_email'];
1773
+ $login = $_POST['reg_username'];
1774
+
1775
+ $reg_errors = ct_registration_errors($reg_errors, $login, $email);
1776
+
1777
+ return $reg_errors;
1778
+ }
1779
+
1780
+ /**
1781
+ * Test users registration for multisite enviroment
1782
+ * @return array with errors
1783
+ */
1784
+ function ct_registration_errors_wpmu($errors) {
1785
+ global $ct_signup_done;
1786
+
1787
+ //
1788
+ // Multisite actions
1789
+ //
1790
+ $sanitized_user_login = null;
1791
+ if (isset($errors['user_name'])) {
1792
+ $sanitized_user_login = $errors['user_name'];
1793
+ $wpmu = true;
1794
+ }
1795
+ $user_email = null;
1796
+ if (isset($errors['user_email'])) {
1797
+ $user_email = $errors['user_email'];
1798
+ $wpmu = true;
1799
+ }
1800
+
1801
+ if ($wpmu && isset($errors['errors']->errors) && count($errors['errors']->errors) > 0) {
1802
+ return $errors;
1803
+ }
1804
+
1805
+ $errors['errors'] = ct_registration_errors($errors['errors'], $sanitized_user_login, $user_email);
1806
+
1807
+ // Show CleanTalk errors in user_name field
1808
+ if (isset($errors['errors']->errors['ct_error'])) {
1809
+ $errors['errors']->errors['user_name'] = $errors['errors']->errors['ct_error'];
1810
+ unset($errors['errors']->errors['ct_error']);
1811
+ }
1812
+
1813
+ return $errors;
1814
+ }
1815
+
1816
+ /**
1817
+ * Shell for action register_post
1818
+ * @return array with errors
1819
+ */
1820
+ function ct_register_post($sanitized_user_login = null, $user_email = null, $errors) {
1821
+ return ct_registration_errors($errors, $sanitized_user_login, $user_email);
1822
+ }
1823
+
1824
+ /**
1825
+ * Check messages for external plugins
1826
+ * @return array with checking result;
1827
+ */
1828
+
1829
+ function ct_test_message($nickname, $email, $ip, $text){
1830
+
1831
+ $base_call_result = apbct_base_call(
1832
+ array(
1833
+ 'message' => $text,
1834
+ 'sender_email' => $email,
1835
+ 'sender_nickname' => $nickname,
1836
+ 'post_info' => array('comment_type' => 'feedback_plugin_check'),
1837
+ 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE),
1838
+ )
1839
+ );
1840
+
1841
+ $ct_result = $base_call_result['ct_result'];
1842
+
1843
+ $result=Array(
1844
+ 'allow' => $ct_result->allow,
1845
+ 'comment' => $ct_result->comment,
1846
+ );
1847
+ return $result;
1848
+ }
1849
+
1850
+ /**
1851
+ * Check registrations for external plugins
1852
+ * @return array with checking result;
1853
+ */
1854
+ function ct_test_registration($nickname, $email, $ip){
1855
+
1856
+ global $ct_checkjs_register_form, $apbct;
1857
+
1858
+ if(apbct_js_test($ct_checkjs_register_form, $_POST)){
1859
+ $checkjs = apbct_js_test($ct_checkjs_register_form, $_POST);
1860
+ $sender_info['post_checkjs_passed'] = $checkjs;
1861
+ }else{
1862
+ $checkjs = $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
1863
+ $sender_info['cookie_checkjs_passed'] = $checkjs;
1864
+ }
1865
+
1866
+ //Making a call
1867
+ $base_call_result = apbct_base_call(
1868
+ array(
1869
+ 'sender_ip' => $ip,
1870
+ 'sender_email' => $email,
1871
+ 'sender_nickname' => $nickname,
1872
+ 'sender_info' => $sender_info,
1873
+ 'js_on' => $checkjs,
1874
+ ),
1875
+ true
1876
+ );
1877
+ $ct_result = $base_call_result['ct_result'];
1878
+
1879
+ $result = array(
1880
+ 'allow' => $ct_result->allow,
1881
+ 'comment' => $ct_result->comment,
1882
+ );
1883
+ return $result;
1884
+ }
1885
+
1886
+ /**
1887
+ * Test users registration
1888
+ *
1889
+ * @param $errors
1890
+ * @param null $sanitized_user_login
1891
+ * @param null $user_email
1892
+ *
1893
+ * @return void with errors
1894
+ */
1895
+ function ct_registration_errors($errors, $sanitized_user_login = null, $user_email = null) {
1896
+
1897
+ global $ct_checkjs_register_form, $apbct_cookie_request_id_label, $apbct_cookie_register_ok_label, $bp, $ct_signup_done, $ct_negative_comment, $apbct, $ct_registration_error_comment, $cleantalk_executed;
1898
+
1899
+ // Go out if a registrered user action
1900
+ if (apbct_is_user_enable() === false) {
1901
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
1902
+ return $errors;
1903
+ }
1904
+
1905
+ if ($apbct->settings['registrations_test'] == 0) {
1906
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
1907
+ return $errors;
1908
+ }
1909
+
1910
+ // The function already executed
1911
+ // It happens when used ct_register_post();
1912
+ if ($ct_signup_done && is_object($errors) && count($errors->errors) > 0) {
1913
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
1914
+ return $errors;
1915
+ }
1916
+
1917
+ // Facebook registration
1918
+ if ($sanitized_user_login === null && isset($_POST['FB_userdata'])){
1919
+ $sanitized_user_login = $_POST['FB_userdata']['name'];
1920
+ $facebook = true;
1921
+ }
1922
+ if ($user_email === null && isset($_POST['FB_userdata'])){
1923
+ $user_email = $_POST['FB_userdata']['email'];
1924
+ $facebook = true;
1925
+ }
1926
+
1927
+ // BuddyPress actions
1928
+ $buddypress = false;
1929
+ if ($sanitized_user_login === null && isset($_POST['signup_username'])) {
1930
+ $sanitized_user_login = $_POST['signup_username'];
1931
+ $buddypress = true;
1932
+ }
1933
+ if ($user_email === null && isset($_POST['signup_email'])) {
1934
+ $user_email = $_POST['signup_email'];
1935
+ $buddypress = true;
1936
+ }
1937
+
1938
+ //
1939
+ // Break tests because we already have servers response
1940
+ //
1941
+ if ($buddypress && $ct_signup_done) {
1942
+ if ($ct_negative_comment) {
1943
+ $bp->signup->errors['signup_username'] = $ct_negative_comment;
1944
+ }
1945
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
1946
+ return $errors;
1947
+ }
1948
+
1949
+
1950
+ if(current_filter() == 'woocommerce_registration_errors'){
1951
+ $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
1952
+ $checkjs_post = null;
1953
+ $checkjs_cookie = $checkjs;
1954
+ }else{
1955
+ // This hack can be helpfull when plugin uses with untested themes&signups plugins.
1956
+ $checkjs_post = apbct_js_test($ct_checkjs_register_form, $_POST);
1957
+ $checkjs_cookie = apbct_js_test('ct_checkjs', $_COOKIE);
1958
+ $checkjs = $checkjs_cookie ? $checkjs_cookie : $checkjs_post;
1959
+ }
1960
+
1961
+ $sender_info = array(
1962
+ 'post_checkjs_passed' => $checkjs_post,
1963
+ 'cookie_checkjs_passed' => $checkjs_cookie,
1964
+ 'form_validation' => ! empty( $errors )
1965
+ ? json_encode( array(
1966
+ 'validation_notice' => $errors->get_error_message(),
1967
+ 'page_url' => apbct_get_server_variable( 'HTTP_HOST' ) . apbct_get_server_variable( 'REQUEST_URI' ),
1968
+ ) )
1969
+ : null,
1970
+ );
1971
+
1972
+ $base_call_result = apbct_base_call(
1973
+ array(
1974
+ 'sender_email' => $user_email,
1975
+ 'sender_nickname' => $sanitized_user_login,
1976
+ 'sender_info' => $sender_info,
1977
+ 'js_on' => $checkjs,
1978
+ ),
1979
+ true
1980
+ );
1981
+ $ct_result = $base_call_result['ct_result'];
1982
+
1983
+ // Change mail notification if license is out of date
1984
+ if($apbct->data['moderate'] == 0 &&
1985
+ ($ct_result->fast_submit == 1 || $ct_result->blacklisted == 1 || $ct_result->js_disabled == 1)
1986
+ ){
1987
+ $apbct->sender_email = $user_email;
1988
+ $apbct->sender_ip = \Cleantalk\ApbctWP\Helper::ip__get(array('real'));
1989
+ add_filter('wp_new_user_notification_email_admin', 'apbct_registration__Wordpress__changeMailNotification', 100, 3);
1990
+ }
1991
+
1992
+ $ct_signup_done = true;
1993
+
1994
+ $ct_result = ct_change_plugin_resonse($ct_result, $checkjs);
1995
+
1996
+ $cleantalk_executed = true;
1997
+
1998
+ if ($ct_result->inactive != 0) {
1999
+ ct_send_error_notice($ct_result->comment);
2000
+ return $errors;
2001
+ }
2002
+
2003
+ if ($ct_result->allow == 0) {
2004
+
2005
+ if ($buddypress === true) {
2006
+ $bp->signup->errors['signup_username'] = $ct_result->comment;
2007
+ }elseif(!empty($facebook)){
2008
+ $_POST['FB_userdata']['email'] = '';
2009
+ $_POST['FB_userdata']['name'] = '';
2010
+ return;
2011
+ }else{
2012
+ if(is_wp_error($errors))
2013
+ $errors->add('ct_error', $ct_result->comment);
2014
+ $ct_negative_comment = $ct_result->comment;
2015
+ }
2016
+
2017
+ $ct_registration_error_comment = $ct_result->comment;
2018
+
2019
+ } else {
2020
+ if ($ct_result->id !== null) {
2021
+ \Cleantalk\Common\Helper::apbct_cookie__set($apbct_cookie_register_ok_label, $ct_result->id, time()+10, '/');
2022
+ \Cleantalk\Common\Helper::apbct_cookie__set($apbct_cookie_request_id_label, $ct_result->id, time()+10, '/');
2023
+ }
2024
+ }
2025
+
2026
+ return $errors;
2027
+ }
2028
+
2029
+ /**
2030
+ * Changes email notification for newly registred user
2031
+ *
2032
+ * @param string $wp_new_user_notification_email_admin Body of email notification
2033
+ * @param array $user User inof
2034
+ * @param string $blogname Blog name
2035
+ * @return string Body for email notification
2036
+ */
2037
+ function apbct_registration__Wordpress__changeMailNotification($wp_new_user_notification_email_admin, $user, $blogname){
2038
+
2039
+ global $apbct;
2040
+
2041
+ $wp_new_user_notification_email_admin['message'] = PHP_EOL
2042
+ .__('CleanTalk AntiSpam: This registration is spam.', 'cleantalk-spam-protect')
2043
+ ."\n" . __('CleanTalk\'s anti-spam database:', 'cleantalk-spam-protect')
2044
+ ."\n" . 'IP: ' . $apbct->sender_ip
2045
+ ."\n" . 'Email: ' . $apbct->sender_email
2046
+ .PHP_EOL . PHP_EOL .
2047
+ __('Activate protection in your Anti-Spam Dashboard: ', 'clentalk')
2048
+ .'https://cleantalk.org/my/?cp_mode=antispam&utm_source=newsletter&utm_medium=email&utm_campaign=wp_spam_registration_passed'
2049
+ .($apbct->data['user_token']
2050
+ ? '&iser_token='.$apbct->data['user_token']
2051
+ : ''
2052
+ )
2053
+ .PHP_EOL . '---'
2054
+ .PHP_EOL
2055
+ .$wp_new_user_notification_email_admin['message'];
2056
+
2057
+ return $wp_new_user_notification_email_admin;
2058
+
2059
+
2060
+ }
2061
+
2062
+ /**
2063
+ * Checks Ultimate Members registration for spam
2064
+ *
2065
+ * @param $args forms arguments with names and values
2066
+ *
2067
+ * @return mixed
2068
+ *
2069
+ */
2070
+ function apbct_registration__UltimateMembers__check( $args ){
2071
+
2072
+ if ( isset( UM()->form()->errors ) ) {
2073
+ $sender_info['previous_form_validation'] = true;
2074
+ $sender_info['validation_notice'] = json_encode( UM()->form()->errors );
2075
+ }
2076
+
2077
+ global $apbct, $cleantalk_executed;
2078
+
2079
+ if ($apbct->settings['registrations_test'] == 0) {
2080
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
2081
+ return $args;
2082
+ }
2083
+
2084
+
2085
+ $checkjs = apbct_js_test('ct_checkjs_register_form', $args);
2086
+ $sender_info['post_checkjs_passed'] = $checkjs;
2087
+
2088
+ // This hack can be helpfull when plugin uses with untested themes&signups plugins.
2089
+ if ($checkjs == 0) {
2090
+ $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
2091
+ $sender_info['cookie_checkjs_passed'] = $checkjs;
2092
+ }
2093
+
2094
+ $base_call_result = apbct_base_call(
2095
+ array(
2096
+ 'sender_email' => $args['user_email'],
2097
+ 'sender_nickname' => $args['user_login'],
2098
+ 'sender_info' => $sender_info,
2099
+ 'js_on' => $checkjs,
2100
+ ),
2101
+ true
2102
+ );
2103
+ $ct_result = $base_call_result['ct_result'];
2104
+
2105
+ $cleantalk_executed = true;
2106
+
2107
+ if ($ct_result->inactive != 0) {
2108
+ ct_send_error_notice($ct_result->comment);
2109
+ return $args;
2110
+ }
2111
+
2112
+ if ($ct_result->allow == 0)
2113
+ UM()->form()->add_error('user_password', $ct_result->comment );
2114
+
2115
+ return $args;
2116
+ }
2117
+
2118
+ /**
2119
+ * Checks registration error and set it if it was dropped
2120
+ * @return errors
2121
+ */
2122
+ function ct_check_registration_erros($errors, $sanitized_user_login = null, $user_email = null) {
2123
+ global $bp, $ct_registration_error_comment;
2124
+
2125
+ if($ct_registration_error_comment){
2126
+
2127
+ if(isset($bp))
2128
+ if(method_exists($bp, 'signup'))
2129
+ if(method_exists($bp->signup, 'errors'))
2130
+ if(isset($bp->signup->errors['signup_username']))
2131
+ if($bp->signup->errors['signup_username'] != $ct_registration_error_comment)
2132
+ $bp->signup->errors['signup_username'] = $ct_registration_error_comment;
2133
+
2134
+ if(isset($errors))
2135
+ if(method_exists($errors, 'errors'))
2136
+ if(isset($errors->errors['ct_error']))
2137
+ if($errors->errors['ct_error'][0] != $ct_registration_error_comment)
2138
+ $errors->add('ct_error', $ct_registration_error_comment);
2139
+
2140
+ }
2141
+ return $errors;
2142
+ }
2143
+
2144
+ /**
2145
+ * Set user meta (ct_hash) for successed registration
2146
+ * @return null
2147
+ */
2148
+ function apbct_user_register($user_id) {
2149
+ global $apbct_cookie_request_id_label;
2150
+ if (isset($_COOKIE[$apbct_cookie_request_id_label])) {
2151
+ if(update_user_meta($user_id, 'ct_hash', $_COOKIE[$apbct_cookie_request_id_label])){
2152
+ \Cleantalk\Common\Helper::apbct_cookie__set($apbct_cookie_request_id_label, '0', 1, '/');
2153
+ }
2154
+ }
2155
+ }
2156
+
2157
+
2158
+ /**
2159
+ * Test for JetPack contact form
2160
+ */
2161
+ function ct_grunion_contact_form_field_html($r, $field_label) {
2162
+
2163
+ global $ct_checkjs_jpcf, $ct_jpcf_patched, $ct_jpcf_fields, $apbct;
2164
+
2165
+ if ($apbct->settings['contact_forms_test'] == 1 && $ct_jpcf_patched === false && preg_match( "/(text|email)/i", $r)) {
2166
+
2167
+ // Looking for element name prefix
2168
+ $name_patched = false;
2169
+ foreach ($ct_jpcf_fields as $v) {
2170
+ if ($name_patched === false && preg_match("/(g\d-)$v/", $r, $matches)) {
2171
+ $ct_checkjs_jpcf = $matches[1] . $ct_checkjs_jpcf;
2172
+ $name_patched = true;
2173
+ }
2174
+ }
2175
+
2176
+ $r .= ct_add_hidden_fields($ct_checkjs_jpcf, true);
2177
+ $ct_jpcf_patched = true;
2178
+ }
2179
+
2180
+ return $r;
2181
+ }
2182
+ /**
2183
+ * Test for JetPack contact form
2184
+ */
2185
+ function ct_contact_form_is_spam($form) {
2186
+
2187
+ global $ct_checkjs_jpcf, $apbct;
2188
+
2189
+ if ($apbct->settings['contact_forms_test'] == 0) {
2190
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
2191
+ return null;
2192
+ }
2193
+
2194
+ $js_field_name = $ct_checkjs_jpcf;
2195
+ foreach ($_POST as $k => $v) {
2196
+ if (preg_match("/^.+$ct_checkjs_jpcf$/", $k))
2197
+ $js_field_name = $k;
2198
+ }
2199
+
2200
+ $sender_email = null;
2201
+ $sender_nickname = null;
2202
+ $message = '';
2203
+ if (isset($form['comment_author_email']))
2204
+ $sender_email = $form['comment_author_email'];
2205
+
2206
+ if (isset($form['comment_author']))
2207
+ $sender_nickname = $form['comment_author'];
2208
+
2209
+ if (isset($form['comment_content']))
2210
+ $message = $form['comment_content'];
2211
+
2212
+ $base_call_result = apbct_base_call(
2213
+ array(
2214
+ 'message' => $message,
2215
+ 'sender_email' => $sender_email,
2216
+ 'sender_nickname' => $sender_nickname,
2217
+ 'post_info' => array('comment_type' => 'contact_form_wordpress_grunion'),
2218
+ 'sender_info' => array('sender_url' => @$form['comment_author_url']),
2219
+ 'js_on' => apbct_js_test($js_field_name, $_POST),
2220
+ )
2221
+ );
2222
+ $ct_result = $base_call_result['ct_result'];
2223
+
2224
+ if ($ct_result->allow == 0) {
2225
+ global $ct_comment;
2226
+ $ct_comment = $ct_result->comment;
2227
+ ct_die(null, null);
2228
+ exit;
2229
+ }
2230
+
2231
+ return (bool) !$ct_result->allow;
2232
+ }
2233
+
2234
+ function ct_contact_form_is_spam_jetpack($is_spam,$form) {
2235
+ global $ct_checkjs_jpcf, $apbct;
2236
+
2237
+ if ($apbct->settings['contact_forms_test'] == 0) {
2238
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
2239
+ return null;
2240
+ }
2241
+
2242
+ $js_field_name = $ct_checkjs_jpcf;
2243
+ foreach ($_POST as $k => $v) {
2244
+ if (preg_match("/^.+$ct_checkjs_jpcf$/", $k))
2245
+ $js_field_name = $k;
2246
+ }
2247
+
2248
+ $base_call_result = apbct_base_call(
2249
+ array(
2250
+ 'message' => isset($form['comment_content']) ? $form['comment_content'] : '',
2251
+ 'sender_email' => isset($form['comment_author_email']) ? $form['comment_author_email'] : null,
2252
+ 'sender_nickname' => isset($form['comment_author']) ? $form['comment_author'] : null,
2253
+ 'post_info' => array('comment_type' => 'contact_form_wordpress_grunion'),
2254
+ 'sender_info' => array('sender_url' => @$form['comment_author_url']),
2255
+ )
2256
+ );
2257
+ $ct_result = $base_call_result['ct_result'];
2258
+
2259
+ if ($ct_result->allow == 0) {
2260
+ global $ct_comment;
2261
+ $ct_comment = $ct_result->comment;
2262
+ ct_die(null, null);
2263
+ exit;
2264
+ }
2265
+
2266
+ return (bool) !$ct_result->allow;
2267
+ }
2268
+
2269
+ /**
2270
+ * Inserts anti-spam hidden to WP Maintenance Mode (wpmm)
2271
+ */
2272
+ function apbct_form__wpmm__addField(){
2273
+ ct_add_hidden_fields('ct_checkjs', false, true, true);
2274
+ }
2275
+
2276
+ /**
2277
+ * Inserts anti-spam hidden to CF7
2278
+ */
2279
+ function apbct_form__contactForm7__addField($html) {
2280
+ global $ct_checkjs_cf7, $apbct;
2281
+
2282
+
2283
+
2284
+ if ($apbct->settings['contact_forms_test'] == 0) {
2285
+ return $html;
2286
+ }
2287
+
2288
+ $html .= ct_add_hidden_fields($ct_checkjs_cf7, true);
2289
+
2290
+ return $html;
2291
+ }
2292
+
2293
+ /**
2294
+ * Test spam for Contact Fomr 7 (CF7) right before validation
2295
+ *
2296
+ * @global SpbcState $apbct
2297
+ * @param type $result
2298
+ * @param type $tags
2299
+ * @return type
2300
+ */
2301
+ function apbct_form__contactForm7__tesSpam__before_validate($result = null, $tags = null) {
2302
+ global $apbct;
2303
+
2304
+ if ($result && method_exists($result, 'get_invalid_fields')){
2305
+ $invalid_fields = $result->get_invalid_fields();
2306
+ if(!empty($invalid_fields) && is_array($invalid_fields)){
2307
+ $apbct->validation_error = $invalid_fields[key($invalid_fields)]['reason'];
2308
+ apbct_form__contactForm7__testSpam(false);
2309
+ }
2310
+ }
2311
+
2312
+ return $result;
2313
+ }
2314
+
2315
+ /**
2316
+ * Test CF7 message for spam
2317
+ */
2318
+ function apbct_form__contactForm7__testSpam($param) {
2319
+
2320
+ global $ct_checkjs_cf7, $apbct;
2321
+
2322
+ if(
2323
+ $apbct->settings['contact_forms_test'] == 0 ||
2324
+ $param == false && WPCF7_VERSION < '3.0.0' ||
2325
+ $param === true && WPCF7_VERSION >= '3.0.0' ||
2326
+ $apbct->settings['protect_logged_in'] != 1 && is_user_logged_in() || // Skip processing for logged in users.
2327
+ apbct_exclusions_check__url() ||
2328
+ apbct_exclusions_check__ip() ||
2329
+ isset($apbct->cf7_checked)
2330
+ ){
2331
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
2332
+ return $param;
2333
+ }
2334
+
2335
+ $checkjs = apbct_js_test($ct_checkjs_cf7, $_POST)
2336
+ ? apbct_js_test($ct_checkjs_cf7, $_POST)
2337
+ : apbct_js_test('ct_checkjs', $_COOKIE);
2338
+
2339
+ $ct_temp_msg_data = ct_get_fields_any($_POST);
2340
+
2341
+ $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
2342
+ $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
2343
+ $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
2344
+ $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
2345
+ $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
2346
+ if ($subject != '') {
2347
+ $message = array_merge(array('subject' => $subject), $message);
2348
+ }
2349
+
2350
+ $base_call_result = apbct_base_call(
2351
+ array(
2352
+ 'message' => $message,
2353
+ 'sender_email' => $sender_email,
2354
+ 'sender_nickname' => $sender_nickname,
2355
+ 'js_on' => $checkjs,
2356
+ 'post_info' => array('comment_type' => 'contact_form_wordpress_cf7'),
2357
+ 'sender_info' => array(
2358
+ 'form_validation' => !isset($apbct->validation_error)
2359
+ ? null
2360
+ : json_encode(array(
2361
+ 'validation_notice' => $apbct->validation_error,
2362
+ 'page_url' => apbct_get_server_variable( 'HTTP_HOST' ) . apbct_get_server_variable( 'REQUEST_URI' ),
2363
+ ))
2364
+ ),
2365
+ )
2366
+ );
2367
+
2368
+ $ct_result = $base_call_result['ct_result'];
2369
+
2370
+ // Change mail notification if license is out of date
2371
+ if($apbct->data['moderate'] == 0 &&
2372
+ ($ct_result->fast_submit == 1 || $ct_result->blacklisted == 1 || $ct_result->js_disabled == 1)
2373
+ ){
2374
+ $apbct->sender_email = $sender_email;
2375
+ $apbct->sender_ip = \Cleantalk\ApbctWP\Helper::ip__get(array('real'));
2376
+ add_filter('wpcf7_mail_components', 'apbct_form__contactForm7__changeMailNotification');
2377
+ }
2378
+
2379
+ if ($ct_result->allow == 0) {
2380
+
2381
+ global $ct_cf7_comment;
2382
+ $ct_cf7_comment = $ct_result->comment;
2383
+
2384
+ add_filter('wpcf7_display_message', 'apbct_form__contactForm7__showResponse', 10, 2);
2385
+
2386
+ $param = WPCF7_VERSION >= '3.0.0' ? true : false;
2387
+
2388
+ }
2389
+
2390
+ $apbct->cf7_checked = true;
2391
+
2392
+ return $param;
2393
+ }
2394
+
2395
+ /**
2396
+ * Changes CF7 status message
2397
+ * @param string $hook URL of hooked page
2398
+ */
2399
+ function apbct_form__contactForm7__showResponse($message, $status = 'spam') {
2400
+ global $ct_cf7_comment;
2401
+
2402
+ if ($status == 'spam') {
2403
+ $message = $ct_cf7_comment;
2404
+ }
2405
+
2406
+ return $message;
2407
+ }
2408
+
2409
+ /**
2410
+ * Changes email notification for succes subscription for Contact Form 7
2411
+ *
2412
+ * @param array $component Arguments for email notification
2413
+ * @return array Arguments for email notification
2414
+ */
2415
+ function apbct_form__contactForm7__changeMailNotification($component){
2416
+
2417
+ global $apbct;
2418
+
2419
+ $component['body'] =
2420
+ __('CleanTalk AntiSpam: This message is spam.', 'cleantalk-spam-protect')
2421
+ .PHP_EOL . __('CleanTalk\'s anti-spam database:', 'cleantalk-spam-protect')
2422
+ .PHP_EOL . 'IP: ' . $apbct->sender_ip
2423
+ .PHP_EOL . 'Email: ' . $apbct->sender_email
2424
+ .PHP_EOL . sprintf(
2425
+ __('Activate protection in your Anti-Spam Dashboard: %s.', 'clentalk'),
2426
+ 'https://cleantalk.org/my/?cp_mode=antispam&utm_source=newsletter&utm_medium=email&utm_campaign=cf7_activate_antispam&user_token='.$apbct->user_token
2427
+ )
2428
+ .PHP_EOL . '---' . PHP_EOL . PHP_EOL
2429
+ .$component['body'];
2430
+
2431
+ return (array) $component;
2432
+ }
2433
+
2434
+ /**
2435
+ * Test Ninja Forms message for spam
2436
+ *
2437
+ * @global SpbcState $apbct
2438
+ * @return void
2439
+ */
2440
+ function apbct_form__ninjaForms__testSpam() {
2441
+
2442
+ global $apbct;
2443
+
2444
+ if(
2445
+ $apbct->settings['contact_forms_test'] == 0
2446
+ || ($apbct->settings['protect_logged_in'] != 1 && is_user_logged_in()) // Skip processing for logged in users.
2447
+ || apbct_exclusions_check__url()
2448
+ ){
2449
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
2450
+ return;
2451
+ }
2452
+
2453
+ $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
2454
+
2455
+ // Choosing between POST and GET
2456
+ $params = ct_get_fields_any(isset($_GET['ninja_forms_ajax_submit']) || isset($_GET['nf_ajax_submit']) ? $_GET : $_POST);
2457
+
2458
+ $sender_email = ($params['email'] ? $params['email'] : '');
2459
+ $sender_nickname = ($params['nickname'] ? $params['nickname'] : '');
2460
+ $subject = ($params['subject'] ? $params['subject'] : '');
2461
+ $message = ($params['message'] ? $params['message'] : array());
2462
+ if ($subject != '') {
2463
+ $message = array_merge(array('subject' => $subject), $message);
2464
+ }
2465
+
2466
+ //Ninja Forms xml fix
2467
+ foreach ($message as $key => $value){
2468
+ if (strpos($value, '<xml>') !== false)
2469
+ unset($message[$key]);
2470
+ }
2471
+
2472
+ $base_call_result = apbct_base_call(
2473
+ array(
2474
+ 'message' => $message,
2475
+ 'sender_email' => $sender_email,
2476
+ 'sender_nickname' => $sender_nickname,
2477
+ 'post_info' => array('comment_type' => 'contact_form_wordpress_ninja_froms'),
2478
+ 'js_on' => $checkjs,
2479
+ )
2480
+ );
2481
+ $ct_result = $base_call_result['ct_result'];
2482
+
2483
+ // Change mail notification if license is out of date
2484
+ if($apbct->data['moderate'] == 0 &&
2485
+ ($ct_result->fast_submit == 1 || $ct_result->blacklisted == 1 || $ct_result->js_disabled == 1)
2486
+ ){
2487
+ $apbct->sender_email = $sender_email;
2488
+ $apbct->sender_ip = \Cleantalk\ApbctWP\Helper::ip__get(array('real'));
2489
+ add_filter('ninja_forms_action_email_message', 'apbct_form__ninjaForms__changeMailNotification', 1, 3);
2490
+ }
2491
+
2492
+ if ($ct_result->allow == 0) {
2493
+
2494
+ // We have to use GLOBAL variable to transfer the comment to apbct_form__ninjaForms__changeResponse() function :(
2495
+ $apbct->response = $ct_result->comment;
2496
+ add_action( 'ninja_forms_before_response', 'apbct_form__ninjaForms__changeResponse', 10, 1 );
2497
+ add_action( 'ninja_forms_action_email_send', 'apbct_form__ninjaForms__stopEmail', 1, 5 ); // Prevent mail notification
2498
+ add_action( 'ninja_forms_save_submission', 'apbct_form__ninjaForms__preventSubmission', 1, 2 ); // Prevent mail notification
2499
+ }
2500
+ }
2501
+
2502
+ function apbct_form__ninjaForms__preventSubmission($some, $form_id){
2503
+ return false;
2504
+ }
2505
+
2506
+ function apbct_form__ninjaForms__stopEmail($some, $action_settings, $message, $headers, $attachments){
2507
+ global $apbct;
2508
+ throw new Exception($apbct->response);
2509
+ }
2510
+
2511
+ function apbct_form__ninjaForms__changeResponse( $data ) {
2512
+
2513
+ global $apbct;
2514
+
2515
+ // Show error message below field found by ID
2516
+ if(array_key_exists('email', $data['fields_by_key'])){
2517
+ // Find ID of EMAIL field
2518
+ $nf_field_id = $data['fields_by_key']['email']['id'];
2519
+ }else{
2520
+ // Find ID of last field (usually SUBMIT)
2521
+ $nf_field_id = array_pop(array_keys($data['fields']));
2522
+ }
2523
+
2524
+ // Below is modified NJ logic
2525
+ $error = array(
2526
+ 'fields' => array(
2527
+ $nf_field_id => $apbct->response,
2528
+ ),
2529
+ );
2530
+
2531
+ $response = array( 'data' => $data, 'errors' => $error, 'debug' => '' );
2532
+
2533
+ die(wp_json_encode( $response, JSON_FORCE_OBJECT ));
2534
+
2535
+ }
2536
+
2537
+ function apbct_form__seedprod_coming_soon__testSpam() {
2538
+
2539
+ global $apbct;
2540
+
2541
+ if(
2542
+ $apbct->settings['contact_forms_test'] == 0
2543
+ || ($apbct->settings['protect_logged_in'] != 1 && is_user_logged_in()) // Skip processing for logged in users.
2544
+ || apbct_exclusions_check__url()
2545
+ ){
2546
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
2547
+ return;
2548
+ }
2549
+
2550
+ $ct_temp_msg_data = ct_get_fields_any($_REQUEST);
2551
+
2552
+ $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
2553
+ $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
2554
+ $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
2555
+ $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
2556
+ if ($subject != '') {
2557
+ $message = array_merge(array('subject' => $subject), $message);
2558
+ }
2559
+
2560
+ $post_info['comment_type'] = 'contact_form_wordpress_seedprod_coming_soon';
2561
+
2562
+ $base_call_result = apbct_base_call(
2563
+ array(
2564
+ 'message' => $message,
2565
+ 'sender_email' => $sender_email,
2566
+ 'sender_nickname' => $sender_nickname,
2567
+ 'post_info' => $post_info,
2568
+ )
2569
+ );
2570
+
2571
+ $ct_result = $base_call_result['ct_result'];
2572
+ if ($ct_result->allow == 0) {
2573
+ global $ct_comment;
2574
+ $ct_comment = $ct_result->comment;
2575
+
2576
+ $response = array(
2577
+ 'status' => 200,
2578
+ 'html' => "<h1>".__('Spam protection by CleanTalk', 'cleantalk-spam-protect')."</h1><h2>".$ct_result->comment."</h2>"
2579
+ );
2580
+
2581
+ echo sanitize_text_field($_GET['callback']) . '(' . json_encode($response) . ')';
2582
+ exit();
2583
+ }
2584
+
2585
+ }
2586
+
2587
+ /**
2588
+ * Changes email notification for succes subscription for Ninja Forms
2589
+ *
2590
+ * @param string $message Body of email notification
2591
+ * @return string Body for email notification
2592
+ */
2593
+ function apbct_form__ninjaForms__changeMailNotification($message, $data, $action_settings){
2594
+
2595
+ global $apbct;
2596
+
2597
+ if($action_settings['to'] !== $apbct->sender_email){
2598
+
2599
+ $message .= wpautop(PHP_EOL . '---'
2600
+ .PHP_EOL
2601
+ .__('CleanTalk AntiSpam: This message is spam.', 'cleantalk-spam-protect')
2602
+ .PHP_EOL . __('CleanTalk\'s anti-spam database:', 'cleantalk-spam-protect')
2603
+ .PHP_EOL . 'IP: ' . $apbct->sender_ip
2604
+ .PHP_EOL . 'Email: ' . $apbct->sender_email
2605
+ .PHP_EOL .
2606
+ __('Activate protection in your Anti-Spam Dashboard: ', 'clentalk').
2607
+ 'https://cleantalk.org/my/?cp_mode=antispam&utm_source=newsletter&utm_medium=email&utm_campaign=ninjaform_activate_antispam'.$apbct->user_token
2608
+ );
2609
+ }
2610
+
2611
+ return $message;
2612
+ }
2613
+
2614
+ /**
2615
+ * Inserts anti-spam hidden to WPForms
2616
+ *
2617
+ * @global SpbcState $apbct
2618
+ * @return void
2619
+ */
2620
+ function apbct_form__WPForms__addField($form_data, $some, $title, $description, $errors) {
2621
+
2622
+ global $apbct;
2623
+
2624
+ if($apbct->settings['contact_forms_test'] == 1)
2625
+ ct_add_hidden_fields('checkjs_wpforms', false);
2626
+
2627
+ }
2628
+
2629
+ /**
2630
+ * Gather fields data from submission and store it
2631
+ *
2632
+ * @param array $entry
2633
+ * @param $form
2634
+ *
2635
+ * @return array
2636
+ * @global SpbcState $apbct
2637
+ */
2638
+ function apbct_from__WPForms__gatherData($entry, $form){
2639
+
2640
+ global $apbct;
2641
+
2642
+ $data = array();
2643
+ foreach($entry['fields'] as $key => $val){
2644
+ $true_key = strtolower(str_replace(' ', '_', $form['fields'][$key]['label']));
2645
+ $true_key = $true_key ? $true_key : $key;
2646
+ $data[$true_key] = $val;
2647
+ } unset($key, $val);
2648
+
2649
+ $apbct->form_data = $data;
2650
+
2651
+ return $entry;
2652
+ }
2653
+
2654
+ /**
2655
+ * Adding error to form entry if message is spam
2656
+ * Call spam test from here
2657
+ *
2658
+ * @param array $errors
2659
+ * @param array $form_data
2660
+ * @return array
2661
+ */
2662
+ function apbct_form__WPForms__showResponse($errors, $form_data) {
2663
+
2664
+ if(empty($errors) || ( isset($form_data['id'], $errors[$form_data['id']]) && !count($errors[$form_data['id']]) ) ){
2665
+
2666
+ $spam_comment = apbct_form__WPForms__testSpam();
2667
+
2668
+ $filed_id = $form_data && !empty($form_data['fields']) && is_array($form_data['fields'])
2669
+ ? key($form_data['fields'])
2670
+ : 0;
2671
+
2672
+ if($spam_comment)
2673
+ $errors[ $form_data['id'] ][ $filed_id ] = $spam_comment;
2674
+
2675
+ }
2676
+
2677
+ return $errors;
2678
+ }
2679
+
2680
+ /**
2681
+ * Test WPForms message for spam
2682
+ * Doesn't hooked anywhere.
2683
+ * Called directly from apbct_form__WPForms__showResponse()
2684
+ *
2685
+ * @global SpbcState $apbct
2686
+ * @global array $apbct->form_data Contains form data
2687
+ * @param array $errors Array of errors to write false result in
2688
+ * @return void|array|null
2689
+ */
2690
+ function apbct_form__WPForms__testSpam() {
2691
+
2692
+ global $apbct;
2693
+
2694
+ if(
2695
+ $apbct->settings['contact_forms_test'] == 0 ||
2696
+ $apbct->settings['protect_logged_in'] != 1 && is_user_logged_in() // Skip processing for logged in users.
2697
+ ){
2698
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
2699
+ return;
2700
+ }
2701
+
2702
+ $checkjs = apbct_js_test('checkjs_wpforms', $_POST);
2703
+
2704
+ $params = ct_get_fields_any($apbct->form_data);
2705
+
2706
+ $sender_email = ($params['email'] ? $params['email'] : '');
2707
+ $sender_nickname = ($params['nickname'] ? $params['nickname'] : '');
2708
+ $subject = ($params['subject'] ? $params['subject'] : '');
2709
+ $message = ($params['message'] ? $params['message'] : array());
2710
+ if ($subject != '') {
2711
+ $message = array_merge(array('subject' => $subject), $message);
2712
+ }
2713
+
2714
+ $base_call_result = apbct_base_call(
2715
+ array(
2716
+ 'message' => $message,
2717
+ 'sender_email' => $sender_email,
2718
+ 'sender_nickname' => $sender_nickname,
2719
+ 'post_info' => array('comment_type' => 'contact_form_wordpress_wp_forms'),
2720
+ 'js_on' => $checkjs,
2721
+ )
2722
+ );
2723
+ $ct_result = $base_call_result['ct_result'];
2724
+
2725
+ // Change mail notification if license is out of date
2726
+ if($apbct->data['moderate'] == 0 &&
2727
+ ($ct_result->fast_submit == 1 || $ct_result->blacklisted == 1 || $ct_result->js_disabled == 1)
2728
+ ){
2729
+ $apbct->sender_email = $sender_email;
2730
+ $apbct->sender_ip = \Cleantalk\ApbctWP\Helper::ip__get(array('real'));
2731
+ add_filter('wpforms_email_message', 'apbct_form__WPForms__changeMailNotification', 100, 2);
2732
+ }
2733
+
2734
+ if ($ct_result->allow == 0){
2735
+ return $ct_result->comment;
2736
+ }
2737
+
2738
+ return null;
2739
+
2740
+ }
2741
+
2742
+ /**
2743
+ * Changes email notification for succes subscription for Ninja Forms
2744
+ *
2745
+ * @param string $message Body of email notification
2746
+ * @param WPForms_WP_Emails $wpforms_email WPForms email class object
2747
+ * @return string Body for email notification
2748
+ */
2749
+ function apbct_form__WPForms__changeMailNotification($message, $wpforms_email){
2750
+
2751
+ global $apbct;
2752
+
2753
+ $message = str_replace('</html>', '', $message);
2754
+ $message = str_replace('</body>', '', $message);
2755
+ $message .= wpautop(PHP_EOL . '---'
2756
+ .PHP_EOL
2757
+ .__('CleanTalk AntiSpam: This message is spam.', 'cleantalk-spam-protect')
2758
+ .PHP_EOL . __('CleanTalk\'s anti-spam database:', 'cleantalk-spam-protect')
2759
+ .PHP_EOL . 'IP: ' . '<a href="https://cleantalk.org/blacklists/' . $apbct->sender_ip . '?utm_source=newsletter&utm_medium=email&utm_campaign=wpforms_spam_passed" target="_blank">' . $apbct->sender_ip . '</a>'
2760
+ .PHP_EOL . 'Email: ' . '<a href="https://cleantalk.org/blacklists/' . $apbct->sender_email . '?utm_source=newsletter&utm_medium=email&utm_campaign=wpforms_spam_passed" target="_blank">' . $apbct->sender_email . '</a>'
2761
+ .PHP_EOL . sprintf(
2762
+ __('Activate protection in your %sAnti-Spam Dashboard%s.', 'clentalk'),
2763
+ '<a href="https://cleantalk.org/my/?cp_mode=antispam&utm_source=newsletter&utm_medium=email&utm_campaign=wpforms_activate_antispam" target="_blank">',
2764
+ '</a>'
2765
+ ))
2766
+ .'</body></html>';
2767
+
2768
+ return $message;
2769
+
2770
+ }
2771
+
2772
+ /*
2773
+ * QuForms check spam
2774
+ * works with singl-paged forms
2775
+ * and with multi-paged forms - check only last step of the forms
2776
+ */
2777
+ function ct_quform_post_validate($result, $form) {
2778
+
2779
+ if ( $form->hasPages() ) {
2780
+ $comment_type = 'contact_form_wordpress_quforms_multipage';
2781
+ } else {
2782
+ $comment_type = 'contact_form_wordpress_quforms_singlepage';
2783
+ }
2784
+
2785
+ $ct_temp_msg_data = ct_get_fields_any( $form->getValues() );
2786
+ // @ToDo If we have several emails at the form - will be used only the first detected!
2787
+ $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
2788
+
2789
+ $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
2790
+ $base_call_result = apbct_base_call(
2791
+ array(
2792
+ 'message' => $form->getValues(),
2793
+ 'sender_email' => $sender_email,
2794
+ 'post_info' => array('comment_type' => $comment_type),
2795
+ 'js_on' => $checkjs,
2796
+ )
2797
+ );
2798
+
2799
+ $ct_result = $base_call_result['ct_result'];
2800
+ if ($ct_result->allow == 0) {
2801
+ die(json_encode(array('type' => 'error', 'apbct' => array('blocked' => true, 'comment' => $ct_result->comment))));
2802
+ } else {
2803
+ return $result;
2804
+ }
2805
+
2806
+ return $result;
2807
+
2808
+ }
2809
+
2810
+ /**
2811
+ * Inserts anti-spam hidden to Fast Secure contact form
2812
+ */
2813
+ function ct_si_contact_display_after_fields($string = '', $style = '', $form_errors = array(), $form_id_num = 0) {
2814
+ $string .= ct_add_hidden_fields('ct_checkjs', true);
2815
+ return $string;
2816
+ }
2817
+
2818
+ /**
2819
+ * Test for Fast Secure contact form
2820
+ */
2821
+ function ct_si_contact_form_validate($form_errors = array(), $form_id_num = 0) {
2822
+ global $apbct, $cleantalk_executed;
2823
+
2824
+ if (!empty($form_errors)) {
2825
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
2826
+ return $form_errors;
2827
+ }
2828
+
2829
+
2830
+ if ($apbct->settings['contact_forms_test'] == 0) {
2831
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
2832
+ return $form_errors;
2833
+ }
2834
+
2835
+ // Skip processing because data already processed.
2836
+ if ($cleantalk_executed) {
2837
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
2838
+ return $form_errors;
2839
+ }
2840
+
2841
+ //getting info from custom fields
2842
+ $ct_temp_msg_data = ct_get_fields_any($_POST);
2843
+
2844
+ $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
2845
+ $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
2846
+ $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
2847
+ $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
2848
+ $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
2849
+ if($subject != '') {
2850
+ $message['subject'] = $subject;
2851
+ }
2852
+
2853
+ $base_call_result = apbct_base_call(
2854
+ array(
2855
+ 'message' => $message,
2856
+ 'sender_email' => $sender_email,
2857
+ 'sender_nickname' => $sender_nickname,
2858
+ 'post_info' => array('comment_type' => 'contact_form_wordpress_fscf'),
2859
+ 'js_on' => apbct_js_test('ct_checkjs', $_POST),
2860
+ )
2861
+ );
2862
+
2863
+ $ct_result = $base_call_result['ct_result'];
2864
+
2865
+ $cleantalk_executed = true;
2866
+
2867
+ if ($ct_result->allow == 0) {
2868
+ global $ct_comment;
2869
+ $ct_comment = $ct_result->comment;
2870
+ ct_die(null, null);
2871
+ exit;
2872
+ }
2873
+
2874
+ return $form_errors;
2875
+ }
2876
+
2877
+ /**
2878
+ * Notice for commentators which comment has automatically approved by plugin
2879
+ * @param string $hook URL of hooked page
2880
+ */
2881
+ function ct_comment_text($comment_text) {
2882
+ global $comment, $ct_approved_request_id_label;
2883
+
2884
+ if (isset($_COOKIE[$ct_approved_request_id_label]) && isset($comment->comment_ID)) {
2885
+ $ct_hash = get_comment_meta($comment->comment_ID, 'ct_hash', true);
2886
+
2887
+ if ($ct_hash !== '' && $_COOKIE[$ct_approved_request_id_label] == $ct_hash) {
2888
+ $comment_text .= '<br /><br /> <em class="comment-awaiting-moderation">' . __('Comment approved. Anti-spam by CleanTalk.', 'cleantalk-spam-protect') . '</em>';
2889
+ }
2890
+ }
2891
+
2892
+ return $comment_text;
2893
+ }
2894
+
2895
+
2896
+ /**
2897
+ * Checks WordPress Landing Pages raw $_POST values
2898
+ */
2899
+ function ct_check_wplp(){
2900
+
2901
+ global $ct_wplp_result_label, $apbct;
2902
+
2903
+ if (!isset($_COOKIE[$ct_wplp_result_label])) {
2904
+ // First AJAX submit of WPLP form
2905
+ if ($apbct->settings['contact_forms_test'] == 0) {
2906
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
2907
+ return;
2908
+ }
2909
+
2910
+ $post_info['comment_type'] = 'feedback';
2911
+ $post_info = json_encode($post_info);
2912
+ if ($post_info === false)
2913
+ $post_info = '';
2914
+
2915
+ $sender_email = '';
2916
+ foreach ($_POST as $v) {
2917
+ if (preg_match("/^\S+@\S+\.\S+$/", $v)) {
2918
+ $sender_email = $v;
2919
+ break;
2920
+ }
2921
+ }
2922
+
2923
+ $message = '';
2924
+ if(array_key_exists('form_input_values', $_POST)){
2925
+ $form_input_values = json_decode(stripslashes($_POST['form_input_values']), true);
2926
+ if (is_array($form_input_values) && array_key_exists('null', $form_input_values))
2927
+ $message = $form_input_values['null'];
2928
+ } else if (array_key_exists('null', $_POST)) {
2929
+ $message = $_POST['null'];
2930
+ }
2931
+
2932
+ $base_call_result = apbct_base_call(
2933
+ array(
2934
+ 'message' => $message,
2935
+ 'sender_email' => $sender_email,
2936
+ 'post_info' => array('comment_type' => 'contact_form_wordpress_wplp'),
2937
+ )
2938
+ );
2939
+
2940
+ $ct_result = $base_call_result['ct_result'];
2941
+
2942
+ if ($ct_result->allow == 0) {
2943
+ $cleantalk_comment = $ct_result->comment;
2944
+ } else {
2945
+ $cleantalk_comment = 'OK';
2946
+ }
2947
+
2948
+ \Cleantalk\Common\Helper::apbct_cookie__set($ct_wplp_result_label, $cleantalk_comment, strtotime("+5 seconds"), '/');
2949
+ } else {
2950
+ // Next POST/AJAX submit(s) of same WPLP form
2951
+ $cleantalk_comment = $_COOKIE[$ct_wplp_result_label];
2952
+ }
2953
+ if ($cleantalk_comment !== 'OK')
2954
+ ct_die_extended($cleantalk_comment);
2955
+ }
2956
+
2957
+ /**
2958
+ * Places a hidding field to Gravity forms.
2959
+ * @return string
2960
+ */
2961
+ function apbct_form__gravityForms__addField($form_string, $form){
2962
+ $ct_hidden_field = 'ct_checkjs';
2963
+
2964
+ // Do not add a hidden field twice.
2965
+ if (preg_match("/$ct_hidden_field/", $form_string)) {
2966
+ return $form_string;
2967
+ }
2968
+
2969
+ $search = "</form>";
2970
+
2971
+ // Adding JS code
2972
+ $js_code = ct_add_hidden_fields($ct_hidden_field, true, false);
2973
+ $form_string = str_replace($search, $js_code . $search, $form_string);
2974
+
2975
+ // Adding field for multipage form. Look for cleantalk.php -> apbct_cookie();
2976
+ $append_string = isset($form['lastPageButton']) ? "<input type='hidden' name='ct_multipage_form' value='yes'>" : '';
2977
+ $form_string = str_replace($search, $append_string.$search, $form_string);
2978
+
2979
+ return $form_string;
2980
+ }
2981
+
2982
+ /**
2983
+ * Gravity forms anti-spam test.
2984
+ * @return boolean
2985
+ */
2986
+ function apbct_form__gravityForms__testSpam($is_spam, $form, $entry) {
2987
+
2988
+ global $apbct, $cleantalk_executed, $ct_gform_is_spam, $ct_gform_response;
2989
+
2990
+ if (
2991
+ $apbct->settings['contact_forms_test'] == 0 ||
2992
+ $is_spam ||
2993
+ $cleantalk_executed // Return unchanged result if the submission was already tested.
2994
+ ) {
2995
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
2996
+ return $is_spam;
2997
+ }
2998
+
2999
+ $ct_temp = array();
3000
+ foreach($entry as $key => $value){
3001
+ if(is_numeric($key))
3002
+ $ct_temp[$key]=$value;
3003
+ } unset($key, $value);
3004
+
3005
+ $ct_temp_msg_data = ct_get_fields_any($ct_temp);
3006
+ $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
3007
+ $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
3008
+ $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
3009
+ $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
3010
+ $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
3011
+
3012
+ // Adding 'input_' to every field /Gravity Forms fix/
3013
+ $tmp = $message;
3014
+ $message = array();
3015
+ foreach($tmp as $key => $value){
3016
+ $message[ 'input_' . $key] = $value;
3017
+ } unset( $key, $value, $tmp );
3018
+
3019
+ if($subject != '')
3020
+ $message['subject'] = $subject;
3021
+
3022
+ $checkjs = apbct_js_test('ct_checkjs', $_POST)
3023
+ ? apbct_js_test('ct_checkjs', $_POST)
3024
+ : apbct_js_test('ct_checkjs', $_COOKIE);
3025
+
3026
+ $base_call_result = apbct_base_call(
3027
+ array(
3028
+ 'message' => $message,
3029
+ 'sender_email' => $sender_email,
3030
+ 'sender_nickname' => $sender_nickname,
3031
+ 'post_info' => array('comment_type' => 'contact_form_wordpress_gravity_forms'),
3032
+ 'js_on' => $checkjs,
3033
+ )
3034
+ );
3035
+
3036
+ $ct_result = $base_call_result['ct_result'];
3037
+ if ($ct_result->allow == 0) {
3038
+ $is_spam = true;
3039
+ $ct_gform_is_spam = true;
3040
+ $ct_gform_response = $ct_result->comment;
3041
+ }
3042
+
3043
+ return $is_spam;
3044
+ }
3045
+
3046
+ function apbct_form__gravityForms__showResponse( $confirmation, $form, $entry, $ajax ){
3047
+
3048
+ global $ct_gform_is_spam, $ct_gform_response;
3049
+
3050
+ if(!empty($ct_gform_is_spam)){
3051
+ $confirmation = '<a id="gf_'.$form['id'].'" class="gform_anchor" ></a><div id="gform_confirmation_wrapper_'.$form['id'].'" class="gform_confirmation_wrapper "><div id="gform_confirmation_message_'.$form['id'].'" class="gform_confirmation_message_'.$form['id'].' gform_confirmation_message"><font style="color: red">'.$ct_gform_response.'</font></div></div>';
3052
+ }
3053
+
3054
+ return $confirmation;
3055
+ }
3056
+
3057
+ /**
3058
+ * Test S2member registration
3059
+ * @return array with errors
3060
+ */
3061
+ function ct_s2member_registration_test($post_key) {
3062
+
3063
+ global $apbct;
3064
+
3065
+ if ($apbct->settings['registrations_test'] == 0) {
3066
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
3067
+ return null;
3068
+ }
3069
+
3070
+ $sender_email = isset($_POST[$post_key]['email']) ? sanitize_email($_POST[$post_key]['email']) : null;
3071
+ $sender_nickname = isset($_POST[$post_key]['username']) ? sanitize_email($_POST[$post_key]['username']) : null;
3072
+
3073
+ //Making a call
3074
+ $base_call_result = apbct_base_call(
3075
+ array(
3076
+ 'sender_email' => $sender_email,
3077
+ 'sender_nickname' => $sender_nickname,
3078
+ ),
3079
+ true
3080
+ );
3081
+ $ct_result = $base_call_result['ct_result'];
3082
+
3083
+ if ($ct_result->allow == 0) {
3084
+ ct_die_extended($ct_result->comment);
3085
+ }
3086
+
3087
+ return true;
3088
+ }
3089
+
3090
+ function apbct_form__the7_contact_form() {
3091
+
3092
+ global $cleantalk_executed;
3093
+
3094
+ if ( check_ajax_referer( 'dt_contact_form', 'nonce', false ) && isset($_POST) ) {
3095
+
3096
+ $post_info['comment_type'] = 'contact_the7_theme_contact_form';
3097
+
3098
+ $ct_temp_msg_data = ct_get_fields_any($_POST);
3099
+
3100
+ $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
3101
+ $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
3102
+ $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
3103
+ $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
3104
+ $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
3105
+ if ($subject != '') {
3106
+ $message = array_merge(array('subject' => $subject), $message);
3107
+ }
3108
+
3109
+ // Skip submission if no data found
3110
+ if ($sender_email === ''|| !$contact_form) {
3111
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
3112
+ return false;
3113
+ }
3114
+ $cleantalk_executed = true;
3115
+
3116
+ $base_call_result = apbct_base_call(
3117
+ array(
3118
+ 'message' => $message,
3119
+ 'sender_email' => $sender_email,
3120
+ 'sender_nickname' => $sender_nickname,
3121
+ 'post_info' => $post_info,
3122
+ )
3123
+ );
3124
+
3125
+ $ct_result = $base_call_result['ct_result'];
3126
+ if ($ct_result->allow == 0) {
3127
+
3128
+ $response = json_encode(
3129
+ array(
3130
+ 'success' => false ,
3131
+ 'errors' => $ct_result->comment,
3132
+ 'nonce' => wp_create_nonce( 'dt_contact_form' )
3133
+ )
3134
+ );
3135
+
3136
+ // response output
3137
+ header( "Content-Type: application/json" );
3138
+ echo $response;
3139
+
3140
+ // IMPORTANT: don't forget to "exit"
3141
+ exit;
3142
+
3143
+ }
3144
+
3145
+ }
3146
+
3147
+ }
3148
+
3149
+ function apbct_form__elementor_pro__testSpam() {
3150
+
3151
+ global $apbct, $cleantalk_executed;
3152
+
3153
+ if(
3154
+ $apbct->settings['contact_forms_test'] == 0
3155
+ || ($apbct->settings['protect_logged_in'] != 1 && is_user_logged_in()) // Skip processing for logged in users.
3156
+ || apbct_exclusions_check__url()
3157
+ ){
3158
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
3159
+ return;
3160
+ }
3161
+
3162
+ $ct_temp_msg_data = ct_get_fields_any($_POST);
3163
+
3164
+ $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
3165
+ $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
3166
+ $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
3167
+ $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
3168
+ if ($subject != '') {
3169
+ $message = array_merge(array('subject' => $subject), $message);
3170
+ }
3171
+
3172
+ $post_info['comment_type'] = 'contact_form_wordpress_elementor_pro';
3173
+
3174
+ $cleantalk_executed = true;
3175
+ $base_call_result = apbct_base_call(
3176
+ array(
3177
+ 'message' => $message,
3178
+ 'sender_email' => $sender_email,
3179
+ 'sender_nickname' => $sender_nickname,
3180
+ 'post_info' => $post_info,
3181
+ )
3182
+ );
3183
+
3184
+ $ct_result = $base_call_result['ct_result'];
3185
+
3186
+ if ($ct_result->allow == 0) {
3187
+
3188
+ wp_send_json_error( array(
3189
+ 'message' => $ct_result->comment,
3190
+ 'data' => array()
3191
+ ) );
3192
+
3193
+ }
3194
+
3195
+ }
3196
+
3197
+ // INEVIO theme integration
3198
+ function apbct_form__inevio__testSpam() {
3199
+
3200
+ global $apbct, $cleantalk_executed;
3201
+
3202
+ $theme = wp_get_theme();
3203
+ if(
3204
+ stripos( $theme->get( 'Name' ), 'INEVIO' ) === false ||
3205
+ $apbct->settings['contact_forms_test'] == 0 ||
3206
+ ($apbct->settings['protect_logged_in'] != 1 && is_user_logged_in()) || // Skip processing for logged in users.
3207
+ apbct_exclusions_check__url()
3208
+ ) {
3209
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
3210
+ return false;
3211
+ }
3212
+ $form_data = array();
3213
+ parse_str($_POST['data'], $form_data);
3214
+
3215
+ $name = isset($form_data['name']) ? $form_data['name'] : '';
3216
+ $email = isset($form_data['email']) ? $form_data['email'] : '';
3217
+ $message = isset($form_data['message']) ? $form_data['message'] : '';
3218
+
3219
+ $post_info['comment_type'] = 'contact_form_wordpress_inevio_theme';
3220
+
3221
+ $cleantalk_executed = true;
3222
+ $base_call_result = apbct_base_call(
3223
+ array(
3224
+ 'message' => $message,
3225
+ 'sender_email' => $email,
3226
+ 'sender_nickname' => $name,
3227
+ 'post_info' => $post_info,
3228
+ )
3229
+ );
3230
+
3231
+ $ct_result = $base_call_result['ct_result'];
3232
+
3233
+ if ( $ct_result->allow == 0 ) {
3234
+ die(json_encode(array('apbct' => array('blocked' => true, 'comment' => $ct_result->comment,))));
3235
+ }
3236
+
3237
+ return true;
3238
+
3239
+ }
3240
+
3241
+ /**
3242
+ * General test for any contact form
3243
+ */
3244
+ function ct_contact_form_validate() {
3245
+
3246
+ global $pagenow,$cleantalk_executed ,$apbct, $ct_checkjs_frm;
3247
+
3248
+ // Exclusios common function
3249
+ if ( apbct_exclusions_check(__FUNCTION__) ) {
3250
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
3251
+ return null;
3252
+ }
3253
+
3254
+ if (@sizeof($_POST)==0 ||
3255
+ (isset($_POST['signup_username']) && isset($_POST['signup_email']) && isset($_POST['signup_password'])) ||
3256
+ (isset($pagenow) && $pagenow == 'wp-login.php') || // WordPress log in form
3257
+ (isset($pagenow) && $pagenow == 'wp-login.php' && isset($_GET['action']) && $_GET['action']=='lostpassword') ||
3258
+ apbct_is_in_referer( 'lostpassword' ) ||
3259
+ apbct_is_in_referer( 'lost-password' ) || //Skip lost-password form check
3260
+ (apbct_is_in_uri('/wp-admin/') && (empty($_POST['your-phone']) && empty($_POST['your-email']) && empty($_POST['your-message']))) || //Bitrix24 Contact
3261
+ apbct_is_in_uri('wp-login.php') ||
3262
+ apbct_is_in_uri('wp-comments-post.php') ||
3263
+ apbct_is_in_uri('?provider=facebook&') ||
3264
+ apbct_is_in_uri('reset-password/') || // Ticket #13668. Password reset.
3265
+ apbct_is_in_referer( '/wp-admin/') ||
3266
+ apbct_is_in_uri('/login/') ||
3267
+ apbct_is_in_uri( '/my-account/edit-account/') || // WooCommerce edit account page
3268
+ apbct_is_in_uri( '/my-account/edit-address/') || // WooCommerce edit account page
3269
+ (isset($_POST['action']) && $_POST['action'] == 'save_account_details') || // WooCommerce edit account action
3270
+ apbct_is_in_uri( '/peepsoajax/profilefieldsajax.validate_register') ||
3271
+ isset($_GET['ptype']) && $_GET['ptype']=='login' ||
3272
+ isset($_POST['ct_checkjs_register_form']) ||
3273
+ (isset($_POST['signup_username']) && isset($_POST['signup_password_confirm']) && isset($_POST['signup_submit']) ) ||
3274
+ $apbct->settings['general_contact_forms_test'] == 0 ||
3275
+ isset($_POST['bbp_topic_content']) ||
3276
+ isset($_POST['bbp_reply_content']) ||
3277
+ isset($_POST['fscf_submitted']) ||
3278
+ apbct_is_in_uri('/wc-api/') ||
3279
+ isset($_POST['log']) && isset($_POST['pwd']) && isset($_POST['wp-submit']) ||
3280
+ isset($_POST[$ct_checkjs_frm]) && $apbct->settings['contact_forms_test'] == 1 ||// Formidable forms
3281
+ ( isset($_POST['comment_post_ID']) && ! isset($_POST['comment-submit'] ) ) || // The comment form && ! DW Question & Answer
3282
+ isset($_GET['for']) ||
3283
+ (isset($_POST['log'], $_POST['pwd'])) || //WooCommerce Sensei login form fix
3284
+ (isset($_POST['wc_reset_password'], $_POST['_wpnonce'], $_POST['_wp_http_referer'])) || // WooCommerce recovery password form
3285
+ ((isset($_POST['woocommerce-login-nonce']) || isset($_POST['_wpnonce'])) && isset($_POST['login'], $_POST['password'], $_POST['_wp_http_referer'])) || // WooCommerce login form
3286
+ (isset($_POST['wc-api']) && strtolower($_POST['wc-api']) == 'wc_gateway_systempay') || // Woo Systempay payment plugin
3287
+ apbct_is_in_uri( 'wc-api=WC_Gateway_Realex_Redirect') || // Woo Realex payment Gateway plugin
3288
+ (isset($_POST['_wpcf7'], $_POST['_wpcf7_version'], $_POST['_wpcf7_locale'])) || //CF7 fix)
3289
+ (isset($_POST['hash'], $_POST['device_unique_id'], $_POST['device_name'])) ||//Mobile Assistant Connector fix
3290
+ isset($_POST['gform_submit']) || //Gravity form
3291
+ apbct_is_in_uri( 'wc-ajax=get_refreshed_fragments') ||
3292
+ (isset($_POST['ccf_form']) && intval($_POST['ccf_form']) == 1) ||
3293
+ (isset($_POST['contact_tags']) && strpos($_POST['contact_tags'], 'MBR:') !== false) ||
3294
+ (apbct_is_in_uri( 'bizuno.php') && !empty($_POST['bizPass'])) ||
3295
+ apbct_is_in_referer( 'my-dashboard/' ) || // ticket_id=7885
3296
+ isset($_POST['slm_action'], $_POST['license_key'], $_POST['secret_key'], $_POST['registered_domain']) || // ticket_id=9122
3297
+ (isset($_POST['wpforms']['submit']) && $_POST['wpforms']['submit'] == 'wpforms-submit') || // WPForms
3298
+ (isset($_POST['action']) && $_POST['action'] == 'grunion-contact-form') || // JetPack
3299
+ (isset($_POST['action']) && $_POST['action'] == 'bbp-update-user') || //BBP update user info page
3300
+ apbct_is_in_referer( '?wc-api=WC_Gateway_Transferuj' ) || //WC Gateway
3301
+ (isset($_GET['mbr'], $_GET['amp;appname'], $_GET['amp;master'])) || // ticket_id=10773
3302
+ (isset($_POST['call_function']) && $_POST['call_function'] == 'push_notification_settings') || // Skip mobile requests (push settings)
3303
+ apbct_is_in_uri('membership-login') || // Skip login form
3304
+ (isset($_GET['cookie-state-change'])) || //skip GDPR plugin
3305
+ ( apbct_get_server_variable( 'HTTP_USER_AGENT' ) == 'MailChimp' && apbct_is_in_uri( 'mc4wp-sync-api/webhook-listener') ) || // Mailchimp webhook skip
3306
+ apbct_is_in_uri('researcher-log-in') || // Skip login form
3307
+ apbct_is_in_uri('admin_aspcms/_system/AspCms_SiteSetting.asp?action=saves') || // Skip admin save callback
3308
+ apbct_is_in_uri('?profile_tab=postjobs') || // Skip post vacancies
3309
+ (isset($_POST['btn_insert_post_type_hotel']) && $_POST['btn_insert_post_type_hotel'] == 'SUBMIT HOTEL') || // Skip adding hotel
3310
+ (isset($_POST['action']) && $_POST['action'] == 'updraft_savesettings') || // Updraft save settings
3311
+ isset($_POST['quform_submit']) || //QForms multi-paged form skip
3312
+ (isset($_POST['wpum_form']) && $_POST['wpum_form'] == 'login') || //WPUM login skip
3313
+ isset($_POST['password']) || // Exception for login form. From Analysis uid=406596
3314
+ (isset($_POST['action']) && $_POST['action'] == 'wilcity_reset_password') || // Exception for reset password form. From Analysis uid=430898
3315
+ (isset($_POST['action']) && $_POST['action'] == 'wilcity_login') || // Exception for login form. From Analysis uid=430898
3316
+ (isset($_POST['qcfsubmit'])) || //Exception for submit quick forms - duplicates with qcfvalidate
3317
+ apbct_is_in_uri('tin-canny-learndash-reporting/src/h5p-xapi/process-xapi-statement.php?v=asd') || //Skip Tin Canny plugin
3318
+ ( isset( $_POST['na'], $_POST['ts'], $_POST['nhr'] ) && !apbct_is_in_uri( '?na=s' ) ) || // The Newsletter Plugin double requests fix. Ticket #14772
3319
+ (isset($_POST['spl_action']) && $_POST['spl_action'] == 'register') || //Skip interal action with empty params
3320
+ (isset($_POST['action']) && $_POST['action'] == 'bwfan_insert_abandoned_cart' && apbct_is_in_uri( 'my-account/edit-address' )) || //Skip edit account
3321
+ apbct_is_in_uri('login-1') || //Skip login form
3322
+ apbct_is_in_uri('recuperacao-de-senha-2') || //Skip form reset password
3323
+ apbct_is_in_uri('membermouse/api/request.php') && isset($_POST['membership_level_id'],$_POST['apikey'],$_POST['apisecret']) || // Membermouse API
3324
+ ( isset( $_POST['AppKey'] ) && ( isset( $_POST['cbAP'] ) && $_POST['cbAP'] == 'Caspio' ) ) || // Caspio exclusion (ticket #16444)
3325
+ isset($_POST['wpforms_id'], $_POST['wpforms_author']) //Skip wpforms
3326
+ ) {
3327
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
3328
+ return null;
3329
+ }
3330
+
3331
+ //Skip woocommerce checkout
3332
+ if (apbct_is_in_uri('wc-ajax=update_order_review') ||
3333
+ apbct_is_in_uri('wc-ajax=checkout') ||
3334
+ !empty($_POST['woocommerce_checkout_place_order']) ||
3335
+ apbct_is_in_uri('wc-ajax=wc_ppec_start_checkout') ||
3336
+ apbct_is_in_referer('wc-ajax=update_order_review')
3337
+ )
3338
+ {
3339
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
3340
+ return null;
3341
+ }
3342
+
3343
+ //Skip woocommerce add_to_cart
3344
+ if( ! empty( $_POST['add-to-cart'] ) )
3345
+ {
3346
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
3347
+ return null;
3348
+ }
3349
+
3350
+ // Do not execute anti-spam test for logged in users.
3351
+ if (isset($_COOKIE[LOGGED_IN_COOKIE]) && $apbct->settings['protect_logged_in'] != 1) {
3352
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
3353
+ return null;
3354
+ }
3355
+ //Skip WP Fusion web hooks
3356
+ if ( apbct_is_in_uri('wpf_action') && apbct_is_in_uri('access_key') && isset( $_GET['access_key'] ) ) {
3357
+ if( function_exists( 'wp_fusion' ) ) {
3358
+ $key = wp_fusion()->settings->get('access_key');
3359
+ if ( $key == $_GET['access_key'] ) {
3360
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
3361
+ return null;
3362
+ }
3363
+ }
3364
+ }
3365
+ //Skip system fields for divi
3366
+ if (strpos( \Cleantalk\Variables\Post::get('action'), 'et_pb_contactform_submit') === 0) {
3367
+ foreach ($_POST as $key => $value) {
3368
+ if (strpos($key, 'et_pb_contact_email_fields') === 0) {
3369
+ unset($_POST[$key]);
3370
+ }
3371
+ }
3372
+ }
3373
+ $post_info['comment_type'] = 'feedback_general_contact_form';
3374
+
3375
+ $ct_temp_msg_data = ct_get_fields_any($_POST);
3376
+
3377
+ $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
3378
+ $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
3379
+ $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
3380
+ $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
3381
+ $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
3382
+ if ($subject != '') {
3383
+ $message = array_merge(array('subject' => $subject), $message);
3384
+ }
3385
+
3386
+ // Skip submission if no data found
3387
+ if ($sender_email === ''|| !$contact_form) {
3388
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
3389
+ return false;
3390
+ }
3391
+ $cleantalk_executed=true;
3392
+
3393
+ if(isset($_POST['TellAFriend_Link'])){
3394
+ $tmp = $_POST['TellAFriend_Link'];
3395
+ unset($_POST['TellAFriend_Link']);
3396
+ }
3397
+
3398
+ $base_call_result = apbct_base_call(
3399
+ array(
3400
+ 'message' => $message,
3401
+ 'sender_email' => $sender_email,
3402
+ 'sender_nickname' => $sender_nickname,
3403
+ 'post_info' => $post_info,
3404
+ 'sender_info' => array( 'sender_email' => urlencode( $sender_email ) ),
3405
+ )
3406
+ );
3407
+
3408
+ if(isset($_POST['TellAFriend_Link'])){
3409
+ $_POST['TellAFriend_Link']=$tmp;
3410
+ }
3411
+
3412
+ $ct_result = $base_call_result['ct_result'];
3413
+ if ($ct_result->allow == 0) {
3414
+
3415
+ // Recognize contact form an set it's name to $contact_form to use later
3416
+ $contact_form = null;
3417
+ foreach($_POST as $param => $value){
3418
+ if(strpos($param, 'et_pb_contactform_submit') === 0){
3419
+ $contact_form = 'contact_form_divi_theme';
3420
+ $contact_form_additional = str_replace('et_pb_contactform_submit', '', $param);
3421
+ }
3422
+ if(strpos($param, 'avia_generated_form') === 0){
3423
+ $contact_form = 'contact_form_enfold_theme';
3424
+ $contact_form_additional = str_replace('avia_generated_form', '', $param);
3425
+ }
3426
+ if(!empty($contact_form))
3427
+ break;
3428
+ }
3429
+
3430
+ $ajax_call = false;
3431
+ if ((defined( 'DOING_AJAX' ) && DOING_AJAX)
3432
+ ) {
3433
+ $ajax_call = true;
3434
+ }
3435
+ if ($ajax_call) {
3436
+ echo $ct_result->comment;
3437
+ } else {
3438
+
3439
+ global $ct_comment;
3440
+ $ct_comment = $ct_result->comment;
3441
+ if(isset($_POST['cma-action'])&&$_POST['cma-action']=='add'){
3442
+ $result=Array('success'=>0, 'thread_id'=>null,'messages'=>Array($ct_result->comment));
3443
+ header("Content-Type: application/json");
3444
+ print json_encode($result);
3445
+ die();
3446
+
3447
+ }else if(isset($_POST['TellAFriend_email'])){
3448
+ echo $ct_result->comment;
3449
+ die();
3450
+
3451
+ }else if(isset($_POST['gform_submit'])){ // Gravity forms submission
3452
+ $response = sprintf("<!DOCTYPE html><html><head><meta charset='UTF-8' /></head><body class='GF_AJAX_POSTBACK'><div id='gform_confirmation_wrapper_1' class='gform_confirmation_wrapper '><div id='gform_confirmation_message_1' class='gform_confirmation_message_1
3453
+ gform_confirmation_message'>%s</div></div></body></html>",
3454
+ $ct_result->comment
3455
+ );
3456
+ echo $response;
3457
+ die();
3458
+
3459
+ }elseif(isset($_POST['action']) && $_POST['action'] == 'ct_check_internal'){
3460
+ return $ct_result->comment;
3461
+
3462
+ }elseif(isset($_POST['vfb-submit']) && defined('VFB_VERSION')){
3463
+ wp_die("<h1>".__('Spam protection by CleanTalk', 'cleantalk-spam-protect')."</h1><h2>".$ct_result->comment."</h2>", '', array('response' => 403, "back_link" => true, "text_direction" => 'ltr'));
3464
+ // Caldera Contact Forms
3465
+ }elseif(isset($_POST['action']) && $_POST['action'] == 'cf_process_ajax_submit'){
3466
+ print json_encode("<h3 style='color: red;'><red>".$ct_result->comment);
3467
+ die();
3468
+ // Mailster
3469
+ }elseif(isset($_POST['_referer'], $_POST['formid'], $_POST['email'])){
3470
+ $return = array(
3471
+ 'success' => false,
3472
+ 'html' => '<p>' . $ct_result->comment . '</p>',
3473
+ );
3474
+ print json_encode($return);
3475
+ die();
3476
+ // Divi Theme Contact Form. Using $contact_form
3477
+ }elseif(!empty($contact_form) && $contact_form == 'contact_form_divi_theme'){
3478
+ echo "<div id='et_pb_contact_form{$contact_form_additional}'><h1>Your request looks like spam.</h1><div><p>{$ct_result->comment}</p></div></div>";
3479
+ die();
3480
+ // Enfold Theme Contact Form. Using $contact_form
3481
+ }elseif(!empty($contact_form) && $contact_form == 'contact_form_enfold_theme'){
3482
+ echo "<div id='ajaxresponse_1' class='ajaxresponse ajaxresponse_1' style='display: block;'><div id='ajaxresponse_1' class='ajaxresponse ajaxresponse_1'><h3 class='avia-form-success'>Antispam by CleanTalk: ".$ct_result->comment."</h3><a href='.'><-Back</a></div></div>";
3483
+ die();
3484
+ }else{
3485
+ ct_die(null, null);
3486
+ }
3487
+ }
3488
+ exit;
3489
+ }
3490
+
3491
+ return null;
3492
+ }
3493
+
3494
+ /**
3495
+ * General test for any post data
3496
+ */
3497
+ function ct_contact_form_validate_postdata() {
3498
+
3499
+ global $apbct, $pagenow,$cleantalk_executed;
3500
+
3501
+ // Exclusios common function
3502
+ if ( apbct_exclusions_check(__FUNCTION__) ) {
3503
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
3504
+ return null;
3505
+ }
3506
+
3507
+ if (@sizeof($_POST)==0 ||
3508
+ (isset($_POST['signup_username']) && isset($_POST['signup_email']) && isset($_POST['signup_password'])) ||
3509
+ (isset($pagenow) && $pagenow == 'wp-login.php') || // WordPress log in form
3510
+ (isset($pagenow) && $pagenow == 'wp-login.php' && isset($_GET['action']) && $_GET['action']=='lostpassword') ||
3511
+ apbct_is_in_uri('/checkout/') ||
3512
+ /* WooCommerce Service Requests - skip them */
3513
+ isset($_GET['wc-ajax']) && (
3514
+ $_GET['wc-ajax']=='checkout' ||
3515
+ $_GET['wc-ajax']=='get_refreshed_fragments' ||
3516
+ $_GET['wc-ajax']=='apply_coupon' ||
3517
+ $_GET['wc-ajax']=='remove_coupon' ||
3518
+ $_GET['wc-ajax']=='update_shipping_method' ||
3519
+ $_GET['wc-ajax']=='get_cart_totals' ||
3520
+ $_GET['wc-ajax']=='update_order_review' ||
3521
+ $_GET['wc-ajax']=='add_to_cart' ||
3522
+ $_GET['wc-ajax']=='remove_from_cart' ||
3523
+ $_GET['wc-ajax']=='get_variation' ||
3524
+ $_GET['wc-ajax']=='get_customer_location'
3525
+ ) ||
3526
+ /* END: WooCommerce Service Requests */
3527
+ apbct_is_in_uri('/wp-admin/') ||
3528
+ apbct_is_in_uri('wp-login.php') ||
3529
+ apbct_is_in_uri('wp-comments-post.php') ||
3530
+ apbct_is_in_referer('/wp-admin/') ||
3531
+ apbct_is_in_uri('/login/') ||
3532
+ apbct_is_in_uri('?provider=facebook&') ||
3533
+ isset($_GET['ptype']) && $_GET['ptype']=='login' ||
3534
+ isset($_POST['ct_checkjs_register_form']) ||
3535
+ (isset($_POST['signup_username']) && isset($_POST['signup_password_confirm']) && isset($_POST['signup_submit']) ) ||
3536
+ $apbct->settings['general_contact_forms_test']==0 ||
3537
+ isset($_POST['bbp_topic_content']) ||
3538
+ isset($_POST['bbp_reply_content']) ||
3539
+ isset($_POST['fscf_submitted']) ||
3540
+ isset($_POST['log']) && isset($_POST['pwd']) && isset($_POST['wp-submit'])||
3541
+ apbct_is_in_uri('/wc-api/') ||
3542
+ (isset($_POST['wc_reset_password'], $_POST['_wpnonce'], $_POST['_wp_http_referer'])) || //WooCommerce recovery password form
3543
+ (isset($_POST['woocommerce-login-nonce'], $_POST['login'], $_POST['password'], $_POST['_wp_http_referer'])) || //WooCommerce login form
3544
+ (isset($_POST['provider'], $_POST['authcode']) && $_POST['provider'] == 'Two_Factor_Totp') || //TwoFactor authorization
3545
+ (isset($_GET['wc-ajax']) && $_GET['wc-ajax'] == 'sa_wc_buy_now_get_ajax_buy_now_button') || //BuyNow add to cart
3546
+ apbct_is_in_uri('/wp-json/wpstatistics/v1/hit') || //WPStatistics
3547
+ (isset($_POST['ihcaction']) && $_POST['ihcaction'] == 'login') || //Skip login form
3548
+ (isset($_POST['action']) && $_POST['action'] == 'infinite_scroll') || //Scroll
3549
+ isset($_POST['gform_submit']) || //Skip gravity checking because of direct integration
3550
+ (isset($_POST['lrm_action']) && $_POST['lrm_action'] == 'login') || //Skip login form
3551
+ apbct_is_in_uri( 'xmlrpc.php?for=jetpack' )
3552
+ ) {
3553
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
3554
+ return null;
3555
+ }
3556
+
3557
+ $message = ct_get_fields_any_postdata($_POST);
3558
+
3559
+ // ???
3560
+ if(strlen(json_encode($message))<10) {
3561
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
3562
+ return null;
3563
+ }
3564
+
3565
+
3566
+ // Skip if request contains params
3567
+ $skip_params = array(
3568
+ 'ipn_track_id', // PayPal IPN #
3569
+ 'txn_type', // PayPal transaction type
3570
+ 'payment_status', // PayPal payment status
3571
+ );
3572
+ foreach($skip_params as $key=>$value){
3573
+ if(@array_key_exists($value,$_GET)||@array_key_exists($value,$_POST)) {
3574
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
3575
+ return null;
3576
+ }
3577
+ }
3578
+
3579
+ $base_call_result = apbct_base_call(
3580
+ array(
3581
+ 'message' => $message,
3582
+ 'post_info' => array('comment_type' => 'feedback_general_postdata'),
3583
+ )
3584
+ );
3585
+
3586
+ $cleantalk_executed=true;
3587
+
3588
+ $ct_result = $base_call_result['ct_result'];
3589
+
3590
+ if ($ct_result->allow == 0) {
3591
+
3592
+ if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)) {
3593
+ global $ct_comment;
3594
+ $ct_comment = $ct_result->comment;
3595
+ if(isset($_POST['cma-action'])&&$_POST['cma-action']=='add')
3596
+ {
3597
+ $result=Array('success'=>0, 'thread_id'=>null,'messages'=>Array($ct_result->comment));
3598
+ header("Content-Type: application/json");
3599
+ print json_encode($result);
3600
+ die();
3601
+ }
3602
+ else
3603
+ {
3604
+ ct_die(null, null);
3605
+ }
3606
+ } else {
3607
+ echo $ct_result->comment;
3608
+ }
3609
+ exit;
3610
+ }
3611
+
3612
+ return null;
3613
+ }
3614
+
3615
+
3616
+ /**
3617
+ * Inner function - Finds and returns pattern in string
3618
+ * @return null|bool
3619
+ */
3620
+ function ct_get_data_from_submit($value = null, $field_name = null) {
3621
+ if (!$value || !$field_name || !is_string($value)) {
3622
+ return false;
3623
+ }
3624
+ if (preg_match("/[a-z0-9_\-]*" . $field_name. "[a-z0-9_\-]*$/", $value)) {
3625
+ return true;
3626
+ }
3627
+ }
3628
+
3629
+ /**
3630
+ * Sends error notice to admin
3631
+ * @return null
3632
+ */
3633
+ function ct_send_error_notice ($comment = '') {
3634
+ global $ct_admin_notoice_period, $apbct;
3635
+
3636
+ $timelabel_reg = intval( get_option('cleantalk_timelabel_reg') );
3637
+ if(time() - $ct_admin_notoice_period > $timelabel_reg){
3638
+ update_option('cleantalk_timelabel_reg', time());
3639
+
3640
+ $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
3641
+ $message = __('Attention, please!', 'cleantalk-spam-protect') . "\r\n\r\n";
3642
+ $message .= sprintf(__('"%s" plugin error on your site "%s":', 'cleantalk-spam-protect'), $apbct->plugin_name, $blogname) . "\r\n\r\n";
3643
+ $message .= preg_replace('/^(.*?)<a.*?"(.*?)".*?>(.*?)<.a>(.*)$/', '$1. $3: $2?user_token='. $apbct->user_token .' $4', $comment) . "\r\n\r\n";
3644
+ @wp_mail(ct_get_admin_email(), sprintf(__('[%s] "%s" error!', 'cleantalk-spam-protect'), $apbct->plugin_name, $blogname), $message);
3645
+ }
3646
+
3647
+ return null;
3648
+ }
3649
+
3650
+ /**
3651
+ * Prints form for "protect externals
3652
+ *
3653
+ * @param $arr
3654
+ * @param $k
3655
+ */
3656
+ function ct_print_form( $arr, $k ){
3657
+
3658
+ // Fix for pages04.net forms
3659
+ if( isset( $arr['formSourceName'] ) ){
3660
+ $tmp = array();
3661
+ foreach( $arr as $key => $val ){
3662
+ $tmp_key = str_replace( '_', '+', $key );
3663
+ $tmp[$tmp_key] = $val;
3664
+ }
3665
+ $arr = $tmp;
3666
+ unset( $tmp, $key, $tmp_key, $val );
3667
+ }
3668
+
3669
+ foreach( $arr as $key => $value ){
3670
+
3671
+ if( ! is_array( $value ) ){
3672
+ print '<textarea
3673
+ name="' . ( $k == '' ? $key : $k . '[' . $key . ']' ) . '"
3674
+ style="display:none;">' . htmlspecialchars( $value )
3675
+ . '</textarea>';
3676
+ }else{
3677
+ ct_print_form( $value, $k == '' ? $key : $k . '[' . $key . ']' );
3678
+ }
3679
+
3680
+ }
3681
+
3682
+ }
3683
+
3684
+ /**
3685
+ * Attaches public scripts and styles.
3686
+ */
3687
+ function ct_enqueue_scripts_public($hook){
3688
+
3689
+ global $current_user, $apbct;
3690
+
3691
+ if (apbct_exclusions_check__url()) {
3692
+ return;
3693
+ }
3694
+
3695
+ if($apbct->settings['registrations_test'] || $apbct->settings['comments_test'] || $apbct->settings['contact_forms_test'] || $apbct->settings['general_contact_forms_test'] || $apbct->settings['wc_checkout_test'] || $apbct->settings['check_external'] || $apbct->settings['check_internal'] || $apbct->settings['bp_private_messages'] || $apbct->settings['general_postdata_test']){
3696
+
3697
+ if( ! $apbct->public_script_loaded ) {
3698
+
3699
+ // Differnt JS params
3700
+ wp_enqueue_script( 'ct_public', APBCT_URL_PATH . '/js/apbct-public.min.js', array( 'jquery' ), APBCT_VERSION, false /*in header*/ );
3701
+
3702
+ wp_localize_script('ct_public', 'ctPublic', array(
3703
+ '_ajax_nonce' => wp_create_nonce('ct_secret_stuff'),
3704
+ '_ajax_url' => admin_url('admin-ajax.php'),
3705
+ ));
3706
+ }
3707
+
3708
+ // GDPR script
3709
+ if($apbct->settings['gdpr_enabled']){
3710
+
3711
+ wp_enqueue_script('ct_public_gdpr', APBCT_URL_PATH.'/js/apbct-public--gdpr.min.js', array('jquery', 'ct_public'), APBCT_VERSION, false /*in header*/);
3712
+
3713
+ wp_localize_script('ct_public_gdpr', 'ctPublicGDPR', array(
3714
+ 'gdpr_forms' => array(),
3715
+ 'gdpr_text' => $apbct->settings['gdpr_text'] ? $apbct->settings['gdpr_text'] : __('By using this form you agree with the storage and processing of your data by using the Privacy Policy on this website.', 'cleantalk-spam-protect'),
3716
+ ));
3717
+ }
3718
+
3719
+ }
3720
+
3721
+ if(!defined('CLEANTALK_AJAX_USE_FOOTER_HEADER') || (defined('CLEANTALK_AJAX_USE_FOOTER_HEADER') && CLEANTALK_AJAX_USE_FOOTER_HEADER)){
3722
+ if($apbct->settings['use_ajax'] && ! apbct_is_in_uri('.xml') && ! apbct_is_in_uri('.xsl')){
3723
+ if( ! apbct_is_in_uri('jm-ajax') ){
3724
+
3725
+ // Use AJAX for JavaScript check
3726
+ if($apbct->settings['use_ajax']){
3727
+
3728
+ wp_enqueue_script('ct_nocache', plugins_url('/cleantalk-spam-protect/js/cleantalk_nocache.min.js'), array(), APBCT_VERSION, false /*in header*/);
3729
+
3730
+ wp_localize_script('ct_nocache', 'ctNocache', array(
3731
+ 'ajaxurl' => admin_url('admin-ajax.php'),
3732
+ 'info_flag' => $apbct->settings['collect_details'] && $apbct->settings['set_cookies'] ? true : false,
3733
+ 'set_cookies_flag' => $apbct->settings['set_cookies'] ? false : true,
3734
+ 'blog_home' => get_home_url().'/',
3735
+ ));
3736
+ }
3737
+
3738
+ // External forms check
3739
+ if($apbct->settings['check_external'])
3740
+ wp_enqueue_script('ct_external', plugins_url('/cleantalk-spam-protect/js/cleantalk_external.min.js'), array('jquery'), APBCT_VERSION, false /*in header*/);
3741
+
3742
+ // Internal forms check
3743
+ if($apbct->settings['check_internal'])
3744
+ wp_enqueue_script('ct_internal', plugins_url('/cleantalk-spam-protect/js/cleantalk_internal.min.js'), array('jquery'), APBCT_VERSION, false /*in header*/);
3745
+
3746
+ }
3747
+ }
3748
+ }
3749
+
3750
+ // Show controls for commentaries
3751
+ if(in_array("administrator", $current_user->roles)){
3752
+
3753
+ if($apbct->settings['manage_comments_on_public_page']){
3754
+
3755
+ $ajax_nonce = wp_create_nonce( "ct_secret_nonce" );
3756
+
3757
+ wp_enqueue_style ('ct_public_admin_css', plugins_url('/cleantalk-spam-protect/css/cleantalk-public-admin.min.css'), array(), APBCT_VERSION, 'all');
3758
+ wp_enqueue_script('ct_public_admin_js', plugins_url('/cleantalk-spam-protect/js/cleantalk-public-admin.min.js'), array('jquery'), APBCT_VERSION, false /*in header*/);
3759
+
3760
+ wp_localize_script('ct_public_admin_js', 'ctPublicAdmin', array(
3761
+ 'ct_ajax_nonce' => $ajax_nonce,
3762
+ 'ajaxurl' => admin_url('admin-ajax.php'),
3763
+ 'ct_feedback_error' => __('Error occurred while sending feedback.', 'cleantalk-spam-protect'),
3764
+ 'ct_feedback_no_hash' => __('Feedback wasn\'t sent. There is no associated request.', 'cleantalk-spam-protect'),
3765
+ 'ct_feedback_msg' => sprintf(__("Feedback has been sent to %sCleanTalk Dashboard%s.", 'cleantalk-spam-protect'), $apbct->user_token ? "<a target='_blank' href=https://cleantalk.org/my/show_requests?user_token={$apbct->user_token}&cp_mode=antispam>" : '', $apbct->user_token ? "</a>" : ''),
3766
+ ));
3767
+
3768
+ }
3769
+ }
3770
+
3771
+ // Debug
3772
+ if($apbct->settings['debug_ajax']){
3773
+ wp_enqueue_script('ct_debug_js', plugins_url('/cleantalk-spam-protect/js/cleantalk-debug-ajax.min.js'), array('jquery'), APBCT_VERSION, false /*in header*/);
3774
+
3775
+ wp_localize_script('ct_debug_js', 'apbctDebug', array(
3776
+ 'reload' => false,
3777
+ 'reload_time' => 10000,
3778
+ ));
3779
+ }
3780
+ }
3781
+
3782
+ /**
3783
+ * Reassign callbackback function for the bootom of comment output.
3784
+ */
3785
+ function ct_wp_list_comments_args($options){
3786
+
3787
+ global $current_user, $apbct;
3788
+
3789
+ if(in_array("administrator", $current_user->roles)){
3790
+ if($apbct->settings['manage_comments_on_public_page']) {
3791
+ $theme = wp_get_theme();
3792
+ $apbct->active_theme = $theme->get( 'Name' );
3793
+ $options['end-callback'] = 'ct_comments_output';
3794
+ }
3795
+ }
3796
+
3797
+ return $options;
3798
+ }
3799
+
3800
+ /**
3801
+ * Callback function for the bootom comment output.
3802
+ */
3803
+ function ct_comments_output($curr_comment, $param2, $wp_list_comments_args){
3804
+
3805
+ global $apbct;
3806
+
3807
+ $email = $curr_comment->comment_author_email;
3808
+ $ip = $curr_comment->comment_author_IP;
3809
+ $id = $curr_comment->comment_ID;
3810
+
3811
+ $settings_link = '/wp-admin/'.(is_network_admin() ? "settings.php?page=cleantalk" : "options-general.php?page=cleantalk");
3812
+
3813
+ echo "<div class='ct_comment_info'><div class ='ct_comment_titles'>";
3814
+ echo "<p class='ct_comment_info_title'>".__('Sender info', 'cleantalk-spam-protect')."</p>";
3815
+
3816
+ echo "<p class='ct_comment_logo_title'>
3817
+ ".__('by', 'cleantalk-spam-protect')
3818
+ ." <a href='{$settings_link}' target='_blank'><img class='ct_comment_logo_img' src='".plugins_url()."/cleantalk-spam-protect/inc/images/logo_color.png'></a>"
3819
+ ." <a href='{$settings_link}' target='_blank'>CleanTalk</a>"
3820
+ ."</p></div>";
3821
+ // Outputs email if exists
3822
+ if($email)
3823
+ echo "<a href='https://cleantalk.org/blacklists/$email' target='_blank' title='https://cleantalk.org/blacklists/$email'>"
3824
+ ."$email"
3825
+ ."&nbsp;<img src='".plugins_url()."/cleantalk-spam-protect/inc/images/new_window.gif' border='0' style='float:none; box-shadow: transparent 0 0 0 !important;'/>"
3826
+ ."</a>";
3827
+ else
3828
+ echo __('No email', 'cleantalk-spam-protect');
3829
+ echo "&nbsp;|&nbsp;";
3830
+
3831
+ // Outputs IP if exists
3832
+ if($ip)
3833
+ echo "<a href='https://cleantalk.org/blacklists/$ip' target='_blank' title='https://cleantalk.org/blacklists/$ip'>"
3834
+ ."$ip"
3835
+ ."&nbsp;<img src='".plugins_url()."/cleantalk-spam-protect/inc/images/new_window.gif' border='0' style='float:none; box-shadow: transparent 0 0 0 !important;'/>"
3836
+ ."</a>";
3837
+ else
3838
+ echo __('No IP', 'cleantalk-spam-protect');
3839
+ echo '&nbsp;|&nbsp;';
3840
+
3841
+ echo "<span commentid='$id' class='ct_this_is ct_this_is_spam' href='#'>".__('Mark as spam', 'cleantalk-spam-protect')."</span>";
3842
+ echo "<span commentid='$id' class='ct_this_is ct_this_is_not_spam ct_hidden' href='#'>".__('Unspam', 'cleantalk-spam-protect')."</span>";
3843
+ echo "<p class='ct_feedback_wrap'>";
3844
+ echo "<span class='ct_feedback_result ct_feedback_result_spam'>".__('Marked as spam.', 'cleantalk-spam-protect')."</span>";
3845
+ echo "<span class='ct_feedback_result ct_feedback_result_not_spam'>".__('Marked as not spam.', 'cleantalk-spam-protect')."</span>";
3846
+ echo "&nbsp;<span class='ct_feedback_msg'><span>";
3847
+ echo "</p>";
3848
+
3849
+ echo "</div>";
3850
+
3851
+ // @todo research what such themes and make exception for them
3852
+ $ending_tag = $wp_list_comments_args['style'];
3853
+ if( in_array( $apbct->active_theme, array( 'Paperio', 'Twenty Twenty' ) ) ){
3854
+ $ending_tag = is_null($wp_list_comments_args['style']) ? 'div' : $wp_list_comments_args['style'];
3855
+ };
3856
+
3857
+ // Ending comment output
3858
+ echo "</{$ending_tag}>";
3859
+ }
3860
+
3861
+ /**
3862
+ * Callback function for the bootom comment output.
3863
+ *
3864
+ * attrs = array()
3865
+ */
3866
+ function apbct_shrotcode_handler__GDPR_public_notice__form( $attrs ){
3867
+
3868
+ $out = '';
3869
+
3870
+ if(isset($attrs['id']))
3871
+ $out .= 'ctPublicGDPR.gdpr_forms.push("'.$attrs['id'].'");';
3872
+
3873
+ if(isset($attrs['text']))
3874
+ $out .= 'ctPublicGDPR.gdpr_text = "'.$attrs['text'].'";';
3875
+
3876
+ $out = '<script>'.$out.'</script>';
3877
+ return $out;
3878
+ }
3879
+
3880
+ /**
3881
+ * Filters the 'status' array before register the user
3882
+ * using only by WICITY theme
3883
+ *
3884
+ * @param $success array array( 'status' => 'success' )
3885
+ * @param $data array ['username'] ['password'] ['email']
3886
+ * @return array array( 'status' => 'error' ) or array( 'status' => 'success' ) by default
3887
+ */
3888
+ function apbct_wilcity_reg_validation( $success, $data ) {
3889
+ $check = ct_test_registration( $data['username'], $data['email'], '' );
3890
+ if( $check['allow'] == 0 ) {
3891
+ return array( 'status' => 'error' );
3892
+ }
3893
+ return $success;
3894
+ }
3895
+
3896
+ // Enfold Theme contact form
3897
+ function apbct_form__enfold_contact_form__test_spam( $send, $new_post, $form_params, $obj ){
3898
+
3899
+ global $cleantalk_executed;
3900
+
3901
+ $url_decoded_data = array();
3902
+ foreach( $new_post as $key => $value ) {
3903
+ $url_decoded_data[$key] = urldecode($value);
3904
+ }
3905
+
3906
+ $data = ct_get_fields_any( $url_decoded_data );
3907
+
3908
+ $base_call_result = apbct_base_call(
3909
+ array(
3910
+ 'message' => !empty( $data['message'] ) ? json_encode( $data['message'] ) : '',
3911
+ 'sender_email' => !empty( $data['email'] ) ? $data['email'] : '',
3912
+ 'sender_nickname' => !empty( $data['nickname'] ) ? $data['nickname'] : '',
3913
+ 'post_info' => array(
3914
+ 'comment_type' => 'contact_form_wordpress_enfold'
3915
+ ),
3916
+ )
3917
+ );
3918
+
3919
+ $ct_result = $base_call_result['ct_result'];
3920
+
3921
+ $cleantalk_executed = true;
3922
+
3923
+ if( $ct_result->allow == 0 ) {
3924
+ $obj->submit_error = $ct_result->comment;
3925
+ return null;
3926
+ }
3927
+
3928
+ return $send;
3929
+
3930
+ }
js/cleantalk-admin-settings-page.min.js CHANGED
@@ -1,2 +1,2 @@
1
- function apbct_banner_check(){var a=setInterval(function(){apbct_admin_sendAJAX({action:"apbct_settings__check_renew_banner"},{callback:function(e,t,n,c){e.close_renew_banner&&(jQuery("#apbct_renew_notice").length&&jQuery("#apbct_renew_notice").hide("slow"),jQuery("#apbct_trial_notice").length&&jQuery("#apbct_trial_notice").hide("slow"),clearInterval(a))}})},9e5)}function apbct_get_elems(e){for(var t,n=0,c=(e=e.split(",")).length;n<c;n++)t=jQuery("#"+e[n]),e[n]=0===t.length?jQuery("."+e[n]):t;return e}function apbct_get_elems__native(e){"string"==typeof e&&(e=e.split(","));var a=[];return e.forEach(function(e,t,n){var c=document.getElementById(e);if(null===c){if(null!==(c=document.getElementsByClassName(e))&&0!==c.length)for(key in c)0<=+key&&a.push(c[key])}else a.push(c[key])}),a}function apbct_show_hide_elem(e){for(var t=0,n=(e=apbct_get_elems(e)).length;t<n;t++)e[t].each(function(e,t){var n=(t=jQuery(t)).next("label")||t.prev("label")||null;t.is(":visible")?(t.hide(),n&&n.hide()):(t.show(),n&&n.show())})}function apbctSettingsDependencies(e,a){a=isNaN(a)?null:a,apbct_get_elems__native(e).forEach(function(e,t,n){console.log(e.getAttribute("id"));if(null===a&&(a=null===e.getAttribute("disabled")?0:1),1===a?e.removeAttribute("disabled"):e.setAttribute("disabled","disabled"),null!==e.getAttribute("apbct_children")){var c=apbctSettingsDependencies_getState(e)&&a;null!==c&&apbctSettingsDependencies(e.getAttribute("apbct_children"),c)}})}function apbctSettingsDependencies_getState(e){var t;switch(e.getAttribute("type")){case"checkbox":t=+e.checked;break;case"radio":t=+(1==+e.getAttribute("value"));break;default:t=null}return t}function apbct_settings__showDescription(e,t){var a=function(e){void 0!==e&&(0!=jQuery(e.target).parent(".apbct_long_desc").length&&!jQuery(e.target).hasClass("apbct_long_desc__cancel")||jQuery(e.target).hasClass("apbct_long_description__show"))||(jQuery(".apbct_long_desc").remove(),jQuery(document).off("click",a))};a(),e.after("<div id='apbct_long_desc__"+t+"' class='apbct_long_desc'></div>");var n=jQuery("#apbct_long_desc__"+t);n.append("<i class='icon-spin1 animate-spin'></i>").append("<div class='apbct_long_desc__angle'></div>").css({top:e.position().top-5,left:e.position().left+25}),apbct_admin_sendAJAX({action:"apbct_settings__get_description",setting_id:t},{spinner:n.children("img"),callback:function(e,t,n,c){c.empty().append("<div class='apbct_long_desc__angle'></div>").append("<i class='apbct_long_desc__cancel icon-cancel'></i>").append("<h3 class='apbct_long_desc__title'>"+e.title+"</h3>").append("<p>"+e.desc+"</p>"),jQuery(document).on("click",a)}},n)}jQuery(document).ready(function(){"rtl"===getComputedStyle(document.getElementsByClassName("apbct_settings-title")[0]).direction&&jQuery(".apbct_switchers").css("text-align","right"),jQuery("#apbct_showApiKey").on("click",function(){jQuery(".apbct_setting---apikey").val(jQuery(".apbct_setting---apikey").attr("key")),jQuery(".apbct_setting---apikey+div").show(),jQuery(this).fadeOut(300)});var e=new Date;jQuery("#ct_admin_timezone").val(e.getTimezoneOffset()/60*-1),jQuery("#apbct_gdpr_open_modal").on("click",function(){jQuery("#gdpr_dialog").dialog({modal:!0,show:!0,position:{my:"center",at:"center",of:window},width:+jQuery("#wpbody").width()/100*70,height:"auto",title:"GDPR compliance",draggable:!1,resizable:!1,closeText:"Close"})}),jQuery("#apbct_button__sync").on("click",function(){apbct_admin_sendAJAX({action:"apbct_sync"},{button:document.getElementById("apbct_button__sync"),spinner:jQuery("#apbct_button__sync .apbct_preloader_button"),callback:function(e,t,n,c){jQuery(".apbct_success").show(300),setTimeout(function(){jQuery(".apbct_success").hide(300)},2e3),e.reload&&document.location.reload()}})}),ctSettingsPage.key_changed&&jQuery("#apbct_button__sync").click(),jQuery(document).on("click",".apbct_settings-long_description---show",function(){self=jQuery(this),apbct_settings__showDescription(self,self.attr("setting"))}),(jQuery("#apbct_renew_notice").length||jQuery("#apbct_trial_notice").length)&&apbct_banner_check()});
2
  //# sourceMappingURL=cleantalk-admin-settings-page.min.js.map
1
+ function apbct_banner_check(){var a=setInterval(function(){apbct_admin_sendAJAX({action:"apbct_settings__check_renew_banner"},{callback:function(e,t,n,c){e.close_renew_banner&&(jQuery("#apbct_renew_notice").length&&jQuery("#apbct_renew_notice").hide("slow"),jQuery("#apbct_trial_notice").length&&jQuery("#apbct_trial_notice").hide("slow"),clearInterval(a))}})},9e5)}function apbct_get_elems(e){for(var t,n=0,c=(e=e.split(",")).length;n<c;n++)t=jQuery("#"+e[n]),e[n]=0===t.length?jQuery("."+e[n]):t;return e}function apbct_get_elems__native(e){"string"==typeof e&&(e=e.split(","));var a=[];return e.forEach(function(e,t,n){var c=document.getElementById(e);if(null===c){if(null!==(c=document.getElementsByClassName(e))&&0!==c.length)for(key in c)0<=+key&&a.push(c[key])}else a.push(c[key])}),a}function apbct_show_hide_elem(e){for(var t=0,n=(e=apbct_get_elems(e)).length;t<n;t++)e[t].each(function(e,t){var n=(t=jQuery(t)).next("label")||t.prev("label")||null;t.is(":visible")?(t.hide(),n&&n.hide()):(t.show(),n&&n.show())})}function apbctSettingsDependencies(e,a){a=isNaN(a)?null:a,apbct_get_elems__native(e).forEach(function(e,t,n){console.log(e.getAttribute("id"));var c;null===a&&(a=null===e.getAttribute("disabled")?0:1),1===a?e.removeAttribute("disabled"):e.setAttribute("disabled","disabled"),null===e.getAttribute("apbct_children")||null!==(c=apbctSettingsDependencies_getState(e)&&a)&&apbctSettingsDependencies(e.getAttribute("apbct_children"),c)})}function apbctSettingsDependencies_getState(e){var t;switch(e.getAttribute("type")){case"checkbox":t=+e.checked;break;case"radio":t=+(1==+e.getAttribute("value"));break;default:t=null}return t}function apbct_settings__showDescription(e,t){var a=function(e){void 0!==e&&(0!=jQuery(e.target).parent(".apbct_long_desc").length&&!jQuery(e.target).hasClass("apbct_long_desc__cancel")||jQuery(e.target).hasClass("apbct_long_description__show"))||(jQuery(".apbct_long_desc").remove(),jQuery(document).off("click",a))};a(),e.after("<div id='apbct_long_desc__"+t+"' class='apbct_long_desc'></div>");var n=jQuery("#apbct_long_desc__"+t);n.append("<i class='icon-spin1 animate-spin'></i>").append("<div class='apbct_long_desc__angle'></div>").css({top:e.position().top-5,left:e.position().left+25}),apbct_admin_sendAJAX({action:"apbct_settings__get_description",setting_id:t},{spinner:n.children("img"),callback:function(e,t,n,c){c.empty().append("<div class='apbct_long_desc__angle'></div>").append("<i class='apbct_long_desc__cancel icon-cancel'></i>").append("<h3 class='apbct_long_desc__title'>"+e.title+"</h3>").append("<p>"+e.desc+"</p>"),jQuery(document).on("click",a)}},n)}jQuery(document).ready(function(){document.getElementsByClassName("apbct_settings-title")[0]&&"rtl"===getComputedStyle(document.getElementsByClassName("apbct_settings-title")[0]).direction&&jQuery(".apbct_switchers").css("text-align","right"),jQuery("#apbct_showApiKey").on("click",function(){jQuery(".apbct_setting---apikey").val(jQuery(".apbct_setting---apikey").attr("key")),jQuery(".apbct_setting---apikey+div").show(),jQuery(this).fadeOut(300)});var e=new Date;jQuery("#ct_admin_timezone").val(e.getTimezoneOffset()/60*-1),jQuery("#apbct_gdpr_open_modal").on("click",function(){jQuery("#gdpr_dialog").dialog({modal:!0,show:!0,position:{my:"center",at:"center",of:window},width:+jQuery("#wpbody").width()/100*70,height:"auto",title:"GDPR compliance",draggable:!1,resizable:!1,closeText:"Close"})}),jQuery("#apbct_button__sync").on("click",function(){apbct_admin_sendAJAX({action:"apbct_sync"},{button:document.getElementById("apbct_button__sync"),spinner:jQuery("#apbct_button__sync .apbct_preloader_button"),callback:function(e,t,n,c){jQuery(".apbct_success").show(300),setTimeout(function(){jQuery(".apbct_success").hide(300)},2e3),e.reload&&document.location.reload()}})}),ctSettingsPage.key_changed&&jQuery("#apbct_button__sync").click(),jQuery(document).on("click",".apbct_settings-long_description---show",function(){self=jQuery(this),apbct_settings__showDescription(self,self.attr("setting"))}),(jQuery("#apbct_renew_notice").length||jQuery("#apbct_trial_notice").length)&&apbct_banner_check()});
2
  //# sourceMappingURL=cleantalk-admin-settings-page.min.js.map
js/cleantalk-admin-settings-page.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["cleantalk-admin-settings-page.js"],"names":["apbct_banner_check","bannerChecker","setInterval","apbct_admin_sendAJAX","action","callback","result","data","params","obj","close_renew_banner","jQuery","length","hide","clearInterval","apbct_get_elems","elems","tmp","i","len","split","apbct_get_elems__native","out","forEach","elem","arr","document","getElementById","getElementsByClassName","key","push","apbct_show_hide_elem","each","label","next","prev","is","show","apbctSettingsDependencies","ids","enable","isNaN","console","log","getAttribute","removeAttribute","setAttribute","state","apbctSettingsDependencies_getState","checked","apbct_settings__showDescription","setting_id","remove_desc_func","e","target","parent","hasClass","remove","off","after","append","css","top","position","left","spinner","children","empty","title","desc","on","ready","getComputedStyle","direction","val","attr","this","fadeOut","d","Date","getTimezoneOffset","dialog","modal","my","at","of","window","width","height","draggable","resizable","closeText","button","setTimeout","reload","location","ctSettingsPage","key_changed","click","self"],"mappings":"AAiEA,SAASA,qBACR,IAAIC,EAAgBC,YAAa,WAChCC,qBACC,CAACC,OAAQ,sCACT,CACCC,SAAU,SAASC,EAAQC,EAAMC,EAAQC,GACpCH,EAAOI,qBACNC,OAAO,uBAAuBC,QACjCD,OAAO,uBAAuBE,KAAK,QAChCF,OAAO,uBAAuBC,QACjCD,OAAO,uBAAuBE,KAAK,QACpCC,cAAcb,QAKhB,KAUJ,SAASc,gBAAgBC,GAErB,IAAK,IAA6BC,EAAzBC,EAAE,EAAGC,GADdH,EAAQA,EAAMI,MAAM,MACMR,OAAaM,EAAIC,EAAKD,IAC5CD,EAAMN,OAAO,IAAIK,EAAME,IACvBF,EAAME,GAAoB,IAAfD,EAAIL,OAAeD,OAAO,IAAIK,EAAME,IAAMD,EAEzD,OAAOD,EAUX,SAASK,wBAAwBL,GAGZ,iBAAVA,IACTA,EAAQA,EAAMI,MAAM,MAErB,IAAIE,EAAM,GAuBV,OArBAN,EAAMO,QAAQ,SAASC,EAAMN,EAAGO,GAG/B,IAAIR,EAAMS,SAASC,eAAeH,GAClC,GAAY,OAARP,GAQJ,GAAY,QADZA,EAAMS,SAASE,uBAAuBJ,KACJ,IAAdP,EAAIL,OACvB,IAAIiB,OAAOZ,EACE,IAAPY,KACJP,EAAIQ,KAAMb,EAAIY,WAVhBP,EAAIQ,KAAMb,EAAIY,QAgBTP,EAGR,SAASS,qBAAqBf,GAE1B,IAAK,IAAIE,EAAE,EAAGC,GADjBH,EAAQD,gBAAgBC,IACKJ,OAAQM,EAAIC,EAAKD,IACvCF,EAAME,GAAGc,KAAK,SAAUd,EAAGM,GAEvB,IAAIS,GADJT,EAAOb,OAAOa,IACGU,KAAK,UAAYV,EAAKW,KAAK,UAAY,KACpDX,EAAKY,GAAG,aACRZ,EAAKX,OACDoB,GAAOA,EAAMpB,SAEjBW,EAAKa,OACDJ,GAAOA,EAAMI,UAajC,SAASC,0BAA0BC,EAAKC,GAGvCA,EAAWC,MAAMD,GAAmB,KAATA,EAGfnB,wBAAyBkB,GAE/BhB,QAAQ,SAASC,EAAMN,EAAGO,GAE/BiB,QAAQC,IAAKnB,EAAKoB,aAAa,OAW/B,GALc,OAAXJ,IACFA,EAA2C,OAAlChB,EAAKoB,aAAa,YAAuB,EAAI,GAE5C,IAAXJ,EANyBhB,EAAKqB,gBAAgB,YADlBrB,EAAKsB,aAAa,WAAY,YASd,OAAxCtB,EAAKoB,aAAa,kBAA2B,CAChD,IAAIG,EAAQC,mCAAoCxB,IAAUgB,EAC5C,OAAVO,GACHT,0BAA2Bd,EAAKoB,aAAa,kBAAmBG,MAOpE,SAASC,mCAAoCxB,GAE5C,IAAIuB,EAEJ,OAASvB,EAAKoB,aAAc,SAC3B,IAAK,WACJG,GAASvB,EAAKyB,QACd,MACD,IAAK,QACJF,IAA0C,IAA/BvB,EAAKoB,aAAa,UAC7B,MACD,QACCG,EAAQ,KAGV,OAAOA,EAGR,SAASG,gCAAgCjB,EAAOkB,GAE/C,IAAIC,EAAmB,SAASC,QACf,IAANA,IAA6E,GAAtD1C,OAAO0C,EAAEC,QAAQC,OAAO,oBAAoB3C,SAAeD,OAAO0C,EAAEC,QAAQE,SAAS,4BAAgC7C,OAAO0C,EAAEC,QAAQE,SAAS,mCAC/K7C,OAAO,oBAAoB8C,SAC3B9C,OAAOe,UAAUgC,IAAI,QAASN,KAIhCA,IAEAnB,EAAM0B,MAAM,6BAA6BR,EAAW,oCACpD,IAAI1C,EAAME,OAAO,qBAAqBwC,GACtC1C,EAAImD,OAAO,2CACTA,OAAO,8CACPC,IAAI,CACJC,IAAK7B,EAAM8B,WAAWD,IAAM,EAC5BE,KAAM/B,EAAM8B,WAAWC,KAAO,KAIhC7D,qBACC,CAACC,OAAQ,kCAAmC+C,WAAYA,GACxD,CACCc,QAASxD,EAAIyD,SAAS,OACtB7D,SAAU,SAASC,EAAQC,EAAMC,EAAQC,GAExCA,EAAI0D,QACFP,OAAO,8CACPA,OAAO,uDACPA,OAAO,sCAAsCtD,EAAO8D,MAAM,SAC1DR,OAAO,MAAMtD,EAAO+D,KAAK,QAE3B1D,OAAOe,UAAU4C,GAAG,QAASlB,KAG/B3C,GAxPFE,OAAOe,UAAU6C,MAAM,WAGwE,QAA3FC,iBAAiB9C,SAASE,uBAAuB,wBAAwB,IAAI6C,WAC/E9D,OAAO,oBAAoBkD,IAAI,aAAc,SAI3ClD,OAAO,qBAAqB2D,GAAG,QAAS,WACpC3D,OAAO,2BAA2B+D,IAAI/D,OAAO,2BAA2BgE,KAAK,QAC7EhE,OAAO,+BAA+B0B,OACtC1B,OAAOiE,MAAMC,QAAQ,OAG5B,IAAIC,EAAI,IAAIC,KACZpE,OAAO,sBAAsB+D,IAAII,EAAEE,oBAAoB,IAAK,GAG5DrE,OAAO,0BAA0B2D,GAAG,QAAS,WAC5C3D,OAAO,gBAAgBsE,OAAO,CAC7BC,OAAM,EACN7C,MAAM,EACN0B,SAAU,CAAEoB,GAAI,SAAUC,GAAI,SAAUC,GAAIC,QAC5CC,OAAS5E,OAAO,WAAW4E,QAAU,IAAM,GAC3CC,OAAQ,OACRpB,MAAO,kBACPqB,WAAW,EACXC,WAAW,EACXC,UAAW,YAKbhF,OAAO,uBAAuB2D,GAAG,QAAS,WACzCnE,qBACC,CAACC,OAAQ,cACT,CACCwF,OAAQlE,SAASC,eAAe,sBAChCsC,QAAStD,OAAO,+CAChBN,SAAU,SAASC,EAAQC,EAAMC,EAAQC,GACxCE,OAAO,kBAAkB0B,KAAK,KAC9BwD,WAAW,WAAWlF,OAAO,kBAAkBE,KAAK,MAAQ,KACzDP,EAAOwF,QACTpE,SAASqE,SAASD,cAMnBE,eAAeC,aAClBtF,OAAO,uBAAuBuF,QAE/BvF,OAAOe,UAAU4C,GAAG,QAAS,0CAA2C,WACvE6B,KAAOxF,OAAOiE,MACd1B,gCAAgCiD,KAAMA,KAAKxB,KAAK,eAG7ChE,OAAO,uBAAuBC,QAAUD,OAAO,uBAAuBC,SACzEZ","file":"cleantalk-admin-settings-page.min.js","sourcesContent":["jQuery(document).ready(function(){\n\n\t// Crunch for Right to Left direction languages\n\tif(getComputedStyle(document.getElementsByClassName('apbct_settings-title')[0]).direction === 'rtl'){\n\t\tjQuery('.apbct_switchers').css('text-align', 'right');\n\t}\n\n\t// Show/Hide access key\n jQuery('#apbct_showApiKey').on('click', function(){\n jQuery('.apbct_setting---apikey').val(jQuery('.apbct_setting---apikey').attr('key'));\n jQuery('.apbct_setting---apikey+div').show();\n jQuery(this).fadeOut(300);\n });\n\n\tvar d = new Date();\n\tjQuery('#ct_admin_timezone').val(d.getTimezoneOffset()/60*(-1));\n\t\n\t// GDPR modal window\n\tjQuery('#apbct_gdpr_open_modal').on('click', function(){\n\t\tjQuery('#gdpr_dialog').dialog({\n\t\t\tmodal:true, \n\t\t\tshow: true,\n\t\t\tposition: { my: \"center\", at: \"center\", of: window },\n\t\t\twidth: +(jQuery('#wpbody').width() / 100 * 70), // 70% of #wpbody\n\t\t\theight: 'auto',\n\t\t\ttitle: 'GDPR compliance',\n\t\t\tdraggable: false,\n\t\t\tresizable: false,\n\t\t\tcloseText: \"Close\",\n\t\t});\n\t});\n\n\t// Sync button\n\tjQuery('#apbct_button__sync').on('click', function(){\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'apbct_sync'},\n\t\t\t{\n\t\t\t\tbutton: document.getElementById('apbct_button__sync' ),\n\t\t\t\tspinner: jQuery('#apbct_button__sync .apbct_preloader_button' ),\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tjQuery('.apbct_success').show(300);\n\t\t\t\t\tsetTimeout(function(){jQuery('.apbct_success').hide(300);}, 2000)\n\t\t\t\t\tif(result.reload)\n\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\tif( ctSettingsPage.key_changed )\n\t\tjQuery('#apbct_button__sync').click();\n\n\tjQuery(document).on('click', '.apbct_settings-long_description---show', function(){\n\t\tself = jQuery(this);\n\t\tapbct_settings__showDescription(self, self.attr('setting'));\n\t});\n\n\tif (jQuery('#apbct_renew_notice').length || jQuery('#apbct_trial_notice').length) \n\t\tapbct_banner_check();\n\t\n});\n\n/**\n * Checking current account status for renew notice\n */\nfunction apbct_banner_check() {\n\tvar bannerChecker = setInterval( function() {\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'apbct_settings__check_renew_banner'},\n\t\t\t{\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tif (result.close_renew_banner) {\n\t\t\t\t\t\tif (jQuery('#apbct_renew_notice').length)\n\t\t\t\t\t\t\tjQuery('#apbct_renew_notice').hide('slow');\n\t\t\t\t\t\tif (jQuery('#apbct_trial_notice').length)\n\t\t\t\t\t\t\tjQuery('#apbct_trial_notice').hide('slow');\n\t\t\t\t\t\tclearInterval(bannerChecker);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}, 900000);\n}\n\n/**\n * Select elems like #{selector} or .{selector}\n * Selector passed in string separated by ,\n *\n * @param elems\n * @returns {*}\n */\nfunction apbct_get_elems(elems){\n elems = elems.split(',');\n for( var i=0, len = elems.length, tmp; i < len; i++){\n tmp = jQuery('#'+elems[i]);\n elems[i] = tmp.length === 0 ? jQuery('.'+elems[i]) : tmp;\n }\n return elems;\n}\n\n/**\n * Select elems like #{selector} or .{selector}\n * Selector could be passed in a string ( separated by comma ) or in array ( [ elem1, elem2, ... ] )\n *\n * @param elems string|array\n * @returns array\n */\nfunction apbct_get_elems__native(elems){\n\n\t// Make array from a string\n\tif(typeof elems === 'string')\n\t\telems = elems.split(',');\n\n\tvar out = [];\n\n\telems.forEach(function(elem, i, arr) {\n\n\t\t// try to get elements with such IDs\n\t\tvar tmp = document.getElementById(elem);\n\t\tif (tmp !== null){\n\t\t\tout.push( tmp[key] );\n\t\t\treturn;\n\t\t}\n\n\t\t// try to get elements with such class name\n\t\t// write each elem from collection to new element of output array\n\t\ttmp = document.getElementsByClassName(elem);\n\t\tif (tmp !== null && tmp.length !==0 ){\n\t\t\tfor(key in tmp){\n\t\t\t\tif( +key >= 0 ){\n\t\t\t\t\tout.push( tmp[key] );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\n\treturn out;\n}\n\nfunction apbct_show_hide_elem(elems){\n\telems = apbct_get_elems(elems);\n for( var i=0, len = elems.length; i < len; i++){\n elems[i].each(function (i, elem) {\n elem = jQuery(elem);\n var label = elem.next('label') || elem.prev('label') || null;\n if (elem.is(\":visible\")) {\n elem.hide();\n if (label) label.hide();\n } else {\n elem.show();\n if (label) label.show();\n }\n });\n }\n}\n\n/**\n * Settings dependences. Switch|toggle depended elements state (disabled|enabled)\n * Recieve list of selectors ( without class mark (.) or id mark (#) )\n *\n * @param ids string|array Selectors\n * @param enable\n */\nfunction apbctSettingsDependencies(ids, enable){\n\n\n\tenable = ! isNaN(enable) ? enable : null;\n\n\t// Get elements\n\tvar elems = apbct_get_elems__native( ids );\n\n\telems.forEach(function(elem, i, arr){\n\n\t\tconsole.log( elem.getAttribute('id') );\n\n\t\tvar do_disable = function(){elem.setAttribute('disabled', 'disabled');},\n\t\t\tdo_enable = function(){elem.removeAttribute('disabled');};\n\n\t\t// Set defined state\n\t\tif(enable === null) // Set\n\t\t\tenable = elem.getAttribute('disabled') === null ? 0 : 1;\n\n\t\tenable === 1 ? do_enable() : do_disable();\n\n\t\tif( elem.getAttribute('apbct_children') !== null){\n\t\t\tvar state = apbctSettingsDependencies_getState( elem ) && enable;\n\t\t\tif( state !== null ) {\n\t\t\t\tapbctSettingsDependencies( elem.getAttribute('apbct_children'), state );\n\t\t\t}\n\t\t}\n\n\t});\n}\n\nfunction apbctSettingsDependencies_getState( elem ){\n\n\tvar state;\n\n\tswitch ( elem.getAttribute( 'type' ) ){\n\t\tcase 'checkbox':\n\t\t\tstate = +elem.checked;\n\t\t\tbreak;\n\t\tcase 'radio':\n\t\t\tstate = +(+elem.getAttribute('value') === 1);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tstate = null;\n\t}\n\n\treturn state;\n}\n\nfunction apbct_settings__showDescription(label, setting_id){\n\n\tvar remove_desc_func = function(e){\n\t\tif(typeof e === 'undefined' || ((jQuery(e.target).parent('.apbct_long_desc').length == 0 || jQuery(e.target).hasClass('apbct_long_desc__cancel')) && !jQuery(e.target).hasClass('apbct_long_description__show'))){\n\t\t\tjQuery('.apbct_long_desc').remove();\n\t\t\tjQuery(document).off('click', remove_desc_func);\n\t\t}\n\t};\n\n\tremove_desc_func();\n\n\tlabel.after(\"<div id='apbct_long_desc__\"+setting_id+\"' class='apbct_long_desc'></div>\");\n\tvar obj = jQuery('#apbct_long_desc__'+setting_id);\n\tobj.append(\"<i class='icon-spin1 animate-spin'></i>\")\n\t\t.append(\"<div class='apbct_long_desc__angle'></div>\")\n\t\t.css({\n\t\t\ttop: label.position().top - 5,\n\t\t\tleft: label.position().left + 25\n\t\t});\n\n\n\tapbct_admin_sendAJAX(\n\t\t{action: 'apbct_settings__get_description', setting_id: setting_id},\n\t\t{\n\t\t\tspinner: obj.children('img'),\n\t\t\tcallback: function(result, data, params, obj){\n\n\t\t\t\tobj.empty()\n\t\t\t\t\t.append(\"<div class='apbct_long_desc__angle'></div>\")\n\t\t\t\t\t.append(\"<i class='apbct_long_desc__cancel icon-cancel'></i>\")\n\t\t\t\t\t.append(\"<h3 class='apbct_long_desc__title'>\"+result.title+\"</h3>\")\n\t\t\t\t\t.append(\"<p>\"+result.desc+\"</p>\");\n\n\t\t\t\tjQuery(document).on('click', remove_desc_func);\n\t\t\t}\n\t\t},\n\t\tobj\n\t);\n}"]}
1
+ {"version":3,"file":"cleantalk-admin-settings-page.min.js","sources":["cleantalk-admin-settings-page.js"],"sourcesContent":["jQuery(document).ready(function(){\r\n\r\n\t// Crunch for Right to Left direction languages\r\n\tif(document.getElementsByClassName('apbct_settings-title')[0]) {\r\n\t\tif(getComputedStyle(document.getElementsByClassName('apbct_settings-title')[0]).direction === 'rtl'){\r\n\t\t\tjQuery('.apbct_switchers').css('text-align', 'right');\r\n\t\t}\r\n\t}\r\n\r\n\t// Show/Hide access key\r\n jQuery('#apbct_showApiKey').on('click', function(){\r\n jQuery('.apbct_setting---apikey').val(jQuery('.apbct_setting---apikey').attr('key'));\r\n jQuery('.apbct_setting---apikey+div').show();\r\n jQuery(this).fadeOut(300);\r\n });\r\n\r\n\tvar d = new Date();\r\n\tjQuery('#ct_admin_timezone').val(d.getTimezoneOffset()/60*(-1));\r\n\t\r\n\t// GDPR modal window\r\n\tjQuery('#apbct_gdpr_open_modal').on('click', function(){\r\n\t\tjQuery('#gdpr_dialog').dialog({\r\n\t\t\tmodal:true, \r\n\t\t\tshow: true,\r\n\t\t\tposition: { my: \"center\", at: \"center\", of: window },\r\n\t\t\twidth: +(jQuery('#wpbody').width() / 100 * 70), // 70% of #wpbody\r\n\t\t\theight: 'auto',\r\n\t\t\ttitle: 'GDPR compliance',\r\n\t\t\tdraggable: false,\r\n\t\t\tresizable: false,\r\n\t\t\tcloseText: \"Close\",\r\n\t\t});\r\n\t});\r\n\r\n\t// Sync button\r\n\tjQuery('#apbct_button__sync').on('click', function(){\r\n\t\tapbct_admin_sendAJAX(\r\n\t\t\t{action: 'apbct_sync'},\r\n\t\t\t{\r\n\t\t\t\tbutton: document.getElementById('apbct_button__sync' ),\r\n\t\t\t\tspinner: jQuery('#apbct_button__sync .apbct_preloader_button' ),\r\n\t\t\t\tcallback: function(result, data, params, obj){\r\n\t\t\t\t\tjQuery('.apbct_success').show(300);\r\n\t\t\t\t\tsetTimeout(function(){jQuery('.apbct_success').hide(300);}, 2000)\r\n\t\t\t\t\tif(result.reload)\r\n\t\t\t\t\t\tdocument.location.reload();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t);\r\n\t});\r\n\r\n\tif( ctSettingsPage.key_changed )\r\n\t\tjQuery('#apbct_button__sync').click();\r\n\r\n\tjQuery(document).on('click', '.apbct_settings-long_description---show', function(){\r\n\t\tself = jQuery(this);\r\n\t\tapbct_settings__showDescription(self, self.attr('setting'));\r\n\t});\r\n\r\n\tif (jQuery('#apbct_renew_notice').length || jQuery('#apbct_trial_notice').length) \r\n\t\tapbct_banner_check();\r\n\t\r\n});\r\n\r\n/**\r\n * Checking current account status for renew notice\r\n */\r\nfunction apbct_banner_check() {\r\n\tvar bannerChecker = setInterval( function() {\r\n\t\tapbct_admin_sendAJAX(\r\n\t\t\t{action: 'apbct_settings__check_renew_banner'},\r\n\t\t\t{\r\n\t\t\t\tcallback: function(result, data, params, obj){\r\n\t\t\t\t\tif (result.close_renew_banner) {\r\n\t\t\t\t\t\tif (jQuery('#apbct_renew_notice').length)\r\n\t\t\t\t\t\t\tjQuery('#apbct_renew_notice').hide('slow');\r\n\t\t\t\t\t\tif (jQuery('#apbct_trial_notice').length)\r\n\t\t\t\t\t\t\tjQuery('#apbct_trial_notice').hide('slow');\r\n\t\t\t\t\t\tclearInterval(bannerChecker);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t);\r\n\t}, 900000);\r\n}\r\n\r\n/**\r\n * Select elems like #{selector} or .{selector}\r\n * Selector passed in string separated by ,\r\n *\r\n * @param elems\r\n * @returns {*}\r\n */\r\nfunction apbct_get_elems(elems){\r\n elems = elems.split(',');\r\n for( var i=0, len = elems.length, tmp; i < len; i++){\r\n tmp = jQuery('#'+elems[i]);\r\n elems[i] = tmp.length === 0 ? jQuery('.'+elems[i]) : tmp;\r\n }\r\n return elems;\r\n}\r\n\r\n/**\r\n * Select elems like #{selector} or .{selector}\r\n * Selector could be passed in a string ( separated by comma ) or in array ( [ elem1, elem2, ... ] )\r\n *\r\n * @param elems string|array\r\n * @returns array\r\n */\r\nfunction apbct_get_elems__native(elems){\r\n\r\n\t// Make array from a string\r\n\tif(typeof elems === 'string')\r\n\t\telems = elems.split(',');\r\n\r\n\tvar out = [];\r\n\r\n\telems.forEach(function(elem, i, arr) {\r\n\r\n\t\t// try to get elements with such IDs\r\n\t\tvar tmp = document.getElementById(elem);\r\n\t\tif (tmp !== null){\r\n\t\t\tout.push( tmp[key] );\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// try to get elements with such class name\r\n\t\t// write each elem from collection to new element of output array\r\n\t\ttmp = document.getElementsByClassName(elem);\r\n\t\tif (tmp !== null && tmp.length !==0 ){\r\n\t\t\tfor(key in tmp){\r\n\t\t\t\tif( +key >= 0 ){\r\n\t\t\t\t\tout.push( tmp[key] );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n\r\n\treturn out;\r\n}\r\n\r\nfunction apbct_show_hide_elem(elems){\r\n\telems = apbct_get_elems(elems);\r\n for( var i=0, len = elems.length; i < len; i++){\r\n elems[i].each(function (i, elem) {\r\n elem = jQuery(elem);\r\n var label = elem.next('label') || elem.prev('label') || null;\r\n if (elem.is(\":visible\")) {\r\n elem.hide();\r\n if (label) label.hide();\r\n } else {\r\n elem.show();\r\n if (label) label.show();\r\n }\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * Settings dependences. Switch|toggle depended elements state (disabled|enabled)\r\n * Recieve list of selectors ( without class mark (.) or id mark (#) )\r\n *\r\n * @param ids string|array Selectors\r\n * @param enable\r\n */\r\nfunction apbctSettingsDependencies(ids, enable){\r\n\r\n\r\n\tenable = ! isNaN(enable) ? enable : null;\r\n\r\n\t// Get elements\r\n\tvar elems = apbct_get_elems__native( ids );\r\n\r\n\telems.forEach(function(elem, i, arr){\r\n\r\n\t\tconsole.log( elem.getAttribute('id') );\r\n\r\n\t\tvar do_disable = function(){elem.setAttribute('disabled', 'disabled');},\r\n\t\t\tdo_enable = function(){elem.removeAttribute('disabled');};\r\n\r\n\t\t// Set defined state\r\n\t\tif(enable === null) // Set\r\n\t\t\tenable = elem.getAttribute('disabled') === null ? 0 : 1;\r\n\r\n\t\tenable === 1 ? do_enable() : do_disable();\r\n\r\n\t\tif( elem.getAttribute('apbct_children') !== null){\r\n\t\t\tvar state = apbctSettingsDependencies_getState( elem ) && enable;\r\n\t\t\tif( state !== null ) {\r\n\t\t\t\tapbctSettingsDependencies( elem.getAttribute('apbct_children'), state );\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t});\r\n}\r\n\r\nfunction apbctSettingsDependencies_getState( elem ){\r\n\r\n\tvar state;\r\n\r\n\tswitch ( elem.getAttribute( 'type' ) ){\r\n\t\tcase 'checkbox':\r\n\t\t\tstate = +elem.checked;\r\n\t\t\tbreak;\r\n\t\tcase 'radio':\r\n\t\t\tstate = +(+elem.getAttribute('value') === 1);\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\tstate = null;\r\n\t}\r\n\r\n\treturn state;\r\n}\r\n\r\nfunction apbct_settings__showDescription(label, setting_id){\r\n\r\n\tvar remove_desc_func = function(e){\r\n\t\tif(typeof e === 'undefined' || ((jQuery(e.target).parent('.apbct_long_desc').length == 0 || jQuery(e.target).hasClass('apbct_long_desc__cancel')) && !jQuery(e.target).hasClass('apbct_long_description__show'))){\r\n\t\t\tjQuery('.apbct_long_desc').remove();\r\n\t\t\tjQuery(document).off('click', remove_desc_func);\r\n\t\t}\r\n\t};\r\n\r\n\tremove_desc_func();\r\n\r\n\tlabel.after(\"<div id='apbct_long_desc__\"+setting_id+\"' class='apbct_long_desc'></div>\");\r\n\tvar obj = jQuery('#apbct_long_desc__'+setting_id);\r\n\tobj.append(\"<i class='icon-spin1 animate-spin'></i>\")\r\n\t\t.append(\"<div class='apbct_long_desc__angle'></div>\")\r\n\t\t.css({\r\n\t\t\ttop: label.position().top - 5,\r\n\t\t\tleft: label.position().left + 25\r\n\t\t});\r\n\r\n\r\n\tapbct_admin_sendAJAX(\r\n\t\t{action: 'apbct_settings__get_description', setting_id: setting_id},\r\n\t\t{\r\n\t\t\tspinner: obj.children('img'),\r\n\t\t\tcallback: function(result, data, params, obj){\r\n\r\n\t\t\t\tobj.empty()\r\n\t\t\t\t\t.append(\"<div class='apbct_long_desc__angle'></div>\")\r\n\t\t\t\t\t.append(\"<i class='apbct_long_desc__cancel icon-cancel'></i>\")\r\n\t\t\t\t\t.append(\"<h3 class='apbct_long_desc__title'>\"+result.title+\"</h3>\")\r\n\t\t\t\t\t.append(\"<p>\"+result.desc+\"</p>\");\r\n\r\n\t\t\t\tjQuery(document).on('click', remove_desc_func);\r\n\t\t\t}\r\n\t\t},\r\n\t\tobj\r\n\t);\r\n}"],"names":["apbct_banner_check","bannerChecker","setInterval","apbct_admin_sendAJAX","action","callback","result","data","params","obj","close_renew_banner","jQuery","length","hide","clearInterval","apbct_get_elems","elems","tmp","i","len","split","apbct_get_elems__native","out","forEach","elem","arr","document","getElementById","getElementsByClassName","key","push","apbct_show_hide_elem","each","label","next","prev","is","show","apbctSettingsDependencies","ids","enable","isNaN","console","log","getAttribute","state","removeAttribute","setAttribute","apbctSettingsDependencies_getState","checked","apbct_settings__showDescription","setting_id","remove_desc_func","e","target","parent","hasClass","remove","off","after","append","css","top","position","left","spinner","children","empty","title","desc","on","ready","getComputedStyle","direction","val","attr","this","fadeOut","d","Date","getTimezoneOffset","dialog","modal","my","at","of","window","width","height","draggable","resizable","closeText","button","setTimeout","reload","location","ctSettingsPage","key_changed","click","self"],"mappings":"AAmEA,SAASA,qBACR,IAAIC,EAAgBC,YAAa,WAChCC,qBACC,CAACC,OAAQ,sCACT,CACCC,SAAU,SAASC,EAAQC,EAAMC,EAAQC,GACpCH,EAAOI,qBACNC,OAAO,uBAAuBC,QACjCD,OAAO,uBAAuBE,KAAK,QAChCF,OAAO,uBAAuBC,QACjCD,OAAO,uBAAuBE,KAAK,QACpCC,cAAcb,QAKhB,KAUJ,SAASc,gBAAgBC,GAErB,IAAK,IAA6BC,EAAzBC,EAAE,EAAGC,GADdH,EAAQA,EAAMI,MAAM,MACMR,OAAaM,EAAIC,EAAKD,IAC5CD,EAAMN,OAAO,IAAIK,EAAME,IACvBF,EAAME,GAAoB,IAAfD,EAAIL,OAAeD,OAAO,IAAIK,EAAME,IAAMD,EAEzD,OAAOD,EAUX,SAASK,wBAAwBL,GAGZ,iBAAVA,IACTA,EAAQA,EAAMI,MAAM,MAErB,IAAIE,EAAM,GAuBV,OArBAN,EAAMO,QAAQ,SAASC,EAAMN,EAAGO,GAG/B,IAAIR,EAAMS,SAASC,eAAeH,GAClC,GAAY,OAARP,GAQJ,GAAY,QADZA,EAAMS,SAASE,uBAAuBJ,KACJ,IAAdP,EAAIL,OACvB,IAAIiB,OAAOZ,EACE,IAAPY,KACJP,EAAIQ,KAAMb,EAAIY,WAVhBP,EAAIQ,KAAMb,EAAIY,QAgBTP,EAGR,SAASS,qBAAqBf,GAE1B,IAAK,IAAIE,EAAE,EAAGC,GADjBH,EAAQD,gBAAgBC,IACKJ,OAAQM,EAAIC,EAAKD,IACvCF,EAAME,GAAGc,KAAK,SAAUd,EAAGM,GAEvB,IAAIS,GADJT,EAAOb,OAAOa,IACGU,KAAK,UAAYV,EAAKW,KAAK,UAAY,KACpDX,EAAKY,GAAG,aACRZ,EAAKX,OACDoB,GAAOA,EAAMpB,SAEjBW,EAAKa,OACDJ,GAAOA,EAAMI,UAajC,SAASC,0BAA0BC,EAAKC,GAGvCA,EAAWC,MAAMD,GAAmB,KAATA,EAGfnB,wBAAyBkB,GAE/BhB,QAAQ,SAASC,EAAMN,EAAGO,GAE/BiB,QAAQC,IAAKnB,EAAKoB,aAAa,OAE/B,IAUKC,EANS,OAAXL,IACFA,EAA2C,OAAlChB,EAAKoB,aAAa,YAAuB,EAAI,GAE5C,IAAXJ,EANyBhB,EAAKsB,gBAAgB,YADlBtB,EAAKuB,aAAa,WAAY,YASd,OAAxCvB,EAAKoB,aAAa,mBAEP,QADVC,EAAQG,mCAAoCxB,IAAUgB,IAEzDF,0BAA2Bd,EAAKoB,aAAa,kBAAmBC,KAOpE,SAASG,mCAAoCxB,GAE5C,IAAIqB,EAEJ,OAASrB,EAAKoB,aAAc,SAC3B,IAAK,WACJC,GAASrB,EAAKyB,QACd,MACD,IAAK,QACJJ,IAA0C,IAA/BrB,EAAKoB,aAAa,UAC7B,MACD,QACCC,EAAQ,KAGV,OAAOA,EAGR,SAASK,gCAAgCjB,EAAOkB,GAE/C,IAAIC,EAAmB,SAASC,QACf,IAANA,IAA6E,GAAtD1C,OAAO0C,EAAEC,QAAQC,OAAO,oBAAoB3C,SAAeD,OAAO0C,EAAEC,QAAQE,SAAS,4BAAgC7C,OAAO0C,EAAEC,QAAQE,SAAS,mCAC/K7C,OAAO,oBAAoB8C,SAC3B9C,OAAOe,UAAUgC,IAAI,QAASN,KAIhCA,IAEAnB,EAAM0B,MAAM,6BAA6BR,EAAW,oCACpD,IAAI1C,EAAME,OAAO,qBAAqBwC,GACtC1C,EAAImD,OAAO,2CACTA,OAAO,8CACPC,IAAI,CACJC,IAAK7B,EAAM8B,WAAWD,IAAM,EAC5BE,KAAM/B,EAAM8B,WAAWC,KAAO,KAIhC7D,qBACC,CAACC,OAAQ,kCAAmC+C,WAAYA,GACxD,CACCc,QAASxD,EAAIyD,SAAS,OACtB7D,SAAU,SAASC,EAAQC,EAAMC,EAAQC,GAExCA,EAAI0D,QACFP,OAAO,8CACPA,OAAO,uDACPA,OAAO,sCAAsCtD,EAAO8D,MAAM,SAC1DR,OAAO,MAAMtD,EAAO+D,KAAK,QAE3B1D,OAAOe,UAAU4C,GAAG,QAASlB,KAG/B3C,GA1PFE,OAAOe,UAAU6C,MAAM,WAGnB7C,SAASE,uBAAuB,wBAAwB,IACoC,QAA3F4C,iBAAiB9C,SAASE,uBAAuB,wBAAwB,IAAI6C,WAC/E9D,OAAO,oBAAoBkD,IAAI,aAAc,SAK5ClD,OAAO,qBAAqB2D,GAAG,QAAS,WACpC3D,OAAO,2BAA2B+D,IAAI/D,OAAO,2BAA2BgE,KAAK,QAC7EhE,OAAO,+BAA+B0B,OACtC1B,OAAOiE,MAAMC,QAAQ,OAG5B,IAAIC,EAAI,IAAIC,KACZpE,OAAO,sBAAsB+D,IAAII,EAAEE,oBAAoB,IAAK,GAG5DrE,OAAO,0BAA0B2D,GAAG,QAAS,WAC5C3D,OAAO,gBAAgBsE,OAAO,CAC7BC,OAAM,EACN7C,MAAM,EACN0B,SAAU,CAAEoB,GAAI,SAAUC,GAAI,SAAUC,GAAIC,QAC5CC,OAAS5E,OAAO,WAAW4E,QAAU,IAAM,GAC3CC,OAAQ,OACRpB,MAAO,kBACPqB,WAAW,EACXC,WAAW,EACXC,UAAW,YAKbhF,OAAO,uBAAuB2D,GAAG,QAAS,WACzCnE,qBACC,CAACC,OAAQ,cACT,CACCwF,OAAQlE,SAASC,eAAe,sBAChCsC,QAAStD,OAAO,+CAChBN,SAAU,SAASC,EAAQC,EAAMC,EAAQC,GACxCE,OAAO,kBAAkB0B,KAAK,KAC9BwD,WAAW,WAAWlF,OAAO,kBAAkBE,KAAK,MAAQ,KACzDP,EAAOwF,QACTpE,SAASqE,SAASD,cAMnBE,eAAeC,aAClBtF,OAAO,uBAAuBuF,QAE/BvF,OAAOe,UAAU4C,GAAG,QAAS,0CAA2C,WACvE6B,KAAOxF,OAAOiE,MACd1B,gCAAgCiD,KAAMA,KAAKxB,KAAK,eAG7ChE,OAAO,uBAAuBC,QAAUD,OAAO,uBAAuBC,SACzEZ"}
js/cleantalk-comments-editscreen.min.js CHANGED
@@ -1,2 +1,2 @@
1
- function ct_is_email(e){return e.search(/.*@.*\..*/)}function ct_is_ip(e){return e.search(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/)}function ct_send_feedback_request(t,c,n){var e={action:"ct_feedback_comment",security:ctCommentsScreen.ct_ajax_nonce,comment_id:t,comment_status:c};jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){ct_feedback_message_output(t,c,e,n)},error:function(e,t,c){console.log(e),console.log(t),console.log(c)},timeout:5e3})}function ct_feedback_message_output(e,t,c,n){1==c&&("approve"!=t||n||jQuery("tr#comment-"+e).html("").show().append("<td colspan='5'></td>").children("td").css("background","rgba(110,240,110,0.7)").append("<div class='spam-undo-inside'>"+ctCommentsScreen.ct_feedback_msg_whitelisted+" "+ctCommentsScreen.ct_feedback_msg+"</div>"),"spam"==t&&(jQuery("tr").is("#undo-"+e)?(jQuery("tr#undo-"+e).css("background","rgba(240,110,110,0.7)"),jQuery("tr#undo-"+e+" div.spam-undo-inside").append(" "+ctCommentsScreen.ct_feedback_msg_blacklisted+" "+ctCommentsScreen.ct_feedback_msg)):jQuery("tr#comment-"+e).html("").show().css("background","rgba(240,110,110,0.7)").append("<td colspan='5'></td>").children("td").append("<div class='spam-undo-inside'>"+ctCommentsScreen.ct_feedback_msg_blacklisted+" "+ctCommentsScreen.ct_feedback_msg+"</div>")))}jQuery(document).ready(function(){var t;parseInt(ctCommentsScreen.ct_show_check_links)&&jQuery(".column-author a, .comment-author a").each(function(){var e=jQuery(this).html();-1==ct_is_email(e)&&-1==ct_is_ip(e)||jQuery(this).after('&nbsp;<a href="https://cleantalk.org/blacklists/'+e+'" target="_blank" title="https://cleantalk.org/blacklists/'+e+'" class="ct_link_new_tab"><img src="'+ctCommentsScreen.ct_img_src_new_tab+'"></a>')}),jQuery("span.approve").on("click",function(){var e=jQuery(this).children("a").attr("href");e=e.match(/^comment\.php\?.*c=(\d*).*/),t=e[1],ct_send_feedback_request(undo_comment_id=t,"approve",0)}),jQuery("span.unapprove").on("click",function(){var e=jQuery(this).children("a").attr("href");e=e.match(/^comment\.php\?.*c=(\d*).*/),t=e[1],ct_send_feedback_request(undo_comment_id=t,"spam",0)}),jQuery("span.spam").on("click",function(){var e=jQuery(this).children("a").attr("href");e=e.match(/^comment\.php\?.*c=(\d*).*/),t=e[1],ct_send_feedback_request(undo_comment_id=t,"spam",0),setTimeout(function(){jQuery("tr#undo-"+t+" span.unspam a").click(function(){var e=jQuery(this).attr("href");e=e.match(/^comment\.php\?.*&c=(\d*).*/),ct_send_feedback_request(t=e[1],"approve",1)})},202)}),jQuery("span.unspam").on("click",function(){var e=jQuery(this).children("a").attr("href");e=e.match(/^comment\.php\?.*c=(\d*).*/),ct_send_feedback_request(t=e[1],"approve",0)}),jQuery("span.untrash a").on("click",function(){var e=jQuery(this).attr("href");e=e.match(/^comment\.php\?.*c=(\d*).*/),t=e[1],feedback_result=ct_send_feedback_request(t,"approve",0)})});
2
  //# sourceMappingURL=cleantalk-comments-editscreen.min.js.map
1
+ function ct_is_email(e){return e.search(/.*@.*\..*/)}function ct_is_ip(e){return e.search(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/)}function ct_send_feedback_request(t,c,n){var e={action:"ct_feedback_comment",security:ctCommentsScreen.ct_ajax_nonce,comment_id:t,comment_status:c};jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){ct_feedback_message_output(t,c,e,n)},error:function(e,t,c){console.log(e),console.log(t),console.log(c)},timeout:5e3})}function ct_feedback_message_output(e,t,c,n){1==c&&("approve"!=t||n||jQuery("tr#comment-"+e).html("").show().append("<td colspan='5'></td>").children("td").css("background","rgba(110,240,110,0.7)").append("<div class='spam-undo-inside'>"+ctCommentsScreen.ct_feedback_msg+"</div>"),"spam"==t&&(jQuery("tr").is("#undo-"+e)?(jQuery("tr#undo-"+e).css("background","rgba(240,110,110,0.7)"),jQuery("tr#undo-"+e+" div.spam-undo-inside").append(" "+ctCommentsScreen.ct_feedback_msg)):jQuery("tr#comment-"+e).html("").show().css("background","rgba(240,110,110,0.7)").append("<td colspan='5'></td>").children("td").append("<div class='spam-undo-inside'>"+ctCommentsScreen.ct_feedback_msg+"</div>")))}jQuery(document).ready(function(){var t;parseInt(ctCommentsScreen.ct_show_check_links)&&jQuery(".column-author a, .comment-author a").each(function(){var e=jQuery(this).html();-1==ct_is_email(e)&&-1==ct_is_ip(e)||jQuery(this).after('&nbsp;<a href="https://cleantalk.org/blacklists/'+e+'" target="_blank" title="https://cleantalk.org/blacklists/'+e+'" class="ct_link_new_tab"><img src="'+ctCommentsScreen.ct_img_src_new_tab+'"></a>')}),jQuery("span.approve").on("click",function(){var e=(e=jQuery(this).children("a").attr("href")).match(/^comment\.php\?.*c=(\d*).*/);t=e[1],ct_send_feedback_request(undo_comment_id=t,"approve",0)}),jQuery("span.unapprove").on("click",function(){var e=(e=jQuery(this).children("a").attr("href")).match(/^comment\.php\?.*c=(\d*).*/);t=e[1],ct_send_feedback_request(undo_comment_id=t,"spam",0)}),jQuery("span.spam").on("click",function(){var e=(e=jQuery(this).children("a").attr("href")).match(/^comment\.php\?.*c=(\d*).*/);t=e[1],ct_send_feedback_request(undo_comment_id=t,"spam",0),setTimeout(function(){jQuery("tr#undo-"+t+" span.unspam a").click(function(){var e=(e=jQuery(this).attr("href")).match(/^comment\.php\?.*&c=(\d*).*/);ct_send_feedback_request(t=e[1],"approve",1)})},202)}),jQuery("span.unspam").on("click",function(){var e=(e=jQuery(this).children("a").attr("href")).match(/^comment\.php\?.*c=(\d*).*/);ct_send_feedback_request(t=e[1],"approve",0)}),jQuery("span.untrash a").on("click",function(){var e=(e=jQuery(this).attr("href")).match(/^comment\.php\?.*c=(\d*).*/);t=e[1],feedback_result=ct_send_feedback_request(t,"approve",0)})});
2
  //# sourceMappingURL=cleantalk-comments-editscreen.min.js.map
js/cleantalk-comments-editscreen.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["cleantalk-comments-editscreen.js"],"names":["ct_is_email","str","search","ct_is_ip","ct_send_feedback_request","ct_comment_id","ct_comment_status","ct_undo","data","action","security","ctCommentsScreen","ct_ajax_nonce","comment_id","comment_status","jQuery","ajax","type","url","ajaxurl","success","msg","ct_feedback_message_output","error","jqXHR","textStatus","errorThrown","console","log","timeout","ct_result","html","show","append","children","css","ct_feedback_msg_whitelisted","ct_feedback_msg","is","ct_feedback_msg_blacklisted","document","ready","parseInt","ct_show_check_links","each","ct_curr_str","this","after","ct_img_src_new_tab","on","result","attr","match","undo_comment_id","setTimeout","click","feedback_result"],"mappings":"AAAA,SAASA,YAAYC,GACpB,OAAOA,EAAIC,OAAO,aAEnB,SAASC,SAASF,GACjB,OAAOA,EAAIC,OAAO,wCAwEnB,SAASE,yBAAyBC,EAAeC,EAAmBC,GAEnE,IAAIC,EAAO,CACVC,OAAU,sBACVC,SAAYC,iBAAiBC,cAC7BC,WAAcR,EACdS,eAAkBR,GAGnBS,OAAOC,KAAK,CACXC,KAAM,OACNC,IAAKC,QACLX,KAAMA,EACNY,QAAS,SAASC,GACjBC,2BAA2BjB,EAAeC,EAAmBe,EAAKd,IAE7DgB,MAAO,SAASC,EAAOC,EAAYC,GACxCC,QAAQC,IAAIJ,GACZG,QAAQC,IAAIH,GACZE,QAAQC,IAAIF,IAEPG,QAAS,MAKjB,SAASP,2BAA2BjB,EAAeC,EAAmBwB,EAAWvB,GAChE,GAAbuB,IACsB,WAArBxB,GAAmCC,GACrCQ,OAAO,cAAcV,GACnB0B,KAAK,IACLC,OACAC,OAAO,yBAAyBC,SAAS,MACxCC,IAAI,aAAc,yBAClBF,OAAO,iCAAiCtB,iBAAiByB,4BAA4B,IAAIzB,iBAAiB0B,gBAAgB,UAEtG,QAArB/B,IACCS,OAAO,MAAMuB,GAAG,SAASjC,IAC3BU,OAAO,WAAWV,GAChB8B,IAAI,aAAc,yBACpBpB,OAAO,WAAWV,EAAc,yBAC9B4B,OAAO,IAAItB,iBAAiB4B,4BAA4B,IAAI5B,iBAAiB0B,kBAE/EtB,OAAO,cAAcV,GACpB0B,KAAK,IACLC,OACAG,IAAI,aAAc,yBAClBF,OAAO,yBAAyBC,SAAS,MACxCD,OAAO,iCAAiCtB,iBAAiB4B,4BAA4B,IAAI5B,iBAAiB0B,gBAAgB,YArHhItB,OAAOyB,UAAUC,MAAM,WAYtB,IAAIpC,EATDqC,SAAS/B,iBAAiBgC,sBAC5B5B,OAAO,uCAAuC6B,KAAK,WAClD,IAAIC,EAAc9B,OAAO+B,MAAMf,QACC,GAA7B/B,YAAY6C,KAAgD,GAA1B1C,SAAS0C,IAC7C9B,OAAO+B,MAAMC,MAAM,mDAAmDF,EAAY,6DAA6DA,EAAY,uCAAuClC,iBAAiBqC,mBAAmB,YAQzOjC,OAAO,gBAAgBkC,GAAG,QAAS,WAClC,IAAIC,EAASnC,OAAO+B,MAAMZ,SAAS,KAAKiB,KAAK,QAC7CD,EAASA,EAAOE,MAAM,8BACtB/C,EAAgB6C,EAAO,GAEvB9C,yBADAiD,gBAAkBhD,EACsB,UAAW,KAIpDU,OAAO,kBAAkBkC,GAAG,QAAS,WACpC,IAAIC,EAASnC,OAAO+B,MAAMZ,SAAS,KAAKiB,KAAK,QAC7CD,EAASA,EAAOE,MAAM,8BACtB/C,EAAgB6C,EAAO,GAEvB9C,yBADAiD,gBAAkBhD,EACsB,OAAQ,KAIjDU,OAAO,aAAakC,GAAG,QAAS,WAC/B,IAAIC,EAASnC,OAAO+B,MAAMZ,SAAS,KAAKiB,KAAK,QAC7CD,EAASA,EAAOE,MAAM,8BACtB/C,EAAgB6C,EAAO,GAEvB9C,yBADAiD,gBAAkBhD,EACsB,OAAQ,GAEhDiD,WAAW,WACVvC,OAAO,WAAWV,EAAc,kBAAkBkD,MAAM,WACvD,IAAIL,EAASnC,OAAO+B,MAAMK,KAAK,QAC/BD,EAASA,EAAOE,MAAM,+BAEtBhD,yBADAC,EAAgB6C,EAAO,GACiB,UAAW,MAElD,OAKJnC,OAAO,eAAekC,GAAG,QAAS,WACjC,IAAIC,EAASnC,OAAO+B,MAAMZ,SAAS,KAAKiB,KAAK,QAC7CD,EAASA,EAAOE,MAAM,8BAEtBhD,yBADAC,EAAgB6C,EAAO,GACiB,UAAW,KAIpDnC,OAAO,kBAAkBkC,GAAG,QAAS,WACpC,IAAIC,EAASnC,OAAO+B,MAAMK,KAAK,QAC/BD,EAASA,EAAOE,MAAM,8BACtB/C,EAAgB6C,EAAO,GACvBM,gBAAkBpD,yBAAyBC,EAAe,UAAW","file":"cleantalk-comments-editscreen.min.js","sourcesContent":["function ct_is_email(str){\r\n\treturn str.search(/.*@.*\\..*/);\r\n}\r\nfunction ct_is_ip(str){\r\n\treturn str.search(/^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$/);\r\n}\r\n\r\njQuery(document).ready(function(){\r\n\r\n\t/* Shows link to blacklists near every email and IP address */\r\n\tif(parseInt(ctCommentsScreen.ct_show_check_links))\r\n\t\tjQuery('.column-author a, .comment-author a').each(function(){\r\n\t\t\tvar ct_curr_str = jQuery(this).html();\r\n\t\t\tif(ct_is_email(ct_curr_str) != -1 || ct_is_ip(ct_curr_str) != -1){\r\n\t\t\t\tjQuery(this).after('&nbsp;<a href=\"https://cleantalk.org/blacklists/'+ct_curr_str+'\" target=\"_blank\" title=\"https://cleantalk.org/blacklists/'+ct_curr_str+'\" class=\"ct_link_new_tab\"><img src=\"'+ctCommentsScreen.ct_img_src_new_tab+'\"></a>');\r\n\t\t\t}\r\n\t\t});\r\n\t\t\r\n\t/* Feedback for comments */\r\n\tvar ct_comment_id;\r\n\t\r\n\t// For approved\r\n\tjQuery('span.approve').on('click', function(){\r\n\t\tvar result = jQuery(this).children('a').attr('href');\r\n\t\tresult = result.match(/^comment\\.php\\?.*c=(\\d*).*/);\r\n\t\tct_comment_id = result[1];\r\n\t\tundo_comment_id = ct_comment_id;\r\n\t\tct_send_feedback_request(ct_comment_id, 'approve', 0);\t\t\r\n\t});\r\n\t\r\n\t// For unapprove\r\n\tjQuery('span.unapprove').on('click', function(){\r\n\t\tvar result = jQuery(this).children('a').attr('href');\r\n\t\tresult = result.match(/^comment\\.php\\?.*c=(\\d*).*/);\r\n\t\tct_comment_id = result[1];\r\n\t\tundo_comment_id = ct_comment_id;\r\n\t\tct_send_feedback_request(ct_comment_id, 'spam', 0);\t\t\r\n\t});\r\n\t\r\n\t// For spammed\r\n\tjQuery('span.spam').on('click', function(){\r\n\t\tvar result = jQuery(this).children('a').attr('href');\r\n\t\tresult = result.match(/^comment\\.php\\?.*c=(\\d*).*/);\r\n\t\tct_comment_id = result[1];\r\n\t\tundo_comment_id = ct_comment_id;\r\n\t\tct_send_feedback_request(ct_comment_id, 'spam', 0);\r\n\t\t\r\n\t\tsetTimeout(function(){\r\n\t\t\tjQuery('tr#undo-'+ct_comment_id+' span.unspam a').click(function(){\r\n\t\t\t\tvar result = jQuery(this).attr('href');\r\n\t\t\t\tresult = result.match(/^comment\\.php\\?.*&c=(\\d*).*/);\r\n\t\t\t\tct_comment_id = result[1];\r\n\t\t\t\tct_send_feedback_request(ct_comment_id, 'approve', 1);\r\n\t\t\t});\r\n\t\t}, 202);\r\n\t\t\r\n\t});\r\n\t\r\n\t// For unspammed\r\n\tjQuery('span.unspam').on('click', function(){\r\n\t\tvar result = jQuery(this).children('a').attr('href');\r\n\t\tresult = result.match(/^comment\\.php\\?.*c=(\\d*).*/);\r\n\t\tct_comment_id = result[1];\r\n\t\tct_send_feedback_request(ct_comment_id, 'approve', 0);\r\n\t});\r\n\t\r\n\t// For untrashed\r\n\tjQuery('span.untrash a').on('click', function(){\r\n\t\tvar result = jQuery(this).attr('href');\r\n\t\tresult = result.match(/^comment\\.php\\?.*c=(\\d*).*/);\r\n\t\tct_comment_id = result[1];\r\n\t\tfeedback_result = ct_send_feedback_request(ct_comment_id, 'approve', 0);\t\t\r\n\t});\t\r\n});\r\n\r\n// Send feedback to backend\r\nfunction ct_send_feedback_request(ct_comment_id, ct_comment_status, ct_undo){\r\n\t\r\n\tvar data = {\r\n\t\t'action': 'ct_feedback_comment',\r\n\t\t'security': ctCommentsScreen.ct_ajax_nonce,\r\n\t\t'comment_id': ct_comment_id,\r\n\t\t'comment_status': ct_comment_status\r\n\t};\r\n\t\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function(msg){\r\n\t\t\tct_feedback_message_output(ct_comment_id, ct_comment_status, msg, ct_undo);\r\n\t\t},\r\n error: function(jqXHR, textStatus, errorThrown) {\r\n\t\t\tconsole.log(jqXHR);\r\n\t\t\tconsole.log(textStatus);\r\n\t\t\tconsole.log(errorThrown);\r\n\t\t},\r\n timeout: 5000\r\n\t});\r\n}\r\n\r\n// Outputs CT message about feedback\r\nfunction ct_feedback_message_output(ct_comment_id, ct_comment_status, ct_result, ct_undo){\r\n\tif(ct_result == 1){\r\n\t\tif(ct_comment_status == 'approve' && !ct_undo){\r\n\t\t\tjQuery('tr#comment-'+ct_comment_id)\r\n\t\t\t\t.html('')\r\n\t\t\t\t.show()\r\n\t\t\t\t.append(\"<td colspan='5'></td>\").children('td')\r\n\t\t\t\t\t.css('background', 'rgba(110,240,110,0.7)')\r\n\t\t\t\t\t.append(\"<div class='spam-undo-inside'>\"+ctCommentsScreen.ct_feedback_msg_whitelisted+\" \"+ctCommentsScreen.ct_feedback_msg+\"</div>\");\t\t\t\t\t\t\r\n\t\t}\r\n\t\tif(ct_comment_status == 'spam'){\r\n\t\t\tif(jQuery('tr').is('#undo-'+ct_comment_id)){\r\n\t\t\t\tjQuery('tr#undo-'+ct_comment_id)\r\n\t\t\t\t\t.css('background', 'rgba(240,110,110,0.7)');\r\n\t\t\t\tjQuery('tr#undo-'+ct_comment_id+' div.spam-undo-inside')\r\n\t\t\t\t\t.append(\" \"+ctCommentsScreen.ct_feedback_msg_blacklisted+\" \"+ctCommentsScreen.ct_feedback_msg);\r\n\t\t\t}else{\r\n\t\t\t\tjQuery('tr#comment-'+ct_comment_id)\r\n\t\t\t\t.html('')\r\n\t\t\t\t.show()\r\n\t\t\t\t.css('background', 'rgba(240,110,110,0.7)')\r\n\t\t\t\t.append(\"<td colspan='5'></td>\").children('td')\r\n\t\t\t\t\t.append(\"<div class='spam-undo-inside'>\"+ctCommentsScreen.ct_feedback_msg_blacklisted+\" \"+ctCommentsScreen.ct_feedback_msg+\"</div>\");\t\t\t\t\t\t\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tif(ct_result == 0){\r\n\t\t// Error occurred\r\n\t}if(ct_result == 'no_hash'){\r\n\t\t// No hash for this comment\r\n\t}\r\n}\r\n"]}
1
+ {"version":3,"file":"cleantalk-comments-editscreen.min.js","sources":["cleantalk-comments-editscreen.js"],"sourcesContent":["function ct_is_email(str){\r\n\treturn str.search(/.*@.*\\..*/);\r\n}\r\nfunction ct_is_ip(str){\r\n\treturn str.search(/^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$/);\r\n}\r\n\r\njQuery(document).ready(function(){\r\n\r\n\t/* Shows link to blacklists near every email and IP address */\r\n\tif(parseInt(ctCommentsScreen.ct_show_check_links))\r\n\t\tjQuery('.column-author a, .comment-author a').each(function(){\r\n\t\t\tvar ct_curr_str = jQuery(this).html();\r\n\t\t\tif(ct_is_email(ct_curr_str) != -1 || ct_is_ip(ct_curr_str) != -1){\r\n\t\t\t\tjQuery(this).after('&nbsp;<a href=\"https://cleantalk.org/blacklists/'+ct_curr_str+'\" target=\"_blank\" title=\"https://cleantalk.org/blacklists/'+ct_curr_str+'\" class=\"ct_link_new_tab\"><img src=\"'+ctCommentsScreen.ct_img_src_new_tab+'\"></a>');\r\n\t\t\t}\r\n\t\t});\r\n\t\t\r\n\t/* Feedback for comments */\r\n\tvar ct_comment_id;\r\n\t\r\n\t// For approved\r\n\tjQuery('span.approve').on('click', function(){\r\n\t\tvar result = jQuery(this).children('a').attr('href');\r\n\t\tresult = result.match(/^comment\\.php\\?.*c=(\\d*).*/);\r\n\t\tct_comment_id = result[1];\r\n\t\tundo_comment_id = ct_comment_id;\r\n\t\tct_send_feedback_request(ct_comment_id, 'approve', 0);\t\t\r\n\t});\r\n\t\r\n\t// For unapprove\r\n\tjQuery('span.unapprove').on('click', function(){\r\n\t\tvar result = jQuery(this).children('a').attr('href');\r\n\t\tresult = result.match(/^comment\\.php\\?.*c=(\\d*).*/);\r\n\t\tct_comment_id = result[1];\r\n\t\tundo_comment_id = ct_comment_id;\r\n\t\tct_send_feedback_request(ct_comment_id, 'spam', 0);\t\t\r\n\t});\r\n\t\r\n\t// For spammed\r\n\tjQuery('span.spam').on('click', function(){\r\n\t\tvar result = jQuery(this).children('a').attr('href');\r\n\t\tresult = result.match(/^comment\\.php\\?.*c=(\\d*).*/);\r\n\t\tct_comment_id = result[1];\r\n\t\tundo_comment_id = ct_comment_id;\r\n\t\tct_send_feedback_request(ct_comment_id, 'spam', 0);\r\n\t\t\r\n\t\tsetTimeout(function(){\r\n\t\t\tjQuery('tr#undo-'+ct_comment_id+' span.unspam a').click(function(){\r\n\t\t\t\tvar result = jQuery(this).attr('href');\r\n\t\t\t\tresult = result.match(/^comment\\.php\\?.*&c=(\\d*).*/);\r\n\t\t\t\tct_comment_id = result[1];\r\n\t\t\t\tct_send_feedback_request(ct_comment_id, 'approve', 1);\r\n\t\t\t});\r\n\t\t}, 202);\r\n\t\t\r\n\t});\r\n\t\r\n\t// For unspammed\r\n\tjQuery('span.unspam').on('click', function(){\r\n\t\tvar result = jQuery(this).children('a').attr('href');\r\n\t\tresult = result.match(/^comment\\.php\\?.*c=(\\d*).*/);\r\n\t\tct_comment_id = result[1];\r\n\t\tct_send_feedback_request(ct_comment_id, 'approve', 0);\r\n\t});\r\n\t\r\n\t// For untrashed\r\n\tjQuery('span.untrash a').on('click', function(){\r\n\t\tvar result = jQuery(this).attr('href');\r\n\t\tresult = result.match(/^comment\\.php\\?.*c=(\\d*).*/);\r\n\t\tct_comment_id = result[1];\r\n\t\tfeedback_result = ct_send_feedback_request(ct_comment_id, 'approve', 0);\t\t\r\n\t});\t\r\n});\r\n\r\n// Send feedback to backend\r\nfunction ct_send_feedback_request(ct_comment_id, ct_comment_status, ct_undo){\r\n\t\r\n\tvar data = {\r\n\t\t'action': 'ct_feedback_comment',\r\n\t\t'security': ctCommentsScreen.ct_ajax_nonce,\r\n\t\t'comment_id': ct_comment_id,\r\n\t\t'comment_status': ct_comment_status\r\n\t};\r\n\t\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function(msg){\r\n\t\t\tct_feedback_message_output(ct_comment_id, ct_comment_status, msg, ct_undo);\r\n\t\t},\r\n error: function(jqXHR, textStatus, errorThrown) {\r\n\t\t\tconsole.log(jqXHR);\r\n\t\t\tconsole.log(textStatus);\r\n\t\t\tconsole.log(errorThrown);\r\n\t\t},\r\n timeout: 5000\r\n\t});\r\n}\r\n\r\n// Outputs CT message about feedback\r\nfunction ct_feedback_message_output(ct_comment_id, ct_comment_status, ct_result, ct_undo){\r\n\tif(ct_result == 1){\r\n\t\tif(ct_comment_status == 'approve' && !ct_undo){\r\n\t\t\tjQuery('tr#comment-'+ct_comment_id)\r\n\t\t\t\t.html('')\r\n\t\t\t\t.show()\r\n\t\t\t\t.append(\"<td colspan='5'></td>\").children('td')\r\n\t\t\t\t\t.css('background', 'rgba(110,240,110,0.7)')\r\n\t\t\t\t\t.append(\"<div class='spam-undo-inside'>\"+ctCommentsScreen.ct_feedback_msg+\"</div>\");\r\n\t\t}\r\n\t\tif(ct_comment_status == 'spam'){\r\n\t\t\tif(jQuery('tr').is('#undo-'+ct_comment_id)){\r\n\t\t\t\tjQuery('tr#undo-'+ct_comment_id)\r\n\t\t\t\t\t.css('background', 'rgba(240,110,110,0.7)');\r\n\t\t\t\tjQuery('tr#undo-'+ct_comment_id+' div.spam-undo-inside')\r\n\t\t\t\t\t.append(\" \"+ctCommentsScreen.ct_feedback_msg);\r\n\t\t\t}else{\r\n\t\t\t\tjQuery('tr#comment-'+ct_comment_id)\r\n\t\t\t\t.html('')\r\n\t\t\t\t.show()\r\n\t\t\t\t.css('background', 'rgba(240,110,110,0.7)')\r\n\t\t\t\t.append(\"<td colspan='5'></td>\").children('td')\r\n\t\t\t\t\t.append(\"<div class='spam-undo-inside'>\"+ctCommentsScreen.ct_feedback_msg+\"</div>\");\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tif(ct_result == 0){\r\n\t\t// Error occurred\r\n\t}if(ct_result == 'no_hash'){\r\n\t\t// No hash for this comment\r\n\t}\r\n}\r\n"],"names":["ct_is_email","str","search","ct_is_ip","ct_send_feedback_request","ct_comment_id","ct_comment_status","ct_undo","data","action","security","ctCommentsScreen","ct_ajax_nonce","comment_id","comment_status","jQuery","ajax","type","url","ajaxurl","success","msg","ct_feedback_message_output","error","jqXHR","textStatus","errorThrown","console","log","timeout","ct_result","html","show","append","children","css","ct_feedback_msg","is","document","ready","parseInt","ct_show_check_links","each","ct_curr_str","this","after","ct_img_src_new_tab","on","result","attr","match","undo_comment_id","setTimeout","click","feedback_result"],"mappings":"AAAA,SAASA,YAAYC,GACpB,OAAOA,EAAIC,OAAO,aAEnB,SAASC,SAASF,GACjB,OAAOA,EAAIC,OAAO,wCAwEnB,SAASE,yBAAyBC,EAAeC,EAAmBC,GAEnE,IAAIC,EAAO,CACVC,OAAU,sBACVC,SAAYC,iBAAiBC,cAC7BC,WAAcR,EACdS,eAAkBR,GAGnBS,OAAOC,KAAK,CACXC,KAAM,OACNC,IAAKC,QACLX,KAAMA,EACNY,QAAS,SAASC,GACjBC,2BAA2BjB,EAAeC,EAAmBe,EAAKd,IAE7DgB,MAAO,SAASC,EAAOC,EAAYC,GACxCC,QAAQC,IAAIJ,GACZG,QAAQC,IAAIH,GACZE,QAAQC,IAAIF,IAEPG,QAAS,MAKjB,SAASP,2BAA2BjB,EAAeC,EAAmBwB,EAAWvB,GAChE,GAAbuB,IACsB,WAArBxB,GAAmCC,GACrCQ,OAAO,cAAcV,GACnB0B,KAAK,IACLC,OACAC,OAAO,yBAAyBC,SAAS,MACxCC,IAAI,aAAc,yBAClBF,OAAO,iCAAiCtB,iBAAiByB,gBAAgB,UAErD,QAArB9B,IACCS,OAAO,MAAMsB,GAAG,SAAShC,IAC3BU,OAAO,WAAWV,GAChB8B,IAAI,aAAc,yBACpBpB,OAAO,WAAWV,EAAc,yBAC9B4B,OAAO,IAAItB,iBAAiByB,kBAE9BrB,OAAO,cAAcV,GACpB0B,KAAK,IACLC,OACAG,IAAI,aAAc,yBAClBF,OAAO,yBAAyBC,SAAS,MACxCD,OAAO,iCAAiCtB,iBAAiByB,gBAAgB,YArH/ErB,OAAOuB,UAAUC,MAAM,WAYtB,IAAIlC,EATDmC,SAAS7B,iBAAiB8B,sBAC5B1B,OAAO,uCAAuC2B,KAAK,WAClD,IAAIC,EAAc5B,OAAO6B,MAAMb,QACC,GAA7B/B,YAAY2C,KAAgD,GAA1BxC,SAASwC,IAC7C5B,OAAO6B,MAAMC,MAAM,mDAAmDF,EAAY,6DAA6DA,EAAY,uCAAuChC,iBAAiBmC,mBAAmB,YAQzO/B,OAAO,gBAAgBgC,GAAG,QAAS,WAClC,IACAC,GADIA,EAASjC,OAAO6B,MAAMV,SAAS,KAAKe,KAAK,SAC7BC,MAAM,8BACtB7C,EAAgB2C,EAAO,GAEvB5C,yBADA+C,gBAAkB9C,EACsB,UAAW,KAIpDU,OAAO,kBAAkBgC,GAAG,QAAS,WACpC,IACAC,GADIA,EAASjC,OAAO6B,MAAMV,SAAS,KAAKe,KAAK,SAC7BC,MAAM,8BACtB7C,EAAgB2C,EAAO,GAEvB5C,yBADA+C,gBAAkB9C,EACsB,OAAQ,KAIjDU,OAAO,aAAagC,GAAG,QAAS,WAC/B,IACAC,GADIA,EAASjC,OAAO6B,MAAMV,SAAS,KAAKe,KAAK,SAC7BC,MAAM,8BACtB7C,EAAgB2C,EAAO,GAEvB5C,yBADA+C,gBAAkB9C,EACsB,OAAQ,GAEhD+C,WAAW,WACVrC,OAAO,WAAWV,EAAc,kBAAkBgD,MAAM,WACvD,IACAL,GADIA,EAASjC,OAAO6B,MAAMK,KAAK,SACfC,MAAM,+BAEtB9C,yBADAC,EAAgB2C,EAAO,GACiB,UAAW,MAElD,OAKJjC,OAAO,eAAegC,GAAG,QAAS,WACjC,IACAC,GADIA,EAASjC,OAAO6B,MAAMV,SAAS,KAAKe,KAAK,SAC7BC,MAAM,8BAEtB9C,yBADAC,EAAgB2C,EAAO,GACiB,UAAW,KAIpDjC,OAAO,kBAAkBgC,GAAG,QAAS,WACpC,IACAC,GADIA,EAASjC,OAAO6B,MAAMK,KAAK,SACfC,MAAM,8BACtB7C,EAAgB2C,EAAO,GACvBM,gBAAkBlD,yBAAyBC,EAAe,UAAW"}
lib/Cleantalk/Antispam/Integrations/EstimationForm.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ namespace Cleantalk\Antispam\Integrations;
5
+
6
+
7
+ class EstimationForm extends IntegrationBase
8
+ {
9
+
10
+ function getDataForChecking( $argument )
11
+ {
12
+ if( isset( $_POST['customerInfos'] ) ) {
13
+ return ct_get_fields_any( $_POST['customerInfos'] );
14
+ }
15
+ return null;
16
+ }
17
+
18
+ function doBlock( $message )
19
+ {
20
+ die(json_encode(array( 'apbct' => array(
21
+ 'blocked' => true,
22
+ 'comment' => $message,
23
+ 'stop_script' => 1
24
+ ))));
25
+ }
26
+ }
lib/Cleantalk/ApbctWP/Firewall/AntiCrawler.php CHANGED
@@ -15,6 +15,8 @@ class AntiCrawler extends \Cleantalk\Common\Firewall\FirewallModule{
15
  private $api_key = '';
16
  private $apbct = false;
17
  private $store_interval = 60;
 
 
18
 
19
  /**
20
  * AntiBot constructor.
@@ -31,6 +33,8 @@ class AntiCrawler extends \Cleantalk\Common\Firewall\FirewallModule{
31
  foreach( $params as $param_name => $param ){
32
  $this->$param_name = isset( $this->$param_name ) ? $param : false;
33
  }
 
 
34
 
35
  }
36
 
@@ -42,7 +46,25 @@ class AntiCrawler extends \Cleantalk\Common\Firewall\FirewallModule{
42
  public function check() {
43
 
44
  $results = array();
45
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  foreach( $this->ip_array as $ip_origin => $current_ip ){
47
 
48
  // @todo Rename ip column to sign. Use IP + UserAgent for it.
@@ -74,8 +96,10 @@ class AntiCrawler extends \Cleantalk\Common\Firewall\FirewallModule{
74
  }
75
 
76
  }else{
77
-
78
- $this->update_ac_log();
 
 
79
 
80
  add_action( 'wp_head', array( '\Cleantalk\ApbctWP\Firewall\AntiCrawler', 'set_cookie' ) );
81
  global $apbct_anticrawler_ip;
@@ -126,7 +150,7 @@ class AntiCrawler extends \Cleantalk\Common\Firewall\FirewallModule{
126
  */
127
  public function update_log( $ip, $status ) {
128
 
129
- $id = md5( $ip );
130
  $time = time();
131
 
132
  $query = "INSERT INTO " . $this->db__table__logs . "
@@ -150,9 +174,9 @@ class AntiCrawler extends \Cleantalk\Common\Firewall\FirewallModule{
150
  public function _die( $result ){
151
 
152
  // File exists?
153
- if(file_exists(CLEANTALK_PLUGIN_DIR . "lib/Cleantalk/ApbctWP/Firewall/die_page__anticrawler.html")){
154
 
155
- $sfw_die_page = file_get_contents(CLEANTALK_PLUGIN_DIR . "lib/Cleantalk/ApbctWP/Firewall/die_page__anticrawler.html");
156
 
157
  // Translation
158
  $replaces = array(
@@ -175,8 +199,27 @@ class AntiCrawler extends \Cleantalk\Common\Firewall\FirewallModule{
175
  wp_die($sfw_die_page, "Blacklisted", Array('response'=>403));
176
 
177
  }else{
178
- wp_die("IP BLACKLISTED", "Blacklisted", Array('response'=>403));
179
  }
180
 
181
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
182
  }
15
  private $api_key = '';
16
  private $apbct = false;
17
  private $store_interval = 60;
18
+
19
+ public $isExcluded = false;
20
 
21
  /**
22
  * AntiBot constructor.
33
  foreach( $params as $param_name => $param ){
34
  $this->$param_name = isset( $this->$param_name ) ? $param : false;
35
  }
36
+
37
+ $this->isExcluded = $this->check_exclusions();
38
 
39
  }
40
 
46
  public function check() {
47
 
48
  $results = array();
49
+
50
+ // Skip by cookie
51
+ foreach( $this->ip_array as $ip_origin => $current_ip ) {
52
+
53
+ if( Cookie::get('apbct_antibot') == md5( $this->api_key . $current_ip ) ) {
54
+
55
+ if( Cookie::get( 'apbct_anticrawler_passed' ) === '1' ){
56
+ if( ! headers_sent() )
57
+ \Cleantalk\Common\Helper::apbct_cookie__set( 'apbct_anticrawler_passed', '0', time() - 86400, '/', null, false, true, 'Lax' );
58
+ }
59
+
60
+ $results[] = array( 'ip' => $current_ip, 'is_personal' => false, 'status' => 'PASS_ANTICRAWLER', );
61
+
62
+ return $results;
63
+
64
+ }
65
+ }
66
+
67
+ // Common check
68
  foreach( $this->ip_array as $ip_origin => $current_ip ){
69
 
70
  // @todo Rename ip column to sign. Use IP + UserAgent for it.
96
  }
97
 
98
  }else{
99
+
100
+ if( ! Cookie::get('apbct_antibot') ) {
101
+ $this->update_ac_log();
102
+ }
103
 
104
  add_action( 'wp_head', array( '\Cleantalk\ApbctWP\Firewall\AntiCrawler', 'set_cookie' ) );
105
  global $apbct_anticrawler_ip;
150
  */
151
  public function update_log( $ip, $status ) {
152
 
153
+ $id = md5( $ip . $this->module_name );
154
  $time = time();
155
 
156
  $query = "INSERT INTO " . $this->db__table__logs . "
174
  public function _die( $result ){
175
 
176
  // File exists?
177
+ if(file_exists(CLEANTALK_PLUGIN_DIR . "lib/Cleantalk/ApbctWP/Firewall/die_page_anticrawler.html")){
178
 
179
+ $sfw_die_page = file_get_contents(CLEANTALK_PLUGIN_DIR . "lib/Cleantalk/ApbctWP/Firewall/die_page_anticrawler.html");
180
 
181
  // Translation
182
  $replaces = array(
199
  wp_die($sfw_die_page, "Blacklisted", Array('response'=>403));
200
 
201
  }else{
202
+ wp_die("IP BLACKLISTED. Blocked by AntiCrawler " . $result['ip'], "Blacklisted", Array('response'=>403));
203
  }
204
 
205
  }
206
+
207
+ private function check_exclusions() {
208
+
209
+ $allowed_roles = array( 'administrator', 'editor' );
210
+ $user = apbct_wp_get_current_user();
211
+
212
+ if( ! $user ) {
213
+ return false;
214
+ }
215
+
216
+ foreach( $allowed_roles as $role ) {
217
+ if( in_array( $role, (array) $user->roles ) ) {
218
+ return true;
219
+ }
220
+ }
221
+
222
+ return false;
223
+
224
+ }
225
  }
lib/Cleantalk/ApbctWP/Firewall/AntiFlood.php CHANGED
@@ -18,6 +18,8 @@ class AntiFlood extends \Cleantalk\Common\Firewall\FirewallModule{
18
  private $store_interval = 60;
19
  private $block_period = 30;
20
  private $chance_to_clean = 20;
 
 
21
 
22
  /**
23
  * AntiCrawler constructor.
@@ -34,6 +36,8 @@ class AntiFlood extends \Cleantalk\Common\Firewall\FirewallModule{
34
  foreach( $params as $param_name => $param ){
35
  $this->$param_name = isset( $this->$param_name ) ? $param : false;
36
  }
 
 
37
  }
38
 
39
  /**
@@ -133,7 +137,7 @@ class AntiFlood extends \Cleantalk\Common\Firewall\FirewallModule{
133
  */
134
  public function update_log( $ip, $status ) {
135
 
136
- $id = md5( $ip );
137
  $time = time();
138
 
139
  $query = "INSERT INTO " . $this->db__table__logs . "
@@ -159,9 +163,9 @@ class AntiFlood extends \Cleantalk\Common\Firewall\FirewallModule{
159
  parent::_die( $result );
160
 
161
  // File exists?
162
- if( file_exists( CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/ApbctWP/Firewall/die_page__AntiFlood.html' ) ){
163
 
164
- $sfw_die_page = file_get_contents( CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/ApbctWP/Firewall/die_page__AntiFlood.html' );
165
 
166
  // Translation
167
  $replaces = array(
@@ -184,8 +188,27 @@ class AntiFlood extends \Cleantalk\Common\Firewall\FirewallModule{
184
  wp_die( $sfw_die_page, 'Blacklisted', array( 'response' => 403 ) );
185
 
186
  } else{
187
- wp_die( 'IP BLACKLISTED', 'Blacklisted', array( 'response' => 403 ) );
188
  }
189
 
190
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
191
  }
18
  private $store_interval = 60;
19
  private $block_period = 30;
20
  private $chance_to_clean = 20;
21
+
22
+ public $isExcluded = false;
23
 
24
  /**
25
  * AntiCrawler constructor.
36
  foreach( $params as $param_name => $param ){
37
  $this->$param_name = isset( $this->$param_name ) ? $param : false;
38
  }
39
+
40
+ $this->isExcluded = $this->check_exclusions();
41
  }
42
 
43
  /**
137
  */
138
  public function update_log( $ip, $status ) {
139
 
140
+ $id = md5( $ip . $this->module_name );
141
  $time = time();
142
 
143
  $query = "INSERT INTO " . $this->db__table__logs . "
163
  parent::_die( $result );
164
 
165
  // File exists?
166
+ if( file_exists( CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/ApbctWP/Firewall/die_page_antiflood.html' ) ){
167
 
168
+ $sfw_die_page = file_get_contents( CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/ApbctWP/Firewall/die_page_antiflood.html' );
169
 
170
  // Translation
171
  $replaces = array(
188
  wp_die( $sfw_die_page, 'Blacklisted', array( 'response' => 403 ) );
189
 
190
  } else{
191
+ wp_die( "IP BLACKLISTED. Blocked by AntiFlood " . $result['ip'], 'Blacklisted', array( 'response' => 403 ) );
192
  }
193
 
194
  }
195
+
196
+ private function check_exclusions() {
197
+
198
+ $allowed_roles = array( 'administrator', 'editor' );
199
+ $user = apbct_wp_get_current_user();
200
+
201
+ if( ! $user ) {
202
+ return false;
203
+ }
204
+
205
+ foreach( $allowed_roles as $role ) {
206
+ if( in_array( $role, (array) $user->roles ) ) {
207
+ return true;
208
+ }
209
+ }
210
+
211
+ return false;
212
+
213
+ }
214
  }
lib/Cleantalk/ApbctWP/Firewall/SFW.php CHANGED
@@ -160,7 +160,7 @@ class SFW extends \Cleantalk\Common\Firewall\FirewallModule {
160
  return;
161
  }
162
 
163
- $id = md5( $ip );
164
  $time = time();
165
 
166
  $query = "INSERT INTO " . $this->db__table__logs . "
@@ -217,9 +217,9 @@ class SFW extends \Cleantalk\Common\Firewall\FirewallModule {
217
  }
218
 
219
  // File exists?
220
- if(file_exists(CLEANTALK_PLUGIN_DIR . "lib/Cleantalk/ApbctWP/Firewall/die_page__SFW.html")){
221
 
222
- $sfw_die_page = file_get_contents(CLEANTALK_PLUGIN_DIR . "lib/Cleantalk/ApbctWP/Firewall/die_page__SFW.html");
223
 
224
  $status = $result['status'] == 'PASS_SFW__BY_WHITELIST' ? '1' : '0';
225
  $cookie_val = md5( $result['ip'] . $this->api_key ) . $status;
@@ -282,7 +282,7 @@ class SFW extends \Cleantalk\Common\Firewall\FirewallModule {
282
  wp_die($sfw_die_page, "Blacklisted", Array('response'=>403));
283
 
284
  }else{
285
- wp_die("IP BLACKLISTED", "Blacklisted", Array('response'=>403));
286
  }
287
 
288
  }
160
  return;
161
  }
162
 
163
+ $id = md5( $ip . $this->module_name );
164
  $time = time();
165
 
166
  $query = "INSERT INTO " . $this->db__table__logs . "
217
  }
218
 
219
  // File exists?
220
+ if(file_exists(CLEANTALK_PLUGIN_DIR . "lib/Cleantalk/ApbctWP/Firewall/die_page_sfw.html")){
221
 
222
+ $sfw_die_page = file_get_contents(CLEANTALK_PLUGIN_DIR . "lib/Cleantalk/ApbctWP/Firewall/die_page_sfw.html");
223
 
224
  $status = $result['status'] == 'PASS_SFW__BY_WHITELIST' ? '1' : '0';
225
  $cookie_val = md5( $result['ip'] . $this->api_key ) . $status;
282
  wp_die($sfw_die_page, "Blacklisted", Array('response'=>403));
283
 
284
  }else{
285
+ wp_die("IP BLACKLISTED. Blocked by SFW " . $result['ip'], "Blacklisted", Array('response'=>403));
286
  }
287
 
288
  }
lib/Cleantalk/ApbctWP/Firewall/{die_page__AntiCrawler.html → die_page_anticrawler.html} RENAMED
@@ -1,135 +1,135 @@
1
- <!DOCTYPE html>
2
- <html lang='en'>
3
- <head>
4
- <meta charset='utf-8' />
5
- <meta name='viewport' content='width=device-width, initial-scale=1' />
6
- <meta http-equiv="cache-control" content="no-cache">
7
- <meta http-equiv="cache-control" content="private">
8
- <meta http-equiv="cache-control" content="max-age=0, must-revalidate">
9
- <meta http-equiv="cache-control" content="max-age=0, proxy-revalidate">
10
- <meta http-equiv="expires" content="0" />
11
- <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
12
- <meta http-equiv="pragma" content="no-cache" />
13
-
14
- <!--[if lt IE 9]>
15
- <script src='http://html5shiv.googlecode.com/svn/trunk/html5.js'></script>
16
- <![endif]-->
17
- <style>
18
- html{font-size: 14pt;}
19
- h1{text-align:center}
20
- h1.main{margin-top: 1em;margin-bottom: 3em;}
21
- div.container {text-align:center;}
22
- div.container p.js_notice{width: 60%; display: inline-block;}
23
- div.footer {color: #666; text-align: center;}
24
- div.footer a {color: #666; vertical-align:bottom; text-align: center;}
25
-
26
- @media (max-width: 600px) {
27
- }
28
-
29
- .spinner {
30
- margin-left: auto;
31
- margin-right: auto;
32
- width: 70px;
33
- text-align: center;
34
- }
35
-
36
- .spinner > div {
37
- width: 14px;
38
- height: 14px;
39
- background-color: #333;
40
-
41
- border-radius: 100%;
42
- display: inline-block;
43
- -webkit-animation: sk-bouncedelay 1.4s infinite ease-in-out both;
44
- animation: sk-bouncedelay 1.4s infinite ease-in-out both;
45
- }
46
-
47
- .spinner .bounce1 {
48
- -webkit-animation-delay: -0.32s;
49
- animation-delay: -0.32s;
50
- }
51
-
52
- .spinner .bounce2 {
53
- -webkit-animation-delay: -0.16s;
54
- animation-delay: -0.16s;
55
- }
56
-
57
- @-webkit-keyframes sk-bouncedelay {
58
- 0%, 80%, 100% { -webkit-transform: scale(0) }
59
- 40% { -webkit-transform: scale(1.0) }
60
- }
61
-
62
- @keyframes sk-bouncedelay {
63
- 0%, 80%, 100% {
64
- -webkit-transform: scale(0);
65
- transform: scale(0);
66
- } 40% {
67
- -webkit-transform: scale(1.0);
68
- transform: scale(1.0);
69
- }
70
- }
71
- </style>
72
- <script>
73
- var ct_date = new Date;
74
-
75
- function set_spamFireWallCookie(cookie_name, cookie_value) {
76
- var date = new Date;
77
- date.setDate(date.getDate() + 30);
78
- document.cookie = cookie_name + '=' + escape(cookie_value) + '; path=/; expires=' + date.toUTCString() + '; samesite=lax';
79
- return null;
80
- }
81
-
82
- function get_current_url() {
83
- document.write(window.location.href);
84
- return null;
85
- }
86
- </script>
87
- </head>
88
-
89
- <body>
90
- <div class='container'>
91
- <h1 class='main'>{SFW_DIE_NOTICE_IP}<a href='https://cleantalk.org/blacklists/{REMOTE_ADDRESS}' target='_blank'> {REMOTE_ADDRESS}</a></h1>
92
-
93
- <div id='js_info'><br />{SFW_DIE_MAKE_SURE_JS_ENABLED}</div>
94
-
95
- <div id='js_passed'>
96
- <br />
97
- <p class='js_notice'>{SFW_DIE_YOU_WILL_BE_REDIRECTED}</p>
98
- <br />
99
- <div class="spinner">
100
- <div class="bounce1"></div>
101
- <div class="bounce2"></div>
102
- <div class="bounce3"></div>
103
- </div>
104
- {GENERATED}
105
- <p>Browser time <span id='curr_date'></span></p>
106
- </div>
107
-
108
- </div>
109
- <div style='position: relative; line-height: 8px; text-align: center;'>
110
- <p style="margin: 0; display: inline-block; font-size: 10px; color: gray;">{SERVICE_ID}, </p>
111
- <p style="margin: 0; display: inline-block; font-size: 10px; color: gray;">{HOST}</p>
112
- </div>
113
- <div class='footer'>
114
- <a href='https://cleantalk.org' target='_blank'>{CLEANTALK_TITLE}</a>
115
- </div>
116
- <script type='text/javascript'>
117
- var reload_timeout = 30000;
118
- document.getElementById('js_info').style.display = 'none';
119
- document.getElementById('js_passed').style.display = 'block';
120
- document.getElementById('curr_date').innerHTML = ct_date.toGMTString();
121
-
122
- setTimeout( function(){
123
- console.log('do');
124
- set_spamFireWallCookie('apbct_antibot', '{COOKIE_ANTICRAWLER}');
125
- set_spamFireWallCookie('apbct_anticrawler_passed','{COOKIE_ANTICRAWLER_PASSED}');
126
- }, 5000 );
127
-
128
- if(location.search.search('debug=1') === -1) {
129
- setTimeout(function(){
130
- window.location.href = window.location.origin + window.location.pathname + '?sfw=pass' + Math.round(ct_date.getTime()/1000);
131
- }, reload_timeout);
132
- }
133
- </script>
134
- </body>
135
  </html>
1
+ <!DOCTYPE html>
2
+ <html lang='en'>
3
+ <head>
4
+ <meta charset='utf-8' />
5
+ <meta name='viewport' content='width=device-width, initial-scale=1' />
6
+ <meta http-equiv="cache-control" content="no-cache">
7
+ <meta http-equiv="cache-control" content="private">
8
+ <meta http-equiv="cache-control" content="max-age=0, must-revalidate">
9
+ <meta http-equiv="cache-control" content="max-age=0, proxy-revalidate">
10
+ <meta http-equiv="expires" content="0" />
11
+ <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
12
+ <meta http-equiv="pragma" content="no-cache" />
13
+
14
+ <!--[if lt IE 9]>
15
+ <script src='http://html5shiv.googlecode.com/svn/trunk/html5.js'></script>
16
+ <![endif]-->
17
+ <style>
18
+ html{font-size: 14pt;}
19
+ h1{text-align:center}
20
+ h1.main{margin-top: 1em;margin-bottom: 3em;}
21
+ div.container {text-align:center;}
22
+ div.container p.js_notice{width: 60%; display: inline-block;}
23
+ div.footer {color: #666; text-align: center;}
24
+ div.footer a {color: #666; vertical-align:bottom; text-align: center;}
25
+
26
+ @media (max-width: 600px) {
27
+ }
28
+
29
+ .spinner {
30
+ margin-left: auto;
31
+ margin-right: auto;
32
+ width: 70px;
33
+ text-align: center;
34
+ }
35
+
36
+ .spinner > div {
37
+ width: 14px;
38
+ height: 14px;
39
+ background-color: #333;
40
+
41
+ border-radius: 100%;
42
+ display: inline-block;
43
+ -webkit-animation: sk-bouncedelay 1.4s infinite ease-in-out both;
44
+ animation: sk-bouncedelay 1.4s infinite ease-in-out both;
45
+ }
46
+
47
+ .spinner .bounce1 {
48
+ -webkit-animation-delay: -0.32s;
49
+ animation-delay: -0.32s;
50
+ }
51
+
52
+ .spinner .bounce2 {
53
+ -webkit-animation-delay: -0.16s;
54
+ animation-delay: -0.16s;
55
+ }
56
+
57
+ @-webkit-keyframes sk-bouncedelay {
58
+ 0%, 80%, 100% { -webkit-transform: scale(0) }
59
+ 40% { -webkit-transform: scale(1.0) }
60
+ }
61
+
62
+ @keyframes sk-bouncedelay {
63
+ 0%, 80%, 100% {
64
+ -webkit-transform: scale(0);
65
+ transform: scale(0);
66
+ } 40% {
67
+ -webkit-transform: scale(1.0);
68
+ transform: scale(1.0);
69
+ }
70
+ }
71
+ </style>
72
+ <script>
73
+ var ct_date = new Date;
74
+
75
+ function set_spamFireWallCookie(cookie_name, cookie_value) {
76
+ var date = new Date;
77
+ date.setDate(date.getDate() + 30);
78
+ document.cookie = cookie_name + '=' + escape(cookie_value) + '; path=/; expires=' + date.toUTCString() + '; samesite=lax';
79
+ return null;
80
+ }
81
+
82
+ function get_current_url() {
83
+ document.write(window.location.href);
84
+ return null;
85
+ }
86
+ </script>
87
+ </head>
88
+
89
+ <body>
90
+ <div class='container'>
91
+ <h1 class='main'>{SFW_DIE_NOTICE_IP}<a href='https://cleantalk.org/blacklists/{REMOTE_ADDRESS}' target='_blank'> {REMOTE_ADDRESS}</a></h1>
92
+
93
+ <div id='js_info'><br />{SFW_DIE_MAKE_SURE_JS_ENABLED}</div>
94
+
95
+ <div id='js_passed'>
96
+ <br />
97
+ <p class='js_notice'>{SFW_DIE_YOU_WILL_BE_REDIRECTED}</p>
98
+ <br />
99
+ <div class="spinner">
100
+ <div class="bounce1"></div>
101
+ <div class="bounce2"></div>
102
+ <div class="bounce3"></div>
103
+ </div>
104
+ {GENERATED}
105
+ <p>Browser time <span id='curr_date'></span></p>
106
+ </div>
107
+
108
+ </div>
109
+ <div style='position: relative; line-height: 8px; text-align: center;'>
110
+ <p style="margin: 0; display: inline-block; font-size: 10px; color: gray;">{SERVICE_ID}, </p>
111
+ <p style="margin: 0; display: inline-block; font-size: 10px; color: gray;">{HOST}</p>
112
+ </div>
113
+ <div class='footer'>
114
+ <a href='https://cleantalk.org' target='_blank'>{CLEANTALK_TITLE}</a>
115
+ </div>
116
+ <script type='text/javascript'>
117
+ var reload_timeout = 30000;
118
+ document.getElementById('js_info').style.display = 'none';
119
+ document.getElementById('js_passed').style.display = 'block';
120
+ document.getElementById('curr_date').innerHTML = ct_date.toGMTString();
121
+
122
+ setTimeout( function(){
123
+ console.log('do');
124
+ set_spamFireWallCookie('apbct_antibot', '{COOKIE_ANTICRAWLER}');
125
+ set_spamFireWallCookie('apbct_anticrawler_passed','{COOKIE_ANTICRAWLER_PASSED}');
126
+ }, 5000 );
127
+
128
+ if(location.search.search('debug=1') === -1) {
129
+ setTimeout(function(){
130
+ window.location.href = window.location.origin + window.location.pathname + '?sfw=pass' + Math.round(ct_date.getTime()/1000);
131
+ }, reload_timeout);
132
+ }
133
+ </script>
134
+ </body>
135
  </html>
lib/Cleantalk/ApbctWP/Firewall/{die_page__AntiFlood.html → die_page_antiflood.html} RENAMED
@@ -1,133 +1,133 @@
1
- <!DOCTYPE html>
2
- <html lang='en'>
3
- <head>
4
- <meta charset='utf-8' />
5
- <meta name='viewport' content='width=device-width, initial-scale=1' />
6
- <meta http-equiv="cache-control" content="no-cache">
7
- <meta http-equiv="cache-control" content="private">
8
- <meta http-equiv="cache-control" content="max-age=0, must-revalidate">
9
- <meta http-equiv="cache-control" content="max-age=0, proxy-revalidate">
10
- <meta http-equiv="expires" content="0" />
11
- <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
12
- <meta http-equiv="pragma" content="no-cache" />
13
-
14
- <!--[if lt IE 9]>
15
- <script src='http://html5shiv.googlecode.com/svn/trunk/html5.js'></script>
16
- <![endif]-->
17
- <style>
18
- html{font-size: 14pt;}
19
- h1{text-align:center}
20
- h1.main{margin-top: 1em;margin-bottom: 3em;}
21
- div.container {text-align:center;}
22
- div.container p.js_notice{width: 60%; display: inline-block;}
23
- div.footer {color: #666; text-align: center;}
24
- div.footer a {color: #666; vertical-align:bottom; text-align: center;}
25
-
26
- @media (max-width: 600px) {
27
- }
28
-
29
- .spinner {
30
- margin-left: auto;
31
- margin-right: auto;
32
- width: 70px;
33
- text-align: center;
34
- }
35
-
36
- .spinner > div {
37
- width: 14px;
38
- height: 14px;
39
- background-color: #333;
40
-
41
- border-radius: 100%;
42
- display: inline-block;
43
- -webkit-animation: sk-bouncedelay 1.4s infinite ease-in-out both;
44
- animation: sk-bouncedelay 1.4s infinite ease-in-out both;
45
- }
46
-
47
- .spinner .bounce1 {
48
- -webkit-animation-delay: -0.32s;
49
- animation-delay: -0.32s;
50
- }
51
-
52
- .spinner .bounce2 {
53
- -webkit-animation-delay: -0.16s;
54
- animation-delay: -0.16s;
55
- }
56
-
57
- @-webkit-keyframes sk-bouncedelay {
58
- 0%, 80%, 100% { -webkit-transform: scale(0) }
59
- 40% { -webkit-transform: scale(1.0) }
60
- }
61
-
62
- @keyframes sk-bouncedelay {
63
- 0%, 80%, 100% {
64
- -webkit-transform: scale(0);
65
- transform: scale(0);
66
- } 40% {
67
- -webkit-transform: scale(1.0);
68
- transform: scale(1.0);
69
- }
70
- }
71
- </style>
72
- <script>
73
- var ct_date = new Date;
74
-
75
- function set_spamFireWallCookie(cookie_name, cookie_value) {
76
- var date = new Date;
77
- date.setDate(date.getDate() + 30);
78
- document.cookie = cookie_name + '=' + escape(cookie_value) + '; path=/; expires=' + date.toUTCString() + '; samesite=lax';
79
- return null;
80
- }
81
-
82
- function get_current_url() {
83
- document.write(window.location.href);
84
- return null;
85
- }
86
- </script>
87
- </head>
88
-
89
- <body>
90
- <div class='container'>
91
- <h1 class='main'>{SFW_DIE_NOTICE_IP}<a href='https://cleantalk.org/blacklists/{REMOTE_ADDRESS}' target='_blank'> {REMOTE_ADDRESS}</a></h1>
92
-
93
- <div id='js_info'><br />{SFW_DIE_MAKE_SURE_JS_ENABLED}</div>
94
-
95
- <div id='js_passed'>
96
- <br />
97
- <p class='js_notice'>{SFW_DIE_YOU_WILL_BE_REDIRECTED}</p>
98
- <br />
99
- <div class="spinner">
100
- <div class="bounce1"></div>
101
- <div class="bounce2"></div>
102
- <div class="bounce3"></div>
103
- </div>
104
- {GENERATED}
105
- <p>Browser time <span id='curr_date'></span></p>
106
- </div>
107
-
108
- </div>
109
- <div style='position: relative; line-height: 8px; text-align: center;'>
110
- <p style="margin: 0; display: inline-block; font-size: 10px; color: gray;">{SERVICE_ID}, </p>
111
- <p style="margin: 0; display: inline-block; font-size: 10px; color: gray;">{HOST}</p>
112
- </div>
113
- <div class='footer'>
114
- <a href='https://cleantalk.org' target='_blank'>{CLEANTALK_TITLE}</a>
115
- </div>
116
- <script type='text/javascript'>
117
- var reload_timeout = 30000;
118
- document.getElementById('js_info').style.display = 'none';
119
- document.getElementById('js_passed').style.display = 'block';
120
- document.getElementById('curr_date').innerHTML = ct_date.toGMTString();
121
-
122
- setTimeout( function(){
123
- set_spamFireWallCookie('apbct_antiflood_passed', '{COOKIE_ANTIFLOOD_PASSED}');
124
- }, 5000 );
125
-
126
- if(location.search.search('debug=1') === -1) {
127
- setTimeout(function(){
128
- window.location.href = window.location.origin + window.location.pathname + '?sfw=pass' + Math.round(ct_date.getTime()/1000);
129
- }, reload_timeout);
130
- }
131
- </script>
132
- </body>
133
  </html>
1
+ <!DOCTYPE html>
2
+ <html lang='en'>
3
+ <head>
4
+ <meta charset='utf-8' />
5
+ <meta name='viewport' content='width=device-width, initial-scale=1' />
6
+ <meta http-equiv="cache-control" content="no-cache">
7
+ <meta http-equiv="cache-control" content="private">
8
+ <meta http-equiv="cache-control" content="max-age=0, must-revalidate">
9
+ <meta http-equiv="cache-control" content="max-age=0, proxy-revalidate">
10
+ <meta http-equiv="expires" content="0" />
11
+ <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
12
+ <meta http-equiv="pragma" content="no-cache" />
13
+
14
+ <!--[if lt IE 9]>
15
+ <script src='http://html5shiv.googlecode.com/svn/trunk/html5.js'></script>
16
+ <![endif]-->
17
+ <style>
18
+ html{font-size: 14pt;}
19
+ h1{text-align:center}
20
+ h1.main{margin-top: 1em;margin-bottom: 3em;}
21
+ div.container {text-align:center;}
22
+ div.container p.js_notice{width: 60%; display: inline-block;}
23
+ div.footer {color: #666; text-align: center;}
24
+ div.footer a {color: #666; vertical-align:bottom; text-align: center;}
25
+
26
+ @media (max-width: 600px) {
27
+ }
28
+
29
+ .spinner {
30
+ margin-left: auto;
31
+ margin-right: auto;
32
+ width: 70px;
33
+ text-align: center;
34
+ }
35
+
36
+ .spinner > div {
37
+ width: 14px;
38
+ height: 14px;
39
+ background-color: #333;
40
+
41
+ border-radius: 100%;
42
+ display: inline-block;
43
+ -webkit-animation: sk-bouncedelay 1.4s infinite ease-in-out both;
44
+ animation: sk-bouncedelay 1.4s infinite ease-in-out both;
45
+ }
46
+
47
+ .spinner .bounce1 {
48
+ -webkit-animation-delay: -0.32s;
49
+ animation-delay: -0.32s;
50
+ }
51
+
52
+ .spinner .bounce2 {
53
+ -webkit-animation-delay: -0.16s;
54
+ animation-delay: -0.16s;
55
+ }
56
+
57
+ @-webkit-keyframes sk-bouncedelay {
58
+ 0%, 80%, 100% { -webkit-transform: scale(0) }
59
+ 40% { -webkit-transform: scale(1.0) }
60
+ }
61
+
62
+ @keyframes sk-bouncedelay {
63
+ 0%, 80%, 100% {
64
+ -webkit-transform: scale(0);
65
+ transform: scale(0);
66
+ } 40% {
67
+ -webkit-transform: scale(1.0);
68
+ transform: scale(1.0);
69
+ }
70
+ }
71
+ </style>
72
+ <script>
73
+ var ct_date = new Date;
74
+
75
+ function set_spamFireWallCookie(cookie_name, cookie_value) {
76
+ var date = new Date;
77
+ date.setDate(date.getDate() + 30);
78
+ document.cookie = cookie_name + '=' + escape(cookie_value) + '; path=/; expires=' + date.toUTCString() + '; samesite=lax';
79
+ return null;
80
+ }
81
+
82
+ function get_current_url() {
83
+ document.write(window.location.href);
84
+ return null;
85
+ }
86
+ </script>
87
+ </head>
88
+
89
+ <body>
90
+ <div class='container'>
91
+ <h1 class='main'>{SFW_DIE_NOTICE_IP}<a href='https://cleantalk.org/blacklists/{REMOTE_ADDRESS}' target='_blank'> {REMOTE_ADDRESS}</a></h1>
92
+
93
+ <div id='js_info'><br />{SFW_DIE_MAKE_SURE_JS_ENABLED}</div>
94
+
95
+ <div id='js_passed'>
96
+ <br />
97
+ <p class='js_notice'>{SFW_DIE_YOU_WILL_BE_REDIRECTED}</p>
98
+ <br />
99
+ <div class="spinner">
100
+ <div class="bounce1"></div>
101
+ <div class="bounce2"></div>
102
+ <div class="bounce3"></div>
103
+ </div>
104
+ {GENERATED}
105
+ <p>Browser time <span id='curr_date'></span></p>
106
+ </div>
107
+
108
+ </div>
109
+ <div style='position: relative; line-height: 8px; text-align: center;'>
110
+ <p style="margin: 0; display: inline-block; font-size: 10px; color: gray;">{SERVICE_ID}, </p>
111
+ <p style="margin: 0; display: inline-block; font-size: 10px; color: gray;">{HOST}</p>
112
+ </div>
113
+ <div class='footer'>
114
+ <a href='https://cleantalk.org' target='_blank'>{CLEANTALK_TITLE}</a>
115
+ </div>
116
+ <script type='text/javascript'>
117
+ var reload_timeout = 30000;
118
+ document.getElementById('js_info').style.display = 'none';
119
+ document.getElementById('js_passed').style.display = 'block';
120
+ document.getElementById('curr_date').innerHTML = ct_date.toGMTString();
121
+
122
+ setTimeout( function(){
123
+ set_spamFireWallCookie('apbct_antiflood_passed', '{COOKIE_ANTIFLOOD_PASSED}');
124
+ }, 5000 );
125
+
126
+ if(location.search.search('debug=1') === -1) {
127
+ setTimeout(function(){
128
+ window.location.href = window.location.origin + window.location.pathname + '?sfw=pass' + Math.round(ct_date.getTime()/1000);
129
+ }, reload_timeout);
130
+ }
131
+ </script>
132
+ </body>
133
  </html>
lib/Cleantalk/ApbctWP/Firewall/{die_page__SFW.html → die_page_sfw.html} RENAMED
@@ -1,140 +1,140 @@
1
- <!DOCTYPE html>
2
- <html lang='en'>
3
- <head>
4
- <meta charset='utf-8' />
5
- <meta name='viewport' content='width=device-width, initial-scale=1' />
6
- <meta http-equiv="cache-control" content="no-cache">
7
- <meta http-equiv="cache-control" content="private">
8
- <meta http-equiv="cache-control" content="max-age=0, must-revalidate">
9
- <meta http-equiv="cache-control" content="max-age=0, proxy-revalidate">
10
- <meta http-equiv="expires" content="0" />
11
- <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
12
- <meta http-equiv="pragma" content="no-cache" />
13
-
14
- <!--[if lt IE 9]>
15
- <script src='http://html5shiv.googlecode.com/svn/trunk/html5.js'></script>
16
- <![endif]-->
17
- <style>
18
- html{font-size: 14pt;}
19
- h1{text-align:center}
20
- h1.main{margin-top: 1em;margin-bottom: 3em;}
21
- div.container {text-align:center;}
22
- div.container p.js_notice{width: 60%; display: inline-block;}
23
- div.footer {color: #666; text-align: center;}
24
- div.footer a {color: #666; vertical-align:bottom; text-align: center;}
25
-
26
- @media (max-width: 600px) {
27
- }
28
-
29
- .spinner {
30
- margin-left: auto;
31
- margin-right: auto;
32
- width: 70px;
33
- text-align: center;
34
- }
35
-
36
- .spinner > div {
37
- width: 14px;
38
- height: 14px;
39
- background-color: #333;
40
-
41
- border-radius: 100%;
42
- display: inline-block;
43
- -webkit-animation: sk-bouncedelay 1.4s infinite ease-in-out both;
44
- animation: sk-bouncedelay 1.4s infinite ease-in-out both;
45
- }
46
-
47
- .spinner .bounce1 {
48
- -webkit-animation-delay: -0.32s;
49
- animation-delay: -0.32s;
50
- }
51
-
52
- .spinner .bounce2 {
53
- -webkit-animation-delay: -0.16s;
54
- animation-delay: -0.16s;
55
- }
56
-
57
- @-webkit-keyframes sk-bouncedelay {
58
- 0%, 80%, 100% { -webkit-transform: scale(0) }
59
- 40% { -webkit-transform: scale(1.0) }
60
- }
61
-
62
- @keyframes sk-bouncedelay {
63
- 0%, 80%, 100% {
64
- -webkit-transform: scale(0);
65
- transform: scale(0);
66
- } 40% {
67
- -webkit-transform: scale(1.0);
68
- transform: scale(1.0);
69
- }
70
- }
71
- </style>
72
- <script>
73
- var ct_date = new Date;
74
-
75
- function set_spamFireWallCookie(cookie_name, cookie_value) {
76
- var date = new Date;
77
- date.setDate(date.getDate() + 30);
78
- document.cookie = cookie_name + '=' + escape(cookie_value) + '; path=/; expires=' + date.toUTCString() + '; samesite=lax';
79
- return null;
80
- }
81
-
82
- function get_current_url() {
83
- document.write(window.location.href);
84
- return null;
85
- }
86
- </script>
87
- </head>
88
-
89
- <body>
90
- <div class='container'>
91
- <h1 class='main'>{SFW_DIE_NOTICE_IP}<a href='https://cleantalk.org/blacklists/{REMOTE_ADDRESS}' target='_blank'>{REMOTE_ADDRESS}</a></h1>
92
-
93
- <h3>{REAL_IP__HEADER} {REAL_IP}</h3>
94
- <h3>{TEST_IP__HEADER} {TEST_IP}</h3>
95
-
96
- <h2>{TEST_TITLE}</h2>
97
-
98
- <div id='js_info'><br />{SFW_DIE_MAKE_SURE_JS_ENABLED}</div>
99
-
100
- <div id='js_passed'>
101
- <h3>{SFW_DIE_CLICK_TO_PASS}</h3>
102
- <a href='{REQUEST_URI}'><script>get_current_url();</script></a>
103
- <br />
104
- <p class='js_notice'>{SFW_DIE_YOU_WILL_BE_REDIRECTED}</p>
105
- <br />
106
- <div class="spinner">
107
- <div class="bounce1"></div>
108
- <div class="bounce2"></div>
109
- <div class="bounce3"></div>
110
- </div>
111
- {GENERATED}
112
- <p>Browser time <span id='curr_date'></span></p>
113
- </div>
114
-
115
- </div>
116
- <div style='position: relative; line-height: 8px; text-align: center;'>
117
- <p style="margin: 0; display: inline-block; font-size: 10px; color: gray;">{SERVICE_ID}, </p>
118
- <p style="margin: 0; display: inline-block; font-size: 10px; color: gray;">{HOST}</p>
119
- </div>
120
- <div class='footer'>
121
- <a href='https://cleantalk.org' target='_blank'>{CLEANTALK_TITLE}</a>
122
- </div>
123
- <script type='text/javascript'>
124
- var reload_timeout = 3000;
125
- document.getElementById('js_info').style.display = 'none';
126
- document.getElementById('js_passed').style.display = 'block';
127
- document.getElementById('curr_date').innerHTML = ct_date.toGMTString();
128
- set_spamFireWallCookie('{COOKIE_PREFIX}ct_sfw_pass_key','{COOKIE_SFW}');
129
- set_spamFireWallCookie('{COOKIE_PREFIX}apbct_antibot','{COOKIE_ANTICRAWLER}');
130
- set_spamFireWallCookie('{COOKIE_PREFIX}ct_sfw_passed','1');
131
-
132
- if(location.search.search('debug=1') === -1) {
133
- setTimeout(function(){
134
- window.location.href = window.location.origin + window.location.pathname + '?sfw=pass' + Math.round(ct_date.getTime()/1000);
135
- }, reload_timeout);
136
- }
137
- </script>
138
- {DEBUG}
139
- </body>
140
  </html>
1
+ <!DOCTYPE html>
2
+ <html lang='en'>
3
+ <head>
4
+ <meta charset='utf-8' />
5
+ <meta name='viewport' content='width=device-width, initial-scale=1' />
6
+ <meta http-equiv="cache-control" content="no-cache">
7
+ <meta http-equiv="cache-control" content="private">
8
+ <meta http-equiv="cache-control" content="max-age=0, must-revalidate">
9
+ <meta http-equiv="cache-control" content="max-age=0, proxy-revalidate">
10
+ <meta http-equiv="expires" content="0" />
11
+ <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
12
+ <meta http-equiv="pragma" content="no-cache" />
13
+
14
+ <!--[if lt IE 9]>
15
+ <script src='http://html5shiv.googlecode.com/svn/trunk/html5.js'></script>
16
+ <![endif]-->
17
+ <style>
18
+ html{font-size: 14pt;}
19
+ h1{text-align:center}
20
+ h1.main{margin-top: 1em;margin-bottom: 3em;}
21
+ div.container {text-align:center;}
22
+ div.container p.js_notice{width: 60%; display: inline-block;}
23
+ div.footer {color: #666; text-align: center;}
24
+ div.footer a {color: #666; vertical-align:bottom; text-align: center;}
25
+
26
+ @media (max-width: 600px) {
27
+ }
28
+
29
+ .spinner {
30
+ margin-left: auto;
31
+ margin-right: auto;
32
+ width: 70px;
33
+ text-align: center;
34
+ }
35
+
36
+ .spinner > div {
37
+ width: 14px;
38
+ height: 14px;
39
+ background-color: #333;
40
+
41
+ border-radius: 100%;
42
+ display: inline-block;
43
+ -webkit-animation: sk-bouncedelay 1.4s infinite ease-in-out both;
44
+ animation: sk-bouncedelay 1.4s infinite ease-in-out both;
45
+ }
46
+
47
+ .spinner .bounce1 {
48
+ -webkit-animation-delay: -0.32s;
49
+ animation-delay: -0.32s;
50
+ }
51
+
52
+ .spinner .bounce2 {
53
+ -webkit-animation-delay: -0.16s;
54
+ animation-delay: -0.16s;
55
+ }
56
+
57
+ @-webkit-keyframes sk-bouncedelay {
58
+ 0%, 80%, 100% { -webkit-transform: scale(0) }
59
+ 40% { -webkit-transform: scale(1.0) }
60
+ }
61
+
62
+ @keyframes sk-bouncedelay {
63
+ 0%, 80%, 100% {
64
+ -webkit-transform: scale(0);
65
+ transform: scale(0);
66
+ } 40% {
67
+ -webkit-transform: scale(1.0);
68
+ transform: scale(1.0);
69
+ }
70
+ }
71
+ </style>
72
+ <script>
73
+ var ct_date = new Date;
74
+
75
+ function set_spamFireWallCookie(cookie_name, cookie_value) {
76
+ var date = new Date;
77
+ date.setDate(date.getDate() + 30);
78
+ document.cookie = cookie_name + '=' + escape(cookie_value) + '; path=/; expires=' + date.toUTCString() + '; samesite=lax';
79
+ return null;
80
+ }
81
+
82
+ function get_current_url() {
83
+ document.write(window.location.href);
84
+ return null;
85
+ }
86
+ </script>
87
+ </head>
88
+
89
+ <body>
90
+ <div class='container'>
91
+ <h1 class='main'>{SFW_DIE_NOTICE_IP}<a href='https://cleantalk.org/blacklists/{REMOTE_ADDRESS}' target='_blank'>{REMOTE_ADDRESS}</a></h1>
92
+
93
+ <h3>{REAL_IP__HEADER} {REAL_IP}</h3>
94
+ <h3>{TEST_IP__HEADER} {TEST_IP}</h3>
95
+
96
+ <h2>{TEST_TITLE}</h2>
97
+
98
+ <div id='js_info'><br />{SFW_DIE_MAKE_SURE_JS_ENABLED}</div>
99
+
100
+ <div id='js_passed'>
101
+ <h3>{SFW_DIE_CLICK_TO_PASS}</h3>
102
+ <a href='{REQUEST_URI}'><script>get_current_url();</script></a>
103
+ <br />
104
+ <p class='js_notice'>{SFW_DIE_YOU_WILL_BE_REDIRECTED}</p>
105
+ <br />
106
+ <div class="spinner">
107
+ <div class="bounce1"></div>
108
+ <div class="bounce2"></div>
109
+ <div class="bounce3"></div>
110
+ </div>
111
+ {GENERATED}
112
+ <p>Browser time <span id='curr_date'></span></p>
113
+ </div>
114
+
115
+ </div>
116
+ <div style='position: relative; line-height: 8px; text-align: center;'>
117
+ <p style="margin: 0; display: inline-block; font-size: 10px; color: gray;">{SERVICE_ID}, </p>
118
+ <p style="margin: 0; display: inline-block; font-size: 10px; color: gray;">{HOST}</p>
119
+ </div>
120
+ <div class='footer'>
121
+ <a href='https://cleantalk.org' target='_blank'>{CLEANTALK_TITLE}</a>
122
+ </div>
123
+ <script type='text/javascript'>
124
+ var reload_timeout = 3000;
125
+ document.getElementById('js_info').style.display = 'none';
126
+ document.getElementById('js_passed').style.display = 'block';
127
+ document.getElementById('curr_date').innerHTML = ct_date.toGMTString();
128
+ set_spamFireWallCookie('{COOKIE_PREFIX}ct_sfw_pass_key','{COOKIE_SFW}');
129
+ set_spamFireWallCookie('{COOKIE_PREFIX}apbct_antibot','{COOKIE_ANTICRAWLER}');
130
+ set_spamFireWallCookie('{COOKIE_PREFIX}ct_sfw_passed','1');
131
+
132
+ if(location.search.search('debug=1') === -1) {
133
+ setTimeout(function(){
134
+ window.location.href = window.location.origin + window.location.pathname + '?sfw=pass' + Math.round(ct_date.getTime()/1000);
135
+ }, reload_timeout);
136
+ }
137
+ </script>
138
+ {DEBUG}
139
+ </body>
140
  </html>
lib/Cleantalk/Common/Firewall.php CHANGED
@@ -34,12 +34,12 @@ class Firewall
34
  private $statuses_priority = array(
35
  // Lowest
36
  'PASS_SFW',
37
- 'DENY_SFW',
38
  'PASS_SFW__BY_COOKIE',
39
- 'DENY_ANTIFLOOD',
40
  'PASS_ANTIFLOOD',
41
- 'DENY_ANTICRAWLER',
42
  'PASS_ANTICRAWLER',
 
 
 
43
  'PASS_SFW__BY_WHITELIST',
44
  // Highest
45
  );
@@ -102,31 +102,40 @@ class Firewall
102
  $this->module_names = array_keys( $this->fw_modules );
103
 
104
  $results = array();
105
-
 
106
  foreach ( $this->fw_modules as $module ) {
107
-
 
 
 
 
108
  $module_results = $module->check();
109
  if( ! empty( $module_results ) ) {
110
- $results[] = $this->prioritize( $module_results );
111
  }
112
-
113
  if( $this->is_whitelisted( $results ) ) {
114
  // Break protection logic if it whitelisted or trusted network.
115
  break;
116
  }
117
 
118
  }
119
-
 
 
 
 
 
 
 
 
120
  $result = $this->prioritize( $results );
121
-
122
- // Blacklisted in DB
123
 
 
124
  foreach( $this->module_names as $module_name ){
125
 
126
  if( strpos( $result['status'], $module_name ) ){
127
-
128
- $this->fw_modules[ $module_name ]->update_log( $result['ip'], $result['status'] );
129
-
130
  // Blocked
131
  if( strpos( $result['status'], 'DENY' ) !== false ){
132
  $this->fw_modules[ $module_name ]->actions_for_denied( $result );
34
  private $statuses_priority = array(
35
  // Lowest
36
  'PASS_SFW',
 
37
  'PASS_SFW__BY_COOKIE',
 
38
  'PASS_ANTIFLOOD',
 
39
  'PASS_ANTICRAWLER',
40
+ 'DENY_ANTIFLOOD',
41
+ 'DENY_ANTICRAWLER',
42
+ 'DENY_SFW',
43
  'PASS_SFW__BY_WHITELIST',
44
  // Highest
45
  );
102
  $this->module_names = array_keys( $this->fw_modules );
103
 
104
  $results = array();
105
+
106
+ // Checking
107
  foreach ( $this->fw_modules as $module ) {
108
+
109
+ if( isset( $module->isExcluded ) && $module->isExcluded ) {
110
+ continue;
111
+ }
112
+
113
  $module_results = $module->check();
114
  if( ! empty( $module_results ) ) {
115
+ $results[$module->module_name] = $this->prioritize( $module_results );
116
  }
117
+
118
  if( $this->is_whitelisted( $results ) ) {
119
  // Break protection logic if it whitelisted or trusted network.
120
  break;
121
  }
122
 
123
  }
124
+
125
+ // Write Logs
126
+ foreach ( $this->fw_modules as $module ) {
127
+ if( array_key_exists( $module->module_name, $results ) ){
128
+ $module->update_log( $results[$module->module_name]['ip'], $results[$module->module_name]['status'] );
129
+ }
130
+ }
131
+
132
+ // Get the primary result
133
  $result = $this->prioritize( $results );
 
 
134
 
135
+ // Do finish action - die or set cookies
136
  foreach( $this->module_names as $module_name ){
137
 
138
  if( strpos( $result['status'], $module_name ) ){
 
 
 
139
  // Blocked
140
  if( strpos( $result['status'], 'DENY' ) !== false ){
141
  $this->fw_modules[ $module_name ]->actions_for_denied( $result );
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: spam, antispam, woocommerce, comments, firewall
4
  Requires at least: 3.0
5
  Tested up to: 5.5
6
  Requires PHP: 5.4
7
- Stable tag: 5.144
8
  License: GPLv2
9
 
10
  Spam protection, anti-spam, firewall, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
@@ -109,12 +109,13 @@ This plugin uses multiple anti-spam tests to filter spam bots having as low fals
109
  = How effective is CleanTalk? =
110
  Accurately blocking spam is not an easy thing to do, but CleanTalk has a very low proven False/Positive rate. Here is actual statistics on false positives for all customers.
111
 
112
- * Registrations - 0.007%
113
- * Comments - 0.001%
114
- * Contact forms - 0.001%
115
- * Orders (WooCommerce) - 0.008%
 
116
 
117
- The statistic was calculated on November 10 2017 for 1 million requests.
118
 
119
  = How CleanTalk improves SEO for your website? =
120
  So, you already know that the speed of the site has a direct impact on SEO.
@@ -579,6 +580,23 @@ If your website has forms that send data to external sources, you can enable opt
579
 
580
  == Changelog ==
581
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
582
  = 5.144 Aug 13 2020 =
583
  * Fix: WPMS setting updating fixed.
584
  * Fix: Text domain added for some options name.
4
  Requires at least: 3.0
5
  Tested up to: 5.5
6
  Requires PHP: 5.4
7
+ Stable tag: 5.145
8
  License: GPLv2
9
 
10
  Spam protection, anti-spam, firewall, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
109
  = How effective is CleanTalk? =
110
  Accurately blocking spam is not an easy thing to do, but CleanTalk has a very low proven False/Positive rate. Here is actual statistics on false positives for all customers.
111
 
112
+ * Registrations - 0.004%
113
+ * Comments - 0.004%
114
+ * Contact forms - 0.006%
115
+ * Orders (WooCommerce) - 0.016%
116
+ * Site search - 0.001%
117
 
118
+ The statistic was calculated on August 28 2020 for 2.5 million requests.
119
 
120
  = How CleanTalk improves SEO for your website? =
121
  So, you already know that the speed of the site has a direct impact on SEO.
580
 
581
  == Changelog ==
582
 
583
+ = 5.145 Aug 27 2020 =
584
+ * Fix: Blocking pages names fixed.
585
+ * Fix: Logs id modified to prevent the overwriting.
586
+ * Fix: FireWall checking flow fixed.
587
+ * Mod: New SpamFirewall, Anti-Crawler, Anti-Flood modules priority.
588
+ * Upd: Block message updated.
589
+ * Fix: "The sender has been blacklisted" message removed.
590
+ * Fix: "The sender has been whitelisted" message removed.
591
+ * Fix: Integration DW Question & Answer plugin.
592
+ * Fix: Dashboard widget layout fixed.
593
+ * Fix: AC & AD skipping checking by roles.
594
+ * Integration: Estimation Form integration implemented.
595
+ * Fix: External contact forms check.
596
+ * Fix: URL, IP and Role exclusions for all requests.
597
+ * Fix: Exception for WooCommerce adding to cart.
598
+ * Fix: Exception for PPOM for WooCommerce plugin.
599
+
600
  = 5.144 Aug 13 2020 =
601
  * Fix: WPMS setting updating fixed.
602
  * Fix: Text domain added for some options name.