<?php
/**
 * WAF Removal Modal
 * 
 * Modal for removing WAF optimization
 * 
 * @package VMPFence
 * @since 2.2.4
 */

if (!defined('ABSPATH')) {
    exit;
}
?>

<!-- WAF Removal Modal -->
<div id="vmpfence-waf-removal-modal" class="vmpfence-waf-modal" style="display: none;">
    <div class="vmpfence-waf-modal-overlay"></div>
    <div class="vmpfence-waf-modal-container">
        <div class="vmpfence-waf-modal-content">
            
            <!-- Step 1: Confirmation Screen -->
            <div class="vmpfence-waf-modal-screen" id="vmpfence-waf-removal-config-screen">
                <div class="vmpfence-waf-modal-header">
                    <h2>Uninstall VMP Security Firewall</h2>
                    <button type="button" class="vmpfence-waf-modal-close" onclick="vmpfenceCloseRemovalModal()">&times;</button>
                </div>
                
                
                
                <div class="vmpfence-waf-modal-body">
                    
                
                    <div class="vmpfence-waf-info-notice">
                        <p>Extended Protection Mode of the VMP Security 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 VMP Security file at:</p>
                    </div>
                    
                    <div class="vmpfence-waf-file-path-box">
                        <code id="vmpfence-waf-file-path-display">Loading...</code>
                    </div>
                    
                    <div class="vmpfence-waf-info-box">
                        <p>Before this file can be deleted, the configuration for the <code>auto_prepend_file</code> setting needs to be removed.</p>
                    </div>

                    <div class="vmpfence-waf-server-config-box">
                        <p>We've preselected your server configuration based on our tests, but if you know your web server's configuration, please select it now.</p>
                        <select id="vmpfence-waf-server-config-select" class="vmpfene-waf-select">
                            <option value="apache">Apache</option>
                            <!-- <option value="apache_suphp">Apache + suPHP</option> -->
                            <!-- <option value="apache_cgi">Apache + CGI/FastCGI</option> -->
                            <option value="litespeed">LiteSpeed</option>
                            <!-- <option value="nginx">NGINX</option> -->
                            <!-- <option value="iis">Windows (IIS)</option> -->
                        </select>
                    </div>

                    <div class="vmpfence-waf-instruction-box">
                        <p>Please download a backup of the following files before we make the necessary changes:</p>
                        <button type="button" class="vmpfence-waf-btn vmpfence-waf-btn-default" onclick="vmpfenceDownloadHtaccess()">
                        DOWNLOAD .HTACCESS BACKUP
                    </button>
                    </div>
                    
                    <!-- Error display -->
                    <div class="vmpfence-waf-error-box" id="vmpfence-waf-removal-error-display" style="display: none;">
                        <strong>Error:</strong>
                        <p id="vmpfence-waf-removal-error-message"></p>
                    </div>
                </div>
                
                <div class="vmpfence-waf-modal-footer">
                    <p> Once you have downloaded the files, click Continue to complete the setup.</p>
                    <button type="button" class="vmpfence-waf-btn vmpfence-waf-btn-danger" id="vmpfence-waf-removal-continue-btn" onclick="vmpfenceStartRemoval()" disabled>
                        CONTINUE
                    </button>
                </div>
            </div>
            
            <!-- Step 2: Processing Screen -->
            <div class="vmpfence-waf-modal-screen" id="vmpfence-waf-removal-processing-screen" style="display: none;">
                <div class="vmpfence-waf-modal-header">
                    <h2>Waiting for Changes</h2>
                </div>
                
                <!-- <div class="vmpfence-waf-help-notice">
                    <p>If you cannot complete the uninstall process, <a href="https://docs.vmpfence.com/help/uninstall" target="_blank">click here for help</a></p>
                </div> -->
                
                <div class="vmpfence-waf-modal-body">
                    <div class="vmpfence-waf-waiting-box">
                        <p>The <code>auto_prepend_file</code> setting has been successfully removed from <code>.htaccess</code> and <code>.user.ini</code>. Once this change takes effect, Extended Protection Mode will be disabled.</p>
                        <div class="vmpfence-waf-spinner-container">
                            <div class="vmpfence-waf-spinner"></div>
                            <p class="vmpfence-waf-waiting-text">Waiting for it to take effect. This may take up to 30 seconds.</p>
                        </div>
                    </div>
                </div>
                
                <div class="vmpfence-waf-modal-footer">
                    <button type="button" class="vmpfence-waf-btn vmpfence-waf-btn-primary" onclick="vmpfenceCloseRemovalModal()">
                        CLOSE
                    </button>
                </div>
            </div>
            
            <!-- Step 3: Success Screen -->
            <div class="vmpfence-waf-modal-screen" id="vmpfence-waf-removal-success-screen" style="display: none;">
                <div class="vmpfence-waf-modal-header">
                    <h2>Uninstallation Complete</h2>
                    <button type="button" class="vmpfence-waf-modal-close" onclick="vmpfenceCloseRemovalModal()">&times;</button>
                </div>
                
                <div class="vmpfence-waf-modal-body">
                    <div class="vmpfence-waf-simple-success-box">
                        <p>Uninstallation was successful!</p>
                    </div>
                </div>
                
                <div class="vmpfence-waf-modal-footer">
                    <button type="button" class="vmpfence-waf-btn vmpfence-waf-btn-primary" onclick="vmpfenceCloseRemovalModal()">
                        CLOSE
                    </button>
                </div>
            </div>
            
        </div>
    </div>
</div>
