| @@ -1,55 +1,55 @@ | ||
| 1 | -<?php | |
| 2 | - | |
| 3 | -// Do not allow the file to be called directly. | |
| 4 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 5 | - exit; | |
| 6 | -} | |
| 7 | - | |
| 8 | -/** | |
| 9 | - * This class is used to block a user when a bad request has been | |
| 10 | - * detected or matches our firewall rules in the .htaccess file. | |
| 11 | - */ | |
| 12 | -class P_Hacker_Log extends P_Core { | |
| 13 | - | |
| 14 | - /** | |
| 15 | - * Add the actions required for the logging of hackers. | |
| 16 | - * | |
| 17 | - * @param Patchstack $core | |
| 18 | - * @return void | |
| 19 | - */ | |
| 20 | - public function __construct( $core ) { | |
| 21 | - parent::__construct( $core ); | |
| 22 | - add_filter( 'query_vars', [ $this, 'query_vars' ] ); | |
| 23 | - add_action( 'parse_request', [ $this, 'parse_request' ] ); | |
| 24 | - } | |
| 25 | - | |
| 26 | - /** | |
| 27 | - * Register our query parameters to WordPress. | |
| 28 | - * | |
| 29 | - * @param array $query_vars | |
| 30 | - * @return array | |
| 31 | - */ | |
| 32 | - public function query_vars( $query_vars ) { | |
| 33 | - $query_vars[] = 'webarx_fpage'; | |
| 34 | - return $query_vars; | |
| 35 | - } | |
| 36 | - | |
| 37 | - /** | |
| 38 | - * Parse the incoming request and determine if our registered | |
| 39 | - * parameters are set. | |
| 40 | - * | |
| 41 | - * @param WP $query | |
| 42 | - * @return void|WP | |
| 43 | - */ | |
| 44 | - public function parse_request( $query ) { | |
| 45 | - if ( $this->plugin->firewall_base->is_authenticated() ) { | |
| 46 | - return $query; | |
| 47 | - } | |
| 48 | - | |
| 49 | - if ( array_key_exists( 'webarx_fpage', $query->query_vars ) ) { | |
| 50 | - $this->plugin->firewall_base->display_error_page( (int) $query->query_vars['webarx_fpage'] ); | |
| 51 | - } else { | |
| 52 | - return $query; | |
| 53 | - } | |
| 54 | - } | |
| 55 | -} | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +// Do not allow the file to be called directly. | |
| 4 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 5 | + exit; | |
| 6 | +} | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * This class is used to block a user when a bad request has been | |
| 10 | + * detected or matches our firewall rules in the .htaccess file. | |
| 11 | + */ | |
| 12 | +class P_Hacker_Log extends P_Core { | |
| 13 | + | |
| 14 | + /** | |
| 15 | + * Add the actions required for the logging of hackers. | |
| 16 | + * | |
| 17 | + * @param Patchstack $core | |
| 18 | + * @return void | |
| 19 | + */ | |
| 20 | + public function __construct( $core ) { | |
| 21 | + parent::__construct( $core ); | |
| 22 | + add_filter( 'query_vars', [ $this, 'query_vars' ] ); | |
| 23 | + add_action( 'parse_request', [ $this, 'parse_request' ] ); | |
| 24 | + } | |
| 25 | + | |
| 26 | + /** | |
| 27 | + * Register our query parameters to WordPress. | |
| 28 | + * | |
| 29 | + * @param array $query_vars | |
| 30 | + * @return array | |
| 31 | + */ | |
| 32 | + public function query_vars( $query_vars ) { | |
| 33 | + $query_vars[] = 'webarx_fpage'; | |
| 34 | + return $query_vars; | |
| 35 | + } | |
| 36 | + | |
| 37 | + /** | |
| 38 | + * Parse the incoming request and determine if our registered | |
| 39 | + * parameters are set. | |
| 40 | + * | |
| 41 | + * @param WP $query | |
| 42 | + * @return void|WP | |
| 43 | + */ | |
| 44 | + public function parse_request( $query ) { | |
| 45 | + if ( $this->plugin->firewall_base->is_authenticated() ) { | |
| 46 | + return $query; | |
| 47 | + } | |
| 48 | + | |
| 49 | + if ( array_key_exists( 'webarx_fpage', $query->query_vars ) ) { | |
| 50 | + $this->plugin->firewall_base->display_error_page( (int) $query->query_vars['webarx_fpage'] ); | |
| 51 | + } else { | |
| 52 | + return $query; | |
| 53 | + } | |
| 54 | + } | |
| 55 | +} | |