<?php if (!defined('DASHBOARD_ROOT')) { http_response_code(403); exit; } $aid = $_SESSION['admin_id'] ?? 0; $manifestPath = PRIVATE_DIR . '/manifest.php'; $manifestExists = file_exists($manifestPath); $manifest = $manifestExists ? require($manifestPath) : ['css' => [], 'tables' => [], 'columns' => [], 'files' => [], 'ids' => []]; if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['_obf_action'])) { while (ob_get_level()) { ob_end_clean(); } header('Content-Type: application/json'); CSRF::enforce(); $act = $_POST['_obf_action']; if ($act === 'status') { $stats = [ 'css_classes' => count($manifest['css'] ?? []), 'tables' => count($manifest['tables'] ?? []), 'columns' => count($manifest['columns'] ?? []), 'files' => count($manifest['files'] ?? []), 'ids' => count($manifest['ids'] ?? []), 'manifest_exists' => $manifestExists, 'last_rotation' => $manifestExists ? date('Y-m-d H:i', filemtime($manifestPath)) : null, ]; exit(json_encode(['ok' => true, 'stats' => $stats])); } if ($act === 'preview') { $sample = []; foreach (array_slice($manifest['css'] ?? [], 0, 20) as $human => $obf) { $sample[] = ['type' => 'css', 'original' => $human, 'obfuscated' => $obf]; } foreach (array_slice($manifest['tables'] ?? [], 0, 10) as $human => $obf) { $sample[] = ['type' => 'table', 'original' => $human, 'obfuscated' => $obf]; } exit(json_encode(['ok' => true, 'sample' => $sample])); } exit(json_encode(['ok' => false, 'error' => 'Unknown action'])); } 