mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
fix: jury-fieldset.php calling old() with wrong signature for partage
jury-fieldset.php called old('jury_promoteur') as a global function,
but the partage context defines old(array $data, string $key) —
passing a string where array is expected caused a TypeError.
Changed jury-fieldset.php to use $oldFn callable (like fieldset-tfe-info.php),
with fallback to global old() when not provided. The add-mode repopulation
block no longer calls the global old() directly.
This commit is contained in:
1
TODO.md
1
TODO.md
@@ -66,3 +66,4 @@
|
||||
- [x] Handle jury_promoteur[] and jury_promoteur_ulb_name[] as arrays in partage/index.php
|
||||
- [x] Make Auteur(s) and Accès columns sortable alphabetically in admin list
|
||||
- [x] Merge both .recap-section sections into one + add margin-bottom: var(--space-l)
|
||||
- [x] Fix Fatal error: old() type error in jury-fieldset.php — switch from global old() to $oldFn callable
|
||||
|
||||
@@ -832,7 +832,8 @@ a.recap-file-name:hover {
|
||||
padding-top: var(--space-m);
|
||||
width: 100%;
|
||||
max-width: 620px;
|
||||
margin-bottom: var(--space-l);
|
||||
/* margin-bottom: var(--space-l); */
|
||||
padding-bottom: var(--space-xl);
|
||||
}
|
||||
|
||||
.recap-section h2 {
|
||||
|
||||
@@ -506,6 +506,19 @@
|
||||
+%%%%%%% diff from: somsyvxz 249f7943 "Bulk bar anti-shift, tags icons, AP no-wrap, credits reorder" (rebased revision)
|
||||
+\\\\\\\ to: wpspurnq 76964b90 "Make Auteur(s) and Accès columns sortable alphabetically in admin list" (rebased revision)
|
||||
++ $linkName = $link['name'] ?? '';
|
||||
++ $linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : '';
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff from: wpspurnq 76964b90 "Make Auteur(s) and Accès columns sortable alphabetically in admin list" (rebased revision)
|
||||
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ to: somsyvxz 249f7943 "Bulk bar anti-shift, tags icons, AP no-wrap, credits reorder" (rebased revision)
|
||||
- $linkName = $link['name'] ?? '';
|
||||
- $linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : '';
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff from: somsyvxz 14a3cd10 "Bulk bar anti-shift, tags icons, AP no-wrap, credits reorder" (rebase destination)
|
||||
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ to: snsxswsz 1675e31b "fix: jury-fieldset.php calling old() with wrong signature for partage" (rebased revision)
|
||||
$linkName = $link['name'] ?? '';
|
||||
$linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : '';
|
||||
$linkLockedYear = $link['locked_year'] ?? null;
|
||||
+%%%%%%% diff from: somsyvxz 249f7943 "Bulk bar anti-shift, tags icons, AP no-wrap, credits reorder" (rebased revision)
|
||||
+\\\\\\\ to: snsxswsz 5a33fb93 "fix: jury-fieldset.php calling old() with wrong signature for partage" (rebased revision)
|
||||
++ $linkName = $link['name'] ?? '';
|
||||
++ $linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : '';
|
||||
?>
|
||||
<tr class="admin-table-row" onclick="event.stopPropagation(); window.open('/partage/<?= urlencode($link['slug']) ?>', '_blank')" style="cursor:pointer">
|
||||
|
||||
@@ -12,8 +12,11 @@
|
||||
* $juryPresident string|null (Deprecated — no longer displayed)
|
||||
* $showPromoteurUlb bool Show ULB promoteur field (default: true)
|
||||
* $promoteurUlbConditional bool If true, field is hidden unless finality=Approfondi
|
||||
* callable|null $oldFn — callable($key, $default='') to retrieve old/current values;
|
||||
* falls back to the global old() function when null.
|
||||
* array $formData — raw form data array (used for jury repopulation).
|
||||
*
|
||||
* In add-mode repopulation: if old() exists and values are null, populate from it.
|
||||
* In add-mode repopulation: if $oldFn is provided and values are null, populate from it.
|
||||
*/
|
||||
|
||||
$juryPromoteur = $juryPromoteur ?? null;
|
||||
@@ -25,12 +28,13 @@ $lecteursExternes = $lecteursExternes ?? [];
|
||||
$showPromoteurUlb = $showPromoteurUlb ?? true;
|
||||
$promoteurUlbConditional = $promoteurUlbConditional ?? false;
|
||||
$adminMode = $adminMode ?? false;
|
||||
$oldFn = $oldFn ?? (function_exists('old') ? 'old' : fn($k, $d = '') => $d);
|
||||
|
||||
// Add-mode repopulation from flash data
|
||||
$addMode = ($juryPromoteur === null && empty($juryPromoteurs) && $juryPromoteurUlb === null && empty($juryPromoteursUlb) && empty($lecteursInternes) && empty($lecteursExternes));
|
||||
if ($addMode && function_exists('old')) {
|
||||
if ($addMode) {
|
||||
// jury_promoteur may be array (new form) or scalar (legacy)
|
||||
$promoteursOld = old('jury_promoteur');
|
||||
$promoteursOld = $oldFn('jury_promoteur');
|
||||
if (is_array($promoteursOld)) {
|
||||
foreach ($promoteursOld as $name) {
|
||||
$name = trim($name ?? '');
|
||||
@@ -40,7 +44,7 @@ if ($addMode && function_exists('old')) {
|
||||
$juryPromoteur = $promoteursOld;
|
||||
}
|
||||
// jury_promoteur_ulb_name may be array (new form) or scalar (legacy)
|
||||
$promoteursUlbOld = old('jury_promoteur_ulb_name');
|
||||
$promoteursUlbOld = $oldFn('jury_promoteur_ulb_name');
|
||||
if (is_array($promoteursUlbOld)) {
|
||||
foreach ($promoteursUlbOld as $name) {
|
||||
$name = trim($name ?? '');
|
||||
@@ -50,11 +54,11 @@ if ($addMode && function_exists('old')) {
|
||||
$juryPromoteurUlb = $promoteursUlbOld;
|
||||
}
|
||||
for ($i = 0; $i < 10; $i++) {
|
||||
$n = old("jury_lecteur_interne:$i");
|
||||
$n = $oldFn("jury_lecteur_interne:$i");
|
||||
if (is_string($n) && $n !== '') $lecteursInternes[] = ['name' => $n];
|
||||
}
|
||||
for ($i = 0; $i < 10; $i++) {
|
||||
$n = old("jury_lecteur_externe:$i");
|
||||
$n = $oldFn("jury_lecteur_externe:$i");
|
||||
if (is_string($n) && $n !== '') $lecteursExternes[] = ['name' => $n];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user