'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']; } ?> >

Select a Project

0, 'kicad_sch' => 1, 'kicad_pcb' => 2]; $prioA = $priority[$extA] ?? 999; $prioB = $priority[$extB] ?? 999; // If different types, sort by priority if ($prioA !== $prioB) { return $prioA - $prioB; } // Same type, sort alphabetically return strcmp($a, $b); }); // Validate and handle file selection parameter (allowlist only) $selectedFile = null; if (isset($_GET['file']) && $_GET['file'] !== 'all') { // Check if the requested file is in our list $requestedFile = $_GET['file']; foreach ($allFiles as $file) { if (basename($file) === $requestedFile) { $selectedFile = $requestedFile; break; } } } // Filter files based on selection $filesToLoad = []; if ($selectedFile === null) { // Show all files $filesToLoad = $allFiles; } else { // Show only .kicad_pro and the selected file foreach ($allFiles as $file) { $ext = pathinfo($file, PATHINFO_EXTENSION); $basename = basename($file); if ($ext === 'kicad_pro' || $basename === $selectedFile) { $filesToLoad[] = $file; } } } // Build list of selectable files (non-pro files) $selectableFiles = []; foreach ($allFiles as $file) { $ext = pathinfo($file, PATHINFO_EXTENSION); if ($ext !== 'kicad_pro') { $selectableFiles[] = basename($file); } } ?>