43 |
jpm |
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 à tous les membres</h1>\n" ;
|
|
|
58 |
|
|
|
59 |
if ($_GET['action'] == ANN_MAIL_TOUS_ENVOIE) $res .= envoie_mail_selection() ;
|
|
|
60 |
$GLOBALS['ann_url']->addQueryString('action', ANN_MAIL_TOUS_ENVOIE);
|
|
|
61 |
// formulaire
|
|
|
62 |
$res .= '<div><form action="'.$GLOBALS['ann_url']->getURL()."\" method=\"post\"><table>\n" ;
|
|
|
63 |
$res .= "<tr><td class=\"insLabel\">" ;
|
|
|
64 |
$res .= "Objet : </td><td><input size=\"91\" name=\"objet\" type=\"text\" class=\"insInputForm\"></td></tr>\n" ;
|
|
|
65 |
$res .= "<tr><td class=\"insLabel\">Corps : </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" ;
|
|
|
70 |
$res .= $_SESSION['requete_mail_tous'];
|
|
|
71 |
|
|
|
72 |
return $res ;
|
|
|
73 |
}
|
|
|
74 |
|
|
|
75 |
include_once ("Mail.php");
|
|
|
76 |
|
|
|
77 |
// envoie le mail à tous
|
|
|
78 |
|
|
|
79 |
|
|
|
80 |
function envoie_mail_selection()
|
|
|
81 |
{
|
|
|
82 |
global $objet, $corps, $annuaire_LABEL_STATUT, $SERVER_ADMIN, $GS_GLOBAL ;
|
|
|
83 |
|
|
|
84 |
$annuaire = "annuaire_tela" ;
|
|
|
85 |
$champs_mail = "U_MAIL" ;
|
|
|
86 |
|
|
|
87 |
$headers['From'] = "accueil@tela-botanica.org" ;
|
|
|
88 |
$headers['Subject'] = stripslashes($objet) ;
|
|
|
89 |
|
|
|
90 |
$corps = stripslashes($corps) ;
|
|
|
91 |
|
|
|
92 |
$requete = $_SESSION['requete_mail_tous'] ;
|
|
|
93 |
unset ($_SESSION['requete_mail_tous']) ;
|
|
|
94 |
|
|
|
95 |
$resultat = mysql_query($requete) or die ("echec") ;
|
|
|
96 |
|
|
|
97 |
while ($ligne = mysql_fetch_object($resultat)) {
|
|
|
98 |
if (!mail($ligne->U_MAIL, $headers['Subject'], $corps, "From: ".$headers['From'])) {
|
|
|
99 |
return "<tr><td>Une erreur s'est produite:<br>".$mail_object->getMessage()."</td></tr>\n" ;
|
|
|
100 |
}
|
|
|
101 |
}
|
|
|
102 |
|
|
|
103 |
return "<div>Le mail est parti !</div>\n";
|
|
|
104 |
|
|
|
105 |
}
|
|
|
106 |
?>
|