| 720 | jpm | 1 | <?php
 | 
        
           |  |  | 2 |   | 
        
           |  |  | 3 | /*vim: set expandtab tabstop=4 shiftwidth=4: */
 | 
        
           |  |  | 4 | // +------------------------------------------------------------------------------------------------------+
 | 
        
           |  |  | 5 | // | PHP version 5.1                                                                                      |
 | 
        
           |  |  | 6 | // +------------------------------------------------------------------------------------------------------+
 | 
        
           |  |  | 7 | // | Copyright (C) 1999-2006 Tela Botanica (accueil@tela-botanica.org)                                    |
 | 
        
           |  |  | 8 | // +------------------------------------------------------------------------------------------------------+
 | 
        
           |  |  | 9 | // | This file is part of papyrus_bp.                                                                     |
 | 
        
           |  |  | 10 | // |                                                                                                      |
 | 
        
           |  |  | 11 | // | Foobar is free software; you can redistribute it and/or modify                                       |
 | 
        
           |  |  | 12 | // | it under the terms of the GNU General Public License as published by                                 |
 | 
        
           |  |  | 13 | // | the Free Software Foundation; either version 2 of the License, or                                    |
 | 
        
           |  |  | 14 | // | (at your option) any later version.                                                                  |
 | 
        
           |  |  | 15 | // |                                                                                                      |
 | 
        
           |  |  | 16 | // | Foobar is distributed in the hope that it will be useful,                                            |
 | 
        
           |  |  | 17 | // | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
 | 
        
           |  |  | 18 | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                        |
 | 
        
           |  |  | 19 | // | GNU General Public License for more details.                                                         |
 | 
        
           |  |  | 20 | // |                                                                                                      |
 | 
        
           |  |  | 21 | // | You should have received a copy of the GNU General Public License                                    |
 | 
        
           |  |  | 22 | // | along with Foobar; if not, write to the Free Software                                                |
 | 
        
           |  |  | 23 | // | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
 | 
        
           |  |  | 24 | // +------------------------------------------------------------------------------------------------------+
 | 
        
           |  |  | 25 | // CVS : $Id: syndication.php,v 1.11 2008-10-29 15:55:56 alexandre_tb Exp $
 | 
        
           |  |  | 26 | /**
 | 
        
           |  |  | 27 | * papyrus_bp - syndication.php
 | 
        
           |  |  | 28 | *
 | 
        
           |  |  | 29 | * Description :
 | 
        
           |  |  | 30 | *
 | 
        
           |  |  | 31 | *@package papyrus_bp
 | 
        
           |  |  | 32 | //Auteur original :
 | 
        
           |  |  | 33 | *@author        Grégoire Duché <gregoire@tela-botanica.org>
 | 
        
           |  |  | 34 | //Autres auteurs :
 | 
        
           |  |  | 35 | *@author        Aucun
 | 
        
           |  |  | 36 | *@copyright     Tela-Botanica 1999-2010
 | 
        
           |  |  | 37 | *@version       $Revision: 0.01 $ $Date: 2008-10-29 15:55:56 $
 | 
        
           |  |  | 38 | // +------------------------------------------------------------------------------------------------------+
 | 
        
           |  |  | 39 | */
 | 
        
           |  |  | 40 |   | 
        
           |  |  | 41 | // +------------------------------------------------------------------------------------------------------+
 | 
        
           |  |  | 42 | // |                                            ENTÊTE du PROGRAMME                                       |
 | 
        
           |  |  | 43 | // +------------------------------------------------------------------------------------------------------+
 | 
        
           |  |  | 44 | $GLOBALS['_GEN_commun']['info_applette_nom_fonction'] = 'afficherRechercheEflore';
 | 
        
           |  |  | 45 | $GLOBALS['_GEN_commun']['info_applette_balise'] = 	'\{\{[Rr]echercheEflore'.
 | 
        
           |  |  | 46 | 													'(?:\s*'.
 | 
        
           |  |  | 47 | 														'(?:'.
 | 
        
           |  |  | 48 | 															'(url="[^"]*")|'.
 | 
        
           |  |  | 49 | 															'(titre="[^"]*")|'.
 | 
        
           |  |  | 50 | 															'(nb="?\d+"?)|'.
 | 
        
           |  |  | 51 | 															'(tailledesc="?\d+"?)|'.
 | 
        
           |  |  | 52 | 															'(id="[^"]*")|'.
 | 
        
           |  |  | 53 | 															'(nbmax="?\d+"?)|'.
 | 
        
           |  |  | 54 | 															'(nouvellefenetre="?(?:0|1)"?)|'.
 | 
        
           |  |  | 55 | 															'(formatdate="[^"]*")|'.
 | 
        
           |  |  | 56 | 															'(formatdatepro="[^"]*")|'.
 | 
        
           |  |  | 57 | 															'(template=".*")|'.
 | 
        
           |  |  | 58 | 														')'.
 | 
        
           |  |  | 59 | 													')+'.
 | 
        
           |  |  | 60 | 													'\s*\}\}';
 | 
        
           |  |  | 61 |   | 
        
           |  |  | 62 | // +------------------------------------------------------------------------------------------------------+
 | 
        
           |  |  | 63 | /** Inclusion du fichier de configuration de cette application.*/
 | 
        
           | 960 | jpm | 64 | require_once GEN_CHEMIN_CLIENT.'recherche_eflore'.GEN_SEP.'configuration'.GEN_SEP.'config.inc.php';
 | 
        
           | 720 | jpm | 65 |   | 
        
           |  |  | 66 |   | 
        
           |  |  | 67 | // Inclusion des fichiers de traduction de l'applette SYND de Papyrus
 | 
        
           | 961 | jpm | 68 | if (file_exists(R_EFLORE_CHEMIN_LANGUE.'langue_'.$GLOBALS['_GEN_commun']['i18n'].'.inc.php')) {
 | 
        
           | 720 | jpm | 69 |     /** Inclusion du fichier de traduction suite à la transaction avec le navigateur.*/
 | 
        
           | 961 | jpm | 70 |     require_once R_EFLORE_CHEMIN_LANGUE.'langue_'.$GLOBALS['_GEN_commun']['i18n'].'.inc.php';
 | 
        
           | 720 | jpm | 71 | } else {
 | 
        
           |  |  | 72 |     /** Inclusion du fichier de traduction par défaut.*/
 | 
        
           | 961 | jpm | 73 |     require_once R_EFLORE_CHEMIN_LANGUE.'langue_'.R_EFLORE_I18N_DEFAUT.'.inc.php';
 | 
        
           | 720 | jpm | 74 | }
 | 
        
           |  |  | 75 |   | 
        
           |  |  | 76 | // +------------------------------------------------------------------------------------------------------+
 | 
        
           |  |  | 77 | // |                                            CORPS du PROGRAMME                                        |
 | 
        
           |  |  | 78 | // +------------------------------------------------------------------------------------------------------+
 | 
        
           |  |  | 79 | /** Fonction afficherRechercheEvenement() - Affiche un formulaire renvoyant vers
 | 
        
           |  |  | 80 | *
 | 
        
           |  |  | 81 | * Cette fonction retourne la liste des pages des sites syndiqués.
 | 
        
           |  |  | 82 | *
 | 
        
           |  |  | 83 | * @param  array contient les arguments de la fonction.
 | 
        
           |  |  | 84 | * @param  array  tableau global de Papyrus.
 | 
        
           |  |  | 85 | * @return string XHTML le formulaire de recherche dans Bazar.
 | 
        
           |  |  | 86 | */
 | 
        
           |  |  | 87 | function afficherRechercheEflore($tab_applette_arguments, $_GEN_commun)
 | 
        
           |  |  | 88 | {
 | 
        
           |  |  | 89 | 	// Initialisation des variables
 | 
        
           |  |  | 90 |     $sortie = '';
 | 
        
           |  |  | 91 | 	$string_arguments = "";
 | 
        
           |  |  | 92 |   | 
        
           |  |  | 93 | 	//+----------------------------------------------------------------------------------------------------------------+
 | 
        
           |  |  | 94 | 	// Gestion des arguments
 | 
        
           |  |  | 95 | 	$balise = $tab_applette_arguments[0];
 | 
        
           |  |  | 96 |     $tab_arguments = $tab_applette_arguments;
 | 
        
           |  |  | 97 |   | 
        
           |  |  | 98 | 	unset($tab_arguments[0]);
 | 
        
           |  |  | 99 |     foreach($tab_arguments as $argument) {
 | 
        
           |  |  | 100 |     	if ($argument != '') {
 | 
        
           |  |  | 101 | 	    		$string_arguments .= $argument;
 | 
        
           |  |  | 102 | 	    	$tab_parametres = explode('=', $argument, 2);
 | 
        
           |  |  | 103 | 	    	$options[$tab_parametres[0]] = trim($tab_parametres[1], '"');
 | 
        
           |  |  | 104 |     	}
 | 
        
           |  |  | 105 |     }
 | 
        
           |  |  | 106 |   | 
        
           |  |  | 107 |    //
 | 
        
           |  |  | 108 | 	//+----------------------------------------------------------------------------------------------------------------+
 | 
        
           |  |  | 109 |     // Gestion des erreurs de paramétrage
 | 
        
           |  |  | 110 | 	/*
 | 
        
           |  |  | 111 | 	 * FIXME : mettre un template paramétré
 | 
        
           |  |  | 112 | 	 * if (!isset($options['template'])) {
 | 
        
           |  |  | 113 | 		$options['template'] = SYND_CHEMIN_SQUELETTE.SYND_SQUELETTE_LISTE;
 | 
        
           |  |  | 114 | 	} else {
 | 
        
           |  |  | 115 | 		if (file_exists(SYND_CHEMIN_SQUELETTE.$options['template'])) {
 | 
        
           |  |  | 116 | 			$options['template'] = SYND_CHEMIN_SQUELETTE.$options['template'];
 | 
        
           |  |  | 117 | 		}
 | 
        
           |  |  | 118 | 	}*/
 | 
        
           |  |  | 119 |   | 
        
           |  |  | 120 | 	//+----------------------------------------------------------------------------------------------------------------+
 | 
        
           |  |  | 121 | 	// Gestion des squelettes
 | 
        
           |  |  | 122 | 	if (!isset($options['template'])) {
 | 
        
           | 961 | jpm | 123 | 		$options['template'] = R_EFLORE_CHEMIN_SQUELETTE."defaut.tpl.html";
 | 
        
           | 720 | jpm | 124 | 	} else {
 | 
        
           | 961 | jpm | 125 | 		if (file_exists(R_EFLORE_CHEMIN_SQUELETTE.$options['template'])) {
 | 
        
           |  |  | 126 | 			$options['template'] = R_EFLORE_CHEMIN_SQUELETTE.$options['template'];
 | 
        
           | 720 | jpm | 127 | 		}
 | 
        
           |  |  | 128 | 	}
 | 
        
           |  |  | 129 |   | 
        
           |  |  | 130 | 	//Gestion des paramètres de flore (passé sous la forme : http://url/||00)
 | 
        
           |  |  | 131 |   | 
        
           |  |  | 132 | 	foreach ($GLOBALS['_R_Eflore_']['flores'] as $flore=>$chaine_valeur)	{
 | 
        
           |  |  | 133 | 		unset($GLOBALS['_R_Eflore_']['flores'][$flore]);
 | 
        
           |  |  | 134 | 		$tab_valeur = explode("||", $chaine_valeur);
 | 
        
           |  |  | 135 | 		$tab_flore = array("nom" => $flore, "url" => str_replace("||", "?eflore_referentiel=", $chaine_valeur), "referentiel" => $tab_valeur[1]);
 | 
        
           |  |  | 136 | 		$GLOBALS['_R_Eflore_']['flores'][] = $tab_flore;
 | 
        
           |  |  | 137 |   | 
        
           |  |  | 138 | 	}
 | 
        
           |  |  | 139 |   | 
        
           |  |  | 140 | 	extract($GLOBALS['_R_Eflore_']);
 | 
        
           |  |  | 141 | 	// Demarre le buffer
 | 
        
           |  |  | 142 | 	ob_start();
 | 
        
           |  |  | 143 | 	// Inclusion du fichier
 | 
        
           |  |  | 144 | 	include($options['template']);
 | 
        
           |  |  | 145 | 	// Recuperer le  contenu du buffer
 | 
        
           |  |  | 146 | 	$sortie = ob_get_contents();
 | 
        
           |  |  | 147 | 	// Arrete et detruit le buffer
 | 
        
           |  |  | 148 | 	ob_end_clean();
 | 
        
           |  |  | 149 |   | 
        
           |  |  | 150 | 	//+----------------------------------------------------------------------------------------------------------------+
 | 
        
           |  |  | 151 | 	// Sortie
 | 
        
           |  |  | 152 |     return $sortie;
 | 
        
           |  |  | 153 | }
 | 
        
           |  |  | 154 |   | 
        
           | 640 | gduche | 155 | ?>
 |