| Current Path : /home/happyrenas/myreco.online/old/ |
Linux webd005.cluster105.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 |
| Current File : /home/happyrenas/myreco.online/old/fiche_carte.php |
<?
include("configuration.php");
include("includes/fonctions.php");
$page="fiche.php";
// Échapper le token de la requête
$token = $db->escape($_REQUEST['token']);
if (!$token) exit;
// Récupération des informations de la fiche hébergement
$myquery = "SELECT * FROM heb WHERE token = '$token'";
$fiche = $db->get_row($myquery);
if (!$fiche || !$fiche->id) exit;
// Redirection si hébergement en version "lite"
if ($fiche->name == 'lite') {
header("Refresh:0; url=fiche_lite.php?token=$token");
exit;
}
// ➤ Gestion de la langue
if (isset($_GET['langue']) && in_array(strtoupper($_GET['langue']), $langues)) {
$_SESSION['langue'] = strtoupper($_GET['langue']);
}
if (isset($_SESSION['langue']) && in_array($_SESSION['langue'], $langues)) {
$langue = $_SESSION['langue'];
} else {
$country_code = strtoupper($fiche->country_code ?? 'FR');
$langue = in_array($country_code, $langues) ? $country_code : 'FR';
$_SESSION['langue'] = $langue; // On l'enregistre aussi
}
$trad = chargerTraductions($langue);
// ➤ Mise à jour du compteur et de la date d'affichage
$date_last_flash = date("Y-m-d H:i");
$db->query("UPDATE heb SET compteur_affichage = compteur_affichage + 1, date_last_flash = '$date_last_flash' WHERE id = {$fiche->id}");
// Paramètres passés
$query = $_GET['query'] ?? 'proche';
$categorie = $_GET['categorie'] ?? 'a_voir';
$zones = [$query]; // tableau avec UNE seule zone sélectionnée
$categories = [$categorie]; // tableau avec UNE seule catégorie sélectionnée
?>
<html class="no-js" lang="<?echo $country_code;?>">
<head>
<?include("includes/google_head.php");?>
<meta charset="utf-8">
<title>MyReco.Online</title>
<meta name="description" content="">
<meta name="robots" content="noindex, nofollow">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="https://www.myreco.online/img/icone.png" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<link rel="stylesheet" href="css/custom.css">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/custom.js"></script>
<style>
</style>
</head>
<body>
<div id="halt_loader_overlay"></div>
<div id="halt_loader" class=""><i class="fa fa-spinner fa-spin"></i> <?echo $trad['Chargement des informations, merci de patienter'] ?? '⚠️';?></div>
<?
include("includes/google_body.php");?>
<nav class="navbar fixed-top navbar-light bg-light">
<div class="container d-flex justify-content-between align-items-center">
<!-- Logo -->
<div>
<img src="img/logo_myreco.png" alt="Logo" class="d-none d-md-block" style="height: 40px;">
<img src="img/logo_myreco.png" alt="Logo Mobile" class="d-md-none" style="height: 15px;">
</div>
<!-- Boutons + Sélecteur de langue -->
<div class="d-flex align-items-center">
<!-- Boutons de distance -->
<a class="ml-1 btn btn-secondary btn-sm text-white <?php if ($query=="proche") echo 'active'; ?>" onclick="showLoader();"
href="fiche.php?token=<?php echo $token; ?>&query=proche&categorie=<?php echo $categorie; ?>&<?php echo $mrx_variable; ?>">0-30km</a>
<a class="ml-1 btn btn-secondary btn-sm text-white <?php if ($query=="median") echo 'active'; ?>" onclick="showLoader();"
href="fiche.php?token=<?php echo $token; ?>&query=median&categorie=<?php echo $categorie; ?>&<?php echo $mrx_variable; ?>">30-60km</a>
<a class="ml-1 btn btn-secondary btn-sm text-white <?php if ($query=="lointain") echo 'active'; ?>" onclick="showLoader();"
href="fiche.php?token=<?php echo $token; ?>&query=lointain&categorie=<?php echo $categorie; ?>&<?php echo $mrx_variable; ?>">60-100km</a>
<!-- Dropdown langue avec drapeau -->
<div class="dropdown ml-1">
<button class="btn btn-sm btn-outline-secondary dropdown-toggle d-flex align-items-center" type="button" id="dropdownLangue" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<img src="img/flag/ico/<?php echo strtolower($langue ?? 'fr'); ?>.png" alt="flag" style="height: 16px; width: auto; margin-right: 5px;">
<?php echo strtoupper($langue ?? 'FR'); ?>
</button>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownLangue">
<?php
foreach ($langues as $l) {
$url = "fiche.php?token=$token&query=$query&categorie=$categorie&$mrx_variable&langue=$l";
$img = "img/flag/ico/" . strtolower($l) . ".png";
echo "<a class='dropdown-item d-flex align-items-center' href='$url'>
<img src='$img' alt='$l' style='height: 16px; width: auto; margin-right: 8px;'> $l
</a>";
}
?>
</div>
</div>
</div>
</div>
</nav>
<div class="mt-3 mb-3"> </div>
<?
$zones_actives = $_GET['zones'] ?? ['proche'];
$categories_actives = $_GET['categories'] ?? ['a_voir'];
$myquery = "SELECT * from heb where token='".$token."'";
$fiche = $db->get_row($myquery);
$resultat = verifierOuRecupererPhoto($fiche->token, "heb");
$hebergement_photo ='img/hebergement.png';
if ($resultat['url']) {$hebergement_photo=$resultat['url'];}
$tableau_liste = recupererLieuxCarte($fiche, $zones_actives, $categories_actives, false);
if (in_array('visite_proprio', $visite_proprio_actives)) {
$tableau_liste_proprio = recupererLieuxCarteProprio($fiche);
}
?>
<div class="container mycards">
<div class="row">
<?php
echo "<pre>";
print_r($tableau_liste);
echo "</pre>";
?>
<div class="col-md-12">
<div id="map" style="height: 500px; border: 1px solid #ccc;"></div>
</div>
</div>
</div>
<div class="mt-3 mb-3"> </div>
<nav class="navbar fixed-bottom navbar-light bg-light">
<div class="container d-flex justify-content-between align-items-center">
<a class="btn btn-secondary text-white <?if ($categorie=="a_voir") {?> active<?}?>" onclick="showLoader();" href="fiche.php?token=<?echo $token;?>&categorie=a_voir"><?echo $trad['A voir'] ?? '⚠️';?></a>
<a class="btn btn-secondary text-white <?if ($categorie=="restaurant") {?> active<?}?>" onclick="showLoader();" href="fiche.php?token=<?echo $token;?>&categorie=restaurant"><?echo $trad['Restaurant'] ?? '⚠️';?></a>
<a class="btn btn-secondary text-white <?if ($categorie=="ludique") {?> active<?}?>" onclick="showLoader();" href="fiche.php?token=<?echo $token;?>&categorie=ludique"><?echo $trad['Ludique'] ?? '⚠️';?></a>
<a class="btn btn-secondary text-white <?if ($categorie=="soiree") {?> active<?}?>" onclick="showLoader();" href="fiche.php?token=<?echo $token;?>&categorie=soiree"><?echo $trad['En soirée'] ?? '⚠️';?></a>
<a class="mt-3 btn btn-block btn-secondary text-white <?if ($categorie=="reco") {?> active<?}?>" href="fiche.php?token=<?echo $token;?>&categorie=reco"><?echo $trad['Les recos du proprio'] ?? '⚠️';?></a>
</div>
</nav>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
<script>
document.addEventListener("DOMContentLoaded", function () {
var latCentre = <?= str_replace(',', '.', $fiche->latitude) ?>;
var lngCentre = <?= str_replace(',', '.', $fiche->longitude) ?>;
var map = L.map('map'); // Pas de setView ici
L.tileLayer('https://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png', {
attribution: '© OpenStreetMap',
maxZoom: 18
}).addTo(map);
// 📍 Icône rouge pour l’hébergement
var redIcon = new L.Icon({
iconUrl: 'img/marker-icon-red.png',
shadowUrl: 'img/marker-shadow.png',
iconSize: [25, 41],
iconAnchor: [12, 41],
popupAnchor: [1, -34],
shadowSize: [41, 41]
});
// Icônes personnalisées
var icons = {
a_voir: new L.Icon({ iconUrl: 'img/marker-icon-blue.png', shadowUrl: 'img/marker-shadow.png', iconSize: [25, 41], iconAnchor: [12, 41], popupAnchor: [1, -34], shadowSize: [41, 41] }),
restaurant: new L.Icon({ iconUrl: 'img/marker-icon-green.png', shadowUrl: 'img/marker-shadow.png', iconSize: [25, 41], iconAnchor: [12, 41], popupAnchor: [1, -34], shadowSize: [41, 41] }),
soiree: new L.Icon({ iconUrl: 'img/marker-icon-orange.png', shadowUrl: 'img/marker-shadow.png', iconSize: [25, 41], iconAnchor: [12, 41], popupAnchor: [1, -34], shadowSize: [41, 41] }),
ludique: new L.Icon({ iconUrl: 'img/marker-icon-violet.png', shadowUrl: 'img/marker-shadow.png', iconSize: [25, 41], iconAnchor: [12, 41], popupAnchor: [1, -34], shadowSize: [41, 41] }),
visite_proprio: new L.Icon({ iconUrl: 'img/marker-icon-yellow.png', shadowUrl: 'img/marker-shadow.png', iconSize: [25, 41], iconAnchor: [12, 41], popupAnchor: [1, -34], shadowSize: [41, 41] })
};
// 📍 Tableau pour stocker les coordonnées
var boundsArray = [];
// ➤ Marqueur hébergement
var markerHeb = L.marker([latCentre, lngCentre], { icon: redIcon }).addTo(map)
.bindPopup(`<b><?= addslashes($fiche->name) ?> (<?= count($tableau_liste) ?> lieux)</b><br><img src="<?= $hebergement_photo ?>" width="120">`)
.openPopup();
boundsArray.push([latCentre, lngCentre]);
// ➤ Marqueurs des lieux
<?php foreach ($tableau_liste as $lieu): ?>
var latlng = [<?= $lieu['latitude'] ?>, <?= $lieu['longitude'] ?>];
var categorie = "<?= $lieu['categorie'] ?>";
var icon = icons[categorie] || icons.a_voir;
var marker = L.marker(latlng, { icon: icon }).addTo(map);
marker.bindPopup(`<b><?= addslashes($lieu['name']) ?></b><br>
<i>Catégorie : <?= $lieu['categorie'] ?></i><br>
(<?= $lieu['distance'] ?> km)<br>
<br><img src="https://www.myreco.online<?echo $lieu['photo_locale'];?>" width="200">
`);
boundsArray.push(latlng);
<?php endforeach; ?>
// ➤ Marqueurs des lieux
<?php foreach ($tableau_liste_proprio as $lieu): ?>
var latlng = [<?= $lieu['latitude'] ?>, <?= $lieu['longitude'] ?>];
var categorie = "Mes recos";
var icon = icons['visite_proprio'] || icons.a_voir;
var marker = L.marker(latlng, { icon: icon }).addTo(map);
marker.bindPopup(`<b><?= addslashes($lieu['name']) ?></b><br>
<i>Catégorie : Mes recos</i><br>
<br><img src="https://www.myreco.online<?echo $lieu['photo_locale'];?>" width="200">
`);
boundsArray.push(latlng);
<?php endforeach; ?>
// ➤ Adapter le zoom automatiquement à tous les marqueurs
map.fitBounds(boundsArray, { padding: [30, 30] });
});
</script>
</body>
</html>