PluginProbe
Patchstack – WordPress & Plugins Security / 2.2.6
Patchstack – WordPress & Plugins Security v2.2.6
2.3.7 trunk 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.16 2.1.17 2.1.18 2.1.19 2.1.2 2.1.20 2.1.21 2.1.22 2.1.23 2.1.24 2.1.25 2.1.3 2.1.4 2.1.5 2.1.6 All 49 releases
← All changes | includes/views/pages/license.php +69 -96 2.1.152.2.6 View file →
@@ -6,126 +6,99 @@
6 6 }
7 7
8 8 // Determine if the subscription of the account is expired.
9 9 $status = $this->plugin->client_id != 'PATCHSTACK_CLIENT_ID' || get_option( 'patchstack_clientid', false ) != false;
10 -$free = get_option( 'patchstack_license_free', 0 ) == 1;
11 -if ( isset( $_GET['activated'] ) && $status ) {
10 +$free = get_option( 'patchstack_license_free', 0 ) == 1;
11 +$planClass = get_option( 'patchstack_subscription_class', '');
12 +$managed = get_option( 'patchstack_managed', false );
13 +$site_id = get_option( 'patchstack_site_id', 0 );
14 +$app_url = $site_id != 0 ? 'https://app.patchstack.com/app/' . $site_id . '/"' : 'https://app.patchstack.com/apps/overview';
15 +if ( isset( $_GET['ps_activated'] ) && $status ) {
12 16 echo "<script>window.location = 'admin.php?page=patchstack&tab=license&active=1';</script>";
13 17 }
14 18
15 19 // Generate the link to turn on settings management.
16 20 $url = '?page=' . esc_attr( $page ) . '&tab=license&action=enable_settings&patchstack_settings_nonce=' . wp_create_nonce( 'patchstack_settings_nonce' );
21 +$url_enabled = '?page=patchstack' . (!$free ? '&tab=firewall' : '');
22 +
23 +if (!$show_settings) {
17 24 ?>
18 25 <div class="patchstack-free" style="<?php echo $show_settings ? 'display: none;' : ''; ?>">
19 26 <div>
20 27 <div class="patchstack-plan patchstack-plan2">
21 - <p>Visit the Patchstack app to monitor and manage your sites</p>
28 + <div class="patchstack-status">
29 + <span>Sync status</span>
30 + <?php
31 + if ($this->is_connected()) {
32 + echo '<span class="patchstack-status-label">Connected</span>';
33 + } else {
34 + echo '<span class="patchstack-status-label patchstack-status-label-error">Disconnected</span>';
35 + }
36 + ?>
37 + </div>
22 38
23 - <div class="form-table patchstack-form-table">
24 - <label for="patchstack_api_client_id">Site ID</label>
25 - <input class="regular-text" type="text" id="patchstack_api_client_id" value="<?php echo esc_attr( get_option( 'patchstack_clientid', false ) ); ?>" placeholder="Enter Site ID">
39 + <div style="clear: both;"></div>
26 40
27 - <label for="patchstack_api_client_secret_key">Site Secret Key</label>
28 - <input class="regular-text" type="text" id="patchstack_api_client_secret_key" value="<?php echo esc_attr( get_option( 'patchstack_secretkey', false ) ); ?>" placeholder="Enter Site Secret Key">
41 + <div class="patchstack-protection" <?php echo !$this->is_protected() && empty($planClass) ? 'style="display: none;"' : ''; ?>>
42 + <img src="<?php echo esc_url( $this->plugin->url ); ?>assets/images/shield.svg">
43 + <span>Protection enabled</span>
29 44 </div>
30 45
31 - <div class="patchstack-sub">
32 - <span>Subscription Type</span>
33 - <span style="color: #fff;" class="patchstack-sub-type">
34 - Professional
35 - </span>
46 + <div class="patchstack-protection" <?php echo $this->is_protected() || $planClass > 0 || $managed ? 'style="display: none;"' : ''; ?>>
47 + <span>Protection disabled</span>
48 + <a href="<?php echo $app_url; ?>" target="_blank" class="button-primary">
49 + Activate for $9 / mo
50 + </a>
36 51 </div>
37 52
38 - <div class="patchstack-sub" style="width: 30%;">
39 - <span>Status</span>
40 - <span style="color: <?php echo $status ? '#B2D675' : '#ED645E'; ?>" class="patchstack-license-status">
41 - <?php echo $status ? 'Active' : 'Inactive'; ?>
42 - </span>
53 + <div class="form-table patchstack-form-table" <?php echo $managed ? 'style="margin-top: 32px;"' : ''; ?>>
54 + <label for="patchstack_api_key">
55 + API key
56 + <?php
57 + if ($planClass != '' && !$managed ) {
58 + $plan = $this->get_subscription_name( $planClass );
59 + ?>
60 + <span><?php echo $plan; ?> plan</span>
61 + <?php
62 + }
63 + ?>
64 + </label>
65 + <input class="regular-text" type="text" id="patchstack_api_key" value="<?php echo get_option( 'patchstack_clientid', false ) ? esc_attr( $this->get_secret_key() . '-' . get_option( 'patchstack_clientid', false ) ) : ''; ?>" placeholder="Enter your API key here...">
43 66 </div>
44 67
68 + <?php
69 + if ( ! get_option( 'patchstack_clientid', false ) ) {
70 + echo '<p class="patchstack-error">To use this plugin, login and add it to the App dashboard and sync using the API key provided there.</p>';
71 + }
72 + ?>
73 +
45 74 <div class="patchstack-license-button">
46 - <input type="submit" id="patchstack-activate" value="<?php echo $status ? __( 'Save', 'patchstack' ) : __( 'Activate', 'patchstack' ); ?>" class="button-primary <?php echo ! $status ? 'patchstack-fullwidth' : ''; ?>" />
47 - <a href="https://app.patchstack.com/dashboard" class="patchstack-activate button-primary" style="<?php echo ! $status ? 'display: none;' : ''; ?>" target="_blank"><?php echo __( 'Go to App', 'patchstack' ); ?></a>
75 + <input type="submit" id="patchstack-activate" value="<?php echo $status ? __( 'Re-sync with App', 'patchstack' ) : __( 'Activate', 'patchstack' ); ?>" class="button-primary patchstack-fullwidth" />
48 76 </div>
77 +
78 + <div style="clear: both;"></div>
79 +
80 + <?php
81 + if (isset($_GET['resync'])) {
82 + echo '<p class="patchstack-resync">The plugin is connected and synchronized.</p>';
83 + }
84 + ?>
85 +
86 + <div class="patchstack-loading"><div></div><div></div><div></div><div></div></div>
49 87 </div>
50 88 <div style="clear: both;"></div>
51 89 </div>
52 90
91 +
53 92 <p class="patchstack-upsell">
54 - Click <a href="<?php echo esc_url( $url ); ?>">here</a> to manage the Patchstack settings through WordPress.
93 + <?php if ( ! $managed ) { ?>
94 + <a href="<?php echo $app_url; ?>" target="_blank"><?php echo __( 'Log in', 'patchstack' ); ?></a>
95 + <?php echo __( 'to the central App to view vulnerabilities, activate protection and manage settings for this web application.', 'patchstack' ); ?>
96 + <?php } ?>
97 + <?php if ( ! $free && $planClass >= 1 ) { ?>
98 + <a href="<?php echo $this->get_option( 'patchstack_show_settings', 0 ) == 1 ? $url_enabled : esc_url( $url ); ?>">Manage</a> the Patchstack plugin settings through WordPress.
99 + <?php } ?>
55 100 </p>
56 101 </div>
57 -
58 -<div style="<?php echo ! $show_settings ? 'display: none;' : ''; ?>">
59 - <div class="patchstack-font"
60 - <?php
61 - if ( $show_settings ) {
62 - echo ' style="display: none;"'; }
63 - ?>
64 - >
65 - <br />
66 - <h2>Thank you for using Patchstack<?php echo ( $free ? '' : ' Professional' ); ?></h2>
67 - <br />
68 - <p>
69 - The default settings of Patchstack are tweaked to provide a good baseline of security.<br />
70 - If however you still want to tweak the settings of Patchstack, you can do so through the "Hardening" tab at <a href="https://app.patchstack.com/sites" target="_blank">app.patchstack.com</a> after logging in and clicking on your site.<br /><br />
71 - Alternatively, you can turn on the setting management feature on WordPress itself by clicking <a href="">here</a>.
72 - </p>
73 - <br />
74 - </div>
75 -
76 - <h2 class="patchstack-license-h2 patchstack-hover"><?php echo __( 'Settings', 'patchstack' ); ?></h2>
77 - <div class="patchstack-font patchstack-license-info">
78 - <div id="hiddenstatusbox" class="patchstackInfo patchstack-font blue">
79 - <span class="label label-success" id="patchstack_license_key_result"></span>
80 - </div>
81 - <p<?php echo ( $show_settings ? '' : ' style="display: none;"' ); ?>>
82 - You can enter your site ID and secret key values below.<br />
83 - You generally do not have to touch these values.<br /><br />
84 -
85 - If both are empty and you do not know your site ID and secret key, you can find it by following these steps:<br />
86 - 1. Go to your site on the Patchstack App.<br />
87 - 2. Click on the "Site Settings" button on the right.<br />
88 - 3. Click on "Site Credentials & Download Plugin".<br />
89 - 4. The site ID and secret key will be displayed on this page.
90 - </p>
91 - <table class="form-table patchstack-form-table">
92 - <tr>
93 - <th>
94 - <label for="patchstack_api_client_id"><?php echo __( 'Site ID', 'patchstack' ); ?></label>
95 - </th>
96 - <td>
97 - <input class="regular-text" type="text" id="patchstack_api_client_id" value="<?php echo esc_attr( get_option( 'patchstack_clientid', false ) ); ?>" placeholder="Enter your site ID here...">
98 - </td>
99 - </tr>
100 - <tr>
101 - <th><label for="patchstack_api_client_secret_key"><?php echo __( 'Site Secret Key', 'patchstack' ); ?></label></th>
102 - <td>
103 - <input class="regular-text" type="text" id="patchstack_api_client_secret_key" value="<?php echo esc_attr( get_option( 'patchstack_secretkey', false ) ); ?>" placeholder="Enter your site secret key here...">
104 - </td>
105 - </tr>
106 - <tr>
107 - <th>
108 - <label><?php echo __( 'Status', 'patchstack' ); ?></label>
109 - </th>
110 - <td>
111 - <span class="patchstack-license-status" style="font-size: 13px; color: #fff;"><?php echo ( $status ? '' : 'Not ' ); ?>Activated</span>
112 - </td>
113 - </tr>
114 - <tr>
115 - <th>
116 - <label><?php echo __( 'Subscription Type', 'patchstack' ); ?></label>
117 - </th>
118 - <td>
119 - <span style="font-size: 13px; color: #fff;"><?php echo ( $free ? 'Community (Free)' : 'Professional' ); ?></span>
120 - </td>
121 - </tr>
122 - <tr>
123 - <td colspan="2">
124 - <p class="submit">
125 - <input type="submit" id="patchstack-activate" value="<?php echo __( 'Save', 'patchstack' ); ?>" class="button-primary" />
126 - </p>
127 - </td>
128 - </tr>
129 - </table>
130 - </div>
131 -</div>
102 +<?php
103 +}
104 +?>