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)
{
$_SESSION['pixcel'][] = $memarray;
}
function fxcount($memarray)
{
$memreturn=0;
if(is_array($memarray))
$memreturn=count($memarray);
return $memreturn;
}
// 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 == "")
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);
$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;
}
// 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); // $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); } 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'"; } ?>
";
$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)
{
global $objDatabase;
$sql = "select * from inscriptions_comptes where FIND_IN_SET('" . intval($intEveId) . "',com_eve_promoteur) AND com_id = " . intval($intComId);
$tab = $objDatabase->fxGetResults($sql);
if ($tab != null)
$return = true;
else
$return = false;
return $return;
}
// 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.'
%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% | |
|
|
| %termes% | |
|
%subject%%message% |
|
|
' . fxShowDateInterval($arrData['eve_date_debut'], $arrData['eve_date_fin'], $strLangue) . '
'; } $strHTML .= '
");
}