| @@ -4,31 +4,133 @@ | ||
| 4 | 4 | if ( ! defined( 'ABSPATH' ) ) { |
| 5 | 5 | exit; |
| 6 | 6 | } |
| 7 | 7 | |
| 8 | -$managed = get_option( 'patchstack_managed', false ); | |
| 8 | +// Determine the active tab and account activation state. | |
| 9 | +$tabs = array( 'hardening', 'firewall', 'login', 'cookienotice', 'logs', 'license', 'multisite' ); | |
| 10 | +$active_tab = isset( $_GET['tab'] ) && in_array( $_GET['tab'], $tabs ) ? esc_attr( $_GET['tab'] ) : 'hardening'; // default active tab | |
| 11 | +$activated = ( ( isset( $_GET['activated'] ) && $_GET['activated'] == 1 ) || ( isset( $_GET['active'] ) && $_GET['active'] == 1 ) ); | |
| 12 | +$status = ( get_option( 'patchstack_license_expiry', '' ) == '' || time() >= strtotime( get_option( 'patchstack_license_expiry', '' ) ) ); | |
| 13 | +$show_settings = $this->get_option( 'patchstack_show_settings', 0 ) == 1; | |
| 14 | + | |
| 15 | +if ( ( ! $show_settings && $_GET['page'] != 'patchstack-multisite-settings' ) || ( $status && $active_tab != 'license' && $_GET['page'] != 'patchstack-multisite-settings' ) ) { | |
| 16 | + $_GET['tab'] = $active_tab = 'license'; | |
| 17 | +} | |
| 18 | + | |
| 19 | +// Determine the URL's. | |
| 20 | +$page = $_GET['page'] == 'patchstack-multisite-settings' ? 'patchstack-multisite-settings' : $this->plugin->name; | |
| 9 | 21 | ?> |
| 10 | -<div class="patchstack-content-wrap patchstack-free"> | |
| 22 | +<div class="patchstack-content-wrap<?php echo ( ! $show_settings || $this->get_option( 'patchstack_license_free', 0 ) == 1 ? ' patchstack-free' : '' ); ?>"> | |
| 11 | 23 | <div class="patchstack-top"> |
| 12 | - <div class="patchstack-top-logo"> | |
| 24 | + <div class="patchstack-top-logo" | |
| 25 | + <?php | |
| 26 | + if ( $show_settings && $this->get_option( 'patchstack_license_free', 0 ) == 1 ) { | |
| 27 | + echo ' style="float: right; width: 80%; margin-right: -15px;"'; } | |
| 28 | + ?> | |
| 29 | + > | |
| 13 | 30 | <img src="<?php echo esc_url( $this->plugin->url ); ?>assets/images/logo.svg" alt=""> |
| 14 | 31 | </div> |
| 32 | + <h1><?php echo __( 'Protect your sites from vulnerabilities', 'patchstack' ); ?></h1> | |
| 33 | + <?php | |
| 34 | + if ( $_GET['page'] != 'patchstack-multisite-settings' && $show_settings && is_multisite() ) { | |
| 35 | + $site_info = get_blog_details(); | |
| 36 | + echo "<h2 style='color:white;padding-left: 95px; margin-left: 95px;padding-top: 4px;'>" . esc_html( $site_info->domain ) . '</h2>'; | |
| 37 | + } | |
| 38 | + ?> | |
| 15 | 39 | </div> |
| 16 | 40 | |
| 17 | - <div class="patchstack-top"> | |
| 18 | - <h1 <?php echo !$managed ? 'style="display: none;"' : ''; ?>> | |
| 19 | - <?php echo wp_kses(get_option( 'patchstack_managed_text', '' ), $this->allowed_html); ?> | |
| 20 | - </h1> | |
| 21 | - </div> | |
| 41 | + <div class="patchstack-content-table"> | |
| 42 | + <?php | |
| 43 | + if ( is_multisite() && $show_settings ) { | |
| 44 | + ?> | |
| 45 | + <div class="notice notice-warning"> | |
| 46 | + <p> | |
| 47 | + <?php | |
| 48 | + if ( isset( $_GET['page'] ) && $_GET['page'] == 'patchstack-multisite-settings' ) { | |
| 49 | + _e( 'Note that because this is a multisite/network environment, this settings page will define all default settings of all sites.<br />If you would like to change the settings of a specific site, visit the administration panel of the site in question. Click <a href="' . network_admin_url( 'admin.php?page=patchstack-multisite' ) . '">here</a> for an overview of sites.', 'patchstack' ); | |
| 50 | + } else { | |
| 51 | + _e( 'Note that because this is a multisite/network environment, certain settings can only be managed by the super administrator of the WordPress network.', 'patchstack' ); | |
| 52 | + } | |
| 53 | + ?> | |
| 54 | + </p> | |
| 55 | + </div><br /> | |
| 56 | + <?php } ?> | |
| 57 | + <h2 class="nav-tab-wrapper patchstack-nav-tab-wrapper" | |
| 58 | + <?php | |
| 59 | + if ( ! $show_settings ) { | |
| 60 | + echo ' style="display: none;"'; } | |
| 61 | + ?> | |
| 62 | + > | |
| 63 | + <a href="?page=<?php echo esc_attr( $page ); ?>&tab=hardening" class="nav-tab patchstack-nav-tab <?php echo $active_tab == 'hardening' ? 'nav-tab-active patchstack-nav-tab-active' : ''; ?>"> | |
| 64 | + <span class="patchstack-icon-wrapper"><span class="patchstack-nav-tab-icon ic-services white"></span></span> | |
| 65 | + <span class="patchstack-icon-text"><?php echo __( 'Hardening', 'patchstack' ); ?><br /><span>General Security Tweaks</span></span> | |
| 66 | + </a> | |
| 22 | 67 | |
| 23 | - <div class="patchstack-content-table"> | |
| 24 | - <div class="patchstack-content-inner patchstack-premium"> | |
| 68 | + <a href="?page=<?php echo esc_attr( $page ); ?>&tab=firewall" class="nav-tab patchstack-nav-tab <?php echo $active_tab == 'firewall' ? 'nav-tab-active patchstack-nav-tab-active' : ''; ?>"> | |
| 69 | + <span class="patchstack-icon-wrapper"><span class="patchstack-nav-tab-icon ic-firewall white"></span></span> | |
| 70 | + <span class="patchstack-icon-text"><?php echo __( 'Firewall', 'patchstack' ); ?><br /><span>Whitelist & Blacklist & Firewall</span></span> | |
| 71 | + </a> | |
| 72 | + | |
| 73 | + <a href="?page=<?php echo esc_attr( $page ); ?>&tab=login" class="nav-tab patchstack-nav-tab <?php echo $active_tab == 'login' ? 'nav-tab-active patchstack-nav-tab-active' : ''; ?>"> | |
| 74 | + <span class="patchstack-icon-wrapper"><span class="patchstack-nav-tab-icon ic-login white"></span></span> | |
| 75 | + <span class="patchstack-icon-text"><?php echo __( 'Login Protection', 'patchstack' ); ?><br /><span>Protect your login page</span></span> | |
| 76 | + </a> | |
| 77 | + | |
| 78 | + <a href="?page=<?php echo esc_attr( $page ); ?>&tab=cookienotice" class="nav-tab patchstack-nav-tab <?php echo $active_tab == 'cookienotice' ? 'nav-tab-active patchstack-nav-tab-active' : ''; ?>"> | |
| 79 | + <span class="patchstack-icon-wrapper"><span class="patchstack-nav-tab-icon ic-cookies white"></span></span> | |
| 80 | + <span class="patchstack-icon-text"><?php echo __( 'Cookie Notice', 'patchstack' ); ?><br /><span>Inform your users</span></span> | |
| 81 | + </a> | |
| 82 | + | |
| 83 | + <?php if ( $page != 'patchstack-multisite-settings' ) { ?> | |
| 84 | + <a href="?page=<?php echo esc_attr( $page ); ?>&tab=logs" class="nav-tab patchstack-nav-tab <?php echo $active_tab == 'logs' ? 'nav-tab-active patchstack-nav-tab-active' : ''; ?>"> | |
| 85 | + <span class="patchstack-icon-wrapper"><span class="patchstack-nav-tab-icon ic-logs white"></span></span> | |
| 86 | + <span class="patchstack-icon-text"><?php echo __( 'Logs', 'patchstack' ); ?><br /><span>Firewall & Activity Logs</span></span> | |
| 87 | + </a> | |
| 88 | + <?php } ?> | |
| 89 | + | |
| 90 | + <?php if ( ! is_multisite() || ( isset( $_GET['page'] ) && $_GET['page'] != 'patchstack-multisite-settings' ) ) { ?> | |
| 91 | + <a href="?page=<?php echo esc_attr( $page ); ?>&tab=license" class="nav-tab patchstack-nav-tab <?php echo $active_tab == 'license' ? 'nav-tab-active patchstack-nav-tab-active' : ''; ?>"> | |
| 92 | + <span class="patchstack-icon-wrapper"><span class="patchstack-nav-tab-icon ic-license white"></span></span> | |
| 93 | + <span class="patchstack-icon-text"><?php echo __( 'License', 'patchstack' ); ?><br /><span>Your license information</span></span> | |
| 94 | + </a> | |
| 95 | + <?php } ?> | |
| 96 | + </h2> | |
| 97 | + <div class="patchstack-content-inner patchstack-active-tab-<?php echo esc_attr( $active_tab ); ?> <?php echo ! $show_settings && $this->get_option( 'patchstack_license_free', 0 ) == 0 ? 'patchstack-premium' : ''; ?>"> | |
| 25 | 98 | <?php |
| 26 | - if (isset($_GET['page']) && $_GET['page'] == 'patchstack-multisite-settings' && is_multisite()) { | |
| 27 | - require 'multisite-activation.php'; | |
| 99 | + if ( $this->get_option( 'patchstack_license_free', 0 ) == 1 ) { | |
| 100 | + require 'license-free.php'; | |
| 101 | + } else { | |
| 102 | + if ( $status && $_GET['page'] != 'patchstack-multisite-settings' ) { | |
| 103 | + require 'license.php'; | |
| 28 | 104 | } else { |
| 29 | - require 'license.php'; | |
| 105 | + $form_action = is_multisite() ? '' : 'options.php'; | |
| 106 | + switch ( $active_tab ) { | |
| 107 | + case 'hardening': | |
| 108 | + require 'hardening.php'; | |
| 109 | + break; | |
| 110 | + case 'firewall': | |
| 111 | + require 'firewall.php'; | |
| 112 | + break; | |
| 113 | + case 'login': | |
| 114 | + require 'login.php'; | |
| 115 | + break; | |
| 116 | + case 'cookienotice': | |
| 117 | + require 'cookie-notice.php'; | |
| 118 | + break; | |
| 119 | + case 'logs': | |
| 120 | + require 'logs.php'; | |
| 121 | + break; | |
| 122 | + case 'license': | |
| 123 | + require 'license.php'; | |
| 124 | + break; | |
| 125 | + case 'multisite': | |
| 126 | + require 'multisite-activation.php'; | |
| 127 | + break; | |
| 128 | + default: | |
| 129 | + break; | |
| 130 | + } | |
| 30 | 131 | } |
| 132 | + } | |
| 31 | 133 | ?> |
| 32 | 134 | </div> |
| 33 | 135 | </div> |
| 34 | -</div> | |
| 136 | +</div> | |