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 |
// +------------------------------------------------------------------------------------------------------+
|
1797 |
alexandre_ |
22 |
// CVS : $Id: mail_tous.php,v 1.2.6.1 2008-02-08 08:26:52 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
|
1797 |
alexandre_ |
33 |
*@version $Revision: 1.2.6.1 $
|
448 |
ddelon |
34 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
35 |
*/
|
|
|
36 |
|
|
|
37 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
38 |
// | ENTETE du PROGRAMME |
|
|
|
39 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
40 |
|
|
|
41 |
function putFrame() {
|
|
|
42 |
|
1797 |
alexandre_ |
43 |
|
679 |
alexandre_ |
44 |
$url = $GLOBALS['ins_url']->getURL() ;
|
448 |
ddelon |
45 |
|
|
|
46 |
// Entete
|
|
|
47 |
|
1797 |
alexandre_ |
48 |
$corps_debut = "";
|
448 |
ddelon |
49 |
|
|
|
50 |
$res = "<h1>Envoi d'un mail à tous les membres</h1>\n" ;
|
679 |
alexandre_ |
51 |
|
448 |
ddelon |
52 |
if ($_GET['action'] == ANN_MAIL_TOUS_ENVOIE) $res .= envoie_mail_selection() ;
|
679 |
alexandre_ |
53 |
|
448 |
ddelon |
54 |
// formulaire
|
1797 |
alexandre_ |
55 |
$GLOBALS['ins_url']->addQueryString ('action', ANN_MAIL_TOUS_ENVOIE);
|
|
|
56 |
$res .= '<div><form action="'.$GLOBALS['ins_url']->getURL().'" method="post"><table>'."\n" ;
|
|
|
57 |
$res .= '<tr><td>' ;
|
|
|
58 |
$res .= 'Objet : </td><td><input size="91" name="objet" type="text" /></td></tr>'."\n" ;
|
679 |
alexandre_ |
59 |
$res .= '<tr><td>Corps : </td><td><textarea name="corps" cols="90" rows="30">'.
|
|
|
60 |
$corps_debut.'</textarea></td></tr>'."\n" ;
|
1797 |
alexandre_ |
61 |
$res .= '<tr><td></td><td><input type="submit" value="envoyer"' ;
|
448 |
ddelon |
62 |
$res .= " onclick=\"javascript:return confirm('Etes-vous sur de vouloir envoyer ce message !!');\"" ;
|
1797 |
alexandre_ |
63 |
$res .= " /></td></tr>\n" ;
|
448 |
ddelon |
64 |
$res .= "</table></form></div>\n" ;
|
1797 |
alexandre_ |
65 |
$GLOBALS['ins_url']->removeQueryString ('action');
|
448 |
ddelon |
66 |
return $res ;
|
|
|
67 |
}
|
|
|
68 |
|
|
|
69 |
include_once ("Mail.php");
|
|
|
70 |
|
|
|
71 |
// envoie le mail à tous
|
|
|
72 |
|
|
|
73 |
|
|
|
74 |
function envoie_mail_selection()
|
|
|
75 |
{
|
|
|
76 |
|
679 |
alexandre_ |
77 |
$headers['From'] = INS_MAIL_ADMIN_APRES_INSCRIPTION ;
|
|
|
78 |
$headers['Subject'] = stripslashes($_REQUEST['objet']) ;
|
|
|
79 |
|
|
|
80 |
$corps = stripslashes($_REQUEST['corps']) ;
|
448 |
ddelon |
81 |
|
|
|
82 |
$requete = $_SESSION['requete_mail_tous'] ;
|
|
|
83 |
unset ($_SESSION['requete_mail_tous']) ;
|
|
|
84 |
|
679 |
alexandre_ |
85 |
$resultat = $GLOBALS['ins_db']->query($requete) ;
|
448 |
ddelon |
86 |
|
679 |
alexandre_ |
87 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
|
|
88 |
if (!mail($ligne[INS_CHAMPS_MAIL], $headers['Subject'], $corps, "From: ".$headers['From'])) {
|
|
|
89 |
return "<div>Une erreur s'est produite:<br>".$mail_object->getMessage()."</div>\n" ;
|
448 |
ddelon |
90 |
}
|
|
|
91 |
}
|
|
|
92 |
|
|
|
93 |
return "<div>Le mail est parti !</div>\n";
|
|
|
94 |
}
|
679 |
alexandre_ |
95 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
|
|
96 |
*
|
|
|
97 |
* $Log: not supported by cvs2svn $
|
1797 |
alexandre_ |
98 |
* Revision 1.2 2006/01/02 09:51:03 alexandre_tb
|
|
|
99 |
* généralisation du code et intégration au bottin
|
|
|
100 |
*
|
679 |
alexandre_ |
101 |
* +-- Fin du code ----------------------------------------------------------------------------------------+
|
|
|
102 |
*/
|
448 |
ddelon |
103 |
?>
|