Subversion Repositories Applications.projet

Rev

Rev 2 | Rev 23 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2 Rev 11
1
<?php
1
<?php
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
3
// +------------------------------------------------------------------------------------------------------+
3
// +------------------------------------------------------------------------------------------------------+
4
// | PHP version 4.1                                                                                      |
4
// | PHP version 4.1                                                                                      |
5
// +------------------------------------------------------------------------------------------------------+
5
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +------------------------------------------------------------------------------------------------------+
7
// +------------------------------------------------------------------------------------------------------+
8
// | This library is free software; you can redistribute it and/or                                        |
8
// | This library is free software; you can redistribute it and/or                                        |
9
// | modify it under the terms of the GNU General Public                                                  |
9
// | modify it under the terms of the GNU General Public                                                  |
10
// | License as published by the Free Software Foundation; either                                         |
10
// | License as published by the Free Software Foundation; either                                         |
11
// | version 2.1 of the License, or (at your option) any later version.                                   |
11
// | version 2.1 of the License, or (at your option) any later version.                                   |
12
// |                                                                                                      |
12
// |                                                                                                      |
13
// | This library is distributed in the hope that it will be useful,                                      |
13
// | This library is distributed in the hope that it will be useful,                                      |
14
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
14
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
15
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
15
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
16
// | General Public License for more details.                                                             |
16
// | General Public License for more details.                                                             |
17
// |                                                                                                      |
17
// |                                                                                                      |
18
// | You should have received a copy of the GNU General Public                                            |
18
// | You should have received a copy of the GNU General Public                                            |
19
// | License along with this library; if not, write to the Free Software                                  |
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                            |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
21
// +------------------------------------------------------------------------------------------------------+
21
// +------------------------------------------------------------------------------------------------------+
22
// CVS : $Id: inscription_liste.class.php,v 1.1 2005-09-22 14:02:47 ddelon Exp $
22
// CVS : $Id: inscription_liste.class.php,v 1.2 2005-09-27 16:36:01 alexandre_tb Exp $
23
/**
23
/**
24
* Application projet
24
* Application projet
25
*
25
*
26
* La classe inscription_liste
26
* La classe inscription_liste
27
*
27
*
28
*@package projet
28
*@package projet
29
//Auteur original :
29
//Auteur original :
30
*@author        Alexandre Granier <alexandre@tela-botanica.org>
30
*@author        Alexandre Granier <alexandre@tela-botanica.org>
31
//Autres auteurs :
31
//Autres auteurs :
32
*@author        Aucun
32
*@author        Aucun
33
*@copyright     Tela-Botanica 2000-2004
33
*@copyright     Tela-Botanica 2000-2004
34
*@version       $Revision: 1.1 $
34
*@version       $Revision: 1.2 $
35
// +------------------------------------------------------------------------------------------------------+
35
// +------------------------------------------------------------------------------------------------------+
36
*/
36
*/
37
 
37
 
38
 
38
 
39
// +------------------------------------------------------------------------------------------------------+
39
// +------------------------------------------------------------------------------------------------------+
40
// |                                            ENTETE du PROGRAMME                                       |
40
// |                                            ENTETE du PROGRAMME                                       |
41
// +------------------------------------------------------------------------------------------------------+
41
// +------------------------------------------------------------------------------------------------------+
42
 
42
 
43
 
43
 
44
/**
44
/**
45
 * class isncription_liste
45
 * class isncription_liste
46
 * 
46
 * 
47
 */
47
 */
48
class inscription_liste
48
class inscription_liste
49
{
49
{
50
     /*** Attributes: ***/
50
     /*** Attributes: ***/
51
 
51
 
52
    /**
52
    /**
53
     * Identifiant de la liste
53
     * Identifiant de la liste
54
     * @access private
54
     * @access private
55
     */
55
     */
56
    var $_id_liste;
56
    var $_id_liste;
57
    /**
57
    /**
58
     * Identifiant de l'utilisateur
58
     * Identifiant de l'utilisateur
59
     * @access private
59
     * @access private
60
     */
60
     */
61
    var $_id_utilisateur;
61
    var $_id_utilisateur;
62
    /**
62
    /**
63
     * Une ressource PEAR::DB
63
     * Une ressource PEAR::DB
64
     * @access private
64
     * @access private
65
     */
65
     */
66
    var $_db;
66
    var $_db;
67
    /**
67
    /**
68
     * Le type d'inscription indique : - 0 : pas d'email - 1 : normale - 2 : résumé
68
     * Le type d'inscription indique : - 0 : pas d'email - 1 : normale - 2 : résumé
69
     * @access private
69
     * @access private
70
     */
70
     */
71
    var $_type_inscription;
71
    var $_type_inscription;
72
 
72
 
73
    /**
73
    /**
74
     * Constructeur
74
     * Constructeur
75
     *
75
     *
76
     * @param DB objetDB Une ressource PEAR::DB
76
     * @param DB objetDB Une ressource PEAR::DB
77
     * @return void
77
     * @return void
78
     * @access public
78
     * @access public
79
     */
79
     */
80
    function inscription_liste( &$objetDB )
80
    function inscription_liste( &$objetDB )
81
    {
81
    {
82
        $this->_db = $objetDB ;
82
        $this->_db = $objetDB ;
83
    } // end of member function inscription_liste
83
    } // end of member function inscription_liste
84
 
84
 
85
    /**
85
    /**
86
     * Renvoie un tableau avec la liste des inscrit à une liste.
86
     * Renvoie un tableau avec la liste des inscrit à une liste.
87
     *
87
     *
88
     * @param int id_liste L'identifiant de la liste
88
     * @param int id_liste L'identifiant de la liste
89
     * @return Array
89
     * @return Array
90
     * @access public
90
     * @access public
91
     */
91
     */
92
    function getInscritsListe( $id_liste )
92
    function getInscritsListe( $id_liste )
93
    {
93
    {
94
        
94
        
95
    } // end of member function getInscritsListe
95
    } // end of member function getInscritsListe
96
 
96
 
97
    /**
97
    /**
98
     * 
98
     * 
99
     *
99
     *
100
     * @param annire utilisateur 
100
     * @param annire utilisateur 
101
     * @param liste_discussion id_liste 
101
     * @param liste_discussion id_liste 
102
     * @param int type_inscription 
102
     * @param int type_inscription 
103
     * @return void
103
     * @return void
104
     * @access public
104
     * @access public
105
     */
105
     */
106
    function inscrireUtilisateur( &$utilisateur,  &$liste,  $type_inscription )
106
    function inscrireUtilisateur( &$utilisateur,  &$liste,  $type_inscription )
107
    {
107
    {
108
        $requete = 'update projet_inscription_liste set '.
108
        $requete = 'update projet_inscription_liste set '.
109
                    'pil_id_liste='.$liste->getId().', pil_id_statut='.$type_inscription.' where pil_id_utilisateur='.$utilisateur->getInfo('identifiant') ; 
109
                    'pil_id_liste='.$liste->getId().', pil_id_statut='.$type_inscription.' where pil_id_utilisateur='.$utilisateur->getInfo('identifiant') ; 
110
        $resultat = $this->_db->query ($requete) ;
110
        $resultat = $this->_db->query ($requete) ;
111
        if (DB::isError ($resultat)) {
111
        if (DB::isError ($resultat)) {
112
            die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
112
            die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
113
        }
113
        }
114
        if ($this->_db->affectedRows() == 0) {
114
        if ($this->_db->affectedRows() == 0) {
115
            $requete = 'insert into projet_inscription_liste set pil_id_utilisateur='.$utilisateur->getInfo('identifiant').
115
            $requete = 'insert into projet_inscription_liste set pil_id_utilisateur='.$utilisateur->getInfo('identifiant').
116
                        ', pil_id_liste='.$liste->getId().', pil_id_statut='.$type_inscription ; 
116
                        ', pil_id_liste='.$liste->getId().', pil_id_statut='.$type_inscription ; 
117
            $resultat = $this->_db->query ($requete) ;
117
            $resultat = $this->_db->query ($requete) ;
118
            if (DB::isError ($resultat)) {
118
            if (DB::isError ($resultat)) {
119
                die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
119
                die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
120
            }
120
            }
121
        }
121
        }
122
        
122
        
123
        // Ajout dans la liste des commandes au serveur
123
        // Ajout dans la liste des commandes au serveur
124
        // On inscrit le créateur de la liste
124
        // On inscrit le créateur de la liste
125
        // On lance une commande pour ezmlm.sh
125
        // On lance une commande pour ezmlm.sh
126
        $commande = new commande_serveur (PROJET_CHEMIN_APPLI.'script_cron/ezmlm.sh') ;
126
        $commande = new commande_serveur (PROJET_CHEMIN_APPLI.'script_cron/ezmlm.sh') ;
127
        if (PEAR::isError($commande)) {
127
        if (PEAR::isError($commande)) {
128
            echo $commande->getMessage() ;
128
            echo $commande->getMessage() ;
129
        }
129
        }
130
        $commande_ajout_utilisateur = 'sudo -u vpopmail /usr/local/bin/ezmlm/ezmlm-sub '.
130
        $commande_ajout_utilisateur = 'sudo -u vpopmail /usr/local/bin/ezmlm/ezmlm-sub '.
131
                                    '/home/vpopmail/domains/'.$liste->getDomaine().'/'.$liste->getNom().' '.
131
                                    '/home/vpopmail/domains/'.$liste->getDomaine().'/'.$liste->getNom().' '.
132
                                    $utilisateur->getInfo('mail');
132
                                    $utilisateur->getInfo('mail');
133
        $commande->ajouterCommande($commande_ajout_utilisateur) ;
133
        $commande->ajouterCommande($commande_ajout_utilisateur) ;
134
    } // end of member function inscrireUtilisateur
134
    } // end of member function inscrireUtilisateur
135
 
135
 
136
    /**
136
    /**
137
     * 
137
     * 
138
     *
138
     *
139
     * @param int id_utilisateur 
139
     * @param int id_utilisateur 
140
     * @param int id_liste 
140
     * @param int id_liste 
141
     * @return void
141
     * @return void
142
     * @access public
142
     * @access public
143
     */
143
     */
144
    function desinscrireUtilisateur( &$utilisateur, &$liste )
144
    function desinscrireUtilisateur( &$utilisateur, &$liste )
145
    {
145
    {
146
        $requete = 'delete from projet_inscription_liste where pil_id_utilisateur='.$utilisateur->getInfo('identifiant').' and pil_id_liste='.$liste->getId() ;
146
        $requete = 'delete from projet_inscription_liste where pil_id_utilisateur='.$utilisateur->getInfo('identifiant').' and pil_id_liste='.$liste->getId() ;
147
        $resultat = $this->_db->query ($requete) ;
147
        $resultat = $this->_db->query ($requete) ;
148
        $commande_serveur = new commande_serveur(PROJET_CHEMIN_APPLI.'script_cron/ezmlm.sh') ;
148
        $commande_serveur = new commande_serveur(PROJET_CHEMIN_APPLI.'script_cron/ezmlm.sh') ;
149
        // On désinscrit l'utilisateur de la liste
149
        // On désinscrit l'utilisateur de la liste
150
        $commande_supressoin_utilisateur = 'sudo -u vpopmail /usr/local/bin/ezmlm/ezmlm-unsub '.
150
        $commande_supressoin_utilisateur = 'sudo -u vpopmail /usr/local/bin/ezmlm/ezmlm-unsub '.
151
                                    '/home/vpopmail/domains/'.$liste->getDomaine().'/'.$liste->getNom().' '.
151
                                    '/home/vpopmail/domains/'.$liste->getDomaine().'/'.$liste->getNom().' '.
152
                                    $utilisateur->getInfo('mail');
152
                                    $utilisateur->getInfo('mail');
153
        $commande_serveur->ajouterCommande ($commande_supressoin_utilisateur) ;
153
        $commande_serveur->ajouterCommande ($commande_supressoin_utilisateur) ;
154
    } // end of member function desinscrireUtilisateur
154
    } // end of member function desinscrireUtilisateur
155
 
155
 
156
    /**
156
    /**
157
     * 
157
     * 
158
     *
158
     *
159
     * @param int id_liste 
159
     * @param int id_liste 
160
     * @param int id_utilisateur 
160
     * @param int id_utilisateur 
161
     * @param int type_inscription 
161
     * @param int type_inscription 
162
     * @return void
162
     * @return void
163
     * @access public
163
     * @access public
164
     */
164
     */
165
    function modifierTypeInscription( $liste,  $utilisateur,  $type_inscription )
165
    function modifierTypeInscription( $liste,  $utilisateur,  $type_inscription )
166
    {
166
    {
-
 
167
        /*
167
        $requete = 'update projet_inscription_liste set '.
168
        $requete = 'update projet_inscription_liste set '.
168
                    'pil_id_liste='.$liste->getId().', pil_id_statut='.$type_inscription.' where pil_id_utilisateur='.$utilisateur->getInfo('identifiant') ; 
169
                    'pil_id_liste='.$liste->getId().', pil_id_statut='.$type_inscription.' where pil_id_utilisateur='.$utilisateur->getInfo('identifiant') ; 
169
        $resultat = $this->_db->query ($requete) ;
170
        $resultat = $this->_db->query ($requete) ;
170
        if (DB::isError ($resultat)) {
171
        if (DB::isError ($resultat)) {
171
            echo ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
172
            echo ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
172
        }
173
        }
173
        if ($this->_db->affectedRows() == 0) {
174
        if ($this->_db->affectedRows() == 0) {
174
            $requete = 'insert into projet_inscription_liste set '.
175
            $requete = 'insert into projet_inscription_liste set '.
175
                        'pil_id_liste='.$liste->getId().', pil_id_statut='.$type_inscription.', pil_id_utilisateur='.$utilisateur->getInfo('identifiant') ; 
176
                        'pil_id_liste='.$liste->getId().', pil_id_statut='.$type_inscription.', pil_id_utilisateur='.$utilisateur->getInfo('identifiant') ; 
176
            $resultat = $this->_db->query ($requete) ;
177
            $resultat = $this->_db->query ($requete) ;
177
            if (DB::isError ($resultat)) {
178
            if (DB::isError ($resultat)) {
178
                echo ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
179
                echo ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
179
            }
180
            }
180
        }
181
        }
-
 
182
        */
181
        // envoie d'une demande d'inscription par email à la liste
183
        // envoie d'une demande d'inscription par email à la liste
182
        include_once 'Mail.php' ;
184
        //include_once 'Mail.php' ;
183
        
185
        
184
        switch ($type_inscription) {
186
        switch ($type_inscription) {
185
            case 0 :
187
            case 0 :
-
 
188
            /*
186
                $commande_serveur = new commande_serveur(PROJET_CHEMIN_APPLI.'script_cron/ezmlm.sh') ;
189
                $commande_serveur = new commande_serveur(PROJET_CHEMIN_APPLI.'script_cron/ezmlm.sh') ;
187
                if (PEAR::isError($commande_serveur)) {
190
                if (PEAR::isError($commande_serveur)) {
188
                    echo $commande_serveur->getMessage() ;
191
                    echo $commande_serveur->getMessage() ;
189
                }
192
                }
190
                // On désinscrit l'utilisateur de la liste
193
                // On désinscrit l'utilisateur de la liste
191
                $commande_supressoin_utilisateur = 'sudo -u vpopmail /usr/local/bin/ezmlm/ezmlm-unsub '.
194
                $commande_supressoin_utilisateur = 'sudo -u vpopmail /usr/local/bin/ezmlm/ezmlm-unsub '.
192
                                            '/home/vpopmail/domains/'.$liste->getDomaine().'/'.$liste->getNom().' '.
195
                                            '/home/vpopmail/domains/'.$liste->getDomaine().'/'.$liste->getNom().' '.
193
                                            $utilisateur->getInfo('mail');
196
                                            $utilisateur->getInfo('mail');
194
                $commande_serveur->ajouterCommande ($commande_supressoin_utilisateur) ;
197
                $commande_serveur->ajouterCommande ($commande_supressoin_utilisateur) ;
-
 
198
            */
-
 
199
            // Ajout du modérateur en tant qu'utilisateur
-
 
200
            $resultat_suppression_utilisateur = file_get_contents ('http://vpopmail.'.$liste->getDomaine().'/suppression_abonne.php?domaine='.
-
 
201
                                    $liste->getDomaine().'&liste='.$liste->getNom().'&mail='.$utilisateur->getInfo('mail')) ;
-
 
202
 
195
            break ;
203
            break ;
196
            case 1 :
204
            case 1 :
-
 
205
                /*
197
                $commande_serveur = new commande_serveur(PROJET_CHEMIN_APPLI.'script_cron/ezmlm.sh') ;
206
                $commande_serveur = new commande_serveur(PROJET_CHEMIN_APPLI.'script_cron/ezmlm.sh') ;
198
                if (PEAR::isError($commande_serveur)) {
207
                if (PEAR::isError($commande_serveur)) {
199
                    echo $commande->getMessage() ;
208
                    echo $commande->getMessage() ;
200
                }
209
                }
201
                // On désinscrit l'utilisateur de la liste
210
                // On désinscrit l'utilisateur de la liste
202
                $commande_supressoin_utilisateur = 'sudo -u vpopmail /usr/local/bin/ezmlm/ezmlm-unsub '.
211
                $commande_supressoin_utilisateur = 'sudo -u vpopmail /usr/local/bin/ezmlm/ezmlm-unsub '.
203
                                            '/home/vpopmail/domains/'.$liste->getDomaine().'/'.$liste->getNom().' '.
212
                                            '/home/vpopmail/domains/'.$liste->getDomaine().'/'.$liste->getNom().' '.
204
                                            $utilisateur->getInfo('mail');
213
                                            $utilisateur->getInfo('mail');
205
                $commande_serveur->ajouterCommande ($commande_supressoin_utilisateur) ;
214
                $commande_serveur->ajouterCommande ($commande_supressoin_utilisateur) ;
206
                // envoie d'une demande d'inscription par email à la liste
215
                // envoie d'une demande d'inscription par email à la liste
207
                include_once 'Mail.php' ;
216
                include_once 'Mail.php' ;
208
                
217
                
209
                // Pour envoyer le mail on utilise la classe Mail de PEAR
218
                // Pour envoyer le mail on utilise la classe Mail de PEAR
210
                // on a besoin du mail de l'inscrit
219
                // on a besoin du mail de l'inscrit
211
        
220
        
212
                $entetes['From'] = $utilisateur->getInfo('mail');
221
                $entetes['From'] = $utilisateur->getInfo('mail');
213
                $entetes['To'] = $liste->getAdresseResume() ;
222
                $entetes['To'] = $liste->getAdresseResume() ;
214
                $entetes['Subject'] = '' ;
223
                $entetes['Subject'] = '' ;
215
                
224
                
216
                $objet_mail =& Mail::factory('smtp');
225
                $objet_mail =& Mail::factory('smtp');
217
                $objet_mail->send($entetes['To'], $entetes, '');
226
                $objet_mail->send($entetes['To'], $entetes, '');
-
 
227
            */
218
            break ;
228
            break ;
219
            case 2 : 
229
            case 2 : 
-
 
230
            /*
220
                $commande_serveur = new commande_serveur(PROJET_CHEMIN_APPLI.'script_cron/ezmlm.sh') ;
231
                $commande_serveur = new commande_serveur(PROJET_CHEMIN_APPLI.'script_cron/ezmlm.sh') ;
221
                if (PEAR::isError($commande_serveur)) {
232
                if (PEAR::isError($commande_serveur)) {
222
                    echo $commande_serveur->getMessage() ;
233
                    echo $commande_serveur->getMessage() ;
223
                }
234
                }
224
                // On désinscrit l'utilisateur de la liste
235
                // On désinscrit l'utilisateur de la liste
225
                $commande_ajout_utilisateur = 'sudo -u vpopmail /usr/local/bin/ezmlm/ezmlm-sub '.
236
                $commande_ajout_utilisateur = 'sudo -u vpopmail /usr/local/bin/ezmlm/ezmlm-sub '.
226
                                            '/home/vpopmail/domains/'.$liste->getDomaine().'/'.$liste->getNom().' '.
237
                                            '/home/vpopmail/domains/'.$liste->getDomaine().'/'.$liste->getNom().' '.
227
                                            $utilisateur->getInfo('mail');
238
                                            $utilisateur->getInfo('mail');
228
                $commande_serveur->ajouterCommande ($commande_ajout_utilisateur) ;
239
                $commande_serveur->ajouterCommande ($commande_ajout_utilisateur) ;
-
 
240
            */
-
 
241
                // Ajout d'un utilisateur
-
 
242
                $resultat_ajout_utilisateur = file_get_contents ('http://vpopmail.'.$liste->getDomaine().'/ajout_abonne.php?domaine='.
-
 
243
                                    $liste->getDomaine().'&liste='.$liste->getNom().'&mail='.$utilisateur->getInfo('mail')) ;
229
            break ;
244
            break ;
230
        }
245
        }
231
    } // end of member function modifierTypeInscription
246
    } // end of member function modifierTypeInscription
232
 
247
 
233
    /**
248
    /**
234
     * Renvoie la liste des statuts d'un utilisateur
249
     * Renvoie la liste des statuts d'un utilisateur
235
     *
250
     *
236
     * @param int id_utilisateur 
251
     * @param int id_utilisateur 
237
     * @return Array
252
     * @return Array
238
     * @access public
253
     * @access public
239
     */
254
     */
240
    function getStatutsInscrit( $id_utilisateur )
255
    function getStatutsInscrit( $id_utilisateur )
241
    {
256
    {
-
 
257
        
242
        $requete = 'select pil_id_liste, pil_id_statut from projet_inscription_liste where pil_id_utilisateur='.$id_utilisateur ;
258
        $requete = 'select pil_id_liste, pil_id_statut from projet_inscription_liste where pil_id_utilisateur='.$id_utilisateur ;
243
        $resultat = $this->_db->query ($requete) ;
259
        $resultat = $this->_db->query ($requete) ;echo $requete;
244
        if (DB::isError ($resultat)) {
260
        if (DB::isError ($resultat)) {
245
            die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
261
            die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
246
        }
262
        }
247
        $tableau_resultat = array() ;
263
        $tableau_resultat = array() ;
248
        while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
264
        while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
249
            $tableau_resultat[$ligne->pil_id_liste] = $ligne->pil_id_statut ;
265
            $tableau_resultat[$ligne->pil_id_liste] = $ligne->pil_id_statut ;
250
        }
266
        }
251
        return $tableau_resultat ;
267
        return $tableau_resultat ;
-
 
268
        
-
 
269
 
252
    } // end of member function getStatutsInscrit
270
    } // end of member function getStatutsInscrit
253
 
271
 
254
    /**
272
    /**
255
     * Renvoie le statut d'un inscrit à une liste
273
     * Renvoie le statut d'un inscrit à une liste
256
     *
274
     *
257
     * @param int id_liste 
275
     * @param int id_liste 
258
     * @param int id_utilisateur 
276
     * @param int id_utilisateur 
259
     * @return int
277
     * @return int
260
     * @access public
278
     * @access public
261
     */
279
     */
262
    function getStatutInscrit( $id_liste,  $id_utilisateur )
280
    function getStatutInscrit( $id_liste,  &$auth )
263
    {
281
    {
-
 
282
        /*
264
        $requete = 'select pil_id_liste, pil_id_statut from projet_inscription_liste where pil_id_utilisateur='.$id_utilisateur.
283
        $requete = 'select pil_id_liste, pil_id_statut from projet_inscription_liste where pil_id_utilisateur='.$id_utilisateur.
265
                    ' and pil_id_liste='.$id_liste;
284
                    ' and pil_id_liste='.$id_liste;
266
        $resultat = $this->_db->query ($requete) ;
285
        $resultat = $this->_db->query ($requete) ;
267
        if (DB::isError ($resultat)) {
286
        if (DB::isError ($resultat)) {
268
            die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
287
            die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
269
        }
288
        }
270
        
289
        
271
        $ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
290
        $ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
272
        
291
        
273
        return $ligne->pil_id_statut;
292
        return $ligne->pil_id_statut;
-
 
293
        */
-
 
294
        // Récupération de la liste des listes !!
-
 
295
        $requete = 'select pl_nom_liste, pl_domaine from projet_liste where pl_id_liste='.$id_liste ;
-
 
296
        $resultat = $this->_db->query ($requete) ;
-
 
297
        if (DB::isError ($resultat)) {
-
 
298
            die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
-
 
299
        }
-
 
300
        $ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
-
 
301
        $xml = file_get_contents('http://vpopmail.'.$ligne->pl_domaine.'/liste_abonnes.php?domaine='.
-
 
302
                            $ligne->pl_domaine.'&liste='.$ligne->pl_nom_liste) ;
-
 
303
        $tableau_mail = array() ;
-
 
304
        $tableau_ligne = explode ('<email>', $xml) ;
-
 
305
        foreach ($tableau_ligne as $ligne) array_push ($tableau_mail, strip_tags($ligne)) ;
-
 
306
        array_shift($tableau_mail) ;
-
 
307
        if (in_array($auth->getUsername(), $tableau_mail)) {
-
 
308
            return 2;       // Inscrit est le statut  2
-
 
309
        }
-
 
310
        return 0 ;
274
    } // end of member function getStatutInscrit
311
    } // end of member function getStatutInscrit
275
 
312
 
276
 
313
 
277
 
314
 
278
 
315
 
279
 
316
 
280
 
317
 
281
 
318
 
282
} // end of isncription_liste
319
} // end of isncription_liste
283
?>
320
?>