iThemes Security (formerly Better WP Security) - Version 7.2.0

Version Description

  • Enhancement: Allow for selecting the particular Proxy header a server is configured to use. Improve the language to indicate the importance of configuring this setting. H/t Filippo Cavallarin CEO at wearesegment.com
  • Enhancement: Block access to git and svn repositories when System Tweaks -> Protect System Files is enabled.
  • Tweak: Update jQuery Validation library to 1.17.0
  • Bug Fix: Improve detection of blocking the File Change Scan from being scheduled if one is already being run.
  • Bug Fix: Prevent infinite recursion error when trying to access directories outside of the allowed file tree.
Download this release

Release Info

Developer TimothyBlynJacobs
Plugin Icon 128x128 iThemes Security (formerly Better WP Security)
Version 7.2.0
Comparing to
See all releases

Code changes from version 7.1.0 to 7.2.0

Files changed (56) hide show
  1. better-wp-security.php +1 -1
  2. core/admin-pages/css/style.css +212 -1
  3. core/core.php +38 -9
  4. core/history.txt +8 -1
  5. core/lib.php +322 -11
  6. core/lib/class-itsec-lib-browser.php +1757 -0
  7. core/lib/class-itsec-lib-directory.php +1 -1
  8. core/lib/class-itsec-lib-fingerprinting.php +193 -0
  9. core/lib/class-itsec-lib-geolocation.php +69 -0
  10. core/lib/class-itsec-lib-login-interstitial.php +4 -1
  11. core/lib/class-itsec-lib-static-map-api.php +171 -0
  12. core/lib/class-itsec-mail.php +55 -14
  13. core/lib/fingerprinting/class-itsec-fingerprint-comparison.php +64 -0
  14. core/lib/fingerprinting/class-itsec-fingerprint-value.php +42 -0
  15. core/lib/fingerprinting/class-itsec-fingerprint.php +699 -0
  16. core/lib/fingerprinting/index.php +1 -0
  17. core/lib/fingerprinting/interface-itsec-fingerprint-source.php +40 -0
  18. core/lib/geolocation/class-itsec-geolocator-chain.php +37 -0
  19. core/lib/geolocation/class-itsec-geolocator-page-cache.php +38 -0
  20. core/lib/geolocation/index.php +1 -0
  21. core/lib/geolocation/interface-itsec-geolocator.php +23 -0
  22. core/lib/log.php +23 -23
  23. core/lib/mail-templates/divider.html +1 -1
  24. core/lib/mail-templates/file-change-summary.html +3 -3
  25. core/lib/mail-templates/footer-user.html +1 -1
  26. core/lib/mail-templates/footer.html +8 -8
  27. core/lib/mail-templates/header.html +4 -4
  28. core/lib/mail-templates/image.html +23 -0
  29. core/lib/mail-templates/info-box.html +1 -1
  30. core/lib/mail-templates/large-text.html +1 -1
  31. core/lib/mail-templates/list.html +1 -1
  32. core/lib/mail-templates/lockouts-summary.html +2 -2
  33. core/lib/mail-templates/module-button.html +18 -18
  34. core/lib/mail-templates/pro-callout.html +1 -1
  35. core/lib/mail-templates/section-heading-with-icon.html +1 -1
  36. core/lib/mail-templates/section-heading.html +1 -1
  37. core/lib/mail-templates/table.html +2 -2
  38. core/lib/mail-templates/text.html +1 -1
  39. core/lib/schema.php +32 -0
  40. core/lib/static-map-api/index.php +1 -0
  41. core/lib/static-map-api/interface-itsec-static-map-api.php +23 -0
  42. core/modules/core/js/mc-validate.js +4 -4
  43. core/modules/core/sidebar-widget-mail-list-signup.php +4 -1
  44. core/modules/file-change/scanner.php +13 -4
  45. core/modules/file-change/setup.php +27 -1
  46. core/modules/global/js/settings-page.js +13 -1
  47. core/modules/global/settings-page.php +68 -6
  48. core/modules/global/settings.php +2 -1
  49. core/modules/global/setup.php +6 -0
  50. core/modules/global/validator.php +12 -3
  51. core/modules/ipcheck/class-itsec-ipcheck.php +1 -0
  52. core/modules/notification-center/class-notification-center.php +10 -0
  53. core/modules/notification-center/settings.php +26 -1
  54. core/modules/system-tweaks/config-generators.php +6 -0
  55. history.txt +6 -0
  56. readme.txt +10 -3
better-wp-security.php CHANGED
@@ -6,7 +6,7 @@
6
  * Description: Take the guesswork out of WordPress security. iThemes Security offers 30+ ways to lock down WordPress in an easy-to-use WordPress security plugin.
7
  * Author: iThemes
8
  * Author URI: https://ithemes.com
9
- * Version: 7.1.0
10
  * Text Domain: better-wp-security
11
  * Network: True
12
  * License: GPLv2
6
  * Description: Take the guesswork out of WordPress security. iThemes Security offers 30+ ways to lock down WordPress in an easy-to-use WordPress security plugin.
7
  * Author: iThemes
8
  * Author URI: https://ithemes.com
9
+ * Version: 7.2.0
10
  * Text Domain: better-wp-security
11
  * Network: True
12
  * License: GPLv2
core/admin-pages/css/style.css CHANGED
@@ -869,4 +869,215 @@ body.security_page_itsec-logs #old-logs-migration-status p {
869
  }
870
  .itsec-module-cards-container .bulkactions:empty {
871
  display: none;
872
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
869
  }
870
  .itsec-module-cards-container .bulkactions:empty {
871
  display: none;
872
+ }
873
+
874
+ body.security_page_itsec-logs .itsec-module-settings-content-main .form-table .widefat th {
875
+ padding: 8px 10px;
876
+ }
877
+
878
+ body.security_page_itsec-logs .itsec-module-settings-content-main .form-table .widefat td {
879
+ padding: 15px 10px;
880
+ }
881
+
882
+
883
+ /***************************************
884
+ Tooltip
885
+ ****************************************/
886
+ .tooltip {
887
+ position: relative;
888
+ top: -6px;
889
+ display: inline-block;
890
+ background: #0080C9;
891
+ padding: 0px 4px;
892
+ border-radius: 50px;
893
+ font-size: 0.7em;
894
+ margin: -10px 0;
895
+ cursor: pointer;
896
+ color: #FFFFFF;
897
+ text-align: left;
898
+ }
899
+
900
+ .tooltip-trigger-only {
901
+ position: relative;
902
+ font-size: 0.7em;
903
+ cursor: pointer;
904
+ color: #FFFFFF;
905
+ text-align: left;
906
+ }
907
+
908
+ .tooltip:hover .info,
909
+ .tooltip-trigger-only:hover .info,
910
+ .tooltip:focus .info,
911
+ .tooltip-trigger-only:focus .info {
912
+ visibility: visible;
913
+ opacity: 1;
914
+ transform: translate3d(0, 0, 0);
915
+ }
916
+
917
+ .tooltip .info,
918
+ .tooltip-trigger-only .info {
919
+ box-sizing: border-box;
920
+ position: absolute;
921
+ top: 18px;
922
+ left: -8px;
923
+ display: block;
924
+ background: #0080C9;
925
+ border: 1px solid #D6D6D6;
926
+ width: 350px;
927
+ font-size: 1.45em;
928
+ font-weight: 300;
929
+ line-height: 1.5;
930
+ cursor: text;
931
+ visibility: hidden;
932
+ opacity: 0;
933
+ transform: translate3d(0, -20px, 0);
934
+ transition: all .5s ease-out;
935
+ z-index: 2;
936
+ }
937
+
938
+ .tooltip .info:before,
939
+ .tooltip-trigger-only .info:before {
940
+ position: absolute;
941
+ content: '';
942
+ width: 100%;
943
+ height: 14px;
944
+ bottom: -14px;
945
+ left: 0;
946
+ }
947
+
948
+ .tooltip .info:after,
949
+ .tooltip-trigger-only .info:after {
950
+ position: absolute;
951
+ content: '';
952
+ width: 10px;
953
+ height: 10px;
954
+ transform: rotate(45deg);
955
+ top: -5px;
956
+ left: 13px;
957
+ margin-left: -5px;
958
+ background: #0080C9;
959
+ }
960
+
961
+ .tooltip .text,
962
+ .tooltip-trigger-only .text {
963
+ display: block;
964
+ padding: 2em;
965
+ color: #FFFFFF;
966
+ }
967
+
968
+ .tooltip .info .text a,
969
+ .tooltip-trigger-only .info .text a {
970
+ color: white;
971
+ }
972
+
973
+ .tooltip .info .text a:hover,
974
+ .tooltip-trigger-only .info .text a:hover {
975
+ color: #000000;
976
+ }
977
+
978
+ .included-with-bb .tooltip span {
979
+ border-bottom: none;
980
+ }
981
+
982
+ .tooltip .tooltip-container .info,
983
+ .tooltip-trigger-only .tooltip-container .info {
984
+ border-bottom: 1px solid #D6D6D6;
985
+ }
986
+
987
+ /***************************************
988
+ Tooltip Responsive Styles
989
+ ****************************************/
990
+ @media ( min-width: 1042px ) and ( max-width: 1342px ) {
991
+ .tooltip .info,
992
+ .tooltip-trigger-only .info {
993
+ width: 250px;
994
+ left: -58px;
995
+ }
996
+
997
+ .tooltip .info:after,
998
+ .tooltip-trigger-only .info:after {
999
+ left: 63px;
1000
+ }
1001
+ }
1002
+
1003
+ @media ( min-width: 783px ) and ( max-width: 1041px ) {
1004
+ .tooltip .info,
1005
+ .tooltip-trigger-only .info {
1006
+ width: 200px;
1007
+ left: -130px;
1008
+ }
1009
+
1010
+ .tooltip .info:after,
1011
+ .tooltip-trigger-only .info:after {
1012
+ left: 136px;
1013
+ }
1014
+ }
1015
+
1016
+ @media ( max-width: 740px ) {
1017
+ .tooltip .info,
1018
+ .tooltip-trigger-only .info {
1019
+ width: 250px;
1020
+ }
1021
+ }
1022
+
1023
+ @media ( max-width: 646px ) {
1024
+ .tooltip .info,
1025
+ .tooltip-trigger-only .info {
1026
+ left: -130px;
1027
+ }
1028
+
1029
+ .tooltip .info:after,
1030
+ .tooltip-trigger-only .info:after {
1031
+ left: 136px;
1032
+ }
1033
+ }
1034
+
1035
+ @media ( min-width: 450px ) and ( max-width: 520px ) {
1036
+ .tooltip .info,
1037
+ .tooltip-trigger-only .info {
1038
+ left: -230px;
1039
+ }
1040
+
1041
+ .tooltip .info:after,
1042
+ .tooltip-trigger-only .info:after {
1043
+ left: 236px;
1044
+ }
1045
+ }
1046
+
1047
+ @media ( max-width: 483px ) {
1048
+ #itsec-version-management-scan_for_old_wordpress_sites ~ .tooltip .info {
1049
+ left: -8px;
1050
+ }
1051
+
1052
+ #itsec-version-management-scan_for_old_wordpress_sites ~ .tooltip .info:after {
1053
+ left: 14px;
1054
+ }
1055
+ }
1056
+
1057
+ @media ( max-width: 449px ) {
1058
+ .tooltip .info,
1059
+ .tooltip-trigger-only .info {
1060
+ left: -58px;
1061
+ }
1062
+
1063
+ .tooltip .info:after,
1064
+ .tooltip-trigger-only .info:after {
1065
+ left: 63px;
1066
+ }
1067
+
1068
+ .itsec-settings-module-settings .form-table td p {
1069
+ max-width: 275px;
1070
+ }
1071
+ }
1072
+
1073
+ @media ( max-width: 336px ) {
1074
+ .tooltip .info,
1075
+ .tooltip-trigger-only .info {
1076
+ left: -100px;
1077
+ }
1078
+
1079
+ .tooltip .info:after,
1080
+ .tooltip-trigger-only .info:after {
1081
+ left: 106px;
1082
+ }
1083
+ }
core/core.php CHANGED
@@ -24,7 +24,7 @@ if ( ! class_exists( 'ITSEC_Core' ) ) {
24
  *
25
  * @access private
26
  */
27
- private $plugin_build = 4106;
28
 
29
  /**
30
  * Used to distinguish between a user modifying settings and the API modifying settings (such as from Sync
@@ -50,8 +50,7 @@ if ( ! class_exists( 'ITSEC_Core' ) ) {
50
  $current_time_gmt,
51
  $is_iwp_call,
52
  $request_type,
53
- $wp_upload_dir,
54
- $storage_dir;
55
 
56
 
57
  /**
@@ -751,21 +750,25 @@ if ( ! class_exists( 'ITSEC_Core' ) ) {
751
  * Retrieve and/or create a directory for ITSEC to store data.
752
  *
753
  * @param string $dir Optionally specify an additional sub-directory.
 
754
  *
755
  * @return string
756
  */
757
- public static function get_storage_dir( $dir = '' ) {
758
- $self = self::get_instance();
759
 
760
  require_once( self::get_core_dir() . '/lib/class-itsec-lib-directory.php' );
761
 
762
- if ( ! isset( $self->storage_dir ) ) {
763
- $wp_upload_dir = self::get_wp_upload_dir();
 
764
 
765
- $self->storage_dir = $wp_upload_dir['basedir'] . '/ithemes-security/';
 
 
 
766
  }
767
 
768
- $dir = $self->storage_dir . $dir;
769
  $dir = rtrim( $dir, '/' );
770
 
771
  ITSEC_Lib_Directory::create( $dir );
@@ -773,6 +776,32 @@ if ( ! class_exists( 'ITSEC_Core' ) ) {
773
  return $dir;
774
  }
775
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
776
  public static function doing_data_upgrade() {
777
  $self = self::get_instance();
778
 
24
  *
25
  * @access private
26
  */
27
+ private $plugin_build = 4108;
28
 
29
  /**
30
  * Used to distinguish between a user modifying settings and the API modifying settings (such as from Sync
50
  $current_time_gmt,
51
  $is_iwp_call,
52
  $request_type,
53
+ $wp_upload_dir;
 
54
 
55
 
56
  /**
750
  * Retrieve and/or create a directory for ITSEC to store data.
751
  *
752
  * @param string $dir Optionally specify an additional sub-directory.
753
+ * @param bool $public Whether to get the public version of the directory.
754
  *
755
  * @return string
756
  */
757
+ public static function get_storage_dir( $dir = '', $public = false ) {
 
758
 
759
  require_once( self::get_core_dir() . '/lib/class-itsec-lib-directory.php' );
760
 
761
+ $wp_upload_dir = self::get_wp_upload_dir();
762
+
763
+ $storage_dir = $wp_upload_dir['basedir'];
764
 
765
+ if ( $public ) {
766
+ $storage_dir .= '/ithemes-security-public/';
767
+ } else {
768
+ $storage_dir .= '/ithemes-security/';
769
  }
770
 
771
+ $dir = $storage_dir . $dir;
772
  $dir = rtrim( $dir, '/' );
773
 
774
  ITSEC_Lib_Directory::create( $dir );
776
  return $dir;
777
  }
778
 
779
+ /**
780
+ * Get the URL to the directory that ITSEC stores data in.
781
+ *
782
+ * @param string $dir
783
+ * @param bool $public Whether to get the public version of the directory.
784
+ *
785
+ * @return string
786
+ */
787
+ public static function get_storage_url( $dir = '', $public = false ) {
788
+
789
+ self::get_storage_dir( $dir );
790
+
791
+ $upload_dir = self::get_wp_upload_dir();
792
+ $base = untrailingslashit( $upload_dir['baseurl'] );
793
+
794
+ $url = $base;
795
+
796
+ if ( $public ) {
797
+ $url .= '/ithemes-security-public/';
798
+ } else {
799
+ $url .= '/ithemes-security/';
800
+ }
801
+
802
+ return $url . $dir;
803
+ }
804
+
805
  public static function doing_data_upgrade() {
806
  $self = self::get_instance();
807
 
core/history.txt CHANGED
@@ -746,4 +746,11 @@
746
  4.7.5 - 2018-08-07 - Chris Jean & Timothy Jacobs
747
  Bug Fix: Fixed how the Grade Report enable/disable status is stored to fix admin page loading issues on some sites.
748
  4.7.6 - 2018-08-14 - Chris Jean & Timothy Jacobs
749
- Bug Fix: REST API Protection blocked the Taxonomies route for all users.
 
 
 
 
 
 
 
746
  4.7.5 - 2018-08-07 - Chris Jean & Timothy Jacobs
747
  Bug Fix: Fixed how the Grade Report enable/disable status is stored to fix admin page loading issues on some sites.
748
  4.7.6 - 2018-08-14 - Chris Jean & Timothy Jacobs
749
+ Bug Fix: REST API Protection blocked the Taxonomies route for all users.
750
+ 4.8.0 - 2018-10-02 - Chris Jean & Timothy Jacobs
751
+ Enhancement: Block access to git and svn repositories when System Tweaks -> Protect System Files is enabled.
752
+ Tweak: Update jQuery Validation library to 1.17.0
753
+ Bug Fix: Improve detection of blocking the File Change Scan from being scheduled if one is already being run.
754
+ Bug Fix: Prevent infinite recursion error when trying to access directories outside of the allowed file tree.
755
+ 4.8.1 - 2018-10-10 - Chris Jean & Timothy Jacobs
756
+ Enhancement: Allow for selecting the particular Proxy header a server is configured to use. Improve the language to indicate the importance of configuring this setting. H/t Filippo Cavallarin CEO at wearesegment.com
core/lib.php CHANGED
@@ -167,7 +167,6 @@ final class ITSEC_Lib {
167
  return $GLOBALS['__itsec_remote_ip'];
168
  }
169
 
170
-
171
  $ip = apply_filters( 'itsec-get-ip', false );
172
 
173
  if ( false !== $ip ) {
@@ -182,24 +181,28 @@ final class ITSEC_Lib {
182
 
183
  unset( $ip );
184
 
185
-
186
- if ( ITSEC_Modules::get_setting( 'global', 'proxy_override' ) ) {
187
- $GLOBALS['__itsec_remote_ip'] = $_SERVER['REMOTE_ADDR'];
188
-
189
- return $GLOBALS['__itsec_remote_ip'];
190
- }
191
-
192
  $headers = array(
193
  'HTTP_CF_CONNECTING_IP', // CloudFlare
194
  'HTTP_X_FORWARDED_FOR', // Squid and most other forward and reverse proxies
195
  'REMOTE_ADDR', // Default source of remote IP
196
  );
197
 
198
- $headers = apply_filters( 'itsec_filter_remote_addr_headers', $headers );
 
 
 
 
 
 
 
199
 
200
- $headers = (array) $headers;
 
 
 
 
201
 
202
- if ( ! in_array( 'REMOTE_ADDR', $headers ) ) {
203
  $headers[] = 'REMOTE_ADDR';
204
  }
205
 
@@ -1220,6 +1223,92 @@ final class ITSEC_Lib {
1220
  return $array;
1221
  }
1222
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1223
  /**
1224
  * Get whatever backup plugin is being used on this site.
1225
  *
@@ -1264,4 +1353,226 @@ final class ITSEC_Lib {
1264
 
1265
  return '';
1266
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1267
  }
167
  return $GLOBALS['__itsec_remote_ip'];
168
  }
169
 
 
170
  $ip = apply_filters( 'itsec-get-ip', false );
171
 
172
  if ( false !== $ip ) {
181
 
182
  unset( $ip );
183
 
 
 
 
 
 
 
 
184
  $headers = array(
185
  'HTTP_CF_CONNECTING_IP', // CloudFlare
186
  'HTTP_X_FORWARDED_FOR', // Squid and most other forward and reverse proxies
187
  'REMOTE_ADDR', // Default source of remote IP
188
  );
189
 
190
+ $headers = (array) apply_filters( 'itsec_filter_remote_addr_headers', $headers );
191
+ $proxy = ITSEC_Modules::get_setting( 'global', 'proxy' );
192
+
193
+ switch ( $proxy ) {
194
+ case 'disabled':
195
+ return $GLOBALS['__itsec_remote_ip'] = $_SERVER['REMOTE_ADDR'];
196
+ case 'manual':
197
+ $header = ITSEC_Modules::get_setting( 'global', 'proxy_header' );
198
 
199
+ if ( in_array( $header, $headers, true ) ) {
200
+ $headers = array( $header );
201
+ }
202
+ break;
203
+ }
204
 
205
+ if ( ! in_array( 'REMOTE_ADDR', $headers, true ) ) {
206
  $headers[] = 'REMOTE_ADDR';
207
  }
208
 
1223
  return $array;
1224
  }
1225
 
1226
+ /**
1227
+ * Parse a complex header that has attributes like quality values.
1228
+ *
1229
+ * @example Parsing the Accept-Language header.
1230
+ *
1231
+ * "en-US,en;q=0.9,de;q=0.8" transforms to:
1232
+ *
1233
+ * [
1234
+ * 'en-US' => [],
1235
+ * 'en' => [ 'q' => 0.9 ],
1236
+ * 'de' => [ 'q' => 0.8' ],
1237
+ * ]
1238
+ *
1239
+ * @param string $header
1240
+ *
1241
+ * @return string[]
1242
+ */
1243
+ public static function parse_header_with_attributes( $header ) {
1244
+
1245
+ $parsed = array();
1246
+ $list = explode( ',', $header );
1247
+
1248
+ foreach ( $list as $value ) {
1249
+
1250
+ $attrs = array();
1251
+ $parts = explode( ';', trim( $value ) );
1252
+ $main = $parts[0];
1253
+
1254
+ foreach ( $parts as $part ) {
1255
+ if ( false === strpos( $part, '=' ) ) {
1256
+ continue;
1257
+ }
1258
+
1259
+ list( $key, $value ) = array_map( 'trim', explode( '=', $part, 2 ) );
1260
+
1261
+ $attrs[ $key ] = $value;
1262
+ }
1263
+
1264
+ $parsed[ $main ] = $attrs;
1265
+ }
1266
+
1267
+ return $parsed;
1268
+ }
1269
+
1270
+ /**
1271
+ * Is a particular function allowed to be called.
1272
+ *
1273
+ * Checks disabled functions and the function blacklist.
1274
+ *
1275
+ * @param string $func
1276
+ *
1277
+ * @return bool
1278
+ */
1279
+ public static function is_func_allowed( $func ) {
1280
+
1281
+ static $cache = array();
1282
+ static $disabled;
1283
+ static $suhosin;
1284
+
1285
+ if ( isset( $cache[ $func ] ) ) {
1286
+ return $cache[ $func ];
1287
+ }
1288
+
1289
+ if ( $disabled === null ) {
1290
+ $disabled = preg_split( '/\s*,\s*/', (string) ini_get( 'disable_functions' ) );
1291
+ }
1292
+
1293
+ if ( $suhosin === null ) {
1294
+ $suhosin = preg_split( '/\s*,\s*/', (string) ini_get( 'suhosin.executor.func.blacklist' ) );
1295
+ }
1296
+
1297
+ if ( ! \is_callable( $func ) ) {
1298
+ return $cache[ $func ] = false;
1299
+ }
1300
+
1301
+ if ( \in_array( $func, $disabled, true ) ) {
1302
+ return $cache[ $func ] = false;
1303
+ }
1304
+
1305
+ if ( \in_array( $func, $suhosin, true ) ) {
1306
+ return $cache[ $func ] = false;
1307
+ }
1308
+
1309
+ return $cache[ $func ] = true;
1310
+ }
1311
+
1312
  /**
1313
  * Get whatever backup plugin is being used on this site.
1314
  *
1353
 
1354
  return '';
1355
  }
1356
+
1357
+ /**
1358
+ * Generate a random token.
1359
+ *
1360
+ * @return string Hex token.
1361
+ */
1362
+ public static function generate_token() {
1363
+
1364
+ $length = 64;
1365
+
1366
+ try {
1367
+ $random = bin2hex( random_bytes( $length / 2 ) );
1368
+ } catch ( Exception $e ) {
1369
+ $unpacked = unpack( 'H*', wp_generate_password( $length / 2, true, true ) );
1370
+ $random = reset( $unpacked );
1371
+ }
1372
+
1373
+ return $random;
1374
+ }
1375
+
1376
+ /**
1377
+ * Generate a hash of the token for storage.
1378
+ *
1379
+ * @param string $token
1380
+ *
1381
+ * @return false|string
1382
+ */
1383
+ public static function hash_token( $token ) {
1384
+ return hash_hmac( self::get_hash_algo(), $token, wp_salt() );
1385
+ }
1386
+
1387
+ /**
1388
+ * Check if the provided token matches the stored hashed token.
1389
+ *
1390
+ * @param string $provided_token
1391
+ * @param string $hashed_token
1392
+ *
1393
+ * @return bool
1394
+ */
1395
+ public static function verify_token( $provided_token, $hashed_token ) {
1396
+
1397
+ if ( ! $hashed_token || ! $provided_token ) {
1398
+ return false;
1399
+ }
1400
+
1401
+ return hash_equals( self::hash_token( $provided_token ), $hashed_token );
1402
+ }
1403
+
1404
+ /**
1405
+ * Get the hash algorithm to use.
1406
+ *
1407
+ * PHP can be compiled without the hash extension and the supported hash algos can be variable. WordPress shims
1408
+ * support for md5 and sha1 hashes with hash_hmac.
1409
+ *
1410
+ * @return string
1411
+ */
1412
+ public static function get_hash_algo() {
1413
+
1414
+ if ( ! function_exists( 'hash_algos' ) ) {
1415
+ return 'sha1';
1416
+ }
1417
+
1418
+ $algos = hash_algos();
1419
+
1420
+ if ( in_array( 'sha256', $algos, true ) ) {
1421
+ return 'sha256';
1422
+ }
1423
+
1424
+ return 'sha1';
1425
+ }
1426
+
1427
+ public static function get_url_from_file( $file, $auto_ssl = true, $prevent_recursion = false ) {
1428
+ $file = str_replace( '\\', '/', $file );
1429
+
1430
+ $url = '';
1431
+
1432
+ $upload_dir = ITSEC_Core::get_wp_upload_dir();
1433
+ $upload_dir['basedir'] = str_replace( '\\', '/', $upload_dir['basedir'] );
1434
+
1435
+ if ( is_array( $upload_dir ) && ( false === $upload_dir['error'] ) ) {
1436
+ if ( 0 === strpos( $file, $upload_dir['basedir'] ) ) {
1437
+ $url = str_replace( $upload_dir['basedir'], $upload_dir['baseurl'], $file );
1438
+ } elseif ( false !== strpos( $file, 'wp-content/uploads' ) ) {
1439
+ $path_pattern = 'wp-content/uploads';
1440
+ $url_base = $upload_dir['baseurl'];
1441
+
1442
+ if ( is_multisite() && ! ( is_main_network() && is_main_site() && defined( 'MULTISITE' ) ) ) {
1443
+ if ( defined( 'MULTISITE' ) ) {
1444
+ $mu_path = '/sites/' . get_current_blog_id();
1445
+ } else {
1446
+ $mu_path = '/' . get_current_blog_id();
1447
+ }
1448
+
1449
+ if ( false === strpos( $file, "$path_pattern$mu_path" ) ) {
1450
+ $url_base = substr( $url_base, 0, - strlen( $mu_path ) );
1451
+ } else {
1452
+ $path_pattern .= $mu_path;
1453
+ }
1454
+ }
1455
+
1456
+ $url = $url_base . substr( $file, strpos( $file, $path_pattern ) + strlen( $path_pattern ) );
1457
+ }
1458
+ }
1459
+
1460
+ if ( empty( $url ) ) {
1461
+ if ( ! isset( $GLOBALS['__itsec_cache_wp_content_dir'] ) ) {
1462
+ $GLOBALS['__itsec_cache_wp_content_dir'] = rtrim( str_replace( '\\', '/', WP_CONTENT_DIR ), '/' );
1463
+ }
1464
+ if ( ! isset( $GLOBALS['__itsec_cache_abspath'] ) ) {
1465
+ $GLOBALS['__itsec_cache_abspath'] = rtrim( str_replace( '\\', '/', ABSPATH ), '/' );
1466
+ }
1467
+
1468
+ if ( 0 === strpos( $file, $GLOBALS['__itsec_cache_wp_content_dir'] ) ) {
1469
+ $url = WP_CONTENT_URL . str_replace( '\\', '/', preg_replace( '/^' . preg_quote( $GLOBALS['__itsec_cache_wp_content_dir'], '/' ) . '/', '', $file ) );
1470
+ } elseif ( 0 === strpos( $file, $GLOBALS['__itsec_cache_abspath'] ) ) {
1471
+ $url = get_option( 'siteurl' ) . str_replace( '\\', '/', preg_replace( '/^' . preg_quote( $GLOBALS['__itsec_cache_abspath'], '/' ) . '/', '', $file ) );
1472
+ }
1473
+ }
1474
+
1475
+ if ( empty( $url ) && ! $prevent_recursion ) {
1476
+ $url = self::get_url_from_file( realpath( $file ), $auto_ssl, true );
1477
+ }
1478
+
1479
+ if ( empty( $url ) ) {
1480
+ return '';
1481
+ }
1482
+
1483
+ if ( $auto_ssl ) {
1484
+ $url = self::fix_url( $url );
1485
+ }
1486
+
1487
+ return $url;
1488
+ }
1489
+
1490
+ public static function get_file_from_url( $url ) {
1491
+ $url = preg_replace( '/^https/', 'http', $url );
1492
+ $url = preg_replace( '/\?.*$/', '', $url );
1493
+
1494
+ $file = '';
1495
+
1496
+ $upload_dir = ITSEC_Core::get_wp_upload_dir();
1497
+
1498
+ if ( is_array( $upload_dir ) && ( false === $upload_dir['error'] ) ) {
1499
+ if ( 0 === strpos( $url, $upload_dir['baseurl'] ) ) {
1500
+ $file = str_replace( $upload_dir['baseurl'], $upload_dir['basedir'], $url );
1501
+ } elseif ( false !== strpos( $url, 'wp-content/uploads' ) ) {
1502
+ $path_pattern = 'wp-content/uploads';
1503
+ $file_base = $upload_dir['basedir'];
1504
+
1505
+ if ( is_multisite() && ! ( is_main_network() && is_main_site() && defined( 'MULTISITE' ) ) ) {
1506
+ if ( defined( 'MULTISITE' ) ) {
1507
+ $mu_path = '/sites/' . get_current_blog_id();
1508
+ } else {
1509
+ $mu_path = '/' . get_current_blog_id();
1510
+ }
1511
+
1512
+ if ( false === strpos( $url, "$path_pattern$mu_path" ) ) {
1513
+ $file_base = substr( $file_base, 0, - strlen( $mu_path ) );
1514
+ } else {
1515
+ $path_pattern .= $mu_path;
1516
+ }
1517
+ }
1518
+
1519
+ $file = $file_base . substr( $url, strpos( $url, $path_pattern ) + strlen( $path_pattern ) );
1520
+ }
1521
+ }
1522
+
1523
+ if ( empty( $file ) ) {
1524
+ if ( ! isset( $GLOBALS['__itsec_cache_wp_content_url'] ) ) {
1525
+ $GLOBALS['__itsec_cache_wp_content_url'] = preg_replace( '/^https/', 'http', WP_CONTENT_URL );
1526
+ }
1527
+ if ( ! isset( $GLOBALS['__itsec_cache_siteurl'] ) ) {
1528
+ $GLOBALS['__itsec_cache_siteurl'] = preg_replace( '/^https/', 'http', get_option( 'siteurl' ) );
1529
+ }
1530
+
1531
+ if ( 0 === strpos( $url, $GLOBALS['__itsec_cache_wp_content_url'] ) ) {
1532
+ $file = rtrim( WP_CONTENT_DIR, '\\\/' ) . preg_replace( '/^' . preg_quote( $GLOBALS['__itsec_cache_wp_content_url'], '/' ) . '/', '', $url );
1533
+ } elseif ( 0 === strpos( $url, $GLOBALS['__itsec_cache_siteurl'] ) ) {
1534
+ $file = rtrim( ABSPATH, '\\\/' ) . preg_replace( '/^' . preg_quote( $GLOBALS['__itsec_cache_siteurl'], '/' ) . '/', '', $url );
1535
+ }
1536
+ }
1537
+
1538
+ return $file;
1539
+ }
1540
+
1541
+ public static function fix_url( $url ) {
1542
+ if ( is_ssl() ) {
1543
+ $url = preg_replace( '|^http://|', 'https://', $url );
1544
+ } else {
1545
+ $url = preg_replace( '|^https://|', 'http://', $url );
1546
+ }
1547
+
1548
+ return $url;
1549
+ }
1550
+
1551
+ /**
1552
+ * Set a cookie.
1553
+ *
1554
+ * @param string $name
1555
+ * @param string $value
1556
+ * @param array $args
1557
+ */
1558
+ public static function set_cookie( $name, $value, $args = array() ) {
1559
+
1560
+ $args = wp_parse_args( array(
1561
+ 'length' => 0,
1562
+ 'http_only' => true,
1563
+ ), $args );
1564
+
1565
+ $expires = $args['length'] ? ITSEC_Core::get_current_time_gmt() + $args['length'] : 0;
1566
+
1567
+ setcookie( $name, $value, $expires, COOKIEPATH, COOKIE_DOMAIN, is_ssl(), $args['http_only'] );
1568
+ }
1569
+
1570
+ /**
1571
+ * Clear a cookie.
1572
+ *
1573
+ * @param string $name
1574
+ */
1575
+ public static function clear_cookie( $name ) {
1576
+ setcookie( $name, ' ', ITSEC_Core::get_current_time_gmt() - YEAR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN, false, false );
1577
+ }
1578
  }
core/lib/class-itsec-lib-browser.php ADDED
@@ -0,0 +1,1757 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * File: Browser.php
5
+ * Author: Chris Schuld (http://chrisschuld.com/)
6
+ * Last Modified: July 22nd, 2016
7
+ * @version 2.0
8
+ * @package PegasusPHP
9
+ *
10
+ * Copyright (C) 2008-2010 Chris Schuld (chris@chrisschuld.com)
11
+ *
12
+ * This program is free software; you can redistribute it and/or
13
+ * modify it under the terms of the GNU General Public License as
14
+ * published by the Free Software Foundation; either version 2 of
15
+ * the License, or (at your option) any later version.
16
+ *
17
+ * This program is distributed in the hope that it will be useful,
18
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
+ * GNU General Public License for more details at:
21
+ * http://www.gnu.org/copyleft/gpl.html
22
+ *
23
+ *
24
+ * Typical Usage:
25
+ *
26
+ * $browser = new Browser();
27
+ * if( $browser->getBrowser() == Browser::BROWSER_FIREFOX && $browser->getVersion() >= 2 ) {
28
+ * echo 'You have FireFox version 2 or greater';
29
+ * }
30
+ *
31
+ * User Agents Sampled from: http://www.useragentstring.com/
32
+ *
33
+ * This implementation is based on the original work from Gary White
34
+ * http://apptools.com/phptools/browser/
35
+ *
36
+ */
37
+ class ITSEC_Lib_Browser
38
+ {
39
+ private $_agent = '';
40
+ private $_browser_name = '';
41
+ private $_version = '';
42
+ private $_platform = '';
43
+ private $_os = '';
44
+ private $_is_aol = false;
45
+ private $_is_mobile = false;
46
+ private $_is_tablet = false;
47
+ private $_is_robot = false;
48
+ private $_is_facebook = false;
49
+ private $_aol_version = '';
50
+
51
+ const BROWSER_UNKNOWN = 'unknown';
52
+ const VERSION_UNKNOWN = 'unknown';
53
+
54
+ const BROWSER_OPERA = 'Opera'; // http://www.opera.com/
55
+ const BROWSER_OPERA_MINI = 'Opera Mini'; // http://www.opera.com/mini/
56
+ const BROWSER_WEBTV = 'WebTV'; // http://www.webtv.net/pc/
57
+ const BROWSER_EDGE = 'Edge'; // https://www.microsoft.com/edge
58
+ const BROWSER_IE = 'Internet Explorer'; // http://www.microsoft.com/ie/
59
+ const BROWSER_POCKET_IE = 'Pocket Internet Explorer'; // http://en.wikipedia.org/wiki/Internet_Explorer_Mobile
60
+ const BROWSER_KONQUEROR = 'Konqueror'; // http://www.konqueror.org/
61
+ const BROWSER_ICAB = 'iCab'; // http://www.icab.de/
62
+ const BROWSER_OMNIWEB = 'OmniWeb'; // http://www.omnigroup.com/applications/omniweb/
63
+ const BROWSER_FIREBIRD = 'Firebird'; // http://www.ibphoenix.com/
64
+ const BROWSER_FIREFOX = 'Firefox'; // http://www.mozilla.com/en-US/firefox/firefox.html
65
+ const BROWSER_ICEWEASEL = 'Iceweasel'; // http://www.geticeweasel.org/
66
+ const BROWSER_SHIRETOKO = 'Shiretoko'; // http://wiki.mozilla.org/Projects/shiretoko
67
+ const BROWSER_MOZILLA = 'Mozilla'; // http://www.mozilla.com/en-US/
68
+ const BROWSER_AMAYA = 'Amaya'; // http://www.w3.org/Amaya/
69
+ const BROWSER_LYNX = 'Lynx'; // http://en.wikipedia.org/wiki/Lynx
70
+ const BROWSER_SAFARI = 'Safari'; // http://apple.com
71
+ const BROWSER_IPHONE = 'iPhone'; // http://apple.com
72
+ const BROWSER_IPOD = 'iPod'; // http://apple.com
73
+ const BROWSER_IPAD = 'iPad'; // http://apple.com
74
+ const BROWSER_CHROME = 'Chrome'; // http://www.google.com/chrome
75
+ const BROWSER_ANDROID = 'Android'; // http://www.android.com/
76
+ const BROWSER_GOOGLEBOT = 'GoogleBot'; // http://en.wikipedia.org/wiki/Googlebot
77
+
78
+ const BROWSER_YANDEXBOT = 'YandexBot'; // http://yandex.com/bots
79
+ const BROWSER_YANDEXIMAGERESIZER_BOT = 'YandexImageResizer'; // http://yandex.com/bots
80
+ const BROWSER_YANDEXIMAGES_BOT = 'YandexImages'; // http://yandex.com/bots
81
+ const BROWSER_YANDEXVIDEO_BOT = 'YandexVideo'; // http://yandex.com/bots
82
+ const BROWSER_YANDEXMEDIA_BOT = 'YandexMedia'; // http://yandex.com/bots
83
+ const BROWSER_YANDEXBLOGS_BOT = 'YandexBlogs'; // http://yandex.com/bots
84
+ const BROWSER_YANDEXFAVICONS_BOT = 'YandexFavicons'; // http://yandex.com/bots
85
+ const BROWSER_YANDEXWEBMASTER_BOT = 'YandexWebmaster'; // http://yandex.com/bots
86
+ const BROWSER_YANDEXDIRECT_BOT = 'YandexDirect'; // http://yandex.com/bots
87
+ const BROWSER_YANDEXMETRIKA_BOT = 'YandexMetrika'; // http://yandex.com/bots
88
+ const BROWSER_YANDEXNEWS_BOT = 'YandexNews'; // http://yandex.com/bots
89
+ const BROWSER_YANDEXCATALOG_BOT = 'YandexCatalog'; // http://yandex.com/bots
90
+
91
+ const BROWSER_SLURP = 'Yahoo! Slurp'; // http://en.wikipedia.org/wiki/Yahoo!_Slurp
92
+ const BROWSER_W3CVALIDATOR = 'W3C Validator'; // http://validator.w3.org/
93
+ const BROWSER_BLACKBERRY = 'BlackBerry'; // http://www.blackberry.com/
94
+ const BROWSER_ICECAT = 'IceCat'; // http://en.wikipedia.org/wiki/GNU_IceCat
95
+ const BROWSER_NOKIA_S60 = 'Nokia S60 OSS Browser'; // http://en.wikipedia.org/wiki/Web_Browser_for_S60
96
+ const BROWSER_NOKIA = 'Nokia Browser'; // * all other WAP-based browsers on the Nokia Platform
97
+ const BROWSER_MSN = 'MSN Browser'; // http://explorer.msn.com/
98
+ const BROWSER_MSNBOT = 'MSN Bot'; // http://search.msn.com/msnbot.htm
99
+ const BROWSER_BINGBOT = 'Bing Bot'; // http://en.wikipedia.org/wiki/Bingbot
100
+ const BROWSER_BINGPREVIEW = 'Bing Preview';
101
+ const BROWSER_VIVALDI = 'Vivalidi'; // https://vivaldi.com/
102
+ const BROWSER_YANDEX = 'Yandex'; // https://browser.yandex.ua/
103
+
104
+ const BROWSER_NETSCAPE_NAVIGATOR = 'Netscape Navigator'; // http://browser.netscape.com/ (DEPRECATED)
105
+ const BROWSER_GALEON = 'Galeon'; // http://galeon.sourceforge.net/ (DEPRECATED)
106
+ const BROWSER_NETPOSITIVE = 'NetPositive'; // http://en.wikipedia.org/wiki/NetPositive (DEPRECATED)
107
+ const BROWSER_PHOENIX = 'Phoenix'; // http://en.wikipedia.org/wiki/History_of_Mozilla_Firefox (DEPRECATED)
108
+ const BROWSER_PLAYSTATION = "PlayStation";
109
+ const BROWSER_SAMSUNG = "SamsungBrowser";
110
+ const BROWSER_SILK = "Silk";
111
+ const BROWSER_I_FRAME = "Iframely";
112
+ const BROWSER_COCOA = "CocoaRestClient";
113
+
114
+ const PLATFORM_UNKNOWN = 'unknown';
115
+ const PLATFORM_WINDOWS = 'Windows';
116
+ const PLATFORM_WINDOWS_CE = 'Windows CE';
117
+ const PLATFORM_APPLE = 'Apple';
118
+ const PLATFORM_LINUX = 'Linux';
119
+ const PLATFORM_OS2 = 'OS/2';
120
+ const PLATFORM_BEOS = 'BeOS';
121
+ const PLATFORM_IPHONE = 'iPhone';
122
+ const PLATFORM_IPOD = 'iPod';
123
+ const PLATFORM_IPAD = 'iPad';
124
+ const PLATFORM_BLACKBERRY = 'BlackBerry';
125
+ const PLATFORM_NOKIA = 'Nokia';
126
+ const PLATFORM_FREEBSD = 'FreeBSD';
127
+ const PLATFORM_OPENBSD = 'OpenBSD';
128
+ const PLATFORM_NETBSD = 'NetBSD';
129
+ const PLATFORM_SUNOS = 'SunOS';
130
+ const PLATFORM_OPENSOLARIS = 'OpenSolaris';
131
+ const PLATFORM_ANDROID = 'Android';
132
+ const PLATFORM_PLAYSTATION = "Sony PlayStation";
133
+ const PLATFORM_ROKU = "Roku";
134
+ const PLATFORM_APPLE_TV = "Apple TV";
135
+ const PLATFORM_TERMINAL = "Terminal";
136
+ const PLATFORM_FIRE_OS = "Fire OS";
137
+ const PLATFORM_SMART_TV = "SMART-TV";
138
+ const PLATFORM_CHROME_OS = "Chrome OS";
139
+ const PLATFORM_JAVA_ANDROID = "Java/Android";
140
+ const PLATFORM_POSTMAN = "Postman";
141
+ const PLATFORM_I_FRAME = "Iframely";
142
+
143
+ const OPERATING_SYSTEM_UNKNOWN = 'unknown';
144
+
145
+ /**
146
+ * Class constructor
147
+ */
148
+ public function __construct($userAgent = "")
149
+ {
150
+ $this->reset();
151
+ if ($userAgent != "") {
152
+ $this->setUserAgent($userAgent);
153
+ } else {
154
+ $this->determine();
155
+ }
156
+ }
157
+
158
+ /**
159
+ * Reset all properties
160
+ */
161
+ public function reset()
162
+ {
163
+ $this->_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "";
164
+ $this->_browser_name = self::BROWSER_UNKNOWN;
165
+ $this->_version = self::VERSION_UNKNOWN;
166
+ $this->_platform = self::PLATFORM_UNKNOWN;
167
+ $this->_os = self::OPERATING_SYSTEM_UNKNOWN;
168
+ $this->_is_aol = false;
169
+ $this->_is_mobile = false;
170
+ $this->_is_tablet = false;
171
+ $this->_is_robot = false;
172
+ $this->_is_facebook = false;
173
+ $this->_aol_version = self::VERSION_UNKNOWN;
174
+ }
175
+
176
+ /**
177
+ * Check to see if the specific browser is valid
178
+ * @param string $browserName
179
+ * @return bool True if the browser is the specified browser
180
+ */
181
+ function isBrowser($browserName)
182
+ {
183
+ return (0 == strcasecmp($this->_browser_name, trim($browserName)));
184
+ }
185
+
186
+ /**
187
+ * The name of the browser. All return types are from the class contants
188
+ * @return string Name of the browser
189
+ */
190
+ public function getBrowser()
191
+ {
192
+ return $this->_browser_name;
193
+ }
194
+
195
+ /**
196
+ * Set the name of the browser
197
+ * @param $browser string The name of the Browser
198
+ */
199
+ public function setBrowser($browser)
200
+ {
201
+ $this->_browser_name = $browser;
202
+ }
203
+
204
+ /**
205
+ * The name of the platform. All return types are from the class contants
206
+ * @return string Name of the browser
207
+ */
208
+ public function getPlatform()
209
+ {
210
+ return $this->_platform;
211
+ }
212
+
213
+ /**
214
+ * Set the name of the platform
215
+ * @param string $platform The name of the Platform
216
+ */
217
+ public function setPlatform($platform)
218
+ {
219
+ $this->_platform = $platform;
220
+ }
221
+
222
+ /**
223
+ * The version of the browser.
224
+ * @return string Version of the browser (will only contain alpha-numeric characters and a period)
225
+ */
226
+ public function getVersion()
227
+ {
228
+ return $this->_version;
229
+ }
230
+
231
+ /**
232
+ * Set the version of the browser
233
+ * @param string $version The version of the Browser
234
+ */
235
+ public function setVersion($version)
236
+ {
237
+ $this->_version = preg_replace('/[^0-9,.,a-z,A-Z-]/', '', $version);
238
+ }
239
+
240
+ /**
241
+ * The version of AOL.
242
+ * @return string Version of AOL (will only contain alpha-numeric characters and a period)
243
+ */
244
+ public function getAolVersion()
245
+ {
246
+ return $this->_aol_version;
247
+ }
248
+
249
+ /**
250
+ * Set the version of AOL
251
+ * @param string $version The version of AOL
252
+ */
253
+ public function setAolVersion($version)
254
+ {
255
+ $this->_aol_version = preg_replace('/[^0-9,.,a-z,A-Z]/', '', $version);
256
+ }
257
+
258
+ /**
259
+ * Is the browser from AOL?
260
+ * @return boolean True if the browser is from AOL otherwise false
261
+ */
262
+ public function isAol()
263
+ {
264
+ return $this->_is_aol;
265
+ }
266
+
267
+ /**
268
+ * Is the browser from a mobile device?
269
+ * @return boolean True if the browser is from a mobile device otherwise false
270
+ */
271
+ public function isMobile()
272
+ {
273
+ return $this->_is_mobile;
274
+ }
275
+
276
+ /**
277
+ * Is the browser from a tablet device?
278
+ * @return boolean True if the browser is from a tablet device otherwise false
279
+ */
280
+ public function isTablet()
281
+ {
282
+ return $this->_is_tablet;
283
+ }
284
+
285
+ /**
286
+ * Is the browser from a robot (ex Slurp,GoogleBot)?
287
+ * @return boolean True if the browser is from a robot otherwise false
288
+ */
289
+ public function isRobot()
290
+ {
291
+ return $this->_is_robot;
292
+ }
293
+
294
+ /**
295
+ * Is the browser from facebook?
296
+ * @return boolean True if the browser is from facebook otherwise false
297
+ */
298
+ public function isFacebook()
299
+ {
300
+ return $this->_is_facebook;
301
+ }
302
+
303
+ /**
304
+ * Set the browser to be from AOL
305
+ * @param $isAol
306
+ */
307
+ public function setAol($isAol)
308
+ {
309
+ $this->_is_aol = $isAol;
310
+ }
311
+
312
+ /**
313
+ * Set the Browser to be mobile
314
+ * @param boolean $value is the browser a mobile browser or not
315
+ */
316
+ protected function setMobile($value = true)
317
+ {
318
+ $this->_is_mobile = $value;
319
+ }
320
+
321
+ /**
322
+ * Set the Browser to be tablet
323
+ * @param boolean $value is the browser a tablet browser or not
324
+ */
325
+ protected function setTablet($value = true)
326
+ {
327
+ $this->_is_tablet = $value;
328
+ }
329
+
330
+ /**
331
+ * Set the Browser to be a robot
332
+ * @param boolean $value is the browser a robot or not
333
+ */
334
+ protected function setRobot($value = true)
335
+ {
336
+ $this->_is_robot = $value;
337
+ }
338
+
339
+ /**
340
+ * Set the Browser to be a Facebook request
341
+ * @param boolean $value is the browser a robot or not
342
+ */
343
+ protected function setFacebook($value = true)
344
+ {
345
+ $this->_is_facebook = $value;
346
+ }
347
+
348
+ /**
349
+ * Get the user agent value in use to determine the browser
350
+ * @return string The user agent from the HTTP header
351
+ */
352
+ public function getUserAgent()
353
+ {
354
+ return $this->_agent;
355
+ }
356
+
357
+ /**
358
+ * Set the user agent value (the construction will use the HTTP header value - this will overwrite it)
359
+ * @param string $agent_string The value for the User Agent
360
+ */
361
+ public function setUserAgent($agent_string)
362
+ {
363
+ $this->reset();
364
+ $this->_agent = $agent_string;
365
+ $this->determine();
366
+ }
367
+
368
+ /**
369
+ * Used to determine if the browser is actually "chromeframe"
370
+ * @since 1.7
371
+ * @return boolean True if the browser is using chromeframe
372
+ */
373
+ public function isChromeFrame()
374
+ {
375
+ return (strpos($this->_agent, "chromeframe") !== false);
376
+ }
377
+
378
+ /**
379
+ * Returns a formatted string with a summary of the details of the browser.
380
+ * @return string formatted string with a summary of the browser
381
+ */
382
+ public function __toString()
383
+ {
384
+ return "<strong>Browser Name:</strong> {$this->getBrowser()}<br/>\n" .
385
+ "<strong>Browser Version:</strong> {$this->getVersion()}<br/>\n" .
386
+ "<strong>Browser User Agent String:</strong> {$this->getUserAgent()}<br/>\n" .
387
+ "<strong>Platform:</strong> {$this->getPlatform()}<br/>";
388
+ }
389
+
390
+ /**
391
+ * Protected routine to calculate and determine what the browser is in use (including platform)
392
+ */
393
+ protected function determine()
394
+ {
395
+ $this->checkPlatform();
396
+ $this->checkBrowsers();
397
+ $this->checkForAol();
398
+ }
399
+
400
+ /**
401
+ * Protected routine to determine the browser type
402
+ * @return boolean True if the browser was detected otherwise false
403
+ */
404
+ protected function checkBrowsers()
405
+ {
406
+ return (
407
+ // well-known, well-used
408
+ // Special Notes:
409
+ // (1) Opera must be checked before FireFox due to the odd
410
+ // user agents used in some older versions of Opera
411
+ // (2) WebTV is strapped onto Internet Explorer so we must
412
+ // check for WebTV before IE
413
+ // (3) (deprecated) Galeon is based on Firefox and needs to be
414
+ // tested before Firefox is tested
415
+ // (4) OmniWeb is based on Safari so OmniWeb check must occur
416
+ // before Safari
417
+ // (5) Netscape 9+ is based on Firefox so Netscape checks
418
+ // before FireFox are necessary
419
+ // (6) Vivalid is UA contains both Firefox and Chrome so Vivalid checks
420
+ // before Firefox and Chrome
421
+ // (7) BingPreview masquerades as all sorts of different browsers to get
422
+ // different preview types.
423
+ $this->checkBrowserBingPreview() ||
424
+ $this->checkBrowserWebTv() ||
425
+ $this->checkBrowserEdge() ||
426
+ $this->checkBrowserInternetExplorer() ||
427
+ $this->checkBrowserOpera() ||
428
+ $this->checkBrowserGaleon() ||
429
+ $this->checkBrowserNetscapeNavigator9Plus() ||
430
+ $this->checkBrowserVivaldi() ||
431
+ $this->checkBrowserYandex() ||
432
+ $this->checkBrowserFirefox() ||
433
+ $this->checkBrowserChrome() ||
434
+ $this->checkBrowserOmniWeb() ||
435
+
436
+ // common mobile
437
+ $this->checkBrowserAndroid() ||
438
+ $this->checkBrowseriPad() ||
439
+ $this->checkBrowseriPod() ||
440
+ $this->checkBrowseriPhone() ||
441
+ $this->checkBrowserBlackBerry() ||
442
+ $this->checkBrowserNokia() ||
443
+
444
+ // common bots
445
+ $this->checkBrowserGoogleBot() ||
446
+ $this->checkBrowserMSNBot() ||
447
+ $this->checkBrowserBingBot() ||
448
+ $this->checkBrowserSlurp() ||
449
+
450
+ // Yandex bots
451
+ $this->checkBrowserYandexBot() ||
452
+ $this->checkBrowserYandexImageResizerBot() ||
453
+ $this->checkBrowserYandexBlogsBot() ||
454
+ $this->checkBrowserYandexCatalogBot() ||
455
+ $this->checkBrowserYandexDirectBot() ||
456
+ $this->checkBrowserYandexFaviconsBot() ||
457
+ $this->checkBrowserYandexImagesBot() ||
458
+ $this->checkBrowserYandexMediaBot() ||
459
+ $this->checkBrowserYandexMetrikaBot() ||
460
+ $this->checkBrowserYandexNewsBot() ||
461
+ $this->checkBrowserYandexVideoBot() ||
462
+ $this->checkBrowserYandexWebmasterBot() ||
463
+
464
+ // check for facebook external hit when loading URL
465
+ $this->checkFacebookExternalHit() ||
466
+
467
+ // WebKit base check (post mobile and others)
468
+ $this->checkBrowserSamsung() ||
469
+ $this->checkBrowserSilk() ||
470
+ $this->checkBrowserSafari() ||
471
+
472
+ // everyone else
473
+ $this->checkBrowserNetPositive() ||
474
+ $this->checkBrowserFirebird() ||
475
+ $this->checkBrowserKonqueror() ||
476
+ $this->checkBrowserIcab() ||
477
+ $this->checkBrowserPhoenix() ||
478
+ $this->checkBrowserAmaya() ||
479
+ $this->checkBrowserLynx() ||
480
+ $this->checkBrowserShiretoko() ||
481
+ $this->checkBrowserIceCat() ||
482
+ $this->checkBrowserIceweasel() ||
483
+ $this->checkBrowserW3CValidator() ||
484
+ $this->checkBrowserPlayStation() ||
485
+ $this->checkBrowserIframely() ||
486
+ $this->checkBrowserCocoa() ||
487
+ $this->checkBrowserMozilla() /* Mozilla is such an open standard that you must check it last */
488
+
489
+
490
+ );
491
+ }
492
+
493
+ /**
494
+ * Determine if the user is using a BlackBerry (last updated 1.7)
495
+ * @return boolean True if the browser is the BlackBerry browser otherwise false
496
+ */
497
+ protected function checkBrowserBlackBerry()
498
+ {
499
+ if (stripos($this->_agent, 'blackberry') !== false) {
500
+ $aresult = explode("/", stristr($this->_agent, "BlackBerry"));
501
+ if (isset($aresult[1])) {
502
+ $aversion = explode(' ', $aresult[1]);
503
+ $this->setVersion($aversion[0]);
504
+ $this->_browser_name = self::BROWSER_BLACKBERRY;
505
+ $this->setMobile(true);
506
+ return true;
507
+ }
508
+ }
509
+ return false;
510
+ }
511
+
512
+ /**
513
+ * Determine if the user is using an AOL User Agent (last updated 1.7)
514
+ * @return boolean True if the browser is from AOL otherwise false
515
+ */
516
+ protected function checkForAol()
517
+ {
518
+ $this->setAol(false);
519
+ $this->setAolVersion(self::VERSION_UNKNOWN);
520
+
521
+ if (stripos($this->_agent, 'aol') !== false) {
522
+ $aversion = explode(' ', stristr($this->_agent, 'AOL'));
523
+ if (isset($aversion[1])) {
524
+ $this->setAol(true);
525
+ $this->setAolVersion(preg_replace('/[^0-9\.a-z]/i', '', $aversion[1]));
526
+ return true;
527
+ }
528
+ }
529
+ return false;
530
+ }
531
+
532
+ /**
533
+ * Determine if the browser is the GoogleBot or not (last updated 1.7)
534
+ * @return boolean True if the browser is the GoogletBot otherwise false
535
+ */
536
+ protected function checkBrowserGoogleBot()
537
+ {
538
+ if (stripos($this->_agent, 'googlebot') !== false) {
539
+ $aresult = explode('/', stristr($this->_agent, 'googlebot'));
540
+ if (isset($aresult[1])) {
541
+ $aversion = explode(' ', $aresult[1]);
542
+ $this->setVersion(str_replace(';', '', $aversion[0]));
543
+ $this->_browser_name = self::BROWSER_GOOGLEBOT;
544
+ $this->setRobot(true);
545
+ return true;
546
+ }
547
+ }
548
+ return false;
549
+ }
550
+
551
+ /**
552
+ * Determine if the browser is the YandexBot or not
553
+ * @return boolean True if the browser is the YandexBot otherwise false
554
+ */
555
+ protected function checkBrowserYandexBot()
556
+ {
557
+ if (stripos($this->_agent, 'YandexBot') !== false) {
558
+ $aresult = explode('/', stristr($this->_agent, 'YandexBot'));
559
+ if (isset($aresult[1])) {
560
+ $aversion = explode(' ', $aresult[1]);
561
+ $this->setVersion(str_replace(';', '', $aversion[0]));
562
+ $this->_browser_name = self::BROWSER_YANDEXBOT;
563
+ $this->setRobot(true);
564
+ return true;
565
+ }
566
+ }
567
+ return false;
568
+ }
569
+
570
+ /**
571
+ * Determine if the browser is the YandexImageResizer or not
572
+ * @return boolean True if the browser is the YandexImageResizer otherwise false
573
+ */
574
+ protected function checkBrowserYandexImageResizerBot()
575
+ {
576
+ if (stripos($this->_agent, 'YandexImageResizer') !== false) {
577
+ $aresult = explode('/', stristr($this->_agent, 'YandexImageResizer'));
578
+ if (isset($aresult[1])) {
579
+ $aversion = explode(' ', $aresult[1]);
580
+ $this->setVersion(str_replace(';', '', $aversion[0]));
581
+ $this->_browser_name = self::BROWSER_YANDEXIMAGERESIZER_BOT;
582
+ $this->setRobot(true);
583
+ return true;
584
+ }
585
+ }
586
+ return false;
587
+ }
588
+
589
+ /**
590
+ * Determine if the browser is the YandexCatalog or not
591
+ * @return boolean True if the browser is the YandexCatalog otherwise false
592
+ */
593
+ protected function checkBrowserYandexCatalogBot()
594
+ {
595
+ if (stripos($this->_agent, 'YandexCatalog') !== false) {
596
+ $aresult = explode('/', stristr($this->_agent, 'YandexCatalog'));
597
+ if (isset($aresult[1])) {
598
+ $aversion = explode(' ', $aresult[1]);
599
+ $this->setVersion(str_replace(';', '', $aversion[0]));
600
+ $this->_browser_name = self::BROWSER_YANDEXCATALOG_BOT;
601
+ $this->setRobot(true);
602
+ return true;
603
+ }
604
+ }
605
+ return false;
606
+ }
607
+
608
+ /**
609
+ * Determine if the browser is the YandexNews or not
610
+ * @return boolean True if the browser is the YandexNews otherwise false
611
+ */
612
+ protected function checkBrowserYandexNewsBot()
613
+ {
614
+ if (stripos($this->_agent, 'YandexNews') !== false) {
615
+ $aresult = explode('/', stristr($this->_agent, 'YandexNews'));
616
+ if (isset($aresult[1])) {
617
+ $aversion = explode(' ', $aresult[1]);
618
+ $this->setVersion(str_replace(';', '', $aversion[0]));
619
+ $this->_browser_name = self::BROWSER_YANDEXNEWS_BOT;
620
+ $this->setRobot(true);
621
+ return true;
622
+ }
623
+ }
624
+ return false;
625
+ }
626
+
627
+ /**
628
+ * Determine if the browser is the YandexMetrika or not
629
+ * @return boolean True if the browser is the YandexMetrika otherwise false
630
+ */
631
+ protected function checkBrowserYandexMetrikaBot()
632
+ {
633
+ if (stripos($this->_agent, 'YandexMetrika') !== false) {
634
+ $aresult = explode('/', stristr($this->_agent, 'YandexMetrika'));
635
+ if (isset($aresult[1])) {
636
+ $aversion = explode(' ', $aresult[1]);
637
+ $this->setVersion(str_replace(';', '', $aversion[0]));
638
+ $this->_browser_name = self::BROWSER_YANDEXMETRIKA_BOT;
639
+ $this->setRobot(true);
640
+ return true;
641
+ }
642
+ }
643
+ return false;
644
+ }
645
+
646
+ /**
647
+ * Determine if the browser is the YandexDirect or not
648
+ * @return boolean True if the browser is the YandexDirect otherwise false
649
+ */
650
+ protected function checkBrowserYandexDirectBot()
651
+ {
652
+ if (stripos($this->_agent, 'YandexDirect') !== false) {
653
+ $aresult = explode('/', stristr($this->_agent, 'YandexDirect'));
654
+ if (isset($aresult[1])) {
655
+ $aversion = explode(' ', $aresult[1]);
656
+ $this->setVersion(str_replace(';', '', $aversion[0]));
657
+ $this->_browser_name = self::BROWSER_YANDEXDIRECT_BOT;
658
+ $this->setRobot(true);
659
+ return true;
660
+ }
661
+ }
662
+ return false;
663
+ }
664
+
665
+ /**
666
+ * Determine if the browser is the YandexWebmaster or not
667
+ * @return boolean True if the browser is the YandexWebmaster otherwise false
668
+ */
669
+ protected function checkBrowserYandexWebmasterBot()
670
+ {
671
+ if (stripos($this->_agent, 'YandexWebmaster') !== false) {
672
+ $aresult = explode('/', stristr($this->_agent, 'YandexWebmaster'));
673
+ if (isset($aresult[1])) {
674
+ $aversion = explode(' ', $aresult[1]);
675
+ $this->setVersion(str_replace(';', '', $aversion[0]));
676
+ $this->_browser_name = self::BROWSER_YANDEXWEBMASTER_BOT;
677
+ $this->setRobot(true);
678
+ return true;
679
+ }
680
+ }
681
+ return false;
682
+ }
683
+
684
+ /**
685
+ * Determine if the browser is the YandexFavicons or not
686
+ * @return boolean True if the browser is the YandexFavicons otherwise false
687
+ */
688
+ protected function checkBrowserYandexFaviconsBot()
689
+ {
690
+ if (stripos($this->_agent, 'YandexFavicons') !== false) {
691
+ $aresult = explode('/', stristr($this->_agent, 'YandexFavicons'));
692
+ if (isset($aresult[1])) {
693
+ $aversion = explode(' ', $aresult[1]);
694
+ $this->setVersion(str_replace(';', '', $aversion[0]));
695
+ $this->_browser_name = self::BROWSER_YANDEXFAVICONS_BOT;
696
+ $this->setRobot(true);
697
+ return true;
698
+ }
699
+ }
700
+ return false;
701
+ }
702
+
703
+ /**
704
+ * Determine if the browser is the YandexBlogs or not
705
+ * @return boolean True if the browser is the YandexBlogs otherwise false
706
+ */
707
+ protected function checkBrowserYandexBlogsBot()
708
+ {
709
+ if (stripos($this->_agent, 'YandexBlogs') !== false) {
710
+ $aresult = explode('/', stristr($this->_agent, 'YandexBlogs'));
711
+ if (isset($aresult[1])) {
712
+ $aversion = explode(' ', $aresult[1]);
713
+ $this->setVersion(str_replace(';', '', $aversion[0]));
714
+ $this->_browser_name = self::BROWSER_YANDEXBLOGS_BOT;
715
+ $this->setRobot(true);
716
+ return true;
717
+ }
718
+ }
719
+ return false;
720
+ }
721
+
722
+ /**
723
+ * Determine if the browser is the YandexMedia or not
724
+ * @return boolean True if the browser is the YandexMedia otherwise false
725
+ */
726
+ protected function checkBrowserYandexMediaBot()
727
+ {
728
+ if (stripos($this->_agent, 'YandexMedia') !== false) {
729
+ $aresult = explode('/', stristr($this->_agent, 'YandexMedia'));
730
+ if (isset($aresult[1])) {
731
+ $aversion = explode(' ', $aresult[1]);
732
+ $this->setVersion(str_replace(';', '', $aversion[0]));
733
+ $this->_browser_name = self::BROWSER_YANDEXMEDIA_BOT;
734
+ $this->setRobot(true);
735
+ return true;
736
+ }
737
+ }
738
+ return false;
739
+ }
740
+
741
+ /**
742
+ * Determine if the browser is the YandexVideo or not
743
+ * @return boolean True if the browser is the YandexVideo otherwise false
744
+ */
745
+ protected function checkBrowserYandexVideoBot()
746
+ {
747
+ if (stripos($this->_agent, 'YandexVideo') !== false) {
748
+ $aresult = explode('/', stristr($this->_agent, 'YandexVideo'));
749
+ if (isset($aresult[1])) {
750
+ $aversion = explode(' ', $aresult[1]);
751
+ $this->setVersion(str_replace(';', '', $aversion[0]));
752
+ $this->_browser_name = self::BROWSER_YANDEXVIDEO_BOT;
753
+ $this->setRobot(true);
754
+ return true;
755
+ }
756
+ }
757
+ return false;
758
+ }
759
+
760
+ /**
761
+ * Determine if the browser is the YandexImages or not
762
+ * @return boolean True if the browser is the YandexImages otherwise false
763
+ */
764
+ protected function checkBrowserYandexImagesBot()
765
+ {
766
+ if (stripos($this->_agent, 'YandexImages') !== false) {
767
+ $aresult = explode('/', stristr($this->_agent, 'YandexImages'));
768
+ if (isset($aresult[1])) {
769
+ $aversion = explode(' ', $aresult[1]);
770
+ $this->setVersion(str_replace(';', '', $aversion[0]));
771
+ $this->_browser_name = self::BROWSER_YANDEXIMAGES_BOT;
772
+ $this->setRobot(true);
773
+ return true;
774
+ }
775
+ }
776
+ return false;
777
+ }
778
+
779
+ /**
780
+ * Determine if the browser is the MSNBot or not (last updated 1.9)
781
+ * @return boolean True if the browser is the MSNBot otherwise false
782
+ */
783
+ protected function checkBrowserMSNBot()
784
+ {
785
+ if (stripos($this->_agent, "msnbot") !== false) {
786
+ $aresult = explode("/", stristr($this->_agent, "msnbot"));
787
+ if (isset($aresult[1])) {
788
+ $aversion = explode(" ", $aresult[1]);
789
+ $this->setVersion(str_replace(";", "", $aversion[0]));
790
+ $this->_browser_name = self::BROWSER_MSNBOT;
791
+ $this->setRobot(true);
792
+ return true;
793
+ }
794
+ }
795
+ return false;
796
+ }
797
+
798
+ /**
799
+ * Determine if the browser is the BingBot or not (last updated 1.9)
800
+ * @return boolean True if the browser is the BingBot otherwise false
801
+ */
802
+ protected function checkBrowserBingBot()
803
+ {
804
+ if (stripos($this->_agent, "bingbot") !== false) {
805
+ $aresult = explode("/", stristr($this->_agent, "bingbot"));
806
+ if (isset($aresult[1])) {
807
+ $aversion = explode(" ", $aresult[1]);
808
+ $this->setVersion(str_replace(";", "", $aversion[0]));
809
+ $this->_browser_name = self::BROWSER_BINGBOT;
810
+ $this->setRobot(true);
811
+ return true;
812
+ }
813
+ }
814
+ return false;
815
+ }
816
+
817
+ /**
818
+ * Determine if the browser is the BingPreview or not. Added by iThemes.
819
+ *
820
+ * BingPreview can masquerade as iOS devices.
821
+ *
822
+ * @return bool
823
+ */
824
+ protected function checkBrowserBingPreview() {
825
+ // "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534+ (KHTML, like Gecko) BingPreview/1.0b"
826
+
827
+ if (stripos( $this->_agent, 'BingPreview' ) !== false) {
828
+ $aresult = explode("/", stristr($this->_agent, "BingPreview"));
829
+ if (isset($aresult[1])) {
830
+ $aversion = explode(" ", $aresult[1]);
831
+ $this->setVersion(str_replace(";", "", $aversion[0]));
832
+ $this->_browser_name = self::BROWSER_BINGPREVIEW;
833
+ $this->setRobot(true);
834
+ return true;
835
+ }
836
+ }
837
+ }
838
+
839
+ /**
840
+ * Determine if the browser is the W3C Validator or not (last updated 1.7)
841
+ * @return boolean True if the browser is the W3C Validator otherwise false
842
+ */
843
+ protected function checkBrowserW3CValidator()
844
+ {
845
+ if (stripos($this->_agent, 'W3C-checklink') !== false) {
846
+ $aresult = explode('/', stristr($this->_agent, 'W3C-checklink'));
847
+ if (isset($aresult[1])) {
848
+ $aversion = explode(' ', $aresult[1]);
849
+ $this->setVersion($aversion[0]);
850
+ $this->_browser_name = self::BROWSER_W3CVALIDATOR;
851
+ return true;
852
+ }
853
+ } else if (stripos($this->_agent, 'W3C_Validator') !== false) {
854
+ // Some of the Validator versions do not delineate w/ a slash - add it back in
855
+ $ua = str_replace("W3C_Validator ", "W3C_Validator/", $this->_agent);
856
+ $aresult = explode('/', stristr($ua, 'W3C_Validator'));
857
+ if (isset($aresult[1])) {
858
+ $aversion = explode(' ', $aresult[1]);
859
+ $this->setVersion($aversion[0]);
860
+ $this->_browser_name = self::BROWSER_W3CVALIDATOR;
861
+ return true;
862
+ }
863
+ } else if (stripos($this->_agent, 'W3C-mobileOK') !== false) {
864
+ $this->_browser_name = self::BROWSER_W3CVALIDATOR;
865
+ $this->setMobile(true);
866
+ return true;
867
+ }
868
+ return false;
869
+ }
870
+
871
+ /**
872
+ * Determine if the browser is the Yahoo! Slurp Robot or not (last updated 1.7)
873
+ * @return boolean True if the browser is the Yahoo! Slurp Robot otherwise false
874
+ */
875
+ protected function checkBrowserSlurp()
876
+ {
877
+ if (stripos($this->_agent, 'slurp') !== false) {
878
+ $aresult = explode('/', stristr($this->_agent, 'Slurp'));
879
+ if (isset($aresult[1])) {
880
+ $aversion = explode(' ', $aresult[1]);
881
+ $this->setVersion($aversion[0]);
882
+ $this->_browser_name = self::BROWSER_SLURP;
883
+ $this->setRobot(true);
884
+ $this->setMobile(false);
885
+ return true;
886
+ }
887
+ }
888
+ return false;
889
+ }
890
+
891
+ /**
892
+ * Determine if the browser is Edge or not
893
+ * @return boolean True if the browser is Edge otherwise false
894
+ */
895
+ protected function checkBrowserEdge()
896
+ {
897
+ if (stripos($this->_agent, 'Edge/') !== false) {
898
+ $aresult = explode('/', stristr($this->_agent, 'Edge'));
899
+ if (isset($aresult[1])) {
900
+ $aversion = explode(' ', $aresult[1]);
901
+ $this->setVersion($aversion[0]);
902
+ $this->setBrowser(self::BROWSER_EDGE);
903
+ if (stripos($this->_agent, 'Windows Phone') !== false || stripos($this->_agent, 'Android') !== false) {
904
+ $this->setMobile(true);
905
+ }
906
+ return true;
907
+ }
908
+ }
909
+ return false;
910
+ }
911
+
912
+ /**
913
+ * Determine if the browser is Internet Explorer or not (last updated 1.7)
914
+ * @return boolean True if the browser is Internet Explorer otherwise false
915
+ */
916
+ protected function checkBrowserInternetExplorer()
917
+ {
918
+ // Test for IE11
919
+ if (stripos($this->_agent, 'Trident/7.0; rv:11.0') !== false) {
920
+ $this->setBrowser(self::BROWSER_IE);
921
+ $this->setVersion('11.0');
922
+ return true;
923
+ } // Test for v1 - v1.5 IE
924
+ else if (stripos($this->_agent, 'microsoft internet explorer') !== false) {
925
+ $this->setBrowser(self::BROWSER_IE);
926
+ $this->setVersion('1.0');
927
+ $aresult = stristr($this->_agent, '/');
928
+ if (preg_match('/308|425|426|474|0b1/i', $aresult)) {
929
+ $this->setVersion('1.5');
930
+ }
931
+ return true;
932
+ } // Test for versions > 1.5
933
+ else if (stripos($this->_agent, 'msie') !== false && stripos($this->_agent, 'opera') === false) {
934
+ // See if the browser is the odd MSN Explorer
935
+ if (stripos($this->_agent, 'msnb') !== false) {
936
+ $aresult = explode(' ', stristr(str_replace(';', '; ', $this->_agent), 'MSN'));
937
+ if (isset($aresult[1])) {
938
+ $this->setBrowser(self::BROWSER_MSN);
939
+ $this->setVersion(str_replace(array('(', ')', ';'), '', $aresult[1]));
940
+ return true;
941
+ }
942
+ }
943
+ $aresult = explode(' ', stristr(str_replace(';', '; ', $this->_agent), 'msie'));
944
+ if (isset($aresult[1])) {
945
+ $this->setBrowser(self::BROWSER_IE);
946
+ $this->setVersion(str_replace(array('(', ')', ';'), '', $aresult[1]));
947
+ if(preg_match('#trident/([0-9\.]+);#i', $this->_agent, $aresult)){
948
+ if($aresult[1] == '3.1'){
949
+ $this->setVersion('7.0');
950
+ }
951
+ else if($aresult[1] == '4.0'){
952
+ $this->setVersion('8.0');
953
+ }
954
+ else if($aresult[1] == '5.0'){
955
+ $this->setVersion('9.0');
956
+ }
957
+ else if($aresult[1] == '6.0'){
958
+ $this->setVersion('10.0');
959
+ }
960
+ else if($aresult[1] == '7.0'){
961
+ $this->setVersion('11.0');
962
+ }
963
+ else if($aresult[1] == '8.0'){
964
+ $this->setVersion('11.0');
965
+ }
966
+ }
967
+ if(stripos($this->_agent, 'IEMobile') !== false) {
968
+ $this->setBrowser(self::BROWSER_POCKET_IE);
969
+ $this->setMobile(true);
970
+ }
971
+ return true;
972
+ }
973
+ } // Test for versions > IE 10
974
+ else if (stripos($this->_agent, 'trident') !== false) {
975
+ $this->setBrowser(self::BROWSER_IE);
976
+ $result = explode('rv:', $this->_agent);
977
+ if (isset($result[1])) {
978
+ $this->setVersion(preg_replace('/[^0-9.]+/', '', $result[1]));
979
+ $this->_agent = str_replace(array("Mozilla", "Gecko"), "MSIE", $this->_agent);
980
+ }
981
+ } // Test for Pocket IE
982
+ else if (stripos($this->_agent, 'mspie') !== false || stripos($this->_agent, 'pocket') !== false) {
983
+ $aresult = explode(' ', stristr($this->_agent, 'mspie'));
984
+ if (isset($aresult[1])) {
985
+ $this->setPlatform(self::PLATFORM_WINDOWS_CE);
986
+ $this->setBrowser(self::BROWSER_POCKET_IE);
987
+ $this->setMobile(true);
988
+
989
+ if (stripos($this->_agent, 'mspie') !== false) {
990
+ $this->setVersion($aresult[1]);
991
+ } else {
992
+ $aversion = explode('/', $this->_agent);
993
+ if (isset($aversion[1])) {
994
+ $this->setVersion($aversion[1]);
995
+ }
996
+ }
997
+ return true;
998
+ }
999
+ }
1000
+ return false;
1001
+ }
1002
+
1003
+ /**
1004
+ * Determine if the browser is Opera or not (last updated 1.7)
1005
+ * @return boolean True if the browser is Opera otherwise false
1006
+ */
1007
+ protected function checkBrowserOpera()
1008
+ {
1009
+ if (stripos($this->_agent, 'opera mini') !== false) {
1010
+ $resultant = stristr($this->_agent, 'opera mini');
1011
+ if (preg_match('/\//', $resultant)) {
1012
+ $aresult = explode('/', $resultant);
1013
+ if (isset($aresult[1])) {
1014
+ $aversion = explode(' ', $aresult[1]);
1015
+ $this->setVersion($aversion[0]);
1016
+ }
1017
+ } else {
1018
+ $aversion = explode(' ', stristr($resultant, 'opera mini'));
1019
+ if (isset($aversion[1])) {
1020
+ $this->setVersion($aversion[1]);
1021
+ }
1022
+ }
1023
+ $this->_browser_name = self::BROWSER_OPERA_MINI;
1024
+ $this->setMobile(true);
1025
+ return true;
1026
+ } else if (stripos($this->_agent, 'opera') !== false) {
1027
+ $resultant = stristr($this->_agent, 'opera');
1028
+ if (preg_match('/Version\/(1*.*)$/', $resultant, $matches)) {
1029
+ $this->setVersion($matches[1]);
1030
+ } else if (preg_match('/\//', $resultant)) {
1031
+ $aresult = explode('/', str_replace("(", " ", $resultant));
1032
+ if (isset($aresult[1])) {
1033
+ $aversion = explode(' ', $aresult[1]);
1034
+ $this->setVersion($aversion[0]);
1035
+ }
1036
+ } else {
1037
+ $aversion = explode(' ', stristr($resultant, 'opera'));
1038
+ $this->setVersion(isset($aversion[1]) ? $aversion[1] : "");
1039
+ }
1040
+ if (stripos($this->_agent, 'Opera Mobi') !== false) {
1041
+ $this->setMobile(true);
1042
+ }
1043
+ $this->_browser_name = self::BROWSER_OPERA;
1044
+ return true;
1045
+ } else if (stripos($this->_agent, 'OPR') !== false) {
1046
+ $resultant = stristr($this->_agent, 'OPR');
1047
+ if (preg_match('/\//', $resultant)) {
1048
+ $aresult = explode('/', str_replace("(", " ", $resultant));
1049
+ if (isset($aresult[1])) {
1050
+ $aversion = explode(' ', $aresult[1]);
1051
+ $this->setVersion($aversion[0]);
1052
+ }
1053
+ }
1054
+ if (stripos($this->_agent, 'Mobile') !== false) {
1055
+ $this->setMobile(true);
1056
+ }
1057
+ $this->_browser_name = self::BROWSER_OPERA;
1058
+ return true;
1059
+ }
1060
+ return false;
1061
+ }
1062
+
1063
+ /**
1064
+ * Determine if the browser is Chrome or not (last updated 1.7)
1065
+ * @return boolean True if the browser is Chrome otherwise false
1066
+ */
1067
+ protected function checkBrowserChrome()
1068
+ {
1069
+ if (stripos($this->_agent, 'Chrome') !== false) {
1070
+ $aresult = explode('/', stristr($this->_agent, 'Chrome'));
1071
+ if (isset($aresult[1])) {
1072
+ $aversion = explode(' ', $aresult[1]);
1073
+ $this->setVersion($aversion[0]);
1074
+ $this->setBrowser(self::BROWSER_CHROME);
1075
+ //Chrome on Android
1076
+ if (stripos($this->_agent, 'Android') !== false) {
1077
+ if (stripos($this->_agent, 'Mobile') !== false) {
1078
+ $this->setMobile(true);
1079
+ } else {
1080
+ $this->setTablet(true);
1081
+ }
1082
+ }
1083
+ return true;
1084
+ }
1085
+ }
1086
+ return false;
1087
+ }
1088
+
1089
+
1090
+ /**
1091
+ * Determine if the browser is WebTv or not (last updated 1.7)
1092
+ * @return boolean True if the browser is WebTv otherwise false
1093
+ */
1094
+ protected function checkBrowserWebTv()
1095
+ {
1096
+ if (stripos($this->_agent, 'webtv') !== false) {
1097
+ $aresult = explode('/', stristr($this->_agent, 'webtv'));
1098
+ if (isset($aresult[1])) {
1099
+ $aversion = explode(' ', $aresult[1]);
1100
+ $this->setVersion($aversion[0]);
1101
+ $this->setBrowser(self::BROWSER_WEBTV);
1102
+ return true;
1103
+ }
1104
+ }
1105
+ return false;
1106
+ }
1107
+
1108
+ /**
1109
+ * Determine if the browser is NetPositive or not (last updated 1.7)
1110
+ * @return boolean True if the browser is NetPositive otherwise false
1111
+ */
1112
+ protected function checkBrowserNetPositive()
1113
+ {
1114
+ if (stripos($this->_agent, 'NetPositive') !== false) {
1115
+ $aresult = explode('/', stristr($this->_agent, 'NetPositive'));
1116
+ if (isset($aresult[1])) {
1117
+ $aversion = explode(' ', $aresult[1]);
1118
+ $this->setVersion(str_replace(array('(', ')', ';'), '', $aversion[0]));
1119
+ $this->setBrowser(self::BROWSER_NETPOSITIVE);
1120
+ return true;
1121
+ }
1122
+ }
1123
+ return false;
1124
+ }
1125
+
1126
+ /**
1127
+ * Determine if the browser is Galeon or not (last updated 1.7)
1128
+ * @return boolean True if the browser is Galeon otherwise false
1129
+ */
1130
+ protected function checkBrowserGaleon()
1131
+ {
1132
+ if (stripos($this->_agent, 'galeon') !== false) {
1133
+ $aresult = explode(' ', stristr($this->_agent, 'galeon'));
1134
+ $aversion = explode('/', $aresult[0]);
1135
+ if (isset($aversion[1])) {
1136
+ $this->setVersion($aversion[1]);
1137
+ $this->setBrowser(self::BROWSER_GALEON);
1138
+ return true;
1139
+ }
1140
+ }
1141
+ return false;
1142
+ }
1143
+
1144
+ /**
1145
+ * Determine if the browser is Konqueror or not (last updated 1.7)
1146
+ * @return boolean True if the browser is Konqueror otherwise false
1147
+ */
1148
+ protected function checkBrowserKonqueror()
1149
+ {
1150
+ if (stripos($this->_agent, 'Konqueror') !== false) {
1151
+ $aresult = explode(' ', stristr($this->_agent, 'Konqueror'));
1152
+ $aversion = explode('/', $aresult[0]);
1153
+ if (isset($aversion[1])) {
1154
+ $this->setVersion($aversion[1]);
1155
+ $this->setBrowser(self::BROWSER_KONQUEROR);
1156
+ return true;
1157
+ }
1158
+ }
1159
+ return false;
1160
+ }
1161
+
1162
+ /**
1163
+ * Determine if the browser is iCab or not (last updated 1.7)
1164
+ * @return boolean True if the browser is iCab otherwise false
1165
+ */
1166
+ protected function checkBrowserIcab()
1167
+ {
1168
+ if (stripos($this->_agent, 'icab') !== false) {
1169
+ $aversion = explode(' ', stristr(str_replace('/', ' ', $this->_agent), 'icab'));
1170
+ if (isset($aversion[1])) {
1171
+ $this->setVersion($aversion[1]);
1172
+ $this->setBrowser(self::BROWSER_ICAB);
1173
+ return true;
1174
+ }
1175
+ }
1176
+ return false;
1177
+ }
1178
+
1179
+ /**
1180
+ * Determine if the browser is OmniWeb or not (last updated 1.7)
1181
+ * @return boolean True if the browser is OmniWeb otherwise false
1182
+ */
1183
+ protected function checkBrowserOmniWeb()
1184
+ {
1185
+ if (stripos($this->_agent, 'omniweb') !== false) {
1186
+ $aresult = explode('/', stristr($this->_agent, 'omniweb'));
1187
+ $aversion = explode(' ', isset($aresult[1]) ? $aresult[1] : "");
1188
+ $this->setVersion($aversion[0]);
1189
+ $this->setBrowser(self::BROWSER_OMNIWEB);
1190
+ return true;
1191
+ }
1192
+ return false;
1193
+ }
1194
+
1195
+ /**
1196
+ * Determine if the browser is Phoenix or not (last updated 1.7)
1197
+ * @return boolean True if the browser is Phoenix otherwise false
1198
+ */
1199
+ protected function checkBrowserPhoenix()
1200
+ {
1201
+ if (stripos($this->_agent, 'Phoenix') !== false) {
1202
+ $aversion = explode('/', stristr($this->_agent, 'Phoenix'));
1203
+ if (isset($aversion[1])) {
1204
+ $this->setVersion($aversion[1]);
1205
+ $this->setBrowser(self::BROWSER_PHOENIX);
1206
+ return true;
1207
+ }
1208
+ }
1209
+ return false;
1210
+ }
1211
+
1212
+ /**
1213
+ * Determine if the browser is Firebird or not (last updated 1.7)
1214
+ * @return boolean True if the browser is Firebird otherwise false
1215
+ */
1216
+ protected function checkBrowserFirebird()
1217
+ {
1218
+ if (stripos($this->_agent, 'Firebird') !== false) {
1219
+ $aversion = explode('/', stristr($this->_agent, 'Firebird'));
1220
+ if (isset($aversion[1])) {
1221
+ $this->setVersion($aversion[1]);
1222
+ $this->setBrowser(self::BROWSER_FIREBIRD);
1223
+ return true;
1224
+ }
1225
+ }
1226
+ return false;
1227
+ }
1228
+
1229
+ /**
1230
+ * Determine if the browser is Netscape Navigator 9+ or not (last updated 1.7)
1231
+ * NOTE: (http://browser.netscape.com/ - Official support ended on March 1st, 2008)
1232
+ * @return boolean True if the browser is Netscape Navigator 9+ otherwise false
1233
+ */
1234
+ protected function checkBrowserNetscapeNavigator9Plus()
1235
+ {
1236
+ if (stripos($this->_agent, 'Firefox') !== false && preg_match('/Navigator\/([^ ]*)/i', $this->_agent, $matches)) {
1237
+ $this->setVersion($matches[1]);
1238
+ $this->setBrowser(self::BROWSER_NETSCAPE_NAVIGATOR);
1239
+ return true;
1240
+ } else if (stripos($this->_agent, 'Firefox') === false && preg_match('/Netscape6?\/([^ ]*)/i', $this->_agent, $matches)) {
1241
+ $this->setVersion($matches[1]);
1242
+ $this->setBrowser(self::BROWSER_NETSCAPE_NAVIGATOR);
1243
+ return true;
1244
+ }
1245
+ return false;
1246
+ }
1247
+
1248
+ /**
1249
+ * Determine if the browser is Shiretoko or not (https://wiki.mozilla.org/Projects/shiretoko) (last updated 1.7)
1250
+ * @return boolean True if the browser is Shiretoko otherwise false
1251
+ */
1252
+ protected function checkBrowserShiretoko()
1253
+ {
1254
+ if (stripos($this->_agent, 'Mozilla') !== false && preg_match('/Shiretoko\/([^ ]*)/i', $this->_agent, $matches)) {
1255
+ $this->setVersion($matches[1]);
1256
+ $this->setBrowser(self::BROWSER_SHIRETOKO);
1257
+ return true;
1258
+ }
1259
+ return false;
1260
+ }
1261
+
1262
+ /**
1263
+ * Determine if the browser is Ice Cat or not (http://en.wikipedia.org/wiki/GNU_IceCat) (last updated 1.7)
1264
+ * @return boolean True if the browser is Ice Cat otherwise false
1265
+ */
1266
+ protected function checkBrowserIceCat()
1267
+ {
1268
+ if (stripos($this->_agent, 'Mozilla') !== false && preg_match('/IceCat\/([^ ]*)/i', $this->_agent, $matches)) {
1269
+ $this->setVersion($matches[1]);
1270
+ $this->setBrowser(self::BROWSER_ICECAT);
1271
+ return true;
1272
+ }
1273
+ return false;
1274
+ }
1275
+
1276
+ /**
1277
+ * Determine if the browser is Nokia or not (last updated 1.7)
1278
+ * @return boolean True if the browser is Nokia otherwise false
1279
+ */
1280
+ protected function checkBrowserNokia()
1281
+ {
1282
+ if (preg_match("/Nokia([^\/]+)\/([^ SP]+)/i", $this->_agent, $matches)) {
1283
+ $this->setVersion($matches[2]);
1284
+ if (stripos($this->_agent, 'Series60') !== false || strpos($this->_agent, 'S60') !== false) {
1285
+ $this->setBrowser(self::BROWSER_NOKIA_S60);
1286
+ } else {
1287
+ $this->setBrowser(self::BROWSER_NOKIA);
1288
+ }
1289
+ $this->setMobile(true);
1290
+ return true;
1291
+ }
1292
+ return false;
1293
+ }
1294
+
1295
+ /**
1296
+ * Determine if the browser is Firefox or not (last updated 1.7)
1297
+ * @return boolean True if the browser is Firefox otherwise false
1298
+ */
1299
+ protected function checkBrowserFirefox()
1300
+ {
1301
+ if (stripos($this->_agent, 'safari') === false) {
1302
+ if (preg_match("/Firefox[\/ \(]([^ ;\)]+)/i", $this->_agent, $matches)) {
1303
+ $this->setVersion($matches[1]);
1304
+ $this->setBrowser(self::BROWSER_FIREFOX);
1305
+ //Firefox on Android
1306
+ if (stripos($this->_agent, 'Android') !== false) {
1307
+ if (stripos($this->_agent, 'Mobile') !== false) {
1308
+ $this->setMobile(true);
1309
+ } else {
1310
+ $this->setTablet(true);
1311
+ }
1312
+ }
1313
+ return true;
1314
+ } else if (preg_match("/Firefox$/i", $this->_agent, $matches)) {
1315
+ $this->setVersion("");
1316
+ $this->setBrowser(self::BROWSER_FIREFOX);
1317
+ return true;
1318
+ }
1319
+ }
1320
+ return false;
1321
+ }
1322
+
1323
+ /**
1324
+ * Determine if the browser is Firefox or not (last updated 1.7)
1325
+ * @return boolean True if the browser is Firefox otherwise false
1326
+ */
1327
+ protected function checkBrowserIceweasel()
1328
+ {
1329
+ if (stripos($this->_agent, 'Iceweasel') !== false) {
1330
+ $aresult = explode('/', stristr($this->_agent, 'Iceweasel'));
1331
+ if (isset($aresult[1])) {
1332
+ $aversion = explode(' ', $aresult[1]);
1333
+ $this->setVersion($aversion[0]);
1334
+ $this->setBrowser(self::BROWSER_ICEWEASEL);
1335
+ return true;
1336
+ }
1337
+ }
1338
+ return false;
1339
+ }
1340
+
1341
+ /**
1342
+ * Determine if the browser is Mozilla or not (last updated 1.7)
1343
+ * @return boolean True if the browser is Mozilla otherwise false
1344
+ */
1345
+ protected function checkBrowserMozilla()
1346
+ {
1347
+ if (stripos($this->_agent, 'mozilla') !== false && preg_match('/rv:[0-9].[0-9][a-b]?/i', $this->_agent) && stripos($this->_agent, 'netscape') === false) {
1348
+ $aversion = explode(' ', stristr($this->_agent, 'rv:'));
1349
+ preg_match('/rv:[0-9].[0-9][a-b]?/i', $this->_agent, $aversion);
1350
+ $this->setVersion(str_replace('rv:', '', $aversion[0]));
1351
+ $this->setBrowser(self::BROWSER_MOZILLA);
1352
+ return true;
1353
+ } else if (stripos($this->_agent, 'mozilla') !== false && preg_match('/rv:[0-9]\.[0-9]/i', $this->_agent) && stripos($this->_agent, 'netscape') === false) {
1354
+ $aversion = explode('', stristr($this->_agent, 'rv:'));
1355
+ $this->setVersion(str_replace('rv:', '', $aversion[0]));
1356
+ $this->setBrowser(self::BROWSER_MOZILLA);
1357
+ return true;
1358
+ } else if (stripos($this->_agent, 'mozilla') !== false && preg_match('/mozilla\/([^ ]*)/i', $this->_agent, $matches) && stripos($this->_agent, 'netscape') === false) {
1359
+ $this->setVersion($matches[1]);
1360
+ $this->setBrowser(self::BROWSER_MOZILLA);
1361
+ return true;
1362
+ }
1363
+ return false;
1364
+ }
1365
+
1366
+ /**
1367
+ * Determine if the browser is Lynx or not (last updated 1.7)
1368
+ * @return boolean True if the browser is Lynx otherwise false
1369
+ */
1370
+ protected function checkBrowserLynx()
1371
+ {
1372
+ if (stripos($this->_agent, 'lynx') !== false) {
1373
+ $aresult = explode('/', stristr($this->_agent, 'Lynx'));
1374
+ $aversion = explode(' ', (isset($aresult[1]) ? $aresult[1] : ""));
1375
+ $this->setVersion($aversion[0]);
1376
+ $this->setBrowser(self::BROWSER_LYNX);
1377
+ return true;
1378
+ }
1379
+ return false;
1380
+ }
1381
+
1382
+ /**
1383
+ * Determine if the browser is Amaya or not (last updated 1.7)
1384
+ * @return boolean True if the browser is Amaya otherwise false
1385
+ */
1386
+ protected function checkBrowserAmaya()
1387
+ {
1388
+ if (stripos($this->_agent, 'amaya') !== false) {
1389
+ $aresult = explode('/', stristr($this->_agent, 'Amaya'));
1390
+ if (isset($aresult[1])) {
1391
+ $aversion = explode(' ', $aresult[1]);
1392
+ $this->setVersion($aversion[0]);
1393
+ $this->setBrowser(self::BROWSER_AMAYA);
1394
+ return true;
1395
+ }
1396
+ }
1397
+ return false;
1398
+ }
1399
+
1400
+ /**
1401
+ * Determine if the browser is Safari or not (last updated 1.7)
1402
+ * @return boolean True if the browser is Safari otherwise false
1403
+ */
1404
+ protected function checkBrowserSafari()
1405
+ {
1406
+ if (stripos($this->_agent, 'Safari') !== false
1407
+ && stripos($this->_agent, 'iPhone') === false
1408
+ && stripos($this->_agent, 'iPod') === false
1409
+ ) {
1410
+
1411
+ $aresult = explode('/', stristr($this->_agent, 'Version'));
1412
+ if (isset($aresult[1])) {
1413
+ $aversion = explode(' ', $aresult[1]);
1414
+ $this->setVersion($aversion[0]);
1415
+ } else {
1416
+ $this->setVersion(self::VERSION_UNKNOWN);
1417
+ }
1418
+ $this->setBrowser(self::BROWSER_SAFARI);
1419
+ return true;
1420
+ }
1421
+ return false;
1422
+ }
1423
+
1424
+ protected function checkBrowserSamsung()
1425
+ {
1426
+ if (stripos($this->_agent, 'SamsungBrowser') !== false) {
1427
+
1428
+ $aresult = explode('/', stristr($this->_agent, 'SamsungBrowser'));
1429
+ if (isset($aresult[1])) {
1430
+ $aversion = explode(' ', $aresult[1]);
1431
+ $this->setVersion($aversion[0]);
1432
+ } else {
1433
+ $this->setVersion(self::VERSION_UNKNOWN);
1434
+ }
1435
+ $this->setBrowser(self::BROWSER_SAMSUNG);
1436
+ return true;
1437
+ }
1438
+ return false;
1439
+ }
1440
+
1441
+ protected function checkBrowserSilk()
1442
+ {
1443
+ if (stripos($this->_agent, 'Silk') !== false) {
1444
+ $aresult = explode('/', stristr($this->_agent, 'Silk'));
1445
+ if (isset($aresult[1])) {
1446
+ $aversion = explode(' ', $aresult[1]);
1447
+ $this->setVersion($aversion[0]);
1448
+ } else {
1449
+ $this->setVersion(self::VERSION_UNKNOWN);
1450
+ }
1451
+ $this->setBrowser(self::BROWSER_SILK);
1452
+ return true;
1453
+ }
1454
+ return false;
1455
+ }
1456
+
1457
+ protected function checkBrowserIframely()
1458
+ {
1459
+ if (stripos($this->_agent, 'Iframely') !== false) {
1460
+ $aresult = explode('/', stristr($this->_agent, 'Iframely'));
1461
+ if (isset($aresult[1])) {
1462
+ $aversion = explode(' ', $aresult[1]);
1463
+ $this->setVersion($aversion[0]);
1464
+ } else {
1465
+ $this->setVersion(self::VERSION_UNKNOWN);
1466
+ }
1467
+ $this->setBrowser(self::BROWSER_I_FRAME);
1468
+ return true;
1469
+ }
1470
+ return false;
1471
+ }
1472
+
1473
+ protected function checkBrowserCocoa()
1474
+ {
1475
+ if (stripos($this->_agent, 'CocoaRestClient') !== false) {
1476
+ $aresult = explode('/', stristr($this->_agent, 'CocoaRestClient'));
1477
+ if (isset($aresult[1])) {
1478
+ $aversion = explode(' ', $aresult[1]);
1479
+ $this->setVersion($aversion[0]);
1480
+ } else {
1481
+ $this->setVersion(self::VERSION_UNKNOWN);
1482
+ }
1483
+ $this->setBrowser(self::BROWSER_COCOA);
1484
+ return true;
1485
+ }
1486
+ return false;
1487
+ }
1488
+
1489
+ /**
1490
+ * Detect if URL is loaded from FacebookExternalHit
1491
+ * @return boolean True if it detects FacebookExternalHit otherwise false
1492
+ */
1493
+ protected function checkFacebookExternalHit()
1494
+ {
1495
+ if (stristr($this->_agent, 'FacebookExternalHit')) {
1496
+ $this->setRobot(true);
1497
+ $this->setFacebook(true);
1498
+ return true;
1499
+ }
1500
+ return false;
1501
+ }
1502
+
1503
+ /**
1504
+ * Detect if URL is being loaded from internal Facebook browser
1505
+ * @return boolean True if it detects internal Facebook browser otherwise false
1506
+ */
1507
+ protected function checkForFacebookIos()
1508
+ {
1509
+ if (stristr($this->_agent, 'FBIOS')) {
1510
+ $this->setFacebook(true);
1511
+ return true;
1512
+ }
1513
+ return false;
1514
+ }
1515
+
1516
+ /**
1517
+ * Detect Version for the Safari browser on iOS devices
1518
+ * @return boolean True if it detects the version correctly otherwise false
1519
+ */
1520
+ protected function getSafariVersionOnIos()
1521
+ {
1522
+ $aresult = explode('/', stristr($this->_agent, 'Version'));
1523
+ if (isset($aresult[1])) {
1524
+ $aversion = explode(' ', $aresult[1]);
1525
+ $this->setVersion($aversion[0]);
1526
+ return true;
1527
+ }
1528
+ return false;
1529
+ }
1530
+
1531
+ /**
1532
+ * Detect Version for the Chrome browser on iOS devices
1533
+ * @return boolean True if it detects the version correctly otherwise false
1534
+ */
1535
+ protected function getChromeVersionOnIos()
1536
+ {
1537
+ $aresult = explode('/', stristr($this->_agent, 'CriOS'));
1538
+ if (isset($aresult[1])) {
1539
+ $aversion = explode(' ', $aresult[1]);
1540
+ $this->setVersion($aversion[0]);
1541
+ $this->setBrowser(self::BROWSER_CHROME);
1542
+ return true;
1543
+ }
1544
+ return false;
1545
+ }
1546
+
1547
+ /**
1548
+ * Determine if the browser is iPhone or not (last updated 1.7)
1549
+ * @return boolean True if the browser is iPhone otherwise false
1550
+ */
1551
+ protected function checkBrowseriPhone()
1552
+ {
1553
+ if (stripos($this->_agent, 'iPhone') !== false) {
1554
+ $this->setVersion(self::VERSION_UNKNOWN);
1555
+ $this->setBrowser(self::BROWSER_IPHONE);
1556
+ $this->getSafariVersionOnIos();
1557
+ $this->getChromeVersionOnIos();
1558
+ $this->checkForFacebookIos();
1559
+ $this->setMobile(true);
1560
+ return true;
1561
+
1562
+ }
1563
+ return false;
1564
+ }
1565
+
1566
+ /**
1567
+ * Determine if the browser is iPad or not (last updated 1.7)
1568
+ * @return boolean True if the browser is iPad otherwise false
1569
+ */
1570
+ protected function checkBrowseriPad()
1571
+ {
1572
+ if (stripos($this->_agent, 'iPad') !== false) {
1573
+ $this->setVersion(self::VERSION_UNKNOWN);
1574
+ $this->setBrowser(self::BROWSER_IPAD);
1575
+ $this->getSafariVersionOnIos();
1576
+ $this->getChromeVersionOnIos();
1577
+ $this->checkForFacebookIos();
1578
+ $this->setTablet(true);
1579
+ return true;
1580
+ }
1581
+ return false;
1582
+ }
1583
+
1584
+ /**
1585
+ * Determine if the browser is iPod or not (last updated 1.7)
1586
+ * @return boolean True if the browser is iPod otherwise false
1587
+ */
1588
+ protected function checkBrowseriPod()
1589
+ {
1590
+ if (stripos($this->_agent, 'iPod') !== false) {
1591
+ $this->setVersion(self::VERSION_UNKNOWN);
1592
+ $this->setBrowser(self::BROWSER_IPOD);
1593
+ $this->getSafariVersionOnIos();
1594
+ $this->getChromeVersionOnIos();
1595
+ $this->checkForFacebookIos();
1596
+ $this->setMobile(true);
1597
+ return true;
1598
+ }
1599
+ return false;
1600
+ }
1601
+
1602
+ /**
1603
+ * Determine if the browser is Android or not (last updated 1.7)
1604
+ * @return boolean True if the browser is Android otherwise false
1605
+ */
1606
+ protected function checkBrowserAndroid()
1607
+ {
1608
+ if (stripos($this->_agent, 'Android') !== false) {
1609
+ $aresult = explode(' ', stristr($this->_agent, 'Android'));
1610
+ if (isset($aresult[1])) {
1611
+ $aversion = explode(' ', $aresult[1]);
1612
+ $this->setVersion($aversion[0]);
1613
+ } else {
1614
+ $this->setVersion(self::VERSION_UNKNOWN);
1615
+ }
1616
+ if (stripos($this->_agent, 'Mobile') !== false) {
1617
+ $this->setMobile(true);
1618
+ } else {
1619
+ $this->setTablet(true);
1620
+ }
1621
+ $this->setBrowser(self::BROWSER_ANDROID);
1622
+ return true;
1623
+ }
1624
+ return false;
1625
+ }
1626
+
1627
+ /**
1628
+ * Determine if the browser is Vivaldi
1629
+ * @return boolean True if the browser is Vivaldi otherwise false
1630
+ */
1631
+ protected function checkBrowserVivaldi()
1632
+ {
1633
+ if (stripos($this->_agent, 'Vivaldi') !== false) {
1634
+ $aresult = explode('/', stristr($this->_agent, 'Vivaldi'));
1635
+ if (isset($aresult[1])) {
1636
+ $aversion = explode(' ', $aresult[1]);
1637
+ $this->setVersion($aversion[0]);
1638
+ $this->setBrowser(self::BROWSER_VIVALDI);
1639
+ return true;
1640
+ }
1641
+ }
1642
+ return false;
1643
+ }
1644
+
1645
+ /**
1646
+ * Determine if the browser is Yandex
1647
+ * @return boolean True if the browser is Yandex otherwise false
1648
+ */
1649
+ protected function checkBrowserYandex()
1650
+ {
1651
+ if (stripos($this->_agent, 'YaBrowser') !== false) {
1652
+ $aresult = explode('/', stristr($this->_agent, 'YaBrowser'));
1653
+ if (isset($aresult[1])) {
1654
+ $aversion = explode(' ', $aresult[1]);
1655
+ $this->setVersion($aversion[0]);
1656
+ $this->setBrowser(self::BROWSER_YANDEX);
1657
+
1658
+ if (stripos($this->_agent, 'iPad') !== false) {
1659
+ $this->setTablet(true);
1660
+ } elseif (stripos($this->_agent, 'Mobile') !== false) {
1661
+ $this->setMobile(true);
1662
+ } elseif (stripos($this->_agent, 'Android') !== false) {
1663
+ $this->setTablet(true);
1664
+ }
1665
+
1666
+ return true;
1667
+ }
1668
+ }
1669
+
1670
+ return false;
1671
+ }
1672
+
1673
+ /**
1674
+ * Determine if the browser is a PlayStation
1675
+ * @return boolean True if the browser is PlayStation otherwise false
1676
+ */
1677
+ protected function checkBrowserPlayStation()
1678
+ {
1679
+ if (stripos($this->_agent, 'PlayStation ') !== false) {
1680
+ $aresult = explode(' ', stristr($this->_agent, 'PlayStation '));
1681
+ $this->setBrowser(self::BROWSER_PLAYSTATION);
1682
+ if (isset($aresult[0])) {
1683
+ $aversion = explode(')', $aresult[2]);
1684
+ $this->setVersion($aversion[0]);
1685
+ if (stripos($this->_agent, 'Portable)') !== false || stripos($this->_agent, 'Vita') !== false) {
1686
+ $this->setMobile(true);
1687
+ }
1688
+ return true;
1689
+ }
1690
+ }
1691
+ return false;
1692
+ }
1693
+
1694
+ /**
1695
+ * Determine the user's platform (last updated 2.0)
1696
+ */
1697
+ protected function checkPlatform()
1698
+ {
1699
+ if (stripos($this->_agent, 'windows') !== false) {
1700
+ $this->_platform = self::PLATFORM_WINDOWS;
1701
+ } else if (stripos($this->_agent, 'iPad') !== false) {
1702
+ $this->_platform = self::PLATFORM_IPAD;
1703
+ } else if (stripos($this->_agent, 'iPod') !== false) {
1704
+ $this->_platform = self::PLATFORM_IPOD;
1705
+ } else if (stripos($this->_agent, 'iPhone') !== false) {
1706
+ $this->_platform = self::PLATFORM_IPHONE;
1707
+ } elseif (stripos($this->_agent, 'mac') !== false) {
1708
+ $this->_platform = self::PLATFORM_APPLE;
1709
+ } elseif (stripos($this->_agent, 'android') !== false) {
1710
+ $this->_platform = self::PLATFORM_ANDROID;
1711
+ } elseif (stripos($this->_agent, 'Silk') !== false) {
1712
+ $this->_platform = self::PLATFORM_FIRE_OS;
1713
+ } elseif (stripos($this->_agent, 'linux') !== false && stripos($this->_agent, 'SMART-TV') !== false ) {
1714
+ $this->_platform = self::PLATFORM_LINUX .'/'.self::PLATFORM_SMART_TV;
1715
+ } elseif (stripos($this->_agent, 'linux') !== false) {
1716
+ $this->_platform = self::PLATFORM_LINUX;
1717
+ } else if (stripos($this->_agent, 'Nokia') !== false) {
1718
+ $this->_platform = self::PLATFORM_NOKIA;
1719
+ } else if (stripos($this->_agent, 'BlackBerry') !== false) {
1720
+ $this->_platform = self::PLATFORM_BLACKBERRY;
1721
+ } elseif (stripos($this->_agent, 'FreeBSD') !== false) {
1722
+ $this->_platform = self::PLATFORM_FREEBSD;
1723
+ } elseif (stripos($this->_agent, 'OpenBSD') !== false) {
1724
+ $this->_platform = self::PLATFORM_OPENBSD;
1725
+ } elseif (stripos($this->_agent, 'NetBSD') !== false) {
1726
+ $this->_platform = self::PLATFORM_NETBSD;
1727
+ } elseif (stripos($this->_agent, 'OpenSolaris') !== false) {
1728
+ $this->_platform = self::PLATFORM_OPENSOLARIS;
1729
+ } elseif (stripos($this->_agent, 'SunOS') !== false) {
1730
+ $this->_platform = self::PLATFORM_SUNOS;
1731
+ } elseif (stripos($this->_agent, 'OS\/2') !== false) {
1732
+ $this->_platform = self::PLATFORM_OS2;
1733
+ } elseif (stripos($this->_agent, 'BeOS') !== false) {
1734
+ $this->_platform = self::PLATFORM_BEOS;
1735
+ } elseif (stripos($this->_agent, 'win') !== false) {
1736
+ $this->_platform = self::PLATFORM_WINDOWS;
1737
+ } elseif (stripos($this->_agent, 'Playstation') !== false) {
1738
+ $this->_platform = self::PLATFORM_PLAYSTATION;
1739
+ } elseif (stripos($this->_agent, 'Roku') !== false) {
1740
+ $this->_platform = self::PLATFORM_ROKU;
1741
+ } elseif (stripos($this->_agent, 'iOS') !== false) {
1742
+ $this->_platform = self::PLATFORM_IPHONE . '/' . self::PLATFORM_IPAD;
1743
+ } elseif (stripos($this->_agent, 'tvOS') !== false) {
1744
+ $this->_platform = self::PLATFORM_APPLE_TV;
1745
+ } elseif (stripos($this->_agent, 'curl') !== false) {
1746
+ $this->_platform = self::PLATFORM_TERMINAL;
1747
+ } elseif (stripos($this->_agent, 'CrOS') !== false) {
1748
+ $this->_platform = self::PLATFORM_CHROME_OS;
1749
+ } elseif (stripos($this->_agent, 'okhttp') !== false) {
1750
+ $this->_platform = self::PLATFORM_JAVA_ANDROID;
1751
+ } elseif (stripos($this->_agent, 'PostmanRuntime') !== false) {
1752
+ $this->_platform = self::PLATFORM_POSTMAN;
1753
+ } elseif (stripos($this->_agent, 'Iframely') !== false) {
1754
+ $this->_platform = self::PLATFORM_I_FRAME;
1755
+ }
1756
+ }
1757
+ }
core/lib/class-itsec-lib-directory.php CHANGED
@@ -138,7 +138,7 @@ if ( ! class_exists( 'ITSEC_Lib_Directory' ) ) {
138
 
139
  $parent = dirname( $dir );
140
 
141
- while ( ! empty( $parent ) && ( ! self::is_dir( $parent ) ) ) {
142
  $parent = dirname( $parent );
143
  }
144
 
138
 
139
  $parent = dirname( $dir );
140
 
141
+ while ( ! empty( $parent ) && ! self::is_dir( $parent ) && dirname( $parent ) !== $parent ) {
142
  $parent = dirname( $parent );
143
  }
144
 
core/lib/class-itsec-lib-fingerprinting.php ADDED
@@ -0,0 +1,193 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once( dirname( __FILE__ ) . '/fingerprinting/class-itsec-fingerprint.php' );
4
+ require_once( dirname( __FILE__ ) . '/fingerprinting/class-itsec-fingerprint-comparison.php' );
5
+ require_once( dirname( __FILE__ ) . '/fingerprinting/class-itsec-fingerprint-value.php' );
6
+ require_once( dirname( __FILE__ ) . '/fingerprinting/interface-itsec-fingerprint-source.php' );
7
+
8
+ class ITSEC_Lib_Fingerprinting {
9
+
10
+ /** @var ITSEC_Fingerprint_Source[] */
11
+ private static $sources;
12
+
13
+ /** @var ITSEC_Fingerprint */
14
+ private static $_current_fingerprint = false;
15
+
16
+ /**
17
+ * Check if the global fingerprint has a matching fingerprint.
18
+ *
19
+ * @param WP_User|int|string|false $user WP User instance, User ID, Username, or false for current user.
20
+ *
21
+ * @return ITSEC_Fingerprint_Comparison|null Null if user has no fingerprints stored.
22
+ */
23
+ public static function check_global_state_fingerprint_for_match( $user = false ) {
24
+
25
+ $fingerprint = self::calculate_fingerprint_from_global_state( $user );
26
+
27
+ return self::check_for_match( $fingerprint );
28
+ }
29
+
30
+ /**
31
+ * Calculate the current fingerprint from global state.
32
+ *
33
+ * @param WP_User|int|string|false $user WP User instance, User ID, Username, or false for current user.
34
+ *
35
+ * @return ITSEC_Fingerprint
36
+ */
37
+ public static function calculate_fingerprint_from_global_state( $user = false ) {
38
+
39
+ $values = array();
40
+
41
+ foreach ( self::get_sources() as $source ) {
42
+ if ( $value = $source->calculate_value_from_global_state() ) {
43
+ $values[] = $value;
44
+ }
45
+ }
46
+
47
+ return new ITSEC_Fingerprint(
48
+ ITSEC_Lib::get_user( $user ),
49
+ new DateTime( '@' . ITSEC_Core::get_current_time_gmt(), new DateTimeZone( 'UTC' ) ),
50
+ $values
51
+ );
52
+ }
53
+
54
+ /**
55
+ * Get the current *stored* fingerprint for this page load.
56
+ *
57
+ * This function is cached for the duration of the request.
58
+ *
59
+ * @return ITSEC_Fingerprint|null
60
+ */
61
+ public static function get_current_fingerprint() {
62
+
63
+ if ( ! self::applies_to_user() ) {
64
+ return null;
65
+ }
66
+
67
+ if ( false === self::$_current_fingerprint ) {
68
+ self::$_current_fingerprint = self::get_stored_fingerprint( self::calculate_fingerprint_from_global_state() );
69
+ }
70
+
71
+ return self::$_current_fingerprint;
72
+ }
73
+
74
+ /**
75
+ * Check if their is an approved or auto-approved fingerprint matching the current fingerprint for this page load.
76
+ *
77
+ * @return bool
78
+ */
79
+ public static function is_current_fingerprint_safe() {
80
+
81
+ $fingerprint = self::get_current_fingerprint();
82
+
83
+ return $fingerprint && ( $fingerprint->is_approved() || $fingerprint->is_auto_approved() );
84
+ }
85
+
86
+ /**
87
+ * Get the matching stored fingerprint for a fingerprint built from global state.
88
+ *
89
+ * @param ITSEC_Fingerprint $global_state_fingerprint
90
+ *
91
+ * @return ITSEC_Fingerprint|null
92
+ */
93
+ public static function get_stored_fingerprint( ITSEC_Fingerprint $global_state_fingerprint ) {
94
+
95
+ if ( ! $global_state_fingerprint->calculate_hash() ) {
96
+ return null;
97
+ }
98
+
99
+ return ITSEC_Fingerprint::get_by_hash( $global_state_fingerprint->get_user(), $global_state_fingerprint->calculate_hash() );
100
+ }
101
+
102
+ /**
103
+ * Check if there is a match for the given fingerprint.
104
+ *
105
+ * @param ITSEC_Fingerprint $maybe_fingerprint
106
+ *
107
+ * @return ITSEC_Fingerprint_Comparison|null Null if user has no safe fingerprints.
108
+ */
109
+ public static function check_for_match( ITSEC_Fingerprint $maybe_fingerprint ) {
110
+
111
+ $fingerprints = self::get_user_fingerprints( $maybe_fingerprint->get_user(), array(
112
+ 'status' => array( ITSEC_Fingerprint::S_AUTO_APPROVED, ITSEC_Fingerprint::S_APPROVED ),
113
+ ) );
114
+
115
+ /** @var ITSEC_Fingerprint_Comparison|null $max */
116
+ $max = null;
117
+
118
+ foreach ( $fingerprints as $fingerprint ) {
119
+ $comparison = $fingerprint->compare( $maybe_fingerprint );
120
+
121
+ if ( ! $max || $comparison->get_match_percent() > $max->get_match_percent() ) {
122
+ $max = $comparison;
123
+ }
124
+ }
125
+
126
+ return $max;
127
+ }
128
+
129
+ /**
130
+ * Get a user's fingerprints.
131
+ *
132
+ * @param WP_User|int|string|false $user WP User instance, User ID, Username, or false for current user.
133
+ * @param array $args Additional args.
134
+ *
135
+ * @return ITSEC_Fingerprint[]
136
+ */
137
+ public static function get_user_fingerprints( $user = false, $args = array() ) {
138
+
139
+ if ( ! $user = ITSEC_Lib::get_user( $user ) ) {
140
+ return array();
141
+ }
142
+
143
+ if ( ! is_array( $args ) ) {
144
+ return array();
145
+ }
146
+
147
+ return ITSEC_Fingerprint::get_all_for_user( $user, $args );
148
+ }
149
+
150
+ /**
151
+ * Whether fingerprinting applies to the given user.
152
+ *
153
+ * @param WP_User|int|string|false $user
154
+ *
155
+ * @return bool
156
+ */
157
+ public static function applies_to_user( $user = false ) {
158
+
159
+ if ( ! $role = ITSEC_Modules::get_setting( 'fingerprinting', 'role' ) ) {
160
+ return false;
161
+ }
162
+
163
+ require_once( ITSEC_Core::get_core_dir() . 'lib/class-itsec-lib-canonical-roles.php' );
164
+
165
+ return ITSEC_Lib_Canonical_Roles::is_user_at_least( $role, $user );
166
+ }
167
+
168
+ /**
169
+ * Get the fingerprint sources.
170
+ *
171
+ * @internal
172
+ *
173
+ * @return ITSEC_Fingerprint_Source[]
174
+ */
175
+ public static function get_sources() {
176
+ if ( ! self::$sources ) {
177
+ $sources = array();
178
+
179
+ /**
180
+ * Filter the available fingerprint sources.
181
+ *
182
+ * @param ITSEC_Fingerprint_Source[] $sources
183
+ */
184
+ $sources = apply_filters( 'itsec_fingerprint_sources', $sources );
185
+
186
+ foreach ( $sources as $source ) {
187
+ self::$sources[ $source->get_slug() ] = $source;
188
+ }
189
+ }
190
+
191
+ return self::$sources;
192
+ }
193
+ }
core/lib/class-itsec-lib-geolocation.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once( dirname( __FILE__ ) . '/geolocation/interface-itsec-geolocator.php' );
4
+ require_once( dirname( __FILE__ ) . '/geolocation/class-itsec-geolocator-chain.php' );
5
+ require_once( dirname( __FILE__ ) . '/geolocation/class-itsec-geolocator-page-cache.php' );
6
+
7
+ class ITSEC_Lib_Geolocation {
8
+
9
+ /** @var ITSEC_Geolocator */
10
+ private static $geolocator;
11
+
12
+ /**
13
+ * Geolocate an IP address.
14
+ *
15
+ * @param string $ip
16
+ *
17
+ * @return array|WP_Error With 'lat', 'long', 'label' and 'credit' fields. Label and credit ARE safe, but may contain limited HTML like <a> tags.
18
+ */
19
+ public static function geolocate( $ip ) {
20
+
21
+ require_once( ITSEC_Core::get_core_dir() . 'lib/class-itsec-lib-ip-tools.php' );
22
+
23
+ if ( ! ITSEC_Lib_IP_Tools::validate( $ip ) ) {
24
+ return new WP_Error( 'itsec_geolocate_invalid_ip', esc_html__( 'Tried to geolocate an invalid IP address.', 'better-wp-security' ) );
25
+ }
26
+
27
+ if ( ! filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE ) ) {
28
+ return new WP_Error( 'itsec_geolocate_private_ip', esc_html__( 'Tried to geolocate a private IP address.', 'better-wp-security' ) );
29
+ }
30
+
31
+ return self::get_geolocator()->geolocate( $ip );
32
+ }
33
+
34
+ /**
35
+ * Get the geolocator.
36
+ *
37
+ * @return ITSEC_Geolocator
38
+ */
39
+ private static function get_geolocator() {
40
+ if ( null === self::$geolocator ) {
41
+ $geolocator = new ITSEC_Geolocator_Chain( self::get_geolocator_apis() );
42
+
43
+ /**
44
+ * Filter the Geolocator uses to geolocate IPs.
45
+ *
46
+ * @param ITSEC_Geolocator $geolocator
47
+ */
48
+ $geolocator = apply_filters( 'itsec_geolocator', $geolocator );
49
+
50
+ self::$geolocator = new ITSEC_Geolocator_Page_Cache( $geolocator );
51
+ }
52
+
53
+ return self::$geolocator;
54
+ }
55
+
56
+ /**
57
+ * Get a list of geolocators.
58
+ *
59
+ * @return ITSEC_Geolocator[]
60
+ */
61
+ private static function get_geolocator_apis() {
62
+ /**
63
+ * Get all API powered Geolocators.
64
+ *
65
+ * @param ITSEC_Geolocator[] $geolocaators
66
+ */
67
+ return apply_filters( 'itsec_geolocator_apis', array() );
68
+ }
69
+ }
core/lib/class-itsec-lib-login-interstitial.php CHANGED
@@ -37,7 +37,7 @@ class ITSEC_Lib_Login_Interstitial {
37
 
38
  $this->registered = wp_list_sort( $this->registered, 'priority', 'ASC', true );
39
 
40
- add_action( 'wp_login', array( $this, 'wp_login' ), 10, 2 );
41
  add_action( 'wp_login_errors', array( $this, 'handle_token_expired' ) );
42
  add_action( 'login_init', array( $this, 'force_interstitial' ) );
43
  add_action( 'login_form', array( $this, 'ferry_after_login' ) );
@@ -275,6 +275,9 @@ class ITSEC_Lib_Login_Interstitial {
275
  update_user_meta( $user->ID, '_itsec_has_logged_in', ITSEC_Core::get_current_time_gmt() );
276
  }
277
 
 
 
 
278
  /**
279
  * Fires when a user is re-logged back in after submitting an interstitial.
280
  *
37
 
38
  $this->registered = wp_list_sort( $this->registered, 'priority', 'ASC', true );
39
 
40
+ add_action( 'wp_login', array( $this, 'wp_login' ), -1000, 2 );
41
  add_action( 'wp_login_errors', array( $this, 'handle_token_expired' ) );
42
  add_action( 'login_init', array( $this, 'force_interstitial' ) );
43
  add_action( 'login_form', array( $this, 'ferry_after_login' ) );
275
  update_user_meta( $user->ID, '_itsec_has_logged_in', ITSEC_Core::get_current_time_gmt() );
276
  }
277
 
278
+ remove_action( 'wp_login', array( $this, 'wp_login' ), - 1000 );
279
+ do_action( 'wp_login', $user->user_login, $user );
280
+
281
  /**
282
  * Fires when a user is re-logged back in after submitting an interstitial.
283
  *
core/lib/class-itsec-lib-static-map-api.php ADDED
@@ -0,0 +1,171 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once( dirname( __FILE__ ) . '/static-map-api/interface-itsec-static-map-api.php' );
4
+
5
+ /**
6
+ * Class ITSEC_Lib_Static_Map_API
7
+ */
8
+ class ITSEC_Lib_Static_Map_API {
9
+
10
+ /** @var ITSEC_Static_Map_API */
11
+ private static $api;
12
+
13
+ /**
14
+ * Get the map.
15
+ *
16
+ * Sizing: If only one dimension is specified, it will scale the image proportionally.
17
+ *
18
+ * @param array $config {
19
+ * Configuration array.
20
+ *
21
+ * @type float $lat Latitude.
22
+ * @type float $long Longitude.
23
+ * @type int $width Desired width of the image.
24
+ * @type int $height Desired height of the image.
25
+ * }
26
+ *
27
+ * @return string|WP_Error The URL to the file, or a WP Error object.
28
+ */
29
+ public static function get_map( $config ) {
30
+
31
+ if ( ! is_array( $config ) || ! isset( $config['lat'], $config['long'] ) || ! is_numeric( $config['lat'] ) || ! is_numeric( $config['long'] ) ) {
32
+ return new WP_Error( 'itsec-static-map-api-invalid-config', __( 'Invalid configuration for retrieving a static map image.', 'better-wp-security' ) );
33
+ }
34
+
35
+ if ( ! self::get_api() ) {
36
+ return new WP_Error( 'itsec-static-map-api-no-providers', __( 'No provider was found to generate a static map image.', 'better-wp-security' ) );
37
+ }
38
+
39
+ if ( is_wp_error( $file = self::get_cached_map_or_fetch( $config ) ) ) {
40
+ return $file;
41
+ }
42
+
43
+ return ITSEC_Lib::get_url_from_file( $file );
44
+ }
45
+
46
+ /**
47
+ * Get the resized map file.
48
+ *
49
+ * @param string $file Path to the full size image.
50
+ * @param array $config
51
+ *
52
+ * @return string|WP_Error Either the path to the resized file or a WP_Error.
53
+ */
54
+ private static function get_resized_map( $file, array $config ) {
55
+
56
+ $width = isset( $config['width'] ) ? (int) $config['width'] : null;
57
+ $height = isset( $config['height'] ) ? (int) $config['height'] : null;
58
+
59
+ if ( $width > 1000 || $height > 1000 ) {
60
+ return new WP_Error( 'itsec-static-map-api-invalid-resize-dimensions', __( 'Maximum map dimensions is 1000px.', 'better-wp-security' ) );
61
+ }
62
+
63
+ $f_info = pathinfo( $file );
64
+ $f_info['dirname'] = trailingslashit( $f_info['dirname'] );
65
+
66
+ $filename_resized = "{$f_info['dirname']}{$f_info['filename']}-{$width}x{$height}.{$f_info['extension']}";
67
+
68
+ if ( file_exists( $filename_resized ) ) {
69
+ return $filename_resized;
70
+ }
71
+
72
+ $editor = wp_get_image_editor( $file );
73
+
74
+ if ( is_wp_error( $editor ) ) {
75
+ return $editor;
76
+ }
77
+
78
+ // We're treating everything as @2x.
79
+ if ( is_wp_error( $resized = $editor->resize( $width ? $width * 2 : null, $height ? $height * 2 : null, true ) ) ) {
80
+ return $resized;
81
+ }
82
+
83
+ $saved = $editor->save( $filename_resized );
84
+
85
+ if ( is_wp_error( $saved ) ) {
86
+ return $saved;
87
+ }
88
+
89
+ return $filename_resized;
90
+ }
91
+
92
+ /**
93
+ * Get a cached map image or fetch.
94
+ *
95
+ * @param array $config
96
+ *
97
+ * @return string|WP_Error
98
+ */
99
+ private static function get_cached_map_or_fetch( array $config ) {
100
+
101
+ $dir = trailingslashit( ITSEC_Core::get_storage_dir( 'static-map', true ) );
102
+ $key = wp_hash( $config['lat'] . $config['long'] );
103
+
104
+ if ( isset( $config['width'] ) || isset( $config['height'] ) ) {
105
+ $key .= sprintf( '-%sx%s', isset( $config['width'] ) ? $config['width'] : 1000, isset( $config['height'] ) ? $config['height'] : 1000 );
106
+ }
107
+
108
+ $file_name = "{$key}.png";
109
+
110
+ if ( ! file_exists( $dir . $file_name ) ) {
111
+ $url = self::get_api()->get_map( $config );
112
+
113
+ if ( ! function_exists( 'download_url' ) ) {
114
+ require_once( ABSPATH . 'wp-admin/includes/file.php' );
115
+ }
116
+
117
+ if ( ! function_exists( 'download_url' ) ) {
118
+ return new WP_Error( 'itsec-static-map-api-file-cache-no-download-url', __( 'The download_url() function was not found.', 'better-wp-security' ) );
119
+ }
120
+
121
+ $temp = download_url( $url );
122
+
123
+ if ( is_wp_error( $temp ) ) {
124
+ return $temp;
125
+ }
126
+
127
+ $checked = wp_check_filetype_and_ext( $temp, $file_name, array( 'png' => 'image/png' ) );
128
+
129
+ if ( 'image/png' !== $checked['type'] ) {
130
+ return $url;
131
+ }
132
+
133
+ rename( $temp, $dir . $file_name );
134
+ }
135
+
136
+ return $dir . $file_name;
137
+ }
138
+
139
+ /**
140
+ * Get the static map API
141
+ *
142
+ * @return ITSEC_Static_Map_API
143
+ */
144
+ private static function get_api() {
145
+ if ( null === self::$api ) {
146
+ foreach ( self::get_apis() as $api ) {
147
+ if ( $api->is_available() ) {
148
+ self::$api = $api;
149
+ break;
150
+ }
151
+ }
152
+ }
153
+
154
+ return self::$api;
155
+ }
156
+
157
+ /**
158
+ * Get the static map API providers.
159
+ *
160
+ * @return ITSEC_Static_Map_API[]
161
+ */
162
+ private static function get_apis() {
163
+
164
+ /**
165
+ * Filter the static map API providers.
166
+ *
167
+ * @param $apis ITSEC_Static_Map_API[]
168
+ */
169
+ return apply_filters( 'itsec_static_map_apis', array() );
170
+ }
171
+ }
core/lib/class-itsec-mail.php CHANGED
@@ -219,15 +219,19 @@ final class ITSEC_Mail {
219
  $this->add_html( $lockouts, 'file-change-summary' );
220
  }
221
 
222
- public function add_button( $link_text, $href ) {
223
- $this->add_html( $this->get_button( $link_text, $href ) );
224
  }
225
 
226
- public function get_button( $link_text, $href ) {
227
 
228
  $module = $this->get_template( 'module-button.html' );
229
- $module = $this->replace( $module, 'href', $href );
230
- $module = $this->replace( $module, 'link_text', $link_text );
 
 
 
 
231
 
232
  return $module;
233
  }
@@ -267,18 +271,19 @@ final class ITSEC_Mail {
267
  *
268
  * @param string[] $headers
269
  * @param array[] $entries
 
270
  */
271
- public function add_table( $headers, $entries ) {
272
- $this->add_html( $this->get_table( $headers, $entries ) );
273
  }
274
 
275
- public function get_table( $headers, $entries ) {
276
 
277
  $template = $this->get_template( 'table.html' );
278
- $html = $this->build_table_header( $headers );
279
 
280
  foreach ( $entries as $entry ) {
281
- $html .= $this->build_table_row( $entry, count( $headers ) );
282
  }
283
 
284
  return $this->replace( $template, 'html', $html );
@@ -288,15 +293,24 @@ final class ITSEC_Mail {
288
  * Build the table header.
289
  *
290
  * @param array $headers
 
291
  *
292
  * @return string
293
  */
294
- private function build_table_header( $headers ) {
295
 
296
  $html = '<tr>';
297
 
298
  foreach ( $headers as $header ) {
299
- $html .= '<th style="text-align: left;font-weight: bold;padding:5px 10px;border:1px solid #cdcece;color: #666f72;">';
 
 
 
 
 
 
 
 
300
  $html .= $header;
301
  $html .= '</th>';
302
  }
@@ -311,15 +325,16 @@ final class ITSEC_Mail {
311
  *
312
  * @param array|string $columns
313
  * @param int $count
 
314
  *
315
  * @return string
316
  */
317
- private function build_table_row( $columns, $count ) {
318
  $html = '<tr>';
319
 
320
  if ( is_array( $columns ) ) {
321
  foreach ( $columns as $i => $column ) {
322
- $style = 'border:1px solid #cdcece;padding:10px;';
323
 
324
  if ( 0 === $i ) {
325
  $style .= 'font-style:italic;';
@@ -328,6 +343,12 @@ final class ITSEC_Mail {
328
  $el = 'td';
329
  }
330
 
 
 
 
 
 
 
331
  $html .= "<{$el} style=\"{$style}\">";
332
  $html .= $column;
333
  $html .= "</{$el}>";
@@ -369,6 +390,26 @@ final class ITSEC_Mail {
369
  return "<li style=\"margin: 0; padding: 5px 10px;{$bold_tag}\">{$item}</li>";
370
  }
371
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
372
  /**
373
  * Add a section of HTML to the email.
374
  *
219
  $this->add_html( $lockouts, 'file-change-summary' );
220
  }
221
 
222
+ public function add_button( $link_text, $href, $style = 'default' ) {
223
+ $this->add_html( $this->get_button( $link_text, $href, $style ) );
224
  }
225
 
226
+ public function get_button( $link_text, $href, $style = 'default' ) {
227
 
228
  $module = $this->get_template( 'module-button.html' );
229
+ $module = $this->replace_all( $module, array(
230
+ 'href' => $href,
231
+ 'link_text' => $link_text,
232
+ 'bk_color' => 'blue' === $style ? '#0085E0' : '#FFCD08',
233
+ 'txt_color' => 'blue' === $style ? '#FFFFFF' : '#2E280E',
234
+ ) );
235
 
236
  return $module;
237
  }
271
  *
272
  * @param string[] $headers
273
  * @param array[] $entries
274
+ * @param bool $large
275
  */
276
+ public function add_table( $headers, $entries, $large = false ) {
277
+ $this->add_html( $this->get_table( $headers, $entries, $large ) );
278
  }
279
 
280
+ public function get_table( $headers, $entries, $large = false ) {
281
 
282
  $template = $this->get_template( 'table.html' );
283
+ $html = $this->build_table_header( $headers, $large );
284
 
285
  foreach ( $entries as $entry ) {
286
+ $html .= $this->build_table_row( $entry, count( $headers ), $large );
287
  }
288
 
289
  return $this->replace( $template, 'html', $html );
293
  * Build the table header.
294
  *
295
  * @param array $headers
296
+ * @param bool $large
297
  *
298
  * @return string
299
  */
300
+ private function build_table_header( $headers, $large = false ) {
301
 
302
  $html = '<tr>';
303
 
304
  foreach ( $headers as $header ) {
305
+ $style = 'text-align: left;font-weight: bold;border:1px solid #cdcece;color: #666f72;';
306
+
307
+ if ( $large ) {
308
+ $style .= 'padding:15px 20px;font-size: 16px;';
309
+ } else {
310
+ $style .= 'padding:5px 10px;';
311
+ }
312
+
313
+ $html .= '<th style="' . $style .'">';
314
  $html .= $header;
315
  $html .= '</th>';
316
  }
325
  *
326
  * @param array|string $columns
327
  * @param int $count
328
+ * @param bool $large
329
  *
330
  * @return string
331
  */
332
+ private function build_table_row( $columns, $count, $large = false ) {
333
  $html = '<tr>';
334
 
335
  if ( is_array( $columns ) ) {
336
  foreach ( $columns as $i => $column ) {
337
+ $style = 'border:1px solid #cdcece;';
338
 
339
  if ( 0 === $i ) {
340
  $style .= 'font-style:italic;';
343
  $el = 'td';
344
  }
345
 
346
+ if ( $large ) {
347
+ $style .= 'padding: 15px 20px;';
348
+ } else {
349
+ $style .= 'padding:10px;';
350
+ }
351
+
352
  $html .= "<{$el} style=\"{$style}\">";
353
  $html .= $column;
354
  $html .= "</{$el}>";
390
  return "<li style=\"margin: 0; padding: 5px 10px;{$bold_tag}\">{$item}</li>";
391
  }
392
 
393
+ /**
394
+ * Add an image to the email.
395
+ *
396
+ * @param string $src URL of the image.
397
+ * @param int $width Max width of the image in pixels.
398
+ */
399
+ public function add_image( $src, $width ) {
400
+ $this->add_html( $this->get_image( $src, $width ) );
401
+ }
402
+
403
+ public function get_image( $src, $width ) {
404
+ $module = $this->get_template( 'image.html' );
405
+ $module = $this->replace_all( $module, array(
406
+ 'src' => $src,
407
+ 'width' => $width,
408
+ ) );
409
+
410
+ return $module;
411
+ }
412
+
413
  /**
414
  * Add a section of HTML to the email.
415
  *
core/lib/fingerprinting/class-itsec-fingerprint-comparison.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class ITSEC_Fingerprint_Comparison
5
+ */
6
+ final class ITSEC_Fingerprint_Comparison {
7
+
8
+ /** @var ITSEC_Fingerprint */
9
+ private $known;
10
+
11
+ /** @var ITSEC_Fingerprint */
12
+ private $unknown;
13
+
14
+ /** @var int|float */
15
+ private $match_percent;
16
+
17
+ /** @var array */
18
+ private $scores;
19
+
20
+ /**
21
+ * ITSEC_Fingerprint_Comparison constructor.
22
+ *
23
+ * @param ITSEC_Fingerprint $known
24
+ * @param ITSEC_Fingerprint $unknown
25
+ * @param float|int $match_percent
26
+ * @param array $scores
27
+ */
28
+ public function __construct( ITSEC_Fingerprint $known, ITSEC_Fingerprint $unknown, $match_percent, array $scores ) {
29
+ $this->known = $known;
30
+ $this->unknown = $unknown;
31
+ $this->match_percent = $match_percent;
32
+ $this->scores = $scores;
33
+ }
34
+
35
+ /**
36
+ * @return ITSEC_Fingerprint
37
+ */
38
+ public function get_known() {
39
+ return $this->known;
40
+ }
41
+
42
+ /**
43
+ * @return ITSEC_Fingerprint
44
+ */
45
+ public function get_unknown() {
46
+ return $this->unknown;
47
+ }
48
+
49
+ /**
50
+ * @return float|int
51
+ */
52
+ public function get_match_percent() {
53
+ return $this->match_percent;
54
+ }
55
+
56
+ /**
57
+ * Get the raw score evaluation
58
+ *
59
+ * @return array
60
+ */
61
+ public function get_scores() {
62
+ return $this->scores;
63
+ }
64
+ }
core/lib/fingerprinting/class-itsec-fingerprint-value.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class ITSEC_Fingerprint_Value
5
+ */
6
+ final class ITSEC_Fingerprint_Value {
7
+
8
+ /** @var ITSEC_Fingerprint_Source */
9
+ private $source;
10
+
11
+ /** @var mixed */
12
+ private $value;
13
+
14
+ /**
15
+ * ITSEC_Fingerprint_Source_Value constructor.
16
+ *
17
+ * @param ITSEC_Fingerprint_Source $source
18
+ * @param mixed $value
19
+ */
20
+ public function __construct( ITSEC_Fingerprint_Source $source, $value ) {
21
+ $this->source = $source;
22
+ $this->value = $value;
23
+ }
24
+
25
+ /**
26
+ * Get the source type.
27
+ *
28
+ * @return ITSEC_Fingerprint_Source
29
+ */
30
+ public function get_source() {
31
+ return $this->source;
32
+ }
33
+
34
+ /**
35
+ * Get the value.
36
+ *
37
+ * @return mixed
38
+ */
39
+ public function get_value() {
40
+ return $this->value;
41
+ }
42
+ }
core/lib/fingerprinting/class-itsec-fingerprint.php ADDED
@@ -0,0 +1,699 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class ITSEC_Fingerprint
5
+ */
6
+ class ITSEC_Fingerprint {
7
+
8
+ const S_APPROVED = 'approved';
9
+ const S_AUTO_APPROVED = 'auto-approved';
10
+ const S_PENDING_AUTO_APPROVE = 'pending-auto-approve';
11
+ const S_PENDING = 'pending';
12
+ const S_DENIED = 'denied';
13
+
14
+ /** @var WP_User */
15
+ private $user;
16
+
17
+ /** @var DateTime */
18
+ private $created_at;
19
+
20
+ /** @var ITSEC_Fingerprint_Value[] */
21
+ private $values = array();
22
+
23
+ /** @var int */
24
+ private $_id;
25
+
26
+ /** @var int */
27
+ private $_uses = 0;
28
+
29
+ /** @var string */
30
+ private $_status = self::S_PENDING;
31
+
32
+ /** @var string */
33
+ private $_uuid;
34
+
35
+ /** @var DateTime */
36
+ private $_last_seen;
37
+
38
+ /** @var DateTime */
39
+ private $_approved_at;
40
+
41
+ /** @var string */
42
+ private $_hash;
43
+
44
+ /** @var array */
45
+ private $_snapshot = array();
46
+
47
+ /**
48
+ * ITSEC_Fingerprint constructor.
49
+ *
50
+ * @param WP_User $user
51
+ * @param DateTime $time
52
+ * @param ITSEC_Fingerprint_Value[] $values
53
+ */
54
+ public function __construct( WP_User $user, DateTime $time, array $values ) {
55
+ $this->user = $user;
56
+ $this->created_at = $this->_last_seen = $time;
57
+
58
+ foreach ( $values as $value ) {
59
+ $this->values[ $value->get_source()->get_slug() ] = $value;
60
+ }
61
+ }
62
+
63
+ /**
64
+ * Compare this fingerprint with another fingerprint.
65
+ *
66
+ * The operation is not commutative, if a source is missing in the given fingerprint that is present in the current fingerprint,
67
+ * it will count as a 0 score, whereas when the given fingerprint has extra source values, those will not impact the score.
68
+ *
69
+ * @param ITSEC_Fingerprint $fingerprint
70
+ *
71
+ * @return ITSEC_Fingerprint_Comparison
72
+ */
73
+ public function compare( ITSEC_Fingerprint $fingerprint ) {
74
+ $scores = array();
75
+ $total_weight = 0;
76
+
77
+ foreach ( $this->values as $value ) {
78
+ $source = $value->get_source();
79
+ $other = $fingerprint->values[ $source->get_slug() ];
80
+ $weight = $source->get_weight( $value );
81
+
82
+ if ( $other ) {
83
+ $scores[ $source->get_slug() ] = array(
84
+ 'score' => $source->compare( $value, $other ),
85
+ 'weight' => $weight,
86
+ );
87
+ } else {
88
+ $scores[ $source->get_slug() ] = array(
89
+ 'score' => 0,
90
+ 'weight' => $weight,
91
+ );
92
+ }
93
+
94
+ $total_weight += $weight;
95
+ }
96
+
97
+ $final_score = 0;
98
+
99
+ foreach ( $scores as $score ) {
100
+ $percent = $score['weight'] / $total_weight;
101
+ $final_score += $score['score'] * $percent;
102
+ }
103
+
104
+ return new ITSEC_Fingerprint_Comparison( $this, $fingerprint, $final_score, $scores );
105
+ }
106
+
107
+ /**
108
+ * Is the fingerprint approved.
109
+ *
110
+ * @return bool
111
+ */
112
+ public function is_approved() { return self::S_APPROVED === $this->_status; }
113
+
114
+ /**
115
+ * Is the fingerprint auto-approved.
116
+ *
117
+ * @return bool
118
+ */
119
+ public function is_auto_approved() { return self::S_AUTO_APPROVED === $this->_status; }
120
+
121
+ /**
122
+ * Is the fingerprint pending auto-approval.
123
+ *
124
+ * @return bool
125
+ */
126
+ public function is_pending_auto_approval() { return self::S_PENDING_AUTO_APPROVE === $this->_status; }
127
+
128
+ /**
129
+ * Is the fingerprint in pending status.
130
+ *
131
+ * @return bool
132
+ */
133
+ public function is_pending() { return self::S_PENDING === $this->_status; }
134
+
135
+ /**
136
+ * Is the fingerprint denied.
137
+ *
138
+ * @return bool
139
+ */
140
+ public function is_denied() { return self::S_DENIED === $this->_status; }
141
+
142
+ /**
143
+ * Can the fingerprint's status be changed.
144
+ *
145
+ * @return bool
146
+ */
147
+ public function can_change_status() { return $this->is_auto_approved() || $this->is_pending_auto_approval() || $this->is_pending(); }
148
+
149
+ /**
150
+ * Get the number of times the fingerprint was used.
151
+ *
152
+ * @return int
153
+ */
154
+ public function get_uses() {
155
+ return $this->_uses;
156
+ }
157
+
158
+ /**
159
+ * Get the WordPress user this fingerprint is for.
160
+ *
161
+ * @return WP_User
162
+ */
163
+ public function get_user() {
164
+ return $this->user;
165
+ }
166
+
167
+ /**
168
+ * Get the time the fingerprint was created.
169
+ *
170
+ * @return DateTime
171
+ */
172
+ public function get_created_at() {
173
+ return $this->created_at;
174
+ }
175
+
176
+ /**
177
+ * Get the values making up this fingerprint.
178
+ *
179
+ * @return ITSEC_Fingerprint_Value[]
180
+ */
181
+ public function get_values() {
182
+ return $this->values;
183
+ }
184
+
185
+ /**
186
+ * Get the UUID associated with this fingerprint.
187
+ *
188
+ * @return string
189
+ */
190
+ public function get_uuid() {
191
+ return $this->_uuid;
192
+ }
193
+
194
+ /**
195
+ * Get the status of the fingerprint.
196
+ *
197
+ * @return string
198
+ */
199
+ public function get_status() {
200
+ return $this->_status;
201
+ }
202
+
203
+ /**
204
+ * Get the time the fingerprint was approved at.
205
+ *
206
+ * @return DateTime|null
207
+ */
208
+ public function get_approved_at() {
209
+ return $this->_approved_at;
210
+ }
211
+
212
+ /**
213
+ * Get the date the fingerprint was last seen.
214
+ *
215
+ * @return DateTime
216
+ */
217
+ public function get_last_seen() {
218
+ return $this->_last_seen;
219
+ }
220
+
221
+ /**
222
+ * Get a snapshot of user or system configuration values at the time this fingerprint was created.
223
+ *
224
+ * @return array
225
+ */
226
+ public function get_snapshot() {
227
+ return $this->_snapshot;
228
+ }
229
+
230
+ /**
231
+ * Get a hash uniquely identifying the collected data.
232
+ *
233
+ * @return string
234
+ */
235
+ public function calculate_hash() {
236
+ if ( $this->_hash ) {
237
+ return $this->_hash;
238
+ }
239
+
240
+ if ( ! $serialized = $this->serialize_values() ) {
241
+ return null;
242
+ }
243
+
244
+ return md5( $serialized );
245
+ }
246
+
247
+ /**
248
+ * Set the last seen time for the Fingerprint.
249
+ *
250
+ * @return bool
251
+ */
252
+ public function was_seen() {
253
+
254
+ $this->_uses ++;
255
+ $this->_last_seen = new DateTime( '@' . ITSEC_Core::get_current_time_gmt(), new DateTimeZone( 'UTC' ) );
256
+
257
+ if ( ! $this->_id ) {
258
+ return true;
259
+ }
260
+
261
+ return $this->save( 'was_seen' );
262
+ }
263
+
264
+ /**
265
+ * Approve this fingerprint.
266
+ *
267
+ * @return bool
268
+ */
269
+ public function approve() {
270
+
271
+ if ( self::S_APPROVED === $this->_status ) {
272
+ return true;
273
+ }
274
+
275
+ if ( ! $this->can_change_status() ) {
276
+ return false;
277
+ }
278
+
279
+ $this->_status = self::S_APPROVED;
280
+ $this->_approved_at = new DateTime( '@' . ITSEC_Core::get_current_time_gmt(), new DateTimeZone( 'UTC' ) );
281
+
282
+ return $this->_id ? $this->save( $this->get_status_action( self::S_APPROVED ) ) : true;
283
+ }
284
+
285
+ /**
286
+ * Approve this fingerprint.
287
+ *
288
+ * @return bool
289
+ */
290
+ public function auto_approve() {
291
+
292
+ if ( self::S_AUTO_APPROVED === $this->_status ) {
293
+ return true;
294
+ }
295
+
296
+ if ( ! $this->can_change_status() ) {
297
+ return false;
298
+ }
299
+
300
+ $this->_status = self::S_AUTO_APPROVED;
301
+ $this->_approved_at = new DateTime( '@' . ITSEC_Core::get_current_time_gmt(), new DateTimeZone( 'UTC' ) );
302
+
303
+ return $this->_id ? $this->save( $this->get_status_action( self::S_AUTO_APPROVED ) ) : true;
304
+ }
305
+
306
+ /**
307
+ * Delay auto-approval for a few days.
308
+ *
309
+ * @return bool
310
+ */
311
+ public function delay_auto_approve() {
312
+ if ( self::S_PENDING_AUTO_APPROVE === $this->_status ) {
313
+ return true;
314
+ }
315
+
316
+ if ( ! $this->is_pending() ) {
317
+ return false;
318
+ }
319
+
320
+ $this->_status = self::S_PENDING_AUTO_APPROVE;
321
+
322
+ return $this->_id ? $this->save( $this->get_status_action( self::S_PENDING_AUTO_APPROVE ) ) : true;
323
+ }
324
+
325
+ /**
326
+ * Deny this fingerprint.
327
+ *
328
+ * @return bool
329
+ */
330
+ public function deny() {
331
+
332
+ if ( self::S_DENIED === $this->_status ) {
333
+ return true;
334
+ }
335
+
336
+ if ( ! $this->can_change_status() ) {
337
+ return false;
338
+ }
339
+
340
+ $this->_status = self::S_DENIED;
341
+
342
+ return $this->_id ? $this->save( $this->get_status_action( self::S_DENIED ) ) : true;
343
+ }
344
+
345
+ /**
346
+ * Set the fingerprint's status.
347
+ *
348
+ * This should almost never be used. Instead use the status-specific methods above.
349
+ *
350
+ * @internal
351
+ *
352
+ * @param string $status
353
+ *
354
+ * @return bool
355
+ */
356
+ public function _set_status( $status ) {
357
+ if ( $status === $this->_status ) {
358
+ return true;
359
+ }
360
+
361
+ if ( ! $this->_id ) {
362
+ return false;
363
+ }
364
+
365
+ $this->_status = $status;
366
+
367
+ return $this->save( $this->get_status_action( $status ), 'override' );
368
+ }
369
+
370
+ /**
371
+ * Get the action suffix to use when changing a status.
372
+ *
373
+ * @param string $status
374
+ *
375
+ * @return string
376
+ */
377
+ private function get_status_action( $status ) {
378
+ switch ( $status ) {
379
+ case self::S_APPROVED:
380
+ return 'approved';
381
+ case self::S_AUTO_APPROVED:
382
+ return 'auto_approved';
383
+ case self::S_PENDING_AUTO_APPROVE:
384
+ return 'auto_approve_delayed';
385
+ case self::S_DENIED:
386
+ return 'denied';
387
+ default:
388
+ return $status;
389
+ }
390
+ }
391
+
392
+ /**
393
+ * Create the fingerprint in storage.
394
+ *
395
+ * @return bool
396
+ */
397
+ public function create() {
398
+
399
+ if ( $this->_id ) {
400
+ return false;
401
+ }
402
+
403
+ if ( ! $data = $this->serialize_values() ) {
404
+ return false;
405
+ }
406
+
407
+ global $wpdb;
408
+
409
+ $this->_uuid = wp_generate_uuid4();
410
+ $this->generate_snapshot();
411
+
412
+ $insert_id = $wpdb->insert( $wpdb->base_prefix . 'itsec_fingerprints', array(
413
+ 'fingerprint_user' => $this->get_user()->ID,
414
+ 'fingerprint_hash' => md5( $data ),
415
+ 'fingerprint_data' => $data,
416
+ 'fingerprint_uses' => 1,
417
+ 'fingerprint_status' => $this->_status,
418
+ 'fingerprint_uuid' => $this->_uuid,
419
+ 'fingerprint_created_at' => $this->get_created_at()->format( 'Y-m-d H:i:s' ),
420
+ 'fingerprint_last_seen' => $this->get_last_seen()->format( 'Y-m-d H:i:s' ),
421
+ 'fingerprint_approved_at' => $this->get_approved_at() ? $this->get_approved_at()->format( 'Y-m-d H:i:s' ) : '',
422
+ 'fingerprint_snapshot' => wp_json_encode( $this->_snapshot ),
423
+ ), array(
424
+ 'fingerprint_user' => '%d',
425
+ 'fingerprint_hash' => '%s',
426
+ 'fingerprint_data' => '%s',
427
+ 'fingerprint_uses' => '%d',
428
+ 'fingerprint_status' => '%s',
429
+ 'fingerprint_uuid' => '%s',
430
+ 'fingerprint_created_at' => '%s',
431
+ 'fingerprint_last_seen' => '%s',
432
+ 'fingerprint_approved_at' => '%s',
433
+ 'fingerprint_snapshot' => '%s',
434
+ ) );
435
+
436
+ if ( $insert_id ) {
437
+ $this->_id = $insert_id;
438
+
439
+ /**
440
+ * Fires when a fingerprint is created.
441
+ *
442
+ * @param ITSEC_Fingerprint $this
443
+ */
444
+ do_action( 'itsec_fingerprint_created', $this );
445
+
446
+ if ( self::S_PENDING !== $this->_status ) {
447
+ $action = $this->get_status_action( $this->_status );
448
+ do_action( "itsec_fingerprint_{$action}", $this, $action );
449
+ }
450
+ }
451
+
452
+ return (bool) $insert_id;
453
+ }
454
+
455
+ /**
456
+ * Serialize the values for storage.
457
+ *
458
+ * @return false|string
459
+ */
460
+ private function serialize_values() {
461
+ $data = array();
462
+
463
+ foreach ( $this->get_values() as $value ) {
464
+ $data[ $value->get_source()->get_slug() ] = $value->get_value();
465
+ }
466
+
467
+ return wp_json_encode( $data );
468
+ }
469
+
470
+ /**
471
+ * Generate the snapshot of user/system configuration.
472
+ */
473
+ private function generate_snapshot() {
474
+ if ( ! $this->_snapshot ) {
475
+ $this->_snapshot = array(
476
+ 'user_email' => $this->get_user()->user_email,
477
+ );
478
+ }
479
+ }
480
+
481
+ /**
482
+ * Save the current state.
483
+ *
484
+ * @param string $action
485
+ * @param mixed $additional,...
486
+ *
487
+ * @return bool
488
+ */
489
+ private function save( $action = '', $additional = null ) {
490
+
491
+ global $wpdb;
492
+
493
+ $updated = (bool) $wpdb->update(
494
+ $wpdb->base_prefix . 'itsec_fingerprints',
495
+ array(
496
+ 'fingerprint_last_seen' => $this->get_last_seen()->format( 'Y-m-d H:i:s' ),
497
+ 'fingerprint_uses' => $this->get_uses(),
498
+ 'fingerprint_status' => $this->get_status(),
499
+ 'fingerprint_approved_at' => $this->get_approved_at() ? $this->get_approved_at()->format( 'Y-m-d H:i:s' ) : '',
500
+ ),
501
+ array( 'fingerprint_id' => $this->_id ),
502
+ array( 'fingerprint_last_seen' => '%s', 'fingerprint_uses' => '%d', 'fingerprint_status' => '%s', 'fingerprint_approved_at' => '%s' ),
503
+ array( 'fingerprint_id' => '%d' )
504
+ );
505
+
506
+ if ( $updated && $action ) {
507
+ $args = array_merge( array( $this, $action ), array_slice( func_get_args(), 1 ) );
508
+
509
+ /**
510
+ * Fires when the fingerprint is saved.
511
+ *
512
+ * @param ITSEC_Fingerprint $this
513
+ * @param string $action
514
+ */
515
+ do_action_ref_array( "itsec_fingerprint_{$action}", $args );
516
+ }
517
+
518
+ return $updated;
519
+ }
520
+
521
+ /**
522
+ * Get a user's fingerprints.
523
+ *
524
+ * @param WP_User $user
525
+ * @param array $args
526
+ *
527
+ * @return ITSEC_Fingerprint[]
528
+ */
529
+ public static function get_all_for_user( WP_User $user, array $args ) {
530
+
531
+ global $wpdb;
532
+
533
+ $sql = "SELECT * FROM {$wpdb->base_prefix}itsec_fingerprints WHERE `fingerprint_user` = %s";
534
+ $prepare = array( $user->ID );
535
+
536
+ if ( ! empty( $args['status'] ) ) {
537
+ if ( is_array( $args['status'] ) ) {
538
+ $sql .= ' AND `fingerprint_status` IN (' . implode( ', ', array_fill( 0, count( $args['status'] ), '%s' ) ) . ')';
539
+ $prepare = array_merge( $prepare, $args['status'] );
540
+ } else {
541
+ $sql .= ' AND `fingerprint_status` = %s';
542
+ $prepare[] = $args['status'];
543
+ }
544
+ }
545
+
546
+ if ( ! empty( $args['exclude'] ) ) {
547
+ $sql .= ' AND `fingerprint_uuid` NOT IN (' . implode( ', ', array_fill( 0, count( $args['exclude'] ), '%s' ) ) . ')';
548
+ $prepare = array_merge( $prepare, wp_parse_slug_list( $args['exclude'] ) );
549
+ }
550
+
551
+ $sql .= ' ORDER BY `fingerprint_last_seen` DESC';
552
+
553
+ $rows = $wpdb->get_results( $wpdb->prepare( $sql, $prepare ) );
554
+
555
+ $fingerprints = array();
556
+
557
+ foreach ( $rows as $row ) {
558
+ if ( $fingerprint = self::_hydrate_fingerprint( $row ) ) {
559
+ $fingerprints[] = $fingerprint;
560
+ }
561
+ }
562
+
563
+ return $fingerprints;
564
+ }
565
+
566
+ /**
567
+ * Get a fingerprint by its UUID.
568
+ *
569
+ * @param string $uuid
570
+ *
571
+ * @return ITSEC_Fingerprint|null
572
+ */
573
+ public static function get_by_uuid( $uuid ) {
574
+
575
+ global $wpdb;
576
+
577
+ $row = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->base_prefix}itsec_fingerprints WHERE `fingerprint_uuid` = %s", $uuid ) );
578
+
579
+ if ( ! $row ) {
580
+ return null;
581
+ }
582
+
583
+ return self::_hydrate_fingerprint( $row );
584
+ }
585
+
586
+ /**
587
+ * Get a fingerprint by its data hash.
588
+ *
589
+ * @param WP_User $user
590
+ * @param string $hash
591
+ *
592
+ * @return ITSEC_Fingerprint|null
593
+ */
594
+ public static function get_by_hash( WP_User $user, $hash ) {
595
+ global $wpdb;
596
+
597
+ $row = $wpdb->get_row( $wpdb->prepare(
598
+ "SELECT * FROM {$wpdb->base_prefix}itsec_fingerprints WHERE `fingerprint_hash` = %s AND `fingerprint_user` = %s",
599
+ $hash,
600
+ $user->ID
601
+ ) );
602
+
603
+ if ( ! $row ) {
604
+ return null;
605
+ }
606
+
607
+ return self::_hydrate_fingerprint( $row );
608
+ }
609
+
610
+ /**
611
+ * Hydrate a fingerprint with data from the database.
612
+ *
613
+ * @internal
614
+ *
615
+ * @param object $row
616
+ *
617
+ * @return ITSEC_Fingerprint|null
618
+ */
619
+ public static function _hydrate_fingerprint( $row ) {
620
+ $sources = ITSEC_Lib_Fingerprinting::get_sources();
621
+ $values = array();
622
+
623
+ foreach ( json_decode( $row->fingerprint_data, true ) as $slug => $value ) {
624
+ if ( isset( $sources[ $slug ] ) ) {
625
+ $values[] = new ITSEC_Fingerprint_Value( $sources[ $slug ], $value );
626
+ }
627
+ }
628
+
629
+ if ( ! $user = get_userdata( $row->fingerprint_user ) ) {
630
+ return null;
631
+ }
632
+
633
+ $fingerprint = new ITSEC_Fingerprint(
634
+ $user,
635
+ new DateTime( $row->fingerprint_created_at, new DateTimeZone( 'UTC' ) ),
636
+ $values
637
+ );
638
+
639
+ $approved_at = $row->fingerprint_approved_at && $row->fingerprint_approved_at !== '0000-00-00 00:00:00' ? $row->fingerprint_approved_at : null;
640
+
641
+ $fingerprint->_id = $row->fingerprint_id;
642
+ $fingerprint->_uses = $row->fingerprint_uses;
643
+ $fingerprint->_status = $row->fingerprint_status;
644
+ $fingerprint->_uuid = $row->fingerprint_uuid;
645
+ $fingerprint->_hash = $row->fingerprint_hash;
646
+ $fingerprint->_last_seen = new DateTime( $row->fingerprint_last_seen, new DateTimeZone( 'UTC' ) );
647
+ $fingerprint->_approved_at = $approved_at ? new DateTime( $approved_at, new DateTimeZone( 'UTC' ) ) : null;
648
+
649
+ if ( $row->fingerprint_snapshot ) {
650
+ $fingerprint->_snapshot = json_decode( $row->fingerprint_snapshot, true );
651
+ }
652
+
653
+ return $fingerprint;
654
+ }
655
+
656
+ /**
657
+ * Get a summary of this fingerprint.
658
+ *
659
+ * @return string
660
+ */
661
+ public function __toString() {
662
+
663
+ $location = $browser = $platform = $ip = '';
664
+
665
+ if ( isset( $this->values['ip'] ) ) {
666
+ $ip = $this->values['ip']->get_value();
667
+
668
+ require_once( ITSEC_Core::get_core_dir() . 'lib/class-itsec-lib-geolocation.php' );
669
+
670
+ if ( ! is_wp_error( $geolocate = ITSEC_Lib_Geolocation::geolocate( $ip ) ) ) {
671
+ $location = $geolocate['label'];
672
+ }
673
+ }
674
+
675
+ if ( isset( $this->values['header-user-agent'] ) ) {
676
+ require_once( ITSEC_Core::get_core_dir() . 'lib/class-itsec-lib-browser.php' );
677
+ $browser_lib = new ITSEC_Lib_Browser( $this->values['header-user-agent']->get_value() );
678
+
679
+ $browser = "{$browser_lib->getBrowser() } ({$browser_lib->getVersion()})";
680
+ $platform = $browser_lib->getPlatform();
681
+ }
682
+
683
+ if ( $location && $browser ) {
684
+ $str = sprintf( esc_html__( 'Device running %1$s on %2$s near %3$s', 'better-wp-security' ), $browser, $platform, $location );
685
+ } elseif ( $location ) {
686
+ $str = sprintf( esc_html__( 'Device near %1$s', 'better-wp-security' ), $location );
687
+ } elseif ( $browser ) {
688
+ $str = sprintf( esc_html__( 'Device running %1$s on %2$s', 'better-wp-security' ), $browser, $platform );
689
+ } else {
690
+ $str = '';
691
+ }
692
+
693
+ if ( $ip ) {
694
+ $str .= " ($ip)";
695
+ }
696
+
697
+ return trim( $str );
698
+ }
699
+ }
core/lib/fingerprinting/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden.
core/lib/fingerprinting/interface-itsec-fingerprint-source.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Interface ITSEC_Fingerprint_Source
5
+ */
6
+ interface ITSEC_Fingerprint_Source {
7
+
8
+ /**
9
+ * Calculate the source value from global state.
10
+ *
11
+ * @return ITSEC_Fingerprint_Value
12
+ */
13
+ public function calculate_value_from_global_state();
14
+
15
+ /**
16
+ * Compare two source values.
17
+ *
18
+ * @param ITSEC_Fingerprint_Value $known
19
+ * @param ITSEC_Fingerprint_Value $unknown
20
+ *
21
+ * @return int A percentage, 100 being a perfect match.
22
+ */
23
+ public function compare( ITSEC_Fingerprint_Value $known, ITSEC_Fingerprint_Value $unknown );
24
+
25
+ /**
26
+ * How should the source be weighted.
27
+ *
28
+ * @param ITSEC_Fingerprint_Value $value
29
+ *
30
+ * @return int
31
+ */
32
+ public function get_weight( ITSEC_Fingerprint_Value $value );
33
+
34
+ /**
35
+ * Get the unique slug identifying this fingerprint source.
36
+ *
37
+ * @return string
38
+ */
39
+ public function get_slug();
40
+ }
core/lib/geolocation/class-itsec-geolocator-chain.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class ITSEC_Geolocator_Chain
5
+ */
6
+ final class ITSEC_Geolocator_Chain implements ITSEC_Geolocator {
7
+
8
+ /** @var ITSEC_Geolocator[] */
9
+ private $chain;
10
+
11
+ /**
12
+ * ITSEC_Geolocator_Chain constructor.
13
+ *
14
+ * @param ITSEC_Geolocator[] $chain
15
+ */
16
+ public function __construct( $chain ) { $this->chain = $chain; }
17
+
18
+ /**
19
+ * @inheritDoc
20
+ */
21
+ public function geolocate( $ip ) {
22
+ foreach ( $this->chain as $geolocator ) {
23
+ if ( ! is_wp_error( $location = $geolocator->geolocate( $ip ) ) ) {
24
+ return $location;
25
+ }
26
+ }
27
+
28
+ return new WP_Error( 'itsec_geolocation_not_found', __( 'No geolocator found a valid location.', 'better-wp-security' ) );
29
+ }
30
+
31
+ /**
32
+ * @inheritDoc
33
+ */
34
+ public function is_available() {
35
+ return count( $this->chain ) > 0;
36
+ }
37
+ }
core/lib/geolocation/class-itsec-geolocator-page-cache.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class ITSEC_Geolocator_Page_Cache
5
+ */
6
+ class ITSEC_Geolocator_Page_Cache implements ITSEC_Geolocator {
7
+
8
+ /** @var ITSEC_Geolocator */
9
+ private $geolocator;
10
+
11
+ /** @var array */
12
+ private $cache = array();
13
+
14
+ /**
15
+ * ITSEC_Geolocator_Cache constructor.
16
+ *
17
+ * @param ITSEC_Geolocator $geolocator
18
+ */
19
+ public function __construct( ITSEC_Geolocator $geolocator ) { $this->geolocator = $geolocator; }
20
+
21
+ /**
22
+ * @inheritDoc
23
+ */
24
+ public function geolocate( $ip ) {
25
+ if ( ! isset( $this->cache[ $ip ] ) ) {
26
+ $this->cache[ $ip ] = $this->geolocator->geolocate( $ip );
27
+ }
28
+
29
+ return $this->cache[ $ip ];
30
+ }
31
+
32
+ /**
33
+ * @inheritDoc
34
+ */
35
+ public function is_available() {
36
+ return $this->geolocator->is_available();
37
+ }
38
+ }
core/lib/geolocation/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden.
core/lib/geolocation/interface-itsec-geolocator.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Interface ITSEC_Geolocator
5
+ */
6
+ interface ITSEC_Geolocator {
7
+
8
+ /**
9
+ * Geolocate an IP address.
10
+ *
11
+ * @param string $ip
12
+ *
13
+ * @return array|WP_Error With 'lat', 'long', 'label' and 'credit' fields. Label and credit ARE safe.
14
+ */
15
+ public function geolocate( $ip );
16
+
17
+ /**
18
+ * Is this geolocator available.
19
+ *
20
+ * @return bool
21
+ */
22
+ public function is_available();
23
+ }
core/lib/log.php CHANGED
@@ -4,72 +4,72 @@ final class ITSEC_Log {
4
  /* Critical issues are very important events that administrators should be notified about, such as finding malware
5
  * on the site or detecting a security breach.
6
  */
7
- public static function add_critical_issue( $module, $code, $data = false ) {
8
- return self::add( $module, $code, $data, 'critical-issue' );
9
  }
10
 
11
  /* Actions are noteworthy automated events that change the functionality of the site based upon certain criteria,
12
  * such as locking out an IP address due to bruteforce attempts.
13
  */
14
- public static function add_action( $module, $code, $data = false ) {
15
- return self::add( $module, $code, $data, 'action' );
16
  }
17
 
18
  /* Fatal errors are critical problems detected in the code that could and should be reserved for very rare but
19
  * highly problematic situations, such as a catch handler in a try/catch block or a shutdown handler running before
20
  * a process finishes.
21
  */
22
- public static function add_fatal_error( $module, $code, $data = false ) {
23
- return self::add( $module, $code, $data, 'fatal' );
24
  }
25
 
26
  /* Errors are events that indicate a failure of some sort, such as failure to write to a file or an inability to
27
  * request a remote URL.
28
  */
29
- public static function add_error( $module, $code, $data = false ) {
30
- return self::add( $module, $code, $data, 'error' );
31
  }
32
 
33
  /* Warnings are noteworthy events that might indicate an issue, such as finding changed files.
34
  */
35
- public static function add_warning( $module, $code, $data = false ) {
36
- return self::add( $module, $code, $data, 'warning' );
37
  }
38
 
39
  /* Notices keep track of events that should be tracked but do not necessarily indicate an issue, such as requests
40
  * for files that do not exist and completed scans that did not find any issues.
41
  */
42
- public static function add_notice( $module, $code, $data = false ) {
43
- return self::add( $module, $code, $data, 'notice' );
44
  }
45
 
46
  /* Debug events are to be used in situations where extra information about a specific process could be helpful to
47
  * have when investigating an issue but the information would typically be uninteresting to the user, such as
48
  * noting the use of a compatibility function.
49
  */
50
- public static function add_debug( $module, $code, $data = false ) {
51
- return self::add( $module, $code, $data, 'debug' );
52
  }
53
 
54
  /* Process events allow for creating single entries that have a start, zero or more updates, and a stopping point.
55
  * This allows for benchmarking performance of long-running code in addition to finding issues such as terminated
56
  * execution due to the missing process-stop entry.
57
  */
58
- public static function add_process_start( $module, $code, $data = false ) {
59
- $id = self::add( $module, $code, $data, 'process-start' );
60
 
61
  return compact( 'module', 'code', 'id' );
62
  }
63
 
64
- public static function add_process_update( $reference, $data = false ) {
65
- self::add( $reference['module'], $reference['code'], $data, 'process-update', $reference['id'] );
66
  }
67
 
68
- public static function add_process_stop( $reference, $data = false ) {
69
- self::add( $reference['module'], $reference['code'], $data, 'process-stop', $reference['id'] );
70
  }
71
 
72
- private static function add( $module, $code, $data, $type, $parent_id = 0 ) {
73
  if ( defined( 'WP_CLI' ) && WP_CLI ) {
74
  $url = 'wp-cli';
75
  } else if ( ( is_callable( 'wp_doing_cron' ) && wp_doing_cron() ) || ( defined( 'DOING_CRON' ) && DOING_CRON ) ) {
@@ -80,7 +80,7 @@ final class ITSEC_Log {
80
  $url = 'unknown';
81
  }
82
 
83
- $data = array(
84
  'parent_id' => $parent_id,
85
  'module' => $module,
86
  'code' => $code,
@@ -94,7 +94,7 @@ final class ITSEC_Log {
94
  'blog_id' => get_current_blog_id(),
95
  'user_id' => get_current_user_id(),
96
  'remote_ip' => ITSEC_Lib::get_ip(),
97
- );
98
 
99
  $log_type = ITSEC_Modules::get_setting( 'global', 'log_type' );
100
 
4
  /* Critical issues are very important events that administrators should be notified about, such as finding malware
5
  * on the site or detecting a security breach.
6
  */
7
+ public static function add_critical_issue( $module, $code, $data = false, $overrides = array() ) {
8
+ return self::add( $module, $code, $data, 'critical-issue', 0, $overrides );
9
  }
10
 
11
  /* Actions are noteworthy automated events that change the functionality of the site based upon certain criteria,
12
  * such as locking out an IP address due to bruteforce attempts.
13
  */
14
+ public static function add_action( $module, $code, $data = false, $overrides = array() ) {
15
+ return self::add( $module, $code, $data, 'action', 0, $overrides );
16
  }
17
 
18
  /* Fatal errors are critical problems detected in the code that could and should be reserved for very rare but
19
  * highly problematic situations, such as a catch handler in a try/catch block or a shutdown handler running before
20
  * a process finishes.
21
  */
22
+ public static function add_fatal_error( $module, $code, $data = false, $overrides = array() ) {
23
+ return self::add( $module, $code, $data, 'fatal', 0, $overrides );
24
  }
25
 
26
  /* Errors are events that indicate a failure of some sort, such as failure to write to a file or an inability to
27
  * request a remote URL.
28
  */
29
+ public static function add_error( $module, $code, $data = false, $overrides = array() ) {
30
+ return self::add( $module, $code, $data, 'error', 0, $overrides );
31
  }
32
 
33
  /* Warnings are noteworthy events that might indicate an issue, such as finding changed files.
34
  */
35
+ public static function add_warning( $module, $code, $data = false, $overrides = array() ) {
36
+ return self::add( $module, $code, $data, 'warning', 0, $overrides );
37
  }
38
 
39
  /* Notices keep track of events that should be tracked but do not necessarily indicate an issue, such as requests
40
  * for files that do not exist and completed scans that did not find any issues.
41
  */
42
+ public static function add_notice( $module, $code, $data = false, $overrides = array() ) {
43
+ return self::add( $module, $code, $data, 'notice', 0, $overrides );
44
  }
45
 
46
  /* Debug events are to be used in situations where extra information about a specific process could be helpful to
47
  * have when investigating an issue but the information would typically be uninteresting to the user, such as
48
  * noting the use of a compatibility function.
49
  */
50
+ public static function add_debug( $module, $code, $data = false, $overrides = array() ) {
51
+ return self::add( $module, $code, $data, 'debug', 0, $overrides );
52
  }
53
 
54
  /* Process events allow for creating single entries that have a start, zero or more updates, and a stopping point.
55
  * This allows for benchmarking performance of long-running code in addition to finding issues such as terminated
56
  * execution due to the missing process-stop entry.
57
  */
58
+ public static function add_process_start( $module, $code, $data = false, $overrides = array() ) {
59
+ $id = self::add( $module, $code, $data, 'process-start', 0, $overrides );
60
 
61
  return compact( 'module', 'code', 'id' );
62
  }
63
 
64
+ public static function add_process_update( $reference, $data = false, $overrides = array() ) {
65
+ self::add( $reference['module'], $reference['code'], $data, 'process-update', $reference['id'], $overrides );
66
  }
67
 
68
+ public static function add_process_stop( $reference, $data = false, $overrides = array() ) {
69
+ self::add( $reference['module'], $reference['code'], $data, 'process-stop', $reference['id'], $overrides );
70
  }
71
 
72
+ private static function add( $module, $code, $data, $type, $parent_id = 0, $overrides = array() ) {
73
  if ( defined( 'WP_CLI' ) && WP_CLI ) {
74
  $url = 'wp-cli';
75
  } else if ( ( is_callable( 'wp_doing_cron' ) && wp_doing_cron() ) || ( defined( 'DOING_CRON' ) && DOING_CRON ) ) {
80
  $url = 'unknown';
81
  }
82
 
83
+ $data = array_merge( array(
84
  'parent_id' => $parent_id,
85
  'module' => $module,
86
  'code' => $code,
94
  'blog_id' => get_current_blog_id(),
95
  'user_id' => get_current_user_id(),
96
  'remote_ip' => ITSEC_Lib::get_ip(),
97
+ ), $overrides );
98
 
99
  $log_type = ITSEC_Modules::get_setting( 'global', 'log_type' );
100
 
core/lib/mail-templates/divider.html CHANGED
@@ -8,7 +8,7 @@
8
  <td class="section-padding" align="center" valign="top" width="450" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;padding-top: 20px;padding-right: 20px;padding-left: 20px;">
9
  <table class="divider-border" border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;border-top-width: 1px;border-top-style: solid;border-top-color: #E8E8E8;">
10
  <tr>
11
- <td class="container-cell" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #404040;font-family: Helvetica;font-size: 16px;line-height: 1px;text-align: center;padding-bottom: 20px;width: 450px;">
12
  &nbsp;
13
  </td>
14
  </tr>
8
  <td class="section-padding" align="center" valign="top" width="450" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;padding-top: 20px;padding-right: 20px;padding-left: 20px;">
9
  <table class="divider-border" border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;border-top-width: 1px;border-top-style: solid;border-top-color: #E8E8E8;">
10
  <tr>
11
+ <td class="container-cell" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #808080;font-family: Helvetica;font-size: 16px;line-height: 1px;text-align: center;padding-bottom: 20px;width: 450px;">
12
  &nbsp;
13
  </td>
14
  </tr>
core/lib/mail-templates/file-change-summary.html CHANGED
@@ -8,7 +8,7 @@
8
  <td class="section-padding" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;padding-top: 20px;padding-right: 20px;padding-left: 20px;">
9
  <table class="container left-column" align="left" border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;margin-right: 60px;">
10
  <tr>
11
- <td class="container-cell" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #404040;font-family: Helvetica;font-size: 16px;line-height: 150%;text-align: center;padding-bottom: 20px;">
12
  <h4 style="color: #ACAAAA;font-family: Helvetica;font-size: 16px;font-weight: normal;line-height: 150%;margin: 0;padding: 0;text-align: center;">{{ $added_text }}</h4>
13
  <p style="-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;font-family: Helvetica;font-size: 30px;line-height: 150%;margin-top: 10px;margin-right: 0;margin-bottom: 10px;margin-left: 0;padding: 0;text-align: center;color: #505050;font-weight: bold;">{{ $added_count }}</p>
14
  </td>
@@ -16,7 +16,7 @@
16
  </table>
17
  <table class="container center-column" align="left" border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;margin-right: 60px;">
18
  <tr>
19
- <td class="container-cell" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #404040;font-family: Helvetica;font-size: 16px;line-height: 150%;text-align: center;padding-bottom: 20px;">
20
  <h4 style="color: #ACAAAA;font-family: Helvetica;font-size: 16px;font-weight: normal;line-height: 150%;margin: 0;padding: 0;text-align: center;">{{ $removed_text }}</h4>
21
  <p style="-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;font-family: Helvetica;font-size: 30px;line-height: 150%;margin-top: 10px;margin-right: 0;margin-bottom: 10px;margin-left: 0;padding: 0;text-align: center;color: #505050;font-weight: bold;">{{ $removed_count }}</p>
22
  </td>
@@ -24,7 +24,7 @@
24
  </table>
25
  <table class="container right-column" align="right" border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
26
  <tr>
27
- <td class="container-cell" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #404040;font-family: Helvetica;font-size: 16px;line-height: 150%;text-align: center;padding-bottom: 20px;">
28
  <h4 style="color: #ACAAAA;font-family: Helvetica;font-size: 16px;font-weight: normal;line-height: 150%;margin: 0;padding: 0;text-align: center;">{{ $modified_text }}</h4>
29
  <p style="-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;font-family: Helvetica;font-size: 30px;line-height: 150%;margin-top: 10px;margin-right: 0;margin-bottom: 10px;margin-left: 0;padding: 0;text-align: center;color: #505050;font-weight: bold;">{{ $modified_count }}</p>
30
  </td>
8
  <td class="section-padding" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;padding-top: 20px;padding-right: 20px;padding-left: 20px;">
9
  <table class="container left-column" align="left" border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;margin-right: 60px;">
10
  <tr>
11
+ <td class="container-cell" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #808080;font-family: Helvetica;font-size: 16px;line-height: 150%;text-align: center;padding-bottom: 20px;">
12
  <h4 style="color: #ACAAAA;font-family: Helvetica;font-size: 16px;font-weight: normal;line-height: 150%;margin: 0;padding: 0;text-align: center;">{{ $added_text }}</h4>
13
  <p style="-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;font-family: Helvetica;font-size: 30px;line-height: 150%;margin-top: 10px;margin-right: 0;margin-bottom: 10px;margin-left: 0;padding: 0;text-align: center;color: #505050;font-weight: bold;">{{ $added_count }}</p>
14
  </td>
16
  </table>
17
  <table class="container center-column" align="left" border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;margin-right: 60px;">
18
  <tr>
19
+ <td class="container-cell" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #808080;font-family: Helvetica;font-size: 16px;line-height: 150%;text-align: center;padding-bottom: 20px;">
20
  <h4 style="color: #ACAAAA;font-family: Helvetica;font-size: 16px;font-weight: normal;line-height: 150%;margin: 0;padding: 0;text-align: center;">{{ $removed_text }}</h4>
21
  <p style="-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;font-family: Helvetica;font-size: 30px;line-height: 150%;margin-top: 10px;margin-right: 0;margin-bottom: 10px;margin-left: 0;padding: 0;text-align: center;color: #505050;font-weight: bold;">{{ $removed_count }}</p>
22
  </td>
24
  </table>
25
  <table class="container right-column" align="right" border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
26
  <tr>
27
+ <td class="container-cell" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #808080;font-family: Helvetica;font-size: 16px;line-height: 150%;text-align: center;padding-bottom: 20px;">
28
  <h4 style="color: #ACAAAA;font-family: Helvetica;font-size: 16px;font-weight: normal;line-height: 150%;margin: 0;padding: 0;text-align: center;">{{ $modified_text }}</h4>
29
  <p style="-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;font-family: Helvetica;font-size: 30px;line-height: 150%;margin-top: 10px;margin-right: 0;margin-bottom: 10px;margin-left: 0;padding: 0;text-align: center;color: #505050;font-weight: bold;">{{ $modified_count }}</p>
30
  </td>
core/lib/mail-templates/footer-user.html CHANGED
@@ -8,7 +8,7 @@
8
  <td class="section-padding" align="center" valign="top" width="600" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;padding-top: 20px;padding-right: 20px;padding-left: 20px;">
9
  <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
10
  <tr>
11
- <td class="container-cell" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #404040;font-family: Helvetica;font-size: 16px;line-height: 200%;text-align: center;padding-bottom: 0;padding-top: 60px;">
12
  <img class="preserve-ratio" src="{! $footer_logo }}" style="max-width: 50px;border: 0;outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;height: auto;" width="50" alt="" align="center"><br>
13
  <br>
14
  <span style="-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #666f72;font-family: Helvetica;font-size: 11px;line-height: 200%;text-align: center;text-decoration: none;font-weight: bold;">
8
  <td class="section-padding" align="center" valign="top" width="600" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;padding-top: 20px;padding-right: 20px;padding-left: 20px;">
9
  <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
10
  <tr>
11
+ <td class="container-cell" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #808080;font-family: Helvetica;font-size: 16px;line-height: 200%;text-align: center;padding-bottom: 0;padding-top: 60px;">
12
  <img class="preserve-ratio" src="{! $footer_logo }}" style="max-width: 50px;border: 0;outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;height: auto;" width="50" alt="" align="center"><br>
13
  <br>
14
  <span style="-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #666f72;font-family: Helvetica;font-size: 11px;line-height: 200%;text-align: center;text-decoration: none;font-weight: bold;">
core/lib/mail-templates/footer.html CHANGED
@@ -8,7 +8,7 @@
8
  <td class="section-padding" align="center" valign="top" width="600" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;padding-top: 20px;padding-right: 20px;padding-left: 20px;">
9
  <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
10
  <tr>
11
- <td class="container-cell" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #404040;font-family: Helvetica;font-size: 16px;line-height: 150%;text-align: center;padding-bottom: 20px;">
12
  <h2 style="color: #002030;font-family: Helvetica;font-size: 26px;font-weight: bold;line-height: 150%;margin: 0;padding: 0;text-align: center;">{{ $security_resources }}</h2>
13
  </td>
14
  </tr>
@@ -31,7 +31,7 @@
31
  <td class="section-padding" valign="top" width="600" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;padding-top: 20px;padding-right: 20px;padding-left: 20px;">
32
  <table class="container" align="left" border="0" cellpadding="0" cellspacing="0" width="260" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
33
  <tr>
34
- <td class="container-cell" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #404040;font-family: Helvetica;font-size: 16px;line-height: 150%;text-align: center;padding-bottom: 20px;">
35
  <img class="preserve-ratio" src="{! $article_icon }}" style="max-width: 61px;border: 0;outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;height: auto;" width="61" alt="" align="center">
36
  <br>
37
  <h4 style="color: #202020;font-family: Helvetica;font-size: 20px;font-weight: bold;line-height: 150%;margin: 0;padding: 0;text-align: center;">
@@ -44,7 +44,7 @@
44
  </table>
45
  <table class="container" align="right" border="0" cellpadding="0" cellspacing="0" width="260" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
46
  <tr>
47
- <td class="container-cell container-cell-bottom" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #404040;font-family: Helvetica;font-size: 16px;line-height: 150%;text-align: center;padding-bottom: 20px;">
48
  <img class="preserve-ratio" src="{! $video_icon }}" style="max-width: 61px;border: 0;outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;height: auto;" width="61" alt="" align="center">
49
  <br>
50
  <h4 style="color: #202020;font-family: Helvetica;font-size: 20px;font-weight: bold;line-height: 150%;margin: 0;padding: 0;text-align: center;">
@@ -73,7 +73,7 @@
73
  <td class="section-padding" align="center" valign="top" width="450" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;padding-top: 20px;padding-right: 20px;padding-left: 20px;">
74
  <table class="divider-border" border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;border-top-width: 1px;border-top-style: solid;border-top-color: #E8E8E8;">
75
  <tr>
76
- <td class="container-cell" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #404040;font-family: Helvetica;font-size: 16px;line-height: 1px;text-align: center;padding-bottom: 20px;width: 450px;">
77
  &nbsp;
78
  </td>
79
  </tr>
@@ -96,7 +96,7 @@
96
  <td class="section-padding" align="center" valign="top" width="600" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;padding-top: 20px;padding-right: 20px;padding-left: 20px;">
97
  <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
98
  <tr>
99
- <td class="container-cell" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #404040;font-family: Helvetica;font-size: 16px;line-height: 150%;text-align: center;padding-bottom: 20px;">
100
  <h2 style="color: #002030;font-family: Helvetica;font-size: 26px;font-weight: bold;line-height: 150%;margin: 0;padding: 0;text-align: center;">{{ $help_and_support }}</h2>
101
  </td>
102
  </tr>
@@ -119,7 +119,7 @@
119
  <td class="section-padding" valign="top" width="600" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;padding-top: 20px;padding-right: 20px;padding-left: 20px;">
120
  <table class="container" align="left" border="0" cellpadding="0" cellspacing="0" width="260" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
121
  <tr>
122
- <td class="container-cell" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #404040;font-family: Helvetica;font-size: 16px;line-height: 150%;text-align: center;padding-bottom: 20px;">
123
  <img class="preserve-ratio" src="{! $documentation_icon }}" style="max-width: 62px;border: 0;outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;height: auto;" width="62" alt="" align="center">
124
  <br>
125
  <h4 style="color: #202020;font-family: Helvetica;font-size: 20px;font-weight: bold;line-height: 150%;margin: 0;padding: 0;text-align: center;">
@@ -132,7 +132,7 @@
132
  </table>
133
  <table class="container" align="right" border="0" cellpadding="0" cellspacing="0" width="260" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
134
  <tr>
135
- <td class="container-cell container-cell-bottom" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #404040;font-family: Helvetica;font-size: 16px;line-height: 150%;text-align: center;padding-bottom: 20px;">
136
  <img class="preserve-ratio" src="{! $support_icon }}" style="max-width: 62px;border: 0;outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;height: auto;" width="62" alt="" align="center">
137
  <br>
138
  <h4 style="color: #202020;font-family: Helvetica;font-size: 20px;font-weight: bold;line-height: 150%;margin: 0;padding: 0;text-align: center;">
@@ -193,7 +193,7 @@
193
  <td class="section-padding" align="center" valign="top" width="600" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;padding-top: 20px;padding-right: 20px;padding-left: 20px;">
194
  <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
195
  <tr>
196
- <td class="container-cell" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #404040;font-family: Helvetica;font-size: 16px;line-height: 200%;text-align: center;padding-bottom: 0;padding-top: 60px;">
197
  <img class="preserve-ratio" src="{! $footer_logo }}" style="max-width: 50px;border: 0;outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;height: auto;" width="50" alt="" align="center"><br>
198
  <br>
199
  <span style="-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #666f72;font-family: Helvetica;font-size: 11px;line-height: 200%;text-align: center;text-decoration: none;font-weight: bold;">
8
  <td class="section-padding" align="center" valign="top" width="600" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;padding-top: 20px;padding-right: 20px;padding-left: 20px;">
9
  <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
10
  <tr>
11
+ <td class="container-cell" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #808080;font-family: Helvetica;font-size: 16px;line-height: 150%;text-align: center;padding-bottom: 20px;">
12
  <h2 style="color: #002030;font-family: Helvetica;font-size: 26px;font-weight: bold;line-height: 150%;margin: 0;padding: 0;text-align: center;">{{ $security_resources }}</h2>
13
  </td>
14
  </tr>
31
  <td class="section-padding" valign="top" width="600" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;padding-top: 20px;padding-right: 20px;padding-left: 20px;">
32
  <table class="container" align="left" border="0" cellpadding="0" cellspacing="0" width="260" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
33
  <tr>
34
+ <td class="container-cell" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #808080;font-family: Helvetica;font-size: 16px;line-height: 150%;text-align: center;padding-bottom: 20px;">
35
  <img class="preserve-ratio" src="{! $article_icon }}" style="max-width: 61px;border: 0;outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;height: auto;" width="61" alt="" align="center">
36
  <br>
37
  <h4 style="color: #202020;font-family: Helvetica;font-size: 20px;font-weight: bold;line-height: 150%;margin: 0;padding: 0;text-align: center;">
44
  </table>
45
  <table class="container" align="right" border="0" cellpadding="0" cellspacing="0" width="260" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
46
  <tr>
47
+ <td class="container-cell container-cell-bottom" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #808080;font-family: Helvetica;font-size: 16px;line-height: 150%;text-align: center;padding-bottom: 20px;">
48
  <img class="preserve-ratio" src="{! $video_icon }}" style="max-width: 61px;border: 0;outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;height: auto;" width="61" alt="" align="center">
49
  <br>
50
  <h4 style="color: #202020;font-family: Helvetica;font-size: 20px;font-weight: bold;line-height: 150%;margin: 0;padding: 0;text-align: center;">
73
  <td class="section-padding" align="center" valign="top" width="450" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;padding-top: 20px;padding-right: 20px;padding-left: 20px;">
74
  <table class="divider-border" border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;border-top-width: 1px;border-top-style: solid;border-top-color: #E8E8E8;">
75
  <tr>
76
+ <td class="container-cell" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #808080;font-family: Helvetica;font-size: 16px;line-height: 1px;text-align: center;padding-bottom: 20px;width: 450px;">
77
  &nbsp;
78
  </td>
79
  </tr>
96
  <td class="section-padding" align="center" valign="top" width="600" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;padding-top: 20px;padding-right: 20px;padding-left: 20px;">
97
  <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
98
  <tr>
99
+ <td class="container-cell" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #808080;font-family: Helvetica;font-size: 16px;line-height: 150%;text-align: center;padding-bottom: 20px;">
100
  <h2 style="color: #002030;font-family: Helvetica;font-size: 26px;font-weight: bold;line-height: 150%;margin: 0;padding: 0;text-align: center;">{{ $help_and_support }}</h2>
101
  </td>
102
  </tr>
119
  <td class="section-padding" valign="top" width="600" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;padding-top: 20px;padding-right: 20px;padding-left: 20px;">
120
  <table class="container" align="left" border="0" cellpadding="0" cellspacing="0" width="260" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
121
  <tr>
122
+ <td class="container-cell" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #808080;font-family: Helvetica;font-size: 16px;line-height: 150%;text-align: center;padding-bottom: 20px;">
123
  <img class="preserve-ratio" src="{! $documentation_icon }}" style="max-width: 62px;border: 0;outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;height: auto;" width="62" alt="" align="center">
124
  <br>
125
  <h4 style="color: #202020;font-family: Helvetica;font-size: 20px;font-weight: bold;line-height: 150%;margin: 0;padding: 0;text-align: center;">
132
  </table>
133
  <table class="container" align="right" border="0" cellpadding="0" cellspacing="0" width="260" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
134
  <tr>
135
+ <td class="container-cell container-cell-bottom" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #808080;font-family: Helvetica;font-size: 16px;line-height: 150%;text-align: center;padding-bottom: 20px;">
136
  <img class="preserve-ratio" src="{! $support_icon }}" style="max-width: 62px;border: 0;outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;height: auto;" width="62" alt="" align="center">
137
  <br>
138
  <h4 style="color: #202020;font-family: Helvetica;font-size: 20px;font-weight: bold;line-height: 150%;margin: 0;padding: 0;text-align: center;">
193
  <td class="section-padding" align="center" valign="top" width="600" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;padding-top: 20px;padding-right: 20px;padding-left: 20px;">
194
  <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
195
  <tr>
196
+ <td class="container-cell" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #808080;font-family: Helvetica;font-size: 16px;line-height: 200%;text-align: center;padding-bottom: 0;padding-top: 60px;">
197
  <img class="preserve-ratio" src="{! $footer_logo }}" style="max-width: 50px;border: 0;outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;height: auto;" width="50" alt="" align="center"><br>
198
  <br>
199
  <span style="-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #666f72;font-family: Helvetica;font-size: 11px;line-height: 200%;text-align: center;text-decoration: none;font-weight: bold;">
core/lib/mail-templates/header.html CHANGED
@@ -34,7 +34,7 @@
34
  #body-cell{padding-bottom:20px;}
35
  .section-padding{padding-top:20px;padding-right:20px;padding-left:20px;}
36
  .section-padding-bottom{padding-bottom:20px;}
37
- .container-cell{color:#404040;font-family:Helvetica;font-size:16px;line-height:150%;text-align:center;padding-bottom:20px;}
38
  #top-banner{background-color:#FFCE08;}
39
  #top-banner .container-cell{color:#413F39;font-size:13px;}
40
  #top-logo .container-cell{padding-top:20px;}
@@ -50,7 +50,7 @@
50
  .lockouts-summary .container.left-column{margin-right:60px;}
51
  .lockouts-summary h4{color:#ACAAAA;font-size:16px;font-weight:normal;}
52
  .lockouts-summary p{color:#505050;font-size:30px;font-weight:bold;}
53
- .table{border:1px solid #cdcece;color: #404040;font-family:Helvetica;font-size:14px;}
54
  .table th,.table td{border:1px solid #cdcece;padding:10px;}
55
  .table th{text-align:left;font-weight:bold;padding:5px 10px;}
56
  .table .row-label{font-style:italic;}
@@ -133,7 +133,7 @@
133
  <td class="section-padding" align="center" valign="top" width="600" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;padding-top: 20px;padding-right: 20px;padding-left: 20px;">
134
  <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
135
  <tr>
136
- <td class="container-cell" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #404040;font-family: Helvetica;font-size: 16px;line-height: 150%;text-align: center;padding-bottom: 20px;padding-top: 20px;">
137
  <img class="preserve-ratio" src="{{ $logo }}" style="max-width: 300px;border: 0;outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;height: auto;" alt="" align="center">
138
  </td>
139
  </tr>
@@ -156,7 +156,7 @@
156
  <td class="section-padding" align="center" valign="top" width="600" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;padding-top: 20px;padding-right: 20px;padding-left: 20px;">
157
  <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
158
  <tr>
159
- <td class="container-cell" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #404040;font-family: Helvetica;font-size: 16px;line-height: 150%;text-align: center;padding-bottom: 20px;">
160
  <h1 style="color: #202020;font-family: Helvetica;font-size: 34px;font-weight: bold;line-height: 150%;margin: 0;padding: 0;text-align: center;">{{ $title }}</h1>
161
  </td>
162
  </tr>
34
  #body-cell{padding-bottom:20px;}
35
  .section-padding{padding-top:20px;padding-right:20px;padding-left:20px;}
36
  .section-padding-bottom{padding-bottom:20px;}
37
+ .container-cell{color:#808080;font-family:Helvetica;font-size:16px;line-height:150%;text-align:center;padding-bottom:20px;}
38
  #top-banner{background-color:#FFCE08;}
39
  #top-banner .container-cell{color:#413F39;font-size:13px;}
40
  #top-logo .container-cell{padding-top:20px;}
50
  .lockouts-summary .container.left-column{margin-right:60px;}
51
  .lockouts-summary h4{color:#ACAAAA;font-size:16px;font-weight:normal;}
52
  .lockouts-summary p{color:#505050;font-size:30px;font-weight:bold;}
53
+ .table{border:1px solid #cdcece;color: #808080;font-family:Helvetica;font-size:14px;}
54
  .table th,.table td{border:1px solid #cdcece;padding:10px;}
55
  .table th{text-align:left;font-weight:bold;padding:5px 10px;}
56
  .table .row-label{font-style:italic;}
133
  <td class="section-padding" align="center" valign="top" width="600" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;padding-top: 20px;padding-right: 20px;padding-left: 20px;">
134
  <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
135
  <tr>
136
+ <td class="container-cell" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #808080;font-family: Helvetica;font-size: 16px;line-height: 150%;text-align: center;padding-bottom: 20px;padding-top: 20px;">
137
  <img class="preserve-ratio" src="{{ $logo }}" style="max-width: 300px;border: 0;outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;height: auto;" alt="" align="center">
138
  </td>
139
  </tr>
156
  <td class="section-padding" align="center" valign="top" width="600" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;padding-top: 20px;padding-right: 20px;padding-left: 20px;">
157
  <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
158
  <tr>
159
+ <td class="container-cell" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #808080;font-family: Helvetica;font-size: 16px;line-height: 150%;text-align: center;padding-bottom: 20px;">
160
  <h1 style="color: #202020;font-family: Helvetica;font-size: 34px;font-weight: bold;line-height: 150%;margin: 0;padding: 0;text-align: center;">{{ $title }}</h1>
161
  </td>
162
  </tr>
core/lib/mail-templates/image.html ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <tr>
2
+ <td align="center" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
3
+ <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
4
+ <tr>
5
+ <td align="center" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
6
+ <table class="container" border="0" cellpadding="0" cellspacing="0" width="600" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
7
+ <tr>
8
+ <td class="section-padding" align="center" valign="top" width="600" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;padding-top: 20px;padding-right: 20px;padding-left: 20px;">
9
+ <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
10
+ <tr>
11
+ <td class="container-cell" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #808080;font-family: Helvetica;font-size: 16px;line-height: 150%;text-align: center;padding-bottom: 20px;padding-top: 20px;">
12
+ <img class="preserve-ratio" src="{{ $src }}" style="max-width: {{ $width }}px;border: 0;outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;height: auto;" alt="" align="center">
13
+ </td>
14
+ </tr>
15
+ </table>
16
+ </td>
17
+ </tr>
18
+ </table>
19
+ </td>
20
+ </tr>
21
+ </table>
22
+ </td>
23
+ </tr>
core/lib/mail-templates/info-box.html CHANGED
@@ -8,7 +8,7 @@
8
  <td class="section-padding" align="center" valign="top" width="600" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;padding-top: 40px;padding-right: 40px;padding-left: 40px;">
9
  <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
10
  <tr>
11
- <td class="container-cell" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #404040;font-family: Helvetica;font-size: 16px;line-height: 150%;text-align: center;padding-bottom: 40px;">
12
  <img class="info-icon" src="{{ $icon_url }}" alt="" align="center" width="33" height="23" style="border: 0;outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;height: 23px;width: 33px;vertical-align: middle;">
13
  {{ $content }}
14
  </td>
8
  <td class="section-padding" align="center" valign="top" width="600" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;padding-top: 40px;padding-right: 40px;padding-left: 40px;">
9
  <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
10
  <tr>
11
+ <td class="container-cell" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #808080;font-family: Helvetica;font-size: 16px;line-height: 150%;text-align: center;padding-bottom: 40px;">
12
  <img class="info-icon" src="{{ $icon_url }}" alt="" align="center" width="33" height="23" style="border: 0;outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;height: 23px;width: 33px;vertical-align: middle;">
13
  {{ $content }}
14
  </td>
core/lib/mail-templates/large-text.html CHANGED
@@ -8,7 +8,7 @@
8
  <td class="section-padding" align="center" valign="top" width="600" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;padding-top: 20px;padding-right: 20px;padding-left: 20px;">
9
  <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
10
  <tr>
11
- <td class="container-cell" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #404040;font-family: Helvetica;font-size: 16px;line-height: 150%;text-align: center;padding-bottom: 20px;">
12
  <h4 style="color: #505050;font-family: Helvetica;font-size: 20px;font-weight: bold;line-height: 150%;margin: 0;padding: 0;text-align: center;margin-bottom: 10px;">{{ $content }}</h4>
13
  </td>
14
  </tr>
8
  <td class="section-padding" align="center" valign="top" width="600" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;padding-top: 20px;padding-right: 20px;padding-left: 20px;">
9
  <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
10
  <tr>
11
+ <td class="container-cell" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #808080;font-family: Helvetica;font-size: 16px;line-height: 150%;text-align: center;padding-bottom: 20px;">
12
  <h4 style="color: #505050;font-family: Helvetica;font-size: 20px;font-weight: bold;line-height: 150%;margin: 0;padding: 0;text-align: center;margin-bottom: 10px;">{{ $content }}</h4>
13
  </td>
14
  </tr>
core/lib/mail-templates/list.html CHANGED
@@ -8,7 +8,7 @@
8
  <td class="section-padding" align="center" valign="top" width="600" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;padding-top: 20px;padding-right: 20px;padding-left: 20px;">
9
  <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
10
  <tr>
11
- <td class="container-cell" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #404040;font-family: Helvetica;font-size: 16px;line-height: 150%;text-align: center;padding-bottom: 20px;">
12
  <div style="text-align: left;">
13
  <ul style="font-size: 15px; line-height: 1.2; text-align: left; margin: 20px 0 20px 20px; padding: 0;">
14
  {{ $html }}
8
  <td class="section-padding" align="center" valign="top" width="600" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;padding-top: 20px;padding-right: 20px;padding-left: 20px;">
9
  <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
10
  <tr>
11
+ <td class="container-cell" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #808080;font-family: Helvetica;font-size: 16px;line-height: 150%;text-align: center;padding-bottom: 20px;">
12
  <div style="text-align: left;">
13
  <ul style="font-size: 15px; line-height: 1.2; text-align: left; margin: 20px 0 20px 20px; padding: 0;">
14
  {{ $html }}
core/lib/mail-templates/lockouts-summary.html CHANGED
@@ -8,7 +8,7 @@
8
  <td class="section-padding" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;padding-top: 20px;padding-right: 20px;padding-left: 20px;">
9
  <table class="container left-column" align="left" border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;margin-right: 60px;">
10
  <tr>
11
- <td class="container-cell" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #404040;font-family: Helvetica;font-size: 16px;line-height: 150%;text-align: center;padding-bottom: 20px;">
12
  <h4 style="color: #ACAAAA;font-family: Helvetica;font-size: 16px;font-weight: normal;line-height: 150%;margin: 0;padding: 0;text-align: center;">{{ $users_text }}</h4>
13
  <p style="-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;font-family: Helvetica;font-size: 30px;line-height: 150%;margin-top: 10px;margin-right: 0;margin-bottom: 10px;margin-left: 0;padding: 0;text-align: center;color: #505050;font-weight: bold;">{{ $user_count }}</p>
14
  </td>
@@ -16,7 +16,7 @@
16
  </table>
17
  <table class="container right-column" align="right" border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
18
  <tr>
19
- <td class="container-cell" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #404040;font-family: Helvetica;font-size: 16px;line-height: 150%;text-align: center;padding-bottom: 20px;">
20
  <h4 style="color: #ACAAAA;font-family: Helvetica;font-size: 16px;font-weight: normal;line-height: 150%;margin: 0;padding: 0;text-align: center;">{{ $hosts_text }}</h4>
21
  <p style="-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;font-family: Helvetica;font-size: 30px;line-height: 150%;margin-top: 10px;margin-right: 0;margin-bottom: 10px;margin-left: 0;padding: 0;text-align: center;color: #505050;font-weight: bold;">{{ $host_count }}</p>
22
  </td>
8
  <td class="section-padding" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;padding-top: 20px;padding-right: 20px;padding-left: 20px;">
9
  <table class="container left-column" align="left" border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;margin-right: 60px;">
10
  <tr>
11
+ <td class="container-cell" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #808080;font-family: Helvetica;font-size: 16px;line-height: 150%;text-align: center;padding-bottom: 20px;">
12
  <h4 style="color: #ACAAAA;font-family: Helvetica;font-size: 16px;font-weight: normal;line-height: 150%;margin: 0;padding: 0;text-align: center;">{{ $users_text }}</h4>
13
  <p style="-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;font-family: Helvetica;font-size: 30px;line-height: 150%;margin-top: 10px;margin-right: 0;margin-bottom: 10px;margin-left: 0;padding: 0;text-align: center;color: #505050;font-weight: bold;">{{ $user_count }}</p>
14
  </td>
16
  </table>
17
  <table class="container right-column" align="right" border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
18
  <tr>
19
+ <td class="container-cell" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #808080;font-family: Helvetica;font-size: 16px;line-height: 150%;text-align: center;padding-bottom: 20px;">
20
  <h4 style="color: #ACAAAA;font-family: Helvetica;font-size: 16px;font-weight: normal;line-height: 150%;margin: 0;padding: 0;text-align: center;">{{ $hosts_text }}</h4>
21
  <p style="-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;font-family: Helvetica;font-size: 30px;line-height: 150%;margin-top: 10px;margin-right: 0;margin-bottom: 10px;margin-left: 0;padding: 0;text-align: center;color: #505050;font-weight: bold;">{{ $host_count }}</p>
22
  </td>
core/lib/mail-templates/module-button.html CHANGED
@@ -1,24 +1,18 @@
 
 
 
 
 
 
1
  <tr>
2
- <td align="center" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
3
- <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
4
  <tr>
5
- <td align="center" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
6
- <table class="container" border="0" cellpadding="0" cellspacing="0" width="600" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
7
  <tr>
8
- <td class="section-padding section-padding-bottom" align="center" valign="top" width="600" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;padding-top: 20px;padding-right: 20px;padding-left: 20px;padding-bottom: 20px;">
9
- <table width="100%" border="0" cellspacing="0" cellpadding="0" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
10
- <tr>
11
- <td style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
12
- <table class="module-button" border="0" cellspacing="0" cellpadding="0" align="center" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
13
- <tr>
14
- <td class="border-radius" align="center" bgcolor="#FFCD08" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;-webkit-border-radius: 5px;-moz-border-radius: 5px;border-radius: 5px;">
15
- <a class="border-radius" href="{{ $href }}" target="_blank" style="-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #2E280E;font-family: Helvetica;font-size: 18px;line-height: 100%;text-align: center;text-decoration: none;background-color: #FFCD08;border: 1px solid #FFCD08;display: inline-block;font-weight: bold;padding-top: 20px;padding-right: 30px;padding-bottom: 20px;padding-left: 30px;-webkit-border-radius: 5px;-moz-border-radius: 5px;border-radius: 5px;">{{ $link_text }}</a>
16
- </td>
17
- </tr>
18
- </table>
19
- </td>
20
- </tr>
21
- </table>
22
  </td>
23
  </tr>
24
  </table>
@@ -27,3 +21,9 @@
27
  </table>
28
  </td>
29
  </tr>
 
 
 
 
 
 
1
+ <tr>
2
+ <td align="center" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
3
+ <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
4
+ <tr>
5
+ <td align="center" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
6
+ <table class="container" border="0" cellpadding="0" cellspacing="0" width="600" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
7
  <tr>
8
+ <td class="section-padding section-padding-bottom" align="center" valign="top" width="600" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;padding-top: 20px;padding-right: 20px;padding-left: 20px;padding-bottom: 20px;">
9
+ <table width="100%" border="0" cellspacing="0" cellpadding="0" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
10
  <tr>
11
+ <td style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
12
+ <table class="module-button" border="0" cellspacing="0" cellpadding="0" align="center" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
13
  <tr>
14
+ <td class="border-radius" align="center" bgcolor="{{ $bk_color }}" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;-webkit-border-radius: 5px;-moz-border-radius: 5px;border-radius: 5px;">
15
+ <a class="border-radius" href="{{ $href }}" target="_blank" style="-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: {{ $txt_color }};font-family: Helvetica;font-size: 18px;line-height: 100%;text-align: center;text-decoration: none;background-color: {{ $bk_color }};border: 1px solid {{ $bk_color }};display: inline-block;font-weight: bold;padding-top: 20px;padding-right: 30px;padding-bottom: 20px;padding-left: 30px;-webkit-border-radius: 5px;-moz-border-radius: 5px;border-radius: 5px;">{{ $link_text }}</a>
 
 
 
 
 
 
 
 
 
 
 
 
16
  </td>
17
  </tr>
18
  </table>
21
  </table>
22
  </td>
23
  </tr>
24
+ </table>
25
+ </td>
26
+ </tr>
27
+ </table>
28
+ </td>
29
+ </tr>
core/lib/mail-templates/pro-callout.html CHANGED
@@ -8,7 +8,7 @@
8
  <td align="center" valign="top" width="600" class="section-padding" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;padding-top: 40px;padding-right: 20px;padding-left: 20px;">
9
  <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
10
  <tr>
11
- <td valign="top" class="container-cell" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #404040;font-family: Helvetica;font-size: 16px;line-height: 150%;text-align: center;padding-bottom: 20px;">
12
  <img class="preserve-ratio" src="{! $pro_logo_no_text }}" style="max-width: 100px;border: 0;outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;height: auto;" width="100" alt="" align="center">
13
  <p class="two-factor" style="-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;font-family: Helvetica;font-size: 16px;line-height: 150%;margin-top: 20px;margin-right: 0;margin-bottom: 20px;margin-left: 0;padding: 0;text-align: center;color: #FFFFFF;">{{ $two_factor }}</p>
14
  <table width="100%" border="0" cellspacing="0" cellpadding="0" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
8
  <td align="center" valign="top" width="600" class="section-padding" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;padding-top: 40px;padding-right: 20px;padding-left: 20px;">
9
  <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
10
  <tr>
11
+ <td valign="top" class="container-cell" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #808080;font-family: Helvetica;font-size: 16px;line-height: 150%;text-align: center;padding-bottom: 20px;">
12
  <img class="preserve-ratio" src="{! $pro_logo_no_text }}" style="max-width: 100px;border: 0;outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;height: auto;" width="100" alt="" align="center">
13
  <p class="two-factor" style="-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;font-family: Helvetica;font-size: 16px;line-height: 150%;margin-top: 20px;margin-right: 0;margin-bottom: 20px;margin-left: 0;padding: 0;text-align: center;color: #FFFFFF;">{{ $two_factor }}</p>
14
  <table width="100%" border="0" cellspacing="0" cellpadding="0" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
core/lib/mail-templates/section-heading-with-icon.html CHANGED
@@ -8,7 +8,7 @@
8
  <td class="section-padding" align="center" valign="top" width="600" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;padding-top: 20px;padding-right: 20px;padding-left: 20px;">
9
  <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
10
  <tr>
11
- <td class="container-cell" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #404040;font-family: Helvetica;font-size: 16px;line-height: 150%;text-align: center;padding-bottom: 0;">
12
  <h4 style="color: #0084CB;font-family: Helvetica;font-size: 16px;font-weight: bold;line-height: 150%;margin: 0;padding: 0;text-align: center;">
13
  <img src="{{ $icon_url }}" alt="" align="center" style="border: 0;outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;height: auto;padding-top: 2px;padding-right: 5px;vertical-align: top;">
14
  {{ $content }}
8
  <td class="section-padding" align="center" valign="top" width="600" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;padding-top: 20px;padding-right: 20px;padding-left: 20px;">
9
  <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
10
  <tr>
11
+ <td class="container-cell" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #808080;font-family: Helvetica;font-size: 16px;line-height: 150%;text-align: center;padding-bottom: 0;">
12
  <h4 style="color: #0084CB;font-family: Helvetica;font-size: 16px;font-weight: bold;line-height: 150%;margin: 0;padding: 0;text-align: center;">
13
  <img src="{{ $icon_url }}" alt="" align="center" style="border: 0;outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;height: auto;padding-top: 2px;padding-right: 5px;vertical-align: top;">
14
  {{ $content }}
core/lib/mail-templates/section-heading.html CHANGED
@@ -8,7 +8,7 @@
8
  <td class="section-padding" align="center" valign="top" width="600" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;padding-top: 20px;padding-right: 20px;padding-left: 20px;">
9
  <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
10
  <tr>
11
- <td class="container-cell" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #404040;font-family: Helvetica;font-size: 16px;line-height: 150%;text-align: center;padding-bottom: 0;">
12
  <h4 style="color: #0084CB;font-family: Helvetica;font-size: 16px;font-weight: bold;line-height: 150%;margin: 0;padding: 0;text-align: center;">
13
  {{ $content }}
14
  </h4>
8
  <td class="section-padding" align="center" valign="top" width="600" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;padding-top: 20px;padding-right: 20px;padding-left: 20px;">
9
  <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
10
  <tr>
11
+ <td class="container-cell" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #808080;font-family: Helvetica;font-size: 16px;line-height: 150%;text-align: center;padding-bottom: 0;">
12
  <h4 style="color: #0084CB;font-family: Helvetica;font-size: 16px;font-weight: bold;line-height: 150%;margin: 0;padding: 0;text-align: center;">
13
  {{ $content }}
14
  </h4>
core/lib/mail-templates/table.html CHANGED
@@ -1,9 +1,9 @@
1
  <tr>
2
  <td align="center" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
3
- <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
4
  <tr>
5
  <td align="center" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
6
- <table class="table" border="0" cellpadding="0" cellspacing="0" style="width: auto;max-width: 850px;border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;border:1px solid #CDCECE; color: #404040;font-family: Helvetica;">
7
  {{ $html }}
8
  </table>
9
  </td>
1
  <tr>
2
  <td align="center" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
3
+ <table border="0" cellpadding="0" cellspacing="0" width="100%" style="margin: 40px 0;border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
4
  <tr>
5
  <td align="center" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
6
+ <table class="table" border="0" cellpadding="0" cellspacing="0" style="width: auto;max-width: 850px;border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;border:1px solid #CDCECE; color: #808080;font-family: Helvetica;">
7
  {{ $html }}
8
  </table>
9
  </td>
core/lib/mail-templates/text.html CHANGED
@@ -8,7 +8,7 @@
8
  <td class="section-padding" align="center" valign="top" width="600" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;padding-top: 20px;padding-right: 20px;padding-left: 20px;">
9
  <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
10
  <tr>
11
- <td class="container-cell" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #404040;font-family: Helvetica;font-size: 16px;line-height: 150%;text-align: center;padding-bottom: 20px;">
12
  {{ $content }}
13
  </td>
14
  </tr>
8
  <td class="section-padding" align="center" valign="top" width="600" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;padding-top: 20px;padding-right: 20px;padding-left: 20px;">
9
  <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
10
  <tr>
11
+ <td class="container-cell" valign="top" style="border-collapse: collapse;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #808080;font-family: Helvetica;font-size: 16px;line-height: 150%;text-align: center;padding-bottom: 20px;">
12
  {{ $content }}
13
  </td>
14
  </tr>
core/lib/schema.php CHANGED
@@ -83,6 +83,36 @@ CREATE TABLE {$wpdb->base_prefix}itsec_distributed_storage (
83
  storage_updated datetime NOT NULL,
84
  PRIMARY KEY (storage_id),
85
  UNIQUE KEY storage_group__key__chunk (storage_group,storage_key,storage_chunk)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  ) $charset_collate;";
87
 
88
  require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
@@ -97,5 +127,7 @@ CREATE TABLE {$wpdb->base_prefix}itsec_distributed_storage (
97
  $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->base_prefix}itsec_lockouts;" );
98
  $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->base_prefix}itsec_temp;" );
99
  $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->base_prefix}itsec_distributed_storage;" );
 
 
100
  }
101
  }
83
  storage_updated datetime NOT NULL,
84
  PRIMARY KEY (storage_id),
85
  UNIQUE KEY storage_group__key__chunk (storage_group,storage_key,storage_chunk)
86
+ ) $charset_collate;
87
+
88
+ CREATE TABLE {$wpdb->base_prefix}itsec_geolocation_cache (
89
+ location_id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
90
+ location_host varchar(40) NOT NULL,
91
+ location_lat decimal(10,8) NOT NULL,
92
+ location_long decimal(11,8) NOT NULL,
93
+ location_label varchar(255) NOT NULL,
94
+ location_credit varchar (255) NOT NULL,
95
+ location_time datetime NOT NULL,
96
+ PRIMARY KEY (location_id),
97
+ UNIQUE KEY location_host (location_host),
98
+ KEY location_time (location_time)
99
+ ) $charset_collate;
100
+
101
+ CREATE TABLE {$wpdb->base_prefix}itsec_fingerprints (
102
+ fingerprint_id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
103
+ fingerprint_user bigint(20) UNSIGNED NOT NULL,
104
+ fingerprint_hash char(32) NOT NULL,
105
+ fingerprint_created_at datetime NOT NULL,
106
+ fingerprint_approved_at datetime NOT NULL,
107
+ fingerprint_data longtext NOT NULL,
108
+ fingerprint_snapshot longtext NOT NULL,
109
+ fingerprint_last_seen datetime NOT NULL,
110
+ fingerprint_uses int NOT NULL default 0,
111
+ fingerprint_status varchar(20) NOT NULL,
112
+ fingerprint_uuid char(36) NOT NULL,
113
+ PRIMARY KEY (fingerprint_id),
114
+ UNIQUE KEY fingerprint_user__hash (fingerprint_user,fingerprint_hash),
115
+ UNIQUE KEY fingerprint_uuid (fingerprint_uuid)
116
  ) $charset_collate;";
117
 
118
  require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
127
  $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->base_prefix}itsec_lockouts;" );
128
  $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->base_prefix}itsec_temp;" );
129
  $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->base_prefix}itsec_distributed_storage;" );
130
+ $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->base_prefix}itsec_geolocation_cache;" );
131
+ $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->base_prefix}itsec_fingerprints;" );
132
  }
133
  }
core/lib/static-map-api/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden.
core/lib/static-map-api/interface-itsec-static-map-api.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Interface ITSEC_Static_Map_API
5
+ */
6
+ interface ITSEC_Static_Map_API {
7
+
8
+ /**
9
+ * Get the map for a location.
10
+ *
11
+ * @param array $config
12
+ *
13
+ * @return string|WP_Error URL to the image.
14
+ */
15
+ public function get_map( array $config );
16
+
17
+ /**
18
+ * Is this static map API available to be used.
19
+ *
20
+ * @return bool
21
+ */
22
+ public function is_available();
23
+ }
core/modules/core/js/mc-validate.js CHANGED
@@ -10,10 +10,10 @@
10
  */
11
  !function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):e("undefined"!=typeof jQuery?jQuery:window.Zepto)}(function(e){"use strict";function t(t){var r=t.data;t.isDefaultPrevented()||(t.preventDefault(),e(t.target).ajaxSubmit(r))}function r(t){var r=t.target,a=e(r);if(!a.is("[type=submit],[type=image]")){var n=a.closest("[type=submit]");if(0===n.length)return;r=n[0]}var i=this;if(i.clk=r,"image"==r.type)if(void 0!==t.offsetX)i.clk_x=t.offsetX,i.clk_y=t.offsetY;else if("function"==typeof e.fn.offset){var o=a.offset();i.clk_x=t.pageX-o.left,i.clk_y=t.pageY-o.top}else i.clk_x=t.pageX-r.offsetLeft,i.clk_y=t.pageY-r.offsetTop;setTimeout(function(){i.clk=i.clk_x=i.clk_y=null},100)}function a(){if(e.fn.ajaxSubmit.debug){var t="[jquery.form] "+Array.prototype.join.call(arguments,"");window.console&&window.console.log?window.console.log(t):window.opera&&window.opera.postError&&window.opera.postError(t)}}var n={};n.fileapi=void 0!==e("<input type='file'/>").get(0).files,n.formdata=void 0!==window.FormData;var i=!!e.fn.prop;e.fn.attr2=function(){if(!i)return this.attr.apply(this,arguments);var e=this.prop.apply(this,arguments);return e&&e.jquery||"string"==typeof e?e:this.attr.apply(this,arguments)},e.fn.ajaxSubmit=function(t){function r(r){var a,n,i=e.param(r,t.traditional).split("&"),o=i.length,s=[];for(a=0;o>a;a++)i[a]=i[a].replace(/\+/g," "),n=i[a].split("="),s.push([decodeURIComponent(n[0]),decodeURIComponent(n[1])]);return s}function o(a){for(var n=new FormData,i=0;i<a.length;i++)n.append(a[i].name,a[i].value);if(t.extraData){var o=r(t.extraData);for(i=0;i<o.length;i++)o[i]&&n.append(o[i][0],o[i][1])}t.data=null;var s=e.extend(!0,{},e.ajaxSettings,t,{contentType:!1,processData:!1,cache:!1,type:u||"POST"});t.uploadProgress&&(s.xhr=function(){var r=e.ajaxSettings.xhr();return r.upload&&r.upload.addEventListener("progress",function(e){var r=0,a=e.loaded||e.position,n=e.total;e.lengthComputable&&(r=Math.ceil(a/n*100)),t.uploadProgress(e,a,n,r)},!1),r}),s.data=null;var c=s.beforeSend;return s.beforeSend=function(e,r){r.data=t.formData?t.formData:n,c&&c.call(this,e,r)},e.ajax(s)}function s(r){function n(e){var t=null;try{e.contentWindow&&(t=e.contentWindow.document)}catch(r){a("cannot get iframe.contentWindow document: "+r)}if(t)return t;try{t=e.contentDocument?e.contentDocument:e.document}catch(r){a("cannot get iframe.contentDocument: "+r),t=e.document}return t}function o(){function t(){try{var e=n(g).readyState;a("state = "+e),e&&"uninitialized"==e.toLowerCase()&&setTimeout(t,50)}catch(r){a("Server abort: ",r," (",r.name,")"),s(k),j&&clearTimeout(j),j=void 0}}var r=f.attr2("target"),i=f.attr2("action"),o="multipart/form-data",c=f.attr("enctype")||f.attr("encoding")||o;w.setAttribute("target",p),(!u||/post/i.test(u))&&w.setAttribute("method","POST"),i!=m.url&&w.setAttribute("action",m.url),m.skipEncodingOverride||u&&!/post/i.test(u)||f.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"}),m.timeout&&(j=setTimeout(function(){T=!0,s(D)},m.timeout));var l=[];try{if(m.extraData)for(var d in m.extraData)m.extraData.hasOwnProperty(d)&&l.push(e.isPlainObject(m.extraData[d])&&m.extraData[d].hasOwnProperty("name")&&m.extraData[d].hasOwnProperty("value")?e('<input type="hidden" name="'+m.extraData[d].name+'">').val(m.extraData[d].value).appendTo(w)[0]:e('<input type="hidden" name="'+d+'">').val(m.extraData[d]).appendTo(w)[0]);m.iframeTarget||v.appendTo("body"),g.attachEvent?g.attachEvent("onload",s):g.addEventListener("load",s,!1),setTimeout(t,15);try{w.submit()}catch(h){var x=document.createElement("form").submit;x.apply(w)}}finally{w.setAttribute("action",i),w.setAttribute("enctype",c),r?w.setAttribute("target",r):f.removeAttr("target"),e(l).remove()}}function s(t){if(!x.aborted&&!F){if(M=n(g),M||(a("cannot access response document"),t=k),t===D&&x)return x.abort("timeout"),void S.reject(x,"timeout");if(t==k&&x)return x.abort("server abort"),void S.reject(x,"error","server abort");if(M&&M.location.href!=m.iframeSrc||T){g.detachEvent?g.detachEvent("onload",s):g.removeEventListener("load",s,!1);var r,i="success";try{if(T)throw"timeout";var o="xml"==m.dataType||M.XMLDocument||e.isXMLDoc(M);if(a("isXml="+o),!o&&window.opera&&(null===M.body||!M.body.innerHTML)&&--O)return a("requeing onLoad callback, DOM not available"),void setTimeout(s,250);var u=M.body?M.body:M.documentElement;x.responseText=u?u.innerHTML:null,x.responseXML=M.XMLDocument?M.XMLDocument:M,o&&(m.dataType="xml"),x.getResponseHeader=function(e){var t={"content-type":m.dataType};return t[e.toLowerCase()]},u&&(x.status=Number(u.getAttribute("status"))||x.status,x.statusText=u.getAttribute("statusText")||x.statusText);var c=(m.dataType||"").toLowerCase(),l=/(json|script|text)/.test(c);if(l||m.textarea){var f=M.getElementsByTagName("textarea")[0];if(f)x.responseText=f.value,x.status=Number(f.getAttribute("status"))||x.status,x.statusText=f.getAttribute("statusText")||x.statusText;else if(l){var p=M.getElementsByTagName("pre")[0],h=M.getElementsByTagName("body")[0];p?x.responseText=p.textContent?p.textContent:p.innerText:h&&(x.responseText=h.textContent?h.textContent:h.innerText)}}else"xml"==c&&!x.responseXML&&x.responseText&&(x.responseXML=X(x.responseText));try{E=_(x,c,m)}catch(y){i="parsererror",x.error=r=y||i}}catch(y){a("error caught: ",y),i="error",x.error=r=y||i}x.aborted&&(a("upload aborted"),i=null),x.status&&(i=x.status>=200&&x.status<300||304===x.status?"success":"error"),"success"===i?(m.success&&m.success.call(m.context,E,"success",x),S.resolve(x.responseText,"success",x),d&&e.event.trigger("ajaxSuccess",[x,m])):i&&(void 0===r&&(r=x.statusText),m.error&&m.error.call(m.context,x,i,r),S.reject(x,"error",r),d&&e.event.trigger("ajaxError",[x,m,r])),d&&e.event.trigger("ajaxComplete",[x,m]),d&&!--e.active&&e.event.trigger("ajaxStop"),m.complete&&m.complete.call(m.context,x,i),F=!0,m.timeout&&clearTimeout(j),setTimeout(function(){m.iframeTarget?v.attr("src",m.iframeSrc):v.remove(),x.responseXML=null},100)}}}var c,l,m,d,p,v,g,x,y,b,T,j,w=f[0],S=e.Deferred();if(S.abort=function(e){x.abort(e)},r)for(l=0;l<h.length;l++)c=e(h[l]),i?c.prop("disabled",!1):c.removeAttr("disabled");if(m=e.extend(!0,{},e.ajaxSettings,t),m.context=m.context||m,p="jqFormIO"+(new Date).getTime(),m.iframeTarget?(v=e(m.iframeTarget),b=v.attr2("name"),b?p=b:v.attr2("name",p)):(v=e('<iframe name="'+p+'" src="'+m.iframeSrc+'" />'),v.css({position:"absolute",top:"-1000px",left:"-1000px"})),g=v[0],x={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(t){var r="timeout"===t?"timeout":"aborted";a("aborting upload... "+r),this.aborted=1;try{g.contentWindow.document.execCommand&&g.contentWindow.document.execCommand("Stop")}catch(n){}v.attr("src",m.iframeSrc),x.error=r,m.error&&m.error.call(m.context,x,r,t),d&&e.event.trigger("ajaxError",[x,m,r]),m.complete&&m.complete.call(m.context,x,r)}},d=m.global,d&&0===e.active++&&e.event.trigger("ajaxStart"),d&&e.event.trigger("ajaxSend",[x,m]),m.beforeSend&&m.beforeSend.call(m.context,x,m)===!1)return m.global&&e.active--,S.reject(),S;if(x.aborted)return S.reject(),S;y=w.clk,y&&(b=y.name,b&&!y.disabled&&(m.extraData=m.extraData||{},m.extraData[b]=y.value,"image"==y.type&&(m.extraData[b+".x"]=w.clk_x,m.extraData[b+".y"]=w.clk_y)));var D=1,k=2,A=e("meta[name=csrf-token]").attr("content"),L=e("meta[name=csrf-param]").attr("content");L&&A&&(m.extraData=m.extraData||{},m.extraData[L]=A),m.forceSync?o():setTimeout(o,10);var E,M,F,O=50,X=e.parseXML||function(e,t){return window.ActiveXObject?(t=new ActiveXObject("Microsoft.XMLDOM"),t.async="false",t.loadXML(e)):t=(new DOMParser).parseFromString(e,"text/xml"),t&&t.documentElement&&"parsererror"!=t.documentElement.nodeName?t:null},C=e.parseJSON||function(e){return window.eval("("+e+")")},_=function(t,r,a){var n=t.getResponseHeader("content-type")||"",i="xml"===r||!r&&n.indexOf("xml")>=0,o=i?t.responseXML:t.responseText;return i&&"parsererror"===o.documentElement.nodeName&&e.error&&e.error("parsererror"),a&&a.dataFilter&&(o=a.dataFilter(o,r)),"string"==typeof o&&("json"===r||!r&&n.indexOf("json")>=0?o=C(o):("script"===r||!r&&n.indexOf("javascript")>=0)&&e.globalEval(o)),o};return S}if(!this.length)return a("ajaxSubmit: skipping submit process - no element selected"),this;var u,c,l,f=this;"function"==typeof t?t={success:t}:void 0===t&&(t={}),u=t.type||this.attr2("method"),c=t.url||this.attr2("action"),l="string"==typeof c?e.trim(c):"",l=l||window.location.href||"",l&&(l=(l.match(/^([^#]+)/)||[])[1]),t=e.extend(!0,{url:l,success:e.ajaxSettings.success,type:u||e.ajaxSettings.type,iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},t);var m={};if(this.trigger("form-pre-serialize",[this,t,m]),m.veto)return a("ajaxSubmit: submit vetoed via form-pre-serialize trigger"),this;if(t.beforeSerialize&&t.beforeSerialize(this,t)===!1)return a("ajaxSubmit: submit aborted via beforeSerialize callback"),this;var d=t.traditional;void 0===d&&(d=e.ajaxSettings.traditional);var p,h=[],v=this.formToArray(t.semantic,h);if(t.data&&(t.extraData=t.data,p=e.param(t.data,d)),t.beforeSubmit&&t.beforeSubmit(v,this,t)===!1)return a("ajaxSubmit: submit aborted via beforeSubmit callback"),this;if(this.trigger("form-submit-validate",[v,this,t,m]),m.veto)return a("ajaxSubmit: submit vetoed via form-submit-validate trigger"),this;var g=e.param(v,d);p&&(g=g?g+"&"+p:p),"GET"==t.type.toUpperCase()?(t.url+=(t.url.indexOf("?")>=0?"&":"?")+g,t.data=null):t.data=g;var x=[];if(t.resetForm&&x.push(function(){f.resetForm()}),t.clearForm&&x.push(function(){f.clearForm(t.includeHidden)}),!t.dataType&&t.target){var y=t.success||function(){};x.push(function(r){var a=t.replaceTarget?"replaceWith":"html";e(t.target)[a](r).each(y,arguments)})}else t.success&&x.push(t.success);if(t.success=function(e,r,a){for(var n=t.context||this,i=0,o=x.length;o>i;i++)x[i].apply(n,[e,r,a||f,f])},t.error){var b=t.error;t.error=function(e,r,a){var n=t.context||this;b.apply(n,[e,r,a,f])}}if(t.complete){var T=t.complete;t.complete=function(e,r){var a=t.context||this;T.apply(a,[e,r,f])}}var j=e("input[type=file]:enabled",this).filter(function(){return""!==e(this).val()}),w=j.length>0,S="multipart/form-data",D=f.attr("enctype")==S||f.attr("encoding")==S,k=n.fileapi&&n.formdata;a("fileAPI :"+k);var A,L=(w||D)&&!k;t.iframe!==!1&&(t.iframe||L)?t.closeKeepAlive?e.get(t.closeKeepAlive,function(){A=s(v)}):A=s(v):A=(w||D)&&k?o(v):e.ajax(t),f.removeData("jqxhr").data("jqxhr",A);for(var E=0;E<h.length;E++)h[E]=null;return this.trigger("form-submit-notify",[this,t]),this},e.fn.ajaxForm=function(n){if(n=n||{},n.delegation=n.delegation&&e.isFunction(e.fn.on),!n.delegation&&0===this.length){var i={s:this.selector,c:this.context};return!e.isReady&&i.s?(a("DOM not ready, queuing ajaxForm"),e(function(){e(i.s,i.c).ajaxForm(n)}),this):(a("terminating; zero elements found by selector"+(e.isReady?"":" (DOM not ready)")),this)}return n.delegation?(e(document).off("submit.form-plugin",this.selector,t).off("click.form-plugin",this.selector,r).on("submit.form-plugin",this.selector,n,t).on("click.form-plugin",this.selector,n,r),this):this.ajaxFormUnbind().bind("submit.form-plugin",n,t).bind("click.form-plugin",n,r)},e.fn.ajaxFormUnbind=function(){return this.unbind("submit.form-plugin click.form-plugin")},e.fn.formToArray=function(t,r){var a=[];if(0===this.length)return a;var i,o=this[0],s=this.attr("id"),u=t?o.getElementsByTagName("*"):o.elements;if(u&&!/MSIE [678]/.test(navigator.userAgent)&&(u=e(u).get()),s&&(i=e(':input[form="'+s+'"]').get(),i.length&&(u=(u||[]).concat(i))),!u||!u.length)return a;var c,l,f,m,d,p,h;for(c=0,p=u.length;p>c;c++)if(d=u[c],f=d.name,f&&!d.disabled)if(t&&o.clk&&"image"==d.type)o.clk==d&&(a.push({name:f,value:e(d).val(),type:d.type}),a.push({name:f+".x",value:o.clk_x},{name:f+".y",value:o.clk_y}));else if(m=e.fieldValue(d,!0),m&&m.constructor==Array)for(r&&r.push(d),l=0,h=m.length;h>l;l++)a.push({name:f,value:m[l]});else if(n.fileapi&&"file"==d.type){r&&r.push(d);var v=d.files;if(v.length)for(l=0;l<v.length;l++)a.push({name:f,value:v[l],type:d.type});else a.push({name:f,value:"",type:d.type})}else null!==m&&"undefined"!=typeof m&&(r&&r.push(d),a.push({name:f,value:m,type:d.type,required:d.required}));if(!t&&o.clk){var g=e(o.clk),x=g[0];f=x.name,f&&!x.disabled&&"image"==x.type&&(a.push({name:f,value:g.val()}),a.push({name:f+".x",value:o.clk_x},{name:f+".y",value:o.clk_y}))}return a},e.fn.formSerialize=function(t){return e.param(this.formToArray(t))},e.fn.fieldSerialize=function(t){var r=[];return this.each(function(){var a=this.name;if(a){var n=e.fieldValue(this,t);if(n&&n.constructor==Array)for(var i=0,o=n.length;o>i;i++)r.push({name:a,value:n[i]});else null!==n&&"undefined"!=typeof n&&r.push({name:this.name,value:n})}}),e.param(r)},e.fn.fieldValue=function(t){for(var r=[],a=0,n=this.length;n>a;a++){var i=this[a],o=e.fieldValue(i,t);null===o||"undefined"==typeof o||o.constructor==Array&&!o.length||(o.constructor==Array?e.merge(r,o):r.push(o))}return r},e.fieldValue=function(t,r){var a=t.name,n=t.type,i=t.tagName.toLowerCase();if(void 0===r&&(r=!0),r&&(!a||t.disabled||"reset"==n||"button"==n||("checkbox"==n||"radio"==n)&&!t.checked||("submit"==n||"image"==n)&&t.form&&t.form.clk!=t||"select"==i&&-1==t.selectedIndex))return null;if("select"==i){var o=t.selectedIndex;if(0>o)return null;for(var s=[],u=t.options,c="select-one"==n,l=c?o+1:u.length,f=c?o:0;l>f;f++){var m=u[f];if(m.selected){var d=m.value;if(d||(d=m.attributes&&m.attributes.value&&!m.attributes.value.specified?m.text:m.value),c)return d;s.push(d)}}return s}return e(t).val()},e.fn.clearForm=function(t){return this.each(function(){e("input,select,textarea",this).clearFields(t)})},e.fn.clearFields=e.fn.clearInputs=function(t){var r=/^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i;return this.each(function(){var a=this.type,n=this.tagName.toLowerCase();r.test(a)||"textarea"==n?this.value="":"checkbox"==a||"radio"==a?this.checked=!1:"select"==n?this.selectedIndex=-1:"file"==a?/MSIE/.test(navigator.userAgent)?e(this).replaceWith(e(this).clone(!0)):e(this).val(""):t&&(t===!0&&/hidden/.test(a)||"string"==typeof t&&e(this).is(t))&&(this.value="")})},e.fn.resetForm=function(){return this.each(function(){("function"==typeof this.reset||"object"==typeof this.reset&&!this.reset.nodeType)&&this.reset()})},e.fn.enable=function(e){return void 0===e&&(e=!0),this.each(function(){this.disabled=!e})},e.fn.selected=function(t){return void 0===t&&(t=!0),this.each(function(){var r=this.type;if("checkbox"==r||"radio"==r)this.checked=t;else if("option"==this.tagName.toLowerCase()){var a=e(this).parent("select");t&&a[0]&&"select-one"==a[0].type&&a.find("option").selected(!1),this.selected=t}})},e.fn.ajaxSubmit.debug=!1});
12
 
13
- /*! jQuery Validation Plugin - v1.12.0 - 4/1/2014
14
- * http://jqueryvalidation.org/
15
- * Copyright (c) 2014 Jörn Zaefferer; Licensed MIT */
16
- !function(a){a.extend(a.fn,{validate:function(b){if(!this.length)return void(b&&b.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing."));var c=a.data(this[0],"validator");return c?c:(this.attr("novalidate","novalidate"),c=new a.validator(b,this[0]),a.data(this[0],"validator",c),c.settings.onsubmit&&(this.validateDelegate(":submit","click",function(b){c.settings.submitHandler&&(c.submitButton=b.target),a(b.target).hasClass("cancel")&&(c.cancelSubmit=!0),void 0!==a(b.target).attr("formnovalidate")&&(c.cancelSubmit=!0)}),this.submit(function(b){function d(){var d;return c.settings.submitHandler?(c.submitButton&&(d=a("<input type='hidden'/>").attr("name",c.submitButton.name).val(a(c.submitButton).val()).appendTo(c.currentForm)),c.settings.submitHandler.call(c,c.currentForm,b),c.submitButton&&d.remove(),!1):!0}return c.settings.debug&&b.preventDefault(),c.cancelSubmit?(c.cancelSubmit=!1,d()):c.form()?c.pendingRequest?(c.formSubmitted=!0,!1):d():(c.focusInvalid(),!1)})),c)},valid:function(){var b,c;return a(this[0]).is("form")?b=this.validate().form():(b=!0,c=a(this[0].form).validate(),this.each(function(){b=c.element(this)&&b})),b},removeAttrs:function(b){var c={},d=this;return a.each(b.split(/\s/),function(a,b){c[b]=d.attr(b),d.removeAttr(b)}),c},rules:function(b,c){var d,e,f,g,h,i,j=this[0];if(b)switch(d=a.data(j.form,"validator").settings,e=d.rules,f=a.validator.staticRules(j),b){case"add":a.extend(f,a.validator.normalizeRule(c)),delete f.messages,e[j.name]=f,c.messages&&(d.messages[j.name]=a.extend(d.messages[j.name],c.messages));break;case"remove":return c?(i={},a.each(c.split(/\s/),function(b,c){i[c]=f[c],delete f[c],"required"===c&&a(j).removeAttr("aria-required")}),i):(delete e[j.name],f)}return g=a.validator.normalizeRules(a.extend({},a.validator.classRules(j),a.validator.attributeRules(j),a.validator.dataRules(j),a.validator.staticRules(j)),j),g.required&&(h=g.required,delete g.required,g=a.extend({required:h},g),a(j).attr("aria-required","true")),g.remote&&(h=g.remote,delete g.remote,g=a.extend(g,{remote:h})),g}}),a.extend(a.expr[":"],{blank:function(b){return!a.trim(""+a(b).val())},filled:function(b){return!!a.trim(""+a(b).val())},unchecked:function(b){return!a(b).prop("checked")}}),a.validator=function(b,c){this.settings=a.extend(!0,{},a.validator.defaults,b),this.currentForm=c,this.init()},a.validator.format=function(b,c){return 1===arguments.length?function(){var c=a.makeArray(arguments);return c.unshift(b),a.validator.format.apply(this,c)}:(arguments.length>2&&c.constructor!==Array&&(c=a.makeArray(arguments).slice(1)),c.constructor!==Array&&(c=[c]),a.each(c,function(a,c){b=b.replace(new RegExp("\\{"+a+"\\}","g"),function(){return c})}),b)},a.extend(a.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:!0,errorContainer:a([]),errorLabelContainer:a([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(a){this.lastActive=a,this.settings.focusCleanup&&!this.blockFocusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,a,this.settings.errorClass,this.settings.validClass),this.addWrapper(this.errorsFor(a)).hide())},onfocusout:function(a){this.checkable(a)||!(a.name in this.submitted)&&this.optional(a)||this.element(a)},onkeyup:function(a,b){(9!==b.which||""!==this.elementValue(a))&&(a.name in this.submitted||a===this.lastElement)&&this.element(a)},onclick:function(a){a.name in this.submitted?this.element(a):a.parentNode.name in this.submitted&&this.element(a.parentNode)},highlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).addClass(c).removeClass(d):a(b).addClass(c).removeClass(d)},unhighlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).removeClass(c).addClass(d):a(b).removeClass(c).addClass(d)}},setDefaults:function(b){a.extend(a.validator.defaults,b)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",maxlength:a.validator.format("Please enter no more than {0} characters."),minlength:a.validator.format("Please enter at least {0} characters."),rangelength:a.validator.format("Please enter a value between {0} and {1} characters long."),range:a.validator.format("Please enter a value between {0} and {1}."),max:a.validator.format("Please enter a value less than or equal to {0}."),min:a.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:!1,prototype:{init:function(){function b(b){var c=a.data(this[0].form,"validator"),d="on"+b.type.replace(/^validate/,""),e=c.settings;e[d]&&!this.is(e.ignore)&&e[d].call(c,this[0],b)}this.labelContainer=a(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||a(this.currentForm),this.containers=a(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var c,d=this.groups={};a.each(this.settings.groups,function(b,c){"string"==typeof c&&(c=c.split(/\s/)),a.each(c,function(a,c){d[c]=b})}),c=this.settings.rules,a.each(c,function(b,d){c[b]=a.validator.normalizeRule(d)}),a(this.currentForm).validateDelegate(":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'] ,[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'] ","focusin focusout keyup",b).validateDelegate("[type='radio'], [type='checkbox'], select, option","click",b),this.settings.invalidHandler&&a(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler),a(this.currentForm).find("[required], [data-rule-required], .required").attr("aria-required","true")},form:function(){return this.checkForm(),a.extend(this.submitted,this.errorMap),this.invalid=a.extend({},this.errorMap),this.valid()||a(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var a=0,b=this.currentElements=this.elements();b[a];a++)this.check(b[a]);return this.valid()},element:function(b){var c=this.clean(b),d=this.validationTargetFor(c),e=!0;return this.lastElement=d,void 0===d?delete this.invalid[c.name]:(this.prepareElement(d),this.currentElements=a(d),e=this.check(d)!==!1,e?delete this.invalid[d.name]:this.invalid[d.name]=!0),a(b).attr("aria-invalid",!e),this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),e},showErrors:function(b){if(b){a.extend(this.errorMap,b),this.errorList=[];for(var c in b)this.errorList.push({message:b[c],element:this.findByName(c)[0]});this.successList=a.grep(this.successList,function(a){return!(a.name in b)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){a.fn.resetForm&&a(this.currentForm).resetForm(),this.submitted={},this.lastElement=null,this.prepareForm(),this.hideErrors(),this.elements().removeClass(this.settings.errorClass).removeData("previousValue").removeAttr("aria-invalid")},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(a){var b,c=0;for(b in a)c++;return c},hideErrors:function(){this.addWrapper(this.toHide).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{a(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(b){}},findLastActive:function(){var b=this.lastActive;return b&&1===a.grep(this.errorList,function(a){return a.element.name===b.name}).length&&b},elements:function(){var b=this,c={};return a(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){return!this.name&&b.settings.debug&&window.console&&console.error("%o has no name assigned",this),this.name in c||!b.objectLength(a(this).rules())?!1:(c[this.name]=!0,!0)})},clean:function(b){return a(b)[0]},errors:function(){var b=this.settings.errorClass.split(" ").join(".");return a(this.settings.errorElement+"."+b,this.errorContext)},reset:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=a([]),this.toHide=a([]),this.currentElements=a([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(a){this.reset(),this.toHide=this.errorsFor(a)},elementValue:function(b){var c,d=a(b),e=d.attr("type");return"radio"===e||"checkbox"===e?a("input[name='"+d.attr("name")+"']:checked").val():(c=d.val(),"string"==typeof c?c.replace(/\r/g,""):c)},check:function(b){b=this.validationTargetFor(this.clean(b));var c,d,e,f=a(b).rules(),g=a.map(f,function(a,b){return b}).length,h=!1,i=this.elementValue(b);for(d in f){e={method:d,parameters:f[d]};try{if(c=a.validator.methods[d].call(this,i,b,e.parameters),"dependency-mismatch"===c&&1===g){h=!0;continue}if(h=!1,"pending"===c)return void(this.toHide=this.toHide.not(this.errorsFor(b)));if(!c)return this.formatAndAdd(b,e),!1}catch(j){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+b.id+", check the '"+e.method+"' method.",j),j}}if(!h)return this.objectLength(f)&&this.successList.push(b),!0},customDataMessage:function(b,c){return a(b).data("msg"+c[0].toUpperCase()+c.substring(1).toLowerCase())||a(b).data("msg")},customMessage:function(a,b){var c=this.settings.messages[a];return c&&(c.constructor===String?c:c[b])},findDefined:function(){for(var a=0;a<arguments.length;a++)if(void 0!==arguments[a])return arguments[a];return void 0},defaultMessage:function(b,c){return this.findDefined(this.customMessage(b.name,c),this.customDataMessage(b,c),!this.settings.ignoreTitle&&b.title||void 0,a.validator.messages[c],"<strong>Warning: No message defined for "+b.name+"</strong>")},formatAndAdd:function(b,c){var d=this.defaultMessage(b,c.method),e=/\$?\{(\d+)\}/g;"function"==typeof d?d=d.call(this,c.parameters,b):e.test(d)&&(d=a.validator.format(d.replace(e,"{$1}"),c.parameters)),this.errorList.push({message:d,element:b,method:c.method}),this.errorMap[b.name]=d,this.submitted[b.name]=d},addWrapper:function(a){return this.settings.wrapper&&(a=a.add(a.parent(this.settings.wrapper))),a},defaultShowErrors:function(){var a,b,c;for(a=0;this.errorList[a];a++)c=this.errorList[a],this.settings.highlight&&this.settings.highlight.call(this,c.element,this.settings.errorClass,this.settings.validClass),this.showLabel(c.element,c.message);if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(a=0;this.successList[a];a++)this.showLabel(this.successList[a]);if(this.settings.unhighlight)for(a=0,b=this.validElements();b[a];a++)this.settings.unhighlight.call(this,b[a],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return a(this.errorList).map(function(){return this.element})},showLabel:function(b,c){var d=this.errorsFor(b);d.length?(d.removeClass(this.settings.validClass).addClass(this.settings.errorClass),d.html(c)):(d=a("<"+this.settings.errorElement+">").attr("for",this.idOrName(b)).addClass(this.settings.errorClass).html(c||""),this.settings.wrapper&&(d=d.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.append(d).length||(this.settings.errorPlacement?this.settings.errorPlacement(d,a(b)):d.insertAfter(b))),!c&&this.settings.success&&(d.text(""),"string"==typeof this.settings.success?d.addClass(this.settings.success):this.settings.success(d,b)),this.toShow=this.toShow.add(d)},errorsFor:function(b){var c=this.idOrName(b);return this.errors().filter(function(){return a(this).attr("for")===c})},idOrName:function(a){return this.groups[a.name]||(this.checkable(a)?a.name:a.id||a.name)},validationTargetFor:function(a){return this.checkable(a)&&(a=this.findByName(a.name).not(this.settings.ignore)[0]),a},checkable:function(a){return/radio|checkbox/i.test(a.type)},findByName:function(b){return a(this.currentForm).find("[name='"+b+"']")},getLength:function(b,c){switch(c.nodeName.toLowerCase()){case"select":return a("option:selected",c).length;case"input":if(this.checkable(c))return this.findByName(c.name).filter(":checked").length}return b.length},depend:function(a,b){return this.dependTypes[typeof a]?this.dependTypes[typeof a](a,b):!0},dependTypes:{"boolean":function(a){return a},string:function(b,c){return!!a(b,c.form).length},"function":function(a,b){return a(b)}},optional:function(b){var c=this.elementValue(b);return!a.validator.methods.required.call(this,c,b)&&"dependency-mismatch"},startRequest:function(a){this.pending[a.name]||(this.pendingRequest++,this.pending[a.name]=!0)},stopRequest:function(b,c){this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[b.name],c&&0===this.pendingRequest&&this.formSubmitted&&this.form()?(a(this.currentForm).submit(),this.formSubmitted=!1):!c&&0===this.pendingRequest&&this.formSubmitted&&(a(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(b){return a.data(b,"previousValue")||a.data(b,"previousValue",{old:null,valid:!0,message:this.defaultMessage(b,"remote")})}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(b,c){b.constructor===String?this.classRuleSettings[b]=c:a.extend(this.classRuleSettings,b)},classRules:function(b){var c={},d=a(b).attr("class");return d&&a.each(d.split(" "),function(){this in a.validator.classRuleSettings&&a.extend(c,a.validator.classRuleSettings[this])}),c},attributeRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)"required"===c?(d=b.getAttribute(c),""===d&&(d=!0),d=!!d):d=f.attr(c),/min|max/.test(c)&&(null===g||/number|range|text/.test(g))&&(d=Number(d)),d||0===d?e[c]=d:g===c&&"range"!==g&&(e[c]=!0);return e.maxlength&&/-1|2147483647|524288/.test(e.maxlength)&&delete e.maxlength,e},dataRules:function(b){var c,d,e={},f=a(b);for(c in a.validator.methods)d=f.data("rule"+c[0].toUpperCase()+c.substring(1).toLowerCase()),void 0!==d&&(e[c]=d);return e},staticRules:function(b){var c={},d=a.data(b.form,"validator");return d.settings.rules&&(c=a.validator.normalizeRule(d.settings.rules[b.name])||{}),c},normalizeRules:function(b,c){return a.each(b,function(d,e){if(e===!1)return void delete b[d];if(e.param||e.depends){var f=!0;switch(typeof e.depends){case"string":f=!!a(e.depends,c.form).length;break;case"function":f=e.depends.call(c,c)}f?b[d]=void 0!==e.param?e.param:!0:delete b[d]}}),a.each(b,function(d,e){b[d]=a.isFunction(e)?e(c):e}),a.each(["minlength","maxlength"],function(){b[this]&&(b[this]=Number(b[this]))}),a.each(["rangelength","range"],function(){var c;b[this]&&(a.isArray(b[this])?b[this]=[Number(b[this][0]),Number(b[this][1])]:"string"==typeof b[this]&&(c=b[this].split(/[\s,]+/),b[this]=[Number(c[0]),Number(c[1])]))}),a.validator.autoCreateRanges&&(b.min&&b.max&&(b.range=[b.min,b.max],delete b.min,delete b.max),b.minlength&&b.maxlength&&(b.rangelength=[b.minlength,b.maxlength],delete b.minlength,delete b.maxlength)),b},normalizeRule:function(b){if("string"==typeof b){var c={};a.each(b.split(/\s/),function(){c[this]=!0}),b=c}return b},addMethod:function(b,c,d){a.validator.methods[b]=c,a.validator.messages[b]=void 0!==d?d:a.validator.messages[b],c.length<3&&a.validator.addClassRules(b,a.validator.normalizeRule(b))},methods:{required:function(b,c,d){if(!this.depend(d,c))return"dependency-mismatch";if("select"===c.nodeName.toLowerCase()){var e=a(c).val();return e&&e.length>0}return this.checkable(c)?this.getLength(b,c)>0:a.trim(b).length>0},email:function(a,b){return this.optional(b)||/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(a)},url:function(a,b){return this.optional(b)||/^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(a)},date:function(a,b){return this.optional(b)||!/Invalid|NaN/.test(new Date(a).toString())},dateISO:function(a,b){return this.optional(b)||/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(a)},number:function(a,b){return this.optional(b)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(a)},digits:function(a,b){return this.optional(b)||/^\d+$/.test(a)},creditcard:function(a,b){if(this.optional(b))return"dependency-mismatch";if(/[^0-9 \-]+/.test(a))return!1;var c,d,e=0,f=0,g=!1;if(a=a.replace(/\D/g,""),a.length<13||a.length>19)return!1;for(c=a.length-1;c>=0;c--)d=a.charAt(c),f=parseInt(d,10),g&&(f*=2)>9&&(f-=9),e+=f,g=!g;return e%10===0},minlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(a.trim(b),c);return this.optional(c)||e>=d},maxlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(a.trim(b),c);return this.optional(c)||d>=e},rangelength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(a.trim(b),c);return this.optional(c)||e>=d[0]&&e<=d[1]},min:function(a,b,c){return this.optional(b)||a>=c},max:function(a,b,c){return this.optional(b)||c>=a},range:function(a,b,c){return this.optional(b)||a>=c[0]&&a<=c[1]},equalTo:function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){a(c).valid()}),b===e.val()},remote:function(b,c,d){if(this.optional(c))return"dependency-mismatch";var e,f,g=this.previousValue(c);return this.settings.messages[c.name]||(this.settings.messages[c.name]={}),g.originalMessage=this.settings.messages[c.name].remote,this.settings.messages[c.name].remote=g.message,d="string"==typeof d&&{url:d}||d,g.old===b?g.valid:(g.old=b,e=this,this.startRequest(c),f={},f[c.name]=b,a.ajax(a.extend(!0,{url:d,mode:"abort",port:"validate"+c.name,dataType:"json",data:f,context:e.currentForm,success:function(d){var f,h,i,j=d===!0||"true"===d;e.settings.messages[c.name].remote=g.originalMessage,j?(i=e.formSubmitted,e.prepareElement(c),e.formSubmitted=i,e.successList.push(c),delete e.invalid[c.name],e.showErrors()):(f={},h=d||e.defaultMessage(c,"remote"),f[c.name]=g.message=a.isFunction(h)?h(b):h,e.invalid[c.name]=!0,e.showErrors(f)),g.valid=j,e.stopRequest(c,j)}},d)),"pending")}}}),a.format=function(){throw"$.format has been deprecated. Please use $.validator.format instead."}}(jQuery),function(a){var b,c={};a.ajaxPrefilter?a.ajaxPrefilter(function(a,b,d){var e=a.port;"abort"===a.mode&&(c[e]&&c[e].abort(),c[e]=d)}):(b=a.ajax,a.ajax=function(d){var e=("mode"in d?d:a.ajaxSettings).mode,f=("port"in d?d:a.ajaxSettings).port;return"abort"===e?(c[f]&&c[f].abort(),c[f]=b.apply(this,arguments),c[f]):b.apply(this,arguments)})}(jQuery),function(a){a.extend(a.fn,{validateDelegate:function(b,c,d){return this.bind(c,function(c){var e=a(c.target);return e.is(b)?d.apply(e,arguments):void 0})}})}(jQuery);
17
 
18
  // ADDITIONAL JQUERY VALIDATE METHODS
19
  (function($) {
10
  */
11
  !function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):e("undefined"!=typeof jQuery?jQuery:window.Zepto)}(function(e){"use strict";function t(t){var r=t.data;t.isDefaultPrevented()||(t.preventDefault(),e(t.target).ajaxSubmit(r))}function r(t){var r=t.target,a=e(r);if(!a.is("[type=submit],[type=image]")){var n=a.closest("[type=submit]");if(0===n.length)return;r=n[0]}var i=this;if(i.clk=r,"image"==r.type)if(void 0!==t.offsetX)i.clk_x=t.offsetX,i.clk_y=t.offsetY;else if("function"==typeof e.fn.offset){var o=a.offset();i.clk_x=t.pageX-o.left,i.clk_y=t.pageY-o.top}else i.clk_x=t.pageX-r.offsetLeft,i.clk_y=t.pageY-r.offsetTop;setTimeout(function(){i.clk=i.clk_x=i.clk_y=null},100)}function a(){if(e.fn.ajaxSubmit.debug){var t="[jquery.form] "+Array.prototype.join.call(arguments,"");window.console&&window.console.log?window.console.log(t):window.opera&&window.opera.postError&&window.opera.postError(t)}}var n={};n.fileapi=void 0!==e("<input type='file'/>").get(0).files,n.formdata=void 0!==window.FormData;var i=!!e.fn.prop;e.fn.attr2=function(){if(!i)return this.attr.apply(this,arguments);var e=this.prop.apply(this,arguments);return e&&e.jquery||"string"==typeof e?e:this.attr.apply(this,arguments)},e.fn.ajaxSubmit=function(t){function r(r){var a,n,i=e.param(r,t.traditional).split("&"),o=i.length,s=[];for(a=0;o>a;a++)i[a]=i[a].replace(/\+/g," "),n=i[a].split("="),s.push([decodeURIComponent(n[0]),decodeURIComponent(n[1])]);return s}function o(a){for(var n=new FormData,i=0;i<a.length;i++)n.append(a[i].name,a[i].value);if(t.extraData){var o=r(t.extraData);for(i=0;i<o.length;i++)o[i]&&n.append(o[i][0],o[i][1])}t.data=null;var s=e.extend(!0,{},e.ajaxSettings,t,{contentType:!1,processData:!1,cache:!1,type:u||"POST"});t.uploadProgress&&(s.xhr=function(){var r=e.ajaxSettings.xhr();return r.upload&&r.upload.addEventListener("progress",function(e){var r=0,a=e.loaded||e.position,n=e.total;e.lengthComputable&&(r=Math.ceil(a/n*100)),t.uploadProgress(e,a,n,r)},!1),r}),s.data=null;var c=s.beforeSend;return s.beforeSend=function(e,r){r.data=t.formData?t.formData:n,c&&c.call(this,e,r)},e.ajax(s)}function s(r){function n(e){var t=null;try{e.contentWindow&&(t=e.contentWindow.document)}catch(r){a("cannot get iframe.contentWindow document: "+r)}if(t)return t;try{t=e.contentDocument?e.contentDocument:e.document}catch(r){a("cannot get iframe.contentDocument: "+r),t=e.document}return t}function o(){function t(){try{var e=n(g).readyState;a("state = "+e),e&&"uninitialized"==e.toLowerCase()&&setTimeout(t,50)}catch(r){a("Server abort: ",r," (",r.name,")"),s(k),j&&clearTimeout(j),j=void 0}}var r=f.attr2("target"),i=f.attr2("action"),o="multipart/form-data",c=f.attr("enctype")||f.attr("encoding")||o;w.setAttribute("target",p),(!u||/post/i.test(u))&&w.setAttribute("method","POST"),i!=m.url&&w.setAttribute("action",m.url),m.skipEncodingOverride||u&&!/post/i.test(u)||f.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"}),m.timeout&&(j=setTimeout(function(){T=!0,s(D)},m.timeout));var l=[];try{if(m.extraData)for(var d in m.extraData)m.extraData.hasOwnProperty(d)&&l.push(e.isPlainObject(m.extraData[d])&&m.extraData[d].hasOwnProperty("name")&&m.extraData[d].hasOwnProperty("value")?e('<input type="hidden" name="'+m.extraData[d].name+'">').val(m.extraData[d].value).appendTo(w)[0]:e('<input type="hidden" name="'+d+'">').val(m.extraData[d]).appendTo(w)[0]);m.iframeTarget||v.appendTo("body"),g.attachEvent?g.attachEvent("onload",s):g.addEventListener("load",s,!1),setTimeout(t,15);try{w.submit()}catch(h){var x=document.createElement("form").submit;x.apply(w)}}finally{w.setAttribute("action",i),w.setAttribute("enctype",c),r?w.setAttribute("target",r):f.removeAttr("target"),e(l).remove()}}function s(t){if(!x.aborted&&!F){if(M=n(g),M||(a("cannot access response document"),t=k),t===D&&x)return x.abort("timeout"),void S.reject(x,"timeout");if(t==k&&x)return x.abort("server abort"),void S.reject(x,"error","server abort");if(M&&M.location.href!=m.iframeSrc||T){g.detachEvent?g.detachEvent("onload",s):g.removeEventListener("load",s,!1);var r,i="success";try{if(T)throw"timeout";var o="xml"==m.dataType||M.XMLDocument||e.isXMLDoc(M);if(a("isXml="+o),!o&&window.opera&&(null===M.body||!M.body.innerHTML)&&--O)return a("requeing onLoad callback, DOM not available"),void setTimeout(s,250);var u=M.body?M.body:M.documentElement;x.responseText=u?u.innerHTML:null,x.responseXML=M.XMLDocument?M.XMLDocument:M,o&&(m.dataType="xml"),x.getResponseHeader=function(e){var t={"content-type":m.dataType};return t[e.toLowerCase()]},u&&(x.status=Number(u.getAttribute("status"))||x.status,x.statusText=u.getAttribute("statusText")||x.statusText);var c=(m.dataType||"").toLowerCase(),l=/(json|script|text)/.test(c);if(l||m.textarea){var f=M.getElementsByTagName("textarea")[0];if(f)x.responseText=f.value,x.status=Number(f.getAttribute("status"))||x.status,x.statusText=f.getAttribute("statusText")||x.statusText;else if(l){var p=M.getElementsByTagName("pre")[0],h=M.getElementsByTagName("body")[0];p?x.responseText=p.textContent?p.textContent:p.innerText:h&&(x.responseText=h.textContent?h.textContent:h.innerText)}}else"xml"==c&&!x.responseXML&&x.responseText&&(x.responseXML=X(x.responseText));try{E=_(x,c,m)}catch(y){i="parsererror",x.error=r=y||i}}catch(y){a("error caught: ",y),i="error",x.error=r=y||i}x.aborted&&(a("upload aborted"),i=null),x.status&&(i=x.status>=200&&x.status<300||304===x.status?"success":"error"),"success"===i?(m.success&&m.success.call(m.context,E,"success",x),S.resolve(x.responseText,"success",x),d&&e.event.trigger("ajaxSuccess",[x,m])):i&&(void 0===r&&(r=x.statusText),m.error&&m.error.call(m.context,x,i,r),S.reject(x,"error",r),d&&e.event.trigger("ajaxError",[x,m,r])),d&&e.event.trigger("ajaxComplete",[x,m]),d&&!--e.active&&e.event.trigger("ajaxStop"),m.complete&&m.complete.call(m.context,x,i),F=!0,m.timeout&&clearTimeout(j),setTimeout(function(){m.iframeTarget?v.attr("src",m.iframeSrc):v.remove(),x.responseXML=null},100)}}}var c,l,m,d,p,v,g,x,y,b,T,j,w=f[0],S=e.Deferred();if(S.abort=function(e){x.abort(e)},r)for(l=0;l<h.length;l++)c=e(h[l]),i?c.prop("disabled",!1):c.removeAttr("disabled");if(m=e.extend(!0,{},e.ajaxSettings,t),m.context=m.context||m,p="jqFormIO"+(new Date).getTime(),m.iframeTarget?(v=e(m.iframeTarget),b=v.attr2("name"),b?p=b:v.attr2("name",p)):(v=e('<iframe name="'+p+'" src="'+m.iframeSrc+'" />'),v.css({position:"absolute",top:"-1000px",left:"-1000px"})),g=v[0],x={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(t){var r="timeout"===t?"timeout":"aborted";a("aborting upload... "+r),this.aborted=1;try{g.contentWindow.document.execCommand&&g.contentWindow.document.execCommand("Stop")}catch(n){}v.attr("src",m.iframeSrc),x.error=r,m.error&&m.error.call(m.context,x,r,t),d&&e.event.trigger("ajaxError",[x,m,r]),m.complete&&m.complete.call(m.context,x,r)}},d=m.global,d&&0===e.active++&&e.event.trigger("ajaxStart"),d&&e.event.trigger("ajaxSend",[x,m]),m.beforeSend&&m.beforeSend.call(m.context,x,m)===!1)return m.global&&e.active--,S.reject(),S;if(x.aborted)return S.reject(),S;y=w.clk,y&&(b=y.name,b&&!y.disabled&&(m.extraData=m.extraData||{},m.extraData[b]=y.value,"image"==y.type&&(m.extraData[b+".x"]=w.clk_x,m.extraData[b+".y"]=w.clk_y)));var D=1,k=2,A=e("meta[name=csrf-token]").attr("content"),L=e("meta[name=csrf-param]").attr("content");L&&A&&(m.extraData=m.extraData||{},m.extraData[L]=A),m.forceSync?o():setTimeout(o,10);var E,M,F,O=50,X=e.parseXML||function(e,t){return window.ActiveXObject?(t=new ActiveXObject("Microsoft.XMLDOM"),t.async="false",t.loadXML(e)):t=(new DOMParser).parseFromString(e,"text/xml"),t&&t.documentElement&&"parsererror"!=t.documentElement.nodeName?t:null},C=e.parseJSON||function(e){return window.eval("("+e+")")},_=function(t,r,a){var n=t.getResponseHeader("content-type")||"",i="xml"===r||!r&&n.indexOf("xml")>=0,o=i?t.responseXML:t.responseText;return i&&"parsererror"===o.documentElement.nodeName&&e.error&&e.error("parsererror"),a&&a.dataFilter&&(o=a.dataFilter(o,r)),"string"==typeof o&&("json"===r||!r&&n.indexOf("json")>=0?o=C(o):("script"===r||!r&&n.indexOf("javascript")>=0)&&e.globalEval(o)),o};return S}if(!this.length)return a("ajaxSubmit: skipping submit process - no element selected"),this;var u,c,l,f=this;"function"==typeof t?t={success:t}:void 0===t&&(t={}),u=t.type||this.attr2("method"),c=t.url||this.attr2("action"),l="string"==typeof c?e.trim(c):"",l=l||window.location.href||"",l&&(l=(l.match(/^([^#]+)/)||[])[1]),t=e.extend(!0,{url:l,success:e.ajaxSettings.success,type:u||e.ajaxSettings.type,iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},t);var m={};if(this.trigger("form-pre-serialize",[this,t,m]),m.veto)return a("ajaxSubmit: submit vetoed via form-pre-serialize trigger"),this;if(t.beforeSerialize&&t.beforeSerialize(this,t)===!1)return a("ajaxSubmit: submit aborted via beforeSerialize callback"),this;var d=t.traditional;void 0===d&&(d=e.ajaxSettings.traditional);var p,h=[],v=this.formToArray(t.semantic,h);if(t.data&&(t.extraData=t.data,p=e.param(t.data,d)),t.beforeSubmit&&t.beforeSubmit(v,this,t)===!1)return a("ajaxSubmit: submit aborted via beforeSubmit callback"),this;if(this.trigger("form-submit-validate",[v,this,t,m]),m.veto)return a("ajaxSubmit: submit vetoed via form-submit-validate trigger"),this;var g=e.param(v,d);p&&(g=g?g+"&"+p:p),"GET"==t.type.toUpperCase()?(t.url+=(t.url.indexOf("?")>=0?"&":"?")+g,t.data=null):t.data=g;var x=[];if(t.resetForm&&x.push(function(){f.resetForm()}),t.clearForm&&x.push(function(){f.clearForm(t.includeHidden)}),!t.dataType&&t.target){var y=t.success||function(){};x.push(function(r){var a=t.replaceTarget?"replaceWith":"html";e(t.target)[a](r).each(y,arguments)})}else t.success&&x.push(t.success);if(t.success=function(e,r,a){for(var n=t.context||this,i=0,o=x.length;o>i;i++)x[i].apply(n,[e,r,a||f,f])},t.error){var b=t.error;t.error=function(e,r,a){var n=t.context||this;b.apply(n,[e,r,a,f])}}if(t.complete){var T=t.complete;t.complete=function(e,r){var a=t.context||this;T.apply(a,[e,r,f])}}var j=e("input[type=file]:enabled",this).filter(function(){return""!==e(this).val()}),w=j.length>0,S="multipart/form-data",D=f.attr("enctype")==S||f.attr("encoding")==S,k=n.fileapi&&n.formdata;a("fileAPI :"+k);var A,L=(w||D)&&!k;t.iframe!==!1&&(t.iframe||L)?t.closeKeepAlive?e.get(t.closeKeepAlive,function(){A=s(v)}):A=s(v):A=(w||D)&&k?o(v):e.ajax(t),f.removeData("jqxhr").data("jqxhr",A);for(var E=0;E<h.length;E++)h[E]=null;return this.trigger("form-submit-notify",[this,t]),this},e.fn.ajaxForm=function(n){if(n=n||{},n.delegation=n.delegation&&e.isFunction(e.fn.on),!n.delegation&&0===this.length){var i={s:this.selector,c:this.context};return!e.isReady&&i.s?(a("DOM not ready, queuing ajaxForm"),e(function(){e(i.s,i.c).ajaxForm(n)}),this):(a("terminating; zero elements found by selector"+(e.isReady?"":" (DOM not ready)")),this)}return n.delegation?(e(document).off("submit.form-plugin",this.selector,t).off("click.form-plugin",this.selector,r).on("submit.form-plugin",this.selector,n,t).on("click.form-plugin",this.selector,n,r),this):this.ajaxFormUnbind().bind("submit.form-plugin",n,t).bind("click.form-plugin",n,r)},e.fn.ajaxFormUnbind=function(){return this.unbind("submit.form-plugin click.form-plugin")},e.fn.formToArray=function(t,r){var a=[];if(0===this.length)return a;var i,o=this[0],s=this.attr("id"),u=t?o.getElementsByTagName("*"):o.elements;if(u&&!/MSIE [678]/.test(navigator.userAgent)&&(u=e(u).get()),s&&(i=e(':input[form="'+s+'"]').get(),i.length&&(u=(u||[]).concat(i))),!u||!u.length)return a;var c,l,f,m,d,p,h;for(c=0,p=u.length;p>c;c++)if(d=u[c],f=d.name,f&&!d.disabled)if(t&&o.clk&&"image"==d.type)o.clk==d&&(a.push({name:f,value:e(d).val(),type:d.type}),a.push({name:f+".x",value:o.clk_x},{name:f+".y",value:o.clk_y}));else if(m=e.fieldValue(d,!0),m&&m.constructor==Array)for(r&&r.push(d),l=0,h=m.length;h>l;l++)a.push({name:f,value:m[l]});else if(n.fileapi&&"file"==d.type){r&&r.push(d);var v=d.files;if(v.length)for(l=0;l<v.length;l++)a.push({name:f,value:v[l],type:d.type});else a.push({name:f,value:"",type:d.type})}else null!==m&&"undefined"!=typeof m&&(r&&r.push(d),a.push({name:f,value:m,type:d.type,required:d.required}));if(!t&&o.clk){var g=e(o.clk),x=g[0];f=x.name,f&&!x.disabled&&"image"==x.type&&(a.push({name:f,value:g.val()}),a.push({name:f+".x",value:o.clk_x},{name:f+".y",value:o.clk_y}))}return a},e.fn.formSerialize=function(t){return e.param(this.formToArray(t))},e.fn.fieldSerialize=function(t){var r=[];return this.each(function(){var a=this.name;if(a){var n=e.fieldValue(this,t);if(n&&n.constructor==Array)for(var i=0,o=n.length;o>i;i++)r.push({name:a,value:n[i]});else null!==n&&"undefined"!=typeof n&&r.push({name:this.name,value:n})}}),e.param(r)},e.fn.fieldValue=function(t){for(var r=[],a=0,n=this.length;n>a;a++){var i=this[a],o=e.fieldValue(i,t);null===o||"undefined"==typeof o||o.constructor==Array&&!o.length||(o.constructor==Array?e.merge(r,o):r.push(o))}return r},e.fieldValue=function(t,r){var a=t.name,n=t.type,i=t.tagName.toLowerCase();if(void 0===r&&(r=!0),r&&(!a||t.disabled||"reset"==n||"button"==n||("checkbox"==n||"radio"==n)&&!t.checked||("submit"==n||"image"==n)&&t.form&&t.form.clk!=t||"select"==i&&-1==t.selectedIndex))return null;if("select"==i){var o=t.selectedIndex;if(0>o)return null;for(var s=[],u=t.options,c="select-one"==n,l=c?o+1:u.length,f=c?o:0;l>f;f++){var m=u[f];if(m.selected){var d=m.value;if(d||(d=m.attributes&&m.attributes.value&&!m.attributes.value.specified?m.text:m.value),c)return d;s.push(d)}}return s}return e(t).val()},e.fn.clearForm=function(t){return this.each(function(){e("input,select,textarea",this).clearFields(t)})},e.fn.clearFields=e.fn.clearInputs=function(t){var r=/^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i;return this.each(function(){var a=this.type,n=this.tagName.toLowerCase();r.test(a)||"textarea"==n?this.value="":"checkbox"==a||"radio"==a?this.checked=!1:"select"==n?this.selectedIndex=-1:"file"==a?/MSIE/.test(navigator.userAgent)?e(this).replaceWith(e(this).clone(!0)):e(this).val(""):t&&(t===!0&&/hidden/.test(a)||"string"==typeof t&&e(this).is(t))&&(this.value="")})},e.fn.resetForm=function(){return this.each(function(){("function"==typeof this.reset||"object"==typeof this.reset&&!this.reset.nodeType)&&this.reset()})},e.fn.enable=function(e){return void 0===e&&(e=!0),this.each(function(){this.disabled=!e})},e.fn.selected=function(t){return void 0===t&&(t=!0),this.each(function(){var r=this.type;if("checkbox"==r||"radio"==r)this.checked=t;else if("option"==this.tagName.toLowerCase()){var a=e(this).parent("select");t&&a[0]&&"select-one"==a[0].type&&a.find("option").selected(!1),this.selected=t}})},e.fn.ajaxSubmit.debug=!1});
12
 
13
+ /*! jQuery Validation Plugin - v1.17.0 - 7/29/2017
14
+ * https://jqueryvalidation.org/
15
+ * Copyright (c) 2017 Jörn Zaefferer; Licensed MIT */
16
+ !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){a.extend(a.fn,{validate:function(b){if(!this.length)return void(b&&b.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing."));var c=a.data(this[0],"validator");return c?c:(this.attr("novalidate","novalidate"),c=new a.validator(b,this[0]),a.data(this[0],"validator",c),c.settings.onsubmit&&(this.on("click.validate",":submit",function(b){c.submitButton=b.currentTarget,a(this).hasClass("cancel")&&(c.cancelSubmit=!0),void 0!==a(this).attr("formnovalidate")&&(c.cancelSubmit=!0)}),this.on("submit.validate",function(b){function d(){var d,e;return c.submitButton&&(c.settings.submitHandler||c.formSubmitted)&&(d=a("<input type='hidden'/>").attr("name",c.submitButton.name).val(a(c.submitButton).val()).appendTo(c.currentForm)),!c.settings.submitHandler||(e=c.settings.submitHandler.call(c,c.currentForm,b),d&&d.remove(),void 0!==e&&e)}return c.settings.debug&&b.preventDefault(),c.cancelSubmit?(c.cancelSubmit=!1,d()):c.form()?c.pendingRequest?(c.formSubmitted=!0,!1):d():(c.focusInvalid(),!1)})),c)},valid:function(){var b,c,d;return a(this[0]).is("form")?b=this.validate().form():(d=[],b=!0,c=a(this[0].form).validate(),this.each(function(){b=c.element(this)&&b,b||(d=d.concat(c.errorList))}),c.errorList=d),b},rules:function(b,c){var d,e,f,g,h,i,j=this[0];if(null!=j&&(!j.form&&j.hasAttribute("contenteditable")&&(j.form=this.closest("form")[0],j.name=this.attr("name")),null!=j.form)){if(b)switch(d=a.data(j.form,"validator").settings,e=d.rules,f=a.validator.staticRules(j),b){case"add":a.extend(f,a.validator.normalizeRule(c)),delete f.messages,e[j.name]=f,c.messages&&(d.messages[j.name]=a.extend(d.messages[j.name],c.messages));break;case"remove":return c?(i={},a.each(c.split(/\s/),function(a,b){i[b]=f[b],delete f[b]}),i):(delete e[j.name],f)}return g=a.validator.normalizeRules(a.extend({},a.validator.classRules(j),a.validator.attributeRules(j),a.validator.dataRules(j),a.validator.staticRules(j)),j),g.required&&(h=g.required,delete g.required,g=a.extend({required:h},g)),g.remote&&(h=g.remote,delete g.remote,g=a.extend(g,{remote:h})),g}}}),a.extend(a.expr.pseudos||a.expr[":"],{blank:function(b){return!a.trim(""+a(b).val())},filled:function(b){var c=a(b).val();return null!==c&&!!a.trim(""+c)},unchecked:function(b){return!a(b).prop("checked")}}),a.validator=function(b,c){this.settings=a.extend(!0,{},a.validator.defaults,b),this.currentForm=c,this.init()},a.validator.format=function(b,c){return 1===arguments.length?function(){var c=a.makeArray(arguments);return c.unshift(b),a.validator.format.apply(this,c)}:void 0===c?b:(arguments.length>2&&c.constructor!==Array&&(c=a.makeArray(arguments).slice(1)),c.constructor!==Array&&(c=[c]),a.each(c,function(a,c){b=b.replace(new RegExp("\\{"+a+"\\}","g"),function(){return c})}),b)},a.extend(a.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",pendingClass:"pending",validClass:"valid",errorElement:"label",focusCleanup:!1,focusInvalid:!0,errorContainer:a([]),errorLabelContainer:a([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(a){this.lastActive=a,this.settings.focusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,a,this.settings.errorClass,this.settings.validClass),this.hideThese(this.errorsFor(a)))},onfocusout:function(a){this.checkable(a)||!(a.name in this.submitted)&&this.optional(a)||this.element(a)},onkeyup:function(b,c){var d=[16,17,18,20,35,36,37,38,39,40,45,144,225];9===c.which&&""===this.elementValue(b)||a.inArray(c.keyCode,d)!==-1||(b.name in this.submitted||b.name in this.invalid)&&this.element(b)},onclick:function(a){a.name in this.submitted?this.element(a):a.parentNode.name in this.submitted&&this.element(a.parentNode)},highlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).addClass(c).removeClass(d):a(b).addClass(c).removeClass(d)},unhighlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).removeClass(c).addClass(d):a(b).removeClass(c).addClass(d)}},setDefaults:function(b){a.extend(a.validator.defaults,b)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",equalTo:"Please enter the same value again.",maxlength:a.validator.format("Please enter no more than {0} characters."),minlength:a.validator.format("Please enter at least {0} characters."),rangelength:a.validator.format("Please enter a value between {0} and {1} characters long."),range:a.validator.format("Please enter a value between {0} and {1}."),max:a.validator.format("Please enter a value less than or equal to {0}."),min:a.validator.format("Please enter a value greater than or equal to {0}."),step:a.validator.format("Please enter a multiple of {0}.")},autoCreateRanges:!1,prototype:{init:function(){function b(b){!this.form&&this.hasAttribute("contenteditable")&&(this.form=a(this).closest("form")[0],this.name=a(this).attr("name"));var c=a.data(this.form,"validator"),d="on"+b.type.replace(/^validate/,""),e=c.settings;e[d]&&!a(this).is(e.ignore)&&e[d].call(c,this,b)}this.labelContainer=a(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||a(this.currentForm),this.containers=a(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var c,d=this.groups={};a.each(this.settings.groups,function(b,c){"string"==typeof c&&(c=c.split(/\s/)),a.each(c,function(a,c){d[c]=b})}),c=this.settings.rules,a.each(c,function(b,d){c[b]=a.validator.normalizeRule(d)}),a(this.currentForm).on("focusin.validate focusout.validate keyup.validate",":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'], [type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], [type='radio'], [type='checkbox'], [contenteditable], [type='button']",b).on("click.validate","select, option, [type='radio'], [type='checkbox']",b),this.settings.invalidHandler&&a(this.currentForm).on("invalid-form.validate",this.settings.invalidHandler)},form:function(){return this.checkForm(),a.extend(this.submitted,this.errorMap),this.invalid=a.extend({},this.errorMap),this.valid()||a(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var a=0,b=this.currentElements=this.elements();b[a];a++)this.check(b[a]);return this.valid()},element:function(b){var c,d,e=this.clean(b),f=this.validationTargetFor(e),g=this,h=!0;return void 0===f?delete this.invalid[e.name]:(this.prepareElement(f),this.currentElements=a(f),d=this.groups[f.name],d&&a.each(this.groups,function(a,b){b===d&&a!==f.name&&(e=g.validationTargetFor(g.clean(g.findByName(a))),e&&e.name in g.invalid&&(g.currentElements.push(e),h=g.check(e)&&h))}),c=this.check(f)!==!1,h=h&&c,c?this.invalid[f.name]=!1:this.invalid[f.name]=!0,this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),a(b).attr("aria-invalid",!c)),h},showErrors:function(b){if(b){var c=this;a.extend(this.errorMap,b),this.errorList=a.map(this.errorMap,function(a,b){return{message:a,element:c.findByName(b)[0]}}),this.successList=a.grep(this.successList,function(a){return!(a.name in b)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){a.fn.resetForm&&a(this.currentForm).resetForm(),this.invalid={},this.submitted={},this.prepareForm(),this.hideErrors();var b=this.elements().removeData("previousValue").removeAttr("aria-invalid");this.resetElements(b)},resetElements:function(a){var b;if(this.settings.unhighlight)for(b=0;a[b];b++)this.settings.unhighlight.call(this,a[b],this.settings.errorClass,""),this.findByName(a[b].name).removeClass(this.settings.validClass);else a.removeClass(this.settings.errorClass).removeClass(this.settings.validClass)},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(a){var b,c=0;for(b in a)void 0!==a[b]&&null!==a[b]&&a[b]!==!1&&c++;return c},hideErrors:function(){this.hideThese(this.toHide)},hideThese:function(a){a.not(this.containers).text(""),this.addWrapper(a).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{a(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(b){}},findLastActive:function(){var b=this.lastActive;return b&&1===a.grep(this.errorList,function(a){return a.element.name===b.name}).length&&b},elements:function(){var b=this,c={};return a(this.currentForm).find("input, select, textarea, [contenteditable]").not(":submit, :reset, :image, :disabled").not(this.settings.ignore).filter(function(){var d=this.name||a(this).attr("name");return!d&&b.settings.debug&&window.console&&console.error("%o has no name assigned",this),this.hasAttribute("contenteditable")&&(this.form=a(this).closest("form")[0],this.name=d),!(d in c||!b.objectLength(a(this).rules()))&&(c[d]=!0,!0)})},clean:function(b){return a(b)[0]},errors:function(){var b=this.settings.errorClass.split(" ").join(".");return a(this.settings.errorElement+"."+b,this.errorContext)},resetInternals:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=a([]),this.toHide=a([])},reset:function(){this.resetInternals(),this.currentElements=a([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(a){this.reset(),this.toHide=this.errorsFor(a)},elementValue:function(b){var c,d,e=a(b),f=b.type;return"radio"===f||"checkbox"===f?this.findByName(b.name).filter(":checked").val():"number"===f&&"undefined"!=typeof b.validity?b.validity.badInput?"NaN":e.val():(c=b.hasAttribute("contenteditable")?e.text():e.val(),"file"===f?"C:\\fakepath\\"===c.substr(0,12)?c.substr(12):(d=c.lastIndexOf("/"),d>=0?c.substr(d+1):(d=c.lastIndexOf("\\"),d>=0?c.substr(d+1):c)):"string"==typeof c?c.replace(/\r/g,""):c)},check:function(b){b=this.validationTargetFor(this.clean(b));var c,d,e,f,g=a(b).rules(),h=a.map(g,function(a,b){return b}).length,i=!1,j=this.elementValue(b);if("function"==typeof g.normalizer?f=g.normalizer:"function"==typeof this.settings.normalizer&&(f=this.settings.normalizer),f){if(j=f.call(b,j),"string"!=typeof j)throw new TypeError("The normalizer should return a string value.");delete g.normalizer}for(d in g){e={method:d,parameters:g[d]};try{if(c=a.validator.methods[d].call(this,j,b,e.parameters),"dependency-mismatch"===c&&1===h){i=!0;continue}if(i=!1,"pending"===c)return void(this.toHide=this.toHide.not(this.errorsFor(b)));if(!c)return this.formatAndAdd(b,e),!1}catch(k){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+b.id+", check the '"+e.method+"' method.",k),k instanceof TypeError&&(k.message+=". Exception occurred when checking element "+b.id+", check the '"+e.method+"' method."),k}}if(!i)return this.objectLength(g)&&this.successList.push(b),!0},customDataMessage:function(b,c){return a(b).data("msg"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase())||a(b).data("msg")},customMessage:function(a,b){var c=this.settings.messages[a];return c&&(c.constructor===String?c:c[b])},findDefined:function(){for(var a=0;a<arguments.length;a++)if(void 0!==arguments[a])return arguments[a]},defaultMessage:function(b,c){"string"==typeof c&&(c={method:c});var d=this.findDefined(this.customMessage(b.name,c.method),this.customDataMessage(b,c.method),!this.settings.ignoreTitle&&b.title||void 0,a.validator.messages[c.method],"<strong>Warning: No message defined for "+b.name+"</strong>"),e=/\$?\{(\d+)\}/g;return"function"==typeof d?d=d.call(this,c.parameters,b):e.test(d)&&(d=a.validator.format(d.replace(e,"{$1}"),c.parameters)),d},formatAndAdd:function(a,b){var c=this.defaultMessage(a,b);this.errorList.push({message:c,element:a,method:b.method}),this.errorMap[a.name]=c,this.submitted[a.name]=c},addWrapper:function(a){return this.settings.wrapper&&(a=a.add(a.parent(this.settings.wrapper))),a},defaultShowErrors:function(){var a,b,c;for(a=0;this.errorList[a];a++)c=this.errorList[a],this.settings.highlight&&this.settings.highlight.call(this,c.element,this.settings.errorClass,this.settings.validClass),this.showLabel(c.element,c.message);if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(a=0;this.successList[a];a++)this.showLabel(this.successList[a]);if(this.settings.unhighlight)for(a=0,b=this.validElements();b[a];a++)this.settings.unhighlight.call(this,b[a],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return a(this.errorList).map(function(){return this.element})},showLabel:function(b,c){var d,e,f,g,h=this.errorsFor(b),i=this.idOrName(b),j=a(b).attr("aria-describedby");h.length?(h.removeClass(this.settings.validClass).addClass(this.settings.errorClass),h.html(c)):(h=a("<"+this.settings.errorElement+">").attr("id",i+"-error").addClass(this.settings.errorClass).html(c||""),d=h,this.settings.wrapper&&(d=h.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.length?this.labelContainer.append(d):this.settings.errorPlacement?this.settings.errorPlacement.call(this,d,a(b)):d.insertAfter(b),h.is("label")?h.attr("for",i):0===h.parents("label[for='"+this.escapeCssMeta(i)+"']").length&&(f=h.attr("id"),j?j.match(new RegExp("\\b"+this.escapeCssMeta(f)+"\\b"))||(j+=" "+f):j=f,a(b).attr("aria-describedby",j),e=this.groups[b.name],e&&(g=this,a.each(g.groups,function(b,c){c===e&&a("[name='"+g.escapeCssMeta(b)+"']",g.currentForm).attr("aria-describedby",h.attr("id"))})))),!c&&this.settings.success&&(h.text(""),"string"==typeof this.settings.success?h.addClass(this.settings.success):this.settings.success(h,b)),this.toShow=this.toShow.add(h)},errorsFor:function(b){var c=this.escapeCssMeta(this.idOrName(b)),d=a(b).attr("aria-describedby"),e="label[for='"+c+"'], label[for='"+c+"'] *";return d&&(e=e+", #"+this.escapeCssMeta(d).replace(/\s+/g,", #")),this.errors().filter(e)},escapeCssMeta:function(a){return a.replace(/([\\!"#$%&'()*+,.\/:;<=>?@\[\]^`{|}~])/g,"\\$1")},idOrName:function(a){return this.groups[a.name]||(this.checkable(a)?a.name:a.id||a.name)},validationTargetFor:function(b){return this.checkable(b)&&(b=this.findByName(b.name)),a(b).not(this.settings.ignore)[0]},checkable:function(a){return/radio|checkbox/i.test(a.type)},findByName:function(b){return a(this.currentForm).find("[name='"+this.escapeCssMeta(b)+"']")},getLength:function(b,c){switch(c.nodeName.toLowerCase()){case"select":return a("option:selected",c).length;case"input":if(this.checkable(c))return this.findByName(c.name).filter(":checked").length}return b.length},depend:function(a,b){return!this.dependTypes[typeof a]||this.dependTypes[typeof a](a,b)},dependTypes:{"boolean":function(a){return a},string:function(b,c){return!!a(b,c.form).length},"function":function(a,b){return a(b)}},optional:function(b){var c=this.elementValue(b);return!a.validator.methods.required.call(this,c,b)&&"dependency-mismatch"},startRequest:function(b){this.pending[b.name]||(this.pendingRequest++,a(b).addClass(this.settings.pendingClass),this.pending[b.name]=!0)},stopRequest:function(b,c){this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[b.name],a(b).removeClass(this.settings.pendingClass),c&&0===this.pendingRequest&&this.formSubmitted&&this.form()?(a(this.currentForm).submit(),this.submitButton&&a("input:hidden[name='"+this.submitButton.name+"']",this.currentForm).remove(),this.formSubmitted=!1):!c&&0===this.pendingRequest&&this.formSubmitted&&(a(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(b,c){return c="string"==typeof c&&c||"remote",a.data(b,"previousValue")||a.data(b,"previousValue",{old:null,valid:!0,message:this.defaultMessage(b,{method:c})})},destroy:function(){this.resetForm(),a(this.currentForm).off(".validate").removeData("validator").find(".validate-equalTo-blur").off(".validate-equalTo").removeClass("validate-equalTo-blur")}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(b,c){b.constructor===String?this.classRuleSettings[b]=c:a.extend(this.classRuleSettings,b)},classRules:function(b){var c={},d=a(b).attr("class");return d&&a.each(d.split(" "),function(){this in a.validator.classRuleSettings&&a.extend(c,a.validator.classRuleSettings[this])}),c},normalizeAttributeRule:function(a,b,c,d){/min|max|step/.test(c)&&(null===b||/number|range|text/.test(b))&&(d=Number(d),isNaN(d)&&(d=void 0)),d||0===d?a[c]=d:b===c&&"range"!==b&&(a[c]=!0)},attributeRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)"required"===c?(d=b.getAttribute(c),""===d&&(d=!0),d=!!d):d=f.attr(c),this.normalizeAttributeRule(e,g,c,d);return e.maxlength&&/-1|2147483647|524288/.test(e.maxlength)&&delete e.maxlength,e},dataRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)d=f.data("rule"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase()),this.normalizeAttributeRule(e,g,c,d);return e},staticRules:function(b){var c={},d=a.data(b.form,"validator");return d.settings.rules&&(c=a.validator.normalizeRule(d.settings.rules[b.name])||{}),c},normalizeRules:function(b,c){return a.each(b,function(d,e){if(e===!1)return void delete b[d];if(e.param||e.depends){var f=!0;switch(typeof e.depends){case"string":f=!!a(e.depends,c.form).length;break;case"function":f=e.depends.call(c,c)}f?b[d]=void 0===e.param||e.param:(a.data(c.form,"validator").resetElements(a(c)),delete b[d])}}),a.each(b,function(d,e){b[d]=a.isFunction(e)&&"normalizer"!==d?e(c):e}),a.each(["minlength","maxlength"],function(){b[this]&&(b[this]=Number(b[this]))}),a.each(["rangelength","range"],function(){var c;b[this]&&(a.isArray(b[this])?b[this]=[Number(b[this][0]),Number(b[this][1])]:"string"==typeof b[this]&&(c=b[this].replace(/[\[\]]/g,"").split(/[\s,]+/),b[this]=[Number(c[0]),Number(c[1])]))}),a.validator.autoCreateRanges&&(null!=b.min&&null!=b.max&&(b.range=[b.min,b.max],delete b.min,delete b.max),null!=b.minlength&&null!=b.maxlength&&(b.rangelength=[b.minlength,b.maxlength],delete b.minlength,delete b.maxlength)),b},normalizeRule:function(b){if("string"==typeof b){var c={};a.each(b.split(/\s/),function(){c[this]=!0}),b=c}return b},addMethod:function(b,c,d){a.validator.methods[b]=c,a.validator.messages[b]=void 0!==d?d:a.validator.messages[b],c.length<3&&a.validator.addClassRules(b,a.validator.normalizeRule(b))},methods:{required:function(b,c,d){if(!this.depend(d,c))return"dependency-mismatch";if("select"===c.nodeName.toLowerCase()){var e=a(c).val();return e&&e.length>0}return this.checkable(c)?this.getLength(b,c)>0:b.length>0},email:function(a,b){return this.optional(b)||/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(a)},url:function(a,b){return this.optional(b)||/^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})).?)(?::\d{2,5})?(?:[\/?#]\S*)?$/i.test(a)},date:function(a,b){return this.optional(b)||!/Invalid|NaN/.test(new Date(a).toString())},dateISO:function(a,b){return this.optional(b)||/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(a)},number:function(a,b){return this.optional(b)||/^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(a)},digits:function(a,b){return this.optional(b)||/^\d+$/.test(a)},minlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e>=d},maxlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e<=d},rangelength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e>=d[0]&&e<=d[1]},min:function(a,b,c){return this.optional(b)||a>=c},max:function(a,b,c){return this.optional(b)||a<=c},range:function(a,b,c){return this.optional(b)||a>=c[0]&&a<=c[1]},step:function(b,c,d){var e,f=a(c).attr("type"),g="Step attribute on input type "+f+" is not supported.",h=["text","number","range"],i=new RegExp("\\b"+f+"\\b"),j=f&&!i.test(h.join()),k=function(a){var b=(""+a).match(/(?:\.(\d+))?$/);return b&&b[1]?b[1].length:0},l=function(a){return Math.round(a*Math.pow(10,e))},m=!0;if(j)throw new Error(g);return e=k(d),(k(b)>e||l(b)%l(d)!==0)&&(m=!1),this.optional(c)||m},equalTo:function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.not(".validate-equalTo-blur").length&&e.addClass("validate-equalTo-blur").on("blur.validate-equalTo",function(){a(c).valid()}),b===e.val()},remote:function(b,c,d,e){if(this.optional(c))return"dependency-mismatch";e="string"==typeof e&&e||"remote";var f,g,h,i=this.previousValue(c,e);return this.settings.messages[c.name]||(this.settings.messages[c.name]={}),i.originalMessage=i.originalMessage||this.settings.messages[c.name][e],this.settings.messages[c.name][e]=i.message,d="string"==typeof d&&{url:d}||d,h=a.param(a.extend({data:b},d.data)),i.old===h?i.valid:(i.old=h,f=this,this.startRequest(c),g={},g[c.name]=b,a.ajax(a.extend(!0,{mode:"abort",port:"validate"+c.name,dataType:"json",data:g,context:f.currentForm,success:function(a){var d,g,h,j=a===!0||"true"===a;f.settings.messages[c.name][e]=i.originalMessage,j?(h=f.formSubmitted,f.resetInternals(),f.toHide=f.errorsFor(c),f.formSubmitted=h,f.successList.push(c),f.invalid[c.name]=!1,f.showErrors()):(d={},g=a||f.defaultMessage(c,{method:e,parameters:b}),d[c.name]=i.message=g,f.invalid[c.name]=!0,f.showErrors(d)),i.valid=j,f.stopRequest(c,j)}},d)),"pending")}}});var b,c={};return a.ajaxPrefilter?a.ajaxPrefilter(function(a,b,d){var e=a.port;"abort"===a.mode&&(c[e]&&c[e].abort(),c[e]=d)}):(b=a.ajax,a.ajax=function(d){var e=("mode"in d?d:a.ajaxSettings).mode,f=("port"in d?d:a.ajaxSettings).port;return"abort"===e?(c[f]&&c[f].abort(),c[f]=b.apply(this,arguments),c[f]):b.apply(this,arguments)}),a});
17
 
18
  // ADDITIONAL JQUERY VALIDATE METHODS
19
  (function($) {
core/modules/core/sidebar-widget-mail-list-signup.php CHANGED
@@ -1,6 +1,9 @@
1
  <?php
2
 
3
  class ITSEC_Settings_Page_Sidebar_Widget_Mail_List_Signup extends ITSEC_Settings_Page_Sidebar_Widget {
 
 
 
4
  public function __construct() {
5
  $this->id = 'mail-list-signup';
6
  $this->title = __( 'Download Our WordPress Security Pocket Guide', 'better-wp-security' );
@@ -11,7 +14,7 @@ class ITSEC_Settings_Page_Sidebar_Widget_Mail_List_Signup extends ITSEC_Settings
11
  }
12
 
13
  public function render( $form ) {
14
- wp_enqueue_script( 'itsec-mc-validate', plugins_url( '/js/mc-validate.js', __FILE__ ), array( 'jquery' ), '20160526', true );
15
  $this->inline_js = "(function($) {window.fnames = new Array(); window.ftypes = new Array();fnames[0]='EMAIL';ftypes[0]='email';fnames[1]='FNAME';ftypes[1]='text';fnames[2]='LNAME';ftypes[2]='text';}(jQuery));";
16
  if ( function_exists( 'wp_add_inline_script' ) ) {
17
  wp_add_inline_script( 'itsec-mc-validate', $this->inline_js );
1
  <?php
2
 
3
  class ITSEC_Settings_Page_Sidebar_Widget_Mail_List_Signup extends ITSEC_Settings_Page_Sidebar_Widget {
4
+
5
+ private $version = 1;
6
+
7
  public function __construct() {
8
  $this->id = 'mail-list-signup';
9
  $this->title = __( 'Download Our WordPress Security Pocket Guide', 'better-wp-security' );
14
  }
15
 
16
  public function render( $form ) {
17
+ wp_enqueue_script( 'itsec-mc-validate', plugins_url( '/js/mc-validate.js', __FILE__ ), array( 'jquery' ), $this->version, true );
18
  $this->inline_js = "(function($) {window.fnames = new Array(); window.ftypes = new Array();fnames[0]='EMAIL';ftypes[0]='email';fnames[1]='FNAME';ftypes[1]='text';fnames[2]='LNAME';ftypes[2]='text';}(jQuery));";
19
  if ( function_exists( 'wp_add_inline_script' ) ) {
20
  wp_add_inline_script( 'itsec-mc-validate', $this->inline_js );
core/modules/file-change/scanner.php CHANGED
@@ -100,7 +100,7 @@ class ITSEC_File_Change_Scanner {
100
 
101
  $scheduler = $scheduler ? $scheduler : ITSEC_Core::get_scheduler();
102
 
103
- if ( self::is_running( $scheduler ) ) {
104
  return new WP_Error( 'itsec-file-change-scan-already-running', __( 'A File Change scan is currently in progress.', 'better-wp-security' ) );
105
  }
106
 
@@ -124,15 +124,24 @@ class ITSEC_File_Change_Scanner {
124
  * Check if a scan is running.
125
  *
126
  * @param ITSEC_Scheduler
 
127
  *
128
  * @return bool
129
  */
130
- public static function is_running( $scheduler = null ) {
131
 
132
  $scheduler = $scheduler ? $scheduler : ITSEC_Core::get_scheduler();
133
 
134
- if ( $scheduler->is_single_scheduled( 'file-change-fast', null ) ) {
135
- return true;
 
 
 
 
 
 
 
 
136
  }
137
 
138
  return ! ITSEC_File_Change::make_progress_storage()->is_empty();
100
 
101
  $scheduler = $scheduler ? $scheduler : ITSEC_Core::get_scheduler();
102
 
103
+ if ( self::is_running( $scheduler, $user_initiated ) ) {
104
  return new WP_Error( 'itsec-file-change-scan-already-running', __( 'A File Change scan is currently in progress.', 'better-wp-security' ) );
105
  }
106
 
124
  * Check if a scan is running.
125
  *
126
  * @param ITSEC_Scheduler
127
+ * @param bool $user_initiated Whether the user initiated run is running for the scheduled loop scan.
128
  *
129
  * @return bool
130
  */
131
+ public static function is_running( $scheduler = null, $user_initiated = null ) {
132
 
133
  $scheduler = $scheduler ? $scheduler : ITSEC_Core::get_scheduler();
134
 
135
+ if ( true === $user_initiated ) {
136
+ if ( $scheduler->is_single_scheduled( 'file-change-fast' ) ) {
137
+ return true;
138
+ }
139
+ } elseif ( false === $user_initiated ) {
140
+ if ( $scheduler->is_single_scheduled( 'file-change' ) ) {
141
+ return true;
142
+ }
143
+ } elseif ( null === $user_initiated ) {
144
+ return $scheduler->is_single_scheduled( 'file-change' ) || $scheduler->is_single_scheduled( 'file-change-fast' );
145
  }
146
 
147
  return ! ITSEC_File_Change::make_progress_storage()->is_empty();
core/modules/file-change/setup.php CHANGED
@@ -230,7 +230,7 @@ if ( ! class_exists( 'ITSEC_File_Change_Setup' ) ) {
230
 
231
  if ( $file_list_option && ! empty( $file_list_option['files'] ) ) {
232
  $files = end( $file_list_option['files'] );
233
- $home = $file_list_option['home'];
234
 
235
  if ( $home !== get_home_path() ) {
236
  $new_home = get_home_path();
@@ -291,6 +291,32 @@ if ( ! class_exists( 'ITSEC_File_Change_Setup' ) ) {
291
  ITSEC_File_Change_Scanner::schedule_start( false );
292
  delete_site_option( 'itsec_file_change_scan_progress' );
293
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
294
  }
295
 
296
  /**
230
 
231
  if ( $file_list_option && ! empty( $file_list_option['files'] ) ) {
232
  $files = end( $file_list_option['files'] );
233
+ $home = $file_list_option['home'];
234
 
235
  if ( $home !== get_home_path() ) {
236
  $new_home = get_home_path();
291
  ITSEC_File_Change_Scanner::schedule_start( false );
292
  delete_site_option( 'itsec_file_change_scan_progress' );
293
  }
294
+
295
+ if ( $itsec_old_version < 4107 ) {
296
+ $options = array(
297
+ 'itsec_file_list',
298
+ 'itsec_local_file_list',
299
+ 'itsec_local_file_list_0',
300
+ 'itsec_local_file_list_1',
301
+ 'itsec_local_file_list_2',
302
+ 'itsec_local_file_list_3',
303
+ 'itsec_local_file_list_4',
304
+ 'itsec_local_file_list_5',
305
+ 'itsec_local_file_list_6',
306
+ );
307
+
308
+ foreach ( $options as $option ) {
309
+ delete_site_option( $option );
310
+ }
311
+
312
+ require_once( dirname( __FILE__ ) . '/class-itsec-file-change.php' );
313
+ require_once( dirname( __FILE__ ) . '/scanner.php' );
314
+
315
+ ITSEC_Core::get_scheduler()->unschedule_single( 'file-change', null );
316
+ ITSEC_Core::get_scheduler()->unschedule_single( 'file-change-fast', null );
317
+ ITSEC_File_Change::make_progress_storage()->clear();
318
+ ITSEC_File_Change_Scanner::schedule_start( false );
319
+ }
320
  }
321
 
322
  /**
core/modules/global/js/settings-page.js CHANGED
@@ -36,7 +36,7 @@ var itsec_log_type_changed = function() {
36
  }
37
  };
38
 
39
- jQuery( document ).ready(function() {
40
  var $container = jQuery( '#wpcontent' );
41
 
42
  $container.on( 'click', '#itsec-global-add-to-whitelist', function( e ) {
@@ -57,4 +57,16 @@ jQuery( document ).ready(function() {
57
  $container.on( 'change', '#itsec-global-log_type', itsec_log_type_changed );
58
 
59
  itsec_log_type_changed();
 
 
 
 
 
 
 
 
 
 
 
 
60
  });
36
  }
37
  };
38
 
39
+ jQuery( document ).ready(function($) {
40
  var $container = jQuery( '#wpcontent' );
41
 
42
  $container.on( 'click', '#itsec-global-add-to-whitelist', function( e ) {
57
  $container.on( 'change', '#itsec-global-log_type', itsec_log_type_changed );
58
 
59
  itsec_log_type_changed();
60
+
61
+ function proxyHeaderChanged() {
62
+ if ( 'manual' === $( "#itsec-global-proxy" ).val() ) {
63
+ $( '.itsec-global-proxy_header-container' ).show();
64
+ } else {
65
+ $( '.itsec-global-proxy_header-container' ).hide();
66
+ }
67
+ }
68
+
69
+ proxyHeaderChanged();
70
+ $( document ).on( 'change', '#itsec-global-proxy', proxyHeaderChanged );
71
+ itsecSettingsPage.events.on( 'modulesReloaded', proxyHeaderChanged );
72
  });
core/modules/global/settings-page.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
 
3
  final class ITSEC_Global_Settings_Page extends ITSEC_Module_Settings_Page {
4
- private $version = 2;
5
 
6
 
7
  public function __construct() {
@@ -37,7 +37,7 @@ final class ITSEC_Global_Settings_Page extends ITSEC_Module_Settings_Page {
37
  'log_location' => ITSEC_Modules::get_default( $this->id, 'log_location' ),
38
  );
39
 
40
- wp_enqueue_script( 'itsec-global-settings-page-script', plugins_url( 'js/settings-page.js', __FILE__ ), array( 'jquery' ), $this->version, true );
41
  wp_localize_script( 'itsec-global-settings-page-script', 'itsec_global_settings_page', $vars );
42
  }
43
 
@@ -78,6 +78,41 @@ final class ITSEC_Global_Settings_Page extends ITSEC_Module_Settings_Page {
78
  true => __( 'Yes' ),
79
  );
80
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  ?>
82
  <table class="form-table itsec-settings-section">
83
  <tr>
@@ -226,11 +261,38 @@ final class ITSEC_Global_Settings_Page extends ITSEC_Module_Settings_Page {
226
  </tr>
227
  <?php endif; ?>
228
  <tr>
229
- <th scope="row"><label for="itsec-global-proxy_override"><?php _e( 'Override Proxy Detection', 'better-wp-security' ); ?></label></th>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
230
  <td>
231
- <?php $form->add_checkbox( 'proxy_override' ); ?>
232
- <label for="itsec-global-proxy_override"><?php _e( 'Disable Proxy IP Detection', 'better-wp-security' ); ?></label>
233
- <p class="description"><?php _e( 'If you\'re not using a proxy service such as Varnish, Cloudflare or others turning this on may result in more accurate IP detection.', 'better-wp-security' ); ?></p>
 
 
 
 
234
  </td>
235
  </tr>
236
  <tr>
1
  <?php
2
 
3
  final class ITSEC_Global_Settings_Page extends ITSEC_Module_Settings_Page {
4
+ private $version = 3;
5
 
6
 
7
  public function __construct() {
37
  'log_location' => ITSEC_Modules::get_default( $this->id, 'log_location' ),
38
  );
39
 
40
+ wp_enqueue_script( 'itsec-global-settings-page-script', plugins_url( 'js/settings-page.js', __FILE__ ), array( 'jquery', 'itsec-settings-page-script' ), $this->version, true );
41
  wp_localize_script( 'itsec-global-settings-page-script', 'itsec_global_settings_page', $vars );
42
  }
43
 
78
  true => __( 'Yes' ),
79
  );
80
 
81
+ $proxy = array( 'value' => $validator->get_proxy_types() );
82
+
83
+ if ( $proxy_header = ITSEC_Modules::get_setting( 'security-check-pro', 'remote_ip_index' ) ) {
84
+ $proxy['disabled'] = true;
85
+ }
86
+
87
+ $possible_headers = apply_filters( 'itsec_filter_remote_addr_headers', array(
88
+ 'HTTP_CF_CONNECTING_IP', // CloudFlare
89
+ 'HTTP_X_FORWARDED_FOR', // Squid and most other forward and reverse proxies
90
+ 'REMOTE_ADDR', // Default source of remote IP
91
+ ) );
92
+
93
+ $ucwords = version_compare( phpversion(), '5.5.16', '>=' ) || ( version_compare( phpversion(), '5.4.32', '>=' ) && version_compare( phpversion(), '5.5.0', '<' ) );
94
+ $proxy_header_opt = array();
95
+
96
+ foreach ( $possible_headers as $header ) {
97
+ $label = $header;
98
+
99
+ if ( 0 === strpos( $header, 'HTTP_' ) ) {
100
+ $label = substr( $label, 5 );
101
+ }
102
+
103
+ $label = str_replace( '_', '-', $label );
104
+ $label = strtolower( $label );
105
+ $label = $ucwords ? ucwords( $label, '-' ) : implode( '-', array_map( 'ucfirst', explode( '-', $label ) ) );
106
+
107
+ if ( isset( $_SERVER[ $header ] ) ) {
108
+ $label .= ' (' . esc_attr( $_SERVER[ $header ] ) . ')';
109
+ }
110
+
111
+ $label = str_replace('Ip', 'IP', $label );
112
+
113
+ $proxy_header_opt[ $header ] = $label;
114
+ }
115
+
116
  ?>
117
  <table class="form-table itsec-settings-section">
118
  <tr>
261
  </tr>
262
  <?php endif; ?>
263
  <tr>
264
+ <th scope="row"><label for="itsec-global-proxy"><?php esc_html_e( 'Proxy Detection', 'better-wp-security' ); ?></label></th>
265
+ <td>
266
+ <?php if ( $proxy_header ) : ?>
267
+ <p class="description">
268
+ <?php printf( esc_html__( 'Security Check Pro has automatically determined the correct header, %s.', 'better-wp-security' ), '<code>' . esc_attr( $proxy_header ) . '</code>' ); ?>
269
+ </p>
270
+ <?php else: ?>
271
+ <?php $form->add_select( 'proxy', $proxy ); ?>
272
+ <?php if ( ITSEC_Core::is_pro() ): ?>
273
+ <p class="">
274
+ <?php printf(
275
+ esc_html__( 'Configure this automatically by running a %1$sSecurity Check%2$s scan.', 'better-wp-security' ),
276
+ '<a href="#itsec-security-check-secure_site" data-module-link="security-check">', '</a>'
277
+ ); ?>
278
+ </p>
279
+ <?php endif; ?>
280
+ <p class="description">
281
+ <?php esc_html_e( 'By default, iThemes Security will try to find the correct proxy header to use automatically. However, we highly recommend manually selecting the header your proxy service uses or disabling it completely if your website is not behind a proxy. Otherwise, IP detection might not be accurate, allowing attackers to bypass lockouts.', 'better-wp-security' ) ?>
282
+ </p>
283
+ <?php endif; ?>
284
+ </td>
285
+ </tr>
286
+ <tr class="itsec-global-proxy_header-container">
287
+ <th scope="row"><label for="itsec-global-proxy_header"><?php esc_html_e( 'Proxy Header', 'better-wp-security' ); ?></label></th>
288
  <td>
289
+ <?php $form->add_select( 'proxy_header', $proxy_header_opt ); ?>
290
+ <p class="description">
291
+ <?php printf(
292
+ esc_html__( 'Select the header your Proxy Server uses to forward the client IP address. If you don\'t know the header, you can contact your hosting provider or select the header that has your %1$sIP Address%2$s.', 'better-wp-security' ),
293
+ '<a href="https://whatismyipaddress.com">', '</a>'
294
+ ); ?>
295
+ </p>
296
  </td>
297
  </tr>
298
  <tr>
core/modules/global/settings.php CHANGED
@@ -26,7 +26,8 @@ final class ITSEC_Global_Settings_New extends ITSEC_Settings {
26
  'infinitewp_compatibility' => false,
27
  'did_upgrade' => false,
28
  'lock_file' => false,
29
- 'proxy_override' => false,
 
30
  'hide_admin_bar' => false,
31
  'show_error_codes' => false,
32
  'show_security_check' => true,
26
  'infinitewp_compatibility' => false,
27
  'did_upgrade' => false,
28
  'lock_file' => false,
29
+ 'proxy' => 'automatic',
30
+ 'proxy_header' => 'HTTP_X_FORWARDED_FOR',
31
  'hide_admin_bar' => false,
32
  'show_error_codes' => false,
33
  'show_security_check' => true,
core/modules/global/setup.php CHANGED
@@ -122,6 +122,12 @@ if ( ! class_exists( 'ITSEC_Global_Setup' ) ) {
122
  if ( $itsec_old_version < 4064 ) {
123
  delete_site_option( 'itsec_global' );
124
  }
 
 
 
 
 
 
125
  }
126
 
127
  }
122
  if ( $itsec_old_version < 4064 ) {
123
  delete_site_option( 'itsec_global' );
124
  }
125
+
126
+ if ( $itsec_old_version < 4108 ) {
127
+ if ( ITSEC_Modules::get_setting( 'global', 'proxy_override' ) ) {
128
+ ITSEC_Modules::set_setting( 'global', 'proxy', 'disabled' );
129
+ }
130
+ }
131
  }
132
 
133
  }
core/modules/global/validator.php CHANGED
@@ -19,16 +19,17 @@ class ITSEC_Global_Validator extends ITSEC_Validator {
19
  }
20
 
21
 
22
- $this->vars_to_skip_validate_matching_fields = array( 'digest_last_sent', 'digest_messages', 'digest_email', 'email_notifications', 'notification_email', 'backup_email', 'show_new_dashboard_notice' );
23
  $this->set_previous_if_empty( array( 'did_upgrade', 'log_info', 'show_security_check', 'build', 'activation_timestamp', 'lock_file', 'cron_status', 'use_cron', 'cron_test_time' ) );
24
  $this->set_default_if_empty( array( 'log_location', 'nginx_file', 'enable_grade_report' ) );
25
- $this->preserve_setting_if_exists( array( 'digest_email', 'email_notifications', 'notification_email', 'backup_email' ) );
26
 
27
 
28
  $this->sanitize_setting( 'bool', 'write_files', __( 'Write to Files', 'better-wp-security' ) );
29
  $this->sanitize_setting( 'bool', 'blacklist', __( 'Blacklist Repeat Offender', 'better-wp-security' ) );
30
  $this->sanitize_setting( 'bool', 'allow_tracking', __( 'Allow Data Tracking', 'better-wp-security' ) );
31
- $this->sanitize_setting( 'bool', 'proxy_override', __( 'Override Proxy Detection', 'better-wp-security' ) );
 
32
  $this->sanitize_setting( 'bool', 'hide_admin_bar', __( 'Hide Security Menu in Admin Bar', 'better-wp-security' ) );
33
  $this->sanitize_setting( 'bool', 'show_error_codes', __( 'Show Error Codes', 'better-wp-security' ) );
34
  $this->sanitize_setting( 'bool', 'enable_grade_report', __( 'Enable Grade Report', 'better-wp-security' ) );
@@ -59,6 +60,14 @@ class ITSEC_Global_Validator extends ITSEC_Validator {
59
  $this->settings['community_lockout_message'] = trim( wp_kses( $this->settings['community_lockout_message'], $allowed_tags ) );
60
  }
61
 
 
 
 
 
 
 
 
 
62
  public function get_valid_log_types() {
63
  return array(
64
  'database' => __( 'Database Only', 'better-wp-security' ),
19
  }
20
 
21
 
22
+ $this->vars_to_skip_validate_matching_fields = array( 'digest_last_sent', 'digest_messages', 'digest_email', 'email_notifications', 'notification_email', 'backup_email', 'show_new_dashboard_notice', 'proxy_override' );
23
  $this->set_previous_if_empty( array( 'did_upgrade', 'log_info', 'show_security_check', 'build', 'activation_timestamp', 'lock_file', 'cron_status', 'use_cron', 'cron_test_time' ) );
24
  $this->set_default_if_empty( array( 'log_location', 'nginx_file', 'enable_grade_report' ) );
25
+ $this->preserve_setting_if_exists( array( 'digest_email', 'email_notifications', 'notification_email', 'backup_email', 'proxy_override' ) );
26
 
27
 
28
  $this->sanitize_setting( 'bool', 'write_files', __( 'Write to Files', 'better-wp-security' ) );
29
  $this->sanitize_setting( 'bool', 'blacklist', __( 'Blacklist Repeat Offender', 'better-wp-security' ) );
30
  $this->sanitize_setting( 'bool', 'allow_tracking', __( 'Allow Data Tracking', 'better-wp-security' ) );
31
+ $this->sanitize_setting( array_keys( $this->get_proxy_types() ), 'proxy', __( 'Proxy Detection', 'better-wp-security' ) );
32
+ $this->sanitize_setting( 'string', 'proxy_header', __( 'Manual Proxy Header', 'better-wp-security' ) );
33
  $this->sanitize_setting( 'bool', 'hide_admin_bar', __( 'Hide Security Menu in Admin Bar', 'better-wp-security' ) );
34
  $this->sanitize_setting( 'bool', 'show_error_codes', __( 'Show Error Codes', 'better-wp-security' ) );
35
  $this->sanitize_setting( 'bool', 'enable_grade_report', __( 'Enable Grade Report', 'better-wp-security' ) );
60
  $this->settings['community_lockout_message'] = trim( wp_kses( $this->settings['community_lockout_message'], $allowed_tags ) );
61
  }
62
 
63
+ public function get_proxy_types() {
64
+ return array(
65
+ 'automatic' => esc_html__( 'Automatic', 'better-wp-security' ),
66
+ 'manual' => esc_html__( 'Manual', 'better-wp-security' ),
67
+ 'disabled' => esc_html__( 'Disabled', 'better-wp-security' ),
68
+ );
69
+ }
70
+
71
  public function get_valid_log_types() {
72
  return array(
73
  'database' => __( 'Database Only', 'better-wp-security' ),
core/modules/ipcheck/class-itsec-ipcheck.php CHANGED
@@ -25,6 +25,7 @@ class ITSEC_IPCheck {
25
  }
26
 
27
  public function filter_authenticate( $user, $username, $password ) {
 
28
  global $itsec_lockout;
29
 
30
  if ( is_wp_error( $user ) && $user->get_error_codes() == array( 'empty_username', 'empty_password' ) ) {
25
  }
26
 
27
  public function filter_authenticate( $user, $username, $password ) {
28
+ /** @var $itsec_lockout ITSEC_Lockout */
29
  global $itsec_lockout;
30
 
31
  if ( is_wp_error( $user ) && $user->get_error_codes() == array( 'empty_username', 'empty_password' ) ) {
core/modules/notification-center/class-notification-center.php CHANGED
@@ -183,6 +183,16 @@ final class ITSEC_Notification_Center {
183
  $args['schedule'] = wp_parse_args( $args['schedule'], $schedule );
184
  }
185
 
 
 
 
 
 
 
 
 
 
 
186
  return $args;
187
  }
188
 
183
  $args['schedule'] = wp_parse_args( $args['schedule'], $schedule );
184
  }
185
 
186
+ $optional = array(
187
+ 'default' => true,
188
+ );
189
+
190
+ if ( $args['optional'] === true ) {
191
+ $args['optional'] = $optional;
192
+ } elseif ( is_array( $args['optional'] ) ) {
193
+ $args['optional'] = wp_parse_args( $args['optional'], $optional );
194
+ }
195
+
196
  return $args;
197
  }
198
 
core/modules/notification-center/settings.php CHANGED
@@ -60,6 +60,31 @@ class ITSEC_Notification_Center_Settings extends ITSEC_Settings {
60
  unset( $this->settings['mail_errors'] );
61
  }
62
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  public function refresh_notification_settings( $save = true ) {
64
 
65
  $nc = ITSEC_Core::get_notification_center();
@@ -174,7 +199,7 @@ class ITSEC_Notification_Center_Settings extends ITSEC_Settings {
174
  }
175
 
176
  if ( ! empty( $notification['optional'] ) ) {
177
- $defaults['enabled'] = true;
178
  }
179
 
180
  if ( ITSEC_Notification_Center::R_USER_LIST === $notification['recipient'] ) {
60
  unset( $this->settings['mail_errors'] );
61
  }
62
 
63
+ protected function handle_settings_changes( $old_settings ) {
64
+
65
+ $nc = ITSEC_Core::get_notification_center();
66
+
67
+ foreach ( $this->settings['notifications'] as $slug => $notification ) {
68
+ if ( ! isset( $old_settings['notifications'][ $slug ] ) ) {
69
+ continue;
70
+ }
71
+
72
+ $config = $nc->get_notification( $slug );
73
+
74
+ if ( empty( $config['optional'] ) ) {
75
+ continue;
76
+ }
77
+
78
+ if ( $notification['enabled'] && ! $old_settings['notifications'][ $slug ]['enabled'] ) {
79
+ do_action( "itsec_notification_center_{$slug}_notification_enabled", $slug );
80
+ do_action( 'itsec_notification_center_notification_enabled', $slug );
81
+ } elseif ( ! $notification['enabled'] && $old_settings['notifications'][ $slug ]['enabled'] ) {
82
+ do_action( "itsec_notification_center_{$slug}_notification_disabled", $slug );
83
+ do_action( 'itsec_notification_center_notification_disabled', $slug );
84
+ }
85
+ }
86
+ }
87
+
88
  public function refresh_notification_settings( $save = true ) {
89
 
90
  $nc = ITSEC_Core::get_notification_center();
199
  }
200
 
201
  if ( ! empty( $notification['optional'] ) ) {
202
+ $defaults['enabled'] = $notification['optional']['default'];
203
  }
204
 
205
  if ( ITSEC_Notification_Center::R_USER_LIST === $notification['recipient'] ) {
core/modules/system-tweaks/config-generators.php CHANGED
@@ -67,6 +67,10 @@ final class ITSEC_System_Tweaks_Config_Generators {
67
  $rewrites .= "\t\tRewriteRule ^$wp_includes/[^/]+\.php$ - [F]\n";
68
  $rewrites .= "\t\tRewriteRule ^$wp_includes/js/tinymce/langs/.+\.php - [F]\n";
69
  $rewrites .= "\t\tRewriteRule ^$wp_includes/theme-compat/ - [F]\n";
 
 
 
 
70
  }
71
 
72
  if ( $input['uploads_php'] ) {
@@ -189,6 +193,8 @@ final class ITSEC_System_Tweaks_Config_Generators {
189
 
190
  $modification .= "\tlocation ~ ^/$wp_includes/js/tinymce/langs/.+\.php$ { deny all; }\n";
191
  $modification .= "\tlocation ~ ^/$wp_includes/theme-compat/ { deny all; }\n";
 
 
192
  }
193
 
194
  // Rewrite Rules for Disable PHP in Uploads
67
  $rewrites .= "\t\tRewriteRule ^$wp_includes/[^/]+\.php$ - [F]\n";
68
  $rewrites .= "\t\tRewriteRule ^$wp_includes/js/tinymce/langs/.+\.php - [F]\n";
69
  $rewrites .= "\t\tRewriteRule ^$wp_includes/theme-compat/ - [F]\n";
70
+
71
+ $hide_dirs = implode( '|', array( 'git', 'svn' ) );
72
+ $rewrites .= "\t\tRewriteCond %{REQUEST_FILENAME} -f\n";
73
+ $rewrites .= "\t\tRewriteRule (^|.*/)\.({$hide_dirs})/.* - [F]\n";
74
  }
75
 
76
  if ( $input['uploads_php'] ) {
193
 
194
  $modification .= "\tlocation ~ ^/$wp_includes/js/tinymce/langs/.+\.php$ { deny all; }\n";
195
  $modification .= "\tlocation ~ ^/$wp_includes/theme-compat/ { deny all; }\n";
196
+ $modification .= "\tlocation ~ ^.*/\.git/.*$ { deny all; }\n";
197
+ $modification .= "\tlocation ~ ^.*/\.svn/.*$ { deny all; }\n";
198
  }
199
 
200
  // Rewrite Rules for Disable PHP in Uploads
history.txt CHANGED
@@ -803,3 +803,9 @@
803
  Bug Fix: Account for any CLI PHP SAPI instead of just WP-CLI in the SSL Module.
804
  Bug Fix: Fixed how the Grade Report enable/disable status is stored to fix admin page loading issues on some sites.
805
  Bug Fix: Fix serialization of closure error when a plugin registering a hook with a closure is in the boot-up stack and the notification center is triggered too early in the cycle.
 
 
 
 
 
 
803
  Bug Fix: Account for any CLI PHP SAPI instead of just WP-CLI in the SSL Module.
804
  Bug Fix: Fixed how the Grade Report enable/disable status is stored to fix admin page loading issues on some sites.
805
  Bug Fix: Fix serialization of closure error when a plugin registering a hook with a closure is in the boot-up stack and the notification center is triggered too early in the cycle.
806
+ 7.2.0 - 2018-10-10 - Chris Jean & Timothy Jacobs
807
+ Enhancement: Allow for selecting the particular Proxy header a server is configured to use. Improve the language to indicate the importance of configuring this setting. H/t Filippo Cavallarin CEO at wearesegment.com
808
+ Enhancement: Block access to git and svn repositories when System Tweaks -> Protect System Files is enabled.
809
+ Tweak: Update jQuery Validation library to 1.17.0
810
+ Bug Fix: Improve detection of blocking the File Change Scan from being scheduled if one is already being run.
811
+ Bug Fix: Prevent infinite recursion error when trying to access directories outside of the allowed file tree.
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: ithemes, chrisjean, gerroald, mattdanner, timothyblynjacobs
3
  Tags: security, security plugin, malware, hack, secure, block, SSL, admin, htaccess, lockdown, login, protect, protection, anti virus, attack, injection, login security, maintenance, permissions, prevention, authentication, administration, password, brute force, ban, permissions, bots, user agents, xml rpc, security log
4
  Requires at least: 4.7
5
  Tested up to: 4.9.8
6
- Stable tag: 7.1.0
7
  Requires PHP: 5.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -189,6 +189,13 @@ Free support may be available with the help of the community in the <a href="htt
189
 
190
  == Changelog ==
191
 
 
 
 
 
 
 
 
192
  = 7.1.0 =
193
  * New Feature: Allow for globally setting recipients for admin-targeted notifications. All new notifications will default to the recipients in this list. Notifications can be set to use the default list or switch to a custom list.
194
  * Enhancement: Added a setting to enable/disable the Grade Report feature of Pro.
@@ -496,5 +503,5 @@ Free support may be available with the help of the community in the <a href="htt
496
 
497
  == Upgrade Notice ==
498
 
499
- = 7.1.0 =
500
- Version 7.1.0 contains important bug fixes and improvements. It is recommended for all users.
3
  Tags: security, security plugin, malware, hack, secure, block, SSL, admin, htaccess, lockdown, login, protect, protection, anti virus, attack, injection, login security, maintenance, permissions, prevention, authentication, administration, password, brute force, ban, permissions, bots, user agents, xml rpc, security log
4
  Requires at least: 4.7
5
  Tested up to: 4.9.8
6
+ Stable tag: 7.2.0
7
  Requires PHP: 5.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
189
 
190
  == Changelog ==
191
 
192
+ = 7.2.0 =
193
+ * Enhancement: Allow for selecting the particular Proxy header a server is configured to use. Improve the language to indicate the importance of configuring this setting. H/t Filippo Cavallarin CEO at wearesegment.com
194
+ * Enhancement: Block access to git and svn repositories when System Tweaks -> Protect System Files is enabled.
195
+ * Tweak: Update jQuery Validation library to 1.17.0
196
+ * Bug Fix: Improve detection of blocking the File Change Scan from being scheduled if one is already being run.
197
+ * Bug Fix: Prevent infinite recursion error when trying to access directories outside of the allowed file tree.
198
+
199
  = 7.1.0 =
200
  * New Feature: Allow for globally setting recipients for admin-targeted notifications. All new notifications will default to the recipients in this list. Notifications can be set to use the default list or switch to a custom list.
201
  * Enhancement: Added a setting to enable/disable the Grade Report feature of Pro.
503
 
504
  == Upgrade Notice ==
505
 
506
+ = 7.2.0 =
507
+ Version 7.2.0 contains important bug fixes and improvements. It is recommended for all users.