Rev 27 | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?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: bb_commun.fonct.php,v 1.2 2007/02/13 17:40:22 jp_milcent Exp $/*** Fonctions communes aux applications de Biblio Bota.** Contient des fonctions communes aux applications de Biblio Bota.**@package BiblioBota*@subpackage Fonctions//Auteur original :*@author Jean-Charles GRANGER <tela@vecteur.org>//Autres auteurs :*@author Jean-Pascal MILCENT <jpm@clapas.org>*@copyright Tela-Botanica 2000-2004*@version $Revision: 1.2 $ $Date: 2007/02/13 17:40:22 $// +------------------------------------------------------------------------------------------------------+*/// +------------------------------------------------------------------------------------------------------+// | ENTETE du PROGRAMME |// +------------------------------------------------------------------------------------------------------+// +------------------------------------------------------------------------------------------------------+// | LISTE de FONCTIONS |// +------------------------------------------------------------------------------------------------------+// string check_if_modif($table)// vérifie dans la table des modifications si une donnée// est sujette à modifications// entrées :// - string $table : nom de la table des modifs// - string $field_src : nom du champ source// - string $fiche_id : identifiant de la fiche// sortie :function check_if_modif($table, $tbl_src, $fiche_id){$query = 'SELECT * '.'FROM '.$table.' '.'WHERE B_MOD_TABLESRC = "'.$tbl_src.'" '.'AND B_MOD_FICHESRC = "'.$fiche_id.'"';$resu = mysql_query($query) or die ("<B>Erreur !!!</B> : la vérification des modifications a échoué... $query");$nb_resu = mysql_num_rows($resu);mysql_free_result($resu);return $nb_resu;}/*** La fonction remplaceEntiteHTLM() remplace des caractères par les entités html.** Cette fonction retourne un texte dans lequel touts les caractères correspondant* à des entités html sont remplacés par la valeur de l'entité, à l'exception* des caractères <, >, & et ".* Cela permet de remplacer toutes les entités dans une chaine contenant du html.**@param string la chaîne html à parsser.*@return string contient la chaîne html avec les entités intégrées.*/function remplaceEntiteHTLM($texte){$texte_retour = '';$tab_entites = get_html_translation_table(HTML_ENTITIES);unset($tab_entites['"']);unset($tab_entites['<']);unset($tab_entites['>']);unset($tab_entites['&']);$tab_entites[' & '] = ' & ';return strtr($texte, $tab_entites);}/*** Fonction fournissant une date au format français depuis une date Mysql** @param string la date au format Mysql* @return string la date au format français*/function donnerDateConviviale($chaine){if (preg_match('/^(\d{4})-(\d{2})$/',$chaine, $match)) {$annee = $match[1];$mois = $match[2];switch ($mois) {case '00' :$mois_sortie = '';break;case '01' :$mois_sortie = 'janvier';break;case '02' :$mois_sortie = 'février';break;case '03' :$mois_sortie = 'mars';break;case '04' :$mois_sortie = 'avril';break;case '05' :$mois_sortie = 'mai';break;case '06' :$mois_sortie = 'juin';break;case '07' :$mois_sortie = 'juillet';break;case '08' :$mois_sortie = 'août';break;case '09' :$mois_sortie = 'septembre';break;case '10' :$mois_sortie = 'octobre';break;case '11' :$mois_sortie = 'novembre';break;case '12' :$mois_sortie = 'décembre';break;}if ($mois_sortie != '') {return $mois_sortie.' '.$annee;} else {return $annee;}} else {return '?';}}/* +--Fin du code ----------------------------------------------------------------------------------------+** $Log: bb_commun.fonct.php,v $* Revision 1.2 2007/02/13 17:40:22 jp_milcent* Ajout d'une fonction pour formater de manière conviviale les dates Mysql.** Revision 1.1 2005/11/23 10:22:25 jp_milcent* Ajout au dépot de l'application BiblioBota.* Elle doit à terme migrer dans eFlore.** Revision 1.2 2005/05/17 10:10:08 jpm* Correction des bogues avant mise en ligne du site v4.** Revision 1.1 2004/09/14 11:12:50 jpm* Ajout des fonctions communes aux applications de BiblioBota.*** +-- Fin du code ----------------------------------------------------------------------------------------+*/?>