Refactor promoteur hub logic and enhance session handling

This commit updates the promoteur hub functionality by introducing a new function, `fxPromoteurHubIsAvailable`, to streamline the logic for determining hub access. The existing `fxPromoteurHubShouldUse` function is modified to incorporate this new check, improving clarity and maintainability. Additionally, comments are added to clarify session handling in the `fxLoginCompte` function, ensuring better understanding of public login behavior. These changes aim to enhance the robustness of the promoteur hub interface and improve code readability.
This commit is contained in:
2026-07-07 10:45:03 -04:00
parent 93cb9f5e81
commit 762ac838b6
4 changed files with 31 additions and 31 deletions

View File

@ -55,6 +55,7 @@ if (!empty($_GET['code']))
$strCode = 'compte_' . $_GET['code'];
else {
if (isset($_SESSION['com_id'])) {
// Legacy actif par défaut : accueil. Hub v2 seulement si promoteur_legacy_actif = 0 (voir fxPromoteurHubShouldUse).
if (fxPromoteurHubShouldUse($_SESSION['com_id'])) {
$strCode = 'compte_promoteur_hub';
} else {
@ -65,7 +66,7 @@ else {
}
}
if ($strCode === 'compte_promoteur_hub' && (!isset($_SESSION['com_id']) || !fxPromoteurHubShouldUse($_SESSION['com_id']))) {
if ($strCode === 'compte_promoteur_hub' && (!isset($_SESSION['com_id']) || !fxPromoteurHubIsAvailable($_SESSION['com_id']))) {
header('Location: ' . $vDomaine . '/' . ($strLangue === 'fr' ? 'compte' : 'account'));
exit;
}