| @@ -5,18 +5,30 @@ | ||
| 5 | 5 | exit; |
| 6 | 6 | } |
| 7 | 7 | |
| 8 | 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 ) ); | |
| 9 | +$tabs = [ 'hardening', 'firewall', 'login', 'logs', 'license', 'multisite' ]; | |
| 10 | +$active_tab = isset( $_GET['tab'] ) && in_array( $_GET['tab'], $tabs ) ? esc_attr( $_GET['tab'] ) : 'license'; // default active tab | |
| 11 | +$activated = ( ( isset( $_GET['ps_activated'] ) && $_GET['ps_activated'] == 1 ) || ( isset( $_GET['active'] ) && $_GET['active'] == 1 ) ); | |
| 12 | 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; | |
| 13 | +$show_settings = $this->get_option( 'patchstack_show_settings', 0 ) == 1 && !isset($_GET['tab']) || isset($_GET['tab']) && $_GET['tab'] != 'license'; | |
| 14 | +$is_free = $this->get_option( 'patchstack_license_free', 0 ) == 1; | |
| 15 | +$class = get_option( 'patchstack_subscription_class', '' ); | |
| 16 | +$managed = get_option( 'patchstack_managed', false ); | |
| 17 | +$managed_text = get_option( 'patchstack_managed_text', '' ); | |
| 14 | 18 | |
| 15 | 19 | if ( ( ! $show_settings && $_GET['page'] != 'patchstack-multisite-settings' ) || ( $status && $active_tab != 'license' && $_GET['page'] != 'patchstack-multisite-settings' ) ) { |
| 16 | 20 | $_GET['tab'] = $active_tab = 'license'; |
| 17 | 21 | } |
| 18 | 22 | |
| 23 | +if ( ( $is_free || ! $is_free && $status ) && $active_tab != 'license' && $_GET['page'] == 'patchstack-multisite-settings' ) { | |
| 24 | + $_GET['tab'] = $active_tab = 'multisite'; | |
| 25 | +} | |
| 26 | + | |
| 27 | +if ($active_tab == 'license') { | |
| 28 | + $show_settings = false; | |
| 29 | +} | |
| 30 | + | |
| 19 | 31 | // Determine the URL's. |
| 20 | 32 | $page = $_GET['page'] == 'patchstack-multisite-settings' ? 'patchstack-multisite-settings' : $this->plugin->name; |
| 21 | 33 | ?> |
| 22 | 34 | <div class="patchstack-content-wrap<?php echo ( ! $show_settings || $this->get_option( 'patchstack_license_free', 0 ) == 1 ? ' patchstack-free' : '' ); ?>"> |
| @@ -23,18 +35,21 @@ | ||
| 23 | 35 | <div class="patchstack-top"> |
| 24 | 36 | <div class="patchstack-top-logo" |
| 25 | 37 | <?php |
| 26 | 38 | if ( $show_settings && $this->get_option( 'patchstack_license_free', 0 ) == 1 ) { |
| 27 | - echo ' style="float: right; width: 80%; margin-right: -15px;"'; } | |
| 39 | + echo ' style="float: right; width: 80%; margin-right: -15px;"'; | |
| 40 | + } | |
| 28 | 41 | ?> |
| 29 | 42 | > |
| 30 | 43 | <img src="<?php echo esc_url( $this->plugin->url ); ?>assets/images/logo.svg" alt=""> |
| 31 | 44 | </div> |
| 32 | - <h1><?php echo __( 'Protect your sites from vulnerabilities', 'patchstack' ); ?></h1> | |
| 45 | + <h1 <?php echo $show_settings || !$managed ? 'style="display: none;"' : ''; ?>> | |
| 46 | + <?php echo $managed_text; ?> | |
| 47 | + </h1> | |
| 33 | 48 | <?php |
| 34 | 49 | if ( $_GET['page'] != 'patchstack-multisite-settings' && $show_settings && is_multisite() ) { |
| 35 | 50 | $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>'; | |
| 51 | + echo "<h2 style='color:white;padding-left: 95px; margin-top: -12px; margin-left: 150px;'>" . esc_html( $site_info->domain ) . '</h2>'; | |
| 37 | 52 | } |
| 38 | 53 | ?> |
| 39 | 54 | </div> |
| 40 | 55 | |
| @@ -39,8 +54,14 @@ | ||
| 39 | 54 | </div> |
| 40 | 55 | |
| 41 | 56 | <div class="patchstack-content-table"> |
| 42 | 57 | <?php |
| 58 | + if ($show_settings) { | |
| 59 | + echo '<div class="notice notice-error"><p>'; | |
| 60 | + _e( 'Note that this is a legacy settings page and will be inaccessible on May 1st, 2024. After this you will be required to view and manage your settings through the <a href="https://app.patchstack.com/" target="_blank">Patchstack App</a>.', 'patchstack' ); | |
| 61 | + echo '</p></div><br />'; | |
| 62 | + } | |
| 63 | + | |
| 43 | 64 | if ( is_multisite() && $show_settings ) { |
| 44 | 65 | ?> |
| 45 | 66 | <div class="notice notice-warning"> |
| 46 | 67 | <p> |
| @@ -59,32 +80,31 @@ | ||
| 59 | 80 | if ( ! $show_settings ) { |
| 60 | 81 | echo ' style="display: none;"'; } |
| 61 | 82 | ?> |
| 62 | 83 | > |
| 84 | + <?php if ( $class >= 1 || $class === '' ) { ?> | |
| 63 | 85 | <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 | 86 | <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> | |
| 87 | + <span class="patchstack-icon-text"><?php echo esc_attr__( 'Hardening', 'patchstack' ); ?><br /><span>General Security Tweaks</span></span> | |
| 66 | 88 | </a> |
| 89 | + <?php } ?> | |
| 67 | 90 | |
| 68 | 91 | <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 | 92 | <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> | |
| 93 | + <span class="patchstack-icon-text"><?php echo esc_attr__( 'Firewall', 'patchstack' ); ?><br /><span>Whitelist & Blacklist & Firewall</span></span> | |
| 71 | 94 | </a> |
| 72 | 95 | |
| 96 | + <?php if ( $class >= 1 || $class === '' ) { ?> | |
| 73 | 97 | <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 | 98 | <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> | |
| 99 | + <span class="patchstack-icon-text"><?php echo esc_attr__( 'Login Protection', 'patchstack' ); ?><br /><span>Protect your login page</span></span> | |
| 76 | 100 | </a> |
| 101 | + <?php } ?> | |
| 77 | 102 | |
| 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 | 103 | <?php if ( $page != 'patchstack-multisite-settings' ) { ?> |
| 84 | 104 | <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 | 105 | <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> | |
| 106 | + <span class="patchstack-icon-text"><?php echo esc_attr__( 'Logs', 'patchstack' ); ?><br /><span>Firewall & Activity Logs</span></span> | |
| 87 | 107 | </a> |
| 88 | 108 | <?php } ?> |
| 89 | 109 | |
| 90 | 110 | <?php if ( ! is_multisite() || ( isset( $_GET['page'] ) && $_GET['page'] != 'patchstack-multisite-settings' ) ) { ?> |
| @@ -89,17 +109,14 @@ | ||
| 89 | 109 | |
| 90 | 110 | <?php if ( ! is_multisite() || ( isset( $_GET['page'] ) && $_GET['page'] != 'patchstack-multisite-settings' ) ) { ?> |
| 91 | 111 | <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 | 112 | <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> | |
| 113 | + <span class="patchstack-icon-text"><?php echo esc_attr__( 'License', 'patchstack' ); ?><br /><span>Your license information</span></span> | |
| 94 | 114 | </a> |
| 95 | 115 | <?php } ?> |
| 96 | 116 | </h2> |
| 97 | 117 | <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' : ''; ?>"> |
| 98 | 118 | <?php |
| 99 | - if ( $this->get_option( 'patchstack_license_free', 0 ) == 1 ) { | |
| 100 | - require 'license-free.php'; | |
| 101 | - } else { | |
| 102 | 119 | if ( $status && $_GET['page'] != 'patchstack-multisite-settings' ) { |
| 103 | 120 | require 'license.php'; |
| 104 | 121 | } else { |
| 105 | 122 | $form_action = is_multisite() ? '' : 'options.php'; |
| @@ -112,11 +129,8 @@ | ||
| 112 | 129 | break; |
| 113 | 130 | case 'login': |
| 114 | 131 | require 'login.php'; |
| 115 | 132 | break; |
| 116 | - case 'cookienotice': | |
| 117 | - require 'cookie-notice.php'; | |
| 118 | - break; | |
| 119 | 133 | case 'logs': |
| 120 | 134 | require 'logs.php'; |
| 121 | 135 | break; |
| 122 | 136 | case 'license': |
| @@ -125,12 +139,12 @@ | ||
| 125 | 139 | case 'multisite': |
| 126 | 140 | require 'multisite-activation.php'; |
| 127 | 141 | break; |
| 128 | 142 | default: |
| 143 | + require 'license.php'; | |
| 129 | 144 | break; |
| 130 | 145 | } |
| 131 | 146 | } |
| 132 | - } | |
| 133 | 147 | ?> |
| 134 | 148 | </div> |
| 135 | 149 | </div> |
| 136 | 150 | </div> |