Accéder au contenu.
Menu Sympa

devel - [Devel] r209 - trunk

Objet : devel-adl

Archives de la liste

[Devel] r209 - trunk


Chronologique Discussions 
  • From: svn AT agendadulibre.org
  • To: devel AT agendadulibre.org
  • Subject: [Devel] r209 - trunk
  • Date: Sun, 14 Jan 2007 18:39:30 +0100 (CET)
  • List-archive: <http://lolut.utbm.info/pipermail/devel>
  • List-id: Developpement de l'Agenda du Libre <devel.agendadulibre.org>

Author: thomas
Date: Sun Jan 14 18:39:29 2007
New Revision: 209

Added:
trunk/listevents.php
trunk/tags.php
Modified:
trunk/funcs.inc.php
trunk/ical.php
trunk/moderate.php
trunk/rss.php
trunk/showevent.php
trunk/submit.php

Log:

Ajout d'un support basique des tags pour les évènements de l'Agenda du
Libre. Chaque évènement est associé à une liste des tags, qui sont des
mots constitués uniquement de minuscules, de chiffres ou de tirets,
séparés par des espaces. Dans cette première implémentation, pour des
raisons de simplicité, les tags sont stockés dans un champ de la table
'events'.

* tags.php:

- Nouvelle page listant tous les tags disponibles, avec une police
plus ou moins grosse selon le nombre d'occurences du tag. Un clic
sur le nom du tag permet d'accéder à une liste des évènements
ayant ce tag. Pour chaque tag, il y a également un lien vers le
flux RSS et le calendrier iCal correspondant.

* submit.php:

- Adaptation pour supporter les tags (passage des tags en paramètre
de diverses fonctions, validation des tags soumis, modification de
la requête SQL d'insertion, etc.)

* ical.php:

- Supporte désormais un paramètre 'tag' qui permet de générer un
calendrier iCal pour un tag donné. Il est possible d'utiliser à la
fois 'region' et 'tag' pour limiter à une région et un tag donné.

* listevents.php:

- Page listant les évènements d'un tag donné, en deux listes: une
pour les évènements à venir, une pour les évènements passés.

* moderate.php:

- Adaptation de l'interface de modération pour supporter les tags
(passage des tags en paramètre de diverses fonctions, modification
de la requête SQL de mise à jour, etc.)

* rss.php:

- Supporte désormais un paramètre 'tag' qui permet de générer un
flux RSS pour un tag donné. Il est possible d'utiliser à la fois
'region' et 'tag' pour limiter à une région et un tag donné.

* showevent.php:

- Ajout du paramètre tags.

* funcs.inc.php:

- Ajout du liens vers la nouvelle page "Tags".

- Dans format_event() et format_event_ascii(), affichage de la liste
des tags.

- Support des tags dans la fonction edit_event()



Modified: trunk/funcs.inc.php
==============================================================================
--- trunk/funcs.inc.php (original)
+++ trunk/funcs.inc.php Sun Jan 14 18:39:29 2007
@@ -99,7 +99,7 @@
?>
</div>
<div class="footer">
-<p><a href="submit.php">Proposer un �v�nement</a> - <a
href="rsslist.php">Flux RSS</a> - <a href="icallist.php">Calendriers iCal</a>
- <a href="map.php">Carte</a> - <a href="infos.php">Informations</a> - <a
href="stats.php">Statistiques</a> - <a href="mailto:moderateurs CHEZ
agendadulibre POINT org">Contact</a></p>
+<p><a href="submit.php">Proposer un �v�nement</a> - <a
href="rsslist.php">Flux RSS</a> - <a href="icallist.php">Calendriers iCal</a>
- <a href="map.php">Carte</a> - <a href="tags.php">Tags</a> - <a
href="infos.php">Informations</a> - <a href="stats.php">Statistiques</a> - <a
href="mailto:moderateurs CHEZ agendadulibre POINT org">Contact</a></p>
</div>
</body>
</html>
@@ -546,7 +546,7 @@
*/
function format_event ($db, $title, $start, $end, $description,
$city, $region, $locality, $url, $contact,
- $submitter, $moderation = FALSE)
+ $submitter, $tags, $moderation = FALSE)
{
$title = stripslashes($title);
$region = stripslashes(region_find($db, $region));
@@ -578,6 +578,19 @@
if ($moderation)
$result .= "<p>�v�nement � port�e <b>" . ($locality == 1 ? "nationale" :
"locale") . "</b></p>";

+ if ($tags != "")
+ {
+ $tags = split(" ", $tags);
+ $result .= "<p>Tags: ";
+ for ($i = 0; $i < count($tags); $i++)
+ {
+ $result .= "<a href=\"listevents.php?tag=" . $tags[$i] . "\">" .
$tags[$i] . "</a>";
+ if ($i != count($tags) - 1)
+ $result .= ", ";
+ }
+ $result .= "</p>";
+ }
+
return $result;
}

@@ -588,7 +601,7 @@
*/
function format_ascii_event ($db, $title, $start, $end, $description,
$city, $region, $locality, $url, $contact,
- $submitter)
+ $submitter, $tags)
{
$title = stripslashes($title);
$start = date_timestamp2humanreadable($start);
@@ -599,6 +612,7 @@
$url = stripslashes($url);
$contact = scramble_email(stripslashes($contact));
$submitter = scramble_email(stripslashes($submitter));
+ $tags = stripslashes($tags);

$str =
"Titre : " . $title . "\n" .
@@ -609,6 +623,7 @@
"URL : " . $url . "\n".
"Contact : " . $contact . "\n" .
"Soumetteur : " . $submitter . "\n" .
+ "Tags : " . $tags . "\n" .
"Description : \n " . preg_replace ("/\n/", "\n ", $description);

return $str;
@@ -689,7 +704,7 @@

function edit_event ($db, $title, $start, $end, $description,
$city, $region, $locality, $url, $contact,
- $submitter, $wants_preview = FALSE)
+ $submitter, $tags, $wants_preview = FALSE)
{
$title = escape_form_string($title);
$description = escape_form_string($description,
"<p><b><i><br/><a><ul><li><ol>");
@@ -697,6 +712,7 @@
$url = escape_form_string($url);
$contact = escape_form_string($contact);
$submitter = escape_form_string($submitter);
+ $tags = escape_form_string($tags);

?>
<table>
@@ -811,6 +827,16 @@
</td>
</tr>

+ <tr>
+ <td>
+ Tags:
+ </td>
+ <td>
+ <i>Tags pour l'�v�nement. Les tags sont s�par�s par des espaces. Un tag
ne peut contenir que des lettres minuscules, des chiffres et des
tirets.</i><br/>
+ <input type="text" size="70" name="__event_tags" value="<?php echo
$tags; ?>"/><br/>
+ </td>
+ </tr>
+
<tr>
<td>
</td>

Modified: trunk/ical.php
==============================================================================
--- trunk/ical.php (original)
+++ trunk/ical.php Sun Jan 14 18:39:29 2007
@@ -31,15 +31,25 @@

$timezone = "Europe/Paris";

-function ical_start_calendar ($region)
+function ical_start_calendar ($region, $tag)
{
echo "BEGIN:VCALENDAR\n";
echo "VERSION:2.0\n";
echo "PRODID:-//AgendaDuLibre.org\n";
- echo "X-WR-CALNAME:Agenda du Libre - " . $region . "\n";
+ echo "X-WR-CALNAME:Agenda du Libre";
+ if ($region != "all")
+ echo utf8_encode(" - r�gion ") . $region;
+ if ($tag != '')
+ echo " - tag " . $tag;
+ echo "\n";
echo "X-WR-TIMEZONE:Europe/Paris\n";
echo "CALSCALE:GREGORIAN\n";
- echo "X-WR-CALDESC:" . utf8_encode("L'Agenda des �v�nements autour du
Libre en r�gion ") . $region . "\n";
+ echo "X-WR-CALDESC:" . utf8_encode("L'Agenda des �v�nements autour du
Libre");
+ if ($region != "all")
+ echo utf8_encode(" en r�gion ") . $region;
+ if ($tag != '')
+ echo ", tag " . $tag;
+ echo "\n";
}

function ical_end_calendar()
@@ -62,35 +72,40 @@
echo "END:VEVENT\n";
}

-function get_events ($db, $region)
+function get_events ($db, $region, $tag)
{
$start = mktime() - (12 * 30 * 24 * 60 *60);

- if ($region == "all")
- {
- $sql = "select * from events where " .
- "(end_time >= '" . date_timestamp2mysql($start) . "') AND
(moderated=1)";
- }
- else
- {
- $sql = "select * from events where " .
- "(end_time >= '" . date_timestamp2mysql($start) . "') AND " .
- "((region=" . $region . ") OR (locality=1)) AND (moderated=1)";
- }
+ $sql = "select * from events where " .
+ "(end_time >= '" . date_timestamp2mysql($start) . "') AND
(moderated=1)";
+
+ if ($region != "all")
+ $sql .= " AND ((region=" . $region . ") OR (locality=1))";
+
+ if ($tag != "")
+ $sql .= " AND (tags like '%" . $tag . "%')";

return $db->query ($sql);
}

$region = get_safe_integer('region', 'all');

-$list = get_events ($db, $region);
+if ($_GET['tag'] && ereg("^[a-z0-9\-]*$", $_GET['tag']))
+ $tag = $_GET['tag'];
+else
+ $tag = '';
+
+$list = get_events ($db, $region, $tag);
if ($list == FALSE)
{
echo "Erreur lors de la r�cup�ration des �v�nements";
exit;
}

-ical_start_calendar(utf8_encode(region_find($db, $region)));
+if ($region != "all")
+ ical_start_calendar(utf8_encode(region_find($db, $region)), $tag);
+else
+ ical_start_calendar($region, $tag);

while ($event = mysql_fetch_object($list))
{

Added: trunk/listevents.php
==============================================================================
--- (empty file)
+++ trunk/listevents.php Sun Jan 14 18:39:29 2007
@@ -0,0 +1,113 @@
+<?php
+
+/* Copyright 2005
+ * - M�lanie Bats <melanie POINT bats CHEZ utbm POINT fr>
+ * - Thomas Petazzoni <thomas POINT petazzoni CHEZ enix POINT org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+include("bd.inc.php");
+include("funcs.inc.php");
+
+function list_events($events)
+{
+ echo " <ul>\n";
+ while($event = mysql_fetch_object($events))
+ {
+ echo "<li>";
+ echo "<a href=\"showevent.php?id=" . $event->id . "\">";
+ echo stripslashes($event->title);
+ echo "</a>";
+ $startday =
onlyday_timestamp2humanreadable(date_mysql2timestamp($event->start_time));
+ $endday =
onlyday_timestamp2humanreadable(date_mysql2timestamp($event->end_time));
+ echo "<br/>";
+ if ($startday == $endday)
+ echo "le " . $startday . " ";
+ else
+ echo "du " . $startday . " au " . $endday . " ";
+ echo " � " . $event->city;
+ echo "</li>";
+ }
+ echo " </ul>\n";
+}
+
+put_header("Liste d'�v�nements");
+
+$db = new db();
+
+if (! $_GET['tag'] || !ereg("^[a-z0-9\-]*$", $_GET['tag']))
+{
+ echo "<p><b>Aucun tag s�lectionn�, ou tag invalide.</b></p>";
+ put_footer();
+ exit;
+}
+
+echo "<h2>Les �v�nements <i>" . $_GET['tag'] . "</i></h2>\n";
+$hasevent = FALSE;
+
+$sql = "select id, title, city, start_time, end_time from events " .
+ "where tags like '%" . $_GET['tag'] . "%' and start_time > NOW()
order by start_time";
+$events = $db->query($sql);
+if (! $events)
+{
+ echo "<p><b>Erreur lors de la requ�te SQL.</b></p>";
+ put_footer();
+ exit;
+}
+
+if (mysql_num_rows($events))
+{
+ $hasevent = TRUE;
+ echo "<p>";
+ echo "<b>Prochainement</b>";
+ if (mysql_num_rows($events) == 1)
+ echo ", un �v�nement&nbsp;:";
+ else
+ echo ", " . mysql_num_rows($events) . " �v�nements&nbsp;:";
+ echo "</p>";
+ list_events($events);
+}
+
+$sql = "select id, title, city, start_time, end_time from events ".
+ "where tags like '%" . $_GET['tag'] . "%' and start_time < NOW()
order by start_time desc";
+$events = $db->query($sql);
+if (! $events)
+{
+ echo "<p><b>Erreur lors de la requ�te SQL.</b>/p>";
+ put_footer();
+ exit;
+}
+
+if (mysql_num_rows($events))
+{
+ $hasevent = TRUE;
+ echo "<p>";
+ echo "<b>Dans le pass�</b>";
+ if (mysql_num_rows($events) == 1)
+ echo ", un �v�nement&nbsp;:";
+ else
+ echo ", " . mysql_num_rows($events) . " �v�nements&nbsp;:";
+ echo "</p>";
+ list_events($events);
+}
+
+if (! $hasevent)
+ echo "<p>Aucun �v�nement avec ce tag.</p>";
+
+put_footer();
+?>
+

Modified: trunk/moderate.php
==============================================================================
--- trunk/moderate.php (original)
+++ trunk/moderate.php Sun Jan 14 18:39:29 2007
@@ -43,7 +43,7 @@
}

function save_event ($db, $id, $title, $start, $end, $description, $city,
- $region, $locality, $url, $contact, $submitter, $userid)
+ $region, $locality, $url, $contact, $submitter, $tags,
$userid)
{
global $moderatorlist;

@@ -67,7 +67,8 @@
"locality=" . $db->quote_smart ($locality) . ", ".
"url=" . $db->quote_smart ($url) . ", ".
"contact=" . $db->quote_smart ($contact) . ", ".
- "submitter=" . $db->quote_smart ($submitter) . " ".
+ "submitter=" . $db->quote_smart ($submitter) . ", ".
+ "tags=" . $db->quote_smart ($tags) . " ".
"where id=" . $db->quote_smart ($id);

$ret = $db->query ($sql);
@@ -82,11 +83,11 @@
format_ascii_event ($db, $oldevent->title,
date_mysql2timestamp($oldevent->start_time),
date_mysql2timestamp($oldevent->end_time),
$oldevent->description, $oldevent->city,
$oldevent->region, $oldevent->locality,
- $oldevent->url, $oldevent->contact,
$oldevent->submitter);
+ $oldevent->url, $oldevent->contact,
$oldevent->submitter, $oldevent->tags);
$newevent_str =
format_ascii_event ($db, $title, $start, $end,
$description, $city, $region, $locality,
- $url, $contact, $submitter);
+ $url, $contact, $submitter, $tags);

$diff = arr_diff (split ("\n", $oldevent_str), split ("\n",
$newevent_str), 1);

@@ -142,7 +143,7 @@
format_ascii_event ($db, $row->title,
date_mysql2timestamp($row->start_time),
date_mysql2timestamp($row->end_time),
$row->description, $row->city,
$row->region, $row->locality,
- $row->url, $row->contact,
$row->submitter) . "\n" .
+ $row->url, $row->contact,
$row->submitter, $row->tags) . "\n" .
"=====================================================\n\n" .
"Merci de votre contribution � l'Agenda du Libre et �
bient�t !\n\n".
"-- \nL'�quipe de mod�ration");
@@ -185,7 +186,7 @@
format_ascii_event ($db, $row->title,
date_mysql2timestamp($row->start_time),
date_mysql2timestamp($row->end_time),
$row->description, $row->city,
$row->region, $row->locality,
- $row->url, $row->contact,
$row->submitter) . "\n" .
+ $row->url, $row->contact,
$row->submitter, $row->tags) . "\n" .
"=====================================================\n\n" .
"Merci de votre contribution !\n\n" .
"-- \nL'�quipe de mod�ration");
@@ -285,7 +286,8 @@
$event->locality,
$event->url,
$event->contact,
- $event->submitter);
+ $event->submitter,
+ $event->tags);
echo "</form>\n";
}

@@ -319,6 +321,7 @@
$_POST['__event_url'],
$_POST['__event_contact'],
$_POST['__event_submitter'],
+ $_POST['__event_tags'],
$session->value ("agenda_libre_id"));

if ($ret == 0)
@@ -395,6 +398,7 @@
$row->url,
$row->contact,
$row->submitter,
+ $row->tags,
TRUE);
echo "<input type=\"submit\" name=\"__event_edit\" value=\"�diter\"/>";
echo "<input type=\"submit\" name=\"__event_accept\" value=\"Accepter\"/>";

Modified: trunk/rss.php
==============================================================================
--- trunk/rss.php (original)
+++ trunk/rss.php Sun Jan 14 18:39:29 2007
@@ -42,48 +42,37 @@
return strtr($string, $trans);
}

-function get_events ($db, $region)
+function get_events ($db, $region, $tag)
{
$start = mktime();
$end = mktime() + (30 * 24 * 60 * 60);

- if ($region == "all")
- {
- $sql = "select * from events where " .
- "(start_time <= '" . date_timestamp2mysql($end) . "') AND " .
- "(end_time >= '" . date_timestamp2mysql($start) . "') AND
(moderated=1)" .
- "ORDER BY start_time ASC";
- }
- else
- {
- $sql = "select * from events where " .
- "(start_time <= '" . date_timestamp2mysql($end) . "') AND " .
- "(end_time >= '" . date_timestamp2mysql($start) . "') AND " .
- "((region=" . $region . ") OR (locality=1)) AND (moderated=1)" .
- "ORDER BY start_time ASC";
- }
+ $sql = "select * from events where " .
+ "(start_time <= '" . date_timestamp2mysql($end) . "') AND " .
+ "(end_time >= '" . date_timestamp2mysql($start) . "') AND
(moderated=1)";
+
+ if ($region != "all")
+ $sql .= " AND ((region=" . $region . ") OR (locality=1))";
+
+ if ($tag != "")
+ $sql .= " AND (tags like '%" . $tag . "%')";
+
+ $sql .= " ORDER BY start_time ASC";

return $db->query ($sql);
}

/* Fetch region name */
$region_num = get_safe_integer('region', 'all');
-
if ($region_num != "all")
-{
- $ret = $db->query ("select name from regions where id=" . $region_num);
- if ($ret == FALSE)
- {
- echo "Erreur lors de la recherche de la r�gion";
- exit;
- }
- $row = mysql_fetch_object($ret);
- $region = $row->name;
-}
+ $region = region_find($db, $region);
else
-{
$region = "Toutes les r�gions";
-}
+
+if ($_GET['tag'] && ereg("^[a-z0-9\-]*$", $_GET['tag']))
+ $tag = $_GET['tag'];
+else
+ $tag = '';

Header("Content-type: text/xml; charset=iso-8859-1");

@@ -102,7 +91,7 @@
echo " <rdf:Seq>\n";

/* Generate item list */
-$list = get_events ($db, $region_num);
+$list = get_events ($db, $region_num, $tag);
if ($list == FALSE)
{
echo "Erreur lors de la r�cup�ration des �v�nements";
@@ -119,7 +108,7 @@
echo "</channel>\n\n\n";

/* Generate items */
-$list = get_events ($db, $region_num);
+$list = get_events ($db, $region_num, $tag);
if ($list == FALSE)
{
echo "Erreur lors de la r�cup�ration des �v�nements";
@@ -134,12 +123,24 @@
echo " <guid>" . $event->id . "@agendadulibre.org</guid>";
echo " <description>\n";

- echo xmlentities(strip_tags(format_event ($db, $event->title,
date_mysql2timestamp($event->start_time),
date_mysql2timestamp($event->end_time), $event->description, $event->city,
$event->region, $event->locality, $event->url, $event->contact,
$event->submitter)));
+ echo xmlentities(strip_tags(format_event ($db, $event->title,
+
date_mysql2timestamp($event->start_time),
+
date_mysql2timestamp($event->end_time),
+ $event->description, $event->city,
+ $event->region, $event->locality,
+ $event->url, $event->contact,
+ $event->submitter,
$event->tags)));

echo " </description>\n";
echo " <content:encoded>\n";

- echo xmlentities(format_event ($db, $event->title,
date_mysql2timestamp($event->start_time),
date_mysql2timestamp($event->end_time), $event->description, $event->city,
$event->region, $event->locality, $event->url, $event->contact,
$event->submitter));
+ echo xmlentities(format_event ($db, $event->title,
+ date_mysql2timestamp($event->start_time),
+ date_mysql2timestamp($event->end_time),
+ $event->description, $event->city,
+ $event->region, $event->locality,
+ $event->url, $event->contact,
+ $event->submitter, $event->tags));

echo " </content:encoded>\n";
echo " </item>\n\n";

Modified: trunk/showevent.php
==============================================================================
--- trunk/showevent.php (original)
+++ trunk/showevent.php Sun Jan 14 18:39:29 2007
@@ -72,7 +72,8 @@
$event->locality,
$event->url,
$event->contact,
- $event->submitter);
+ $event->submitter,
+ $event->tags);
}

put_footer();

Modified: trunk/submit.php
==============================================================================
--- trunk/submit.php (original)
+++ trunk/submit.php Sun Jan 14 18:39:29 2007
@@ -26,7 +26,7 @@
$db = new db();

function alert_moderators ($db, $id, $title, $start, $end, $description,
$city,
- $region, $locality, $url, $contact, $submitter)
+ $region, $locality, $url, $contact, $submitter,
$tags)
{
global $moderatorlist;

@@ -35,7 +35,7 @@
$mail_body = "Bonjour,\n\n" .
"Un nouvel �v�nement est � mod�rer sur\n" .
calendar_absolute_url("moderate.php#" . $id) . "\n\n".
format_ascii_event ($db, $title, $start, $end, $description, $city,
$region,
- $locality, $url, $contact, $submitter) . "\n\n" .
+ $locality, $url, $contact, $submitter, $tags) .
"\n\n" .
"Merci !\n" .
"-- Agenda du Libre";

@@ -44,7 +44,7 @@
return 0;
}

-function add_event ($db, $title, $start, $end, $description, $city, $region,
$locality, $url, $contact, $submitter)
+function add_event ($db, $title, $start, $end, $description, $city, $region,
$locality, $url, $contact, $submitter, $tags)
{
$error_cnt = 0;

@@ -54,6 +54,7 @@
$url = stripslashes(strip_tags($url));
$contact = stripslashes(strip_tags($contact));
$submitter = stripslashes(strip_tags($submitter));
+ $tags = stripslashes(strip_tags($tags));

if (! $description)
{
@@ -103,6 +104,20 @@
$error_cnt++;
}

+ foreach(split(" ", $tags) as $tag)
+ {
+ if (! ereg("^[a-z0-9\-]*$", $tag))
+ {
+ error("Tag '" . $tag . "' invalide. Les tags ne doivent contenir
que des lettres minuscules, des chiffres ou des tirets.");
+ $error_cnt++;
+ }
+ if (strlen($tag) < 4)
+ {
+ error("Tag '" . $tag . "' trop court. Les tags doivent faire au
moins 4 caract�res de long.");
+ $error_cnt++;
+ }
+ }
+
if ($error_cnt != 0)
{
return -1;
@@ -112,7 +127,7 @@
$submitter = $contact;

/* Checks are done, add to database */
- $sql = "INSERT INTO events
(title,description,start_time,end_time,city,region,locality,url,contact,submitter,moderated)
values (" .
+ $sql = "INSERT INTO events
(title,description,start_time,end_time,city,region,locality,url,contact,submitter,tags,moderated)
values (" .
$db->quote_smart($title) . "," .
$db->quote_smart($description) . "," .
$db->quote_smart(date_timestamp2mysql ($start)) . "," .
@@ -123,6 +138,7 @@
$db->quote_smart($url) . "," .
$db->quote_smart($contact) . "," .
$db->quote_smart($submitter) . "," .
+ $db->quote_smart($tags) . "," .
"'0')";

$ret = $db->query ($sql);
@@ -134,9 +150,10 @@
}

alert_moderators ($db, $db->insertid(), $title, $start, $end,
$description, $city,
- $region, $locality, $url, $contact, $submitter);
+ $region, $locality, $url, $contact, $submitter, $tags);

- echo "<p><b>Votre �v�nement a bien �t� ajout� � la liste des �v�nements en
attente de mod�ration. Il appara�tra en ligne d�s qu'un mod�rateur l'aura
valid�.</b></p>";
+ echo "<p><b>Votre �v�nement a bien �t� ajout� � la liste des �v�nements en
attente de mod�ration." .
+ "Il appara�tra en ligne d�s qu'un mod�rateur l'aura valid�.</b></p>";

echo "<p><a href=\"index.php\">Retour � l'Agenda</a></p>";

@@ -182,7 +199,8 @@
$_POST['__event_locality'],
$_POST['__event_url'],
$_POST['__event_contact'],
- $_POST['__event_submitter']);
+ $_POST['__event_submitter'],
+ $_POST['__event_tags']);

if ($ret == 0)
{
@@ -207,7 +225,8 @@
$_POST['__event_locality'],
$_POST['__event_url'],
$_POST['__event_contact'],
- $_POST['__event_submitter']);
+ $_POST['__event_submitter'],
+ $_POST['__event_tags']);
echo "<hr/>";
}
}
@@ -224,7 +243,8 @@
$_POST['__event_locality'],
$_POST['__event_url'],
$_POST['__event_contact'],
- $_POST['__event_submitter']);
+ $_POST['__event_submitter'],
+ $_POST['__event_tags']);
echo "<hr/>";
}

@@ -313,6 +333,7 @@
$_POST['__event_url'],
$_POST['__event_contact'],
$_POST['__event_submitter'],
+ $_POST['__event_tags'],
TRUE);

echo "</form>\n";

Added: trunk/tags.php
==============================================================================
--- (empty file)
+++ trunk/tags.php Sun Jan 14 18:39:29 2007
@@ -0,0 +1,77 @@
+<?php
+
+/* Copyright 2005
+ * - Mélanie Bats <melanie POINT bats CHEZ utbm POINT fr>
+ * - Thomas Petazzoni <thomas POINT petazzoni CHEZ enix POINT org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+include("bd.inc.php");
+include("funcs.inc.php");
+
+put_header("Tags");
+
+echo "<h2>Tags</h2>";
+
+$db = new db();
+
+$sql = "select tags from events where tags != ''";
+$events = $db->query($sql);
+if (! $events)
+{
+ echo "<p>Erreur lors de la requête SQL.</p>";
+ put_footer();
+ exit;
+}
+
+$tags = array();
+while($event = mysql_fetch_object($events))
+{
+ foreach(split(" ", $event->tags) as $tag)
+ {
+ if (! isset($tags[$tag]))
+ $tags[$tag] = 1;
+ else
+ $tags[$tag]++;
+ }
+}
+
+echo "<p style=\"text-align: center; margin-top: 40px; line-height:
50px;\">";
+asort($tags);
+foreach($tags as $tag => $count)
+{
+ if ($count > 10)
+ echo "<font size=\"+5\">";
+ else if ($count > 2)
+ echo "<font size=\"+3\">";
+ else
+ echo "<font size=\"+2\">";
+ echo "<a href=\"listevents.php?tag=" . $tag . "\">";
+ echo $tag;
+ echo "</a>";
+ echo "<sub style=\"font-size: 10px;\">";
+ echo "<a style=\"font-size: 10px;\" href=\"rss.php?tag=" . $tag .
"\">rss</a>/";
+ echo "<a style=\"font-size: 10px;\" href=\"ical.php?tag=" . $tag
."\">ical</a>";
+ echo "</sub> ";
+ echo "</font>\n";
+ echo "&nbsp;&nbsp;";
+}
+echo "</p>";
+
+put_footer();
+
+?>
\ No newline at end of file





Archives gérées par MHonArc 2.6.16.

Haut de le page