PluginProbe
Patchstack – WordPress & Plugins Security / 2.1.2
Patchstack – WordPress & Plugins Security v2.1.2
2.3.7 trunk 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.16 2.1.17 2.1.18 2.1.19 2.1.2 2.1.20 2.1.21 2.1.22 2.1.23 2.1.24 2.1.25 2.1.3 2.1.4 2.1.5 2.1.6 All 49 releases
patchstack / includes / hacker-log.php

hacker-log.php in Patchstack – WordPress & Plugins Security 2.1.2, at includes/hacker-log.php

56 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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', array( $this, 'query_vars' ) );
23 add_action( 'parse_request', array( $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 }
56