Subversion Repositories Sites.tela-botanica.org

Rev

Rev 463 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 463 Rev 499
1
<?php
1
<?php
2
 
2
 
3
//vim: set expandtab tabstop=4 shiftwidth=4: 
3
//vim: set expandtab tabstop=4 shiftwidth=4: 
4
// +-----------------------------------------------------------------------------------------------+
4
// +-----------------------------------------------------------------------------------------------+
5
// | PHP version 4.0                                                                               |
5
// | PHP version 4.0                                                                               |
6
// +-----------------------------------------------------------------------------------------------+
6
// +-----------------------------------------------------------------------------------------------+
7
// | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group                                      |
7
// | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group                                      |
8
// +-----------------------------------------------------------------------------------------------+
8
// +-----------------------------------------------------------------------------------------------+
9
// | This source file is subject to version 2.0 of the PHP license,                                | 
9
// | This source file is subject to version 2.0 of the PHP license,                                | 
10
// | that is bundled with this package in the file LICENSE, and is                                 |
10
// | that is bundled with this package in the file LICENSE, and is                                 |
11
// | available at through the world-wide-web at                                                    |
11
// | available at through the world-wide-web at                                                    |
12
// | http://www.php.net/license/2_02.txt.                                                          |
12
// | http://www.php.net/license/2_02.txt.                                                          |
13
// | If you did not receive a copy of the PHP license and are unable to                            |
13
// | If you did not receive a copy of the PHP license and are unable to                            |
14
// | obtain it through the world-wide-web, please send a note to                                   |
14
// | obtain it through the world-wide-web, please send a note to                                   |
15
// | license@php.net so we can mail you a copy immediately.                                        |
15
// | license@php.net so we can mail you a copy immediately.                                        |
16
// +-----------------------------------------------------------------------------------------------+
16
// +-----------------------------------------------------------------------------------------------+
17
/**
17
/**
18
*
18
*
19
*Page permettant l'affichage des informations de cartographie des inscrits
19
*Page permettant l'affichage des informations de cartographie des inscrits
20
*
20
*
21
*@package cartographie
21
*@package cartographie
22
//Auteur original :
22
//Auteur original :
23
*@author                Alexandre GRANIER <alexandre@tela-botanica.org>
23
*@author                Alexandre GRANIER <alexandre@tela-botanica.org>
24
//Autres auteurs :
24
//Autres auteurs :
25
*@copyright         Tela-Botanica 2000-2004
25
*@copyright         Tela-Botanica 2000-2004
26
*@version             03 mai 2004
26
*@version             03 mai 2004
27
// +-----------------------------------------------------------------------------------------------+
27
// +-----------------------------------------------------------------------------------------------+
28
//
28
//
29
// $Id: car_cartographie.fonct.php,v 1.4 2005/03/11 17:27:23 alex Exp $
29
// $Id: car_cartographie.fonct.php,v 1.4 2005/03/11 17:27:23 alex Exp $
30
// FICHIER : $RCSfile: car_cartographie.fonct.php,v $
30
// FICHIER : $RCSfile: car_cartographie.fonct.php,v $
31
// AUTEUR    : $Author: alex $
31
// AUTEUR    : $Author: alex $
32
// VERSION : $Revision: 1.4 $
32
// VERSION : $Revision: 1.4 $
33
// DATE        : $Date: 2005/03/11 17:27:23 $
33
// DATE        : $Date: 2005/03/11 17:27:23 $
34
*/
34
*/
35
 
35
 
36
/** function carto_texte_cocher ()
36
/** function carto_texte_cocher ()
37
*
37
*
38
*
38
*
39
*	@return string  HTML
39
*	@return string  HTML
40
*/
40
*/
41
 
41
 
42
function carto_texte_cocher () {
42
function carto_texte_cocher () {
43
    $res = '<p class="cocher">'.CAR_CHECK_UNCHECK ;
43
    $res = '<p class="cocher">'.CAR_CHECK_UNCHECK ;
44
    $res .= '&nbsp;<input type="checkbox" name="selecttotal" onclick="javascript:setCheckboxes(\'formmail\');" />'.
44
    $res .= '&nbsp;<input type="checkbox" name="selecttotal" onclick="javascript:setCheckboxes(\'formmail\');" />'.
45
			'</p>';
45
			'</p>';
46
    return $res ;
46
    return $res ;
47
}
47
}
48
/** function carto_formulaire ()
48
/** function carto_formulaire ()
49
*
49
*
50
*
50
*
51
*
51
*
52
*	@return string  HTML
52
*	@return string  HTML
53
*/
53
*/
54
function carto_formulaire ($titre_mail = '', $corps = '') {
54
function carto_formulaire ($titre_mail = '', $corps = '') {
55
    $res = '<div id="redaction">'."\n";
55
    $res = '<div id="redaction">'."\n";
56
    $res .= '<div id="redaction_tete"></div>'."\n";
56
    $res .= '<div id="redaction_tete"></div>'."\n";
57
    $res .= '<h2 class="chapo">'.CAR_ENVOYER_MAIL.'</h2>'."\n";
57
    $res .= '<h2 class="chapo">'.CAR_ENVOYER_MAIL.'</h2>'."\n";
58
    $res .= '<table id="formulaire_mail" border="0">'."\n".
58
    $res .= '<table id="formulaire_mail" border="0">'."\n".
59
			'	<tr>' .
59
			'	<tr>' .
60
			'		<td class="texte">'.CAR_SUJET.' :</td>'."\n".
60
			'		<td class="texte">'.CAR_SUJET.' :</td>'."\n".
61
			'		<td><input class="forml" type="text" name="titre_mail" size="60" value="'.$titre_mail.'" /></td>'."\n".
61
			'		<td><input class="forml" type="text" name="titre_mail" size="60" value="'.$titre_mail.'" /></td>'."\n".
62
			'	</tr>'."\n".
62
			'	</tr>'."\n".
63
			'	<tr>'."\n".
63
			'	<tr>'."\n".
64
			'		<td class="texte" valign="top">'.CAR_MESSAGE.'&nbsp;:&nbsp;</td>'."\n".
64
			'		<td class="texte" valign="top">'.CAR_MESSAGE.'&nbsp;:&nbsp;</td>'."\n".
65
			'		<td><textarea class="forml" name="corps" rows="5" cols="60">'.$corps.'</textarea></td>'."\n".
65
			'		<td><textarea class="forml" name="corps" rows="5" cols="60">'.$corps.'</textarea></td>'."\n".
66
			'	</tr>'."\n".
66
			'	</tr>'."\n".
67
			'	<tr>'."\n".
67
			'	<tr>'."\n".
68
			'		<td>&nbsp;</td>'."\n".
68
			'		<td>&nbsp;</td>'."\n".
69
			'		<td>';
69
			'		<td>';
70
    if (ereg('Gecko', $GLOBALS['HTTP_USER_AGENT'])) {
70
    if (ereg('Gecko', $GLOBALS['HTTP_USER_AGENT'])) {
71
        $res.= '<input class="spip_bouton" type="submit" value="'.CAR_ENVOYER.'" />';
71
        $res.= '<input class="spip_bouton" type="submit" value="'.CAR_ENVOYER.'" />';
72
    } else {
72
    } else {
73
        $res .= '<input class="spip_bouton" type="submit" onclick="javascript:confirmer();" value="'.CAR_ENVOYER.'" />';
73
        $res .= '<input class="spip_bouton" type="submit" onclick="javascript:confirmer();" value="'.CAR_ENVOYER.'" />';
74
    }
74
    }
75
    $res .=	'		</td>'."\n".
75
    $res .=	'		</td>'."\n".
76
    		'	</tr>'."\n".
76
    		'	</tr>'."\n".
77
    		'</table>'."\n".
77
    		'</table>'."\n".
78
    		'<div id="redaction_pied"/></div>'."\n".
78
    		'<div id="redaction_pied"/></div>'."\n".
79
    		'</div>'."\n".
79
    		'</div>'."\n".
80
    		'</form>'."\n";
80
    		'</form>'."\n";
81
    $res .= '<p class="attention surveillance">'.CAR_SURVEILLANCE.'</p>' ;
81
    $res .= '<p class="attention surveillance">'.CAR_SURVEILLANCE.'</p>' ;
82
    $res .= '<p class="information message_a_tous">'.sprintf(CAR_MESSAGE_A_TOUS, '<a href="'.CAR_URL_ACTUALITE.'">'.CAR_ACTUALITE.'</a>').'</p>' ;
82
    $res .= '<p class="information message_a_tous">'.sprintf(CAR_MESSAGE_A_TOUS, '<a href="'.CAR_URL_ACTUALITE.'">'.CAR_ACTUALITE.'</a>').'</p>' ;
83
    
83
    
84
    return $res ;
84
    return $res ;
85
}
85
}
86
 
86
 
87
/**
87
/**
88
 *  La fonction carto_getNbInscrits renvoit une phrase complete indiquant le 
88
 *  La fonction carto_getNbInscrits renvoit une phrase complete indiquant le 
89
 *  nombre d'inscrits dans zone passee en argument
89
 *  nombre d'inscrits dans zone passee en argument
90
 *  @param  string  identifiant de carte ex: europe
90
 *  @param  string  identifiant de carte ex: europe
91
 * @return string
91
 * @return string
92
 */
92
 */
93
 
93
 
94
function carto_ad_consulterNbreInscrits ($id_carte)
94
function carto_ad_consulterNbreInscrits ($id_carte)
95
{
95
{
96
    global $NOM_FICHIER;
96
    global $NOM_FICHIER;
97
    
97
    
98
    $titre_carte = carto_consulterTitreCarte($id_carte);
98
    $titre_carte = carto_consulterTitreCarte($id_carte);
99
    $type_zone_carte = carto_consulterTypeZoneCarte ($id_carte);
99
    $type_zone_carte = carto_consulterTypeZoneCarte ($id_carte);
100
    
100
    
101
    switch ($type_zone_carte){
101
    switch ($type_zone_carte){
102
        case '0' :
102
        case '0' :
103
            $requete =
103
            $requete =
104
                    ' SELECT count(u_id) as nbr'.
104
                    ' SELECT count(u_id) as nbr'.
105
                    ' FROM annuaire_tela'.
105
                    ' FROM annuaire_tela'.
106
                    ' WHERE u_french_dpt <> 999';
106
                    ' WHERE u_french_dpt <> 999';
107
                break;
107
                break;
108
        
108
        
109
        case '1' :
109
        case '1' :
110
            $requete =
110
            $requete =
111
                    ' SELECT count(u_id) as nbr'.
111
                    ' SELECT count(u_id) as nbr'.
112
                    ' FROM annuaire_tela, carto_PAYS'.
112
                    ' FROM annuaire_tela, carto_PAYS'.
113
                    ' WHERE u_country = cp_id_pays'.
113
                    ' WHERE u_country = cp_id_pays'.
114
                    ' AND cp_id_continent = "'.carto_consulterIdZoneGeoCarte ($id_carte).'"';
114
                    ' AND cp_id_continent = "'.carto_consulterIdZoneGeoCarte ($id_carte).'"';
115
                break;
115
                break;
116
        
116
        
117
        case '2' :
117
        case '2' :
118
            $requete = 
118
            $requete = 
119
                    ' SELECT count(u_id) as nbr'.
119
                    ' SELECT count(u_id) as nbr'.
120
                    ' FROM annuaire_tela'.
120
                    ' FROM annuaire_tela'.
121
                    ' WHERE u_french_dpt != "999"'.
121
                    ' WHERE u_french_dpt != "999"'.
122
                    ' AND u_country = "fr"';
122
                    ' AND u_country = "fr"';
123
                break;
123
                break;
124
    }
124
    }
125
    
125
    
126
    $resultat = mysql_query($requete) or die('
126
    $resultat = mysql_query($requete) or die('
127
            <H2 style="text-align: center; font-weight: bold; font-size: 26px;">Erreur de requête</H2>'.
127
            <H2 style="text-align: center; font-weight: bold; font-size: 26px;">Erreur de requête</H2>'.
128
            '<b>Nom du fichier : </b> '.$NOM_FICHIER.'<br/>'.
128
            '<b>Nom du fichier : </b> '.$NOM_FICHIER.'<br/>'.
129
            '<b>Nom fonction : </b> carto_ad_consulterNbreInscrits<br/>'.
129
            '<b>Nom fonction : </b> carto_ad_consulterNbreInscrits<br/>'.
130
            '<b>Requete : </b>'.$requete.
130
            '<b>Requete : </b>'.$requete.
131
            '<br/><br/><b>Erreur : </b>'.mysql_error());
131
            '<br/><br/><b>Erreur : </b>'.mysql_error());
132
    
132
    
133
    $ligne = mysql_fetch_object ($resultat) ;
133
    $ligne = mysql_fetch_object ($resultat) ;
134
    $res = '<h1 class="titre1_cartographie">'.$titre_carte.' : ' ;
134
    $res = '<h1 class="titre1_cartographie">'.$titre_carte.' : ' ;
135
    if ($ligne->nbr == 0) {
135
    if ($ligne->nbr == 0) {
136
        $res .= 'aucun inscrit' ;
136
        $res .= 'aucun inscrit' ;
137
    }
137
    }
138
    else if ($ligne->nbr == 1) {
138
    else if ($ligne->nbr == 1) {
139
        $res .= $ligne->nbr.' inscrit' ;
139
        $res .= $ligne->nbr.' inscrit' ;
140
    }
140
    }
141
    else {
141
    else {
142
        $res .= $ligne->nbr.' inscrits ';
142
        $res .= $ligne->nbr.' inscrits ';
143
    }
143
    }
144
    return $res.' &agrave; Tela Botanica</h1>' ;
144
    return $res.' &agrave; Tela Botanica</h1>' ;
145
}
145
}
146
 
146
 
147
/**
147
/**
148
 *  Envoie un email à tous les adhérents sélectionnés
148
 *  Envoie un email à tous les adhérents sélectionnés
149
 *
149
 *
150
 * @return  string  Renvoie le message 'votre message a été envoyé'
150
 * @return  string  Renvoie le message 'votre message a été envoyé'
151
 */
151
 */
152
 
152
 
153
function envoie_mail (&$db) {
153
function envoie_mail (&$db) {
154
    $res = "<h1 class=\"titre1_cartographie\">Votre message a &eacute;t&eacute; envoy&eacute;</div>\n" ;
154
    $res = "<h1 class=\"titre1_cartographie\">Votre message a &eacute;t&eacute; envoy&eacute;</div>\n" ;
155
    $requete = "select ".CAR_CHAMPS_MAIL." from ".CAR_ANNUAIRE.
155
    $requete = "select ".CAR_CHAMPS_MAIL." from ".CAR_ANNUAIRE.
156
            " where ".CAR_CHAMPS_ID."='".$GLOBALS['car_auth']->getAuthData (CAR_CHAMPS_ID)."'";
156
            " where ".CAR_CHAMPS_ID."='".$GLOBALS['car_auth']->getAuthData (CAR_CHAMPS_ID)."'";
157
    $resultat = $db->query($requete);
157
    $resultat = $db->query($requete);
158
    if (DB::isError($resultat)) {
158
    if (DB::isError($resultat)) {
159
        die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo());
159
        die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo());
160
    }
160
    }
161
    $ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
161
    $ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
162
    $entete = "From: <".$ligne[CAR_CHAMPS_MAIL].">\n";
162
    $entete = "From: <".$ligne[CAR_CHAMPS_MAIL].">\n";
163
    
163
    
164
    $_POST['corps'] .= CAR_TEXTE_FIN_MAIL;
164
    $_POST['corps'] .= CAR_TEXTE_FIN_MAIL;
165
    $_POST['corps'] = stripslashes($_POST['corps']) ;
165
    $_POST['corps'] = stripslashes($_POST['corps']) ;
166
    $liste = "" ;
166
    $liste = "" ;
167
    foreach ($_POST['select'] as $key => $value) {
167
    foreach ($_POST['select'] as $key => $value) {
168
        mail ($value, stripslashes($_POST['titre_mail']), $_POST['corps'], $entete) ;
168
        mail($value, stripslashes($_POST['titre_mail']), $_POST['corps'], $entete) ;
169
        $liste .= $value."\n" ;
169
        $liste .= $value."\n" ;
170
    }
170
    }
171
    
171
    
172
    $_POST['corps'] .= "\n----------------------------------------------------------------------------";
172
    $_POST['corps'] .= "\n----------------------------------------------------------------------------";
173
    $_POST['corps'] .= "\n".CAR_MESSAGE_APPLI."\n" ;
173
    $_POST['corps'] .= "\n".CAR_MESSAGE_APPLI."\n" ;
174
    $_POST['corps'] .= "\n".CAR_MESSAGE_ENVOYE_A.":\n $liste" ;
174
    $_POST['corps'] .= "\n".CAR_MESSAGE_ENVOYE_A.":\n $liste" ;
-
 
175
    
-
 
176
    // Envoie du message aux administrateurs
175
    
177
	foreach ($GLOBALS['mail_admin'] as $courriel) {
-
 
178
		if (!mail($courriel, stripslashes($_POST['titre_mail']), $_POST['corps'], $entete)) {
-
 
179
			trigger_error("Le courriel n'a pas été envoyé à : $courriel", E_USER_WANRNING);
-
 
180
		}
-
 
181
	}
-
 
182
    
176
    mail ("carto@tela-botanica.org", stripslashes($_POST['titre_mail']), $_POST['corps'], $entete);
183
    
177
    
184
    
178
    $_POST['corps']='';
185
    $_POST['corps']='';
179
    $_POST['titre_mail']='';
186
    $_POST['titre_mail']='';
180
    return $res ;
187
    return $res ;
181
}
188
}
182
 
189
 
183
//-- Fin du code source    ------------------------------------------------------------
190
//-- Fin du code source    ------------------------------------------------------------
184
/*
191
/*
185
* $Log: car_cartographie.fonct.php,v $
192
* $Log: car_cartographie.fonct.php,v $
186
* Revision 1.4  2005/03/11 17:27:23  alex
193
* Revision 1.4  2005/03/11 17:27:23  alex
187
* modification html
194
* modification html
188
*
195
*
189
* Revision 1.3  2005/03/11 17:24:39  alex
196
* Revision 1.3  2005/03/11 17:24:39  alex
190
* modification html
197
* modification html
191
*
198
*
192
* Revision 1.2  2005/03/11 15:18:45  alex
199
* Revision 1.2  2005/03/11 15:18:45  alex
193
* migration version 4
200
* migration version 4
194
*
201
*
195
* Revision 1.1  2004/11/30 13:37:19  tam
202
* Revision 1.1  2004/11/30 13:37:19  tam
196
* installation
203
* installation
197
*
204
*
198
* Revision 1.1.1.1  2004/11/23 17:48:17  tam
205
* Revision 1.1.1.1  2004/11/23 17:48:17  tam
199
* Importation
206
* Importation
200
*
207
*
201
* Revision 1.1  2004/11/23 17:30:13  tam
208
* Revision 1.1  2004/11/23 17:30:13  tam
202
* installation
209
* installation
203
*
210
*
204
*
211
*
205
*/
212
*/
206
?>
213
?>