PluginProbe ʕ •ᴥ•ʔ
Wordfence Security – Firewall, Malware Scan, and Login Security / 7.2.5
Wordfence Security – Firewall, Malware Scan, and Login Security v7.2.5
8.2.2 8.2.1 8.2.0 3.7.1 3.7.2 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.8.6 3.8.7 3.8.8 3.8.9 3.9.1 4.0.1 4.0.2 4.0.3 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 5.0.6 5.0.7 5.0.8 5.0.9 5.1.1 5.1.2 5.1.4 5.1.5 5.1.6 5.1.7 5.1.8 5.1.9 5.2.1 5.2.2 5.2.3 5.2.4 5.2.5 5.2.6 5.2.7 5.2.8 5.2.9 5.3.1 5.3.10 5.3.11 5.3.12 5.3.2 5.3.3 5.3.4 5.3.5 5.3.6 5.3.7 5.3.8 5.3.9 6.0.1 6.0.10 6.0.11 6.0.12 6.0.14 6.0.15 6.0.16 6.0.17 6.0.18 6.0.19 6.0.2 6.0.20 6.0.21 6.0.22 6.0.23 6.0.24 6.0.25 6.0.3 6.0.4 6.0.5 6.0.6 6.0.7 6.0.8 6.0.9 6.1.1 6.1.10 6.1.11 6.1.12 6.1.14 6.1.15 6.1.16 6.1.17 6.1.2 6.1.3 6.1.4 6.1.5 6.1.6 6.1.7 6.1.8 6.1.9 6.2.0 6.2.1 6.2.10 6.2.2 6.2.3 6.2.4 6.2.5 6.2.6 6.2.7 6.2.8 6.2.9 6.3.0 6.3.1 6.3.10 6.3.11 6.3.12 6.3.14 6.3.15 6.3.16 6.3.17 6.3.18 6.3.19 6.3.2 6.3.20 6.3.21 6.3.22 6.3.3 6.3.4 6.3.5 6.3.6 6.3.7 6.3.8 6.3.9 7.0.1 7.0.2 7.0.3 7.0.4 7.0.5 7.1.0 7.1.1 7.1.10 7.1.11 7.1.12 7.1.14 7.1.15 7.1.16 7.1.17 7.1.18 7.1.19 7.1.2 7.1.20 7.1.3 7.1.4 7.1.5 7.1.6 7.1.7 7.1.8 7.1.9 7.10.0 7.10.1 7.10.2 7.10.3 7.10.4 7.10.5 7.10.6 7.10.7 7.11.0 7.11.1 7.11.2 7.11.3 7.11.4 7.11.5 7.11.6 7.11.7 7.2.1 7.2.2 7.2.3 7.2.4 7.2.5 7.3.1 7.3.2 7.3.3 7.3.4 7.3.5 7.3.6 7.4.0 7.4.1 7.4.10 7.4.11 7.4.12 7.4.14 7.4.2 7.4.3 trunk 7.4.4 1.1 7.4.5 1.2 7.4.6 1.3 7.4.7 1.3.1 7.4.8 1.3.2 7.4.9 1.3.3 7.5.0 1.4.2 7.5.1 1.4.3 7.5.10 1.4.4 7.5.11 1.4.5 7.5.2 1.4.6 7.5.3 1.4.7 7.5.4 1.4.8 7.5.5 1.5.1 7.5.6 1.5.2 7.5.7 1.5.3 7.5.8 1.5.4 7.5.9 1.5.5 7.6.0 1.5.6 7.6.1 2.0.1 7.6.2 2.0.2 7.7.0 2.0.3 7.7.1 2.0.5 7.8.0 2.0.6 7.8.1 2.0.7 7.8.2 2.1.0 7.9.0 2.1.1 7.9.1 2.1.2 7.9.2 2.1.3 7.9.3 2.1.4 8.0.0 2.1.5 8.0.1 3.0.2 8.0.2 3.0.3 8.0.3 3.0.4 8.0.4 3.0.5 8.0.5 3.0.6 8.1.0 3.0.7 8.1.1 3.0.8 8.1.2 3.0.9 8.1.3 3.1.0 8.1.4 3.1.1 v1.4.1 3.1.2 3.1.4 3.1.6 3.2.1 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.4.1 3.4.4 3.4.5 3.5.1 3.5.2 3.6.1 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.6.9
wordfence / views / waf / options-group-basic-firewall.php
wordfence / views / waf Last commit date
debug.php 7 years ago firewall-status.php 8 years ago option-rate-limit.php 8 years ago option-rules.php 7 years ago option-whitelist.php 7 years ago options-group-advanced-firewall.php 7 years ago options-group-basic-firewall.php 7 years ago options-group-brute-force.php 7 years ago options-group-rate-limiting.php 7 years ago options-group-whitelisted.php 7 years ago status-tooltip-learning-mode.php 8 years ago waf-install-manual.php 8 years ago waf-install-success.php 8 years ago waf-install.php 7 years ago waf-modal-wrapper.php 8 years ago waf-uninstall-success.php 8 years ago waf-uninstall.php 8 years ago
options-group-basic-firewall.php
507 lines
1 <?php
2 if (!defined('WORDFENCE_VERSION')) { exit; }
3 /**
4 * Presents the Basic Firewall Options group.
5 *
6 * Expects $firewall, $waf, and $stateKey.
7 *
8 * @var wfFirewall $firewall
9 * @var wfWAF $waf
10 * @var string $stateKey The key under which the collapse state is stored.
11 * @var bool $collapseable If defined, specifies whether or not this grouping can be collapsed. Defaults to true.
12 */
13
14 $config = $waf->getStorageEngine();
15
16 if (!isset($collapseable)) {
17 $collapseable = true;
18 }
19 ?>
20 <div class="wf-row">
21 <div class="wf-col-xs-12">
22 <div class="wf-block<?php if (!$collapseable) { echo ' wf-always-active'; } else { echo (wfPersistenceController::shared()->isActive($stateKey) ? ' wf-active' : ''); } ?>" data-persistence-key="<?php echo esc_attr($stateKey); ?>">
23 <div class="wf-block-header">
24 <div class="wf-block-header-content">
25 <div class="wf-block-title">
26 <strong><?php _e('Basic Firewall Options', 'wordfence'); ?></strong>
27 </div>
28 <?php if ($collapseable): ?><div class="wf-block-header-action"><div class="wf-block-header-action-disclosure" role="checkbox" aria-checked="<?php echo (wfPersistenceController::shared()->isActive($stateKey) ? 'true' : 'false'); ?>" tabindex="0"></div></div><?php endif; ?>
29 </div>
30 </div>
31 <div class="wf-block-content">
32 <ul class="wf-block-list wf-block-list-horizontal">
33 <li id="wf-option-wafStatus" class="wf-flex-vertical wf-flex-align-left wf-flex-full-width">
34 <h3><?php esc_html_e('Web Application Firewall Status', 'wordfence'); ?></h3>
35 <?php if ($firewall->isSubDirectoryInstallation()): ?>
36 <p class="wf-no-top"><?php printf(__('You are currently running the Wordfence Web Application Firewall from another WordPress installation. Please <a href="%s">click here</a> to configure the Firewall to run correctly on this site.', 'wordfence'), esc_attr(network_admin_url('admin.php?page=WordfenceWAF&subpage=waf_options#configureAutoPrepend'))); ?></p>
37 <?php else: ?>
38 <p class="wf-no-top">
39 <?php $wafStatus = $firewall->firewallMode(); ?>
40 <span id="wafStatus-enabled-description" class="wafStatus-description"<?php if ($wafStatus != wfFirewall::FIREWALL_MODE_ENABLED) { echo ' style="display: none;"'; } ?>><strong><?php _e('Enabled and Protecting:', 'wordfence'); ?></strong> <?php _e('In this mode, the Wordfence Web Application Firewall is actively blocking requests matching known attack patterns and is actively protecting your site from attackers.', 'wordfence'); ?></span>
41 <span id="wafStatus-learning-mode-description" class="wafStatus-description"<?php if ($wafStatus != wfFirewall::FIREWALL_MODE_LEARNING) { echo ' style="display: none;"'; } ?>><strong><?php _e('Learning Mode:', 'wordfence'); ?></strong> <?php printf(__('When you first install the Wordfence Web Application Firewall, it will be in learning mode. This allows Wordfence to learn about your site so that we can understand how to protect it and how to allow normal visitors through the firewall. We recommend you let Wordfence learn for a week before you enable the firewall. <a href="%s" target="_blank" rel="noopener noreferrer">Learn More</a>', 'wordfence'), wfSupportController::supportURL(wfSupportController::ITEM_FIREWALL_WAF_LEARNING_MODE)); ?></span>
42 <span id="wafStatus-disabled-description" class="wafStatus-description"<?php if ($wafStatus != wfFirewall::FIREWALL_MODE_DISABLED) { echo ' style="display: none;"'; } ?>><strong><?php _e('Disabled:', 'wordfence'); ?></strong> <?php _e('In this mode, the Wordfence Web Application Firewall is functionally turned off and does not run any of its rules or analyze the request in any way.', 'wordfence'); ?></span>
43 </p>
44 <p class="wf-no-top wf-add-bottom">
45 <select id="input-wafStatus" data-original-value="<?php echo esc_attr($wafStatus); ?>" name="wafStatus" class="wf-form-control"<?php echo !WFWAF_ENABLED ? ' disabled' : '' ?>>
46 <option<?php echo $wafStatus == wfFirewall::FIREWALL_MODE_ENABLED ? ' selected' : '' ?> class="wafStatus-enabled" value="enabled"><?php _e('Enabled and Protecting', 'wordfence'); ?></option>
47 <option<?php echo $wafStatus == wfFirewall::FIREWALL_MODE_LEARNING ? ' selected' : '' ?> class="wafStatus-learning-mode" value="learning-mode"><?php _e('Learning Mode', 'wordfence'); ?></option>
48 <option<?php echo $wafStatus == wfFirewall::FIREWALL_MODE_DISABLED ? ' selected' : '' ?> class="wafStatus-disabled" value="disabled"><?php _e('Disabled', 'wordfence'); ?></option>
49 </select>
50 <script type="application/javascript">
51 (function($) {
52 $(function() {
53 $('#input-wafStatus').wfselect2({
54 minimumResultsForSearch: -1,
55 width: '200px'
56 }).on('change', function() {
57 var select = $(this);
58 var value = select.val();
59 var container = $($(this).data('wfselect2').$container);
60 container.removeClass('wafStatus-enabled wafStatus-learning-mode wafStatus-disabled')
61 .addClass('wafStatus-' + value);
62
63 $('.wafStatus-description').hide();
64 $('#wafStatus-' + value + '-description').show();
65 if (value == 'learning-mode') {
66 $('#waf-learning-mode-grace-period').show();
67 }
68 else {
69 $('#waf-learning-mode-grace-period').hide();
70 }
71
72 var originalValue = select.data('originalValue');
73 if (originalValue == value) {
74 delete WFAD.pendingChanges['wafStatus'];
75 }
76 else {
77 WFAD.pendingChanges['wafStatus'] = value;
78 }
79
80 WFAD.updatePendingChanges();
81 }).val(<?php echo json_encode($wafStatus) ?>).triggerHandler('change');
82
83 $('#waf-learning-mode-grace-period .wf-datetime').datetimepicker({
84 dateFormat: 'yy-mm-dd',
85 timezone: <?php try { echo (int) wfUtils::timeZoneMinutes($config->getConfig('learningModeGracePeriod') ? (int) $config->getConfig('learningModeGracePeriod') : false); } catch (Exception $e) { echo 0; }; ?>,
86 showTime: false,
87 showTimepicker: false,
88 showMonthAfterYear: true
89 }).each(function() {
90 var el = $(this);
91 if (el.attr('data-value')) {
92 el.datetimepicker('setDate', new Date(el.attr('data-value') * 1000));
93 }
94 }).on('change', function() {
95 var value = Math.floor($(this).datetimepicker('getDate').getTime() / 1000);
96 var originalValue = $('#input-learningModeGracePeriod').data('originalValue');
97 if (originalValue == value) {
98 delete WFAD.pendingChanges['learningModeGracePeriod'];
99 }
100 else {
101 WFAD.pendingChanges['learningModeGracePeriod'] = $(this).val();
102 }
103 WFAD.updatePendingChanges();
104 });
105
106 $('#waf-learning-mode-grace-period .wf-option-checkbox').on('click', function(e) {
107 e.preventDefault();
108 e.stopPropagation();
109
110 var originalValue = $(this).data('originalValue');
111 var value = originalValue;
112 var isActive = $(this).hasClass('wf-checked');
113 if (isActive) {
114 $(this).removeClass('wf-checked');
115 $('#waf-learning-mode-grace-period .wf-datetime').attr('disabled', true);
116 value = 0;
117 }
118 else {
119 $(this).addClass('wf-checked');
120 $('#waf-learning-mode-grace-period .wf-datetime').attr('disabled', false);
121 value = 1;
122
123 if (!$('#input-learningModeGracePeriod').val()) {
124 var date = new Date();
125 date.setDate(date.getDate() + 7);
126 $('#input-learningModeGracePeriod').datetimepicker('setDate', date);
127 }
128 }
129
130 if (originalValue == value) {
131 delete WFAD.pendingChanges['learningModeGracePeriodEnabled'];
132 }
133 else {
134 WFAD.pendingChanges['learningModeGracePeriodEnabled'] = value;
135 }
136
137 WFAD.updatePendingChanges();
138 });
139
140 $(window).on('wfOptionsReset', function() {
141 $('#input-wafStatus').val($('#input-wafStatus').data('originalValue')).trigger('change');
142 $('#waf-learning-mode-grace-period .wf-option-checkbox').each(function() {
143 var originalValue = $(this).data('originalValue');
144 $(this).toggleClass('wf-checked', !!originalValue);
145 $('#waf-learning-mode-grace-period .wf-datetime').attr('disabled', !originalValue);
146 });
147 $('.wf-datetime').each(function() {
148 var el = $(this);
149 if (el.attr('data-value')) {
150 el.datetimepicker('setDate', new Date(el.attr('data-value') * 1000));
151 }
152 else {
153 el.val('');
154 }
155 })
156 });
157 });
158 })(jQuery);
159 </script>
160 </p>
161 <div id="waf-learning-mode-grace-period" class="wf-add-bottom" style="display: none;"><div class="waf-learning-mode wf-option-checkbox<?php try { echo $config->getConfig('learningModeGracePeriodEnabled') ? ' wf-checked' : ''; } catch (Exception $e) { /* Do nothing */ } ?>" data-original-value="<?php try { echo $config->getConfig('learningModeGracePeriodEnabled') ? 1 : 0; } catch (Exception $e) { echo 0; } ?>"><i class="wf-ion-ios-checkmark-empty" aria-hidden="true"></i></div><span> <?php _e('Automatically enable on', 'wordfence'); ?> </span><input type="text" name="learningModeGracePeriod" id="input-learningModeGracePeriod" class="wf-datetime wf-form-control" placeholder="Enabled until..." data-value="<?php try { echo esc_attr($config->getConfig('learningModeGracePeriod') ? (int) $config->getConfig('learningModeGracePeriod') : ''); } catch (Exception $e) { /* Do nothing */ } ?>" data-original-value="<?php try { echo esc_attr($config->getConfig('learningModeGracePeriod') ? (int) $config->getConfig('learningModeGracePeriod') : ''); } catch (Exception $e) { /* Do nothing */ } ?>"<?php try { echo $config->getConfig('learningModeGracePeriodEnabled') ? '' : ' disabled'; } catch (Exception $e) { echo ' disabled'; } ?>></div>
162 <?php endif; ?>
163 </li>
164 <li id="wf-option-protectionMode" class="wf-flex-vertical wf-flex-align-left">
165 <h3><?php esc_html_e('Protection Level', 'wordfence'); ?></h3>
166 <?php if ($firewall->protectionMode() == wfFirewall::PROTECTION_MODE_EXTENDED && !$firewall->isSubDirectoryInstallation()): ?>
167 <p class="wf-no-top"><strong><?php _e('Extended Protection:', 'wordfence'); ?></strong> <?php _e('All PHP requests will be processed by the firewall prior to running.', 'wordfence'); ?></p>
168 <p><?php printf(__('If you\'re moving to a new host or a new installation location, you may need to temporarily disable extended protection to avoid any file not found errors. Use this action to remove the configuration changes that enable extended protection mode or you can <a href="%s" target="_blank" rel="noopener noreferrer">remove them manually</a>.', 'wordfence'), wfSupportController::esc_supportURL(wfSupportController::ITEM_FIREWALL_WAF_REMOVE_MANUALLY)); ?></p>
169 <p class="wf-no-top"><a class="wf-btn wf-btn-default" href="#" id="wf-waf-uninstall"><?php _e('Remove Extended Protection', 'wordfence'); ?></a></p>
170 <?php elseif ($firewall->isSubDirectoryInstallation()): ?>
171 <p class="wf-no-top"><strong><?php _e('Existing WAF Installation Detected:', 'wordfence'); ?></strong> <?php _e('You are currently running the Wordfence Web Application Firewall from another WordPress installation. Please configure the firewall to run correctly on this site.', 'wordfence'); ?></p>
172 <p><a class="wf-btn wf-btn-primary" href="#" id="wf-waf-install"><?php _e('Optimize the Wordfence Firewall', 'wordfence'); ?></a></p>
173 <?php else: ?>
174 <p class="wf-no-top"><strong><?php _e('Basic WordPress Protection:', 'wordfence'); ?></strong> <?php _e('The plugin will load as a regular plugin after WordPress has been loaded, and while it can block many malicious requests, some vulnerable plugins or WordPress itself may run vulnerable code before all plugins are loaded.', 'wordfence'); ?></p>
175 <p><a class="wf-btn wf-btn-primary" href="#" id="wf-waf-install"><?php _e('Optimize the Wordfence Firewall', 'wordfence'); ?></a></p>
176 <?php endif; ?>
177 <script type="application/javascript">
178
179 (function($) {
180 $(function() {
181 var validateContinue = function() {
182 var backupsAvailable = $('.wf-waf-backups:visible').data('backups');
183 var backupsDownloaded = $('#wf-waf-server-config').data('backups');
184
185 var matchCount = 0;
186 backupsAvailable = backupsAvailable.sort();
187 backupsDownloaded = backupsDownloaded.sort();
188 for (var i = 0; i < backupsAvailable.length; i++) {
189 for (var n = 0; n < backupsDownloaded.length; n++) {
190 if (backupsAvailable[i] == backupsDownloaded[n]) {
191 matchCount++;
192 }
193 }
194 }
195
196 $('#wf-waf-install-continue, #wf-waf-uninstall-continue').toggleClass('wf-disabled', matchCount != backupsAvailable.length);
197 };
198
199 var installUninstallResponseHandler = function(action, res) {
200 var modal = $('.wf-modal-title').closest('.wf-modal');
201 if (res.needsCredentials) {
202 var replacement = $(res.html);
203 modal.replaceWith(replacement);
204 modal = replacement;
205
206 var form = replacement.find('#request-filesystem-credentials-form').closest('form');
207 form.find('input[type="submit"]').attr('type', 'hidden');
208 form.on('submit', function(e) {
209 e.preventDefault();
210 e.stopPropagation();
211
212 WFAD.ajax(action, form.serialize(), function(res) {
213 installUninstallResponseHandler(action, res);
214 });
215 });
216 modal.find('#wf-waf-modal-continue').on('click', function(e) {
217 e.preventDefault();
218 e.stopPropagation();
219
220 form.trigger('submit');
221 });
222 $.wfcolorbox.resize();
223 }
224 else if (res.credentialsFailed || res.installationFailed || res.uninstallationFailed) {
225 var replacement = $(res.html);
226 modal.replaceWith(replacement);
227 modal = replacement;
228 modal.find('#wf-waf-modal-continue').on('click', function(e) {
229 e.preventDefault();
230 e.stopPropagation();
231
232 WFAD.colorboxClose();
233 });
234 $.wfcolorbox.resize();
235
236 var payload = {serverConfiguration: res.serverConfiguration, iniModified: 1};
237 if (res.credentials) {
238 payload['credentials'] = res.credentials;
239 payload['credentialsSignature'] = res.credentialsSignature;
240 }
241
242 $('.wf-waf-uninstall-try-again').on('click', function(e) {
243 e.preventDefault();
244 e.stopPropagation();
245
246 $(this).text('Retrying');
247 payload['retryAttempted'] = 1;
248
249 WFAD.ajax(action, payload, function(res) {
250 installUninstallResponseHandler(action, res);
251 });
252 });
253 }
254 else if (res.uninstallationWaiting) {
255 var replacement = $(res.html);
256 modal.replaceWith(replacement);
257 modal = replacement;
258 modal.find('#wf-waf-modal-continue').on('click', function(e) {
259 e.preventDefault();
260 e.stopPropagation();
261
262 WFAD.colorboxClose();
263 }).addClass('wf-disabled');
264
265 var timeout = res.timeout; //In seconds
266 setTimeout(function() {
267 modal.find('#wf-waf-modal-continue').removeClass('wf-disabled');
268 var payload = {serverConfiguration: res.serverConfiguration, iniModified: 1};
269 if (res.credentials) {
270 payload['credentials'] = res.credentials;
271 payload['credentialsSignature'] = res.credentialsSignature;
272 }
273 WFAD.ajax(action, payload, function(res) {
274 installUninstallResponseHandler(action, res);
275 });
276 }, (timeout + 10) * 1000);
277 $.wfcolorbox.resize();
278 }
279 else if (res.ok) {
280 var replacement = $(res.html);
281 modal.replaceWith(replacement);
282 modal = replacement;
283 modal.find('#wf-waf-modal-continue').on('click', function(e) {
284 e.preventDefault();
285 e.stopPropagation();
286
287 window.location.reload(true);
288 });
289 $.wfcolorbox.resize();
290 }
291 else {
292 WFAD.colorboxModal((WFAD.isSmallScreen ? '300px' : '400px'), 'Error During Setup', res.errorMsg);
293 }
294 };
295
296 var installUninstallHandler = function(html) {
297 WFAD.colorboxHTML('800px', html, {overlayClose: false, closeButton: false, className: 'wf-modal', onComplete: function() {
298 $('#wf-waf-server-config').data('backups', []);
299 $('.wf-waf-backup-download').on('click', function(e) {
300 var backupIndex = parseInt($(this).data('backupIndex'));
301 var backupsAvailable = $(this).closest('.wf-waf-backups').data('backups');
302 var backupsDownloaded = $('#wf-waf-server-config').data('backups');
303 var found = false;
304 for (var i = 0; i < backupsDownloaded.length; i++) {
305 if (backupsDownloaded[i] == backupsAvailable[backupIndex]) {
306 found = true;
307 break;
308 }
309 }
310
311 if (!found) {
312 backupsDownloaded.push(backupsAvailable[backupIndex]);
313 $('#wf-waf-server-config').data('backups', backupsDownloaded);
314 validateContinue();
315 }
316 });
317
318 $('#wf-waf-server-config').wfselect2({
319 minimumResultsForSearch: -1,
320 width: WFAD.isSmallScreen ? '300px' : '500px'
321 });
322
323 $('#wf-waf-include-prepend > li').each(function(index, element) {
324 $(element).on('click', function(e) {
325 e.preventDefault();
326 e.stopPropagation();
327
328 var control = $(this).closest('.wf-switch');
329 var value = $(this).data('optionValue');
330
331 control.find('li').each(function() {
332 $(this).toggleClass('wf-active', value == $(this).data('optionValue'));
333 });
334 });
335 });
336
337 var nginxNotice = $('.wf-nginx-waf-config');
338 var manualNotice = $('.wf-manual-waf-config');
339 $('#wf-waf-server-config').on('change', function() {
340 var el = $(this);
341 if (manualNotice.length) {
342 if (el.val() == 'manual') {
343 manualNotice.fadeIn(400, function () {
344 $.wfcolorbox.resize();
345 });
346 }
347 else {
348 manualNotice.fadeOut(400, function () {
349 $.wfcolorbox.resize();
350 });
351 }
352 }
353
354 var identifier = '.wf-waf-backups-' + el.val().replace(/[^a-z0-9\-]/i, '');
355 $('.wf-waf-backups').hide();
356 $(identifier).show();
357 if ($(identifier).find('.wf-waf-backup-file-list').children().length > 0) {
358 $('.wf-waf-download-instructions').show();
359 }
360 else {
361 $('.wf-waf-download-instructions').hide();
362 }
363
364 if (nginxNotice.length) { //Install only
365 if (el.val() == 'nginx') {
366 nginxNotice.fadeIn(400, function () {
367 $.wfcolorbox.resize();
368 });
369 }
370 else {
371 nginxNotice.fadeOut(400, function () {
372 $.wfcolorbox.resize();
373 });
374 }
375
376 validateContinue();
377 return;
378 }
379
380 $.wfcolorbox.resize();
381 validateContinue();
382 }).triggerHandler('change');
383
384 $('#wf-waf-install-continue').on('click', function(e) {
385 e.preventDefault();
386 e.stopPropagation();
387
388 var serverConfiguration = $('#wf-waf-server-config').val();
389 var currentAutoPrepend = $('#wf-waf-include-prepend .wf-active').data('optionValue');
390
391 WFAD.ajax('wordfence_installAutoPrepend', {serverConfiguration: serverConfiguration, currentAutoPrepend: currentAutoPrepend}, function(res) {
392 installUninstallResponseHandler('wordfence_installAutoPrepend', res);
393 });
394 });
395
396 $('#wf-waf-uninstall-continue').on('click', function(e) {
397 e.preventDefault();
398 e.stopPropagation();
399
400 if ($('.wf-manual-waf-config').is(':visible')) {
401 WFAD.colorboxClose();
402 return;
403 }
404
405 var serverConfiguration = $('#wf-waf-server-config').val();
406
407 WFAD.ajax('wordfence_uninstallAutoPrepend', {serverConfiguration: serverConfiguration}, function(res) {
408 installUninstallResponseHandler('wordfence_uninstallAutoPrepend', res);
409 });
410 });
411 }});
412 };
413
414 $('#wf-waf-install').on('click', function(e) {
415 e.preventDefault();
416 e.stopPropagation();
417
418 var installer = $('#wafTmpl_install').tmpl();
419 var installerHTML = $("<div />").append(installer).html();
420 installUninstallHandler(installerHTML);
421 });
422
423 $('#wf-waf-uninstall').on('click', function(e) {
424 e.preventDefault();
425 e.stopPropagation();
426
427 var uninstaller = $('#wafTmpl_uninstall').tmpl();
428 var uninstallerHTML = $("<div />").append(uninstaller).html();
429 installUninstallHandler(uninstallerHTML);
430 });
431
432 if (window.location.hash) {
433 var hashes = WFAD.parseHashes();
434 for (var i = 0; i < hashes.length; i++) {
435 if (hashes[i] == 'configureAutoPrepend') {
436 $('#wf-waf-install').trigger('click');
437 history.replaceState('', document.title, window.location.pathname + window.location.search);
438 }
439 else if (hashes[i] == 'removeAutoPrepend') {
440 $('#wf-waf-uninstall').trigger('click');
441 history.replaceState('', document.title, window.location.pathname + window.location.search);
442 }
443 }
444 }
445
446 $(window).on('hashchange', function () {
447 var hashes = WFAD.parseHashes();
448 for (var i = 0; i < hashes.length; i++) {
449 if (hashes[i] == 'configureAutoPrepend') {
450 $('#wf-waf-install').trigger('click');
451 history.replaceState('', document.title, window.location.pathname + window.location.search);
452 }
453 else if (hashes[i] == 'removeAutoPrepend') {
454 $('#wf-waf-uninstall').trigger('click');
455 history.replaceState('', document.title, window.location.pathname + window.location.search);
456 }
457 }
458 });
459 });
460 })(jQuery);
461 </script>
462 </li>
463 <li id="wf-option-disableWAFBlacklistBlocking" class="wf-flex-vertical wf-flex-align-left">
464 <h3><?php esc_html_e('Real-Time IP Blacklist', 'wordfence'); ?></h3>
465 <?php if ($firewall->ruleMode() == wfFirewall::RULE_MODE_COMMUNITY): ?>
466 <p class="wf-no-top"><strong><?php _e('Premium Feature:', 'wordfence'); ?></strong> <?php _e('This feature blocks all traffic from IPs with a high volume of recent malicious activity using Wordfence\'s real-time blacklist.', 'wordfence'); ?></p>
467 <p><a class="wf-btn wf-btn-primary wf-btn-callout-subtle" href="https://www.wordfence.com/gnl1blacklistUpgrade/wordfence-signup/#premium-order-form" target="_blank" rel="noopener noreferrer"><?php _e('Upgrade to Premium', 'wordfence'); ?></a>&nbsp;&nbsp;<a class="wf-btn wf-btn-callout-subtle wf-btn-default" href="https://www.wordfence.com/gnl1blacklistLearn/wordfence-signup/" target="_blank" rel="noopener noreferrer"><?php _e('Learn More', 'wordfence'); ?></a></p>
468 <?php elseif ($firewall->isSubDirectoryInstallation()): ?>
469 <p class="wf-no-top"><?php printf(__('You are currently running the Wordfence Web Application Firewall from another WordPress installation. Please <a href="%s">click here</a> to configure the Firewall to run correctly on this site.', 'wordfence'), esc_attr(network_admin_url('admin.php?page=WordfenceWAF&subpage=waf_options#configureAutoPrepend'))); ?></p>
470 <?php else: ?>
471 <p class="wf-no-top"><?php _e('This feature blocks all traffic from IPs with a high volume of recent malicious activity using Wordfence\'s real-time blacklist.', 'wordfence'); ?></p>
472 <div class="wf-option wf-option-switch wf-padding-add-bottom" data-option-name="disableWAFBlacklistBlocking" data-original-value="<?php try { echo $config->getConfig('disableWAFBlacklistBlocking') ? '1': '0'; } catch (Exception $e) { echo 0; } ?>">
473 <ul class="wf-switch" role="radiogroup">
474 <?php
475 $states = array(
476 array('value' => '1', 'label' => __('Disabled', 'wordfence')),
477 array('value' => '0', 'label' => __('Enabled', 'wordfence')),
478 );
479
480 foreach ($states as $s):
481 $disableBlacklist = false;
482 try {
483 $disableBlacklist = !!$config->getConfig('disableWAFBlacklistBlocking');
484 }
485 catch (Exception $e) { }
486 ?>
487 <li<?php if ($s['value'] == ($disableBlacklist ? '1': '0')) { echo ' class="wf-active"'; } ?> data-option-value="<?php echo esc_attr($s['value']); ?>" role="radio" aria-checked="<?php echo (($s['value'] == ($disableBlacklist ? '1': '0')) ? 'true' : 'false'); ?>" tabindex="0"><?php echo esc_html($s['label']); ?></li>
488 <?php endforeach; ?>
489 </ul>
490 </div>
491 <?php endif; ?>
492 </li>
493 </ul>
494 </div>
495 </div>
496 </div>
497 </div> <!-- end basic firewall options -->
498 <?php
499 if ($firewall->protectionMode() == wfFirewall::PROTECTION_MODE_BASIC || ($firewall->protectionMode() == wfFirewall::PROTECTION_MODE_EXTENDED && $firewall->isSubDirectoryInstallation())) {
500 echo wfView::create('waf/waf-install', array(
501 ))->render();
502 }
503 else {
504 echo wfView::create('waf/waf-uninstall', array(
505 ))->render();
506 }
507 ?>