mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 11:09:18 +02:00
feat: add objet field (tfe/thèse/frart) with share-link restriction and site-settings toggles
This commit is contained in:
@@ -25,13 +25,14 @@ switch ($action) {
|
||||
$expiresRaw = !empty($_POST['expires_at']) ? trim($_POST['expires_at']) : null;
|
||||
$expiresAt = null;
|
||||
if ($expiresRaw) {
|
||||
// datetime-local gives "YYYY-MM-DDTHH:MM"
|
||||
$expiresAt = date('Y-m-d H:i:s', strtotime($expiresRaw));
|
||||
if ($expiresAt <= date('Y-m-d H:i:s')) {
|
||||
App::redirect('/admin/acces-etudiante.php', error: "La date d'expiration doit être dans le futur.");
|
||||
}
|
||||
}
|
||||
$shareLink->create(1, $password, $expiresAt);
|
||||
$objetRaw = $_POST['objet_restriction'] ?? '';
|
||||
$objetRestriction = in_array($objetRaw, ['tfe', 'thèse', 'frart'], true) ? $objetRaw : null;
|
||||
$shareLink->create(1, $password, $expiresAt, $objetRestriction);
|
||||
App::redirect('/admin/acces-etudiante.php', success: 'Lien d\'accès créé.');
|
||||
break;
|
||||
|
||||
|
||||
@@ -17,13 +17,16 @@ $db = new Database();
|
||||
$section = $_POST['section'] ?? '';
|
||||
|
||||
if ($section === 'formulaire') {
|
||||
// Save access-type toggle settings
|
||||
$allowed = ['access_type_libre_enabled', 'access_type_interne_enabled', 'access_type_interdit_enabled'];
|
||||
foreach ($allowed as $key) {
|
||||
$value = isset($_POST[$key]) ? '1' : '0';
|
||||
$db->setSetting($key, $value);
|
||||
}
|
||||
App::flash('success', "Paramètres du formulaire mis à jour.");
|
||||
} elseif ($section === 'objet_types') {
|
||||
$db->setSetting('objet_these_enabled', isset($_POST['objet_these_enabled']) ? '1' : '0');
|
||||
$db->setSetting('objet_frart_enabled', isset($_POST['objet_frart_enabled']) ? '1' : '0');
|
||||
App::flash('success', "Types de travaux mis à jour.");
|
||||
} elseif ($section === 'smtp') {
|
||||
$smtpData = [
|
||||
'host' => $_POST['smtp_host'] ?? '',
|
||||
|
||||
Reference in New Issue
Block a user