PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 4.6.0.1
MainWP Dashboard: Self-hosted WordPress Management for Agencies v4.6.0.1
6.2.3 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 All 156 releases
mainwp / pages / page-mainwp-server-information.php

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

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