PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 6.2.1
MainWP Dashboard: Self-hosted WordPress Management for Agencies v6.2.1
6.2.2 6.2.1 6.2 6.1.8 6.1.7 6.1.6 6.1.5 6.1.4 6.1.3 6.1.2 6.1.1 6.1 6.0.12 6.0.11 4.6.0.1 5.0 5.0.1 5.0.2 5.0.3 5.0.3.1 5.0.3.2 5.1 5.1.1 5.2 5.2.1 All 155 releases
← All changes | pages/page-mainwp-security-issues.php +363 -434 5.0.3.1 → 6.2.1 View file →
@@ -8,474 +8,403 @@
8 8 */
9 9
10 10 namespace MainWP\Dashboard;
11 11
12 +// Exit if accessed directly.
13 +if ( ! defined( 'ABSPATH' ) ) {
14 + exit;
15 +}
16 +
12 17 /**
13 18 * Class MainWP_Security_Issues
14 19 *
15 20 * Detect, display & fix known Security Issues.
16 21 */
17 -class MainWP_Security_Issues {
22 +class MainWP_Security_Issues { // phpcs:ignore Generic.Classes.OpeningBraceSameLine.ContentAfterBrace -- NOSONAR.
18 23
19 - /**
20 - * Method get_class_name()
21 - *
22 - * @return string __CLASS__ Class Name
23 - */
24 - public static function get_class_name() {
25 - return __CLASS__;
26 - }
24 + /**
25 + * Method get_class_name()
26 + *
27 + * @return string __CLASS__ Class Name
28 + */
29 + public static function get_class_name() {
30 + return __CLASS__;
31 + }
27 32
28 - /**
29 - * Method render()
30 - *
31 - * @param null $website Child Site ID.
32 - *
33 - * @uses \MainWP\Dashboard\MainWP_DB::get_website_by_id()
34 - * @uses \MainWP\Dashboard\MainWP_System_Utility::can_edit_website()
35 - */
36 - public static function render( $website = null ) {
33 + /**
34 + * Method render()
35 + *
36 + * @param null $website Child Site ID.
37 + *
38 + * @uses \MainWP\Dashboard\MainWP_DB::get_website_by_id()
39 + * @uses \MainWP\Dashboard\MainWP_System_Utility::can_edit_website()
40 + */
41 + public static function render( $website = null ) {
37 42
38 - if ( empty( $website ) ) {
39 - $id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : false; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.NonceVerification.Recommended
40 - if ( ! $id ) {
41 - return;
42 - }
43 - $website = MainWP_DB::instance()->get_website_by_id( $id );
44 - }
43 + if ( empty( $website ) ) {
44 + $id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : false; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.NonceVerification.Recommended
45 + if ( ! $id ) {
46 + return;
47 + }
48 + $website = MainWP_DB::instance()->get_website_by_id( $id );
49 + }
45 50
46 - if ( ! MainWP_System_Utility::can_edit_website( $website ) ) {
47 - return;
48 - }
49 - $unset_scripts = apply_filters( 'mainwp_unset_security_scripts_stylesheets', true );
50 - ?>
51 - <table class="ui table" id="mainwp-security-issues-table" un-set="<?php echo $unset_scripts ? 'versions,registered_versions' : ''; ?>">
52 - <thead>
53 - <tr>
54 - <th class="collapsing"><?php esc_html_e( 'Status', 'mainwp' ); ?></th>
55 - <th><?php esc_html_e( 'Detected Issues', 'mainwp' ); ?></th>
56 - <th class="collapsing"><?php esc_html_e( '', 'mainwp' ); ?></th>
57 - </tr>
58 - </thead>
59 - <tbody>
60 - <tr>
61 - <td>
62 - <span id="listing_loading"><i class="notched circle big loading icon"></i></span>
63 - <span id="listing_ok" style="display: none;"><i class="big check circle green icon"></i></span>
64 - <span id="listing_nok" style="display: none;"><i class="big times circle red icon"></i></span>
65 - </td>
66 - <td>
67 - <strong id="listing-status-nok"><?php esc_html_e( '/wp-content/, /wp-content/plugins/, /wp-content/themes/ and /wp-content/uploads/ directories listing has not been prevented', 'mainwp' ); ?></strong>
68 - <strong id="listing-status-ok" style="display: none;"><?php esc_html_e( '/wp-content/, /wp-content/plugins/, /wp-content/themes/ and /wp-content/uploads/ directories listing has been prevented', 'mainwp' ); ?></strong>
69 - <br />
70 - <em><?php esc_html_e( 'After fixing this issue, an empty index.php will be inserted in these directories to prevent listing.', 'mainwp' ); ?></em>
71 - </td>
72 - <td>
73 - <span id="listing_fix" style="display: none"><a href="#" class="ui mini green fluid button"><?php esc_html_e( 'Fix', 'mainwp' ); ?></a></span>
74 - </td>
75 - </tr>
76 - <tr>
77 - <td>
78 - <span id="wp_version_loading"><i class="notched circle big loading icon"></i></span>
79 - <span id="wp_version_ok" style="display: none;"><i class="big check circle green icon"></i></span>
80 - <span id="wp_version_nok" style="display: none;"><i class="big times circle red icon"></i></span>
81 - </td>
82 - <td>
83 - <strong id="wp_version-status-nok"><?php esc_html_e( 'WordPress version has not been hidden', 'mainwp' ); ?></strong>
84 - <strong id="wp_version-status-ok" style="display: none;"><?php esc_html_e( 'WordPress version has been hidden', 'mainwp' ); ?></strong>
85 - <br />
86 - <em><?php esc_html_e( 'After fixing this issue, WordPress generator meta tag will be removed from the head sections of the Child Site', 'mainwp' ); ?></em>
87 - </td>
88 - <td>
89 - <span id="wp_version_fix" style="display: none"><a href="#" class="ui mini green fluid button"><?php esc_html_e( 'Fix', 'mainwp' ); ?></a></span>
90 - <span id="wp_version_unfix" style="display: none"><a href="#" class="ui mini fluid button"><?php esc_html_e( 'Unfix', 'mainwp' ); ?></a></span>
91 - </td>
92 - </tr>
93 - <tr>
94 - <td>
95 - <span id="rsd_loading"><i class="notched circle big loading icon"></i></span>
96 - <span id="rsd_ok" style="display: none;"><i class="big check circle green icon"></i></span>
97 - <span id="rsd_nok" style="display: none;"><i class="big times circle red icon"></i></span>
98 - </td>
99 - <td>
100 - <strong id="rsd-status-nok"><?php esc_html_e( 'Really Simple Discovery meta tag has not been removed from front-end', 'mainwp' ); ?></strong>
101 - <strong id="rsd-status-ok" style="display: none;"><?php esc_html_e( 'Really Simple Discovery meta tag has been removed from front-end', 'mainwp' ); ?></strong>
102 - <br />
103 - <em><?php esc_html_e( 'After fixing this issue, RSD meta tag will be removed from head sections of the Child Site', 'mainwp' ); ?></em>
104 - </td>
105 - <td>
106 - <span id="rsd_fix" style="display: none"><a href="#" class="ui mini green fluid button"><?php esc_html_e( 'Fix', 'mainwp' ); ?></a></span>
107 - <span id="rsd_unfix" style="display: none"><a href="#" class="ui mini fluid button"><?php esc_html_e( 'Unfix', 'mainwp' ); ?></a></span>
108 - </td>
109 - </tr>
110 - <tr>
111 - <td>
112 - <span id="wlw_loading"><i class="notched circle big loading icon"></i></span>
113 - <span id="wlw_ok" style="display: none;"><i class="big check circle green icon"></i></span>
114 - <span id="wlw_nok" style="display: none;"><i class="big times circle red icon"></i></span>
115 - </td>
116 - <td>
117 - <strong id="wlw-status-nok"><?php esc_html_e( 'Windows Live Writer meta tag has not been removed from front-end', 'mainwp' ); ?></strong>
118 - <strong id="wlw-status-ok" style="display: none;"><?php esc_html_e( 'Windows Live Writer meta tag has been removed from front-end', 'mainwp' ); ?></strong>
119 - <br />
120 - <em><?php esc_html_e( 'After fixing this issue, WLW meta tag will be removed from head sections of the Child Site', 'mainwp' ); ?></em>
121 - </td>
122 - <td>
123 - <span id="wlw_fix" style="display: none"><a href="#" class="ui mini fluid green button"> <?php esc_html_e( 'Fix', 'mainwp' ); ?></a></span>
124 - <span id="wlw_unfix" style="display: none"><a href="#" class="ui mini fluid button"><?php esc_html_e( 'Unfix', 'mainwp' ); ?></a></span>
125 - </td>
126 - </tr>
127 - <tr>
128 - <td>
129 - <span id="db_reporting_loading"><i class="notched circle big loading icon"></i></span>
130 - <span id="db_reporting_ok" style="display: none;"><i class="big check circle green icon"></i></span>
131 - <span id="db_reporting_nok" style="display: none;"><i class="big times circle red icon"></i></span>
132 - </td>
133 - <td>
134 - <strong id="db_reporting-status-nok"><?php esc_html_e( 'Database error reporting has not been disabled', 'mainwp' ); ?></strong>
135 - <strong id="db_reporting-status-ok" style="display: none;"><?php esc_html_e( 'Database error reporting has been disabled', 'mainwp' ); ?></strong>
136 - <br />
137 - <em><?php esc_html_e( 'After fixing this issue, database error reporting will be disabled', 'mainwp' ); ?></em>
138 - </td>
139 - <td>
140 - <span id="db_reporting_fix" style="display: none"><a href="#" class="ui mini fluid green button"><?php esc_html_e( 'Fix', 'mainwp' ); ?></a></span>
141 - </td>
142 - </tr>
143 - <tr>
144 - <td>
145 - <span id="php_reporting_loading"><i class="notched circle big loading icon"></i></span>
146 - <span id="php_reporting_ok" style="display: none;"><i class="big check circle green icon"></i></span>
147 - <span id="php_reporting_nok" style="display: none;"><i class="big times circle red icon"></i></span>
148 - </td>
149 - <td>
150 - <strong id="php_reporting-status-nok"><?php esc_html_e( 'PHP error reporting has not been disabled', 'mainwp' ); ?></strong>
151 - <strong id="php_reporting-status-ok" style="display: none;"><?php esc_html_e( 'PHP error reporting has been disabled', 'mainwp' ); ?></strong>
152 - <br />
153 - <em><?php esc_html_e( 'After fixing this issue, PHP error reporting will be disabled', 'mainwp' ); ?></em>
154 - </td>
155 - <td>
156 - <span id="php_reporting_fix" style="display: none"><a href="#" class="ui mini fluid green button"> <?php esc_html_e( 'Fix', 'mainwp' ); ?></a></span>
157 - <span id="php_reporting_unfix" style="display: none"><a href="#" class="ui mini fluid button"><?php esc_html_e( 'Unfix', 'mainwp' ); ?></a></span>
158 - </td>
159 - </tr>
160 - <?php if ( ! $unset_scripts ) { ?>
161 - <tr>
162 - <td>
163 - <span id="versions_loading"><i class="notched circle big loading icon"></i></span>
164 - <span id="versions_ok" style="display: none;"><i class="big check circle green icon"></i></span>
165 - <span id="versions_nok" style="display: none;"><i class="big times circle red icon"></i></span>
166 - </td>
167 - <td>
168 - <strong id="versions-status-nok"><?php esc_html_e( 'Scripts and Stylesheets version information has not been removed from URLs', 'mainwp' ); ?></strong>
169 - <strong id="versions-status-ok" style="display: none;"><?php esc_html_e( 'Scripts and Stylesheets version information has been removed from URLs', 'mainwp' ); ?></strong>
170 - <br />
171 - <em><?php esc_html_e( 'After fixing this issue, versions will be removed', 'mainwp' ); ?></em>
172 - </td>
173 - <td>
174 - <span id="versions_fix" style="display: none"><a href="#" class="ui mini green fluid button"><?php esc_html_e( 'Fix', 'mainwp' ); ?></a></span>
175 - <span id="versions_unfix" style="display: none"><a href="#" class="ui mini fluid button"><?php esc_html_e( 'Unfix', 'mainwp' ); ?></a></span>
176 - </td>
177 - </tr>
178 - <tr>
179 - <td>
180 - <span id="registered_versions_loading"><i class="notched circle big loading icon"></i></span>
181 - <span id="registered_versions_ok" style="display: none;"><i class="big check circle green icon"></i></span>
182 - <span id="registered_versions_nok" style="display: none;"><i class="big times circle red icon"></i></span>
183 - </td>
184 - <td>
185 - <strong id="registered_versions-status-nok"><?php esc_html_e( 'Scripts and Stylesheets registered version information has not been removed from URLs', 'mainwp' ); ?></strong>
186 - <strong id="registered_versions-status-ok" style="display: none;"><?php esc_html_e( 'Scripts and Stylesheets registered version information has been removed from URLs', 'mainwp' ); ?></strong>
187 - <br />
188 - <em><?php esc_html_e( 'After fixing this issue, registered versions will be removed', 'mainwp' ); ?></em>
189 - </td>
190 - <td>
191 - <span id="registered_versions_fix" style="display: none"><a href="#" class="ui mini fluid green button"><?php esc_html_e( 'Fix', 'mainwp' ); ?></a></span>
192 - <span id="registered_versions_unfix" style="display: none"><a href="#" class="ui mini fluid button"><?php esc_html_e( 'Unfix', 'mainwp' ); ?></a></span>
193 - </td>
194 - </tr>
195 - <?php } ?>
196 - <?php
197 - $is_wpengine = false;
198 - if ( property_exists( $website, 'wpe' ) && 1 === (int) $website->wpe ) {
199 - $is_wpengine = true;
200 - }
201 - ?>
202 - <tr>
203 - <td>
204 - <span id="readme_loading"><i class="notched circle big loading icon"></i></span>
205 - <span id="readme_ok" style="display: none;"><i class="big check circle green icon"></i></span>
206 - <span id="readme_nok" style="display: none;"><i class="big times circle red icon"></i></span>
207 - </td>
208 - <td>
209 - <strong id="readme-status-nok"><?php esc_html_e( 'readme.html file has not been removed from WordPress root', 'mainwp' ); ?></strong>
210 - <strong id="readme-status-ok" style="display: none;"><?php esc_html_e( 'readme.html file has been removed from WordPress root', 'mainwp' ); ?></strong>
211 - <br />
212 - <em><?php esc_html_e( 'After fixing this issue, the readme.html file will be removed from the Child Site root directory', 'mainwp' ); ?></em>
213 - <?php if ( $is_wpengine ) { ?>
214 - <strong id="readme-wpe-nok"><?php esc_html_e( 'Removing the file on WPEngine hosting can cause issues. If you need to remove the file, please consult the WPEngine support first.', 'mainwp' ); ?></strong>
215 - <?php } ?>
216 - </td>
217 - <td>
218 - <?php if ( ! $is_wpengine ) { ?>
219 - <span id="readme_fix" style="display: none"><a href="#" class="ui mini green fluid button"><?php esc_html_e( 'Fix', 'mainwp' ); ?></a></span>
220 - <?php esc_html_e( 'You need to re-upload the readme.html file manually to unfix this.', 'mainwp' ); ?></span>
221 - <?php } else { ?>
222 - <span><a href="javascript:void(0)" class="ui mini fluid button"><?php esc_html_e( 'Fix', 'mainwp' ); ?></a>
223 - <?php } ?>
224 - </td>
225 - </tr>
226 - <tr>
227 - <td>
228 - <span id="admin_loading"><i class="notched circle big loading icon"></i></span>
229 - <span id="admin_ok" style="display: none;"><i class="big check circle green icon"></i></span>
230 - <span id="admin_nok" style="display: none;"><i class="big times circle red icon"></i></span>
231 - </td>
232 - <td>
233 - <strong id="admin-status-nok"><?php esc_html_e( 'Administrator username should not be "admin"', 'mainwp' ); ?></strong>
234 - <strong id="admin-status-ok" style="display: none;"><?php esc_html_e( 'Administrator username is not "admin"', 'mainwp' ); ?></strong>
235 - <br />
236 - <em><?php esc_html_e( 'You have to change this yourself. If this user was used as your MainWP Secure Link Admin, you will need to change your Administrator Username in the MainWP Dashboard for the site.', 'mainwp' ); ?></em>
237 - </td>
238 - <td></td>
239 - </tr>
51 + if ( ! MainWP_System_Utility::can_edit_website( $website ) ) {
52 + return;
53 + }
54 + ?>
55 + <table class="ui table" id="mainwp-security-issues-table">
56 + <thead>
57 + <tr>
58 + <th scope="col" class="center aligned collapsing"></th>
59 + <th scope="col"><?php esc_html_e( 'Site Hardening Checks', 'mainwp' ); ?></th>
60 + <th scope="col" class="collapsing"></th>
61 + </tr>
62 + </thead>
63 + <tbody>
64 + <tr>
65 + <td>
66 + <span id="wp_uptodate_loading"><i class="notched circle big loading icon"></i></span>
67 + <span id="wp_uptodate_ok" style="display: none;"><span class="ui small green label"><?php esc_html_e( 'Good', 'mainwp' ); ?></span></span>
68 + <span id="wp_uptodate_nok" style="display: none;"><span class="ui small red label"><?php esc_html_e( 'Bad', 'mainwp' ); ?></span></span>
69 + </td>
70 + <td>
71 + <div class="ui small header">
72 + <?php esc_html_e( 'WordPress Version', 'mainwp' ); ?>
73 + <div class="sub header">
74 + <div id="wp_uptodate-status-nok" style="display: none;"><?php esc_html_e( 'WordPress is not up to date.', 'mainwp' ); ?></div>
75 + <div id="wp_uptodate-status-ok" style="display: none;"><?php esc_html_e( 'WordPress is up to date.', 'mainwp' ); ?></div>
76 + </div>
77 + </div>
78 + </td>
79 + <td>
80 + <span id="wp_uptodate_fix" style="display: none"><a href="#" onClick="updatesoverview_global_upgrade_all('wp', <?php echo intval( $website->id ); ?>); return false;" class="ui mini green fluid button" data-inverted="" data-position="left center" data-tooltip="<?php esc_attr_e( 'Click here to update the WordPress core on the site.', 'mainwp' ); ?>"><?php esc_html_e( 'Update WordPress', 'mainwp' ); ?></a></span>
81 + </td>
82 + </tr>
240 83
241 - <tr>
242 - <td>
243 - <span id="wp_uptodate_loading"><i class="notched circle big loading icon"></i></span>
244 - <span id="wp_uptodate_ok" style="display: none;"><i class="big check circle green icon"></i></span>
245 - <span id="wp_uptodate_nok" style="display: none;"><i class="big times circle red icon"></i></span>
246 - </td>
247 - <td>
248 - <strong id="wp_uptodate-status-nok"><?php esc_html_e( 'WordPress is not up to date.', 'mainwp' ); ?></strong>
249 - <strong id="wp_uptodate-status-ok" style="display: none;"><?php esc_html_e( 'WordPress is up to date.', 'mainwp' ); ?></strong>
250 - <br />
251 - <em><?php esc_html_e( 'Checks if WP is up to date. You have to change this yourself.', 'mainwp' ); ?></em>
252 - </td>
253 - <td></td>
254 - </tr>
255 - <tr>
256 - <td>
257 - <span id="phpversion_matched_loading"><i class="notched circle big loading icon"></i></span>
258 - <span id="phpversion_matched_ok" style="display: none;"><i class="big check circle green icon"></i></span>
259 - <span id="phpversion_matched_nok" style="display: none;"><i class="big times circle red icon"></i></span>
260 - </td>
261 - <td>
262 - <strong id="phpversion_matched-status-nok"><?php esc_html_e( 'PHP version does not match the WordPress requirement', 'mainwp' ); ?></strong>
263 - <strong id="phpversion_matched-status-ok" style="display: none;"><?php esc_html_e( 'PHP version matches the WordPress requirement', 'mainwp' ); ?></strong>
264 - <br />
265 - <em><?php esc_html_e( 'Checks if PHP version matches the WP requirement. You have to change this yourself.', 'mainwp' ); ?></em>
266 - </td>
267 - <td></td>
268 - </tr>
84 + <tr>
85 + <td>
86 + <span id="phpversion_matched_loading"><i class="notched circle big loading icon"></i></span>
87 + <span id="phpversion_matched_ok" style="display: none;"><span class="ui small green label"><?php esc_html_e( 'Good', 'mainwp' ); ?></span></span>
88 + <span id="phpversion_matched_nok" style="display: none;"><span class="ui small red label"><?php esc_html_e( 'Bad', 'mainwp' ); ?></span></span>
89 + </td>
90 + <td>
91 + <div class="ui small header">
92 + <?php esc_html_e( 'PHP Version', 'mainwp' ); ?>
93 + <div class="sub header">
94 + <div id="phpversion_matched-status-nok" style="display: none;"><?php esc_html_e( 'PHP version older than 8.0 reached end of development and no longer receive security updates.', 'mainwp' ); ?></div>
95 + <div id="phpversion_matched-status-ok" style="display: none;"><?php esc_html_e( 'PHP version is up to date.', 'mainwp' ); ?></div>
96 + </div>
97 + </div>
98 + </td>
99 + <td></td>
100 + </tr>
269 101
270 - <tr>
271 - <td>
272 - <span id="sslprotocol_loading"><i class="notched circle big loading icon"></i></span>
273 - <span id="sslprotocol_ok" style="display: none;"><i class="big check circle green icon"></i></span>
274 - <span id="sslprotocol_nok" style="display: none;"><i class="big times circle red icon"></i></span>
275 - </td>
276 - <td>
277 - <strong id="sslprotocol-status-nok"><?php esc_html_e( 'SSL protocol is not in place', 'mainwp' ); ?></strong>
278 - <strong id="sslprotocol-status-ok" style="display: none;"><?php esc_html_e( 'SSL protocol is in place', 'mainwp' ); ?></strong>
279 - <br />
280 - <em><?php esc_html_e( 'Checks if SSL protocol is in place. You have to change this yourself.', 'mainwp' ); ?></em>
281 - </td>
282 - <td></td>
283 - </tr>
102 + <tr>
103 + <td>
104 + <span id="php_reporting_loading"><i class="notched circle big loading icon"></i></span>
105 + <span id="php_reporting_ok" style="display: none;"><span class="ui small green label"><?php esc_html_e( 'Good', 'mainwp' ); ?></span></span>
106 + <span id="php_reporting_nok" style="display: none;"><span class="ui small red label"><?php esc_html_e( 'Bad', 'mainwp' ); ?></span></span>
107 + </td>
108 + <td>
109 + <div class="ui small header">
110 + <?php esc_html_e( 'PHP Error Reporting', 'mainwp' ); ?>
111 + <div class="sub header">
112 + <div id="php_reporting-status-nok" style="display: none;"><?php esc_html_e( 'PHP Error reporting is not disabled. Error messages can reveal sensitive details.', 'mainwp' ); ?></div>
113 + <div id="php_reporting-status-ok" style="display: none;"><?php esc_html_e( 'PHP Error reporting is disabled.', 'mainwp' ); ?></div>
114 + </div>
115 + </div>
116 + </td>
117 + <td>
118 + <span id="php_reporting_fix" style="display: none"><a href="#" class="ui mini fluid green button"> <?php esc_html_e( 'Disable PHP Error Reporting', 'mainwp' ); ?></a></span>
119 + <span id="php_reporting_unfix" style="display: none"><a href="#" class="ui mini fluid button"><?php esc_html_e( 'Reenable PHP Error Reporting', 'mainwp' ); ?></a></span>
120 + </td>
121 + </tr>
284 122
285 - <tr>
286 - <td>
287 - <span id="debug_disabled_loading"><i class="notched circle big loading icon"></i></span>
288 - <span id="debug_disabled_ok" style="display: none;"><i class="big check circle green icon"></i></span>
289 - <span id="debug_disabled_nok" style="display: none;"><i class="big times circle red icon"></i></span>
290 - </td>
291 - <td>
292 - <strong id="debug_disabled-status-nok"><?php esc_html_e( 'WP Config debugging is enabled', 'mainwp' ); ?></strong>
293 - <strong id="debug_disabled-status-ok" style="display: none;"><?php esc_html_e( 'WP Config debugging is disabled', 'mainwp' ); ?></strong>
294 - <br />
295 - <em><?php esc_html_e( 'Checks if WP Config debugging is disabled. You have to change this yourself.', 'mainwp' ); ?></em>
296 - </td>
297 - <td></td>
298 - </tr>
123 + <tr>
124 + <td>
125 + <span id="db_reporting_loading"><i class="notched circle big loading icon"></i></span>
126 + <span id="db_reporting_ok" style="display: none;"><span class="ui small green label"><?php esc_html_e( 'Good', 'mainwp' ); ?></span></span>
127 + <span id="db_reporting_nok" style="display: none;"><span class="ui small red label"><?php esc_html_e( 'Bad', 'mainwp' ); ?></span></span>
128 + </td>
129 + <td>
130 + <div class="ui small header">
131 + <?php esc_html_e( 'Database Error Reporting', 'mainwp' ); ?>
132 + <div class="sub header">
133 + <div id="db_reporting-status-nok" style="display: none;"><?php esc_html_e( 'Database Error reporting is not disabled. Error messages can reveal sensitive details.', 'mainwp' ); ?></div>
134 + <div id="db_reporting-status-ok" style="display: none;"><?php esc_html_e( 'Database Error reporting is disabled.', 'mainwp' ); ?></div>
135 + </div>
136 + </div>
137 + </td>
138 + <td>
139 + <span id="db_reporting_fix" style="display: none"><a href="#" class="ui mini fluid green button"><?php esc_html_e( 'Disable DB Error Reporting', 'mainwp' ); ?></a></span>
140 + <span id="db_reporting_unfix" style="display: none"><a href="#" class="ui mini fluid button"><?php esc_html_e( 'Reenable DB Error Reporting', 'mainwp' ); ?></a></span>
141 + </td>
142 + </tr>
299 143
300 - </tbody>
301 - <?php
302 - $is_demo = MainWP_Demo_Handle::is_demo_mode();
303 - ?>
304 - <tfoot class="full-width">
305 - <tr>
306 - <th colspan="3">
307 - <?php if ( ! $is_demo ) : ?>
308 - <input type="button" id="securityIssues_fixAll" class="ui green button right floated" value="<?php esc_html_e( 'Fix All', 'mainwp' ); ?>"/>
309 - <input type="button" id="securityIssues_refresh" class="ui green basic button" value="<?php esc_html_e( 'Refresh', 'mainwp' ); ?>"/>
310 - <input type="hidden" id="securityIssueSite" value="<?php echo intval( $website->id ); ?>"/>
311 - <?php endif; ?>
312 - </th>
313 - </tr>
314 - </tfoot>
315 - </table>
316 - <?php
317 - }
144 + <tr>
145 + <td>
146 + <span id="sslprotocol_loading"><i class="notched circle big loading icon"></i></span>
147 + <span id="sslprotocol_ok" style="display: none;"><span class="ui small green label"><?php esc_html_e( 'Good', 'mainwp' ); ?></span></span>
148 + <span id="sslprotocol_nok" style="display: none;"><span class="ui small red label"><?php esc_html_e( 'Bad', 'mainwp' ); ?></span></span>
149 + </td>
150 + <td>
151 + <div class="ui small header">
152 + <?php esc_html_e( 'SSL Protocol', 'mainwp' ); ?>
153 + <div class="sub header">
154 + <div id="sslprotocol-status-nok" style="display: none;"><?php esc_html_e( 'SSL Protocol is not in place.', 'mainwp' ); ?></div>
155 + <div id="sslprotocol-status-ok" style="display: none;"><?php esc_html_e( 'SSL Protocol is in place.', 'mainwp' ); ?></div>
156 + </div>
157 + </div>
158 + </td>
159 + <td></td>
160 + </tr>
318 161
162 + <tr>
163 + <td>
164 + <span id="debug_disabled_loading"><i class="notched circle big loading icon"></i></span>
165 + <span id="debug_disabled_ok" style="display: none;"><span class="ui small green label"><?php esc_html_e( 'Good', 'mainwp' ); ?></span></span>
166 + <span id="debug_disabled_nok" style="display: none;"><span class="ui small red label"><?php esc_html_e( 'Bad', 'mainwp' ); ?></span></span>
167 + </td>
168 + <td>
169 + <div class="ui small header">
170 + <?php esc_html_e( 'Debug Mode', 'mainwp' ); ?>
171 + <div class="sub header">
172 + <div id="debug_disabled-status-nok" style="display: none;"><?php esc_html_e( 'WP Debug mode is not disabled. Error messages can reveal sensitive details.', 'mainwp' ); ?></div>
173 + <div id="debug_disabled-status-ok" style="display: none;"><?php esc_html_e( 'WP Debug mode is disabled.', 'mainwp' ); ?></div>
174 + </div>
175 + </div>
176 + </td>
177 + <td></td>
178 + </tr>
319 179
320 - /**
321 - * Method Fetch Security Issues
322 - *
323 - * Fetch stored known Child Site Security Issues from DB that were found during Sync.
324 - *
325 - * @uses \MainWP\Dashboard\MainWP_Connect::fetch_url_authed()
326 - * @uses \MainWP\Dashboard\MainWP_DB::get_website_by_id()
327 - * @uses \MainWP\Dashboard\MainWP_System_Utility::can_edit_website()
328 - */
329 - public static function fetch_security_issues() {
330 - $id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : false; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.NonceVerification.Recommended
331 - if ( ! $id ) {
332 - return '';
333 - }
334 - $website = MainWP_DB::instance()->get_website_by_id( $id );
180 + <tr>
181 + <td>
182 + <span id="sec_outdated_plugins_loading"><i class="notched circle big loading icon"></i></span>
183 + <span id="sec_outdated_plugins_ok" style="display: none;"><span class="ui small green label"><?php esc_html_e( 'Good', 'mainwp' ); ?></span></span>
184 + <span id="sec_outdated_plugins_nok" style="display: none;"><span class="ui small red label"><?php esc_html_e( 'Bad', 'mainwp' ); ?></span></span>
185 + </td>
186 + <td>
187 + <div class="ui small header">
188 + <?php esc_html_e( 'Outdated Plugins', 'mainwp' ); ?>
189 + <div class="sub header">
190 + <div id="sec_outdated_plugins-status-nok" style="display: none;"><?php esc_html_e( 'Plugins are not up to date. Outdated plugins can contain known vulnerabilities that attackers may exploit.', 'mainwp' ); ?></div>
191 + <div id="sec_outdated_plugins-status-ok" style="display: none;"><?php esc_html_e( 'Plugins are up to date.', 'mainwp' ); ?></div>
192 + </div>
193 + </div>
194 + </td>
195 + <td>
196 + <span id="sec_outdated_plugins_fix" style="display: none"><a href="admin.php?page=managesites&updateid=<?php echo intval( $website->id ); ?>" class="ui mini basic button"><?php esc_html_e( 'Manage Updates', 'mainwp' ); ?></a></span>
197 + </td>
198 + </tr>
335 199
336 - if ( ! MainWP_System_Utility::can_edit_website( $website ) ) {
337 - return '';
338 - }
200 + <tr>
201 + <td>
202 + <span id="sec_inactive_plugins_loading"><i class="notched circle big loading icon"></i></span>
203 + <span id="sec_inactive_plugins_ok" style="display: none;"><span class="ui small green label"><?php esc_html_e( 'Good', 'mainwp' ); ?></span></span>
204 + <span id="sec_inactive_plugins_nok" style="display: none;"><span class="ui small red label"><?php esc_html_e( 'Bad', 'mainwp' ); ?></span></span>
205 + </td>
206 + <td>
207 + <div class="ui small header">
208 + <?php esc_html_e( 'Inactive Plugins', 'mainwp' ); ?>
209 + <div class="sub header">
210 + <div id="sec_inactive_plugins-status-nok" style="display: none;"><?php esc_html_e( 'Inactive plugins detected. Removing unused plugins minimizes the risk of hidden vulnerabilities that could be exploited.', 'mainwp' ); ?></div>
211 + <div id="sec_inactive_plugins-status-ok" style="display: none;"><?php esc_html_e( 'No inactive plugins.', 'mainwp' ); ?></div>
212 + </div>
213 + </div>
214 + </td>
215 + <td>
216 + <span id="sec_inactive_plugins_fix" style="display: none"><a href="admin.php?page=PluginsManage" class="ui mini basic button"><?php esc_html_e( 'Manage Plugins', 'mainwp' ); ?></a></span>
217 + </td>
218 + </tr>
339 219
340 - $information = MainWP_Connect::fetch_url_authed( $website, 'security' );
220 + <tr>
221 + <td>
222 + <span id="sec_outdated_themes_loading"><i class="notched circle big loading icon"></i></span>
223 + <span id="sec_outdated_themes_ok" style="display: none;"><span class="ui small green label"><?php esc_html_e( 'Good', 'mainwp' ); ?></span></span>
224 + <span id="sec_outdated_themes_nok" style="display: none;"><span class="ui small red label"><?php esc_html_e( 'Bad', 'mainwp' ); ?></span></span>
225 + </td>
226 + <td>
227 + <div class="ui small header">
228 + <?php esc_html_e( 'Outdated Themes', 'mainwp' ); ?>
229 + <div class="sub header">
230 + <div id="sec_outdated_themes-status-nok" style="display: none;"><?php esc_html_e( 'Themes are not up to date. Outdated themes can contain known vulnerabilities that attackers may exploit.', 'mainwp' ); ?></div>
231 + <div id="sec_outdated_themes-status-ok" style="display: none;"><?php esc_html_e( 'Themes are up to date.', 'mainwp' ); ?></div>
232 + </div>
233 + </div>
234 + </td>
235 + <td>
236 + <span id="sec_outdated_themes_fix" style="display: none"><a href="admin.php?page=managesites&updateid=<?php echo intval( $website->id ); ?>&tab=themes-updates" class="ui mini basic button"><?php esc_html_e( 'Manage Updates', 'mainwp' ); ?></a></span>
237 + </td>
238 + </tr>
341 239
342 - /**
343 - * Filters security issues
344 - *
345 - * Filters the default security checks and enables user to disable certain checks.
346 - *
347 - * @param bool false Whether security issues should be filtered.
348 - * @param object $information Object containing data from che chid site related to security issues.
349 - * Available options: 'listing', 'wp_version', 'rsd', 'wlw', 'db_reporting', 'php_reporting', 'versions', 'registered_versions', 'readme'.
350 - * @param object $website Object containing child site data.
351 - *
352 - * @since 4.1
353 - */
354 - $filterStats = apply_filters( 'mainwp_security_issues_stats', false, $information, $website );
355 - if ( false !== $filterStats && is_array( $filterStats ) ) {
356 - $information = array_merge( $information, $filterStats );
357 - }
358 - return $information;
359 - }
240 + <tr>
241 + <td>
242 + <span id="sec_inactive_themes_loading"><i class="notched circle big loading icon"></i></span>
243 + <span id="sec_inactive_themes_ok" style="display: none;"><span class="ui small green label"><?php esc_html_e( 'Good', 'mainwp' ); ?></span></span>
244 + <span id="sec_inactive_themes_nok" style="display: none;"><span class="ui small red label"><?php esc_html_e( 'Bad', 'mainwp' ); ?></span></span>
245 + </td>
246 + <td>
247 + <div class="ui small header">
248 + <?php esc_html_e( 'Inactive Themes', 'mainwp' ); ?>
249 + <div class="sub header">
250 + <div id="sec_inactive_themes-status-nok" style="display: none;"><?php esc_html_e( 'Inactive themes detected. Removing unused themes minimizes the risk of hidden vulnerabilities that could be exploited.', 'mainwp' ); ?></div>
251 + <div id="sec_inactive_themes-status-ok" style="display: none;"><?php esc_html_e( 'No inactive themes.', 'mainwp' ); ?></div>
252 + </div>
253 + </div>
254 + </td>
255 + <td>
256 + <span id="sec_inactive_themes_fix" style="display: none"><a href="admin.php?page=ThemesManage" class="ui mini basic button"><?php esc_html_e( 'Manage Themes', 'mainwp' ); ?></a></span>
257 + </td>
258 + </tr>
360 259
361 - /**
362 - * Method Fix Security Issues
363 - *
364 - * Fix the selected security issue.
365 - *
366 - * @uses \MainWP\Dashboard\MainWP_Connect::fetch_url_authed()
367 - * @uses \MainWP\Dashboard\MainWP_DB::get_website_by_id()
368 - * @uses \MainWP\Dashboard\MainWP_Sync::sync_information_array()
369 - * @uses \MainWP\Dashboard\MainWP_System_Utility::can_edit_website()
370 - */
371 - public static function fix_security_issue() {
372 - $id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : false; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.NonceVerification.Recommended
373 - if ( ! $id ) {
374 - return '';
375 - }
376 - $website = MainWP_DB::instance()->get_website_by_id( $id );
260 + </tbody>
261 + </table>
377 262
378 - if ( ! MainWP_System_Utility::can_edit_website( $website ) ) {
379 - return '';
380 - }
381 263
382 - if ( '' !== $website->sync_errors || MainWP_System_Utility::is_suspended_site( $website ) ) {
383 - return '';
384 - }
264 + <input type="hidden" id="securityIssueSite" value="<?php echo intval( $website->id ); ?>"/>
265 + <div id="wp_upgrades">
266 + <div updated="-1" site_id="<?php echo intval( $website->id ); ?>" site_name="<?php echo esc_attr( $website->name ); ?>" ></div>
267 + </div>
268 + <?php
269 + }
385 270
386 - $skip_features = array(
387 - 'listing',
388 - 'wp_version',
389 - 'rsd',
390 - 'wlw',
391 - 'db_reporting',
392 - 'php_reporting',
393 - 'versions',
394 - 'registered_versions',
395 - 'readme',
396 - 'wp_uptodate',
397 - 'phpversion_matched',
398 - 'sslprotocol',
399 - 'debug_disabled',
400 - );
401 271
402 - /**
403 - * Filters security issues from fixing
404 - *
405 - * Filters the default security checks and enables user to disable certain issues from being fixed by using the Fix All button.
406 - *
407 - * @param bool false Whether security issues should be filtered.
408 - * @param object $skip_features Object containing data from che chid site related to security issues.
409 - * Available options: 'listing', 'wp_version', 'rsd', 'wlw', 'db_reporting', 'php_reporting', 'versions', 'registered_versions', 'readme'.
410 - * @param object $website Object containing child site data.
411 - *
412 - * @since 4.1
413 - */
414 - $skip_features = apply_filters( 'mainwp_security_post_data', false, $skip_features, $website );
272 + /**
273 + * Method Fetch Security Issues
274 + *
275 + * Fetch stored known Child Site Security Issues from DB that were found during Sync.
276 + *
277 + * @uses \MainWP\Dashboard\MainWP_Connect::fetch_url_authed()
278 + * @uses \MainWP\Dashboard\MainWP_DB::get_website_by_id()
279 + * @uses \MainWP\Dashboard\MainWP_System_Utility::can_edit_website()
280 + */
281 + public static function fetch_security_issues() {
282 + $id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : false; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.NonceVerification.Recommended
283 + if ( ! $id ) {
284 + return '';
285 + }
286 + $website = MainWP_DB::instance()->get_website_by_id( $id );
415 287
416 - $feature = isset( $_REQUEST['feature'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['feature'] ) ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.NonceVerification.Recommended
417 - $post_data = array( 'feature' => $feature );
418 - if ( ! empty( $skip_features ) && is_array( $skip_features ) ) {
419 - $post_data['skip_features'] = $skip_features;
420 - }
288 + if ( ! MainWP_System_Utility::can_edit_website( $website ) ) {
289 + return '';
290 + }
421 291
422 - $unset_scripts = apply_filters( 'mainwp_unset_security_scripts_stylesheets', true );
423 - if ( $unset_scripts ) {
424 - if ( ! isset( $post_data['skip_features'] ) ) {
425 - $post_data['skip_features'] = array();
426 - }
292 + $information = MainWP_Connect::fetch_url_authed( $website, 'security' );
427 293
428 - if ( ! in_array( 'versions', $post_data['skip_features'] ) ) {
429 - $post_data['skip_features'][] = 'versions';
430 - }
294 + /**
295 + * Filters security issues
296 + *
297 + * Filters the default security checks and enables user to disable certain checks.
298 + *
299 + * @param bool false Whether security issues should be filtered.
300 + * @param object $information Object containing data from che chid site related to security issues.
301 + * Available options: 'db_reporting', 'php_reporting'.
302 + * @param object $website Object containing child site data.
303 + *
304 + * @since 4.1
305 + */
306 + $filterStats = apply_filters( 'mainwp_security_issues_stats', false, $information, $website );
307 + if ( false !== $filterStats && is_array( $filterStats ) ) {
308 + $information = array_merge( $information, $filterStats );
309 + }
310 + return $information;
311 + }
431 312
432 - if ( ! in_array( 'registered_versions', $post_data['skip_features'] ) ) {
433 - $post_data['skip_features'][] = 'registered_versions';
434 - }
435 - }
313 + /**
314 + * Method Fix Security Issues
315 + *
316 + * Fix the selected security issue.
317 + *
318 + * @uses \MainWP\Dashboard\MainWP_Connect::fetch_url_authed()
319 + * @uses \MainWP\Dashboard\MainWP_DB::get_website_by_id()
320 + * @uses \MainWP\Dashboard\MainWP_System_Utility::can_edit_website()
321 + */
322 + public static function fix_security_issue() { // phpcs:ignore -- NOSONAR - complex.
323 + $id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : false; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.NonceVerification.Recommended
324 + if ( ! $id ) {
325 + return '';
326 + }
327 + $website = MainWP_DB::instance()->get_website_by_id( $id );
436 328
437 - $information = MainWP_Connect::fetch_url_authed( $website, 'securityFix', $post_data );
438 - if ( isset( $information['sync'] ) && ! empty( $information['sync'] ) ) {
439 - MainWP_Sync::sync_information_array( $website, $information['sync'] );
440 - unset( $information['sync'] );
441 - }
329 + if ( ! MainWP_System_Utility::can_edit_website( $website ) ) {
330 + return '';
331 + }
442 332
443 - return $information;
444 - }
333 + if ( '' !== $website->sync_errors || MainWP_System_Utility::is_suspended_site( $website ) ) {
334 + return '';
335 + }
445 336
446 - /**
447 - * Method un-Fix Security Issues
448 - *
449 - * Un-Fix the selected security issue.
450 - *
451 - * @uses \MainWP\Dashboard\MainWP_Connect::fetch_url_authed()
452 - * @uses \MainWP\Dashboard\MainWP_DB::get_website_by_id()
453 - * @uses \MainWP\Dashboard\MainWP_Sync::sync_information_array()
454 - * @uses \MainWP\Dashboard\MainWP_System_Utility::can_edit_website()
455 - */
456 - public static function unfix_security_issue() {
457 - $id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : false; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.NonceVerification.Recommended
458 - if ( ! $id ) {
459 - return '';
460 - }
461 - $website = MainWP_DB::instance()->get_website_by_id( $id );
337 + $skip_features = array(
338 + 'db_reporting',
339 + 'php_reporting',
340 + 'wp_uptodate',
341 + 'phpversion_matched',
342 + 'sslprotocol',
343 + 'debug_disabled',
344 + );
462 345
463 - if ( ! MainWP_System_Utility::can_edit_website( $website ) ) {
464 - return '';
465 - }
346 + /**
347 + * Filters security issues from fixing
348 + *
349 + * Filters the default security checks and enables user to disable certain issues from being fixed by using the Fix All button.
350 + *
351 + * @param bool false Whether security issues should be filtered.
352 + * @param object $skip_features Object containing data from che chid site related to security issues.
353 + * Available options: 'db_reporting', 'php_reporting'.
354 + * @param object $website Object containing child site data.
355 + *
356 + * @since 4.1
357 + */
358 + $skip_features = apply_filters( 'mainwp_security_post_data', false, $skip_features, $website );
466 359
467 - if ( '' !== $website->sync_errors || MainWP_System_Utility::is_suspended_site( $website ) ) {
468 - return '';
469 - }
360 + $feature = isset( $_REQUEST['feature'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['feature'] ) ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.NonceVerification.Recommended
361 + $post_data = array( 'feature' => $feature );
362 + if ( ! empty( $skip_features ) && is_array( $skip_features ) ) {
363 + $post_data['skip_features'] = $skip_features;
364 + }
470 365
471 - $feature = isset( $_REQUEST['feature'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['feature'] ) ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.NonceVerification.Recommended
366 + $unset_scripts = apply_filters( 'mainwp_unset_security_scripts_stylesheets', true );
367 + if ( $unset_scripts ) {
368 + if ( ! isset( $post_data['skip_features'] ) ) {
369 + $post_data['skip_features'] = array();
370 + }
472 371
473 - $information = MainWP_Connect::fetch_url_authed( $website, 'securityUnFix', array( 'feature' => $feature ) );
474 - if ( isset( $information['sync'] ) && ! empty( $information['sync'] ) ) {
475 - MainWP_Sync::sync_information_array( $website, $information['sync'] );
476 - unset( $information['sync'] );
477 - }
372 + if ( ! in_array( 'versions', $post_data['skip_features'] ) ) {
373 + $post_data['skip_features'][] = 'versions';
374 + }
375 + }
478 376
479 - return $information;
480 - }
377 + $information = MainWP_Connect::fetch_url_authed( $website, 'securityFix', $post_data );
378 + return $information;
379 + }
380 +
381 + /**
382 + * Method un-Fix Security Issues
383 + *
384 + * Un-Fix the selected security issue.
385 + *
386 + * @uses \MainWP\Dashboard\MainWP_Connect::fetch_url_authed()
387 + * @uses \MainWP\Dashboard\MainWP_DB::get_website_by_id()
388 + * @uses \MainWP\Dashboard\MainWP_System_Utility::can_edit_website()
389 + */
390 + public static function unfix_security_issue() {
391 + $id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : false; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.NonceVerification.Recommended
392 + if ( ! $id ) {
393 + return '';
394 + }
395 + $website = MainWP_DB::instance()->get_website_by_id( $id );
396 +
397 + if ( ! MainWP_System_Utility::can_edit_website( $website ) ) {
398 + return '';
399 + }
400 +
401 + if ( '' !== $website->sync_errors || MainWP_System_Utility::is_suspended_site( $website ) ) {
402 + return '';
403 + }
404 +
405 + $feature = isset( $_REQUEST['feature'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['feature'] ) ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.NonceVerification.Recommended
406 +
407 + $information = MainWP_Connect::fetch_url_authed( $website, 'securityUnFix', array( 'feature' => $feature ) );
408 + return $information;
409 + }
481 410 }