146 lines
3.0 KiB
PHP
146 lines
3.0 KiB
PHP
<?php
|
|
|
|
require_once('config.php');
|
|
|
|
|
|
require_once('lib/Gchange.class.php');
|
|
require_once('lib/CesiumPlus.class.php');
|
|
|
|
$gchange = new Gchange();
|
|
$cesiumPlus = new CesiumPlus();
|
|
|
|
|
|
if (isset($_GET['location'])) {
|
|
|
|
$_SESSION['location'] = $_GET['location'];
|
|
|
|
$streamContext = stream_context_create(
|
|
array(
|
|
"http" => array(
|
|
"header" => "User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36"
|
|
)
|
|
)
|
|
);
|
|
|
|
|
|
$url = 'http://nominatim.openstreetmap.org/search?q='. urlencode($_GET['location']) . '&format=json';
|
|
|
|
$citiesJson = file_get_contents($url, false, $streamContext);
|
|
$cities = json_decode($citiesJson);
|
|
|
|
$_SESSION['lat'] = $cities[0]->lat;
|
|
$_SESSION['lon'] = $cities[0]->lon;
|
|
$_SESSION['location'] = htmlspecialchars($_GET['location']);
|
|
|
|
}
|
|
|
|
|
|
|
|
include('header.php');
|
|
|
|
|
|
echo '<h2>Événements à '. EVENT_RADIUS .' km autour de '. $_SESSION['location'] . '</h2>';
|
|
|
|
$feedUrl = 'https://www.agendadulibre.org/events.rss?tag=monnaie-libre&near[distance]='. EVENT_RADIUS . '&near[location]=['. $_SESSION['lat'] . ','. $_SESSION['lon'] . ']';
|
|
$content = @file_get_contents($feedUrl);
|
|
$x = new SimpleXmlElement($content);
|
|
|
|
echo '<ul>';
|
|
|
|
foreach($x->item as $entry) {
|
|
|
|
echo '
|
|
|
|
<li>
|
|
<a href="'. $entry->link .'"
|
|
title="'. substr(strip_tags($entry->description), 0, 60) . '">
|
|
|
|
'. $entry->title . '
|
|
|
|
</a>
|
|
</li>';
|
|
}
|
|
|
|
echo '</ul>';
|
|
|
|
echo '
|
|
<p>
|
|
Ces événements sont importés automatiquement depuis
|
|
<a href="'. CALENDAR_URL .'">
|
|
l\'Agenda du libre
|
|
</a>
|
|
</p>';
|
|
|
|
|
|
echo '<h2>Contacter d\'autres junistes près de '. $_SESSION['location'] . '</h2>';
|
|
|
|
echo '
|
|
<p>
|
|
Consulter la doc de OpenStreetMap API pour voir comment récupérer les descriptions des pins des groupes locaux de la Framacarte.
|
|
</p>';
|
|
|
|
echo '
|
|
|
|
<p>
|
|
<a href="'. BB_URL . '">
|
|
Groupe de discussion par mail du groupe de Vannes
|
|
</a>
|
|
</p>';
|
|
|
|
|
|
|
|
$offers = $gchange->getNearbyOffers($_SESSION['lat'], $_SESSION['lon'], RADIUS);
|
|
|
|
echo '<h2>Annonces à '. RADIUS . ' km autour de '. $_SESSION['location'] .'</h2>';
|
|
echo '<ol>';
|
|
foreach ($offers as $offer) {
|
|
|
|
$description = isset($offer->_source->description) ? ' title="'. substr($offer->_source->description, 0, 30) . '"' : '';
|
|
|
|
echo '
|
|
|
|
<li>
|
|
<a href="https://www.gchange.fr/#/app/market/view/'. $offer->_id . '/"'. $description .'>
|
|
' . $offer->_source->title . '
|
|
</a>
|
|
('. $offer->_source->city . ')
|
|
</li>
|
|
|
|
';
|
|
}
|
|
echo '</ol>';
|
|
|
|
|
|
|
|
$users = $cesiumPlus->getNearbyUsers($_SESSION['lat'], $_SESSION['lon'], RADIUS);
|
|
|
|
echo '<h2>Nouveaux utilisateurs à '. RADIUS . ' km autour de '. $_SESSION['location'] .'</h2>';
|
|
|
|
echo '<table>';
|
|
foreach ($users as $user) {
|
|
|
|
$date = new DateTime();
|
|
$date->setTimestamp($user->_source->time);
|
|
|
|
echo '
|
|
|
|
<tr>
|
|
<td class="date">'. $date->format('j') . ' ' . moisFr($date->format('n')) . ' ' . $date->format('Y') . '</td>
|
|
<td>
|
|
<a href="https://demo.cesium.app/#/app/wot/'. $user->_source->issuer . '/">
|
|
' . $user->_source->title . '
|
|
</a>
|
|
</td>
|
|
</tr>
|
|
|
|
';
|
|
}
|
|
echo '</table>';
|
|
|
|
|
|
|
|
include('footer.php');
|
|
|
|
|
|
|