mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-26 00:29:18 +02:00
fix: resolve partage form submission issues
- Replace mb_strlen/mb_substr/mb_strtolower with strlen/substr/strtolower (mbstring extension missing on server, causing fatal error) - Scope annexes checkbox HTMX swap to #annexes-input-block with hx-select (prevents duplicating entire page inside Fichiers fieldset) - Split format+fichiers response: #format-fichiers-block (stable) and #format-extras-block (swappable, inside Fichiers fieldset). Format checkboxes use hx-select to extract only the extras, preserving file queue. - Keep format extras inline in Fichiers fieldset (no sub-fieldsets). Remove website legend input (URL only). - When PeerTube upload disabled, show direct file upload inputs for video/audio (name=files[]). - Add "Glissez-déposez" sort hint below TFE file queue. - Fix .fq-name overflow with width:0;min-width:100% chain. - Remove legend placeholder from .fq-item. - Merge "Récits et expérimentation" AP into "Narration Spéculative". Rename PACS to "Pratique de lart - outils critiques, arts et contexte simultanés". - Remove président·e field from jury fieldset, form templates, and controller validation. Keep DB column and display logic for existing data.
This commit is contained in:
@@ -427,10 +427,6 @@ class ThesisCreateController
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!empty(trim($post['jury_president'] ?? ''))) {
|
||||
$juryMembers[] = ['name' => trim($post['jury_president']), 'role' => 'president', 'is_external' => 0];
|
||||
}
|
||||
|
||||
if (!$adminMode && !$hasPromoteur) {
|
||||
throw new Exception('Veuillez indiquer au moins un·e promoteur·ice interne.');
|
||||
}
|
||||
@@ -508,8 +504,8 @@ class ThesisCreateController
|
||||
|
||||
// Note contextuelle (optional, max 1500 chars)
|
||||
$contextNote = $this->sanitiseString($post['context_note'] ?? '');
|
||||
if (mb_strlen($contextNote) > 1500) {
|
||||
$contextNote = mb_substr($contextNote, 0, 1500);
|
||||
if (strlen($contextNote) > 1500) {
|
||||
$contextNote = substr($contextNote, 0, 1500);
|
||||
}
|
||||
|
||||
// Backoffice fields (admin only)
|
||||
|
||||
@@ -650,15 +650,6 @@ class ThesisEditController
|
||||
}
|
||||
}
|
||||
|
||||
// President (optional, admin-only)
|
||||
if (!empty(trim($post['jury_president'] ?? ''))) {
|
||||
$members[] = [
|
||||
'name' => trim($post['jury_president']),
|
||||
'role' => 'president',
|
||||
'is_external' => 0,
|
||||
];
|
||||
}
|
||||
|
||||
// Backwards compat: old jury_lecteurs[]
|
||||
if (isset($post['jury_lecteurs'])) {
|
||||
foreach ($post['jury_lecteurs'] as $i => $name) {
|
||||
|
||||
@@ -1016,7 +1016,7 @@ class Database
|
||||
}
|
||||
|
||||
$normalise = static function (string $s): string {
|
||||
return preg_replace('/[^a-z0-9]/u', '', mb_strtolower($s));
|
||||
return preg_replace('/[^a-z0-9]/u', '', strtolower($s));
|
||||
};
|
||||
|
||||
$normNew = $normalise($title);
|
||||
@@ -1036,11 +1036,11 @@ class Database
|
||||
}
|
||||
|
||||
// Prefix match: one starts with the other (handles subtitle variations).
|
||||
$maxLen = max(mb_strlen($normNew), mb_strlen($normExisting));
|
||||
$maxLen = max(strlen($normNew), strlen($normExisting));
|
||||
if ($maxLen === 0) {
|
||||
continue;
|
||||
}
|
||||
$minLen = min(mb_strlen($normNew), mb_strlen($normExisting));
|
||||
$minLen = min(strlen($normNew), strlen($normExisting));
|
||||
if ($minLen >= 5) { // avoid matching very short fragments
|
||||
if (str_starts_with($normExisting, $normNew) || str_starts_with($normNew, $normExisting)) {
|
||||
return [
|
||||
@@ -1055,8 +1055,8 @@ class Database
|
||||
|
||||
// Levenshtein distance ≤ 10 % of the longer string.
|
||||
// levenshtein() is limited to 255 chars; use substrings for safety.
|
||||
$a = mb_substr($normNew, 0, 255);
|
||||
$b = mb_substr($normExisting, 0, 255);
|
||||
$a = substr($normNew, 0, 255);
|
||||
$b = substr($normExisting, 0, 255);
|
||||
$dist = levenshtein($a, $b);
|
||||
$threshold = (int)ceil($maxLen * 0.10);
|
||||
if ($dist <= $threshold) {
|
||||
|
||||
Reference in New Issue
Block a user