PluginProbe
Patchstack – WordPress & Plugins Security / 2.2.13
Patchstack – WordPress & Plugins Security v2.2.13
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
patchstack / includes / views / pages / license.php

license.php in Patchstack – WordPress & Plugins Security 2.2.13, at includes/views/pages/license.php

224 lines 9.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // Do not allow the file to be called directly.
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit;
6 }
7
8 // Determine if the subscription of the account is expired.
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 $planClass = get_option( 'patchstack_subscription_class', '');
12 $site_id = (int) get_option( 'patchstack_site_id', 0 );
13 $app_url = $site_id != 0 ? 'https://app.patchstack.com/site/' . $site_id . '/' : 'https://app.patchstack.com/sites/overview';
14
15 // Generate the link to turn on settings management.
16 $secretToken = get_option( 'patchstack_activation_secret', '' );
17 $secretTime = get_option( 'patchstack_activation_time', '' );
18 if (!empty($secretToken) && !$this->is_connected() ){
19 echo '<script>jQuery(function(){ window.Patchstack.poller(); });</script>';
20 }
21 ?>
22 <div class="patchstack-free patchstack-auto-activate" style="<?php echo $status ? 'display: none;' : ''; ?>">
23 <div>
24 <div class="is-polling-section has-text-centered">
25 <img src="<?php echo esc_url( $this->plugin->url ); ?>assets/images/polling.svg" class="rotate">
26
27 <p class="is-text-medium">
28 <?php esc_html_e( 'Checking sync status', 'patchstack' ); ?>
29 </p>
30 </div>
31
32 <?php
33 $mins = ! empty( $secretTime ) ? floor( ( ( 1800 ) - ( time() - $secretTime ) ) / 60 ) : 0;
34 if ( $mins >= 1 ) {
35 echo '<p class="patchstack-upsell patchstack-has-text-white">' . sprintf('%s %d %s', esc_html__('This plugin is only a connector. Add this website to the Patchstack dashboard within '), $mins, esc_html__(' minutes to initiate automatic sync.')) . '</p>';
36 } else {
37 echo '<p class="patchstack-upsell patchstack-has-text-white">' . esc_html_e('This plugin is only a connector. Add this website to the Patchstack dashboard to sync your unique API key.', 'patchstack') . '</p>';
38 }
39 ?>
40
41 <div class="patchstack-plan patchstack-plan2">
42 <div class="form-table patchstack-form-table">
43 <div class="patchstack-activate-wrapper">
44 <label for="patchstack_api_key"><?php esc_html_e( 'Paste API key for manual sync', 'patchstack' ); ?></label>
45 <input class="regular-text" type="text" id="patchstack_api_key2" placeholder="<?php esc_attr_e( 'Unique API key', 'patchstack' ); ?>">
46 <input type="submit" id="patchstack-activate" value="<?php echo esc_attr__( 'Sync', 'patchstack' ); ?>" class="button-primary" />
47 </div>
48 </div>
49
50 <div style="clear: both;"></div>
51
52 <div class="patchstack-loading"><div></div><div></div><div></div><div></div></div>
53 </div>
54 <div style="clear: both;"></div>
55 </div>
56 </div>
57
58 <p class="patchstack-upsell" style="<?php echo $status ? 'display: none;' : ''; ?>">
59 <a href="https://app.patchstack.com/login" target="_blank"><?php esc_html_e( 'Log in to dashboard', 'patchstack' ); ?></a>
60 </p>
61
62 <div class="patchstack-free" style="<?php echo !$status ? 'display: none;' : ''; ?>">
63 <div>
64 <p class="patchstack-upsell patchstack-has-text-white" style="<?php echo $managed ? 'display: none;' : ''; ?>">
65 <?php if ($free) { ?>
66 <?php echo esc_attr__('Log in to our dashboard to access vulnerability data, to manage protection modules and remote settings.', 'patchstack' ); ?>
67 <?php } else { ?>
68 <?php echo sprintf('%s %s %s', esc_attr__('Log in to our dashboard to access vulnerability data, to manage protection modules and remote ', 'patchstack' ), '<a href="' . $app_url . 'hardening/firewall" target="_blank">hardening</a>', esc_attr('settings for this website.', 'patchstack' )); ?>
69 <?php } ?>
70 </p>
71
72 <div class="patchstack-plan patchstack-plan2">
73 <?php
74 if (!isset($_GET['key'])) {
75 ?>
76 <div class="patchstack-rows">
77 <div>
78 <span class="hint--top" aria-label="<?php !$this->is_connected() ? esc_html_e( 'There is not a proper connection to Patchstack', 'patchstack' ) : esc_html_e( 'Actively monitoring for new vulnerabilities', 'patchstack' ); ?>">
79 <?php esc_html_e( 'Connection status', 'patchstack' ); ?>
80 <span><img src="<?php echo esc_url( $this->plugin->url ); ?>assets/images/info.svg" alt=""></span>
81 </span>
82
83 <span class="<?php echo !$this->is_connected() ? 'ps-label has-error' : 'ps-label has-success'; ?>">
84 <?php !$this->is_connected() ? esc_html_e( 'Disconnected', 'patchstack' ) : esc_html_e( 'Synced', 'patchstack' ); ?>
85 </span>
86 </div>
87
88 <div>
89 <span>
90 <?php esc_html_e( 'Protection', 'patchstack' ); ?>
91 </span>
92
93 <span class="<?php echo !$this->is_protected() && empty($planClass) ? 'ps-label has-error' : 'ps-label has-success'; ?>">
94 <?php !$this->is_protected() && empty($planClass) ? esc_html_e( 'Disabled', 'patchstack' ) : esc_html_e( 'Enabled', 'patchstack' ); ?>
95 </span>
96 </div>
97
98 <div>
99 <span>
100 <?php esc_html_e( 'Vulnerabilities present', 'patchstack' ); ?>
101 </span>
102
103 <span>
104 <?php echo esc_html(get_option('patchstack_vulns_present', '?')); ?>
105 </span>
106 </div>
107
108 <div>
109 <span class="hint--top" aria-label="<?php esc_attr_e( 'The number of vulnerabilities which have a fix available through an update.', 'patchstack' ); ?>">
110 <?php esc_html_e( 'Fixes available', 'patchstack' ); ?>
111 <span><img src="<?php echo esc_url( $this->plugin->url ); ?>assets/images/info.svg" alt=""></span>
112 </span>
113
114 <span>
115 <?php echo esc_attr(get_option('patchstack_fixes_present', '?')); ?>
116 </span>
117 </div>
118
119 <?php if ($this->is_protected() || !empty($planClass)) { ?>
120 <div>
121 <span class="hint--top" aria-label="<?php esc_attr_e( 'The number of vulnerability specific vPatches. This is 0 when no severe vulnerabilities are present.', 'patchstack' ); ?>">
122 <?php esc_html_e( 'vPatches present', 'patchstack' ); ?>
123 <span><img src="<?php echo esc_url( $this->plugin->url ); ?>assets/images/info.svg" alt=""></span>
124 </span>
125
126 <span>
127 <?php echo esc_html(get_option('patchstack_vpatches_present', '?')); ?>
128 </span>
129 </div>
130
131 <div>
132 <span class="hint--top" aria-label="<?php esc_attr_e( 'The number of firewall rules. These are not vulnerability specific.', 'patchstack' ); ?>">
133 <?php esc_html_e( 'Firewall rules present', 'patchstack' ); ?>
134 <span><img src="<?php echo esc_url( $this->plugin->url ); ?>assets/images/info.svg" alt=""></span>
135 </span>
136
137 <span>
138 <?php echo esc_html(get_option('patchstack_non_vpatches_present', '?')); ?>
139 </span>
140 </div>
141
142 <div>
143 <span>
144 <?php esc_html_e( 'Attacks blocked last 30 days', 'patchstack' ); ?>
145 </span>
146
147 <span>
148 <?php echo $this->plugin->firewall_base->get_hits_counter(); ?>
149 </span>
150 </div>
151
152 <div>
153 <span class="hint--top" aria-label="Since July 9th, 2024.">
154 <?php esc_html_e( 'Attacks blocked in total', 'patchstack' ); ?>
155 <span><img src="<?php echo esc_url( $this->plugin->url ); ?>assets/images/info.svg" alt=""></span>
156 </span>
157
158 <span>
159 <?php echo esc_html(get_option('patchstack_hits_all_time', 0)); ?>
160 </span>
161 </div>
162 <?php } ?>
163 </div>
164
165 <div class="patchstack-license-button patchstack-login-button" <?php echo $managed ? 'style="display: none;"' : ''; ?>>
166 <a href="<?php echo $app_url; ?>" class="patchstack-button button-primary patchstack-fullwidth" target="_blank">
167 <?php esc_attr_e( 'Log in to view details', 'patchstack' ); ?>
168 </a>
169 </div>
170
171 <?php
172 } else {
173 ?>
174 <div class="form-table patchstack-form-table" <?php echo $managed ? 'style="margin-top: 32px;"' : ''; ?>>
175 <label for="patchstack_api_key">
176 <?php esc_html_e('API key', 'patchstack'); ?>
177 </label>
178 <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="<?php esc_attr_e('Unique API key', 'patchstack'); ?>">
179 </div>
180
181 <?php
182 if ( ! get_option( 'patchstack_clientid', false ) ) {
183 echo '<p class="patchstack-error">' . esc_html__('To use this plugin, login and add it to the App dashboard and sync using the API key provided there.', 'patchstack') . '</p>';
184 }
185 ?>
186
187 <div class="patchstack-license-button">
188 <input type="submit" id="patchstack-activate" value="<?php $status ? esc_attr_e( 'Re-sync with App', 'patchstack' ) : esc_attr_e( 'Activate', 'patchstack' ); ?>" class="button-primary patchstack-fullwidth" />
189 </div>
190
191 <div style="clear: both;"></div>
192
193 <?php
194 }
195
196 if (isset($_GET['resync'])) {
197 echo '<p class="patchstack-resync">' . esc_html__('The plugin is connected and synchronized.', 'patchstack') . '</p>';
198 }
199 ?>
200
201 <div class="patchstack-loading"><div></div><div></div><div></div><div></div></div>
202
203 <?php
204 if (isset($_GET['ps_autoa'])) {
205 echo '<p class="patchstack-resync">' . esc_html__('Attempting to auto-activate the plugin, this will take a moment...', 'patchstack') . '</p>';
206 }
207 ?>
208 </div>
209 <div style="clear: both;"></div>
210 </div>
211
212 <p class="patchstack-upsell patchstack-footer">
213 <?php if ( ! $managed && $free ) { ?>
214 <a href="<?php echo $app_url; ?>" target="_blank"><?php esc_html_e( 'Protect this site for $5/mo', 'patchstack' ); ?></a>
215 <span></span>
216 <?php } ?>
217
218 <?php if ( ! isset( $_GET['key'] ) ) { ?>
219 <a href="options-general.php?page=patchstack&key=1"><?php esc_html_e( 'Change API key', 'patchstack' ); ?></a>
220 <?php } else { ?>
221 <a href="options-general.php?page=patchstack"><?php esc_html_e( 'Back to overview', 'patchstack' ); ?></a>
222 <?php } ?>
223 </p>
224 </div>