diff --git a/compte.php b/compte.php index 8dadf5f..b87cf88 100644 --- a/compte.php +++ b/compte.php @@ -378,6 +378,50 @@ $strMetaKeywords = fxRemoveHtml(fxUnescape($recPage['pag_keywords_' . $strLangue $blnBoutonRetour = true; $blnHideCompteTitle = false; +// MSIN-4401 — POST invite/revoke AVANT le HTML (sinon header Location → page blanche). +if ($strCode === 'compte_inc_tableau_eve_acces' + && ($_SERVER['REQUEST_METHOD'] ?? '') === 'POST' + && isset($_GET['promoteur_eve_id'])) { + require_once('php/inc_fx_eve_acces_promoteur.php'); + $intEveIdPost = intval(base64_decode(urldecode($_GET['promoteur_eve_id']))); + $intActorPost = intval($_SESSION['com_id'] ?? 0); + if (!empty($_SESSION['usa_id'])) { + $intActorPost = intval($_SESSION['usa_id']); + } + $strLanguePost = ($strLangue === 'en') ? 'en' : 'fr'; + $strBasePathPost = ($strLanguePost === 'en') ? '/account' : '/compte'; + $strSelfUrlPost = $vDomaine . $strBasePathPost . '/inc_tableau_eve_acces?promoteur_eve_id=' + . urlencode(base64_encode($intEveIdPost)) . '&lng=' . $strLanguePost; + + if ($intEveIdPost > 0 && fxEveAccesCanTeamInvite($intActorPost, $intEveIdPost)) { + $strEveAccesAction = (string)($_POST['eve_acces_action'] ?? ''); + if ($strEveAccesAction === 'invite') { + $arrEveAccesResult = fxEveAccesPromoteurInvite($intEveIdPost, $intActorPost, $_POST, $strLanguePost); + if (($arrEveAccesResult['state'] ?? '') === 'success') { + header('Location: ' . $strSelfUrlPost . '&ok=' . urlencode($arrEveAccesResult['message'])); + exit; + } + header('Location: ' . $strSelfUrlPost . '&err=' . urlencode( + $arrEveAccesResult['message'] ?? fxEveAccesPromoteurT('eve_acces_promoteur_err_generic', $strLanguePost) + )); + exit; + } + if ($strEveAccesAction === 'revoke') { + $arrEveAccesResult = fxEveAccesPromoteurRevoke(intval($_POST['ea_id'] ?? 0), $intActorPost, $intEveIdPost); + if (($arrEveAccesResult['state'] ?? '') === 'success') { + header('Location: ' . $strSelfUrlPost . '&ok=' . urlencode( + fxEveAccesPromoteurT('eve_acces_promoteur_ok_revoked', $strLanguePost) + )); + exit; + } + header('Location: ' . $strSelfUrlPost . '&err=' . urlencode( + fxEveAccesPromoteurT('eve_acces_promoteur_err_revoke', $strLanguePost) + )); + exit; + } + } +} + require_once("inc_header.php"); ?> diff --git a/inc_tableau_eve_acces.php b/inc_tableau_eve_acces.php index a8b8bf6..b997b10 100644 --- a/inc_tableau_eve_acces.php +++ b/inc_tableau_eve_acces.php @@ -2,6 +2,7 @@ /** * MSIN-4401 — Gestion des accès V2 (promoteur, par événement). + * Les POST invite/revoke sont traités dans compte.php AVANT inc_header (évite page blanche). */ include_once('php/inc_fx_promoteur.php'); @@ -31,39 +32,24 @@ if (!empty($_SESSION['usa_id'])) { if ($intEveId <= 0 || (empty($_SESSION['com_id']) && empty($_SESSION['usa_id'])) || !fxEveAccesCanTeamInvite($intActor, $intEveId)) { - header('Location: ' . $strRedirect); - exit; + // Headers déjà envoyés (include après layout) : message + lien, pas de header Location. + echo '