mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 08:09:18 +02:00
53 lines
1.7 KiB
PHP
53 lines
1.7 KiB
PHP
<?php
|
|
require_once __DIR__ . '/../../bootstrap.php';
|
|
require_once __DIR__ . '/../../src/AdminAuth.php';
|
|
require_once __DIR__ . '/../../src/Form/FormBootstrap.php';
|
|
AdminAuth::requireLogin();
|
|
|
|
if (empty($_SESSION['csrf_token'])) {
|
|
$_SESSION['csrf_token'] = bin2hex(random_bytes(32));
|
|
}
|
|
|
|
$pageTitle = 'Ajouter un TFE';
|
|
|
|
require_once __DIR__ . '/../../src/Controllers/ThesisCreateController.php';
|
|
|
|
try {
|
|
$ctrl = ThesisCreateController::make();
|
|
extract($ctrl->loadFormData());
|
|
} catch (Exception $e) {
|
|
error_log('Failed to load form data: ' . $e->getMessage());
|
|
die('Erreur lors du chargement du formulaire.');
|
|
}
|
|
|
|
// Form data (flash repopulation)
|
|
$formData = $_SESSION['form_data'] ?? [];
|
|
unset($_SESSION['form_data']);
|
|
|
|
$siteSettings = Database::getInstance()->getAllSettings();
|
|
$helpBlocks = Database::getInstance()->getAllFormHelpBlocks();
|
|
|
|
// Shared form variables from the bootstrap helper
|
|
extract(FormBootstrap::adminFormVariables(
|
|
mode: 'add',
|
|
formAction: 'actions/formulaire.php',
|
|
hiddenFields: '<input type="hidden" name="csrf_token" value="' . htmlspecialchars($_SESSION['csrf_token']) . '">',
|
|
formData: $formData,
|
|
siteSettings: $siteSettings,
|
|
helpBlocks: $helpBlocks,
|
|
options: [
|
|
'existingWebsiteUrl' => $formData['website_url'] ?? '',
|
|
'existingWebsiteLabel' => $formData['website_label'] ?? '',
|
|
'checkedFormats' => $formData['formats'] ?? [],
|
|
],
|
|
));
|
|
|
|
// Asset arrays and page chrome
|
|
$isAdmin = true;
|
|
$bodyClass = 'admin-body';
|
|
extract(FormBootstrap::adminAssetArrays());
|
|
require_once APP_ROOT . '/templates/head.php';
|
|
include APP_ROOT . '/templates/header.php';
|
|
include APP_ROOT . '/templates/admin/add.php';
|
|
require_once APP_ROOT . '/templates/admin/footer.php';
|