235 |
alex |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
// +--------------------------------------------------------------------+
|
|
|
4 |
// | mail_tous.php |
|
|
|
5 |
// +--------------------------------------------------------------------+
|
|
|
6 |
// | Copyright (c) 2002 Tela Botanica |
|
|
|
7 |
// +--------------------------------------------------------------------+
|
|
|
8 |
// | Application permetant d'envoyer un mail à tous |
|
|
|
9 |
// +--------------------------------------------------------------------+
|
|
|
10 |
// | Auteur : Alexandre Granier <alexandre@tela-botanica.org> |
|
|
|
11 |
// +--------------------------------------------------------------------+
|
|
|
12 |
//
|
|
|
13 |
// $Id: mail_tous.php,v 1.1.1.1 2005-01-03 17:27:49 alex Exp $
|
|
|
14 |
|
|
|
15 |
include_once "php/lib/pack.lib.gen.php" ;
|
|
|
16 |
include_once "php/auth_object_login.php" ;
|
|
|
17 |
|
|
|
18 |
function putFrame() {
|
|
|
19 |
|
|
|
20 |
// configuration
|
|
|
21 |
global $GS_GLOBAL ;
|
|
|
22 |
global $objet, $corps, $annuaire_LABEL_STATUT, $SERVER_ADMIN ;
|
|
|
23 |
global $action ;
|
|
|
24 |
|
|
|
25 |
$url = "document.php?project=".$GS_GLOBAL['project']."&locale=".$GS_GLOBAL['locale']."&doc=".$GS_GLOBAL['document_row']->D_NAME ;
|
|
|
26 |
$url .= "&page=".$GS_GLOBAL['current_page_ndx'] ;
|
|
|
27 |
|
|
|
28 |
$link = $GS_GLOBAL['link'] ;
|
|
|
29 |
$annu_table = "annuaire_tela" ;
|
|
|
30 |
$champs_mail = "U_MAIL" ;
|
|
|
31 |
|
|
|
32 |
// Identification
|
|
|
33 |
$loginObj = new authLoginClass() ;
|
|
|
34 |
if (!gs_manageAuthWithObject ($GS_GLOBAL['mysql_db'], $GS_GLOBAL['link'], $loginObj, &$outputText)) {
|
|
|
35 |
$res = $outputText ;
|
|
|
36 |
} else {
|
|
|
37 |
|
|
|
38 |
// Entete
|
|
|
39 |
confirmation() ;
|
|
|
40 |
$corps_debut = "RESEAU TELA BOTANICA - Le ".date("j/m/Y").
|
|
|
41 |
"\n\nBonjour,\n"."\n\nCordialement,\n-------------------\nTela Botanica le réseau des botanistes francophones\naccueil@tela-botanica.org\nhttp://www.tela-botanica.org\n";
|
|
|
42 |
|
|
|
43 |
$res = "<tr class=\"titlePage\"><td>Envoi d'un mail à tous les membres</td></tr>\n" ;
|
|
|
44 |
$res .= "<tr><td> </td></tr>\n" ;
|
|
|
45 |
|
|
|
46 |
if ($action == "go") $res .= envoie_mail() ;
|
|
|
47 |
|
|
|
48 |
// formulaire
|
|
|
49 |
$res .= "<tr><td><form action=\"$url&action=go\" method=\"post\"><table width=\"100%\">\n" ;
|
|
|
50 |
$res .= "<tr><td class=\"insLabel\">" ;
|
|
|
51 |
$res .= "Objet : </td><td><input size=\"91\" name=\"objet\" type=\"text\" class=\"insInputForm\"></td></tr>\n" ;
|
|
|
52 |
$res .= "<tr><td class=\"insLabel\">Corps : </td><td><textarea name=\"corps\" cols=\"90\" rows=\"30\" class=\"insInputForm\">$corps_debut</textarea></td></tr>\n" ;
|
|
|
53 |
$res .= "<tr><td></td><td><input type=\"submit\" class=\"texte_tb\" value=\"envoyer\"" ;
|
|
|
54 |
$res .= " onclick=\"javascript:return confirmLink(this, 'Etes-vous sur de vouloir envoyer ce message !!');\"" ;
|
|
|
55 |
$res .= "></td></tr>\n" ;
|
|
|
56 |
$res .= "</table></form></td></tr>\n" ;
|
|
|
57 |
|
|
|
58 |
}
|
|
|
59 |
return $res ;
|
|
|
60 |
}
|
|
|
61 |
|
|
|
62 |
include_once ("Mail.php");
|
|
|
63 |
|
|
|
64 |
// envoie le mail à tous
|
|
|
65 |
|
|
|
66 |
|
|
|
67 |
function envoie_mail()
|
|
|
68 |
{
|
|
|
69 |
global $objet, $corps, $annuaire_LABEL_STATUT, $SERVER_ADMIN, $GS_GLOBAL ;
|
|
|
70 |
|
|
|
71 |
$annuaire = "annuaire_tela" ;
|
|
|
72 |
$champs_mail = "U_MAIL" ;
|
|
|
73 |
|
|
|
74 |
$headers['From'] = "accueil@tela-botanica.org" ;
|
|
|
75 |
$headers['Subject'] = stripslashes($objet) ;
|
|
|
76 |
|
|
|
77 |
$corps = stripslashes($corps) ;
|
|
|
78 |
|
|
|
79 |
$requete = cxt_getVariable($GS_GLOBAL['mysql_db'], $GS_GLOBAL['link'], "requete_mail_tous") ;
|
|
|
80 |
cxt_clear($GS_GLOBAL['mysql_db'], $GS_GLOBAL['link']) ;
|
|
|
81 |
|
|
|
82 |
$resultat = mysql_query($requete) or die ("echec") ;
|
|
|
83 |
|
|
|
84 |
while ($ligne = mysql_fetch_object($resultat)) {
|
|
|
85 |
if (!mail($ligne->U_MAIL, $headers['Subject'], $corps, "From: ".$headers['From'])) {
|
|
|
86 |
return "<tr><td>Une erreur s'est produite:<br>".$mail_object->getMessage()."</td></tr>\n" ;
|
|
|
87 |
}
|
|
|
88 |
}
|
|
|
89 |
|
|
|
90 |
|
|
|
91 |
return "<tr><td class=\"titlePage\">Le mail est parti !</td></tr>\n";
|
|
|
92 |
|
|
|
93 |
}
|
|
|
94 |
?>
|