Ajout événements du forum
This commit is contained in:
parent
c450d2d236
commit
1e7cfa1d46
13
config.php
13
config.php
|
@ -1,11 +1,20 @@
|
|||
<?php
|
||||
|
||||
session_start();
|
||||
|
||||
define('RADIUS', '100');
|
||||
define('EVENT_RADIUS', '500');
|
||||
define('BB_URL', 'https://framalistes.org/sympa/info/vannes.monnaielibre');
|
||||
define('CALENDAR_RSS', 'https://www.agendadulibre.org/events.rss?tag=monnaie-libre');
|
||||
define('CALENDAR_URL', 'https://www.agendadulibre.org/events?tag=monnaie-libre');
|
||||
|
||||
define('CALENDAR_1_FEED', 'https://www.agendadulibre.org/events.rss?tag=monnaie-libre');
|
||||
define('CALENDAR_1_LOCAL_FEED', 'https://www.agendadulibre.org/events.rss?tag=monnaie-libre&near[distance]=%s&near[location]=[%s,%s]');
|
||||
define('CALENDAR_1_URL', 'https://www.agendadulibre.org/events?tag=monnaie-libre');
|
||||
|
||||
define('CALENDAR_2_FEED', 'https://forum.monnaie-libre.fr/calendar.json');
|
||||
define('CALENDAR_2_URL', 'https://forum.monnaie-libre.fr/calendar');
|
||||
define('CALENDAR_2_EVENT_URL', 'https://forum.monnaie-libre.fr/t/%s');
|
||||
|
||||
|
||||
|
||||
require_once('functions.php');
|
||||
|
||||
|
|
75
index.php
75
index.php
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
|
||||
require_once('config.php');
|
||||
require_once('lib/Gchange.class.php');
|
||||
|
||||
|
||||
|
@ -78,15 +79,16 @@ echo '</ol>';
|
|||
|
||||
echo '<h2>Prochains événements monnaie libre</h2>';
|
||||
|
||||
|
||||
echo '
|
||||
<p>
|
||||
Ces événements sont importés automatiquement depuis
|
||||
<a href="'. htmlspecialchars(CALENDAR_URL) .'">
|
||||
Événements importés automatiquement depuis
|
||||
<a href="'. htmlspecialchars(CALENDAR_1_URL) .'">
|
||||
l\'Agenda du libre
|
||||
</a>
|
||||
</a> :
|
||||
</p>';
|
||||
|
||||
$content = file_get_contents(CALENDAR_RSS);
|
||||
$content = @file_get_contents(CALENDAR_1_FEED);
|
||||
$x = new SimpleXmlElement($content);
|
||||
|
||||
echo '<ul>';
|
||||
|
@ -97,7 +99,7 @@ foreach($x->item as $entry) {
|
|||
|
||||
<li>
|
||||
<a href="'. $entry->link .'"
|
||||
title="'. substr(strip_tags($entry->description), 0, 30) . '">
|
||||
title="'. substr(strip_tags($entry->description), 0, 60) . '">
|
||||
|
||||
'. $entry->title . '
|
||||
|
||||
|
@ -107,6 +109,69 @@ foreach($x->item as $entry) {
|
|||
|
||||
echo '</ul>';
|
||||
|
||||
|
||||
|
||||
|
||||
echo '
|
||||
<p>
|
||||
Événements importés automatiquement depuis
|
||||
<a href="'. CALENDAR_2_URL .'">
|
||||
forum.monnaie-libre.fr
|
||||
</a> :
|
||||
</p>';
|
||||
|
||||
$content = @file_get_contents(CALENDAR_2_FEED);
|
||||
$x = json_decode($content);
|
||||
|
||||
echo '<ul>';
|
||||
|
||||
$i = 0;
|
||||
$limit = 20;
|
||||
$todayIso = new DateTime();
|
||||
foreach($x->topic_list->topics as $entry) {
|
||||
|
||||
$eventDate = new DateTime($entry->event->start);
|
||||
|
||||
if ($eventDate < $todayIso) {
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
++$i;
|
||||
if ($i > $limit) {
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
echo '
|
||||
|
||||
<li>';
|
||||
if (isset($eventDate)) {
|
||||
|
||||
echo '
|
||||
le '. $eventDate->format('j ') . moisFr($eventDate->format('n')) . $eventDate->format(' Y') . ', ';
|
||||
}
|
||||
|
||||
if (isset($entry->location->geo_location->city)) {
|
||||
|
||||
echo '
|
||||
à '. $entry->location->geo_location->city . ' : ';
|
||||
}
|
||||
|
||||
echo '
|
||||
|
||||
<a href="'. sprintf(CALENDAR_2_EVENT_URL, $entry->id) .'"
|
||||
title="'. substr(strip_tags($entry->excerpt), 0, 60) . '">
|
||||
|
||||
'. $entry->title . '
|
||||
|
||||
</a>
|
||||
</li>';
|
||||
}
|
||||
|
||||
echo '</ul>';
|
||||
|
||||
|
||||
include('footer.php');
|
||||
|
||||
|
||||
|
|
11
mytown.php
11
mytown.php
|
@ -1,8 +1,6 @@
|
|||
<?php
|
||||
|
||||
require_once('config.php');
|
||||
|
||||
|
||||
require_once('lib/Gchange.class.php');
|
||||
require_once('lib/CesiumPlus.class.php');
|
||||
|
||||
|
@ -40,8 +38,8 @@ 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'] . ']';
|
||||
|
||||
$feedUrl = sprintf(CALENDAR_1_LOCAL_FEED, EVENT_RADIUS, $_SESSION['lat'], $_SESSION['lon']);
|
||||
$content = @file_get_contents($feedUrl);
|
||||
$x = new SimpleXmlElement($content);
|
||||
|
||||
|
@ -66,12 +64,15 @@ echo '</ul>';
|
|||
echo '
|
||||
<p>
|
||||
Ces événements sont importés automatiquement depuis
|
||||
<a href="'. CALENDAR_URL .'">
|
||||
<a href="'. CALENDAR_1_URL .'">
|
||||
l\'Agenda du libre
|
||||
</a>
|
||||
</p>';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
echo '<h2>Contacter d\'autres junistes près de '. $_SESSION['location'] . '</h2>';
|
||||
|
||||
echo '
|
||||
|
|
Loading…
Reference in New Issue