Subversion Repositories Applications.papyrus

Rev

Rev 235 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 235 Rev 311
Line 1... Line 1...
1
<?php
1
<?php
2
 
-
 
-
 
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
3
// +--------------------------------------------------------------------+
3
// +------------------------------------------------------------------------------------------------------+
4
// | mail_tous.php                                                      |
4
// | PHP version 4.1                                                                                      |
5
// +--------------------------------------------------------------------+
5
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (c) 2002 Tela Botanica							        |
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +--------------------------------------------------------------------+
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
// |                                                                                                      |
8
// | Application permetant d'envoyer un mail à tous                     |
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                            |
9
// +--------------------------------------------------------------------+
21
// +------------------------------------------------------------------------------------------------------+
-
 
22
// CVS : $Id: mail_tous.php,v 1.2 2005-03-24 08:24:39 alex Exp $
-
 
23
/**
-
 
24
* Permet d'envoie un mail à une sélection dans l'annuaire
-
 
25
* 
-
 
26
*
-
 
27
*@package annuaire
-
 
28
//Auteur original :
10
// | Auteur : Alexandre Granier <alexandre@tela-botanica.org> 		  	|
29
*@author        Alexandre Granier <alexandre@tela-botanica.org>
-
 
30
//Autres auteurs :
-
 
31
*@author        Aucun
-
 
32
*@copyright     Tela-Botanica 2000-2004
-
 
33
*@version       $Revision: 1.2 $
11
// +--------------------------------------------------------------------+
34
// +------------------------------------------------------------------------------------------------------+
12
//
35
*/
13
// $Id: mail_tous.php,v 1.1.1.1 2005-01-03 17:27:49 alex Exp $
-
 
14
 
36
 
-
 
37
// +------------------------------------------------------------------------------------------------------+
15
include_once "php/lib/pack.lib.gen.php" ;
38
// |                                            ENTETE du PROGRAMME                                       |
16
include_once "php/auth_object_login.php" ;
39
// +------------------------------------------------------------------------------------------------------+
Line 17... Line 40...
17
 
40
 
Line 18... Line 41...
18
function putFrame() {
41
function putFrame() {
19
    
-
 
20
    // configuration
42
    
21
    global $GS_GLOBAL ;
43
    // configuration
Line 22... Line -...
22
    global $objet, $corps, $annuaire_LABEL_STATUT, $SERVER_ADMIN ;
-
 
23
    global $action ;
44
    global $objet, $corps, $annuaire_LABEL_STATUT, $SERVER_ADMIN ;
Line 24... Line -...
24
    
-
 
25
    $url = "document.php?project=".$GS_GLOBAL['project']."&locale=".$GS_GLOBAL['locale']."&doc=".$GS_GLOBAL['document_row']->D_NAME ;
45
    global $action ;
26
    $url .= "&page=".$GS_GLOBAL['current_page_ndx'] ;
46
    
-
 
47
    $url = $GLOBALS['ann_url']->getURL() ;
-
 
48
    
Line 27... Line -...
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 ;
49
    $annu_table = "annuaire_tela" ;
36
	} else {
50
    $champs_mail = "U_MAIL" ;
37
    
51
 
38
        // Entete
52
    // Entete
39
        confirmation() ;
-
 
40
        $corps_debut = "RESEAU TELA BOTANICA - Le ".date("j/m/Y").
53
    
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";  
54
    $corps_debut = "RESEAU TELA BOTANICA - Le ".date("j/m/Y").
42
    
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";  
43
        $res = "<tr class=\"titlePage\"><td>Envoi d'un mail &agrave; tous les membres</td></tr>\n" ;
56
 
44
        $res .= "<tr><td>&nbsp;</td></tr>\n" ;
57
    $res = "<h1>Envoi d'un mail &agrave; tous les membres</h1>\n" ;
45
        
58
    
46
        if ($action == "go") $res .= envoie_mail() ;
59
    if ($_GET['action'] == ANN_MAIL_TOUS_ENVOIE) $res .= envoie_mail_selection() ;
47
        
60
    
48
        // formulaire
61
    // formulaire
49
        $res .= "<tr><td><form action=\"$url&action=go\" method=\"post\"><table width=\"100%\">\n" ;
62
    $res .= "<div><form action=\"$url&action=".ANN_MAIL_TOUS_ENVOIE."\" method=\"post\"><table>\n" ;
50
        $res .= "<tr><td class=\"insLabel\">" ;
63
    $res .= "<tr><td class=\"insLabel\">" ;
51
        $res .= "Objet&nbsp;:&nbsp;</td><td><input size=\"91\" name=\"objet\" type=\"text\" class=\"insInputForm\"></td></tr>\n" ;
64
    $res .= "Objet&nbsp;:&nbsp;</td><td><input size=\"91\" name=\"objet\" type=\"text\" class=\"insInputForm\"></td></tr>\n" ;
52
        $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" ;
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" ;
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 !!');\"" ;
66
    $res .= "<tr><td></td><td><input type=\"submit\" class=\"texte_tb\" value=\"envoyer\"" ;
55
        $res .= "></td></tr>\n" ;
67
    $res .= " onclick=\"javascript:return confirm('Etes-vous sur de vouloir envoyer ce message !!');\"" ;
Line 56... Line 68...
56
        $res .= "</table></form></td></tr>\n" ;
68
    $res .= "></td></tr>\n" ;
Line 57... Line 69...
57
        
69
    $res .= "</table></form></div>\n" ;
Line 58... Line 70...
58
    }
70
 
59
return $res ;
71
return $res ;
60
}
72
}
Line 61... Line 73...
61
 
73
 
62
include_once ("Mail.php");
74
include_once ("Mail.php");
Line 74... Line 86...
74
    $headers['From']    = "accueil@tela-botanica.org" ;
86
    $headers['From']    = "accueil@tela-botanica.org" ;
75
    $headers['Subject'] = stripslashes($objet) ;
87
    $headers['Subject'] = stripslashes($objet) ;
Line 76... Line 88...
76
 
88
 
Line 77... Line 89...
77
    $corps = stripslashes($corps) ;
89
    $corps = stripslashes($corps) ;
78
    
90
    
Line 79... Line 91...
79
    $requete = cxt_getVariable($GS_GLOBAL['mysql_db'], $GS_GLOBAL['link'], "requete_mail_tous") ;
91
    $requete = $_SESSION['requete_mail_tous'] ;
Line 80... Line 92...
80
    cxt_clear($GS_GLOBAL['mysql_db'], $GS_GLOBAL['link']) ;
92
    unset ($_SESSION['requete_mail_tous']) ;
81
 
93
 
82
    $resultat = mysql_query($requete) or die ("echec") ;
94
    $resultat = mysql_query($requete) or die ("echec") ;
83
    
95
    
84
    while ($ligne = mysql_fetch_object($resultat)) {
96
    while ($ligne = mysql_fetch_object($resultat)) {
Line 85... Line -...
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" ;
97
        if (!mail($ligne->U_MAIL, $headers['Subject'], $corps, "From: ".$headers['From'])) {
Line 87... Line 98...
87
        }
98
        return "<tr><td>Une erreur s'est produite:<br>".$mail_object->getMessage()."</td></tr>\n" ;
88
    }
99
        }