Subversion Repositories Sites.tela-botanica.org

Rev

Rev 609 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4 david 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
// +------------------------------------------------------------------------------------------------------+
22
// CVS : $Id: annuaire.php,v 1.3 2005/01/06 15:44:33 alex Exp $
23
/**
24
* Permet d'envoie un mail à une sélection dans l'annuaire
25
*
26
*
27
*@package annuaire
28
//Auteur original :
29
*@author        Alexandre Granier <alexandre@tela-botanica.org>
30
//Autres auteurs :
31
*@author        Aucun
32
*@copyright     Tela-Botanica 2000-2004
33
*@version       $Revision: 1.3 $
34
// +------------------------------------------------------------------------------------------------------+
35
*/
36
 
37
// +------------------------------------------------------------------------------------------------------+
38
// |                                            ENTETE du PROGRAMME                                       |
39
// +------------------------------------------------------------------------------------------------------+
40
 
41
function putFrame() {
42
 
43
    // configuration
44
    global $objet, $corps, $annuaire_LABEL_STATUT, $SERVER_ADMIN ;
45
    global $action ;
46
 
47
    $url = $GLOBALS['ann_url']->getURL() ;
48
 
49
    $annu_table = "annuaire_tela" ;
50
    $champs_mail = "U_MAIL" ;
51
 
52
    // Entete
53
 
54
    $corps_debut = "RESEAU TELA BOTANICA - Le ".date("j/m/Y").
55
                    "\n\nBonjour,\n"."\n\nCordialement,\n-------------------\nTela Botanica le réseau des botanistes francophones\naccueil@tela-botanica.org\nhttp://www.tela-botanica.org\n";
56
 
57
    $res = "<h1>Envoi d'un mail &agrave; tous les membres</h1>\n" ;
58
 
59
    if ($_GET['action'] == ANN_MAIL_TOUS_ENVOIE) $res .= envoie_mail_selection() ;
264 alex 60
    $GLOBALS['ann_url']->addQueryString('action', ANN_MAIL_TOUS_ENVOIE);
4 david 61
    // formulaire
264 alex 62
    $res .= '<div><form action="'.$GLOBALS['ann_url']->getURL()."\" method=\"post\"><table>\n" ;
4 david 63
    $res .= "<tr><td class=\"insLabel\">" ;
64
    $res .= "Objet&nbsp;:&nbsp;</td><td><input size=\"91\" name=\"objet\" type=\"text\" class=\"insInputForm\"></td></tr>\n" ;
65
    $res .= "<tr><td class=\"insLabel\">Corps&nbsp;:&nbsp;</td><td><textarea name=\"corps\" cols=\"90\" rows=\"30\" class=\"insInputForm\">$corps_debut</textarea></td></tr>\n" ;
66
    $res .= "<tr><td></td><td><input type=\"submit\" class=\"texte_tb\" value=\"envoyer\"" ;
67
    $res .= " onclick=\"javascript:return confirm('Etes-vous sur de vouloir envoyer ce message !!');\"" ;
68
    $res .= "></td></tr>\n" ;
69
    $res .= "</table></form></div>\n" ;
264 alex 70
    $res .= $_SESSION['requete_mail_tous'];
4 david 71
 
72
return $res ;
73
}
74
 
75
include_once ("Mail.php");
76
 
77
// envoie le mail à tous
78
function envoie_mail_selection()
79
{
80
    global $objet, $corps, $annuaire_LABEL_STATUT, $SERVER_ADMIN, $GS_GLOBAL ;
81
 
82
    $annuaire = "annuaire_tela" ;
83
    $champs_mail = "U_MAIL" ;
84
 
85
    $headers['From']    = "accueil@tela-botanica.org" ;
86
    $headers['Subject'] = stripslashes($objet) ;
87
 
88
    $corps = stripslashes($corps) ;
89
 
90
    $requete = $_SESSION['requete_mail_tous'] ;
91
    unset ($_SESSION['requete_mail_tous']) ;
92
 
93
    $resultat = mysql_query($requete) or die ("echec") ;
94
 
95
    while ($ligne = mysql_fetch_object($resultat)) {
96
        if (!mail($ligne->U_MAIL, $headers['Subject'], $corps, "From: ".$headers['From'])) {
97
        return "<tr><td>Une erreur s'est produite:<br>".$mail_object->getMessage()."</td></tr>\n" ;
98
        }
99
    }
100
 
101
    return "<div>Le mail est parti !</div>\n";
102
 
103
}
104
?>