mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
link creation: fieldset with checkboxes for objet restriction, TFE checked by default
link creation: fieldset with checkboxes for objet restriction, TFE checked by default; password/expiration in second fieldset 'Accès'
This commit is contained in:
@@ -32,8 +32,10 @@ switch ($action) {
|
||||
App::redirect('/admin/acces.php', error: "La date d'expiration doit être dans le futur.");
|
||||
}
|
||||
}
|
||||
$objetRaw = $_POST['objet_restriction'] ?? '';
|
||||
$objetRestriction = in_array($objetRaw, ['tfe', 'thèse', 'frart'], true) ? $objetRaw : null;
|
||||
$objetRaw = $_POST['objet_restriction'] ?? ['tfe'];
|
||||
$validObjet = ['tfe', 'thèse', 'frart'];
|
||||
$selected = is_array($objetRaw) ? array_intersect($objetRaw, $validObjet) : [];
|
||||
$objetRestriction = !empty($selected) ? implode(',', $selected) : 'tfe';
|
||||
$link = $shareLink->create(1, $password, $expiresAt, $objetRestriction);
|
||||
$logger->logLinkCreate(
|
||||
$link['slug'] ?? '',
|
||||
|
||||
@@ -249,8 +249,8 @@ function renderShareLinkForm(string $slug, array $link): void
|
||||
// Determine allowed objet values for this link
|
||||
$siteSettings = Database::getInstance()->getAllSettings();
|
||||
$objetRestriction = $link['objet_restriction'] ?? null;
|
||||
if ($objetRestriction !== null) {
|
||||
$allowedObjet = [$objetRestriction];
|
||||
if ($objetRestriction !== null && $objetRestriction !== '') {
|
||||
$allowedObjet = explode(',', $objetRestriction);
|
||||
} else {
|
||||
$allowedObjet = ['tfe'];
|
||||
if (($siteSettings['objet_these_enabled'] ?? '1') === '1') $allowedObjet[] = 'thèse';
|
||||
|
||||
Reference in New Issue
Block a user