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
waf-uninstall.php
105 lines
| 1 | <?php |
| 2 | if (!defined('WORDFENCE_VERSION')) { exit; } |
| 3 | ?> |
| 4 | <script type="text/x-jquery-template" id="wafTmpl_uninstall"> |
| 5 | <div class="wf-modal"> |
| 6 | <div class="wf-modal-header"> |
| 7 | <div class="wf-modal-header-content"> |
| 8 | <div class="wf-modal-title"> |
| 9 | <strong><?php _e('Uninstall Wordfence Firewall', 'wordfence'); ?></strong> |
| 10 | </div> |
| 11 | </div> |
| 12 | <div class="wf-modal-header-action"> |
| 13 | <div><?php printf(__('If you cannot complete the uninstall process, <a target="_blank" rel="noopener noreferrer" href="%s">click here for help</a>', 'wordfence'), wfSupportController::esc_supportURL(wfSupportController::ITEM_FIREWALL_WAF_REMOVE_MANUALLY)); ?></div> |
| 14 | <div class="wf-padding-add-left-small wf-modal-header-action-close"><a href="#" onclick="WFAD.colorboxClose(); return false"><i class="wf-fa wf-fa-times-circle" aria-hidden="true"></i></a></div> |
| 15 | </div> |
| 16 | </div> |
| 17 | <div class="wf-modal-content"> |
| 18 | <?php |
| 19 | $currentAutoPrependFile = ini_get('auto_prepend_file'); |
| 20 | ?> |
| 21 | <p><?php _e('Extended Protection Mode of the Wordfence Web Application Firewall uses the PHP ini setting called <code>auto_prepend_file</code> in order to ensure it runs before any potentially vulnerable code runs. This PHP setting currently refers to the Wordfence file at:', 'wordfence'); ?></p> |
| 22 | <pre class='wf-pre'><?php echo esc_html($currentAutoPrependFile); ?></pre> |
| 23 | <?php |
| 24 | $contents = file_get_contents($currentAutoPrependFile); |
| 25 | $refersToWAF = preg_match('/define\s*\(\s*(["\'])WFWAF_LOG_PATH\1\s*,\s*(["\']).+?\2\s*\)\s*/', $contents); |
| 26 | |
| 27 | if (!$refersToWAF): |
| 28 | ?> |
| 29 | <p><?php printf(__('Automatic uninstallation cannot be completed, but you may still be able to <a href="%s" target="_blank" rel="noopener noreferrer">manually uninstall extended protection</a>.', 'wordfence'), wfSupportController::esc_supportURL(wfSupportController::ITEM_FIREWALL_WAF_REMOVE_MANUALLY)); ?></p> |
| 30 | <?php else: ?> |
| 31 | <p><?php _e('Before this file can be deleted, the configuration for the <code>auto_prepend_file</code> setting needs to be removed.', 'wordfence'); ?></p> |
| 32 | <?php |
| 33 | $serverInfo = wfWebServerInfo::createFromEnvironment(); |
| 34 | $dropdown = array( |
| 35 | array("apache-mod_php", __('Apache + mod_php', 'wordfence'), $serverInfo->isApacheModPHP(), wfWAFAutoPrependHelper::helper('apache-mod_php')->getFilesNeededForBackup()), |
| 36 | array("apache-suphp", __('Apache + suPHP', 'wordfence'), $serverInfo->isApacheSuPHP(), wfWAFAutoPrependHelper::helper('apache-suphp')->getFilesNeededForBackup()), |
| 37 | array("cgi", __('Apache + CGI/FastCGI', 'wordfence'), $serverInfo->isApache() && !$serverInfo->isApacheSuPHP() && ($serverInfo->isCGI() || $serverInfo->isFastCGI()), wfWAFAutoPrependHelper::helper('cgi')->getFilesNeededForBackup()), |
| 38 | array("litespeed", __('LiteSpeed/lsapi', 'wordfence'), $serverInfo->isLiteSpeed(), wfWAFAutoPrependHelper::helper('litespeed')->getFilesNeededForBackup()), |
| 39 | array("nginx", __('NGINX', 'wordfence'), $serverInfo->isNGINX(), wfWAFAutoPrependHelper::helper('nginx')->getFilesNeededForBackup()), |
| 40 | array("iis", __('Windows (IIS)', 'wordfence'), $serverInfo->isIIS(), wfWAFAutoPrependHelper::helper('iis')->getFilesNeededForBackup()), |
| 41 | ); |
| 42 | |
| 43 | $hasRecommendedOption = false; |
| 44 | $wafPrependOptions = ''; |
| 45 | foreach ($dropdown as $option) { |
| 46 | list($optionValue, $optionText, $selected) = $option; |
| 47 | $wafPrependOptions .= "<option value=\"{$optionValue}\"" . ($selected ? ' selected' : '') . ">{$optionText}" . ($selected ? ' (recommended based on our tests)' : '') . "</option>\n"; |
| 48 | if ($selected) { |
| 49 | $hasRecommendedOption = true; |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | if (!$hasRecommendedOption): ?> |
| 54 | <p><?php _e('If you know your web server\'s configuration, please select it from the list below.', 'wordfence'); ?></p> |
| 55 | <?php else: ?> |
| 56 | <p><?php _e('We\'ve preselected your server configuration based on our tests, but if you know your web server\'s configuration, please select it now.', 'wordfence'); ?></p> |
| 57 | <?php endif; ?> |
| 58 | <select name='serverConfiguration' id='wf-waf-server-config'> |
| 59 | <?php echo $wafPrependOptions; ?> |
| 60 | </select> |
| 61 | <?php |
| 62 | $adminURL = network_admin_url('admin.php?page=WordfenceWAF&subpage=waf_options&action=removeAutoPrepend'); |
| 63 | $wfnonce = wp_create_nonce('wfWAFRemoveAutoPrepend'); |
| 64 | foreach ($dropdown as $option): |
| 65 | list($optionValue, $optionText, $selected) = $option; |
| 66 | $class = preg_replace('/[^a-z0-9\-]/i', '', $optionValue); |
| 67 | $helper = new wfWAFAutoPrependHelper($optionValue, null); |
| 68 | $backups = $helper->getFilesNeededForBackup(); |
| 69 | $filteredBackups = array(); |
| 70 | foreach ($backups as $index => $backup) { |
| 71 | if (!file_exists($backup)) { |
| 72 | continue; |
| 73 | } |
| 74 | |
| 75 | $filteredBackups[$index] = $backup; |
| 76 | } |
| 77 | $jsonBackups = json_encode(array_map('basename', $filteredBackups)); |
| 78 | ?> |
| 79 | <div class="wf-waf-backups wf-waf-backups-<?php echo $class; ?>" style="display: none;" data-backups="<?php echo esc_attr($jsonBackups); ?>"> |
| 80 | <?php if (count($filteredBackups)): ?><p><?php _e('Please download a backup of the following files before we make the necessary changes:', 'wordfence'); ?></p><?php endif; ?> |
| 81 | <ul class="wf-waf-backup-file-list"> |
| 82 | <?php |
| 83 | foreach ($filteredBackups as $index => $backup) { |
| 84 | echo '<li><a class="wf-btn wf-btn-default wf-waf-backup-download" data-backup-index="' . $index . '" href="' . |
| 85 | esc_url(add_query_arg(array( |
| 86 | 'downloadBackup' => 1, |
| 87 | 'backupIndex' => $index, |
| 88 | 'serverConfiguration' => $helper->getServerConfig(), |
| 89 | 'wfnonce' => $wfnonce, |
| 90 | ), $adminURL)) . '">' . sprintf(__('Download %s', 'wordfence'), esc_html(basename($backup))) . '</a></li>'; |
| 91 | } |
| 92 | ?> |
| 93 | </ul> |
| 94 | </div> |
| 95 | <?php endforeach; ?> |
| 96 | <?php endif; ?> |
| 97 | </div> |
| 98 | <div class="wf-modal-footer"> |
| 99 | <ul class="wf-flex-horizontal wf-flex-full-width"> |
| 100 | <li class="wf-waf-download-instructions"><?php _e('Once you have downloaded the files, click Continue to complete uninstallation.', 'wordfence'); ?></li> |
| 101 | <li class="wf-right"><a href="#" class="wf-btn wf-btn-primary wf-btn-callout-subtle wf-disabled" id="wf-waf-uninstall-continue"><?php _e('Continue', 'wordfence'); ?></a></li> |
| 102 | </ul> |
| 103 | </div> |
| 104 | </div> |
| 105 | </script> |