Subversion Repositories Sites.tela-botanica.org

Rev

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

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