prepare("SELECT * FROM pf_pv_models WHERE id=?"); $s->execute([$id]); $model = $s->fetch(); if (!$model) { header('Location: /printvault.php'); exit; } $s2 = $pdo->query("SELECT name, color FROM pf_pv_categories ORDER BY name"); $categories = $s2->fetchAll(); $ext = strtolower($model['file_type']); $canView = in_array($ext, ['stl','3mf','gcode','gco','g']); $isGcode = in_array($ext, ['gcode','gco','g']); $thumbUrl = $model['thumb'] ? '/uploads/printvault/thumbs/' . rawurlencode($model['thumb']) : null; $typeIcon = ['stl'=>'π£','3mf'=>'π΅','gcode'=>'π’','gco'=>'π’','g'=>'π’'][$ext] ?? 'π'; function fmtSize(int $b): string { if ($b > 1048576) return round($b/1048576,1).' Mo'; return round($b/1024).' Ko'; } function fmtDate(string $s): string { return date('d/m/Y', strtotime($s)); } $pageTitle = htmlspecialchars($model['name']) . ' β PrintVault'; $activePage = 'printvault'; require __DIR__ . '/header.php'; ?>