mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
- 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
30 lines
909 B
PHP
30 lines
909 B
PHP
<?php
|
|
/**
|
|
* Admin fragment: Site web format fieldset (HTMX partial).
|
|
*/
|
|
require_once __DIR__ . '/../../../bootstrap.php';
|
|
require_once __DIR__ . '/../../../src/AdminAuth.php';
|
|
App::boot();
|
|
|
|
AdminAuth::requireLogin();
|
|
|
|
require_once APP_ROOT . '/src/FragmentRenderer.php';
|
|
|
|
$db = Database::getInstance()->getConnection();
|
|
|
|
$stmt = $db->prepare('SELECT id FROM format_types WHERE name = ? LIMIT 1');
|
|
$stmt->execute(['Site web']);
|
|
$websiteFormatId = $stmt->fetchColumn();
|
|
|
|
$selectedFormats = isset($_POST['formats']) && is_array($_POST['formats'])
|
|
? array_map('intval', $_POST['formats'])
|
|
: [];
|
|
|
|
FragmentRenderer::render('form/_format-website', [
|
|
'fieldsetId' => 'edit-website-url-fieldset',
|
|
'selectedFormats' => $selectedFormats,
|
|
'websiteFormatId' => $websiteFormatId,
|
|
'websiteUrl' => $_POST['website_url'] ?? '',
|
|
'websiteLabel' => $_POST['website_label'] ?? '',
|
|
]);
|