' . esc_html__( 'Info', 'mainwp' ) . '', 'read', 'ServerInformation', array( static::get_class_name(), 'render', ) ); if ( ! MainWP_Menu::is_disable_menu_item( 3, 'ServerInformationCron' ) ) { add_submenu_page( 'mainwp_tab', __( 'Cron Schedules', 'mainwp' ), '
' . esc_html__( 'Cron Schedules', 'mainwp' ) . '
', 'read', 'ServerInformationCron', array( static::get_class_name(), 'render_cron', ) ); } if ( ! MainWP_Menu::is_disable_menu_item( 3, 'ErrorLog' ) ) { add_submenu_page( 'mainwp_tab', __( 'Error Log', 'mainwp' ), '
' . esc_html__( 'Error Log', 'mainwp' ) . '
', 'read', 'ErrorLog', array( static::get_class_name(), 'render_error_log_page', ) ); } if ( ! MainWP_Menu::is_disable_menu_item( 3, 'WPConfig' ) ) { add_submenu_page( 'mainwp_tab', __( 'WP-Config File', 'mainwp' ), '
' . esc_html__( 'WP-Config File', 'mainwp' ) . '
', 'read', 'WPConfig', array( static::get_class_name(), 'render_wp_config', ) ); } if ( ! MainWP_Menu::is_disable_menu_item( 3, '.htaccess' ) && MainWP_Server_Information_Handler::is_apache_server_software() ) { add_submenu_page( 'mainwp_tab', __( '.htaccess File', 'mainwp' ), '
' . esc_html__( '.htaccess File', 'mainwp' ) . '
', 'read', '.htaccess', array( static::get_class_name(), 'render_htaccess', ) ); } if ( ! MainWP_Menu::is_disable_menu_item( 3, 'ActionLogs' ) ) { add_submenu_page( 'mainwp_tab', __( 'Custom Event Monitor', 'mainwp' ), '
' . esc_html__( 'Custom Event Monitor', 'mainwp' ) . '
', 'read', 'ActionLogs', array( static::get_class_name(), 'render_action_logs', ) ); } if ( ! MainWP_Menu::is_disable_menu_item( 3, 'PluginPrivacy' ) ) { add_submenu_page( 'mainwp_tab', __( 'Plugin Privacy', 'mainwp' ), '
' . esc_html__( 'Plugin Privacy', 'mainwp' ) . '
', 'read', 'PluginPrivacy', array( static::get_class_name(), 'render_plugin_privacy_page', ) ); } /** * Filter mainwp_getsubpages_server * * Filters subpages for the Info page. * * @since Unknown */ $sub_pages = apply_filters_deprecated( 'mainwp-getsubpages-server', array( array() ), '4.0.7.2', 'mainwp_getsubpages_server' ); // NOSONAR - not IP. static::$subPages = apply_filters( 'mainwp_getsubpages_server', $sub_pages ); if ( isset( static::$subPages ) && is_array( static::$subPages ) ) { foreach ( static::$subPages as $subPage ) { if ( ! isset( $subPage['slug'] ) ) { continue; } if ( MainWP_Menu::is_disable_menu_item( 3, 'Server' . $subPage['slug'] ) ) { continue; } add_submenu_page( 'mainwp_tab', $subPage['title'], '
' . $subPage['title'] . '
', 'read', 'Server' . $subPage['slug'], $subPage['callback'] ); } } } /** * Renders Sub Pages Menu. * * @uses \MainWP\Dashboard\MainWP_Menu::is_disable_menu_item() * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::is_apache_server_software() */ public static function init_subpages_menu() { // phpcs:ignore -- NOSONAR - complex. ?> esc_html__( 'Info', 'mainwp' ), 'parent_key' => 'mainwp_tab', 'slug' => 'ServerInformation', 'href' => 'admin.php?page=ServerInformation', 'icon' => '', ), 0 ); /** * MainWP active menu slugs array. * * @global object */ global $_mainwp_menu_active_slugs; $_mainwp_menu_active_slugs['ActionLogs'] = 'ServerInformation'; $init_sub_subleftmenu = array( array( 'title' => esc_html__( 'Server', 'mainwp' ), 'parent_key' => 'ServerInformation', 'href' => 'admin.php?page=ServerInformation', 'slug' => 'ServerInformation', 'right' => '', ), array( 'title' => esc_html__( 'Cron Schedules', 'mainwp' ), 'parent_key' => 'ServerInformation', 'href' => 'admin.php?page=ServerInformationCron', 'slug' => 'ServerInformationCron', 'right' => '', ), array( 'title' => esc_html__( 'Error Log', 'mainwp' ), 'parent_key' => 'ServerInformation', 'href' => 'admin.php?page=ErrorLog', 'slug' => 'ErrorLog', 'right' => '', ), array( 'title' => esc_html__( 'Custom Event Monitor', 'mainwp' ), 'parent_key' => 'ServerInformation', 'href' => 'admin.php?page=ActionLogs', 'slug' => 'ActionLogs', 'right' => '', ), array( 'title' => esc_html__( 'Plugin Privacy', 'mainwp' ), 'parent_key' => 'mainwp_tab', 'href' => 'admin.php?page=PluginPrivacy', 'slug' => 'PluginPrivacy', 'right' => '', ), ); MainWP_Menu::init_subpages_left_menu( $subPages, $init_sub_subleftmenu, 'ServerInformation', 'Server' ); foreach ( $init_sub_subleftmenu as $item ) { if ( MainWP_Menu::is_disable_menu_item( 3, $item['slug'] ) ) { continue; } MainWP_Menu::add_left_menu( $item, 2 ); } } /** * Renders Info header. * * @param string $shownPage Current page. * * @uses \MainWP\Dashboard\MainWP_Menu::is_disable_menu_item() * @uses \MainWP\Dashboard\MainWP_UI::render_top_header() * @uses \MainWP\Dashboard\MainWP_UI::render_page_navigation() * @uses \MainWP\Dashboard\MainWP_Server_Information_Handler::is_apache_server_software() */ public static function render_header( $shownPage = '' ) { $params = array( 'title' => esc_html__( 'Info', 'mainwp' ), ); MainWP_UI::render_top_header( $params ); $renderItems = array(); $renderItems[] = array( 'title' => esc_html__( 'Server', 'mainwp' ), 'href' => 'admin.php?page=ServerInformation', 'active' => ( '' === $shownPage ) ? true : false, ); if ( ! MainWP_Menu::is_disable_menu_item( 3, 'ServerInformationCron' ) ) { $renderItems[] = array( 'title' => esc_html__( 'Cron Schedules', 'mainwp' ), 'href' => 'admin.php?page=ServerInformationCron', 'active' => ( 'ServerInformationCron' === $shownPage ) ? true : false, ); } if ( ! MainWP_Menu::is_disable_menu_item( 3, 'ErrorLog' ) ) { $renderItems[] = array( 'title' => esc_html__( 'Error Log', 'mainwp' ), 'href' => 'admin.php?page=ErrorLog', 'active' => ( 'ErrorLog' === $shownPage ) ? true : false, ); } if ( ! MainWP_Menu::is_disable_menu_item( 3, 'ActionLogs' ) ) { $renderItems[] = array( 'title' => esc_html__( 'Custom Event Monitor', 'mainwp' ), 'href' => 'admin.php?page=ActionLogs', 'active' => ( 'ActionLogs' === $shownPage ) ? true : false, ); } if ( isset( $_GET['page'] ) && 'PluginPrivacy' !== $_GET['page'] ) { //phpcs:ignore -- monce safe. MainWP_UI::render_page_navigation( $renderItems ); } static::render_actions_bar(); echo '
'; } /** * Renders Server Information footer. */ public static function render_footer() { echo '
'; } /** * Renders Server Information action bar element. */ public static function render_actions_bar() { if ( isset( $_GET['page'] ) && 'ServerInformation' === $_GET['page'] ) : // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized ?>
', ' ' ); ?>
=' ) ) { echo "
" . 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' ), '
', '', '' ) . '
'; } ?>
=', '6.2', 'get_wordpress_version', '', '', null, null, static::ERROR ); static::render_row( 'WordPress Memory Limit', '>=', '64M', 'get_wordpress_memory_limit', '', '', null ); static::render_row( 'MultiSite Disabled', '=', true, 'check_if_multisite', '', '', null ); ?> =', '7.4', 'get_php_version', '', '', null, null, static::ERROR ); static::render_row( 'PHP Safe Mode Disabled', '=', true, 'get_php_safe_mode', '', '', null ); static::render_row( 'PHP Max Execution Time', '>=', '30', 'get_max_execution_time', 'seconds', '=', '0' ); static::render_row( 'PHP Max Input Time', '>=', '30', 'get_max_input_time', 'seconds', '=', '0' ); static::render_row( 'PHP Memory Limit', '>=', '256M', 'get_php_memory_limit', '', '', null, 'filesize' ); static::render_row( 'PCRE Backtracking Limit', '>=', '10000', 'get_output_buffer_size', '', '', null ); static::render_row( 'PHP Upload Max Filesize', '>=', '2M', 'get_upload_max_filesize', '', '', null, 'filesize' ); static::render_row( 'PHP Post Max Size', '>=', '2M', 'get_post_max_size', '', '', null, 'filesize' ); static::render_row( 'SSL Extension Enabled', '=', true, 'get_ssl_support', '', '', null ); static::render_row( 'SSL Warnings', '=', '', 'get_ssl_warning', 'empty', '', null ); static::render_row( 'cURL Extension Enabled', '=', true, 'get_curl_support', '', '', null, null, static::ERROR ); static::render_row( 'cURL Timeout', '>=', '300', 'get_curl_timeout', 'seconds', '=', '0' ); if ( function_exists( 'curl_version' ) ) { $reuire_curl = '7.18.1'; if ( version_compare( MainWP_Server_Information_Handler::get_php_version(), '8.0.0' ) >= 0 ) { $reuire_curl = '7.29.0'; } static::render_row( 'cURL Version', '>=', $reuire_curl, 'get_curl_version', '', '', null ); $openssl_version = 'OpenSSL/1.1.0'; static::render_row( 'OpenSSL Version', '>=', $openssl_version, 'get_curl_ssl_version', '', '', null, 'curlssl' ); $wk = MainWP_Server_Information_Handler::get_openssl_working_status(); ?> OpenSSL Working Status Yes =', '5.0', 'get_mysql_version', '', '', null, null, static::ERROR ); ?> | $plugin ) { if ( isset( $all_extensions[ dirname( $slug ) ] ) ) { continue; } ?> =', '7.4', 'get_php_version', '', '', null ); static::render_row_with_description( esc_html__( 'SSL Extension Enabled', 'mainwp' ), '=', true, 'get_ssl_support', '', '', null ); static::render_row_with_description( esc_html__( 'cURL Extension Enabled', 'mainwp' ), '=', true, 'get_curl_support', '', '', null ); $ssl_version = MainWP_Server_Information_Handler::get_curl_ssl_version(); $openssl_version = 'OpenSSL/1.1.0'; if ( false !== strpos( $ssl_version, 'LibreSSL' ) ) { $openssl_version = 'LibreSSL/2.5.0'; } static::render_row_with_description( 'cURL SSL Version', '>=', $openssl_version, 'get_curl_ssl_version', '', '', null, 'curlssl' ); if ( ! MainWP_Server_Information_Handler::curlssl_compare( $openssl_version, '>=' ) ) { ?> =', '5.0', 'get_mysql_version', '', '', null ); ?>
', '', '' ); } else { printf( 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' ), '
', '', '' ); } ?>
array( 'mainwp_updatescheck_start_last_timestamp', 'mainwp_cronupdatescheck_action', $auto_update_text ), 'Check for reconnect sites' => array( 'mainwp_cron_last_stats', 'mainwp_cronreconnect_action', esc_html__( 'Once hourly', 'mainwp' ), 'hourly' ), 'Ping childs sites' => array( 'mainwp_cron_last_ping', 'mainwp_cronpingchilds_action', esc_html__( 'Once daily', 'mainwp' ), 'daily' ), ); $cron_jobs['Child site uptime monitoring'] = array( 'mainwp_uptimecheck_auto_main_counter_lasttime_started', 'mainwp_cronuptimemonitoringcheck_action', esc_html__( 'Once every minute', 'mainwp' ), 'minutely' ); $disableHealthChecking = get_option( 'mainwp_disableSitesHealthMonitoring', 1 ); // disabled by default. if ( ! $disableHealthChecking ) { $cron_jobs['Site Health monitoring'] = array( 'mainwp_cron_checksiteshealth_last_timestamp', 'mainwp_cronsitehealthcheck_action', esc_html__( 'Once hourly', 'mainwp' ), 'hourly' ); } if ( get_option( 'mainwp_enableLegacyBackupFeature' ) ) { $cron_jobs['Start backups (Legacy)'] = array( 'mainwp_cron_last_backups', 'mainwp_cronbackups_action', esc_html__( 'Once hourly', 'mainwp' ), 'hourly' ); $cron_jobs['Continue backups (Legacy)'] = array( 'mainwp_cron_last_backups_continue', 'mainwp_cronbackups_continue_action', esc_html__( 'Once every five minutes', 'mainwp' ), '5minutely' ); } $cron_jobs = apply_filters( 'mainwp_info_schedules_cron_listing', $cron_jobs ); /** * Action: mainwp_before_cron_jobs_table * * Renders on the top of the Cron Jobs page, before the Schedules table. * * @since 4.0 */ do_action( 'mainwp_before_cron_jobs_table' ); ?>
', ' ' ); ?>
$hook ) { if ( is_array( $hook ) && isset( $hook['title'] ) && isset( $hook['action'] ) ) { $job_title = $hook['title']; $job_action = $hook['action']; $job_freq = isset( $hook['frequency'] ) ? $hook['frequency'] : ''; $job_last_run = isset( $hook['last_run'] ) ? $hook['last_run'] : ''; $job_next_run = isset( $hook['next_run'] ) ? $hook['next_run'] : ''; } else { $is_auto_update_job = false; $lasttime_run = 0; $next_run = 0; if ( 'mainwp_updatescheck_start_last_timestamp' === $hook[0] ) { $update_time = MainWP_Settings::get_websites_automatic_update_time(); $last_run = $update_time['last']; $next_run = $update_time['next']; $is_auto_update_job = true; } elseif ( false === get_option( $hook[0] ) ) { $last_run = esc_html__( 'Never', 'mainwp' ); } else { $lasttime_run = get_option( $hook[0] ); if ( $lasttime_run ) { if ( 'mainwp_uptimecheck_auto_main_counter_lasttime_started' === $hook[0] ) { $last_run = MainWP_Utility::format_timestamp( $lasttime_run ); } else { $last_run = MainWP_Utility::format_timestamp( MainWP_Utility::get_timestamp( $lasttime_run ) ); } } else { $last_run = esc_html__( 'Never', 'mainwp' ); } } if ( $useWPCron && 'mainwp_updatescheck_start_last_timestamp' !== $hook[0] ) { $next_run = wp_next_scheduled( $hook[1] ); if ( ! empty( $next_run ) ) { $next_run = MainWP_Utility::format_timestamp( MainWP_Utility::get_timestamp( $next_run ) ); } } if ( empty( $next_run ) || ( ! $useWPCron && ! $is_auto_update_job && isset( $hook[3] ) ) ) { $nexttime_run = static::get_schedule_next_time_to_show( $hook[3], $lasttime_run, $local_timestamp ); if ( $nexttime_run < $local_timestamp + 3 * MINUTE_IN_SECONDS ) { $next_run = esc_html__( 'Any minute', 'mainwp' ); } else { $next_run = MainWP_Utility::format_timestamp( MainWP_Utility::get_timestamp( $nexttime_run ) ); } } $job_title = $cron_job; $job_action = $hook[1]; $job_freq = $hook[2]; $job_last_run = $last_run; $job_next_run = $next_run; } // phpcs:disable WordPress.Security.EscapeOutput ?>
'true', 'paging' => 'false', 'info' => 'false', 'responsive' => 'true', ); /** * Filter: mainwp_cron_jobs_table_features * * Filters the Cron Schedules table features. * * @since 4.1 */ $table_features = apply_filters( 'mainwp_cron_jobs_table_features', $table_features ); ?>
MainWP Upload Directory' . $mess . ''; } /** * Renders the directory check row. * * @param string $name check name. * @param string $check desired result. * @param string $result detected result. * @param bool $passed true|false check result. * * @return bool true. */ public static function render_directory_row( $name, $check, $result, $passed ) { // phpcs:disable WordPress.Security.EscapeOutput ?>
' . esc_html__( 'MainWP is unable to find your error logs, please contact your host for server error logs.', 'mainwp' ) . ''; return; } foreach ( $lines as $key => $line ) { if ( false !== strpos( $line, ']' ) ) { list( $time, $error ) = explode( ']', $line, 2 ); } else { list( $time, $error ) = array( '', $line ); } $time = trim( $time, '[]' ); $error = trim( $error ); $lines[ $key ] = compact( 'time', 'error' ); } if ( 1 < count( $lines ) ) { // phpcs:ignore -- ok. //uasort( $lines, array( MainWP_Server_Information_Handler::get_class_name(), 'time_compare' ) ); $lines = array_slice( $lines, 0, $count ); } // phpcs:disable WordPress.Security.EscapeOutput foreach ( $lines as $line ) { $error = esc_html( $line['error'] ); $time = esc_html( $line['time'] ); if ( ! empty( $error ) ) { echo '' . $time . '' . $error . ''; } } // phpcs:enable } /** * Renders the WP Config page. * * @return void */ public static function render_wp_config() { if ( ! \mainwp_current_user_can( 'dashboard', 'see_server_information' ) ) { \mainwp_do_not_have_permissions( 'WP-Config.php', 'mainwp' ); return; } static::render_header( 'WPConfig' ); /** * Action: mainwp_before_wp_config_section * * Fires before the WP Config section. * * @since 4.1 */ do_action( 'mainwp_before_wp_config_section' ); ?>
'; esc_html_e( 'It appears that the show_source() PHP function has been disabled on the servre.', 'mainwp' ); echo '
'; esc_html_e( 'Please, contact your host support and have them enable the show_source() function for the proper functioning of this feature.', 'mainwp' ); } elseif ( file_exists( ABSPATH . 'wp-config.php' ) ) { show_source( ABSPATH . 'wp-config.php' ); } else { $files = get_included_files(); $configFound = false; if ( is_array( $files ) ) { foreach ( $files as $file ) { if ( stristr( $file, 'wp-config.php' ) ) { $configFound = true; show_source( $file ); break; } } } if ( ! $configFound ) { esc_html_e( 'wp-config.php not found', 'mainwp' ); } } ?>
log_action( 'Action logs set to: ' . MainWP_Logger::instance()->get_log_text( $act_log ), ( $spec_log ? $act_log : MainWP_Logger::LOG ), 2, true ); if ( MainWP_Logger::DISABLED === $act_log ) { MainWP_Logger::instance()->set_log_priority( $act_log, $spec_log ); } MainWP_Utility::update_option( 'mainwp_actionlogs', $act_log ); MainWP_Utility::update_option( 'mainwp_actionlogs_enabled_timestamp', time() ); } if ( isset( $_REQUEST['actionlogs_clear'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized $log_to_db = apply_filters( 'mainwp_logger_to_db', true ); if ( $log_to_db ) { MainWP_Logger::instance()->clear_log_db(); } else { MainWP_Logger::instance()->clear_log(); } } $enabled = (int) MainWP_Logger::instance()->get_log_status(); $specific_default = array( MainWP_Logger::UPDATE_CHECK_LOG_PRIORITY => esc_html__( 'Update Checking', 'mainwp' ), MainWP_Logger::UPTIME_CHECK_LOG_PRIORITY => esc_html__( 'Uptime monitoring', 'mainwp' ), MainWP_Logger::UPTIME_NOTICE_LOG_PRIORITY => esc_html__( 'Uptime notification', 'mainwp' ), MainWP_Logger::LOGS_REGULAR_SCHEDULE => esc_html__( 'Regular Schedule', 'mainwp' ), MainWP_Logger::DEBUG_UPDATES_SCHEDULE => esc_html__( 'Debug updates crons', 'mainwp' ), MainWP_Logger::EXECUTION_TIME_LOG_PRIORITY => esc_html__( 'Execution time', 'mainwp' ), MainWP_Logger::LOGS_AUTO_PURGE_LOG_PRIORITY => esc_html__( 'Logs Auto Purge', 'mainwp' ), MainWP_Logger::CONNECT_LOG_PRIORITY => esc_html__( 'Dashboard Connect', 'mainwp' ), ); $specific_logs = apply_filters( 'mainwp_specific_action_logs', $specific_default ); // deprecated since 4.3.1, use 'mainwp_log_specific_actions' instead. $specific_logs = apply_filters( 'mainwp_log_specific_actions', $specific_logs ); ?>

', ' ' ); ?>

show_log_db(); } else { MainWP_Logger::instance()->show_log_file(); } ?>

'; esc_html_e( 'It appears that the show_source() PHP function has been disabled on the servre.', 'mainwp' ); echo '
'; esc_html_e( 'Please, contact your host support and have them enable the show_source() function for the proper functioning of this feature.', 'mainwp' ); } else { show_source( ABSPATH . '.htaccess' ); } ?>
' . esc_html__( 'Individual uptime monitoring is running', 'mainwp' ) . ''; } echo '' . $option['label'] . '' . $option['value'] . $addition_info . ''; } // phpcs:enable } /** * Renders PHP Warning HTML. * * @param int $errorType Global variable static::WARNING = 1. * @param bool $ech echo or return. * * @return string PHP Warning html. */ private static function get_warning_html( $errorType = self::WARNING, $ech = false ) { $msg = ''; if ( static::WARNING === $errorType ) { $msg = '' . esc_html__( 'Warning', 'mainwp' ) . ''; } else { $msg = '' . esc_html__( 'Fail', 'mainwp' ) . ''; } if ( $ech ) { echo $msg; //phpcs:ignore -- escaped. } else { return $msg; } } /** * Renders PHP Pass HTML. * * @param bool $ech echo or return. * * @return string PHP Pass html. */ private static function get_pass_html( $ech = false ) { $msg = '' . esc_html__( 'Pass', 'mainwp' ) . ''; if ( $ech ) { echo $msg; //phpcs:ignore -- escaped. } else { return $msg; } } }