Subversion Repositories eFlore/Archives.herbiers

Compare Revisions

Ignore whitespace Rev 5 → Rev 6

/trunk/applications/hb_rss/hb_rss.php
New file
0,0 → 1,136
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: hb_rss.php,v 1.1 2006-10-30 18:57:17 jp_milcent Exp $
/**
* Générateur de flux RSS pour les Herbiers
*
*@package bazar
//Auteur original :
*@author Florian SCHMITT <florian@ecole-et-nature.org>
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
*
*@copyright Tela-Botanica 2000-2006
*@version $Revision: 1.1 $
// +------------------------------------------------------------------------------------------------------+
*/
 
//==================================== LES FLUX RSS==================================
// Constantes liées aux flux RSS
//==================================================================================
define('HBR_CREER_FICHIERS_XML',0);//0=ne cree pas le fichier XML dans rss/; 1=cree le fichier XML dans rss/
define('HBR_RSS_NOMSITE','tela-botanica.org');//Nom du site indiqué dans les flux rss
define('HBR_RSS_ADRESSESITE','http://www.tela-botanica.org');//Adresse Internet du site indiqué dans les flux rss
define('HBR_RSS_DESCRIPTIONSITE','www.tela-botanica.org, pour mutualiser l\'information sur les Herbiers.'); //Description du site indiquée dans les flux rss
define('HBR_RSS_LOGOSITE','http://www.tela-botanica.org/sites/commun/generique/images/logos/logo_tela_ombre.png');//Logo du site indiqué dans les flux rss
define('HBR_RSS_MANAGINGEDITOR', 'accueil@tela-botanica.org') ;//Managing editor du site
define('HBR_RSS_WEBMASTER', 'jpm@tela-botanica.org') ; //Mail Webmaster du site
define('HBR_RSS_CATEGORIE', 'Botanique, Herbiers'); //catégorie du flux RSS
// TODO : à mettre dans le fichier de langue
define('HBR_PAS_D_ANNONCES', 'Pas d\'annonce'); //Message pas d'annonce
 
if (isset($_GET['type'])) {
$annonce = $_GET['type'];
} else {
$annonce = '';
}
 
if (isset($_GET['nbitem'])) {
$nbitem = $_GET['nbitem'];
} else {
$nbitem = '';
}
 
 
 
echo html_entity_decode(gen_RSS($annonce, $nbitem));
 
 
/** gen_RSS() - generer un fichier de flux RSS par type d'annonce
*
* @param string Le type de l'annonce (laisser vide pour tout type d'annonce)
* @param integer Le nombre d'annonces a regrouper dans le fichier XML (laisser vide pour toutes)
* @param integer L'identifiant de l'emetteur (laisser vide pour tous)
* @param integer L'etat de validation de l'annonce (laisser 1 pour les annonces validees, 0 pour les non-validees)
* @param string La requete SQL personnalisee
* @param integer La categorie des fiches bazar
*
* @return string Le code du flux RSS
*/
function gen_RSS($typeannonce='', $nbitem='') {
// Generation de la requete MySQL personnalisee
$requete = 'SELECT DISTINCT * '.
'FROM HERBIERS_ORGANISATION '.
'ORDER BY DATE_DERNIERE_MODIF DESC';
if ($nbitem!='') {
$requete .= ' LIMIT 0,'.$nbitem;
}
$resultat = $GLOBALS['_HERBIER_']['bdd']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
// Initialisation des variables
$nomflux = 'Flux des '.$typeannonce;
// En-tete du flux RSS version 2.0
$xml = '<?xml version="1.0" encoding="ISO-8859-1"?>'."\n".'<rss version="2.0">'."\n";
$xml .= '<channel>'."\n".'<title>'.$nomflux.'</title>'."\n".'<link>'.HBR_RSS_ADRESSESITE.'</link>'."\n";
$xml .= '<description>'.HBR_RSS_DESCRIPTIONSITE.'</description>'."\n".'<language>fr-FR</language>'."\n".
'<copyright>Copyright 2005 '.HBR_RSS_NOMSITE.'</copyright>'."\n";
// Ajout de la date actuelle de publication (suivant la DTD RSS)
$xml .= '<lastBuildDate>'.strftime('%d %b %Y %H:%M:%S GMT').'</lastBuildDate>'."\n";
// En-tete suite et fin
$xml .= '<docs>http://www.stervinou.com/projets/rss/</docs>'."\n".'<category>'.HBR_RSS_CATEGORIE.'</category>'."\n".
'<managingEditor>'.HBR_RSS_MANAGINGEDITOR.'</managingEditor>'."\n".'<webMaster>'.HBR_RSS_WEBMASTER.'</webMaster>'."\n";
$xml .= '<ttl>60</ttl>'."\n".'<image>'."\n".'<title>'.HBR_RSS_NOMSITE.'</title>'."\n".'<url>'.HBR_RSS_LOGOSITE.'</url>'."\n".
'<link>'.HBR_RSS_ADRESSESITE.'</link>'."\n".'</image>'."\n";
if ($resultat->numRows() > 0) {
// Creation des items : titre + lien + description + date de publication
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$xml .= '<item>'."\n";
$xml .= '<title>'.$ligne['INSTITUTION_NAME'].'</title>'."\n";
$lien = sprintf(HB_URL_COURANTE_CONSULTATION_FICHE_HERBIER_ID, $ligne['ID_ORG']);
$xml .= '<link>'.str_replace('&', '&amp;', $lien).'</link>'."\n";
$xml .= '<description>'."\n".'<![CDATA[' ;
$xml .= $ligne['ZIP'] ;
$xml .= ']]>'."\n".'</description>'."\n";
$xml .= '<pubDate>'.strftime('%d %b %Y %H:%M:%S GMT',strtotime($ligne['DATE_DERNIERE_MODIF'])).'</pubDate>'."\n";
$xml .= '</item>'."\n";
}
} else {//pas d'annonces
$xml .= '<item>'."\n";
$xml .= '<title>'.HBR_PAS_D_ANNONCES.'</title>'."\n";
$xml .= '<link>#</link>'."\n";
$xml .= '<description>'.HBR_PAS_D_ANNONCES.'</description>'."\n";
$xml .= '<pubDate>'.strftime('%d %b %Y %H:%M:%S GMT',strtotime('12/12/2004')).'</pubDate>'."\n";
$xml .= '</item>'."\n";
}
$xml .= '</channel>'."\n".'</rss>'."\n";
return $xml;
}
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
 
?>
/trunk/herbier.php
21,7 → 21,7
// | along with Foobar; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: herbier.php,v 1.2 2006-09-22 09:19:28 jp_milcent Exp $
// CVS : $Id: herbier.php,v 1.3 2006-10-30 18:57:17 jp_milcent Exp $
/**
* Application Herbier
*
38,7 → 38,7
//Autres auteurs :
*@author Jean-Pascal MILCENT <jpm@clapas.org>
*@copyright Tela-Botanica 2000-2005
*@version $Revision: 1.2 $ $Date: 2006-09-22 09:19:28 $
*@version $Revision: 1.3 $ $Date: 2006-10-30 18:57:17 $
// +------------------------------------------------------------------------------------------------------+
*/
 
45,10 → 45,18
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
// +------------------------------------------------------------------------------------------------------+
// Gestion du chemin de l'application et de son dossier de configuration
/** Constante "dynamique" stockant le chemin absolue de base de l'application recherche de plante.*/
define('HB_CHEMIN_APPLI', dirname(realpath(__FILE__)).GEN_SEP);
/** Constante "dynamique" stockant le chemin relatif de base de l'application recherche de plante.*/
define('HB_CHEMIN_APPLI_RELATIF', str_replace($_SERVER['DOCUMENT_ROOT'], '', HB_CHEMIN_APPLI));
/** Constante stockant le chemin vers le dossier configuration.*/
define('HB_CHEMIN_CONFIG', HB_CHEMIN_APPLI.'configuration'.GEN_SEP);
/** Inclusion du fichier de configuration de la base de données de BiblioBota.*/
require_once GEN_CHEMIN_CLIENT.'herbier'.GEN_SEP.'configuration'.GEN_SEP.'hb_config_bdd.inc.php';
require_once HB_CHEMIN_CONFIG.'hb_config_bdd.inc.php';
/** Inclusion du fichier de configuration général de BiblioBota.*/
require_once GEN_CHEMIN_CLIENT.'herbier'.GEN_SEP.'configuration'.GEN_SEP.'hb_config.inc.php';
require_once HB_CHEMIN_CONFIG.'hb_config.inc.php';
 
/** Inclusion de l'API Débogage */
require_once HB_CHEMIN_API_DEBOGAGE.'BOG_sql.fonct.php';
57,7 → 65,7
/** Inclusion de la classe PEAR d'abstraction de base de donnée. */
require_once HB_CHEMIN_API_PEAR.'DB.php';
/** Inclusion de la classe PEAR de gestion des URL. */
require_once HB_CHEMIN_API_PEAR.'Net/URL.php';
require_once HB_CHEMIN_API_PEAR.'Net'.GEN_SEP.'URL.php';
/** Inclusion du fichier de configuration des url de BiblioBota.*/
require_once HB_CHEMIN_CONFIG.'hb_config_url.inc.php';
 
217,6 → 225,10
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.2 2006/09/22 09:19:28 jp_milcent
* Utilisation de mysql_connect et mysql_select_db suite à disfonctionnement.
* Amélioration de la gestion des chemins des fichiers inclus.
*
* Revision 1.1 2005/11/23 10:32:32 jp_milcent
* Ajout au dépot de l'application Herbiers.
* Elle doit à terme migrer dans eFlore.
/trunk/configuration/hb_config.inc.php
21,7 → 21,7
// | along with Foobar; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: hb_config.inc.php,v 1.2 2006-09-22 09:19:14 jp_milcent Exp $
// CVS : $Id: hb_config.inc.php,v 1.3 2006-10-30 18:57:17 jp_milcent Exp $
/**
* Configuration générale des applications de Herbier
*
35,7 → 35,7
//Autres auteurs :
*@author Jean-Pascal MILCENT <jpm@clapas.org>
*@copyright Tela-Botanica 2000-2005
*@version $Revision: 1.2 $ $Date: 2006-09-22 09:19:14 $
*@version $Revision: 1.3 $ $Date: 2006-10-30 18:57:17 $
// +------------------------------------------------------------------------------------------------------+
*/
 
94,7 → 94,7
/** Constante stockant le chemin absolu du dossier racine de l'application.*/
define('HB_CHEMIN_ABSO_RACINE', PAP_CHEMIN_RACINE.GEN_CHEMIN_CLIENT.'herbier'.GEN_SEP);
/** Constante stockant le chemin du dossier contenant les applications spécifiques de Herbier.*/
define('HB_CHEMIN_APPLI', HB_CHEMIN_RACINE.'applications'.GEN_SEP);
//define('HB_CHEMIN_APPLI', HB_CHEMIN_RACINE.'applications'.GEN_SEP);
/** Constante stockant le chemin absolu du dossier contenant les applications spécifiques de Herbier.*/
define('HB_CHEMIN_ABSO_APPLI', HB_CHEMIN_ABSO_RACINE.'applications'.GEN_SEP);
/** Constante stockant le chemin du dossier contenant les traductions générales.*/
156,6 → 156,9
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.2 2006/09/22 09:19:14 jp_milcent
* Ajout de constantes de chemin.
*
* Revision 1.1 2005/11/23 10:32:32 jp_milcent
* Ajout au dépot de l'application Herbiers.
* Elle doit à terme migrer dans eFlore.
/trunk/herbier_rss.php
New file
0,0 → 1,76
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: herbier_rss.php,v 1.1 2006-10-30 18:57:17 jp_milcent Exp $
/**
* Générateur de flux RSS pour les Herbiers
*
*@package bazar
//Auteur original :
*@author Florian SCHMITT <florian@ecole-et-nature.org>
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
*
*@copyright Tela-Botanica 2000-2006
*@version $Revision: 1.1 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
// Pour une utilisation hors de Papyrus
if (!defined('PAP_VERSION')) {
 
// Redéfini le séparateur utilisé lorsque PHP génère des URLs pour séparer les arguments. (compatible XHTML strict)
ini_set('arg_separator.output', '&amp;');
define('GEN_SEP', DIRECTORY_SEPARATOR);
define('PAP_CHEMIN_RACINE', dirname(realpath(__FILE__)).GEN_SEP.'..'.GEN_SEP.'..'.GEN_SEP);
define('GEN_CHEMIN_API', PAP_CHEMIN_RACINE.'api'.GEN_SEP);
define('GEN_CHEMIN_CLIENT', PAP_CHEMIN_RACINE.'client'.GEN_SEP);
define('PAP_CHEMIN_API_PEAR', GEN_CHEMIN_API.'pear'.GEN_SEP);
$GLOBALS['_GEN_commun']['i18n'] = 'fr';
$GLOBALS['_DEBOGAGE_'] = '';
//session_name('herbier_rss_beta');
//session_start();
//$expiration = 60*60*60;
//setcookie(session_name(),session_id(), time()+$expiration, '/');
}
 
// Nous spécifions l'application à appeler.
if (!isset($_REQUEST['appli'])) {
$_REQUEST['appli'] = 'hb_rss';
}
 
// +------------------------------------------------------------------------------------------------------+
// | CORPS du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
/** Inclusion du fichier principal de Herbier.*/
require_once 'herbier.php';
echo afficherContenuCorps();
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
 
?>