1
'); // echo( $newUrl ); // Redirigez vers la nouvelle URL avec le préfixe $newUrl = str_replace('preprod', 'reloadlogin', $newUrl); $newUrl = str_replace('www.', '', $newUrl); $newUrl=$prefix.$newUrl; header("Location: https://" . $newUrl); exit; // } //$_SESSION['preprod'] = 'preprod'; } else { $prefix = "preprod."; // if (strpos($_SERVER['HTTP_HOST'], $prefix) === true) { // Ajoutez le préfixe à l'URL actuelle // Supprimer les caractères avant le premier point $newhost = str_replace('www.', '', $_SERVER['HTTP_HOST']); $cleanHost = substr($newhost, strpos($newhost, '.') + 1); $newUrl = $cleanHost . $_SERVER['REQUEST_URI']; // echo($_SERVER['HTTP_HOST']); // echo('
2
'); $newUrl = str_replace('preprod', 'reloadlogin', $newUrl); // Redirigez vers la nouvelle URL avec le préfixe header("Location: https://" . $newUrl); exit; // } //unset($_SESSION['preprod']); } } //MSIN-3999 if (isset($_GET['reloadlogin'])) { $previousPage = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null; require_once('php/inc_fx_affilies.php'); if (isset($_SESSION['com_info']['com_login'] )){ $sqlCourriel = "SELECT * FROM inscriptions_comptes WHERE com_login = '" . $_SESSION['com_info']['com_login'] . "'"; $infoCompte = $objDatabase->fxGetRow($sqlCourriel); $_SESSION['com_id'] = $infoCompte['com_id']; $_SESSION['com_prenom'] = $infoCompte['com_prenom']; $_SESSION['vadmin_texte'] = false; $_SESSION['com_info'] = $infoCompte; // liste des compte affilie $infoAffilie = fxGetInfosAffilies($_SESSION['com_id']); $_SESSION['com_affilie'] = $infoAffilie; // metre dans l'info compte la liste des evenement prive $_SESSION['com_info']['eve_prive'] = explode(',', $infoCompte['com_eve_prive']); // Démarrer une session (si nécessaire) session_start(); // Obtenir l'URL actuelle $currentUrl = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; // Décomposer l'URL en composants $parsedUrl = parse_url($currentUrl); // Extraire les paramètres $queryParams = []; if (isset($parsedUrl['query'])) { parse_str($parsedUrl['query'], $queryParams); } // Supprimer le paramètre 'reloadlogin' s'il existe if (isset($queryParams['reloadlogin'])) { unset($queryParams['reloadlogin']); } // Reconstruire l'URL sans le paramètre 'reloadlogin' $cleanUrl = $parsedUrl['scheme'] . '://' . $parsedUrl['host']; if (isset($parsedUrl['path'])) { $cleanUrl .= $parsedUrl['path']; } if (!empty($queryParams)) { $cleanUrl .= '?' . http_build_query($queryParams); } // Rediriger vers l'URL nettoyée header("Location: $cleanUrl"); exit; } } function fxsessionpixelfacebook($memarray) { if (!fxCookiesAllowMarketing()) { return; } $_SESSION['pixcel'][] = $memarray; } function fxcount($memarray) { $memreturn=0; if(is_array($memarray)) $memreturn=count($memarray); return $memreturn; } /** * MSIN-4405 — Determine, en LECTURE SEULE, pourquoi une inscription annulee (is_cancelled = 1) * porte ce statut. Aucune ecriture : on ne touche ni is_cancelled, ni pec_actif, ni la base. * * Regles (cf. fxMajEpreuvesCommandees / annuler_inscription.php) : * - vraie annulation : l'ancien pec reste actif (pec_actif = 1), ou defaut * - transfert complete: ligne dans inscriptions_transferts (ts_id = 2) pour ce pec * * @param int $intPecId pec_id_original de l'inscription * @param int|null $intPecActif valeur de pec_actif si deja connue (evite une requete) * @return string 'annule' | 'transfert' */ function fxGetAnnulationCause($intPecId, $intPecActif = null) { global $objDatabase; $intPecId = intval($intPecId); if ($intPecId <= 0) { return 'annule'; } // Une vraie annulation laisse l'inscription active (pec_actif = 1). if ($intPecActif !== null && intval($intPecActif) === 1) { return 'annule'; } // Transfert complete vers une autre personne. $varTransfert = $objDatabase->fxGetVar( "SELECT 1 FROM inscriptions_transferts WHERE pec_id = " . $intPecId . " AND ts_id = 2 LIMIT 1" ); if ($varTransfert) { return 'transfert'; } return 'annule'; } // fonction qui retourne les infos des champs de la table (SL / JSP) // param : nom de la table, nom de la base de données // créé : 2013-04-10 function fxGetFileds($strTable, $strBdd) { global $objDatabase; $sqlFields = "SELECT COLUMN_NAME, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH FROM information_schema.COLUMNS WHERE TABLE_NAME = '" . $objDatabase->fxEscape($strTable) . "' AND TABLE_SCHEMA = '" . $objDatabase->fxEscape($strBdd) . "'"; $recFields = $objDatabase->fxGetResultsKey($sqlFields); return $recFields; } // fonction qui compose le SQL pour les INSERT et UPDATE // param : tableau des données, nom de la clé (PK), nom de la table, nom de la base de données // créé : 2013-04-10 function fxListFieldsValues($tabData, $strKey, $strTable, $strBdd) { global $objDatabase; $tabFields = fxGetFileds($strTable, $strBdd); $mem_set = "SET "; $xvide = 0; $listvide[] = ""; $mem_id = ""; foreach (array_keys($tabData) as $strField) { $listvide[$xvide] = $strField; $xvide += 1; if (strstr($strField, 'btn') === false) { if ($strField == $strKey) $mem_id = $strField . " = " . intval($tabData[$strField]); else { if (isset($tabFields[$strField]['DATA_TYPE'])) { switch ($tabFields[$strField]['DATA_TYPE']) { case 'char': case 'varchar': case 'text': case 'date': $mem_set = $mem_set . $strField . " = '" . $objDatabase->fxEscape($tabData[$strField]) . "', "; break; case 'tinyint': case 'int': case 'smallint': case 'mediumint': case 'bigint': $mem_set = $mem_set . $strField . " = " . intval($tabData[$strField]) . ", "; break; case 'double': case 'float': $mem_set = $mem_set . $strField . " = " . floatval($tabData[$strField]) . ", "; break; } } } } } // enlever la virgule de trop et mettre dans le tableau à l'index 'set' $memreturn['set'] = substr($mem_set, 0, -2); // mettre dans le tableau à l'index 'key' $memreturn['key'] = $mem_id; // mettre dans le tableau les champs pas vide 'vide' $memreturn['pasvide'] = $listvide; return $memreturn; } // fonction qui retourne le string pour le track event (SL) // param : category, action, label // créé : 2012-09-18 function tcheckevents($category, $action, $label) { if ($category == "" || !fxCookiesAllowMarketing()) return ""; else { $param = "'_trackEvent', '" . $category . "', '" . $action . "', '" . $label . "', 1"; return 'onClick="_gaq.push([' . $param . ']);"'; } } // fonction qui retourne x nombre de mots (JSP) // param : string, nb de mots // créé : 2012-06-20 function fxGetNbWords($string, $num, $tail = ' ...') { // enlever les tags HTML $string = fxRemoveHtml($string); // mettre les mots dans un tableau (chaque mot = 1 case) // $words = str_word_count($string, 1, '0123456789âàäêéèîìïôòöùüÿç'); $words = explode(' ', $string); if (count($words) > $num) { // couper le nombre de mots $firstwords = array_slice($words, 0, $num); } else $firstwords = $words; // transformer en string et ajouter la queue return implode(' ', $firstwords) . $tail; } // fonction qui enlève les tags html (JSP) // param : string // créé : 2012-08-02 function fxRemoveHtml($string) { $string = html_entity_decode($string, ENT_COMPAT, 'UTF-8'); $string = str_replace("’", "'", $string); $string = preg_replace('/\s\s+/', ' ', $string); $string = strip_tags($string); return $string; } // fonction pour formatter une valeur sous la forme $ 9,999.99 // param : valeur, langue, format (afficher $ CAD) // créé : 2013-03-28 function fxShowPrix($strValue, $strLangue, $intFormat = 1) { if ($strLangue == 'fr') { $strValue = number_format($strValue, 2, ',', ' '); if ($intFormat == 1) $strValue .= ' $'; } else { $strValue = number_format($strValue, 2, '.', ','); if ($intFormat == 1) $strValue = '$ ' . $strValue; } return $strValue; } // fonction pour récupérer les infos de la page de présenation (JSP) // param : code de la page // créé : 2012-05-29 function fxGetPage($code) { global $objDatabase; $sqlPage = "SELECT * FROM inscriptions_pages WHERE pag_actif = 1 AND pag_code = '" . $objDatabase->fxEscape($code) . "'"; $recPage = $objDatabase->fxGetRow($sqlPage); if (!$recPage) { return []; } $recPage['pag_description_fr'] = fxGetNbWords($recPage['pag_texte_fr'], 50); $recPage['pag_description_en'] = fxGetNbWords($recPage['pag_texte_en'], 50); return $recPage; } // fonction qui détermine le url de retour (JSP) // créé : 2012-07-02 function fxGetReferer() { global $vDomaine; $url_retour = $vDomaine . '/index.php'; $dom = parse_url($vDomaine); if ($_SERVER['HTTP_REFERER'] != '') { $ref = parse_url($_SERVER['HTTP_REFERER']); if (strpos($ref['host'], $dom['host']) !== false) $url_retour = $_SERVER['HTTP_REFERER']; } return $url_retour; } // fonction pour un message via la page contact (JSP) // param : données post, langue // créé : 2012-07-03 function fxSendMessage($data, $strLangue) { global $vDomaine, $vClient; if (trim($data['txt_nom']) != '' && trim($data['txt_courriel']) != '' && trim($data['txt_message']) != '') { if (file_exists('../mail.html')) $body = file_get_contents('../mail.html'); else $body = file_get_contents('mail.html'); $subject = "Nouveau message " . $strLangue; $message = "Message:

" . $data['txt_message'] . "


De: " . $data['txt_nom'] . " <" . $data['txt_courriel'] . ">
"; $datetime = 'Message envoyé le: ' . fxShowDate(fxGetDate(), $strLangue) . ' @ ' . fxGetTime(); $body = str_replace('%lang%', $strLangue, $body); $body = str_replace('%logo%', $vDomaine . '/images/logoms1inscription.png', $body); $body = str_replace('%client%', $vClient, $body); $body = str_replace('%subject%', $subject, $body); $body = str_replace('%message%', $message, $body); $body = str_replace('%datetime%', $datetime, $body); $mail = fxSendMail($subject, $body, $GLOBALS['vEmail'], fxRemoveHtml($GLOBALS['vClient']), $data['txt_courriel'], $data['txt_nom'], 1, 0); //$mail = fxSendMail($subject, $body, "js.proulx@94productions.com", fxRemoveHtml($GLOBALS['vClient']), $data['txt_courriel'], $data['txt_nom'], 1, 0); if ($mail === false) { if ($strLangue == 'fr') $_SESSION['msg'] = 'e101'; else $_SESSION['msg'] = 'e501'; } else { if ($strLangue == 'fr') $_SESSION['msg'] = 'p103'; else $_SESSION['msg'] = 'p503'; } } else { if ($strLangue == 'fr') $_SESSION['msg'] = 'e102'; else $_SESSION['msg'] = 'e502'; } header('Location: ' . fxGetReferer()); exit; } // fonction pour récuérer les menus à afficher (JSP) // param : langue, id du client // créé : 2012-07-12 //modifié : 2012-11-22 function fxGetMenus($strLangue) { global $objDatabase; $sqlMenus = "SELECT pag_code, pag_label_$strLangue, pag_titre_$strLangue FROM inscriptions_pages WHERE pag_actif = 1 AND pag_menu = 1 ORDER BY pag_tri"; $recMenus = $objDatabase->fxGetResults($sqlMenus); return $recMenus; } // fonction pour récuérer l'arrière-plan à afficher (JSP) // créé : 2012-07-30 function fxGetBackground() { global $objDatabase; $sqlBackground = "SELECT bac_image FROM inscriptions_backgrounds WHERE bac_actif = 1 ORDER BY bac_id DESC LIMIT 1"; $bg_image = $objDatabase->fxGetVar($sqlBackground); return $bg_image; } // fonction pour récupérer les commanditaires à afficher (JSP) // param : langue // créé : 2012-07-30 function fxGetSponsors($strLangue, $eve_id = 0) { global $objDatabase; if ($eve_id == 0) $sqlSponsors = "SELECT com_titre_$strLangue, com_url_$strLangue, com_image_$strLangue, com_target,com_stat_category,com_stat_action,com_stat_label FROM inscriptions_commanditaires WHERE com_actif = 1 ORDER BY com_tri"; else $sqlSponsors = "SELECT com_titre_$strLangue, com_url_$strLangue, com_image_$strLangue, com_target,com_stat_category,com_stat_action,com_stat_label FROM inscriptions_commanditaires WHERE com_actif=1 and eve_id=" . $eve_id . " ORDER BY com_tri"; $recSponsors = $objDatabase->fxGetResults($sqlSponsors); return $recSponsors; } // fonction pour récupérer les provinces à afficher (JSP) // param : id de la province, langue // créé : 2013-04-02 function fxGetProvinces($intProvince, $strLangue) { global $objDatabase; if ($intProvince != 0) { $sqlProvinces = "SELECT pro_id, pro_nom_$strLangue, pro_defaut,pro_paypal,pro_iso FROM inscriptions_provinces WHERE pro_id = " . intval($intProvince); $recProvinces = $objDatabase->fxGetRow($sqlProvinces); } else { $sqlProvinces = "SELECT pro_id,pro_trie, pro_nom_$strLangue, pro_defaut,pro_iso FROM inscriptions_provinces WHERE pro_actif = 1 order by pro_trie"; $recProvinces = $objDatabase->fxGetResults($sqlProvinces); } return $recProvinces; } // fonction pour récupérer les pays à afficher (JSP) // param : id du pays, langue // créé : 2013-04-02 function fxGetPays($intPays, $strLangue) { global $objDatabase; if ($intPays != 0) { $sqlPays = "SELECT pay_id, pay_nom_$strLangue, pay_defaut,pay_iso FROM inscriptions_pays WHERE pay_id = " . intval($intPays); $recPays = $objDatabase->fxGetRow($sqlPays); } else { $sqlPays = "SELECT pay_id,pay_trie, pay_nom_$strLangue, pay_defaut,pay_iso FROM inscriptions_pays WHERE pay_actif = 1 ORDER BY pay_trie,pay_nom_$strLangue"; $recPays = $objDatabase->fxGetResults($sqlPays); } return $recPays; } // fonction pour récupérer le url (JSP) // param : id de l'événement, // créé : 2013-03-20 function fxGetEvenementsUrl($intId) { global $objDatabase; $sqlEvenements = "SELECT eve_label_url FROM inscriptions_evenements WHERE eve_id = " . intval($intId); $strLabel = $objDatabase->fxGetVar($sqlEvenements); return $strLabel; } // fonction pour récupérer les info avec le id (sl) // param : id de l'événement, // créé : 2014-06-12 function fxGetEvenementsId($intId) { global $objDatabase; $sqlEvenements = "SELECT * FROM inscriptions_evenements WHERE eve_id = " . intval($intId); $recEvenements = $objDatabase->fxGetRow($sqlEvenements); if ($recEvenements != null) { return $recEvenements; } else { return ""; } } // fonction pour récupérer les événements à afficher (JSP) // param : url de l'événement, langue // créé : 2013-03-20 function fxGetEvenements($strUrl, $strLangue, $intTypeEpreuve = 1, $blnListeAlpha = false) { global $objDatabase; $strWhere = " AND p.cp_id = 1"; if ($strUrl != '') { $sqlEvenements = "SELECT * FROM inscriptions_evenements e, inscriptions_types_evenements t WHERE t.te_id = e.te_id AND e.eve_actif = 1 AND e.eve_date_fin >= '" . fxGetDate() . "' AND e.eve_label_url = '" . $objDatabase->fxEscape($strUrl) . "'"; $recEvenements = $objDatabase->fxGetRow($sqlEvenements); if ($recEvenements != null) { $tabEvenements['general'] = $recEvenements; $tabEvenements['infos']['titre_' . $strLangue] = $recEvenements['eve_nom_' . $strLangue]; $tabEvenements['infos']['texte_' . $strLangue] = $recEvenements['eve_description_' . $strLangue]; $tabEvenements['reserver']['titre_' . $strLangue] = $recEvenements['eve_nom_' . $strLangue]; $tabEvenements['reserver']['texte_' . $strLangue] = $recEvenements['eve_details_reserver_' . $strLangue]; // récupérer les épreuves et leurs prix if (isset($_SESSION['com_id'])) { $intCompte = $_SESSION['com_id']; $sqlCategoriePrix = "SELECT cp.cp_id FROM inscriptions_categories_prix_comptes cp, inscriptions_epreuves c, inscriptions_epreuves_prix p WHERE c.epr_id = p.epr_id AND c.eve_id = cp.eve_id AND cp.cp_id = p.cp_id AND cp.eve_id = " . intval($recEvenements['eve_id']) . " AND cp.com_id = " . intval($intCompte) . " LIMIT 1"; $intCategoriePrix = $objDatabase->fxGetVar($sqlCategoriePrix); if ($intCategoriePrix != NULL) $strWhere = " AND p.cp_id = " . intval($intCategoriePrix); } $recEpreuves=[]; //$sqlEpreuves = "SELECT * FROM inscriptions_epreuves c, inscriptions_epreuves_prix p, inscriptions_categories_prix cp WHERE c.epr_actif = 1 AND c.epr_id = p.epr_id AND p.cp_id = cp.cp_id AND tep_id = " . intval($intTypeEpreuve) . " AND c.eve_id = " . intval($recEvenements['eve_id']) . $strWhere . " ORDER BY c.epr_tri, c.epr_type_$strLangue, c.epr_nom_$strLangue, p.ep_date_limite"; $sqlEpreuves = "SELECT * FROM inscriptions_epreuves c, inscriptions_epreuves_prix p, inscriptions_categories_prix cp WHERE c.epr_actif = 1 AND c.epr_id = p.epr_id AND p.cp_id = cp.cp_id AND c.eve_id = " . intval($recEvenements['eve_id']) . $strWhere . " ORDER BY c.epr_tri, c.epr_type_$strLangue, c.epr_nom_$strLangue, p.ep_date_limite"; $recEpreuves = $objDatabase->fxGetResults($sqlEpreuves); $strEpreuveP = $strDateP = ''; $tabEpreuves = $tabDates = $tabPrix = array(); if (isset($recEpreuves)){ for ($intCtr = 1; $intCtr <= count($recEpreuves); $intCtr++) { if ($intCtr == 1) { $tabEvenements['categorie_prix']['cp_id'] = $recEpreuves[$intCtr]['cp_id']; $tabEvenements['categorie_prix']['cp_details_fr'] = $recEpreuves[$intCtr]['cp_details_fr']; $tabEvenements['categorie_prix']['cp_details_en'] = $recEpreuves[$intCtr]['cp_details_en']; } // inscrire l'épreuve dans la table épreuves if ($recEpreuves[$intCtr]['epr_categorie_fr'] . $recEpreuves[$intCtr]['epr_type_fr'] . $recEpreuves[$intCtr]['epr_nom_fr'] != $strEpreuveP) { $tabEpreuves[] = $recEpreuves[$intCtr]; } // inscrire les dates des prix if ($recEpreuves[$intCtr]['ep_date_limite'] != $strDateP && $recEpreuves[$intCtr]['ep_prive'] != 1) { if (!in_array($recEpreuves[$intCtr]['ep_date_limite'], $tabDates)) $tabDates[] = $recEpreuves[$intCtr]['ep_date_limite']; } // inscrire les prix de l'épreuve dans la table prix $tabPrix[$recEpreuves[$intCtr]['epr_id']][$recEpreuves[$intCtr]['ep_date_limite']] = array( 'ep_age_min' => $recEpreuves[$intCtr]['ep_age_min'], 'ep_age_max' => $recEpreuves[$intCtr]['ep_age_max'], 'ep_date_limite' => $recEpreuves[$intCtr]['ep_date_limite'], 'ep_montant' => $recEpreuves[$intCtr]['ep_montant'], 'ep_montant_affiche' => $recEpreuves[$intCtr]['ep_montant_affiche'] ); $strEpreuveP = $recEpreuves[$intCtr]['epr_categorie_fr'] . $recEpreuves[$intCtr]['epr_type_fr'] . $recEpreuves[$intCtr]['epr_nom_fr']; $strDateP = $recEpreuves[$intCtr]['ep_date_limite']; } } // mettre les épreuves et les prix dans le tableau de retour $tabEvenements['epreuves'] = $tabEpreuves; $tabEvenements['prix'] = $tabPrix; $tabEvenements['dates_prix'] = $tabDates; } else $tabEvenements = $recEvenements; } else { if ($blnListeAlpha) { $sqlEvenements = " (SELECT e.eve_id, s.ser_nom_$strLangue, e.eve_nom_$strLangue, e.eve_date_debut, e.eve_date_fin, t.te_nom_$strLangue FROM inscriptions_evenements e LEFT JOIN inscriptions_series s ON s.ser_id = e.ser_id JOIN inscriptions_types_evenements t ON t.te_id = e.te_id WHERE e.te_id NOT IN(9,10) AND e.eve_actif = 1 AND e.eve_date_limite >= '" . fxGetDate() . "' AND e.eve_prive = 0 AND e.eve_hidden = 0 ORDER BY e.eve_nom_$strLangue) "; $tabEvenements = $objDatabase->fxGetResults($sqlEvenements); } else { // sortir les événements abonnements /* $sqlEvenements = " (SELECT e.eve_id, s.ser_nom_$strLangue, e.eve_nom_$strLangue, e.eve_description_$strLangue, e.eve_date_debut, e.eve_date_fin, e.eve_date_limite, e.eve_siteweb, e.eve_label_url, e.eve_lieu_$strLangue, e.eve_photo_$strLangue, e.te_id, t.te_nom_$strLangue, t.te_icone FROM inscriptions_evenements e LEFT JOIN inscriptions_series s ON s.ser_id = e.ser_id JOIN inscriptions_types_evenements t ON t.te_id = e.te_id WHERE e.te_id = 13 AND e.eve_actif = 1 AND e.eve_date_limite >= '" . fxGetDate() . "' AND e.eve_prive = 0 AND e.eve_hidden = 0 ORDER BY e.eve_date_debut, e.eve_nom_$strLangue) UNION (SELECT e.eve_id, s.ser_nom_$strLangue, e.eve_nom_$strLangue, e.eve_description_$strLangue, e.eve_date_debut, e.eve_date_fin, e.eve_date_limite, e.eve_siteweb, e.eve_label_url, e.eve_lieu_$strLangue, e.eve_photo_$strLangue, e.te_id, t.te_nom_$strLangue, t.te_icone FROM inscriptions_evenements e LEFT JOIN inscriptions_series s ON s.ser_id = e.ser_id JOIN inscriptions_types_evenements t ON t.te_id = e.te_id WHERE e.te_id NOT IN(9,10,13) AND e.eve_actif = 1 AND e.eve_date_limite >= '" . fxGetDate() . "' AND e.eve_prive = 0 AND e.eve_hidden = 0 ORDER BY e.eve_date_debut, e.eve_nom_$strLangue) UNION (SELECT e.eve_id, s.ser_nom_$strLangue, e.eve_nom_$strLangue, e.eve_description_$strLangue, e.eve_date_debut, e.eve_date_fin, e.eve_date_limite, e.eve_siteweb, e.eve_label_url, e.eve_lieu_$strLangue, e.eve_photo_$strLangue, e.te_id, t.te_nom_$strLangue, t.te_icone FROM inscriptions_evenements e LEFT JOIN inscriptions_series s ON s.ser_id = e.ser_id JOIN inscriptions_types_evenements t ON t.te_id = e.te_id WHERE e.te_id NOT IN(9,10,13) AND e.eve_actif = 1 AND e.eve_date_limite > ('" . fxGetDate() . "' - INTERVAL 14 DAY) AND e.eve_prive = 0 AND e.eve_hidden = 0 ORDER BY e.eve_date_fin DESC, e.eve_nom_$strLangue) "; $tabEvenements['tous'] = $objDatabase->fxGetResults($sqlEvenements); */ $sqlEvenements = " (SELECT e.eve_id, s.ser_nom_$strLangue, e.eve_nom_$strLangue, e.eve_description_$strLangue, e.eve_date_debut, e.eve_date_fin, e.eve_date_limite, e.eve_siteweb, e.eve_label_url, e.eve_lieu_$strLangue, e.eve_photo_$strLangue, e.te_id, t.te_nom_$strLangue, t.te_icone FROM inscriptions_evenements e LEFT JOIN inscriptions_series s ON s.ser_id = e.ser_id JOIN inscriptions_types_evenements t ON t.te_id = e.te_id WHERE e.te_id = 13 AND e.eve_actif = 1 AND e.eve_date_limite >= '" . fxGetDate() . "' AND e.eve_prive = 0 AND e.eve_hidden = 0 ORDER BY e.eve_date_debut, e.eve_nom_$strLangue) "; $arrCoursesAdhesions = $objDatabase->fxGetResultsKey($sqlEvenements); $sqlEvenements = " (SELECT e.eve_id, s.ser_nom_$strLangue, e.eve_nom_$strLangue, e.eve_description_$strLangue, e.eve_date_debut, e.eve_date_fin, e.eve_date_limite, e.eve_siteweb, e.eve_label_url, e.eve_lieu_$strLangue, e.eve_photo_$strLangue, e.te_id, t.te_nom_$strLangue, t.te_icone FROM inscriptions_evenements e LEFT JOIN inscriptions_series s ON s.ser_id = e.ser_id JOIN inscriptions_types_evenements t ON t.te_id = e.te_id WHERE e.te_id NOT IN(9,10,13) AND e.eve_actif = 1 AND e.eve_date_limite >= '" . fxGetDate() . "' AND e.eve_prive = 0 AND e.eve_hidden = 0 ORDER BY e.eve_date_debut, e.eve_nom_$strLangue) "; $arrCoursesActives = $objDatabase->fxGetResultsKey($sqlEvenements); $sqlEvenements = " (SELECT e.eve_id, s.ser_nom_$strLangue, e.eve_nom_$strLangue, e.eve_description_$strLangue, e.eve_date_debut, e.eve_date_fin, e.eve_date_limite, e.eve_siteweb, e.eve_label_url, e.eve_lieu_$strLangue, e.eve_photo_$strLangue, e.te_id, t.te_nom_$strLangue, t.te_icone FROM inscriptions_evenements e LEFT JOIN inscriptions_series s ON s.ser_id = e.ser_id JOIN inscriptions_types_evenements t ON t.te_id = e.te_id WHERE e.te_id NOT IN(9,10,13) AND e.eve_actif = 1 AND e.eve_date_limite > ('" . fxGetDate() . "' - INTERVAL 14 DAY) AND e.eve_prive = 0 AND e.eve_hidden = 0 ORDER BY e.eve_date_fin DESC, e.eve_nom_$strLangue) "; $arrCoursesTermines = $objDatabase->fxGetResultsKey($sqlEvenements); $tabEvenements['tous'] = array(); if (count($arrCoursesAdhesions) > 0) { $tabEvenements['tous'] += $arrCoursesAdhesions; } if (count($arrCoursesActives) > 0) { $tabEvenements['tous'] += $arrCoursesActives; } if (count($arrCoursesTermines) > 0) { $tabEvenements['tous'] += $arrCoursesTermines; } } } return $tabEvenements; } // fonction pour récupérer les infos d'une épreuve (JSP) // param : id de l'épreuve // créé : 2013-05-21 function fxGetEpreuve($intEpreuve) { global $objDatabase; $sqlEpreuves = "SELECT * FROM inscriptions_epreuves WHERE epr_id = " . intval($intEpreuve); $tabEpreuves = $objDatabase->fxGetRow($sqlEpreuves); return $tabEpreuves; } function fxGetCheckinqte($intEpreuve) { global $objDatabase; $sqlEpreuves = "SELECT count(epr_id) as tot FROM resultats_participants WHERE no_bib_remis=1 and epr_id =" . intval($intEpreuve); $qte = $objDatabase->fxGetVar($sqlEpreuves); return $qte; } // fonction pour récupérer les étapes d'une épreuve (JSP) // param : id de l'épreuve // créé : 2013-05-22 function fxGetEtapesEpreuve($intEpreuve) { global $objDatabase; $sqlEtapes = "SELECT s.eta_id, s.eta_nom_fr, s.eta_nom_en, e.ee_tri FROM inscriptions_epreuves_etapes e, inscriptions_etapes s WHERE s.eta_id = e.eta_id AND e.epr_id = " . intval($intEpreuve); $tabEtapes = $objDatabase->fxGetResults($sqlEtapes); return $tabEtapes; } // récupérer les taux selon le code (JSP) // param : code du taux // créé : 2013-04-11 function fxGetTaux($strCode) { global $objDatabase; $tabTaux[0] = 0; $tabTaux[1] = 0; $tabTaux[2] = ''; $sqlTaux = "SELECT * FROM inscriptions_taux WHERE tau_nom_fr = '" . $objDatabase->fxEscape($strCode) . "' AND tau_actif = 1"; $recTaux = $objDatabase->fxGetRow($sqlTaux); if ($recTaux != null) { $tabTaux[0] = $recTaux['tau_taux']; $tabTaux[1] = $recTaux['tau_desc_fr']; $tabTaux[2] = $recTaux['tau_desc_en']; } return $tabTaux; } // affiche le nombre d'item pour un panier (JSP) // param : no panier // créé : 2013-04-18 function fxNbItemsPanier($strNoPanier) { global $objDatabase; $sqlNbItems = " SELECT COUNT(c.pec_id) AS nb_items, c.eve_id, e.eve_id_membership, e.eve_label_url FROM inscriptions_panier_epreuves_commandees c, inscriptions_evenements e WHERE c.eve_id = e.eve_id AND c.no_panier = '" . $objDatabase->fxEscape($strNoPanier) . "' UNION ALL SELECT COUNT(c.ppn_id) AS nb_items, c.eve_id, e.eve_id_membership, e.eve_label_url FROM inscriptions_panier_produits_new c, inscriptions_evenements e WHERE c.eve_id = e.eve_id AND c.no_panier = '" . $objDatabase->fxEscape($strNoPanier) . "' UNION ALL SELECT COUNT(m.pmd_id) AS nb_items, m.eve_id, e.eve_id_membership, e.eve_label_url FROM inscriptions_panier_montants_dus m, inscriptions_evenements e WHERE m.eve_id = e.eve_id AND m.no_panier = '" . $objDatabase->fxEscape($strNoPanier) . "' "; $tabNbItems = $objDatabase->fxGetResults($sqlNbItems); // evenement id un abonnement 13 (sl) $sqlid = "SELECT * FROM inscriptions_panier_epreuves_commandees c, inscriptions_evenements e WHERE c.eve_id = e.eve_id AND c.no_panier = '" . $objDatabase->fxEscape($strNoPanier) . "' and te_id <> 13 limit 1"; $tabid = $objDatabase->fxGetRow($sqlid); $sqlid13 = "SELECT * FROM inscriptions_panier_epreuves_commandees c, inscriptions_evenements e WHERE c.eve_id = e.eve_id AND c.no_panier = '" . $objDatabase->fxEscape($strNoPanier) . "' and te_id = 13 limit 1"; $tabid13 = $objDatabase->fxGetRow($sqlid13); $mem_return['nbitem'] = intval($tabNbItems[1]['nb_items'] + $tabNbItems[2]['nb_items'] + $tabNbItems[3]['nb_items']); $mem_return['eve_id_membership'] = 0; if ($mem_return['nbitem'] > 0) { if ($tabNbItems[1]['eve_id'] > 0) { $mem_return['eve_id'] = $tabNbItems[1]['eve_id']; $mem_return['eve_id_membership'] = $tabNbItems[1]['eve_id_membership']; $mem_return['eve_label_url'] = $tabNbItems[1]['eve_label_url']; } elseif ($tabNbItems[2]['eve_id'] > 0) { $mem_return['eve_id'] = $tabNbItems[2]['eve_id']; $mem_return['eve_label_url'] = $tabNbItems[2]['eve_label_url']; } else { $mem_return['eve_id'] = $tabNbItems[3]['eve_id']; $mem_return['eve_label_url'] = $tabNbItems[3]['eve_label_url']; } // remettre eve_id qui est pas abonnement (sl) if ($tabid != null) { if (intval($mem_return['eve_id']) != intval($tabid['eve_id'])) { $mem_return['eve_id'] = $tabid['eve_id']; $mem_return['eve_label_url'] = $tabid['eve_label_url']; } } // identifi si abonement $mem_return['abbonement'] = 0; if ($tabid13!= null && $mem_return != null) { if (intval($tabid13['eve_id']) == intval($mem_return['eve_id'])) $mem_return['abbonement'] = 1; } if (!isset($_SESSION['eve_label_url']) && $mem_return['eve_label_url'] != '') $_SESSION['eve_label_url'] = $mem_return['eve_label_url']; } else { // supprimer l'entête vide require_once 'inc_fx_panier.php'; fxDelPanierVide($strNoPanier); unset($_SESSION['no_panier']); } return $mem_return; } // fonction qui retourne les modes de paiements (JSP) // param: admin seulement? (1 ou 0), langue d'affichage // créé: 2013-04-24 function fxGetPaiements($blnAdmin = false, $blnIsPromoteur = false, $strLangue = 'fr') { global $objDatabase; $where = ''; if (!$blnAdmin) { $where .= " AND pai_admin <> 1"; } if (!$blnIsPromoteur) { $where .= " AND pai_promoteur = 0"; } if ($blnAdmin) { $where = ''; } $sqlPaiements = "SELECT pai_id, pai_nom_" . $strLangue . " FROM inscriptions_paiements WHERE pai_actif = 1 $where ORDER BY pai_tri"; $recPaiements = $objDatabase->fxGetResults($sqlPaiements); if ($recPaiements != null) return $recPaiements; else return false; } /** Compte connecté au panier (com_info ou com_id en session). */ function fxPaiementSessionComId() { if (!empty($_SESSION['com_info']['com_id'])) { return intval($_SESSION['com_info']['com_id']); } if (!empty($_SESSION['com_id'])) { return intval($_SESSION['com_id']); } return 0; } /** Modes paiement réservés promoteur (chèque, etc.) — aligné hub v2 + legacy. */ function fxPaiementCanUseModesPromoteur($intComId, $intEveId) { $intComId = intval($intComId); $intEveId = intval($intEveId); if ($intComId <= 0 || $intEveId <= 0) { return false; } if (!function_exists('fxPromoteurHubCanAccessPromoteurWeb')) { require_once __DIR__ . '/inc_fx_promoteur_hub.php'; } $arrLegacyFlip = array(); if (function_exists('fxPromoteurHubGetLegacyEventIds')) { $arrLegacyFlip = array_flip(array_map('intval', fxPromoteurHubGetLegacyEventIds($intComId))); } return fxPromoteurHubCanAccessPromoteurWeb($intComId, $intEveId, $arrLegacyFlip); } /** Modes paiement réservés admin (canal superadm / usa_id). */ function fxPaiementCanUseModesAdmin() { return !empty($_SESSION['usa_id']); } // fonction qui retire/transforme le HTML présent dans les termes et conditions à accepter // param : texteà transformer // créé : 2013-04-26 function fxSetTexteTermes($strTexte) { $strBreaks = array("
", "
", "
", "

"); $strTexte = str_ireplace($strBreaks, "\r\n", $strTexte); $strTexte = str_ireplace("

", "", $strTexte); // $strTexte = fxRemoveHtml($strTexte); return $strTexte; } function fxreplace_accents_string($string) { return str_replace(array('à', 'á', 'â', 'ã', 'ä', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', 'ù', 'ú', 'û', 'ü', 'ý', 'ÿ', 'À', 'Á', 'Â', 'Ã', 'Ä', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ù', 'Ú', 'Û', 'Ü', 'Ý'), array('a', 'a', 'a', 'a', 'a', 'c', 'e', 'e', 'e', 'e', 'i', 'i', 'i', 'i', 'n', 'o', 'o', 'o', 'o', 'o', 'u', 'u', 'u', 'u', 'y', 'y', 'A', 'A', 'A', 'A', 'A', 'C', 'E', 'E', 'E', 'E', 'I', 'I', 'I', 'I', 'N', 'O', 'O', 'O', 'O', 'O', 'U', 'U', 'U', 'U', 'Y'), $string); } function fxreplace_accents_array($mem_array) { $mem_output = ''; foreach ($mem_array as $key => $value) $mem_output = $mem_output[$key] = str_replace(array('à', 'á', 'â', 'ã', 'ä', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', 'ù', 'ú', 'û', 'ü', 'ý', 'ÿ', 'À', 'Á', 'Â', 'Ã', 'Ä', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ù', 'Ú', 'Û', 'Ü', 'Ý'), array('a', 'a', 'a', 'a', 'a', 'c', 'e', 'e', 'e', 'e', 'i', 'i', 'i', 'i', 'n', 'o', 'o', 'o', 'o', 'o', 'u', 'u', 'u', 'u', 'y', 'y', 'A', 'A', 'A', 'A', 'A', 'C', 'E', 'E', 'E', 'E', 'I', 'I', 'I', 'I', 'N', 'O', 'O', 'O', 'O', 'O', 'U', 'U', 'U', 'U', 'Y'), $value); return $mem_output; } function fxupload_excel_triathlon($mem_fichier) { global $objDatabase; include 'simplexlsx.class.php'; $xlsx = new SimpleXLSX($mem_fichier); $mem_rows = $xlsx->rows(); print_r($xlsx); $sqlDelete = "DELETE FROM inscriptions_tq WHERE 1=1"; $qryDelete = $objDatabase->fxQuery($sqlDelete); $counter = 0; foreach ($mem_rows as $r) { if ($counter != 0) { $sqlInsert = "INSERT INTO inscriptions_tq set tq_nom='" . htmlentities(trim($r[0]), ENT_QUOTES, 'UTF-8') . "',tq_prenom='" . $objDatabase->fxEscape(htmlentities(trim($r[1]), ENT_QUOTES, 'UTF-8')) . "',tq_no='" . $r[2] . "',tq_adhesion='" . date('Y-m-d', $xlsx->unixstamp($r[3])) . "',tq_naissance='" . date('Y-m-d', $xlsx->unixstamp($r[4])) . "',tq_sexe='" . $r[5] . "',tq_categorie='" . $objDatabase->fxEscape(htmlentities(trim($r[6]), ENT_QUOTES, 'UTF-8')) . "',tq_timeupdate=now()"; $qryInsert = $objDatabase->fxQuery($sqlInsert); } $counter = $counter + 1; } echo($counter); return "ok"; } function fxupload_excel_triathlonv2bad($mem_fichier) { global $objDatabase; $objReader = new PHPExcel_Reader_Excel5(); $objReader->setReadDataOnly(true); $objPHPExcel = $objReader->load($mem_fichier); echo('test'); print_r($objPHPExcel); exit; $sqlDelete = "DELETE FROM inscriptions_tq WHERE 1=1"; $qryDelete = $objDatabase->fxQuery($sqlDelete); $counter = 0; foreach ($mem_rows as $r) { if ($counter != 0) { $sqlInsert = "INSERT INTO inscriptions_tq set tq_nom='" . htmlentities(trim($r[0]), ENT_QUOTES, 'UTF-8') . "',tq_prenom='" . $objDatabase->fxEscape(htmlentities(trim($r[1]), ENT_QUOTES, 'UTF-8')) . "',tq_no='" . $r[2] . "',tq_adhesion='" . date('Y-m-d', $xlsx->unixstamp($r[3])) . "',tq_naissance='" . date('Y-m-d', $xlsx->unixstamp($r[4])) . "',tq_sexe='" . $r[5] . "',tq_categorie='" . $objDatabase->fxEscape(htmlentities(trim($r[6]), ENT_QUOTES, 'UTF-8')) . "',tq_timeupdate=now()"; $qryInsert = $objDatabase->fxQuery($sqlInsert); } $counter = $counter + 1; } echo($counter); return "ok"; } // fonction pour créer le texte pour le lien facebook // param : no panier, langue // créé : 2013-11-26 function fxGetTextFacebook($strNoPanier, $strLangue) { global $objDatabase, $vDomaine; $tabRetour = array(); // trouver pour qui est le don (équipe) $sqlDon = "SELECT * FROM inscriptions_panier_dons d, inscriptions_panier_epreuves_commandees e WHERE d.pec_id = e.pec_id AND d.no_panier = '" . $objDatabase->fxEscape($strNoPanier) . "'"; $tabDon = $objDatabase->fxGetRow($sqlDon); if (count($tabDon) > 0) {// message le cas d'un don // récupérer l'événement du panier $sqlEvenement = "SELECT e.* FROM inscriptions_panier_dons d, inscriptions_evenements e WHERE d.eve_id = e.eve_id AND d.no_panier = '" . $objDatabase->fxEscape($strNoPanier) . "'"; $tabEvenement = $objDatabase->fxGetRow($sqlEvenement); $arrLien = fxGetLinksDonationParticipant($tabDon['pec_id'], $tabDon['par_id'], $strLangue); $tabRetour['url'] = $vDomaine . '/' . $arrLien['link']; if ($tabDon['par_id'] > 0) { // trouver pour qui est le don $sqlParticipant = "SELECT * FROM inscriptions_panier_participants WHERE par_id = " . intval($tabDon['par_id']); $tabParticipant = $objDatabase->fxGetRow($sqlParticipant); $strDon = fxUnescape($tabParticipant['par_prenom']) . ' ' . fxUnescape($tabParticipant['par_nom']); } else { if ($strLangue == 'fr') $strDon = 'l\'équipe '; else $strDon = 'the team '; $strDon .= fxUnescape($tabDon['pec_nom_equipe']); } if ($tabEvenement['eve_date_debut'] != $tabEvenement['eve_date_fin']) $strDate = fxShowDateInterval($tabEvenement['eve_date_debut'], $tabEvenement['eve_date_fin'], $strLangue); else { if ($strLangue == 'fr') $strDate = 'le '; else $strDate = 'on '; $strDate .= fxShowDateInterval($tabEvenement['eve_date_debut'], $tabEvenement['eve_date_fin'], $strLangue); } if ($strLangue == 'fr') $strMessage = "Je viens de faire un don à " . $strDon . " inscrit au " . fxUnescape($tabEvenement['eve_nom_' . $strLangue]) . " qui aura lieu " . $strDate . "."; else $strMessage = "I just donated to " . $strDon . " registered to " . fxUnescape($tabEvenement['eve_nom_' . $strLangue]) . " which will take place " . $strDate . "."; } else { // récupérer l'événement du panier $sqlEvenement = "SELECT e.* FROM inscriptions_panier_acheteurs a, inscriptions_evenements e WHERE a.eve_id = e.eve_id AND no_panier = '" . $objDatabase->fxEscape($strNoPanier) . "'"; $tabEvenement = $objDatabase->fxGetRow($sqlEvenement); if ($tabEvenement['eve_facebook_texte_' . $strLangue] != '') { $strMessage = fxUnescape($tabEvenement['eve_facebook_texte_' . $strLangue]); } else { if ($tabEvenement['eve_date_debut'] != $tabEvenement['eve_date_fin']) $strDate = fxShowDateInterval($tabEvenement['eve_date_debut'], $tabEvenement['eve_date_fin'], $strLangue); else { if ($strLangue == 'fr') $strDate = 'le '; else $strDate = 'on '; $strDate .= fxShowDateInterval($tabEvenement['eve_date_debut'], $tabEvenement['eve_date_fin'], $strLangue); } if ($strLangue == 'fr') $strMessage = "Je me suis inscrit au " . fxUnescape($tabEvenement['eve_nom_' . $strLangue]) . " qui aura lieu " . $strDate . "."; else $strMessage = "I registered to " . fxUnescape($tabEvenement['eve_nom_' . $strLangue]) . " which will take place " . $strDate . "."; } if (trim($tabEvenement['eve_siteweb']) != '') { $tabRetour['url'] = trim($tabEvenement['eve_siteweb']); } else { $tabRetour['url'] = $vDomaine . '/' . $tabEvenement['eve_label_url'] . '/' . $strLangue; } } $tabRetour['message'] = $objDatabase->fxEscape($strMessage); return $tabRetour; } // fonction qui créé le lien pour partager sur facebook (JSP) // param : tableau des paramètres // créé : 2013-11-26 function fxGetFacebookLink($tabParam) { $strLink = 'https://www.facebook.com/dialog/share?app_id=' . $tabParam['app_id'] . '&display=' . $tabParam['display'] . '&href=' . $tabParam['link'] . '&redirect_uri=' . $tabParam['redirect_uri']; return $strLink; } // fonction pour récupérer les paramètre pour le lien facebook // param : message // créé : 2013-11-26 function fxGetFacebookParam($tabData) { $tabParam['app_id'] = fxGetVariable('fb_app_id'); $tabParam['display'] = 'popup'; $tabParam['quote'] = $tabData['message']; $tabParam['link'] = $tabData['url']; $tabParam['redirect_uri'] = 'https://www.ms1inscription.com'; return $tabParam; } // fonction pour faire la liste des log // param : message // créé : 2014-06-2 function fxemaillog($mem_logtype) { global $objDatabase; $sqllog = "SELECT * FROM inscriptions_log WHERE " . $mem_logtype . " AND log_email = 1 ORDER BY logdate"; $tablog = $objDatabase->fxGetResults($sqllog); print_r($tablog); return ($tablog); } // fonction pour creer un log // param : message // créé : 2014-06-2 function fxcreer_log($strDescription, $intType = 10, $int_Email = 0, $int_eve_id = 0, $int_epr_id = 0, $int_pra_id = 0, $str_no_panier = '', $int_com_id = 0, $str_com_courriel = '') { // intType 50 nouveau membre // intType 55 renouvellement //function fxcreer_log($strDescription, $intType = 10, $int_Email = 0, $int_eve_id = 0, $int_epr_id = 0, $int_pra_id = 0, $str_no_panier = '', $int_com_id = 0) { global $objDatabase; if (isset($_SESSION['com_id'])) $int_com_id = $_SESSION['com_id']; if (isset($_SESSION['no_panier'])) $str_no_panier = $_SESSION['no_panier']; $sqlInsert = "INSERT INTO inscriptions_log SET log_description = '" . $strDescription . "', log_email = " . $int_Email . ", log_type = " . $intType . ", eve_id = " . $int_eve_id . ", epr_id = " . $int_epr_id . ", pra_id = " . $int_pra_id . ", no_panier = '" . $str_no_panier . "', log_time = NOW(), com_id = " . $int_com_id . ", log_prg = '" . $GLOBALS['vPage'] . "', log_com_courriel = '" . $str_com_courriel . "'"; $qryInsert = $objDatabase->fxQuery($sqlInsert); return (true); } /** MSIN-4379 — Table inscriptions_evt_erreur disponible ? */ function fxEvtErreurTableReady() { static $blnReady = null; if ($blnReady !== null) { return $blnReady; } global $objDatabase; $tabRow = $objDatabase->fxGetRow("SHOW TABLES LIKE 'inscriptions_evt_erreur'"); $blnReady = is_array($tabRow) && !empty($tabRow); return $blnReady; } /** * MSIN-4379 — Ouvre une erreur actionnable (une seule ligne ouverte par type + epr + par). * @param string $strType ex. bib_auto_miss * @param array $tabCtx eve_id, epr_id, par_id, pec_id, no_commande, no_panier, com_id, detail */ function fxEvtErreurOuvrir($strType, array $tabCtx = []) { global $objDatabase; if (!fxEvtErreurTableReady()) { return false; } $strType = trim((string)$strType); if ($strType === '') { return false; } $intEveId = (int)($tabCtx['eve_id'] ?? 0); $intEprId = (int)($tabCtx['epr_id'] ?? 0); $intParId = (int)($tabCtx['par_id'] ?? 0); if ($intEveId <= 0 || $intEprId <= 0 || $intParId <= 0) { return false; } $sqlExists = " SELECT evt_err_id FROM inscriptions_evt_erreur WHERE evt_err_type = '" . $objDatabase->fxEscape($strType) . "' AND epr_id = $intEprId AND par_id = $intParId AND evt_err_statut = 'ouvert' LIMIT 1 "; if ((int)$objDatabase->fxGetVar($sqlExists) > 0) { return true; } $intPecId = (int)($tabCtx['pec_id'] ?? 0); $strNoCommande = trim((string)($tabCtx['no_commande'] ?? '')); $strNoPanier = trim((string)($tabCtx['no_panier'] ?? '')); $intComId = (int)($tabCtx['com_id'] ?? 0); $strDetail = trim((string)($tabCtx['detail'] ?? '')); $sqlInsert = " INSERT INTO inscriptions_evt_erreur SET evt_err_type = '" . $objDatabase->fxEscape($strType) . "', evt_err_statut = 'ouvert', eve_id = $intEveId, epr_id = $intEprId, par_id = $intParId, pec_id = $intPecId, no_commande = '" . $objDatabase->fxEscape($strNoCommande) . "', no_panier = '" . $objDatabase->fxEscape($strNoPanier) . "', com_id = $intComId, evt_err_detail = " . ($strDetail !== '' ? "'" . $objDatabase->fxEscape($strDetail) . "'" : 'NULL') . ", evt_err_created = NOW() "; return $objDatabase->fxQuery($sqlInsert) !== false; } /** MSIN-4379 — Marque résolues les erreurs ouvertes pour un participant / épreuve. */ function fxEvtErreurResoudre($strType, $int_epr_id, $int_par_id, $int_resolved_by = 0) { global $objDatabase; if (!fxEvtErreurTableReady()) { return false; } $strType = trim((string)$strType); $int_epr_id = (int)$int_epr_id; $int_par_id = (int)$int_par_id; $int_resolved_by = (int)$int_resolved_by; if ($strType === '' || $int_epr_id <= 0 || $int_par_id <= 0) { return false; } if ($int_resolved_by <= 0 && isset($_SESSION['com_id'])) { $int_resolved_by = (int)$_SESSION['com_id']; } $sqlUpdate = " UPDATE inscriptions_evt_erreur SET evt_err_statut = 'resolu', evt_err_resolved = NOW(), evt_err_resolved_by = $int_resolved_by WHERE evt_err_type = '" . $objDatabase->fxEscape($strType) . "' AND epr_id = $int_epr_id AND par_id = $int_par_id AND evt_err_statut = 'ouvert' "; $objDatabase->fxQuery($sqlUpdate); return true; } function fxIsRegistered($strPartId, $strChamp, $strWhere, $strTable, $strLangue) { global $objDatabase; $return = true; $qry = "SELECT * FROM " . $strTable . " WHERE " . $strChamp . " = " . $strPartId . $strWhere; $rec = $objDatabase->fxGetResults($qry); if (!(isset($rec))) $return = false; return $return; } // récupérer les transactions selon le compte client ou l'épreuve commandée (JSP) // param : id de l'épreuve commandée (pec_id), id du compte client (com_id) // création : 2014-06-23 function fxGetTransactions($intEpreuveCommandee = 0, $intCompte = 0) { global $objDatabase; // $blnFindPecIds = true; // $tabPecIds = array(); // $tabPecIds[] = $intEpreuveCommandee; // $sql = "SELECT pec_id_old FROM inscriptions_panier_epreuves_commandees_upgrade WHERE pec_id_new = " . intval($intEpreuveCommandee);// . " ORDER BY pecu_maj"; // $int_pec_id_old = $objDatabase->fxGetVar($sql); // $tabPecIds[] = $int_pec_id_old; // while($blnFindPecIds){ // $sql = "SELECT pec_id_old FROM inscriptions_panier_epreuves_commandees_upgrade WHERE pec_id_new = " . intval($int_pec_id_old); // $int_pec_id_old = $objDatabase->fxGetVar($sql); // if($int_pec_id_old != null){ // $tabPecIds[] = $int_pec_id_old; // } // else // $blnFindPecIds = false; // } $tabTransactions = null; if ($intEpreuveCommandee != 0) { $sqlTransactions = "SELECT a.no_commande, a.ach_maj, a.ach_total, s.sta_nom_fr, s.sta_nom_en, a.no_panier FROM inscriptions_panier_acheteurs a, inscriptions_panier_statuts s, inscriptions_panier_epreuves_commandees e WHERE s.sta_id = a.sta_id AND a.sta_id = 3 AND e.no_panier = a.no_panier AND e.pec_id = " . intval($intEpreuveCommandee) . " UNION SELECT a.no_commande, a.ach_maj, a.ach_total, s.sta_nom_fr, s.sta_nom_en, a.no_panier FROM inscriptions_panier_acheteurs a, inscriptions_panier_statuts s, inscriptions_panier_produits_new p WHERE s.sta_id = a.sta_id AND a.sta_id = 3 AND p.no_panier = a.no_panier AND p.pec_id = " . intval($intEpreuveCommandee) . " UNION SELECT a.no_commande, a.ach_maj, a.ach_total, s.sta_nom_fr, s.sta_nom_en, a.no_panier FROM inscriptions_panier_acheteurs a, inscriptions_panier_statuts s, inscriptions_panier_montants_dus m WHERE s.sta_id = a.sta_id AND a.sta_id = 3 AND m.no_panier = a.no_panier AND m.pec_id = " . intval($intEpreuveCommandee) . " ORDER BY ach_maj DESC"; $tabTransactions = $objDatabase->fxGetResults($sqlTransactions); } elseif ($intCompte != 0) { $sqlTransactions = "SELECT a.no_commande, a.ach_maj, a.ach_total, s.sta_nom_fr, s.sta_nom_en, a.no_panier FROM inscriptions_panier_acheteurs a, inscriptions_panier_statuts s WHERE s.sta_id = a.sta_id AND a.sta_id = 3 AND com_id = " . intval($intCompte) . " ORDER BY a.ach_maj DESC"; $tabTransactions = $objDatabase->fxGetResults($sqlTransactions); } return $tabTransactions; } // récupérer les montants dus selon le compte client ou l'épreuve commandée (JSP) // param : id de l'épreuve commandée (pec_id), id du compte client (com_id), inclure les items du panier (oui/non) // création : 2014-07-07 /*function fxGetMontantsDus($intEpreuveCommandee = 0, $intCompte = 0, $intPanier = 1) { global $objDatabase; $tabMontants = null; if ($intEpreuveCommandee != 0) { if ($intPanier == 1) $sqlMontants = "SELECT a.no_commande, a.ach_maj, m.md_montant, m.md_id, a.no_panier, m.md_date_limite_paiement FROM inscriptions_panier_acheteurs a, inscriptions_montants_dus m WHERE a.no_commande = m.no_commande AND (m.no_commande_paye IS NULL OR m.no_commande_paye = '') AND m.pec_id = " . intval($intEpreuveCommandee) . " AND m.md_id NOT IN(SELECT m.md_id FROM inscriptions_panier_montants_dus m, inscriptions_panier_acheteurs a WHERE a.no_panier = m.no_panier AND a.sta_id = 1) ORDER BY a.ach_maj DESC"; else $sqlMontants = "SELECT a.no_commande, a.ach_maj, m.md_montant, m.md_id, a.no_panier, m.md_date_limite_paiement FROM inscriptions_panier_acheteurs a, inscriptions_montants_dus m WHERE a.no_commande = m.no_commande AND (m.no_commande_paye IS NULL OR m.no_commande_paye = '') AND m.pec_id = " . intval($intEpreuveCommandee) . " ORDER BY a.ach_maj DESC"; $tabMontants = $objDatabase->fxGetResults($sqlMontants); } elseif ($intCompte != 0) { if ($intPanier == 1) $sqlMontants = "SELECT a.no_commande, a.ach_maj, m.md_montant, m.md_id, a.no_panier, m.md_date_limite_paiement FROM inscriptions_panier_acheteurs a, inscriptions_montants_dus m WHERE a.no_commande = m.no_commande AND (m.no_commande_paye IS NULL OR m.no_commande_paye = '') AND m.com_id = " . intval($intCompte) . " AND m.md_id NOT IN(SELECT m.md_id FROM inscriptions_panier_montants_dus m, inscriptions_panier_acheteurs a WHERE a.no_panier = m.no_panier AND a.sta_id = 1) ORDER BY a.ach_maj DESC"; else $sqlMontants = "SELECT a.no_commande, a.ach_maj, m.md_montant, m.md_id, a.no_panier, m.md_date_limite_paiement FROM inscriptions_panier_acheteurs a, inscriptions_montants_dus m WHERE a.no_commande = m.no_commande AND (m.no_commande_paye IS NULL OR m.no_commande_paye = '') AND m.com_id = " . intval($intCompte) . " ORDER BY a.ach_maj DESC"; $tabMontants = $objDatabase->fxGetResults($sqlMontants); } return $tabMontants; }*/ /* * Fonction qui retourne une string du navigateur de l'usager * @param str_user_agent le 'user agent' de l'usager */ function fxGetBrowser($str_user_agent) { if (strpos($str_user_agent, 'MSIE') !== FALSE) return 'Internet explorer'; elseif (strpos($str_user_agent, 'Trident') !== FALSE) //For Supporting IE 11 return 'Internet explorer'; elseif (strpos($str_user_agent, 'Firefox') !== FALSE) return 'Mozilla Firefox'; elseif (strpos($str_user_agent, 'Chrome') !== FALSE) return 'Google Chrome'; elseif (strpos($str_user_agent, 'Opera Mini') !== FALSE) return "Opera Mini"; elseif (strpos($str_user_agent, 'Opera') !== FALSE) return "Opera"; elseif (strpos($str_user_agent, 'Safari') !== FALSE) return "Safari"; else return 'Something else'; } function fxGetInfosChamps($eve_id, $str_value_prefix) { global $objDatabase; $qry = "select * from inscriptions_infos_participants p, inscriptions_infos_participants_champs c where p.inf_actif = 1 AND p.cha_id = c.cha_id and p.eve_id = " . intval($eve_id) . " ORDER BY p.inf_tri"; $results = $objDatabase->fxGetResults($qry); $str_champs = ''; $str_values = ''; for ($i = 1; $i <= count($results); $i++) { $str_champs .= $results[$i]['cha_nom'] . "_1,"; if ($results[$i]['cha_nom'] == 'pro_id' || $results[$i]['cha_nom'] == 'pay_id') $str_values .= $results[$i]['cha_nom'] . ","; else $str_values .= $str_value_prefix . substr($results[$i]['cha_nom'], 3) . ","; } // Remove trailing comma (,) $mem_return['champs'] = substr($str_champs, 0, -1); $mem_return['values'] = substr($str_values, 0, -1); return $mem_return; } /** * Fonction qui affiche un bouton "view waiver" avec les donnees du participant + jQuery requis (fonctionne avec script 'clear_waiver.php') * @param $tab_data : tableau des donnees du participant inscrit a une epreuve requerant un waiver * @param $str_waiver_text : string du texte du waiver * @param $int_com_id : le id unique de l'usager logge au site */ function fxShowWaiverForm($tab_data, $str_waiver_text, $str_waiver_pdf, $int_com_id, $str_mod) { global $vDomaine, $vRepertoireFichiers; // button "clear waiver" pour participant majeur (18 ans +) if ($str_mod == 'invite') { ?>

= 18) { ?>
()
fxGetVar($sqlEveURL); $strButtonDisabled = ''; if ($GLOBALS['strUserPermission'] == 'view') { $strButtonDisabled = "disabled='disabled' style='padding: 3px; float: right; cursor: default'"; } ?>
" method="post" id="frm_invite">

fxGetRow($qry); return $return; } function fxGetNomEquipe($int_pec_id) { global $objDatabase; $qry = "SELECT pec_nom_equipe FROM resultats_epreuves_commandees WHERE pec_id_original = " . intval($int_pec_id); $return = $objDatabase->fxGetVar($qry); return $return; } function fxGetTabCaptain($int_pec_id) { global $objDatabase; $qry = "SELECT * FROM resultats_participants WHERE pec_id = " . intval($int_pec_id) . " AND rol_id = 1";// . intval($_SESSION['com_info']['com_id']); $return = $objDatabase->fxGetRow($qry); return $return; } function fxGetRoleTab($int_rol_id) { $mem_return = array(); switch ($int_rol_id) { case 1: $mem_return['rol_img'] = ""; $mem_return['rol_txt'] = afficheTexte('role_captain', 0); break; case 3: $mem_return['rol_img'] = ""; $mem_return['rol_txt'] = afficheTexte('role_volunteer', 0); break; case 4: // echo " Pit manager"; $mem_return['rol_img'] = ""; $mem_return['rol_txt'] = afficheTexte('role_pitmanager', 0); break; default: // echo " Participant"; $mem_return['rol_img'] = ""; $mem_return['rol_txt'] = afficheTexte('role_participant', 0); break; } return $mem_return; } function fxIsPromoteur($intComId, $intEveId) { if (!fxPromoteurLegacySiteEnabled()) { return false; } static $arrLegacyByCom = array(); $intComId = intval($intComId); $intEveId = intval($intEveId); if (!isset($arrLegacyByCom[$intComId])) { $strCsv = ''; if (!empty($_SESSION['com_info']['com_id']) && intval($_SESSION['com_info']['com_id']) === $intComId && isset($_SESSION['com_info']['com_eve_promoteur'])) { $strCsv = (string)$_SESSION['com_info']['com_eve_promoteur']; } else { global $objDatabase; $row = $objDatabase->fxGetRow( 'SELECT com_eve_promoteur FROM inscriptions_comptes WHERE com_id = ' . $intComId ); $strCsv = ($row !== null) ? (string)$row['com_eve_promoteur'] : ''; } $arrLegacyByCom[$intComId] = array(); foreach (array_map('trim', explode(',', $strCsv)) as $strId) { if ($strId !== '') { $arrLegacyByCom[$intComId][intval($strId)] = true; } } } return !empty($arrLegacyByCom[$intComId][$intEveId]); } // nouvelle fonction 2026 /** * ============================================================ * CALCUL DES FRAIS ET TAXES APPLICABLES * ============================================================ * * @param object $objDatabase Instance base de données * @param float $fltSousTotal Montant sur lequel appliquer les frais * @param int $eve_frais ID configuration frais (0 = aucun frais) * @param int $tt_id ID type de taxes (1 = aucune taxe) * * @return array [ * 'fra_avant_tx' => float, * 'fra_total' => float, * 'fra_pourcent' => float, * 'fra_taxes' => float * ] */ function fxCalculerFrais( $objDatabase, $montantSousTotal, $eve_frais, $tt_id, $inclureTaxesDansBaseFrais = false ) { /* =============================== 1) Sécurisation des entrées =============================== */ $montantSousTotal = floatval($montantSousTotal); $eve_frais = intval($eve_frais); $tt_id = intval($tt_id); $montantBaseFrais = $montantSousTotal; $montantTaxesSousTotal = 0; $montantFraisAvantTaxes = 0; $montantTaxesSurFrais = 0; $pourcentageFrais = 0; /* =============================== 2) Calcul taxes sur sous-total (optionnel) =============================== */ if ($inclureTaxesDansBaseFrais && $tt_id > 1) { $sqlTaux = " SELECT t.tau_taux FROM inscriptions_taux t JOIN inscriptions_taux_types_taux ttt ON t.tau_id = ttt.tau_id WHERE ttt.tt_id = {$tt_id} "; $tabTaux = $objDatabase->fxGetResults($sqlTaux); if ($tabTaux) { foreach ($tabTaux as $tx) { $montantTaxesSousTotal += round( $montantSousTotal * (floatval($tx['tau_taux']) / 100), 2 ); } } $montantBaseFrais = round($montantSousTotal + $montantTaxesSousTotal, 2); } /* =============================== 3) Si aucun frais configuré =============================== */ if ($eve_frais <= 0) { return [ 'sous_total' => $montantSousTotal, 'taxes_sous_total' => $montantTaxesSousTotal, 'base_calcul_frais' => $montantBaseFrais, 'frais_avant_taxes' => 0, 'taxes_sur_frais' => 0, 'frais_total' => 0, 'frais_pourcentage' => 0 ]; } /* =============================== 4) Recherche du frais applicable =============================== */ $sqlFrais = " SELECT fra_avant_tx, fra_pourcent FROM inscriptions_frais WHERE fra_actif = 1 AND fra_montant_max >= {$montantBaseFrais} AND fra_montant_min <= {$montantBaseFrais} AND eve_frais = {$eve_frais} LIMIT 1 "; $tabFrais = $objDatabase->fxGetRow($sqlFrais); if (!$tabFrais) { return [ 'sous_total' => $montantSousTotal, 'taxes_sous_total' => $montantTaxesSousTotal, 'base_calcul_frais' => $montantBaseFrais, 'frais_avant_taxes' => 0, 'taxes_sur_frais' => 0, 'frais_total' => 0, 'frais_pourcentage' => 0 ]; } /* =============================== 5) Calcul frais avant taxes =============================== */ if ($tabFrais['fra_pourcent'] > 0) { $pourcentageFrais = floatval($tabFrais['fra_pourcent']); $montantFraisAvantTaxes = round( $montantBaseFrais * ($pourcentageFrais / 100), 2 ); } else { $montantFraisAvantTaxes = floatval($tabFrais['fra_avant_tx']); } /* =============================== 6) Calcul taxes sur frais =============================== */ if ($tt_id > 1) { $sqlTaux = " SELECT t.tau_taux FROM inscriptions_taux t JOIN inscriptions_taux_types_taux ttt ON t.tau_id = ttt.tau_id WHERE ttt.tt_id = {$tt_id} "; $tabTaux = $objDatabase->fxGetResults($sqlTaux); if ($tabTaux) { foreach ($tabTaux as $tx) { $montantTaxesSurFrais += round( $montantFraisAvantTaxes * (floatval($tx['tau_taux']) / 100), 2 ); } } } /* =============================== 7) Retour structuré clair =============================== */ return [ 'sous_total' => $montantSousTotal, 'taxes_sous_total' => $montantTaxesSousTotal, 'base_calcul_frais' => $montantBaseFrais, 'frais_avant_taxes' => $montantFraisAvantTaxes, 'taxes_sur_frais' => $montantTaxesSurFrais, 'frais_total' => round($montantFraisAvantTaxes + $montantTaxesSurFrais, 2), 'frais_pourcentage' => $pourcentageFrais ]; } // fonction pour récupérer les infos d'un produit (JSP) // param : id du produit, id de l'événement (optionel) // créé : 2015-02-19 function fxGetProduits($intProduit, $intEvenement = 0, $strWhere = '',$validedate=1) { global $objDatabase; $tabProduits = null; if ($intProduit != 0) { // si le id du produit est défini if($validedate==1){ $sqlProduits = "SELECT * FROM inscriptions_produits_new WHERE pro_id = " . intval($intProduit) . " AND pro_actif = 1 AND (pro_date_limite = '0000-00-00' OR pro_date_limite = '' OR pro_date_limite IS NULL OR pro_date_limite >= '" . fxGetDate() . "')"; $tabProduits = $objDatabase->fxGetRow($sqlProduits); }else{ $sqlProduits = "SELECT *,not(pro_date_limite = '0000-00-00' OR pro_date_limite = '' OR pro_date_limite IS NULL OR pro_date_limite >=now() ) as echue FROM inscriptions_produits_new WHERE pro_id = " . intval($intProduit) . " AND pro_actif = 1 "; $tabProduits = $objDatabase->fxGetRow($sqlProduits); } } elseif ($intEvenement != 0) { // si le id du produit n'est pas défini mais que le id de l'événement est défini $sqlProduits = "SELECT * FROM inscriptions_produits_new WHERE eve_id = " . intval($intEvenement) . " AND pro_actif = 1 AND (pro_date_limite = '0000-00-00' OR pro_date_limite = '' OR pro_date_limite IS NULL OR pro_date_limite >= '" . fxGetDate() . "')"; if ($strWhere != '') { $sqlProduits .= " AND " . $strWhere; $tabProduits = $objDatabase->fxGetRow($sqlProduits); } else { $tabProduits = $objDatabase->fxGetResults($sqlProduits); } } $sqlPrix = "SELECT eve_frais,tt_id from inscriptions_evenements WHERE eve_id = " . intval($tabProduits['eve_id']); $arrEve = $objDatabase->fxGetResults($sqlPrix); $arr['eve_frais']=$arrEve[1]['eve_frais']; $arr['tt_id']=$arrEve[1]['tt_id']; $fltSousTotal=$tabProduits['pro_prix']; if ($arr['eve_frais'] > 0) { //MSIN-4344 /* ===== frais / taxes ===== */ $result = fxCalculerFrais($objDatabase, $tabProduits['pro_prix'], $arr['eve_frais'], $arr['tt_id'],$tabProduits['pro_taxable']); $tabProduits['fra_avant_tx'] = $result['frais_avant_taxes']; $tabProduits['fra_total'] = $result['frais_avant_taxes']; $tabProduits['fra_pourcent'] = $result['frais_pourcentage']; // echosl("fxGetProduits"); // print_rsl($result); } return $tabProduits; } function fxGetFraisAutres($strType, $intFrais, $intEvenement, $intTypeEpreuve = 1) { global $objDatabase; if ($intTypeEpreuve == 1) { // $sqlFrais = "SELECT * FROM inscriptions_frais_autres WHERE fa_actif = 1 AND fa_type = '" . $objDatabase->fxEscape($strType) . "' AND (FIND_IN_SET('" . intval($intEvenement) . "', eve_id))"; //" AND eve_frais = " . intval($intFrais); // MSIN-4009 $sqlFrais = "SELECT * FROM inscriptions_frais_autres WHERE fa_actif = 1 AND fa_type = '" . $objDatabase->fxEscape($strType) . "' AND eve_frais = " . intval($intFrais); $tabFrais = $objDatabase->fxGetRow($sqlFrais); if (fxcount($tabFrais) < 1) { $sqlFrais = "SELECT * FROM inscriptions_frais_autres WHERE fa_actif = 1 AND fa_type = '" . $objDatabase->fxEscape($strType) . "' AND eve_id = " . intval($intEvenement); $tabFrais = $objDatabase->fxGetRow($sqlFrais); } } else { $tabFrais['fa_montant'] = 0; } return $tabFrais; } function fxGetFactures($pec_id) { global $objDatabase; $sqlFactures = "SELECT DISTINCT no_panier, no_commande FROM resultats_epreuves_commandees WHERE pec_id_original = " . intval($pec_id) . " UNION SELECT DISTINCT no_panier, no_commande FROM resultats_produits_new WHERE pec_id = " . intval($pec_id) . " UNION SELECT a.no_panier, a.no_commande FROM inscriptions_panier_acheteurs a, inscriptions_panier_statuts s, inscriptions_panier_montants_dus m WHERE s.sta_id = a.sta_id AND a.sta_id = 3 AND m.no_panier = a.no_panier AND m.pec_id = " . intval($pec_id) . " ORDER BY no_commande"; $arrFactures = $objDatabase->fxGetResults($sqlFactures); return $arrFactures; } function fxregles_niveau_updateall($mem_eve_id, $bd = 'resultats_participants') { global $objDatabase; $sqlparticipant = "SELECT * FROM " . $bd . " WHERE eve_id=" . $mem_eve_id; $arrparticipant = $objDatabase->fxGetResults($sqlparticipant); if ($arrparticipant != null) { foreach ($arrparticipant as $key => $value) { fxregles_niveau_update($value['par_id'], $bd, 'par_id'); fxUpdateCategorieQuestion($value['par_id'], $bd, 'par_id'); } } } function fxregles_niveau_update($mem_id, $bd, $id) { global $objDatabase; $sqlparticipant = "SELECT * FROM " . $bd . " WHERE " . $id . "=" . $mem_id; $arrparticipant = $objDatabase->fxGetRow($sqlparticipant); if ($arrparticipant) { $mem_eve_id = $arrparticipant['eve_id']; $mem_epr_id = $arrparticipant['epr_id']; $mem_data = $arrparticipant; $mem_resul = fxregles_niveau($mem_eve_id, $mem_epr_id, $mem_data); $par_categorie_1_long_fr = $mem_resul[1]['fr']['long'] . " " . $mem_resul[2]['fr']['long']; $par_categorie_1_long_en = $mem_resul[1]['en']['long'] . " " . $mem_resul[2]['en']['long']; $par_categorie_1_court_fr = $mem_resul[1]['fr']['cour'] . $mem_resul[2]['fr']['cour']; $par_categorie_1_court_en = $mem_resul[1]['en']['cour'] . $mem_resul[2]['en']['cour']; $sqlparticipant = "update " . $bd . " set par_categorie_1_long_fr='" . $par_categorie_1_long_fr . "',par_categorie_1_long_en='" . $par_categorie_1_long_en . "',par_categorie_1_court_fr='" . $par_categorie_1_court_fr . "',par_categorie_1_court_en='" . $par_categorie_1_court_en . "' WHERE " . $id . "=" . $mem_id; $qryUpdate = $objDatabase->fxQuery($sqlparticipant); } } function fxUpdateCategorieQuestion($intId, $strBdd, $strKey) { global $objDatabase; $sqlparticipant = "SELECT pec_id, eve_id FROM " . $strBdd . " WHERE " . $intId . " = " . $strKey; $arrParticipants = $objDatabase->fxGetRow($sqlparticipant); if ($arrParticipants != null) { $arrQuestion = fxGetCategorieQuestion($arrParticipants['eve_id'], $arrParticipants['pec_id']); if ($arrQuestion != false) { $par_categorie_1_long_fr = $par_categorie_1_court_fr = $arrQuestion['que_choix_fr']; $par_categorie_1_long_en = $par_categorie_1_court_en = $arrQuestion['que_choix_en']; $sqlparticipant = "update " . $strBdd . " set par_categorie_1_long_fr='" . $par_categorie_1_long_fr . "',par_categorie_1_long_en='" . $par_categorie_1_long_en . "',par_categorie_1_court_fr='" . $par_categorie_1_court_fr . "',par_categorie_1_court_en='" . $par_categorie_1_court_en . "' WHERE " . $strKey . " = " . $intId; $qryUpdate = $objDatabase->fxQuery($sqlparticipant); } } } function fxGetCategorieQuestion($intEvenement, $intPecId) { global $objDatabase; $sqlparticipant = "SELECT que_id FROM inscriptions_panier_questions WHERE que_validation = 'categorie' AND pec_id = " . intval($intPecId); $intQuestion = $objDatabase->fxGetVar($sqlparticipant); if ($intQuestion != null) { $sqlparticipant = "SELECT * FROM resultats_questions WHERE que_id = " . intval($intQuestion) . " AND pec_id = " . intval($intPecId); $arrparticipant = $objDatabase->fxGetRow($sqlparticipant); if ($arrparticipant != null) { return $arrparticipant; } else { return false; } } else { return false; } } function fxregles_niveau($mem_eve_id, $mem_epr_id, $mem_data) { global $objDatabase; // $traduction = array // ( // "f"=> array("fr"=>array("Femme","F"),"en"=>array("Female","F")) , // "h"=> array("fr"=>array("Homme","H"),"en"=>array("Male","M")) // ); // print_r($traduction); // echo(json_encode($traduction)); // exit; $mem_niv = array(); $mem_tab_lang = array("fr", "en"); $mem_niv[1]['fr']['long'] = ''; $mem_niv[1]['fr']['cour'] = ''; $mem_niv[1]['en']['long'] = ''; $mem_niv[1]['en']['cour'] = ''; $mem_niv[2]['fr']['long'] = ''; $mem_niv[2]['fr']['cour'] = ''; $mem_niv[2]['en']['long'] = ''; $mem_niv[2]['en']['cour'] = ''; $sqlRegles = "SELECT * FROM regles_niveau WHERE eve_id=" . $mem_eve_id . " and epr_id=" . $mem_epr_id . " ORDER BY reg_niv,reg_trie"; $arrRegles = $objDatabase->fxGetResults($sqlRegles); $mem_niv_encour = 1; if ($arrRegles != null) { foreach ($arrRegles as $key => $value) { switch ($value['reg_type']) { case 'champ': $mem_result_temp = $mem_data[$value['reg_param1']]; $mem_traduction = json_decode($value['reg_traduction'], true); foreach ($mem_tab_lang as $langue) { $mem_niv[$value['reg_niv']][$langue]['long'] = $mem_traduction[$mem_result_temp][$langue][0]; $mem_niv[$value['reg_niv']][$langue]['cour'] = $mem_traduction[$mem_result_temp][$langue][1]; } break; case 'champet_age': $mem_condition1 = str_replace('reg_param2', $mem_data[$value['reg_param2']], $value['reg_param1']); $mem_condition2 = "'" . $mem_data[$value['reg_param3']] . "'=='" . $value['reg_param4'] . "'"; $mem_condition = 'return ' . $mem_condition1 . ' && ' . $mem_condition2 . ';'; // echo($mem_condition.'
'); if (eval($mem_condition)) { foreach ($mem_tab_lang as $langue) { $mem_niv[$value['reg_niv']][$langue]['long'] = $value['reg_nom_' . $langue]; $mem_niv[$value['reg_niv']][$langue]['cour'] = $value['reg_nom_' . $langue]; } } break; } } } return ($mem_niv); } function fxregles_copie($mem_eve_id_old, $mem_epr_id_old, $mem_eve_id_new, $mem_epr_id_new) { global $objDatabase; $sqlRegles = "SELECT * FROM regles_niveau WHERE eve_id=" . $mem_eve_id_old . " and epr_id=" . $mem_epr_id_old; $arrRegles = $objDatabase->fxGetResults($sqlRegles); foreach ($arrRegles as $keyrec => $original_record) { $sqlInsert = "INSERT INTO regles_niveau set eve_id=0"; $qryInsert = $objDatabase->fxQuery($sqlInsert); $mem_last = $objDatabase->fxGetLastId(); $query = "UPDATE regles_niveau SET eve_id=" . $mem_eve_id_new . ",epr_id=" . $mem_epr_id_new . ","; foreach ($original_record as $key => $value) { if ($key != 'reg_id' && $key != 'eve_id' & $key != 'epr_id') { $query .= '`' . $key . '` = "' . str_replace('"', '\"', $value) . '", '; } } $query = substr($query, 0, strlen($query) - 2); # lop off the extra trailing comma $query .= " WHERE reg_id= " . $mem_last; $qryInsert = $objDatabase->fxQuery($query); } } function fxCheckCreditCard($arrData) { if ($arrData['ccnumber'] == '4528038032834793' && $arrData['ccmonth'] == '03' && $arrData['ccyear'] == '2025' && $arrData['cvv'] == '123') { return true; } else { return false; } } // trouve la valeur d'une variable de la bdd function fxGetVariable($strVarNom) { global $objDatabase; $sqlVariable = "SELECT var_valeur FROM variables WHERE var_nom = '" . $objDatabase->fxEscape($strVarNom) . "'"; $strVarValeur = $objDatabase->fxGetVar($sqlVariable); return $strVarValeur; } /** * Interrupteur site : promoteur legacy (com_eve_promoteur / fxIsPromoteur) actif ? * Defaut : oui (1). Super admin : bouton dans inc_droite (variables.promoteur_legacy_actif). */ function fxPromoteurLegacySiteEnabled() { static $blnEnabled = null; if ($blnEnabled !== null) { return $blnEnabled; } global $objDatabase; if (!isset($objDatabase)) { $blnEnabled = true; return $blnEnabled; } $strVal = fxGetVariable('promoteur_legacy_actif'); $blnEnabled = ($strVal === null || $strVal === '' || intval($strVal) === 1); return $blnEnabled; } function fxGetMailHeader($blnTransaction = false, $strLangue = 'fr') { if ($blnTransaction) { $strHTML = ' %nom_evenement%

%nom_evenement%

'; } else { $strHTML = ' %client% '; } return $strHTML; } function fxGetMailBody($blnTransaction = false, $blnTransactionAutre = false, $blnAttachment = false, $blnWewbVersion = false, $strLangue = 'fr', $intGratuit = 0) { if ($blnTransaction && !$blnTransactionAutre) { $strHTML = ' '; if ($blnAttachment) { $strHTML .= ' '; } $strHTML .= ' '; if (!$blnWewbVersion) { $strHTML .= ' '; } $strHTML .= '

%subject%

%message_etat%

'; if (intval($intGratuit) == 0) { if ($strLangue == 'fr') { $strHTML .= '

La charge de cette transaction sera portée à votre relevé de carte de crédit sous le nom de : INSCRIP MS1.

Voici les renseignements de la commande effectuée :

'; } else { $strHTML .= '

This transaction will appear on your credit card statement under the business name of: INSCRIP MS1.

Here are the details about your order :

'; } } else { if ($strLangue == 'fr') { $strHTML .= '

Voici les renseignements de la commande effectuée :

'; } else { $strHTML .= '

Here are the details about your order :

'; } } $strHTML .= ' %details%
%trousse%
%attachment_label%
%termes%
%web_version_label%
'; } else { $strHTML = ' '; if ($blnAttachment) { $strHTML .= ' '; } $strHTML .= '

%subject%

%message%

%attachment_label%
'; } return $strHTML; } function fxGetMailFooter($blnTransaction = false, $blnWebVersion = false, $strLangue = 'fr') { $strHTML = ''; if ($strLangue == 'fr') { if (!$blnWebVersion) { $strHTML .= ' Le présent courriel a été envoyé à l’adresse: %to_mail%

'; } if ($blnTransaction) { $strHTML .= ' Si vous avez des questions sur l\'événement ou sur cette transaction, contactez l\'organisateur.

'; } $strHTML .= ' Si vous avez des problèmes techniques, contactez-nous. Ne pas répondre à ce courriel.

Pour vous assurer de recevoir les messages dans votre boîte de réception, veuillez ajouter confirmation@ms1timing.com à votre liste d\'expéditeurs autorisés ou à votre carnet d\'adresses.

© MS-1 Timing Inc, %year%. Tous droits réservés.
Saint-Sauveur, Québec, J0R 1R1
514-360-1610
MS1timing.com          MS1Inscription.com '; if (!$blnWebVersion) { $strHTML .= '

Ce message a été envoyé le %date% @ %time% '; } } else { if (!$blnWebVersion) { $strHTML .= ' This email has been sent to: %to_mail%

'; } if ($blnTransaction) { $strHTML .= ' If you have questions about the event or this transaction, contact the organizer.

'; } $strHTML .= ' If you have technical problem, contact us. Do not reply to this email.

To ensure that you receive messages in your inbox, please add confirmation@ms1timing.com to your list of allowed senders or your address book.

© MS-1 Timing Inc, %year%. All rights reserved.
Saint-Sauveur, Québec, J0R 1R1
514-360-1610
MS1timing.com          MS1Inscription.com '; if (!$blnWebVersion) { $strHTML .= '

This message was sent on %date% @ %time% '; } } return $strHTML; } function fxGetMailFormat($blnTransaction = false, $blnTransactionAutre = false, $blnAttachment = false, $blnWebVersion = false, $strLangue = 'fr', $intGratuit = 0) { global $vClient; $strHeader = fxGetMailHeader($blnTransaction, $strLangue); $strBody = fxGetMailBody($blnTransaction, $blnTransactionAutre, $blnAttachment, $blnWebVersion, $strLangue, $intGratuit); $strFooter = fxGetMailFooter($blnTransaction, $blnWebVersion, $strLangue); if (file_exists('../mail.html')) { $strHTML = file_get_contents('../mail.html'); } else { $strHTML = file_get_contents('mail.html'); } $strHTML = str_replace('%header%', $strHeader, $strHTML); $strHTML = str_replace('%body%', $strBody, $strHTML); $strHTML = str_replace('%footer%', $strFooter, $strHTML); $strHTML = str_replace('%lang%', $strLangue, $strHTML); $strHTML = str_replace('%client%', $vClient, $strHTML); $strHTML = str_replace('%date%', fxShowDate(fxGetDate(), $strLangue), $strHTML); $strHTML = str_replace('%time%', fxShowTime(fxGetTime(), 1, $strLangue), $strHTML); $strHTML = str_replace('%year%', date('Y'), $strHTML); return $strHTML; } function fxShowListeEvenements($arrEvenements, $strLangue) { global $vDomaine; $strHTML = $strNoticeHTML = ''; if ($arrEvenements != null) { if ($strLangue == 'fr') { $strLabel = "S'inscrire"; $strNoticeLabelInProgress = "En cours"; $strNoticeLabelToCome = "À venir"; $strNoticeLabelOver = "Terminé"; $strLabelMembership = "Adhérer"; $strNoticeLabelMembership = "Adhésion"; $strLangueUrl = ''; } else { $strLabel = "Register"; $strNoticeLabelInProgress = "In progress"; $strNoticeLabelToCome = "To come"; $strNoticeLabelOver = "Over"; $strLabelMembership = "Subscribe"; $strNoticeLabelMembership = "Membership"; $strLangueUrl = '/' . $strLangue; } $strHTML .= '
'; foreach ($arrEvenements as $intEvenement => $arrData) { if ($strLangue == 'fr') { $strLabel = "S'inscrire"; } else { $strLabel = "Register"; } if (intval($arrData['te_id']) == 13) { $strLabel = $strLabelMembership; $strNoticeHTML = '
' . $strNoticeLabelMembership . '
'; } else { if ($arrData['eve_date_fin'] >= fxGetDate() && $arrData['eve_date_debut'] <= fxGetDate()) { // si l'événement est en congé, afficher une notice $strNoticeHTML = '
' . $strNoticeLabelInProgress . '
'; } elseif ($arrData['eve_date_debut'] >= fxGetDate()) { // si l'événement est à venir, afficher une notice $strNoticeHTML = '
' . $strNoticeLabelToCome . '
'; } elseif ($arrData['eve_date_fin'] < fxGetDate()) { // si l'événement est terminé, afficher une notice $strNoticeHTML = '
' . $strNoticeLabelOver . '
'; } } $strHTML .= '
' . $strNoticeHTML . '
' . $arrData['te_nom_' . $strLangue] . '
' . fxUnescape($arrData['eve_nom_' . $strLangue]) . '
'; if (intval($arrData['te_id']) != 13) { $strHTML .= '

' . fxShowDateInterval($arrData['eve_date_debut'], $arrData['eve_date_fin'], $strLangue) . '

'; } $strHTML .= '
'; if ($arrData['eve_date_fin'] >= fxGetDate()) { $strHTML .= ' '; } $strHTML .= '
'; } $strHTML .= '
'; } return $strHTML; } function fxShowCartLink($intNbItems, $strEvenementURL, $strLangue) { global $vDomaine; $strHTML = ''; if ($intNbItems > 0 && trim($strEvenementURL) != '') { if ($strLangue == 'fr') { $strPage = 'panier'; } else { $strPage = 'cart'; } if ($intNbItems > 1) { $strItem = 'items'; } else { $strItem = 'item'; } $strHTML = '
  • ' . afficheTexte('gauche_panier_achat', 0, 1, 1) . ' (' . $intNbItems . ' ' . $strItem . ')
  • '; } return $strHTML; } // fonction qui affiche le HTML de la pagination // param: le url de la page, nb total de records, nb par page, page courante function fxGetPagination($strUrl, $intTotal, $intNb, $intPage) { $strRetour = ''; if ($intTotal > $intNb) { // déterminer le nb de pages totales, le no de page précédente et suivante $intNbPages = ceil($intTotal / $intNb); $intMidRange = 7; $intPrev = $intPage - 1; $intNext = $intPage + 1; $tabRange = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); if ($intNbPages > 10) { $intStartRange = $intPage - floor($intMidRange / 2); $intEndRange = $intPage + floor($intMidRange / 2); if ($intStartRange <= 0) { $intEndRange += abs($intStartRange) + 1; $intStartRange = 1; } if ($intEndRange > $intNbPages) { $intStartRange -= $intEndRange - $intNbPages; $intEndRange = $intNbPages; } $tabRange = range($intStartRange, $intEndRange); } $strRetour .= ' '; } return $strRetour; } function fxUpdateLiensInternes($strOutput) { global $vDomaine; $objDoc = new DOMDocument(); $objDoc->loadHTML($strOutput); // pour les images $arrSearchedTags = $objDoc->getElementsByTagName('img'); foreach ($arrSearchedTags as $arrTag) { $old_src = $arrTag->getAttribute('src'); if (substr($old_src, 0, 4) != "http") { $new_src_url = $vDomaine . '/' . $old_src; $arrTag->setAttribute('src', $new_src_url); } } // pour les llens $arrSearchedTags = $objDoc->getElementsByTagName('a'); foreach ($arrSearchedTags as $arrTag) { $old_href = $arrTag->getAttribute('href'); if (substr($old_href, 0, 4) != "http" && substr($old_href, 0, 7) != "mailto:") { $new_href_url = $vDomaine . '/' . $old_href; $arrTag->setAttribute('href', $new_href_url); } } $strOutput = $objDoc->saveHTML(); return $strOutput; } function fxShowListeEvenementsContact($arrEvenements, $strLangue) { $strHTML = ''; if ($arrEvenements != null) { if ($strLangue == 'fr') { $strLabelChoose = 'Choisissez un événement'; } else { $strLabelChoose = 'Choose event'; } $strHTML .= ' '; } return $strHTML; } function fxJiraIsAutreDemande($strLibelle) { $strNorm = mb_strtolower(trim($strLibelle)); return ($strNorm === 'autre' || $strNorm === 'autres' || strpos($strNorm, 'autre') !== false); } function fxJiraMapCategorieInterne($strLibelle) { if (fxJiraIsAutreDemande($strLibelle)) { return ''; } $strNorm = mb_strtolower(trim($strLibelle)); if (strpos($strNorm, 'organisateur') !== false) { return 'Vente'; } if (strpos($strNorm, 'participant') !== false && (strpos($strNorm, 'course') !== false || strpos($strNorm, 'épreuve') !== false || strpos($strNorm, 'epreuve') !== false)) { return 'Questions Résultats course'; } return ''; } function fxShowFormcontactjira($strLangue) { global $objDatabase; $mem_nom=""; $mem_email=""; $mem_nom_read=" "; $mem_email_read=" "; if (isset($_SESSION['com_id'])){ $mem_nom=$_SESSION['com_info']['com_prenom']." ".$_SESSION['com_info']['com_nom']; $mem_email=$_SESSION['com_info']['com_courriel']; $mem_nom_read="readonly"; $mem_email_read="readonly"; } ?>
    name="txt_nom" maxlength="80" value="" autofocus required>
    name="txt_courriel_Display" value="" > name="txt_courriel" value="" >
    fxGetResults($sqlCol); // print_r($tabCol); ?>
    Logo - ' . $arrEvenement['general']['eve_nom_' . $strLangue] . '
    ' . $arrEvenement['general']['eve_contact_footer_' . $strLangue] . '
    '; } } $tabRetour['details'] = $strHTML; return $tabRetour; } if ((isset($blnNoMaintenance) && !$blnNoMaintenance) || !isset($_SESSION['usa_id'])) { include_once("inc_maintenance.php"); } function fxShowMoney($value, $lang) { if ($lang == 'fr') { $value = number_format($value, 2, ',', ' ') . ' $'; } else { $value = '$ ' . number_format($value, 2, '.', ','); } return $value; } function print_rsl($arr){ ?>
        
    
    "); }