Version Description
Download this release
Release Info
Developer | paultgoodchild |
Plugin | Shield Security for WordPress |
Version | 16.1.13 |
Comparing to | |
See all releases |
Code changes from version 16.1.12 to 16.1.13
- cl.json +12 -3
- config/deprecated/audit_trail.php +6 -0
- config/deprecated/hack_protect.php +6 -0
- config/deprecated/insights.php +0 -27
- config/deprecated/ips.php +6 -0
- config/deprecated/license.php +7 -0
- config/deprecated/plugin.php +23 -0
- config/deprecated/reporting.php +4 -0
- config/deprecated/traffic.php +6 -0
- icwp-wpsf.php +2 -3
- plugin-spec.php +9 -9
- plugin.json +9 -9
- readme.txt +1 -1
- src/lib/src/Modules/IPs/Lib/IpRules/IpRuleStatus.php +9 -0
- src/lib/src/Modules/IPs/Lib/Table/BuildIpRulesTableData.php +20 -6
- src/lib/src/Modules/Integrations/Lib/MainWP/Server/UI/PageRender/MwpOutOfDate.php +0 -30
- src/lib/src/Modules/Integrations/Lib/MainWP/Server/UI/PageRender/NotShieldPro.php +0 -24
- src/lib/src/Modules/Integrations/Lib/MainWP/Server/UI/PageRender/PluginOutOfDate.php +0 -25
- src/lib/src/Modules/Integrations/Lib/MainWP/Server/UI/PageRender/SitesList.php +0 -142
- src/lib/src/Modules/LoginGuard/AjaxHandler.php +6 -1
- src/lib/src/Modules/Plugin/Lib/PluginTelemetry.php +1 -1
- src/lib/src/Modules/UserManagement/Lib/Suspend/UserSuspendController.php +54 -29
- src/lib/src/Rules/Conditions/IsIpHighReputation.php +3 -4
cl.json
CHANGED
@@ -128,11 +128,16 @@
|
|
128 |
],
|
129 |
"patches": [
|
130 |
{
|
131 |
-
"version": "
|
132 |
-
"released_at":
|
133 |
"items": [
|
134 |
{
|
135 |
-
"title": "
|
|
|
|
|
|
|
|
|
|
|
136 |
"type": "improved"
|
137 |
},
|
138 |
{
|
@@ -146,6 +151,10 @@
|
|
146 |
{
|
147 |
"title": "Improved the data used to construct the QR codes for Google Authenticator setup.",
|
148 |
"type": "improved"
|
|
|
|
|
|
|
|
|
149 |
}
|
150 |
]
|
151 |
},
|
128 |
],
|
129 |
"patches": [
|
130 |
{
|
131 |
+
"version": "13",
|
132 |
+
"released_at": 1667298000,
|
133 |
"items": [
|
134 |
{
|
135 |
+
"title": "Marks Shield 16.x as the final series supporting PHP 7.0 and 7.1. Shield 17 will require PHP 7.2.",
|
136 |
+
"type": "changed",
|
137 |
+
"href": "https://shsec.io/l8"
|
138 |
+
},
|
139 |
+
{
|
140 |
+
"title": "Attempt to eliminate CrowdSec API issues.",
|
141 |
"type": "improved"
|
142 |
},
|
143 |
{
|
151 |
{
|
152 |
"title": "Improved the data used to construct the QR codes for Google Authenticator setup.",
|
153 |
"type": "improved"
|
154 |
+
},
|
155 |
+
{
|
156 |
+
"title": "Minor bug fixes.",
|
157 |
+
"type": "fixed"
|
158 |
}
|
159 |
]
|
160 |
},
|
config/deprecated/audit_trail.php
CHANGED
@@ -32,6 +32,12 @@
|
|
32 |
"wpcli": {
|
33 |
"enabled": true
|
34 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
"custom_redirects": [
|
36 |
{
|
37 |
"source_mod_page": "audit-redirect",
|
32 |
"wpcli": {
|
33 |
"enabled": true
|
34 |
},
|
35 |
+
"menu_items": [
|
36 |
+
{
|
37 |
+
"title": "Activity Log",
|
38 |
+
"slug": "audit-redirect"
|
39 |
+
}
|
40 |
+
],
|
41 |
"custom_redirects": [
|
42 |
{
|
43 |
"source_mod_page": "audit-redirect",
|
config/deprecated/hack_protect.php
CHANGED
@@ -35,6 +35,12 @@
|
|
35 |
"enabled": true,
|
36 |
"root": "hack_guard"
|
37 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
"custom_redirects": [
|
39 |
{
|
40 |
"source_mod_page": "scans-redirect",
|
35 |
"enabled": true,
|
36 |
"root": "hack_guard"
|
37 |
},
|
38 |
+
"menu_items": [
|
39 |
+
{
|
40 |
+
"title": "Scans",
|
41 |
+
"slug": "scans-redirect"
|
42 |
+
}
|
43 |
+
],
|
44 |
"custom_redirects": [
|
45 |
{
|
46 |
"source_mod_page": "scans-redirect",
|
config/deprecated/insights.php
CHANGED
@@ -19,33 +19,6 @@
|
|
19 |
"skip_processor": true,
|
20 |
"tracking_exclude": true
|
21 |
},
|
22 |
-
"menu_items": [
|
23 |
-
{
|
24 |
-
"title": "Configuration",
|
25 |
-
"slug": "redirect-config"
|
26 |
-
},
|
27 |
-
{
|
28 |
-
"title": "IP Manager",
|
29 |
-
"slug": "redirect-ips"
|
30 |
-
},
|
31 |
-
{
|
32 |
-
"title": "Scans",
|
33 |
-
"slug": "redirect-scans_results"
|
34 |
-
},
|
35 |
-
{
|
36 |
-
"title": "Activity Log",
|
37 |
-
"slug": "redirect-audit_trail"
|
38 |
-
},
|
39 |
-
{
|
40 |
-
"title": "Traffic Log",
|
41 |
-
"slug": "redirect-traffic"
|
42 |
-
},
|
43 |
-
{
|
44 |
-
"title": "Go PRO!",
|
45 |
-
"slug": "redirect-license",
|
46 |
-
"highlight": true
|
47 |
-
}
|
48 |
-
],
|
49 |
"wpcli": {
|
50 |
"enabled": false
|
51 |
},
|
19 |
"skip_processor": true,
|
20 |
"tracking_exclude": true
|
21 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
"wpcli": {
|
23 |
"enabled": false
|
24 |
},
|
config/deprecated/ips.php
CHANGED
@@ -30,6 +30,12 @@
|
|
30 |
"wpcli": {
|
31 |
"enabled": true
|
32 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
"custom_redirects": [
|
34 |
{
|
35 |
"source_mod_page": "ips-redirect",
|
30 |
"wpcli": {
|
31 |
"enabled": true
|
32 |
},
|
33 |
+
"menu_items": [
|
34 |
+
{
|
35 |
+
"title": "IP Manager",
|
36 |
+
"slug": "ips-redirect"
|
37 |
+
}
|
38 |
+
],
|
39 |
"custom_redirects": [
|
40 |
{
|
41 |
"source_mod_page": "ips-redirect",
|
config/deprecated/license.php
CHANGED
@@ -30,6 +30,13 @@
|
|
30 |
"type": "error"
|
31 |
}
|
32 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
"custom_redirects": [
|
34 |
{
|
35 |
"source_mod_page": "pro-redirect",
|
30 |
"type": "error"
|
31 |
}
|
32 |
},
|
33 |
+
"menu_items": [
|
34 |
+
{
|
35 |
+
"title": "Go PRO!",
|
36 |
+
"slug": "pro-redirect",
|
37 |
+
"highlight": true
|
38 |
+
}
|
39 |
+
],
|
40 |
"custom_redirects": [
|
41 |
{
|
42 |
"source_mod_page": "pro-redirect",
|
config/deprecated/plugin.php
CHANGED
@@ -73,6 +73,15 @@
|
|
73 |
"can_dismiss": false,
|
74 |
"type": "error"
|
75 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
"plugin-mailing-list-signup": {
|
77 |
"id": "plugin-mailing-list-signup",
|
78 |
"min_install_days": 5,
|
@@ -546,6 +555,20 @@
|
|
546 |
"section": "section_non_ui",
|
547 |
"type": "integer",
|
548 |
"default": 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
549 |
}
|
550 |
],
|
551 |
"definitions": {
|
73 |
"can_dismiss": false,
|
74 |
"type": "error"
|
75 |
},
|
76 |
+
"compat-sgoptimize": {
|
77 |
+
"id": "compat-sgoptimize",
|
78 |
+
"schedule": "conditions",
|
79 |
+
"valid_admin": true,
|
80 |
+
"plugin_admin": "ignore",
|
81 |
+
"plugin_page_only": false,
|
82 |
+
"can_dismiss": false,
|
83 |
+
"type": "warning"
|
84 |
+
},
|
85 |
"plugin-mailing-list-signup": {
|
86 |
"id": "plugin-mailing-list-signup",
|
87 |
"min_install_days": 5,
|
555 |
"section": "section_non_ui",
|
556 |
"type": "integer",
|
557 |
"default": 0
|
558 |
+
},
|
559 |
+
{
|
560 |
+
"key": "import_id",
|
561 |
+
"transferable": false,
|
562 |
+
"section": "section_non_ui",
|
563 |
+
"type": "text",
|
564 |
+
"default": ""
|
565 |
+
},
|
566 |
+
{
|
567 |
+
"key": "import_url_ids",
|
568 |
+
"transferable": false,
|
569 |
+
"section": "section_non_ui",
|
570 |
+
"type": "array",
|
571 |
+
"default": []
|
572 |
}
|
573 |
],
|
574 |
"definitions": {
|
config/deprecated/reporting.php
CHANGED
@@ -18,6 +18,10 @@
|
|
18 |
"wpcli": {
|
19 |
"enabled": true
|
20 |
},
|
|
|
|
|
|
|
|
|
21 |
"sections": [
|
22 |
{
|
23 |
"slug": "section_timings",
|
18 |
"wpcli": {
|
19 |
"enabled": true
|
20 |
},
|
21 |
+
"menu_items": [
|
22 |
+
],
|
23 |
+
"custom_redirects": [
|
24 |
+
],
|
25 |
"sections": [
|
26 |
{
|
27 |
"slug": "section_timings",
|
config/deprecated/traffic.php
CHANGED
@@ -30,6 +30,12 @@
|
|
30 |
"wpcli": {
|
31 |
"enabled": true
|
32 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
"custom_redirects": [
|
34 |
{
|
35 |
"source_mod_page": "traffic-redirect",
|
30 |
"wpcli": {
|
31 |
"enabled": true
|
32 |
},
|
33 |
+
"menu_items": [
|
34 |
+
{
|
35 |
+
"title": "Traffic Log",
|
36 |
+
"slug": "traffic-redirect"
|
37 |
+
}
|
38 |
+
],
|
39 |
"custom_redirects": [
|
40 |
{
|
41 |
"source_mod_page": "traffic-redirect",
|
icwp-wpsf.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Shield Security
|
4 |
* Plugin URI: https://shsec.io/2f
|
5 |
* Description: Powerful, Easy-To-Use #1 Rated WordPress Security System
|
6 |
-
* Version: 16.1.
|
7 |
* Text Domain: wp-simple-firewall
|
8 |
* Domain Path: /languages
|
9 |
* Author: Shield Security
|
@@ -37,10 +37,9 @@ if ( version_compare( PHP_VERSION, '7.0', '<' ) ) {
|
|
37 |
}
|
38 |
elseif ( @is_file( dirname( __FILE__ ).'/src/lib/vendor/autoload.php' ) ) {
|
39 |
|
40 |
-
require_once( dirname( __FILE__ ).'/src/lib/vendor/autoload.php' );
|
41 |
-
|
42 |
add_action( 'plugins_loaded', 'icwp_wpsf_init', 1 ); // use 0 for extensions to ensure hooks have been added.
|
43 |
function icwp_wpsf_init() {
|
|
|
44 |
$rootFile = __FILE__;
|
45 |
require_once( dirname( __FILE__ ).'/init.php' );
|
46 |
}
|
3 |
* Plugin Name: Shield Security
|
4 |
* Plugin URI: https://shsec.io/2f
|
5 |
* Description: Powerful, Easy-To-Use #1 Rated WordPress Security System
|
6 |
+
* Version: 16.1.13
|
7 |
* Text Domain: wp-simple-firewall
|
8 |
* Domain Path: /languages
|
9 |
* Author: Shield Security
|
37 |
}
|
38 |
elseif ( @is_file( dirname( __FILE__ ).'/src/lib/vendor/autoload.php' ) ) {
|
39 |
|
|
|
|
|
40 |
add_action( 'plugins_loaded', 'icwp_wpsf_init', 1 ); // use 0 for extensions to ensure hooks have been added.
|
41 |
function icwp_wpsf_init() {
|
42 |
+
require_once( dirname( __FILE__ ).'/src/lib/vendor/autoload.php' );
|
43 |
$rootFile = __FILE__;
|
44 |
require_once( dirname( __FILE__ ).'/init.php' );
|
45 |
}
|
plugin-spec.php
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
{
|
2 |
"properties": {
|
3 |
-
"version": "16.1.
|
4 |
-
"release_timestamp":
|
5 |
-
"build": "
|
6 |
"slug_parent": "icwp",
|
7 |
"slug_plugin": "wpsf",
|
8 |
"text_domain": "wp-simple-firewall",
|
@@ -36,8 +36,8 @@
|
|
36 |
"wp": "3.7",
|
37 |
"mysql": "5.6"
|
38 |
},
|
39 |
-
"
|
40 |
-
"php": "7.
|
41 |
"wp": "4.7",
|
42 |
"mysql": "5.6"
|
43 |
}
|
@@ -93,7 +93,7 @@
|
|
93 |
"register": {
|
94 |
"css": {
|
95 |
"bootstrap": {
|
96 |
-
"url": "https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.2.
|
97 |
},
|
98 |
"select2": {
|
99 |
"url": "https://cdnjs.cloudflare.com/ajax/libs/select2/4.1.0-rc.0/css/select2.min.css",
|
@@ -101,7 +101,7 @@
|
|
101 |
"plugin"
|
102 |
]
|
103 |
},
|
104 |
-
"datatables":
|
105 |
"url": "https://cdn.datatables.net/v/bs5/dt-1.12.1/b-2.2.3/sp-2.0.2/sl-1.4.0/datatables.min.css",
|
106 |
"deps": [
|
107 |
"bootstrap"
|
@@ -168,7 +168,7 @@
|
|
168 |
},
|
169 |
"js": {
|
170 |
"bootstrap": {
|
171 |
-
"url": "https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.2.
|
172 |
"deps": [
|
173 |
"wp-jquery"
|
174 |
]
|
@@ -213,7 +213,7 @@
|
|
213 |
},
|
214 |
"lz-string.min": {},
|
215 |
"jquery/fileDownload": {},
|
216 |
-
"jquery/jquery.qrcode":
|
217 |
"deps": [
|
218 |
"wp-jquery"
|
219 |
]
|
1 |
{
|
2 |
"properties": {
|
3 |
+
"version": "16.1.13",
|
4 |
+
"release_timestamp": 1667298000,
|
5 |
+
"build": "202211.0101",
|
6 |
"slug_parent": "icwp",
|
7 |
"slug_plugin": "wpsf",
|
8 |
"text_domain": "wp-simple-firewall",
|
36 |
"wp": "3.7",
|
37 |
"mysql": "5.6"
|
38 |
},
|
39 |
+
"17.0": {
|
40 |
+
"php": "7.2",
|
41 |
"wp": "4.7",
|
42 |
"mysql": "5.6"
|
43 |
}
|
93 |
"register": {
|
94 |
"css": {
|
95 |
"bootstrap": {
|
96 |
+
"url": "https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.2.2/css/bootstrap.min.css"
|
97 |
},
|
98 |
"select2": {
|
99 |
"url": "https://cdnjs.cloudflare.com/ajax/libs/select2/4.1.0-rc.0/css/select2.min.css",
|
101 |
"plugin"
|
102 |
]
|
103 |
},
|
104 |
+
"datatables": {
|
105 |
"url": "https://cdn.datatables.net/v/bs5/dt-1.12.1/b-2.2.3/sp-2.0.2/sl-1.4.0/datatables.min.css",
|
106 |
"deps": [
|
107 |
"bootstrap"
|
168 |
},
|
169 |
"js": {
|
170 |
"bootstrap": {
|
171 |
+
"url": "https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.2.2/js/bootstrap.bundle.min.js",
|
172 |
"deps": [
|
173 |
"wp-jquery"
|
174 |
]
|
213 |
},
|
214 |
"lz-string.min": {},
|
215 |
"jquery/fileDownload": {},
|
216 |
+
"jquery/jquery.qrcode": {
|
217 |
"deps": [
|
218 |
"wp-jquery"
|
219 |
]
|
plugin.json
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
{
|
2 |
"properties": {
|
3 |
-
"version": "16.1.
|
4 |
-
"release_timestamp":
|
5 |
-
"build": "
|
6 |
"slug_parent": "icwp",
|
7 |
"slug_plugin": "wpsf",
|
8 |
"text_domain": "wp-simple-firewall",
|
@@ -36,8 +36,8 @@
|
|
36 |
"wp": "3.7",
|
37 |
"mysql": "5.6"
|
38 |
},
|
39 |
-
"
|
40 |
-
"php": "7.
|
41 |
"wp": "4.7",
|
42 |
"mysql": "5.6"
|
43 |
}
|
@@ -93,7 +93,7 @@
|
|
93 |
"register": {
|
94 |
"css": {
|
95 |
"bootstrap": {
|
96 |
-
"url": "https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.2.
|
97 |
},
|
98 |
"select2": {
|
99 |
"url": "https://cdnjs.cloudflare.com/ajax/libs/select2/4.1.0-rc.0/css/select2.min.css",
|
@@ -101,7 +101,7 @@
|
|
101 |
"plugin"
|
102 |
]
|
103 |
},
|
104 |
-
"datatables":
|
105 |
"url": "https://cdn.datatables.net/v/bs5/dt-1.12.1/b-2.2.3/sp-2.0.2/sl-1.4.0/datatables.min.css",
|
106 |
"deps": [
|
107 |
"bootstrap"
|
@@ -168,7 +168,7 @@
|
|
168 |
},
|
169 |
"js": {
|
170 |
"bootstrap": {
|
171 |
-
"url": "https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.2.
|
172 |
"deps": [
|
173 |
"wp-jquery"
|
174 |
]
|
@@ -213,7 +213,7 @@
|
|
213 |
},
|
214 |
"lz-string.min": {},
|
215 |
"jquery/fileDownload": {},
|
216 |
-
"jquery/jquery.qrcode":
|
217 |
"deps": [
|
218 |
"wp-jquery"
|
219 |
]
|
1 |
{
|
2 |
"properties": {
|
3 |
+
"version": "16.1.13",
|
4 |
+
"release_timestamp": 1667298000,
|
5 |
+
"build": "202211.0101",
|
6 |
"slug_parent": "icwp",
|
7 |
"slug_plugin": "wpsf",
|
8 |
"text_domain": "wp-simple-firewall",
|
36 |
"wp": "3.7",
|
37 |
"mysql": "5.6"
|
38 |
},
|
39 |
+
"17.0": {
|
40 |
+
"php": "7.2",
|
41 |
"wp": "4.7",
|
42 |
"mysql": "5.6"
|
43 |
}
|
93 |
"register": {
|
94 |
"css": {
|
95 |
"bootstrap": {
|
96 |
+
"url": "https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.2.2/css/bootstrap.min.css"
|
97 |
},
|
98 |
"select2": {
|
99 |
"url": "https://cdnjs.cloudflare.com/ajax/libs/select2/4.1.0-rc.0/css/select2.min.css",
|
101 |
"plugin"
|
102 |
]
|
103 |
},
|
104 |
+
"datatables": {
|
105 |
"url": "https://cdn.datatables.net/v/bs5/dt-1.12.1/b-2.2.3/sp-2.0.2/sl-1.4.0/datatables.min.css",
|
106 |
"deps": [
|
107 |
"bootstrap"
|
168 |
},
|
169 |
"js": {
|
170 |
"bootstrap": {
|
171 |
+
"url": "https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.2.2/js/bootstrap.bundle.min.js",
|
172 |
"deps": [
|
173 |
"wp-jquery"
|
174 |
]
|
213 |
},
|
214 |
"lz-string.min": {},
|
215 |
"jquery/fileDownload": {},
|
216 |
+
"jquery/jquery.qrcode": {
|
217 |
"deps": [
|
218 |
"wp-jquery"
|
219 |
]
|
readme.txt
CHANGED
@@ -8,7 +8,7 @@ Requires at least: 3.7
|
|
8 |
Requires PHP: 7.0
|
9 |
Recommended PHP: 7.4
|
10 |
Tested up to: 6.1
|
11 |
-
Stable tag: 16.1.
|
12 |
|
13 |
Bad Bots Are Your #1 Security Risk. Are you playing whack-a-mole with malware & vulnerabilities? Discover the real security before marketing hype.
|
14 |
|
8 |
Requires PHP: 7.0
|
9 |
Recommended PHP: 7.4
|
10 |
Tested up to: 6.1
|
11 |
+
Stable tag: 16.1.13
|
12 |
|
13 |
Bad Bots Are Your #1 Security Risk. Are you playing whack-a-mole with malware & vulnerabilities? Discover the real security before marketing hype.
|
14 |
|
src/lib/src/Modules/IPs/Lib/IpRules/IpRuleStatus.php
CHANGED
@@ -4,6 +4,7 @@ namespace FernleafSystems\Wordpress\Plugin\Shield\Modules\IPs\Lib\IpRules;
|
|
4 |
|
5 |
use FernleafSystems\Wordpress\Plugin\Shield\Databases;
|
6 |
use FernleafSystems\Wordpress\Plugin\Shield\Modules;
|
|
|
7 |
use FernleafSystems\Wordpress\Services\Services;
|
8 |
use FernleafSystems\Wordpress\Services\Utilities\Net\IpID;
|
9 |
use IPLib\Factory;
|
@@ -170,6 +171,14 @@ class IpRuleStatus {
|
|
170 |
return !empty( $rule ) && $rule->blocked_at > 0 && ( $rule->blocked_at >= $rule->unblocked_at );
|
171 |
}
|
172 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
173 |
public function hasManualBlock() :bool {
|
174 |
return !empty( $this->getRulesForManualBlock() );
|
175 |
}
|
4 |
|
5 |
use FernleafSystems\Wordpress\Plugin\Shield\Databases;
|
6 |
use FernleafSystems\Wordpress\Plugin\Shield\Modules;
|
7 |
+
use FernleafSystems\Wordpress\Plugin\Shield\Modules\IPs\Lib\IsHighReputationIP;
|
8 |
use FernleafSystems\Wordpress\Services\Services;
|
9 |
use FernleafSystems\Wordpress\Services\Utilities\Net\IpID;
|
10 |
use IPLib\Factory;
|
171 |
return !empty( $rule ) && $rule->blocked_at > 0 && ( $rule->blocked_at >= $rule->unblocked_at );
|
172 |
}
|
173 |
|
174 |
+
public function hasHighReputation() :bool {
|
175 |
+
return $this->hasAutoBlock()
|
176 |
+
&& ( new IsHighReputationIP() )
|
177 |
+
->setMod( $this->getMod() )
|
178 |
+
->setIP( $this->getRuleForAutoBlock()->ip )
|
179 |
+
->query();
|
180 |
+
}
|
181 |
+
|
182 |
public function hasManualBlock() :bool {
|
183 |
return !empty( $this->getRulesForManualBlock() );
|
184 |
}
|
src/lib/src/Modules/IPs/Lib/Table/BuildIpRulesTableData.php
CHANGED
@@ -8,6 +8,7 @@ use FernleafSystems\Wordpress\Plugin\Shield\Modules\IPs\DB\IpRules\CleanIpRules;
|
|
8 |
use FernleafSystems\Wordpress\Plugin\Shield\Modules\IPs\DB\IpRules\IpRuleRecord;
|
9 |
use FernleafSystems\Wordpress\Plugin\Shield\Modules\IPs\DB\IpRules\LoadIpRules;
|
10 |
use FernleafSystems\Wordpress\Plugin\Shield\Modules\IPs\DB\IpRules\Ops\Handler;
|
|
|
11 |
use FernleafSystems\Wordpress\Plugin\Shield\Modules\IPs\Options;
|
12 |
use FernleafSystems\Wordpress\Plugin\Shield\Tables\DataTables\Build\ForIpRules;
|
13 |
use FernleafSystems\Wordpress\Plugin\Shield\Tables\DataTables\LoadData\BaseBuildTableData;
|
@@ -152,12 +153,25 @@ class BuildIpRulesTableData extends BaseBuildTableData {
|
|
152 |
|
153 |
switch ( $record->type ) {
|
154 |
case Handler::T_AUTO_BLOCK:
|
155 |
-
$
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
break;
|
162 |
case Handler::T_CROWDSEC:
|
163 |
$blockedStatus = sprintf( '%s (%s: %s)', $blockedStatus, __( 'expires', 'wp-simple-firewall' ),
|
8 |
use FernleafSystems\Wordpress\Plugin\Shield\Modules\IPs\DB\IpRules\IpRuleRecord;
|
9 |
use FernleafSystems\Wordpress\Plugin\Shield\Modules\IPs\DB\IpRules\LoadIpRules;
|
10 |
use FernleafSystems\Wordpress\Plugin\Shield\Modules\IPs\DB\IpRules\Ops\Handler;
|
11 |
+
use FernleafSystems\Wordpress\Plugin\Shield\Modules\IPs\Lib\IpRules\IpRuleStatus;
|
12 |
use FernleafSystems\Wordpress\Plugin\Shield\Modules\IPs\Options;
|
13 |
use FernleafSystems\Wordpress\Plugin\Shield\Tables\DataTables\Build\ForIpRules;
|
14 |
use FernleafSystems\Wordpress\Plugin\Shield\Tables\DataTables\LoadData\BaseBuildTableData;
|
153 |
|
154 |
switch ( $record->type ) {
|
155 |
case Handler::T_AUTO_BLOCK:
|
156 |
+
$ipStatus = ( new IpRuleStatus( $record->ip ) )->setMod( $this->getMod() );
|
157 |
+
if ( $ipStatus->hasHighReputation() ) {
|
158 |
+
$color = 'warning';
|
159 |
+
$blockedStatus = sprintf( '%s (%s: %s)',
|
160 |
+
__( 'Blocked/High Reputation', 'wp-simple-firewall' ), __( 'expires', 'wp-simple-firewall' ),
|
161 |
+
Services::Request()
|
162 |
+
->carbon()
|
163 |
+
->timestamp( $record->last_access_at )
|
164 |
+
->addSeconds( $opts->getAutoExpireTime() )
|
165 |
+
->diffForHumans() );
|
166 |
+
}
|
167 |
+
else {
|
168 |
+
$blockedStatus = sprintf( '%s (%s: %s)', $blockedStatus, __( 'expires', 'wp-simple-firewall' ),
|
169 |
+
Services::Request()
|
170 |
+
->carbon()
|
171 |
+
->timestamp( $record->last_access_at )
|
172 |
+
->addSeconds( $opts->getAutoExpireTime() )
|
173 |
+
->diffForHumans() );
|
174 |
+
}
|
175 |
break;
|
176 |
case Handler::T_CROWDSEC:
|
177 |
$blockedStatus = sprintf( '%s (%s: %s)', $blockedStatus, __( 'expires', 'wp-simple-firewall' ),
|
src/lib/src/Modules/Integrations/Lib/MainWP/Server/UI/PageRender/MwpOutOfDate.php
DELETED
@@ -1,30 +0,0 @@
|
|
1 |
-
<?php declare( strict_types=1 );
|
2 |
-
|
3 |
-
namespace FernleafSystems\Wordpress\Plugin\Shield\Modules\Integrations\Lib\MainWP\Server\UI\PageRender;
|
4 |
-
|
5 |
-
use FernleafSystems\Wordpress\Plugin\Shield\Modules\Integrations\Lib\MainWP\Controller;
|
6 |
-
use FernleafSystems\Wordpress\Plugin\Shield\Modules\Integrations\Lib\MainWP\Server\UI\BaseRender;
|
7 |
-
use FernleafSystems\Wordpress\Services\Services;
|
8 |
-
|
9 |
-
class MwpOutOfDate extends BaseRender {
|
10 |
-
|
11 |
-
protected function getData() :array {
|
12 |
-
return [
|
13 |
-
'strings' => [
|
14 |
-
'update' => __( "The MainWP Security plugin doesn't meet Shield's minimum requirements." ),
|
15 |
-
'min_version' => __( 'Minimum required MainWP server version' ),
|
16 |
-
'go_here' => __( 'Go to WordPress Updates' ),
|
17 |
-
],
|
18 |
-
'hrefs' => [
|
19 |
-
'update' => Services::WpGeneral()->getAdminUrl_Updates()
|
20 |
-
],
|
21 |
-
'vars' => [
|
22 |
-
'min_version' => Controller::MIN_VERSION_MAINWP
|
23 |
-
],
|
24 |
-
];
|
25 |
-
}
|
26 |
-
|
27 |
-
protected function getTemplateSlug() :string {
|
28 |
-
return 'pages/mwp_outofdate';
|
29 |
-
}
|
30 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/lib/src/Modules/Integrations/Lib/MainWP/Server/UI/PageRender/NotShieldPro.php
DELETED
@@ -1,24 +0,0 @@
|
|
1 |
-
<?php declare( strict_types=1 );
|
2 |
-
|
3 |
-
namespace FernleafSystems\Wordpress\Plugin\Shield\Modules\Integrations\Lib\MainWP\Server\UI\PageRender;
|
4 |
-
|
5 |
-
use FernleafSystems\Wordpress\Plugin\Shield\Modules\Integrations\Lib\MainWP\Server\UI\BaseRender;
|
6 |
-
|
7 |
-
class NotShieldPro extends BaseRender {
|
8 |
-
|
9 |
-
protected function getData() :array {
|
10 |
-
return [
|
11 |
-
'strings' => [
|
12 |
-
'not_pro' => __( "Sorry, the MainWP server integration is available only for ShieldPRO clients." ),
|
13 |
-
'go_pro' => __( 'Upgrade To ShieldPRO' ),
|
14 |
-
],
|
15 |
-
'hrefs' => [
|
16 |
-
'go_pro' => 'https://shsec.io/mainwpservergopro'
|
17 |
-
],
|
18 |
-
];
|
19 |
-
}
|
20 |
-
|
21 |
-
protected function getTemplateSlug() :string {
|
22 |
-
return 'pages/mwp_for_pro';
|
23 |
-
}
|
24 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/lib/src/Modules/Integrations/Lib/MainWP/Server/UI/PageRender/PluginOutOfDate.php
DELETED
@@ -1,25 +0,0 @@
|
|
1 |
-
<?php declare( strict_types=1 );
|
2 |
-
|
3 |
-
namespace FernleafSystems\Wordpress\Plugin\Shield\Modules\Integrations\Lib\MainWP\Server\UI\PageRender;
|
4 |
-
|
5 |
-
use FernleafSystems\Wordpress\Plugin\Shield\Modules\Integrations\Lib\MainWP\Server\UI\BaseRender;
|
6 |
-
use FernleafSystems\Wordpress\Services\Services;
|
7 |
-
|
8 |
-
class PluginOutOfDate extends BaseRender {
|
9 |
-
|
10 |
-
protected function getData() :array {
|
11 |
-
return [
|
12 |
-
'strings' => [
|
13 |
-
'update' => __( 'The Shield Security plugin on this site needs to be upgraded.' ),
|
14 |
-
'go_here' => __( 'Go to WordPress Updates' )
|
15 |
-
],
|
16 |
-
'hrefs' => [
|
17 |
-
'update' => Services::WpGeneral()->getAdminUrl_Updates()
|
18 |
-
],
|
19 |
-
];
|
20 |
-
}
|
21 |
-
|
22 |
-
protected function getTemplateSlug() :string {
|
23 |
-
return 'pages/shield_outofdate';
|
24 |
-
}
|
25 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/lib/src/Modules/Integrations/Lib/MainWP/Server/UI/PageRender/SitesList.php
DELETED
@@ -1,142 +0,0 @@
|
|
1 |
-
<?php declare( strict_types=1 );
|
2 |
-
|
3 |
-
namespace FernleafSystems\Wordpress\Plugin\Shield\Modules\Integrations\Lib\MainWP\Server\UI\PageRender;
|
4 |
-
|
5 |
-
use FernleafSystems\Wordpress\Plugin\Shield\Modules\Integrations\Lib\MainWP\Common\MWPSiteVO;
|
6 |
-
use FernleafSystems\Wordpress\Plugin\Shield\Modules\Integrations\Lib\MainWP\Server\Data\ClientPluginStatus;
|
7 |
-
use FernleafSystems\Wordpress\Plugin\Shield\Modules\Integrations\Lib\MainWP\Server\Data\LoadShieldSyncData;
|
8 |
-
use FernleafSystems\Wordpress\Plugin\Shield\Modules\Integrations\Lib\MainWP\Server\UI\BaseRender;
|
9 |
-
use FernleafSystems\Wordpress\Services\Services;
|
10 |
-
|
11 |
-
class SitesList extends BaseRender {
|
12 |
-
|
13 |
-
protected function getData() :array {
|
14 |
-
$mod = $this->getMod();
|
15 |
-
$mwp = $this->getCon()->mwpVO;
|
16 |
-
$WP = Services::WpGeneral();
|
17 |
-
$req = Services::Request();
|
18 |
-
|
19 |
-
$statsHead = [
|
20 |
-
'connected' => 0,
|
21 |
-
'disconnected' => 0,
|
22 |
-
'with_issues' => 0,
|
23 |
-
'needs_update' => 0,
|
24 |
-
];
|
25 |
-
$sites = apply_filters( 'mainwp_getsites', $mwp->child_file, $mwp->child_key );
|
26 |
-
foreach ( $sites as &$site ) {
|
27 |
-
$mwpSite = MWPSiteVO::LoadByID( (int)$site[ 'id' ] );
|
28 |
-
$sync = LoadShieldSyncData::Load( $mwpSite );
|
29 |
-
$meta = $sync->meta;
|
30 |
-
|
31 |
-
$shd = $sync->getRawData();
|
32 |
-
$status = ( new ClientPluginStatus() )
|
33 |
-
->setMod( $this->getMod() )
|
34 |
-
->setMwpSite( $mwpSite )
|
35 |
-
->detect();
|
36 |
-
$shd[ 'status_key' ] = key( $status );
|
37 |
-
$shd[ 'status' ] = current( $status );
|
38 |
-
|
39 |
-
$shd[ 'is_active' ] = $shd[ 'status_key' ] === ClientPluginStatus::ACTIVE;
|
40 |
-
$shd[ 'is_inactive' ] = $shd[ 'status_key' ] === ClientPluginStatus::INACTIVE;
|
41 |
-
$shd[ 'is_notinstalled' ] = $shd[ 'status_key' ] === ClientPluginStatus::NOT_INSTALLED;
|
42 |
-
$shd[ 'is_notpro' ] = $shd[ 'status_key' ] === ClientPluginStatus::NOT_PRO;
|
43 |
-
$shd[ 'is_mwpnoton' ] = $shd[ 'status_key' ] === ClientPluginStatus::MWP_NOT_ON;
|
44 |
-
$shd[ 'is_sync_rqd' ] = $shd[ 'status_key' ] === ClientPluginStatus::NEED_SYNC;
|
45 |
-
$shd[ 'is_version_mismatch' ] = in_array( $shd[ 'status_key' ], [
|
46 |
-
ClientPluginStatus::VERSION_NEWER_THAN_SERVER,
|
47 |
-
ClientPluginStatus::VERSION_OLDER_THAN_SERVER,
|
48 |
-
] );
|
49 |
-
$shd[ 'can_sync' ] = in_array( $shd[ 'status_key' ], [
|
50 |
-
ClientPluginStatus::ACTIVE,
|
51 |
-
ClientPluginStatus::NEED_SYNC,
|
52 |
-
] );
|
53 |
-
|
54 |
-
if ( $shd[ 'is_active' ] ) {
|
55 |
-
|
56 |
-
$statsHead[ 'connected' ]++;
|
57 |
-
$shd[ 'sync_at_text' ] = $WP->getTimeStringForDisplay( $meta->sync_at );
|
58 |
-
$shd[ 'sync_at_diff' ] = $req->carbon()->setTimestamp( $meta->sync_at )->diffForHumans();
|
59 |
-
|
60 |
-
if ( empty( $sync->modules[ 'hack_protect' ][ 'scan_issues' ] ) ) {
|
61 |
-
$shd[ 'issues' ] = __( 'No Issues', 'wp-simple-firewall' );
|
62 |
-
$shd[ 'has_issues' ] = false;
|
63 |
-
}
|
64 |
-
else {
|
65 |
-
$shd[ 'has_issues' ] = true;
|
66 |
-
$shd[ 'issues' ] = array_sum( $sync->modules[ 'hack_protect' ][ 'scan_issues' ] );
|
67 |
-
$statsHead[ 'with_issues' ]++;
|
68 |
-
}
|
69 |
-
|
70 |
-
$shd[ 'issues_href' ] = add_query_arg(
|
71 |
-
[
|
72 |
-
'newWindow' => 'yes',
|
73 |
-
'websiteid' => $site[ 'id' ],
|
74 |
-
'location' => base64_encode( $this->getScanPageUrlPart() )
|
75 |
-
],
|
76 |
-
Services::WpGeneral()->getUrl_AdminPage( 'SiteOpen' )
|
77 |
-
);
|
78 |
-
}
|
79 |
-
else {
|
80 |
-
$statsHead[ 'disconnected' ]++;
|
81 |
-
}
|
82 |
-
|
83 |
-
$statsHead[ 'needs_update' ] += $meta->has_update ? 1 : 0;
|
84 |
-
|
85 |
-
$site[ 'shield' ] = $shd;
|
86 |
-
}
|
87 |
-
|
88 |
-
return [
|
89 |
-
'vars' => [
|
90 |
-
'sites' => $sites,
|
91 |
-
'stats_head' => $statsHead,
|
92 |
-
],
|
93 |
-
'ajax' => [
|
94 |
-
'mwp_sh_site_action' => $mod->getAjaxActionData( 'mwp_sh_site_action', true ),
|
95 |
-
'mwp_sh_ext_table' => $mod->getAjaxActionData( 'mwp_sh_ext_table', true ),
|
96 |
-
],
|
97 |
-
'strings' => [
|
98 |
-
'actions' => __( 'Actions', 'wp-simple-firewall' ),
|
99 |
-
'site' => __( 'Site', 'wp-simple-firewall' ),
|
100 |
-
'url' => __( 'URL', 'wp-simple-firewall' ),
|
101 |
-
'issues' => __( 'Issues', 'wp-simple-firewall' ),
|
102 |
-
'status' => __( 'Status', 'wp-simple-firewall' ),
|
103 |
-
'last_sync' => __( 'Last Sync', 'wp-simple-firewall' ),
|
104 |
-
'last_scan' => __( 'Last Scan', 'wp-simple-firewall' ),
|
105 |
-
'version' => __( 'Version', 'wp-simple-firewall' ),
|
106 |
-
'connected' => __( 'Connected', 'wp-simple-firewall' ),
|
107 |
-
'disconnected' => __( 'Disconnected', 'wp-simple-firewall' ),
|
108 |
-
'with_issues' => __( 'With Issues', 'wp-simple-firewall' ),
|
109 |
-
'needs_update' => __( 'Needs Update', 'wp-simple-firewall' ),
|
110 |
-
'st_inactive' => __( 'Shield Security plugin is installed but not activated.', 'wp-simple-firewall' ),
|
111 |
-
'st_notinstalled' => __( "Shield Security plugin not detected in last sync.", 'wp-simple-firewall' ),
|
112 |
-
'st_notpro' => __( "ShieldPRO isn't activated on this site.", 'wp-simple-firewall' ),
|
113 |
-
'st_mwpnoton' => __( "Shield's MainWP integration isn't enabled for this site.", 'wp-simple-firewall' ),
|
114 |
-
'st_sync_rqd' => __( 'Shield Security plugin needs to sync.', 'wp-simple-firewall' ),
|
115 |
-
'st_version_mismatch' => __( 'Shield Security plugin versions are out of sync.', 'wp-simple-firewall' ),
|
116 |
-
'st_unknown' => __( "Couldn't determine Shield plugin status.", 'wp-simple-firewall' ),
|
117 |
-
'act_sync' => __( 'Sync Shield', 'wp-simple-firewall' ),
|
118 |
-
'act_activate' => __( 'Activate Shield', 'wp-simple-firewall' ),
|
119 |
-
'act_align' => __( 'Align Shield', 'wp-simple-firewall' ),
|
120 |
-
'act_deactivate' => __( 'Deactivate Shield', 'wp-simple-firewall' ),
|
121 |
-
'act_install' => __( 'Install Shield', 'wp-simple-firewall' ),
|
122 |
-
'act_upgrade' => __( 'Upgrade Shield', 'wp-simple-firewall' ),
|
123 |
-
'act_uninstall' => __( 'Uninstall Shield', 'wp-simple-firewall' ),
|
124 |
-
'act_license' => __( 'Check ShieldPRO License', 'wp-simple-firewall' ),
|
125 |
-
'act_mwp' => __( 'Switch-On MainWP Integration', 'wp-simple-firewall' ),
|
126 |
-
]
|
127 |
-
];
|
128 |
-
}
|
129 |
-
|
130 |
-
private function getScanPageUrlPart() :string {
|
131 |
-
$WP = Services::WpGeneral();
|
132 |
-
return str_replace(
|
133 |
-
$WP->getAdminUrl(),
|
134 |
-
'',
|
135 |
-
$this->getCon()->getModule_Insights()->getUrl_ScansResults()
|
136 |
-
);
|
137 |
-
}
|
138 |
-
|
139 |
-
protected function getTemplateSlug() :string {
|
140 |
-
return 'pages/sites';
|
141 |
-
}
|
142 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/lib/src/Modules/LoginGuard/AjaxHandler.php
CHANGED
@@ -249,7 +249,12 @@ class AjaxHandler extends Shield\Modules\BaseShield\AjaxHandler {
|
|
249 |
|
250 |
return [
|
251 |
'success' => $success,
|
252 |
-
'message' => $success ?
|
|
|
|
|
|
|
|
|
|
|
253 |
: __( 'There was a problem sending the One-Time Password email.', 'wp-simple-firewall' ),
|
254 |
'page_reload' => true
|
255 |
];
|
249 |
|
250 |
return [
|
251 |
'success' => $success,
|
252 |
+
'message' => $success ?
|
253 |
+
implode( " \n", [
|
254 |
+
__( 'A new One-Time Password was sent to your email address.', 'wp-simple-firewall' ),
|
255 |
+
sprintf( '%s: %s', __( 'Note', 'wp-simple-firewall' ),
|
256 |
+
__( 'Previously created One-Time Passwords are invalid.', 'wp-simple-firewall' ) )
|
257 |
+
] )
|
258 |
: __( 'There was a problem sending the One-Time Password email.', 'wp-simple-firewall' ),
|
259 |
'page_reload' => true
|
260 |
];
|
src/lib/src/Modules/Plugin/Lib/PluginTelemetry.php
CHANGED
@@ -46,7 +46,7 @@ class PluginTelemetry extends ExecOnceModConsumer {
|
|
46 |
$canSend = $opts->isTrackingEnabled()
|
47 |
&& Services::Request()
|
48 |
->carbon()
|
49 |
-
->
|
50 |
if ( $canSend ) {
|
51 |
$this->collectAndSend();
|
52 |
}
|
46 |
$canSend = $opts->isTrackingEnabled()
|
47 |
&& Services::Request()
|
48 |
->carbon()
|
49 |
+
->subDay()->timestamp > (int)$opts->getOpt( 'tracking_last_sent_at', 0 );
|
50 |
if ( $canSend ) {
|
51 |
$this->collectAndSend();
|
52 |
}
|
src/lib/src/Modules/UserManagement/Lib/Suspend/UserSuspendController.php
CHANGED
@@ -6,6 +6,7 @@ use FernleafSystems\Wordpress\Plugin\Shield\Modules\Base\Common\ExecOnceModConsu
|
|
6 |
use FernleafSystems\Wordpress\Plugin\Shield\Modules\Data\DB\UserMeta\Ops\Select;
|
7 |
use FernleafSystems\Wordpress\Plugin\Shield\Modules\UserManagement;
|
8 |
use FernleafSystems\Wordpress\Services\Services;
|
|
|
9 |
|
10 |
class UserSuspendController extends ExecOnceModConsumer {
|
11 |
|
@@ -75,11 +76,12 @@ class UserSuspendController extends ExecOnceModConsumer {
|
|
75 |
$opts = $this->getOptions();
|
76 |
$ts = Services::Request()->ts();
|
77 |
|
78 |
-
|
79 |
-
$metaSelect = $this->getCon()
|
80 |
->getModule_Data()
|
81 |
-
->getDbH_UserMeta()
|
82 |
-
|
|
|
|
|
83 |
|
84 |
if ( $opts->isSuspendManualEnabled() ) {
|
85 |
$manual = array_map(
|
@@ -129,58 +131,81 @@ class UserSuspendController extends ExecOnceModConsumer {
|
|
129 |
$idle = [];
|
130 |
}
|
131 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
// Provide the links above the table.
|
133 |
add_filter( 'views_users', function ( $views ) use ( $manual, $idle, $passwords ) {
|
134 |
-
|
135 |
if ( !empty( $manual ) ) {
|
136 |
$views[ 'shield_users_suspended' ] = sprintf(
|
137 |
'<a href="%s">%s <span class="count">(%s)</span></a>',
|
138 |
-
|
139 |
-
->getUrl_CurrentAdminPage() ),
|
140 |
__( 'Manually Suspended', 'wp-simple-firewall' ), count( $manual )
|
141 |
);
|
142 |
-
|
143 |
-
// Filter the database query
|
144 |
-
add_filter( 'users_list_table_query_args', function ( $args ) use ( $manual ) {
|
145 |
-
if ( is_array( $args ) && Services::Request()->query( 'shield_users_suspended' ) ) {
|
146 |
-
$args[ 'include' ] = $manual;
|
147 |
-
}
|
148 |
-
return $args;
|
149 |
-
} );
|
150 |
}
|
151 |
|
152 |
if ( !empty( $idle ) ) {
|
153 |
$views[ 'shield_idle_users' ] = sprintf(
|
154 |
'<a href="%s">%s <span class="count">(%s)</span></a>',
|
155 |
-
|
156 |
__( 'Idle', 'wp-simple-firewall' ), count( $idle )
|
157 |
);
|
158 |
-
add_filter( 'users_list_table_query_args', function ( $args ) use ( $manual ) {
|
159 |
-
if ( is_array( $args ) && Services::Request()->query( 'shield_users_idle' ) ) {
|
160 |
-
$args[ 'include' ] = $manual;
|
161 |
-
}
|
162 |
-
return $args;
|
163 |
-
} );
|
164 |
}
|
165 |
|
166 |
if ( !empty( $passwords ) ) {
|
167 |
$views[ 'shield_users_pass' ] = sprintf(
|
168 |
'<a href="%s">%s <span class="count">(%s)</span></a>',
|
169 |
-
|
170 |
__( 'Password Expired', 'wp-simple-firewall' ), count( $passwords )
|
171 |
);
|
172 |
-
add_filter( 'users_list_table_query_args', function ( $args ) use ( $manual ) {
|
173 |
-
if ( is_array( $args ) && Services::Request()->query( 'shield_users_pass' ) ) {
|
174 |
-
$args[ 'include' ] = $manual;
|
175 |
-
}
|
176 |
-
return $args;
|
177 |
-
} );
|
178 |
}
|
179 |
|
180 |
return $views;
|
181 |
} );
|
182 |
}
|
183 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
public function addUserBlockOption( \WP_User $user ) {
|
185 |
$con = $this->getCon();
|
186 |
$meta = $con->getUserMeta( $user );
|
6 |
use FernleafSystems\Wordpress\Plugin\Shield\Modules\Data\DB\UserMeta\Ops\Select;
|
7 |
use FernleafSystems\Wordpress\Plugin\Shield\Modules\UserManagement;
|
8 |
use FernleafSystems\Wordpress\Services\Services;
|
9 |
+
use FernleafSystems\Wordpress\Services\Utilities\URL;
|
10 |
|
11 |
class UserSuspendController extends ExecOnceModConsumer {
|
12 |
|
76 |
$opts = $this->getOptions();
|
77 |
$ts = Services::Request()->ts();
|
78 |
|
79 |
+
$userMetaDB = $this->getCon()
|
|
|
80 |
->getModule_Data()
|
81 |
+
->getDbH_UserMeta();
|
82 |
+
|
83 |
+
/** @var Select $metaSelect */
|
84 |
+
$metaSelect = $userMetaDB->getQuerySelector();
|
85 |
|
86 |
if ( $opts->isSuspendManualEnabled() ) {
|
87 |
$manual = array_map(
|
131 |
$idle = [];
|
132 |
}
|
133 |
|
134 |
+
$cleaned = $this->cleanNonExistentUsers( array_merge( $manual, $passwords, $idle ) );
|
135 |
+
if ( !empty( $cleaned ) ) {
|
136 |
+
$manual = array_diff( $manual, $cleaned );
|
137 |
+
$passwords = array_diff( $passwords, $cleaned );
|
138 |
+
$idle = array_diff( $idle, $cleaned );
|
139 |
+
}
|
140 |
+
|
141 |
+
// Filter the user list database query
|
142 |
+
add_filter( 'users_list_table_query_args', function ( $args ) use ( $manual, $idle, $passwords ) {
|
143 |
+
$req = Services::Request();
|
144 |
+
if ( is_array( $args ) ) {
|
145 |
+
if ( !empty( $manual ) && $req->query( 'shield_users_suspended' ) ) {
|
146 |
+
$args[ 'include' ] = $manual;
|
147 |
+
}
|
148 |
+
elseif ( !empty( $idle ) && $req->query( 'shield_users_idle' ) ) {
|
149 |
+
$args[ 'include' ] = $idle;
|
150 |
+
}
|
151 |
+
elseif ( !empty( $passwords ) && $req->query( 'shield_users_pass' ) ) {
|
152 |
+
$args[ 'include' ] = $passwords;
|
153 |
+
}
|
154 |
+
}
|
155 |
+
return $args;
|
156 |
+
} );
|
157 |
+
|
158 |
// Provide the links above the table.
|
159 |
add_filter( 'views_users', function ( $views ) use ( $manual, $idle, $passwords ) {
|
160 |
+
$WP = Services::WpGeneral();
|
161 |
if ( !empty( $manual ) ) {
|
162 |
$views[ 'shield_users_suspended' ] = sprintf(
|
163 |
'<a href="%s">%s <span class="count">(%s)</span></a>',
|
164 |
+
URL::Build( $WP->getUrl_CurrentAdminPage(), [ 'shield_users_suspended' => 1 ] ),
|
|
|
165 |
__( 'Manually Suspended', 'wp-simple-firewall' ), count( $manual )
|
166 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
}
|
168 |
|
169 |
if ( !empty( $idle ) ) {
|
170 |
$views[ 'shield_idle_users' ] = sprintf(
|
171 |
'<a href="%s">%s <span class="count">(%s)</span></a>',
|
172 |
+
URL::Build( $WP->getUrl_CurrentAdminPage(), [ 'shield_users_idle' => 1 ] ),
|
173 |
__( 'Idle', 'wp-simple-firewall' ), count( $idle )
|
174 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
}
|
176 |
|
177 |
if ( !empty( $passwords ) ) {
|
178 |
$views[ 'shield_users_pass' ] = sprintf(
|
179 |
'<a href="%s">%s <span class="count">(%s)</span></a>',
|
180 |
+
URL::Build( $WP->getUrl_CurrentAdminPage(), [ 'shield_users_pass' => 1 ] ),
|
181 |
__( 'Password Expired', 'wp-simple-firewall' ), count( $passwords )
|
182 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
}
|
184 |
|
185 |
return $views;
|
186 |
} );
|
187 |
}
|
188 |
|
189 |
+
private function cleanNonExistentUsers( array $IDs ) :array {
|
190 |
+
$toClean = array_filter(
|
191 |
+
array_unique( $IDs ),
|
192 |
+
function ( $userID ) {
|
193 |
+
return empty( Services::WpUsers()->getUserById( (int)$userID ) );
|
194 |
+
}
|
195 |
+
);
|
196 |
+
|
197 |
+
if ( !empty( $toClean ) ) {
|
198 |
+
$this->getCon()
|
199 |
+
->getModule_Data()
|
200 |
+
->getDbH_UserMeta()
|
201 |
+
->getQueryDeleter()
|
202 |
+
->addWhereIn( 'user_id', $toClean )
|
203 |
+
->query();
|
204 |
+
}
|
205 |
+
|
206 |
+
return $toClean;
|
207 |
+
}
|
208 |
+
|
209 |
public function addUserBlockOption( \WP_User $user ) {
|
210 |
$con = $this->getCon();
|
211 |
$meta = $con->getUserMeta( $user );
|
src/lib/src/Rules/Conditions/IsIpHighReputation.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
namespace FernleafSystems\Wordpress\Plugin\Shield\Rules\Conditions;
|
4 |
|
5 |
-
use FernleafSystems\Wordpress\Plugin\Shield\Modules\IPs\Lib\
|
6 |
use FernleafSystems\Wordpress\Plugin\Shield\Rules\Conditions\Traits\RequestIP;
|
7 |
|
8 |
class IsIpHighReputation extends Base {
|
@@ -12,9 +12,8 @@ class IsIpHighReputation extends Base {
|
|
12 |
const SLUG = 'is_ip_high_reputation';
|
13 |
|
14 |
protected function execConditionCheck() :bool {
|
15 |
-
return ( new
|
16 |
->setMod( $this->getCon()->getModule_IPs() )
|
17 |
-
->
|
18 |
-
->query();
|
19 |
}
|
20 |
}
|
2 |
|
3 |
namespace FernleafSystems\Wordpress\Plugin\Shield\Rules\Conditions;
|
4 |
|
5 |
+
use FernleafSystems\Wordpress\Plugin\Shield\Modules\IPs\Lib\IpRules\IpRuleStatus;
|
6 |
use FernleafSystems\Wordpress\Plugin\Shield\Rules\Conditions\Traits\RequestIP;
|
7 |
|
8 |
class IsIpHighReputation extends Base {
|
12 |
const SLUG = 'is_ip_high_reputation';
|
13 |
|
14 |
protected function execConditionCheck() :bool {
|
15 |
+
return ( new IpRuleStatus( $this->getRequestIP() ) )
|
16 |
->setMod( $this->getCon()->getModule_IPs() )
|
17 |
+
->hasHighReputation();
|
|
|
18 |
}
|
19 |
}
|