'; echo ''; echo ''; echo '' . h(page_title($title)) . ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; if ($projectImageUrl) { echo ''; echo ''; } echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } function render_header(string $active = 'home'): void { $navItems = kei_nav_items(); ?>
Bahasa Indonesia aktif.
exec($sql); } function normalize_whatsapp(string $value): string { $value = preg_replace('/[^0-9+]/', '', $value) ?? ''; return trim($value); } function handle_optional_upload(string $field, array $allowedMimeMap, int $maxBytes, string $subdir): ?string { if (empty($_FILES[$field]) || (int) $_FILES[$field]['error'] === UPLOAD_ERR_NO_FILE) { return null; } $file = $_FILES[$field]; if ((int) $file['error'] !== UPLOAD_ERR_OK) { throw new RuntimeException('Upload gagal untuk ' . $field . '.'); } if ((int) $file['size'] > $maxBytes) { throw new RuntimeException('Ukuran file ' . $field . ' terlalu besar.'); } $finfo = new finfo(FILEINFO_MIME_TYPE); $mime = (string) $finfo->file($file['tmp_name']); if (!isset($allowedMimeMap[$mime])) { throw new RuntimeException('Format file ' . $field . ' tidak didukung.'); } $targetDir = __DIR__ . '/../assets/uploads/' . $subdir; if (!is_dir($targetDir) && !mkdir($targetDir, 0775, true) && !is_dir($targetDir)) { throw new RuntimeException('Folder upload tidak dapat dibuat.'); } $filename = $subdir . '-' . date('YmdHis') . '-' . bin2hex(random_bytes(4)) . '.' . $allowedMimeMap[$mime]; $target = $targetDir . '/' . $filename; if (!move_uploaded_file($file['tmp_name'], $target)) { throw new RuntimeException('Gagal menyimpan file ' . $field . '.'); } return 'assets/uploads/' . $subdir . '/' . $filename; } function admin_credentials(): array { $user = getenv('KEI_ADMIN_USER') ?: (getenv('ADMIN_EMAIL') ?: 'admin@kei.local'); $pass = getenv('KEI_ADMIN_PASSWORD') ?: (getenv('ADMIN_PASSWORD') ?: 'KEIadmin2026!'); return [$user, $pass]; } function using_default_admin_credentials(): bool { return !getenv('KEI_ADMIN_USER') && !getenv('ADMIN_EMAIL') && !getenv('KEI_ADMIN_PASSWORD') && !getenv('ADMIN_PASSWORD'); } function is_admin(): bool { return !empty($_SESSION['kei_admin_logged_in']); } function require_admin(): void { if (!is_admin()) { header('Location: login.php'); exit; } } function status_badge_class(string $status): string { return match ($status) { 'accepted' => 'badge bg-success-subtle text-success-emphasis', 'rejected' => 'badge bg-danger-subtle text-danger-emphasis', default => 'badge bg-secondary-subtle text-secondary-emphasis', }; }