Files
xamxam/app/public/admin/fragments/licence.php
Pontoporeia da153fc604 Refactor HTMX fragment architecture: DRY split into auth endpoints + shared templates
- Created templates/partials/form/_licence.php (shared HTML, no auth logic)
- Created templates/partials/form/_format-website.php (shared HTML, no auth logic)
- Created src/FragmentRenderer.php helper for clean fragment rendering
- Created public/{admin,partage}/fragments/ subdirectories
- Created thin fragment endpoint files: auth guard + data fetch + render template
- Updated all hx-post references in templates to new fragments/ paths
- Updated partage/index.php routing for new fragments subdirectory
- Kept old fragment files as thin delegates for backward compat
- Updated nginx config: added PHP handler in /partage/ location block
2026-05-19 00:08:06 +02:00

24 lines
813 B
PHP

<?php
/**
* Admin fragment: licence section (HTMX partial).
*/
require_once __DIR__ . '/../../../bootstrap.php';
require_once __DIR__ . '/../../../src/AdminAuth.php';
AdminAuth::requireLogin();
require_once APP_ROOT . '/src/Database.php';
require_once APP_ROOT . '/src/FragmentRenderer.php';
$licenseTypes = Database::getInstance()->getAllLicenseTypes();
FragmentRenderer::render('form/_licence', [
'adminMode' => true,
'accessTypeId' => $_POST['access_type_id'] ?? '',
'licenseId' => $_POST['license_id'] ?? '',
'licenseCustom' => $_POST['license_custom'] ?? '',
'cc2r' => !empty($_POST['cc2r']),
'wantLicense' => !empty($_POST['want_license']),
'hxPost' => '/admin/fragments/licence.php',
'licenseTypes' => $licenseTypes,
]);