Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/wordfenc.../views/waf
File: options-group-advanced-firewall.php
<?php
[0] Fix | Delete
if (!defined('WORDFENCE_VERSION')) { exit; }
[1] Fix | Delete
/**
[2] Fix | Delete
* Presents the Advanced Firewall Options group.
[3] Fix | Delete
*
[4] Fix | Delete
* Expects $firewall, $waf, and $stateKey.
[5] Fix | Delete
*
[6] Fix | Delete
* @var wfFirewall $firewall
[7] Fix | Delete
* @var wfWAF $waf
[8] Fix | Delete
* @var string $stateKey The key under which the collapse state is stored.
[9] Fix | Delete
* @var bool $collapseable If defined, specifies whether or not this grouping can be collapsed. Defaults to true.
[10] Fix | Delete
*/
[11] Fix | Delete
[12] Fix | Delete
$config = $waf->getStorageEngine();
[13] Fix | Delete
[14] Fix | Delete
if (!isset($collapseable)) {
[15] Fix | Delete
$collapseable = true;
[16] Fix | Delete
}
[17] Fix | Delete
?>
[18] Fix | Delete
<div class="wf-row">
[19] Fix | Delete
<div class="wf-col-xs-12">
[20] Fix | Delete
<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); ?>">
[21] Fix | Delete
<div class="wf-block-header">
[22] Fix | Delete
<div class="wf-block-header-content">
[23] Fix | Delete
<div class="wf-block-title">
[24] Fix | Delete
<strong><?php esc_html_e('Advanced Firewall Options', 'wordfence'); ?></strong>
[25] Fix | Delete
</div>
[26] Fix | Delete
<?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; ?>
[27] Fix | Delete
</div>
[28] Fix | Delete
</div>
[29] Fix | Delete
<div class="wf-block-content">
[30] Fix | Delete
<ul class="wf-block-list">
[31] Fix | Delete
<li>
[32] Fix | Delete
<?php
[33] Fix | Delete
echo wfView::create('options/option-toggled', array(
[34] Fix | Delete
'optionName' => 'disableWAFIPBlocking',
[35] Fix | Delete
'enabledValue' => 1,
[36] Fix | Delete
'disabledValue' => 0,
[37] Fix | Delete
'value' => wfConfig::get('disableWAFIPBlocking') ? 1 : 0,
[38] Fix | Delete
'title' => __('Delay IP and Country blocking until after WordPress and plugins have loaded (only process firewall rules early)', 'wordfence'),
[39] Fix | Delete
'subtitle' => ($firewall->isSubDirectoryInstallation() ? __('You are currently running the WAF from another WordPress installation. This option can be changed once you configure the firewall to run correctly on this site.', 'wordfence') : ''),
[40] Fix | Delete
'helpLink' => wfSupportController::supportURL(wfSupportController::ITEM_FIREWALL_WAF_OPTION_DELAY_BLOCKING),
[41] Fix | Delete
'disabled' => $firewall->isSubDirectoryInstallation(),
[42] Fix | Delete
))->render();
[43] Fix | Delete
?>
[44] Fix | Delete
</li>
[45] Fix | Delete
<li>
[46] Fix | Delete
<?php
[47] Fix | Delete
echo wfView::create('options/option-textarea', array(
[48] Fix | Delete
'textOptionName' => 'whitelisted',
[49] Fix | Delete
'textValue' => wfUtils::cleanupOneEntryPerLine(wfConfig::get('whitelisted')),
[50] Fix | Delete
'title' => __('Allowlisted IP addresses that bypass all rules', 'wordfence'),
[51] Fix | Delete
'alignTitle' => 'top',
[52] Fix | Delete
'subtitleHTML' => wp_kses(__('Allowlisted IPs must be separated by commas or placed on separate lines. You can specify ranges using the following formats: 127.0.0.1/24, 127.0.0.[1-100], or 127.0.0.1-127.0.1.100<br/>Wordfence automatically allowlists <a href="http://en.wikipedia.org/wiki/Private_network" target="_blank" rel="noopener noreferrer">private networks<span class="screen-reader-text"> (opens in new tab)</span></a> because these are not routable on the public Internet.', 'wordfence'), array('br'=>array(), 'a'=>array('href'=>array(), 'target'=>array(), 'rel'=>array()), 'span'=>array('class'=>array()))),
[53] Fix | Delete
'subtitlePosition' => 'value',
[54] Fix | Delete
'helpLink' => wfSupportController::supportURL(wfSupportController::ITEM_FIREWALL_WAF_OPTION_WHITELISTED_IPS),
[55] Fix | Delete
))->render();
[56] Fix | Delete
?>
[57] Fix | Delete
</li>
[58] Fix | Delete
<li>
[59] Fix | Delete
<?php
[60] Fix | Delete
$whitelistedServices = wfConfig::getJSON('whitelistedServices', array());
[61] Fix | Delete
$whitelistPresets = wfUtils::whitelistPresets();
[62] Fix | Delete
[63] Fix | Delete
$names = array();
[64] Fix | Delete
foreach ($whitelistPresets as $tag => $preset) {
[65] Fix | Delete
if (!isset($preset['n'])) { continue; } //Not named, omitted from configurable list
[66] Fix | Delete
if ((isset($preset['h']) && $preset['h']) || (isset($preset['f']) && $preset['f'])) { continue; } //Flagged as hidden or always enabled, omitted from configurable list
[67] Fix | Delete
$names[$tag] = $preset['n'];
[68] Fix | Delete
if (!isset($whitelistedServices[$tag]) && isset($preset['d']) && $preset['d']) {
[69] Fix | Delete
$whitelistedServices[$tag] = 1;
[70] Fix | Delete
}
[71] Fix | Delete
}
[72] Fix | Delete
[73] Fix | Delete
$options = array();
[74] Fix | Delete
foreach ($names as $tag => $name) {
[75] Fix | Delete
$options[] = array(
[76] Fix | Delete
'name' => 'whitelistedServices.' . preg_replace('/[^a-z0-9]/i', '', $tag),
[77] Fix | Delete
'enabledValue' => 1,
[78] Fix | Delete
'disabledValue' => 0,
[79] Fix | Delete
'value' => (isset($whitelistedServices[$tag]) && $whitelistedServices[$tag]) ? 1 : 0,
[80] Fix | Delete
'title' => $name,
[81] Fix | Delete
);
[82] Fix | Delete
}
[83] Fix | Delete
[84] Fix | Delete
echo wfView::create('options/option-toggled-multiple', array(
[85] Fix | Delete
'options' => $options,
[86] Fix | Delete
'title' => __('Allowlisted services', 'wordfence'),
[87] Fix | Delete
'id' => 'wf-option-whitelistedServices',
[88] Fix | Delete
'helpLink' => wfSupportController::supportURL(wfSupportController::ITEM_FIREWALL_WAF_OPTION_WHITELISTED_SERVICES),
[89] Fix | Delete
))->render();
[90] Fix | Delete
?>
[91] Fix | Delete
</li>
[92] Fix | Delete
<li>
[93] Fix | Delete
<?php
[94] Fix | Delete
echo wfView::create('options/option-textarea', array(
[95] Fix | Delete
'textOptionName' => 'bannedURLs',
[96] Fix | Delete
'textValue' => wfUtils::cleanupOneEntryPerLine(wfConfig::get('bannedURLs')),
[97] Fix | Delete
'title' => __('Immediately block IPs that access these URLs', 'wordfence'),
[98] Fix | Delete
'alignTitle' => 'top',
[99] Fix | Delete
'subtitle' => __('Separate multiple URLs with commas or place them on separate lines. Asterisks are wildcards, but use with care. If you see an attacker repeatedly probing your site for a known vulnerability you can use this to immediately block them. All URLs must start with a "/" without quotes and must be relative. e.g. /badURLone/, /bannedPage.html, /dont-access/this/URL/, /starts/with-*', 'wordfence'),
[100] Fix | Delete
'subtitlePosition' => 'value',
[101] Fix | Delete
'helpLink' => wfSupportController::supportURL(wfSupportController::ITEM_FIREWALL_WAF_OPTION_IMMEDIATELY_BLOCK_URLS),
[102] Fix | Delete
))->render();
[103] Fix | Delete
?>
[104] Fix | Delete
</li>
[105] Fix | Delete
<li>
[106] Fix | Delete
<?php
[107] Fix | Delete
echo wfView::create('options/option-textarea', array(
[108] Fix | Delete
'textOptionName' => 'wafAlertWhitelist',
[109] Fix | Delete
'textValue' => wfUtils::cleanupOneEntryPerLine(wfConfig::get('wafAlertWhitelist')),
[110] Fix | Delete
'title' => __('Ignored IP addresses for Wordfence Web Application Firewall alerting', 'wordfence'),
[111] Fix | Delete
'alignTitle' => 'top',
[112] Fix | Delete
'subtitle' => __('Ignored IPs must be separated by commas or placed on separate lines. These addresses will be ignored from any alerts about increased attacks and can be used to ignore things like standalone website security scanners.', 'wordfence'),
[113] Fix | Delete
'subtitlePosition' => 'value',
[114] Fix | Delete
'helpLink' => wfSupportController::supportURL(wfSupportController::ITEM_FIREWALL_WAF_IGNORED_ALERT_IPS),
[115] Fix | Delete
))->render();
[116] Fix | Delete
?>
[117] Fix | Delete
</li>
[118] Fix | Delete
<li>
[119] Fix | Delete
<?php
[120] Fix | Delete
echo wfView::create('waf/option-rules', array(
[121] Fix | Delete
'firewall' => $firewall,
[122] Fix | Delete
))->render();
[123] Fix | Delete
?>
[124] Fix | Delete
</li>
[125] Fix | Delete
</ul>
[126] Fix | Delete
</div>
[127] Fix | Delete
</div>
[128] Fix | Delete
</div>
[129] Fix | Delete
</div> <!-- end advanced firewall options -->
[130] Fix | Delete
<script type="text/x-jquery-template" id="waf-rules-tmpl">
[131] Fix | Delete
<table class="wf-striped-table">
[132] Fix | Delete
<thead>
[133] Fix | Delete
<tr>
[134] Fix | Delete
<th style="width: 5%"></th>
[135] Fix | Delete
<th><?php esc_html_e('Category', 'wordfence'); ?></th>
[136] Fix | Delete
<th><?php esc_html_e('Description', 'wordfence'); ?></th>
[137] Fix | Delete
</tr>
[138] Fix | Delete
</thead>
[139] Fix | Delete
<tbody>
[140] Fix | Delete
{{each(idx, rule) rules}}
[141] Fix | Delete
<tr data-rule-id="${rule.ruleID}" data-original-value="{{if (!disabledRules[rule.ruleID])}}1{{else}}0{{/if}}">
[142] Fix | Delete
<td style="text-align: center">
[143] Fix | Delete
<div class="wf-rule-toggle wf-boolean-switch{{if (!disabledRules[rule.ruleID])}} wf-active{{/if}}<?php echo ($firewall->isSubDirectoryInstallation() ? ' wf-disabled' : ''); ?>"><a href="#" class="wf-boolean-switch-handle"></a></div>
[144] Fix | Delete
</td>
[145] Fix | Delete
<td>${rule.category}</td>
[146] Fix | Delete
<td>${rule.description}</td>
[147] Fix | Delete
</tr>
[148] Fix | Delete
{{/each}}
[149] Fix | Delete
{{if (rules.length == 0)}}
[150] Fix | Delete
<tr>
[151] Fix | Delete
<td colspan="4"><?php esc_html_e('No rules currently set.', 'wordfence'); ?> <?php if (!($firewall->protectionMode() == wfFirewall::PROTECTION_MODE_EXTENDED && $firewall->isSubDirectoryInstallation())) { echo wp_kses(__('<a href="#" onclick="WFAD.wafUpdateRules();return false;" role="button">Click here</a> to pull down the latest from the Wordfence servers.', 'wordfence'), array('a'=>array('href'=>array(), 'onclick'=>array(), 'role'=>array()))); } ?>
[152] Fix | Delete
</td>
[153] Fix | Delete
</tr>
[154] Fix | Delete
{{/if}}
[155] Fix | Delete
</tbody>
[156] Fix | Delete
<tfoot>
[157] Fix | Delete
{{if (ruleCount >= 10)}}
[158] Fix | Delete
<tr id="waf-show-all-rules">
[159] Fix | Delete
<td class="wf-center" colspan="4"><a href="#" id="waf-show-all-rules-button" role="button"><?php esc_html_e('SHOW ALL RULES', 'wordfence'); ?></a></td>
[160] Fix | Delete
</tr>
[161] Fix | Delete
{{/if}}
[162] Fix | Delete
</tfoot>
[163] Fix | Delete
</table>
[164] Fix | Delete
</script>
[165] Fix | Delete
<script type="application/javascript">
[166] Fix | Delete
(function($) {
[167] Fix | Delete
$(window).on('wordfenceWAFConfigPageRender', function() {
[168] Fix | Delete
delete WFAD.pendingChanges['wafRules'];
[169] Fix | Delete
[170] Fix | Delete
//Add event handler to rule checkboxes
[171] Fix | Delete
$('.wf-rule-toggle.wf-boolean-switch').each(function() {
[172] Fix | Delete
$(this).on('keydown', function(e) {
[173] Fix | Delete
if (e.keyCode == 32) {
[174] Fix | Delete
e.preventDefault();
[175] Fix | Delete
e.stopPropagation();
[176] Fix | Delete
[177] Fix | Delete
$(this).find('.wf-boolean-switch-handle').trigger('click');
[178] Fix | Delete
}
[179] Fix | Delete
});
[180] Fix | Delete
[181] Fix | Delete
$(this).on('click', function(e) {
[182] Fix | Delete
e.preventDefault();
[183] Fix | Delete
e.stopPropagation();
[184] Fix | Delete
[185] Fix | Delete
$(this).find('.wf-boolean-switch-handle').trigger('click');
[186] Fix | Delete
});
[187] Fix | Delete
[188] Fix | Delete
$(this).find('.wf-boolean-switch-handle').on('keydown', function(e) {
[189] Fix | Delete
if (e.keyCode == 32) {
[190] Fix | Delete
e.preventDefault();
[191] Fix | Delete
e.stopPropagation();
[192] Fix | Delete
[193] Fix | Delete
$(this).trigger('click');
[194] Fix | Delete
}
[195] Fix | Delete
});
[196] Fix | Delete
[197] Fix | Delete
$(this).find('.wf-boolean-switch-handle').on('click', function(e) {
[198] Fix | Delete
e.preventDefault();
[199] Fix | Delete
e.stopPropagation();
[200] Fix | Delete
[201] Fix | Delete
var control = $(this).closest('.wf-boolean-switch');
[202] Fix | Delete
var row = $(this).closest('tr');
[203] Fix | Delete
var ruleID = row.data('ruleId');
[204] Fix | Delete
var value = control.hasClass('wf-active') ? 1 : 0;
[205] Fix | Delete
if (value) {
[206] Fix | Delete
control.removeClass('wf-active').attr('aria-checked', 'false');
[207] Fix | Delete
value = 0;
[208] Fix | Delete
}
[209] Fix | Delete
else {
[210] Fix | Delete
control.addClass('wf-active').attr('aria-checked', 'false');
[211] Fix | Delete
value = 1;
[212] Fix | Delete
}
[213] Fix | Delete
[214] Fix | Delete
var originalValue = row.data('originalValue');
[215] Fix | Delete
if (originalValue == value) {
[216] Fix | Delete
delete WFAD.pendingChanges['wafRules'][ruleID];
[217] Fix | Delete
if (Object.keys(WFAD.pendingChanges['wafRules']).length == 0) {
[218] Fix | Delete
delete WFAD.pendingChanges['wafRules']
[219] Fix | Delete
}
[220] Fix | Delete
}
[221] Fix | Delete
else {
[222] Fix | Delete
if (!(WFAD.pendingChanges['wafRules'] instanceof Object)) {
[223] Fix | Delete
WFAD.pendingChanges['wafRules'] = {};
[224] Fix | Delete
}
[225] Fix | Delete
WFAD.pendingChanges['wafRules'][ruleID] = value;
[226] Fix | Delete
}
[227] Fix | Delete
[228] Fix | Delete
$(control).trigger('change', [false]);
[229] Fix | Delete
WFAD.updatePendingChanges();
[230] Fix | Delete
});
[231] Fix | Delete
});
[232] Fix | Delete
});
[233] Fix | Delete
})(jQuery);
[234] Fix | Delete
</script>
[235] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function