Subversion Repositories Applications.papyrus

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
448 ddelon 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
// +------------------------------------------------------------------------------------------------------+
679 alexandre_ 22
// CVS : $Id: mail_tous.php,v 1.2 2006-01-02 09:51:03 alexandre_tb Exp $
448 ddelon 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
679 alexandre_ 33
*@version       $Revision: 1.2 $
448 ddelon 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
 
679 alexandre_ 47
    $url = $GLOBALS['ins_url']->getURL() ;
448 ddelon 48
 
49
    // Entete
50
 
51
    $corps_debut = "RESEAU TELA BOTANICA - Le ".date("j/m/Y").
679 alexandre_ 52
                    "\n\nBonjour,\n"."\n\nCordialement,\n-------------------\n".
53
                    "Tela Botanica le réseau des botanistes francophones\n".
54
                    "accueil@tela-botanica.org\nhttp://www.tela-botanica.org\n";
448 ddelon 55
 
56
    $res = "<h1>Envoi d'un mail &agrave; tous les membres</h1>\n" ;
679 alexandre_ 57
 
448 ddelon 58
    if ($_GET['action'] == ANN_MAIL_TOUS_ENVOIE) $res .= envoie_mail_selection() ;
679 alexandre_ 59
 
448 ddelon 60
    // formulaire
61
    $res .= "<div><form action=\"$url&action=".ANN_MAIL_TOUS_ENVOIE."\" method=\"post\"><table>\n" ;
679 alexandre_ 62
    $res .= "<tr><td>" ;
63
    $res .= "Objet&nbsp;:&nbsp;</td><td><input size=\"91\" name=\"objet\" type=\"text\"></td></tr>\n" ;
64
    $res .= '<tr><td>Corps&nbsp;:&nbsp;</td><td><textarea name="corps" cols="90" rows="30">'.
65
    			$corps_debut.'</textarea></td></tr>'."\n" ;
66
    $res .= "<tr><td></td><td><input type=\"submit\" value=\"envoyer\"" ;
448 ddelon 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" ;
70
 
71
return $res ;
72
}
73
 
74
include_once ("Mail.php");
75
 
76
// envoie le mail à tous
77
 
78
 
79
function envoie_mail_selection()
80
{
81
 
679 alexandre_ 82
    $headers['From']    = INS_MAIL_ADMIN_APRES_INSCRIPTION ;
83
    $headers['Subject'] = stripslashes($_REQUEST['objet']) ;
84
 
85
    $corps = stripslashes($_REQUEST['corps']) ;
448 ddelon 86
 
87
    $requete = $_SESSION['requete_mail_tous'] ;
88
    unset ($_SESSION['requete_mail_tous']) ;
89
 
679 alexandre_ 90
    $resultat = $GLOBALS['ins_db']->query($requete) ;
448 ddelon 91
 
679 alexandre_ 92
    while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
93
        if (!mail($ligne[INS_CHAMPS_MAIL], $headers['Subject'], $corps, "From: ".$headers['From'])) {
94
        	return "<div>Une erreur s'est produite:<br>".$mail_object->getMessage()."</div>\n" ;
448 ddelon 95
        }
96
    }
97
 
98
    return "<div>Le mail est parti !</div>\n";
99
}
679 alexandre_ 100
/* +--Fin du code ----------------------------------------------------------------------------------------+
101
*
102
* $Log: not supported by cvs2svn $
103
* +-- Fin du code ----------------------------------------------------------------------------------------+
104
*/
448 ddelon 105
?>