2635 lines
107 KiB
PHP
2635 lines
107 KiB
PHP
<?php
|
||
define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/..') . '/');
|
||
// MSIN-CON-259
|
||
//ini_set('session.gc_maxlifetime', 3600);
|
||
|
||
// initialiser la variable $binEnvironementDev en utiliant le nom de domaine
|
||
include_once APPLICATION_PATH . 'php/inc_fonctions_sl.php';
|
||
include_once APPLICATION_PATH . 'php/inc_fx_doc.php';
|
||
include_once APPLICATION_PATH . 'php/inc_settings.php';
|
||
include_once APPLICATION_PATH . 'php/inc_mysql.php';
|
||
include_once APPLICATION_PATH . 'php/inc_dates.php';
|
||
include_once APPLICATION_PATH . 'php/inc_mail.php';
|
||
include_once APPLICATION_PATH . 'php/inc_fx_memberships.php';
|
||
include_once APPLICATION_PATH . 'php/inc_fx_liste_attente.php';// inclure les fonctions des abonemennts
|
||
include_once APPLICATION_PATH . 'php/recaptcha.class.php';
|
||
|
||
if (isset($_SESSION['affiche_pas_connexion']))
|
||
unset($_SESSION['affiche_pas_connexion']);
|
||
|
||
global $arrConDatabaseMain,$arrConDatabaseProd,$arrConDatabasePreProd;
|
||
|
||
$objDatabase = new clsMysql($arrConDatabaseMain);
|
||
$objDatabaseProd= new clsMysql($arrConDatabaseProd);
|
||
$objDatabasePreProd= new clsMysql($arrConDatabasePreProd);
|
||
|
||
//MSIN-3999
|
||
if (isset($_GET['preprod'])) {
|
||
$preprod = $_GET['preprod'];
|
||
|
||
|
||
if ($preprod == 1) {
|
||
$prefix = "preprod.";
|
||
//if (strpos("zzz".$_SERVER['HTTP_HOST'], $prefix) != 0) {
|
||
//if (strpos($_SERVER['HTTP_HOST'], $prefix) === false) {
|
||
// Ajoutez le préfixe à l'URL actuelle
|
||
|
||
|
||
$newUrl = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
||
//$newUrl = explode('?', $newUrl)[0];
|
||
// echo($_SERVER['HTTP_HOST']);
|
||
// echo('<br>1<br>');
|
||
// 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('<br>2<br>');
|
||
$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:<br><br>" . $data['txt_message'] . "<br><br><br>De: " . $data['txt_nom'] . " <" . $data['txt_courriel'] . "><br>";
|
||
$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("<br />", "<br>", "<br/>", "</p>");
|
||
$strTexte = str_ireplace($strBreaks, "\r\n", $strTexte);
|
||
$strTexte = str_ireplace("<p>", "", $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') {
|
||
?>
|
||
<!--<a href="#div_waiver" id="link_waiver" class="fancybox"-->
|
||
<!-- title="--><?php //afficheTexte('terme_waiver_titre')?><!--">--><?php //echo "Waiver" ?><!--</a>-->
|
||
<!-- <br/>-->
|
||
|
||
<input type="checkbox" class="chk_waiver_invite" disabled>
|
||
<?php afficheTexte('invite_must_clear_waiver'); ?>
|
||
<div id="dialog-confirm-waiver" title="24 Hours of Adrenalin - Participant Waiver" style="display: none;">
|
||
<p><span class="ui-icon ui-icon-alert" style="float:top; margin:0 7px 20px 0;"></span></p>
|
||
<?php echo $str_waiver_text ?>
|
||
</div>
|
||
<button title="<?php echo afficheTexte('btn_view_waiver', 0) ?>" type="button"
|
||
data-com_id="<?php echo $int_com_id ?>" id="btn_view_invite_waiver"
|
||
value="<?php echo afficheTexte('btn_view_waiver', 0) ?>"
|
||
style="cursor: pointer"><?php echo afficheTexte('btn_view_waiver', 0) ?></button>
|
||
<?php
|
||
} else {
|
||
if ($tab_data['par_age'] >= 18) {
|
||
?>
|
||
<div id="dialog-confirm-waiver" title="24 Hours of Adrenalin - Participant Waiver" style="display: none;">
|
||
<p><span class="ui-icon ui-icon-alert" style="float:top; margin:0 7px 20px 0;"></span></p>
|
||
<?php echo $str_waiver_text ?>
|
||
</div>
|
||
<!-- <input title="--><?php //echo afficheTexte('btn_view_waiver', 0)?><!--" type="button"-->
|
||
<!-- data-com_id="--><?php //echo $int_com_id?><!--" data-par_id="--><?php //echo $tab_data['par_id']?><!--"-->
|
||
<!-- id="btn_view_waiver_--><?php //echo $tab_data['par_id']?><!--"-->
|
||
<!-- value="--><?php //echo afficheTexte('btn_view_waiver', 0)?><!--" style="cursor: pointer"/>-->
|
||
<button title="<?php echo afficheTexte('btn_view_waiver', 0) ?>" type="button"
|
||
data-com_id="<?php echo $int_com_id ?>" data-par_id="<?php echo $tab_data['par_id'] ?>"
|
||
id="btn_view_waiver_<?php echo $tab_data['par_id'] ?>"
|
||
value="<?php echo afficheTexte('btn_view_waiver', 0) ?>"
|
||
style="cursor: pointer"><?php echo afficheTexte('btn_view_waiver', 0) ?></button>
|
||
|
||
<?php } else {
|
||
?>
|
||
<div id="minor_part">
|
||
<?php
|
||
afficheTexte('dash_participant_is_minor'); ?>
|
||
(<a href="<?php echo $vDomaine . $vRepertoireFichiers; ?>/pdf/waivers/<?php echo $str_waiver_pdf ?>"
|
||
id="link_waiver_pdf" title="<?php afficheTexte('terme_waiver_titre') ?>"
|
||
target="_blank"><?php afficheTexte('dash_print_waiver_pdf') ?></a>)
|
||
<!-- (<a href="-->
|
||
<?php //echo $vDomaine ?><!--/pdf/waivers/canmore_participant_waiver_2015_108.pdf" id="link_waiver_pdf" title="-->
|
||
<?php //afficheTexte('terme_waiver_titre')?><!--">-->
|
||
<?php //afficheTexte('dash_print_waiver_pdf') ?><!--</a>)-->
|
||
<div id="div_waiver_pdf" style="display:none;width:300px;">
|
||
<?php
|
||
echo $str_waiver_text;
|
||
?>
|
||
</div>
|
||
<!-- <a href="">Print waiver & have legal tutor sign and mail it.</a>-->
|
||
</div>
|
||
<?php
|
||
}
|
||
}
|
||
?>
|
||
|
||
<input type="hidden" id="hidden_waiver_text" value="<?php echo fxUnescape($str_waiver_text); ?>"/>
|
||
<script type="text/javascript">
|
||
$('[id^="btn_view_waiver_"]').click(function () {
|
||
par_id = $(this).data('par_id');
|
||
com_id = $(this).data('com_id');
|
||
$("#dialog-confirm-waiver").dialog({
|
||
// resizable: false,
|
||
height: 500,
|
||
width: 800,
|
||
modal: true,
|
||
buttons: {
|
||
"Read and accept": function () {
|
||
// document.location.href='http://www.ms1inscriptiondev.progiweb.co/clear_waiver.php';
|
||
document.location.href = "<?php echo $vDomaine;?>/clear_waiver.php?com_id=" + com_id + "&par_id=" + par_id;
|
||
$(this).dialog("close");
|
||
|
||
},
|
||
Cancel: function () {
|
||
$(this).dialog("close");
|
||
}
|
||
}
|
||
});
|
||
});
|
||
// MSIN-963
|
||
$("#btn_view_invite_waiver").click(function () {
|
||
$("#dialog-confirm-waiver").dialog({
|
||
// resizable: false,
|
||
height: 500,
|
||
width: 800,
|
||
modal: true,
|
||
buttons: {
|
||
"Read and accept": function () {
|
||
$(".chk_waiver_invite").prop("checked", true);
|
||
$("#btn_accept").css("display", "inline");
|
||
$("#inv_com_tshirt").css("display", "inline");
|
||
$(this).dialog("close");
|
||
|
||
},
|
||
Cancel: function () {
|
||
$(this).dialog("close");
|
||
}
|
||
}
|
||
});
|
||
});
|
||
// MSIN-896
|
||
$(".fancybox").fancybox({
|
||
'width': 'auto',
|
||
'height': 'auto',
|
||
'autoSize': false,
|
||
openEffect: 'none',
|
||
closeEffect: 'none'
|
||
// afterLoad : function() {
|
||
// this.content = this.content.html();
|
||
// }
|
||
// afterShow: function(){
|
||
// var win=null;
|
||
// var content = $('.fancybox-inner');
|
||
// $('.fancybox-wrap')
|
||
// // append print button
|
||
// .append('<div id="fancy_print"></div>')
|
||
// // use .on() in its delegated form to bind a click to the print button event for future elements
|
||
// .on("click", "#fancy_print", function(){
|
||
// win = window.open("width=200,height=200");
|
||
// self.focus();
|
||
// win.document.open();
|
||
// win.document.write('<'+'html'+'><'+'head'+'><'+'style'+'>');
|
||
// win.document.write('body, td { color: black; font-family: Verdana; font-size: 10pt;}');
|
||
// win.document.write('<'+'/'+'style'+'><'+'/'+'head'+'><'+'body'+'>');
|
||
// win.document.write(content.html());
|
||
// win.document.write('<'+'/'+'body'+'><'+'/'+'html'+'>');
|
||
// win.document.close();
|
||
// win.print();
|
||
// win.close();
|
||
// }); // on
|
||
// } // afterShow
|
||
});
|
||
</script>
|
||
<?php
|
||
}
|
||
|
||
function fxShowInviteForm($int_pec_id, $int_epr_id, $int_eve_id)
|
||
{
|
||
global $objDatabase, $vDomaine;
|
||
|
||
// get eve_label_url
|
||
$sqlEveURL = "SELECT eve_label_url FROM inscriptions_evenements WHERE eve_id = " . intval($int_eve_id);
|
||
$strEveURL = $objDatabase->fxGetVar($sqlEveURL);
|
||
|
||
$strButtonDisabled = '';
|
||
if ($GLOBALS['strUserPermission'] == 'view') {
|
||
$strButtonDisabled = "disabled='disabled' style='padding: 3px; float: right; cursor: default'";
|
||
}
|
||
?>
|
||
<form action="<?php echo $vDomaine . "/" . $strEveURL . "/en/invite" ?>" method="post" id="frm_invite">
|
||
<input type="hidden" id="hidden_pec_id" name="hidden_pec_id" value="<?php echo $int_pec_id ?>">
|
||
<input type="hidden" id="hidden_epr_id" name="hidden_epr_id" value="<?php echo $int_epr_id ?>">
|
||
<!-- <input type="submit" class="button" id="btn_invite" --><?php //echo $strButtonDisabled
|
||
?><!-- value="Invite" style="padding: 3px; float: right; cursor: pointer"/>-->
|
||
<button type="submit" class="button" id="btn_invite" <?php echo $strButtonDisabled ?> value="Invite"
|
||
data-eve_code="<?php echo $strEveURL ?>" style="padding: 3px; float: right; cursor: pointer">Invite
|
||
</button>
|
||
</form>
|
||
<br/>
|
||
<?php
|
||
}
|
||
|
||
function fxGetOwner($epr_id, $pec_id_original)
|
||
{
|
||
global $objDatabase;
|
||
|
||
$qry = "select * from inscriptions_panier_acheteurs where no_panier = (select no_panier from resultats_epreuves_commandees where epr_id = " . intval($epr_id) . " AND pec_id_original = " . intval($pec_id_original) . ")";
|
||
$return = $objDatabase->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'] = "<img class='tooltip' src='images/captain.png' title='Captain' />";
|
||
$mem_return['rol_txt'] = afficheTexte('role_captain', 0);
|
||
break;
|
||
case 3:
|
||
$mem_return['rol_img'] = "<img class='tooltip' src='images/volunteer.png' title='Volunteer' />";
|
||
$mem_return['rol_txt'] = afficheTexte('role_volunteer', 0);
|
||
break;
|
||
case 4:
|
||
// echo "<img src='images/manager.png' /> Pit manager";
|
||
$mem_return['rol_img'] = "<img class='tooltip' src='images/manager.png' title='Pit manager' />";
|
||
$mem_return['rol_txt'] = afficheTexte('role_pitmanager', 0);
|
||
break;
|
||
default:
|
||
// echo "<img src='images/racer.png' /> Participant";
|
||
$mem_return['rol_img'] = "<img class='tooltip' src='images/racer.png' title='Participant' />";
|
||
$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.'<br>');
|
||
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;
|
||
}
|
||
|
||
function fxGetMailHeader($blnTransaction = false, $strLangue = 'fr')
|
||
{
|
||
if ($blnTransaction) {
|
||
$strHTML = '
|
||
<tr>
|
||
<td style="background-color: #ffffff; padding: 20px; text-align: right;">
|
||
<img src="%logo_evenement%" width="" height="" alt="%nom_evenement%" border="0" style="max-width: 680px; height: auto; background: #ffffff; font-family: sans-serif; font-size: 15px; line-height: 15px; color: #555555; float: right; display: block;" class="g-img">
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td style="background-color: #ffffff; padding: 20px; text-align: right;">
|
||
<h1 style="margin: 0 0 10px; font-size: 25px; line-height: 30px; color: #333333; font-weight: normal;">%nom_evenement%</h1>
|
||
</td>
|
||
</tr>
|
||
';
|
||
} else {
|
||
$strHTML = '
|
||
<tr>
|
||
<td style="background-color: #000000; padding: 20px; text-align: right;">
|
||
<img src="%logo%" width="" height="" alt="%client%" border="0" style="max-width: 680px; height: auto; background: #000000; font-family: sans-serif; font-size: 15px; line-height: 15px; color: #555555; margin: auto; display: block;" class="g-img">
|
||
</td>
|
||
</tr>
|
||
';
|
||
}
|
||
|
||
return $strHTML;
|
||
}
|
||
|
||
function fxGetMailBody($blnTransaction = false, $blnTransactionAutre = false, $blnAttachment = false, $blnWewbVersion = false, $strLangue = 'fr', $intGratuit = 0)
|
||
{
|
||
if ($blnTransaction && !$blnTransactionAutre) {
|
||
$strHTML = '
|
||
<table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
|
||
<tr>
|
||
<td style="padding: 20px; font-family: sans-serif; font-size: 15px; line-height: 20px; color: #555555;">
|
||
<h1 style="margin: 0 0 10px; font-size: 25px; line-height: 30px; color: #333333; font-weight: normal;">%subject%</h1>
|
||
<p style="margin: 0 0 10px;">%message_etat%</p>
|
||
';
|
||
|
||
if (intval($intGratuit) == 0) {
|
||
if ($strLangue == 'fr') {
|
||
$strHTML .= '
|
||
<p style="margin: 0 0 10px;">La charge de cette transaction sera portée à votre relevé de carte de crédit sous le nom de : INSCRIP MS1.</p>
|
||
<p style="margin: 0 0 10px;">Voici les renseignements de la commande effectuée :</p>
|
||
';
|
||
} else {
|
||
$strHTML .= '
|
||
<p style="margin: 0 0 10px;">This transaction will appear on your credit card statement under the business name of: INSCRIP MS1.</p>
|
||
<p style="margin: 0 0 10px;">Here are the details about your order :</p>
|
||
';
|
||
}
|
||
} else {
|
||
if ($strLangue == 'fr') {
|
||
$strHTML .= '
|
||
<p style="margin: 0 0 10px;">Voici les renseignements de la commande effectuée :</p>
|
||
';
|
||
} else {
|
||
$strHTML .= '
|
||
<p style="margin: 0 0 10px;">Here are the details about your order :</p>
|
||
';
|
||
}
|
||
}
|
||
|
||
$strHTML .= '
|
||
%details%
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td style="padding: 20px; font-family: sans-serif; font-size: 15px; line-height: 20px; color: #555555;">
|
||
%trousse%
|
||
</td>
|
||
</tr>
|
||
';
|
||
|
||
if ($blnAttachment) {
|
||
$strHTML .= '
|
||
<tr>
|
||
<td style="padding: 0 20px 20px;">
|
||
<table align="center" role="presentation" cellspacing="0" cellpadding="0" border="0" style="margin: auto;">
|
||
<tr>
|
||
<td class="button-td button-td-primary" style="border-radius: 4px; background: #222222;">
|
||
<a class="button-a button-a-primary" href="%attachment_url%" style="background: #222222; border: 1px solid #000000; font-family: sans-serif; font-size: 15px; line-height: 15px; text-decoration: none; padding: 13px 17px; color: #ffffff; display: block; border-radius: 4px;">%attachment_label%</a>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
';
|
||
}
|
||
|
||
$strHTML .= '
|
||
<tr>
|
||
<td style="padding: 20px; font-family: sans-serif; font-size: 15px; line-height: 20px; color: #555555;">
|
||
%termes%
|
||
</td>
|
||
</tr>
|
||
';
|
||
|
||
if (!$blnWewbVersion) {
|
||
$strHTML .= '
|
||
<tr>
|
||
<td style="padding: 0 20px 20px;">
|
||
<table align="center" role="presentation" cellspacing="0" cellpadding="0" border="0" style="margin: auto;">
|
||
<tr>
|
||
<td class="button-td button-td-primary" style="border-radius: 4px; background: #222222;">
|
||
<a class="button-a button-a-primary" href="%web_version_url%" style="background: #222222; border: 1px solid #000000; font-family: sans-serif; font-size: 15px; line-height: 15px; text-decoration: none; padding: 13px 17px; color: #ffffff; display: block; border-radius: 4px;">%web_version_label%</a>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
';
|
||
}
|
||
|
||
$strHTML .= '
|
||
</table>
|
||
';
|
||
} else {
|
||
$strHTML = '
|
||
<table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
|
||
<tr>
|
||
<td style="padding: 20px; font-family: sans-serif; font-size: 15px; line-height: 20px; color: #555555;">
|
||
<h1 style="margin: 0 0 10px; font-size: 25px; line-height: 30px; color: #333333; font-weight: normal;">%subject%</h1>
|
||
<p style="margin: 0 0 10px;">%message%</p>
|
||
</td>
|
||
</tr>
|
||
';
|
||
|
||
if ($blnAttachment) {
|
||
$strHTML .= '
|
||
<tr>
|
||
<td style="padding: 0 20px 20px;">
|
||
<table align="center" role="presentation" cellspacing="0" cellpadding="0" border="0" style="margin: auto;">
|
||
<tr>
|
||
<td class="button-td button-td-primary" style="border-radius: 4px; background: #222222;">
|
||
<a class="button-a button-a-primary" href="%attachment_url%" style="background: #222222; border: 1px solid #000000; font-family: sans-serif; font-size: 15px; line-height: 15px; text-decoration: none; padding: 13px 17px; color: #ffffff; display: block; border-radius: 4px;">%attachment_label%</a>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
';
|
||
}
|
||
|
||
$strHTML .= '
|
||
</table>
|
||
';
|
||
}
|
||
|
||
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%
|
||
<br><br>
|
||
';
|
||
}
|
||
|
||
if ($blnTransaction) {
|
||
$strHTML .= '
|
||
Si vous avez des questions sur l\'événement ou sur cette transaction, contactez l\'organisateur.
|
||
<br><br>
|
||
';
|
||
}
|
||
|
||
$strHTML .= '
|
||
Si vous avez des problèmes techniques, <a style="color: #f3954a; font-weight: bold; text-decoration: underline;" href="https://www.ms1timing.com/index.php?code=contact&lang=fr">contactez-nous</a>. Ne pas répondre à ce courriel.
|
||
<br><br>
|
||
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.
|
||
<br><br>
|
||
© MS-1 Timing Inc, %year%. Tous droits réservés.<br>
|
||
Saint-Sauveur, Québec, J0R 1R1<br>
|
||
514-360-1610<br>
|
||
<a style="color: #f3954a; font-weight: bold; text-decoration: underline;" href="https://www.ms1timing.com/" target="_blank">MS1timing.com</a> <a style="color: #f3954a; font-weight: bold; text-decoration: underline;" href="https://www.ms1inscription.com/" target="_blank">MS1Inscription.com</a>
|
||
';
|
||
|
||
if (!$blnWebVersion) {
|
||
$strHTML .= '
|
||
<br><br>
|
||
Ce message a été envoyé le %date% @ %time%
|
||
';
|
||
}
|
||
} else {
|
||
if (!$blnWebVersion) {
|
||
$strHTML .= '
|
||
This email has been sent to: %to_mail%
|
||
<br><br>
|
||
';
|
||
}
|
||
|
||
if ($blnTransaction) {
|
||
$strHTML .= '
|
||
If you have questions about the event or this transaction, contact the organizer.
|
||
<br><br>
|
||
';
|
||
}
|
||
|
||
$strHTML .= '
|
||
If you have technical problem, <a style="color: #f3954a; font-weight: bold; text-decoration: underline;" href="https://www.ms1timing.com/index.php?code=contact&lang=en">contact us</a>. Do not reply to this email.
|
||
<br><br>
|
||
To ensure that you receive messages in your inbox, please add confirmation@ms1timing.com to your list of allowed senders or your address book.
|
||
<br><br>
|
||
© MS-1 Timing Inc, %year%. All rights reserved.<br>
|
||
Saint-Sauveur, Québec, J0R 1R1<br>
|
||
514-360-1610<br>
|
||
<a style="color: #f3954a; font-weight: bold; text-decoration: underline;" href="https://www.ms1timing.com/" target="_blank">MS1timing.com</a> <a style="color: #f3954a; font-weight: bold; text-decoration: underline;" href="https://www.ms1inscription.com/" target="_blank">MS1Inscription.com</a>
|
||
';
|
||
|
||
if (!$blnWebVersion) {
|
||
$strHTML .= '
|
||
<br><br>
|
||
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 .= '<div class="row my-5 row-cols-1 row-cols-md-2 row-cols-lg-3 row-cols-xl-5">';
|
||
|
||
foreach ($arrEvenements as $intEvenement => $arrData) {
|
||
if ($strLangue == 'fr') {
|
||
$strLabel = "S'inscrire";
|
||
} else {
|
||
$strLabel = "Register";
|
||
}
|
||
|
||
if (intval($arrData['te_id']) == 13) {
|
||
$strLabel = $strLabelMembership;
|
||
$strNoticeHTML = '
|
||
<div class="card-header text-white bg-info">
|
||
' . $strNoticeLabelMembership . '
|
||
</div>
|
||
';
|
||
} else {
|
||
if ($arrData['eve_date_fin'] >= fxGetDate() && $arrData['eve_date_debut'] <= fxGetDate()) { // si l'événement est en congé, afficher une notice
|
||
$strNoticeHTML = '
|
||
<div class="card-header text-white bg-primary">
|
||
' . $strNoticeLabelInProgress . '
|
||
</div>
|
||
';
|
||
} elseif ($arrData['eve_date_debut'] >= fxGetDate()) { // si l'événement est à venir, afficher une notice
|
||
$strNoticeHTML = '
|
||
<div class="card-header text-white bg-success">
|
||
' . $strNoticeLabelToCome . '
|
||
</div>
|
||
';
|
||
} elseif ($arrData['eve_date_fin'] < fxGetDate()) { // si l'événement est terminé, afficher une notice
|
||
$strNoticeHTML = '
|
||
<div class="card-header text-white bg-danger">
|
||
' . $strNoticeLabelOver . '
|
||
</div>
|
||
';
|
||
}
|
||
}
|
||
|
||
$strHTML .= '
|
||
<div class="col mb-3">
|
||
<div class="card text-center h-100">
|
||
' . $strNoticeHTML . '
|
||
<div class="card-body">
|
||
<div class="card-text">
|
||
<img src="' . $vDomaine . '/images/' . $arrData['te_icone'] . '" class="img-fluid mb-3" alt="' . $arrData['te_nom_' . $strLangue] . '" style="max-height: 100px;">
|
||
</div>
|
||
<h5 class="card-title">' . fxUnescape($arrData['eve_nom_' . $strLangue]) . '</h5>
|
||
';
|
||
|
||
if (intval($arrData['te_id']) != 13) {
|
||
$strHTML .= '
|
||
<p class="card-text text-muted">' . fxShowDateInterval($arrData['eve_date_debut'], $arrData['eve_date_fin'], $strLangue) . '</p>
|
||
';
|
||
}
|
||
|
||
$strHTML .= '
|
||
</div>
|
||
';
|
||
|
||
if ($arrData['eve_date_fin'] >= fxGetDate()) {
|
||
$strHTML .= '
|
||
<div class="card-footer bg-transparent">
|
||
<a href="' . $vDomaine . '/' . fxUnescape($arrData['eve_label_url']) . $strLangueUrl . '" class="btn btn-primary rounded-pill px-4 stretched-link">' . $strLabel . '</a>
|
||
</div>
|
||
';
|
||
}
|
||
|
||
$strHTML .= '
|
||
</div>
|
||
</div>
|
||
';
|
||
}
|
||
|
||
$strHTML .= '</div>';
|
||
}
|
||
|
||
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 = '
|
||
<li class="list-inline-item">
|
||
<i class="fa fa-shopping-cart mr-1"></i> <a href="' . $vDomaine . '/' . $strPage . '/somaire/' . $strEvenementURL . '">' . afficheTexte('gauche_panier_achat', 0, 1, 1) . ' (' . $intNbItems . ' ' . $strItem . ')</a>
|
||
</li>
|
||
';
|
||
}
|
||
|
||
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 .= '
|
||
<nav aria-label="Page navigation">
|
||
<ul class="pagination pagination-lg justify-content-center">
|
||
';
|
||
if ($intPrev > 0) {
|
||
$strRetour .= '
|
||
<li class="page-item">
|
||
<a class="page-link" href="' . $strUrl . '&pg=' . $intPrev . '" aria-label="Previous">
|
||
<span aria-hidden="true">«</span>
|
||
</a>
|
||
</li>
|
||
';
|
||
}
|
||
|
||
for ($intCtr = 1; $intCtr <= $intNbPages; $intCtr++) {
|
||
if (isset($tabRange) && $tabRange[0] > 2 && $intCtr == $tabRange[0]) {
|
||
$strRetour .= '
|
||
<li class="disabled page-item">
|
||
<a class="page-link" href="#">...</a>
|
||
</li>
|
||
';
|
||
}
|
||
if ($intCtr == 1 || $intCtr == $intNbPages || in_array($intCtr, $tabRange)) {
|
||
$strActif = ($intCtr == $intPage) ? ' active' : '';
|
||
$strRetour .= '
|
||
<li class="page-item' . $strActif . '">
|
||
<a class="page-link" href="' . $strUrl . '&pg=' . $intCtr . '">' . $intCtr . '</a>
|
||
</li>
|
||
';
|
||
}
|
||
if ($intNbPages > 10) {
|
||
if (isset($tabRange) && $tabRange[$intMidRange - 1] < $intNbPages - 1 && $intCtr == $tabRange[$intMidRange - 1]) {
|
||
$strRetour .= '
|
||
<li class="disabled page-item">
|
||
<a class="page-link" href="#">...</a>
|
||
</li>
|
||
';
|
||
}
|
||
}
|
||
}
|
||
if ($intNext <= $intNbPages) {
|
||
$strRetour .= '
|
||
<li class="page-item">
|
||
<a class="page-link" href="' . $strUrl . '&pg=' . $intNext . '" aria-label="Suivant">
|
||
<span aria-hidden="true">»</span>
|
||
</a>
|
||
</li>
|
||
';
|
||
}
|
||
$strRetour .= '
|
||
</ul>
|
||
</nav>
|
||
';
|
||
}
|
||
|
||
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 .= '
|
||
<select class="form-control mb-3 rounded-0" id="sel_evenement_contact">
|
||
<option value="">>> ' . $strLabelChoose . '</option>
|
||
';
|
||
|
||
for ($intCtr = 1; $intCtr <= count($arrEvenements); $intCtr++) {
|
||
$strHTML .= '<option value="' . $arrEvenements[$intCtr]['eve_id'] . '">' . $arrEvenements[$intCtr]['eve_nom_' . $strLangue] . '</option>';
|
||
}
|
||
|
||
$strHTML .= '
|
||
</select>
|
||
<div class="bg-light border p-3 rounded" id="box_evenement_contact" style="display: none;"></div>
|
||
';
|
||
}
|
||
|
||
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";
|
||
}
|
||
|
||
?>
|
||
<form class="form-horizontal" id="frm_contact" name="frm_contact">
|
||
|
||
|
||
<fieldset>
|
||
<legend> <?php echo afficheTexte('jira_ecrire', 0, 1, 1); ?></legend>
|
||
<div class="form-group">
|
||
<label class="control-label col-sm-3" for="txt_nom"> <?php echo afficheTexte('jira_nom', 0, 1, 1); ?></label>
|
||
<div class="col-sm-8">
|
||
<input class="form-control b-straight" type="text" id="txt_nom" <?php echo($mem_nom_read);?> name="txt_nom" maxlength="80" value="<?php echo( $mem_nom);?>"
|
||
autofocus required>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="control-label col-sm-3" for="txt_courriel"> <?php echo afficheTexte('jira_email', 0, 1, 1); ?></label>
|
||
<div class="col-sm-8">
|
||
|
||
<?php if (isset($_SESSION['com_id'])){?>
|
||
<input class="form-control b-straight" type="email" id="txt_courriel_Display" <?php echo($mem_email_read);?> name="txt_courriel_Display" value=""
|
||
>
|
||
<input type="hidden" class="form-control b-straight" id="txt_courriel" <?php echo($mem_email_read);?> name="txt_courriel" value="<?php echo( $mem_email);?>"
|
||
>
|
||
|
||
<?php ?>
|
||
<script>
|
||
// Exemple d'adresse email
|
||
var email = "<?php echo( $mem_email);?>";
|
||
|
||
// Fonction pour masquer une partie de l'email
|
||
function masquerEmail(email) {
|
||
var partieVisible = email.split("@")[0].slice(0, 3); // Affiche les 3 premiers caractères
|
||
var domaine = email.split("@")[1]; // Conserve le domaine complet
|
||
return partieVisible + "****@" + domaine;
|
||
}
|
||
|
||
// Appliquer la fonction à l'input
|
||
document.getElementById("txt_courriel_Display").value = masquerEmail(email);
|
||
</script>
|
||
|
||
|
||
|
||
<?php }else{ ?>
|
||
<input class="form-control b-straight" type="email" id="txt_courriel" name="txt_courriel" value=""
|
||
maxlength="80" required>
|
||
|
||
<?php }?>
|
||
|
||
</div>
|
||
</div>
|
||
<?php
|
||
$strClef = 'type_de_demande';
|
||
$sqlCol = "SELECT * FROM info WHERE info_actif = 1 AND info_clef = '" . $strClef . "' AND info_langue = '" . $strLangue . "' ORDER BY info_trie";
|
||
$tabCol = $objDatabase->fxGetResults($sqlCol);
|
||
// print_r($tabCol);
|
||
|
||
|
||
?>
|
||
|
||
<div class="form-group">
|
||
<label for="typedemande"> <?php echo afficheTexte('jira_selection_demandetitre', 0, 1, 1); ?></label>
|
||
<select id="typedemande" name="typedemande" required>
|
||
<option value=""><?php echo afficheTexte('jira_selection_demandeoption', 0, 1, 1); ?></option>
|
||
|
||
<?php
|
||
foreach ($tabCol as $key => $value ){
|
||
?>
|
||
<?php
|
||
$strCategorieInterne = trim((string)($tabCol[$key]['info_option3'] ?? ''));
|
||
if ($strCategorieInterne === '') {
|
||
$strCategorieInterne = fxJiraMapCategorieInterne($tabCol[$key]['info_texte']);
|
||
}
|
||
?>
|
||
<option value="<?php echo($tabCol[$key]["info_option2"]); ?>" data-categorie="<?php echo htmlspecialchars($strCategorieInterne, ENT_QUOTES, 'UTF-8'); ?>"><?php echo($tabCol[$key]["info_texte"]); ?></option>
|
||
<?php
|
||
|
||
|
||
}
|
||
|
||
?>
|
||
|
||
</select>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="control-label col-sm-3" for="txt_nom"><?php echo afficheTexte('jira_sujet', 0, 1, 1); ?></label>
|
||
<div class="col-sm-8">
|
||
<input class="form-control b-straight" type="text" id="txt_sujet" name="txt_sujet" maxlength="80"
|
||
autofocus required>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="control-label col-sm-3" for="txt_message"><?php echo afficheTexte('jira_message', 0, 1, 1); ?></label>
|
||
<div class="col-sm-8">
|
||
<textarea class="form-control" id="txt_message" name="txt_message" cols="33" rows="10"
|
||
required></textarea>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
|
||
<div class="col-sm-offset-3 col-sm-8">
|
||
<div class="g-recaptcha" data-sitekey="6Le4I10UAAAAAMyr3O6CpO1ujRdUJlZ224-WW_8X"></div>
|
||
|
||
<button class="btn btn-primary b-straight send_jira" ><?php echo afficheTexte('jira_envoiyer', 0, 1, 1); ?></button>
|
||
</div>
|
||
</div>
|
||
</fieldset>
|
||
</form>
|
||
|
||
|
||
<?php
|
||
|
||
}
|
||
|
||
function fxShowDetailsEvenementContact($arrEvenement, $strLangue)
|
||
{
|
||
global $vDomaine, $vRepertoireFichiers;
|
||
$strHTML = '';
|
||
if (is_array($arrEvenement)) {
|
||
if ($arrEvenement != null) {
|
||
$strHTML .= '<a href="'.$arrEvenement["general"]["eve_siteweb"].'" target="_blank">
|
||
<img class="d-block img-fluid mb-2" src="' . $vDomaine . $vRepertoireFichiers . '/images/evenements/' . $arrEvenement['general']['eve_photo_' . $strLangue] . '" alt="Logo - ' . $arrEvenement['general']['eve_nom_' . $strLangue] . '">
|
||
</a><div>
|
||
' . $arrEvenement['general']['eve_contact_footer_' . $strLangue] . '
|
||
</div>
|
||
';
|
||
}
|
||
}
|
||
$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){
|
||
?>
|
||
<pre>
|
||
<?php
|
||
print_r($arr);
|
||
?>
|
||
</pre>
|
||
<?php
|
||
}
|
||
// php version 8
|
||
function fxcountpatch($table){
|
||
|
||
$sortie= (is_array($table) ? count($table) : 0);
|
||
return $sortie;
|
||
}
|
||
function fx_bouton_prod_test(){
|
||
|
||
if($_SESSION['com_info']['com_preprod']==1){
|
||
|
||
$prefix = "preprod.";
|
||
|
||
if (strpos("zzz".$_SERVER['HTTP_HOST'], $prefix) != 0) {
|
||
|
||
//if(isset($_SESSION['preprod'])){
|
||
?>
|
||
<a class="btn btn-primary rounded-pill mr-2 my-2" onclick="preprod(0)" role="button">
|
||
<?php afficheTexte('siteenligne',1,1,1); ?>
|
||
</a>
|
||
<?php
|
||
|
||
}else{
|
||
?>
|
||
<a class="btn btn-primary rounded-pill mr-2 my-2" onclick="preprod(1)" role="button">
|
||
<?php afficheTexte('sitedeTEST',1,1,1); ?>
|
||
</a>
|
||
<?php
|
||
|
||
|
||
}
|
||
|
||
}
|
||
}
|
||
|
||
function echosl($string)
|
||
{
|
||
|
||
echo($string);
|
||
echo("<br>");
|
||
}
|