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
option-whitelist.php
180 lines
| 1 | <?php |
| 2 | if (!defined('WORDFENCE_VERSION')) { exit; } |
| 3 | ?> |
| 4 | <ul id="wf-option-wafWhitelist" class="wf-option wf-flex-vertical wf-flex-full-width"> |
| 5 | <li><strong><?php _e('Add Whitelisted URL/Param', 'wordfence'); ?></strong> <a href="<?php echo wfSupportController::esc_supportURL(wfSupportController::ITEM_FIREWALL_WAF_WHITELIST); ?>" target="_blank" rel="noopener noreferrer" class="wf-inline-help"><i class="wf-fa wf-fa-question-circle-o" aria-hidden="true"></i></a> <?php _e('The URL/parameters in this table will not be tested by the firewall. They are typically added while the firewall is in Learning Mode or by an admin who identifies a particular action/request is a false positive.', 'wordfence'); ?></li> |
| 6 | <li id="whitelist-form"> |
| 7 | <div class="wf-form-inline"> |
| 8 | <div class="wf-form-group"> |
| 9 | <input class="wf-form-control" type="text" name="whitelistURL" id="whitelistURL" placeholder="<?php esc_attr_e('URL', 'wordfence'); ?>"> |
| 10 | </div> |
| 11 | <div class="wf-form-group"> |
| 12 | <select class="wf-form-control" name="whitelistParam" id="whitelistParam"> |
| 13 | <option value="request.body"><?php _e('POST Body', 'wordfence'); ?></option> |
| 14 | <option value="request.cookies"><?php _e('Cookie', 'wordfence'); ?></option> |
| 15 | <option value="request.fileNames"><?php _e('File Name', 'wordfence'); ?></option> |
| 16 | <option value="request.headers"><?php _e('Header', 'wordfence'); ?></option> |
| 17 | <option value="request.queryString"><?php _e('Query String', 'wordfence'); ?></option> |
| 18 | </select> |
| 19 | </div> |
| 20 | <div class="wf-form-group"> |
| 21 | <input class="wf-form-control" type="text" name="whitelistParamName" id="whitelistParamName" placeholder="<?php esc_attr_e('Param Name', 'wordfence'); ?>"> |
| 22 | </div> |
| 23 | <a href="#" class="wf-btn wf-btn-callout wf-btn-primary wf-disabled" id="waf-whitelisted-urls-add"><?php _e('Add', 'wordfence'); ?></a> |
| 24 | </div> |
| 25 | <script type="application/javascript"> |
| 26 | (function($) { |
| 27 | $(function() { |
| 28 | $('#whitelistURL, #whitelistParamName').on('change paste keyup', function() { |
| 29 | setTimeout(function() { |
| 30 | $('#waf-whitelisted-urls-add').toggleClass('wf-disabled', $('#whitelistURL').val().length == 0 || $('#whitelistParamName').val().length == 0); |
| 31 | }, 100); |
| 32 | }); |
| 33 | |
| 34 | $('#waf-whitelisted-urls-add').on('click', function(e) { |
| 35 | e.preventDefault(); |
| 36 | e.stopPropagation(); |
| 37 | |
| 38 | var form = $('#whitelist-form'); |
| 39 | var inputURL = form.find('[name=whitelistURL]'); |
| 40 | var inputParam = form.find('[name=whitelistParam]'); |
| 41 | var inputParamName = form.find('[name=whitelistParamName]'); |
| 42 | |
| 43 | var url = inputURL.val(); |
| 44 | var param = inputParam.val(); |
| 45 | var paramName = inputParamName.val(); |
| 46 | if (url && param) { |
| 47 | <?php $user = wp_get_current_user(); ?> |
| 48 | var paramKey = WFAD.base64_encode(param + '[' + paramName + ']'); |
| 49 | var pathKey = WFAD.base64_encode(url); |
| 50 | var key = pathKey + '|' + paramKey; |
| 51 | var matches = $('#waf-whitelisted-urls-wrapper .whitelist-table > tbody > tr[data-key="' + key + '"]'); |
| 52 | if (matches.length > 0) { |
| 53 | WFAD.colorboxModal((WFAD.isSmallScreen ? '300px' : '400px'), '<?php esc_attr_e('Whitelist Entry Exists', 'wordfence'); ?>', '<?php esc_attr_e('A whitelist entry for this URL and parameter already exists.', 'wordfence'); ?>'); |
| 54 | return; |
| 55 | } |
| 56 | |
| 57 | //Generate entry and add to display data set |
| 58 | var entry = { |
| 59 | data: { |
| 60 | description: "<?php esc_attr_e('Whitelisted via Firewall Options page', 'wordfence'); ?>", |
| 61 | source: 'waf-options', |
| 62 | disabled: false, |
| 63 | ip: "<?php echo esc_attr(wfUtils::getIP()); ?>", |
| 64 | timestamp: Math.round(Date.now() / 1000), |
| 65 | userID: <?php echo (int) $user->ID; ?>, |
| 66 | username: "<?php echo esc_attr($user->user_login); ?>" |
| 67 | }, |
| 68 | paramKey: paramKey, |
| 69 | path: pathKey, |
| 70 | ruleID: ['all'], |
| 71 | adding: true |
| 72 | }; |
| 73 | WFAD.wafData.whitelistedURLParams.push(entry); |
| 74 | |
| 75 | //Add to change list |
| 76 | if (!(WFAD.pendingChanges['whitelistedURLParams'] instanceof Object)) { |
| 77 | WFAD.pendingChanges['whitelistedURLParams'] = {}; |
| 78 | } |
| 79 | |
| 80 | if (!(WFAD.pendingChanges['whitelistedURLParams']['add'] instanceof Object)) { |
| 81 | WFAD.pendingChanges['whitelistedURLParams']['add'] = {}; |
| 82 | } |
| 83 | |
| 84 | WFAD.pendingChanges['whitelistedURLParams']['add'][key] = entry; |
| 85 | WFAD.updatePendingChanges(); |
| 86 | |
| 87 | //Reload and reset add form |
| 88 | var whitelistedIPsEl = $('#waf-whitelisted-urls-tmpl').tmpl(WFAD.wafData); |
| 89 | $('#waf-whitelisted-urls-wrapper').html(whitelistedIPsEl); |
| 90 | $(window).trigger('wordfenceWAFInstallWhitelistEventHandlers'); |
| 91 | |
| 92 | inputURL.val(''); |
| 93 | inputParamName.val(''); |
| 94 | } |
| 95 | }); |
| 96 | }); |
| 97 | })(jQuery); |
| 98 | </script> |
| 99 | </li> |
| 100 | <li><hr id="whitelist-form-separator"></li> |
| 101 | <li id="whitelist-table-controls" class="wf-flex-horizontal wf-flex-vertical-xs wf-flex-full-width"> |
| 102 | <div><a href="#" id="whitelist-bulk-delete" class="wf-btn wf-btn-callout wf-btn-default"><?php _e('Delete', 'wordfence'); ?></a> <a href="#" id="whitelist-bulk-enable" class="wf-btn wf-btn-callout wf-btn-default"><?php _e('Enable', 'wordfence'); ?></a> <a href="#" id="whitelist-bulk-disable" class="wf-btn wf-btn-callout wf-btn-default"><?php _e('Disable', 'wordfence'); ?></a></div> |
| 103 | <div class="wf-right wf-left-xs wf-padding-add-top-xs-small"> |
| 104 | <div class="wf-select-group wf-flex-vertical-xs wf-flex-full-width"> |
| 105 | <select name="filterColumn"> |
| 106 | <option value="url"><?php _e('URL', 'wordfence'); ?></option> |
| 107 | <option value="param"><?php _e('Param', 'wordfence'); ?></option> |
| 108 | <option value="source"><?php _e('Source', 'wordfence'); ?></option> |
| 109 | <option value="user"><?php _e('User', 'wordfence'); ?></option> |
| 110 | <option value="ip"><?php _e('IP', 'wordfence'); ?></option> |
| 111 | </select> |
| 112 | <input type="text" class="wf-form-control" placeholder="<?php esc_attr_e('Filter Value', 'wordfence'); ?>" name="filterValue"> |
| 113 | <div><span class="wf-hidden-xs"> </span><a href="#" id="whitelist-apply-filter" class="wf-btn wf-btn-callout wf-btn-default"><?php _e('Filter', 'wordfence'); ?></a></div> |
| 114 | </div> |
| 115 | <script type="application/javascript"> |
| 116 | (function($) { |
| 117 | $(function() { |
| 118 | $('#whitelist-apply-filter').on('click', function(e) { |
| 119 | e.preventDefault(); |
| 120 | e.stopPropagation(); |
| 121 | |
| 122 | $(window).trigger('wordfenceWAFApplyWhitelistFilter'); |
| 123 | }); |
| 124 | }); |
| 125 | })(jQuery); |
| 126 | </script> |
| 127 | </div> |
| 128 | </li> |
| 129 | <li> |
| 130 | <div id="waf-whitelisted-urls-wrapper"></div> |
| 131 | </li> |
| 132 | </ul> |
| 133 | <script type="application/javascript"> |
| 134 | (function($) { |
| 135 | $(function() { |
| 136 | $('#whitelistParam').wfselect2({ |
| 137 | minimumResultsForSearch: -1, |
| 138 | templateSelection: function(item) { |
| 139 | return 'Param Type: ' + item.text; |
| 140 | } |
| 141 | }); |
| 142 | |
| 143 | $('#whitelist-table-controls select').wfselect2({ |
| 144 | minimumResultsForSearch: -1, |
| 145 | placeholder: "Filter By", |
| 146 | width: '200px', |
| 147 | templateSelection: function(item) { |
| 148 | return 'Filter By: ' + item.text; |
| 149 | } |
| 150 | }); |
| 151 | |
| 152 | $('#whitelist-bulk-delete').on('click', function(e) { |
| 153 | e.preventDefault(); |
| 154 | e.stopPropagation(); |
| 155 | |
| 156 | WFAD.wafWhitelistedBulkDelete(); |
| 157 | WFAD.updatePendingChanges(); |
| 158 | var whitelistedIPsEl = $('#waf-whitelisted-urls-tmpl').tmpl(WFAD.wafData); |
| 159 | $('#waf-whitelisted-urls-wrapper').html(whitelistedIPsEl); |
| 160 | $(window).trigger('wordfenceWAFInstallWhitelistEventHandlers'); |
| 161 | }); |
| 162 | |
| 163 | $('#whitelist-bulk-enable').on('click', function(e) { |
| 164 | e.preventDefault(); |
| 165 | e.stopPropagation(); |
| 166 | |
| 167 | WFAD.wafWhitelistedBulkChangeEnabled(true); |
| 168 | WFAD.updatePendingChanges(); |
| 169 | }); |
| 170 | |
| 171 | $('#whitelist-bulk-disable').on('click', function(e) { |
| 172 | e.preventDefault(); |
| 173 | e.stopPropagation(); |
| 174 | |
| 175 | WFAD.wafWhitelistedBulkChangeEnabled(false); |
| 176 | WFAD.updatePendingChanges(); |
| 177 | }); |
| 178 | }); |
| 179 | })(jQuery); |
| 180 | </script> |