PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 5.0.3.1
MainWP Dashboard: Self-hosted WordPress Management for Agencies v5.0.3.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 5.2.2 5.3 All 153 releases
mainwp / pages / page-mainwp-server-information.php

page-mainwp-server-information.php in MainWP Dashboard: Self-hosted WordPress Management for Agencies 5.0.3.1, at pages/page-mainwp-server-information.php

1,894 lines 71.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * MainWP Info Page.
4 *
5 * @package MainWP/Dashboard
6 */
7
8 namespace MainWP\Dashboard;
9
10 // phpcs:disable Generic.Metrics.CyclomaticComplexity -- complexity.
11 /**
12 * Class MainWP_Server_Information
13 */
14 class MainWP_Server_Information {
15
16 const WARNING = 1;
17 const ERROR = 2;
18
19 /**
20 * The Info page sub-pages.
21 *
22 * @static
23 * @var array Sub pages.
24 */
25 public static $subPages;
26
27 /**
28 * Get Class Name
29 *
30 * @return string __CLASS__
31 */
32 public static function get_class_name() {
33 return __CLASS__;
34 }
35
36 /**
37 * Method init_menu()
38 *
39 * Initiate Info subPage menu.
40 *
41 * @uses \MainWP\Dashboard\MainWP_Menu::is_disable_menu_item()
42 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::is_apache_server_software()
43 */
44 public static function init_menu() {
45
46 add_action( 'mainwp_pageheader_infor', array( self::get_class_name(), 'render_header' ) );
47 add_action( 'mainwp_pagefooter_infor', array( self::get_class_name(), 'render_footer' ) );
48
49 add_submenu_page(
50 'mainwp_tab',
51 __( 'Info', 'mainwp' ),
52 ' <span id="mainwp-ServerInformation">' . esc_html__( 'Info', 'mainwp' ) . '</span>',
53 'read',
54 'ServerInformation',
55 array(
56 self::get_class_name(),
57 'render',
58 )
59 );
60 if ( ! MainWP_Menu::is_disable_menu_item( 3, 'ServerInformationCron' ) ) {
61 add_submenu_page(
62 'mainwp_tab',
63 __( 'Cron Schedules', 'mainwp' ),
64 '<div class="mainwp-hidden">' . esc_html__( 'Cron Schedules', 'mainwp' ) . '</div>',
65 'read',
66 'ServerInformationCron',
67 array(
68 self::get_class_name(),
69 'render_cron',
70 )
71 );
72 }
73
74 if ( ! MainWP_Menu::is_disable_menu_item( 3, 'ErrorLog' ) ) {
75 add_submenu_page(
76 'mainwp_tab',
77 __( 'Error Log', 'mainwp' ),
78 '<div class="mainwp-hidden">' . esc_html__( 'Error Log', 'mainwp' ) . '</div>',
79 'read',
80 'ErrorLog',
81 array(
82 self::get_class_name(),
83 'render_error_log_page',
84 )
85 );
86 }
87 if ( ! MainWP_Menu::is_disable_menu_item( 3, 'WPConfig' ) ) {
88 add_submenu_page(
89 'mainwp_tab',
90 __( 'WP-Config File', 'mainwp' ),
91 '<div class="mainwp-hidden">' . esc_html__( 'WP-Config File', 'mainwp' ) . '</div>',
92 'read',
93 'WPConfig',
94 array(
95 self::get_class_name(),
96 'render_wp_config',
97 )
98 );
99 }
100 if ( ! MainWP_Menu::is_disable_menu_item( 3, '.htaccess' ) ) {
101 if ( MainWP_Server_Information_Handler::is_apache_server_software() ) {
102 add_submenu_page(
103 'mainwp_tab',
104 __( '.htaccess File', 'mainwp' ),
105 '<div class="mainwp-hidden">' . esc_html__( '.htaccess File', 'mainwp' ) . '</div>',
106 'read',
107 '.htaccess',
108 array(
109 self::get_class_name(),
110 'render_htaccess',
111 )
112 );
113 }
114 }
115 if ( ! MainWP_Menu::is_disable_menu_item( 3, 'ActionLogs' ) ) {
116 add_submenu_page(
117 'mainwp_tab',
118 __( 'Custom Event Monitor', 'mainwp' ),
119 '<div class="mainwp-hidden">' . esc_html__( 'Custom Event Monitor', 'mainwp' ) . '</div>',
120 'read',
121 'ActionLogs',
122 array(
123 self::get_class_name(),
124 'render_action_logs',
125 )
126 );
127 }
128
129 if ( ! MainWP_Menu::is_disable_menu_item( 3, 'PluginPrivacy' ) ) {
130 add_submenu_page(
131 'mainwp_tab',
132 __( 'Plugin Privacy', 'mainwp' ),
133 '<div class="mainwp-hidden">' . esc_html__( 'Plugin Privacy', 'mainwp' ) . '</div>',
134 'read',
135 'PluginPrivacy',
136 array(
137 self::get_class_name(),
138 'render_plugin_privacy_page',
139 )
140 );
141 }
142
143 /**
144 * Filter mainwp_getsubpages_server
145 *
146 * Filters subpages for the Info page.
147 *
148 * @since Unknown
149 */
150 $sub_pages = apply_filters_deprecated( 'mainwp-getsubpages-server', array( array() ), '4.0.7.2', 'mainwp_getsubpages_server' );
151 self::$subPages = apply_filters( 'mainwp_getsubpages_server', $sub_pages );
152
153 if ( isset( self::$subPages ) && is_array( self::$subPages ) ) {
154 foreach ( self::$subPages as $subPage ) {
155 if ( ! isset( $subPage['slug'] ) ) {
156 continue;
157 }
158 if ( MainWP_Menu::is_disable_menu_item( 3, 'Server' . $subPage['slug'] ) ) {
159 continue;
160 }
161 add_submenu_page( 'mainwp_tab', $subPage['title'], '<div class="mainwp-hidden">' . $subPage['title'] . '</div>', 'read', 'Server' . $subPage['slug'], $subPage['callback'] );
162 }
163 }
164 }
165
166 /**
167 * Renders Sub Pages Menu.
168 *
169 * @uses \MainWP\Dashboard\MainWP_Menu::is_disable_menu_item()
170 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::is_apache_server_software()
171 */
172 public static function init_subpages_menu() {
173 ?>
174 <div id="menu-mainwp-ServerInformation" class="mainwp-submenu-wrapper">
175 <div class="wp-submenu sub-open">
176 <div class="mainwp_boxout">
177 <div class="mainwp_boxoutin"></div>
178 <a href="<?php echo esc_url( admin_url( 'admin.php?page=ServerInformation' ) ); ?>" class="mainwp-submenu"><?php esc_html_e( 'Server', 'mainwp' ); ?></a>
179 <?php if ( ! MainWP_Menu::is_disable_menu_item( 3, 'ServerInformationCron' ) ) { ?>
180 <a href="<?php echo esc_url( admin_url( 'admin.php?page=ServerInformationCron' ) ); ?>" class="mainwp-submenu"><?php esc_html_e( 'Cron Schedules', 'mainwp' ); ?></a>
181 <?php } ?>
182 <?php if ( ! MainWP_Menu::is_disable_menu_item( 3, 'ErrorLog' ) ) { ?>
183 <a href="<?php echo esc_url( admin_url( 'admin.php?page=ErrorLog' ) ); ?>" class="mainwp-submenu"><?php esc_html_e( 'Error Log', 'mainwp' ); ?></a>
184 <?php } ?>
185 <?php if ( ! MainWP_Menu::is_disable_menu_item( 3, 'WPConfig' ) ) { ?>
186 <a href="<?php echo esc_url( admin_url( 'admin.php?page=WPConfig' ) ); ?>" class="mainwp-submenu"><?php esc_html_e( 'WP-Config File', 'mainwp' ); ?></a>
187 <?php } ?>
188 <?php
189 if ( ! MainWP_Menu::is_disable_menu_item( 3, '.htaccess' ) ) {
190 if ( MainWP_Server_Information_Handler::is_apache_server_software() ) {
191 ?>
192 <a href="<?php echo esc_url( admin_url( 'admin.php?page=.htaccess' ) ); ?>" class="mainwp-submenu"><?php esc_html_e( '.htaccess File', 'mainwp' ); ?></a>
193 <?php
194 }
195 }
196 ?>
197 <?php
198 if ( isset( self::$subPages ) && is_array( self::$subPages ) ) {
199 foreach ( self::$subPages as $subPage ) {
200 if ( ! isset( $subPage['menu_hidden'] ) || ( isset( $subPage['menu_hidden'] ) && true !== $subPage['menu_hidden'] ) ) {
201 if ( MainWP_Menu::is_disable_menu_item( 3, 'Server' . $subPage['slug'] ) ) {
202 continue;
203 }
204 ?>
205 <a href="<?php echo esc_url( admin_url( 'admin.php?page=Server' . $subPage['slug'] ) ); ?>" class="mainwp-submenu"><?php echo esc_html( $subPage['title'] ); ?></a>
206 <?php
207 }
208 }
209 }
210 ?>
211 </div>
212 </div>
213 </div>
214 <?php
215 }
216
217 /**
218 * Initiates Server Information left menu.
219 *
220 * @param array $subPages array of subpages.
221 *
222 * @uses \MainWP\Dashboard\MainWP_Menu::add_left_menu()
223 * @uses \MainWP\Dashboard\MainWP_Menu::init_subpages_left_menu()
224 * @uses \MainWP\Dashboard\MainWP_Menu::is_disable_menu_item()
225 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::is_apache_server_software()
226 */
227 public static function init_left_menu( $subPages = array() ) {
228 MainWP_Menu::add_left_menu(
229 array(
230 'title' => esc_html__( 'Info', 'mainwp' ),
231 'parent_key' => 'mainwp_tab',
232 'slug' => 'ServerInformation',
233 'href' => 'admin.php?page=ServerInformation',
234 'icon' => '<i class="info circle icon"></i>',
235 ),
236 0
237 );
238
239 /**
240 * MainWP active menu slugs array.
241 *
242 * @global object
243 */
244 global $_mainwp_menu_active_slugs;
245
246 $_mainwp_menu_active_slugs['ActionLogs'] = 'ServerInformation';
247
248 $init_sub_subleftmenu = array(
249 array(
250 'title' => esc_html__( 'Server', 'mainwp' ),
251 'parent_key' => 'ServerInformation',
252 'href' => 'admin.php?page=ServerInformation',
253 'slug' => 'ServerInformation',
254 'right' => '',
255 ),
256 array(
257 'title' => esc_html__( 'Cron Schedules', 'mainwp' ),
258 'parent_key' => 'ServerInformation',
259 'href' => 'admin.php?page=ServerInformationCron',
260 'slug' => 'ServerInformationCron',
261 'right' => '',
262 ),
263 array(
264 'title' => esc_html__( 'Error Log', 'mainwp' ),
265 'parent_key' => 'ServerInformation',
266 'href' => 'admin.php?page=ErrorLog',
267 'slug' => 'ErrorLog',
268 'right' => '',
269 ),
270 array(
271 'title' => esc_html__( 'Custom Event Monitor', 'mainwp' ),
272 'parent_key' => 'ServerInformation',
273 'href' => 'admin.php?page=ActionLogs',
274 'slug' => 'ActionLogs',
275 'right' => '',
276 ),
277 array(
278 'title' => esc_html__( 'Plugin Privacy', 'mainwp' ),
279 'parent_key' => 'ServerInformation',
280 'href' => 'admin.php?page=PluginPrivacy',
281 'slug' => 'PluginPrivacy',
282 'right' => '',
283 ),
284 );
285
286 MainWP_Menu::init_subpages_left_menu( $subPages, $init_sub_subleftmenu, 'ServerInformation', 'Server' );
287 foreach ( $init_sub_subleftmenu as $item ) {
288 if ( MainWP_Menu::is_disable_menu_item( 3, $item['slug'] ) ) {
289 continue;
290 }
291 MainWP_Menu::add_left_menu( $item, 2 );
292 }
293 }
294
295 /**
296 * Renders Info header.
297 *
298 * @param string $shownPage Current page.
299 *
300 * @uses \MainWP\Dashboard\MainWP_Menu::is_disable_menu_item()
301 * @uses \MainWP\Dashboard\MainWP_UI::render_top_header()
302 * @uses \MainWP\Dashboard\MainWP_UI::render_page_navigation()
303 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::is_apache_server_software()
304 */
305 public static function render_header( $shownPage = '' ) {
306 $params = array(
307 'title' => esc_html__( 'Info', 'mainwp' ),
308 );
309
310 MainWP_UI::render_top_header( $params );
311
312 $renderItems = array();
313
314 $renderItems[] = array(
315 'title' => esc_html__( 'Server', 'mainwp' ),
316 'href' => 'admin.php?page=ServerInformation',
317 'active' => ( '' === $shownPage ) ? true : false,
318 );
319
320 if ( ! MainWP_Menu::is_disable_menu_item( 3, 'ServerInformationCron' ) ) {
321 $renderItems[] = array(
322 'title' => esc_html__( 'Cron Schedules', 'mainwp' ),
323 'href' => 'admin.php?page=ServerInformationCron',
324 'active' => ( 'ServerInformationCron' === $shownPage ) ? true : false,
325 );
326 }
327
328 if ( ! MainWP_Menu::is_disable_menu_item( 3, 'ErrorLog' ) ) {
329 $renderItems[] = array(
330 'title' => esc_html__( 'Error Log', 'mainwp' ),
331 'href' => 'admin.php?page=ErrorLog',
332 'active' => ( 'ErrorLog' === $shownPage ) ? true : false,
333 );
334 }
335
336 if ( ! MainWP_Menu::is_disable_menu_item( 3, 'ActionLogs' ) ) {
337 $renderItems[] = array(
338 'title' => esc_html__( 'Custom Event Monitor', 'mainwp' ),
339 'href' => 'admin.php?page=ActionLogs',
340 'active' => ( 'ActionLogs' === $shownPage ) ? true : false,
341 );
342 }
343
344 if ( ! MainWP_Menu::is_disable_menu_item( 3, 'PluginPrivacy' ) ) {
345 $renderItems[] = array(
346 'title' => esc_html__( 'Plugin Privacy', 'mainwp' ),
347 'href' => 'admin.php?page=PluginPrivacy',
348 'active' => ( 'PluginPrivacy' === $shownPage ) ? true : false,
349 );
350 }
351
352 MainWP_UI::render_page_navigation( $renderItems );
353
354 self::render_actions_bar();
355
356 echo '<div>';
357 }
358
359 /**
360 * Renders Server Information footer.
361 */
362 public static function render_footer() {
363 echo '</div>';
364 }
365
366 /**
367 * Renders Server Information action bar element.
368 */
369 public static function render_actions_bar() {
370 if ( isset( $_GET['page'] ) && 'ServerInformation' === $_GET['page'] ) : // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
371 ?>
372 <div class="mainwp-actions-bar">
373 <div class="ui two column grid">
374 <div class="column"></div>
375 <div class="right aligned column">
376 <a href="#" style="margin-left:5px" class="ui mini basic green button" id="mainwp-copy-meta-system-report" data-inverted="" data-position="left center" data-tooltip="<?php esc_attr_e( 'Copy the system report to paste it to the MainWP Community.', 'mainwp' ); ?>"><?php esc_html_e( 'Copy System Report for the MainWP Community', 'mainwp' ); ?></a>
377 <a href="#" class="ui mini green button" id="mainwp-download-system-report"><?php esc_html_e( 'Download System Report', 'mainwp' ); ?></a>
378 </div>
379 </div>
380 </div>
381 <?php
382 endif;
383 }
384
385 /**
386 * Renders Server Information page.
387 *
388 * @return void
389 *
390 * @uses \MainWP\Dashboard\MainWP_Extensions_View::get_available_extensions()
391 * @uses \MainWP\Dashboard\MainWP_Extensions_Handler::get_extensions()
392 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_mainwp_version()
393 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_current_version()
394 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_file_system_method()
395 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_php_allow_url_fopen()
396 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_php_exif()
397 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_php_iptc()
398 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_php_xml()
399 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_loaded_php_extensions()
400 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_sql_mode()
401 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_wp_root()
402 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_server_name()
403 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_server_software()
404 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_os()
405 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_architecture()
406 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_server_ip()
407 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_server_protocol()
408 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_http_host()
409 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_https()
410 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::server_self_connect()
411 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_user_agent()
412 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_server_port()
413 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_server_gateway_interface()
414 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::memory_usage()
415 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_complete_url()
416 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_server_request_time()
417 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_server_http_accept()
418 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_server_accept_charset()
419 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_script_file_name()
420 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_current_page_uri()
421 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_remote_address()
422 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_remote_host()
423 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_remote_port()
424 */
425 public static function render() {
426 if ( ! mainwp_current_user_have_right( 'dashboard', 'see_server_information' ) ) {
427 mainwp_do_not_have_permissions( 'server information', 'mainwp' );
428 return;
429 }
430 self::render_header( '' );
431
432 /**
433 * Action: mainwp_before_server_info_table
434 *
435 * Fires on the top of the Info page, before the Server Info table.
436 *
437 * @since 4.0
438 */
439 do_action( 'mainwp_before_server_info_table' );
440 ?>
441 <div class="ui segment">
442 <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp-server-info-info-message' ) ) : ?>
443 <div class="ui info message">
444 <i class="close icon mainwp-notice-dismiss" notice-id="mainwp-server-info-info-message"></i>
445 <?php printf( esc_html__( 'Check your system configuration and make sure your MainWP Dashboard passes all system requirements. If you need help with resolving specific errors, please review this %1$shelp document%2$s.', 'mainwp' ), '<a href="https://kb.mainwp.com/docs/resolving-system-requirement-issues/" target="_blank">', '</a> <i class="external alternate icon"></i>' ); ?>
446 </div>
447 <?php endif; ?>
448 <?php
449 if ( function_exists( 'curl_version' ) ) {
450 if ( ! MainWP_Server_Information_Handler::curlssl_compare( 'OpenSSL/1.1.0', '>=' ) ) {
451 echo "<div class='ui yellow message'>" . sprintf( esc_html__( 'Your host needs to update OpenSSL to at least version 1.1.0 which is already over 4 years old and contains patches for over 60 vulnerabilities.%1$sThese range from Denial of Service to Remote Code Execution. %2$sClick here for more information.%3$s', 'mainwp' ), '<br/>', '<a href="https://community.letsencrypt.org/t/openssl-client-compatibility-changes-for-let-s-encrypt-certificates/143816" target="_blank">', '</a>' ) . '</div>';
452 }
453 }
454 ?>
455 <table id="mainwp-system-report-wordpress-table" class="ui unstackable table single line mainwp-system-report-table mainwp-system-info-table">
456 <thead>
457 <tr>
458 <th><?php esc_html_e( 'WordPress Check', 'mainwp' ); ?></th>
459 <th><?php esc_html_e( 'Required', 'mainwp' ); ?></th>
460 <th><?php esc_html_e( 'Detected', 'mainwp' ); ?></th>
461 <th class="right aligned"><?php esc_html_e( 'Status', 'mainwp' ); ?></th>
462 </tr>
463 </thead>
464 <tbody>
465 <?php self::render_wordpress_check_tbody(); ?>
466 </tbody>
467 </table>
468
469 <table id="mainwp-system-report-php-table" class="ui unstackable table fixed mainwp-system-report-table mainwp-system-info-table">
470 <thead>
471 <tr>
472 <th><?php esc_html_e( 'PHP', 'mainwp' ); ?></th>
473 <th><?php esc_html_e( 'Required', 'mainwp' ); ?></th>
474 <th><?php esc_html_e( 'Detected', 'mainwp' ); ?></th>
475 <th class="right aligned"><?php esc_html_e( 'Status', 'mainwp' ); ?></th>
476 </tr>
477 </thead>
478 <tbody>
479 <?php self::render_php_check_tbody(); ?>
480 </tbody>
481 </table>
482
483 <table id="mainwp-system-report-mysql-table" class="ui unstackable table mainwp-system-report-table mainwp-system-info-table">
484 <thead>
485 <tr>
486 <th><?php esc_html_e( 'MySQL', 'mainwp' ); ?></th>
487 <th><?php esc_html_e( 'Required', 'mainwp' ); ?></th>
488 <th><?php esc_html_e( 'Detected', 'mainwp' ); ?></th>
489 <th class="right aligned"><?php esc_html_e( 'Status', 'mainwp' ); ?></th>
490 </tr>
491 </thead>
492 <tbody>
493 <?php self::render_mysql_check_tbody(); ?>
494 </tbody>
495 </table>
496
497 <table id="mainwp-system-report-server-table" class="ui unstackable table mainwp-system-report-table mainwp-system-info-table">
498 <thead>
499 <tr>
500 <th><?php esc_html_e( 'Server Configuration', 'mainwp' ); ?></th>
501 <th><?php esc_html_e( 'Detected Value', 'mainwp' ); ?></th>
502 </tr>
503 </thead>
504 <tbody>
505 <?php self::render_server_check_tbody(); ?>
506 </tbody>
507 </table>
508
509 <table id="mainwp-system-report-dashboard-table" class="ui unstackable table mainwp-system-report-table mainwp-system-info-table">
510 <thead>
511 <tr>
512 <th><?php esc_html_e( 'MainWP Dashboard Settings', 'mainwp' ); ?></th>
513 <th><?php esc_html_e( 'Detected Value', 'mainwp' ); ?></th>
514 </tr>
515 </thead>
516 <tbody>
517 <?php self::render_dashboard_check_tbody(); ?>
518 </tbody>
519 </table>
520
521 <table id="mainwp-system-report-extensions-table" class="ui unstackable table single line mainwp-system-report-table mainwp-system-info-table">
522 <thead>
523 <tr>
524 <th><?php esc_html_e( 'Extensions', 'mainwp' ); ?></th>
525 <th><?php esc_html_e( 'Version', 'mainwp' ); ?></th>
526 <th><?php esc_html_e( 'License', 'mainwp' ); ?></th>
527 <th class="right aligned"><?php esc_html_e( 'Status', 'mainwp' ); ?></th>
528 </tr>
529 </thead>
530 <tbody>
531 <?php self::render_extensions_license_check_tbody(); ?>
532 </tbody>
533 </table>
534
535 <table id="mainwp-system-report-plugins-table" class="ui single line table unstackable mainwp-system-report-table mainwp-system-info-table">
536 <thead>
537 <tr>
538 <th><?php esc_html_e( 'Plugin', 'mainwp' ); ?></th>
539 <th><?php esc_html_e( 'Version', 'mainwp' ); ?></th>
540 <th><?php esc_html_e( 'Status', 'mainwp' ); ?></th>
541 </tr>
542 </thead>
543 <tbody>
544 <?php self::render_plugins_check_tbody(); ?>
545 </tbody>
546 </table>
547
548 <div id="download-server-information" style="opacity:0">
549 <textarea readonly="readonly" wrap="off"></textarea>
550 </div>
551
552 <script type="text/javascript">
553 var responsive = true;
554 if( jQuery( window ).width() > 1140 ) {
555 responsive = false;
556 }
557 jQuery( document ).ready( function() {
558 jQuery( '.mainwp-system-info-table' ).DataTable( {
559 responsive: responsive,
560 colreorder: true,
561 paging: false,
562 info: false,
563 } );
564 } );
565 </script>
566 </div>
567
568 <?php
569
570 /**
571 * Action: mainwp_after_server_info_table
572 *
573 * Fires on the bottom of the Info page, after the Server Info table.
574 *
575 * @since 4.0
576 */
577 do_action( 'mainwp_after_server_info_table' );
578
579 self::render_footer( '' );
580 }
581
582 /**
583 * Renders WordPress checks table body.
584 *
585 * @return void
586 */
587 public static function render_wordpress_check_tbody() {
588 self::render_row( 'WordPress Version', '>=', '6.2', 'get_wordpress_version', '', '', null, null, self::ERROR );
589 self::render_row( 'WordPress Memory Limit', '>=', '64M', 'get_wordpress_memory_limit', '', '', null );
590 self::render_row( 'MultiSite Disabled', '=', true, 'check_if_multisite', '', '', null );
591 ?>
592 <tr>
593 <td><?php esc_html_e( 'FileSystem Method', 'mainwp' ); ?></td>
594 <td><?php echo esc_html( '= direct' ); ?></td>
595 <td><?php echo MainWP_Server_Information_Handler::get_file_system_method(); // phpcs:ignore WordPress.Security.EscapeOutput ?></td>
596 <td class="right aligned"><?php echo self::get_file_system_method_check(); // phpcs:ignore WordPress.Security.EscapeOutput ?></td>
597 </tr>
598 <?php
599 }
600
601 /**
602 * Renders PHP checks table body.
603 *
604 * @return void
605 */
606 public static function render_php_check_tbody() {
607 self::render_row( 'PHP Version', '>=', '7.4', 'get_php_version', '', '', null, null, self::ERROR );
608 self::render_row( 'PHP Safe Mode Disabled', '=', true, 'get_php_safe_mode', '', '', null );
609 self::render_row( 'PHP Max Execution Time', '>=', '30', 'get_max_execution_time', 'seconds', '=', '0' );
610 self::render_row( 'PHP Max Input Time', '>=', '30', 'get_max_input_time', 'seconds', '=', '0' );
611 self::render_row( 'PHP Memory Limit', '>=', '256M', 'get_php_memory_limit', '', '', null, 'filesize' );
612 self::render_row( 'PCRE Backtracking Limit', '>=', '10000', 'get_output_buffer_size', '', '', null );
613 self::render_row( 'PHP Upload Max Filesize', '>=', '2M', 'get_upload_max_filesize', '', '', null, 'filesize' );
614 self::render_row( 'PHP Post Max Size', '>=', '2M', 'get_post_max_size', '', '', null, 'filesize' );
615 self::render_row( 'SSL Extension Enabled', '=', true, 'get_ssl_support', '', '', null );
616 self::render_row( 'SSL Warnings', '=', '', 'get_ssl_warning', 'empty', '', null );
617 self::render_row( 'cURL Extension Enabled', '=', true, 'get_curl_support', '', '', null, null, self::ERROR );
618 self::render_row( 'cURL Timeout', '>=', '300', 'get_curl_timeout', 'seconds', '=', '0' );
619 if ( function_exists( 'curl_version' ) ) {
620 $reuire_curl = '7.18.1';
621 if ( version_compare( MainWP_Server_Information_Handler::get_php_version(), '8.0.0' ) >= 0 ) {
622 $reuire_curl = '7.29.0';
623 }
624 self::render_row( 'cURL Version', '>=', $reuire_curl, 'get_curl_version', '', '', null );
625 $openssl_version = 'OpenSSL/1.1.0';
626 self::render_row(
627 'OpenSSL Version',
628 '>=',
629 $openssl_version,
630 'get_curl_ssl_version',
631 '',
632 '',
633 null,
634 'curlssl'
635 );
636
637 $wk = MainWP_Server_Information_Handler::get_openssl_working_status();
638 ?>
639 <tr>
640 <td>OpenSSL Working Status</td>
641 <td>Yes</td>
642 <td><?php echo( $wk ? 'Yes' : 'No' ); ?></td>
643 <td class="right aligned"><?php echo ( $wk ? self::get_pass_html() : self::get_warning_html() ); // phpcs:ignore WordPress.Security.EscapeOutput ?></td>
644 </tr>
645 <?php
646
647 }
648 ?>
649 <tr>
650 <td><?php esc_html_e( 'PHP Allow URL fopen', 'mainwp' ); ?></td>
651 <td><?php esc_html_e( 'N/A', 'mainwp' ); ?></td>
652 <td><?php MainWP_Server_Information_Handler::get_php_allow_url_fopen(); ?></td>
653 <td></td>
654 </tr>
655 <tr>
656 <td><?php esc_html_e( 'PHP Exif Support', 'mainwp' ); ?></td>
657 <td><?php esc_html_e( 'N/A', 'mainwp' ); ?></td>
658 <td><?php MainWP_Server_Information_Handler::get_php_exif(); ?></td>
659 <td></td>
660 </tr>
661 <tr>
662 <td><?php esc_html_e( 'PHP IPTC Support', 'mainwp' ); ?></td>
663 <td><?php esc_html_e( 'N/A', 'mainwp' ); ?></td>
664 <td><?php MainWP_Server_Information_Handler::get_php_iptc(); ?></td>
665 <td></td>
666 </tr>
667 <tr>
668 <td><?php esc_html_e( 'PHP XML Support', 'mainwp' ); ?></td>
669 <td><?php esc_html_e( 'N/A', 'mainwp' ); ?></td>
670 <td><?php MainWP_Server_Information_Handler::get_php_xml(); ?></td>
671 <td></td>
672 </tr>
673 <tr>
674 <td><?php esc_html_e( 'PHP Disabled Functions', 'mainwp' ); ?></td>
675 <td><?php esc_html_e( 'N/A', 'mainwp' ); ?></td>
676 <td><?php self::php_disabled_functions(); ?></td>
677 <td></td>
678 </tr>
679 <tr>
680 <td><?php esc_html_e( 'PHP Loaded Extensions', 'mainwp' ); ?></td>
681 <td><?php esc_html_e( 'N/A', 'mainwp' ); ?></td>
682 <td><?php MainWP_Server_Information_Handler::get_loaded_php_extensions(); ?></td>
683 <td></td>
684 </tr>
685 <?php
686 }
687
688 /**
689 * Renders MySQL checks table body.
690 *
691 * @return void
692 */
693 public static function render_mysql_check_tbody() {
694 self::render_row( 'MySQL Version', '>=', '5.0', 'get_mysql_version', '', '', null, null, self::ERROR );
695 ?>
696 <tr>
697 <td><?php esc_html_e( 'MySQL Mode', 'mainwp' ); ?></td>
698 <td><?php esc_html_e( 'N/A', 'mainwp' ); ?></td>
699 <td><?php MainWP_Server_Information_Handler::get_sql_mode(); ?></td>
700 <td></td>
701 </tr>
702 <tr>
703 <td><?php esc_html_e( 'MySQL Client Encoding', 'mainwp' ); ?></td>
704 <td><?php esc_html_e( 'N/A', 'mainwp' ); ?></td>
705 <td><?php echo defined( 'DB_CHARSET' ) ? esc_html( DB_CHARSET ) : ''; ?></td>
706 <td></td>
707 </tr>
708 <?php
709 }
710
711 /**
712 * Renders Server checks table body.
713 *
714 * @return void
715 */
716 public static function render_server_check_tbody() {
717 ?>
718 <tr class="mwp-not-generate-row">
719 <td><?php esc_html_e( 'WordPress Root Directory', 'mainwp' ); ?></td>
720 <td><?php MainWP_Server_Information_Handler::get_wp_root(); ?></td>
721 </tr>
722 <tr class="mwp-not-generate-row">
723 <td><?php esc_html_e( 'Server Name', 'mainwp' ); ?></td>
724 <td><?php MainWP_Server_Information_Handler::get_server_name(); ?></td>
725 </tr>
726 <tr>
727 <td><?php esc_html_e( 'Server Software', 'mainwp' ); ?></td>
728 <td><?php MainWP_Server_Information_Handler::get_server_software(); ?></td>
729 </tr>
730 <tr>
731 <td><?php esc_html_e( 'Operating System', 'mainwp' ); ?></td>
732 <td><?php MainWP_Server_Information_Handler::get_os(); ?></td>
733 </tr>
734 <tr>
735 <td><?php esc_html_e( 'Architecture', 'mainwp' ); ?></td>
736 <td><?php MainWP_Server_Information_Handler::get_architecture(); ?></td>
737 </tr>
738 <tr class="mwp-not-generate-row">
739 <td><?php esc_html_e( 'Server IP', 'mainwp' ); ?></td>
740 <td><?php MainWP_Server_Information_Handler::get_server_ip(); ?></td>
741 </tr>
742 <tr>
743 <td><?php esc_html_e( 'Server Protocol', 'mainwp' ); ?></td>
744 <td><?php MainWP_Server_Information_Handler::get_server_protocol(); ?></td>
745 </tr>
746 <tr class="mwp-not-generate-row">
747 <td><?php esc_html_e( 'HTTP Host', 'mainwp' ); ?></td>
748 <td><?php MainWP_Server_Information_Handler::get_http_host(); ?></td>
749 </tr>
750 <tr>
751 <td><?php esc_html_e( 'HTTPS', 'mainwp' ); ?></td>
752 <td><?php MainWP_Server_Information_Handler::get_https(); ?></td>
753 </tr>
754 <tr>
755 <td><?php esc_html_e( 'Server self connect', 'mainwp' ); ?></td>
756 <td><?php MainWP_Server_Information_Handler::server_self_connect(); ?></td>
757 </tr>
758 <tr>
759 <td><?php esc_html_e( 'User Agent', 'mainwp' ); ?></td>
760 <td><?php MainWP_Server_Information_Handler::get_user_agent(); ?></td>
761 </tr>
762 <tr class="mwp-not-generate-row">
763 <td><?php esc_html_e( 'Server Port', 'mainwp' ); ?></td>
764 <td><?php MainWP_Server_Information_Handler::get_server_port(); ?></td>
765 </tr>
766 <tr>
767 <td><?php esc_html_e( 'Gateway Interface', 'mainwp' ); ?></td>
768 <td><?php MainWP_Server_Information_Handler::get_server_gateway_interface(); ?></td>
769 </tr>
770 <tr>
771 <td><?php esc_html_e( 'Memory Usage', 'mainwp' ); ?></td>
772 <td><?php MainWP_Server_Information_Handler::memory_usage(); ?></td>
773 </tr>
774 <tr class="mwp-not-generate-row">
775 <td><?php esc_html_e( 'Complete URL', 'mainwp' ); ?></td>
776 <td><?php MainWP_Server_Information_Handler::get_complete_url(); ?></td>
777 </tr>
778 <tr>
779 <td><?php esc_html_e( 'Request Time', 'mainwp' ); ?></td>
780 <td><?php MainWP_Server_Information_Handler::get_server_request_time(); ?></td>
781 </tr>
782 <tr>
783 <td><?php esc_html_e( 'Accept Content', 'mainwp' ); ?></td>
784 <td><?php MainWP_Server_Information_Handler::get_server_http_accept(); ?></td>
785 </tr>
786 <tr>
787 <td><?php esc_html_e( 'Accept-Charset Content', 'mainwp' ); ?></td>
788 <td><?php MainWP_Server_Information_Handler::get_server_accept_charset(); ?></td>
789 </tr>
790 <tr class="mwp-not-generate-row">
791 <td><?php esc_html_e( 'Currently Executing Script Pathname', 'mainwp' ); ?></td>
792 <td><?php MainWP_Server_Information_Handler::get_script_file_name(); ?></td>
793 </tr>
794 <tr class="mwp-not-generate-row">
795 <td><?php esc_html_e( 'Current Page URI', 'mainwp' ); ?></td>
796 <td><?php MainWP_Server_Information_Handler::get_current_page_uri(); ?></td>
797 </tr>
798 <tr class="mwp-not-generate-row">
799 <td><?php esc_html_e( 'Remote Address', 'mainwp' ); ?></td>
800 <td><?php MainWP_Server_Information_Handler::get_remote_address(); ?></td>
801 </tr>
802 <tr class="mwp-not-generate-row">
803 <td><?php esc_html_e( 'Remote Host', 'mainwp' ); ?></td>
804 <td><?php MainWP_Server_Information_Handler::get_remote_host(); ?></td>
805 </tr>
806 <tr class="mwp-not-generate-row">
807 <td><?php esc_html_e( 'Remote Port', 'mainwp' ); ?></td>
808 <td><?php MainWP_Server_Information_Handler::get_remote_port(); ?></td>
809 </tr>
810 <?php
811 }
812
813 /**
814 * Renders MainWP Dashboard checks table body.
815 *
816 * @return void
817 */
818 public static function render_dashboard_check_tbody() {
819 ?>
820 <tr>
821 <td><?php esc_html_e( 'MainWP Dashboard Version', 'mainwp' ); ?></td>
822 <td><?php echo 'Latest: ' . MainWP_Server_Information_Handler::get_mainwp_version(); ?> | <?php echo 'Detected: ' . MainWP_Server_Information_Handler::get_current_version(); ?> <?php echo self::get_mainwp_version_check(); // phpcs:ignore WordPress.Security.EscapeOutput ?></td>
823 </tr>
824 <?php
825 self::check_directory_mainwp_directory();
826 self::display_mainwp_options();
827 }
828
829 /**
830 * Renders extensions API License status table body.
831 *
832 * @return void
833 */
834 public static function render_extensions_license_check_tbody() {
835 $extensions = MainWP_Extensions_Handler::get_extensions();
836 $extensions_slugs = array();
837 if ( 0 === count( $extensions ) ) {
838 echo '<tr><td colspan="4">' . esc_html__( 'No installed extensions', 'mainwp' ) . '</td></tr>';
839 }
840 foreach ( $extensions as $extension ) {
841 $extensions_slugs[] = $extension['slug'];
842 ?>
843 <tr>
844 <td><?php echo esc_html( $extension['name'] ); ?></td>
845 <td><?php echo esc_html( $extension['version'] ); ?></td>
846 <?php
847 if ( isset( $extension['mainwp'] ) && $extension['mainwp'] ) {
848 ?>
849 <td><?php echo isset( $extension['activated_key'] ) && 'Activated' === $extension['activated_key'] ? esc_html__( 'Active', 'mainwp' ) : esc_html__( 'Inactive', 'mainwp' ); ?></td>
850 <td class="right aligned"><?php echo isset( $extension['activated_key'] ) && 'Activated' === $extension['activated_key'] ? self::get_pass_html() : self::get_warning_html( self::WARNING ); // phpcs:ignore WordPress.Security.EscapeOutput ?></td>
851 <?php
852 } else {
853 ?>
854 <td></td>
855 <td></td>
856 <?php
857 }
858 ?>
859 </tr>
860 <?php
861 }
862 }
863
864 /**
865 * Renders plugins check table body.
866 *
867 * @return void
868 */
869 public static function render_plugins_check_tbody() {
870 $all_extensions = MainWP_Extensions_View::get_available_extensions();
871 $all_plugins = get_plugins();
872 foreach ( $all_plugins as $slug => $plugin ) {
873 if ( isset( $all_extensions[ dirname( $slug ) ] ) ) {
874 continue;
875 }
876 ?>
877 <tr>
878 <td><?php echo esc_html( $plugin['Name'] ); ?></td>
879 <td><?php echo esc_html( $plugin['Version'] ); ?></td>
880 <td class="right aligned"><?php echo is_plugin_active( $slug ) ? esc_html__( 'Active', 'mainwp' ) : esc_html__( 'Inactive', 'mainwp' ); ?></td>
881 </tr>
882 <?php
883 }
884 }
885
886 /**
887 * Renders MainWP system requirements check.
888 *
889 * @return void
890 */
891 public static function render_quick_setup_system_check() {
892 /**
893 * Action: mainwp_before_system_requirements_check
894 *
895 * Fires on the bottom of the System Requirements page, in Quick Setup Wizard.
896 *
897 * @since 4.1
898 */
899 do_action( 'mainwp_before_system_requirements_check' );
900 ?>
901 <table id="mainwp-quick-system-requirements-check" class="ui single line table">
902 <thead>
903 <tr>
904 <th><?php esc_html_e( 'Check', 'mainwp' ); ?></th>
905 <th><?php esc_html_e( 'Required Value', 'mainwp' ); ?></th>
906 <th><?php esc_html_e( 'Detected Value', 'mainwp' ); ?></th>
907 <th class="collapsing"><?php esc_html_e( 'Status', 'mainwp' ); ?></th>
908 </tr>
909 </thead>
910 <tbody>
911 <?php
912 self::render_row_with_description( esc_html__( 'PHP Version', 'mainwp' ), '>=', '7.4', 'get_php_version', '', '', null );
913 self::render_row_with_description( esc_html__( 'SSL Extension Enabled', 'mainwp' ), '=', true, 'get_ssl_support', '', '', null );
914 self::render_row_with_description( esc_html__( 'cURL Extension Enabled', 'mainwp' ), '=', true, 'get_curl_support', '', '', null );
915 $openssl_version = 'OpenSSL/1.1.0';
916 self::render_row_with_description(
917 'cURL SSL Version',
918 '>=',
919 $openssl_version,
920 'get_curl_ssl_version',
921 '',
922 '',
923 null,
924 'curlssl'
925 );
926
927 if ( ! MainWP_Server_Information_Handler::curlssl_compare( $openssl_version, '>=' ) ) {
928 echo "<tr class='warning'><td colspan='4'><i class='attention icon'></i>" . sprintf( esc_html__( 'Your host needs to update OpenSSL to at least version 1.1.0 which is already over 4 years old and contains patches for over 60 vulnerabilities.%1$sThese range from Denial of Service to Remote Code Execution. %2$sClick here for more information.%3$s', 'mainwp' ), '<br/>', '<a href="https://community.letsencrypt.org/t/openssl-client-compatibility-changes-for-let-s-encrypt-certificates/143816" target="_blank">', '</a>' ) . '</td></tr>';
929 }
930 self::render_row_with_description( esc_html__( 'MySQL Version', 'mainwp' ), '>=', '5.0', 'get_mysql_version', '', '', null );
931 ?>
932 </tbody>
933 </table>
934 <?php
935 /**
936 * Action: mainwp_after_system_requirements_check
937 *
938 * Fires on the bottom of the System Requirements page, in Quick Setup Wizard.
939 *
940 * @since 4.1
941 */
942 do_action( 'mainwp_after_system_requirements_check' );
943 }
944
945 /**
946 * Compares the detected MainWP Dashboard version agains the verion in WP.org.
947 *
948 * @return mixed Pass|self::get_warning_html().
949 *
950 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_mainwp_version()
951 */
952 public static function get_mainwp_version_check() {
953 $current = get_option( 'mainwp_plugin_version' );
954 $latest = MainWP_Server_Information_Handler::get_mainwp_version();
955 if ( $current === $latest ) {
956 return self::get_pass_html();
957 } else {
958 return self::get_warning_html();
959 }
960 }
961
962 /**
963 * Renders the Cron Schedule page.
964 *
965 * @return void
966 *
967 * @uses \MainWP\Dashboard\MainWP_Utility::format_timestamp()
968 * @uses \MainWP\Dashboard\MainWP_Utility::get_timestamp()
969 */
970 public static function render_cron() {
971 if ( ! mainwp_current_user_have_right( 'dashboard', 'see_server_information' ) ) {
972 mainwp_do_not_have_permissions( 'cron schedules', 'mainwp' );
973 return;
974 }
975
976 self::render_header( 'ServerInformationCron' );
977
978 $local_timestamp = MainWP_Utility::get_timestamp();
979
980 $freq = (int) get_option( 'mainwp_frequencyDailyUpdate', 2 );
981 if ( $freq <= 0 ) {
982 $freq = 1;
983 }
984 $auto_update_text = self::get_schedule_auto_update_label( $freq );
985
986 $cron_jobs = array(
987 'Check for available updates' => array( 'mainwp_updatescheck_start_last_timestamp', 'mainwp_cronupdatescheck_action', $auto_update_text ),
988 'Check for reconnect sites' => array( 'mainwp_cron_last_stats', 'mainwp_cronreconnect_action', esc_html__( 'Once hourly', 'mainwp' ), 'hourly' ),
989 'Ping childs sites' => array( 'mainwp_cron_last_ping', 'mainwp_cronpingchilds_action', esc_html__( 'Once daily', 'mainwp' ), 'daily' ),
990 );
991
992 $disableSitesMonitoring = get_option( 'mainwp_disableSitesChecking', 1 );
993 if ( ! $disableSitesMonitoring ) {
994 $cron_jobs['Child site uptime monitoring'] = array( 'mainwp_cron_checksites_last_timestamp', 'mainwp_croncheckstatus_action', esc_html__( 'Once every minute', 'mainwp' ), 'minutely' );
995 }
996
997 $disableHealthChecking = get_option( 'mainwp_disableSitesHealthMonitoring', 1 ); // disabled by default.
998 if ( ! $disableHealthChecking ) {
999 $cron_jobs['Site Health monitoring'] = array( 'mainwp_cron_checksiteshealth_last_timestamp', 'mainwp_cronsitehealthcheck_action', esc_html__( 'Once hourly', 'mainwp' ), 'hourly' );
1000 }
1001
1002 if ( get_option( 'mainwp_enableLegacyBackupFeature' ) ) {
1003 $cron_jobs['Start backups (Legacy)'] = array( 'mainwp_cron_last_backups', 'mainwp_cronbackups_action', esc_html__( 'Once hourly', 'mainwp' ), 'hourly' );
1004 $cron_jobs['Continue backups (Legacy)'] = array( 'mainwp_cron_last_backups_continue', 'mainwp_cronbackups_continue_action', esc_html__( 'Once every five minutes', 'mainwp' ), '5minutely' );
1005 }
1006
1007 /**
1008 * Action: mainwp_before_cron_jobs_table
1009 *
1010 * Renders on the top of the Cron Jobs page, before the Schedules table.
1011 *
1012 * @since 4.0
1013 */
1014 do_action( 'mainwp_before_cron_jobs_table' );
1015 ?>
1016 <div class="ui segment">
1017 <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp-cron-info-message' ) ) : ?>
1018 <div class="ui info message">
1019 <i class="close icon mainwp-notice-dismiss" notice-id="mainwp-cron-info-message"></i>
1020 <?php printf( esc_html__( 'Make sure scheduled actions are working correctly. If scheduled actions do not run normally, please review this %1$shelp document%2$s.', 'mainwp' ), '<a href="https://kb.mainwp.com/docs/scheduled-events-not-occurring/" target="_blank">', '</a> <i class="external alternate icon"></i>' ); ?>
1021 </div>
1022 <?php endif; ?>
1023 <table class="ui single line unstackable table" id="mainwp-cron-jobs-table">
1024 <thead>
1025 <tr>
1026 <th><?php esc_html_e( 'Cron Job', 'mainwp' ); ?></th>
1027 <th><?php esc_html_e( 'Hook', 'mainwp' ); ?></th>
1028 <th><?php esc_html_e( 'Schedule', 'mainwp' ); ?></th>
1029 <th><?php esc_html_e( 'Last Run', 'mainwp' ); ?></th>
1030 <th><?php esc_html_e( 'Next Run', 'mainwp' ); ?></th>
1031 </tr>
1032 </thead>
1033 <tbody>
1034 <?php
1035 $useWPCron = ( false === get_option( 'mainwp_wp_cron' ) ) || ( 1 === (int) get_option( 'mainwp_wp_cron' ) );
1036
1037 foreach ( $cron_jobs as $cron_job => $hook ) {
1038
1039 $is_auto_update_job = false;
1040 $lasttime_run = 0;
1041 if ( 'mainwp_updatescheck_start_last_timestamp' === $hook[0] ) {
1042 $update_time = MainWP_Settings::get_websites_automatic_update_time();
1043 $last_run = $update_time['last'];
1044 $next_run = $update_time['next'];
1045 $is_auto_update_job = true;
1046 } elseif ( false === get_option( $hook[0] ) ) {
1047 $last_run = esc_html__( 'Never', 'mainwp' );
1048 } else {
1049 $lasttime_run = get_option( $hook[0] );
1050 if ( $lasttime_run ) {
1051 $last_run = MainWP_Utility::format_timestamp( MainWP_Utility::get_timestamp( $lasttime_run ) );
1052 } else {
1053 $last_run = esc_html__( 'Never', 'mainwp' );
1054 }
1055 }
1056
1057 if ( $useWPCron && 'mainwp_updatescheck_start_last_timestamp' !== $hook[0] ) {
1058 $next_run = wp_next_scheduled( $hook[1] );
1059 if ( ! empty( $next_run ) ) {
1060 $next_run = MainWP_Utility::format_timestamp( MainWP_Utility::get_timestamp( $next_run ) );
1061 }
1062 }
1063
1064 if ( empty( $next_run ) || ( ! $useWPCron && ! $is_auto_update_job && isset( $hook[3] ) ) ) {
1065 $nexttime_run = self::get_schedule_next_time_to_show( $hook[3], $lasttime_run, $local_timestamp );
1066 if ( $nexttime_run < $local_timestamp + 3 * MINUTE_IN_SECONDS ) {
1067 $next_run = esc_html__( 'Any minute', 'mainwp' );
1068 } else {
1069 $next_run = MainWP_Utility::format_timestamp( MainWP_Utility::get_timestamp( $nexttime_run ) );
1070 }
1071 }
1072
1073 // phpcs:disable WordPress.Security.EscapeOutput
1074 ?>
1075 <tr>
1076 <td><?php echo $cron_job; ?></td>
1077 <td><?php echo $hook[1]; ?></td>
1078 <td><?php echo $hook[2]; ?></td>
1079 <td><?php echo esc_html( $last_run ); ?></td>
1080 <td><?php echo ! empty( $next_run ) ? esc_html( $next_run ) : ''; ?></td>
1081 </tr>
1082 <?php
1083 // phpcs:enable
1084 }
1085 /**
1086 * Action: mainwp_cron_jobs_list
1087 *
1088 * Renders as the last row of the Schedules table.
1089 *
1090 * @since 4.0
1091 */
1092 do_action( 'mainwp_cron_jobs_list' );
1093 ?>
1094 </tbody>
1095 </table>
1096 <?php
1097 $table_features = array(
1098 'searching' => 'true',
1099 'paging' => 'false',
1100 'info' => 'false',
1101 'responsive' => 'true',
1102 );
1103 /**
1104 * Filter: mainwp_cron_jobs_table_features
1105 *
1106 * Filters the Cron Schedules table features.
1107 *
1108 * @since 4.1
1109 */
1110 $table_features = apply_filters( 'mainwp_cron_jobs_table_features', $table_features );
1111 ?>
1112 <script type="text/javascript">
1113 var responsive = <?php echo esc_html( $table_features['responsive'] ); ?>;
1114 if( jQuery( window ).width() > 1140 ) {
1115 responsive = false;
1116 }
1117 jQuery( document ).ready( function() {
1118 jQuery( '#mainwp-cron-jobs-table' ).DataTable( {
1119 "searching": <?php echo esc_html( $table_features['searching'] ); ?>,
1120 "paging": <?php echo esc_html( $table_features['paging'] ); ?>,
1121 "info": <?php echo esc_html( $table_features['info'] ); ?>,
1122 "responsive": responsive,
1123 }
1124 } );
1125 </script>
1126 </div>
1127 <?php
1128
1129 /**
1130 * Action: mainwp_after_cron_jobs_table
1131 *
1132 * Renders on the bottom of the Cron Jobs page, after the Schedules table.
1133 *
1134 * @since 4.0
1135 */
1136 do_action( 'mainwp_after_cron_jobs_table' );
1137
1138 self::render_footer( 'ServerInformationCron' );
1139 }
1140
1141 /**
1142 * Get frequency auto update to show.
1143 *
1144 * @param int $freq frequency of auto update.
1145 *
1146 * @return string label of frequency.
1147 */
1148 public static function get_schedule_auto_update_label( $freq ) {
1149 $freq = intval( $freq );
1150 $text = '';
1151 switch ( $freq ) {
1152 case 1:
1153 $text = esc_html__( 'Once per day', 'mainwp' );
1154 break;
1155 case 2:
1156 $text = esc_html__( 'Twice per day', 'mainwp' );
1157 break;
1158 case 3:
1159 $text = esc_html__( 'Three times per day', 'mainwp' );
1160 break;
1161 case 4:
1162 $text = esc_html__( 'Four times per day', 'mainwp' );
1163 break;
1164 case 5:
1165 $text = esc_html__( 'Five times per day', 'mainwp' );
1166 break;
1167 case 6:
1168 $text = esc_html__( 'Six times per day', 'mainwp' );
1169 break;
1170 case 7:
1171 $text = esc_html__( 'Seven times per day', 'mainwp' );
1172 break;
1173 case 8:
1174 $text = esc_html__( 'Eight times per day', 'mainwp' );
1175 break;
1176 case 9:
1177 $text = esc_html__( 'Nine times per day', 'mainwp' );
1178 break;
1179 case 10:
1180 $text = esc_html__( 'Ten times per day', 'mainwp' );
1181 break;
1182 case 11:
1183 $text = esc_html__( 'Eleven times per day', 'mainwp' );
1184 break;
1185 case 12:
1186 $text = esc_html__( 'Twelve times per day', 'mainwp' );
1187 break;
1188 }
1189 return $text;
1190 }
1191
1192 /**
1193 * Get next time of schedule job to show.
1194 *
1195 * @param string $job_freq frequency of schedule job.
1196 * @param int $lasttime_run Lasttime to run.
1197 * @param int $local_timestamp current local time.
1198 *
1199 * @return int next run time of schedule job.
1200 */
1201 public static function get_schedule_next_time_to_show( $job_freq, $lasttime_run, $local_timestamp ) {
1202 $next_time = $local_timestamp;
1203 $lasttime_run = is_numeric( $lasttime_run ) ? intval( $lasttime_run ) : false;
1204 switch ( $job_freq ) {
1205 case 'daily':
1206 $next_time = $lasttime_run ? $lasttime_run + DAY_IN_SECONDS : $local_timestamp + DAY_IN_SECONDS;
1207 break;
1208 case 'hourly':
1209 $next_time = $lasttime_run ? $lasttime_run + HOUR_IN_SECONDS : $local_timestamp + HOUR_IN_SECONDS;
1210 break;
1211 case '5minutely':
1212 $next_time = $lasttime_run ? $lasttime_run + 5 * MINUTE_IN_SECONDS : $local_timestamp + 5 * MINUTE_IN_SECONDS;
1213 break;
1214 case 'minutely':
1215 $next_time = $lasttime_run ? $lasttime_run + MINUTE_IN_SECONDS : $local_timestamp + MINUTE_IN_SECONDS;
1216 break;
1217 }
1218
1219 if ( $next_time < $local_timestamp ) { // to fix next time in past.
1220 $next_time = $local_timestamp;
1221 }
1222
1223 return $next_time;
1224 }
1225
1226 /**
1227 * Checks if the ../wp-content/uploads/mainwp/ directory is writable.
1228 *
1229 * @return bool True if writable, false if not.
1230 *
1231 * @uses \MainWP\Dashboard\MainWP_System_Utility::get_mainwp_dir()
1232 * @uses \MainWP\Dashboard\MainWP_System_Utility::get_wp_file_system()
1233 */
1234 public static function check_directory_mainwp_directory() {
1235 $dirs = MainWP_System_Utility::get_mainwp_dir();
1236 $path = $dirs[0];
1237
1238 $mess = 'Writable';
1239
1240 if ( ! is_dir( dirname( $path ) ) ) {
1241 $mess = 'Not Found';
1242 }
1243
1244 $is_writable = MainWP_System_Utility::is_writable( $path );
1245
1246 if ( $is_writable ) {
1247 $mess = 'Not Writable';
1248 }
1249
1250 $output = '<tr><td>MainWP Upload Directory</td><td>' . $mess . '</td></tr>';
1251 return $output;
1252 }
1253
1254 /**
1255 * Renders the directory check row.
1256 *
1257 * @param string $name check name.
1258 * @param string $check desired result.
1259 * @param string $result detected result.
1260 * @param bool $passed true|false check result.
1261 *
1262 * @return bool true.
1263 */
1264 public static function render_directory_row( $name, $check, $result, $passed ) {
1265 // phpcs:disable WordPress.Security.EscapeOutput
1266 ?>
1267 <tr>
1268 <td><?php echo esc_html( $name ); ?></td>
1269 <td><?php echo esc_html( $check ); ?></td>
1270 <td><?php echo esc_html( $result ); ?></td>
1271 <td class="right aligned"><?php echo ( $passed ? self::get_pass_html() : self::get_warning_html( self::ERROR ) ); ?></td>
1272 </tr>
1273 <?php
1274 // phpcs:enable
1275 return true;
1276 }
1277
1278 /**
1279 * Renders server information table row.
1280 *
1281 * @param string $config configuraion check.
1282 * @param string $compare comparison operator.
1283 * @param mixed $version reqiored minium version number.
1284 * @param mixed $getter detected version number.
1285 * @param string $extraText additionl text.
1286 * @param null $extraCompare extra compare.
1287 * @param null $extraVersion extra version.
1288 * @param null $whatType comparison type.
1289 * @param int $errorType global variable self::WARNING = 1.
1290 *
1291 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::filesize_compare()
1292 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::curlssl_compare()
1293 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_class_name()
1294 */
1295 public static function render_row( $config, $compare, $version, $getter, $extraText = '', $extraCompare = null, $extraVersion = null, $whatType = null, $errorType = self::WARNING ) {
1296 $currentVersion = call_user_func( array( MainWP_Server_Information_Handler::get_class_name(), $getter ) );
1297 // phpcs:disable WordPress.Security.EscapeOutput
1298 ?>
1299 <tr>
1300 <td><?php echo esc_html( $config ); ?></td>
1301 <td><?php echo esc_html( $compare ); ?><?php echo ( true === $version ? 'true' : ( is_array( $version ) && isset( $version['version'] ) ? esc_html( $version['version'] ) : esc_html( $version ) ) ) . ' ' . $extraText; ?></td>
1302 <td><?php echo( true === $currentVersion ? 'true' : $currentVersion ); ?></td>
1303 <?php if ( 'filesize' === $whatType ) { ?>
1304 <td class="right aligned"><?php echo ( MainWP_Server_Information_Handler::filesize_compare( $currentVersion, $version, $compare ) ? self::get_pass_html() : self::get_warning_html( $errorType ) ); ?></td>
1305 <?php } elseif ( 'get_curl_ssl_version' === $getter ) { ?>
1306 <td class="right aligned"><?php echo ( MainWP_Server_Information_Handler::curlssl_compare( $version, $compare ) ? self::get_pass_html() : self::get_warning_html( $errorType ) ); ?></td>
1307 <?php } elseif ( ( 'get_max_input_time' === $getter || 'get_max_execution_time' === $getter ) && -1 === (int) $currentVersion ) { ?>
1308 <td class="right aligned"><?php echo self::get_pass_html(); ?></td>
1309 <?php } else { ?>
1310 <td class="right aligned"><?php echo ( version_compare( $currentVersion, $version, $compare ) || ( ! empty( $extraCompare ) && version_compare( $currentVersion, $extraVersion, $extraCompare ) ) ? self::get_pass_html() : self::get_warning_html( $errorType ) ); ?></td>
1311 <?php } ?>
1312 </tr>
1313 <?php
1314 // phpcs:enable
1315 }
1316
1317 /**
1318 * Renders server information table row with description.
1319 *
1320 * @param string $config configuraion check.
1321 * @param string $compare comparison operator.
1322 * @param mixed $version reqiored minium version number.
1323 * @param mixed $getter detected version number.
1324 * @param string $extraText additionl text.
1325 * @param null $extraCompare extra compare.
1326 * @param null $extraVersion extra version.
1327 * @param null $whatType comparison type.
1328 * @param int $errorType global variable self::WARNING = 1.
1329 *
1330 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_class_name()
1331 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::filesize_compare()
1332 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::curlssl_compare()
1333 */
1334 public static function render_row_with_description( $config, $compare, $version, $getter, $extraText = '', $extraCompare = null, $extraVersion = null, $whatType = null, $errorType = self::WARNING ) {
1335 $currentVersion = call_user_func( array( MainWP_Server_Information_Handler::get_class_name(), $getter ) );
1336 // phpcs:disable WordPress.Security.EscapeOutput
1337 ?>
1338 <tr>
1339 <td><?php echo esc_html( $config ); ?></td>
1340 <td><?php echo esc_html( $compare ); ?> <?php echo ( true === $version ? 'true' : ( is_array( $version ) && isset( $version['version'] ) ? esc_html( $version['version'] ) : esc_html( $version ) ) ) . ' ' . $extraText; ?></td>
1341 <td><?php echo ( true === $currentVersion ? 'true' : $currentVersion ); ?></td>
1342 <?php if ( 'filesize' === $whatType ) { ?>
1343 <td class="right aligned"><?php echo ( MainWP_Server_Information_Handler::filesize_compare( $currentVersion, $version, $compare ) ? self::get_pass_html() : self::get_warning_html( $errorType ) ); ?></td>
1344 <?php } elseif ( 'get_curl_ssl_version' === $getter ) { ?>
1345 <td class="right aligned"><?php echo ( MainWP_Server_Information_Handler::curlssl_compare( $version, $compare ) ? self::get_pass_html() : self::get_warning_html( $errorType ) ); ?></td>
1346 <?php } elseif ( 'get_max_input_time' === $getter && -1 === (int) $currentVersion ) { ?>
1347 <td class="right aligned"><?php echo self::get_pass_html(); ?></td>
1348 <?php } else { ?>
1349 <td class="right aligned"><?php echo( version_compare( $currentVersion, $version, $compare ) || ( ! empty( $extraCompare ) && version_compare( $currentVersion, $extraVersion, $extraCompare ) ) ? self::get_pass_html() : self::get_warning_html( $errorType ) ); ?></td>
1350 <?php } ?>
1351 </tr>
1352 <?php
1353 // phpcs:enable
1354 }
1355
1356 /**
1357 * Checks if file system method is direct.
1358 *
1359 * @return mixed html|self::get_warning_html().
1360 *
1361 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_file_system_method()
1362 */
1363 public static function get_file_system_method_check() {
1364 $fsmethod = MainWP_Server_Information_Handler::get_file_system_method();
1365 if ( 'direct' === $fsmethod ) {
1366 return self::get_pass_html();
1367 } else {
1368 return self::get_warning_html();
1369 }
1370 }
1371
1372 /**
1373 * Renders Error Log page.
1374 *
1375 * Plugin-Name: Error Log Dashboard Widget
1376 * Plugin URI: http://wordpress.org/extend/plugins/error-log-dashboard-widget/
1377 * Description: Robust zero-configuration and low-memory way to keep an eye on error log.
1378 * Author: Andrey "Rarst" Savchenko
1379 * Author URI: http://www.rarst.net/
1380 * Version: 1.0.2
1381 * License: GPLv2 or later
1382
1383 * Includes last_lines() function by phant0m, licensed under cc-wiki and GPLv2+
1384 */
1385 public static function render_error_log_page() {
1386 if ( ! mainwp_current_user_have_right( 'dashboard', 'see_server_information' ) ) {
1387 mainwp_do_not_have_permissions( 'error log', 'mainwp' );
1388 return;
1389 }
1390 self::render_header( 'ErrorLog' );
1391
1392 /**
1393 * Action: mainwp_before_error_log_table
1394 *
1395 * Fires before the Error Log table.
1396 *
1397 * @since 4.1
1398 */
1399 do_action( 'mainwp_before_error_log_table' );
1400 ?>
1401 <div class="ui segment">
1402 <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp-error-log-info-message' ) ) : ?>
1403 <div class="ui info message">
1404 <i class="close icon mainwp-notice-dismiss" notice-id="mainwp-error-log-info-message"></i>
1405 <?php echo esc_html__( 'See the WordPress error log to fix problems that arise on your MainWP Dashboard site.', 'mainwp' ); ?>
1406 </div>
1407 <?php endif; ?>
1408 <table class="ui unstackable table" id="mainwp-error-log-table">
1409 <thead>
1410 <tr>
1411 <th><?php esc_html_e( 'Time', 'mainwp' ); ?></th>
1412 <th><?php esc_html_e( 'Error', 'mainwp' ); ?></th>
1413 </tr>
1414 </thead>
1415 <tbody>
1416 <?php self::render_error_log(); ?>
1417 </tbody>
1418 </table>
1419 <script type="text/javascript">
1420 var responsive = true;
1421 if( jQuery( window ).width() > 1140 ) {
1422 responsive = false;
1423 }
1424 jQuery( document ).ready( function() {
1425 jQuery( '#mainwp-error-log-table' ).DataTable( {
1426 "responsive": responsive,
1427 "ordering": false,
1428 "stateSave": true,
1429 "stateDuration": 0,
1430 "lengthMenu": [ [10, 25, 50, 100, -1], [10, 25, 50, 100, "All"] ],
1431 } );
1432 } );
1433 </script>
1434 </div>
1435 <?php
1436 /**
1437 * Action: mainwp_after_error_log_table
1438 *
1439 * Fires after the Error Log table.
1440 *
1441 * @since 4.1
1442 */
1443 do_action( 'mainwp_after_error_log_table' );
1444
1445 self::render_footer( 'ErrorLog' );
1446 }
1447
1448 /**
1449 * Renders error log page.
1450 *
1451 * @return void
1452 *
1453 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::last_lines()
1454 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::get_class_name()
1455 */
1456 public static function render_error_log() {
1457 $tbody = '';
1458 $log_errors = ini_get( 'log_errors' );
1459 if ( ! $log_errors ) {
1460 echo '<tr><td colspan="2">' . esc_html__( 'Error logging disabled.', 'mainwp' );
1461 echo '<br/>' . sprintf( esc_html__( 'To enable error logging, please check this %1$shelp document%2$s.', 'mainwp' ), '<a href="https://codex.wordpress.org/Debugging_in_WordPress" target="_blank">', '</a>' );
1462 echo '</td></tr>';
1463 }
1464
1465 $error_log = ini_get( 'error_log' );
1466 /**
1467 * Filter: error_log_mainwp_logs
1468 *
1469 * Filters the error log files to show.
1470 *
1471 * @since Unknown
1472 */
1473 $logs = apply_filters( 'error_log_mainwp_logs', array( $error_log ) );
1474
1475 /**
1476 * Filter: error_log_mainwp_lines
1477 *
1478 * Limits the number of error log records to be displayed. Default value, 50.
1479 *
1480 * @since Unknown
1481 */
1482 $count = apply_filters( 'error_log_mainwp_lines', 100 );
1483 $lines = array();
1484
1485 foreach ( $logs as $log ) {
1486 if ( is_readable( $log ) ) {
1487 $lines = array_merge( $lines, MainWP_Server_Information_Handler::last_lines( $log, $count ) );
1488 }
1489 }
1490
1491 $lines = array_map( 'trim', $lines );
1492 $lines = array_filter( $lines );
1493
1494 if ( empty( $lines ) ) {
1495
1496 echo '<tr><td colspan="2">' . esc_html__( 'MainWP is unable to find your error logs, please contact your host for server error logs.', 'mainwp' ) . '</td></tr>';
1497
1498 return;
1499 }
1500
1501 foreach ( $lines as $key => $line ) {
1502 if ( false !== strpos( $line, ']' ) ) {
1503 list( $time, $error ) = explode( ']', $line, 2 );
1504 } else {
1505 list( $time, $error ) = array( '', $line );
1506 }
1507 $time = trim( $time, '[]' );
1508 $error = trim( $error );
1509 $lines[ $key ] = compact( 'time', 'error' );
1510 }
1511
1512 if ( 1 < count( $lines ) ) {
1513 // phpcs:ignore -- ok.
1514 //uasort( $lines, array( MainWP_Server_Information_Handler::get_class_name(), 'time_compare' ) );
1515 $lines = array_slice( $lines, 0, $count );
1516 }
1517
1518 // phpcs:disable WordPress.Security.EscapeOutput
1519 foreach ( $lines as $line ) {
1520 $error = esc_html( $line['error'] );
1521 $time = esc_html( $line['time'] );
1522 if ( ! empty( $error ) ) {
1523 echo '<tr><td>' . $time . '</td><td>' . $error . '</td></tr>';
1524 }
1525 }
1526 // phpcs:enable
1527 }
1528
1529 /**
1530 * Renders the WP Config page.
1531 *
1532 * @return void
1533 */
1534 public static function render_wp_config() {
1535 if ( ! mainwp_current_user_have_right( 'dashboard', 'see_server_information' ) ) {
1536 mainwp_do_not_have_permissions( 'WP-Config.php', 'mainwp' );
1537 return;
1538 }
1539
1540 self::render_header( 'WPConfig' );
1541 /**
1542 * Action: mainwp_before_wp_config_section
1543 *
1544 * Fires before the WP Config section.
1545 *
1546 * @since 4.1
1547 */
1548 do_action( 'mainwp_before_wp_config_section' );
1549 ?>
1550 <div id="mainwp-show-wp-config">
1551 <?php
1552 if ( false !== strpos( ini_get( 'disable_functions' ), 'show_source' ) ) {
1553 esc_html_e( 'File content could not be displayed.', 'mainwp' );
1554 echo '<br />';
1555 esc_html_e( 'It appears that the show_source() PHP function has been disabled on the servre.', 'mainwp' );
1556 echo '<br />';
1557 esc_html_e( 'Please, contact your host support and have them enable the show_source() function for the proper functioning of this feature.', 'mainwp' );
1558 } elseif ( file_exists( ABSPATH . 'wp-config.php' ) ) {
1559 show_source( ABSPATH . 'wp-config.php' );
1560 } else {
1561 $files = get_included_files();
1562 $configFound = false;
1563 if ( is_array( $files ) ) {
1564 foreach ( $files as $file ) {
1565 if ( stristr( $file, 'wp-config.php' ) ) {
1566 $configFound = true;
1567 show_source( $file );
1568 break;
1569 }
1570 }
1571 }
1572 if ( ! $configFound ) {
1573 esc_html_e( 'wp-config.php not found', 'mainwp' );
1574 }
1575 }
1576 ?>
1577 </div>
1578 <?php
1579 /**
1580 * Action: mainwp_after_wp_config_section
1581 *
1582 * Fires after the WP Config section.
1583 *
1584 * @since 4.1
1585 */
1586 do_action( 'mainwp_after_wp_config_section' );
1587
1588 self::render_footer( 'WPConfig' );
1589 }
1590
1591 /**
1592 * Renders action logs page.
1593 *
1594 * @uses \MainWP\Dashboard\MainWP_Logger
1595 * @uses \MainWP\Dashboard\MainWP_Logger::clear_log()
1596 * @uses \MainWP\Dashboard\MainWP_Utility::update_option()
1597 */
1598 public static function render_action_logs() { // phpcs:ignore -- Current complexity is the only way to achieve desired results, pull request solutions appreciated.
1599 self::render_header( 'ActionLogs' );
1600
1601 if ( isset( $_REQUEST['actionlogs_status'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
1602 $act_log = isset( $_REQUEST['actionlogs_status'] ) ? wp_unslash( $_REQUEST['actionlogs_status'] ) : MainWP_Logger::DISABLED; // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
1603 $spec_log = 0;
1604 if ( is_string( $act_log ) && false !== strpos( $act_log, 'specific_' ) ) {
1605 $act_log = str_replace( 'specific_', '', $act_log );
1606 $spec_log = 1;
1607 }
1608
1609 $act_log = intval( $act_log );
1610
1611 MainWP_Utility::update_option( 'mainwp_specific_logs', $spec_log );
1612
1613 MainWP_Logger::instance()->log_action( 'Action logs set to: ' . MainWP_Logger::instance()->get_log_text( $act_log ), ( $spec_log ? $act_log : MainWP_Logger::LOG ), 2, true );
1614
1615 if ( MainWP_Logger::DISABLED === $act_log ) {
1616 MainWP_Logger::instance()->set_log_priority( $act_log, $spec_log );
1617 }
1618
1619 MainWP_Utility::update_option( 'mainwp_actionlogs', $act_log );
1620 MainWP_Utility::update_option( 'mainwp_actionlogs_enabled_timestamp', time() );
1621 }
1622
1623 if ( isset( $_REQUEST['actionlogs_clear'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
1624 $log_to_db = apply_filters( 'mainwp_logger_to_db', true );
1625 if ( $log_to_db ) {
1626 MainWP_Logger::instance()->clear_log_db();
1627 } else {
1628 MainWP_Logger::instance()->clear_log();
1629 }
1630 }
1631
1632 $enabled = (int) MainWP_Logger::instance()->get_log_status();
1633 $specific_default = array(
1634 MainWP_Logger::UPDATE_CHECK_LOG_PRIORITY => esc_html__( 'Update Checking', 'mainwp' ),
1635 MainWP_Logger::EXECUTION_TIME_LOG_PRIORITY => esc_html__( 'Execution time', 'mainwp' ),
1636 MainWP_Logger::LOGS_AUTO_PURGE_LOG_PRIORITY => esc_html__( 'Logs Auto Purge', 'mainwp' ),
1637 );
1638 $specific_logs = apply_filters( 'mainwp_specific_action_logs', $specific_default ); // deprecated since 4.3.1, use 'mainwp_log_specific_actions' instead.
1639 $specific_logs = apply_filters( 'mainwp_log_specific_actions', $specific_logs );
1640
1641 ?>
1642 <div class="mainwp-sub-header">
1643 <div class="ui mini form two column stackable grid">
1644 <div class="column">
1645 <form method="POST" action="">
1646 <?php wp_nonce_field( 'mainwp-admin-nonce' ); ?>
1647 <?php // phpcs:disable WordPress.Security.EscapeOutput ?>
1648 <select name="actionlogs_status" class="ui mini dropdown">
1649 <option value="<?php echo MainWP_Logger::DISABLED; ?>" <?php echo ( MainWP_Logger::DISABLED === $enabled ? 'selected' : '' ); ?>>
1650 <?php esc_html_e( 'Disabled', 'mainwp' ); ?>
1651 </option>
1652 <option value="<?php echo MainWP_Logger::INFO; ?>" <?php echo ( MainWP_Logger::INFO === $enabled ? 'selected' : '' ); ?>>
1653 <?php esc_html_e( 'Info', 'mainwp' ); ?>
1654 </option>
1655 <option value="<?php echo MainWP_Logger::WARNING; ?>" <?php echo ( MainWP_Logger::WARNING === $enabled ? 'selected' : '' ); ?>>
1656 <?php esc_html_e( 'Warning', 'mainwp' ); ?>
1657 </option>
1658 <option value="<?php echo MainWP_Logger::DEBUG; ?>" <?php echo ( MainWP_Logger::DEBUG === $enabled ? 'selected' : '' ); ?>>
1659 <?php esc_html_e( 'Debug', 'mainwp' ); ?>
1660 </option>
1661 <?php
1662 // phpcs:enable
1663 if ( is_array( $specific_logs ) && ! empty( $specific_logs ) ) {
1664 foreach ( $specific_logs as $spec_log => $spec_title ) {
1665 ?>
1666 <option value="specific_<?php echo intval( $spec_log ); ?>" <?php echo ( (int) $spec_log === (int) $enabled ? 'selected' : '' ); ?>>
1667 <?php echo esc_html( $spec_title ); ?>
1668 </option>
1669 <?php
1670 }
1671 }
1672 ?>
1673 </select>
1674 <input type="submit" class="ui green mini button" value="<?php esc_attr_e( 'Save Settings', 'mainwp' ); ?>" />
1675 <input type="submit" class="ui mini button" name="actionlogs_clear" value="<?php esc_attr_e( 'Delete Log', 'mainwp' ); ?>" />
1676 </form>
1677 </div>
1678 <div class="column">
1679
1680 </div>
1681 </div>
1682 </div>
1683 <div class="ui segment">
1684 <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp-action-logs-info-message' ) ) : ?>
1685 <div class="ui info message">
1686 <i class="close icon mainwp-notice-dismiss" notice-id="mainwp-action-logs-info-message"></i>
1687 <div><?php echo esc_html__( 'Enable a specific logging system.', 'mainwp' ); ?></div>
1688 <p><?php echo esc_html__( 'Each specific log type changes only the type of information logged. It does not change the log view.', 'mainwp' ); ?></p>
1689 <p><?php echo esc_html__( 'After disabling the Action Log, logs will still be visible. To remove records, click the Delete Logs button.', 'mainwp' ); ?></p>
1690 <p><?php printf( esc_html__( 'For additional help, please review this %1$shelp document%2$s.', 'mainwp' ), '<a href="https://kb.mainwp.com/docs/action-logs/" target="_blank">', '</a> <i class="external alternate icon"></i>' ); ?></p>
1691 </div>
1692 <?php endif; ?>
1693 <?php
1694 $log_to_db = apply_filters( 'mainwp_logger_to_db', true );
1695 if ( $log_to_db ) {
1696 return MainWP_Logger::instance()->show_log_db();
1697 } else {
1698 MainWP_Logger::instance()->show_log_file();
1699 }
1700 ?>
1701 </div>
1702 <?php
1703 self::render_footer( 'ActionLogs' );
1704 }
1705
1706 /**
1707 * Renders the Plugin Privacy page.
1708 *
1709 * @return void
1710 */
1711 public static function render_plugin_privacy_page() {
1712
1713 self::render_header( 'PluginPrivacy' );
1714 /**
1715 * Action: mainwp_before_plugin_privacy_section
1716 *
1717 * Fires before the Plugin Privacy section.
1718 *
1719 * @since 4.2
1720 */
1721 do_action( 'mainwp_before_plugin_privacy_section' );
1722 ?>
1723 <div class="ui segment">
1724 <div id="mainwp-plugin-privacy">
1725 <h2 class="ui header">
1726 <?php echo esc_html__( 'MainWP Dashboard Plugin Privacy Policy', 'mainwp' ); ?>
1727 <div class="sub header"><em><?php echo esc_html__( 'Last updated: April 14, 2022', 'mainwp' ); ?></em></div>
1728 </h2>
1729 <p><?php echo esc_html__( 'We value your privacy very highly. Please read this Privacy Policy carefully before using the MainWP Dashboard Plugin ("Plugin") operated by Sick Marketing, LLC d/b/a MainWP, a Limited Liability Company formed in Nevada, United States ("us","we","our") as this Privacy Policy contains important information regarding your privacy.', 'mainwp' ); ?></p>
1730 <p><?php echo esc_html__( 'Your access to and use of the Plugin is conditional upon your acceptance of and compliance with this Privacy Policy. This Privacy Policy applies to everyone accessing or using the Plugin.', 'mainwp' ); ?></p>
1731 <p><?php echo esc_html__( 'By accessing or using the Plugin, you agree to be bound by this Privacy Policy. If you disagree with any part of this Privacy Policy, then you do not have our permission to access or use the Plugin.', 'mainwp' ); ?></p>
1732 <h3 class="ui header"><?php echo esc_html__( 'What personal data we collect', 'mainwp' ); ?></h3>
1733 <p><?php echo esc_html__( 'We do not collect, store, nor process any personal data through this Plugin.', 'mainwp' ); ?></p>
1734 <h3 class="ui header"><?php echo esc_html__( 'Third-party extensions and integrations', 'mainwp' ); ?></h3>
1735 <p><?php echo esc_html__( 'This Plugin may be used with extensions that are operated by parties other than us. We may also provide extensions that have integrations with third party services. We do not control such extensions and integrations and are not responsible for their contents or the privacy or other practices of such extensions or integrations. Further, it is up to you to take precautions to ensure that whatever extensions or integrations you use adequately protect your privacy. Please review the Privacy Policies of such extensions or integrations before using them.', 'mainwp' ); ?></p>
1736 <div class="ui hidden divider"></div>
1737 <div class="ui two columns stackable grid">
1738 <div class="column">
1739 <h3 class="ui header"><?php echo esc_html__( 'Our contact information', 'mainwp' ); ?></h3>
1740 <p><?php echo esc_html__( 'If you have any questions regarding our privacy practices, please do not hesitate to contact us at the following:', 'mainwp' ); ?></p>
1741 <div class="ui list">
1742 <div class="item"><?php echo esc_html__( 'Sick Marketing, LLC d/b/a MainWP', 'mainwp' ); ?></div>
1743 <div class="item"><?php echo esc_html__( '[email protected]', 'mainwp' ); ?></div>
1744 <div class="item"><?php echo esc_html__( '4730 S. Fort Apache Road', 'mainwp' ); ?></div>
1745 <div class="item"><?php echo esc_html__( 'Suite 300', 'mainwp' ); ?></div>
1746 <div class="item"><?php echo esc_html__( 'PO Box 27740', 'mainwp' ); ?></div>
1747 <div class="item"><?php echo esc_html__( 'Las Vegas, NV 89126', 'mainwp' ); ?></div>
1748 <div class="item"><?php echo esc_html__( 'United States', 'mainwp' ); ?></div>
1749 </div>
1750 </div>
1751 <div class="column">
1752 <h3 class="ui header"><?php echo esc_html__( 'Our representative\'s contact information', 'mainwp' ); ?></h3>
1753 <p><?php echo esc_html__( 'If you are a resident of the European Union or the European Economic Area, you may also contact our representative at the following:', 'mainwp' ); ?></p>
1754 <div class="item"><?php echo esc_html__( 'Ametros Ltd', 'mainwp' ); ?></div>
1755 <div class="item"><?php echo esc_html__( 'Unit 3D', 'mainwp' ); ?></div>
1756 <div class="item"><?php echo esc_html__( 'North Point House', 'mainwp' ); ?></div>
1757 <div class="item"><?php echo esc_html__( 'North Point Business Park', 'mainwp' ); ?></div>
1758 <div class="item"><?php echo esc_html__( 'New Mallow Road', 'mainwp' ); ?></div>
1759 <div class="item"><?php echo esc_html__( 'Cork', 'mainwp' ); ?></div>
1760 <div class="item"><?php echo esc_html__( 'Ireland', 'mainwp' ); ?></div>
1761 <div class="ui hidden divider"></div>
1762 <p><?php echo esc_html__( 'If you are a resident of the United Kingdom, you may contact our representative at the following:', 'mainwp' ); ?></p>
1763 <div class="item"><?php echo esc_html__( 'Ametros Group Ltd', 'mainwp' ); ?></div>
1764 <div class="item"><?php echo esc_html__( 'Lakeside Offices', 'mainwp' ); ?></div>
1765 <div class="item"><?php echo esc_html__( 'Thorn Business Park', 'mainwp' ); ?></div>
1766 <div class="item"><?php echo esc_html__( 'Hereford', 'mainwp' ); ?></div>
1767 <div class="item"><?php echo esc_html__( 'Herefordshire', 'mainwp' ); ?></div>
1768 <div class="item"><?php echo esc_html__( 'HR2 6JT', 'mainwp' ); ?></div>
1769 <div class="item"><?php echo esc_html__( 'England', 'mainwp' ); ?></div>
1770 </div>
1771 </div>
1772 <div class="ui divider"></div>
1773 </div>
1774
1775 <a href="<?php echo esc_url( get_site_url() ) . '/wp-content/plugins/mainwp/privacy-policy.txt'; ?>" class="ui green basic button" target="_blank"><?php echo esc_html__( 'Download MainWP Dashboard Privacy Policy', 'mainwp' ); ?></a> <a href="<?php echo esc_url( get_site_url() ) . '/wp-content/plugins/mainwp/mainwp-child-privacy-policy.txt'; ?>" class="ui green basic button" target="_blank"><?php echo esc_html__( 'Download MainWP Child Privacy Policy', 'mainwp' ); ?></a>
1776 </div>
1777
1778 <?php
1779 /**
1780 * Action: mainwp_after_plugin_privacy_section
1781 *
1782 * Fires after the Plugin Privacy section.
1783 *
1784 * @since 4.2
1785 */
1786 do_action( 'mainwp_after_plugin_privacy_section' );
1787
1788 self::render_footer( 'PluginPrivacy' );
1789 }
1790
1791 /**
1792 * Renders .htaccess File page.
1793 *
1794 * @return void
1795 */
1796 public static function render_htaccess() {
1797 if ( ! mainwp_current_user_have_right( 'dashboard', 'see_server_information' ) ) {
1798 mainwp_do_not_have_permissions( '.htaccess', 'mainwp' );
1799 return;
1800 }
1801 self::render_header( '.htaccess' );
1802 /**
1803 * Action: mainwp_before_htaccess_section
1804 *
1805 * Fires before the .htaccess file section.
1806 *
1807 * @since 4.1
1808 */
1809 do_action( 'mainwp_before_htaccess_section' );
1810 ?>
1811 <div id="mainwp-show-htaccess">
1812 <?php
1813 if ( false !== strpos( ini_get( 'disable_functions' ), 'show_source' ) ) {
1814 esc_html_e( 'File content could not be displayed.', 'mainwp' );
1815 echo '<br />';
1816 esc_html_e( 'It appears that the show_source() PHP function has been disabled on the servre.', 'mainwp' );
1817 echo '<br />';
1818 esc_html_e( 'Please, contact your host support and have them enable the show_source() function for the proper functioning of this feature.', 'mainwp' );
1819 } else {
1820 show_source( ABSPATH . '.htaccess' );
1821 }
1822 ?>
1823 </div>
1824 <?php
1825 /**
1826 * Action: mainwp_after_htaccess_section
1827 *
1828 * Fires after the .htaccess file section.
1829 *
1830 * @since 4.1
1831 */
1832 do_action( 'mainwp_after_htaccess_section' );
1833 self::render_footer( '.htaccess' );
1834 }
1835
1836 /**
1837 * Checks for disable PHP Functions.
1838 *
1839 * @return void
1840 */
1841 public static function php_disabled_functions() {
1842 $disabled_functions = ini_get( 'disable_functions' );
1843 if ( '' !== $disabled_functions ) {
1844 $arr = explode( ',', $disabled_functions );
1845 sort( $arr );
1846 $_count = count( $arr );
1847 for ( $i = 0; $i < $_count; $i++ ) {
1848 echo esc_html( $arr[ $i ] ) . ', ';
1849 }
1850 } else {
1851 esc_html_e( 'No functions disabled.', 'mainwp' );
1852 }
1853 }
1854
1855 /**
1856 * Renders MainWP Settings 'Options'.
1857 *
1858 * @return void
1859 *
1860 * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::mainwp_options()
1861 */
1862 public static function display_mainwp_options() {
1863 $options = MainWP_Server_Information_Handler::mainwp_options();
1864 // phpcs:disable WordPress.Security.EscapeOutput
1865 foreach ( $options as $option ) {
1866 echo '<tr><td>' . $option['label'] . '</td><td>' . $option['value'] . '</td></tr>';
1867 }
1868 // phpcs:enable
1869 }
1870
1871 /**
1872 * Renders PHP Warning HTML.
1873 *
1874 * @param int $errorType Global variable self::WARNING = 1.
1875 *
1876 * @return string PHP Warning html.
1877 */
1878 private static function get_warning_html( $errorType = self::WARNING ) {
1879 if ( self::WARNING === $errorType ) {
1880 return '<i class="large yellow exclamation icon"></i><span style="display:none">' . esc_html__( 'Warning', 'mainwp' ) . '</span>';
1881 }
1882 return '<i class="large red times icon"></i><span style="display:none">' . esc_html__( 'Fail', 'mainwp' ) . '</span>';
1883 }
1884
1885 /**
1886 * Renders PHP Pass HTML.
1887 *
1888 * @return string PHP Pass html.
1889 */
1890 private static function get_pass_html() {
1891 return '<i class="large green check icon"></i><span style="display:none">' . esc_html__( 'Pass', 'mainwp' ) . '</span>';
1892 }
1893 }
1894