'MNT Desktop Reform', 'mnt-halo-90' => 'MNT HALO-90', 'reform' => 'MNT Reform 2', 'reform-next' => 'MNT Reform Next', 'pocket-reform' => 'MNT Pocket Reform', 'mnt-reform-layerscape-ls1028a-som' => 'LS1028A System-on-Module', 'mnt-reform-rk3588-som' => 'RCORE RK3588 System-on-Module', 'mnt-reform-raspberry-pi-cm4-som' => 'RCM4 RPi CM4 System-on-Module', 'reform-kintex-som' => 'RKX7 Kintex-7 FPGA System-on-Module', 'reform-qcs6490' => 'Quisar QCS6490 System-on-Module', ]; function findKicadProFiles($dir, $baseDir = '') { $results = []; if (!is_dir($dir)) { return $results; } $items = scandir($dir); foreach ($items as $item) { if ($item === '.' || $item === '..') continue; $fullPath = $dir . '/' . $item; $relativePath = $baseDir ? $baseDir . '/' . $item : $item; if (is_dir($fullPath)) { $results = array_merge($results, findKicadProFiles($fullPath, $relativePath)); } elseif (pathinfo($item, PATHINFO_EXTENSION) === 'kicad_pro') { $results[] = $relativePath; } } return $results; } $projects = []; $projectDescriptions = []; foreach ($topLevelProjects as $topLevel => $description) { $topLevelPath = 'projects/' . $topLevel; if (is_dir($topLevelPath)) { $foundFiles = findKicadProFiles($topLevelPath, $topLevel); foreach ($foundFiles as $projectPath) { $projects[] = $projectPath; $projectDescriptions[$projectPath] = $description; } } } // Get selected project from URL parameter $selectedProject = $_GET['project'] ?? null; $isViewerMode = $selectedProject !== null && in_array($selectedProject, $projects); // Validate theme parameter (allowlist only) $allowedThemes = ['kicad', 'witchhazel']; $selectedTheme = 'kicad'; // default if (isset($_GET['theme']) && in_array($_GET['theme'], $allowedThemes, true)) { $selectedTheme = $_GET['theme']; } ?>
>