Subversion Repositories Applications.papyrus

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
235 alex 1
<?
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.1.1.1 2005-01-03 17:27:49 alex Exp $
23
/**
24
* programme principal du module annuaire
25
*
26
* programme principal du module annuaire
27
*
28
*@package annuaire
29
//Auteur original :
30
*@author        Alexandre Granier <alexandre@tela-botanica.org>
31
//Autres auteurs :
32
*@author        Aucun
33
*@copyright     Tela-Botanica 2000-2004
34
*@version       $Revision: 1.1.1.1 $
35
// +------------------------------------------------------------------------------------------------------+
36
*/
37
 
38
// +------------------------------------------------------------------------------------------------------+
39
// |                                            ENTETE du PROGRAMME                                       |
40
// +------------------------------------------------------------------------------------------------------+
41
 
42
 
43
include_once 'client/annuaire/configuration/ann_config.inc.php' ;
44
if (isset($lang)) {
45
    include_once CAR_CHEMIN_APPLI."/langues/ann_langue_$lang.inc.php" ;
46
} else {
47
    include_once CAR_CHEMIN_APPLI.'/langues/ann_langue_fr.inc.php' ;
48
}
49
 
50
 
51
include_once 'annuaire/configuration/ann_config.inc.php' ;
52
include_once ANN_CHEMIN_LIBRAIRIE.'ann_annuaire.fonct.php' ;
53
if (isset($lang)) {
54
	include_once "annuaire/langues/ann_langue_$lang.inc.php" ;
55
} else {
56
	include_once 'annuaire/langues/ann_langue_fr.inc.php' ;
57
}
58
include_once 'HTML/QuickForm.php' ;
59
 
60
 
61
define ("ENVOIE_MAIL", 2) ;
62
 
63
//==============================================================================
64
// putFrame ($db, $link, $DOCrow, $PAGEresult, $CURRENTPAGErow, $innerTableWidth, $innerTableSpacing)
65
//  $db                : database name
66
//  $link              : connexion to database
67
//  $DOCrow            : row about the current document
68
//  $PAGEresult        : result set: all pages linked to the current document
69
//  $CURRENTPAGErow    : row about the current page
70
//  $innerTableWidth   : global table width
71
//  $innerTableSpacing : cell spacing for global table.
72
//
73
// Generation frame content.
74
//==============================================================================
75
 
76
function GEN_afficherContenuCorps () {
77
 
78
    global $AUTH, $db ;
79
    global $GS_GLOBAL ;
80
 
81
 
82
    if (!$AUTH->getAuth())  {
83
        $res = AUTH_formulaire_login() ;
84
    } else {
85
        // Le code javascript des cases à cocher
86
        $java =
87
            "function setCheckboxes(the_form)
88
            {
89
            var do_check=document.forms[the_form].elements['selecttotal'].checked;
90
            var elts            = document.forms[the_form].elements['select[]'];
91
            var elts_cnt = (typeof(elts.length) != 'undefined')
92
                                ? elts.length
93
                                : 0;
94
            if (elts_cnt) {
95
                for (var i = 0; i < elts_cnt; i++) {
96
                    elts[i].checked = do_check;
97
                } // Fin for
98
            } else {
99
                elts.checked = do_check;
100
            } // Fin if... else
101
            return true;
102
        } // Fin de la fonction 'setCheckboxes()'";
103
        $GLOBALS['javascript'] .= $java ;
104
 
105
        $res = "<h1 class=\"annuaire_titre1\">".ANN_TITRE."</h1>\n" ;
106
 
107
        $res .= "<h2 class=\"annuaire_titre2\">".ANN_CLIQUEZ_LETTRE."</h2>\n";
108
 
109
        global $baseURL ;
110
        $baseURL = ANN_URL_SPIP ;
111
            // S'il y a un mail a envoyé, on l'envoie
112
        if ($action == ENVOIE_MAIL) $res .= envoie_mail () ;
113
 
114
        $res .= parcourrirAnnu("") ;
115
    }
116
    return $res;
117
}
118
 
119
//==============================================================================
120
// FUNCTION putFooter ()
121
//
122
// Generation of footer.
123
//==============================================================================
124
 
125
function putFooter () {
126
  return '&nbsp;';
127
}
128
 
129
 
130
 
131
function envoie_mail () {
132
    global $titre, $corps, $HTTP_POST_VARS, $select, $AUTH, $db ;
133
 
134
    // On vérifie qu'un email aie été sélectionné
135
    if (!is_array($select)) {
136
        $res ="<div class=\"annuaire_erreur\">".ANN_VERIF_MAIL_COCHE."</divr>";
137
        return $res ;
138
    }
139
    if ($titre == "" || $corps == "") {
140
        $res = "<div class=\"annuaire_erreur\">".ANN_VERIF_TITRE."</div>\n" ;
141
        return $res ;
142
    }
143
 
144
    // On récupère le mail de l'expéditeur
145
    $req_exp = "select ".ANN_CHAMPS_MAIL." from ".ANN_ANNUAIRE." where ".ANN_CHAMPS_ID."=".$AUTH->getAuthData(ANN_CHAMPS_ID) ;
146
    $res_exp = $db->query($req_exp) ;
147
    if (DB::isError($res_exp)) {
148
	die ("Echec de la requete sur annuaire_tela <br>".$res_exp->getMessage()) ;
149
    }
150
    $ligne_exp = $res_exp->fetchRow(DB_FETCHMODE_ASSOC) ;
151
    $expediteur = $ligne_exp[ANN_CHAMPS_MAIL] ;
152
 
153
    $corps .= ANN_PIED_MESSAGE ;
154
    $liste = "" ;
155
    for ($i = 0; $i < count($select); $i++) {
156
        $requete = "select ".ANN_CHAMPS_MAIL." from ".ANN_ANUAIRE." where ".ANN_CHAMPS_ID."=".$select[$i] ;
157
        $resultat = $db->query($requete) ;
158
 
159
        if (DB::isError($resultat)) {
160
            die ("Echec de la requete sur annuaire_tela <br>".$resultat->getMessage()) ;
161
        }
162
        $ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
163
 
164
        // L'envoie du mail proprement dit
165
        if (!mail($ligne[ANN_CHAMPS_MAIL], stripslashes($titre), stripslashes($corps), "From: $expediteur")) {
166
            return "<div class=\"annuaire_erreur\">Le mail n'est pas partie</div>\n" ;
167
        }
168
        $liste .= $ligne[ANN_CHAMPS_MAIL]."\n" ;
169
    }
170
    $corps .= "\n----------------------------------------------------------------------------
171
                Ce message a été envoyé à :\n $liste" ;
172
    mail ("ANN_MAIL_ADMIN", stripslashes($titre), stripslashes($corps), "From: $expediteur");
173
}
174
/**------------------------------------------------------------------------------
175
* $Log: not supported by cvs2svn $
176
* Revision 1.1  2005/01/03 17:18:43  alex
177
* retour vers la liste des participants après un ajout.
178
*
179
*
180
*-- End of source  ------------------------------------------------------------*/
181
?>