Shield Security for WordPress - Version 6.10.3

Version Description

  • Current Release = Released: 5th November, 2018 - Release Notes

  • (v.3) ADDED: Support for Ultimate Member forms

  • (v.3) ADDED: Support for LearnPress login/registration forms

  • (v.3) FIXED: Security Admin now correctly honours the WordPress Options zone setting.

  • (v.3) IMPROVED: Distinguish which sub-site (sub-domain) for WPMS installations on Traffic Watcher.

  • (v.3) IMPROVED: Server's own IP lookup is only attempted once.

  • (v.3) ADDED: Experimental feature to help with some custom 3rd party login/registration forms

Download this release

Release Info

Developer paultgoodchild
Plugin Icon 128x128 Shield Security for WordPress
Version 6.10.3
Comparing to
See all releases

Code changes from version 6.10.2 to 6.10.3

Files changed (89) hide show
  1. icwp-plugin-controller.php +15 -16
  2. icwp-wpsf.php +1 -1
  3. plugin-spec.php +1 -1
  4. readme.txt +13 -7
  5. resources/css/global-plugin.css +1 -1
  6. resources/js/global-plugin.js +19 -4
  7. resources/js/shield-antibot.js +66 -0
  8. src/common/icwp-data.php +173 -227
  9. src/common/icwp-edd.php +1 -1
  10. src/common/icwp-foundation.php +12 -0
  11. src/common/icwp-ip.php +11 -14
  12. src/common/icwp-request.php +313 -0
  13. src/common/icwp-wpfunctions-plugins.php +81 -69
  14. src/common/icwp-wpfunctions.php +33 -34
  15. src/common/lib/composer.lock +10 -10
  16. src/common/lib/vendor/composer/ca-bundle/res/cacert.pem +48 -122
  17. src/common/lib/vendor/composer/installed.json +89 -89
  18. src/common/lib/vendor/symfony/translation/Catalogue/AbstractOperation.php +14 -15
  19. src/common/lib/vendor/symfony/translation/Dumper/CsvFileDumper.php +1 -1
  20. src/common/wp-admin-notices.php +5 -5
  21. src/common/wp-comments.php +1 -1
  22. src/config/feature-firewall.php +1 -0
  23. src/config/feature-login_protect.php +26 -0
  24. src/features/admin_access_restriction.php +5 -5
  25. src/features/audit_trail.php +2 -2
  26. src/features/autoupdates.php +3 -3
  27. src/features/base.php +20 -16
  28. src/features/base_wpsf.php +3 -3
  29. src/features/hack_protect.php +14 -14
  30. src/features/insights.php +11 -20
  31. src/features/ips.php +9 -9
  32. src/features/license.php +9 -9
  33. src/features/login_protect.php +111 -14
  34. src/features/plugin.php +25 -24
  35. src/features/sessions.php +2 -2
  36. src/features/traffic.php +4 -15
  37. src/features/user_management.php +3 -4
  38. src/processors/admin_access_restriction.php +38 -36
  39. src/processors/audit_trail.php +1 -0
  40. src/processors/audit_trail_auditor_base.php +2 -2
  41. src/processors/base.php +1 -1
  42. src/processors/base_plugin.php +1 -1
  43. src/processors/base_wpsf.php +2 -2
  44. src/processors/commentsfilter_antibotspam.php +7 -7
  45. src/processors/commentsfilter_humanspam.php +1 -1
  46. src/processors/firewall.php +5 -6
  47. src/processors/hack_protect.php +7 -7
  48. src/processors/hackprotect_corechecksumscan.php +4 -4
  49. src/processors/hackprotect_filecleanerscan.php +3 -3
  50. src/processors/hackprotect_pluginvulnerabilities.php +2 -5
  51. src/processors/hackprotect_ptguard.php +3 -3
  52. src/processors/hackprotect_wpvulnscan.php +4 -4
  53. src/processors/ips.php +1 -1
  54. src/processors/license.php +4 -4
  55. src/processors/lockdown.php +1 -1
  56. src/processors/login_protect.php +1 -1
  57. src/processors/loginprotect_base.php +124 -6
  58. src/processors/loginprotect_gasp.php +19 -31
  59. src/processors/loginprotect_googleauthenticator.php +4 -5
  60. src/processors/loginprotect_intent.php +13 -13
  61. src/processors/loginprotect_intent_tracker.php +166 -0
  62. src/processors/loginprotect_intentprovider_backup.php +209 -0
  63. src/processors/loginprotect_intentprovider_base.php +4 -4
  64. src/processors/loginprotect_intentprovider_email.php +239 -0
  65. src/processors/loginprotect_intentprovider_ga.php +344 -0
  66. src/processors/loginprotect_intentprovider_yubikey.php +300 -0
  67. src/processors/loginprotect_wplogin.php +11 -14
  68. src/processors/plugin.php +1 -2
  69. src/processors/plugin_importexport.php +8 -9
  70. src/processors/sessions.php +1 -1
  71. src/processors/traffic_logger.php +16 -12
  72. src/processors/usermanagement_passwords.php +4 -4
  73. src/processors/usermanagement_sessions.php +1 -1
  74. src/query/audittrail/select.php +1 -1
  75. src/query/base/insert.php +2 -3
  76. src/query/base/statistics_base.php +1 -1
  77. src/query/ips/update.php +2 -2
  78. src/query/notes/insert.php +1 -1
  79. src/query/sessions/insert.php +4 -4
  80. src/query/sessions/update.php +4 -4
  81. src/query/statistics/tally_insert.php +1 -1
  82. src/query/traffic/insert.php +1 -1
  83. src/wizards/base.php +7 -7
  84. src/wizards/base_wpsf.php +2 -2
  85. src/wizards/hack_protect.php +10 -10
  86. src/wizards/login_protect.php +9 -9
  87. src/wizards/plugin.php +19 -20
  88. templates/php/snippets/admin_access_login_box.php +8 -6
  89. templates/php/snippets/plugin-deactivate-survey.php +2 -1
icwp-plugin-controller.php CHANGED
@@ -235,7 +235,7 @@ class ICWP_WPSF_Plugin_Controller extends ICWP_WPSF_Foundation {
235
  * @return bool
236
  */
237
  public function isThisPluginModuleRequest() {
238
- return strpos( $this->loadDP()->query( 'page' ), $this->prefix() ) === 0;
239
  }
240
 
241
  /**
@@ -322,7 +322,7 @@ class ICWP_WPSF_Plugin_Controller extends ICWP_WPSF_Foundation {
322
  add_action( 'wp_dashboard_setup', array( $this, 'onWpDashboardSetup' ) );
323
  }
324
  add_action( 'admin_enqueue_scripts', array( $this, 'onWpEnqueueAdminCss' ), 100 );
325
- add_action( 'admin_enqueue_scripts', array( $this, 'onWpEnqueueAdminJs' ), 99 );
326
  }
327
 
328
  /**
@@ -396,14 +396,14 @@ class ICWP_WPSF_Plugin_Controller extends ICWP_WPSF_Foundation {
396
  * @uses die()
397
  */
398
  private function downloadOptionsExport() {
399
- $oDp = $this->loadDP();
400
  if ( $oDp->query( 'icwp_shield_export' ) == 1 ) {
401
  $aExportOptions = apply_filters( $this->prefix( 'gather_options_for_export' ), array() );
402
  if ( !empty( $aExportOptions ) && is_array( $aExportOptions ) ) {
403
  $oDp->downloadStringAsFile(
404
  wp_json_encode( $aExportOptions ),
405
  'shield_options_export-'
406
- .$oDp->urlStripSchema( $this->loadWp()->getHomeUrl() )
407
  .'-'.date( 'y-m-d__H-i-s' ).'.txt'
408
  );
409
  }
@@ -411,7 +411,7 @@ class ICWP_WPSF_Plugin_Controller extends ICWP_WPSF_Foundation {
411
  }
412
 
413
  public function ajaxAction() {
414
- $sNonceAction = $this->loadDP()->request( 'exec' );
415
  check_ajax_referer( $sNonceAction, 'exec_nonce' );
416
 
417
  $sAction = $this->loadWpUsers()->isUserLoggedIn() ? 'ajaxAuthAction' : 'ajaxNonAuthAction';
@@ -760,7 +760,7 @@ class ICWP_WPSF_Plugin_Controller extends ICWP_WPSF_Foundation {
760
  $oConOptions->update_first_detected = array();
761
  }
762
  if ( !isset( $oConOptions->update_first_detected[ $sNewVersion ] ) ) {
763
- $oConOptions->update_first_detected[ $sNewVersion ] = $this->loadDP()->time();
764
  }
765
 
766
  // a bit of cleanup to remove the old-style entries which would gather foreva-eva
@@ -823,7 +823,7 @@ class ICWP_WPSF_Plugin_Controller extends ICWP_WPSF_Foundation {
823
  $sNewVersion = $oWpPlugins->getUpdateNewVersion( $sFile );
824
  if ( !empty( $sNewVersion ) ) {
825
  $nFirstDetected = isset( $oConOptions->update_first_detected[ $sNewVersion ] ) ? $oConOptions->update_first_detected[ $sNewVersion ] : 0;
826
- $nTimeUpdateAvailable = $this->loadDP()->time() - $nFirstDetected;
827
  $bDoAutoUpdate = ( $nFirstDetected > 0 && ( $nTimeUpdateAvailable > DAY_IN_SECONDS*$nAutoupdateDays ) );
828
  }
829
  break;
@@ -1161,9 +1161,9 @@ class ICWP_WPSF_Plugin_Controller extends ICWP_WPSF_Foundation {
1161
 
1162
  $aFormSubmitOptions = array( 'plugin_form_submit', 'icwp_link_action' );
1163
 
1164
- $oDp = $this->loadDP();
1165
  foreach ( $aFormSubmitOptions as $sOption ) {
1166
- if ( !is_null( $oDp->request( $sOption, false ) ) ) {
1167
  return true;
1168
  }
1169
  }
@@ -1584,7 +1584,7 @@ class ICWP_WPSF_Plugin_Controller extends ICWP_WPSF_Foundation {
1584
  /**
1585
  */
1586
  public function clearSession() {
1587
- $this->loadDP()->setDeleteCookie( $this->getPluginPrefix() );
1588
  self::$sSessionId = null;
1589
  }
1590
 
@@ -1625,7 +1625,7 @@ class ICWP_WPSF_Plugin_Controller extends ICWP_WPSF_Foundation {
1625
  */
1626
  public function getSessionId( $bSetIfNeeded = true ) {
1627
  if ( empty( self::$sSessionId ) ) {
1628
- self::$sSessionId = $this->loadDP()->cookie( $this->getPluginPrefix(), '' );
1629
  if ( empty( self::$sSessionId ) && $bSetIfNeeded ) {
1630
  self::$sSessionId = md5( uniqid( $this->getPluginPrefix() ) );
1631
  $this->setSessionCookie();
@@ -1640,9 +1640,8 @@ class ICWP_WPSF_Plugin_Controller extends ICWP_WPSF_Foundation {
1640
  */
1641
  public function getUniqueRequestId( $bSetIfNeeded = true ) {
1642
  if ( !isset( self::$sRequestId ) ) {
1643
- $oDp = $this->loadDP();
1644
  self::$sRequestId = md5(
1645
- $this->getSessionId( $bSetIfNeeded ).$this->loadIpService()->getRequestIp().$oDp->time().wp_rand()
1646
  );
1647
  }
1648
  return self::$sRequestId;
@@ -1667,11 +1666,11 @@ class ICWP_WPSF_Plugin_Controller extends ICWP_WPSF_Foundation {
1667
  */
1668
  protected function setSessionCookie() {
1669
  $oWp = $this->loadWp();
1670
- $oDP = $this->loadDP();
1671
- $oDP->setCookie(
1672
  $this->getPluginPrefix(),
1673
  $this->getSessionId(),
1674
- $oDP->time() + DAY_IN_SECONDS*30,
1675
  $oWp->getCookiePath(),
1676
  $oWp->getCookieDomain(),
1677
  false
235
  * @return bool
236
  */
237
  public function isThisPluginModuleRequest() {
238
+ return strpos( $this->loadRequest()->query( 'page' ), $this->prefix() ) === 0;
239
  }
240
 
241
  /**
322
  add_action( 'wp_dashboard_setup', array( $this, 'onWpDashboardSetup' ) );
323
  }
324
  add_action( 'admin_enqueue_scripts', array( $this, 'onWpEnqueueAdminCss' ), 100 );
325
+ add_action( 'admin_enqueue_scripts', array( $this, 'onWpEnqueueAdminJs' ), 5 );
326
  }
327
 
328
  /**
396
  * @uses die()
397
  */
398
  private function downloadOptionsExport() {
399
+ $oDp = $this->loadRequest();
400
  if ( $oDp->query( 'icwp_shield_export' ) == 1 ) {
401
  $aExportOptions = apply_filters( $this->prefix( 'gather_options_for_export' ), array() );
402
  if ( !empty( $aExportOptions ) && is_array( $aExportOptions ) ) {
403
  $oDp->downloadStringAsFile(
404
  wp_json_encode( $aExportOptions ),
405
  'shield_options_export-'
406
+ .$this->loadDP()->urlStripSchema( $this->loadWp()->getHomeUrl() )
407
  .'-'.date( 'y-m-d__H-i-s' ).'.txt'
408
  );
409
  }
411
  }
412
 
413
  public function ajaxAction() {
414
+ $sNonceAction = $this->loadRequest()->request( 'exec' );
415
  check_ajax_referer( $sNonceAction, 'exec_nonce' );
416
 
417
  $sAction = $this->loadWpUsers()->isUserLoggedIn() ? 'ajaxAuthAction' : 'ajaxNonAuthAction';
760
  $oConOptions->update_first_detected = array();
761
  }
762
  if ( !isset( $oConOptions->update_first_detected[ $sNewVersion ] ) ) {
763
+ $oConOptions->update_first_detected[ $sNewVersion ] = $this->loadRequest()->ts();
764
  }
765
 
766
  // a bit of cleanup to remove the old-style entries which would gather foreva-eva
823
  $sNewVersion = $oWpPlugins->getUpdateNewVersion( $sFile );
824
  if ( !empty( $sNewVersion ) ) {
825
  $nFirstDetected = isset( $oConOptions->update_first_detected[ $sNewVersion ] ) ? $oConOptions->update_first_detected[ $sNewVersion ] : 0;
826
+ $nTimeUpdateAvailable = $this->loadRequest()->ts() - $nFirstDetected;
827
  $bDoAutoUpdate = ( $nFirstDetected > 0 && ( $nTimeUpdateAvailable > DAY_IN_SECONDS*$nAutoupdateDays ) );
828
  }
829
  break;
1161
 
1162
  $aFormSubmitOptions = array( 'plugin_form_submit', 'icwp_link_action' );
1163
 
1164
+ $oReq = $this->loadRequest();
1165
  foreach ( $aFormSubmitOptions as $sOption ) {
1166
+ if ( !is_null( $oReq->request( $sOption, false ) ) ) {
1167
  return true;
1168
  }
1169
  }
1584
  /**
1585
  */
1586
  public function clearSession() {
1587
+ $this->loadRequest()->setDeleteCookie( $this->getPluginPrefix() );
1588
  self::$sSessionId = null;
1589
  }
1590
 
1625
  */
1626
  public function getSessionId( $bSetIfNeeded = true ) {
1627
  if ( empty( self::$sSessionId ) ) {
1628
+ self::$sSessionId = $this->loadRequest()->cookie( $this->getPluginPrefix(), '' );
1629
  if ( empty( self::$sSessionId ) && $bSetIfNeeded ) {
1630
  self::$sSessionId = md5( uniqid( $this->getPluginPrefix() ) );
1631
  $this->setSessionCookie();
1640
  */
1641
  public function getUniqueRequestId( $bSetIfNeeded = true ) {
1642
  if ( !isset( self::$sRequestId ) ) {
 
1643
  self::$sRequestId = md5(
1644
+ $this->getSessionId( $bSetIfNeeded ).$this->loadIpService()->getRequestIp().$this->loadRequest()->ts().wp_rand()
1645
  );
1646
  }
1647
  return self::$sRequestId;
1666
  */
1667
  protected function setSessionCookie() {
1668
  $oWp = $this->loadWp();
1669
+ $oReq = $this->loadRequest();
1670
+ $oReq->setCookie(
1671
  $this->getPluginPrefix(),
1672
  $this->getSessionId(),
1673
+ $oReq->ts() + DAY_IN_SECONDS*30,
1674
  $oWp->getCookiePath(),
1675
  $oWp->getCookieDomain(),
1676
  false
icwp-wpsf.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Shield Security
4
  * Plugin URI: https://icwp.io/2f
5
  * Description: Powerful, Easy-To-Use #1 Rated WordPress Security System
6
- * Version: 6.10.2
7
  * Text Domain: wp-simple-firewall
8
  * Domain Path: /languages/
9
  * Author: One Dollar Plugin
3
  * Plugin Name: Shield Security
4
  * Plugin URI: https://icwp.io/2f
5
  * Description: Powerful, Easy-To-Use #1 Rated WordPress Security System
6
+ * Version: 6.10.3
7
  * Text Domain: wp-simple-firewall
8
  * Domain Path: /languages/
9
  * Author: One Dollar Plugin
plugin-spec.php CHANGED
@@ -1,6 +1,6 @@
1
  {
2
  "properties": {
3
- "version": "6.10.2",
4
  "release_timestamp": 1540289000,
5
  "slug_parent": "icwp",
6
  "slug_plugin": "wpsf",
1
  {
2
  "properties": {
3
+ "version": "6.10.3",
4
  "release_timestamp": 1540289000,
5
  "slug_parent": "icwp",
6
  "slug_plugin": "wpsf",
readme.txt CHANGED
@@ -8,7 +8,7 @@ Requires at least: 3.5.0
8
  Requires PHP: 5.2.4
9
  Recommended PHP: 5.4
10
  Tested up to: 5.0
11
- Stable tag: 6.10.2
12
 
13
  Complete All-In-One Protection for your WordPress sites, that makes Security Easy for Everyone - it doesn't have to be hard anymore.
14
 
@@ -354,18 +354,24 @@ You will always be able to use Shield Security and its free features in-full.
354
 
355
  [Go Pro for just $1/month](https://icwp.io/aa).
356
 
357
- = 6.10.2 - Current Release =
358
- *Released: 23rd October, 2018* - [Release Notes](https://icwp.io/dg)
 
 
 
 
 
 
 
 
 
 
359
 
360
  * **(v.2)** IMPROVED: Visitor IP address detection
361
  * **(v.2)** IMPROVED: Automatic whitelisting of Manage WP IP addresses
362
  * **(v.2)** IMPROVED: SPAM Comments code enhanced and optimised
363
  * **(v.2)** IMPROVED: IP Whitelisting code enhanced and optimised
364
  * **(v.2)** IMPROVED: Code cleaning and refactoring.
365
-
366
- = 6.10 - Series =
367
- *Released: 15th October, 2018* - [Release Notes](https://icwp.io/dg)
368
-
369
  * **(v.1)** FIXED: Googlebot PHP error notice.
370
  * **(v.0)** NEW: [**PRO**] 2FA Login Backup Codes - all users can create a backup login code in-case their MFA factors are temporarily unavailable.
371
  * **(v.0)** NEW: [**PRO**] White Label - you can now specify custom image for 2FA login screen.
8
  Requires PHP: 5.2.4
9
  Recommended PHP: 5.4
10
  Tested up to: 5.0
11
+ Stable tag: 6.10.3
12
 
13
  Complete All-In-One Protection for your WordPress sites, that makes Security Easy for Everyone - it doesn't have to be hard anymore.
14
 
354
 
355
  [Go Pro for just $1/month](https://icwp.io/aa).
356
 
357
+ = 6.10.3 - Current Release =
358
+ *Released: 5th November, 2018* - [Release Notes](https://icwp.io/dg)
359
+
360
+ * **(v.3)** ADDED: Support for Ultimate Member forms
361
+ * **(v.3)** ADDED: Support for LearnPress login/registration forms
362
+ * **(v.3)** FIXED: Security Admin now correctly honours the WordPress Options zone setting.
363
+ * **(v.3)** IMPROVED: Distinguish which sub-site (sub-domain) for WPMS installations on [Traffic Watcher](https://icwp.io/c1).
364
+ * **(v.3)** IMPROVED: Server's own IP lookup is only attempted once.
365
+ * **(v.3)** ADDED: Experimental feature to help with some custom 3rd party login/registration forms
366
+
367
+ = 6.10 - Series =
368
+ *Released: 15th October, 2018* - [Release Notes](https://icwp.io/dg)
369
 
370
  * **(v.2)** IMPROVED: Visitor IP address detection
371
  * **(v.2)** IMPROVED: Automatic whitelisting of Manage WP IP addresses
372
  * **(v.2)** IMPROVED: SPAM Comments code enhanced and optimised
373
  * **(v.2)** IMPROVED: IP Whitelisting code enhanced and optimised
374
  * **(v.2)** IMPROVED: Code cleaning and refactoring.
 
 
 
 
375
  * **(v.1)** FIXED: Googlebot PHP error notice.
376
  * **(v.0)** NEW: [**PRO**] 2FA Login Backup Codes - all users can create a backup login code in-case their MFA factors are temporarily unavailable.
377
  * **(v.0)** NEW: [**PRO**] White Label - you can now specify custom image for 2FA login screen.
resources/css/global-plugin.css CHANGED
@@ -274,7 +274,7 @@ tr.icwp-plugin-vulnerability dd {
274
  top: 0;
275
  left: 0;
276
  background: rgba(0, 0, 0, 0.2);
277
- z-index: 5000;
278
  }
279
  .icwp-waiting {
280
  width: 200px;
274
  top: 0;
275
  left: 0;
276
  background: rgba(0, 0, 0, 0.2);
277
+ z-index: 10;
278
  }
279
  .icwp-waiting {
280
  width: 200px;
resources/js/global-plugin.js CHANGED
@@ -1,3 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  var iCWP_WPSF_SecurityAdmin = new function () {
2
 
3
  this.initialise = function () {
@@ -294,10 +307,12 @@ if ( typeof icwp_wpsf_vars_plugin !== 'undefined' ) {
294
  this.initialise = function () {
295
  jQuery( document ).ready( function () {
296
 
297
- jQuery( document ).on( "click",
298
- '[data-plugin="' + icwp_wpsf_vars_plugin.file + '"] span.deactivate a',
299
- promptSurvey
300
- );
 
 
301
 
302
  var oShareSettings = {
303
  title: 'Care To Share?',
1
+ var iCWP_WPSF_JSErrorTrack = new function () {
2
+ var bHasError = false;
3
+ this.initialise = function () {
4
+ window.onerror = function ( error ) {
5
+ bHasError = true;
6
+ };
7
+ };
8
+ this.hasError = function () {
9
+ return bHasError;
10
+ };
11
+ }();
12
+ iCWP_WPSF_JSErrorTrack.initialise();
13
+
14
  var iCWP_WPSF_SecurityAdmin = new function () {
15
 
16
  this.initialise = function () {
307
  this.initialise = function () {
308
  jQuery( document ).ready( function () {
309
 
310
+ if ( !iCWP_WPSF_JSErrorTrack.hasError() ) {
311
+ jQuery( document ).on( "click",
312
+ '[data-plugin="' + icwp_wpsf_vars_plugin.file + '"] span.deactivate a',
313
+ promptSurvey
314
+ );
315
+ }
316
 
317
  var oShareSettings = {
318
  title: 'Care To Share?',
resources/js/shield-antibot.js ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ if ( typeof icwp_wpsf_vars_lpantibot !== 'undefined' ) {
2
+ var iCWP_WPSF_LoginGuard_Gasp = new function () {
3
+
4
+ this.initialise = function () {
5
+ jQuery( document ).ready( function () {
6
+ jQuery.each( icwp_wpsf_vars_lpantibot.form_ids,
7
+ function ( _, form_id ) {
8
+ var form = document.getElementById( form_id );
9
+ if ( form !== null ) {
10
+ if ( icwp_wpsf_vars_lpantibot.flags.recap ) {
11
+ insertPlaceHolder_Recap( form );
12
+ }
13
+ if ( icwp_wpsf_vars_lpantibot.flags.gasp ) {
14
+ insertPlaceHolder_Gasp( form );
15
+ }
16
+ }
17
+ }
18
+ );
19
+
20
+ } );
21
+ };
22
+
23
+ var insertPlaceHolder_Recap = function ( form ) {
24
+ var recap_div = document.createElement( 'div' );
25
+ recap_div.classList.add( 'icwpg-recaptcha' );
26
+ jQuery( recap_div ).insertBefore( '#' + form.id + ' :submit' );
27
+ };
28
+
29
+ /**
30
+ */
31
+ var insertPlaceHolder_Gasp = function ( form ) {
32
+ var uniq = icwp_wpsf_vars_lpantibot.uniq;
33
+ var shiep = document.createElement( "p" );
34
+ shiep.id = 'icwp_wpsf_login_p' + uniq;
35
+ shiep.classList.add( 'icwpImHuman_' + uniq );
36
+ shiep.innerHTML = '';
37
+
38
+ var shishoney = document.createElement( "input" );
39
+ shishoney.type = "hidden";
40
+ shishoney.name = "icwp_wpsf_login_email";
41
+
42
+ shiep.appendChild( shishoney );
43
+
44
+ var shieThe_lab = document.createElement( "label" );
45
+ var shieThe_txt = document.createTextNode( ' ' + icwp_wpsf_vars_lpantibot.strings.label );
46
+ var shieThe_cb = document.createElement( "input" );
47
+ shieThe_cb.type = "checkbox";
48
+ shieThe_cb.name = icwp_wpsf_vars_lpantibot.cbname;
49
+ shieThe_cb.id = '_' + shieThe_cb.name;
50
+ shiep.appendChild( shieThe_lab );
51
+ shieThe_lab.appendChild( shieThe_cb );
52
+ shieThe_lab.appendChild( shieThe_txt );
53
+
54
+ jQuery( shiep ).insertBefore( '#' + form.id + ' :submit' );
55
+
56
+ form.onsubmit = function () {
57
+ if ( shieThe_cb.checked !== true ) {
58
+ alert( icwp_wpsf_vars_lpantibot.strings.alert );
59
+ return false;
60
+ }
61
+ return true;
62
+ };
63
+ };
64
+ }();
65
+ iCWP_WPSF_LoginGuard_Gasp.initialise();
66
+ }
src/common/icwp-data.php CHANGED
@@ -15,11 +15,6 @@ class ICWP_WPSF_DataProcessor extends ICWP_WPSF_Foundation {
15
  */
16
  protected static $nRequestTime = null;
17
 
18
- /**
19
- * @var array
20
- */
21
- protected $aRequestUriParts;
22
-
23
  protected function __construct() {
24
  }
25
 
@@ -60,122 +55,6 @@ class ICWP_WPSF_DataProcessor extends ICWP_WPSF_Foundation {
60
  return $aArray1;
61
  }
62
 
63
- /**
64
- * @param string $sKey
65
- * @param string $mDefault
66
- * @param bool $bTrim -automatically trim whitespace
67
- * @return mixed|null
68
- */
69
- public function cookie( $sKey, $mDefault = null, $bTrim = true ) {
70
- $mVal = $this->arrayFetch( $_COOKIE, $sKey, $mDefault );
71
- return ( $bTrim && is_scalar( $mVal ) ) ? trim( $mVal ) : $mVal;
72
- }
73
-
74
- /**
75
- * @param string $sKey
76
- * @param mixed $mDefault
77
- * @return mixed|null
78
- */
79
- public function env( $sKey, $mDefault = null ) {
80
- return $this->arrayFetch( $_ENV, $sKey, $mDefault );
81
- }
82
-
83
- /**
84
- * @param string $sKey
85
- * @param null $mDefault
86
- * @param bool $bTrim -automatically trim whitespace
87
- * @return mixed|null
88
- */
89
- public function post( $sKey, $mDefault = null, $bTrim = true ) {
90
- $mVal = $this->arrayFetch( $_POST, $sKey, $mDefault );
91
- return ( $bTrim && is_scalar( $mVal ) ) ? trim( $mVal ) : $mVal;
92
- }
93
-
94
- /**
95
- * @param string $sKey
96
- * @param null $mDefault
97
- * @param bool $bTrim -automatically trim whitespace
98
- * @return mixed|null
99
- */
100
- public function query( $sKey, $mDefault = null, $bTrim = true ) {
101
- $mVal = $this->arrayFetch( $_GET, $sKey, $mDefault );
102
- return ( $bTrim && is_scalar( $mVal ) ) ? trim( $mVal ) : $mVal;
103
- }
104
-
105
- /**
106
- * @param string $sKey
107
- * @param null $mDefault
108
- * @param bool $bTrim -automatically trim whitespace
109
- * @return mixed|null
110
- */
111
- public function server( $sKey, $mDefault = null, $bTrim = true ) {
112
- $mVal = $this->arrayFetch( $_SERVER, $sKey, $mDefault );
113
- return ( $bTrim && is_scalar( $mVal ) ) ? trim( $mVal ) : $mVal;
114
- }
115
-
116
- /**
117
- * @param string $sKey
118
- * @param null $mDefault
119
- * @param bool $bIncludeCookie
120
- * @param bool $bTrim -automatically trim whitespace
121
- * @return mixed|null
122
- */
123
- public function request( $sKey, $bIncludeCookie = false, $mDefault = null, $bTrim = true ) {
124
- $mVal = $this->post( $sKey, null, $bTrim );
125
- if ( is_null( $mVal ) ) {
126
- $mVal = $this->query( $sKey, null, $bTrim );
127
- if ( is_null( $mVal && $bIncludeCookie ) ) {
128
- $mVal = $this->cookie( $sKey );
129
- }
130
- }
131
- return is_null( $mVal ) ? $mDefault : ( $bTrim && is_scalar( $mVal ) ) ? trim( $mVal ) : $mVal;
132
- }
133
-
134
- /**
135
- * @return string URI Path in lowercase
136
- */
137
- public function getRequestPath() {
138
- $aRequestParts = $this->getRequestUriParts();
139
- return $aRequestParts[ 'path' ];
140
- }
141
-
142
- /**
143
- * @return string
144
- */
145
- public function getRequestUri() {
146
- return $this->server( 'REQUEST_URI' );
147
- }
148
-
149
- /**
150
- * @return string
151
- */
152
- public function getUserAgent() {
153
- return $this->server( 'HTTP_USER_AGENT' );
154
- }
155
-
156
- /**
157
- * @param bool $bIncludeCookie
158
- * @return array
159
- */
160
- public function getRequestParams( $bIncludeCookie = true ) {
161
- $aParams = array_merge( $_GET, $_POST );
162
- return $bIncludeCookie ? array_merge( $aParams, $_COOKIE ) : $aParams;
163
- }
164
-
165
- /**
166
- * @return array
167
- */
168
- public function getRequestUriParts() {
169
- if ( !isset( $this->aRequestUriParts ) ) {
170
- $aExploded = explode( '?', $this->getRequestUri(), 2 );
171
- $this->aRequestUriParts = array(
172
- 'path' => empty( $aExploded[ 0 ] ) ? '' : $aExploded[ 0 ],
173
- 'query' => empty( $aExploded[ 1 ] ) ? '' : $aExploded[ 1 ],
174
- );
175
- }
176
- return $this->aRequestUriParts;
177
- }
178
-
179
  /**
180
  * @param string $sPath
181
  * @param string $sExtensionToAdd
@@ -322,38 +201,6 @@ class ICWP_WPSF_DataProcessor extends ICWP_WPSF_Foundation {
322
  return $aNewList;
323
  }
324
 
325
- /**
326
- * @return string
327
- */
328
- public function getRequestMethod() {
329
- $sRequestMethod = $this->server( 'REQUEST_METHOD' );
330
- return ( empty( $sRequestMethod ) ? 'get' : strtolower( $sRequestMethod ) );
331
- }
332
-
333
- /**
334
- * @return bool
335
- */
336
- public function isMethodPost() {
337
- return ( $this->getRequestMethod() == 'post' );
338
- }
339
-
340
- /**
341
- * TODO: scrap?
342
- * Taken from http://www.phacks.net/detecting-search-engine-bot-and-web-spiders/
343
- */
344
- public function isSearchEngineBot() {
345
-
346
- $sUserAgent = $this->server( 'HTTP_USER_AGENT' );
347
- if ( empty( $sUserAgent ) ) {
348
- return false;
349
- }
350
-
351
- $sBots = 'Googlebot|bingbot|Twitterbot|Baiduspider|ia_archiver|R6_FeedFetcher|NetcraftSurveyAgent'
352
- .'|Sogou web spider|Yahoo! Slurp|facebookexternalhit|PrintfulBot|msnbot|UnwindFetchor|urlresolver|Butterfly|TweetmemeBot';
353
-
354
- return ( preg_match( "/$sBots/", $sUserAgent ) > 0 );
355
- }
356
-
357
  /**
358
  * Strength can be 1, 3, 7, 15
359
  * @param integer $nLength
@@ -396,14 +243,6 @@ class ICWP_WPSF_DataProcessor extends ICWP_WPSF_Foundation {
396
  return $sAtoZ[ wp_rand( 0, ( strlen( $sAtoZ ) - 1 ) ) ];
397
  }
398
 
399
- /**
400
- * @return string|null
401
- */
402
- public function getScriptName() {
403
- $sScriptName = $this->server( 'SCRIPT_NAME' );
404
- return !empty( $sScriptName ) ? $sScriptName : $this->server( 'PHP_SELF' );
405
- }
406
-
407
  /**
408
  * @param array $aA
409
  * @param string $sKey
@@ -414,33 +253,6 @@ class ICWP_WPSF_DataProcessor extends ICWP_WPSF_Foundation {
414
  return isset( $aA[ $sKey ] ) ? $aA[ $sKey ] : $mDefault;
415
  }
416
 
417
- /**
418
- * @param string $sRequestedUriPath
419
- * @param string $sHostName - you can also send a full and valid URL
420
- */
421
- public function doSendApache404( $sRequestedUriPath = '', $sHostName = '' ) {
422
- if ( empty( $sRequestedUriPath ) ) {
423
- $sRequestedUriPath = $this->server( 'REQUEST_URI' );
424
- }
425
-
426
- if ( empty( $sHostName ) ) {
427
- $sHostName = $this->server( 'SERVER_NAME' );
428
- }
429
- else if ( filter_var( $sHostName, FILTER_VALIDATE_URL ) ) {
430
- $sHostName = parse_url( $sRequestedUriPath, PHP_URL_HOST );
431
- }
432
-
433
- $bSsl = is_ssl() || $this->server( 'HTTP_X_FORWARDED_PROTO' ) == 'https';
434
- header( 'HTTP/1.1 404 Not Found' );
435
- $sDie = sprintf(
436
- '<html><head><title>404 Not Found</title><style type="text/css"></style></head><body><h1>Not Found</h1><p>The requested URL %s was not found on this server.</p><p>Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.</p><hr><address>Apache Server at %s Port %s</address></body></html>',
437
- $sRequestedUriPath,
438
- $sHostName,
439
- $bSsl ? 443 : $this->server( 'SERVER_PORT' )
440
- );
441
- die( $sDie );
442
- }
443
-
444
  /**
445
  * @param string $sStringContent
446
  * @param string $sFilename
@@ -468,41 +280,6 @@ class ICWP_WPSF_DataProcessor extends ICWP_WPSF_Foundation {
468
  return ob_get_clean();
469
  }
470
 
471
- /**
472
- * @param $sKey
473
- * @param $mValue
474
- * @param int $nExpireLength
475
- * @param null $sPath
476
- * @param null $sDomain
477
- * @param bool $bSsl
478
- * @return bool
479
- */
480
- public function setCookie( $sKey, $mValue, $nExpireLength = 3600, $sPath = null, $sDomain = null, $bSsl = true ) {
481
- $_COOKIE[ $sKey ] = $mValue;
482
- if ( function_exists( 'headers_sent' ) && headers_sent() ) {
483
- return false;
484
- }
485
- return setcookie(
486
- $sKey,
487
- $mValue,
488
- (int)( $this->time() + $nExpireLength ),
489
- ( is_null( $sPath ) && defined( 'COOKIEPATH' ) ) ? COOKIEPATH : $sPath,
490
- ( is_null( $sDomain ) && defined( 'COOKIE_DOMAIN' ) ) ? COOKIE_DOMAIN : $sDomain,
491
- $bSsl && is_ssl()
492
- );
493
- }
494
-
495
- /**
496
- * @param string $sKey
497
- * @return bool
498
- */
499
- public function setDeleteCookie( $sKey ) {
500
- if ( isset( $_COOKIE[ $sKey ] ) ) {
501
- unset( $_COOKIE[ $sKey ] );
502
- }
503
- return $this->setCookie( $sKey, '', -3600 );
504
- }
505
-
506
  /**
507
  * @return string
508
  */
@@ -644,12 +421,181 @@ class ICWP_WPSF_DataProcessor extends ICWP_WPSF_Foundation {
644
  }
645
 
646
  /**
 
647
  * @return int
648
  */
649
  public function time() {
650
- if ( !isset( self::$nRequestTime ) ) {
651
- self::$nRequestTime = time();
652
- }
653
- return self::$nRequestTime;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
654
  }
655
  }
15
  */
16
  protected static $nRequestTime = null;
17
 
 
 
 
 
 
18
  protected function __construct() {
19
  }
20
 
55
  return $aArray1;
56
  }
57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  /**
59
  * @param string $sPath
60
  * @param string $sExtensionToAdd
201
  return $aNewList;
202
  }
203
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
204
  /**
205
  * Strength can be 1, 3, 7, 15
206
  * @param integer $nLength
243
  return $sAtoZ[ wp_rand( 0, ( strlen( $sAtoZ ) - 1 ) ) ];
244
  }
245
 
 
 
 
 
 
 
 
 
246
  /**
247
  * @param array $aA
248
  * @param string $sKey
253
  return isset( $aA[ $sKey ] ) ? $aA[ $sKey ] : $mDefault;
254
  }
255
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
256
  /**
257
  * @param string $sStringContent
258
  * @param string $sFilename
280
  return ob_get_clean();
281
  }
282
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
283
  /**
284
  * @return string
285
  */
421
  }
422
 
423
  /**
424
+ * @deprecated
425
  * @return int
426
  */
427
  public function time() {
428
+ return $this->loadRequest()->ts();
429
+ }
430
+
431
+ /**
432
+ * @deprecated
433
+ * @param string $sKey
434
+ * @param string $mDefault
435
+ * @param bool $bTrim -automatically trim whitespace
436
+ * @return mixed|null
437
+ */
438
+ public function cookie( $sKey, $mDefault = null, $bTrim = true ) {
439
+ return $this->loadRequest()->cookie( $sKey, $mDefault, $bTrim );
440
+ }
441
+
442
+ /**
443
+ * @deprecated
444
+ * @param string $sKey
445
+ * @param mixed $mDefault
446
+ * @return mixed|null
447
+ */
448
+ public function env( $sKey, $mDefault = null ) {
449
+ return $this->loadRequest()->env( $sKey, $mDefault );
450
+ }
451
+
452
+ /**
453
+ * @deprecated
454
+ * @param string $sKey
455
+ * @param null $mDefault
456
+ * @param bool $bTrim -automatically trim whitespace
457
+ * @return mixed|null
458
+ */
459
+ public function post( $sKey, $mDefault = null, $bTrim = true ) {
460
+ return $this->loadRequest()->post( $sKey, $mDefault, $bTrim );
461
+ }
462
+
463
+ /**
464
+ * @deprecated
465
+ * @param string $sKey
466
+ * @param null $mDefault
467
+ * @param bool $bTrim -automatically trim whitespace
468
+ * @return mixed|null
469
+ */
470
+ public function query( $sKey, $mDefault = null, $bTrim = true ) {
471
+ return $this->loadRequest()->query( $sKey, $mDefault, $bTrim );
472
+ }
473
+
474
+ /**
475
+ * @deprecated
476
+ * @param string $sKey
477
+ * @param null $mDefault
478
+ * @param bool $bTrim -automatically trim whitespace
479
+ * @return mixed|null
480
+ */
481
+ public function server( $sKey, $mDefault = null, $bTrim = true ) {
482
+ return $this->loadRequest()->server( $sKey, $mDefault, $bTrim );
483
+ }
484
+
485
+ /**
486
+ * @deprecated
487
+ * @param string $sKey
488
+ * @param null $mDefault
489
+ * @param bool $bIncludeCookie
490
+ * @param bool $bTrim -automatically trim whitespace
491
+ * @return mixed|null
492
+ */
493
+ public function request( $sKey, $bIncludeCookie = false, $mDefault = null, $bTrim = true ) {
494
+ return $this->loadRequest()->request( $sKey, $bIncludeCookie, $mDefault, $bTrim );
495
+ }
496
+
497
+ /**
498
+ * @deprecated
499
+ * @return string URI Path in lowercase
500
+ */
501
+ public function getRequestPath() {
502
+ return $this->loadRequest()->getPath();
503
+ }
504
+
505
+ /**
506
+ * @deprecated
507
+ * @return string
508
+ */
509
+ public function getRequestUri() {
510
+ return $this->loadRequest()->getUri();
511
+ }
512
+
513
+ /**
514
+ * @deprecated
515
+ * @return string
516
+ */
517
+ public function getUserAgent() {
518
+ return $this->loadRequest()->getUserAgent();
519
+ }
520
+
521
+ /**
522
+ * @deprecated
523
+ * @param bool $bIncludeCookie
524
+ * @return array
525
+ */
526
+ public function getRequestParams( $bIncludeCookie = true ) {
527
+ return $this->loadRequest()->getParams( $bIncludeCookie );
528
+ }
529
+
530
+ /**
531
+ * @deprecated
532
+ * @return array
533
+ */
534
+ public function getRequestUriParts() {
535
+ return $this->loadRequest()->getUriParts();
536
+ }
537
+
538
+ /**
539
+ * @deprecated
540
+ * @return string
541
+ */
542
+ public function getRequestMethod() {
543
+ return $this->loadRequest()->getMethod();
544
+ }
545
+
546
+ /**
547
+ * @deprecated
548
+ * @return bool
549
+ */
550
+ public function isMethodPost() {
551
+ return $this->loadRequest()->isMethodPost();
552
+ }
553
+
554
+ /**
555
+ * @deprecated
556
+ * @return string|null
557
+ */
558
+ public function getScriptName() {
559
+ return $this->loadRequest()->getScriptName();
560
+ }
561
+
562
+ /**
563
+ * @deprecated
564
+ * @param string $sRequestedUriPath
565
+ * @param string $sHostName - you can also send a full and valid URL
566
+ */
567
+ public function doSendApache404( $sRequestedUriPath = '', $sHostName = '' ) {
568
+ return $this->loadRequest()->sendResponseApache404( $sRequestedUriPath, $sHostName );
569
+ }
570
+
571
+ /**
572
+ * @deprecated
573
+ * Taken from http://www.phacks.net/detecting-search-engine-bot-and-web-spiders/
574
+ */
575
+ public function isSearchEngineBot() {
576
+ return $this->loadRequest()->isSearchEngineBot();
577
+ }
578
+
579
+ /**
580
+ * @deprecated
581
+ * @param $sKey
582
+ * @param $mValue
583
+ * @param int $nExpireLength
584
+ * @param null $sPath
585
+ * @param null $sDomain
586
+ * @param bool $bSsl
587
+ * @return bool
588
+ */
589
+ public function setCookie( $sKey, $mValue, $nExpireLength = 3600, $sPath = null, $sDomain = null, $bSsl = true ) {
590
+ return $this->loadRequest()->setCookie( $sKey, $mValue, $nExpireLength, $sPath, $sDomain, $bSsl );
591
+ }
592
+
593
+ /**
594
+ * @deprecated
595
+ * @param string $sKey
596
+ * @return bool
597
+ */
598
+ public function setDeleteCookie( $sKey ) {
599
+ return $this->loadRequest()->setDeleteCookie( $sKey );
600
  }
601
  }
src/common/icwp-edd.php CHANGED
@@ -129,7 +129,7 @@ class ICWP_WPSF_Edd extends ICWP_WPSF_Foundation {
129
  ->getUrl( $sStoreUrl, $aLicenseLookupParams );
130
  $oDec = !empty( $aContent ) ? @json_decode( $aContent[ 'body' ] ) : new stdClass();
131
  return $this->getLicenseVoFromData( $oDec )
132
- ->setLastRequestAt( $this->loadDP()->time() );
133
  }
134
 
135
  /**
129
  ->getUrl( $sStoreUrl, $aLicenseLookupParams );
130
  $oDec = !empty( $aContent ) ? @json_decode( $aContent[ 'body' ] ) : new stdClass();
131
  return $this->getLicenseVoFromData( $oDec )
132
+ ->setLastRequestAt( $this->loadRequest()->ts() );
133
  }
134
 
135
  /**
src/common/icwp-foundation.php CHANGED
@@ -135,6 +135,18 @@ class ICWP_WPSF_Foundation {
135
  return self::getService( $sKey );
136
  }
137
 
 
 
 
 
 
 
 
 
 
 
 
 
138
  /**
139
  * @return ICWP_WPSF_ServiceProviders
140
  */
135
  return self::getService( $sKey );
136
  }
137
 
138
+ /**
139
+ * @return ICWP_WPSF_Request
140
+ */
141
+ public function loadRequest() {
142
+ $sKey = 'icwp-request';
143
+ if ( !self::isServiceReady( $sKey ) ) {
144
+ self::requireCommonLib( $sKey.'.php' );
145
+ self::setService( $sKey, ICWP_WPSF_Request::GetInstance() );
146
+ }
147
+ return self::getService( $sKey );
148
+ }
149
+
150
  /**
151
  * @return ICWP_WPSF_ServiceProviders
152
  */
src/common/icwp-ip.php CHANGED
@@ -174,7 +174,8 @@ class ICWP_WPSF_Ip extends ICWP_WPSF_Foundation {
174
  * @return boolean
175
  */
176
  public function isValidIp( $sIp, $flags = null ) {
177
- return filter_var( $sIp, FILTER_VALIDATE_IP, $flags );
 
178
  }
179
 
180
  /**
@@ -247,17 +248,12 @@ class ICWP_WPSF_Ip extends ICWP_WPSF_Foundation {
247
  }
248
 
249
  /**
250
- * @return string|null
251
  */
252
  public function whatIsMyIp() {
253
-
254
- if ( empty( $this->sMyIp ) ) {
255
- $sIp = $this->loadFS()
256
- ->getUrlContent( self::IpifyEndpoint );
257
- if ( is_string( $sIp ) ) {
258
- $sIp = trim( $sIp );
259
- }
260
- $this->sMyIp = $this->isValidIp_PublicRemote( $sIp ) ? $sIp : null;
261
  }
262
  return $this->sMyIp;
263
  }
@@ -267,12 +263,12 @@ class ICWP_WPSF_Ip extends ICWP_WPSF_Foundation {
267
  * @return string
268
  */
269
  public function determineSourceFromIp( $sVisitorIp ) {
270
- $oDp = $this->loadDP();
271
 
272
  $sBestSource = null;
273
  foreach ( $this->getIpSourceOptions() as $sSource ) {
274
 
275
- $sIpToTest = $oDp->server( $sSource );
276
  if ( empty( $sIpToTest ) ) {
277
  continue;
278
  }
@@ -309,10 +305,10 @@ class ICWP_WPSF_Ip extends ICWP_WPSF_Foundation {
309
 
310
  $sIpToReturn = false;
311
  $sSource = false;
312
- $oDp = $this->loadDP();
313
  foreach ( $this->getIpSourceOptions() as $sMaybeSource ) {
314
 
315
- $sIpToTest = $oDp->server( $sMaybeSource );
316
  if ( empty( $sIpToTest ) ) {
317
  continue;
318
  }
@@ -347,6 +343,7 @@ class ICWP_WPSF_Ip extends ICWP_WPSF_Foundation {
347
  'HTTP_X_REAL_IP',
348
  'HTTP_X_SUCURI_CLIENTIP',
349
  'HTTP_INCAP_CLIENT_IP',
 
350
  'HTTP_FORWARDED',
351
  'HTTP_CLIENT_IP'
352
  );
174
  * @return boolean
175
  */
176
  public function isValidIp( $sIp, $flags = null ) {
177
+ /*preg_replace( '#[^a-f0-9:.]#i', '', $sIp )*/
178
+ return filter_var( trim( $sIp ), FILTER_VALIDATE_IP, $flags );
179
  }
180
 
181
  /**
248
  }
249
 
250
  /**
251
+ * @return string|false
252
  */
253
  public function whatIsMyIp() {
254
+ if ( is_null( $this->sMyIp ) ) {
255
+ $sIp = $this->loadFS()->getUrlContent( self::IpifyEndpoint );
256
+ $this->sMyIp = $this->isValidIp_PublicRemote( $sIp ) ? $sIp : false;
 
 
 
 
 
257
  }
258
  return $this->sMyIp;
259
  }
263
  * @return string
264
  */
265
  public function determineSourceFromIp( $sVisitorIp ) {
266
+ $oReq = $this->loadRequest();
267
 
268
  $sBestSource = null;
269
  foreach ( $this->getIpSourceOptions() as $sSource ) {
270
 
271
+ $sIpToTest = $oReq->server( $sSource );
272
  if ( empty( $sIpToTest ) ) {
273
  continue;
274
  }
305
 
306
  $sIpToReturn = false;
307
  $sSource = false;
308
+ $oReq = $this->loadRequest();
309
  foreach ( $this->getIpSourceOptions() as $sMaybeSource ) {
310
 
311
+ $sIpToTest = $oReq->server( $sMaybeSource );
312
  if ( empty( $sIpToTest ) ) {
313
  continue;
314
  }
343
  'HTTP_X_REAL_IP',
344
  'HTTP_X_SUCURI_CLIENTIP',
345
  'HTTP_INCAP_CLIENT_IP',
346
+ 'HTTP_X_SP_FORWARDED_IP',
347
  'HTTP_FORWARDED',
348
  'HTTP_CLIENT_IP'
349
  );
src/common/icwp-request.php ADDED
@@ -0,0 +1,313 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( class_exists( 'ICWP_WPSF_Request', false ) ) {
3
+ return;
4
+ }
5
+
6
+ class ICWP_WPSF_Request extends ICWP_WPSF_Foundation {
7
+
8
+ /**
9
+ * @var ICWP_WPSF_Request
10
+ */
11
+ protected static $oInstance = null;
12
+
13
+ /**
14
+ * @var int
15
+ */
16
+ protected static $nTime = null;
17
+
18
+ /**
19
+ * @var float
20
+ */
21
+ protected static $nMicroTime = null;
22
+
23
+ /**
24
+ * @var array
25
+ */
26
+ protected $aRequestUriParts;
27
+
28
+ protected function __construct() {
29
+ }
30
+
31
+ /**
32
+ * @return ICWP_WPSF_Request
33
+ */
34
+ public static function GetInstance() {
35
+ if ( is_null( self::$oInstance ) ) {
36
+ self::$oInstance = new self();
37
+ }
38
+ return self::$oInstance;
39
+ }
40
+
41
+ /**
42
+ * @param string $sKey
43
+ * @param string $mDefault
44
+ * @param bool $bTrim -automatically trim whitespace
45
+ * @return mixed|null
46
+ */
47
+ public function cookie( $sKey, $mDefault = null, $bTrim = true ) {
48
+ $mVal = $this->loadDP()->arrayFetch( $_COOKIE, $sKey, $mDefault );
49
+ return ( $bTrim && is_scalar( $mVal ) ) ? trim( $mVal ) : $mVal;
50
+ }
51
+
52
+ /**
53
+ * @param string $sKey
54
+ * @param mixed $mDefault
55
+ * @return mixed|null
56
+ */
57
+ public function env( $sKey, $mDefault = null ) {
58
+ return $this->loadDP()->arrayFetch( $_ENV, $sKey, $mDefault );
59
+ }
60
+
61
+ /**
62
+ * @param string $sKey
63
+ * @param null $mDefault
64
+ * @param bool $bTrim -automatically trim whitespace
65
+ * @return mixed|null
66
+ */
67
+ public function post( $sKey, $mDefault = null, $bTrim = true ) {
68
+ $mVal = $this->loadDP()->arrayFetch( $_POST, $sKey, $mDefault );
69
+ return ( $bTrim && is_scalar( $mVal ) ) ? trim( $mVal ) : $mVal;
70
+ }
71
+
72
+ /**
73
+ * @param string $sKey
74
+ * @param null $mDefault
75
+ * @param bool $bTrim -automatically trim whitespace
76
+ * @return mixed|null
77
+ */
78
+ public function query( $sKey, $mDefault = null, $bTrim = true ) {
79
+ $mVal = $this->loadDP()->arrayFetch( $_GET, $sKey, $mDefault );
80
+ return ( $bTrim && is_scalar( $mVal ) ) ? trim( $mVal ) : $mVal;
81
+ }
82
+
83
+ /**
84
+ * @param string $sKey
85
+ * @param null $mDefault
86
+ * @param bool $bTrim -automatically trim whitespace
87
+ * @return mixed|null
88
+ */
89
+ public function server( $sKey, $mDefault = null, $bTrim = true ) {
90
+ $mVal = $this->loadDP()->arrayFetch( $_SERVER, $sKey, $mDefault );
91
+ return ( $bTrim && is_scalar( $mVal ) ) ? trim( $mVal ) : $mVal;
92
+ }
93
+
94
+ /**
95
+ * @param string $sKey
96
+ * @param null $mDefault
97
+ * @param bool $bIncludeCookie
98
+ * @param bool $bTrim -automatically trim whitespace
99
+ * @return mixed|null
100
+ */
101
+ public function request( $sKey, $bIncludeCookie = false, $mDefault = null, $bTrim = true ) {
102
+ $mVal = $this->post( $sKey, null, $bTrim );
103
+ if ( is_null( $mVal ) ) {
104
+ $mVal = $this->query( $sKey, null, $bTrim );
105
+ if ( is_null( $mVal && $bIncludeCookie ) ) {
106
+ $mVal = $this->cookie( $sKey );
107
+ }
108
+ }
109
+ return is_null( $mVal ) ? $mDefault : ( $bTrim && is_scalar( $mVal ) ) ? trim( $mVal ) : $mVal;
110
+ }
111
+
112
+ /**
113
+ * @return string
114
+ */
115
+ public function getHost() {
116
+ return $this->server( 'HTTP_HOST' );
117
+ }
118
+
119
+ /**
120
+ * @return string
121
+ */
122
+ public function getMethod() {
123
+ $sRequestMethod = $this->server( 'REQUEST_METHOD' );
124
+ return ( empty( $sRequestMethod ) ? 'get' : strtolower( $sRequestMethod ) );
125
+ }
126
+
127
+ /**
128
+ * @param bool $bIncludeCookie
129
+ * @return array
130
+ */
131
+ public function getParams( $bIncludeCookie = true ) {
132
+ $aParams = array_merge( $_GET, $_POST );
133
+ return $bIncludeCookie ? array_merge( $aParams, $_COOKIE ) : $aParams;
134
+ }
135
+
136
+ /**
137
+ * @return string URI Path in lowercase
138
+ */
139
+ public function getPath() {
140
+ $aRequestParts = $this->getUriParts();
141
+ return $aRequestParts[ 'path' ];
142
+ }
143
+
144
+ /**
145
+ * @return string
146
+ */
147
+ public function getUri() {
148
+ return $this->server( 'REQUEST_URI' );
149
+ }
150
+
151
+ /**
152
+ * @return array
153
+ */
154
+ public function getUriParts() {
155
+ if ( !isset( $this->aRequestUriParts ) ) {
156
+ $aExploded = explode( '?', $this->getUri(), 2 );
157
+ $this->aRequestUriParts = array(
158
+ 'path' => empty( $aExploded[ 0 ] ) ? '' : $aExploded[ 0 ],
159
+ 'query' => empty( $aExploded[ 1 ] ) ? '' : $aExploded[ 1 ],
160
+ );
161
+ }
162
+ return $this->aRequestUriParts;
163
+ }
164
+
165
+ /**
166
+ * @return string
167
+ */
168
+ public function getUserAgent() {
169
+ return $this->server( 'HTTP_USER_AGENT' );
170
+ }
171
+
172
+ /**
173
+ * @return string|null
174
+ */
175
+ public function getScriptName() {
176
+ $sScriptName = $this->server( 'SCRIPT_NAME' );
177
+ return !empty( $sScriptName ) ? $sScriptName : $this->server( 'PHP_SELF' );
178
+ }
179
+
180
+ /**
181
+ * @return bool
182
+ */
183
+ public function isMethodPost() {
184
+ return ( $this->getMethod() == 'post' );
185
+ }
186
+
187
+ /**
188
+ * TODO: scrap?
189
+ * Taken from http://www.phacks.net/detecting-search-engine-bot-and-web-spiders/
190
+ */
191
+ public function isSearchEngineBot() {
192
+
193
+ $sUserAgent = $this->server( 'HTTP_USER_AGENT' );
194
+ if ( empty( $sUserAgent ) ) {
195
+ return false;
196
+ }
197
+
198
+ $sBots = 'Googlebot|bingbot|Twitterbot|Baiduspider|ia_archiver|R6_FeedFetcher|NetcraftSurveyAgent'
199
+ .'|Sogou web spider|Yahoo! Slurp|facebookexternalhit|PrintfulBot|msnbot|UnwindFetchor|urlresolver|Butterfly|TweetmemeBot';
200
+
201
+ return ( preg_match( "/$sBots/", $sUserAgent ) > 0 );
202
+ }
203
+
204
+ /**
205
+ * @param string $sRequestedUriPath
206
+ * @param string $sHostName - you can also send a full and valid URL
207
+ */
208
+ public function sendResponseApache404( $sRequestedUriPath = '', $sHostName = '' ) {
209
+ if ( empty( $sRequestedUriPath ) ) {
210
+ $sRequestedUriPath = $this->server( 'REQUEST_URI' );
211
+ }
212
+
213
+ if ( empty( $sHostName ) ) {
214
+ $sHostName = $this->server( 'SERVER_NAME' );
215
+ }
216
+ else if ( filter_var( $sHostName, FILTER_VALIDATE_URL ) ) {
217
+ $sHostName = parse_url( $sRequestedUriPath, PHP_URL_HOST );
218
+ }
219
+
220
+ $bSsl = is_ssl() || $this->server( 'HTTP_X_FORWARDED_PROTO' ) == 'https';
221
+ header( 'HTTP/1.1 404 Not Found' );
222
+ $sDie = sprintf(
223
+ '<html><head><title>404 Not Found</title><style type="text/css"></style></head><body><h1>Not Found</h1><p>The requested URL %s was not found on this server.</p><p>Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.</p><hr><address>Apache Server at %s Port %s</address></body></html>',
224
+ $sRequestedUriPath,
225
+ $sHostName,
226
+ $bSsl ? 443 : $this->server( 'SERVER_PORT' )
227
+ );
228
+ die( $sDie );
229
+ }
230
+
231
+ /**
232
+ * @param string $sStringContent
233
+ * @param string $sFilename
234
+ */
235
+ public function downloadStringAsFile( $sStringContent, $sFilename ) {
236
+ header( "Content-type: application/octet-stream" );
237
+ header( "Content-disposition: attachment; filename=".$sFilename );
238
+ header( "Content-Transfer-Encoding: binary" );
239
+ header( "Content-Length: ".strlen( $sStringContent ) );
240
+ echo $sStringContent;
241
+ die();
242
+ }
243
+
244
+ /**
245
+ * @param $sKey
246
+ * @param $mValue
247
+ * @param int $nExpireLength
248
+ * @param null $sPath
249
+ * @param null $sDomain
250
+ * @param bool $bSsl
251
+ * @return bool
252
+ */
253
+ public function setCookie( $sKey, $mValue, $nExpireLength = 3600, $sPath = null, $sDomain = null, $bSsl = true ) {
254
+ $_COOKIE[ $sKey ] = $mValue;
255
+ if ( function_exists( 'headers_sent' ) && headers_sent() ) {
256
+ return false;
257
+ }
258
+ return setcookie(
259
+ $sKey,
260
+ $mValue,
261
+ (int)( $this->ts() + $nExpireLength ),
262
+ ( is_null( $sPath ) && defined( 'COOKIEPATH' ) ) ? COOKIEPATH : $sPath,
263
+ ( is_null( $sDomain ) && defined( 'COOKIE_DOMAIN' ) ) ? COOKIE_DOMAIN : $sDomain,
264
+ $bSsl && is_ssl()
265
+ );
266
+ }
267
+
268
+ /**
269
+ * @param string $sKey
270
+ * @return bool
271
+ */
272
+ public function setDeleteCookie( $sKey ) {
273
+ if ( isset( $_COOKIE[ $sKey ] ) ) {
274
+ unset( $_COOKIE[ $sKey ] );
275
+ }
276
+ return $this->setCookie( $sKey, '', -3600 );
277
+ }
278
+
279
+ /**
280
+ * @return int
281
+ */
282
+ public function ts() {
283
+ if ( !isset( self::$nTime ) ) {
284
+ self::$nTime = time();
285
+ self::$nMicroTime = function_exists( 'microtime' ) ? @microtime( true ) : false;
286
+ }
287
+ return self::$nTime;
288
+ }
289
+
290
+ /**
291
+ * @param bool $bMillisecondOnly
292
+ * @return int
293
+ */
294
+ public function mts( $bMillisecondOnly = false ) {
295
+ $nT = $this->ts();
296
+ if ( empty( self::$nMicroTime ) ) {
297
+ $nT = $bMillisecondOnly ? 0 : $nT;
298
+ }
299
+ else {
300
+ $nT = $bMillisecondOnly ? preg_replace( '#^[0-9]+\.#', '', self::$nMicroTime ) : self::$nMicroTime;
301
+ }
302
+ return $nT;
303
+ }
304
+
305
+ /**
306
+ * alias
307
+ * @deprecated
308
+ * @return int
309
+ */
310
+ public function time() {
311
+ return $this->ts();
312
+ }
313
+ }
src/common/icwp-wpfunctions-plugins.php CHANGED
@@ -253,17 +253,16 @@ class ICWP_WPSF_WpFunctions_Plugins extends ICWP_WPSF_Foundation {
253
  * @return null|string
254
  */
255
  public function findPluginBy( $sValueToCompare, $sKey = 'Name' ) {
256
- $sFilename = null;
257
 
258
- if ( !empty( $sValueToCompare ) ) {
259
- foreach ( $this->getPlugins() as $sBaseFileName => $aPluginData ) {
260
- if ( isset( $aPluginData[ $sKey ] ) && $sValueToCompare == $aPluginData[ $sKey ] ) {
261
- $sFilename = $sBaseFileName;
262
- }
263
  }
264
  }
265
 
266
- return $sFilename;
267
  }
268
 
269
  /**
@@ -274,59 +273,14 @@ class ICWP_WPSF_WpFunctions_Plugins extends ICWP_WPSF_Foundation {
274
  return dirname( path_join( WP_PLUGIN_DIR, $sFile ) );
275
  }
276
 
277
- /**
278
- * @param string $sPluginFile
279
- * @return string
280
- */
281
- public function getLinkPluginActivate( $sPluginFile ) {
282
- $sUrl = self_admin_url( 'plugins.php' );
283
- $aQueryArgs = array(
284
- 'action' => 'activate',
285
- 'plugin' => urlencode( $sPluginFile ),
286
- '_wpnonce' => wp_create_nonce( 'activate-plugin_'.$sPluginFile )
287
- );
288
- return add_query_arg( $aQueryArgs, $sUrl );
289
- }
290
-
291
- /**
292
- * @param string $sPluginFile
293
- * @return string
294
- */
295
- public function getUrl_Deactivate( $sPluginFile ) {
296
- return add_query_arg(
297
- array(
298
- 'action' => 'deactivate',
299
- 'plugin' => urlencode( $sPluginFile ),
300
- '_wpnonce' => wp_create_nonce( 'deactivate-plugin_'.$sPluginFile )
301
- ),
302
- self_admin_url( 'plugins.php' )
303
- );
304
- }
305
-
306
- /**
307
- * @param string $sPluginFile
308
- * @return string
309
- */
310
- public function getLinkPluginUpgrade( $sPluginFile ) {
311
- $sUrl = self_admin_url( 'update.php' );
312
- $aQueryArgs = array(
313
- 'action' => 'upgrade-plugin',
314
- 'plugin' => urlencode( $sPluginFile ),
315
- '_wpnonce' => wp_create_nonce( 'upgrade-plugin_'.$sPluginFile )
316
- );
317
- return add_query_arg( $aQueryArgs, $sUrl );
318
- }
319
-
320
  /**
321
  * @param string $sPluginFile
322
  * @return array|null
323
  */
324
  public function getPlugin( $sPluginFile ) {
325
  $aPlugin = null;
326
-
327
- $aPlugins = $this->getPlugins();
328
- if ( !empty( $sPluginFile ) && !empty( $aPlugins )
329
- && is_array( $aPlugins ) && array_key_exists( $sPluginFile, $aPlugins ) ) {
330
  $aPlugin = $aPlugins[ $sPluginFile ];
331
  }
332
  return $aPlugin;
@@ -339,7 +293,7 @@ class ICWP_WPSF_WpFunctions_Plugins extends ICWP_WPSF_Foundation {
339
  public function getFileFromDirName( $sDirName ) {
340
  $sFile = null;
341
  if ( !empty( $sDirName ) ) {
342
- foreach ( $this->getInstalledPluginFiles() as $sF ) {
343
  if ( strpos( $sFile, $sDirName.'/' ) === 0 ) {
344
  $sFile = $sF;
345
  break;
@@ -372,14 +326,14 @@ class ICWP_WPSF_WpFunctions_Plugins extends ICWP_WPSF_Foundation {
372
  */
373
  public function getActivePlugins() {
374
  $oWp = $this->loadWp();
375
- $sOptionKey = $oWp->isMultisite() ? 'active_sitewide_plugins' : 'active_plugins';
376
- return $oWp->getOption( $sOptionKey );
377
  }
378
 
379
  /**
380
  * @return array
381
  */
382
- public function getInstalledPluginFiles() {
383
  return array_keys( $this->getPlugins() );
384
  }
385
 
@@ -390,7 +344,8 @@ class ICWP_WPSF_WpFunctions_Plugins extends ICWP_WPSF_Foundation {
390
  if ( !function_exists( 'get_plugins' ) ) {
391
  require_once( ABSPATH.'wp-admin/includes/plugin.php' );
392
  }
393
- return function_exists( 'get_plugins' ) ? get_plugins() : array();
 
394
  }
395
 
396
  /**
@@ -437,15 +392,6 @@ class ICWP_WPSF_WpFunctions_Plugins extends ICWP_WPSF_Foundation {
437
  return isset( $oPluginInfo->slug ) ? $oPluginInfo->slug : '';
438
  }
439
 
440
- /**
441
- * @param string $sBaseName
442
- * @return bool
443
- */
444
- public function isWpOrg( $sBaseName ) {
445
- $oPluginInfo = $this->getExtendedData( $sBaseName );
446
- return isset( $oPluginInfo->id ) ? strpos( $oPluginInfo->id, 'w.org/' ) === 0 : false;
447
- }
448
-
449
  /**
450
  * @param string $sFile
451
  * @return stdClass|null
@@ -477,6 +423,46 @@ class ICWP_WPSF_WpFunctions_Plugins extends ICWP_WPSF_Foundation {
477
  return is_array( $aUpdates ) ? $aUpdates : array();
478
  }
479
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
480
  /**
481
  * @param string $sFile
482
  * @return bool
@@ -490,7 +476,7 @@ class ICWP_WPSF_WpFunctions_Plugins extends ICWP_WPSF_Foundation {
490
  * @return bool
491
  */
492
  public function isInstalled( $sFile ) {
493
- return !empty( $sFile ) && !is_null( $this->getPlugin( $sFile ) );
494
  }
495
 
496
  /**
@@ -501,6 +487,15 @@ class ICWP_WPSF_WpFunctions_Plugins extends ICWP_WPSF_Foundation {
501
  return !is_null( $this->getUpdateInfo( $sFile ) );
502
  }
503
 
 
 
 
 
 
 
 
 
 
504
  /**
505
  * @param string $sFile
506
  * @param int $nDesiredPosition
@@ -536,4 +531,21 @@ class ICWP_WPSF_WpFunctions_Plugins extends ICWP_WPSF_Foundation {
536
  public function setActivePluginLoadLast( $sFile ) {
537
  $this->setActivePluginLoadPosition( $sFile, 1000 );
538
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
539
  }
253
  * @return null|string
254
  */
255
  public function findPluginBy( $sValueToCompare, $sKey = 'Name' ) {
256
+ $sFile = null;
257
 
258
+ foreach ( $this->getPlugins() as $sBaseFileName => $aPluginData ) {
259
+ if ( isset( $aPluginData[ $sKey ] ) && $sValueToCompare == $aPluginData[ $sKey ] ) {
260
+ $sFile = $sBaseFileName;
261
+ break;
 
262
  }
263
  }
264
 
265
+ return $sFile;
266
  }
267
 
268
  /**
273
  return dirname( path_join( WP_PLUGIN_DIR, $sFile ) );
274
  }
275
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
276
  /**
277
  * @param string $sPluginFile
278
  * @return array|null
279
  */
280
  public function getPlugin( $sPluginFile ) {
281
  $aPlugin = null;
282
+ if ( $this->isInstalled( $sPluginFile ) ) {
283
+ $aPlugins = $this->getPlugins();
 
 
284
  $aPlugin = $aPlugins[ $sPluginFile ];
285
  }
286
  return $aPlugin;
293
  public function getFileFromDirName( $sDirName ) {
294
  $sFile = null;
295
  if ( !empty( $sDirName ) ) {
296
+ foreach ( $this->getInstalledBaseFiles() as $sF ) {
297
  if ( strpos( $sFile, $sDirName.'/' ) === 0 ) {
298
  $sFile = $sF;
299
  break;
326
  */
327
  public function getActivePlugins() {
328
  $oWp = $this->loadWp();
329
+ $aActive = $oWp->getOption( ( $oWp->isMultisite() ? 'active_sitewide_plugins' : 'active_plugins' ) );
330
+ return is_array( $aActive ) ? $aActive : array();
331
  }
332
 
333
  /**
334
  * @return array
335
  */
336
+ public function getInstalledBaseFiles() {
337
  return array_keys( $this->getPlugins() );
338
  }
339
 
344
  if ( !function_exists( 'get_plugins' ) ) {
345
  require_once( ABSPATH.'wp-admin/includes/plugin.php' );
346
  }
347
+ $aP = function_exists( 'get_plugins' ) ? get_plugins() : array();
348
+ return is_array( $aP ) ? $aP : array();
349
  }
350
 
351
  /**
392
  return isset( $oPluginInfo->slug ) ? $oPluginInfo->slug : '';
393
  }
394
 
 
 
 
 
 
 
 
 
 
395
  /**
396
  * @param string $sFile
397
  * @return stdClass|null
423
  return is_array( $aUpdates ) ? $aUpdates : array();
424
  }
425
 
426
+ /**
427
+ * @param string $sPluginFile
428
+ * @return string
429
+ */
430
+ public function getUrl_Activate( $sPluginFile ) {
431
+ return $this->getUrl_Action( $sPluginFile, 'activate' );
432
+ }
433
+
434
+ /**
435
+ * @param string $sPluginFile
436
+ * @return string
437
+ */
438
+ public function getUrl_Deactivate( $sPluginFile ) {
439
+ return $this->getUrl_Action( $sPluginFile, 'deactivate' );
440
+ }
441
+
442
+ /**
443
+ * @param string $sPluginFile
444
+ * @return string
445
+ */
446
+ public function getUrl_Upgrade( $sPluginFile ) {
447
+ return $this->getUrl_Action( $sPluginFile, 'upgrade' );
448
+ }
449
+
450
+ /**
451
+ * @param string $sPluginFile
452
+ * @param string $sAction
453
+ * @return string
454
+ */
455
+ protected function getUrl_Action( $sPluginFile, $sAction ) {
456
+ return add_query_arg(
457
+ array(
458
+ 'action' => $sAction.'-plugin',
459
+ 'plugin' => urlencode( $sPluginFile ),
460
+ '_wpnonce' => wp_create_nonce( $sAction.'-plugin_'.$sPluginFile )
461
+ ),
462
+ self_admin_url( 'plugins.php' )
463
+ );
464
+ }
465
+
466
  /**
467
  * @param string $sFile
468
  * @return bool
476
  * @return bool
477
  */
478
  public function isInstalled( $sFile ) {
479
+ return in_array( $sFile, $this->getInstalledBaseFiles() );
480
  }
481
 
482
  /**
487
  return !is_null( $this->getUpdateInfo( $sFile ) );
488
  }
489
 
490
+ /**
491
+ * @param string $sBaseName
492
+ * @return bool
493
+ */
494
+ public function isWpOrg( $sBaseName ) {
495
+ $oPluginInfo = $this->getExtendedData( $sBaseName );
496
+ return isset( $oPluginInfo->id ) ? strpos( $oPluginInfo->id, 'w.org/' ) === 0 : false;
497
+ }
498
+
499
  /**
500
  * @param string $sFile
501
  * @param int $nDesiredPosition
531
  public function setActivePluginLoadLast( $sFile ) {
532
  $this->setActivePluginLoadPosition( $sFile, 1000 );
533
  }
534
+
535
+ /**
536
+ * @deprecated
537
+ * @param string $sPluginFile
538
+ * @return string
539
+ */
540
+ public function getLinkPluginUpgrade( $sPluginFile ) {
541
+ return $this->getUrl_Upgrade( $sPluginFile );
542
+ }
543
+
544
+ /**
545
+ * @deprecated
546
+ * @return array
547
+ */
548
+ public function getInstalledPluginFiles() {
549
+ return $this->getInstalledBaseFiles();
550
+ }
551
  }
src/common/icwp-wpfunctions.php CHANGED
@@ -30,11 +30,6 @@ class ICWP_WPSF_WpFunctions extends ICWP_WPSF_Foundation {
30
  */
31
  protected $sWpVersion;
32
 
33
- /**
34
- * @var boolean
35
- */
36
- protected $bIsMultisite;
37
-
38
  public function __construct() {
39
  }
40
 
@@ -106,7 +101,7 @@ class ICWP_WPSF_WpFunctions extends ICWP_WPSF_Foundation {
106
  || ( isset( $GLOBALS[ 'pagenow' ] ) && $GLOBALS[ 'pagenow' ] == 'update.php' ) ) {
107
  return true;
108
  }
109
- wp_redirect( $oWpPlugins->getLinkPluginUpgrade( $sPluginFile ) );
110
  exit();
111
  }
112
 
@@ -405,7 +400,7 @@ class ICWP_WPSF_WpFunctions extends ICWP_WPSF_Foundation {
405
  }
406
 
407
  public function redirectHere() {
408
- $this->doRedirect( $this->loadDP()->getRequestUri() );
409
  }
410
 
411
  /**
@@ -438,14 +433,14 @@ class ICWP_WPSF_WpFunctions extends ICWP_WPSF_Foundation {
438
  public function doRedirect( $sUrl, $aQueryParams = array(), $bSafe = true, $bProtectAgainstInfiniteLoops = true ) {
439
  $sUrl = empty( $aQueryParams ) ? $sUrl : add_query_arg( $aQueryParams, $sUrl );
440
 
441
- $oDp = $this->loadDP();
442
  // we prevent any repetitive redirect loops
443
  if ( $bProtectAgainstInfiniteLoops ) {
444
- if ( $oDp->cookie( 'icwp-isredirect' ) == 'yes' ) {
445
  return;
446
  }
447
  else {
448
- $oDp->setCookie( 'icwp-isredirect', 'yes', 5 );
449
  }
450
  }
451
 
@@ -541,7 +536,7 @@ class ICWP_WPSF_WpFunctions extends ICWP_WPSF_Foundation {
541
 
542
  //special case for plugin admin pages.
543
  if ( $sPage == 'admin.php' ) {
544
- $sSubPage = $this->loadDP()->query( 'page' );
545
  if ( !empty( $sSubPage ) ) {
546
  $aQueryArgs = array(
547
  'page' => $sSubPage,
@@ -581,33 +576,33 @@ class ICWP_WPSF_WpFunctions extends ICWP_WPSF_Foundation {
581
  * @return bool
582
  */
583
  public function isRequestLoginUrl() {
584
- return $this->isLoginUrl( $this->loadDP()->getRequestPath() );
585
  }
586
 
587
  /**
588
  * @return bool
589
  */
590
  public function isRequestUserLogin() {
591
- $oDp = $this->loadDP();
592
- return $this->isRequestLoginUrl() && $oDp->isMethodPost()
593
- && !is_null( $oDp->post( 'log' ) ) && !is_null( $oDp->post( 'pwd' ) );
594
  }
595
 
596
  /**
597
  * @return bool
598
  */
599
  public function isRequestUserRegister() {
600
- $oDp = $this->loadDP();
601
- return $oDp->isMethodPost() && !is_null( $oDp->post( 'user_login' ) )
602
- && !is_null( $oDp->post( 'user_email' ) ) && $this->isRequestLoginUrl();
603
  }
604
 
605
  /**
606
  * @return bool
607
  */
608
  public function isRequestUserResetPasswordStart() {
609
- $oDp = $this->loadDP();
610
- return $this->isRequestLoginUrl() && $oDp->isMethodPost() && !is_null( $oDp->post( 'user_login' ) );
611
  }
612
 
613
  /**
@@ -717,10 +712,14 @@ class ICWP_WPSF_WpFunctions extends ICWP_WPSF_Foundation {
717
  * @return bool
718
  */
719
  public function isMultisite() {
720
- if ( !isset( $this->bIsMultisite ) ) {
721
- $this->bIsMultisite = function_exists( 'is_multisite' ) && is_multisite();
722
- }
723
- return $this->bIsMultisite;
 
 
 
 
724
  }
725
 
726
  /**
@@ -732,7 +731,7 @@ class ICWP_WPSF_WpFunctions extends ICWP_WPSF_Foundation {
732
  if ( !$bIsRest && function_exists( 'rest_url' ) ) {
733
  $sRestUrlBase = get_rest_url( get_current_blog_id(), '/' );
734
  $sRestPath = trim( parse_url( $sRestUrlBase, PHP_URL_PATH ), '/' );
735
- $sRequestPath = trim( $this->loadDP()->getRequestPath(), '/' );
736
  $bIsRest = !empty( $sRequestPath ) && !empty( $sRestPath )
737
  && ( strpos( $sRequestPath, $sRestPath ) === 0 );
738
  }
@@ -763,11 +762,11 @@ class ICWP_WPSF_WpFunctions extends ICWP_WPSF_Foundation {
763
  $sPath = null;
764
 
765
  if ( $this->isRest() ) {
766
- $oDP = $this->loadDP();
767
 
768
- $sPath = $oDP->request( 'rest_route' );
769
  if ( empty( $sPath ) && $this->isPermalinksEnabled() ) {
770
- $sFullUri = $this->loadWp()->getHomeUrl( $oDP->getRequestPath() );
771
  $sPath = substr( $sFullUri, strlen( get_rest_url( get_current_blog_id() ) ) );
772
  }
773
  }
@@ -814,10 +813,10 @@ class ICWP_WPSF_WpFunctions extends ICWP_WPSF_Foundation {
814
  */
815
  public function getCurrentWpAdminPage() {
816
 
817
- $oDp = $this->loadDP();
818
- $sScript = $oDp->getScriptName();
819
  if ( is_admin() && !empty( $sScript ) && basename( $sScript ) == 'admin.php' ) {
820
- $sCurrentPage = $oDp->query( 'page' );
821
  }
822
  return empty( $sCurrentPage ) ? '' : $sCurrentPage;
823
  }
@@ -829,7 +828,7 @@ class ICWP_WPSF_WpFunctions extends ICWP_WPSF_Foundation {
829
  * @return string
830
  */
831
  public function getTimeStringForDisplay( $nTime = null, $bShowTime = true, $bShowDate = true ) {
832
- $nTime = empty( $nTime ) ? $this->loadDP()->time() : $nTime;
833
 
834
  $sFullTimeString = $bShowTime ? $this->getTimeFormat() : '';
835
  if ( empty( $sFullTimeString ) ) {
@@ -846,7 +845,7 @@ class ICWP_WPSF_WpFunctions extends ICWP_WPSF_Foundation {
846
  * @return string
847
  */
848
  public function getTimeStampForDisplay( $nTime = null ) {
849
- $nTime = empty( $nTime ) ? $this->loadDP()->time() : $nTime;
850
  return date_i18n( DATE_RFC2822, $this->getTimeAsGmtOffset( $nTime ) );
851
  }
852
 
@@ -864,7 +863,7 @@ class ICWP_WPSF_WpFunctions extends ICWP_WPSF_Foundation {
864
  }
865
  }
866
 
867
- $nTime = is_null( $nTime ) ? $this->loadDP()->time() : $nTime;
868
  return $nTime + ( $nTimezoneOffset*HOUR_IN_SECONDS );
869
  }
870
 
30
  */
31
  protected $sWpVersion;
32
 
 
 
 
 
 
33
  public function __construct() {
34
  }
35
 
101
  || ( isset( $GLOBALS[ 'pagenow' ] ) && $GLOBALS[ 'pagenow' ] == 'update.php' ) ) {
102
  return true;
103
  }
104
+ wp_redirect( $oWpPlugins->getUrl_Upgrade( $sPluginFile ) );
105
  exit();
106
  }
107
 
400
  }
401
 
402
  public function redirectHere() {
403
+ $this->doRedirect( $this->loadRequest()->getUri() );
404
  }
405
 
406
  /**
433
  public function doRedirect( $sUrl, $aQueryParams = array(), $bSafe = true, $bProtectAgainstInfiniteLoops = true ) {
434
  $sUrl = empty( $aQueryParams ) ? $sUrl : add_query_arg( $aQueryParams, $sUrl );
435
 
436
+ $oReq = $this->loadRequest();
437
  // we prevent any repetitive redirect loops
438
  if ( $bProtectAgainstInfiniteLoops ) {
439
+ if ( $oReq->cookie( 'icwp-isredirect' ) == 'yes' ) {
440
  return;
441
  }
442
  else {
443
+ $oReq->setCookie( 'icwp-isredirect', 'yes', 5 );
444
  }
445
  }
446
 
536
 
537
  //special case for plugin admin pages.
538
  if ( $sPage == 'admin.php' ) {
539
+ $sSubPage = $this->loadRequest()->query( 'page' );
540
  if ( !empty( $sSubPage ) ) {
541
  $aQueryArgs = array(
542
  'page' => $sSubPage,
576
  * @return bool
577
  */
578
  public function isRequestLoginUrl() {
579
+ return $this->isLoginUrl( $this->loadRequest()->getPath() );
580
  }
581
 
582
  /**
583
  * @return bool
584
  */
585
  public function isRequestUserLogin() {
586
+ $oReq = $this->loadRequest();
587
+ return $this->isRequestLoginUrl() && $oReq->isMethodPost()
588
+ && !is_null( $oReq->post( 'log' ) ) && !is_null( $oReq->post( 'pwd' ) );
589
  }
590
 
591
  /**
592
  * @return bool
593
  */
594
  public function isRequestUserRegister() {
595
+ $oReq = $this->loadRequest();
596
+ return $oReq->isMethodPost() && !is_null( $oReq->post( 'user_login' ) )
597
+ && !is_null( $oReq->post( 'user_email' ) ) && $this->isRequestLoginUrl();
598
  }
599
 
600
  /**
601
  * @return bool
602
  */
603
  public function isRequestUserResetPasswordStart() {
604
+ $oReq = $this->loadRequest();
605
+ return $this->isRequestLoginUrl() && $oReq->isMethodPost() && !is_null( $oReq->post( 'user_login' ) );
606
  }
607
 
608
  /**
712
  * @return bool
713
  */
714
  public function isMultisite() {
715
+ return function_exists( 'is_multisite' ) && is_multisite();
716
+ }
717
+
718
+ /**
719
+ * @return bool
720
+ */
721
+ public function isMultisite_SubdomainInstall() {
722
+ return $this->isMultisite() && defined( 'SUBDOMAIN_INSTALL' ) && SUBDOMAIN_INSTALL;
723
  }
724
 
725
  /**
731
  if ( !$bIsRest && function_exists( 'rest_url' ) ) {
732
  $sRestUrlBase = get_rest_url( get_current_blog_id(), '/' );
733
  $sRestPath = trim( parse_url( $sRestUrlBase, PHP_URL_PATH ), '/' );
734
+ $sRequestPath = trim( $this->loadRequest()->getPath(), '/' );
735
  $bIsRest = !empty( $sRequestPath ) && !empty( $sRestPath )
736
  && ( strpos( $sRequestPath, $sRestPath ) === 0 );
737
  }
762
  $sPath = null;
763
 
764
  if ( $this->isRest() ) {
765
+ $oReq = $this->loadRequest();
766
 
767
+ $sPath = $oReq->request( 'rest_route' );
768
  if ( empty( $sPath ) && $this->isPermalinksEnabled() ) {
769
+ $sFullUri = $this->loadWp()->getHomeUrl( $oReq->getPath() );
770
  $sPath = substr( $sFullUri, strlen( get_rest_url( get_current_blog_id() ) ) );
771
  }
772
  }
813
  */
814
  public function getCurrentWpAdminPage() {
815
 
816
+ $oReq = $this->loadRequest();
817
+ $sScript = $oReq->getScriptName();
818
  if ( is_admin() && !empty( $sScript ) && basename( $sScript ) == 'admin.php' ) {
819
+ $sCurrentPage = $oReq->query( 'page' );
820
  }
821
  return empty( $sCurrentPage ) ? '' : $sCurrentPage;
822
  }
828
  * @return string
829
  */
830
  public function getTimeStringForDisplay( $nTime = null, $bShowTime = true, $bShowDate = true ) {
831
+ $nTime = empty( $nTime ) ? $this->loadRequest()->ts() : $nTime;
832
 
833
  $sFullTimeString = $bShowTime ? $this->getTimeFormat() : '';
834
  if ( empty( $sFullTimeString ) ) {
845
  * @return string
846
  */
847
  public function getTimeStampForDisplay( $nTime = null ) {
848
+ $nTime = empty( $nTime ) ? $this->loadRequest()->ts() : $nTime;
849
  return date_i18n( DATE_RFC2822, $this->getTimeAsGmtOffset( $nTime ) );
850
  }
851
 
863
  }
864
  }
865
 
866
+ $nTime = is_null( $nTime ) ? $this->loadRequest()->ts() : $nTime;
867
  return $nTime + ( $nTimezoneOffset*HOUR_IN_SECONDS );
868
  }
869
 
src/common/lib/composer.lock CHANGED
@@ -53,16 +53,16 @@
53
  },
54
  {
55
  "name": "composer/ca-bundle",
56
- "version": "1.1.2",
57
  "source": {
58
  "type": "git",
59
  "url": "https://github.com/composer/ca-bundle.git",
60
- "reference": "46afded9720f40b9dc63542af4e3e43a1177acb0"
61
  },
62
  "dist": {
63
  "type": "zip",
64
- "url": "https://api.github.com/repos/composer/ca-bundle/zipball/46afded9720f40b9dc63542af4e3e43a1177acb0",
65
- "reference": "46afded9720f40b9dc63542af4e3e43a1177acb0",
66
  "shasum": ""
67
  },
68
  "require": {
@@ -105,7 +105,7 @@
105
  "ssl",
106
  "tls"
107
  ],
108
- "time": "2018-08-08T08:57:40+00:00"
109
  },
110
  {
111
  "name": "fernleafsystems/utilities",
@@ -469,16 +469,16 @@
469
  },
470
  {
471
  "name": "symfony/translation",
472
- "version": "v2.8.45",
473
  "source": {
474
  "type": "git",
475
  "url": "https://github.com/symfony/translation.git",
476
- "reference": "12ad0a708ec55fb80cac9e809c5b56ddd5417d6a"
477
  },
478
  "dist": {
479
  "type": "zip",
480
- "url": "https://api.github.com/repos/symfony/translation/zipball/12ad0a708ec55fb80cac9e809c5b56ddd5417d6a",
481
- "reference": "12ad0a708ec55fb80cac9e809c5b56ddd5417d6a",
482
  "shasum": ""
483
  },
484
  "require": {
@@ -529,7 +529,7 @@
529
  ],
530
  "description": "Symfony Translation Component",
531
  "homepage": "https://symfony.com",
532
- "time": "2018-07-26T11:13:39+00:00"
533
  },
534
  {
535
  "name": "twig/twig",
53
  },
54
  {
55
  "name": "composer/ca-bundle",
56
+ "version": "1.1.3",
57
  "source": {
58
  "type": "git",
59
  "url": "https://github.com/composer/ca-bundle.git",
60
+ "reference": "8afa52cd417f4ec417b4bfe86b68106538a87660"
61
  },
62
  "dist": {
63
  "type": "zip",
64
+ "url": "https://api.github.com/repos/composer/ca-bundle/zipball/8afa52cd417f4ec417b4bfe86b68106538a87660",
65
+ "reference": "8afa52cd417f4ec417b4bfe86b68106538a87660",
66
  "shasum": ""
67
  },
68
  "require": {
105
  "ssl",
106
  "tls"
107
  ],
108
+ "time": "2018-10-18T06:09:13+00:00"
109
  },
110
  {
111
  "name": "fernleafsystems/utilities",
469
  },
470
  {
471
  "name": "symfony/translation",
472
+ "version": "v2.8.46",
473
  "source": {
474
  "type": "git",
475
  "url": "https://github.com/symfony/translation.git",
476
+ "reference": "59b4debd89c156fd753343fcc1ca36aa5bc2d0f4"
477
  },
478
  "dist": {
479
  "type": "zip",
480
+ "url": "https://api.github.com/repos/symfony/translation/zipball/59b4debd89c156fd753343fcc1ca36aa5bc2d0f4",
481
+ "reference": "59b4debd89c156fd753343fcc1ca36aa5bc2d0f4",
482
  "shasum": ""
483
  },
484
  "require": {
529
  ],
530
  "description": "Symfony Translation Component",
531
  "homepage": "https://symfony.com",
532
+ "time": "2018-09-21T12:46:38+00:00"
533
  },
534
  {
535
  "name": "twig/twig",
src/common/lib/vendor/composer/ca-bundle/res/cacert.pem CHANGED
@@ -1,7 +1,7 @@
1
  ##
2
  ## Bundle of CA Root Certificates
3
  ##
4
- ## Certificate data from Mozilla as of: Wed Jun 20 03:12:06 2018 GMT
5
  ##
6
  ## This is a bundle of X.509 certificates of public Certificate Authorities
7
  ## (CA). These were automatically extracted from Mozilla's root certificates
@@ -14,7 +14,7 @@
14
  ## Just configure this file as the SSLCACertificateFile.
15
  ##
16
  ## Conversion done with mk-ca-bundle.pl version 1.27.
17
- ## SHA256: c80f571d9f4ebca4a91e0ad3a546f263153d71afffc845c6f8f52ce9d1a2e8ec
18
  ##
19
 
20
 
@@ -2792,126 +2792,6 @@ GiecMjvAwNW6qef4BENThe5SId6d9SWDPp5YSy/XZxMOIQIwBeF1Ad5o7SofTUwJCA3sS61kFyjn
2792
  dc5FZXIhF8siQQ6ME5g4mlRtm8rifOoCWCKR
2793
  -----END CERTIFICATE-----
2794
 
2795
- Certplus Root CA G1
2796
- ===================
2797
- -----BEGIN CERTIFICATE-----
2798
- MIIFazCCA1OgAwIBAgISESBVg+QtPlRWhS2DN7cs3EYRMA0GCSqGSIb3DQEBDQUAMD4xCzAJBgNV
2799
- BAYTAkZSMREwDwYDVQQKDAhDZXJ0cGx1czEcMBoGA1UEAwwTQ2VydHBsdXMgUm9vdCBDQSBHMTAe
2800
- Fw0xNDA1MjYwMDAwMDBaFw0zODAxMTUwMDAwMDBaMD4xCzAJBgNVBAYTAkZSMREwDwYDVQQKDAhD
2801
- ZXJ0cGx1czEcMBoGA1UEAwwTQ2VydHBsdXMgUm9vdCBDQSBHMTCCAiIwDQYJKoZIhvcNAQEBBQAD
2802
- ggIPADCCAgoCggIBANpQh7bauKk+nWT6VjOaVj0W5QOVsjQcmm1iBdTYj+eJZJ+622SLZOZ5KmHN
2803
- r49aiZFluVj8tANfkT8tEBXgfs+8/H9DZ6itXjYj2JizTfNDnjl8KvzsiNWI7nC9hRYt6kuJPKNx
2804
- Qv4c/dMcLRC4hlTqQ7jbxofaqK6AJc96Jh2qkbBIb6613p7Y1/oA/caP0FG7Yn2ksYyy/yARujVj
2805
- BYZHYEMzkPZHogNPlk2dT8Hq6pyi/jQu3rfKG3akt62f6ajUeD94/vI4CTYd0hYCyOwqaK/1jpTv
2806
- LRN6HkJKHRUxrgwEV/xhc/MxVoYxgKDEEW4wduOU8F8ExKyHcomYxZ3MVwia9Az8fXoFOvpHgDm2
2807
- z4QTd28n6v+WZxcIbekN1iNQMLAVdBM+5S//Ds3EC0pd8NgAM0lm66EYfFkuPSi5YXHLtaW6uOrc
2808
- 4nBvCGrch2c0798wct3zyT8j/zXhviEpIDCB5BmlIOklynMxdCm+4kLV87ImZsdo/Rmz5yCTmehd
2809
- 4F6H50boJZwKKSTUzViGUkAksnsPmBIgJPaQbEfIDbsYIC7Z/fyL8inqh3SV4EJQeIQEQWGw9CEj
2810
- jy3LKCHyamz0GqbFFLQ3ZU+V/YDI+HLlJWvEYLF7bY5KinPOWftwenMGE9nTdDckQQoRb5fc5+R+
2811
- ob0V8rqHDz1oihYHAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0G
2812
- A1UdDgQWBBSowcCbkahDFXxdBie0KlHYlwuBsTAfBgNVHSMEGDAWgBSowcCbkahDFXxdBie0KlHY
2813
- lwuBsTANBgkqhkiG9w0BAQ0FAAOCAgEAnFZvAX7RvUz1isbwJh/k4DgYzDLDKTudQSk0YcbX8ACh
2814
- 66Ryj5QXvBMsdbRX7gp8CXrc1cqh0DQT+Hern+X+2B50ioUHj3/MeXrKls3N/U/7/SMNkPX0XtPG
2815
- YX2eEeAC7gkE2Qfdpoq3DIMku4NQkv5gdRE+2J2winq14J2by5BSS7CTKtQ+FjPlnsZlFT5kOwQ/
2816
- 2wyPX1wdaR+v8+khjPPvl/aatxm2hHSco1S1cE5j2FddUyGbQJJD+tZ3VTNPZNX70Cxqjm0lpu+F
2817
- 6ALEUz65noe8zDUa3qHpimOHZR4RKttjd5cUvpoUmRGywO6wT/gUITJDT5+rosuoD6o7BlXGEilX
2818
- CNQ314cnrUlZp5GrRHpejXDbl85IULFzk/bwg2D5zfHhMf1bfHEhYxQUqq/F3pN+aLHsIqKqkHWe
2819
- tUNy6mSjhEv9DKgma3GX7lZjZuhCVPnHHd/Qj1vfyDBviP4NxDMcU6ij/UgQ8uQKTuEVV/xuZDDC
2820
- VRHc6qnNSlSsKWNEz0pAoNZoWRsz+e86i9sgktxChL8Bq4fA1SCC28a5g4VCXA9DO2pJNdWY9BW/
2821
- +mGBDAkgGNLQFwzLSABQ6XaCjGTXOqAHVcweMcDvOrRl++O/QmueD6i9a5jc2NvLi6Td11n0bt3+
2822
- qsOR0C5CB8AMTVPNJLFMWx5R9N/pkvo=
2823
- -----END CERTIFICATE-----
2824
-
2825
- Certplus Root CA G2
2826
- ===================
2827
- -----BEGIN CERTIFICATE-----
2828
- MIICHDCCAaKgAwIBAgISESDZkc6uo+jF5//pAq/Pc7xVMAoGCCqGSM49BAMDMD4xCzAJBgNVBAYT
2829
- AkZSMREwDwYDVQQKDAhDZXJ0cGx1czEcMBoGA1UEAwwTQ2VydHBsdXMgUm9vdCBDQSBHMjAeFw0x
2830
- NDA1MjYwMDAwMDBaFw0zODAxMTUwMDAwMDBaMD4xCzAJBgNVBAYTAkZSMREwDwYDVQQKDAhDZXJ0
2831
- cGx1czEcMBoGA1UEAwwTQ2VydHBsdXMgUm9vdCBDQSBHMjB2MBAGByqGSM49AgEGBSuBBAAiA2IA
2832
- BM0PW1aC3/BFGtat93nwHcmsltaeTpwftEIRyoa/bfuFo8XlGVzX7qY/aWfYeOKmycTbLXku54uN
2833
- Am8xIk0G42ByRZ0OQneezs/lf4WbGOT8zC5y0xaTTsqZY1yhBSpsBqNjMGEwDgYDVR0PAQH/BAQD
2834
- AgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNqDYwJ5jtpMxjwjFNiPwyCrKGBZMB8GA1Ud
2835
- IwQYMBaAFNqDYwJ5jtpMxjwjFNiPwyCrKGBZMAoGCCqGSM49BAMDA2gAMGUCMHD+sAvZ94OX7PNV
2836
- HdTcswYO/jOYnYs5kGuUIe22113WTNchp+e/IQ8rzfcq3IUHnQIxAIYUFuXcsGXCwI4Un78kFmjl
2837
- vPl5adytRSv3tjFzzAalU5ORGpOucGpnutee5WEaXw==
2838
- -----END CERTIFICATE-----
2839
-
2840
- OpenTrust Root CA G1
2841
- ====================
2842
- -----BEGIN CERTIFICATE-----
2843
- MIIFbzCCA1egAwIBAgISESCzkFU5fX82bWTCp59rY45nMA0GCSqGSIb3DQEBCwUAMEAxCzAJBgNV
2844
- BAYTAkZSMRIwEAYDVQQKDAlPcGVuVHJ1c3QxHTAbBgNVBAMMFE9wZW5UcnVzdCBSb290IENBIEcx
2845
- MB4XDTE0MDUyNjA4NDU1MFoXDTM4MDExNTAwMDAwMFowQDELMAkGA1UEBhMCRlIxEjAQBgNVBAoM
2846
- CU9wZW5UcnVzdDEdMBsGA1UEAwwUT3BlblRydXN0IFJvb3QgQ0EgRzEwggIiMA0GCSqGSIb3DQEB
2847
- AQUAA4ICDwAwggIKAoICAQD4eUbalsUwXopxAy1wpLuwxQjczeY1wICkES3d5oeuXT2R0odsN7fa
2848
- Yp6bwiTXj/HbpqbfRm9RpnHLPhsxZ2L3EVs0J9V5ToybWL0iEA1cJwzdMOWo010hOHQX/uMftk87
2849
- ay3bfWAfjH1MBcLrARYVmBSO0ZB3Ij/swjm4eTrwSSTilZHcYTSSjFR077F9jAHiOH3BX2pfJLKO
2850
- YheteSCtqx234LSWSE9mQxAGFiQD4eCcjsZGT44ameGPuY4zbGneWK2gDqdkVBFpRGZPTBKnjix9
2851
- xNRbxQA0MMHZmf4yzgeEtE7NCv82TWLxp2NX5Ntqp66/K7nJ5rInieV+mhxNaMbBGN4zK1FGSxyO
2852
- 9z0M+Yo0FMT7MzUj8czxKselu7Cizv5Ta01BG2Yospb6p64KTrk5M0ScdMGTHPjgniQlQ/GbI4Kq
2853
- 3ywgsNw2TgOzfALU5nsaqocTvz6hdLubDuHAk5/XpGbKuxs74zD0M1mKB3IDVedzagMxbm+WG+Oi
2854
- n6+Sx+31QrclTDsTBM8clq8cIqPQqwWyTBIjUtz9GVsnnB47ev1CI9sjgBPwvFEVVJSmdz7QdFG9
2855
- URQIOTfLHzSpMJ1ShC5VkLG631UAC9hWLbFJSXKAqWLXwPYYEQRVzXR7z2FwefR7LFxckvzluFqr
2856
- TJOVoSfupb7PcSNCupt2LQIDAQABo2MwYTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB
2857
- /zAdBgNVHQ4EFgQUl0YhVyE12jZVx/PxN3DlCPaTKbYwHwYDVR0jBBgwFoAUl0YhVyE12jZVx/Px
2858
- N3DlCPaTKbYwDQYJKoZIhvcNAQELBQADggIBAB3dAmB84DWn5ph76kTOZ0BP8pNuZtQ5iSas000E
2859
- PLuHIT839HEl2ku6q5aCgZG27dmxpGWX4m9kWaSW7mDKHyP7Rbr/jyTwyqkxf3kfgLMtMrpkZ2Cv
2860
- uVnN35pJ06iCsfmYlIrM4LvgBBuZYLFGZdwIorJGnkSI6pN+VxbSFXJfLkur1J1juONI5f6ELlgK
2861
- n0Md/rcYkoZDSw6cMoYsYPXpSOqV7XAp8dUv/TW0V8/bhUiZucJvbI/NeJWsZCj9VrDDb8O+WVLh
2862
- X4SPgPL0DTatdrOjteFkdjpY3H1PXlZs5VVZV6Xf8YpmMIzUUmI4d7S+KNfKNsSbBfD4Fdvb8e80
2863
- nR14SohWZ25g/4/Ii+GOvUKpMwpZQhISKvqxnUOOBZuZ2mKtVzazHbYNeS2WuOvyDEsMpZTGMKcm
2864
- GS3tTAZQMPH9WD25SxdfGbRqhFS0OE85og2WaMMolP3tLR9Ka0OWLpABEPs4poEL0L9109S5zvE/
2865
- bw4cHjdx5RiHdRk/ULlepEU0rbDK5uUTdg8xFKmOLZTW1YVNcxVPS/KyPu1svf0OnWZzsD2097+o
2866
- 4BGkxK51CUpjAEggpsadCwmKtODmzj7HPiY46SvepghJAwSQiumPv+i2tCqjI40cHLI5kqiPAlxA
2867
- OXXUc0ECd97N4EOH1uS6SsNsEn/+KuYj1oxx
2868
- -----END CERTIFICATE-----
2869
-
2870
- OpenTrust Root CA G2
2871
- ====================
2872
- -----BEGIN CERTIFICATE-----
2873
- MIIFbzCCA1egAwIBAgISESChaRu/vbm9UpaPI+hIvyYRMA0GCSqGSIb3DQEBDQUAMEAxCzAJBgNV
2874
- BAYTAkZSMRIwEAYDVQQKDAlPcGVuVHJ1c3QxHTAbBgNVBAMMFE9wZW5UcnVzdCBSb290IENBIEcy
2875
- MB4XDTE0MDUyNjAwMDAwMFoXDTM4MDExNTAwMDAwMFowQDELMAkGA1UEBhMCRlIxEjAQBgNVBAoM
2876
- CU9wZW5UcnVzdDEdMBsGA1UEAwwUT3BlblRydXN0IFJvb3QgQ0EgRzIwggIiMA0GCSqGSIb3DQEB
2877
- AQUAA4ICDwAwggIKAoICAQDMtlelM5QQgTJT32F+D3Y5z1zCU3UdSXqWON2ic2rxb95eolq5cSG+
2878
- Ntmh/LzubKh8NBpxGuga2F8ORAbtp+Dz0mEL4DKiltE48MLaARf85KxP6O6JHnSrT78eCbY2albz
2879
- 4e6WiWYkBuTNQjpK3eCasMSCRbP+yatcfD7J6xcvDH1urqWPyKwlCm/61UWY0jUJ9gNDlP7ZvyCV
2880
- eYCYitmJNbtRG6Q3ffyZO6v/v6wNj0OxmXsWEH4db0fEFY8ElggGQgT4hNYdvJGmQr5J1WqIP7wt
2881
- UdGejeBSzFfdNTVY27SPJIjki9/ca1TSgSuyzpJLHB9G+h3Ykst2Z7UJmQnlrBcUVXDGPKBWCgOz
2882
- 3GIZ38i1MH/1PCZ1Eb3XG7OHngevZXHloM8apwkQHZOJZlvoPGIytbU6bumFAYueQ4xncyhZW+vj
2883
- 3CzMpSZyYhK05pyDRPZRpOLAeiRXyg6lPzq1O4vldu5w5pLeFlwoW5cZJ5L+epJUzpM5ChaHvGOz
2884
- 9bGTXOBut9Dq+WIyiET7vycotjCVXRIouZW+j1MY5aIYFuJWpLIsEPUdN6b4t/bQWVyJ98LVtZR0
2885
- 0dX+G7bw5tYee9I8y6jj9RjzIR9u701oBnstXW5DiabA+aC/gh7PU3+06yzbXfZqfUAkBXKJOAGT
2886
- y3HCOV0GEfZvePg3DTmEJwIDAQABo2MwYTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB
2887
- /zAdBgNVHQ4EFgQUajn6QiL35okATV59M4PLuG53hq8wHwYDVR0jBBgwFoAUajn6QiL35okATV59
2888
- M4PLuG53hq8wDQYJKoZIhvcNAQENBQADggIBAJjLq0A85TMCl38th6aP1F5Kr7ge57tx+4BkJamz
2889
- Gj5oXScmp7oq4fBXgwpkTx4idBvpkF/wrM//T2h6OKQQbA2xx6R3gBi2oihEdqc0nXGEL8pZ0keI
2890
- mUEiyTCYYW49qKgFbdEfwFFEVn8nNQLdXpgKQuswv42hm1GqO+qTRmTFAHneIWv2V6CG1wZy7HBG
2891
- S4tz3aAhdT7cHcCP009zHIXZ/n9iyJVvttN7jLpTwm+bREx50B1ws9efAvSyB7DH5fitIw6mVskp
2892
- EndI2S9G/Tvw/HRwkqWOOAgfZDC2t0v7NqwQjqBSM2OdAzVWxWm9xiNaJ5T2pBL4LTM8oValX9YZ
2893
- 6e18CL13zSdkzJTaTkZQh+D5wVOAHrut+0dSixv9ovneDiK3PTNZbNTe9ZUGMg1RGUFcPk8G97kr
2894
- gCf2o6p6fAbhQ8MTOWIaNr3gKC6UAuQpLmBVrkA9sHSSXvAgZJY/X0VdiLWK2gKgW0VU3jg9CcCo
2895
- SmVGFvyqv1ROTVu+OEO3KMqLM6oaJbolXCkvW0pujOotnCr2BXbgd5eAiN1nE28daCSLT7d0geX0
2896
- YJ96Vdc+N9oWaz53rK4YcJUIeSkDiv7BO7M/Gg+kO14fWKGVyasvc0rQLW6aWQ9VGHgtPFGml4vm
2897
- u7JwqkwR3v98KzfUetF3NI/n+UL3PIEMS1IK
2898
- -----END CERTIFICATE-----
2899
-
2900
- OpenTrust Root CA G3
2901
- ====================
2902
- -----BEGIN CERTIFICATE-----
2903
- MIICITCCAaagAwIBAgISESDm+Ez8JLC+BUCs2oMbNGA/MAoGCCqGSM49BAMDMEAxCzAJBgNVBAYT
2904
- AkZSMRIwEAYDVQQKDAlPcGVuVHJ1c3QxHTAbBgNVBAMMFE9wZW5UcnVzdCBSb290IENBIEczMB4X
2905
- DTE0MDUyNjAwMDAwMFoXDTM4MDExNTAwMDAwMFowQDELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCU9w
2906
- ZW5UcnVzdDEdMBsGA1UEAwwUT3BlblRydXN0IFJvb3QgQ0EgRzMwdjAQBgcqhkjOPQIBBgUrgQQA
2907
- IgNiAARK7liuTcpm3gY6oxH84Bjwbhy6LTAMidnW7ptzg6kjFYwvWYpa3RTqnVkrQ7cG7DK2uu5B
2908
- ta1doYXM6h0UZqNnfkbilPPntlahFVmhTzeXuSIevRHr9LIfXsMUmuXZl5mjYzBhMA4GA1UdDwEB
2909
- /wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRHd8MUi2I5DMlv4VBN0BBY3JWIbTAf
2910
- BgNVHSMEGDAWgBRHd8MUi2I5DMlv4VBN0BBY3JWIbTAKBggqhkjOPQQDAwNpADBmAjEAj6jcnboM
2911
- BBf6Fek9LykBl7+BFjNAk2z8+e2AcG+qj9uEwov1NcoG3GRvaBbhj5G5AjEA2Euly8LQCGzpGPta
2912
- 3U1fJAuwACEl74+nBCZx4nxp5V2a+EEfOzmTk51V6s2N8fvB
2913
- -----END CERTIFICATE-----
2914
-
2915
  ISRG Root X1
2916
  ============
2917
  -----BEGIN CERTIFICATE-----
@@ -3312,3 +3192,49 @@ BBYEFFvKXuXe0oGqzagtZFG22XKbl+ZPMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUW8pe
3312
  N+vp1RPZytRrJPOwPYdGWBrssd9v+1a6cGvHOMzosYxPD/fxZ3YOg9AeUY8CMD32IygmTMZgh5Mm
3313
  m7I1HrrW9zzRHM76JTymGoEVW/MSD2zuZYrJh6j5B+BimoxcSg==
3314
  -----END CERTIFICATE-----
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ##
2
  ## Bundle of CA Root Certificates
3
  ##
4
+ ## Certificate data from Mozilla as of: Wed Oct 17 03:12:10 2018 GMT
5
  ##
6
  ## This is a bundle of X.509 certificates of public Certificate Authorities
7
  ## (CA). These were automatically extracted from Mozilla's root certificates
14
  ## Just configure this file as the SSLCACertificateFile.
15
  ##
16
  ## Conversion done with mk-ca-bundle.pl version 1.27.
17
+ ## SHA256: 3f875d87fee4ce3d966c69f1d6c111aa95c0143ade59e4fa24882c582bb5f0ca
18
  ##
19
 
20
 
2792
  dc5FZXIhF8siQQ6ME5g4mlRtm8rifOoCWCKR
2793
  -----END CERTIFICATE-----
2794
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2795
  ISRG Root X1
2796
  ============
2797
  -----BEGIN CERTIFICATE-----
3192
  N+vp1RPZytRrJPOwPYdGWBrssd9v+1a6cGvHOMzosYxPD/fxZ3YOg9AeUY8CMD32IygmTMZgh5Mm
3193
  m7I1HrrW9zzRHM76JTymGoEVW/MSD2zuZYrJh6j5B+BimoxcSg==
3194
  -----END CERTIFICATE-----
3195
+
3196
+ GlobalSign Root CA - R6
3197
+ =======================
3198
+ -----BEGIN CERTIFICATE-----
3199
+ MIIFgzCCA2ugAwIBAgIORea7A4Mzw4VlSOb/RVEwDQYJKoZIhvcNAQEMBQAwTDEgMB4GA1UECxMX
3200
+ R2xvYmFsU2lnbiBSb290IENBIC0gUjYxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkds
3201
+ b2JhbFNpZ24wHhcNMTQxMjEwMDAwMDAwWhcNMzQxMjEwMDAwMDAwWjBMMSAwHgYDVQQLExdHbG9i
3202
+ YWxTaWduIFJvb3QgQ0EgLSBSNjETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFs
3203
+ U2lnbjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAJUH6HPKZvnsFMp7PPcNCPG0RQss
3204
+ grRIxutbPK6DuEGSMxSkb3/pKszGsIhrxbaJ0cay/xTOURQh7ErdG1rG1ofuTToVBu1kZguSgMpE
3205
+ 3nOUTvOniX9PeGMIyBJQbUJmL025eShNUhqKGoC3GYEOfsSKvGRMIRxDaNc9PIrFsmbVkJq3MQbF
3206
+ vuJtMgamHvm566qjuL++gmNQ0PAYid/kD3n16qIfKtJwLnvnvJO7bVPiSHyMEAc4/2ayd2F+4OqM
3207
+ PKq0pPbzlUoSB239jLKJz9CgYXfIWHSw1CM69106yqLbnQneXUQtkPGBzVeS+n68UARjNN9rkxi+
3208
+ azayOeSsJDa38O+2HBNXk7besvjihbdzorg1qkXy4J02oW9UivFyVm4uiMVRQkQVlO6jxTiWm05O
3209
+ WgtH8wY2SXcwvHE35absIQh1/OZhFj931dmRl4QKbNQCTXTAFO39OfuD8l4UoQSwC+n+7o/hbguy
3210
+ CLNhZglqsQY6ZZZZwPA1/cnaKI0aEYdwgQqomnUdnjqGBQCe24DWJfncBZ4nWUx2OVvq+aWh2IMP
3211
+ 0f/fMBH5hc8zSPXKbWQULHpYT9NLCEnFlWQaYw55PfWzjMpYrZxCRXluDocZXFSxZba/jJvcE+kN
3212
+ b7gu3GduyYsRtYQUigAZcIN5kZeR1BonvzceMgfYFGM8KEyvAgMBAAGjYzBhMA4GA1UdDwEB/wQE
3213
+ AwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSubAWjkxPioufi1xzWx/B/yGdToDAfBgNV
3214
+ HSMEGDAWgBSubAWjkxPioufi1xzWx/B/yGdToDANBgkqhkiG9w0BAQwFAAOCAgEAgyXt6NH9lVLN
3215
+ nsAEoJFp5lzQhN7craJP6Ed41mWYqVuoPId8AorRbrcWc+ZfwFSY1XS+wc3iEZGtIxg93eFyRJa0
3216
+ lV7Ae46ZeBZDE1ZXs6KzO7V33EByrKPrmzU+sQghoefEQzd5Mr6155wsTLxDKZmOMNOsIeDjHfrY
3217
+ BzN2VAAiKrlNIC5waNrlU/yDXNOd8v9EDERm8tLjvUYAGm0CuiVdjaExUd1URhxN25mW7xocBFym
3218
+ Fe944Hn+Xds+qkxV/ZoVqW/hpvvfcDDpw+5CRu3CkwWJ+n1jez/QcYF8AOiYrg54NMMl+68KnyBr
3219
+ 3TsTjxKM4kEaSHpzoHdpx7Zcf4LIHv5YGygrqGytXm3ABdJ7t+uA/iU3/gKbaKxCXcPu9czc8FB1
3220
+ 0jZpnOZ7BN9uBmm23goJSFmH63sUYHpkqmlD75HHTOwY3WzvUy2MmeFe8nI+z1TIvWfspA9MRf/T
3221
+ uTAjB0yPEL+GltmZWrSZVxykzLsViVO6LAUP5MSeGbEYNNVMnbrt9x+vJJUEeKgDu+6B5dpffItK
3222
+ oZB0JaezPkvILFa9x8jvOOJckvB595yEunQtYQEgfn7R8k8HWV+LLUNS60YMlOH1Zkd5d9VUWx+t
3223
+ JDfLRVpOoERIyNiwmcUVhAn21klJwGW45hpxbqCo8YLoRT5s1gLXCmeDBVrJpBA=
3224
+ -----END CERTIFICATE-----
3225
+
3226
+ OISTE WISeKey Global Root GC CA
3227
+ ===============================
3228
+ -----BEGIN CERTIFICATE-----
3229
+ MIICaTCCAe+gAwIBAgIQISpWDK7aDKtARb8roi066jAKBggqhkjOPQQDAzBtMQswCQYDVQQGEwJD
3230
+ SDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNlZDEo
3231
+ MCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwgUm9vdCBHQyBDQTAeFw0xNzA1MDkwOTQ4MzRa
3232
+ Fw00MjA1MDkwOTU4MzNaMG0xCzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYDVQQL
3233
+ ExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEdsb2Jh
3234
+ bCBSb290IEdDIENBMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAETOlQwMYPchi82PG6s4nieUqjFqdr
3235
+ VCTbUf/q9Akkwwsin8tqJ4KBDdLArzHkdIJuyiXZjHWd8dvQmqJLIX4Wp2OQ0jnUsYd4XxiWD1Ab
3236
+ NTcPasbc2RNNpI6QN+a9WzGRo1QwUjAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAd
3237
+ BgNVHQ4EFgQUSIcUrOPDnpBgOtfKie7TrYy0UGYwEAYJKwYBBAGCNxUBBAMCAQAwCgYIKoZIzj0E
3238
+ AwMDaAAwZQIwJsdpW9zV57LnyAyMjMPdeYwbY9XJUpROTYJKcx6ygISpJcBMWm1JKWB4E+J+SOtk
3239
+ AjEA2zQgMgj/mkkCtojeFK9dbJlxjRo/i9fgojaGHAeCOnZT/cKi7e97sIBPWA9LUzm9
3240
+ -----END CERTIFICATE-----
src/common/lib/vendor/composer/installed.json CHANGED
@@ -271,64 +271,6 @@
271
  "portable"
272
  ]
273
  },
274
- {
275
- "name": "composer/ca-bundle",
276
- "version": "1.1.2",
277
- "version_normalized": "1.1.2.0",
278
- "source": {
279
- "type": "git",
280
- "url": "https://github.com/composer/ca-bundle.git",
281
- "reference": "46afded9720f40b9dc63542af4e3e43a1177acb0"
282
- },
283
- "dist": {
284
- "type": "zip",
285
- "url": "https://api.github.com/repos/composer/ca-bundle/zipball/46afded9720f40b9dc63542af4e3e43a1177acb0",
286
- "reference": "46afded9720f40b9dc63542af4e3e43a1177acb0",
287
- "shasum": ""
288
- },
289
- "require": {
290
- "ext-openssl": "*",
291
- "ext-pcre": "*",
292
- "php": "^5.3.2 || ^7.0"
293
- },
294
- "require-dev": {
295
- "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5",
296
- "psr/log": "^1.0",
297
- "symfony/process": "^2.5 || ^3.0 || ^4.0"
298
- },
299
- "time": "2018-08-08T08:57:40+00:00",
300
- "type": "library",
301
- "extra": {
302
- "branch-alias": {
303
- "dev-master": "1.x-dev"
304
- }
305
- },
306
- "installation-source": "dist",
307
- "autoload": {
308
- "psr-4": {
309
- "Composer\\CaBundle\\": "src"
310
- }
311
- },
312
- "notification-url": "https://packagist.org/downloads/",
313
- "license": [
314
- "MIT"
315
- ],
316
- "authors": [
317
- {
318
- "name": "Jordi Boggiano",
319
- "email": "j.boggiano@seld.be",
320
- "homepage": "http://seld.be"
321
- }
322
- ],
323
- "description": "Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.",
324
- "keywords": [
325
- "cabundle",
326
- "cacert",
327
- "certificate",
328
- "ssl",
329
- "tls"
330
- ]
331
- },
332
  {
333
  "name": "maxmind/web-service-common",
334
  "version": "v0.5.0",
@@ -489,19 +431,76 @@
489
  "maxmind"
490
  ]
491
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
492
  {
493
  "name": "symfony/translation",
494
- "version": "v2.8.45",
495
- "version_normalized": "2.8.45.0",
496
  "source": {
497
  "type": "git",
498
  "url": "https://github.com/symfony/translation.git",
499
- "reference": "12ad0a708ec55fb80cac9e809c5b56ddd5417d6a"
500
  },
501
  "dist": {
502
  "type": "zip",
503
- "url": "https://api.github.com/repos/symfony/translation/zipball/12ad0a708ec55fb80cac9e809c5b56ddd5417d6a",
504
- "reference": "12ad0a708ec55fb80cac9e809c5b56ddd5417d6a",
505
  "shasum": ""
506
  },
507
  "require": {
@@ -522,7 +521,7 @@
522
  "symfony/config": "",
523
  "symfony/yaml": ""
524
  },
525
- "time": "2018-07-26T11:13:39+00:00",
526
  "type": "library",
527
  "extra": {
528
  "branch-alias": {
@@ -556,41 +555,41 @@
556
  "homepage": "https://symfony.com"
557
  },
558
  {
559
- "name": "nesbot/carbon",
560
- "version": "1.34.0",
561
- "version_normalized": "1.34.0.0",
562
  "source": {
563
  "type": "git",
564
- "url": "https://github.com/briannesbitt/Carbon.git",
565
- "reference": "1dbd3cb01c5645f3e7deda7aa46ef780d95fcc33"
566
  },
567
  "dist": {
568
  "type": "zip",
569
- "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/1dbd3cb01c5645f3e7deda7aa46ef780d95fcc33",
570
- "reference": "1dbd3cb01c5645f3e7deda7aa46ef780d95fcc33",
571
  "shasum": ""
572
  },
573
  "require": {
574
- "php": ">=5.3.9",
575
- "symfony/translation": "~2.6 || ~3.0 || ~4.0"
 
576
  },
577
  "require-dev": {
578
- "friendsofphp/php-cs-fixer": "~2",
579
- "phpunit/phpunit": "^4.8.35 || ^5.7"
 
580
  },
581
- "time": "2018-09-20T19:36:25+00:00",
582
  "type": "library",
583
  "extra": {
584
- "laravel": {
585
- "providers": [
586
- "Carbon\\Laravel\\ServiceProvider"
587
- ]
588
  }
589
  },
590
  "installation-source": "dist",
591
  "autoload": {
592
  "psr-4": {
593
- "": "src/"
594
  }
595
  },
596
  "notification-url": "https://packagist.org/downloads/",
@@ -599,17 +598,18 @@
599
  ],
600
  "authors": [
601
  {
602
- "name": "Brian Nesbitt",
603
- "email": "brian@nesbot.com",
604
- "homepage": "http://nesbot.com"
605
  }
606
  ],
607
- "description": "A simple API extension for DateTime.",
608
- "homepage": "http://carbon.nesbot.com",
609
  "keywords": [
610
- "date",
611
- "datetime",
612
- "time"
 
 
613
  ]
614
  }
615
  ]
271
  "portable"
272
  ]
273
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
274
  {
275
  "name": "maxmind/web-service-common",
276
  "version": "v0.5.0",
431
  "maxmind"
432
  ]
433
  },
434
+ {
435
+ "name": "nesbot/carbon",
436
+ "version": "1.34.0",
437
+ "version_normalized": "1.34.0.0",
438
+ "source": {
439
+ "type": "git",
440
+ "url": "https://github.com/briannesbitt/Carbon.git",
441
+ "reference": "1dbd3cb01c5645f3e7deda7aa46ef780d95fcc33"
442
+ },
443
+ "dist": {
444
+ "type": "zip",
445
+ "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/1dbd3cb01c5645f3e7deda7aa46ef780d95fcc33",
446
+ "reference": "1dbd3cb01c5645f3e7deda7aa46ef780d95fcc33",
447
+ "shasum": ""
448
+ },
449
+ "require": {
450
+ "php": ">=5.3.9",
451
+ "symfony/translation": "~2.6 || ~3.0 || ~4.0"
452
+ },
453
+ "require-dev": {
454
+ "friendsofphp/php-cs-fixer": "~2",
455
+ "phpunit/phpunit": "^4.8.35 || ^5.7"
456
+ },
457
+ "time": "2018-09-20T19:36:25+00:00",
458
+ "type": "library",
459
+ "extra": {
460
+ "laravel": {
461
+ "providers": [
462
+ "Carbon\\Laravel\\ServiceProvider"
463
+ ]
464
+ }
465
+ },
466
+ "installation-source": "dist",
467
+ "autoload": {
468
+ "psr-4": {
469
+ "": "src/"
470
+ }
471
+ },
472
+ "notification-url": "https://packagist.org/downloads/",
473
+ "license": [
474
+ "MIT"
475
+ ],
476
+ "authors": [
477
+ {
478
+ "name": "Brian Nesbitt",
479
+ "email": "brian@nesbot.com",
480
+ "homepage": "http://nesbot.com"
481
+ }
482
+ ],
483
+ "description": "A simple API extension for DateTime.",
484
+ "homepage": "http://carbon.nesbot.com",
485
+ "keywords": [
486
+ "date",
487
+ "datetime",
488
+ "time"
489
+ ]
490
+ },
491
  {
492
  "name": "symfony/translation",
493
+ "version": "v2.8.46",
494
+ "version_normalized": "2.8.46.0",
495
  "source": {
496
  "type": "git",
497
  "url": "https://github.com/symfony/translation.git",
498
+ "reference": "59b4debd89c156fd753343fcc1ca36aa5bc2d0f4"
499
  },
500
  "dist": {
501
  "type": "zip",
502
+ "url": "https://api.github.com/repos/symfony/translation/zipball/59b4debd89c156fd753343fcc1ca36aa5bc2d0f4",
503
+ "reference": "59b4debd89c156fd753343fcc1ca36aa5bc2d0f4",
504
  "shasum": ""
505
  },
506
  "require": {
521
  "symfony/config": "",
522
  "symfony/yaml": ""
523
  },
524
+ "time": "2018-09-21T12:46:38+00:00",
525
  "type": "library",
526
  "extra": {
527
  "branch-alias": {
555
  "homepage": "https://symfony.com"
556
  },
557
  {
558
+ "name": "composer/ca-bundle",
559
+ "version": "1.1.3",
560
+ "version_normalized": "1.1.3.0",
561
  "source": {
562
  "type": "git",
563
+ "url": "https://github.com/composer/ca-bundle.git",
564
+ "reference": "8afa52cd417f4ec417b4bfe86b68106538a87660"
565
  },
566
  "dist": {
567
  "type": "zip",
568
+ "url": "https://api.github.com/repos/composer/ca-bundle/zipball/8afa52cd417f4ec417b4bfe86b68106538a87660",
569
+ "reference": "8afa52cd417f4ec417b4bfe86b68106538a87660",
570
  "shasum": ""
571
  },
572
  "require": {
573
+ "ext-openssl": "*",
574
+ "ext-pcre": "*",
575
+ "php": "^5.3.2 || ^7.0"
576
  },
577
  "require-dev": {
578
+ "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5",
579
+ "psr/log": "^1.0",
580
+ "symfony/process": "^2.5 || ^3.0 || ^4.0"
581
  },
582
+ "time": "2018-10-18T06:09:13+00:00",
583
  "type": "library",
584
  "extra": {
585
+ "branch-alias": {
586
+ "dev-master": "1.x-dev"
 
 
587
  }
588
  },
589
  "installation-source": "dist",
590
  "autoload": {
591
  "psr-4": {
592
+ "Composer\\CaBundle\\": "src"
593
  }
594
  },
595
  "notification-url": "https://packagist.org/downloads/",
598
  ],
599
  "authors": [
600
  {
601
+ "name": "Jordi Boggiano",
602
+ "email": "j.boggiano@seld.be",
603
+ "homepage": "http://seld.be"
604
  }
605
  ],
606
+ "description": "Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.",
 
607
  "keywords": [
608
+ "cabundle",
609
+ "cacert",
610
+ "certificate",
611
+ "ssl",
612
+ "tls"
613
  ]
614
  }
615
  ]
src/common/lib/vendor/symfony/translation/Catalogue/AbstractOperation.php CHANGED
@@ -37,21 +37,20 @@ abstract class AbstractOperation implements OperationInterface
37
  * This array stores 'all', 'new' and 'obsolete' messages for all valid domains.
38
  *
39
  * The data structure of this array is as follows:
40
- * ```php
41
- * array(
42
- * 'domain 1' => array(
43
- * 'all' => array(...),
44
- * 'new' => array(...),
45
- * 'obsolete' => array(...)
46
- * ),
47
- * 'domain 2' => array(
48
- * 'all' => array(...),
49
- * 'new' => array(...),
50
- * 'obsolete' => array(...)
51
- * ),
52
- * ...
53
- * )
54
- * ```
55
  *
56
  * @var array The array that stores 'all', 'new' and 'obsolete' messages
57
  */
37
  * This array stores 'all', 'new' and 'obsolete' messages for all valid domains.
38
  *
39
  * The data structure of this array is as follows:
40
+ *
41
+ * array(
42
+ * 'domain 1' => array(
43
+ * 'all' => array(...),
44
+ * 'new' => array(...),
45
+ * 'obsolete' => array(...)
46
+ * ),
47
+ * 'domain 2' => array(
48
+ * 'all' => array(...),
49
+ * 'new' => array(...),
50
+ * 'obsolete' => array(...)
51
+ * ),
52
+ * ...
53
+ * )
 
54
  *
55
  * @var array The array that stores 'all', 'new' and 'obsolete' messages
56
  */
src/common/lib/vendor/symfony/translation/Dumper/CsvFileDumper.php CHANGED
@@ -38,7 +38,7 @@ class CsvFileDumper extends FileDumper
38
  */
39
  public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = array())
40
  {
41
- $handle = fopen('php://memory', 'rb+');
42
 
43
  foreach ($messages->all($domain) as $source => $target) {
44
  fputcsv($handle, array($source, $target), $this->delimiter, $this->enclosure);
38
  */
39
  public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = array())
40
  {
41
+ $handle = fopen('php://memory', 'r+b');
42
 
43
  foreach ($messages->all($domain) as $source => $target) {
44
  fputcsv($handle, array($source, $target), $this->delimiter, $this->enclosure);
src/common/wp-admin-notices.php CHANGED
@@ -46,7 +46,7 @@ class ICWP_WPSF_WpAdminNotices extends ICWP_WPSF_Foundation {
46
  * @return array
47
  */
48
  public function handleAuthAjax( $aAjaxResponse ) {
49
- if ( empty( $aAjaxResponse ) && $this->loadDP()->request( 'exec' ) === 'dismiss_admin_notice' ) {
50
  $aAjaxResponse = $this->ajaxExec_DismissAdminNotice();
51
  }
52
  return $aAjaxResponse;
@@ -57,7 +57,7 @@ class ICWP_WPSF_WpAdminNotices extends ICWP_WPSF_Foundation {
57
  */
58
  protected function ajaxExec_DismissAdminNotice() {
59
  // Get all notices and if this notice exists, we set it to "hidden"
60
- $sNoticeId = sanitize_key( $this->loadDP()->query( 'notice_id', '' ) );
61
  $aNotices = apply_filters( $this->getPrefix().'register_admin_notices', array() );
62
  if ( !empty( $sNoticeId ) && array_key_exists( $sNoticeId, $aNotices ) ) {
63
  $this->setMeta( $aNotices[ $sNoticeId ][ 'id' ] );
@@ -117,7 +117,7 @@ class ICWP_WPSF_WpAdminNotices extends ICWP_WPSF_Foundation {
117
 
118
  $oMeta = $this->getCurrentUserMeta();
119
  $sCleanNotice = 'notice_'.str_replace( array( '-', '_' ), '', $sNoticeId );
120
- $oMeta->{$sCleanNotice} = array_merge( array( 'time' => $this->loadDP()->time() ), $aMeta );
121
  return;
122
  }
123
 
@@ -212,7 +212,7 @@ class ICWP_WPSF_WpAdminNotices extends ICWP_WPSF_Foundation {
212
  if ( $this->loadWpUsers()->isUserLoggedIn() ) {
213
  $this->getCurrentUserMeta()->flash_msg = ( $bError ? 'error' : 'updated' )
214
  .'::'.sanitize_text_field( $sMessage )
215
- .'::'.( $this->loadDP()->time() + 300 );
216
  }
217
  return $this;
218
  }
@@ -221,7 +221,7 @@ class ICWP_WPSF_WpAdminNotices extends ICWP_WPSF_Foundation {
221
  $this->flushFlash();
222
  if ( $this->hasFlash() ) {
223
  $aParts = $this->getFlashParts();
224
- if ( empty( $aParts[ 2 ] ) || $this->loadDP()->time() < $aParts[ 2 ] ) {
225
  echo $this->wrapAdminNoticeHtml( '<p>'.$aParts[ 1 ].'</p>', $aParts[ 0 ] );
226
  }
227
  }
46
  * @return array
47
  */
48
  public function handleAuthAjax( $aAjaxResponse ) {
49
+ if ( empty( $aAjaxResponse ) && $this->loadRequest()->request( 'exec' ) === 'dismiss_admin_notice' ) {
50
  $aAjaxResponse = $this->ajaxExec_DismissAdminNotice();
51
  }
52
  return $aAjaxResponse;
57
  */
58
  protected function ajaxExec_DismissAdminNotice() {
59
  // Get all notices and if this notice exists, we set it to "hidden"
60
+ $sNoticeId = sanitize_key( $this->loadRequest()->query( 'notice_id', '' ) );
61
  $aNotices = apply_filters( $this->getPrefix().'register_admin_notices', array() );
62
  if ( !empty( $sNoticeId ) && array_key_exists( $sNoticeId, $aNotices ) ) {
63
  $this->setMeta( $aNotices[ $sNoticeId ][ 'id' ] );
117
 
118
  $oMeta = $this->getCurrentUserMeta();
119
  $sCleanNotice = 'notice_'.str_replace( array( '-', '_' ), '', $sNoticeId );
120
+ $oMeta->{$sCleanNotice} = array_merge( array( 'time' => $this->loadRequest()->ts() ), $aMeta );
121
  return;
122
  }
123
 
212
  if ( $this->loadWpUsers()->isUserLoggedIn() ) {
213
  $this->getCurrentUserMeta()->flash_msg = ( $bError ? 'error' : 'updated' )
214
  .'::'.sanitize_text_field( $sMessage )
215
+ .'::'.( $this->loadRequest()->ts() + 300 );
216
  }
217
  return $this;
218
  }
221
  $this->flushFlash();
222
  if ( $this->hasFlash() ) {
223
  $aParts = $this->getFlashParts();
224
+ if ( empty( $aParts[ 2 ] ) || $this->loadRequest()->ts() < $aParts[ 2 ] ) {
225
  echo $this->wrapAdminNoticeHtml( '<p>'.$aParts[ 1 ].'</p>', $aParts[ 0 ] );
226
  }
227
  }
src/common/wp-comments.php CHANGED
@@ -80,6 +80,6 @@ class ICWP_WPSF_WpComments extends ICWP_WPSF_Foundation {
80
  * @return bool
81
  */
82
  public function isCommentPost() {
83
- return $this->loadDP()->isMethodPost() && $this->loadWp()->isCurrentPage( 'wp-comments-post.php' );
84
  }
85
  }
80
  * @return bool
81
  */
82
  public function isCommentPost() {
83
+ return $this->loadRequest()->isMethodPost() && $this->loadWp()->isCurrentPage( 'wp-comments-post.php' );
84
  }
85
  }
src/config/feature-firewall.php CHANGED
@@ -293,6 +293,7 @@
293
  "comment"
294
  ],
295
  "*": [
 
296
  "g-recaptcha-response",
297
  "verify_sign",
298
  "txn_id",
293
  "comment"
294
  ],
295
  "*": [
296
+ "ajaxurl",
297
  "g-recaptcha-response",
298
  "verify_sign",
299
  "txn_id",
src/config/feature-login_protect.php CHANGED
@@ -337,6 +337,32 @@
337
  "summary": "Enable Google reCAPTCHA",
338
  "description": "Use Google reCAPTCHA on the login screen."
339
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
340
  {
341
  "key": "enable_yubikey",
342
  "section": "section_yubikey_authentication",
337
  "summary": "Enable Google reCAPTCHA",
338
  "description": "Use Google reCAPTCHA on the login screen."
339
  },
340
+ {
341
+ "key": "enable_antibot_js",
342
+ "section": "section_brute_force_login_protection",
343
+ "premium": true,
344
+ "default": "N",
345
+ "type": "checkbox",
346
+ "link_info": "https://icwp.io/di",
347
+ "link_blog": "",
348
+ "name": "AntiBot JS",
349
+ "summary": "Load Anti-Bot JS For 3rd Party Login Forms",
350
+ "description": "Important: This is experimental. Please contact support for further assistance."
351
+ },
352
+ {
353
+ "key": "antibot_form_ids",
354
+ "section": "section_brute_force_login_protection",
355
+ "type": "array",
356
+ "default": [
357
+ "ihc_login_form",
358
+ "createuser"
359
+ ],
360
+ "link_info": "",
361
+ "link_blog": "",
362
+ "name": "AntiBot Forms",
363
+ "summary": "Enter The IDs Of The 3rd Party Login Forms For Use With AntiBot JS",
364
+ "description": "For Use With AnitBot JS (above)."
365
+ },
366
  {
367
  "key": "enable_yubikey",
368
  "section": "section_yubikey_authentication",
src/features/admin_access_restriction.php CHANGED
@@ -26,7 +26,7 @@ class ICWP_WPSF_FeatureHandler_AdminAccessRestriction extends ICWP_WPSF_FeatureH
26
  public function handleAuthAjax( $aAjaxResponse ) {
27
 
28
  if ( empty( $aAjaxResponse ) ) {
29
- switch ( $this->loadDP()->request( 'exec' ) ) {
30
 
31
  case 'sec_admin_check':
32
  $aAjaxResponse = $this->ajaxExec_SecAdminCheck();
@@ -133,7 +133,7 @@ class ICWP_WPSF_FeatureHandler_AdminAccessRestriction extends ICWP_WPSF_FeatureH
133
  return $this->getOpt( 'admin_access_key' );
134
  }
135
 
136
- /** TODO
137
  * @return bool
138
  */
139
  public function getAdminAccessArea_Options() {
@@ -269,7 +269,7 @@ class ICWP_WPSF_FeatureHandler_AdminAccessRestriction extends ICWP_WPSF_FeatureH
269
  public function getSecAdminTimeLeft() {
270
  $nLeft = 0;
271
  if ( $this->isReadyToExecute() && $this->hasSession() ) {
272
- $nLeft = $this->getSecAdminTimeout() - ( $this->loadDP()->time() - $this->getSession()->getSecAdminAt() );
273
  }
274
  return max( 0, $nLeft );
275
  }
@@ -296,7 +296,7 @@ class ICWP_WPSF_FeatureHandler_AdminAccessRestriction extends ICWP_WPSF_FeatureH
296
  * @return bool
297
  */
298
  protected function checkAdminAccessKeySubmission() {
299
- $sAccessKeyRequest = $this->loadDP()->post( 'admin_access_key_request', '' );
300
  $bSuccess = $this->verifyAccessKey( $sAccessKeyRequest );
301
  if ( !$bSuccess && !empty( $sAccessKeyRequest ) ) {
302
  add_filter( $this->prefix( 'ip_black_mark' ), '__return_true' );
@@ -308,7 +308,7 @@ class ICWP_WPSF_FeatureHandler_AdminAccessRestriction extends ICWP_WPSF_FeatureH
308
  * @return bool
309
  */
310
  protected function isAccessKeyRequest() {
311
- return strlen( $this->loadDP()->post( 'admin_access_key_request', '' ) ) > 0;
312
  }
313
 
314
  /**
26
  public function handleAuthAjax( $aAjaxResponse ) {
27
 
28
  if ( empty( $aAjaxResponse ) ) {
29
+ switch ( $this->loadRequest()->request( 'exec' ) ) {
30
 
31
  case 'sec_admin_check':
32
  $aAjaxResponse = $this->ajaxExec_SecAdminCheck();
133
  return $this->getOpt( 'admin_access_key' );
134
  }
135
 
136
+ /**
137
  * @return bool
138
  */
139
  public function getAdminAccessArea_Options() {
269
  public function getSecAdminTimeLeft() {
270
  $nLeft = 0;
271
  if ( $this->isReadyToExecute() && $this->hasSession() ) {
272
+ $nLeft = $this->getSecAdminTimeout() - ( $this->loadRequest()->ts() - $this->getSession()->getSecAdminAt() );
273
  }
274
  return max( 0, $nLeft );
275
  }
296
  * @return bool
297
  */
298
  protected function checkAdminAccessKeySubmission() {
299
+ $sAccessKeyRequest = $this->loadRequest()->post( 'admin_access_key_request', '' );
300
  $bSuccess = $this->verifyAccessKey( $sAccessKeyRequest );
301
  if ( !$bSuccess && !empty( $sAccessKeyRequest ) ) {
302
  add_filter( $this->prefix( 'ip_black_mark' ), '__return_true' );
308
  * @return bool
309
  */
310
  protected function isAccessKeyRequest() {
311
+ return strlen( $this->loadRequest()->post( 'admin_access_key_request', '' ) ) > 0;
312
  }
313
 
314
  /**
src/features/audit_trail.php CHANGED
@@ -21,7 +21,7 @@ class ICWP_WPSF_FeatureHandler_AuditTrail extends ICWP_WPSF_FeatureHandler_BaseW
21
  public function handleAuthAjax( $aAjaxResponse ) {
22
 
23
  if ( empty( $aAjaxResponse ) ) {
24
- switch ( $this->loadDP()->request( 'exec' ) ) {
25
 
26
  case 'render_audit_table':
27
  $aAjaxResponse = $this->ajaxExec_RenderAuditTable();
@@ -35,7 +35,7 @@ class ICWP_WPSF_FeatureHandler_AuditTrail extends ICWP_WPSF_FeatureHandler_BaseW
35
  }
36
 
37
  public function ajaxExec_RenderAuditTable() {
38
- $sContext = $this->loadDP()->post( 'auditcontext' );
39
  $aParams = array_intersect_key( $_POST, array_flip( array( 'paged', 'order', 'orderby' ) ) );
40
  return array(
41
  'success' => true,
21
  public function handleAuthAjax( $aAjaxResponse ) {
22
 
23
  if ( empty( $aAjaxResponse ) ) {
24
+ switch ( $this->loadRequest()->request( 'exec' ) ) {
25
 
26
  case 'render_audit_table':
27
  $aAjaxResponse = $this->ajaxExec_RenderAuditTable();
35
  }
36
 
37
  public function ajaxExec_RenderAuditTable() {
38
+ $sContext = $this->loadRequest()->post( 'auditcontext' );
39
  $aParams = array_intersect_key( $_POST, array_flip( array( 'paged', 'order', 'orderby' ) ) );
40
  return array(
41
  'success' => true,
src/features/autoupdates.php CHANGED
@@ -10,7 +10,7 @@ class ICWP_WPSF_FeatureHandler_Autoupdates extends ICWP_WPSF_FeatureHandler_Base
10
 
11
  protected function doPostConstruction() {
12
  // Force run automatic updates
13
- if ( $this->loadDP()->query( 'force_run_auto_updates' ) == 'now' ) {
14
  add_filter( $this->prefix( 'force_autoupdate' ), '__return_true' );
15
  }
16
  }
@@ -109,7 +109,7 @@ class ICWP_WPSF_FeatureHandler_Autoupdates extends ICWP_WPSF_FeatureHandler_Base
109
  public function handleAuthAjax( $aAjaxResponse ) {
110
 
111
  if ( empty( $aAjaxResponse ) ) {
112
- switch ( $this->loadDP()->request( 'exec' ) ) {
113
 
114
  case 'toggle_plugin_autoupdate':
115
  if ( $this->isAutoupdateIndividualPlugins() && $this->getConn()->isValidAdminArea() ) {
@@ -132,7 +132,7 @@ class ICWP_WPSF_FeatureHandler_Autoupdates extends ICWP_WPSF_FeatureHandler_Base
132
  $bSuccess = false;
133
 
134
  $oWpPlugins = $this->loadWpPlugins();
135
- $sFile = $this->loadDP()->post( 'pluginfile' );
136
  if ( $oWpPlugins->isInstalled( $sFile ) ) {
137
  $this->setPluginToAutoUpdate( $sFile );
138
 
10
 
11
  protected function doPostConstruction() {
12
  // Force run automatic updates
13
+ if ( $this->loadRequest()->query( 'force_run_auto_updates' ) == 'now' ) {
14
  add_filter( $this->prefix( 'force_autoupdate' ), '__return_true' );
15
  }
16
  }
109
  public function handleAuthAjax( $aAjaxResponse ) {
110
 
111
  if ( empty( $aAjaxResponse ) ) {
112
+ switch ( $this->loadRequest()->request( 'exec' ) ) {
113
 
114
  case 'toggle_plugin_autoupdate':
115
  if ( $this->isAutoupdateIndividualPlugins() && $this->getConn()->isValidAdminArea() ) {
132
  $bSuccess = false;
133
 
134
  $oWpPlugins = $this->loadWpPlugins();
135
+ $sFile = $this->loadRequest()->post( 'pluginfile' );
136
  if ( $oWpPlugins->isInstalled( $sFile ) ) {
137
  $this->setPluginToAutoUpdate( $sFile );
138
 
src/features/base.php CHANGED
@@ -127,7 +127,8 @@ abstract class ICWP_WPSF_FeatureHandler_Base extends ICWP_WPSF_Foundation {
127
  add_filter( $this->prefix( 'register_admin_notices' ), array( $this, 'fRegisterAdminNotices' ) );
128
  add_filter( $this->prefix( 'gather_options_for_export' ), array( $this, 'exportTransferableOptions' ) );
129
 
130
- add_action( 'admin_enqueue_scripts', array( $this, 'insertCustomJsVars' ), 100 );
 
131
 
132
  if ( $this->isAdminOptionsPage() ) {
133
  // add_action( 'current_screen', array( $this, 'onSetCurrentScreen' ) );
@@ -166,7 +167,7 @@ abstract class ICWP_WPSF_FeatureHandler_Base extends ICWP_WPSF_Foundation {
166
  public function handleAuthAjax( $aAjaxResponse ) {
167
 
168
  if ( empty( $aAjaxResponse ) ) {
169
- switch ( $this->loadDP()->request( 'exec' ) ) {
170
 
171
  case 'mod_options':
172
  $aAjaxResponse = $this->ajaxExec_ModOptions();
@@ -295,7 +296,7 @@ abstract class ICWP_WPSF_FeatureHandler_Base extends ICWP_WPSF_Foundation {
295
  */
296
  protected function importOptions() {
297
  // So we don't poll for the file every page load.
298
- if ( $this->loadDP()->query( 'icwp_shield_import' ) == 1 ) {
299
  $aOptions = self::getConn()->getOptionsImportFromFile();
300
  if ( !empty( $aOptions ) && is_array( $aOptions ) && array_key_exists( $this->getOptionsStorageKey(), $aOptions ) ) {
301
  $this->getOptionsVo()->setMultipleOptions( $aOptions[ $this->getOptionsStorageKey() ] );
@@ -829,7 +830,7 @@ abstract class ICWP_WPSF_FeatureHandler_Base extends ICWP_WPSF_Foundation {
829
  * @return bool
830
  */
831
  protected function isModuleRequest() {
832
- return ( $this->getModSlug() == $this->loadDP()->request( 'mod_slug' ) );
833
  }
834
 
835
  /**
@@ -1243,15 +1244,15 @@ abstract class ICWP_WPSF_FeatureHandler_Base extends ICWP_WPSF_Foundation {
1243
  * @throws Exception
1244
  */
1245
  protected function updatePluginOptionsFromSubmit() {
1246
- $oDp = $this->loadDP();
1247
 
1248
- if ( $oDp->post( 'plugin_form_submit' ) !== 'Y' ) {
1249
  return;
1250
  }
1251
 
1252
  foreach ( $this->getAllFormOptionsAndTypes() as $sOptionKey => $sOptionType ) {
1253
 
1254
- $sOptionValue = $oDp->post( $sOptionKey );
1255
  if ( is_null( $sOptionValue ) ) {
1256
 
1257
  if ( $sOptionType == 'text' || $sOptionType == 'email' ) { //if it was a text box, and it's null, don't update anything
@@ -1281,7 +1282,7 @@ abstract class ICWP_WPSF_FeatureHandler_Base extends ICWP_WPSF_Foundation {
1281
  continue;
1282
  }
1283
 
1284
- $sConfirm = trim( (string)$oDp->post( $sOptionKey.'_confirm', '' ) );
1285
  if ( $sTempValue !== $sConfirm ) {
1286
  throw new Exception( _wpsf__( 'Password values do not match.' ) );
1287
  }
@@ -1292,7 +1293,7 @@ abstract class ICWP_WPSF_FeatureHandler_Base extends ICWP_WPSF_Foundation {
1292
  $sOptionValue = array_filter( explode( "\n", esc_textarea( $sOptionValue ) ), 'trim' );
1293
  }
1294
  else if ( $sOptionType == 'comma_separated_lists' ) {
1295
- $sOptionValue = $oDp->extractCommaSeparatedList( $sOptionValue );
1296
  }
1297
  else if ( $sOptionType == 'multiple_select' ) {
1298
  }
@@ -1309,7 +1310,7 @@ abstract class ICWP_WPSF_FeatureHandler_Base extends ICWP_WPSF_Foundation {
1309
  // only use this flag when the options are being updated with a MANUAL save.
1310
  if ( isset( $this->bImportExportWhitelistNotify ) && $this->bImportExportWhitelistNotify ) {
1311
  if ( !wp_next_scheduled( $this->prefix( 'importexport_notify' ) ) ) {
1312
- wp_schedule_single_event( $this->loadDP()->time() + 15, $this->prefix( 'importexport_notify' ) );
1313
  }
1314
  }
1315
  }
@@ -1336,28 +1337,28 @@ abstract class ICWP_WPSF_FeatureHandler_Base extends ICWP_WPSF_Foundation {
1336
  * @return bool
1337
  */
1338
  protected function isModulePage() {
1339
- return strpos( $this->loadDP()->query( 'page' ), $this->prefix() ) === 0;
1340
  }
1341
 
1342
  /**
1343
  * @return bool
1344
  */
1345
  protected function isThisModulePage() {
1346
- return $this->loadDP()->query( 'page' ) == $this->getModSlug();
1347
  }
1348
 
1349
  /**
1350
  * @return bool
1351
  */
1352
  protected function isModuleOptionsRequest() {
1353
- return $this->loadDP()->post( 'mod_slug' ) === $this->getModSlug();
1354
  }
1355
 
1356
  /**
1357
  * @return bool
1358
  */
1359
  protected function isWizardPage() {
1360
- return ( $this->loadDP()->query( 'shield_action' ) == 'wizard' && $this->isThisModulePage() );
1361
  }
1362
 
1363
  /**
@@ -1717,10 +1718,13 @@ abstract class ICWP_WPSF_FeatureHandler_Base extends ICWP_WPSF_Foundation {
1717
  return $this->loadDP()->getPhpVersionIsAtLeast( '5.4.0' );
1718
  }
1719
 
 
 
 
1720
  /**
1721
  * Override this with custom JS vars for your particular module.
1722
  */
1723
- public function insertCustomJsVars() {
1724
  }
1725
 
1726
  /**
@@ -1986,7 +1990,7 @@ abstract class ICWP_WPSF_FeatureHandler_Base extends ICWP_WPSF_Foundation {
1986
  * @return $this
1987
  */
1988
  protected function setOptAt( $sOpt, $nAt = null ) {
1989
- return $this->setOpt( $sOpt, is_null( $nAt ) ? $this->loadDP()->time() : max( 0, (int)$nAt ) );
1990
  }
1991
 
1992
  /**
127
  add_filter( $this->prefix( 'register_admin_notices' ), array( $this, 'fRegisterAdminNotices' ) );
128
  add_filter( $this->prefix( 'gather_options_for_export' ), array( $this, 'exportTransferableOptions' ) );
129
 
130
+ add_action( 'wp_enqueue_scripts', array( $this, 'onWpEnqueueJs' ) );
131
+ add_action( 'admin_enqueue_scripts', array( $this, 'insertCustomJsVars_Admin' ), 100 );
132
 
133
  if ( $this->isAdminOptionsPage() ) {
134
  // add_action( 'current_screen', array( $this, 'onSetCurrentScreen' ) );
167
  public function handleAuthAjax( $aAjaxResponse ) {
168
 
169
  if ( empty( $aAjaxResponse ) ) {
170
+ switch ( $this->loadRequest()->request( 'exec' ) ) {
171
 
172
  case 'mod_options':
173
  $aAjaxResponse = $this->ajaxExec_ModOptions();
296
  */
297
  protected function importOptions() {
298
  // So we don't poll for the file every page load.
299
+ if ( $this->loadRequest()->query( 'icwp_shield_import' ) == 1 ) {
300
  $aOptions = self::getConn()->getOptionsImportFromFile();
301
  if ( !empty( $aOptions ) && is_array( $aOptions ) && array_key_exists( $this->getOptionsStorageKey(), $aOptions ) ) {
302
  $this->getOptionsVo()->setMultipleOptions( $aOptions[ $this->getOptionsStorageKey() ] );
830
  * @return bool
831
  */
832
  protected function isModuleRequest() {
833
+ return ( $this->getModSlug() == $this->loadRequest()->request( 'mod_slug' ) );
834
  }
835
 
836
  /**
1244
  * @throws Exception
1245
  */
1246
  protected function updatePluginOptionsFromSubmit() {
1247
+ $oReq = $this->loadRequest();
1248
 
1249
+ if ( $oReq->post( 'plugin_form_submit' ) !== 'Y' ) {
1250
  return;
1251
  }
1252
 
1253
  foreach ( $this->getAllFormOptionsAndTypes() as $sOptionKey => $sOptionType ) {
1254
 
1255
+ $sOptionValue = $oReq->post( $sOptionKey );
1256
  if ( is_null( $sOptionValue ) ) {
1257
 
1258
  if ( $sOptionType == 'text' || $sOptionType == 'email' ) { //if it was a text box, and it's null, don't update anything
1282
  continue;
1283
  }
1284
 
1285
+ $sConfirm = $oReq->post( $sOptionKey.'_confirm', '' );
1286
  if ( $sTempValue !== $sConfirm ) {
1287
  throw new Exception( _wpsf__( 'Password values do not match.' ) );
1288
  }
1293
  $sOptionValue = array_filter( explode( "\n", esc_textarea( $sOptionValue ) ), 'trim' );
1294
  }
1295
  else if ( $sOptionType == 'comma_separated_lists' ) {
1296
+ $sOptionValue = $this->loadDP()->extractCommaSeparatedList( $sOptionValue );
1297
  }
1298
  else if ( $sOptionType == 'multiple_select' ) {
1299
  }
1310
  // only use this flag when the options are being updated with a MANUAL save.
1311
  if ( isset( $this->bImportExportWhitelistNotify ) && $this->bImportExportWhitelistNotify ) {
1312
  if ( !wp_next_scheduled( $this->prefix( 'importexport_notify' ) ) ) {
1313
+ wp_schedule_single_event( $this->loadRequest()->ts() + 15, $this->prefix( 'importexport_notify' ) );
1314
  }
1315
  }
1316
  }
1337
  * @return bool
1338
  */
1339
  protected function isModulePage() {
1340
+ return strpos( $this->loadRequest()->query( 'page' ), $this->prefix() ) === 0;
1341
  }
1342
 
1343
  /**
1344
  * @return bool
1345
  */
1346
  protected function isThisModulePage() {
1347
+ return $this->loadRequest()->query( 'page' ) == $this->getModSlug();
1348
  }
1349
 
1350
  /**
1351
  * @return bool
1352
  */
1353
  protected function isModuleOptionsRequest() {
1354
+ return $this->loadRequest()->post( 'mod_slug' ) === $this->getModSlug();
1355
  }
1356
 
1357
  /**
1358
  * @return bool
1359
  */
1360
  protected function isWizardPage() {
1361
+ return ( $this->loadRequest()->query( 'shield_action' ) == 'wizard' && $this->isThisModulePage() );
1362
  }
1363
 
1364
  /**
1718
  return $this->loadDP()->getPhpVersionIsAtLeast( '5.4.0' );
1719
  }
1720
 
1721
+ public function onWpEnqueueJs() {
1722
+ }
1723
+
1724
  /**
1725
  * Override this with custom JS vars for your particular module.
1726
  */
1727
+ public function insertCustomJsVars_Admin() {
1728
  }
1729
 
1730
  /**
1990
  * @return $this
1991
  */
1992
  protected function setOptAt( $sOpt, $nAt = null ) {
1993
+ return $this->setOpt( $sOpt, is_null( $nAt ) ? $this->loadRequest()->ts() : max( 0, (int)$nAt ) );
1994
  }
1995
 
1996
  /**
src/features/base_wpsf.php CHANGED
@@ -40,8 +40,8 @@ class ICWP_WPSF_FeatureHandler_BaseWpsf extends ICWP_WPSF_FeatureHandler_Base {
40
  return ( $this->getSession() instanceof ICWP_WPSF_SessionVO );
41
  }
42
 
43
- public function insertCustomJsVars() {
44
- parent::insertCustomJsVars();
45
 
46
  wp_localize_script(
47
  $this->prefix( 'plugin' ),
@@ -275,7 +275,7 @@ class ICWP_WPSF_FeatureHandler_BaseWpsf extends ICWP_WPSF_FeatureHandler_Base {
275
  $oSp = $this->loadServiceProviders();
276
 
277
  $sIp = $this->loadIpService()->getRequestIp();
278
- $sAgent = (string)$this->loadDP()->server( 'HTTP_USER_AGENT' );
279
  if ( empty( $sAgent ) ) {
280
  $sAgent = 'Unknown';
281
  }
40
  return ( $this->getSession() instanceof ICWP_WPSF_SessionVO );
41
  }
42
 
43
+ public function insertCustomJsVars_Admin() {
44
+ parent::insertCustomJsVars_Admin();
45
 
46
  wp_localize_script(
47
  $this->prefix( 'plugin' ),
275
  $oSp = $this->loadServiceProviders();
276
 
277
  $sIp = $this->loadIpService()->getRequestIp();
278
+ $sAgent = (string)$this->loadRequest()->server( 'HTTP_USER_AGENT' );
279
  if ( empty( $sAgent ) ) {
280
  $sAgent = 'Unknown';
281
  }
src/features/hack_protect.php CHANGED
@@ -19,7 +19,7 @@ class ICWP_WPSF_FeatureHandler_HackProtect extends ICWP_WPSF_FeatureHandler_Base
19
  public function handleAuthAjax( $aAjaxResponse ) {
20
 
21
  if ( empty( $aAjaxResponse ) ) {
22
- switch ( $this->loadDP()->request( 'exec' ) ) {
23
 
24
  case 'plugin_reinstall':
25
  $aAjaxResponse = $this->ajaxExec_PluginReinstall();
@@ -392,7 +392,7 @@ class ICWP_WPSF_FeatureHandler_HackProtect extends ICWP_WPSF_FeatureHandler_Base
392
  */
393
  public function canPtgWriteToDisk() {
394
  $bCan = (bool)$this->getOpt( 'ptg_candiskwrite' );
395
- $nNow = $this->loadDP()->time();
396
 
397
  $bLastCheckExpired = ( $nNow - $this->getOpt( 'ptg_candiskwrite_at', 0 ) ) > DAY_IN_SECONDS;
398
  if ( !$bCan && $bLastCheckExpired ) {
@@ -517,7 +517,7 @@ class ICWP_WPSF_FeatureHandler_HackProtect extends ICWP_WPSF_FeatureHandler_Base
517
  * @return $this
518
  */
519
  public function setPtgLastBuildAt( $nTime = null ) {
520
- return $this->setOpt( 'ptg_last_build_at', is_null( $nTime ) ? $this->loadDP()->time() : $nTime );
521
  }
522
 
523
  /**
@@ -532,10 +532,10 @@ class ICWP_WPSF_FeatureHandler_HackProtect extends ICWP_WPSF_FeatureHandler_Base
532
  * @return array
533
  */
534
  public function ajaxExec_PluginReinstall() {
535
- $oDP = $this->loadDP();
536
- $bReinstall = (bool)$oDP->post( 'reinstall' );
537
- $bActivate = (bool)$oDP->post( 'activate' );
538
- $sFile = sanitize_text_field( wp_unslash( $oDP->post( 'file' ) ) );
539
  $oWpP = $this->loadWpPlugins();
540
 
541
  if ( $bReinstall ) {
@@ -554,8 +554,8 @@ class ICWP_WPSF_FeatureHandler_HackProtect extends ICWP_WPSF_FeatureHandler_Base
554
  );
555
  }
556
 
557
- public function insertCustomJsVars() {
558
- parent::insertCustomJsVars();
559
 
560
  if ( $this->loadWp()->isCurrentPage( 'plugins.php' ) && $this->isPtgReinstallLinks() ) {
561
  wp_localize_script(
@@ -576,13 +576,13 @@ class ICWP_WPSF_FeatureHandler_HackProtect extends ICWP_WPSF_FeatureHandler_Base
576
  */
577
  protected function getReinstallablePlugins() {
578
  $oWPP = $this->loadWpPlugins();
579
- $aP = array();
580
- foreach ( $oWPP->getPlugins() as $sPluginFile => $aData ) {
581
- if ( $oWPP->isWpOrg( $sPluginFile ) ) {
582
- $aP[] = $sPluginFile;
583
  }
584
  }
585
- return $aP;
586
  }
587
 
588
  /**
19
  public function handleAuthAjax( $aAjaxResponse ) {
20
 
21
  if ( empty( $aAjaxResponse ) ) {
22
+ switch ( $this->loadRequest()->request( 'exec' ) ) {
23
 
24
  case 'plugin_reinstall':
25
  $aAjaxResponse = $this->ajaxExec_PluginReinstall();
392
  */
393
  public function canPtgWriteToDisk() {
394
  $bCan = (bool)$this->getOpt( 'ptg_candiskwrite' );
395
+ $nNow = $this->loadRequest()->ts();
396
 
397
  $bLastCheckExpired = ( $nNow - $this->getOpt( 'ptg_candiskwrite_at', 0 ) ) > DAY_IN_SECONDS;
398
  if ( !$bCan && $bLastCheckExpired ) {
517
  * @return $this
518
  */
519
  public function setPtgLastBuildAt( $nTime = null ) {
520
+ return $this->setOpt( 'ptg_last_build_at', is_null( $nTime ) ? $this->loadRequest()->ts() : $nTime );
521
  }
522
 
523
  /**
532
  * @return array
533
  */
534
  public function ajaxExec_PluginReinstall() {
535
+ $oReq = $this->loadRequest();
536
+ $bReinstall = (bool)$oReq->post( 'reinstall' );
537
+ $bActivate = (bool)$oReq->post( 'activate' );
538
+ $sFile = sanitize_text_field( wp_unslash( $oReq->post( 'file' ) ) );
539
  $oWpP = $this->loadWpPlugins();
540
 
541
  if ( $bReinstall ) {
554
  );
555
  }
556
 
557
+ public function insertCustomJsVars_Admin() {
558
+ parent::insertCustomJsVars_Admin();
559
 
560
  if ( $this->loadWp()->isCurrentPage( 'plugins.php' ) && $this->isPtgReinstallLinks() ) {
561
  wp_localize_script(
576
  */
577
  protected function getReinstallablePlugins() {
578
  $oWPP = $this->loadWpPlugins();
579
+ $aP = $oWPP->getInstalledBaseFiles();
580
+ foreach ( $aP as $nKey => $sPluginFile ) {
581
+ if ( !$oWPP->isWpOrg( $sPluginFile ) ) {
582
+ unset( $aP[ $nKey ] );
583
  }
584
  }
585
+ return array_values( $aP );
586
  }
587
 
588
  /**
src/features/insights.php CHANGED
@@ -62,8 +62,8 @@ class ICWP_WPSF_FeatureHandler_Insights extends ICWP_WPSF_FeatureHandler_BaseWps
62
  echo $this->renderTemplate( '/wpadmin_pages/insights/index.twig', $aData, true );
63
  }
64
 
65
- public function insertCustomJsVars() {
66
- parent::insertCustomJsVars();
67
 
68
  if ( $this->isThisModulePage() ) {
69
  wp_localize_script(
@@ -84,7 +84,7 @@ class ICWP_WPSF_FeatureHandler_Insights extends ICWP_WPSF_FeatureHandler_BaseWps
84
  public function handleAuthAjax( $aAjaxResponse ) {
85
 
86
  if ( empty( $aAjaxResponse ) ) {
87
- switch ( $this->loadDP()->request( 'exec' ) ) {
88
 
89
  case 'admin_note_new':
90
  $aAjaxResponse = $this->ajaxExec_AdminNoteNew();
@@ -109,10 +109,9 @@ class ICWP_WPSF_FeatureHandler_Insights extends ICWP_WPSF_FeatureHandler_BaseWps
109
  * @return array
110
  */
111
  protected function ajaxExec_AdminNoteNew() {
112
- $oDP = $this->loadDP();
113
  /** @var ICWP_WPSF_FeatureHandler_Plugin $oMod */
114
  $oMod = $this->getConn()->getModule( 'plugin' );
115
- $sNote = trim( $oDP->post( 'admin_note', '' ) );
116
  $bSuccess = false;
117
  if ( !$oMod->getCanAdminNotes() ) {
118
  $sMessage = _wpsf__( 'Sorry, Admin Notes is only available for Pro subscriptions.' );
@@ -139,14 +138,13 @@ class ICWP_WPSF_FeatureHandler_Insights extends ICWP_WPSF_FeatureHandler_BaseWps
139
  * @return array
140
  */
141
  protected function ajaxExec_AdminNotesDelete() {
142
- $oDP = $this->loadDP();
143
- /** @var ICWP_WPSF_FeatureHandler_Plugin $oMod */
144
- $oMod = $this->getConn()->getModule( 'plugin' );
145
- /** @var ICWP_WPSF_Processor_Plugin $oP */
146
- $oP = $oMod->getProcessor();
147
 
148
- $nNoteId = (int)trim( $oDP->post( 'note_id', 0 ) );
149
  if ( $nNoteId >= 0 ) {
 
 
 
 
150
  $oP->getSubProcessorNotes()
151
  ->getQueryDeleter()
152
  ->deleteById( $nNoteId );
@@ -249,7 +247,6 @@ class ICWP_WPSF_FeatureHandler_Insights extends ICWP_WPSF_FeatureHandler_BaseWps
249
  }
250
 
251
  protected function getNoticesSite() {
252
- $oDp = $this->loadDP();
253
  $oSslService = $this->loadSslService();
254
 
255
  $aNotices = array(
@@ -270,7 +267,7 @@ class ICWP_WPSF_FeatureHandler_Insights extends ICWP_WPSF_FeatureHandler_BaseWps
270
  // If we didn't throw and exception, we got it.
271
  $nExpiresAt = $oSslService->getExpiresAt( $sHomeUrl );
272
  if ( $nExpiresAt > 0 ) {
273
- $nTimeLeft = ( $nExpiresAt - $oDp->time() );
274
  $bExpired = $nTimeLeft < 0;
275
  $nDaysLeft = $bExpired ? 0 : (int)round( $nTimeLeft/DAY_IN_SECONDS, 0, PHP_ROUND_HALF_DOWN );
276
 
@@ -332,13 +329,7 @@ class ICWP_WPSF_FeatureHandler_Insights extends ICWP_WPSF_FeatureHandler_BaseWps
332
  );
333
 
334
  {// Inactive
335
- $nCount = 0;
336
- $aActivePlugs = $oWpPlugins->getActivePlugins();
337
- foreach ( $oWpPlugins->getPlugins() as $sFile => $aPlugData ) {
338
- if ( !in_array( $sFile, $aActivePlugs ) ) {
339
- $nCount++;
340
- }
341
- }
342
  if ( $nCount > 0 ) {
343
  $aNotices[ 'messages' ][ 'inactive' ] = array(
344
  'title' => 'Inactive',
62
  echo $this->renderTemplate( '/wpadmin_pages/insights/index.twig', $aData, true );
63
  }
64
 
65
+ public function insertCustomJsVars_Admin() {
66
+ parent::insertCustomJsVars_Admin();
67
 
68
  if ( $this->isThisModulePage() ) {
69
  wp_localize_script(
84
  public function handleAuthAjax( $aAjaxResponse ) {
85
 
86
  if ( empty( $aAjaxResponse ) ) {
87
+ switch ( $this->loadRequest()->request( 'exec' ) ) {
88
 
89
  case 'admin_note_new':
90
  $aAjaxResponse = $this->ajaxExec_AdminNoteNew();
109
  * @return array
110
  */
111
  protected function ajaxExec_AdminNoteNew() {
 
112
  /** @var ICWP_WPSF_FeatureHandler_Plugin $oMod */
113
  $oMod = $this->getConn()->getModule( 'plugin' );
114
+ $sNote = $this->loadRequest()->post( 'admin_note', '' );
115
  $bSuccess = false;
116
  if ( !$oMod->getCanAdminNotes() ) {
117
  $sMessage = _wpsf__( 'Sorry, Admin Notes is only available for Pro subscriptions.' );
138
  * @return array
139
  */
140
  protected function ajaxExec_AdminNotesDelete() {
 
 
 
 
 
141
 
142
+ $nNoteId = (int)$this->loadRequest()->post( 'note_id', 0 );
143
  if ( $nNoteId >= 0 ) {
144
+ /** @var ICWP_WPSF_FeatureHandler_Plugin $oMod */
145
+ $oMod = $this->getConn()->getModule( 'plugin' );
146
+ /** @var ICWP_WPSF_Processor_Plugin $oP */
147
+ $oP = $oMod->getProcessor();
148
  $oP->getSubProcessorNotes()
149
  ->getQueryDeleter()
150
  ->deleteById( $nNoteId );
247
  }
248
 
249
  protected function getNoticesSite() {
 
250
  $oSslService = $this->loadSslService();
251
 
252
  $aNotices = array(
267
  // If we didn't throw and exception, we got it.
268
  $nExpiresAt = $oSslService->getExpiresAt( $sHomeUrl );
269
  if ( $nExpiresAt > 0 ) {
270
+ $nTimeLeft = ( $nExpiresAt - $this->loadRequest()->ts() );
271
  $bExpired = $nTimeLeft < 0;
272
  $nDaysLeft = $bExpired ? 0 : (int)round( $nTimeLeft/DAY_IN_SECONDS, 0, PHP_ROUND_HALF_DOWN );
273
 
329
  );
330
 
331
  {// Inactive
332
+ $nCount = count( $oWpPlugins->getPlugins() ) - count( $oWpPlugins->getActivePlugins() );
 
 
 
 
 
 
333
  if ( $nCount > 0 ) {
334
  $aNotices[ 'messages' ][ 'inactive' ] = array(
335
  'title' => 'Inactive',
src/features/ips.php CHANGED
@@ -154,7 +154,7 @@ class ICWP_WPSF_FeatureHandler_Ips extends ICWP_WPSF_FeatureHandler_BaseWpsf {
154
  public function handleAuthAjax( $aAjaxResponse ) {
155
 
156
  if ( empty( $aAjaxResponse ) ) {
157
- switch ( $this->loadDP()->request( 'exec' ) ) {
158
 
159
  case 'get_ip_list':
160
  $aAjaxResponse = $this->ajaxExec_GetIpList();
@@ -181,37 +181,37 @@ class ICWP_WPSF_FeatureHandler_Ips extends ICWP_WPSF_FeatureHandler_BaseWpsf {
181
  protected function ajaxExec_GetIpList() {
182
  return array(
183
  'success' => true,
184
- 'html' => $this->renderListTable( $this->loadDP()->post( 'list', '' ) )
185
  );
186
  }
187
 
188
  public function ajaxExec_RemoveIpFromList() {
189
- $oDp = $this->loadDP();
190
  /** @var ICWP_WPSF_Processor_Ips $oPro */
191
  $oPro = $this->getProcessor();
192
  $oPro->getQueryDeleter()
193
- ->deleteIpOnList( $oDp->post( 'ip' ), $oDp->post( 'list' ) );
194
 
195
  return array(
196
  'success' => true,
197
- 'html' => $this->renderListTable( $oDp->post( 'list', '' ) ),
198
  );
199
  }
200
 
201
  protected function ajaxExec_AddIpToWhitelist() {
202
- $oDp = $this->loadDP();
203
  /** @var ICWP_WPSF_Processor_Ips $oProcessor */
204
  $oProcessor = $this->getProcessor();
205
 
206
- $sIp = $oDp->post( 'ip', '' );
207
- $sLabel = $oDp->post( 'label', '' );
208
  if ( !empty( $sIp ) ) {
209
  $oProcessor->addIpToWhiteList( $sIp, $sLabel );
210
  }
211
 
212
  return array(
213
  'success' => true,
214
- 'html' => $this->renderListTable( $oDp->post( 'list', '' ) ),
215
  );
216
  }
217
 
154
  public function handleAuthAjax( $aAjaxResponse ) {
155
 
156
  if ( empty( $aAjaxResponse ) ) {
157
+ switch ( $this->loadRequest()->request( 'exec' ) ) {
158
 
159
  case 'get_ip_list':
160
  $aAjaxResponse = $this->ajaxExec_GetIpList();
181
  protected function ajaxExec_GetIpList() {
182
  return array(
183
  'success' => true,
184
+ 'html' => $this->renderListTable( $this->loadRequest()->post( 'list', '' ) )
185
  );
186
  }
187
 
188
  public function ajaxExec_RemoveIpFromList() {
189
+ $oReq = $this->loadRequest();
190
  /** @var ICWP_WPSF_Processor_Ips $oPro */
191
  $oPro = $this->getProcessor();
192
  $oPro->getQueryDeleter()
193
+ ->deleteIpOnList( $oReq->post( 'ip' ), $oReq->post( 'list' ) );
194
 
195
  return array(
196
  'success' => true,
197
+ 'html' => $this->renderListTable( $oReq->post( 'list', '' ) ),
198
  );
199
  }
200
 
201
  protected function ajaxExec_AddIpToWhitelist() {
202
+ $oReq = $this->loadRequest();
203
  /** @var ICWP_WPSF_Processor_Ips $oProcessor */
204
  $oProcessor = $this->getProcessor();
205
 
206
+ $sIp = $oReq->post( 'ip', '' );
207
+ $sLabel = $oReq->post( 'label', '' );
208
  if ( !empty( $sIp ) ) {
209
  $oProcessor->addIpToWhiteList( $sIp, $sLabel );
210
  }
211
 
212
  return array(
213
  'success' => true,
214
+ 'html' => $this->renderListTable( $oReq->post( 'list', '' ) ),
215
  );
216
  }
217
 
src/features/license.php CHANGED
@@ -143,7 +143,7 @@ class ICWP_WPSF_FeatureHandler_License extends ICWP_WPSF_FeatureHandler_BaseWpsf
143
  public function handleAuthAjax( $aAjaxResponse ) {
144
 
145
  if ( empty( $aAjaxResponse ) ) {
146
- switch ( $this->loadDP()->request( 'exec' ) ) {
147
 
148
  case 'license_handling':
149
  $aAjaxResponse = $this->ajaxExec_LicenseHandling();
@@ -167,7 +167,7 @@ class ICWP_WPSF_FeatureHandler_License extends ICWP_WPSF_FeatureHandler_BaseWpsf
167
  $bSuccess = false;
168
  $sMessage = 'Unsupported license action';
169
 
170
- $sLicenseAction = $this->loadDP()->post( 'license-action' );
171
 
172
  $nCheckInterval = $this->getLicenseNotCheckedForInterval();
173
  if ( $nCheckInterval < 20 ) {
@@ -266,7 +266,7 @@ class ICWP_WPSF_FeatureHandler_License extends ICWP_WPSF_FeatureHandler_BaseWpsf
266
  * @return $this
267
  */
268
  public function verifyLicense( $bForceCheck = true ) {
269
- $nNow = $this->loadDP()->time();
270
  $oCurrent = $this->loadLicense();
271
 
272
  // If your last license verification has expired and it's been 4hrs since your last check.
@@ -343,7 +343,7 @@ class ICWP_WPSF_FeatureHandler_License extends ICWP_WPSF_FeatureHandler_BaseWpsf
343
  /**
344
  */
345
  protected function sendLicenseWarningEmail() {
346
- $nNow = $this->loadDP()->time();
347
  $bCanSend = $nNow - $this->getOpt( 'last_warning_email_sent_at' ) > DAY_IN_SECONDS;
348
 
349
  if ( $bCanSend ) {
@@ -478,7 +478,7 @@ class ICWP_WPSF_FeatureHandler_License extends ICWP_WPSF_FeatureHandler_BaseWpsf
478
  * @return int
479
  */
480
  private function getLicenseNotCheckedForInterval() {
481
- return ( $this->loadDP()->time() - $this->getLicenseLastCheckedAt() );
482
  }
483
 
484
  /**
@@ -524,7 +524,7 @@ class ICWP_WPSF_FeatureHandler_License extends ICWP_WPSF_FeatureHandler_BaseWpsf
524
  * @return bool
525
  */
526
  protected function isLastVerifiedExpired() {
527
- return ( $this->loadDP()->time() - $this->loadLicense()->getLastVerifiedAt() )
528
  > $this->getDef( 'lic_verify_expire_days' )*DAY_IN_SECONDS;
529
  }
530
 
@@ -534,7 +534,7 @@ class ICWP_WPSF_FeatureHandler_License extends ICWP_WPSF_FeatureHandler_BaseWpsf
534
  protected function isLastVerifiedGraceExpired() {
535
  $nGracePeriod = ( $this->getDef( 'lic_verify_expire_days' ) + $this->getDef( 'lic_verify_expire_grace_days' ) )
536
  *DAY_IN_SECONDS;
537
- return ( $this->loadDP()->time() - $this->loadLicense()->getLastVerifiedAt() ) > $nGracePeriod;
538
  }
539
 
540
  /**
@@ -646,7 +646,7 @@ class ICWP_WPSF_FeatureHandler_License extends ICWP_WPSF_FeatureHandler_BaseWpsf
646
  * @return bool
647
  */
648
  public function isKeylessHandshakeExpired() {
649
- return ( $this->loadDP()->time() - $this->getKeylessRequestAt() )
650
  > $this->getDef( 'keyless_handshake_expire' );
651
  }
652
 
@@ -663,7 +663,7 @@ class ICWP_WPSF_FeatureHandler_License extends ICWP_WPSF_FeatureHandler_BaseWpsf
663
  * @return $this
664
  */
665
  public function setKeylessRequestAt( $nTime = null ) {
666
- $nTime = is_numeric( $nTime ) ? $nTime : $this->loadDP()->time();
667
  return $this->setOpt( 'keyless_request_at', $nTime );
668
  }
669
 
143
  public function handleAuthAjax( $aAjaxResponse ) {
144
 
145
  if ( empty( $aAjaxResponse ) ) {
146
+ switch ( $this->loadRequest()->request( 'exec' ) ) {
147
 
148
  case 'license_handling':
149
  $aAjaxResponse = $this->ajaxExec_LicenseHandling();
167
  $bSuccess = false;
168
  $sMessage = 'Unsupported license action';
169
 
170
+ $sLicenseAction = $this->loadRequest()->post( 'license-action' );
171
 
172
  $nCheckInterval = $this->getLicenseNotCheckedForInterval();
173
  if ( $nCheckInterval < 20 ) {
266
  * @return $this
267
  */
268
  public function verifyLicense( $bForceCheck = true ) {
269
+ $nNow = $this->loadRequest()->ts();
270
  $oCurrent = $this->loadLicense();
271
 
272
  // If your last license verification has expired and it's been 4hrs since your last check.
343
  /**
344
  */
345
  protected function sendLicenseWarningEmail() {
346
+ $nNow = $this->loadRequest()->ts();
347
  $bCanSend = $nNow - $this->getOpt( 'last_warning_email_sent_at' ) > DAY_IN_SECONDS;
348
 
349
  if ( $bCanSend ) {
478
  * @return int
479
  */
480
  private function getLicenseNotCheckedForInterval() {
481
+ return ( $this->loadRequest()->ts() - $this->getLicenseLastCheckedAt() );
482
  }
483
 
484
  /**
524
  * @return bool
525
  */
526
  protected function isLastVerifiedExpired() {
527
+ return ( $this->loadRequest()->ts() - $this->loadLicense()->getLastVerifiedAt() )
528
  > $this->getDef( 'lic_verify_expire_days' )*DAY_IN_SECONDS;
529
  }
530
 
534
  protected function isLastVerifiedGraceExpired() {
535
  $nGracePeriod = ( $this->getDef( 'lic_verify_expire_days' ) + $this->getDef( 'lic_verify_expire_grace_days' ) )
536
  *DAY_IN_SECONDS;
537
+ return ( $this->loadRequest()->ts() - $this->loadLicense()->getLastVerifiedAt() ) > $nGracePeriod;
538
  }
539
 
540
  /**
646
  * @return bool
647
  */
648
  public function isKeylessHandshakeExpired() {
649
+ return ( $this->loadRequest()->ts() - $this->getKeylessRequestAt() )
650
  > $this->getDef( 'keyless_handshake_expire' );
651
  }
652
 
663
  * @return $this
664
  */
665
  public function setKeylessRequestAt( $nTime = null ) {
666
+ $nTime = is_numeric( $nTime ) ? $nTime : $this->loadRequest()->ts();
667
  return $this->setOpt( 'keyless_request_at', $nTime );
668
  }
669
 
src/features/login_protect.php CHANGED
@@ -14,10 +14,10 @@ class ICWP_WPSF_FeatureHandler_LoginProtect extends ICWP_WPSF_FeatureHandler_Bas
14
  public function onWpInit() {
15
  parent::onWpInit();
16
 
17
- $oDp = $this->loadDP();
18
  // User has clicked a link in their email to verify they can send email.
19
- if ( $oDp->query( 'shield_action' ) == 'emailsendverify' ) {
20
- if ( $oDp->query( 'authkey' ) == $this->getCanEmailVerifyCode() ) {
21
  $this->setIfCanSendEmail( true )
22
  ->savePluginOptions();
23
 
@@ -57,6 +57,18 @@ class ICWP_WPSF_FeatureHandler_LoginProtect extends ICWP_WPSF_FeatureHandler_Bas
57
  $this->getOptionsVo()->resetOptToDefault( 'login_limit_interval' );
58
  }
59
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  $this->cleanLoginUrlPath();
61
  }
62
 
@@ -196,7 +208,21 @@ class ICWP_WPSF_FeatureHandler_LoginProtect extends ICWP_WPSF_FeatureHandler_Bas
196
  $sKey = uniqid();
197
  $this->setOpt( 'gasp_key', $sKey );
198
  }
199
- return $sKey;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
200
  }
201
 
202
  /**
@@ -224,9 +250,9 @@ class ICWP_WPSF_FeatureHandler_LoginProtect extends ICWP_WPSF_FeatureHandler_Bas
224
  $aHashes = $this->getMfaLoginHashes( $oUser );
225
  $nSkipTime = $this->getMfaSkip()*DAY_IN_SECONDS;
226
 
227
- $sHash = md5( $this->loadDP()->getUserAgent() );
228
  $bCanSkip = isset( $aHashes[ $sHash ] )
229
- && ( (int)$aHashes[ $sHash ] + $nSkipTime ) > $this->loadDP()->time();
230
  }
231
  else if ( $this->getIfSupport3rdParty() && class_exists( 'WC_Social_Login' ) ) {
232
  // custom support for WooCommerce Social login
@@ -241,10 +267,10 @@ class ICWP_WPSF_FeatureHandler_LoginProtect extends ICWP_WPSF_FeatureHandler_Bas
241
  * @return $this
242
  */
243
  public function addMfaLoginHash( $oUser ) {
244
- $oDp = $this->loadDP();
245
  $aHashes = $this->getMfaLoginHashes( $oUser );
246
- $aHashes[ md5( $oDp->getUserAgent() ) ] = $oDp->time();
247
- $this->getController()->getCurrentUserMeta()->hash_loginmfa = $aHashes;
248
  return $this;
249
  }
250
 
@@ -386,7 +412,7 @@ class ICWP_WPSF_FeatureHandler_LoginProtect extends ICWP_WPSF_FeatureHandler_Bas
386
  public function setIfCanSendEmail( $bCan ) {
387
  $nCurrentDateAt = $this->getCanSendEmailVerifiedAt();
388
  if ( $bCan ) {
389
- $nDateAt = ( $nCurrentDateAt <= 0 ) ? $this->loadDP()->time() : $nCurrentDateAt;
390
  }
391
  else {
392
  $nDateAt = 0;
@@ -522,7 +548,7 @@ class ICWP_WPSF_FeatureHandler_LoginProtect extends ICWP_WPSF_FeatureHandler_Bas
522
  public function handleAuthAjax( $aAjaxResponse ) {
523
 
524
  if ( empty( $aAjaxResponse ) ) {
525
- switch ( $this->loadDP()->request( 'exec' ) ) {
526
 
527
  case 'gen_backup_codes':
528
  $aAjaxResponse = $this->ajaxExec_GenBackupCodes();
@@ -543,7 +569,6 @@ class ICWP_WPSF_FeatureHandler_LoginProtect extends ICWP_WPSF_FeatureHandler_Bas
543
  * @return array
544
  */
545
  protected function ajaxExec_GenBackupCodes() {
546
-
547
  /** @var ICWP_WPSF_Processor_LoginProtect $oPro */
548
  $oPro = $this->loadProcessor();
549
  $sPass = $oPro->getProcessorLoginIntent()
@@ -560,6 +585,66 @@ class ICWP_WPSF_FeatureHandler_LoginProtect extends ICWP_WPSF_FeatureHandler_Bas
560
  );
561
  }
562
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
563
  /**
564
  * @return array
565
  */
@@ -576,8 +661,8 @@ class ICWP_WPSF_FeatureHandler_LoginProtect extends ICWP_WPSF_FeatureHandler_Bas
576
  );
577
  }
578
 
579
- public function insertCustomJsVars() {
580
- parent::insertCustomJsVars();
581
 
582
  wp_localize_script(
583
  $this->prefix( 'global-plugin' ),
@@ -776,6 +861,18 @@ class ICWP_WPSF_FeatureHandler_LoginProtect extends ICWP_WPSF_FeatureHandler_Bas
776
  .'<br />'.sprintf( '%s: %s', _wpsf__( 'Recommendation' ), _wpsf__( 'ON' ) );
777
  break;
778
 
 
 
 
 
 
 
 
 
 
 
 
 
779
  case 'login_limit_interval' :
780
  $sName = _wpsf__( 'Cooldown Period' );
781
  $sSummary = _wpsf__( 'Limit account access requests to every X seconds' );
14
  public function onWpInit() {
15
  parent::onWpInit();
16
 
17
+ $oReq = $this->loadRequest();
18
  // User has clicked a link in their email to verify they can send email.
19
+ if ( $oReq->query( 'shield_action' ) == 'emailsendverify' ) {
20
+ if ( $oReq->query( 'authkey' ) == $this->getCanEmailVerifyCode() ) {
21
  $this->setIfCanSendEmail( true )
22
  ->savePluginOptions();
23
 
57
  $this->getOptionsVo()->resetOptToDefault( 'login_limit_interval' );
58
  }
59
 
60
+ $aIds = $this->getAntiBotFormIds();
61
+ foreach ( $aIds as $nKey => $sId ) {
62
+ $sId = preg_replace( '/\s/', '', strip_tags( trim( $sId ) ) );
63
+ if ( empty( $sId ) ) {
64
+ unset( $aIds[ $nKey ] );
65
+ }
66
+ else {
67
+ $aIds[ $nKey ] = $sId;
68
+ }
69
+ }
70
+ $this->setOpt( 'antibot_form_ids', array_values( array_unique( $aIds ) ) );
71
+
72
  $this->cleanLoginUrlPath();
73
  }
74
 
208
  $sKey = uniqid();
209
  $this->setOpt( 'gasp_key', $sKey );
210
  }
211
+ return $this->prefix( $sKey );
212
+ }
213
+
214
+ /**
215
+ * @return string
216
+ */
217
+ public function getTextImAHuman() {
218
+ return stripslashes( $this->getTextOpt( 'text_imahuman' ) );
219
+ }
220
+
221
+ /**
222
+ * @return string
223
+ */
224
+ public function getTextPleaseCheckBox() {
225
+ return stripslashes( $this->getTextOpt( 'text_pleasecheckbox' ) );
226
  }
227
 
228
  /**
250
  $aHashes = $this->getMfaLoginHashes( $oUser );
251
  $nSkipTime = $this->getMfaSkip()*DAY_IN_SECONDS;
252
 
253
+ $sHash = md5( $this->loadRequest()->getUserAgent() );
254
  $bCanSkip = isset( $aHashes[ $sHash ] )
255
+ && ( (int)$aHashes[ $sHash ] + $nSkipTime ) > $this->loadRequest()->ts();
256
  }
257
  else if ( $this->getIfSupport3rdParty() && class_exists( 'WC_Social_Login' ) ) {
258
  // custom support for WooCommerce Social login
267
  * @return $this
268
  */
269
  public function addMfaLoginHash( $oUser ) {
270
+ $oReq = $this->loadRequest();
271
  $aHashes = $this->getMfaLoginHashes( $oUser );
272
+ $aHashes[ md5( $oReq->getUserAgent() ) ] = $oReq->ts();
273
+ $this->getConn()->getCurrentUserMeta()->hash_loginmfa = $aHashes;
274
  return $this;
275
  }
276
 
412
  public function setIfCanSendEmail( $bCan ) {
413
  $nCurrentDateAt = $this->getCanSendEmailVerifiedAt();
414
  if ( $bCan ) {
415
+ $nDateAt = ( $nCurrentDateAt <= 0 ) ? $this->loadRequest()->ts() : $nCurrentDateAt;
416
  }
417
  else {
418
  $nDateAt = 0;
548
  public function handleAuthAjax( $aAjaxResponse ) {
549
 
550
  if ( empty( $aAjaxResponse ) ) {
551
+ switch ( $this->loadRequest()->request( 'exec' ) ) {
552
 
553
  case 'gen_backup_codes':
554
  $aAjaxResponse = $this->ajaxExec_GenBackupCodes();
569
  * @return array
570
  */
571
  protected function ajaxExec_GenBackupCodes() {
 
572
  /** @var ICWP_WPSF_Processor_LoginProtect $oPro */
573
  $oPro = $this->loadProcessor();
574
  $sPass = $oPro->getProcessorLoginIntent()
585
  );
586
  }
587
 
588
+ /**
589
+ * @return bool
590
+ */
591
+ public function isEnabledBotJs() {
592
+ return $this->isPremium() && $this->isOpt( 'enable_antibot_js', 'Y' )
593
+ && count( $this->getAntiBotFormIds() ) > 0
594
+ && ( $this->isEnabledGaspCheck() || $this->isGoogleRecaptchaEnabled() );
595
+ }
596
+
597
+ /**
598
+ * @return array
599
+ */
600
+ public function getAntiBotFormIds() {
601
+ $aIds = $this->getOpt( 'antibot_form_ids', array() );
602
+ return is_array( $aIds ) ? $aIds : array();
603
+ }
604
+
605
+ public function onWpEnqueueJs() {
606
+ parent::onWpEnqueueJs();
607
+
608
+ if ( $this->isEnabledBotJs() ) {
609
+ $oConn = $this->getConn();
610
+
611
+ $sAsset = 'shield-antibot';
612
+ $sUnique = $this->prefix( $sAsset );
613
+ wp_register_script(
614
+ $sUnique,
615
+ $oConn->getPluginUrl_Js( $sAsset.'.js' ),
616
+ array( 'jquery' ),
617
+ $oConn->getVersion(),
618
+ true
619
+ );
620
+ wp_enqueue_script( $sUnique );
621
+
622
+ wp_localize_script(
623
+ $sUnique,
624
+ 'icwp_wpsf_vars_lpantibot',
625
+ array(
626
+ 'form_ids' => $this->getAntiBotFormIds(),
627
+ 'uniq' => preg_replace( '#[^a-zA-Z0-9]#', '', apply_filters( 'icwp_shield_lp_gasp_uniqid', uniqid() ) ),
628
+ 'cbname' => $this->getGaspKey(),
629
+ 'strings' => array(
630
+ 'label' => $this->getTextImAHuman(),
631
+ 'alert' => $this->getTextPleaseCheckBox(),
632
+ ),
633
+ 'flags' => array(
634
+ 'gasp' => $this->isEnabledGaspCheck(),
635
+ 'recap' => $this->isGoogleRecaptchaEnabled(),
636
+ )
637
+ )
638
+ );
639
+
640
+ if ( $this->isGoogleRecaptchaEnabled() ) {
641
+ /** @var ICWP_WPSF_Processor_LoginProtect $oPro */
642
+ $oPro = $this->getProcessor();
643
+ $oPro->setRecaptchaToEnqueue();
644
+ }
645
+ }
646
+ }
647
+
648
  /**
649
  * @return array
650
  */
661
  );
662
  }
663
 
664
+ public function insertCustomJsVars_Admin() {
665
+ parent::insertCustomJsVars_Admin();
666
 
667
  wp_localize_script(
668
  $this->prefix( 'global-plugin' ),
861
  .'<br />'.sprintf( '%s: %s', _wpsf__( 'Recommendation' ), _wpsf__( 'ON' ) );
862
  break;
863
 
864
+ case 'enable_antibot_js' :
865
+ $sName = _wpsf__( 'AntiBot JS' );
866
+ $sSummary = _wpsf__( 'Use AntiBot JS Includes For Custom 3rd Party Form' );
867
+ $sDescription = _wpsf__( 'Important: This is experimental. Please contact support for further assistance.' );
868
+ break;
869
+
870
+ case 'antibot_form_ids' :
871
+ $sName = _wpsf__( 'AntiBot Forms' );
872
+ $sSummary = _wpsf__( 'Enter The IDs Of The 3rd Party Login Forms For Use With AntiBot JS' );
873
+ $sDescription = _wpsf__( 'For use with the AntiBot JS option.' );
874
+ break;
875
+
876
  case 'login_limit_interval' :
877
  $sName = _wpsf__( 'Cooldown Period' );
878
  $sSummary = _wpsf__( 'Limit account access requests to every X seconds' );
src/features/plugin.php CHANGED
@@ -53,7 +53,7 @@ class ICWP_WPSF_FeatureHandler_Plugin extends ICWP_WPSF_FeatureHandler_BaseWpsf
53
  * @return bool
54
  */
55
  public function getLastCheckServerIpAtHasExpired() {
56
- return ( ( $this->loadDP()->time() - $this->getLastCheckServerIpAt() ) > DAY_IN_SECONDS );
57
  }
58
 
59
  /**
@@ -76,7 +76,7 @@ class ICWP_WPSF_FeatureHandler_Plugin extends ICWP_WPSF_FeatureHandler_BaseWpsf
76
  $this->setOpt( 'this_server_ip', $sThisServerIp );
77
  }
78
  // we always update so we don't forever check on every single page load
79
- $this->setOpt( 'this_server_ip_last_check_at', $this->loadDP()->time() );
80
  }
81
  return $sThisServerIp;
82
  }
@@ -86,7 +86,7 @@ class ICWP_WPSF_FeatureHandler_Plugin extends ICWP_WPSF_FeatureHandler_BaseWpsf
86
  */
87
  public function isDisplayPluginBadge() {
88
  return $this->isOpt( 'display_plugin_badge', 'Y' )
89
- && ( $this->loadDP()->cookie( $this->getCookieIdBadgeState() ) != 'closed' );
90
  }
91
 
92
  /**
@@ -103,11 +103,10 @@ class ICWP_WPSF_FeatureHandler_Plugin extends ICWP_WPSF_FeatureHandler_BaseWpsf
103
  protected function setVisitorIp() {
104
  $sIp = null;
105
  $oIpService = $this->loadIpService();
106
- $oDp = $this->loadDP();
107
 
108
  if ( !$this->isVisitorAddressSourceAutoDetect() ) {
109
 
110
- $sMaybeIp = $oDp->server( $this->getVisitorAddressSource() );
111
 
112
  if ( !empty( $sMaybeIp ) ) {
113
  $aMaybeIps = array_map( 'trim', explode( ',', $sMaybeIp ) ); // TODO:streamline this comma handling
@@ -169,7 +168,7 @@ class ICWP_WPSF_FeatureHandler_Plugin extends ICWP_WPSF_FeatureHandler_BaseWpsf
169
  public function handleAjax( $aAjaxResponse ) {
170
 
171
  if ( empty( $aAjaxResponse ) ) {
172
- switch ( $this->loadDP()->request( 'exec' ) ) {
173
  case 'plugin_badge_close':
174
  $aAjaxResponse = $this->ajaxExec_PluginBadgeClose();
175
  break;
@@ -193,7 +192,7 @@ class ICWP_WPSF_FeatureHandler_Plugin extends ICWP_WPSF_FeatureHandler_BaseWpsf
193
  public function handleAuthAjax( $aAjaxResponse ) {
194
 
195
  if ( empty( $aAjaxResponse ) ) {
196
- switch ( $this->loadDP()->request( 'exec' ) ) {
197
 
198
  case 'delete_forceoff':
199
  $aAjaxResponse = $this->ajaxExec_DeleteForceOff();
@@ -210,7 +209,7 @@ class ICWP_WPSF_FeatureHandler_Plugin extends ICWP_WPSF_FeatureHandler_BaseWpsf
210
  * @return array
211
  */
212
  public function ajaxExec_PluginBadgeClose() {
213
- $bSuccess = $this->loadDP()
214
  ->setCookie(
215
  $this->getCookieIdBadgeState(),
216
  'closed',
@@ -227,7 +226,7 @@ class ICWP_WPSF_FeatureHandler_Plugin extends ICWP_WPSF_FeatureHandler_BaseWpsf
227
  * @return array
228
  */
229
  public function ajaxExec_SetPluginTrackingPerm() {
230
- $this->setPluginTrackingPermission( (bool)$this->loadDP()->query( 'agree', false ) );
231
  return array( 'success' => true );
232
  }
233
 
@@ -269,7 +268,7 @@ class ICWP_WPSF_FeatureHandler_Plugin extends ICWP_WPSF_FeatureHandler_BaseWpsf
269
  */
270
  public function setPluginTrackingPermission( $bOnOrOff = true ) {
271
  $this->setOpt( 'enable_tracking', $bOnOrOff ? 'Y' : 'N' )
272
- ->setOpt( 'tracking_permission_set_at', $this->loadDP()->time() )
273
  ->savePluginOptions();
274
  return $this;
275
  }
@@ -322,7 +321,7 @@ class ICWP_WPSF_FeatureHandler_Plugin extends ICWP_WPSF_FeatureHandler_BaseWpsf
322
  if ( !$oCon->getHasPermissionToManage() ) {
323
  $this->loadWp()->wpDie(
324
  _wpsf__( 'Sorry, you do not have permission to disable this plugin.' )
325
- ._wpsf__( 'You need to authenticate first.' )
326
  );
327
  }
328
  }
@@ -364,14 +363,14 @@ class ICWP_WPSF_FeatureHandler_Plugin extends ICWP_WPSF_FeatureHandler_BaseWpsf
364
  * @return $this
365
  */
366
  public function setTrackingLastSentAt() {
367
- return $this->setOpt( 'tracking_last_sent_at', $this->loadDP()->time() );
368
  }
369
 
370
  /**
371
  * @return bool
372
  */
373
  public function readyToSendTrackingData() {
374
- return ( ( $this->loadDP()->time() - $this->getTrackingLastSentAt() ) > WEEK_IN_SECONDS );
375
  }
376
 
377
  /**
@@ -388,11 +387,11 @@ class ICWP_WPSF_FeatureHandler_Plugin extends ICWP_WPSF_FeatureHandler_BaseWpsf
388
 
389
  $nInstalledAt = $this->getPluginInstallationTime();
390
  if ( empty( $nInstalledAt ) || $nInstalledAt <= 0 ) {
391
- $this->setOpt( 'installation_time', $this->loadDP()->time() );
392
  }
393
 
394
  if ( $this->isTrackingEnabled() && !$this->isTrackingPermissionSet() ) {
395
- $this->setOpt( 'tracking_permission_set_at', $this->loadDP()->time() );
396
  }
397
 
398
  $this->cleanRecaptchaKey( 'google_recaptcha_site_key' );
@@ -484,7 +483,7 @@ class ICWP_WPSF_FeatureHandler_Plugin extends ICWP_WPSF_FeatureHandler_BaseWpsf
484
  * @return int
485
  */
486
  public function getImportExportHandshakeExpiresAt() {
487
- return $this->getOpt( 'importexport_handshake_expires_at', $this->loadDP()->time() );
488
  }
489
 
490
  /**
@@ -510,7 +509,7 @@ class ICWP_WPSF_FeatureHandler_Plugin extends ICWP_WPSF_FeatureHandler_BaseWpsf
510
  if ( empty( $sId ) || $this->isImportExportSecretKeyExpired() ) {
511
  $sId = sha1( $this->getPluginInstallationId().wp_rand( 0, PHP_INT_MAX ) );
512
  $this->setOpt( 'importexport_secretkey', $sId )
513
- ->setOpt( 'importexport_secretkey_expires_at', $this->loadDP()->time() + HOUR_IN_SECONDS );
514
  }
515
  return $sId;
516
  }
@@ -526,7 +525,7 @@ class ICWP_WPSF_FeatureHandler_Plugin extends ICWP_WPSF_FeatureHandler_BaseWpsf
526
  * @return bool
527
  */
528
  protected function isImportExportSecretKeyExpired() {
529
- return ( $this->loadDP()->time() > $this->getOpt( 'importexport_secretkey_expires_at' ) );
530
  }
531
 
532
  /**
@@ -592,7 +591,7 @@ class ICWP_WPSF_FeatureHandler_Plugin extends ICWP_WPSF_FeatureHandler_BaseWpsf
592
  * @return $this
593
  */
594
  public function startImportExportHandshake() {
595
- $this->setOpt( 'importexport_handshake_expires_at', $this->loadDP()->time() + 30 )
596
  ->savePluginOptions();
597
  return $this;
598
  }
@@ -627,20 +626,22 @@ class ICWP_WPSF_FeatureHandler_Plugin extends ICWP_WPSF_FeatureHandler_BaseWpsf
627
  * @return array
628
  */
629
  protected function buildIpAddressMap() {
 
 
 
630
  $aOptionData = $this->getOptionsVo()->getRawData_SingleOption( 'visitor_address_source' );
631
  $aValueOptions = $aOptionData[ 'value_options' ];
632
 
633
- $oDp = $this->loadDP();
634
  $aMap = array();
635
  $aEmpties = array();
636
  foreach ( $aValueOptions as $aOptionValue ) {
637
  $sKey = $aOptionValue[ 'value_key' ];
638
  if ( $sKey == 'AUTO_DETECT_IP' ) {
639
  $sKey = 'Auto Detect';
640
- $sIp = $oDp->loadIpService()->getRequestIp();
641
  }
642
  else {
643
- $sIp = $oDp->server( $sKey );
644
  }
645
  if ( empty( $sIp ) ) {
646
  $aEmpties[] = sprintf( '%s- %s', $sKey, 'ip not available' );
@@ -738,8 +739,8 @@ class ICWP_WPSF_FeatureHandler_Plugin extends ICWP_WPSF_FeatureHandler_BaseWpsf
738
  return $this->prefixOptionKey( $this->getDef( 'db_notes_name' ) );
739
  }
740
 
741
- public function insertCustomJsVars() {
742
- parent::insertCustomJsVars();
743
 
744
  if ( $this->loadWp()->isCurrentPage( 'plugins.php' ) ) {
745
  $sFile = $this->getConn()->getPluginBaseFile();
53
  * @return bool
54
  */
55
  public function getLastCheckServerIpAtHasExpired() {
56
+ return ( ( $this->loadRequest()->ts() - $this->getLastCheckServerIpAt() ) > DAY_IN_SECONDS );
57
  }
58
 
59
  /**
76
  $this->setOpt( 'this_server_ip', $sThisServerIp );
77
  }
78
  // we always update so we don't forever check on every single page load
79
+ $this->setOpt( 'this_server_ip_last_check_at', $this->loadRequest()->ts() );
80
  }
81
  return $sThisServerIp;
82
  }
86
  */
87
  public function isDisplayPluginBadge() {
88
  return $this->isOpt( 'display_plugin_badge', 'Y' )
89
+ && ( $this->loadRequest()->cookie( $this->getCookieIdBadgeState() ) != 'closed' );
90
  }
91
 
92
  /**
103
  protected function setVisitorIp() {
104
  $sIp = null;
105
  $oIpService = $this->loadIpService();
 
106
 
107
  if ( !$this->isVisitorAddressSourceAutoDetect() ) {
108
 
109
+ $sMaybeIp = $this->loadRequest()->server( $this->getVisitorAddressSource() );
110
 
111
  if ( !empty( $sMaybeIp ) ) {
112
  $aMaybeIps = array_map( 'trim', explode( ',', $sMaybeIp ) ); // TODO:streamline this comma handling
168
  public function handleAjax( $aAjaxResponse ) {
169
 
170
  if ( empty( $aAjaxResponse ) ) {
171
+ switch ( $this->loadRequest()->request( 'exec' ) ) {
172
  case 'plugin_badge_close':
173
  $aAjaxResponse = $this->ajaxExec_PluginBadgeClose();
174
  break;
192
  public function handleAuthAjax( $aAjaxResponse ) {
193
 
194
  if ( empty( $aAjaxResponse ) ) {
195
+ switch ( $this->loadRequest()->request( 'exec' ) ) {
196
 
197
  case 'delete_forceoff':
198
  $aAjaxResponse = $this->ajaxExec_DeleteForceOff();
209
  * @return array
210
  */
211
  public function ajaxExec_PluginBadgeClose() {
212
+ $bSuccess = $this->loadRequest()
213
  ->setCookie(
214
  $this->getCookieIdBadgeState(),
215
  'closed',
226
  * @return array
227
  */
228
  public function ajaxExec_SetPluginTrackingPerm() {
229
+ $this->setPluginTrackingPermission( (bool)$this->loadRequest()->query( 'agree', false ) );
230
  return array( 'success' => true );
231
  }
232
 
268
  */
269
  public function setPluginTrackingPermission( $bOnOrOff = true ) {
270
  $this->setOpt( 'enable_tracking', $bOnOrOff ? 'Y' : 'N' )
271
+ ->setOpt( 'tracking_permission_set_at', $this->loadRequest()->ts() )
272
  ->savePluginOptions();
273
  return $this;
274
  }
321
  if ( !$oCon->getHasPermissionToManage() ) {
322
  $this->loadWp()->wpDie(
323
  _wpsf__( 'Sorry, you do not have permission to disable this plugin.' )
324
+ .' '._wpsf__( 'You need to authenticate first.' )
325
  );
326
  }
327
  }
363
  * @return $this
364
  */
365
  public function setTrackingLastSentAt() {
366
+ return $this->setOpt( 'tracking_last_sent_at', $this->loadRequest()->ts() );
367
  }
368
 
369
  /**
370
  * @return bool
371
  */
372
  public function readyToSendTrackingData() {
373
+ return ( ( $this->loadRequest()->ts() - $this->getTrackingLastSentAt() ) > WEEK_IN_SECONDS );
374
  }
375
 
376
  /**
387
 
388
  $nInstalledAt = $this->getPluginInstallationTime();
389
  if ( empty( $nInstalledAt ) || $nInstalledAt <= 0 ) {
390
+ $this->setOpt( 'installation_time', $this->loadRequest()->ts() );
391
  }
392
 
393
  if ( $this->isTrackingEnabled() && !$this->isTrackingPermissionSet() ) {
394
+ $this->setOpt( 'tracking_permission_set_at', $this->loadRequest()->ts() );
395
  }
396
 
397
  $this->cleanRecaptchaKey( 'google_recaptcha_site_key' );
483
  * @return int
484
  */
485
  public function getImportExportHandshakeExpiresAt() {
486
+ return $this->getOpt( 'importexport_handshake_expires_at', $this->loadRequest()->ts() );
487
  }
488
 
489
  /**
509
  if ( empty( $sId ) || $this->isImportExportSecretKeyExpired() ) {
510
  $sId = sha1( $this->getPluginInstallationId().wp_rand( 0, PHP_INT_MAX ) );
511
  $this->setOpt( 'importexport_secretkey', $sId )
512
+ ->setOpt( 'importexport_secretkey_expires_at', $this->loadRequest()->ts() + HOUR_IN_SECONDS );
513
  }
514
  return $sId;
515
  }
525
  * @return bool
526
  */
527
  protected function isImportExportSecretKeyExpired() {
528
+ return ( $this->loadRequest()->ts() > $this->getOpt( 'importexport_secretkey_expires_at' ) );
529
  }
530
 
531
  /**
591
  * @return $this
592
  */
593
  public function startImportExportHandshake() {
594
+ $this->setOpt( 'importexport_handshake_expires_at', $this->loadRequest()->ts() + 30 )
595
  ->savePluginOptions();
596
  return $this;
597
  }
626
  * @return array
627
  */
628
  protected function buildIpAddressMap() {
629
+ $oReq = $this->loadRequest();
630
+ $oIp = $this->loadIpService();
631
+
632
  $aOptionData = $this->getOptionsVo()->getRawData_SingleOption( 'visitor_address_source' );
633
  $aValueOptions = $aOptionData[ 'value_options' ];
634
 
 
635
  $aMap = array();
636
  $aEmpties = array();
637
  foreach ( $aValueOptions as $aOptionValue ) {
638
  $sKey = $aOptionValue[ 'value_key' ];
639
  if ( $sKey == 'AUTO_DETECT_IP' ) {
640
  $sKey = 'Auto Detect';
641
+ $sIp = $oIp->getRequestIp();
642
  }
643
  else {
644
+ $sIp = $oReq->server( $sKey );
645
  }
646
  if ( empty( $sIp ) ) {
647
  $aEmpties[] = sprintf( '%s- %s', $sKey, 'ip not available' );
739
  return $this->prefixOptionKey( $this->getDef( 'db_notes_name' ) );
740
  }
741
 
742
+ public function insertCustomJsVars_Admin() {
743
+ parent::insertCustomJsVars_Admin();
744
 
745
  if ( $this->loadWp()->isCurrentPage( 'plugins.php' ) ) {
746
  $sFile = $this->getConn()->getPluginBaseFile();
src/features/sessions.php CHANGED
@@ -31,10 +31,10 @@ class ICWP_WPSF_FeatureHandler_Sessions extends ICWP_WPSF_FeatureHandler_BaseWps
31
  public function isAutoAddSessions() {
32
  $nStartedAt = $this->getOpt( 'autoadd_sessions_started_at', 0 );
33
  if ( $nStartedAt < 1 ) {
34
- $nStartedAt = $this->loadDP()->time();
35
  $this->setOpt( 'autoadd_sessions_started_at', $nStartedAt );
36
  }
37
- return ( $this->loadDP()->time() - $nStartedAt ) < 20;
38
  }
39
 
40
  /**
31
  public function isAutoAddSessions() {
32
  $nStartedAt = $this->getOpt( 'autoadd_sessions_started_at', 0 );
33
  if ( $nStartedAt < 1 ) {
34
+ $nStartedAt = $this->loadRequest()->ts();
35
  $this->setOpt( 'autoadd_sessions_started_at', $nStartedAt );
36
  }
37
+ return ( $this->loadRequest()->ts() - $nStartedAt ) < 20;
38
  }
39
 
40
  /**
src/features/traffic.php CHANGED
@@ -17,7 +17,7 @@ class ICWP_WPSF_FeatureHandler_Traffic extends ICWP_WPSF_FeatureHandler_BaseWpsf
17
  * Hooked to the plugin's main plugin_shutdown action
18
  */
19
  public function action_doFeatureShutdown() {
20
- if ( $this->isAutoDisable() && $this->loadDP()->time() - $this->getAutoDisableAt() > 0 ) {
21
  $this->setOpt( 'auto_disable', 'N' )
22
  ->setOpt( 'autodisable_at', 0 )
23
  ->setIsMainFeatureEnabled( false );
@@ -25,16 +25,6 @@ class ICWP_WPSF_FeatureHandler_Traffic extends ICWP_WPSF_FeatureHandler_BaseWpsf
25
  parent::action_doFeatureShutdown();
26
  }
27
 
28
- /**
29
- * We clean the database after saving.
30
- */
31
- protected function doPrePluginOptionsSave() {
32
- /** @var ICWP_WPSF_Processor_Traffic $oPro */
33
- $oPro = $this->getProcessor();
34
- $oPro->getProcessorLogger()
35
- ->cleanupDatabase();
36
- }
37
-
38
  /**
39
  * We clean the database after saving.
40
  */
@@ -44,7 +34,7 @@ class ICWP_WPSF_FeatureHandler_Traffic extends ICWP_WPSF_FeatureHandler_BaseWpsf
44
  $oPro->getProcessorLogger()
45
  ->cleanupDatabase();
46
 
47
- $this->setOpt( 'autodisable_at', $this->isAutoDisable() ? $this->loadDP()->time() + WEEK_IN_SECONDS : 0 );
48
 
49
  $aExcls = $this->getCustomExclusions();
50
  foreach ( $aExcls as &$sExcl ) {
@@ -209,7 +199,7 @@ class ICWP_WPSF_FeatureHandler_Traffic extends ICWP_WPSF_FeatureHandler_BaseWpsf
209
  public function handleAuthAjax( $aAjaxResponse ) {
210
 
211
  if ( empty( $aAjaxResponse ) ) {
212
- switch ( $this->loadDP()->request( 'exec' ) ) {
213
 
214
  case 'render_traffic_table':
215
  $aAjaxResponse = $this->ajaxExec_RenderTrafficTable();
@@ -223,8 +213,7 @@ class ICWP_WPSF_FeatureHandler_Traffic extends ICWP_WPSF_FeatureHandler_BaseWpsf
223
  }
224
 
225
  protected function ajaxExec_RenderTrafficTable() {
226
- $oDP = $this->loadDP();
227
- parse_str( $oDP->post( 'filters', '' ), $aFilters );
228
  $aParams = array_intersect_key(
229
  array_merge( $_POST, array_map( 'trim', $aFilters ) ),
230
  array_flip( array(
17
  * Hooked to the plugin's main plugin_shutdown action
18
  */
19
  public function action_doFeatureShutdown() {
20
+ if ( $this->isAutoDisable() && $this->loadRequest()->ts() - $this->getAutoDisableAt() > 0 ) {
21
  $this->setOpt( 'auto_disable', 'N' )
22
  ->setOpt( 'autodisable_at', 0 )
23
  ->setIsMainFeatureEnabled( false );
25
  parent::action_doFeatureShutdown();
26
  }
27
 
 
 
 
 
 
 
 
 
 
 
28
  /**
29
  * We clean the database after saving.
30
  */
34
  $oPro->getProcessorLogger()
35
  ->cleanupDatabase();
36
 
37
+ $this->setOpt( 'autodisable_at', $this->isAutoDisable() ? $this->loadRequest()->ts() + WEEK_IN_SECONDS : 0 );
38
 
39
  $aExcls = $this->getCustomExclusions();
40
  foreach ( $aExcls as &$sExcl ) {
199
  public function handleAuthAjax( $aAjaxResponse ) {
200
 
201
  if ( empty( $aAjaxResponse ) ) {
202
+ switch ( $this->loadRequest()->request( 'exec' ) ) {
203
 
204
  case 'render_traffic_table':
205
  $aAjaxResponse = $this->ajaxExec_RenderTrafficTable();
213
  }
214
 
215
  protected function ajaxExec_RenderTrafficTable() {
216
+ parse_str( $this->loadRequest()->post( 'filters', '' ), $aFilters );
 
217
  $aParams = array_intersect_key(
218
  array_merge( $_POST, array_map( 'trim', $aFilters ) ),
219
  array_flip( array(
src/features/user_management.php CHANGED
@@ -44,8 +44,7 @@ class ICWP_WPSF_FeatureHandler_UserManagement extends ICWP_WPSF_FeatureHandler_B
44
 
45
  return array(
46
  'strings' => $this->getDisplayStrings(),
47
- 'time_now' => sprintf( _wpsf__( 'now: %s' ), date_i18n( $sTimeFormat.' '.$sDateFormat, $this->loadDP()
48
- ->time() ) ),
49
  'sUserSessionsTable' => $sUserSessionsTable
50
  );
51
  }
@@ -170,10 +169,10 @@ class ICWP_WPSF_FeatureHandler_UserManagement extends ICWP_WPSF_FeatureHandler_B
170
  public function isAutoAddSessions() {
171
  $nStartedAt = $this->getOpt( 'autoadd_sessions_started_at', 0 );
172
  if ( $nStartedAt < 1 ) {
173
- $nStartedAt = $this->loadDP()->time();
174
  $this->setOpt( 'autoadd_sessions_started_at', $nStartedAt );
175
  }
176
- return ( $this->loadDP()->time() - $nStartedAt ) < 20;
177
  }
178
 
179
  /**
44
 
45
  return array(
46
  'strings' => $this->getDisplayStrings(),
47
+ 'time_now' => sprintf( _wpsf__( 'now: %s' ), date_i18n( $sTimeFormat.' '.$sDateFormat, $this->loadRequest()->ts() ) ),
 
48
  'sUserSessionsTable' => $sUserSessionsTable
49
  );
50
  }
169
  public function isAutoAddSessions() {
170
  $nStartedAt = $this->getOpt( 'autoadd_sessions_started_at', 0 );
171
  if ( $nStartedAt < 1 ) {
172
+ $nStartedAt = $this->loadRequest()->ts();
173
  $this->setOpt( 'autoadd_sessions_started_at', $nStartedAt );
174
  }
175
+ return ( $this->loadRequest()->ts() - $nStartedAt ) < 20;
176
  }
177
 
178
  /**
src/processors/admin_access_restriction.php CHANGED
@@ -31,38 +31,38 @@ class ICWP_WPSF_Processor_AdminAccessRestriction extends ICWP_WPSF_Processor_Bas
31
 
32
  public function onWpInit() {
33
  parent::onWpInit();
34
- /** @var ICWP_WPSF_FeatureHandler_AdminAccessRestriction $oFO */
35
- $oFO = $this->getMod();
36
- if ( !$this->loadWpUsers()->isUserLoggedIn() || $this->isSecurityAdmin() ) {
37
- return;
38
- }
39
 
40
- if ( $oFO->isAdminAccessAdminUsersEnabled() ) {
41
- add_filter( 'editable_roles', array( $this, 'restrictEditableRoles' ), 100, 1 );
42
- add_filter( 'user_has_cap', array( $this, 'restrictAdminUserChanges' ), 100, 3 );
43
- add_action( 'delete_user', array( $this, 'restrictAdminUserDelete' ), 100, 1 );
44
- add_action( 'add_user_role', array( $this, 'restrictAddUserRole' ), 100, 2 );
45
- add_action( 'remove_user_role', array( $this, 'restrictRemoveUserRole' ), 100, 2 );
46
- add_action( 'set_user_role', array( $this, 'restrictSetUserRole' ), 100, 3 );
47
- }
48
 
49
- $aPluginRestrictions = $oFO->getAdminAccessArea_Plugins();
50
- if ( !empty( $aPluginRestrictions ) ) {
51
- add_filter( 'user_has_cap', array( $this, 'disablePluginManipulation' ), 0, 3 );
52
- }
 
 
 
 
53
 
54
- $aThemeRestrictions = $oFO->getAdminAccessArea_Themes();
55
- if ( !empty( $aThemeRestrictions ) ) {
56
- add_filter( 'user_has_cap', array( $this, 'disableThemeManipulation' ), 0, 3 );
57
- }
58
 
59
- $aPostRestrictions = $oFO->getAdminAccessArea_Posts();
60
- if ( !empty( $aPostRestrictions ) ) {
61
- add_filter( 'user_has_cap', array( $this, 'disablePostsManipulation' ), 0, 3 );
62
- }
63
 
64
- if ( !$this->getController()->isThisPluginModuleRequest() ) {
65
- add_action( 'admin_footer', array( $this, 'printAdminAccessAjaxForm' ) );
 
 
 
 
 
 
66
  }
67
  }
68
 
@@ -228,14 +228,14 @@ class ICWP_WPSF_Processor_AdminAccessRestriction extends ICWP_WPSF_Processor_Bas
228
  if ( in_array( $sUserCap, $aReleventCaps ) ) {
229
  $bBlockCapability = false;
230
 
231
- $oDp = $this->loadDP();
232
  $oWpUsers = $this->loadWpUsers();
233
 
234
  // Find the WP_User for the POST
235
  $oPostUser = false;
236
- $sPostUserlogin = $oDp->post( 'user_login' );
237
  if ( empty( $sPostUserlogin ) ) {
238
- $nPostUserId = $oDp->post( 'user_id' );
239
  if ( !empty( $nPostUserId ) ) {
240
  $oPostUser = $oWpUsers->getUserById( $nPostUserId );
241
  }
@@ -244,7 +244,7 @@ class ICWP_WPSF_Processor_AdminAccessRestriction extends ICWP_WPSF_Processor_Bas
244
  $oPostUser = $oWpUsers->getUserByUsername( $sPostUserlogin );
245
  }
246
 
247
- $sRequestRole = strtolower( $oDp->post( 'role', '' ) );
248
 
249
  if ( $oPostUser instanceof WP_User ) {
250
  // editing an existing user other than yourself?
@@ -281,7 +281,7 @@ class ICWP_WPSF_Processor_AdminAccessRestriction extends ICWP_WPSF_Processor_Bas
281
  }
282
 
283
  $sCurrentPage = $this->loadWp()->getCurrentPage();
284
- $sCurrentGetPage = $this->loadDP()->query( 'page' );
285
  if ( !in_array( $sCurrentPage, $oFO->getOptionsPagesToRestrict() ) || !empty( $sCurrentGetPage ) ) {
286
  return;
287
  }
@@ -411,10 +411,9 @@ class ICWP_WPSF_Processor_AdminAccessRestriction extends ICWP_WPSF_Processor_Bas
411
  * @return array
412
  */
413
  public function disablePluginManipulation( $aAllCaps, $cap, $aArgs ) {
414
-
415
  /** @var ICWP_WPSF_FeatureHandler_AdminAccessRestriction $oFO */
416
  $oFO = $this->getMod();
417
- $oDp = $this->loadDP();
418
 
419
  /** @var string $sRequestedCapability */
420
  $sRequestedCapability = $aArgs[ 0 ];
@@ -422,8 +421,8 @@ class ICWP_WPSF_Processor_AdminAccessRestriction extends ICWP_WPSF_Processor_Bas
422
  // special case for plugin info thickbox for changelog
423
  $bIsChangelog = defined( 'IFRAME_REQUEST' )
424
  && ( $sRequestedCapability === 'install_plugins' )
425
- && ( $oDp->query( 'section' ) == 'changelog' )
426
- && $oDp->query( 'plugin' );
427
  if ( $bIsChangelog ) {
428
  return $aAllCaps;
429
  }
@@ -540,6 +539,9 @@ class ICWP_WPSF_Processor_AdminAccessRestriction extends ICWP_WPSF_Processor_Bas
540
  $oFO = $this->getMod();
541
 
542
  $aRenderData = array(
 
 
 
543
  'strings' => array(
544
  'editing_restricted' => _wpsf__( 'Editing this option is currently restricted.' ),
545
  'unlock_link' => $this->getUnlockLinkHtml(),
31
 
32
  public function onWpInit() {
33
  parent::onWpInit();
 
 
 
 
 
34
 
35
+ if ( $this->loadWpUsers()->isUserLoggedIn() && !$this->isSecurityAdmin() ) {
36
+ /** @var ICWP_WPSF_FeatureHandler_AdminAccessRestriction $oFO */
37
+ $oFO = $this->getMod();
 
 
 
 
 
38
 
39
+ if ( $oFO->isAdminAccessAdminUsersEnabled() ) {
40
+ add_filter( 'editable_roles', array( $this, 'restrictEditableRoles' ), 100, 1 );
41
+ add_filter( 'user_has_cap', array( $this, 'restrictAdminUserChanges' ), 100, 3 );
42
+ add_action( 'delete_user', array( $this, 'restrictAdminUserDelete' ), 100, 1 );
43
+ add_action( 'add_user_role', array( $this, 'restrictAddUserRole' ), 100, 2 );
44
+ add_action( 'remove_user_role', array( $this, 'restrictRemoveUserRole' ), 100, 2 );
45
+ add_action( 'set_user_role', array( $this, 'restrictSetUserRole' ), 100, 3 );
46
+ }
47
 
48
+ $aPluginRestrictions = $oFO->getAdminAccessArea_Plugins();
49
+ if ( !empty( $aPluginRestrictions ) ) {
50
+ add_filter( 'user_has_cap', array( $this, 'disablePluginManipulation' ), 0, 3 );
51
+ }
52
 
53
+ $aThemeRestrictions = $oFO->getAdminAccessArea_Themes();
54
+ if ( !empty( $aThemeRestrictions ) ) {
55
+ add_filter( 'user_has_cap', array( $this, 'disableThemeManipulation' ), 0, 3 );
56
+ }
57
 
58
+ $aPostRestrictions = $oFO->getAdminAccessArea_Posts();
59
+ if ( !empty( $aPostRestrictions ) ) {
60
+ add_filter( 'user_has_cap', array( $this, 'disablePostsManipulation' ), 0, 3 );
61
+ }
62
+
63
+ if ( !$this->getController()->isThisPluginModuleRequest() ) {
64
+ add_action( 'admin_footer', array( $this, 'printAdminAccessAjaxForm' ) );
65
+ }
66
  }
67
  }
68
 
228
  if ( in_array( $sUserCap, $aReleventCaps ) ) {
229
  $bBlockCapability = false;
230
 
231
+ $oReq = $this->loadRequest();
232
  $oWpUsers = $this->loadWpUsers();
233
 
234
  // Find the WP_User for the POST
235
  $oPostUser = false;
236
+ $sPostUserlogin = $oReq->post( 'user_login' );
237
  if ( empty( $sPostUserlogin ) ) {
238
+ $nPostUserId = $oReq->post( 'user_id' );
239
  if ( !empty( $nPostUserId ) ) {
240
  $oPostUser = $oWpUsers->getUserById( $nPostUserId );
241
  }
244
  $oPostUser = $oWpUsers->getUserByUsername( $sPostUserlogin );
245
  }
246
 
247
+ $sRequestRole = strtolower( $oReq->post( 'role', '' ) );
248
 
249
  if ( $oPostUser instanceof WP_User ) {
250
  // editing an existing user other than yourself?
281
  }
282
 
283
  $sCurrentPage = $this->loadWp()->getCurrentPage();
284
+ $sCurrentGetPage = $this->loadRequest()->query( 'page' );
285
  if ( !in_array( $sCurrentPage, $oFO->getOptionsPagesToRestrict() ) || !empty( $sCurrentGetPage ) ) {
286
  return;
287
  }
411
  * @return array
412
  */
413
  public function disablePluginManipulation( $aAllCaps, $cap, $aArgs ) {
 
414
  /** @var ICWP_WPSF_FeatureHandler_AdminAccessRestriction $oFO */
415
  $oFO = $this->getMod();
416
+ $oReq = $this->loadRequest();
417
 
418
  /** @var string $sRequestedCapability */
419
  $sRequestedCapability = $aArgs[ 0 ];
421
  // special case for plugin info thickbox for changelog
422
  $bIsChangelog = defined( 'IFRAME_REQUEST' )
423
  && ( $sRequestedCapability === 'install_plugins' )
424
+ && ( $oReq->query( 'section' ) == 'changelog' )
425
+ && $oReq->query( 'plugin' );
426
  if ( $bIsChangelog ) {
427
  return $aAllCaps;
428
  }
539
  $oFO = $this->getMod();
540
 
541
  $aRenderData = array(
542
+ 'flags' => array(
543
+ 'restrict_options' => $oFO->getAdminAccessArea_Options()
544
+ ),
545
  'strings' => array(
546
  'editing_restricted' => _wpsf__( 'Editing this option is currently restricted.' ),
547
  'unlock_link' => $this->getUnlockLinkHtml(),
src/processors/audit_trail.php CHANGED
@@ -122,6 +122,7 @@ class ICWP_WPSF_Processor_AuditTrail extends ICWP_WPSF_BaseDbProcessor {
122
  }
123
 
124
  /**
 
125
  * @param string $sContext
126
  * @param string $sOrderBy
127
  * @param string $sOrder
122
  }
123
 
124
  /**
125
+ * @CENTRAL
126
  * @param string $sContext
127
  * @param string $sOrderBy
128
  * @param string $sOrder
src/processors/audit_trail_auditor_base.php CHANGED
@@ -33,8 +33,8 @@ class ICWP_WPSF_AuditTrail_Auditor_Base extends ICWP_WPSF_Foundation {
33
  }
34
 
35
  $aNewEntry = array(
36
- 'ip' => $oDp->loadIpService()->getRequestIp(),
37
- 'created_at' => $oDp->time(),
38
  'wp_username' => $sWpUsername,
39
  'context' => $sContext,
40
  'event' => $sEvent,
33
  }
34
 
35
  $aNewEntry = array(
36
+ 'ip' => $this->loadIpService()->getRequestIp(),
37
+ 'created_at' => $this->loadRequest()->ts(),
38
  'wp_username' => $sWpUsername,
39
  'context' => $sContext,
40
  'event' => $sEvent,
src/processors/base.php CHANGED
@@ -297,7 +297,7 @@ abstract class ICWP_WPSF_Processor_Base extends ICWP_WPSF_Foundation {
297
  * @return int
298
  */
299
  protected function time() {
300
- return $this->loadDP()->time();
301
  }
302
 
303
  /**
297
  * @return int
298
  */
299
  protected function time() {
300
+ return $this->loadRequest()->ts();
301
  }
302
 
303
  /**
src/processors/base_plugin.php CHANGED
@@ -168,7 +168,7 @@ class ICWP_WPSF_Processor_BasePlugin extends ICWP_WPSF_Processor_BaseWpsf {
168
  'dismiss' => _wpsf__( 'Dismiss this notice' )
169
  ),
170
  'hrefs' => array(
171
- 'upgrade_link' => $oWpPlugins->getLinkPluginUpgrade( $sBaseFile )
172
  )
173
  );
174
  $this->insertAdminNotice( $aRenderData );
168
  'dismiss' => _wpsf__( 'Dismiss this notice' )
169
  ),
170
  'hrefs' => array(
171
+ 'upgrade_link' => $oWpPlugins->getUrl_Upgrade( $sBaseFile )
172
  )
173
  );
174
  $this->insertAdminNotice( $aRenderData );
src/processors/base_wpsf.php CHANGED
@@ -49,7 +49,7 @@ abstract class ICWP_WPSF_Processor_BaseWpsf extends ICWP_WPSF_Processor_Base {
49
  if ( empty( $nTimeInstalled ) ) {
50
  return 0;
51
  }
52
- return (int)round( ( $this->loadDP()->time() - $nTimeInstalled )/DAY_IN_SECONDS );
53
  }
54
 
55
  /**
@@ -82,7 +82,7 @@ abstract class ICWP_WPSF_Processor_BaseWpsf extends ICWP_WPSF_Processor_Base {
82
  * @return string
83
  */
84
  protected function getRecaptchaResponse() {
85
- return $this->loadDP()->post( 'g-recaptcha-response' );
86
  }
87
 
88
  /**
49
  if ( empty( $nTimeInstalled ) ) {
50
  return 0;
51
  }
52
+ return (int)round( ( $this->loadRequest()->ts() - $nTimeInstalled )/DAY_IN_SECONDS );
53
  }
54
 
55
  /**
82
  * @return string
83
  */
84
  protected function getRecaptchaResponse() {
85
+ return $this->loadRequest()->post( 'g-recaptcha-response' );
86
  }
87
 
88
  /**
src/processors/commentsfilter_antibotspam.php CHANGED
@@ -45,7 +45,7 @@ class ICWP_WPSF_Processor_CommentsFilter_AntiBotSpam extends ICWP_WPSF_BaseDbPro
45
  }
46
 
47
  public function setupForm() {
48
- if ( !$this->loadDP()->isMethodPost() && $this->getIfDoGaspCheck() ) {
49
  add_action( 'comment_form', array( $this, 'printGaspFormItems' ), 1 );
50
  }
51
  }
@@ -110,13 +110,13 @@ class ICWP_WPSF_Processor_CommentsFilter_AntiBotSpam extends ICWP_WPSF_BaseDbPro
110
  $sStatKey = '';
111
  $sExplanation = '';
112
 
113
- $oDp = $this->loadDP();
114
- $sFieldCheckboxName = $oDp->post( 'cb_nombre' );
115
- $sFieldHoney = $oDp->post( 'sugar_sweet_email' );
116
- $sCommentToken = $oDp->post( 'comment_token' );
117
 
118
  // we have the cb name, is it set?
119
- if ( !$sFieldCheckboxName || !$oDp->post( $sFieldCheckboxName ) ) {
120
  $sExplanation = sprintf( _wpsf__( 'Failed GASP Bot Filter Test (%s)' ), _wpsf__( 'checkbox' ) );
121
  $sStatKey = 'checkbox';
122
  }
@@ -158,7 +158,7 @@ class ICWP_WPSF_Processor_CommentsFilter_AntiBotSpam extends ICWP_WPSF_BaseDbPro
158
  protected function getIfDoGaspCheck() {
159
  $bCheck = true;
160
 
161
- if ( function_exists( 'WPWall_Init' ) && !is_null( $this->loadDP()->post( 'submit_wall_post' ) ) ) {
162
  $bCheck = false; // Compatibility with shoutbox WP Wall Plugin http://wordpress.org/plugins/wp-wall/
163
  }
164
 
45
  }
46
 
47
  public function setupForm() {
48
+ if ( !$this->loadRequest()->isMethodPost() && $this->getIfDoGaspCheck() ) {
49
  add_action( 'comment_form', array( $this, 'printGaspFormItems' ), 1 );
50
  }
51
  }
110
  $sStatKey = '';
111
  $sExplanation = '';
112
 
113
+ $oReq = $this->loadRequest();
114
+ $sFieldCheckboxName = $oReq->post( 'cb_nombre' );
115
+ $sFieldHoney = $oReq->post( 'sugar_sweet_email' );
116
+ $sCommentToken = $oReq->post( 'comment_token' );
117
 
118
  // we have the cb name, is it set?
119
+ if ( !$sFieldCheckboxName || !$oReq->post( $sFieldCheckboxName ) ) {
120
  $sExplanation = sprintf( _wpsf__( 'Failed GASP Bot Filter Test (%s)' ), _wpsf__( 'checkbox' ) );
121
  $sStatKey = 'checkbox';
122
  }
158
  protected function getIfDoGaspCheck() {
159
  $bCheck = true;
160
 
161
+ if ( function_exists( 'WPWall_Init' ) && !is_null( $this->loadRequest()->post( 'submit_wall_post' ) ) ) {
162
  $bCheck = false; // Compatibility with shoutbox WP Wall Plugin http://wordpress.org/plugins/wp-wall/
163
  }
164
 
src/processors/commentsfilter_humanspam.php CHANGED
@@ -61,7 +61,7 @@ class ICWP_WPSF_Processor_CommentsFilter_HumanSpam extends ICWP_WPSF_Processor_C
61
  $aCommentData[ 'comment_author_url' ],
62
  $aCommentData[ 'comment_content' ],
63
  $this->ip(),
64
- substr( $this->loadDP()->server( 'HTTP_USER_AGENT', '' ), 0, 254 )
65
  );
66
 
67
  // Now we check whether comment status is to completely reject and then we simply redirect to "home"
61
  $aCommentData[ 'comment_author_url' ],
62
  $aCommentData[ 'comment_content' ],
63
  $this->ip(),
64
+ substr( $this->loadRequest()->server( 'HTTP_USER_AGENT', '' ), 0, 254 )
65
  );
66
 
67
  // Now we check whether comment status is to completely reject and then we simply redirect to "home"
src/processors/firewall.php CHANGED
@@ -58,14 +58,14 @@ class ICWP_WPSF_Processor_Firewall extends ICWP_WPSF_Processor_BaseWpsf {
58
  */
59
  protected function getIfPerformFirewallScan() {
60
  $bPerformScan = true;
61
- $oDp = $this->loadDP();
62
 
63
  if ( count( $this->getRawRequestParams() ) == 0 ) {
64
  $bPerformScan = false;
65
  }
66
 
67
  // if we couldn't process the REQUEST_URI parts, we can't firewall so we effectively whitelist without erroring.
68
- $aRequestParts = $oDp->getRequestUriParts();
69
  if ( $bPerformScan && empty( $aRequestParts ) ) {
70
  $sAuditMessage = sprintf( _wpsf__( 'Skipping firewall checking for this visit: %s.' ), _wpsf__( 'Parsing the URI failed' ) );
71
  $this->addToAuditEntry( $sAuditMessage, 2, 'firewall_skip' );
@@ -79,7 +79,7 @@ class ICWP_WPSF_Processor_Firewall extends ICWP_WPSF_Processor_BaseWpsf {
79
  $bPerformScan = false;
80
  }
81
 
82
- if ( $bPerformScan && $this->getOption( 'ignore_search_engines' ) == 'Y' && $oDp->isSearchEngineBot() ) {
83
  $sAuditMessage = sprintf( _wpsf__( 'Skipping firewall checking for this visit: %s.' ), _wpsf__( 'Visitor detected as Search Engine Bot' ) );
84
  $this->addToAuditEntry( $sAuditMessage, 2, 'firewall_skip' );
85
  $bPerformScan = false;
@@ -358,10 +358,9 @@ class ICWP_WPSF_Processor_Firewall extends ICWP_WPSF_Processor_BaseWpsf {
358
  return $this->aPageParams;
359
  }
360
 
361
- $oDp = $this->loadDP();
362
  $this->aPageParams = $this->getRawRequestParams();
363
  $aWhitelistPages = $this->getWhitelistPages();
364
- $aRequestUriParts = $oDp->getRequestUriParts();
365
  $sRequestPage = $aRequestUriParts[ 'path' ];
366
 
367
  // first we remove globally whitelisted request parameters
@@ -415,7 +414,7 @@ class ICWP_WPSF_Processor_Firewall extends ICWP_WPSF_Processor_BaseWpsf {
415
  * @return array
416
  */
417
  protected function getRawRequestParams() {
418
- return $this->loadDP()->getRequestParams( $this->getMod()->isOpt( 'include_cookie_checks', 'Y' ) );
419
  }
420
 
421
  /**
58
  */
59
  protected function getIfPerformFirewallScan() {
60
  $bPerformScan = true;
61
+ $oReq = $this->loadRequest();
62
 
63
  if ( count( $this->getRawRequestParams() ) == 0 ) {
64
  $bPerformScan = false;
65
  }
66
 
67
  // if we couldn't process the REQUEST_URI parts, we can't firewall so we effectively whitelist without erroring.
68
+ $aRequestParts = $oReq->getUriParts();
69
  if ( $bPerformScan && empty( $aRequestParts ) ) {
70
  $sAuditMessage = sprintf( _wpsf__( 'Skipping firewall checking for this visit: %s.' ), _wpsf__( 'Parsing the URI failed' ) );
71
  $this->addToAuditEntry( $sAuditMessage, 2, 'firewall_skip' );
79
  $bPerformScan = false;
80
  }
81
 
82
+ if ( $bPerformScan && $this->getOption( 'ignore_search_engines' ) == 'Y' && $oReq->isSearchEngineBot() ) {
83
  $sAuditMessage = sprintf( _wpsf__( 'Skipping firewall checking for this visit: %s.' ), _wpsf__( 'Visitor detected as Search Engine Bot' ) );
84
  $this->addToAuditEntry( $sAuditMessage, 2, 'firewall_skip' );
85
  $bPerformScan = false;
358
  return $this->aPageParams;
359
  }
360
 
 
361
  $this->aPageParams = $this->getRawRequestParams();
362
  $aWhitelistPages = $this->getWhitelistPages();
363
+ $aRequestUriParts = $this->loadRequest()->getUriParts();
364
  $sRequestPage = $aRequestUriParts[ 'path' ];
365
 
366
  // first we remove globally whitelisted request parameters
414
  * @return array
415
  */
416
  protected function getRawRequestParams() {
417
+ return $this->loadRequest()->getParams( $this->getMod()->isOpt( 'include_cookie_checks', 'Y' ) );
418
  }
419
 
420
  /**
src/processors/hack_protect.php CHANGED
@@ -15,7 +15,7 @@ class ICWP_WPSF_Processor_HackProtect extends ICWP_WPSF_Processor_BaseWpsf {
15
  /** @var ICWP_WPSF_FeatureHandler_HackProtect $oFO */
16
  $oFO = $this->getMod();
17
 
18
- $sPath = $this->loadDP()->getRequestPath();
19
  if ( !empty( $sPath ) && ( strpos( $sPath, '/wp-admin/admin-ajax.php' ) !== false ) ) {
20
  $this->revSliderPatch_LFI();
21
  $this->revSliderPatch_AFU();
@@ -160,10 +160,10 @@ class ICWP_WPSF_Processor_HackProtect extends ICWP_WPSF_Processor_BaseWpsf {
160
  }
161
 
162
  protected function revSliderPatch_LFI() {
163
- $oDp = $this->loadDP();
164
 
165
- $sAction = $oDp->query( 'action', '' );
166
- $sFileExt = strtolower( $oDp->getExtension( $oDp->query( 'img', '' ) ) );
167
  if ( $sAction == 'revslider_show_image' && !empty( $sFileExt ) ) {
168
  if ( !in_array( $sFileExt, array( 'jpg', 'jpeg', 'png', 'tiff', 'tif', 'gif' ) ) ) {
169
  die( 'RevSlider Local File Inclusion Attempt' );
@@ -172,10 +172,10 @@ class ICWP_WPSF_Processor_HackProtect extends ICWP_WPSF_Processor_BaseWpsf {
172
  }
173
 
174
  protected function revSliderPatch_AFU() {
175
- $oDp = $this->loadDP();
176
 
177
- $sAction = strtolower( $oDp->request( 'action', '' ) );
178
- $sClientAction = strtolower( $oDp->request( 'client_action', '' ) );
179
  if ( ( strpos( $sAction, 'revslider_ajax_action' ) !== false || strpos( $sAction, 'showbiz_ajax_action' ) !== false ) && $sClientAction == 'update_plugin' ) {
180
  die( 'RevSlider Arbitrary File Upload Attempt' );
181
  }
15
  /** @var ICWP_WPSF_FeatureHandler_HackProtect $oFO */
16
  $oFO = $this->getMod();
17
 
18
+ $sPath = $this->loadRequest()->getPath();
19
  if ( !empty( $sPath ) && ( strpos( $sPath, '/wp-admin/admin-ajax.php' ) !== false ) ) {
20
  $this->revSliderPatch_LFI();
21
  $this->revSliderPatch_AFU();
160
  }
161
 
162
  protected function revSliderPatch_LFI() {
163
+ $oReq = $this->loadRequest();
164
 
165
+ $sAction = $oReq->query( 'action', '' );
166
+ $sFileExt = strtolower( $this->loadDP()->getExtension( $oReq->query( 'img', '' ) ) );
167
  if ( $sAction == 'revslider_show_image' && !empty( $sFileExt ) ) {
168
  if ( !in_array( $sFileExt, array( 'jpg', 'jpeg', 'png', 'tiff', 'tif', 'gif' ) ) ) {
169
  die( 'RevSlider Local File Inclusion Attempt' );
172
  }
173
 
174
  protected function revSliderPatch_AFU() {
175
+ $oReq = $this->loadRequest();
176
 
177
+ $sAction = strtolower( $oReq->request( 'action', '' ) );
178
+ $sClientAction = strtolower( $oReq->request( 'client_action', '' ) );
179
  if ( ( strpos( $sAction, 'revslider_ajax_action' ) !== false || strpos( $sAction, 'showbiz_ajax_action' ) !== false ) && $sClientAction == 'update_plugin' ) {
180
  die( 'RevSlider Arbitrary File Upload Attempt' );
181
  }
src/processors/hackprotect_corechecksumscan.php CHANGED
@@ -15,12 +15,12 @@ class ICWP_WPSF_Processor_HackProtect_CoreChecksumScan extends ICWP_WPSF_Process
15
  // $this->cron_dailyChecksumScan();
16
 
17
  if ( $this->loadWpUsers()->isUserAdmin() ) {
18
- $oDp = $this->loadDP();
19
 
20
- switch ( $oDp->query( 'shield_action' ) ) {
21
 
22
  case 'repair_file':
23
- $sPath = '/'.trim( $oDp->query( 'repair_file_path' ) ); // "/" prevents esc_url() from prepending http.
24
  $sMd5FilePath = urldecode( esc_url( $sPath ) );
25
  if ( !empty( $sMd5FilePath ) ) {
26
  if ( $this->repairCoreFile( $sMd5FilePath ) ) {
@@ -143,7 +143,7 @@ class ICWP_WPSF_Processor_HackProtect_CoreChecksumScan extends ICWP_WPSF_Process
143
  /** @var ICWP_WPSF_FeatureHandler_HackProtect $oFO */
144
  $oFO = $this->getMod();
145
 
146
- $bOptionRepair = $oFO->isWcfScanAutoRepair() || ( $this->loadDP()->query( 'checksum_repair' ) == 1 );
147
 
148
  $aFiles = $this->doChecksumScan( $bOptionRepair );
149
  if ( !empty( $aFiles[ 'checksum_mismatch' ] ) || !empty( $aFiles[ 'missing' ] ) ) {
15
  // $this->cron_dailyChecksumScan();
16
 
17
  if ( $this->loadWpUsers()->isUserAdmin() ) {
18
+ $oReq = $this->loadRequest();
19
 
20
+ switch ( $oReq->query( 'shield_action' ) ) {
21
 
22
  case 'repair_file':
23
+ $sPath = '/'.trim( $oReq->query( 'repair_file_path' ) ); // "/" prevents esc_url() from prepending http.
24
  $sMd5FilePath = urldecode( esc_url( $sPath ) );
25
  if ( !empty( $sMd5FilePath ) ) {
26
  if ( $this->repairCoreFile( $sMd5FilePath ) ) {
143
  /** @var ICWP_WPSF_FeatureHandler_HackProtect $oFO */
144
  $oFO = $this->getMod();
145
 
146
+ $bOptionRepair = $oFO->isWcfScanAutoRepair() || ( $this->loadRequest()->query( 'checksum_repair' ) == 1 );
147
 
148
  $aFiles = $this->doChecksumScan( $bOptionRepair );
149
  if ( !empty( $aFiles[ 'checksum_mismatch' ] ) || !empty( $aFiles[ 'missing' ] ) ) {
src/processors/hackprotect_filecleanerscan.php CHANGED
@@ -19,11 +19,11 @@ class ICWP_WPSF_Processor_HackProtect_FileCleanerScan extends ICWP_WPSF_Processo
19
  $this->setupChecksumCron();
20
 
21
  if ( $this->loadWpUsers()->isUserAdmin() ) {
22
- $oDp = $this->loadDP();
23
 
24
- switch ( $oDp->query( 'shield_action' ) ) {
25
  case 'delete_unrecognised_file':
26
- $sPath = '/'.trim( $oDp->query( 'repair_file_path' ) ); // "/" prevents esc_url() from prepending http.
27
  break;
28
  }
29
  }
19
  $this->setupChecksumCron();
20
 
21
  if ( $this->loadWpUsers()->isUserAdmin() ) {
22
+ $oReq = $this->loadRequest();
23
 
24
+ switch ( $oReq->query( 'shield_action' ) ) {
25
  case 'delete_unrecognised_file':
26
+ $sPath = '/'.$oReq->query( 'repair_file_path' ); // "/" prevents esc_url() from prepending http.
27
  break;
28
  }
29
  }
src/processors/hackprotect_pluginvulnerabilities.php CHANGED
@@ -56,9 +56,7 @@ if ( !class_exists( 'ICWP_WPSF_Processor_HackProtect_PluginVulnerabilities', fal
56
  /** @var ICWP_WPSF_FeatureHandler_HackProtect $oFO */
57
  $oFO = $this->getMod();
58
 
59
- $aPlugins = $this->loadWpPlugins()->getPlugins();
60
-
61
- foreach( $aPlugins as $sPluginFile => $aPluginData ) {
62
  $aPluginVulnerabilityData = $this->getPluginVulnerabilityData( $sPluginFile, $aPluginData );
63
  if ( is_array( $aPluginVulnerabilityData ) ) {
64
  $this->addPluginVulnerabilityToEmail( $aPluginData, $aPluginVulnerabilityData );
@@ -122,8 +120,7 @@ if ( !class_exists( 'ICWP_WPSF_Processor_HackProtect_PluginVulnerabilities', fal
122
  }
123
 
124
  public function addPluginVulnerabilityRows() {
125
- $aPlugins = $this->loadWpPlugins()->getPlugins();
126
- foreach( array_keys( $aPlugins ) as $sPluginFile ) {
127
  add_action( "after_plugin_row_$sPluginFile", array( $this, 'attachVulnerabilityWarning' ), 100, 2 );
128
  }
129
  }
56
  /** @var ICWP_WPSF_FeatureHandler_HackProtect $oFO */
57
  $oFO = $this->getMod();
58
 
59
+ foreach( $this->loadWpPlugins()->getPlugins() as $sPluginFile => $aPluginData ) {
 
 
60
  $aPluginVulnerabilityData = $this->getPluginVulnerabilityData( $sPluginFile, $aPluginData );
61
  if ( is_array( $aPluginVulnerabilityData ) ) {
62
  $this->addPluginVulnerabilityToEmail( $aPluginData, $aPluginVulnerabilityData );
120
  }
121
 
122
  public function addPluginVulnerabilityRows() {
123
+ foreach( $this->loadWpPlugins()->getInstalledBaseFiles() as $sPluginFile ) {
 
124
  add_action( "after_plugin_row_$sPluginFile", array( $this, 'attachVulnerabilityWarning' ), 100, 2 );
125
  }
126
  }
src/processors/hackprotect_ptguard.php CHANGED
@@ -235,7 +235,7 @@ class ICWP_WPSF_Processor_HackProtect_PTGuard extends ICWP_WPSF_Processor_CronBa
235
  'meta' => array(
236
  'name' => $aPlugin[ 'Name' ],
237
  'version' => $aPlugin[ 'Version' ],
238
- 'ts' => $this->loadDP()->time(),
239
  ),
240
  'hashes' => $this->hashPluginFiles( $sBaseFile )
241
  );
@@ -252,7 +252,7 @@ class ICWP_WPSF_Processor_HackProtect_PTGuard extends ICWP_WPSF_Processor_CronBa
252
  'meta' => array(
253
  'name' => $oTheme->get( 'Name' ),
254
  'version' => $oTheme->get( 'Version' ),
255
- 'ts' => $this->loadDP()->time(),
256
  ),
257
  'hashes' => $this->hashThemeFiles( $sSlug )
258
  );
@@ -265,7 +265,7 @@ class ICWP_WPSF_Processor_HackProtect_PTGuard extends ICWP_WPSF_Processor_CronBa
265
  $oWpPl = $this->loadWpPlugins();
266
 
267
  $aSnapshot = array();
268
- foreach ( $oWpPl->getInstalledPluginFiles() as $sBaseName ) {
269
  if ( $oWpPl->isActive( $sBaseName ) ) {
270
  $aSnapshot[ $sBaseName ] = $this->snapshotPlugin( $sBaseName );
271
  }
235
  'meta' => array(
236
  'name' => $aPlugin[ 'Name' ],
237
  'version' => $aPlugin[ 'Version' ],
238
+ 'ts' => $this->loadRequest()->ts(),
239
  ),
240
  'hashes' => $this->hashPluginFiles( $sBaseFile )
241
  );
252
  'meta' => array(
253
  'name' => $oTheme->get( 'Name' ),
254
  'version' => $oTheme->get( 'Version' ),
255
+ 'ts' => $this->loadRequest()->ts(),
256
  ),
257
  'hashes' => $this->hashThemeFiles( $sSlug )
258
  );
265
  $oWpPl = $this->loadWpPlugins();
266
 
267
  $aSnapshot = array();
268
+ foreach ( $oWpPl->getInstalledBaseFiles() as $sBaseName ) {
269
  if ( $oWpPl->isActive( $sBaseName ) ) {
270
  $aSnapshot[ $sBaseName ] = $this->snapshotPlugin( $sBaseName );
271
  }
src/processors/hackprotect_wpvulnscan.php CHANGED
@@ -83,14 +83,14 @@ class ICWP_WPSF_Processor_HackProtect_WpVulnScan extends ICWP_WPSF_Processor_Bas
83
  add_filter( 'views_plugins', array( $this, 'addPluginsStatusViewLink' ), 1000 );
84
 
85
  add_filter( 'manage_plugins_columns', array( $this, 'fCountColumns' ), 1000 );
86
- foreach ( array_keys( $this->loadWpPlugins()->getPlugins() ) as $sPluginFile ) {
87
  add_action( "after_plugin_row_$sPluginFile", array( $this, 'attachVulnerabilityWarning' ), 100, 2 );
88
  }
89
  }
90
  }
91
 
92
  public function addVulnerablePluginStatusView() {
93
- if ( $this->loadDP()->query( 'plugin_status' ) == 'vulnerable' ) {
94
  global $status;
95
  $status = 'vulnerable';
96
  }
@@ -120,7 +120,7 @@ class ICWP_WPSF_Processor_HackProtect_WpVulnScan extends ICWP_WPSF_Processor_Bas
120
  * @return array
121
  */
122
  public function filterPluginsToView( $aPlugins ) {
123
- if ( $this->loadDP()->query( 'plugin_status' ) == 'vulnerable' ) {
124
  global $status;
125
  $status = 'vulnerable';
126
  $aPlugins = array_intersect_key( $aPlugins, $this->getVulnerablePlugins() );
@@ -265,7 +265,7 @@ class ICWP_WPSF_Processor_HackProtect_WpVulnScan extends ICWP_WPSF_Processor_Bas
265
  if ( !isset( $this->aPluginVulnerabilities ) || !is_array( $this->aPluginVulnerabilities ) ) {
266
  $this->aPluginVulnerabilities = array();
267
 
268
- foreach ( $this->loadWpPlugins()->getInstalledPluginFiles() as $sFile ) {
269
 
270
  $aThisVulns = $this->getPluginVulnerabilities( $sFile );
271
  if ( !empty( $aThisVulns ) ) {
83
  add_filter( 'views_plugins', array( $this, 'addPluginsStatusViewLink' ), 1000 );
84
 
85
  add_filter( 'manage_plugins_columns', array( $this, 'fCountColumns' ), 1000 );
86
+ foreach ( $this->loadWpPlugins()->getInstalledBaseFiles() as $sPluginFile ) {
87
  add_action( "after_plugin_row_$sPluginFile", array( $this, 'attachVulnerabilityWarning' ), 100, 2 );
88
  }
89
  }
90
  }
91
 
92
  public function addVulnerablePluginStatusView() {
93
+ if ( $this->loadRequest()->query( 'plugin_status' ) == 'vulnerable' ) {
94
  global $status;
95
  $status = 'vulnerable';
96
  }
120
  * @return array
121
  */
122
  public function filterPluginsToView( $aPlugins ) {
123
+ if ( $this->loadRequest()->query( 'plugin_status' ) == 'vulnerable' ) {
124
  global $status;
125
  $status = 'vulnerable';
126
  $aPlugins = array_intersect_key( $aPlugins, $this->getVulnerablePlugins() );
265
  if ( !isset( $this->aPluginVulnerabilities ) || !is_array( $this->aPluginVulnerabilities ) ) {
266
  $this->aPluginVulnerabilities = array();
267
 
268
+ foreach ( $this->loadWpPlugins()->getInstalledBaseFiles() as $sFile ) {
269
 
270
  $aThisVulns = $this->getPluginVulnerabilities( $sFile );
271
  if ( !empty( $aThisVulns ) ) {
src/processors/ips.php CHANGED
@@ -55,7 +55,7 @@ class ICWP_WPSF_Processor_Ips extends ICWP_WPSF_BaseDbProcessor {
55
  $this->setIpTransgressed(); // We now black mark this IP
56
  }
57
  $this->addToAuditEntry(
58
- sprintf( _wpsf__( '404 detected at "%s"' ), $this->loadDP()->getRequestPath() ),
59
  2, 'request_tracking_404'
60
  );
61
  }
55
  $this->setIpTransgressed(); // We now black mark this IP
56
  }
57
  $this->addToAuditEntry(
58
+ sprintf( _wpsf__( '404 detected at "%s"' ), $this->loadRequest()->getPath() ),
59
  2, 'request_tracking_404'
60
  );
61
  }
src/processors/license.php CHANGED
@@ -13,15 +13,15 @@ class ICWP_WPSF_Processor_License extends ICWP_WPSF_Processor_BaseWpsf {
13
  public function run() {
14
  /** @var ICWP_WPSF_FeatureHandler_License $oFO */
15
  $oFO = $this->getMod();
16
- $oDp = $this->loadDP();
17
 
18
  // performs the license check
19
  add_action( $oFO->prefix( 'adhoc_cron_license_check' ), array( $oFO, 'verifyLicense' ) );
20
 
21
- switch ( $oDp->query( 'shield_action' ) ) {
22
 
23
  case 'keyless_handshake':
24
- $sNonce = $oDp->query( 'nonce' );
25
  if ( !empty( $sNonce ) && $sNonce == $oFO->getKeylessRequestHash() ) {
26
  $aHandshakeData = array( 'success' => false );
27
  if ( !$oFO->isKeylessHandshakeExpired() ) {
@@ -33,7 +33,7 @@ class ICWP_WPSF_Processor_License extends ICWP_WPSF_Processor_BaseWpsf {
33
 
34
  case 'license_check':
35
  if ( !wp_next_scheduled( $oFO->prefix( 'adhoc_cron_license_check' ) ) ) {
36
- wp_schedule_single_event( $oDp->time() + 12, $oFO->prefix( 'adhoc_cron_license_check' ), array( true ) );
37
  }
38
  break;
39
  }
13
  public function run() {
14
  /** @var ICWP_WPSF_FeatureHandler_License $oFO */
15
  $oFO = $this->getMod();
16
+ $oReq = $this->loadRequest();
17
 
18
  // performs the license check
19
  add_action( $oFO->prefix( 'adhoc_cron_license_check' ), array( $oFO, 'verifyLicense' ) );
20
 
21
+ switch ( $oReq->query( 'shield_action' ) ) {
22
 
23
  case 'keyless_handshake':
24
+ $sNonce = $oReq->query( 'nonce' );
25
  if ( !empty( $sNonce ) && $sNonce == $oFO->getKeylessRequestHash() ) {
26
  $aHandshakeData = array( 'success' => false );
27
  if ( !$oFO->isKeylessHandshakeExpired() ) {
33
 
34
  case 'license_check':
35
  if ( !wp_next_scheduled( $oFO->prefix( 'adhoc_cron_license_check' ) ) ) {
36
+ wp_schedule_single_event( $oReq->ts() + 12, $oFO->prefix( 'adhoc_cron_license_check' ), array( true ) );
37
  }
38
  break;
39
  }
src/processors/lockdown.php CHANGED
@@ -209,7 +209,7 @@ class ICWP_WPSF_Processor_Lockdown extends ICWP_WPSF_Processor_BaseWpsf {
209
  public function interceptCanonicalRedirects() {
210
 
211
  if ( $this->getMod()->isOpt( 'block_author_discovery', 'Y' ) && !$this->loadWpUsers()->isUserLoggedIn() ) {
212
- $sAuthor = $this->loadDP()->query( 'author', '' );
213
  if ( !empty( $sAuthor ) ) {
214
  $this->loadWp()->wpDie( sprintf(
215
  _wpsf__( 'The "author" query parameter has been blocked by %s to protect against user login name fishing.' )
209
  public function interceptCanonicalRedirects() {
210
 
211
  if ( $this->getMod()->isOpt( 'block_author_discovery', 'Y' ) && !$this->loadWpUsers()->isUserLoggedIn() ) {
212
+ $sAuthor = $this->loadRequest()->query( 'author', '' );
213
  if ( !empty( $sAuthor ) ) {
214
  $this->loadWp()->wpDie( sprintf(
215
  _wpsf__( 'The "author" query parameter has been blocked by %s to protect against user login name fishing.' )
src/processors/login_protect.php CHANGED
@@ -29,7 +29,7 @@ class ICWP_WPSF_Processor_LoginProtect extends ICWP_WPSF_Processor_BaseWpsf {
29
  $this->getProcessorGasp()->run();
30
  }
31
 
32
- if ( $oFO->isCooldownEnabled() && $this->loadDP()->isMethodPost() ) {
33
  $this->getProcessorCooldown()->run();
34
  }
35
 
29
  $this->getProcessorGasp()->run();
30
  }
31
 
32
+ if ( $oFO->isCooldownEnabled() && $this->loadRequest()->isMethodPost() ) {
33
  $this->getProcessorCooldown()->run();
34
  }
35
 
src/processors/loginprotect_base.php CHANGED
@@ -39,7 +39,7 @@ abstract class ICWP_WPSF_Processor_LoginProtect_Base extends ICWP_WPSF_Processor
39
  */
40
  public function run() {
41
  $this->setFactorTested( false );
42
- add_action( 'init', array( $this, 'addHooks' ) );
43
  }
44
 
45
  /**
@@ -69,6 +69,14 @@ abstract class ICWP_WPSF_Processor_LoginProtect_Base extends ICWP_WPSF_Processor
69
 
70
  // MemberPress
71
  add_action( 'mepr-login-form-before-submit', array( $this, 'printLoginFormItems_MePr' ), 100 );
 
 
 
 
 
 
 
 
72
  }
73
  }
74
 
@@ -86,6 +94,9 @@ abstract class ICWP_WPSF_Processor_LoginProtect_Base extends ICWP_WPSF_Processor
86
 
87
  // MemberPress
88
  add_action( 'mepr-forgot-password-form', array( $this, 'printLoginFormItems_MePr' ), 100 );
 
 
 
89
  }
90
  }
91
 
@@ -112,6 +123,12 @@ abstract class ICWP_WPSF_Processor_LoginProtect_Base extends ICWP_WPSF_Processor
112
  // MemberPress - Checkout == Registration
113
  add_action( 'mepr-checkout-before-submit', array( $this, 'printRegisterFormItems_MePr' ), 10 );
114
  add_filter( 'mepr-validate-signup', array( $this, 'checkReqRegistration_MePr' ), 10, 2 );
 
 
 
 
 
 
115
  }
116
  }
117
 
@@ -137,6 +154,23 @@ abstract class ICWP_WPSF_Processor_LoginProtect_Base extends ICWP_WPSF_Processor
137
  }
138
  }
139
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
  /**
141
  * @param WP_Error $oWpError
142
  * @param string $sUsername
@@ -178,13 +212,28 @@ abstract class ICWP_WPSF_Processor_LoginProtect_Base extends ICWP_WPSF_Processor
178
  return $oUserOrError;
179
  }
180
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
181
  /**
182
  * @param WP_Error $oWpError
183
  * @return WP_Error
184
  */
185
  public function checkReqLostPassword_Wp( $oWpError ) {
186
  try {
187
- $this->setUserToAudit( $this->loadDP()->post( 'user_login', '' ) )
188
  ->setActionToAudit( 'reset-password' )
189
  ->performCheckWithException();
190
  }
@@ -195,6 +244,20 @@ abstract class ICWP_WPSF_Processor_LoginProtect_Base extends ICWP_WPSF_Processor
195
  return $oWpError;
196
  }
197
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
198
  /**
199
  * This is for the request where the User actually enters their new password
200
  * @param WP_Error $oWpError
@@ -202,9 +265,9 @@ abstract class ICWP_WPSF_Processor_LoginProtect_Base extends ICWP_WPSF_Processor
202
  */
203
  public function checkReqResetPassword_Wp( $oWpError ) {
204
  try {
205
- $oDP = $this->loadDP();
206
- if ( $oDP->isMethodPost() && is_wp_error( $oWpError ) && empty( $oWpError->errors ) ) {
207
- list( $sUser, $null ) = explode( ':', wp_unslash( $oDP->cookie( 'wp-resetpass-'.COOKIEHASH, '' ) ), 2 );
208
  $this->setUserToAudit( $sUser )
209
  ->setActionToAudit( 'set-password' )
210
  ->performCheckWithException();
@@ -222,7 +285,7 @@ abstract class ICWP_WPSF_Processor_LoginProtect_Base extends ICWP_WPSF_Processor
222
  * @return array
223
  */
224
  public function checkPreUserInsert_Wp( $aData ) {
225
- if ( !$this->loadWpUsers()->isUserLoggedIn() && $this->loadDP()->isMethodPost() ) {
226
  $this->setActionToAudit( 'register' )
227
  ->performCheckWithDie();
228
  }
@@ -306,6 +369,37 @@ abstract class ICWP_WPSF_Processor_LoginProtect_Base extends ICWP_WPSF_Processor
306
  return $aErrors;
307
  }
308
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
309
  /**
310
  * @param WP_Error $oWpError
311
  * @param string $sUsername
@@ -371,6 +465,23 @@ abstract class ICWP_WPSF_Processor_LoginProtect_Base extends ICWP_WPSF_Processor
371
  $this->printLoginFormItems();
372
  }
373
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
374
  /**
375
  * @return void
376
  */
@@ -483,6 +594,13 @@ abstract class ICWP_WPSF_Processor_LoginProtect_Base extends ICWP_WPSF_Processor
483
  return (bool)$this->bFactorTested;
484
  }
485
 
 
 
 
 
 
 
 
486
  /**
487
  * @param string $sActionToAudit
488
  * @return $this
39
  */
40
  public function run() {
41
  $this->setFactorTested( false );
42
+ add_action( 'init', array( $this, 'addHooks' ), -100 );
43
  }
44
 
45
  /**
69
 
70
  // MemberPress
71
  add_action( 'mepr-login-form-before-submit', array( $this, 'printLoginFormItems_MePr' ), 100 );
72
+ // Ultimate Member
73
+ add_action( 'um_after_login_fields', array( $this, 'printFormItems_UltMem' ), 100 );
74
+ add_action( 'um_submit_form_login', array( $this, 'checkReqLogin_UltMem' ), 100 );
75
+
76
+ // LearnPress
77
+ add_action( 'learn-press/after-form-login-fields', array( $this, 'printFormItems_LearnPress' ), 100 );
78
+ add_action( 'learn-press/before-checkout-form-login-button', array( $this, 'printFormItems_LearnPress' ), 100 );
79
+ add_filter( 'learn-press/login-validate-field', array( $this, 'checkReqLogin_LearnPress' ), 100 );
80
  }
81
  }
82
 
94
 
95
  // MemberPress
96
  add_action( 'mepr-forgot-password-form', array( $this, 'printLoginFormItems_MePr' ), 100 );
97
+ // Ultimate Member
98
+ add_action( 'um_after_password_reset_fields', array( $this, 'printFormItems_UltMem' ), 100 );
99
+ add_action( 'um_submit_form_password_reset', array( $this, 'checkReqLostPassword_UltMem' ), 5, 0 );
100
  }
101
  }
102
 
123
  // MemberPress - Checkout == Registration
124
  add_action( 'mepr-checkout-before-submit', array( $this, 'printRegisterFormItems_MePr' ), 10 );
125
  add_filter( 'mepr-validate-signup', array( $this, 'checkReqRegistration_MePr' ), 10, 2 );
126
+ // Ultimate Member
127
+ add_action( 'um_after_register_fields', array( $this, 'printFormItems_UltMem' ), 100 );
128
+ add_action( 'um_submit_form_register', array( $this, 'checkReqRegistration_UltMem' ), 5, 0 );
129
+ // LearnPress
130
+ add_action( 'learn-press/after-form-register-fields', array( $this, 'printFormItems_LearnPress' ), 100 );
131
+ add_filter( 'learn-press/register-validate-field', array( $this, 'checkReqRegistration_LearnPress' ), 100, 1 );
132
  }
133
  }
134
 
154
  }
155
  }
156
 
157
+ /**
158
+ * @param string|WP_Error $sFieldNameOrError
159
+ * @return string|WP_Error
160
+ */
161
+ public function checkReqLogin_LearnPress( $sFieldNameOrError ) {
162
+ if ( !empty( $sFieldNameOrError ) || !is_wp_error( $sFieldNameOrError ) ) {
163
+ try {
164
+ $this->setActionToAudit( 'learnpress-login' )
165
+ ->performCheckWithException();
166
+ }
167
+ catch ( Exception $oE ) {
168
+ $sFieldNameOrError = new WP_Error( 'shield-fail-login', $oE->getMessage() );
169
+ }
170
+ }
171
+ return $sFieldNameOrError;
172
+ }
173
+
174
  /**
175
  * @param WP_Error $oWpError
176
  * @param string $sUsername
212
  return $oUserOrError;
213
  }
214
 
215
+ /**
216
+ *
217
+ */
218
+ public function checkReqLogin_UltMem() {
219
+ if ( $this->isUltimateMember() ) {
220
+ try {
221
+ $this->setActionToAudit( 'ultimatemember-login' )
222
+ ->performCheckWithException();
223
+ }
224
+ catch ( Exception $oE ) {
225
+ UM()->form()->add_error( 'shield-fail-login', $oE->getMessage() );
226
+ }
227
+ }
228
+ }
229
+
230
  /**
231
  * @param WP_Error $oWpError
232
  * @return WP_Error
233
  */
234
  public function checkReqLostPassword_Wp( $oWpError ) {
235
  try {
236
+ $this->setUserToAudit( $this->loadRequest()->post( 'user_login', '' ) )
237
  ->setActionToAudit( 'reset-password' )
238
  ->performCheckWithException();
239
  }
244
  return $oWpError;
245
  }
246
 
247
+ /**
248
+ */
249
+ public function checkReqLostPassword_UltMem() {
250
+ if ( $this->isUltimateMember() ) {
251
+ try {
252
+ $this->setActionToAudit( 'ultimatemember-lostpassword' )
253
+ ->performCheckWithException();
254
+ }
255
+ catch ( Exception $oE ) {
256
+ UM()->form()->add_error( 'shield-fail-lostpassword', $oE->getMessage() );
257
+ }
258
+ }
259
+ }
260
+
261
  /**
262
  * This is for the request where the User actually enters their new password
263
  * @param WP_Error $oWpError
265
  */
266
  public function checkReqResetPassword_Wp( $oWpError ) {
267
  try {
268
+ $oReq = $this->loadRequest();
269
+ if ( $oReq->isMethodPost() && is_wp_error( $oWpError ) && empty( $oWpError->errors ) ) {
270
+ list( $sUser, $null ) = explode( ':', wp_unslash( $oReq->cookie( 'wp-resetpass-'.COOKIEHASH, '' ) ), 2 );
271
  $this->setUserToAudit( $sUser )
272
  ->setActionToAudit( 'set-password' )
273
  ->performCheckWithException();
285
  * @return array
286
  */
287
  public function checkPreUserInsert_Wp( $aData ) {
288
+ if ( !$this->loadWpUsers()->isUserLoggedIn() && $this->loadRequest()->isMethodPost() ) {
289
  $this->setActionToAudit( 'register' )
290
  ->performCheckWithDie();
291
  }
369
  return $aErrors;
370
  }
371
 
372
+ /**
373
+ * @param string|WP_Error $sFieldNameOrError
374
+ * @return string|WP_Error
375
+ */
376
+ public function checkReqRegistration_LearnPress( $sFieldNameOrError ) {
377
+ if ( !empty( $sFieldNameOrError ) || !is_wp_error( $sFieldNameOrError ) ) {
378
+ try {
379
+ $this->setActionToAudit( 'learnpress-register' )
380
+ ->performCheckWithException();
381
+ }
382
+ catch ( Exception $oE ) {
383
+ $sFieldNameOrError = new WP_Error( 'shield-fail-register', $oE->getMessage() );
384
+ }
385
+ }
386
+ return $sFieldNameOrError;
387
+ }
388
+
389
+ /**
390
+ */
391
+ public function checkReqRegistration_UltMem() {
392
+ if ( $this->isUltimateMember() ) {
393
+ try {
394
+ $this->setActionToAudit( 'ultimatemember-register' )
395
+ ->performCheckWithException();
396
+ }
397
+ catch ( Exception $oE ) {
398
+ UM()->form()->add_error( 'shield-fail-register', $oE->getMessage() );
399
+ }
400
+ }
401
+ }
402
+
403
  /**
404
  * @param WP_Error $oWpError
405
  * @param string $sUsername
465
  $this->printLoginFormItems();
466
  }
467
 
468
+ /**
469
+ * LearnPress
470
+ * @return void
471
+ */
472
+ public function printFormItems_LearnPress() {
473
+ $this->printLoginFormItems();
474
+ }
475
+
476
+ /**
477
+ * Ultimate Member Forms
478
+ * https://wordpress.org/plugins/ultimate-member/
479
+ * @return void
480
+ */
481
+ public function printFormItems_UltMem() {
482
+ $this->printLoginFormItems();
483
+ }
484
+
485
  /**
486
  * @return void
487
  */
594
  return (bool)$this->bFactorTested;
595
  }
596
 
597
+ /**
598
+ * @return bool
599
+ */
600
+ protected function isUltimateMember() {
601
+ return function_exists( 'UM' ) && class_exists( 'UM' ) && method_exists( 'UM', 'form' );
602
+ }
603
+
604
  /**
605
  * @param string $sActionToAudit
606
  * @return $this
src/processors/loginprotect_gasp.php CHANGED
@@ -19,13 +19,15 @@ class ICWP_WPSF_Processor_LoginProtect_Gasp extends ICWP_WPSF_Processor_LoginPro
19
  * @return string
20
  */
21
  private function getGaspLoginHtml() {
 
 
22
  $sUniqId = preg_replace( '#[^a-zA-Z0-9]#', '', apply_filters( 'icwp_shield_lp_gasp_uniqid', uniqid() ) );
23
  return $this->getMod()->renderTemplate(
24
  'snippets/gasp_js.php',
25
  array(
26
- 'sCbName' => $this->getGaspCheckboxName(),
27
- 'sLabel' => $this->getTextImAHuman(),
28
- 'sAlert' => $this->getTextPleaseCheckBox(),
29
  'sMustJs' => _wpsf__( 'You MUST enable Javascript to be able to login' ),
30
  'sUniqId' => $sUniqId,
31
  'sUniqElem' => 'icwp_wpsf_login_p'.$sUniqId,
@@ -37,21 +39,19 @@ class ICWP_WPSF_Processor_LoginProtect_Gasp extends ICWP_WPSF_Processor_LoginPro
37
  }
38
 
39
  /**
40
- * @return string
41
  */
42
- protected function getGaspCheckboxName() {
 
 
 
43
  /** @var ICWP_WPSF_FeatureHandler_LoginProtect $oFO */
44
  $oFO = $this->getMod();
45
- return $oFO->prefix( $oFO->getGaspKey() );
46
- }
47
 
48
- /**
49
- * @throws Exception
50
- */
51
- protected function performCheckWithException() {
52
- $oDp = $this->loadDP();
53
- $sGaspCheckBox = $oDp->post( $this->getGaspCheckboxName() );
54
- $sHoney = $oDp->post( 'icwp_wpsf_login_email' );
55
 
56
  $sUsername = $this->getUserToAudit();
57
  $sActionAttempted = $this->getActionToAudit();
@@ -96,9 +96,11 @@ class ICWP_WPSF_Processor_LoginProtect_Gasp extends ICWP_WPSF_Processor_LoginPro
96
  * @throws Exception
97
  */
98
  protected function doGaspChecks( $sUsername, $sActionAttempted = 'login' ) {
99
- $oDp = $this->loadDP();
100
- $sGaspCheckBox = $oDp->post( $this->getGaspCheckboxName() );
101
- $sHoney = $oDp->post( 'icwp_wpsf_login_email' );
 
 
102
 
103
  $bValid = false;
104
  $sDieMessage = '';
@@ -134,18 +136,4 @@ class ICWP_WPSF_Processor_LoginProtect_Gasp extends ICWP_WPSF_Processor_LoginPro
134
 
135
  return $bValid;
136
  }
137
-
138
- /**
139
- * @return string
140
- */
141
- protected function getTextImAHuman() {
142
- return $this->getMod()->getTextOpt( 'text_imahuman' );
143
- }
144
-
145
- /**
146
- * @return string
147
- */
148
- protected function getTextPleaseCheckBox() {
149
- return $this->getMod()->getTextOpt( 'text_pleasecheckbox' );
150
- }
151
  }
19
  * @return string
20
  */
21
  private function getGaspLoginHtml() {
22
+ /** @var ICWP_WPSF_FeatureHandler_LoginProtect $oFO */
23
+ $oFO = $this->getMod();
24
  $sUniqId = preg_replace( '#[^a-zA-Z0-9]#', '', apply_filters( 'icwp_shield_lp_gasp_uniqid', uniqid() ) );
25
  return $this->getMod()->renderTemplate(
26
  'snippets/gasp_js.php',
27
  array(
28
+ 'sCbName' => $oFO->getGaspKey(),
29
+ 'sLabel' => $oFO->getTextImAHuman(),
30
+ 'sAlert' => $oFO->getTextPleaseCheckBox(),
31
  'sMustJs' => _wpsf__( 'You MUST enable Javascript to be able to login' ),
32
  'sUniqId' => $sUniqId,
33
  'sUniqElem' => 'icwp_wpsf_login_p'.$sUniqId,
39
  }
40
 
41
  /**
42
+ * @throws Exception
43
  */
44
+ protected function performCheckWithException() {
45
+ if ( $this->isFactorTested() ) {
46
+ return;
47
+ }
48
  /** @var ICWP_WPSF_FeatureHandler_LoginProtect $oFO */
49
  $oFO = $this->getMod();
50
+ $this->setFactorTested( true );
 
51
 
52
+ $oReq = $this->loadRequest();
53
+ $sGaspCheckBox = $oReq->post( $oFO->getGaspKey() );
54
+ $sHoney = $oReq->post( 'icwp_wpsf_login_email' );
 
 
 
 
55
 
56
  $sUsername = $this->getUserToAudit();
57
  $sActionAttempted = $this->getActionToAudit();
96
  * @throws Exception
97
  */
98
  protected function doGaspChecks( $sUsername, $sActionAttempted = 'login' ) {
99
+ /** @var ICWP_WPSF_FeatureHandler_LoginProtect $oFO */
100
+ $oFO = $this->getMod();
101
+ $oReq = $this->loadRequest();
102
+ $sGaspCheckBox = $oReq->post( $oFO->getGaspKey() );
103
+ $sHoney = $oReq->post( 'icwp_wpsf_login_email' );
104
 
105
  $bValid = false;
106
  $sDieMessage = '';
136
 
137
  return $bValid;
138
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
  }
src/processors/loginprotect_googleauthenticator.php CHANGED
@@ -12,7 +12,7 @@ class ICWP_WPSF_Processor_LoginProtect_GoogleAuthenticator extends ICWP_WPSF_Pro
12
  */
13
  public function run() {
14
  parent::run();
15
- if ( $this->loadDP()->query( 'shield_action' ) == 'garemovalconfirm' ) {
16
  add_action( 'wp_loaded', array( $this, 'validateUserGaRemovalLink' ), 10 );
17
  }
18
  }
@@ -85,14 +85,13 @@ class ICWP_WPSF_Processor_LoginProtect_GoogleAuthenticator extends ICWP_WPSF_Pro
85
  * @param int $nSavingUserId
86
  */
87
  public function handleEditOtherUserProfileSubmit( $nSavingUserId ) {
88
- $oDp = $this->loadDP();
89
 
90
  // Can only edit other users if you're admin/security-admin
91
  if ( $this->getController()->getHasPermissionToManage() ) {
92
  $oWpUsers = $this->loadWpUsers();
93
  $oSavingUser = $oWpUsers->getUserById( $nSavingUserId );
94
 
95
- $sShieldTurnOff = $oDp->post( 'shield_turn_off_google_authenticator' );
96
  if ( !empty( $sShieldTurnOff ) && $sShieldTurnOff == 'Y' ) {
97
 
98
  $bPermissionToRemoveGa = true;
@@ -143,7 +142,7 @@ class ICWP_WPSF_Processor_LoginProtect_GoogleAuthenticator extends ICWP_WPSF_Pro
143
 
144
  $sMessageOtpInvalid = _wpsf__( 'One Time Password (OTP) was not valid.' ).' '._wpsf__( 'Please try again.' );
145
 
146
- $sShieldTurnOff = $this->loadDP()->post( 'shield_turn_off_google_authenticator' );
147
  if ( !empty( $sShieldTurnOff ) && $sShieldTurnOff == 'Y' ) {
148
 
149
  $bError = false;
@@ -244,7 +243,7 @@ class ICWP_WPSF_Processor_LoginProtect_GoogleAuthenticator extends ICWP_WPSF_Pro
244
  }
245
 
246
  // Session IDs must be the same
247
- $sSessionId = $this->loadDP()->query( 'sessionid' );
248
  if ( empty( $sSessionId ) || ( $sSessionId !== $this->getController()->getSessionId() ) ) {
249
  return;
250
  }
12
  */
13
  public function run() {
14
  parent::run();
15
+ if ( $this->loadRequest()->query( 'shield_action' ) == 'garemovalconfirm' ) {
16
  add_action( 'wp_loaded', array( $this, 'validateUserGaRemovalLink' ), 10 );
17
  }
18
  }
85
  * @param int $nSavingUserId
86
  */
87
  public function handleEditOtherUserProfileSubmit( $nSavingUserId ) {
 
88
 
89
  // Can only edit other users if you're admin/security-admin
90
  if ( $this->getController()->getHasPermissionToManage() ) {
91
  $oWpUsers = $this->loadWpUsers();
92
  $oSavingUser = $oWpUsers->getUserById( $nSavingUserId );
93
 
94
+ $sShieldTurnOff = $this->loadRequest()->post( 'shield_turn_off_google_authenticator' );
95
  if ( !empty( $sShieldTurnOff ) && $sShieldTurnOff == 'Y' ) {
96
 
97
  $bPermissionToRemoveGa = true;
142
 
143
  $sMessageOtpInvalid = _wpsf__( 'One Time Password (OTP) was not valid.' ).' '._wpsf__( 'Please try again.' );
144
 
145
+ $sShieldTurnOff = $this->loadRequest()->post( 'shield_turn_off_google_authenticator' );
146
  if ( !empty( $sShieldTurnOff ) && $sShieldTurnOff == 'Y' ) {
147
 
148
  $bError = false;
243
  }
244
 
245
  // Session IDs must be the same
246
+ $sSessionId = $this->loadRequest()->query( 'sessionid' );
247
  if ( empty( $sSessionId ) || ( $sSessionId !== $this->getController()->getSessionId() ) ) {
248
  return;
249
  }
src/processors/loginprotect_intent.php CHANGED
@@ -57,7 +57,7 @@ class ICWP_WPSF_Processor_LoginProtect_Intent extends ICWP_WPSF_Processor_BaseWp
57
  }
58
 
59
  if ( $oFO->isEmailAuthenticationActive() ) {
60
- $this->getProcessorTwoFactor()->run();
61
  }
62
 
63
  if ( $oFO->isYubikeyActive() ) {
@@ -135,19 +135,19 @@ class ICWP_WPSF_Processor_LoginProtect_Intent extends ICWP_WPSF_Processor_BaseWp
135
  $oFO = $this->getMod();
136
 
137
  if ( $this->hasValidLoginIntent() ) { // ie. valid login intent present
138
- $oDp = $this->loadDP();
139
 
140
- $bIsLoginIntentSubmission = $oDp->request( $oFO->getLoginIntentRequestFlag() ) == 1;
141
  if ( $bIsLoginIntentSubmission ) {
142
 
143
- if ( $oDp->post( 'cancel' ) == 1 ) {
144
  $oWpUsers->logoutUser(); // clears the login and login intent
145
  $this->loadWp()->redirectToLogin();
146
  return;
147
  }
148
 
149
  if ( $this->isLoginIntentValid() ) {
150
- if ( $oDp->post( 'skip_mfa' ) === 'Y' ) { // store the browser hash
151
  $oFO->addMfaLoginHash( $oWpUsers->getCurrentWpUser() );
152
  }
153
 
@@ -271,7 +271,7 @@ class ICWP_WPSF_Processor_LoginProtect_Intent extends ICWP_WPSF_Processor_BaseWp
271
  $sMessageType = 'warning';
272
  }
273
 
274
- $sRedirectTo = rawurlencode( $this->loadDP()->getRequestUri() ); // not actually used
275
 
276
  $aLabels = $oCon->getPluginLabels();
277
  $sBannerUrl = empty( $aLabels[ 'url_login2fa_logourl' ] ) ? $oCon->getPluginUrl_Image( 'pluginlogo_banner-772x250.png' ) : $aLabels[ 'url_login2fa_logourl' ];
@@ -300,7 +300,7 @@ class ICWP_WPSF_Processor_LoginProtect_Intent extends ICWP_WPSF_Processor_BaseWp
300
  'login_intent_flag' => $oFO->getLoginIntentRequestFlag()
301
  ),
302
  'hrefs' => array(
303
- 'form_action' => $this->loadDP()->getRequestUri(),
304
  'css_bootstrap' => $oCon->getPluginUrl_Css( 'bootstrap4.min.css' ),
305
  'js_bootstrap' => $oCon->getPluginUrl_Js( 'bootstrap4.min.js' ),
306
  'shield_logo' => 'https://ps.w.org/wp-simple-firewall/assets/banner-772x250.png',
@@ -342,8 +342,8 @@ class ICWP_WPSF_Processor_LoginProtect_Intent extends ICWP_WPSF_Processor_BaseWp
342
  /**
343
  * @return ICWP_WPSF_Processor_LoginProtect_TwoFactorAuth
344
  */
345
- protected function getProcessorTwoFactor() {
346
- require_once( dirname( __FILE__ ).'/loginprotect_twofactorauth.php' );
347
  /** @var ICWP_WPSF_FeatureHandler_LoginProtect $oFO */
348
  $oFO = $this->getMod();
349
  $oProc = new ICWP_WPSF_Processor_LoginProtect_TwoFactorAuth( $oFO );
@@ -354,7 +354,7 @@ class ICWP_WPSF_Processor_LoginProtect_Intent extends ICWP_WPSF_Processor_BaseWp
354
  * @return ICWP_WPSF_Processor_LoginProtect_Yubikey
355
  */
356
  protected function getProcessorYubikey() {
357
- require_once( dirname( __FILE__ ).'/loginprotect_yubikey.php' );
358
  $oProc = new ICWP_WPSF_Processor_LoginProtect_Yubikey( $this->getMod() );
359
  return $oProc->setLoginTrack( $this->getLoginTrack() );
360
  }
@@ -363,7 +363,7 @@ class ICWP_WPSF_Processor_LoginProtect_Intent extends ICWP_WPSF_Processor_BaseWp
363
  * @return ICWP_WPSF_Processor_LoginProtect_BackupCodes
364
  */
365
  public function getProcessorBackupCodes() {
366
- require_once( dirname( __FILE__ ).'/loginprotect_backupcodes.php' );
367
  $oProc = new ICWP_WPSF_Processor_LoginProtect_BackupCodes( $this->getMod() );
368
  return $oProc->setLoginTrack( $this->getLoginTrack() );
369
  }
@@ -372,7 +372,7 @@ class ICWP_WPSF_Processor_LoginProtect_Intent extends ICWP_WPSF_Processor_BaseWp
372
  * @return ICWP_WPSF_Processor_LoginProtect_GoogleAuthenticator
373
  */
374
  public function getProcessorGoogleAuthenticator() {
375
- require_once( dirname( __FILE__ ).'/loginprotect_googleauthenticator.php' );
376
  $oProc = new ICWP_WPSF_Processor_LoginProtect_GoogleAuthenticator( $this->getMod() );
377
  return $oProc->setLoginTrack( $this->getLoginTrack() );
378
  }
@@ -382,7 +382,7 @@ class ICWP_WPSF_Processor_LoginProtect_Intent extends ICWP_WPSF_Processor_BaseWp
382
  */
383
  public function getLoginTrack() {
384
  if ( !isset( $this->oLoginTrack ) ) {
385
- require_once( dirname( __FILE__ ).'/loginprotect_track.php' );
386
  $this->oLoginTrack = new ICWP_WPSF_Processor_LoginProtect_Track();
387
  }
388
  return $this->oLoginTrack;
57
  }
58
 
59
  if ( $oFO->isEmailAuthenticationActive() ) {
60
+ $this->getProcessorEmailAuth()->run();
61
  }
62
 
63
  if ( $oFO->isYubikeyActive() ) {
135
  $oFO = $this->getMod();
136
 
137
  if ( $this->hasValidLoginIntent() ) { // ie. valid login intent present
138
+ $oReq = $this->loadRequest();
139
 
140
+ $bIsLoginIntentSubmission = $oReq->request( $oFO->getLoginIntentRequestFlag() ) == 1;
141
  if ( $bIsLoginIntentSubmission ) {
142
 
143
+ if ( $oReq->post( 'cancel' ) == 1 ) {
144
  $oWpUsers->logoutUser(); // clears the login and login intent
145
  $this->loadWp()->redirectToLogin();
146
  return;
147
  }
148
 
149
  if ( $this->isLoginIntentValid() ) {
150
+ if ( $oReq->post( 'skip_mfa' ) === 'Y' ) { // store the browser hash
151
  $oFO->addMfaLoginHash( $oWpUsers->getCurrentWpUser() );
152
  }
153
 
271
  $sMessageType = 'warning';
272
  }
273
 
274
+ $sRedirectTo = rawurlencode( $this->loadRequest()->getUri() ); // not actually used
275
 
276
  $aLabels = $oCon->getPluginLabels();
277
  $sBannerUrl = empty( $aLabels[ 'url_login2fa_logourl' ] ) ? $oCon->getPluginUrl_Image( 'pluginlogo_banner-772x250.png' ) : $aLabels[ 'url_login2fa_logourl' ];
300
  'login_intent_flag' => $oFO->getLoginIntentRequestFlag()
301
  ),
302
  'hrefs' => array(
303
+ 'form_action' => $this->loadRequest()->getUri(),
304
  'css_bootstrap' => $oCon->getPluginUrl_Css( 'bootstrap4.min.css' ),
305
  'js_bootstrap' => $oCon->getPluginUrl_Js( 'bootstrap4.min.js' ),
306
  'shield_logo' => 'https://ps.w.org/wp-simple-firewall/assets/banner-772x250.png',
342
  /**
343
  * @return ICWP_WPSF_Processor_LoginProtect_TwoFactorAuth
344
  */
345
+ protected function getProcessorEmailAuth() {
346
+ require_once( dirname( __FILE__ ).'/loginprotect_intentprovider_email.php' );
347
  /** @var ICWP_WPSF_FeatureHandler_LoginProtect $oFO */
348
  $oFO = $this->getMod();
349
  $oProc = new ICWP_WPSF_Processor_LoginProtect_TwoFactorAuth( $oFO );
354
  * @return ICWP_WPSF_Processor_LoginProtect_Yubikey
355
  */
356
  protected function getProcessorYubikey() {
357
+ require_once( dirname( __FILE__ ).'/loginprotect_intentprovider_yubikey.php' );
358
  $oProc = new ICWP_WPSF_Processor_LoginProtect_Yubikey( $this->getMod() );
359
  return $oProc->setLoginTrack( $this->getLoginTrack() );
360
  }
363
  * @return ICWP_WPSF_Processor_LoginProtect_BackupCodes
364
  */
365
  public function getProcessorBackupCodes() {
366
+ require_once( dirname( __FILE__ ).'/loginprotect_intentprovider_backup.php' );
367
  $oProc = new ICWP_WPSF_Processor_LoginProtect_BackupCodes( $this->getMod() );
368
  return $oProc->setLoginTrack( $this->getLoginTrack() );
369
  }
372
  * @return ICWP_WPSF_Processor_LoginProtect_GoogleAuthenticator
373
  */
374
  public function getProcessorGoogleAuthenticator() {
375
+ require_once( dirname( __FILE__ ).'/loginprotect_intentprovider_ga.php' );
376
  $oProc = new ICWP_WPSF_Processor_LoginProtect_GoogleAuthenticator( $this->getMod() );
377
  return $oProc->setLoginTrack( $this->getLoginTrack() );
378
  }
382
  */
383
  public function getLoginTrack() {
384
  if ( !isset( $this->oLoginTrack ) ) {
385
+ require_once( dirname( __FILE__ ).'/loginprotect_intent_tracker.php' );
386
  $this->oLoginTrack = new ICWP_WPSF_Processor_LoginProtect_Track();
387
  }
388
  return $this->oLoginTrack;
src/processors/loginprotect_intent_tracker.php ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( class_exists( 'ICWP_WPSF_Processor_LoginProtect_Track', false ) ) {
4
+ return;
5
+ }
6
+
7
+ class ICWP_WPSF_Processor_LoginProtect_Track {
8
+
9
+ const Factor_Google_Authenticator = 'ga';
10
+ const Factor_Yubikey = 'yubi';
11
+ const Factor_Email = 'email';
12
+ const Factor_BackupCode = 'backupcode';
13
+
14
+ /**
15
+ * @var array
16
+ */
17
+ private $aFactorsTracked;
18
+
19
+ /**
20
+ * @var array
21
+ */
22
+ private $aFactorsToTrack;
23
+
24
+ /**
25
+ * @param string $sFactor
26
+ * @return $this
27
+ */
28
+ public function addFactorToTrack( $sFactor ) {
29
+ $aFactorsToTrack = $this->getAuthFactorsToTrack();
30
+ $aFactorsToTrack[ $sFactor ] = true;
31
+ $this->aFactorsToTrack = $aFactorsToTrack;
32
+ return $this;
33
+ }
34
+
35
+ /**
36
+ * @param string $sFactor
37
+ * @return $this
38
+ */
39
+ public function addSuccessfulFactor( $sFactor ) {
40
+ return $this->setFactorState( $sFactor, true );
41
+ }
42
+
43
+ /**
44
+ * @param string $sFactor
45
+ * @return $this
46
+ */
47
+ public function addUnSuccessfulFactor( $sFactor ) {
48
+ return $this->setFactorState( $sFactor, false );
49
+ }
50
+
51
+ /**
52
+ * @return array
53
+ */
54
+ public function getAuthFactorsTracked() {
55
+ if ( !isset( $this->aFactorsTracked ) ) {
56
+ $this->aFactorsTracked = array();
57
+ }
58
+ return $this->aFactorsTracked;
59
+ }
60
+
61
+ /**
62
+ * @return array
63
+ */
64
+ public function getAuthFactorsToTrack() {
65
+ if ( !is_array( $this->aFactorsToTrack ) ) {
66
+ $this->aFactorsToTrack = array();
67
+ }
68
+ return array_unique( $this->aFactorsToTrack );
69
+ }
70
+
71
+ /**
72
+ * @return int
73
+ */
74
+ public function getCountAuthFactorsTrackedTotal() {
75
+ return count( $this->getAuthFactorsTracked() );
76
+ }
77
+
78
+ /**
79
+ * Works by using array_filter() with no callback, so only those values in the
80
+ * array that don't evaluate as false are returned. #SuperOmgElegant :)
81
+ * @return int
82
+ */
83
+ public function getCountFactorsSuccessful() {
84
+ return count( $this->getFactorsSuccessful() );
85
+ }
86
+
87
+ /**
88
+ * @return array
89
+ */
90
+ public function getFactorsSuccessful() {
91
+ return array_keys( array_filter( $this->getAuthFactorsTracked() ) ); // filter out the 'falses'
92
+ }
93
+
94
+ /**
95
+ * @return array
96
+ */
97
+ public function getFactorsUnsuccessful() {
98
+ return array_diff( array_keys( $this->getAuthFactorsTracked() ), $this->getFactorsSuccessful() );
99
+ }
100
+
101
+ /**
102
+ * @return int
103
+ */
104
+ public function getCountFactorsUnsuccessful() {
105
+ return ( $this->getCountAuthFactorsTrackedTotal() - $this->getCountFactorsSuccessful() );
106
+ }
107
+
108
+ /**
109
+ * @return int
110
+ */
111
+ public function getCountFactorsRemainingToTrack() {
112
+ return count( $this->getAuthFactorsToTrack() );
113
+ }
114
+
115
+ /**
116
+ * @return bool
117
+ */
118
+ public function hasFactorsRemainingToTrack() {
119
+ return ( $this->getCountFactorsRemainingToTrack() > 0 );
120
+ }
121
+
122
+ /**
123
+ * @return bool
124
+ */
125
+ public function hasSuccessfulFactor() {
126
+ return ( $this->getCountFactorsSuccessful() > 0 );
127
+ }
128
+
129
+ /**
130
+ * @return bool
131
+ */
132
+ public function hasUnSuccessfulFactor() {
133
+ return ( $this->getCountFactorsUnsuccessful() > 0 );
134
+ }
135
+
136
+ /**
137
+ * @return bool
138
+ */
139
+ public function isFinalFactorRemainingToTrack() {
140
+ return ( $this->getCountFactorsRemainingToTrack() === 1 );
141
+ }
142
+
143
+ /**
144
+ * @param string $sFactor
145
+ * @return $this
146
+ */
147
+ public function removeFactorToTrack( $sFactor ) {
148
+ $aFactorsToTrack = $this->getAuthFactorsToTrack();
149
+ unset( $aFactorsToTrack[ $sFactor ] );
150
+ $this->aFactorsToTrack = $aFactorsToTrack;
151
+ return $this;
152
+ }
153
+
154
+ /**
155
+ * Also remove remaining factors to track
156
+ * @param string $sFactor
157
+ * @param bool $bState
158
+ * @return $this
159
+ */
160
+ protected function setFactorState( $sFactor, $bState ) {
161
+ $aFactors = $this->getAuthFactorsTracked();
162
+ $aFactors[ $sFactor ] = $bState;
163
+ $this->aFactorsTracked = $aFactors;
164
+ return $this->removeFactorToTrack( $sFactor );
165
+ }
166
+ }
src/processors/loginprotect_intentprovider_backup.php ADDED
@@ -0,0 +1,209 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( class_exists( 'ICWP_WPSF_Processor_LoginProtect_BackupCodes', false ) ) {
4
+ return;
5
+ }
6
+
7
+ require_once( dirname( __FILE__ ).'/loginprotect_intentprovider_base.php' );
8
+
9
+ class ICWP_WPSF_Processor_LoginProtect_BackupCodes extends ICWP_WPSF_Processor_LoginProtect_IntentProviderBase {
10
+
11
+ /**
12
+ * This MUST only ever be hooked into when the User is looking at their OWN profile, so we can use "current user"
13
+ * functions. Otherwise we need to be careful of mixing up users.
14
+ * @param WP_User $oUser
15
+ */
16
+ public function addOptionsToUserProfile( $oUser ) {
17
+ $oCon = $this->getController();
18
+
19
+ $bValidatedProfile = $this->hasValidatedProfile( $oUser );
20
+ $aData = array(
21
+ 'has_mfa' => $this->isUserSubjectToLoginIntent( $oUser ),
22
+ 'has_validated_profile' => $bValidatedProfile,
23
+ 'user_google_authenticator_secret' => $this->getSecret( $oUser ),
24
+ 'is_my_user_profile' => ( $oUser->ID == $this->loadWpUsers()->getCurrentWpUserId() ),
25
+ 'i_am_valid_admin' => $oCon->getHasPermissionToManage(),
26
+ 'user_to_edit_is_admin' => $this->loadWpUsers()->isUserAdmin( $oUser ),
27
+ 'strings' => array(
28
+ 'button_gen_code' => _wpsf__( 'Generate ONE-Time Backup 2FA Login Code' ),
29
+ 'button_del_code' => _wpsf__( 'Delete Login Backup Code' ),
30
+ 'not_available' => _wpsf__( 'Backup login codes are not available if you do not have any other two-factor authentication modes active.' ),
31
+ 'description_code' => _wpsf__( 'Click to generate a backup login code for your two-factor authentication.' ),
32
+ 'description_code_ext1' => sprintf( '%s: %s',
33
+ _wpsf__( 'Important' ),
34
+ _wpsf__( 'This code will be displayed only once and you may use it to verify your login only once.' )
35
+ .' '._wpsf__( 'Store it somewhere safe.' ) ),
36
+ 'description_code_ext2' => _wpsf__( 'Generating a new code will replace your existing code.' ),
37
+ 'description_chart_url' => _wpsf__( 'Use your Google Authenticator app to scan this QR code and enter the one time password below.' ),
38
+ 'description_ga_secret' => _wpsf__( 'If you have a problem with scanning the QR code enter this code manually into the app.' ),
39
+ 'desc_remove' => _wpsf__( 'Check the box to remove Google Authenticator login authentication.' ),
40
+ 'label_check_to_remove' => sprintf( _wpsf__( 'Remove %s' ), _wpsf__( 'Google Authenticator' ) ),
41
+ 'label_enter_code' => _wpsf__( 'Create Backup 2FA Login Code' ),
42
+ 'label_ga_secret' => _wpsf__( 'Manual Code' ),
43
+ 'label_scan_qr_code' => _wpsf__( 'Scan This QR Code' ),
44
+ 'title' => _wpsf__( 'Backup Login Code' ),
45
+ 'cant_add_other_user' => sprintf( _wpsf__( "Sorry, %s may not be added to another user's account." ), 'Backup Codes' ),
46
+ 'cant_remove_admins' => sprintf( _wpsf__( "Sorry, %s may only be removed from another user's account by a Security Administrator." ), _wpsf__( 'Backup Codes' ) ),
47
+ 'provided_by' => sprintf( _wpsf__( 'Provided by %s' ), $oCon->getHumanName() ),
48
+ 'remove_more_info' => sprintf( _wpsf__( 'Understand how to remove Google Authenticator' ) )
49
+ ),
50
+ 'data' => array(
51
+ 'otp_field_name' => $this->getLoginFormParameter()
52
+ )
53
+ );
54
+
55
+ echo $this->getMod()->renderTemplate( 'snippets/user_profile_backupcode.php', $aData );
56
+ }
57
+
58
+ /**
59
+ * @param WP_User $oUser
60
+ */
61
+ public function addOptionsToUserEditProfile( $oUser ) {
62
+ // Allow no actions to be taken on other user profiles
63
+ }
64
+
65
+ /**
66
+ * @param array $aFields
67
+ * @return array
68
+ */
69
+ public function addLoginIntentField( $aFields ) {
70
+ if ( $this->getCurrentUserHasValidatedProfile() ) {
71
+ $aFields[] = array(
72
+ 'name' => $this->getLoginFormParameter(),
73
+ 'type' => 'text',
74
+ 'value' => '',
75
+ 'placeholder' => _wpsf__( 'Please use your Backup Code to login.' ),
76
+ 'text' => _wpsf__( 'Login Backup Code' ),
77
+ 'help_link' => '',
78
+ );
79
+ }
80
+ return $aFields;
81
+ }
82
+
83
+ /**
84
+ * Backup codes shouldn't make a user subject to login intent, but only be presented as required
85
+ * - i.e. they have other MFA options but they can't be used at the moment. So no MFA options =
86
+ * no need for backup codes
87
+ * @param bool $bIsSubjectTo
88
+ * @param WP_User $oUser
89
+ * @return bool
90
+ */
91
+ public function filterUserSubjectToIntent( $bIsSubjectTo, $oUser ) {
92
+ return $bIsSubjectTo;
93
+ }
94
+
95
+ /**
96
+ * @param WP_User $oUser
97
+ * @return bool
98
+ */
99
+ protected function hasValidatedProfile( $oUser ) {
100
+ return $this->hasValidSecret( $oUser );
101
+ }
102
+
103
+ /**
104
+ * Backup Code are 1-time only and if you have MFA, then we need to remove all the other tracking factors
105
+ * @param WP_User $oUser
106
+ * @param string $sOtpCode
107
+ * @return bool
108
+ */
109
+ protected function processOtp( $oUser, $sOtpCode ) {
110
+ $bValid = $this->validateBackupCode( $oUser, $sOtpCode );
111
+ if ( $bValid ) {
112
+ $this->deleteSecret( $oUser );
113
+ }
114
+ return $bValid;
115
+ }
116
+
117
+ /**
118
+ * @param WP_User $oUser
119
+ * @param string $sOtpCode
120
+ * @return bool
121
+ */
122
+ private function validateBackupCode( $oUser, $sOtpCode ) {
123
+ return wp_check_password( str_replace( '-', '', $sOtpCode ), $this->getSecret( $oUser ) );
124
+ }
125
+
126
+ /**
127
+ * @param WP_User $oUser
128
+ * @param bool $bIsSuccess
129
+ */
130
+ protected function auditLogin( $oUser, $bIsSuccess ) {
131
+ if ( $bIsSuccess ) {
132
+ $this->addToAuditEntry(
133
+ sprintf( _wpsf__( 'User "%s" verified their identity using %s method.' ),
134
+ $oUser->user_login, _wpsf__( 'Backup Code' )
135
+ ), 2, 'login_protect_bc_verified'
136
+ );
137
+ $this->doStatIncrement( 'login.backupcode.verified' );
138
+ }
139
+ else {
140
+ $this->addToAuditEntry(
141
+ sprintf( _wpsf__( 'User "%s" failed to verify their identity using %s method.' ),
142
+ $oUser->user_login, _wpsf__( 'Backup Code' )
143
+ ), 2, 'login_protect_bc_failed'
144
+ );
145
+ $this->doStatIncrement( 'login.backupcode.fail' );
146
+ }
147
+ }
148
+
149
+ /**
150
+ * @param WP_User $oUser
151
+ * @param bool $bIsOtpSuccess
152
+ * @param bool $bOtpProvided - whether a OTP was actually provided
153
+ * @return $this
154
+ */
155
+ protected function postOtpProcessAction( $oUser, $bIsOtpSuccess, $bOtpProvided ) {
156
+ parent::postOtpProcessAction( $oUser, $bIsOtpSuccess, $bOtpProvided );
157
+
158
+ if ( $bOtpProvided && $bIsOtpSuccess ) {
159
+ $this->sendBackupCodeUsedEmail( $oUser );
160
+ }
161
+ return $this;
162
+ }
163
+
164
+ /**
165
+ * @param WP_User $oUser
166
+ */
167
+ private function sendBackupCodeUsedEmail( $oUser ) {
168
+ $aEmailContent = array(
169
+ _wpsf__( 'This is a quick notice to inform you that your Backup Login code was just used.' ),
170
+ _wpsf__( "Your WordPress account had only 1 backup login code." )
171
+ .' '._wpsf__( "You must go to your profile and regenerate a new code if you want to use this method again." ),
172
+ '',
173
+ sprintf( '<strong>%s</strong>', _wpsf__( 'Login Details' ) ),
174
+ sprintf( '%s: %s', _wpsf__( 'URL' ), $this->loadWp()->getHomeUrl() ),
175
+ sprintf( '%s: %s', _wpsf__( 'Username' ), $oUser->user_login ),
176
+ sprintf( '%s: %s', _wpsf__( 'IP Address' ), $this->ip() ),
177
+ '',
178
+ _wpsf__( 'Thank You.' ),
179
+ );
180
+
181
+ $sTitle = sprintf( _wpsf__( "Notice: %s" ), _wpsf__( "Backup Login Code Just Used" ) );
182
+ $this->getEmailProcessor()
183
+ ->sendEmailWithWrap( $oUser->user_email, $sTitle, $aEmailContent );
184
+ }
185
+
186
+ /**
187
+ * @return string
188
+ */
189
+ protected function genNewSecret() {
190
+ return wp_generate_password( 25, false );
191
+ }
192
+
193
+ /**
194
+ * @param WP_User $oUser
195
+ * @param string $sNewSecret
196
+ * @return $this
197
+ */
198
+ protected function setSecret( $oUser, $sNewSecret ) {
199
+ parent::setSecret( $oUser, wp_hash_password( $sNewSecret ) );
200
+ return $this;
201
+ }
202
+
203
+ /**
204
+ * @return string
205
+ */
206
+ protected function getStub() {
207
+ return ICWP_WPSF_Processor_LoginProtect_Track::Factor_BackupCode;
208
+ }
209
+ }
src/processors/loginprotect_intentprovider_base.php CHANGED
@@ -47,7 +47,7 @@ abstract class ICWP_WPSF_Processor_LoginProtect_IntentProviderBase extends ICWP_
47
  * @param WP_User $oUser
48
  */
49
  public function onWpLogin( $sUsername, $oUser ) {
50
- $this->processLoginAttempt_Filter( $oUser );
51
  }
52
 
53
  /**
@@ -57,7 +57,7 @@ abstract class ICWP_WPSF_Processor_LoginProtect_IntentProviderBase extends ICWP_
57
  * @param int $nUserId
58
  */
59
  public function onWpSetLoggedInCookie( $sCookie, $nExpire, $nExpiration, $nUserId ) {
60
- $this->processLoginAttempt_Filter( $this->loadWpUsers()->getUserById( $nUserId ) );
61
  }
62
 
63
  /**
@@ -247,7 +247,7 @@ abstract class ICWP_WPSF_Processor_LoginProtect_IntentProviderBase extends ICWP_
247
  * @param WP_Error|WP_User $oUser
248
  * @return WP_Error|WP_User
249
  */
250
- public function processLoginAttempt_Filter( $oUser ) {
251
  return $oUser;
252
  }
253
 
@@ -287,7 +287,7 @@ abstract class ICWP_WPSF_Processor_LoginProtect_IntentProviderBase extends ICWP_
287
  * @return string
288
  */
289
  protected function fetchCodeFromRequest() {
290
- return esc_attr( trim( $this->loadDP()->request( $this->getLoginFormParameter(), false, '' ) ) );
291
  }
292
 
293
  /**
47
  * @param WP_User $oUser
48
  */
49
  public function onWpLogin( $sUsername, $oUser ) {
50
+ $this->processLoginAttempt( $oUser );
51
  }
52
 
53
  /**
57
  * @param int $nUserId
58
  */
59
  public function onWpSetLoggedInCookie( $sCookie, $nExpire, $nExpiration, $nUserId ) {
60
+ $this->processLoginAttempt( $this->loadWpUsers()->getUserById( $nUserId ) );
61
  }
62
 
63
  /**
247
  * @param WP_Error|WP_User $oUser
248
  * @return WP_Error|WP_User
249
  */
250
+ public function processLoginAttempt( $oUser ) {
251
  return $oUser;
252
  }
253
 
287
  * @return string
288
  */
289
  protected function fetchCodeFromRequest() {
290
+ return esc_attr( $this->loadRequest()->request( $this->getLoginFormParameter(), false, '' ) );
291
  }
292
 
293
  /**
src/processors/loginprotect_intentprovider_email.php ADDED
@@ -0,0 +1,239 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( class_exists( 'ICWP_WPSF_Processor_LoginProtect_TwoFactorAuth', false ) ) {
4
+ return;
5
+ }
6
+
7
+ require_once( dirname( __FILE__ ).'/loginprotect_intentprovider_base.php' );
8
+
9
+ class ICWP_WPSF_Processor_LoginProtect_TwoFactorAuth extends ICWP_WPSF_Processor_LoginProtect_IntentProviderBase {
10
+
11
+ /**
12
+ * @param WP_User|WP_Error|null $oUser
13
+ * @return WP_Error|WP_User|null - WP_User when the login success AND the IP is authenticated. null when login
14
+ * not successful but IP is valid. WP_Error otherwise.
15
+ */
16
+ public function processLoginAttempt( $oUser ) {
17
+ /** @var ICWP_WPSF_FeatureHandler_LoginProtect $oFO */
18
+ $oFO = $this->getMod();
19
+
20
+ if ( !$this->isLoginCaptured() && $oUser instanceof WP_User
21
+ && $this->hasValidatedProfile( $oUser ) && !$oFO->canUserMfaSkip( $oUser ) ) {
22
+
23
+ $oFO->getSessionsProcessor()
24
+ ->getQueryUpdater()
25
+ ->setLoginIntentCodeEmail( $oFO->getSession(), $this->getSecret( $oUser ) );
26
+
27
+ // Now send email with authentication link for user.
28
+ $this->doStatIncrement( 'login.twofactor.started' )
29
+ ->sendEmailTwoFactorVerify( $oUser )
30
+ ->setLoginCaptured();
31
+ }
32
+ return $oUser;
33
+ }
34
+
35
+ /**
36
+ * @param WP_User $oUser
37
+ * @param bool $bIsSuccess
38
+ */
39
+ protected function auditLogin( $oUser, $bIsSuccess ) {
40
+ if ( $bIsSuccess ) {
41
+ $this->addToAuditEntry(
42
+ sprintf( _wpsf__( 'User "%s" verified their identity using %s method.' ),
43
+ $oUser->user_login, _wpsf__( 'Email Auth' )
44
+ ), 2, 'login_protect_emailauth_verified'
45
+ );
46
+ $this->doStatIncrement( 'login.emailauth.verified' );
47
+ }
48
+ else {
49
+ $this->addToAuditEntry(
50
+ sprintf( _wpsf__( 'User "%s" failed to verify their identity using %s method.' ),
51
+ $oUser->user_login, _wpsf__( 'Email Auth' )
52
+ ), 2, 'login_protect_emailauth_failed'
53
+ );
54
+ $this->doStatIncrement( 'login.emailauth.failed' );
55
+ }
56
+ }
57
+
58
+ /**
59
+ * @param WP_User $oUser
60
+ * @param string $sOtpCode
61
+ * @return bool
62
+ */
63
+ protected function processOtp( $oUser, $sOtpCode ) {
64
+ $bValid = !empty( $sOtpCode ) && ( $sOtpCode == $this->getStoredSessionHashCode() );
65
+ if ( $bValid ) {
66
+ /** @var ICWP_WPSF_FeatureHandler_LoginProtect $oFO */
67
+ $oFO = $this->getMod();
68
+ $oFO->getSessionsProcessor()
69
+ ->getQueryUpdater()
70
+ ->clearLoginIntentCodeEmail( $oFO->getSession() );
71
+ }
72
+ return $bValid;
73
+ }
74
+
75
+ /**
76
+ * @param array $aFields
77
+ * @return array
78
+ */
79
+ public function addLoginIntentField( $aFields ) {
80
+ if ( $this->getCurrentUserHasValidatedProfile() ) {
81
+ $aFields[] = array(
82
+ 'name' => $this->getLoginFormParameter(),
83
+ 'type' => 'text',
84
+ 'value' => $this->fetchCodeFromRequest(),
85
+ 'placeholder' => _wpsf__( 'This code was just sent to your registered Email address.' ),
86
+ 'text' => _wpsf__( 'Email OTP' ),
87
+ 'help_link' => 'https://icwp.io/3t'
88
+ );
89
+ }
90
+ return $aFields;
91
+ }
92
+
93
+ /**
94
+ * @param WP_User $oUser
95
+ * @return bool
96
+ */
97
+ protected function hasValidatedProfile( $oUser ) {
98
+ /** @var ICWP_WPSF_FeatureHandler_LoginProtect $oFO */
99
+ $oFO = $this->getMod();
100
+ // Currently it's a global setting but this will evolve to be like Google Authenticator so that it's a user meta
101
+ return ( $oFO->isEmailAuthenticationActive() && $this->isSubjectToEmailAuthentication( $oUser ) );
102
+ }
103
+
104
+ /**
105
+ * @param WP_User $oUser
106
+ * @return bool
107
+ */
108
+ private function isSubjectToEmailAuthentication( $oUser ) {
109
+ /** @var ICWP_WPSF_FeatureHandler_LoginProtect $oFO */
110
+ $oFO = $this->getMod();
111
+ return count( array_intersect( $oFO->getEmail2FaRoles(), $oUser->roles ) ) > 0;
112
+ }
113
+
114
+ /**
115
+ * @return string
116
+ */
117
+ protected function genSessionHash() {
118
+ /** @var ICWP_WPSF_FeatureHandler_LoginProtect $oFO */
119
+ $oFO = $this->getMod();
120
+ return hash_hmac(
121
+ 'sha1',
122
+ $this->getController()->getUniqueRequestId(),
123
+ $oFO->getTwoAuthSecretKey()
124
+ );
125
+ }
126
+
127
+ /**
128
+ * We don't use user meta as it's dependent on the particular user sessions in-use
129
+ * @param WP_User $oUser
130
+ * @return string
131
+ */
132
+ protected function getSecret( WP_User $oUser ) {
133
+ return strtoupper( substr( $this->genSessionHash(), 0, 6 ) );
134
+ }
135
+
136
+ /**
137
+ * @return string The unique 2FA 6-digit code
138
+ */
139
+ protected function getStoredSessionHashCode() {
140
+ /** @var ICWP_WPSF_FeatureHandler_LoginProtect $oFO */
141
+ $oFO = $this->getMod();
142
+ return $oFO->hasSession() ? $oFO->getSession()->getLoginIntentCodeEmail() : '';
143
+ }
144
+
145
+ /**
146
+ * @param string $sSecret
147
+ * @return bool
148
+ */
149
+ protected function isSecretValid( $sSecret ) {
150
+ $sHash = $this->getStoredSessionHashCode();
151
+ return !empty( $sHash );
152
+ }
153
+
154
+ /**
155
+ * @param WP_User $oUser
156
+ * @return $this
157
+ */
158
+ protected function sendEmailTwoFactorVerify( WP_User $oUser ) {
159
+ $sIpAddress = $this->ip();
160
+
161
+ $aMessage = array(
162
+ _wpsf__( 'Someone attempted to login into this WordPress site using your account.' ),
163
+ _wpsf__( 'Login requires verification with the following code.' ),
164
+ '',
165
+ sprintf( _wpsf__( 'Verification Code: %s' ), sprintf( '<strong>%s</strong>', $this->getSecret( $oUser ) ) ),
166
+ '',
167
+ sprintf( '<strong>%s</strong>', _wpsf__( 'Login Details' ) ),
168
+ sprintf( '%s: %s', _wpsf__( 'URL' ), $this->loadWp()->getHomeUrl() ),
169
+ sprintf( '%s: %s', _wpsf__( 'Username' ), $oUser->user_login ),
170
+ sprintf( '%s: %s', _wpsf__( 'IP Address' ), $sIpAddress ),
171
+ '',
172
+ );
173
+
174
+ if ( !$this->getController()->isRelabelled() ) {
175
+ $aMessage[] = sprintf( '- <a href="%s" target="_blank">%s</a>', 'https://icwp.io/96', _wpsf__( 'Why no login link?' ) );
176
+ $aContent[] = '';
177
+ }
178
+
179
+ $sEmailSubject = _wpsf__( 'Two-Factor Login Verification' );
180
+
181
+ $bResult = $this->getEmailProcessor()
182
+ ->sendEmailWithWrap( $oUser->user_email, $sEmailSubject, $aMessage );
183
+ if ( $bResult ) {
184
+ $sAuditMessage = sprintf( _wpsf__( 'User "%s" was sent an email to verify their Identity using Two-Factor Login Auth for IP address "%s".' ), $oUser->user_login, $sIpAddress );
185
+ $this->addToAuditEntry( $sAuditMessage, 2, 'login_protect_two_factor_email_send' );
186
+ }
187
+ else {
188
+ $sAuditMessage = sprintf( _wpsf__( 'Tried to send email to User "%s" to verify their identity using Two-Factor Login Auth for IP address "%s", but email sending failed.' ), $oUser->user_login, $sIpAddress );
189
+ $this->addToAuditEntry( $sAuditMessage, 3, 'login_protect_two_factor_email_send_fail' );
190
+ }
191
+ return $this;
192
+ }
193
+
194
+ /**
195
+ * This MUST only ever be hooked into when the User is looking at their OWN profile, so we can use "current user"
196
+ * functions. Otherwise we need to be careful of mixing up users.
197
+ * @param WP_User $oUser
198
+ */
199
+ public function addOptionsToUserProfile( $oUser ) {
200
+ $oWp = $this->loadWpUsers();
201
+ $bValidatedProfile = $this->hasValidatedProfile( $oUser );
202
+ $aData = array(
203
+ 'user_has_email_authentication_active' => $bValidatedProfile,
204
+ 'user_has_email_authentication_enforced' => $this->isSubjectToEmailAuthentication( $oUser ),
205
+ 'is_my_user_profile' => ( $oUser->ID == $oWp->getCurrentWpUserId() ),
206
+ 'i_am_valid_admin' => $this->getController()->isValidAdminArea( true ),
207
+ 'user_to_edit_is_admin' => $oWp->isUserAdmin( $oUser ),
208
+ 'strings' => array(
209
+ 'label_email_authentication' => _wpsf__( 'Email Authentication' ),
210
+ 'title' => _wpsf__( 'Email Authentication' ),
211
+ 'description_email_authentication_checkbox' => _wpsf__( 'Check the box to enable email-based login authentication.' ),
212
+ 'provided_by' => sprintf( _wpsf__( 'Provided by %s' ), $this->getController()
213
+ ->getHumanName() )
214
+ )
215
+ );
216
+
217
+ $aData[ 'bools' ] = array(
218
+ 'checked' => $bValidatedProfile || $aData[ 'user_has_email_authentication_enforced' ],
219
+ 'disabled' => true || $aData[ 'user_has_email_authentication_enforced' ]
220
+ //TODO: Make email authentication a per-user setting
221
+ );
222
+
223
+ echo $this->getMod()->renderTemplate( 'snippets/user_profile_emailauthentication.php', $aData );
224
+ }
225
+
226
+ /**
227
+ * @return string
228
+ */
229
+ protected function getStub() {
230
+ return ICWP_WPSF_Processor_LoginProtect_Track::Factor_Email;
231
+ }
232
+
233
+ /**
234
+ * @return string
235
+ */
236
+ protected function get2FaCodeUserMetaKey() {
237
+ return $this->getMod()->prefix( 'tfaemail_reqid' );
238
+ }
239
+ }
src/processors/loginprotect_intentprovider_ga.php ADDED
@@ -0,0 +1,344 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( class_exists( 'ICWP_WPSF_Processor_LoginProtect_GoogleAuthenticator', false ) ) {
4
+ return;
5
+ }
6
+
7
+ require_once( dirname( __FILE__ ).'/loginprotect_intentprovider_base.php' );
8
+
9
+ class ICWP_WPSF_Processor_LoginProtect_GoogleAuthenticator extends ICWP_WPSF_Processor_LoginProtect_IntentProviderBase {
10
+
11
+ /**
12
+ */
13
+ public function run() {
14
+ parent::run();
15
+ if ( $this->loadRequest()->query( 'shield_action' ) == 'garemovalconfirm' ) {
16
+ add_action( 'wp_loaded', array( $this, 'validateUserGaRemovalLink' ), 10 );
17
+ }
18
+ }
19
+
20
+ /**
21
+ * This MUST only ever be hooked into when the User is looking at their OWN profile, so we can use "current user"
22
+ * functions. Otherwise we need to be careful of mixing up users.
23
+ * @param WP_User $oUser
24
+ */
25
+ public function addOptionsToUserProfile( $oUser ) {
26
+ $oCon = $this->getController();
27
+
28
+ $bValidatedProfile = $this->hasValidatedProfile( $oUser );
29
+ $aData = array(
30
+ 'has_validated_profile' => $bValidatedProfile,
31
+ 'user_google_authenticator_secret' => $this->getSecret( $oUser ),
32
+ 'is_my_user_profile' => ( $oUser->ID == $this->loadWpUsers()->getCurrentWpUserId() ),
33
+ 'i_am_valid_admin' => $oCon->getHasPermissionToManage(),
34
+ 'user_to_edit_is_admin' => $this->loadWpUsers()->isUserAdmin( $oUser ),
35
+ 'strings' => array(
36
+ 'description_otp_code' => _wpsf__( 'Provide the current code generated by your Google Authenticator app.' ),
37
+ 'description_otp_code_ext' => _wpsf__( 'To reset this QR Code enter fake data here.' ),
38
+ 'description_chart_url' => _wpsf__( 'Use your Google Authenticator app to scan this QR code and enter the one time password below.' ),
39
+ 'description_ga_secret' => _wpsf__( 'If you have a problem with scanning the QR code enter this code manually into the app.' ),
40
+ 'desc_remove' => _wpsf__( 'Check the box to remove Google Authenticator login authentication.' ),
41
+ 'label_check_to_remove' => sprintf( _wpsf__( 'Remove %s' ), _wpsf__( 'Google Authenticator' ) ),
42
+ 'label_enter_code' => _wpsf__( 'Google Authenticator Code' ),
43
+ 'label_ga_secret' => _wpsf__( 'Manual Code' ),
44
+ 'label_scan_qr_code' => _wpsf__( 'Scan This QR Code' ),
45
+ 'title' => _wpsf__( 'Google Authenticator' ),
46
+ 'cant_add_other_user' => sprintf( _wpsf__( "Sorry, %s may not be added to another user's account." ), 'Google Authenticator' ),
47
+ 'cant_remove_admins' => sprintf( _wpsf__( "Sorry, %s may only be removed from another user's account by a Security Administrator." ), _wpsf__( 'Google Authenticator' ) ),
48
+ 'provided_by' => sprintf( _wpsf__( 'Provided by %s' ), $oCon->getHumanName() ),
49
+ 'remove_more_info' => sprintf( _wpsf__( 'Understand how to remove Google Authenticator' ) )
50
+ ),
51
+ 'data' => array(
52
+ 'otp_field_name' => $this->getLoginFormParameter()
53
+ )
54
+ );
55
+
56
+ if ( !$bValidatedProfile ) {
57
+ $aData[ 'chart_url' ] = $this->getGaRegisterChartUrl( $oUser );
58
+ }
59
+
60
+ echo $this->getMod()->renderTemplate( 'snippets/user_profile_googleauthenticator.php', $aData );
61
+ }
62
+
63
+ /**
64
+ * @param WP_User $oUser
65
+ * @return string
66
+ */
67
+ public function getGaRegisterChartUrl( $oUser ) {
68
+ if ( empty( $oUser ) ) {
69
+ $sUrl = '';
70
+ }
71
+ else {
72
+ $sUrl = $this->loadGoogleAuthenticatorProcessor()
73
+ ->getGoogleQrChartUrl(
74
+ $this->getSecret( $oUser ),
75
+ preg_replace( '#[^0-9a-z]#i', '', $oUser->user_login )
76
+ .'@'.preg_replace( '#[^0-9a-z]#i', '', $this->loadWp()->getSiteName() )
77
+ );
78
+ }
79
+ return $sUrl;
80
+ }
81
+
82
+ /**
83
+ * The only thing we can do is REMOVE Google Authenticator from an account that is not our own
84
+ * But, only admins can do this. If Security Admin feature is enabled, then only they can do it.
85
+ * @param int $nSavingUserId
86
+ */
87
+ public function handleEditOtherUserProfileSubmit( $nSavingUserId ) {
88
+
89
+ // Can only edit other users if you're admin/security-admin
90
+ if ( $this->getController()->getHasPermissionToManage() ) {
91
+ $oWpUsers = $this->loadWpUsers();
92
+ $oSavingUser = $oWpUsers->getUserById( $nSavingUserId );
93
+
94
+ $sShieldTurnOff = $this->loadRequest()->post( 'shield_turn_off_google_authenticator' );
95
+ if ( !empty( $sShieldTurnOff ) && $sShieldTurnOff == 'Y' ) {
96
+
97
+ $bPermissionToRemoveGa = true;
98
+ // if the current user has Google Authenticator on THEIR account, process their OTP.
99
+ $oCurrentUser = $oWpUsers->getCurrentWpUser();
100
+ if ( $this->hasValidatedProfile( $oCurrentUser ) ) {
101
+ $bPermissionToRemoveGa = $this->processOtp( $oCurrentUser, $this->fetchCodeFromRequest() );
102
+ }
103
+
104
+ if ( $bPermissionToRemoveGa ) {
105
+ $this->processRemovalFromAccount( $oSavingUser );
106
+ $sMsg = _wpsf__( 'Google Authenticator was successfully removed from the account.' );
107
+ }
108
+ else {
109
+ $sMsg = _wpsf__( 'Google Authenticator could not be removed from the account - ensure your code is correct.' );
110
+ }
111
+ $this->getMod()->setFlashAdminNotice( $sMsg, $bPermissionToRemoveGa );
112
+ }
113
+ }
114
+ else {
115
+ // DO NOTHING EVER
116
+ }
117
+ }
118
+
119
+ /**
120
+ * @param WP_User $oUser
121
+ * @return $this
122
+ */
123
+ protected function processRemovalFromAccount( $oUser ) {
124
+ $this->setProfileValidated( $oUser, false )
125
+ ->resetSecret( $oUser );
126
+ return $this;
127
+ }
128
+
129
+ /**
130
+ * This MUST only ever be hooked into when the User is looking at their OWN profile,
131
+ * so we can use "current user" functions. Otherwise we need to be careful of mixing up users.
132
+ * @param int $nSavingUserId
133
+ */
134
+ public function handleUserProfileSubmit( $nSavingUserId ) {
135
+ $oWpUsers = $this->loadWpUsers();
136
+
137
+ $oSavingUser = $oWpUsers->getUserById( $nSavingUserId );
138
+
139
+ // If it's your own account, you CANT do anything without your OTP (except turn off via email).
140
+ $sOtp = $this->fetchCodeFromRequest();
141
+ $bValidOtp = $this->processOtp( $oSavingUser, $sOtp );
142
+
143
+ $sMessageOtpInvalid = _wpsf__( 'One Time Password (OTP) was not valid.' ).' '._wpsf__( 'Please try again.' );
144
+
145
+ $sShieldTurnOff = $this->loadRequest()->post( 'shield_turn_off_google_authenticator' );
146
+ if ( !empty( $sShieldTurnOff ) && $sShieldTurnOff == 'Y' ) {
147
+
148
+ $bError = false;
149
+ if ( $bValidOtp ) {
150
+ $this->processRemovalFromAccount( $oSavingUser );
151
+ $sFlash = _wpsf__( 'Google Authenticator was successfully removed from the account.' );
152
+ }
153
+ else if ( empty( $sOtp ) ) {
154
+
155
+ if ( $this->sendEmailConfirmationGaRemoval( $oSavingUser ) ) {
156
+ $sFlash = _wpsf__( 'An email has been sent to you in order to confirm Google Authenticator removal' );
157
+ }
158
+ else {
159
+ $bError = true;
160
+ $sFlash = _wpsf__( 'We tried to send an email for you to confirm Google Authenticator removal but it failed.' );
161
+ }
162
+ }
163
+ else {
164
+ $bError = true;
165
+ $sFlash = $sMessageOtpInvalid;
166
+ }
167
+ $this->getMod()->setFlashAdminNotice( $sFlash, $bError );
168
+ return;
169
+ }
170
+
171
+ // At this stage, if the OTP was empty, then we have no further processing to do.
172
+ if ( empty( $sOtp ) ) {
173
+ return;
174
+ }
175
+
176
+ // We're trying to validate our OTP to activate our GA
177
+ if ( !$this->hasValidatedProfile( $oSavingUser ) ) {
178
+
179
+ if ( $bValidOtp ) {
180
+ $this->setProfileValidated( $oSavingUser );
181
+ $sFlash = sprintf(
182
+ _wpsf__( '%s was successfully added to your account.' ),
183
+ _wpsf__( 'Google Authenticator' )
184
+ );
185
+ }
186
+ else {
187
+ $this->resetSecret( $oSavingUser );
188
+ $sFlash = $sMessageOtpInvalid;
189
+ }
190
+ $this->getMod()->setFlashAdminNotice( $sFlash, !$bValidOtp );
191
+ }
192
+ }
193
+
194
+ /**
195
+ * @param array $aFields
196
+ * @return array
197
+ */
198
+ public function addLoginIntentField( $aFields ) {
199
+ if ( $this->getCurrentUserHasValidatedProfile() ) {
200
+ $aFields[] = array(
201
+ 'name' => $this->getLoginFormParameter(),
202
+ 'type' => 'text',
203
+ 'value' => '',
204
+ 'placeholder' => _wpsf__( 'Please use your Google Authenticator App to retrieve your code.' ),
205
+ 'text' => _wpsf__( 'Google Authenticator Code' ),
206
+ 'help_link' => 'https://icwp.io/wpsf42',
207
+ 'extras' => array(
208
+ 'onkeyup' => "this.value=this.value.replace(/[^\d]/g,'')"
209
+ )
210
+ );
211
+ }
212
+ return $aFields;
213
+ }
214
+
215
+ /**
216
+ * @param WP_User $oUser
217
+ * @return bool
218
+ */
219
+ protected function sendEmailConfirmationGaRemoval( $oUser ) {
220
+ $bSendSuccess = false;
221
+
222
+ $aEmailContent = array();
223
+ $aEmailContent[] = _wpsf__( 'You have requested the removal of Google Authenticator from your WordPress account.' )
224
+ ._wpsf__( 'Please click the link below to confirm.' );
225
+ $aEmailContent[] = $this->generateGaRemovalConfirmationLink();
226
+
227
+ $sRecipient = $oUser->get( 'user_email' );
228
+ if ( $this->loadDP()->validEmail( $sRecipient ) ) {
229
+ $sEmailSubject = _wpsf__( 'Google Authenticator Removal Confirmation' );
230
+ $bSendSuccess = $this->getEmailProcessor()
231
+ ->sendEmailWithWrap( $sRecipient, $sEmailSubject, $aEmailContent );
232
+ }
233
+ return $bSendSuccess;
234
+ }
235
+
236
+ /**
237
+ */
238
+ public function validateUserGaRemovalLink() {
239
+ // Must be already logged in for this link to work.
240
+ $oWpCurrentUser = $this->loadWpUsers()->getCurrentWpUser();
241
+ if ( empty( $oWpCurrentUser ) ) {
242
+ return;
243
+ }
244
+
245
+ // Session IDs must be the same
246
+ $sSessionId = $this->loadRequest()->query( 'sessionid' );
247
+ if ( empty( $sSessionId ) || ( $sSessionId !== $this->getController()->getSessionId() ) ) {
248
+ return;
249
+ }
250
+
251
+ $this->processRemovalFromAccount( $oWpCurrentUser );
252
+ $this->getMod()
253
+ ->setFlashAdminNotice( _wpsf__( 'Google Authenticator was successfully removed from this account.' ) );
254
+ $this->loadWp()->redirectToAdmin();
255
+ }
256
+
257
+ /**
258
+ * @param WP_User $oUser
259
+ * @param string $sOtpCode
260
+ * @return bool
261
+ */
262
+ protected function processOtp( $oUser, $sOtpCode ) {
263
+ return $this->validateGaCode( $oUser, $sOtpCode );
264
+ }
265
+
266
+ /**
267
+ * @param WP_User $oUser
268
+ * @param string $sOtpCode
269
+ * @return bool
270
+ */
271
+ public function validateGaCode( $oUser, $sOtpCode ) {
272
+ $bValidOtp = false;
273
+ if ( !empty( $sOtpCode ) && preg_match( '#^[0-9]{6}$#', $sOtpCode ) ) {
274
+ $bValidOtp = $this->loadGoogleAuthenticatorProcessor()
275
+ ->verifyOtp( $this->getSecret( $oUser ), $sOtpCode );
276
+ }
277
+ return $bValidOtp;
278
+ }
279
+
280
+ /**
281
+ * @param WP_User $oUser
282
+ * @param bool $bIsSuccess
283
+ */
284
+ protected function auditLogin( $oUser, $bIsSuccess ) {
285
+ if ( $bIsSuccess ) {
286
+ $this->addToAuditEntry(
287
+ sprintf( _wpsf__( 'User "%s" verified their identity using %s method.' ),
288
+ $oUser->user_login, _wpsf__( 'Google Authenticator' )
289
+ ), 2, 'login_protect_ga_verified'
290
+ );
291
+ $this->doStatIncrement( 'login.googleauthenticator.verified' );
292
+ }
293
+ else {
294
+ $this->addToAuditEntry(
295
+ sprintf( _wpsf__( 'User "%s" failed to verify their identity using %s method.' ),
296
+ $oUser->user_login, _wpsf__( 'Google Authenticator' )
297
+ ), 2, 'login_protect_ga_failed'
298
+ );
299
+ $this->doStatIncrement( 'login.googleauthenticator.fail' );
300
+ }
301
+ }
302
+
303
+ /**
304
+ * @return string
305
+ */
306
+ protected function generateGaRemovalConfirmationLink() {
307
+ $aQueryArgs = array(
308
+ 'shield_action' => 'garemovalconfirm',
309
+ 'sessionid' => $this->getController()->getSessionId()
310
+ );
311
+ return add_query_arg( $aQueryArgs, $this->loadWp()->getUrl_WpAdmin() );
312
+ }
313
+
314
+ /**
315
+ * @return string
316
+ */
317
+ protected function genNewSecret() {
318
+ return $this->loadGoogleAuthenticatorProcessor()->generateNewSecret();
319
+ }
320
+
321
+ /**
322
+ * @param WP_User $oUser
323
+ * @return string
324
+ */
325
+ protected function getSecret( WP_User $oUser ) {
326
+ $sSec = parent::getSecret( $oUser );
327
+ return empty( $sSec ) ? $this->resetSecret( $oUser ) : $sSec;
328
+ }
329
+
330
+ /**
331
+ * @return string
332
+ */
333
+ protected function getStub() {
334
+ return ICWP_WPSF_Processor_LoginProtect_Track::Factor_Google_Authenticator;
335
+ }
336
+
337
+ /**
338
+ * @param string $sSecret
339
+ * @return bool
340
+ */
341
+ protected function isSecretValid( $sSecret ) {
342
+ return parent::isSecretValid( $sSecret ) && ( strlen( $sSecret ) == 16 );
343
+ }
344
+ }
src/processors/loginprotect_intentprovider_yubikey.php ADDED
@@ -0,0 +1,300 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( class_exists( 'ICWP_WPSF_Processor_LoginProtect_Yubikey', false ) ) {
4
+ return;
5
+ }
6
+
7
+ require_once( dirname( __FILE__ ).'/loginprotect_intentprovider_base.php' );
8
+
9
+ class ICWP_WPSF_Processor_LoginProtect_Yubikey extends ICWP_WPSF_Processor_LoginProtect_IntentProviderBase {
10
+
11
+ const OTP_LENGTH = 12;
12
+ /**
13
+ * @const string
14
+ */
15
+ const URL_YUBIKEY_VERIFY = 'https://api.yubico.com/wsapi/2.0/verify';
16
+
17
+ /**
18
+ * This MUST only ever be hooked into when the User is looking at their OWN profile, so we can use "current user"
19
+ * functions. Otherwise we need to be careful of mixing up users.
20
+ * @param WP_User $oUser
21
+ */
22
+ public function addOptionsToUserProfile( $oUser ) {
23
+ $oCon = $this->getController();
24
+ $oWpUsers = $this->loadWpUsers();
25
+
26
+ $bValidatedProfile = $this->hasValidatedProfile( $oUser );
27
+ $aData = array(
28
+ 'has_validated_profile' => $bValidatedProfile,
29
+ 'is_my_user_profile' => ( $oUser->ID == $oWpUsers->getCurrentWpUserId() ),
30
+ 'i_am_valid_admin' => $oCon->getHasPermissionToManage(),
31
+ 'user_to_edit_is_admin' => $oWpUsers->isUserAdmin( $oUser ),
32
+ 'strings' => array(
33
+ 'description_otp_code' => _wpsf__( 'This is your unique Yubikey Device ID.' ),
34
+ 'description_otp_code_ext' => '['._wpsf__( 'Pro Only' ).'] '
35
+ ._wpsf__( 'Multiple Yubikey Device IDs are separated by a comma.' ),
36
+ 'description_otp' => _wpsf__( 'Provide a One Time Password from your Yubikey.' ),
37
+ 'description_otp_ext' => $bValidatedProfile ?
38
+ _wpsf__( 'This will remove the Yubikey Device ID from your profile.' )
39
+ : _wpsf__( 'This will add the Yubikey Device ID to your profile.' ),
40
+ 'description_otp_ext_2' => $bValidatedProfile ?
41
+ '['._wpsf__( 'Pro Only' ).'] '._wpsf__( 'If you provide a OTP from an alternative Yubikey device, it will also be added to your profile.' )
42
+ : '',
43
+ 'label_enter_code' => _wpsf__( 'Yubikey ID' ),
44
+ 'label_enter_otp' => _wpsf__( 'Yubikey OTP' ),
45
+ 'title' => _wpsf__( 'Yubikey Authentication' ),
46
+ 'cant_add_other_user' => sprintf( _wpsf__( "Sorry, %s may not be added to another user's account." ), 'Yubikey' ),
47
+ 'cant_remove_admins' => sprintf( _wpsf__( "Sorry, %s may only be removed from another user's account by a Security Administrator." ), _wpsf__( 'Yubikey' ) ),
48
+ 'provided_by' => sprintf( _wpsf__( 'Provided by %s' ), $oCon->getHumanName() ),
49
+ 'remove_more_info' => sprintf( _wpsf__( 'Understand how to remove Google Authenticator' ) )
50
+ ),
51
+ 'data' => array(
52
+ 'otp_field_name' => $this->getLoginFormParameter(),
53
+ 'secret' => str_replace( ',', ', ', $this->getSecret( $oUser ) ),
54
+ )
55
+ );
56
+
57
+ echo $this->getMod()->renderTemplate( 'snippets/user_profile_yubikey.php', $aData );
58
+ }
59
+
60
+ /**
61
+ * This MUST only ever be hooked into when the User is looking at their OWN profile,
62
+ * so we can use "current user" functions. Otherwise we need to be careful of mixing up users.
63
+ * @param int $nSavingUserId
64
+ */
65
+ public function handleUserProfileSubmit( $nSavingUserId ) {
66
+
67
+ // If it's your own account, you CANT do anything without your OTP (except turn off via email).
68
+ $sOtp = $this->fetchCodeFromRequest();
69
+
70
+ // At this stage, if the OTP was empty, then we have no further processing to do.
71
+ if ( empty( $sOtp ) ) {
72
+ return;
73
+ }
74
+
75
+ /** @var ICWP_WPSF_FeatureHandler_LoginProtect $oFO */
76
+ $oFO = $this->getMod();
77
+
78
+ if ( !$this->sendYubiOtpRequest( $sOtp ) ) {
79
+ $oFO->setFlashAdminNotice(
80
+ _wpsf__( 'One Time Password (OTP) was not valid.' ).' '._wpsf__( 'Please try again.' ),
81
+ true
82
+ );
83
+ return;
84
+ }
85
+
86
+ /*
87
+ * How we proceed depends on :
88
+ * 1) Is the OTP for a registered ID - if so, remove it; If not, add it;
89
+ * 2) Is this a premium Shield installation - if so, multiple yubikeys are permitted
90
+ */
91
+
92
+ $oSavingUser = $this->loadWpUsers()->getUserById( $nSavingUserId );
93
+ $sYubiId = $this->getYubiIdFromOtp( $sOtp );
94
+
95
+ $bError = false;
96
+ if ( $this->hasYubiIdInProfile( $oSavingUser, $sYubiId ) ) {
97
+ $this->removeYubiIdFromProfile( $oSavingUser, $sYubiId );
98
+ $sMsg = sprintf(
99
+ _wpsf__( '%s was removed from your profile.' ),
100
+ _wpsf__( 'Yubikey Device' ).sprintf( ' "%s"', $sYubiId )
101
+ );
102
+ }
103
+ else if ( count( $this->getYubiIds( $oSavingUser ) ) == 0 || $oFO->isPremium() ) {
104
+ $this->addYubiIdToProfile( $oSavingUser, $sYubiId );
105
+ $sMsg = sprintf(
106
+ _wpsf__( '%s was added to your profile.' ),
107
+ _wpsf__( 'Yubikey Device' ).sprintf( ' (%s)', $sYubiId )
108
+ );
109
+ }
110
+ else {
111
+ $bError = true;
112
+ $sMsg = _wpsf__( 'No changes were made to your Yubikey configuration' );
113
+ }
114
+
115
+ $this->setProfileValidated( $oSavingUser, $this->hasValidSecret( $oSavingUser ) );
116
+ $oFO->setFlashAdminNotice( $sMsg, $bError );
117
+ }
118
+
119
+ /**
120
+ * @param WP_User $oUser
121
+ * @return array
122
+ */
123
+ protected function getYubiIds( WP_User $oUser ) {
124
+ return explode( ',', parent::getSecret( $oUser ) );
125
+ }
126
+
127
+ /**
128
+ * @param string $sOTP
129
+ * @return string
130
+ */
131
+ protected function getYubiIdFromOtp( $sOTP ) {
132
+ return substr( $sOTP, 0, $this->getYubiOtpLength() );
133
+ }
134
+
135
+ /**
136
+ * @param WP_User $oUser
137
+ * @param string $sKey
138
+ * @return bool
139
+ */
140
+ protected function hasYubiIdInProfile( WP_User $oUser, $sKey ) {
141
+ return in_array( $sKey, $this->getYubiIds( $oUser ) );
142
+ }
143
+
144
+ /**
145
+ * @param WP_User $oUser
146
+ * @param string $sOneTimePassword
147
+ * @return bool
148
+ */
149
+ protected function processOtp( $oUser, $sOneTimePassword ) {
150
+ /** @var ICWP_WPSF_FeatureHandler_LoginProtect $oFO */
151
+ $oFO = $this->getMod();
152
+ $bSuccess = false;
153
+
154
+ $aYubiKeys = $this->getYubiIds( $oUser );
155
+
156
+ // Only process the 1st secret if premium
157
+ if ( !$oFO->isPremium() ) {
158
+ $aYubiKeys = array_slice( $aYubiKeys, 0, 1 );
159
+ }
160
+
161
+ foreach ( $aYubiKeys as $sKey ) {
162
+ $bSuccess = strpos( $sOneTimePassword, $sKey ) === 0
163
+ && $this->sendYubiOtpRequest( $sOneTimePassword );
164
+ if ( $bSuccess ) {
165
+ break;
166
+ }
167
+ }
168
+
169
+ return $bSuccess;
170
+ }
171
+
172
+ /**
173
+ * @param string $sOTP
174
+ * @return bool
175
+ */
176
+ private function sendYubiOtpRequest( $sOTP ) {
177
+ $sOTP = trim( $sOTP );
178
+ $bSuccess = preg_match( '#^[a-z]{44}$#', $sOTP );
179
+
180
+ if ( $bSuccess ) {
181
+ $aParts = array(
182
+ 'otp' => $sOTP,
183
+ 'nonce' => md5( uniqid( rand() ) ),
184
+ 'id' => $this->getOption( 'yubikey_app_id' )
185
+ );
186
+ $sYubiResponse = trim( $this->loadFS()
187
+ ->getUrlContent( add_query_arg( $aParts, self::URL_YUBIKEY_VERIFY ) ) );
188
+
189
+ unset( $aParts[ 'id' ] );
190
+ $aParts[ 'status' ] = 'OK';
191
+
192
+ $bSuccess = true;
193
+ foreach ( $aParts as $sKey => $mVal ) {
194
+ $bSuccess = $bSuccess && preg_match( sprintf( '#%s=%s#', $sKey, $mVal ), $sYubiResponse );
195
+ }
196
+ }
197
+
198
+ return $bSuccess;
199
+ }
200
+
201
+ /**
202
+ * @param WP_User $oUser
203
+ * @param string $sNewKey
204
+ * @return $this
205
+ */
206
+ protected function addYubiIdToProfile( $oUser, $sNewKey ) {
207
+ $aKeys = $this->getYubiIds( $oUser );
208
+ $aKeys[] = $sNewKey;
209
+ return $this->storeYubiIdInProfile( $oUser, $aKeys );
210
+ }
211
+
212
+ /**
213
+ * @param WP_User $oUser
214
+ * @param string $sKey
215
+ * @return $this
216
+ */
217
+ protected function removeYubiIdFromProfile( $oUser, $sKey ) {
218
+ $aKeys = $this->loadDP()->removeFromArrayByValue( $this->getYubiIds( $oUser ), $sKey );
219
+ return $this->storeYubiIdInProfile( $oUser, $aKeys );
220
+ }
221
+
222
+ /**
223
+ * @param WP_User $oUser
224
+ * @param array $aKeys
225
+ * @return $this
226
+ */
227
+ private function storeYubiIdInProfile( $oUser, $aKeys ) {
228
+ parent::setSecret( $oUser, implode( ',', array_unique( array_filter( $aKeys ) ) ) );
229
+ return $this;
230
+ }
231
+
232
+ /**
233
+ * @param WP_User $oUser
234
+ * @param bool $bIsSuccess
235
+ */
236
+ protected function auditLogin( $oUser, $bIsSuccess ) {
237
+ if ( $bIsSuccess ) {
238
+ $this->addToAuditEntry(
239
+ sprintf( _wpsf__( 'User "%s" verified their identity using %s method.' ),
240
+ $oUser->user_login, _wpsf__( 'Yubikey OTP' )
241
+ ), 2, 'login_protect_yubikey_login_success'
242
+ );
243
+ $this->doStatIncrement( 'login.yubikey.verified' );
244
+ }
245
+ else {
246
+ $this->addToAuditEntry(
247
+ sprintf( _wpsf__( 'User "%s" failed to verify their identity using %s method.' ),
248
+ $oUser->user_login, _wpsf__( 'Yubikey OTP' )
249
+ ),2, 'login_protect_yubikey_failed'
250
+ );
251
+ $this->doStatIncrement( 'login.yubikey.failed' );
252
+ }
253
+ }
254
+
255
+ /**
256
+ * @param array $aFields
257
+ * @return array
258
+ */
259
+ public function addLoginIntentField( $aFields ) {
260
+ if ( $this->getCurrentUserHasValidatedProfile() ) {
261
+ $aFields[] = array(
262
+ 'name' => $this->getLoginFormParameter(),
263
+ 'type' => 'text',
264
+ 'placeholder' => _wpsf__( 'Use your Yubikey to generate a new code.' ),
265
+ 'value' => '',
266
+ 'text' => _wpsf__( 'Yubikey OTP' ),
267
+ 'help_link' => 'https://icwp.io/4i'
268
+ );
269
+ }
270
+ return $aFields;
271
+ }
272
+
273
+ /**
274
+ * @return string
275
+ */
276
+ protected function getStub() {
277
+ return ICWP_WPSF_Processor_LoginProtect_Track::Factor_Yubikey;
278
+ }
279
+
280
+ /**
281
+ * @param string $sSecret
282
+ * @return bool
283
+ */
284
+ protected function isSecretValid( $sSecret ) {
285
+ $bValid = parent::isSecretValid( $sSecret );
286
+ if ( $bValid ) {
287
+ foreach ( explode( ',', $sSecret ) as $sId ) {
288
+ $bValid = $bValid && preg_match( sprintf( '#^[a-z]{%s}$#', $this->getYubiOtpLength() ), $sId );
289
+ }
290
+ }
291
+ return $bValid;
292
+ }
293
+
294
+ /**
295
+ * @return int
296
+ */
297
+ protected function getYubiOtpLength() {
298
+ return self::OTP_LENGTH;
299
+ }
300
+ }
src/processors/loginprotect_wplogin.php CHANGED
@@ -4,7 +4,7 @@ if ( class_exists( 'ICWP_WPSF_Processor_LoginProtect_WpLogin', false ) ) {
4
  return;
5
  }
6
 
7
- require_once( dirname(__FILE__ ).'/base_wpsf.php' );
8
 
9
  class ICWP_WPSF_Processor_LoginProtect_WpLogin extends ICWP_WPSF_Processor_BaseWpsf {
10
 
@@ -84,14 +84,13 @@ class ICWP_WPSF_Processor_LoginProtect_WpLogin extends ICWP_WPSF_Processor_BaseW
84
  * @return bool
85
  */
86
  protected function checkForUnsupportedConfiguration() {
87
- $oDp = $this->loadDP();
88
- $aRequestParts = $oDp->getRequestUriParts();
89
- if ( $aRequestParts === false || empty( $aRequestParts['path'] ) ) {
90
 
91
  $sNoticeMessage = sprintf(
92
  '<strong>%s</strong>: %s',
93
  _wpsf__( 'Warning' ),
94
- _wpsf__( 'Your login URL is unchanged because your current hosting/PHP configuration cannot parse the necessary information.')
95
  );
96
  $this->loadWpNotices()->addRawAdminNotice( $sNoticeMessage, 'error' );
97
  return true;
@@ -108,7 +107,7 @@ class ICWP_WPSF_Processor_LoginProtect_WpLogin extends ICWP_WPSF_Processor_BaseW
108
 
109
  // Next block option is where it's a direct attempt to access the old login URL
110
  if ( !$bDoBlock ) {
111
- $sPath = trim( $this->loadDP()->getRequestPath(), '/' );
112
  $aPossiblePaths = array(
113
  trim( home_url( 'wp-login.php', 'relative' ), '/' ),
114
  trim( home_url( 'wp-signup.php', 'relative' ), '/' ),
@@ -119,7 +118,7 @@ class ICWP_WPSF_Processor_LoginProtect_WpLogin extends ICWP_WPSF_Processor_BaseW
119
  trim( site_url( 'login', 'relative' ), '/' )
120
  );
121
  $bDoBlock = !empty( $sPath )
122
- && ( in_array( $sPath, $aPossiblePaths ) || preg_match( '/wp-login\.php/i', $sPath ));
123
  }
124
 
125
  if ( $bDoBlock ) {
@@ -150,8 +149,8 @@ class ICWP_WPSF_Processor_LoginProtect_WpLogin extends ICWP_WPSF_Processor_BaseW
150
 
151
  $sLoginUrl = home_url( $this->getLoginPath() );
152
  $aQueryArgs = explode( '?', $sLocation );
153
- if ( !empty( $aQueryArgs[1] ) ) {
154
- parse_str( $aQueryArgs[1], $aNewQueryArgs );
155
  $sLoginUrl = add_query_arg( $aNewQueryArgs, $sLoginUrl );
156
  }
157
  return $sLoginUrl;
@@ -181,7 +180,7 @@ class ICWP_WPSF_Processor_LoginProtect_WpLogin extends ICWP_WPSF_Processor_BaseW
181
  * @return string
182
  */
183
  public function blockRegisterUrlRedirect( $sUrl ) {
184
- $aParts = $this->loadDP()->getRequestUriParts();
185
  if ( is_array( $aParts ) && !empty( $aParts[ 'path' ] ) && strpos( $aParts[ 'path' ], 'wp-register.php' ) ) {
186
  $this->doWpLoginFailedRedirect404();
187
  die();
@@ -194,7 +193,7 @@ class ICWP_WPSF_Processor_LoginProtect_WpLogin extends ICWP_WPSF_Processor_BaseW
194
  */
195
  public function aLoadWpLogin() {
196
  if ( $this->loadWp()->isRequestLoginUrl() ) {
197
- @require_once( ABSPATH . 'wp-login.php' );
198
  die();
199
  }
200
  }
@@ -210,7 +209,6 @@ class ICWP_WPSF_Processor_LoginProtect_WpLogin extends ICWP_WPSF_Processor_BaseW
210
 
211
  /**
212
  * Add the custom login URL to the Elegant Themes Maintenance Mode plugin URL exceptions list
213
- *
214
  * @param array $aUrlExceptions
215
  * @return array
216
  */
@@ -234,7 +232,6 @@ class ICWP_WPSF_Processor_LoginProtect_WpLogin extends ICWP_WPSF_Processor_BaseW
234
  }
235
  }
236
 
237
- $this->loadDP()
238
- ->doSendApache404( '', $this->loadWp()->getHomeUrl() );
239
  }
240
  }
4
  return;
5
  }
6
 
7
+ require_once( dirname( __FILE__ ).'/base_wpsf.php' );
8
 
9
  class ICWP_WPSF_Processor_LoginProtect_WpLogin extends ICWP_WPSF_Processor_BaseWpsf {
10
 
84
  * @return bool
85
  */
86
  protected function checkForUnsupportedConfiguration() {
87
+ $aRequestParts = $this->loadRequest()->getUriParts();
88
+ if ( $aRequestParts === false || empty( $aRequestParts[ 'path' ] ) ) {
 
89
 
90
  $sNoticeMessage = sprintf(
91
  '<strong>%s</strong>: %s',
92
  _wpsf__( 'Warning' ),
93
+ _wpsf__( 'Your login URL is unchanged because your current hosting/PHP configuration cannot parse the necessary information.' )
94
  );
95
  $this->loadWpNotices()->addRawAdminNotice( $sNoticeMessage, 'error' );
96
  return true;
107
 
108
  // Next block option is where it's a direct attempt to access the old login URL
109
  if ( !$bDoBlock ) {
110
+ $sPath = trim( $this->loadRequest()->getPath(), '/' );
111
  $aPossiblePaths = array(
112
  trim( home_url( 'wp-login.php', 'relative' ), '/' ),
113
  trim( home_url( 'wp-signup.php', 'relative' ), '/' ),
118
  trim( site_url( 'login', 'relative' ), '/' )
119
  );
120
  $bDoBlock = !empty( $sPath )
121
+ && ( in_array( $sPath, $aPossiblePaths ) || preg_match( '/wp-login\.php/i', $sPath ) );
122
  }
123
 
124
  if ( $bDoBlock ) {
149
 
150
  $sLoginUrl = home_url( $this->getLoginPath() );
151
  $aQueryArgs = explode( '?', $sLocation );
152
+ if ( !empty( $aQueryArgs[ 1 ] ) ) {
153
+ parse_str( $aQueryArgs[ 1 ], $aNewQueryArgs );
154
  $sLoginUrl = add_query_arg( $aNewQueryArgs, $sLoginUrl );
155
  }
156
  return $sLoginUrl;
180
  * @return string
181
  */
182
  public function blockRegisterUrlRedirect( $sUrl ) {
183
+ $aParts = $this->loadRequest()->getUriParts();
184
  if ( is_array( $aParts ) && !empty( $aParts[ 'path' ] ) && strpos( $aParts[ 'path' ], 'wp-register.php' ) ) {
185
  $this->doWpLoginFailedRedirect404();
186
  die();
193
  */
194
  public function aLoadWpLogin() {
195
  if ( $this->loadWp()->isRequestLoginUrl() ) {
196
+ @require_once( ABSPATH.'wp-login.php' );
197
  die();
198
  }
199
  }
209
 
210
  /**
211
  * Add the custom login URL to the Elegant Themes Maintenance Mode plugin URL exceptions list
 
212
  * @param array $aUrlExceptions
213
  * @return array
214
  */
232
  }
233
  }
234
 
235
+ $this->loadRequest()->sendResponseApache404( '', $this->loadWp()->getHomeUrl() );
 
236
  }
237
  }
src/processors/plugin.php CHANGED
@@ -24,7 +24,6 @@ class ICWP_WPSF_Processor_Plugin extends ICWP_WPSF_Processor_BasePlugin {
24
  parent::run();
25
  /** @var ICWP_WPSF_FeatureHandler_Plugin $oFO */
26
  $oFO = $this->getMod();
27
- $oDP = $this->loadDP();
28
 
29
  $this->removePluginConflicts();
30
  $this->getBadgeProcessor()
@@ -41,7 +40,7 @@ class ICWP_WPSF_Processor_Plugin extends ICWP_WPSF_Processor_BasePlugin {
41
  add_action( 'wp_loaded', array( $this, 'onWpLoaded' ) );
42
  add_action( 'in_admin_footer', array( $this, 'printVisitorIpFooter' ) );
43
 
44
- switch ( (string)$oDP->query( 'shield_action', '' ) ) {
45
  case 'dump_tracking_data':
46
  add_action( 'wp_loaded', array( $this, 'dumpTrackingData' ) );
47
  break;
24
  parent::run();
25
  /** @var ICWP_WPSF_FeatureHandler_Plugin $oFO */
26
  $oFO = $this->getMod();
 
27
 
28
  $this->removePluginConflicts();
29
  $this->getBadgeProcessor()
40
  add_action( 'wp_loaded', array( $this, 'onWpLoaded' ) );
41
  add_action( 'in_admin_footer', array( $this, 'printVisitorIpFooter' ) );
42
 
43
+ switch ( $this->loadRequest()->query( 'shield_action', '' ) ) {
44
  case 'dump_tracking_data':
45
  add_action( 'wp_loaded', array( $this, 'dumpTrackingData' ) );
46
  break;
src/processors/plugin_importexport.php CHANGED
@@ -50,8 +50,7 @@ class ICWP_WPSF_Processor_Plugin_ImportExport extends ICWP_WPSF_Processor_BaseWp
50
  }
51
 
52
  public function runAction() {
53
- $oDP = $this->loadDP();
54
- switch ( $oDP->query( 'shield_action' ) ) {
55
 
56
  case 'importexport_export':
57
  add_action( 'init', array( $this, 'runOptionsExport' ) );
@@ -79,7 +78,7 @@ class ICWP_WPSF_Processor_Plugin_ImportExport extends ICWP_WPSF_Processor_BaseWp
79
  /** @var ICWP_WPSF_FeatureHandler_Plugin $oFO */
80
  $oFO = $this->getMod();
81
  if ( $oFO->isPremium() && $oFO->isImportExportPermitted() &&
82
- ( $this->loadDP()->time() < $oFO->getImportExportHandshakeExpiresAt() ) ) {
83
  echo json_encode( array( 'success' => true ) );
84
  die();
85
  }
@@ -102,9 +101,9 @@ class ICWP_WPSF_Processor_Plugin_ImportExport extends ICWP_WPSF_Processor_BaseWp
102
 
103
  if ( !wp_next_scheduled( $sCronHook ) ) {
104
 
105
- wp_schedule_single_event( $this->loadDP()->time() + 12, $sCronHook );
106
 
107
- preg_match( '#.*WordPress/.*\s+(.*)\s?#', $this->loadDP()->server( 'HTTP_USER_AGENT' ), $aMatches );
108
  if ( !empty( $aMatches[ 1 ] ) && filter_var( $aMatches[ 1 ], FILTER_VALIDATE_URL ) ) {
109
  $sUrl = parse_url( $aMatches[ 1 ], PHP_URL_HOST );
110
  if ( !empty( $sUrl ) ) {
@@ -130,11 +129,11 @@ class ICWP_WPSF_Processor_Plugin_ImportExport extends ICWP_WPSF_Processor_BaseWp
130
  public function runOptionsExport() {
131
  /** @var ICWP_WPSF_FeatureHandler_Plugin $oFO */
132
  $oFO = $this->getMod();
133
- $oDP = $this->loadDP();
134
 
135
- $sSecretKey = $oDP->query( 'secret', '' );
136
- $bNetwork = $oDP->query( 'network', '' ) === 'Y';
137
- $sUrl = $oDP->validateSimpleHttpUrl( $oDP->query( 'url', '' ) );
138
 
139
  if ( !$oFO->isImportExportSecretKey( $sSecretKey ) && !$this->isUrlOnWhitelist( $sUrl ) ) {
140
  return; // we show no signs of responding to invalid secret keys or unwhitelisted URLs
50
  }
51
 
52
  public function runAction() {
53
+ switch ( $this->loadRequest()->query( 'shield_action' ) ) {
 
54
 
55
  case 'importexport_export':
56
  add_action( 'init', array( $this, 'runOptionsExport' ) );
78
  /** @var ICWP_WPSF_FeatureHandler_Plugin $oFO */
79
  $oFO = $this->getMod();
80
  if ( $oFO->isPremium() && $oFO->isImportExportPermitted() &&
81
+ ( $this->loadRequest()->ts() < $oFO->getImportExportHandshakeExpiresAt() ) ) {
82
  echo json_encode( array( 'success' => true ) );
83
  die();
84
  }
101
 
102
  if ( !wp_next_scheduled( $sCronHook ) ) {
103
 
104
+ wp_schedule_single_event( $this->loadRequest()->ts() + 12, $sCronHook );
105
 
106
+ preg_match( '#.*WordPress/.*\s+(.*)\s?#', $this->loadRequest()->server( 'HTTP_USER_AGENT' ), $aMatches );
107
  if ( !empty( $aMatches[ 1 ] ) && filter_var( $aMatches[ 1 ], FILTER_VALIDATE_URL ) ) {
108
  $sUrl = parse_url( $aMatches[ 1 ], PHP_URL_HOST );
109
  if ( !empty( $sUrl ) ) {
129
  public function runOptionsExport() {
130
  /** @var ICWP_WPSF_FeatureHandler_Plugin $oFO */
131
  $oFO = $this->getMod();
132
+ $oReq = $this->loadRequest();
133
 
134
+ $sSecretKey = $oReq->query( 'secret', '' );
135
+ $bNetwork = $oReq->query( 'network', '' ) === 'Y';
136
+ $sUrl = $this->loadDP()->validateSimpleHttpUrl( $oReq->query( 'url', '' ) );
137
 
138
  if ( !$oFO->isImportExportSecretKey( $sSecretKey ) && !$this->isUrlOnWhitelist( $sUrl ) ) {
139
  return; // we show no signs of responding to invalid secret keys or unwhitelisted URLs
src/processors/sessions.php CHANGED
@@ -96,7 +96,7 @@ class ICWP_WPSF_Processor_Sessions extends ICWP_WPSF_BaseDbProcessor {
96
  /** @var ICWP_WPSF_FeatureHandler_Sessions $oFO */
97
  $oFO = $this->getMod();
98
  $oWpUsers = $this->loadWpUsers();
99
- $sAction = $this->loadDP()->query( 'action' );
100
 
101
  if ( $oWpUsers->isUserLoggedIn() && $oFO->hasSession() && ( empty( $sAction ) || $sAction == 'login' ) ) {
102
  $sMessage = sprintf(
96
  /** @var ICWP_WPSF_FeatureHandler_Sessions $oFO */
97
  $oFO = $this->getMod();
98
  $oWpUsers = $this->loadWpUsers();
99
+ $sAction = $this->loadRequest()->query( 'action' );
100
 
101
  if ( $oWpUsers->isUserLoggedIn() && $oFO->hasSession() && ( empty( $sAction ) || $sAction == 'login' ) ) {
102
  $sMessage = sprintf(
src/processors/traffic_logger.php CHANGED
@@ -52,7 +52,7 @@ class ICWP_WPSF_Processor_TrafficLogger extends ICWP_WPSF_BaseDbProcessor {
52
  return parent::getIfLogRequest()
53
  && ( $oFO->getMaxEntries() > 0 )
54
  && ( !$this->isCustomExcluded() )
55
- && ( $oFO->isIncluded_Simple() || count( $this->loadDP()->getRequestParams( false ) ) > 0 )
56
  && ( $oFO->isIncluded_LoggedInUser() || !$bLoggedIn )
57
  && ( $oFO->isIncluded_Ajax() || !$oWp->isAjax() )
58
  && ( $oFO->isIncluded_Cron() || !$oWp->isCron() )
@@ -71,13 +71,13 @@ class ICWP_WPSF_Processor_TrafficLogger extends ICWP_WPSF_BaseDbProcessor {
71
  protected function isCustomExcluded() {
72
  /** @var ICWP_WPSF_FeatureHandler_Traffic $oFO */
73
  $oFO = $this->getMod();
74
- $oDP = $this->loadDP();
75
- $aExcls = $oFO->getCustomExclusions();
76
- $sAgent = (string)$this->loadDP()->server( 'HTTP_USER_AGENT' );
77
- $sPath = $oDP->getRequestPath().( empty( $_GET ) ? '' : '?'.http_build_query( $_GET ) );
78
 
79
  $bExcluded = false;
80
- foreach ( $aExcls as $sExcl ) {
81
  if ( stripos( $sAgent, $sExcl ) !== false || stripos( $sPath, $sExcl ) !== false ) {
82
  $bExcluded = true;
83
  }
@@ -100,7 +100,7 @@ class ICWP_WPSF_Processor_TrafficLogger extends ICWP_WPSF_BaseDbProcessor {
100
  $oSP = $this->loadServiceProviders();
101
 
102
  $sIp = $this->ip();
103
- $sAgent = (string)$this->loadDP()->server( 'HTTP_USER_AGENT' );
104
  return $oSP->isIp_GoogleBot( $sIp, $sAgent )
105
  || $oSP->isIp_BingBot( $sIp, $sAgent )
106
  || $oSP->isIp_DuckDuckGoBot( $sIp, $sAgent )
@@ -117,23 +117,27 @@ class ICWP_WPSF_Processor_TrafficLogger extends ICWP_WPSF_BaseDbProcessor {
117
  $oSP = $this->loadServiceProviders();
118
 
119
  $sIp = $this->ip();
120
- $sAgent = (string)$this->loadDP()->server( 'HTTP_USER_AGENT' );
121
  return $oSP->isIp_Statuscake( $sIp, $sAgent )
122
  || $oSP->isIp_UptimeRobot( $sIp, $sAgent )
123
  || $oSP->isIp_Pingdom( $sIp, $sAgent );
124
  }
125
 
126
  protected function logTraffic() {
127
- $oDP = $this->loadDP();
 
 
 
 
128
  /** @var ICWP_WPSF_TrafficEntryVO $oEntry */
129
  $oEntry = $this->getQuerySelector()->getVo();
130
  $oEntry->rid = $this->getController()->getShortRequestId();
131
  $oEntry->uid = $this->loadWpUsers()->getCurrentWpUserId();
132
  $oEntry->ip = inet_pton( $this->ip() );
133
- $oEntry->verb = $oDP->getRequestMethod();
134
- $oEntry->path = $oDP->getRequestPath().( empty( $_GET ) ? '' : '?'.http_build_query( $_GET ) );
135
  $oEntry->code = http_response_code();
136
- $oEntry->ua = (string)$oDP->server( 'HTTP_USER_AGENT' );
137
  $oEntry->trans = $this->getIfIpTransgressed() ? 1 : 0;
138
 
139
  $this->getQueryInserter()->insert( $oEntry );
52
  return parent::getIfLogRequest()
53
  && ( $oFO->getMaxEntries() > 0 )
54
  && ( !$this->isCustomExcluded() )
55
+ && ( $oFO->isIncluded_Simple() || count( $this->loadRequest()->getParams( false ) ) > 0 )
56
  && ( $oFO->isIncluded_LoggedInUser() || !$bLoggedIn )
57
  && ( $oFO->isIncluded_Ajax() || !$oWp->isAjax() )
58
  && ( $oFO->isIncluded_Cron() || !$oWp->isCron() )
71
  protected function isCustomExcluded() {
72
  /** @var ICWP_WPSF_FeatureHandler_Traffic $oFO */
73
  $oFO = $this->getMod();
74
+ $oReq = $this->loadRequest();
75
+
76
+ $sAgent = $oReq->getUserAgent();
77
+ $sPath = $oReq->getPath().( empty( $_GET ) ? '' : '?'.http_build_query( $_GET ) );
78
 
79
  $bExcluded = false;
80
+ foreach ( $oFO->getCustomExclusions() as $sExcl ) {
81
  if ( stripos( $sAgent, $sExcl ) !== false || stripos( $sPath, $sExcl ) !== false ) {
82
  $bExcluded = true;
83
  }
100
  $oSP = $this->loadServiceProviders();
101
 
102
  $sIp = $this->ip();
103
+ $sAgent = (string)$this->loadRequest()->server( 'HTTP_USER_AGENT' );
104
  return $oSP->isIp_GoogleBot( $sIp, $sAgent )
105
  || $oSP->isIp_BingBot( $sIp, $sAgent )
106
  || $oSP->isIp_DuckDuckGoBot( $sIp, $sAgent )
117
  $oSP = $this->loadServiceProviders();
118
 
119
  $sIp = $this->ip();
120
+ $sAgent = (string)$this->loadRequest()->server( 'HTTP_USER_AGENT' );
121
  return $oSP->isIp_Statuscake( $sIp, $sAgent )
122
  || $oSP->isIp_UptimeRobot( $sIp, $sAgent )
123
  || $oSP->isIp_Pingdom( $sIp, $sAgent );
124
  }
125
 
126
  protected function logTraffic() {
127
+ $oReq = $this->loadRequest();
128
+
129
+ // For multisites that are separated by sub-domains we also show the host.
130
+ $sLeadingPath = $this->loadWp()->isMultisite_SubdomainInstall() ? $oReq->getHost() : '';
131
+
132
  /** @var ICWP_WPSF_TrafficEntryVO $oEntry */
133
  $oEntry = $this->getQuerySelector()->getVo();
134
  $oEntry->rid = $this->getController()->getShortRequestId();
135
  $oEntry->uid = $this->loadWpUsers()->getCurrentWpUserId();
136
  $oEntry->ip = inet_pton( $this->ip() );
137
+ $oEntry->verb = $oReq->getMethod();
138
+ $oEntry->path = $sLeadingPath.$oReq->getPath().( empty( $_GET ) ? '' : '?'.http_build_query( $_GET ) );
139
  $oEntry->code = http_response_code();
140
+ $oEntry->ua = (string)$oReq->server( 'HTTP_USER_AGENT' );
141
  $oEntry->trans = $this->getIfIpTransgressed() ? 1 : 0;
142
 
143
  $this->getQueryInserter()->insert( $oEntry );
src/processors/usermanagement_passwords.php CHANGED
@@ -46,7 +46,7 @@ class ICWP_WPSF_Processor_UserManagement_Passwords extends ICWP_WPSF_Processor_B
46
  private function captureLogin( $oUser ) {
47
  $sPassword = $this->getLoginPassword();
48
 
49
- if ( $this->loadDP()->isMethodPost() && !$this->isLoginCaptured()
50
  && $oUser instanceof WP_User && !empty( $sPassword ) ) {
51
  $this->setLoginCaptured();
52
  try {
@@ -61,7 +61,7 @@ class ICWP_WPSF_Processor_UserManagement_Passwords extends ICWP_WPSF_Processor_B
61
  }
62
 
63
  public function onWpLoaded() {
64
- if ( !$this->loadDP()->isMethodPost() && $this->loadWpUsers()->isUserLoggedIn() ) {
65
  $this->processExpiredPassword();
66
  $this->processFailedCheckPassword();
67
  }
@@ -138,7 +138,7 @@ class ICWP_WPSF_Processor_UserManagement_Passwords extends ICWP_WPSF_Processor_B
138
 
139
  $oWp = $this->loadWp();
140
  $oWpUsers = $this->loadWpUsers();
141
- $sAction = $this->loadDP()->query( 'action' );
142
  $oUser = $oWpUsers->getCurrentWpUser();
143
  if ( $oUser && ( !$oWp->isRequestLoginUrl() || !in_array( $sAction, array( 'rp', 'resetpass' ) ) ) ) {
144
 
@@ -390,7 +390,7 @@ class ICWP_WPSF_Processor_UserManagement_Passwords extends ICWP_WPSF_Processor_B
390
 
391
  // Edd: edd_user_pass; Woo: password;
392
  foreach ( array( 'pwd', 'pass1' ) as $sKey ) {
393
- $sP = $this->loadDP()->post( $sKey );
394
  if ( !empty( $sP ) ) {
395
  $sPass = $sP;
396
  break;
46
  private function captureLogin( $oUser ) {
47
  $sPassword = $this->getLoginPassword();
48
 
49
+ if ( $this->loadRequest()->isMethodPost() && !$this->isLoginCaptured()
50
  && $oUser instanceof WP_User && !empty( $sPassword ) ) {
51
  $this->setLoginCaptured();
52
  try {
61
  }
62
 
63
  public function onWpLoaded() {
64
+ if ( !$this->loadRequest()->isMethodPost() && $this->loadWpUsers()->isUserLoggedIn() ) {
65
  $this->processExpiredPassword();
66
  $this->processFailedCheckPassword();
67
  }
138
 
139
  $oWp = $this->loadWp();
140
  $oWpUsers = $this->loadWpUsers();
141
+ $sAction = $this->loadRequest()->query( 'action' );
142
  $oUser = $oWpUsers->getCurrentWpUser();
143
  if ( $oUser && ( !$oWp->isRequestLoginUrl() || !in_array( $sAction, array( 'rp', 'resetpass' ) ) ) ) {
144
 
390
 
391
  // Edd: edd_user_pass; Woo: password;
392
  foreach ( array( 'pwd', 'pass1' ) as $sKey ) {
393
+ $sP = $this->loadRequest()->post( $sKey );
394
  if ( !empty( $sP ) ) {
395
  $sPass = $sP;
396
  break;
src/processors/usermanagement_sessions.php CHANGED
@@ -270,7 +270,7 @@ class ICWP_WPSF_Processor_UserManagement_Sessions extends ICWP_WPSF_Processor_Cr
270
  $oError = new WP_Error();
271
  }
272
 
273
- $sForceLogout = $this->loadDP()->query( 'wpsf-forcelogout' );
274
  if ( $sForceLogout ) {
275
 
276
  switch ( $sForceLogout ) {
270
  $oError = new WP_Error();
271
  }
272
 
273
+ $sForceLogout = $this->loadRequest()->query( 'wpsf-forcelogout' );
274
  if ( $sForceLogout ) {
275
 
276
  switch ( $sForceLogout ) {
src/query/audittrail/select.php CHANGED
@@ -27,7 +27,7 @@ class ICWP_WPSF_Query_AuditTrail_Select extends ICWP_WPSF_Query_BaseSelect {
27
  }
28
 
29
  /**
30
- * @return int|stdClass[]|ICWP_WPSF_IpsEntryVO[]
31
  */
32
  public function query() {
33
  return parent::query();
27
  }
28
 
29
  /**
30
+ * @return int|stdClass[]|ICWP_WPSF_AuditTrailEntryVO[]
31
  */
32
  public function query() {
33
  return parent::query();
src/query/base/insert.php CHANGED
@@ -25,12 +25,11 @@ class ICWP_WPSF_Query_BaseInsert extends ICWP_WPSF_Query_BaseQuery {
25
  * @return bool
26
  */
27
  public function insert( $oEntry ) {
28
- $oDP = $this->loadDP();
29
  $aData = array_merge(
30
  array(
31
- 'created_at' => $oDP->time(),
32
  ),
33
- $oDP->convertStdClassToArray( $oEntry->getRawData() )
34
  );
35
  return $this->setInsertData( $aData )->query() === 1;
36
  }
25
  * @return bool
26
  */
27
  public function insert( $oEntry ) {
 
28
  $aData = array_merge(
29
  array(
30
+ 'created_at' => $this->loadRequest()->ts(),
31
  ),
32
+ $this->loadDP()->convertStdClassToArray( $oEntry->getRawData() )
33
  );
34
  return $this->setInsertData( $aData )->query() === 1;
35
  }
src/query/base/statistics_base.php CHANGED
@@ -143,7 +143,7 @@ class ICWP_WPSF_Query_Statistics_Base extends ICWP_WPSF_Query_Base {
143
  * @return int
144
  */
145
  public function getDateTo() {
146
- return isset( $this->nDateTo ) ? (int)$this->nDateTo : $this->loadDP()->time();
147
  }
148
 
149
  /**
143
  * @return int
144
  */
145
  public function getDateTo() {
146
+ return isset( $this->nDateTo ) ? (int)$this->nDateTo : $this->loadRequest()->ts();
147
  }
148
 
149
  /**
src/query/ips/update.php CHANGED
@@ -18,7 +18,7 @@ class ICWP_WPSF_Query_Ips_Update extends ICWP_WPSF_Query_BaseUpdate {
18
  $oIp,
19
  array(
20
  'transgressions' => $oIp->getTransgressions() + 1,
21
- 'last_access_at' => $this->loadDP()->time()
22
  )
23
  );
24
  }
@@ -40,7 +40,7 @@ class ICWP_WPSF_Query_Ips_Update extends ICWP_WPSF_Query_BaseUpdate {
40
  public function updateLastAccessAt( $oIp ) {
41
  return $this->updateIp(
42
  $oIp,
43
- array( 'last_access_at' => $this->loadDP()->time() )
44
  );
45
  }
46
 
18
  $oIp,
19
  array(
20
  'transgressions' => $oIp->getTransgressions() + 1,
21
+ 'last_access_at' => $this->loadRequest()->ts()
22
  )
23
  );
24
  }
40
  public function updateLastAccessAt( $oIp ) {
41
  return $this->updateIp(
42
  $oIp,
43
+ array( 'last_access_at' => $this->loadRequest()->ts() )
44
  );
45
  }
46
 
src/query/notes/insert.php CHANGED
@@ -17,7 +17,7 @@ class ICWP_WPSF_Query_PluginNotes_Insert extends ICWP_WPSF_Query_BaseInsert {
17
  $aData = array(
18
  'wp_username' => ( $oUser instanceof WP_User ) ? $oUser->user_login : 'unknown',
19
  'note' => esc_sql( $sNote ),
20
- 'created_at' => $this->loadDP()->time(),
21
  );
22
  return $this->setInsertData( $aData )->query() === 1;
23
  }
17
  $aData = array(
18
  'wp_username' => ( $oUser instanceof WP_User ) ? $oUser->user_login : 'unknown',
19
  'note' => esc_sql( $sNote ),
20
+ 'created_at' => $this->loadRequest()->ts(),
21
  );
22
  return $this->setInsertData( $aData )->query() === 1;
23
  }
src/query/sessions/insert.php CHANGED
@@ -14,18 +14,18 @@ class ICWP_WPSF_Query_Sessions_Insert extends ICWP_WPSF_Query_BaseInsert {
14
  * @return bool
15
  */
16
  public function create( $sSessionId, $sUsername ) {
17
- $oDP = $this->loadDP();
18
- $nTimeStamp = $oDP->time();
19
 
20
  $aData = array(
21
  'session_id' => $sSessionId,
22
  'ip' => $this->loadIpService()->getRequestIp(), // TODO: SHA1
23
- 'browser' => md5( $oDP->getUserAgent() ),
24
  'wp_username' => $sUsername,
25
  'logged_in_at' => $nTimeStamp,
26
  'created_at' => $nTimeStamp,
27
  'last_activity_at' => $nTimeStamp,
28
- 'last_activity_uri' => $oDP->server( 'REQUEST_URI' ),
29
  'login_intent_expires_at' => 0,
30
  'secadmin_at' => 0,
31
  );
14
  * @return bool
15
  */
16
  public function create( $sSessionId, $sUsername ) {
17
+ $oReq = $this->loadRequest();
18
+ $nTimeStamp = $oReq->ts();
19
 
20
  $aData = array(
21
  'session_id' => $sSessionId,
22
  'ip' => $this->loadIpService()->getRequestIp(), // TODO: SHA1
23
+ 'browser' => md5( $oReq->getUserAgent() ),
24
  'wp_username' => $sUsername,
25
  'logged_in_at' => $nTimeStamp,
26
  'created_at' => $nTimeStamp,
27
  'last_activity_at' => $nTimeStamp,
28
+ 'last_activity_uri' => $oReq->server( 'REQUEST_URI' ),
29
  'login_intent_expires_at' => 0,
30
  'secadmin_at' => 0,
31
  );
src/query/sessions/update.php CHANGED
@@ -13,7 +13,7 @@ class ICWP_WPSF_Query_Sessions_Update extends ICWP_WPSF_Query_BaseUpdate {
13
  * @return bool
14
  */
15
  public function startSecurityAdmin( $oSession ) {
16
- return $this->updateSession( $oSession, array( 'secadmin_at' => $this->loadDP()->time() ) );
17
  }
18
 
19
  /**
@@ -29,12 +29,12 @@ class ICWP_WPSF_Query_Sessions_Update extends ICWP_WPSF_Query_BaseUpdate {
29
  * @return bool
30
  */
31
  public function updateLastActivity( $oSession ) {
32
- $oDP = $this->loadDP();
33
  return $this->updateSession(
34
  $oSession,
35
  array(
36
- 'last_activity_at' => $oDP->time(),
37
- 'last_activity_uri' => $oDP->server( 'REQUEST_URI' )
38
  )
39
  );
40
  }
13
  * @return bool
14
  */
15
  public function startSecurityAdmin( $oSession ) {
16
+ return $this->updateSession( $oSession, array( 'secadmin_at' => $this->loadRequest()->ts() ) );
17
  }
18
 
19
  /**
29
  * @return bool
30
  */
31
  public function updateLastActivity( $oSession ) {
32
+ $oR = $this->loadRequest();
33
  return $this->updateSession(
34
  $oSession,
35
  array(
36
+ 'last_activity_at' => $oR->ts(),
37
+ 'last_activity_uri' => $oR->server( 'REQUEST_URI' )
38
  )
39
  );
40
  }
src/query/statistics/tally_insert.php CHANGED
@@ -33,7 +33,7 @@ class ICWP_WPSF_Query_Tally_Insert extends ICWP_WPSF_Query_BaseInsert {
33
  return false;
34
  }
35
 
36
- $nTimeStamp = $this->loadDP()->time();
37
  $aData = array(
38
  'stat_key' => $sStatKey,
39
  'parent_stat_key' => $sParent,
33
  return false;
34
  }
35
 
36
+ $nTimeStamp = $this->loadRequest()->ts();
37
  $aData = array(
38
  'stat_key' => $sStatKey,
39
  'parent_stat_key' => $sParent,
src/query/traffic/insert.php CHANGED
@@ -15,7 +15,7 @@ class ICWP_WPSF_Query_TrafficEntry_Insert extends ICWP_WPSF_Query_BaseInsert {
15
  */
16
  public function insert( $oEntry ) {
17
  if ( $oEntry->created_at < 1 ) {
18
- $oEntry->created_at = $this->loadDP()->time();
19
  }
20
  return $this->setInsertData( $oEntry->getRawDataAsArray() )->query() === 1;
21
  }
15
  */
16
  public function insert( $oEntry ) {
17
  if ( $oEntry->created_at < 1 ) {
18
+ $oEntry->created_at = $this->loadRequest()->ts();
19
  }
20
  return $this->setInsertData( $oEntry->getRawDataAsArray() )->query() === 1;
21
  }
src/wizards/base.php CHANGED
@@ -37,7 +37,7 @@ abstract class ICWP_WPSF_Wizard_Base extends ICWP_WPSF_Foundation {
37
  * Ensure to only ever process supported wizards
38
  */
39
  public function ajaxExec_WizRenderStep() {
40
- $oDP = $this->loadDP();
41
 
42
  $aResponse = array(
43
  'success' => false,
@@ -45,11 +45,11 @@ abstract class ICWP_WPSF_Wizard_Base extends ICWP_WPSF_Foundation {
45
  );
46
 
47
  try {
48
- $this->setCurrentWizard( $oDP->post( 'wizard_slug' ) );
49
  if ( $this->getUserCan() ) {
50
  $aNextStep = $this->buildNextStep(
51
- $oDP->post( 'wizard_steps' ),
52
- (int)$oDP->post( 'current_index' )
53
  );
54
  $aResponse[ 'success' ] = true;
55
  $aResponse[ 'next_step' ] = $aNextStep;
@@ -68,7 +68,7 @@ abstract class ICWP_WPSF_Wizard_Base extends ICWP_WPSF_Foundation {
68
  * TODO: does not honour 'min_user_permissions' from the wizard definition
69
  */
70
  public function onWpLoaded() {
71
- $sWizard = $this->loadDP()->query( 'wizard' );
72
  try {
73
  $this->setCurrentWizard( $sWizard );
74
 
@@ -185,7 +185,7 @@ abstract class ICWP_WPSF_Wizard_Base extends ICWP_WPSF_Foundation {
185
  */
186
  public function ajaxExec_WizProcessStep() {
187
  $this->loadAutoload(); // for Response
188
- $oResponse = $this->processWizardStep( $this->loadDP()->post( 'wizard-step' ) );
189
  if ( !empty( $oResponse ) ) {
190
  $this->buildWizardResponse( $oResponse );
191
  }
@@ -312,7 +312,7 @@ abstract class ICWP_WPSF_Wizard_Base extends ICWP_WPSF_Foundation {
312
  ),
313
  'data' => array(),
314
  'hrefs' => array(
315
- 'form_action' => $this->loadDP()->getRequestUri(),
316
  'css_bootstrap' => $oCon->getPluginUrl_Css( 'bootstrap4.min.css' ),
317
  'css_pages' => $oCon->getPluginUrl_Css( 'pages.css' ),
318
  'css_steps' => $oCon->getPluginUrl_Css( 'jquery.steps.css' ),
37
  * Ensure to only ever process supported wizards
38
  */
39
  public function ajaxExec_WizRenderStep() {
40
+ $oReq = $this->loadRequest();
41
 
42
  $aResponse = array(
43
  'success' => false,
45
  );
46
 
47
  try {
48
+ $this->setCurrentWizard( $oReq->post( 'wizard_slug' ) );
49
  if ( $this->getUserCan() ) {
50
  $aNextStep = $this->buildNextStep(
51
+ $oReq->post( 'wizard_steps' ),
52
+ (int)$oReq->post( 'current_index' )
53
  );
54
  $aResponse[ 'success' ] = true;
55
  $aResponse[ 'next_step' ] = $aNextStep;
68
  * TODO: does not honour 'min_user_permissions' from the wizard definition
69
  */
70
  public function onWpLoaded() {
71
+ $sWizard = $this->loadRequest()->query( 'wizard' );
72
  try {
73
  $this->setCurrentWizard( $sWizard );
74
 
185
  */
186
  public function ajaxExec_WizProcessStep() {
187
  $this->loadAutoload(); // for Response
188
+ $oResponse = $this->processWizardStep( $this->loadRequest()->post( 'wizard-step' ) );
189
  if ( !empty( $oResponse ) ) {
190
  $this->buildWizardResponse( $oResponse );
191
  }
312
  ),
313
  'data' => array(),
314
  'hrefs' => array(
315
+ 'form_action' => $this->loadRequest()->getUri(),
316
  'css_bootstrap' => $oCon->getPluginUrl_Css( 'bootstrap4.min.css' ),
317
  'css_pages' => $oCon->getPluginUrl_Css( 'pages.css' ),
318
  'css_steps' => $oCon->getPluginUrl_Css( 'jquery.steps.css' ),
src/wizards/base_wpsf.php CHANGED
@@ -42,7 +42,7 @@ abstract class ICWP_WPSF_Wizard_BaseWpsf extends ICWP_WPSF_Wizard_Base {
42
 
43
  switch ( $sStep ) {
44
  case 'security_admin_verify':
45
- $aAdditional = array( 'current_index' => $this->loadDP()->post( 'current_index' ) );
46
  break;
47
  default:
48
  $aAdditional = parent::getRenderData_SlideExtra( $sStep );
@@ -97,7 +97,7 @@ abstract class ICWP_WPSF_Wizard_BaseWpsf extends ICWP_WPSF_Wizard_Base {
97
  * @return \FernleafSystems\Utilities\Response
98
  */
99
  private function wizardSecurityAdminVerify() {
100
- $sKey = $this->loadDP()->post( 'AccessKey' );
101
 
102
  $oResponse = new \FernleafSystems\Utilities\Response();
103
 
42
 
43
  switch ( $sStep ) {
44
  case 'security_admin_verify':
45
+ $aAdditional = array( 'current_index' => $this->loadRequest()->post( 'current_index' ) );
46
  break;
47
  default:
48
  $aAdditional = parent::getRenderData_SlideExtra( $sStep );
97
  * @return \FernleafSystems\Utilities\Response
98
  */
99
  private function wizardSecurityAdminVerify() {
100
+ $sKey = $this->loadRequest()->post( 'AccessKey' );
101
 
102
  $oResponse = new \FernleafSystems\Utilities\Response();
103
 
src/wizards/hack_protect.php CHANGED
@@ -76,7 +76,7 @@ class ICWP_WPSF_Wizard_HackProtect extends ICWP_WPSF_Wizard_BaseWpsf {
76
  private function process_Exclusions() {
77
  /** @var ICWP_WPSF_FeatureHandler_HackProtect $oFO */
78
  $oFO = $this->getModCon();
79
- $oFO->setUfcFileExclusions( explode( "\n", $this->loadDP()->post( 'exclusions' ) ) );
80
 
81
  $oResponse = new \FernleafSystems\Utilities\Response();
82
  return $oResponse->setSuccessful( true )
@@ -91,7 +91,7 @@ class ICWP_WPSF_Wizard_HackProtect extends ICWP_WPSF_Wizard_BaseWpsf {
91
  $oFO = $this->getModCon();
92
 
93
  $oResponse = new \FernleafSystems\Utilities\Response();
94
- if ( $this->loadDP()->post( 'DeleteFiles' ) === 'Y' ) {
95
  // First get the current setting and if necessary, modify it and then reset it.
96
  $sDesiredOption = 'enabled_delete_only';
97
  $sCurrentOption = $oFO->getUnrecognisedFileScannerOption();
@@ -124,7 +124,7 @@ class ICWP_WPSF_Wizard_HackProtect extends ICWP_WPSF_Wizard_BaseWpsf {
124
  /** @var ICWP_WPSF_FeatureHandler_HackProtect $oFO */
125
  $oFO = $this->getModCon();
126
 
127
- if ( $this->loadDP()->post( 'RestoreFiles' ) === 'Y' ) {
128
  /** @var ICWP_WPSF_Processor_HackProtect $oProc */
129
  $oProc = $oFO->getProcessor();
130
  $oProc->getSubProcessorChecksumScan()->doChecksumScan( true );
@@ -147,7 +147,7 @@ class ICWP_WPSF_Wizard_HackProtect extends ICWP_WPSF_Wizard_BaseWpsf {
147
  /** @var ICWP_WPSF_FeatureHandler_HackProtect $oFO */
148
  $oFO = $this->getModCon();
149
 
150
- $sSetting = $this->loadDP()->post( 'enable_scan' );
151
  $oFO->setPtgEnabledOption( $sSetting )
152
  ->savePluginOptions();
153
 
@@ -172,7 +172,7 @@ class ICWP_WPSF_Wizard_HackProtect extends ICWP_WPSF_Wizard_BaseWpsf {
172
  /** @var ICWP_WPSF_FeatureHandler_HackProtect $oFO */
173
  $oFO = $this->getModCon();
174
 
175
- $sSetting = $this->loadDP()->post( 'enable_scan' );
176
  $oFO->setUfcOption( $sSetting )
177
  ->savePluginOptions();
178
 
@@ -202,7 +202,7 @@ class ICWP_WPSF_Wizard_HackProtect extends ICWP_WPSF_Wizard_BaseWpsf {
202
  /** @var ICWP_WPSF_FeatureHandler_HackProtect $oFO */
203
  $oFO = $this->getModCon();
204
 
205
- $sSetting = $this->loadDP()->post( 'enable_scan' );
206
 
207
  $bEnabled = true;
208
  $bRestore = false;
@@ -254,11 +254,11 @@ class ICWP_WPSF_Wizard_HackProtect extends ICWP_WPSF_Wizard_BaseWpsf {
254
  private function process_AssetAction() {
255
  /** @var ICWP_WPSF_FeatureHandler_HackProtect $oFO */
256
  $oFO = $this->getModCon();
257
- $oDP = $this->loadDP();
258
 
259
- $sSlug = $oDP->post( 'slug' );
260
- $sContext = $oDP->post( 'context' );
261
- $sItemAction = $oDP->post( 'ptgaction' );
262
 
263
  $oWpPlugins = $this->loadWpPlugins();
264
  $oWpThemes = $this->loadWpThemes();
76
  private function process_Exclusions() {
77
  /** @var ICWP_WPSF_FeatureHandler_HackProtect $oFO */
78
  $oFO = $this->getModCon();
79
+ $oFO->setUfcFileExclusions( explode( "\n", $this->loadRequest()->post( 'exclusions' ) ) );
80
 
81
  $oResponse = new \FernleafSystems\Utilities\Response();
82
  return $oResponse->setSuccessful( true )
91
  $oFO = $this->getModCon();
92
 
93
  $oResponse = new \FernleafSystems\Utilities\Response();
94
+ if ( $this->loadRequest()->post( 'DeleteFiles' ) === 'Y' ) {
95
  // First get the current setting and if necessary, modify it and then reset it.
96
  $sDesiredOption = 'enabled_delete_only';
97
  $sCurrentOption = $oFO->getUnrecognisedFileScannerOption();
124
  /** @var ICWP_WPSF_FeatureHandler_HackProtect $oFO */
125
  $oFO = $this->getModCon();
126
 
127
+ if ( $this->loadRequest()->post( 'RestoreFiles' ) === 'Y' ) {
128
  /** @var ICWP_WPSF_Processor_HackProtect $oProc */
129
  $oProc = $oFO->getProcessor();
130
  $oProc->getSubProcessorChecksumScan()->doChecksumScan( true );
147
  /** @var ICWP_WPSF_FeatureHandler_HackProtect $oFO */
148
  $oFO = $this->getModCon();
149
 
150
+ $sSetting = $this->loadRequest()->post( 'enable_scan' );
151
  $oFO->setPtgEnabledOption( $sSetting )
152
  ->savePluginOptions();
153
 
172
  /** @var ICWP_WPSF_FeatureHandler_HackProtect $oFO */
173
  $oFO = $this->getModCon();
174
 
175
+ $sSetting = $this->loadRequest()->post( 'enable_scan' );
176
  $oFO->setUfcOption( $sSetting )
177
  ->savePluginOptions();
178
 
202
  /** @var ICWP_WPSF_FeatureHandler_HackProtect $oFO */
203
  $oFO = $this->getModCon();
204
 
205
+ $sSetting = $this->loadRequest()->post( 'enable_scan' );
206
 
207
  $bEnabled = true;
208
  $bRestore = false;
254
  private function process_AssetAction() {
255
  /** @var ICWP_WPSF_FeatureHandler_HackProtect $oFO */
256
  $oFO = $this->getModCon();
257
+ $oReq = $this->loadRequest();
258
 
259
+ $sSlug = $oReq->post( 'slug' );
260
+ $sContext = $oReq->post( 'context' );
261
+ $sItemAction = $oReq->post( 'ptgaction' );
262
 
263
  $oWpPlugins = $this->loadWpPlugins();
264
  $oWpThemes = $this->loadWpThemes();
src/wizards/login_protect.php CHANGED
@@ -49,16 +49,16 @@ class ICWP_WPSF_Wizard_LoginProtect extends ICWP_WPSF_Wizard_BaseWpsf {
49
  private function processAuthEmail() {
50
  /** @var ICWP_WPSF_FeatureHandler_LoginProtect $oFO */
51
  $oFO = $this->getModCon();
52
- $oDP = $this->loadDP();
53
 
54
  $oResponse = new \FernleafSystems\Utilities\Response();
55
  $oResponse->setSuccessful( false );
56
 
57
- $sEmail = $oDP->post( 'email' );
58
- $sCode = $oDP->post( 'code' );
59
- $bFa = $oDP->post( 'Email2FAOption' ) === 'Y';
60
 
61
- if ( !$oDP->validEmail( $sEmail ) ) {
62
  $sMessage = _wpsf__( 'Invalid email address' );
63
  }
64
  else {
@@ -104,13 +104,13 @@ class ICWP_WPSF_Wizard_LoginProtect extends ICWP_WPSF_Wizard_BaseWpsf {
104
  private function processAuthGa() {
105
  /** @var ICWP_WPSF_FeatureHandler_LoginProtect $oFO */
106
  $oFO = $this->getModCon();
107
- $oDP = $this->loadDP();
108
 
109
  $oResponse = new \FernleafSystems\Utilities\Response();
110
  $oResponse->setSuccessful( false );
111
 
112
- $sCode = $oDP->post( 'gacode' );
113
- $bEnableGa = $oDP->post( 'enablega' ) === 'Y';
114
 
115
  $sMessage = '';
116
  if ( $sCode != 'ignore' ) {
@@ -156,7 +156,7 @@ class ICWP_WPSF_Wizard_LoginProtect extends ICWP_WPSF_Wizard_BaseWpsf {
156
  /** @var ICWP_WPSF_FeatureHandler_LoginProtect $oFO */
157
  $oFO = $this->getModCon();
158
 
159
- $bEnabledMulti = $this->loadDP()->post( 'multiselect' ) === 'Y';
160
  $oFO->setIsChainedAuth( $bEnabledMulti );
161
  $sMessage = sprintf( _wpsf__( 'Multi-Factor Authentication was %s for the site.' ),
162
  $bEnabledMulti ? _wpsf__( 'enabled' ) : _wpsf__( 'disabled' )
49
  private function processAuthEmail() {
50
  /** @var ICWP_WPSF_FeatureHandler_LoginProtect $oFO */
51
  $oFO = $this->getModCon();
52
+ $oReq = $this->loadRequest();
53
 
54
  $oResponse = new \FernleafSystems\Utilities\Response();
55
  $oResponse->setSuccessful( false );
56
 
57
+ $sEmail = $oReq->post( 'email' );
58
+ $sCode = $oReq->post( 'code' );
59
+ $bFa = $oReq->post( 'Email2FAOption' ) === 'Y';
60
 
61
+ if ( !$this->loadDP()->validEmail( $sEmail ) ) {
62
  $sMessage = _wpsf__( 'Invalid email address' );
63
  }
64
  else {
104
  private function processAuthGa() {
105
  /** @var ICWP_WPSF_FeatureHandler_LoginProtect $oFO */
106
  $oFO = $this->getModCon();
107
+ $oReq = $this->loadRequest();
108
 
109
  $oResponse = new \FernleafSystems\Utilities\Response();
110
  $oResponse->setSuccessful( false );
111
 
112
+ $sCode = $oReq->post( 'gacode' );
113
+ $bEnableGa = $oReq->post( 'enablega' ) === 'Y';
114
 
115
  $sMessage = '';
116
  if ( $sCode != 'ignore' ) {
156
  /** @var ICWP_WPSF_FeatureHandler_LoginProtect $oFO */
157
  $oFO = $this->getModCon();
158
 
159
+ $bEnabledMulti = $this->loadRequest()->post( 'multiselect' ) === 'Y';
160
  $oFO->setIsChainedAuth( $bEnabledMulti );
161
  $sMessage = sprintf( _wpsf__( 'Multi-Factor Authentication was %s for the site.' ),
162
  $bEnabledMulti ? _wpsf__( 'enabled' ) : _wpsf__( 'disabled' )
src/wizards/plugin.php CHANGED
@@ -338,7 +338,7 @@ class ICWP_WPSF_Wizard_Plugin extends ICWP_WPSF_Wizard_BaseWpsf {
338
  */
339
  private function wizardIpDetect() {
340
  $oIps = $this->loadIpService();
341
- $sIp = $this->loadDP()->post( 'ip' );
342
 
343
  $oResponse = new \FernleafSystems\Utilities\Response();
344
  $oResponse->setSuccessful( false );
@@ -404,11 +404,11 @@ class ICWP_WPSF_Wizard_Plugin extends ICWP_WPSF_Wizard_BaseWpsf {
404
  private function wizardImportOptions() {
405
  /** @var ICWP_WPSF_FeatureHandler_Plugin $oFO */
406
  $oFO = $this->getModCon();
407
- $oDP = $this->loadDP();
408
 
409
- $sMasterSiteUrl = $oDP->post( 'MasterSiteUrl' );
410
- $sSecretKey = $oDP->post( 'MasterSiteSecretKey' );
411
- $bEnabledNetwork = $oDP->post( 'ShieldNetworkCheck' ) === 'Y';
412
 
413
  /** @var ICWP_WPSF_Processor_Plugin $oProc */
414
  $oProc = $oFO->getProcessor();
@@ -439,9 +439,9 @@ class ICWP_WPSF_Wizard_Plugin extends ICWP_WPSF_Wizard_BaseWpsf {
439
  * @return \FernleafSystems\Utilities\Response
440
  */
441
  private function wizardSecurityAdmin() {
442
- $oDP = $this->loadDP();
443
- $sKey = $oDP->post( 'AccessKey' );
444
- $sConfirm = $oDP->post( 'AccessKeyConfirm' );
445
 
446
  $oResponse = new \FernleafSystems\Utilities\Response();
447
 
@@ -475,7 +475,7 @@ class ICWP_WPSF_Wizard_Plugin extends ICWP_WPSF_Wizard_BaseWpsf {
475
  */
476
  private function wizardAuditTrail() {
477
 
478
- $sInput = $this->loadDP()->post( 'AuditTrailOption' );
479
  $bSuccess = false;
480
  $sMessage = _wpsf__( 'No changes were made as no option was selected' );
481
 
@@ -508,7 +508,7 @@ class ICWP_WPSF_Wizard_Plugin extends ICWP_WPSF_Wizard_BaseWpsf {
508
  */
509
  private function wizardIps() {
510
 
511
- $sInput = $this->loadDP()->post( 'IpManagerOption' );
512
  $bSuccess = false;
513
  $sMessage = _wpsf__( 'No changes were made as no option was selected' );
514
 
@@ -541,7 +541,7 @@ class ICWP_WPSF_Wizard_Plugin extends ICWP_WPSF_Wizard_BaseWpsf {
541
  */
542
  private function wizardLoginProtect() {
543
 
544
- $sInput = $this->loadDP()->post( 'LoginProtectOption' );
545
  $bSuccess = false;
546
  $sMessage = _wpsf__( 'No changes were made as no option was selected' );
547
 
@@ -576,16 +576,16 @@ class ICWP_WPSF_Wizard_Plugin extends ICWP_WPSF_Wizard_BaseWpsf {
576
  * @return \FernleafSystems\Utilities\Response
577
  */
578
  private function wizardOptin() {
579
- $oDP = $this->loadDP();
580
  /** @var ICWP_WPSF_FeatureHandler_Plugin $oModule */
581
  $oModule = $this->getPluginCon()->getModule( 'plugin' );
582
 
583
  $bSuccess = false;
584
  $sMessage = _wpsf__( 'No changes were made as no option was selected' );
585
 
586
- $sForm = $oDP->post( 'wizard-step' );
587
  if ( $sForm == 'optin_badge' ) {
588
- $sInput = $oDP->post( 'BadgeOption' );
589
 
590
  if ( !empty( $sInput ) ) {
591
  $bEnabled = $sInput === 'Y';
@@ -595,7 +595,7 @@ class ICWP_WPSF_Wizard_Plugin extends ICWP_WPSF_Wizard_BaseWpsf {
595
  }
596
  }
597
  else if ( $sForm == 'optin_usage' ) {
598
- $sInput = $oDP->post( 'AnonymousOption' );
599
 
600
  if ( !empty( $sInput ) ) {
601
  $bEnabled = $sInput === 'Y';
@@ -614,8 +614,7 @@ class ICWP_WPSF_Wizard_Plugin extends ICWP_WPSF_Wizard_BaseWpsf {
614
  * @return \FernleafSystems\Utilities\Response
615
  */
616
  private function wizardAddSearchItem() {
617
- $oDP = $this->loadDP();
618
- $sInput = esc_js( esc_html( trim( $oDP->post( 'SearchItem' ) ) ) );
619
 
620
  $aItems = $this->getGdprSearchItems();
621
 
@@ -625,7 +624,7 @@ class ICWP_WPSF_Wizard_Plugin extends ICWP_WPSF_Wizard_BaseWpsf {
625
  }
626
  else {
627
  $aItems[] = $sInput;
628
- if ( $oDP->validEmail( $sInput ) ) {
629
  $oUser = $this->loadWpUsers()->getUserByEmail( $sInput );
630
  if ( !is_null( $oUser ) ) {
631
  $aItems[] = $oUser->user_login;
@@ -658,7 +657,7 @@ class ICWP_WPSF_Wizard_Plugin extends ICWP_WPSF_Wizard_BaseWpsf {
658
  }
659
 
660
  private function wizardConfirmDelete() {
661
- $bDelete = $this->loadDP()->post( 'ConfirmDelete' ) === 'Y';
662
  if ( $bDelete ) {
663
  /** @var ICWP_WPSF_Processor_AuditTrail $oProc */
664
  $oProc = $this->getPluginCon()->getModule( 'audit_trail' )->getProcessor();
@@ -687,7 +686,7 @@ class ICWP_WPSF_Wizard_Plugin extends ICWP_WPSF_Wizard_BaseWpsf {
687
  */
688
  private function wizardCommentsFilter() {
689
 
690
- $sInput = $this->loadDP()->post( 'CommentsFilterOption' );
691
  $bSuccess = false;
692
  $sMessage = _wpsf__( 'No changes were made as no option was selected' );
693
 
338
  */
339
  private function wizardIpDetect() {
340
  $oIps = $this->loadIpService();
341
+ $sIp = $this->loadRequest()->post( 'ip' );
342
 
343
  $oResponse = new \FernleafSystems\Utilities\Response();
344
  $oResponse->setSuccessful( false );
404
  private function wizardImportOptions() {
405
  /** @var ICWP_WPSF_FeatureHandler_Plugin $oFO */
406
  $oFO = $this->getModCon();
407
+ $oREq = $this->loadRequest();
408
 
409
+ $sMasterSiteUrl = $oREq->post( 'MasterSiteUrl' );
410
+ $sSecretKey = $oREq->post( 'MasterSiteSecretKey' );
411
+ $bEnabledNetwork = $oREq->post( 'ShieldNetworkCheck' ) === 'Y';
412
 
413
  /** @var ICWP_WPSF_Processor_Plugin $oProc */
414
  $oProc = $oFO->getProcessor();
439
  * @return \FernleafSystems\Utilities\Response
440
  */
441
  private function wizardSecurityAdmin() {
442
+ $oReq = $this->loadRequest();
443
+ $sKey = $oReq->post( 'AccessKey' );
444
+ $sConfirm = $oReq->post( 'AccessKeyConfirm' );
445
 
446
  $oResponse = new \FernleafSystems\Utilities\Response();
447
 
475
  */
476
  private function wizardAuditTrail() {
477
 
478
+ $sInput = $this->loadRequest()->post( 'AuditTrailOption' );
479
  $bSuccess = false;
480
  $sMessage = _wpsf__( 'No changes were made as no option was selected' );
481
 
508
  */
509
  private function wizardIps() {
510
 
511
+ $sInput = $this->loadRequest()->post( 'IpManagerOption' );
512
  $bSuccess = false;
513
  $sMessage = _wpsf__( 'No changes were made as no option was selected' );
514
 
541
  */
542
  private function wizardLoginProtect() {
543
 
544
+ $sInput = $this->loadRequest()->post( 'LoginProtectOption' );
545
  $bSuccess = false;
546
  $sMessage = _wpsf__( 'No changes were made as no option was selected' );
547
 
576
  * @return \FernleafSystems\Utilities\Response
577
  */
578
  private function wizardOptin() {
579
+ $oReq = $this->loadRequest();
580
  /** @var ICWP_WPSF_FeatureHandler_Plugin $oModule */
581
  $oModule = $this->getPluginCon()->getModule( 'plugin' );
582
 
583
  $bSuccess = false;
584
  $sMessage = _wpsf__( 'No changes were made as no option was selected' );
585
 
586
+ $sForm = $oReq->post( 'wizard-step' );
587
  if ( $sForm == 'optin_badge' ) {
588
+ $sInput = $oReq->post( 'BadgeOption' );
589
 
590
  if ( !empty( $sInput ) ) {
591
  $bEnabled = $sInput === 'Y';
595
  }
596
  }
597
  else if ( $sForm == 'optin_usage' ) {
598
+ $sInput = $oReq->post( 'AnonymousOption' );
599
 
600
  if ( !empty( $sInput ) ) {
601
  $bEnabled = $sInput === 'Y';
614
  * @return \FernleafSystems\Utilities\Response
615
  */
616
  private function wizardAddSearchItem() {
617
+ $sInput = esc_js( esc_html( $this->loadRequest()->post( 'SearchItem' ) ) );
 
618
 
619
  $aItems = $this->getGdprSearchItems();
620
 
624
  }
625
  else {
626
  $aItems[] = $sInput;
627
+ if ( $this->loadDP()->validEmail( $sInput ) ) {
628
  $oUser = $this->loadWpUsers()->getUserByEmail( $sInput );
629
  if ( !is_null( $oUser ) ) {
630
  $aItems[] = $oUser->user_login;
657
  }
658
 
659
  private function wizardConfirmDelete() {
660
+ $bDelete = $this->loadRequest()->post( 'ConfirmDelete' ) === 'Y';
661
  if ( $bDelete ) {
662
  /** @var ICWP_WPSF_Processor_AuditTrail $oProc */
663
  $oProc = $this->getPluginCon()->getModule( 'audit_trail' )->getProcessor();
686
  */
687
  private function wizardCommentsFilter() {
688
 
689
+ $sInput = $this->loadRequest()->post( 'CommentsFilterOption' );
690
  $bSuccess = false;
691
  $sMessage = _wpsf__( 'No changes were made as no option was selected' );
692
 
templates/php/snippets/admin_access_login_box.php CHANGED
@@ -4,12 +4,14 @@
4
 
5
  <script type="text/javascript">
6
 
7
- jQuery( document ).ready(
8
- function () {
9
- aItems = [ <?php echo $js_snippets[ 'options_to_restrict' ]; ?> ];
10
- aItems.forEach( disable_input );
11
- }
12
- );
 
 
13
 
14
  function disable_input( element, index, array ) {
15
  $oItem = jQuery( 'input[name=' + element + ']' );
4
 
5
  <script type="text/javascript">
6
 
7
+ <?php if ( $flags[ 'restrict_options' ] ) : ?>
8
+ jQuery( document ).ready(
9
+ function () {
10
+ aItems = [ <?php echo $js_snippets[ 'options_to_restrict' ]; ?> ];
11
+ aItems.forEach( disable_input );
12
+ }
13
+ );
14
+ <?php endif; ?>
15
 
16
  function disable_input( element, index, array ) {
17
  $oItem = jQuery( 'input[name=' + element + ']' );
templates/php/snippets/plugin-deactivate-survey.php CHANGED
@@ -8,6 +8,7 @@
8
  <?php echo $sOpt; ?></label></li>
9
  <?php endforeach; ?>
10
  </ul>
11
- <textarea name="reason_comments" style="width: 360px;" rows="3" placeholder="Any other comments?"></textarea>
 
12
  </form>
13
  </div>
8
  <?php echo $sOpt; ?></label></li>
9
  <?php endforeach; ?>
10
  </ul>
11
+ <textarea name="reason_comments" style="width: 360px;" rows="3"
12
+ placeholder="If you got errors, for example, could you outline the problems you had?"></textarea>
13
  </form>
14
  </div>