mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-26 00:29:18 +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:
@@ -54,9 +54,12 @@ class ShareLink
|
||||
$slug = self::generateSlug();
|
||||
$passwordHash = $password !== null ? password_hash($password, PASSWORD_BCRYPT) : null;
|
||||
$validObjet = ['tfe', 'thèse', 'frart'];
|
||||
$objetRestriction = ($objetRestriction !== null && in_array($objetRestriction, $validObjet, true))
|
||||
? $objetRestriction
|
||||
: null;
|
||||
if ($objetRestriction !== null && $objetRestriction !== '') {
|
||||
$parts = array_intersect(explode(',', $objetRestriction), $validObjet);
|
||||
$objetRestriction = !empty($parts) ? implode(',', $parts) : 'tfe';
|
||||
} else {
|
||||
$objetRestriction = 'tfe';
|
||||
}
|
||||
|
||||
$stmt = $this->db->getConnection()->prepare(
|
||||
'INSERT INTO share_links (slug, objet_restriction, password_hash, is_active, created_by, expires_at)
|
||||
|
||||
Reference in New Issue
Block a user