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-rules.php
57 lines
| 1 | <?php |
| 2 | if (!defined('WORDFENCE_VERSION')) { exit; } |
| 3 | ?> |
| 4 | <ul id="wf-option-wafRules" class="wf-option wf-flex-vertical wf-flex-align-left"> |
| 5 | <li class="wf-option-title"><strong><?php _e('Rules', 'wordfence'); ?></strong> <a href="<?php echo wfSupportController::esc_supportURL(wfSupportController::ITEM_FIREWALL_WAF_RULES); ?>" target="_blank" rel="noopener noreferrer" class="wf-inline-help"><i class="wf-fa wf-fa-question-circle-o" aria-hidden="true"></i></a></li> |
| 6 | <li class="wf-option-subtitle"><?php echo ($firewall->isSubDirectoryInstallation() ? __('You are currently running the WAF from another WordPress installation. These rules can be disabled or enabled once you configure the firewall to run correctly on this site.', 'wordfence') : ''); ?></li> |
| 7 | <li id="waf-rules-wrapper" class="wf-add-top"></li> |
| 8 | <?php if (!WFWAF_SUBDIRECTORY_INSTALL): ?> |
| 9 | <li id="waf-rules-manual-update"> |
| 10 | <ul class="wf-option wf-option-footer wf-padding-no-bottom"> |
| 11 | <li><a class="wf-btn wf-btn-default waf-rules-refresh" href="#"><?php _e('Manually Refresh Rules', 'wordfence'); ?></a> </li> |
| 12 | <li class="wf-padding-add-top-xs-small"><em id="waf-rules-next-update"></em></li> |
| 13 | </ul> |
| 14 | <script type="application/javascript"> |
| 15 | (function($) { |
| 16 | $('.waf-rules-refresh').on('click', function(e) { |
| 17 | e.preventDefault(); |
| 18 | e.stopPropagation(); |
| 19 | |
| 20 | WFAD.wafUpdateRules(); |
| 21 | }); |
| 22 | })(jQuery); |
| 23 | <?php |
| 24 | try { |
| 25 | $lastUpdated = wfWAF::getInstance()->getStorageEngine()->getConfig('rulesLastUpdated', null, 'transient'); |
| 26 | |
| 27 | $nextUpdate = PHP_INT_MAX; |
| 28 | $cron = (array) wfWAF::getInstance()->getStorageEngine()->getConfig('cron', null, 'livewaf'); |
| 29 | if (is_array($cron)) { |
| 30 | /** @var wfWAFCronEvent $event */ |
| 31 | foreach ($cron as $index => $event) { |
| 32 | if ($event instanceof wfWAFCronFetchRulesEvent) { |
| 33 | $event->setWaf(wfWAF::getInstance()); |
| 34 | if (!$event->isInPast()) { |
| 35 | $nextUpdate = min($nextUpdate, $event->getFireTime()); |
| 36 | } |
| 37 | } |
| 38 | } |
| 39 | } |
| 40 | } |
| 41 | catch (wfWAFStorageFileException $e) { |
| 42 | error_log($e->getMessage()); |
| 43 | } |
| 44 | if (!empty($lastUpdated)): ?> |
| 45 | var lastUpdated = <?php echo (int) $lastUpdated ?>; |
| 46 | WFAD.renderWAFRulesLastUpdated(new Date(lastUpdated * 1000)); |
| 47 | <?php endif ?> |
| 48 | |
| 49 | <?php if ($nextUpdate < PHP_INT_MAX): ?> |
| 50 | var nextUpdate = <?php echo (int) $nextUpdate ?>; |
| 51 | WFAD.renderWAFRulesNextUpdate(new Date(nextUpdate * 1000)); |
| 52 | <?php endif ?> |
| 53 | </script> |
| 54 | </li> |
| 55 | <?php endif ?> |
| 56 | </ul> |
| 57 |