Subversion Repositories eFlore/Applications.bibliobota

Rev

Rev 2 | Rev 27 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2 Rev 19
1
<?php
1
<?php
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
3
// +------------------------------------------------------------------------------------------------------+
3
// +------------------------------------------------------------------------------------------------------+
4
// | PHP version 4.1                                                                                      |
4
// | PHP version 4.1                                                                                      |
5
// +------------------------------------------------------------------------------------------------------+
5
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +------------------------------------------------------------------------------------------------------+
7
// +------------------------------------------------------------------------------------------------------+
8
// | This library is free software; you can redistribute it and/or                                        |
8
// | This library is free software; you can redistribute it and/or                                        |
9
// | modify it under the terms of the GNU Lesser General Public                                           |
9
// | modify it under the terms of the GNU Lesser General Public                                           |
10
// | License as published by the Free Software Foundation; either                                         |
10
// | License as published by the Free Software Foundation; either                                         |
11
// | version 2.1 of the License, or (at your option) any later version.                                   |
11
// | version 2.1 of the License, or (at your option) any later version.                                   |
12
// |                                                                                                      |
12
// |                                                                                                      |
13
// | This library is distributed in the hope that it will be useful,                                      |
13
// | This library is distributed in the hope that it will be useful,                                      |
14
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
14
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
15
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
15
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
16
// | Lesser General Public License for more details.                                                      |
16
// | Lesser General Public License for more details.                                                      |
17
// |                                                                                                      |
17
// |                                                                                                      |
18
// | You should have received a copy of the GNU Lesser General Public                                     |
18
// | You should have received a copy of the GNU Lesser General Public                                     |
19
// | License along with this library; if not, write to the Free Software                                  |
19
// | License along with this library; if not, write to the Free Software                                  |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
21
// +------------------------------------------------------------------------------------------------------+
21
// +------------------------------------------------------------------------------------------------------+
22
// CVS : $Id: bb_commun.fonct.php,v 1.1 2005-11-23 10:22:25 jp_milcent Exp $
22
// CVS : $Id: bb_commun.fonct.php,v 1.2 2007-02-13 17:40:22 jp_milcent Exp $
23
/**
23
/**
24
* Fonctions communes aux applications de Biblio Bota.
24
* Fonctions communes aux applications de Biblio Bota.
25
*
25
*
26
* Contient des fonctions communes aux applications de Biblio Bota.
26
* Contient des fonctions communes aux applications de Biblio Bota.
27
*
27
*
28
*@package BiblioBota
28
*@package BiblioBota
29
*@subpackage Fonctions
29
*@subpackage Fonctions
30
//Auteur original :
30
//Auteur original :
31
*@author        Jean-Charles GRANGER <tela@vecteur.org>
31
*@author        Jean-Charles GRANGER <tela@vecteur.org>
32
//Autres auteurs :
32
//Autres auteurs :
33
*@author        Jean-Pascal MILCENT <jpm@clapas.org>
33
*@author        Jean-Pascal MILCENT <jpm@clapas.org>
34
*@copyright     Tela-Botanica 2000-2004
34
*@copyright     Tela-Botanica 2000-2004
35
*@version       $Revision: 1.1 $ $Date: 2005-11-23 10:22:25 $
35
*@version       $Revision: 1.2 $ $Date: 2007-02-13 17:40:22 $
36
// +------------------------------------------------------------------------------------------------------+
36
// +------------------------------------------------------------------------------------------------------+
37
*/
37
*/
38
 
38
 
39
// +------------------------------------------------------------------------------------------------------+
39
// +------------------------------------------------------------------------------------------------------+
40
// |                                            ENTETE du PROGRAMME                                       |
40
// |                                            ENTETE du PROGRAMME                                       |
41
// +------------------------------------------------------------------------------------------------------+
41
// +------------------------------------------------------------------------------------------------------+
42
 
42
 
43
 
43
 
44
// +------------------------------------------------------------------------------------------------------+
44
// +------------------------------------------------------------------------------------------------------+
45
// |                                           LISTE de FONCTIONS                                         |
45
// |                                           LISTE de FONCTIONS                                         |
46
// +------------------------------------------------------------------------------------------------------+
46
// +------------------------------------------------------------------------------------------------------+
47
 
47
 
48
// string check_if_modif($table)
48
// string check_if_modif($table)
49
// vérifie dans la table des modifications si une donnée
49
// vérifie dans la table des modifications si une donnée
50
// est sujette à modifications
50
// est sujette à modifications
51
// entrées :
51
// entrées :
52
// - string $table : nom de la table des modifs
52
// - string $table : nom de la table des modifs
53
// - string $field_src : nom du champ source
53
// - string $field_src : nom du champ source
54
// - string $fiche_id : identifiant de la fiche
54
// - string $fiche_id : identifiant de la fiche
55
// sortie : 
55
// sortie : 
56
function check_if_modif($table, $tbl_src, $fiche_id)
56
function check_if_modif($table, $tbl_src, $fiche_id)
57
{
57
{
58
    $query =    'SELECT * '.
58
    $query =    'SELECT * '.
59
                'FROM '.$table.' '.
59
                'FROM '.$table.' '.
60
                'WHERE B_MOD_TABLESRC = "'.$tbl_src.'" '.
60
                'WHERE B_MOD_TABLESRC = "'.$tbl_src.'" '.
61
                'AND B_MOD_FICHESRC = "'.$fiche_id.'"';
61
                'AND B_MOD_FICHESRC = "'.$fiche_id.'"';
62
    $resu = mysql_query($query) or die ("<B>Erreur !!!</B> : la vérification des modifications a échoué... $query");
62
    $resu = mysql_query($query) or die ("<B>Erreur !!!</B> : la vérification des modifications a échoué... $query");
63
    $nb_resu = mysql_num_rows($resu);
63
    $nb_resu = mysql_num_rows($resu);
64
    mysql_free_result($resu);
64
    mysql_free_result($resu);
65
    
65
    
66
    return $nb_resu;
66
    return $nb_resu;
67
}
67
}
68
/**
68
/**
69
* La fonction remplaceEntiteHTLM() remplace des caractères par les entités html.
69
* La fonction remplaceEntiteHTLM() remplace des caractères par les entités html.
70
*
70
*
71
* Cette fonction retourne un texte dans lequel touts les caractères correspondant
71
* Cette fonction retourne un texte dans lequel touts les caractères correspondant
72
* à des entités html sont remplacés par la valeur de l'entité, à l'exception
72
* à des entités html sont remplacés par la valeur de l'entité, à l'exception
73
* des caractères <, >, & et ".
73
* des caractères <, >, & et ".
74
* Cela permet de remplacer toutes les entités dans une chaine contenant du html.
74
* Cela permet de remplacer toutes les entités dans une chaine contenant du html.
75
*
75
*
76
*@param string la chaîne html à parsser.
76
*@param string la chaîne html à parsser.
77
*@return string contient la chaîne html avec les entités intégrées.
77
*@return string contient la chaîne html avec les entités intégrées.
78
*/
78
*/
79
function remplaceEntiteHTLM($texte)
79
function remplaceEntiteHTLM($texte)
80
{
80
{
81
    $texte_retour = '';
81
    $texte_retour = '';
82
    $tab_entites = get_html_translation_table(HTML_ENTITIES);
82
    $tab_entites = get_html_translation_table(HTML_ENTITIES);
83
    unset($tab_entites['"']);
83
    unset($tab_entites['"']);
84
    unset($tab_entites['<']);
84
    unset($tab_entites['<']);
85
    unset($tab_entites['>']);
85
    unset($tab_entites['>']);
86
    unset($tab_entites['&']);
86
    unset($tab_entites['&']);
87
    $tab_entites[' & '] = ' &amp; ';
87
    $tab_entites[' & '] = ' &amp; ';
88
    return strtr($texte, $tab_entites);
88
    return strtr($texte, $tab_entites);
89
}
89
}
-
 
90
 
-
 
91
/**
-
 
92
 * Fonction fournissant une date au format français depuis une date Mysql
-
 
93
 * 
-
 
94
 * @param string la date au format Mysql
-
 
95
 * @return string la date au format français
-
 
96
 */
-
 
97
function donnerDateConviviale($chaine)
-
 
98
{
-
 
99
	if (preg_match('/^(\d{4})-(\d{2})$/',$chaine, $match)) {
-
 
100
		$annee = $match[1];
-
 
101
		$mois = $match[2];
-
 
102
		switch ($mois) {
-
 
103
			case '01' :
-
 
104
				$mois_sortie = 'janvier';
-
 
105
				break;
-
 
106
			case '02' :
-
 
107
				$mois_sortie = 'février';
-
 
108
				break;
-
 
109
			case '03' :
-
 
110
				$mois_sortie = 'mars';
-
 
111
				break;
-
 
112
			case '04' :
-
 
113
				$mois_sortie = 'avril';
-
 
114
				break;
-
 
115
			case '05' :
-
 
116
				$mois_sortie = 'mai';
-
 
117
				break;
-
 
118
			case '06' :
-
 
119
				$mois_sortie = 'juin';
-
 
120
				break;
-
 
121
			case '07' :
-
 
122
				$mois_sortie = 'juillet';
-
 
123
				break;
-
 
124
			case '08' :
-
 
125
				$mois_sortie = 'août';
-
 
126
				break;
-
 
127
			case '09' :
-
 
128
				$mois_sortie = 'septembre';
-
 
129
				break;
-
 
130
			case '10' :
-
 
131
				$mois_sortie = 'octobre';
-
 
132
				break;
-
 
133
			case '11' :
-
 
134
				$mois_sortie = 'novembre';
-
 
135
				break;
-
 
136
			case '12' :
-
 
137
				$mois_sortie = 'décembre';
-
 
138
				break;
-
 
139
		}
-
 
140
		return $mois_sortie.' '.$annee;
-
 
141
	} else {
-
 
142
		return '?';
-
 
143
	}
-
 
144
}
90
/* +--Fin du code ----------------------------------------------------------------------------------------+
145
/* +--Fin du code ----------------------------------------------------------------------------------------+
91
*
146
*
92
* $Log: not supported by cvs2svn $
147
* $Log: not supported by cvs2svn $
-
 
148
* Revision 1.1  2005/11/23 10:22:25  jp_milcent
-
 
149
* Ajout au dépot de l'application BiblioBota.
-
 
150
* Elle doit à terme migrer dans eFlore.
-
 
151
*
93
* Revision 1.2  2005/05/17 10:10:08  jpm
152
* Revision 1.2  2005/05/17 10:10:08  jpm
94
* Correction des bogues avant mise en ligne du site v4.
153
* Correction des bogues avant mise en ligne du site v4.
95
*
154
*
96
* Revision 1.1  2004/09/14 11:12:50  jpm
155
* Revision 1.1  2004/09/14 11:12:50  jpm
97
* Ajout des fonctions communes aux applications de BiblioBota.
156
* Ajout des fonctions communes aux applications de BiblioBota.
98
*
157
*
99
*
158
*
100
* +-- Fin du code ----------------------------------------------------------------------------------------+
159
* +-- Fin du code ----------------------------------------------------------------------------------------+
101
*/
160
*/
102
?>
161
?>