87 |
alex |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
//vim: set expandtab tabstop=4 shiftwidth=4:
|
|
|
4 |
// +-----------------------------------------------------------------------------------------------+
|
|
|
5 |
// | PHP version 4.0 |
|
|
|
6 |
// +-----------------------------------------------------------------------------------------------+
|
|
|
7 |
// | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
|
|
|
8 |
// +-----------------------------------------------------------------------------------------------+
|
|
|
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 |
|
|
|
11 |
// | available at through the world-wide-web at |
|
|
|
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 |
|
|
|
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. |
|
|
|
16 |
// +-----------------------------------------------------------------------------------------------+
|
|
|
17 |
/**
|
|
|
18 |
*
|
|
|
19 |
*Page permettant l'affichage des informations de cartographie des inscrits
|
|
|
20 |
*
|
|
|
21 |
*@package cartographie
|
|
|
22 |
//Auteur original :
|
|
|
23 |
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
|
|
|
24 |
//Autres auteurs :
|
|
|
25 |
*@copyright Tela-Botanica 2000-2004
|
|
|
26 |
*@version 03 mai 2004
|
|
|
27 |
// +-----------------------------------------------------------------------------------------------+
|
|
|
28 |
//
|
|
|
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 $
|
|
|
31 |
// AUTEUR : $Author: alex $
|
|
|
32 |
// VERSION : $Revision: 1.4 $
|
|
|
33 |
// DATE : $Date: 2005/03/11 17:27:23 $
|
|
|
34 |
*/
|
|
|
35 |
|
|
|
36 |
/** function carto_texte_cocher ()
|
|
|
37 |
*
|
|
|
38 |
*
|
|
|
39 |
* @return string HTML
|
|
|
40 |
*/
|
|
|
41 |
|
|
|
42 |
function carto_texte_cocher () {
|
463 |
jpm |
43 |
$res = '<p class="cocher">'.CAR_CHECK_UNCHECK ;
|
|
|
44 |
$res .= ' <input type="checkbox" name="selecttotal" onclick="javascript:setCheckboxes(\'formmail\');" />'.
|
|
|
45 |
'</p>';
|
87 |
alex |
46 |
return $res ;
|
|
|
47 |
}
|
|
|
48 |
/** function carto_formulaire ()
|
|
|
49 |
*
|
|
|
50 |
*
|
|
|
51 |
*
|
|
|
52 |
* @return string HTML
|
|
|
53 |
*/
|
463 |
jpm |
54 |
function carto_formulaire ($titre_mail = '', $corps = '') {
|
|
|
55 |
$res = '<div id="redaction">'."\n";
|
|
|
56 |
$res .= '<div id="redaction_tete"></div>'."\n";
|
|
|
57 |
$res .= '<h2 class="chapo">'.CAR_ENVOYER_MAIL.'</h2>'."\n";
|
|
|
58 |
$res .= '<table id="formulaire_mail" border="0">'."\n".
|
|
|
59 |
' <tr>' .
|
|
|
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".
|
|
|
62 |
' </tr>'."\n".
|
|
|
63 |
' <tr>'."\n".
|
|
|
64 |
' <td class="texte" valign="top">'.CAR_MESSAGE.' : </td>'."\n".
|
|
|
65 |
' <td><textarea class="forml" name="corps" rows="5" cols="60">'.$corps.'</textarea></td>'."\n".
|
|
|
66 |
' </tr>'."\n".
|
|
|
67 |
' <tr>'."\n".
|
|
|
68 |
' <td> </td>'."\n".
|
|
|
69 |
' <td>';
|
|
|
70 |
if (ereg('Gecko', $GLOBALS['HTTP_USER_AGENT'])) {
|
|
|
71 |
$res.= '<input class="spip_bouton" type="submit" value="'.CAR_ENVOYER.'" />';
|
87 |
alex |
72 |
} else {
|
463 |
jpm |
73 |
$res .= '<input class="spip_bouton" type="submit" onclick="javascript:confirmer();" value="'.CAR_ENVOYER.'" />';
|
87 |
alex |
74 |
}
|
463 |
jpm |
75 |
$res .= ' </td>'."\n".
|
|
|
76 |
' </tr>'."\n".
|
|
|
77 |
'</table>'."\n".
|
|
|
78 |
'<div id="redaction_pied"/></div>'."\n".
|
|
|
79 |
'</div>'."\n".
|
|
|
80 |
'</form>'."\n";
|
|
|
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>' ;
|
|
|
83 |
|
87 |
alex |
84 |
return $res ;
|
|
|
85 |
}
|
|
|
86 |
|
|
|
87 |
/**
|
|
|
88 |
* La fonction carto_getNbInscrits renvoit une phrase complete indiquant le
|
|
|
89 |
* nombre d'inscrits dans zone passee en argument
|
|
|
90 |
* @param string identifiant de carte ex: europe
|
|
|
91 |
* @return string
|
|
|
92 |
*/
|
|
|
93 |
|
|
|
94 |
function carto_ad_consulterNbreInscrits ($id_carte)
|
|
|
95 |
{
|
|
|
96 |
global $NOM_FICHIER;
|
|
|
97 |
|
|
|
98 |
$titre_carte = carto_consulterTitreCarte($id_carte);
|
|
|
99 |
$type_zone_carte = carto_consulterTypeZoneCarte ($id_carte);
|
|
|
100 |
|
|
|
101 |
switch ($type_zone_carte){
|
|
|
102 |
case '0' :
|
|
|
103 |
$requete =
|
|
|
104 |
' SELECT count(u_id) as nbr'.
|
|
|
105 |
' FROM annuaire_tela'.
|
|
|
106 |
' WHERE u_french_dpt <> 999';
|
|
|
107 |
break;
|
|
|
108 |
|
|
|
109 |
case '1' :
|
|
|
110 |
$requete =
|
|
|
111 |
' SELECT count(u_id) as nbr'.
|
|
|
112 |
' FROM annuaire_tela, carto_PAYS'.
|
|
|
113 |
' WHERE u_country = cp_id_pays'.
|
|
|
114 |
' AND cp_id_continent = "'.carto_consulterIdZoneGeoCarte ($id_carte).'"';
|
|
|
115 |
break;
|
|
|
116 |
|
|
|
117 |
case '2' :
|
|
|
118 |
$requete =
|
|
|
119 |
' SELECT count(u_id) as nbr'.
|
|
|
120 |
' FROM annuaire_tela'.
|
|
|
121 |
' WHERE u_french_dpt != "999"'.
|
|
|
122 |
' AND u_country = "fr"';
|
|
|
123 |
break;
|
|
|
124 |
}
|
|
|
125 |
|
|
|
126 |
$resultat = mysql_query($requete) or die('
|
|
|
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/>'.
|
|
|
129 |
'<b>Nom fonction : </b> carto_ad_consulterNbreInscrits<br/>'.
|
|
|
130 |
'<b>Requete : </b>'.$requete.
|
|
|
131 |
'<br/><br/><b>Erreur : </b>'.mysql_error());
|
|
|
132 |
|
|
|
133 |
$ligne = mysql_fetch_object ($resultat) ;
|
|
|
134 |
$res = '<h1 class="titre1_cartographie">'.$titre_carte.' : ' ;
|
|
|
135 |
if ($ligne->nbr == 0) {
|
|
|
136 |
$res .= 'aucun inscrit' ;
|
|
|
137 |
}
|
|
|
138 |
else if ($ligne->nbr == 1) {
|
|
|
139 |
$res .= $ligne->nbr.' inscrit' ;
|
|
|
140 |
}
|
|
|
141 |
else {
|
|
|
142 |
$res .= $ligne->nbr.' inscrits ';
|
|
|
143 |
}
|
|
|
144 |
return $res.' à Tela Botanica</h1>' ;
|
|
|
145 |
}
|
|
|
146 |
|
|
|
147 |
/**
|
|
|
148 |
* Envoie un email à tous les adhérents sélectionnés
|
|
|
149 |
*
|
|
|
150 |
* @return string Renvoie le message 'votre message a été envoyé'
|
|
|
151 |
*/
|
|
|
152 |
|
|
|
153 |
function envoie_mail (&$db) {
|
540 |
jpm |
154 |
$res = "<div class=\"titre1_cartographie\">Votre message a été envoyé</div>" ;
|
87 |
alex |
155 |
$requete = "select ".CAR_CHAMPS_MAIL." from ".CAR_ANNUAIRE.
|
|
|
156 |
" where ".CAR_CHAMPS_ID."='".$GLOBALS['car_auth']->getAuthData (CAR_CHAMPS_ID)."'";
|
|
|
157 |
$resultat = $db->query($requete);
|
|
|
158 |
if (DB::isError($resultat)) {
|
|
|
159 |
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo());
|
|
|
160 |
}
|
|
|
161 |
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
|
|
|
162 |
$entete = "From: <".$ligne[CAR_CHAMPS_MAIL].">\n";
|
|
|
163 |
|
|
|
164 |
$_POST['corps'] .= CAR_TEXTE_FIN_MAIL;
|
|
|
165 |
$_POST['corps'] = stripslashes($_POST['corps']) ;
|
|
|
166 |
$liste = "" ;
|
|
|
167 |
foreach ($_POST['select'] as $key => $value) {
|
499 |
jpm |
168 |
mail($value, stripslashes($_POST['titre_mail']), $_POST['corps'], $entete) ;
|
87 |
alex |
169 |
$liste .= $value."\n" ;
|
|
|
170 |
}
|
|
|
171 |
|
|
|
172 |
$_POST['corps'] .= "\n----------------------------------------------------------------------------";
|
367 |
jpm |
173 |
$_POST['corps'] .= "\n".CAR_MESSAGE_APPLI."\n" ;
|
|
|
174 |
$_POST['corps'] .= "\n".CAR_MESSAGE_ENVOYE_A.":\n $liste" ;
|
87 |
alex |
175 |
|
499 |
jpm |
176 |
// Envoie du message aux administrateurs
|
|
|
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 |
}
|
364 |
jpm |
182 |
|
499 |
jpm |
183 |
|
|
|
184 |
|
87 |
alex |
185 |
$_POST['corps']='';
|
|
|
186 |
$_POST['titre_mail']='';
|
|
|
187 |
return $res ;
|
|
|
188 |
}
|
|
|
189 |
|
540 |
jpm |
190 |
function envoie_mail_modere (&$db) {
|
541 |
jpm |
191 |
$res = '<p class="attention">'.CAR_MAIL_ATTENTE_MODERATION.'</p>' ;
|
540 |
jpm |
192 |
$requete = "select ".CAR_CHAMPS_MAIL." from ".CAR_ANNUAIRE.
|
|
|
193 |
" where ".CAR_CHAMPS_ID."='".$GLOBALS['car_auth']->getAuthData (CAR_CHAMPS_ID)."'";
|
|
|
194 |
$resultat = $db->query($requete);
|
|
|
195 |
if (DB::isError($resultat)) {
|
|
|
196 |
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo());
|
|
|
197 |
}
|
|
|
198 |
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
|
|
|
199 |
$liste = '';
|
|
|
200 |
$entete = '' ;
|
|
|
201 |
|
|
|
202 |
foreach ($_POST['select'] as $key => $value) {
|
|
|
203 |
$liste .= $value."\n" ;
|
|
|
204 |
}
|
|
|
205 |
|
|
|
206 |
$precorps = $ligne[CAR_CHAMPS_MAIL]." ".CAR_EXPEDITEUR_ORIGINAL." \n" ;
|
|
|
207 |
$precorps .= CAR_LISTE_DESTINATAIRES." : ".$liste." \n" ;
|
|
|
208 |
$precorps .= CAR_TITRE_MAIL.' : '.$_POST['titre_mail']." \n" ;
|
|
|
209 |
$precorps .= "\n------".CAR_CONTENU_MESSAGE."------\n";
|
|
|
210 |
|
541 |
jpm |
211 |
$corps = stripslashes($precorps.$_POST['corps']) ;
|
540 |
jpm |
212 |
|
|
|
213 |
$corps .= "\n----------------------------------------------------------------------------";
|
|
|
214 |
$corps .= "\n".CAR_MESSAGE_APPLI."\n" ;
|
|
|
215 |
|
|
|
216 |
// Envoie du message au modérateur
|
|
|
217 |
foreach ($GLOBALS['mail_admin'] as $courriel) {
|
|
|
218 |
if(!mail($courriel,CAR_TITRE_MAIL_MODERATION,$corps, $entete))
|
|
|
219 |
{
|
|
|
220 |
trigger_error("Le courriel n'a pas été envoyé à : $courriel", E_USER_WARNING);
|
|
|
221 |
}
|
|
|
222 |
}
|
|
|
223 |
|
|
|
224 |
|
|
|
225 |
$_POST['corps']='';
|
|
|
226 |
$_POST['titre_mail']='';
|
|
|
227 |
return $res ;
|
|
|
228 |
}
|
|
|
229 |
|
87 |
alex |
230 |
//-- Fin du code source ------------------------------------------------------------
|
|
|
231 |
/*
|
|
|
232 |
* $Log: car_cartographie.fonct.php,v $
|
|
|
233 |
* Revision 1.4 2005/03/11 17:27:23 alex
|
|
|
234 |
* modification html
|
|
|
235 |
*
|
|
|
236 |
* Revision 1.3 2005/03/11 17:24:39 alex
|
|
|
237 |
* modification html
|
|
|
238 |
*
|
|
|
239 |
* Revision 1.2 2005/03/11 15:18:45 alex
|
|
|
240 |
* migration version 4
|
|
|
241 |
*
|
|
|
242 |
* Revision 1.1 2004/11/30 13:37:19 tam
|
|
|
243 |
* installation
|
|
|
244 |
*
|
|
|
245 |
* Revision 1.1.1.1 2004/11/23 17:48:17 tam
|
|
|
246 |
* Importation
|
|
|
247 |
*
|
|
|
248 |
* Revision 1.1 2004/11/23 17:30:13 tam
|
|
|
249 |
* installation
|
|
|
250 |
*
|
|
|
251 |
*
|
|
|
252 |
*/
|
|
|
253 |
?>
|