Accéder au contenu.
Menu Sympa

devel - [Devel] r433 - branches/dui

Objet : devel-adl

Archives de la liste

[Devel] r433 - branches/dui


Chronologique Discussions 
  • From: svn AT agendadulibre.org
  • To: devel AT agendadulibre.org
  • Subject: [Devel] r433 - branches/dui
  • Date: Sun, 1 Mar 2009 18:46:09 +0100 (CET)
  • List-archive: <http://agendadulibre.org/pipermail/devel>
  • List-id: Developpement de l'Agenda du Libre <devel.agendadulibre.org>

Author: ldayot
Date: Sun Mar 1 18:46:08 2009
New Revision: 433

Log:
Le reste des modifications pour la prise en comptes des nouveaux scripts pour
les
classes d'objet, notamment class.event.inc.php.

Deleted:
branches/dui/bd.inc.php
branches/dui/session.inc.php
Modified:
branches/dui/findgeogul.php
branches/dui/funcs.inc.php
branches/dui/importepn.php
branches/dui/index.php
branches/dui/infos.php
branches/dui/listevents.php
branches/dui/lugtextlist.php
branches/dui/map.php
branches/dui/moderatetags.php
branches/dui/moderation-howto.php
branches/dui/moderation.php
branches/dui/passgen.php
branches/dui/regionimage.php
branches/dui/rejectevent.php
branches/dui/showoneday.php
branches/dui/stats.php
branches/dui/tags.php
branches/dui/text.inc.php
branches/dui/textlist.php
branches/dui/upgrade.php
branches/dui/validateevent.php
branches/dui/xmllistevents.php

Modified: branches/dui/findgeogul.php
==============================================================================
--- branches/dui/findgeogul.php Sun Mar 1 18:44:53 2009 (r432)
+++ branches/dui/findgeogul.php Sun Mar 1 18:46:08 2009 (r433)
@@ -4,10 +4,10 @@
*/

include("text.inc.php");
-include("bd.inc.php");
+include("class.bd.inc.php");
include("funcs.inc.php");
-include("session.inc.php");
-include("user.inc.php");
+include("class.session.inc.php");
+include("class.user.inc.php");

$db = new db();
$user = new user($db);

Modified: branches/dui/funcs.inc.php
==============================================================================
--- branches/dui/funcs.inc.php Sun Mar 1 18:44:53 2009 (r432)
+++ branches/dui/funcs.inc.php Sun Mar 1 18:46:08 2009 (r433)
@@ -1,8 +1,9 @@
<?php

-/* Copyright 2005-2007
+/* Copyright 2005-2009
* - Mélanie Bats <melanie POINT bats CHEZ utbm POINT fr>
* - Thomas Petazzoni <thomas POINT petazzoni CHEZ enix POINT org>
+ * - Loic Dayot <ldayot CHEZ ouvaton 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
@@ -18,8 +19,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
- *
- * $Id: top.inc.php,v 1.51 2007/03/10 16:22:12 ldayot Exp $
*/

require_once("bd-private.inc.php");
@@ -50,7 +49,7 @@

function calendar_setlocale()
{
- if(setlocale(LC_TIME, "fr_FR.utf8") == false)
+ if(setlocale(LC_TIME, "fr_FR.utf8", 'fr_FR.UTF8', 'fr.UTF8',
'fr_FR.UTF-8', 'fr.UTF-8', "fr_FR", "fr_FR@euro") == false)
{
error ("Erreur locales");
}
@@ -118,6 +117,20 @@
echo "<body". ($onloadfunc>"" ? " onload=\"".$onloadfunc."\"" : "").
">\n";
}
echo "<div class=\"main\">\n";
+
+ echo "<div id=\"important\">\n".
+ "<p style=\"text-align: center; margin-left: 0.5em;\">".
+ "En mars, fêtons l'Internet&nbsp;!".
+ "<a
href=\"http://www.villes-internet.net/UPLOAD/article/pages/2182_article.php\";>
+ <img style=\"border:0;max-width:180px\"
src=\"http://www.villes-internet.net/UPLOAD/image/imgPetite/227_fete_internet.jpg\";
+ alt=\"F&ecirc;te de l'Internet\"/></a></p>
+
+ <p style=\"text-align: center; margin-left: 0.5em;\">D&eacute;couvrez le
Libre autour du 21 mars avec<br/>
+ <a href=\"http://www.libre-en-fete.net\";>
+ <img style=\"border:0\"
src=\"http://www.libre-en-fete.net/images/banniere-2.png\";
+ alt=\"Libre en Fete\"/></a>".
+ "</p></div>\n";
+
echo "<h1><a href=\"index.php\">$adl_title</a></h1>\n";
if ($adl_subtitle>"")
echo "<p id=\"subtitle\"><em>$adl_subtitle</em></p>\n";
@@ -170,7 +183,12 @@

function error($msg)
{
- echo "<p class=\"error\">" . $msg . "</p>";
+ echo returnError($msg);
+}
+
+function returnError($msg)
+{
+ return "<p class=\"error\">" . $msg . "</p>";
}

function date_mysql2timestamp ($mysql_date)
@@ -340,12 +358,18 @@
// LD : seems ad hoc function. TODO : generalize or remove it.
function calendar_custom_icon($year, $month, $day)
{
- if ($year == 2007 && $month == 3 && $day >= 17 && $day <= 25)
+ if ($year == 2009 && $month == 3 && $day >= 16 && $day <= 29)
{
echo "<a href=\"http://www.libre-en-fete.net\"; title=\"Libre en
F&ecirc;te\">";
echo "<img src=\"lef-2007-small.png\" style=\"float: right; border:
0;\" alt=\"Libre en F&ecirc;te\" />";
echo "</a>";
}
+ if ($year == 2009 && $month == 3 && $day >= 14 && $day <= 22)
+ {
+ echo "<a
href=\"http://www.villes-internet.net/UPLOAD/article/pages/2182_article.php\";
title=\"F&ecirc;te de l'Internet\">";
+ echo "<img src=\"fi-2009-small.png\" style=\"float: right; border:
0;\" alt=\"F&ecirc;te de l'Internet\" />";
+ echo "</a>";
+ }
}

function calendar($db, $month, $year, $region)
@@ -609,28 +633,13 @@
echo "</p>";
}

-function fetch_event($db, $id)
-{
- $result = $db->query ("select * from events where id=" .
$db->quote_smart($id));
-
- if (! $result)
- {
- error ("Aucun évènement avec l'ID " . $id);
- return FALSE;
- }
-
- return $db->fetchObject($result);
-}
-
function region_find ($db, $id)
{
$ret = $db->query ("select * from regions where id=" .
$db->quote_smart($id));

- if ($ret == FALSE)
+ if (! $row = $db->fetchObject ($ret))
return "Région inconnue";

- $row = $db->fetchObject ($ret);
-
return $row->name;
}

@@ -676,65 +685,6 @@
echo "</select>";
}

-/**
- * Format an event so that it can be displayed in a nice fashion
- *
- * @param db Database handle
- *
- * @param title Title of the event
- *
- * @param start Starting time (timestamp format)
- *
- * @param end Ending time (timestamp format)
- *
- *
- * @return The HTML code that corresponds to the formatted event
- */
-function format_event ($db, $title, $start, $end, $description,
- $city, $region, $locality, $url, $contact,
- $submitter, $tags, $moderation = FALSE)
-{
- $title = stripslashes($title);
- $region = stripslashes(region_find($db, $region));
- $city = stripslashes($city);
- //$description = stripslashes($description);
- $url = stripslashes($url);
- $contact = scramble_email(stripslashes($contact));
-
- $start_day = onlyday_timestamp2humanreadable($start);
- if ($start_day == onlyday_timestamp2humanreadable($end)) {
- $date = "<p>Le " . $start_day . ", de "
- . onlyhour_timestamp2humanreadable($start) . " &agrave; "
- . onlyhour_timestamp2humanreadable($end) . ".</p>\n";
- } else {
- $date = "<p>Du " . date_timestamp2humanreadable($start)
- . " au " . date_timestamp2humanreadable($end) . ".</p>\n";
- }
-
- $result = "<h2><i>" . $city . "</i> : " . $title . "</h2>\n\n";
- $result .= "<h3>Date et lieu</h3>\n";
- $result .= $date;
-
- $result .= "<p>&agrave; <i><a href=\"http://fr.wikipedia.org/wiki/"; .
$city . "\">"
- . $city . "</a></i>, <a href=\"http://fr.wikipedia.org/wiki/";
- . $region . "\">" . $region . "</a></p>\n\n";
- $result .= "<h3>Description</h3>\n";
- $result .= $description . "\n\n";
- $result .= "<h3>Informations</h3>\n";
- $result .= "<p>Site Web: <a href=\"" . $url . "\">" . $url . "</a></p>\n";
- $result .= "<p>Contact: <a href=\"mailto:"; . $contact . "\">" . $contact .
"</a></p>\n";
-
- if ($moderation)
- $result .= "<p>Évènement à portée <b>".
$GLOBALS["adl_locality"][$locality]. "</b></p>";
-
- if ($tags != "")
- {
- $result .= format_tags($tags);
- }
-
- return $result;
-}
-
// Display tags grouped by categories
// $tags is a string of tag
function format_tags($tags)
@@ -743,96 +693,45 @@

$res = $db->query("SELECT tags.name AS tag, tags.category_id as cat_id,
tags_categories.name as category ".
"FROM tags LEFT JOIN tags_categories ON category_id=tags_categories.id ".
- "WHERE tags.name IN ('". str_replace(" ", "','", $tags). "') ".
- "ORDER BY tags_categories.name");
+ "WHERE tags.name IN ('". str_replace(" ", "','", $tags). "') AND
tags.name>' '".
+ "ORDER BY tags_categories.name, tags.name");

- $result = "";
+ $result = $lastline = "";
$cat = "-1";
+ $aTags = array();
while ($rec = $db->fetchObject($res))
- {
- if ($cat != $rec->category)
{
- if ($cat != "-1")
- if ($cat_id==0)
+ if (!isset ($aTags[$rec->category]))
+ $aTags[$rec->category] = array();
+ $aTags[$rec->category][] = $rec->tag;
+ }
+ foreach ($aTags as $key=>$aaTags)
+ {
+ if ($key>"a")
{
- $last_line = "<p>". _("Mots-cl&eacute;s"). " : ";
- foreach ($result_tags as $tag)
- $last_line .= "<a href=\"" .
calendar_absolute_url("listevents.php?tag=$tag"). "\">$tag</a> ";
- $last_line .= "</p>";
+ $result .= "<p> {$key} : ";
+ foreach ($aaTags as $tag)
+ {
+ $result .= "<a href=\"" .
calendar_absolute_url("listevents.php?tag=$tag"). "\">$tag</a> ";
+ $tags = str_replace($tag, "", $tags);
+ }
+ $result .= "</p>";
}
- else
+ else
{
- $result .= "<p>". $cat. " : ";
- foreach ($result_tags as $tag)
- $result .= "<a href=\"" .
calendar_absolute_url("listevents.php?tag=$tag"). "\">$tag</a> ";
- $result .= "</p>";
+ $lastline .= "<p>". _("Mots-cl&eacute;s"). " : ";
+ foreach ($aaTags as $tag)
+ {
+ $lastline .= "<a href=\"" .
calendar_absolute_url("listevents.php?tag=$tag"). "\">$tag</a> ";
+ $tags = str_replace($tag, "", $tags);
+ }
}
- $cat = $rec->category;
- unset($result_tags);
- $result_tags = array();
- }
- $result_tags[] = $rec->tag;
- $cat_id=$rec->cat_id;
- }
- if ($cat != "-1")
- if ($cat_id==0)
- {
- $last_line = "<p>". _("Mots-clés"). " : ";
- foreach ($result_tags as $tag)
- $last_line .= "<a href=\"listevents.php?tag=$tag\">$tag</a> ";
- $last_line .= "</p>";
}
- else
- {
- $result .= "<p>". $cat. " : ";
- foreach ($result_tags as $tag)
- $result .= "<a href=\"listevents.php?tag=$tag\">$tag</a> ";
- $result .= "</p>";
- }
-
- if (isset($last_line))
- $result .= $last_line;
-
- return $result;
+ $lastline .= trim($tags);
+ return $result. $lastline;
} // end function


-/**
- * Format an event in an ASCII format, suitable for e-mails
- *
- * @return An ASCII description of the event
- */
-function format_ascii_event ($db, $title, $start, $end, $description,
- $city, $region, $locality, $url, $contact,
- $submitter, $tags)
-{
- $title = stripslashes($title);
- $start = date_timestamp2humanreadable($start);
- $end = date_timestamp2humanreadable($end);
- $region = stripslashes(region_find($db, $region));
- $city = stripslashes($city);
- $description = stripslashes($description);
- $url = stripslashes($url);
- $contact = scramble_email(stripslashes($contact));
- $submitter = scramble_email(stripslashes($submitter));
- $tags = stripslashes($tags);
-
- $str =
- "Titre : " . $title . "\n" .
- "Début : " . $start . "\n".
- "Fin : " . $end . "\n" .
- "Région : " . $region . "\n" .
- "Ville : " . $city . "\n" .
- "URL : " . $url . "\n".
- "Contact : " . $contact . "\n" .
- "Soumetteur : " . $submitter . "\n" .
- "Mots-clés : " . $tags . "\n" .
- "Description : \n " . preg_replace ("/\n/", "\n ", $description);
-
- return $str;
-}
-
-
function generate_date_forms ($ident, $current_time)
{
echo "<select name=\"__event_" . $ident . "_day\">\n";
@@ -890,11 +789,6 @@
echo "</select>\n";
}

-function escape_form_string ($str, $allowed_tags="")
-{
- return htmlspecialchars(stripslashes(strip_tags($str, $allowed_tags)));
-}
-
/* Function to safely get identifiers from forms */
function get_safe_integer($name, $default)
{
@@ -914,205 +808,6 @@
}
}

-function edit_event ($db, $title, $start, $end, $description,
- $city, $region, $locality, $url, $contact,
- $submitter, $tags, $wants_preview = FALSE,
$submit_enable=TRUE)
-{
- global $adl_form_description_guide, $adl_form_tags_guide;
-
- $title = escape_form_string($title);
- $description = escape_form_string($description,
"<p><b><i><br/><a><ul><li><ol>");
- $city = escape_form_string($city);
- $url = escape_form_string($url);
- $contact = escape_form_string($contact);
- $submitter = escape_form_string($submitter);
- $tags = escape_form_string($tags);
-
- if (file_exists("tiny_mce"))
- {
- ?>
-<!-- tinyMCE -->
-<script language="javascript" type="text/javascript"
src="tiny_mce/tiny_mce.js"></script>
-<script language="javascript" type="text/javascript">
- // Notice: The simple theme does not use all options some of them
are limited to the advanced theme
- tinyMCE.init({
- mode : "textareas",
- language : "fr",
- theme : "advanced",
- plugins : "paste,preview",
- theme_advanced_buttons1 : "bold,italic,underline,separator,
bullist,numlist,undo,redo,link,unlink,separator,cut,copy,paste,pastetext,pasteword,separator,preview,code",
- theme_advanced_buttons2 : "",
- theme_advanced_buttons3 : "",
- theme_advanced_toolbar_location : "top",
- theme_advanced_toolbar_align : "left",
- theme_advanced_path_location : "bottom",
- plugin_preview_width : "500",
- plugin_preview_height : "600",
- extended_valid_elements : "a[name|href|target|title|onclick]"
- });
-</script>
-<!-- /tinyMCE -->
-<?php
- } // end if tiny_mce
-
-?>
- <table class='form'>
-
- <tr>
- <td>
- Titre:
- </td>
- <td>
- <b>Décrivez en moins de 5 mots votre évènement, sans y indiquer le lieu,
la ville ni la date.</b><br/>
- <input type="text" size="70" name="__event_title" value="<?php echo
$title;?>"/><br/><br/>
- </td>
- </tr>
-
- <tr>
- <td>
- Début:
- </td>
- <td>
- <?php generate_date_forms("start", $start); ?>
- </td>
- </tr>
-
- <tr>
- <td>
- Fin:<br/><br/>
- </td>
- <td>
- <?php generate_date_forms("end", $end); ?><br/><br/>
- </td>
- </tr>
-
- <tr>
- <td>
- Description:
- </td>
- <td>
- <b>Décrivez de la manière la plus complète possible votre
évènement.</b><br/>
- <?php
- if (file_exists("tiny_mce"))
- {
- echo "<noscript>". $adl_form_description_guide. "</noscript>\n";
- }
- else
- {
- echo $adl_form_description_guide. "\n";
- }
- ?>
- <textarea rows="25" cols="70" name="__event_description"><?php echo
$description;?></textarea><br/><br/>
- </td>
- </tr>
-
- <tr>
- <td>
- Commune:
- </td>
- <td>
- <input type="text" size="70" name="__event_city" value="<?php echo
$city;?>"/><br/>
- </td>
- </tr>
-
- <tr>
- <td>
- Région:
- </td>
- <td>
- <?php region_select_form($db, "__event_region", $region); ?><br/>
- </td>
- </tr>
-
- <tr>
- <td>
- Portée:
- </td>
- <td>
- <select name="__event_locality">
- <?php
- foreach ($GLOBALS["adl_locality"] as $key=>$value)
- {
- echo "<option value=\"$key\"". ($locality == $key ? "
selected=\"selected\"" : ""). ">$value</option>\n";
- }
- ?>
- </select>
- </td>
- </tr>
-
- <tr>
- <td>
- URL:
- </td>
- <td>
- <i>Lien <b>direct</b> vers une page donnant plus d'informations sur
l'évènement (lieu et horaire précis, programme détaillé...)</i><br/>
- <input type="text" size="70" name="__event_url" value="<?php echo
$url;?>"/><br/>
- </td>
- </tr>
-
- <tr>
- <td>
- Contact:
- </td>
- <td>
- <i>Adresse courriel de contact (elle sera transformée de manière à
éviter le spam).</i><br/>
- <input type="text" size="70" name="__event_contact" value="<?php echo
$contact;?>"/><br/>
- </td>
- </tr>
-
- <tr>
- <td>
- Soumetteur:
- </td>
- <td>
- <i>Adresse courriel du soumetteur de l'évènement (qui ne sera utilisée
que par les modérateurs pour informer de la validation ou du rejet). A
défaut, l'adresse de contact sera utilisée.</i><br/>
- <input type="text" size="70" name="__event_submitter" value="<?php echo
$submitter;?>"/><br/>
- </td>
- </tr>
-<?php
-
- $aCategoryTags = selectWithCategoryTags(explode(" ", $tags));
- foreach ($aCategoryTags->HTML as $category_id=>$aSelect)
- {
- echo "<tr><td>{$aSelect['categoryName']}:</td>".
- "<td>{$aSelect['categoryDescription']}<br />".
- "{$aSelect['HTMLSelect']} </td>\n</tr>\n";
- }
- $aTags = explode(' ', $aCategoryTags->tagsRest);
-?>
- <tr>
- <td>
- Mots-clés:
- </td>
- <td>
- <?php
- echo $adl_form_tags_guide;
-
- $oTags = selectCategoryTags($aTags, 0, $fieldName="tags[0]",
$multiple=true);
- echo _("Dans les mots-clés courants"). " : <br />". $oTags->HTML;
- $tags = $oTags->tagsRest;
-
- ?><br />
- <input type="text" size="70" name="__event_tags" value="<?php echo
$tags; ?>"/><br/>
- </td>
- </tr>
-
- <tr>
- <td>
- </td>
- <td>
-<?php
- if ($wants_preview)
- echo "<input name=\"__event_preview\" type=\"submit\"
value=\"Visualiser\"/>";
- if ($submit_enable)
- echo "<input name=\"__event_save\" type=\"submit\" value=\"Valider\"/>";
-?>
- </td>
- </tr>
-
- </table>
-<?php
-}


// Function to choose place (region)

Modified: branches/dui/importepn.php
==============================================================================
--- branches/dui/importepn.php Sun Mar 1 18:44:53 2009 (r432)
+++ branches/dui/importepn.php Sun Mar 1 18:46:08 2009 (r433)
@@ -5,10 +5,10 @@
*/

include("text.inc.php");
-include("bd.inc.php");
+include("class.bd.inc.php");
include("funcs.inc.php");
-include("session.inc.php");
-include("user.inc.php");
+include("class.session.inc.php");
+include("class.user.inc.php");

$db = new db();
$user = new user($db);

Modified: branches/dui/index.php
==============================================================================
--- branches/dui/index.php Sun Mar 1 18:44:53 2009 (r432)
+++ branches/dui/index.php Sun Mar 1 18:46:08 2009 (r433)
@@ -1,8 +1,9 @@
<?php

-/* Copyright 2005
+/* Copyright 2005-2009
* - Mélanie Bats <melanie POINT bats CHEZ utbm POINT fr>
* - Thomas Petazzoni <thomas POINT petazzoni CHEZ enix POINT org>
+ * - Loic Dayot <ldayot CHEZ ouvaton 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
@@ -25,7 +26,7 @@
* Main page of the Agenda that displays the calendar
*/

-include("bd.inc.php");
+include("class.bd.inc.php");
include("funcs.inc.php");

put_header("Accueil");

Modified: branches/dui/infos.php
==============================================================================
--- branches/dui/infos.php Sun Mar 1 18:44:53 2009 (r432)
+++ branches/dui/infos.php Sun Mar 1 18:46:08 2009 (r433)
@@ -1,8 +1,9 @@
<?php

-/* Copyright 2004-2007
+/* Copyright 2004-2009
* - Mélanie Bats <melanie POINT bats CHEZ utbm POINT fr>
* - Thomas Petazzoni <thomas POINT petazzoni CHEZ enix POINT org>
+ * - Loic Dayot <ldayot CHEZ ouvaton 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
@@ -20,7 +21,7 @@
* 02111-1307, USA.
*/

-include("bd.inc.php");
+include("class.bd.inc.php");
include("funcs.inc.php");

put_header ("Informations");

Modified: branches/dui/listevents.php
==============================================================================
--- branches/dui/listevents.php Sun Mar 1 18:44:53 2009 (r432)
+++ branches/dui/listevents.php Sun Mar 1 18:46:08 2009 (r433)
@@ -1,8 +1,9 @@
<?php

-/* Copyright 2007
+/* Copyright 2007-2009
* - Mélanie Bats <melanie POINT bats CHEZ utbm POINT fr>
* - Thomas Petazzoni <thomas POINT petazzoni CHEZ enix POINT org>
+ * - Loic Dayot <ldayot CHEZ ouvaton 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
@@ -18,11 +19,9 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
- *
- * $Id: top.inc.php,v 1.51 2007/03/10 16:22:12 ldayot Exp $
*/

-include("bd.inc.php");
+include("class.bd.inc.php");
include("funcs.inc.php");

function list_events($events)

Modified: branches/dui/lugtextlist.php
==============================================================================
--- branches/dui/lugtextlist.php Sun Mar 1 18:44:53 2009 (r432)
+++ branches/dui/lugtextlist.php Sun Mar 1 18:46:08 2009 (r433)
@@ -1,7 +1,7 @@
<?php
/* Copyright 2008-2009
* - Thomas Petazzoni <thomas POINT petazzoni CHEZ enix POINT org>
- * - Loic Dayot
+ * - Loic Dayot <ldayot CHEZ ouvaton 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
@@ -19,8 +19,7 @@
* 02111-1307, USA.
*/

-include("bd.inc.php");
-include("bd-private.inc.php");
+include("class.bd.inc.php");
include("funcs.inc.php");

$db = new db();

Modified: branches/dui/map.php
==============================================================================
--- branches/dui/map.php Sun Mar 1 18:44:53 2009 (r432)
+++ branches/dui/map.php Sun Mar 1 18:46:08 2009 (r433)
@@ -1,8 +1,9 @@
<?php

-/* Copyright 2004-2006
+/* Copyright 2004-2009
* - Mélanie Bats <melanie POINT bats CHEZ utbm POINT fr>
* - Thomas Petazzoni <thomas POINT petazzoni CHEZ enix POINT org>
+ * - Loic Dayot <ldayot CHEZ ouvaton 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
@@ -18,15 +19,11 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
- *
- * $Id: top.inc.php,v 1.51 2007/03/10 16:22:12 ldayot Exp $
*/

-include("bd.inc.php");
-include("bd-private.inc.php");
+include("class.bd.inc.php");
include("funcs.inc.php");

-
$db = new db();

calendar_setlocale();

Modified: branches/dui/moderatetags.php
==============================================================================
--- branches/dui/moderatetags.php Sun Mar 1 18:44:53 2009 (r432)
+++ branches/dui/moderatetags.php Sun Mar 1 18:46:08 2009 (r433)
@@ -1,5 +1,5 @@
<?php
-/* Copyright 2004-2007
+/* Copyright 2004-2009
* - Loic Dayot <ldayot CHEZ ouvaton POINT org>
*
* This program is free software; you can redistribute it and/or
@@ -20,10 +20,10 @@
* $Id: top.inc.php,v 1.51 2007/03/10 16:22:12 ldayot Exp $
*/

-include("bd.inc.php");
+include("class.bd.inc.php");
include("funcs.inc.php");
-include("session.inc.php");
-include("user.inc.php");
+include("class.session.inc.php");
+include("class.user.inc.php");

$db = new db();
$user = new user($db);

Modified: branches/dui/moderation-howto.php
==============================================================================
--- branches/dui/moderation-howto.php Sun Mar 1 18:44:53 2009 (r432)
+++ branches/dui/moderation-howto.php Sun Mar 1 18:46:08 2009 (r433)
@@ -20,7 +20,7 @@
* 02111-1307, USA.
*/

-include("bd.inc.php");
+include("class.bd.inc.php");
include("bd-private.inc.php");
include("funcs.inc.php");


Modified: branches/dui/moderation.php
==============================================================================
--- branches/dui/moderation.php Sun Mar 1 18:44:53 2009 (r432)
+++ branches/dui/moderation.php Sun Mar 1 18:46:08 2009 (r433)
@@ -20,10 +20,10 @@
*/

include("text.inc.php");
-include("bd.inc.php");
+include("class.bd.inc.php");
include("funcs.inc.php");
-include("session.inc.php");
-include("user.inc.php");
+include("class.session.inc.php");
+include("class.user.inc.php");

$db = new db();
$user = new user($db);
@@ -40,7 +40,9 @@

echo "<p style=\"font-weight: bold; text-align:
center;\">Mod&eacute;rateurs, merci de lire et de tenir compte des <a
href=\"moderation-howto.php\">recommandations de mod&eacute;ration</a>.</p>";

-$ret = $db->query ("select id, title, start_time, end_time, datediff(now(),
submission_time) as waiting_time, city, region from events where moderated=0
order by start_time");
+$ret = $db->query ("select id, title, start_time, end_time, datediff(now(),
".
+ "submission_time) as waiting_time, city, region from events ".
+ "where moderated=0 order by start_time");

if ($ret == FALSE)
{

Modified: branches/dui/passgen.php
==============================================================================
--- branches/dui/passgen.php Sun Mar 1 18:44:53 2009 (r432)
+++ branches/dui/passgen.php Sun Mar 1 18:46:08 2009 (r433)
@@ -22,7 +22,7 @@
* $Id: top.inc.php,v 1.51 2007/03/10 16:22:12 ldayot Exp $
*/

-include("bd.inc.php");
+include("class.bd.inc.php");
include("funcs.inc.php");

put_header("Génération du mot de passe");

Modified: branches/dui/regionimage.php
==============================================================================
--- branches/dui/regionimage.php Sun Mar 1 18:44:53 2009 (r432)
+++ branches/dui/regionimage.php Sun Mar 1 18:46:08 2009 (r433)
@@ -1,6 +1,6 @@
<?php

-/* Copyright 2004-2007
+/* Copyright 2004-2009
* - Mélanie Bats <melanie POINT bats CHEZ utbm POINT fr>
* - Thomas Petazzoni <thomas POINT petazzoni CHEZ enix POINT org>
* - Loic Dayot <ldayot CHEZ ouvaton POINT org>
@@ -19,11 +19,9 @@
* 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("bd-private.inc.php");
+include("class.bd.inc.php");
include("funcs.inc.php");

function generate_event_count($db, $img)

Modified: branches/dui/rejectevent.php
==============================================================================
--- branches/dui/rejectevent.php Sun Mar 1 18:44:53 2009 (r432)
+++ branches/dui/rejectevent.php Sun Mar 1 18:46:08 2009 (r433)
@@ -1,7 +1,8 @@
<?php

-/* Copyright 2008
+/* Copyright 2008-2009
* - Thomas Petazzoni <thomas POINT petazzoni CHEZ enix POINT org>
+ * - Loic Dayot <ldayot CHEZ ouvaton 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
@@ -20,12 +21,12 @@
*/

include("text.inc.php");
-include("bd.inc.php");
+include("class.bd.inc.php");
include("funcs.inc.php");
-include("user.inc.php");
-
+include("class.user.inc.php");
+include("class.session.inc.php");
+include("class.event.inc.php");
$db = new db();
-include("session.inc.php");
$user = new user($db);

if (isset($_POST['__event_rejection_cancel']))
@@ -39,34 +40,40 @@

$id = get_safe_integer('id', 0);

- if ($_POST['reason'] == "out-of-subject")
- $reason = wordwrap($GLOBALS["adl_notrelated_message"]);
- else if ($_POST['reason'] == "not-enough-infos")
- $reason = wordwrap($GLOBALS["adl_notenough_message"]);
- else if ($_POST['reason'] == "duplicate")
- $reason = wordwrap($GLOBALS["adl_double_message"]);
- else if ($_POST['reason'] == "custom")
- $reason = wordwrap("Toutefois, votre &eacute;v&egrave;nement n'a pour le
moment pas retenu l'attention des mod&eacute;rateurs, pour la raison suivante
: " . stripslashes($_POST['customtext']));
-
- $row = fetch_event($db, $id);
- if (! $row)
- exit;
-
- $sql = "delete from events where id=" . $db->quote_smart($id);
-
- $ret = $db->query ($sql);
- if ($ret == FALSE)
+ switch ($_POST['reason'])
+ {
+ case "out-of-subject" :
+ $reason = wordwrap($GLOBALS["adl_notrelated_message"]); break;
+ case "not-enough-infos" :
+ $reason = wordwrap($GLOBALS["adl_notenough_message"]); break;
+ case "duplicate" :
+ $reason = wordwrap($GLOBALS["adl_double_message"]); break;
+ case "custom" :
+ $reason = wordwrap("Toutefois, votre &eacute;v&egrave;nement n'a".
+ " pour le moment pas retenu l'attention des mod&eacute;rateurs,".
+ " pour la raison suivante : " . stripslashes($_POST['customtext']));
+ break;
+ }
+ $event = new event($db, $id);
+ if ($event->error)
{
- error ("La requ&ecirc;te <i>" . $sql . "</i> a &eacute;chou&eacute;");
- return -1;
+ put_header("Rejet d'un &eacute;v&egrave;nement");
+ error($event->message);
+ put_footer();
+ exit;
}
-
- $row = mysql_fetch_object($ret);
- $row->tags = eventTagsList($row->id);
- $sql = "delete from events where id=" . $db->quote_smart($id);
+
+ $event->delete();
+ if ($event->error)
+ {
+ put_header("Rejet d'un &eacute;v&egrave;nement");
+ error($event->message);
+ put_footer();
+ exit;
+ }

/* Send email */
- calendar_mail ($row->submitter, $moderatorlist, "Évènement '" .
stripslashes($row->title) . "' refusé",
+ $mailBody =
"Bonjour,\n\n" .
"Vous avez soumis l'évènement suivant dans $adl_title, et nous\n" .
"vous remercions de cette contribution.\n\n" .
@@ -75,13 +82,13 @@
"à l'adresse ". $GLOBALS["moderatorlist"]. "." .
"\n\nPour rappel, voici le contenu de votre évènement:\n" .
"=====================================================\n" .
- 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, $row->tags) . "\n" .
+ $event->formatAscii() . "\n" .
"=====================================================\n\n" .
"Avec tous nos remerciements pour votre contribution,\n\n" .
- "-- \nL'équipe de modération");
+ "-- \nL'équipe de modération";
+ calendar_mail ($event->submitter, $moderatorlist,
+ "Évènement '" . stripslashes($event->title) . "' refusé",
+ $mailBody);

header("Location: moderation.php");
exit;
@@ -91,10 +98,10 @@

put_header("Rejet d'un &eacute;v&egrave;nement");

-$event = fetch_event($db, $id);
-if (! $event)
+$event = new event($db, $id);
+if ($event->error)
{
- echo "<p>Pas d'&eacute;v&egrave;nement avec cet ID</p>";
+ error($event->message);
put_footer();
exit;
}
@@ -127,11 +134,7 @@
echo '</div>';

echo '<div class="moderationbox">';
-echo format_event ($db, $event->title, strtotime($event->start_time),
- strtotime($event->end_time), $event->description,
- $event->city, $event->region, $event->locality,
- $event->url, $event->contact, $event->submitter,
- eventTagsList($event->id));
+echo $event->formatHTML();
echo '</div>';

put_footer();

Modified: branches/dui/showoneday.php
==============================================================================
--- branches/dui/showoneday.php Sun Mar 1 18:44:53 2009 (r432)
+++ branches/dui/showoneday.php Sun Mar 1 18:46:08 2009 (r433)
@@ -1,8 +1,9 @@
<?php

-/* Copyright 2004-2007
+/* Copyright 2004-2009
* - Mélanie Bats <melanie POINT bats CHEZ utbm POINT fr>
* - Thomas Petazzoni <thomas POINT petazzoni CHEZ enix POINT org>
+ * - Loic Dayot <ldayot CHEZ ouvaton 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
@@ -20,7 +21,7 @@
* 02111-1307, USA.
*/

-include("bd.inc.php");
+include("class.bd.inc.php");
include("funcs.inc.php");

$db = new db();

Modified: branches/dui/stats.php
==============================================================================
--- branches/dui/stats.php Sun Mar 1 18:44:53 2009 (r432)
+++ branches/dui/stats.php Sun Mar 1 18:46:08 2009 (r433)
@@ -23,7 +23,7 @@
* $Id: top.inc.php,v 1.51 2007/03/10 16:22:12 ldayot Exp $
*/

-include("bd.inc.php");
+include("class.bd.inc.php");
include("funcs.inc.php");

$db = new db();

Modified: branches/dui/tags.php
==============================================================================
--- branches/dui/tags.php Sun Mar 1 18:44:53 2009 (r432)
+++ branches/dui/tags.php Sun Mar 1 18:46:08 2009 (r433)
@@ -1,6 +1,6 @@
<?php

-/* Copyright 2007
+/* Copyright 2007-2009
* - Mélanie Bats <melanie POINT bats CHEZ utbm POINT fr>
* - Thomas Petazzoni <thomas POINT petazzoni CHEZ enix POINT org>
* - Loic Dayot <ldayot CHEZ ouvaton POINT org>
@@ -19,11 +19,9 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
- *
- * $Id: top.inc.php,v 1.51 2007/03/10 16:22:12 ldayot Exp $
*/

-include("bd.inc.php");
+include("class.bd.inc.php");
include("funcs.inc.php");

put_header("Mots-clés");
@@ -33,7 +31,10 @@
$db = new db();

// Build query to get tags and count of events
-$query = "SELECT tags.name as tag, COUNT(events.id) as nb FROM events LEFT
JOIN tags_events ON event_id=events.id LEFT JOIN tags ON tags.id=tag_id WHERE
events.moderated=1 GROUP BY tags.id ORDER BY tags.name";
+$query = "SELECT tags.name as tag, COUNT(events.id) as nb FROM events".
+ " LEFT JOIN tags_events ON event_id=events.id".
+ " LEFT JOIN tags ON tags.id=tag_id".
+ " WHERE events.moderated=1 GROUP BY tags.id ORDER BY tags.name";
if (! $result = $db->query($query))
{
error ("<p>Erreur lors de la requête SQL.</p>");

Modified: branches/dui/text.inc.php
==============================================================================
--- branches/dui/text.inc.php Sun Mar 1 18:44:53 2009 (r432)
+++ branches/dui/text.inc.php Sun Mar 1 18:46:08 2009 (r433)
@@ -1,5 +1,5 @@
<?php
- /* Copyright 2007
+ /* Copyright 2007-2009
* - Melanie Bats <melanie POINT bats CHEZ utbm POINT fr>
* - Thomas Petazzoni <thomas POINT petazzoni CHEZ enix POINT org>
* - Loic Dayot <ldayot CHEZ ouvaton POINT org>
@@ -18,7 +18,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
- *
*/

// From funcs.inc.php
@@ -28,9 +27,9 @@
$adl_short_title = "Agenda de l'accès public internet";
$adl_all_region = "toutes les régions";

-$adl_url_contact = "mailto:jeudisepn-agenda CHEZ listes POINT pierrefitte93
POINT fr";
+$adl_url_contact = "mailto:agenda CHEZ listes POINT jeudisepn POINT org";

-$adl_mailto_moderates = "jeudisepn-agenda AT listes.pierrefitte93.fr";
+$adl_mailto_moderates = "agenda AT listes.jeudisepn.org";

$adl_form_description_guide = "<i>Les balises HTML autorisées sont ".
"&lt;p&gt;, &lt;b&gt;, &lt;i&gt;, &lt;ul&gt;, &lt;ol&gt;, &lt;li&gt;,
&lt;br/&gt;, &lt;a&gt;.".

Modified: branches/dui/textlist.php
==============================================================================
--- branches/dui/textlist.php Sun Mar 1 18:44:53 2009 (r432)
+++ branches/dui/textlist.php Sun Mar 1 18:46:08 2009 (r433)
@@ -1,6 +1,6 @@
<?php
header("Content-Type: text/plain; charset=utf-8");
-include("bd.inc.php");
+include("class.bd.inc.php");
include("funcs.inc.php");

calendar_setlocale();

Modified: branches/dui/upgrade.php
==============================================================================
--- branches/dui/upgrade.php Sun Mar 1 18:44:53 2009 (r432)
+++ branches/dui/upgrade.php Sun Mar 1 18:46:08 2009 (r433)
@@ -23,12 +23,12 @@
* $Id: top.inc.php,v 1.51 2007/03/10 16:22:12 ldayot Exp $
*/

-include("bd.inc.php");
+include("class.bd.inc.php");
include("funcs.inc.php");
include("diff.inc.php");

$db = new db();
-include("session.inc.php");
+include("class.session.inc.php");

put_header("Upgrade");


Modified: branches/dui/validateevent.php
==============================================================================
--- branches/dui/validateevent.php Sun Mar 1 18:44:53 2009 (r432)
+++ branches/dui/validateevent.php Sun Mar 1 18:46:08 2009 (r433)
@@ -1,7 +1,8 @@
<?php

-/* Copyright 2008
+/* Copyright 2008-2009
* - Thomas Petazzoni <thomas POINT petazzoni CHEZ enix POINT org>
+ * - Loic Dayot <ldayot A ouvaton 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
@@ -20,13 +21,13 @@
*/

include("text.inc.php");
-include("bd.inc.php");
-include("funcs.inc.php");
-include("session.inc.php");
-include("user.inc.php");
-
+include("class.bd.inc.php");
$db = new db();
+include("funcs.inc.php");
+include("class.session.inc.php");
+include("class.user.inc.php");
$user = new user($db);
+include("class.event.inc.php");

if (isset($_POST['__event_validation_cancel']))
{
@@ -41,58 +42,66 @@

/* Fetch contact email, in order to be able to send a confirmation
mail */
- $row = fetch_event($db, $id);
- if (! $row)
+ $event = new event($db, $id);
+ if ($event->error)
+ {
+ put_header("Validation d'un &eacute;v&egrave;nement");
+ error($event->message);
+ put_footer();
exit;
-
- $email = $row->contact;
- $title = $row->title;
- $secret = $row->secret;
- $link = calendar_absolute_url("showevent.php?id=".$id);
+ }
+
+ //$email = $event->contact;
+ //$title = $event->title;
+ //$secret = $event->secret;
+ $link = calendar_absolute_url("showevent.php?id=".$event->id);

/* Accept event */
- $sql = "UPDATE events SET moderated=1, decision_time=NOW() WHERE id=" .
$db->quote_smart($id);
+ $sql = "UPDATE events SET moderated=1, decision_time=NOW() WHERE id=".
+ $db->quote_smart($event->id);
$ret = $db->query ($sql);
if ($ret == FALSE)
{
+ put_header("Validation d'un &eacute;v&egrave;nement");
error ("La requ&ecirc;te <i>" . $sql . "</i> a &eacute;chou&eacute;");
+ put_footer();
exit;
}

/* Send email */
- calendar_mail ($row->submitter, $moderatorlist,
- "Évènement '" . $row->title . "' modéré",
+ $mailBody =
"Bonjour,\n\n" .
wordwrap("L'évènement que vous avez soumis a été modéré par " .
$user->get_name() .
".\nIl est maintenant visible dans l'Agenda à l'adresse :\n") . $link .
"\n\n" .
wordwrap("Vous pouvez le modifier ultéreurement pour y ajouter des
précisions en vous rendant à l'adresse :\n") .
- " " . calendar_absolute_url("editevent.php?id=" . $id . "&secret=" .
$secret) . "\n\n" .
- wordwrap("Vous pouvez également l'annuler en vous rendant à l'adresse
:\n") .
- " " . calendar_absolute_url("cancelevent.php?id=" . $id . "&secret=" .
$secret) . "\n\n" .
+ " " . calendar_absolute_url("editevent.php?id=" . $event->id .
"&secret=" . $event->secret) . "\n\n" .
+ wordwrap("Vous pouvez égaletment l'annuler en vous rendant à l'adresse
:\n") .
+ " " . calendar_absolute_url("cancelevent.php?id=" . $event->id .
"&secret=" . $event->secret) . "\n\n" .
"=====================================================\n" .
- 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,
eventTagsList($row->id)) . "\n" .
+ $event->formatAscii() . "\n" .
"=====================================================\n\n" .
"Merci de votre contribution à $adl_title et à bientôt !\n\n".
- "-- \nL'équipe de modération");
+ "-- \nL'équipe de modération";

- if ($row->submitter != $row->contact) {
- calendar_mail ($row->contact, $moderatorlist,
- "Évènement '" . $row->title . "' publié",
+ calendar_mail ($event->submitter, $moderatorlist,
+ "Évènement '" . $event->title . "' modéré",
+ $mailBody);
+
+ if ($event->submitter != $event->contact) {
+ $mailBody =
"Bonjour,\n\n" .
"Un évènement dont vous êtes le contact a été publié dans $adl_title" .
".\nIl est maintenant visible à l'adresse\n" . $link . "\n\n" .
"=====================================================\n" .
- 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, eventTagsList($row->id))
. "\n" .
+ $event->formatAscii() . "\n" .
"=====================================================\n\n" .
"*Nous vous invitons à déposer dorénavant vous-mêmes les événements à
publier sur l'agenda.*\n\n".
"À bientôt sur $adl_title.\n\n".
- "-- \nL'équipe de modération.");
+ "-- \nL'équipe de modération.";
+
+ calendar_mail ($event->contact, $moderatorlist,
+ "Évènement '" . $event->title . "' publié",
+ $mailBody);
}

header("Location: moderation.php");
@@ -103,7 +112,7 @@

put_header("Validation d'un &eacute;v&egrave;nement");

-$event = fetch_event($db, $id);
+$event = new event($db, $id);
if (! $event)
{
echo "<p>Pas d'&eacute;v&egrave;nement avec cet ID.</p>";
@@ -124,10 +133,11 @@

echo '<div class="moderationbox">';

-if ($event->locality)
+if ($event->locality >= 0)
{
echo '<p style="color: red; font-weight: bold; text-align: center;">';
- echo 'Attention, cet &eacute;v&egrave;nement est &agrave; port&eacute;e
nationale !';
+ echo "Attention, cet &eacute;v&egrave;nement est &agrave; port&eacute;e ".
+ $adl_locality[$event->locality]. " !";
echo '</p>';
}

@@ -139,11 +149,7 @@
echo '</div>';

echo '<div class="moderationbox">';
-echo format_event ($db, $event->title, strtotime($event->start_time),
- strtotime($event->end_time), $event->description,
- $event->city, $event->region, $event->locality,
- $event->url, $event->contact, $event->submitter,
- eventTagsList($id));
+echo $event->formatHTML($event);
echo '</div>';

put_footer();

Modified: branches/dui/xmllistevents.php
==============================================================================
--- branches/dui/xmllistevents.php Sun Mar 1 18:44:53 2009 (r432)
+++ branches/dui/xmllistevents.php Sun Mar 1 18:46:08 2009 (r433)
@@ -20,7 +20,7 @@
*/

include("text.inc.php");
-include("bd.inc.php");
+include("class.bd.inc.php");
include("funcs.inc.php");

if (! $_GET['tag'] || !ereg("^[a-z0-9\-]*$", $_GET['tag']))




  • [Devel] r433 - branches/dui, svn, 01/03/2009

Archives gérées par MHonArc 2.6.16.

Haut de le page