This commit introduces a comprehensive cookie consent management system by integrating the `fxCookiesAllowMarketing()` function across multiple files. It ensures that marketing-related scripts, such as Facebook Pixel and Google Analytics, are only executed if the user has consented to cookies. Additionally, it enhances the cookie consent UI in `inc_footer.php` and `inc_header.php`, improving user experience and compliance with privacy regulations. The changes also include refactoring of cookie handling functions for better maintainability.
283 lines
9.5 KiB
PHP
283 lines
9.5 KiB
PHP
<?php
|
|
require_once('php/inc_start_time.php');
|
|
require_once('php/inc_fonctions.php');
|
|
require_once('php/inc_fx_messages.php');
|
|
require_once('php/inc_fx_panier.php');
|
|
require_once('php/inc_fx_reserver.php');
|
|
require_once('php/inc_fx_panier.php');
|
|
require_once('php/inc_fx_affilies.php');
|
|
require_once('php/inc_fx_memberships.php');
|
|
require_once('php/inc_fx_liste_attente.php');
|
|
global $vPage, $vDomaine;
|
|
$strCode = '';
|
|
$tabEvenement = null;
|
|
$strPage = "reserver.php";
|
|
|
|
// récupérer le paramètre de langue, français par défaut
|
|
if (!empty($_GET['lang']))
|
|
$strLangue = $_GET['lang'];
|
|
else
|
|
$strLangue = 'fr';
|
|
|
|
// récupérer le $intpec_id
|
|
if (!empty($_GET['pec_id']))
|
|
$intpec_id = $_GET['pec_id'];
|
|
else
|
|
$intpec_id = 0;
|
|
|
|
$vtexte_page = obtenirTextepage($vPage, $strLangue, 2);
|
|
|
|
// récupérer le paramètre action, add par défaut
|
|
if (!empty($_GET['action']))
|
|
$strAction = $_GET['action'];
|
|
else
|
|
$strAction = 'add';
|
|
|
|
if ($strAction == 'mod' && !isset($_SESSION['no_panier']) && !isset($_SESSION['com_info'])) { // si l'uiisateur n'est pas loggé et sur la page de modification
|
|
|
|
if ($strLangue == 'fr') {
|
|
$strPage = 'compte';
|
|
} else {
|
|
$strPage = 'account';
|
|
}
|
|
|
|
$_SESSION['msg'] = 'e207';
|
|
|
|
header("Location: " . $vDomaine . '/' . $strPage);
|
|
exit;
|
|
}
|
|
|
|
// récupérer le code et les infos de l'événement
|
|
if (!empty($_GET['code']) && isset($_GET['id'])) {
|
|
$strCode = $_GET['code'];
|
|
$intEpreuve = $_GET['id'];
|
|
$tabEvenement = fxGetEvenements($strCode, $strLangue);
|
|
|
|
if ($intpec_id == 0 && $intEpreuve != 0) {
|
|
// Vérifier si l'épreuve est toujours réservable par la table de prix
|
|
$tabPrix = fxGetPrixParticipant($intEpreuve);
|
|
|
|
if ($tabPrix == null) {
|
|
if ($strLangue == 'fr') {
|
|
$_SESSION['msg'] = 'e158';
|
|
} else {
|
|
$_SESSION['msg'] = 'e558';
|
|
}
|
|
|
|
header("Location: " . $vDomaine . '/' . $tabEvenement['general']['eve_label_url']);
|
|
exit;
|
|
}
|
|
|
|
// Vérifier si l'épreuve est toujours réservable par la qte et liste_attente
|
|
if (fx_liste_attente_valideqte(intval($intEpreuve)) <= 0) {
|
|
|
|
if ($strLangue == 'fr') {
|
|
$_SESSION['msg'] = 'e158';
|
|
} else {
|
|
$_SESSION['msg'] = 'e558';
|
|
}
|
|
|
|
header("Location: " . $vDomaine . '/' . $tabEvenement['general']['eve_label_url']);
|
|
exit;
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
// si le code est vide ou bien que l'événement n'existe pas, retourner à la page d'accueil
|
|
if (empty($_GET['code']) || !isset($_GET['id']) || $tabEvenement == null) {
|
|
header('Location: ' . $vDomaine);
|
|
exit;
|
|
}
|
|
//pour la map
|
|
if (isset($_GET['btn_add_produit'])) {
|
|
$_POST['btn_add_produit']='oui';
|
|
$_POST['pro_id']=$_GET['pro_id'];
|
|
$_POST['pec_id']=$_GET['pec_id'];
|
|
}
|
|
if(isset($_GET['btn_cancel_produit'])) {
|
|
$_POST['btn_cancel_produit'] = 'oui';
|
|
$_POST['pro_id']=$_GET['pro_id'];
|
|
$_POST['pec_id']=$_GET['pec_id'];
|
|
}
|
|
|
|
// vérifier les form POST
|
|
if(isset($_POST['btn_epr_upgradable_ok'])){
|
|
fxSetPanier($strAction, $tabEvenement, $_POST, $_FILES, $strLangue, $intpec_id);
|
|
}
|
|
if (isset($_POST['btn_participant']) || isset($_POST['btn_add_produit']) || isset($_POST['btn_add_montants_dus'])) {
|
|
//MSIN-4338
|
|
if ( isset($_POST['no_transfert'])) {
|
|
$intquestechue = 1;
|
|
} else {
|
|
$intquestechue = 0;
|
|
};
|
|
|
|
fxSetPanier($strAction, $tabEvenement, $_POST, $_FILES, $strLangue, $intpec_id,$intquestechue);
|
|
} elseif (isset($_POST['btn_cancel_produit'])) {
|
|
fxSetPanier('cancel', $tabEvenement, $_POST, '', $strLangue);
|
|
} elseif (isset($_POST['btn_enregistrer_modif'])) {
|
|
if (isset($_SESSION['no_panier'])){
|
|
fxSetPanier('mod', $tabEvenement, $_POST, $_FILES, $strLangue, $intpec_id);
|
|
} else {
|
|
if ($_POST['promoteur'] == 1) {
|
|
fxSetPanier('mod', $tabEvenement, $_POST, $_FILES, $strLangue, $intpec_id);
|
|
} elseif ($_POST['switch_epreuve'] == 1) {
|
|
|
|
fxSetPanier('add', $tabEvenement, $_POST, $_FILES, $strLangue, $intpec_id, 1);
|
|
} else {
|
|
fxSetPanier('mod', $tabEvenement, $_POST, $_FILES, $strLangue, $intpec_id);
|
|
}
|
|
}
|
|
}
|
|
|
|
// vérifier le nb max de réservation
|
|
if ($intEpreuve != 0) {
|
|
if (isset($_SESSION['com_info']))
|
|
$intCompte = $_SESSION['com_info']['com_id'];
|
|
else
|
|
$intCompte = 0;
|
|
|
|
if ($strAction == 'add' && $intCompte != 0)
|
|
fxCheckMaxEpreuves($tabEvenement['general']['eve_id'], $intCompte, $strLangue);
|
|
}
|
|
|
|
$strLienFr = "/reserver/" . $strCode . "/" . $intEpreuve;
|
|
$strLienEn = "/book/" . $strCode . "/" . $intEpreuve;
|
|
|
|
// trouver le nom de l'épreuve
|
|
foreach ($tabEvenement['epreuves'] as $tabEpreuves) {
|
|
if ($tabEpreuves['epr_id'] == $intEpreuve) {
|
|
// si epreuve ne permet plus reservations (epr_non_reservable == 1)
|
|
// ou
|
|
// si la date de réservation est passée, retourver à la page de l'événement
|
|
$strDateLimite = $tabEpreuves['epr_date_limite'] . ' ' . $tabEpreuves['epr_heure_limite'];
|
|
$strDateLimitePrive = $tabEpreuves['epr_date_limite_prive'] . ' ' . $tabEpreuves['epr_heure_limite_prive'];
|
|
|
|
// ne pas rediriger le promoteur (MSIN-1116)
|
|
if (!fxIsPromoteur($intCompte, $tabEvenement['general']['eve_id'])) {
|
|
if (($tabEpreuves['epr_non_reservable'] == 1) || ($strDateLimite < fxGetDateTime() && (trim($strDateLimitePrive) == '' || $strDateLimitePrive < fxGetDateTime()))) {
|
|
header('Location: ' . $vDomaine . '/' . $tabEvenement['general']['eve_label_url']);
|
|
exit;
|
|
}
|
|
}
|
|
|
|
if (trim($tabEpreuves['epr_categorie_' . $strLangue]) != '') {
|
|
$strEpreuve = $tabEpreuves['epr_categorie_' . $strLangue] . ' - ';
|
|
} else {
|
|
$strEpreuve = '';
|
|
}
|
|
|
|
$strEpreuve .= fxUnescape($tabEpreuves['epr_type_' . $strLangue]);
|
|
|
|
if (trim($tabEpreuves['epr_nom_' . $strLangue]) != '' )
|
|
$strEpreuve .= ' - ' . fxUnescape($tabEpreuves['epr_nom_' . $strLangue]);
|
|
}
|
|
}
|
|
|
|
// récupérer le paramètre de menu (tab), infos par défaut
|
|
if (!empty($_GET['tab']))
|
|
$strTab = $_GET['tab'];
|
|
else
|
|
$strTab = 'reserver';
|
|
|
|
$strMetaTitle= fxRemoveHtml(fxUnescape($tabEvenement['general']['eve_nom_' . $strLangue]) . $strEpreuve);
|
|
$strMetaDescription = fxGetNbWords(fxUnescape($tabEvenement['general']['eve_description_' . $strLangue]), 50);
|
|
$strMetaKeywords = fxRemoveHtml(fxUnescape($tabEvenement['general']['eve_keywords_' . $strLangue]));
|
|
|
|
require_once("inc_header.php");
|
|
|
|
//**
|
|
// * Usager: stephan
|
|
// * Date : 24-04-18
|
|
// * jira : MSIN-2310
|
|
// * Time : 09:02
|
|
// */
|
|
// pixcel facebook
|
|
if (fxCookiesAllowMarketing() && isset($tabEvenement['general']['eve_facebook_pixel'])) {
|
|
if ($tabEvenement['general']['eve_facebook_pixel'] <> '') {
|
|
?>
|
|
<script>
|
|
fbq_pw(
|
|
'track', 'ViewContent', {
|
|
content_name: '<?php echo $strEpreuve ; ?>',
|
|
content_ids: [<?php echo $intEpreuve ; ?>],
|
|
content_type: 'product'
|
|
}
|
|
)
|
|
</script>
|
|
<?php
|
|
}
|
|
}
|
|
?>
|
|
<div id="page">
|
|
<div id="main">
|
|
<div class="container bg-white p-3 p-xl-5">
|
|
<h2 class="mb-3 text-break"><?php echo $strEpreuve ; ?></h2>
|
|
<?php
|
|
if (isset($_SESSION['msg']) && $_SESSION['msg'] != '') {
|
|
echo fxMessage($_SESSION['msg']);
|
|
//echo $_SESSION['msg'];
|
|
}
|
|
//MSIN-4338
|
|
if ( (isset($_GET['switch']) && $_GET['switch'] == 'true')
|
|
||
|
|
(!empty($_GET['t']))) {
|
|
$intquestechue = 1;
|
|
} else {
|
|
$intquestechue = 0;
|
|
};
|
|
$strHintModal = '';
|
|
fxShowFormParticipant($tabEvenement, $strAction, $strLangue, $intEpreuve, $intpec_id, $intquestechue);
|
|
?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php require_once("inc_footer.php");
|
|
|
|
// todosl: si on garde la fonction, la bouger dans un inc_fx_*
|
|
function fxCheckCategorieSexeAge($tab_data, $tab_eve, $str_lang = 'fr') {
|
|
$return = true;
|
|
global $strAction;
|
|
|
|
// get age en date
|
|
$tabEpreuve = fxGetEpreuve($tab_data['epr_id']);
|
|
$intDateAge = $tabEpreuve['epr_date_age'];
|
|
//get age
|
|
$intAge = filter_var(fxGetAge($tab_data['par_naissance_1'], $intDateAge, $str_lang), FILTER_SANITIZE_NUMBER_INT);
|
|
// get info question
|
|
$tabQuestions = fxGetQuestions('epr', $tab_eve['general']['eve_id'], $tab_data['epr_id'], $strAction);
|
|
|
|
for($i = 1; $i<= count($tabQuestions); $i++) {
|
|
switch ($tabQuestions[$i]['que_validation_cat']) {
|
|
case 'age':
|
|
// debug const
|
|
$strChoix = $tabQuestions[$i]['que_choix_' . $str_lang];
|
|
|
|
$tabChoix = explode(",", $strChoix);
|
|
$choix = $tab_data['que_' . $tabQuestions[$i]['que_id']];
|
|
$intInterval = filter_var($tabChoix[$choix - 1], FILTER_SANITIZE_NUMBER_INT);
|
|
$tabStartEnd = explode("-", $intInterval);
|
|
|
|
if ($intAge < $tabStartEnd[0] || $intAge > $tabStartEnd[1])
|
|
$return = false;
|
|
break;
|
|
|
|
//plus tard
|
|
case 'sexe':
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (!$return) {
|
|
if($str_lang = 'fr')
|
|
$_SESSION['msg'] = 'e157';
|
|
else
|
|
$_SESSION['msg'] = 'e557';
|
|
|
|
header("Location: " . $_SERVER['HTTP_REFERER']);
|
|
exit;
|
|
}
|
|
|
|
return $return;
|
|
}
|