235 |
alex |
1 |
<?php
|
|
|
2 |
/*vim: set expandtab tabstop=4 shiftwidth=4: */
|
|
|
3 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
4 |
// | PHP version 4.1 |
|
|
|
5 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
6 |
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
|
|
|
7 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
8 |
// | This library is free software; you can redistribute it and/or |
|
|
|
9 |
// | modify it under the terms of the GNU Lesser General Public |
|
|
|
10 |
// | License as published by the Free Software Foundation; either |
|
|
|
11 |
// | version 2.1 of the License, or (at your option) any later version. |
|
|
|
12 |
// | |
|
|
|
13 |
// | This library is distributed in the hope that it will be useful, |
|
|
|
14 |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
|
15 |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
|
|
16 |
// | Lesser General Public License for more details. |
|
|
|
17 |
// | |
|
|
|
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 |
|
|
|
20 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
|
|
21 |
// +------------------------------------------------------------------------------------------------------+
|
389 |
alex |
22 |
// CVS : $Id: annuaire.fonct.php,v 1.4 2005-06-03 11:26:51 alex Exp $
|
235 |
alex |
23 |
/**
|
|
|
24 |
* Fonctions du module annuaire
|
|
|
25 |
*
|
|
|
26 |
* Fonctions du module annuaire
|
|
|
27 |
*
|
|
|
28 |
*@package annuaire
|
|
|
29 |
//Auteur original :
|
|
|
30 |
*@author Alexandre Granier <alexandre@tela-botanica.org>
|
|
|
31 |
//Autres auteurs :
|
|
|
32 |
*@author Aucun
|
|
|
33 |
*@copyright Tela-Botanica 2000-2004
|
389 |
alex |
34 |
*@version $Revision: 1.4 $
|
235 |
alex |
35 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
36 |
*/
|
|
|
37 |
|
|
|
38 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
39 |
// | ENTETE du PROGRAMME |
|
|
|
40 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
41 |
|
|
|
42 |
include_once "HTML/QuickForm.php" ;
|
|
|
43 |
|
|
|
44 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
45 |
// | LISTE de FONCTIONS |
|
|
|
46 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
47 |
|
|
|
48 |
|
|
|
49 |
function AUTH_formulaire_login() {
|
|
|
50 |
$res = '';
|
244 |
alex |
51 |
$url = preg_replace ('/&/', '&', $GLOBALS['ann_url']->getURL()) ;
|
235 |
alex |
52 |
$form = new HTML_QuickForm ('inscription', 'post', $url) ;
|
|
|
53 |
$form->addElement ('text', 'username', ANN_EMAIL) ;
|
|
|
54 |
$form->addElement ('password', 'password', ANN_MOT_DE_PASSE) ;
|
|
|
55 |
$form->addElement('submit', 'valider', ANN_VALIDER);
|
|
|
56 |
|
|
|
57 |
$res .= $form->toHTML() ;
|
|
|
58 |
|
311 |
alex |
59 |
$res .= "<div>".ANN_TEXTE_PERDU."</div>\n" ;
|
235 |
alex |
60 |
return $res;
|
|
|
61 |
}
|
|
|
62 |
|
|
|
63 |
/** function parcourrirAnnu () Affiche l'annuaire à partir d'une lettre
|
|
|
64 |
*
|
|
|
65 |
*
|
|
|
66 |
*
|
|
|
67 |
* @return string HTML
|
|
|
68 |
*/
|
|
|
69 |
|
|
|
70 |
function parcourrirAnnu($event) {
|
|
|
71 |
|
311 |
alex |
72 |
$res = '<div><table><tr>';
|
|
|
73 |
|
235 |
alex |
74 |
// ecrire toutes les lettres avec un lien
|
|
|
75 |
for ($i = 65 ; $i <91 ; $i++) {
|
311 |
alex |
76 |
$res .= '<td><a style="font-size:15px;" href="'.$GLOBALS['ann_url']->getURL().'&lettre=';
|
235 |
alex |
77 |
$res .= chr($i) ;
|
311 |
alex |
78 |
$res .= '">';
|
235 |
alex |
79 |
$res .= chr($i) ;
|
|
|
80 |
$res .= "</a></td>\n";
|
|
|
81 |
}
|
|
|
82 |
$res .= "</tr></table></div>\n";
|
|
|
83 |
|
|
|
84 |
// si une lettre est selectionne
|
311 |
alex |
85 |
if (!empty($_REQUEST['lettre'])) {
|
|
|
86 |
$requete = "SELECT ".ANN_ANNUAIRE.".* from ".ANN_ANNUAIRE." WHERE";
|
|
|
87 |
if ($_REQUEST['lettre'] != "tous") $requete .= " ".ANN_CHAMPS_NOM." LIKE \"".$_REQUEST['lettre']."%\"" ;
|
|
|
88 |
$requete .= " ORDER BY ".ANN_CHAMPS_NOM ;
|
389 |
alex |
89 |
isset ($_POST['titre']) ? $titre = $_POST['titre'] : $titre = '' ;
|
|
|
90 |
isset ($_POST['corps']) ? $corps = $_POST['corps'] : $corps = '' ;
|
|
|
91 |
$res .= listes_inscrit ($requete, $GLOBALS['ann_url']->getURL(), '', '', $GLOBALS['ann_db'], $niveau = 'pays').carto_texte_cocher().
|
|
|
92 |
carto_formulaire($titre, $corps) ;
|
311 |
alex |
93 |
}
|
|
|
94 |
return $res ;
|
|
|
95 |
}
|
|
|
96 |
|
|
|
97 |
/**
|
|
|
98 |
* Renvoie le code HTML de la liste des inscrits
|
|
|
99 |
* en fonction de la requete passé en parametre
|
|
|
100 |
*
|
|
|
101 |
* @return Renvoie le code HTML de la liste des inscrits
|
|
|
102 |
*/
|
|
|
103 |
|
|
|
104 |
function listes_inscrit ($requete, $url, $select, $argument, &$db, $niveau = 'pays') {
|
|
|
105 |
$res = "<div>";
|
|
|
106 |
$res .= "<form action=\"$url&mailer=1"."&select=$select&lettre=".$_REQUEST['lettre']."\" method=\"post\" name=\"formmail\">\n
|
|
|
107 |
<table id=\"table_inscrit\">\n
|
|
|
108 |
<colgroup>
|
|
|
109 |
<col />
|
|
|
110 |
<col />
|
|
|
111 |
<col />
|
|
|
112 |
<col />
|
|
|
113 |
<col />
|
|
|
114 |
<col />
|
|
|
115 |
</colgroup>
|
|
|
116 |
<thead>\n
|
|
|
117 |
<th> </th>
|
|
|
118 |
<th>".ANN_NOM."</th>
|
|
|
119 |
<th>".ANN_PRENOM."</th>
|
|
|
120 |
<th>".ANN_DATE_INS."</th>
|
|
|
121 |
<th>".ANN_VILLE."</th>
|
|
|
122 |
</thead>";
|
|
|
123 |
|
|
|
124 |
$resultat= $GLOBALS['ann_db']->query($requete);
|
|
|
125 |
if (DB::isError($resultat)) {
|
|
|
126 |
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
|
|
|
127 |
}
|
|
|
128 |
$indic=0;
|
|
|
129 |
$i=1;
|
|
|
130 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
|
|
131 |
if ($indic==0) {
|
|
|
132 |
$res.="<tr class=\"ligne_impaire\">\n";
|
|
|
133 |
$indic=1;
|
235 |
alex |
134 |
}
|
311 |
alex |
135 |
else {
|
|
|
136 |
$res.="<tr class=\"ligne_paire\">\n";
|
|
|
137 |
$indic=0;
|
|
|
138 |
}
|
|
|
139 |
$res.="<td><input type=\"checkbox\" name=\"select[]\" value=\"".$ligne[ANN_CHAMPS_MAIL]."\"></td>\n
|
|
|
140 |
<td>".$ligne[ANN_CHAMPS_NOM]." </td>\n
|
|
|
141 |
<td>".$ligne[ANN_CHAMPS_PRENOM]." </td>\n
|
|
|
142 |
<td>".date("d m Y", strtotime($ligne[ANN_CHAMPS_DATE_INS]))." </td>\n
|
|
|
143 |
<td>".$ligne[ANN_CHAMPS_VILLE]." </td>\n" ;
|
|
|
144 |
$res .= "</tr>\n";
|
|
|
145 |
}
|
|
|
146 |
$res .= "</table></div>\n";
|
|
|
147 |
return $res ;
|
|
|
148 |
}
|
235 |
alex |
149 |
|
|
|
150 |
|
311 |
alex |
151 |
function carto_formulaire ($titre_mail="", $corps = "") {
|
|
|
152 |
global $HTTP_USER_AGENT ;
|
389 |
alex |
153 |
$res = "<div class=\"chapo\">".ANN_ENVOYER_MAIL."</div>\n";
|
311 |
alex |
154 |
$res .= "<div>\n<table border=\"0\">\n"
|
|
|
155 |
.'<tr><td class="texte">'.ANN_SUJET.' :</td>'."\n"
|
389 |
alex |
156 |
.'<td><input class="forml" type="text" name="titre_mail" size="60" value="'.$titre_mail.'"></td>'."\n"
|
311 |
alex |
157 |
.'</tr><tr><td class="texte" valign="top">'.ANN_MESSAGE.' : </td>'."\n"
|
389 |
alex |
158 |
.'<td><textarea class="forml" name="corps" rows="5" cols="60">'.$corps.'</textarea></td>'."\n"
|
311 |
alex |
159 |
.'</tr><tr><td></td><td align="center">';
|
|
|
160 |
if (ereg ("Gecko",$HTTP_USER_AGENT)) {
|
|
|
161 |
$res.='<input class="spip_bouton" type="submit" value="'.ANN_ENVOYER.'">';
|
|
|
162 |
} else {
|
|
|
163 |
$res.='<input class="spip_bouton" type="submit" onclick="javascript:confirmer();" value="'.ANN_ENVOYER.'">';
|
|
|
164 |
}
|
|
|
165 |
$res.="</td>\n</tr>\n</table>\n</div></form>\n";
|
|
|
166 |
return $res ;
|
|
|
167 |
}
|
235 |
alex |
168 |
|
|
|
169 |
|
311 |
alex |
170 |
/** function carto_texte_cocher ()
|
|
|
171 |
*
|
|
|
172 |
*
|
|
|
173 |
* @return string HTML
|
|
|
174 |
*/
|
235 |
alex |
175 |
|
311 |
alex |
176 |
function carto_texte_cocher () {
|
389 |
alex |
177 |
$res = '<div class="texte">'.ANN_CHECK_UNCHECK ;
|
311 |
alex |
178 |
$res .= " <input type=\"checkbox\" name=\"selecttotal\" onclick=\"javascript:setCheckboxes('formmail');\"></div>";
|
|
|
179 |
return $res ;
|
235 |
alex |
180 |
}
|
|
|
181 |
|
311 |
alex |
182 |
|
|
|
183 |
/** envoie_mail()
|
|
|
184 |
*
|
|
|
185 |
*
|
|
|
186 |
* @return envoie l'email
|
|
|
187 |
*/
|
|
|
188 |
|
|
|
189 |
function envoie_mail () {
|
|
|
190 |
$requete = "select ".ANN_CHAMPS_MAIL." from ".ANN_ANNUAIRE.
|
|
|
191 |
" where ".ANN_CHAMPS_ID."='".$GLOBALS['AUTH']->getAuthData (ANN_CHAMPS_ID)."'";
|
|
|
192 |
$resultat = $GLOBALS['ann_db']->query($requete);
|
|
|
193 |
if (DB::isError($resultat)) {
|
|
|
194 |
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo());
|
|
|
195 |
}
|
|
|
196 |
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
|
|
|
197 |
$entete = "From: <".$ligne[ANN_CHAMPS_MAIL].">\n";
|
|
|
198 |
|
|
|
199 |
$_POST['corps'] .= ANN_PIED_MESSAGE;
|
|
|
200 |
$_POST['corps'] = stripslashes($_POST['corps']) ;
|
|
|
201 |
$liste = "" ;
|
|
|
202 |
foreach ($_POST['select'] as $key => $value) {
|
|
|
203 |
mail ($value, stripslashes($_POST['titre_mail']), $_POST['corps'] , $entete) ;
|
|
|
204 |
$liste .= $value."\n" ;
|
|
|
205 |
}
|
|
|
206 |
|
|
|
207 |
$_POST['corps'] .= "\n----------------------------------------------------------------------------";
|
|
|
208 |
$_POST['corps'] .= "\n".ANN_MESSAGE_ENVOYE_A." :\n $liste" ;
|
|
|
209 |
|
389 |
alex |
210 |
mail (ANN_MAIL_ADMIN, stripslashes($_POST['titre_mail']), $_POST['corps'], $entete);
|
311 |
alex |
211 |
$_POST['corps'] = '';
|
|
|
212 |
$_POST['titre_mail'] = '';
|
|
|
213 |
return '<div>'.ANN_MAIL_ENVOYER.'</div>' ;
|
|
|
214 |
}
|
|
|
215 |
|
235 |
alex |
216 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
|
|
217 |
*
|
|
|
218 |
* $Log: not supported by cvs2svn $
|
389 |
alex |
219 |
* Revision 1.3 2005/03/24 08:24:29 alex
|
|
|
220 |
* --
|
|
|
221 |
*
|
311 |
alex |
222 |
* Revision 1.2 2005/01/06 15:18:31 alex
|
|
|
223 |
* modification de la fonction de formulaire d'authentification
|
|
|
224 |
*
|
244 |
alex |
225 |
* Revision 1.1.1.1 2005/01/03 17:27:49 alex
|
|
|
226 |
* Import initial
|
|
|
227 |
*
|
235 |
alex |
228 |
* Revision 1.1 2005/01/03 17:18:49 alex
|
|
|
229 |
* retour vers la liste des participants après un ajout.
|
|
|
230 |
*
|
|
|
231 |
*
|
|
|
232 |
*
|
|
|
233 |
* +-- Fin du code ----------------------------------------------------------------------------------------+
|
|
|
234 |
*/
|
311 |
alex |
235 |
?>
|