Subversion Repositories Applications.projet

Rev

Rev 11 | Rev 30 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 11 Rev 23
Line 17... Line 17...
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.2 2005-09-27 16:36:01 alexandre_tb Exp $
22
// CVS : $Id: inscription_liste.class.php,v 1.3 2005-10-04 10:12:16 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
*
Line 29... Line 29...
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.2 $
34
*@version       $Revision: 1.3 $
35
// +------------------------------------------------------------------------------------------------------+
35
// +------------------------------------------------------------------------------------------------------+
36
*/
36
*/
Line 37... Line 37...
37
 
37
 
Line 162... Line 162...
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
        /*
-
 
168
        $requete = 'update projet_inscription_liste set '.
-
 
169
                    'pil_id_liste='.$liste->getId().', pil_id_statut='.$type_inscription.' where pil_id_utilisateur='.$utilisateur->getInfo('identifiant') ; 
-
 
170
        $resultat = $this->_db->query ($requete) ;
-
 
171
        if (DB::isError ($resultat)) {
-
 
172
            echo ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
-
 
173
        }
167
 
174
        if ($this->_db->affectedRows() == 0) {
-
 
175
            $requete = 'insert into projet_inscription_liste set '.
-
 
176
                        'pil_id_liste='.$liste->getId().', pil_id_statut='.$type_inscription.', pil_id_utilisateur='.$utilisateur->getInfo('identifiant') ; 
-
 
177
            $resultat = $this->_db->query ($requete) ;
-
 
178
            if (DB::isError ($resultat)) {
-
 
179
                echo ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
-
 
180
            }
-
 
181
        }
-
 
182
        */
-
 
183
        // envoie d'une demande d'inscription par email à la liste
168
        // envoie d'une demande d'inscription par email à la liste
184
        //include_once 'Mail.php' ;
169
        //include_once 'Mail.php' ;
Line 185... Line 170...
185
        
170
        
186
        switch ($type_inscription) {
171
        switch ($type_inscription) {
187
            case 0 :
-
 
188
            /*
-
 
189
                $commande_serveur = new commande_serveur(PROJET_CHEMIN_APPLI.'script_cron/ezmlm.sh') ;
-
 
190
                if (PEAR::isError($commande_serveur)) {
-
 
191
                    echo $commande_serveur->getMessage() ;
-
 
192
                }
-
 
193
                // On désinscrit l'utilisateur de la liste
-
 
194
                $commande_supressoin_utilisateur = 'sudo -u vpopmail /usr/local/bin/ezmlm/ezmlm-unsub '.
-
 
195
                                            '/home/vpopmail/domains/'.$liste->getDomaine().'/'.$liste->getNom().' '.
-
 
196
                                            $utilisateur->getInfo('mail');
-
 
197
                $commande_serveur->ajouterCommande ($commande_supressoin_utilisateur) ;
172
            case 0 :
198
            */
173
 
199
            // Ajout du modérateur en tant qu'utilisateur
174
            // Ajout du modérateur en tant qu'utilisateur
200
            $resultat_suppression_utilisateur = file_get_contents ('http://vpopmail.'.$liste->getDomaine().'/suppression_abonne.php?domaine='.
175
            $resultat_suppression_utilisateur = file_get_contents (PROJET_SERVEUR_VPOPMAIL.'/suppression_abonne.php?domaine='.
Line 201... Line 176...
201
                                    $liste->getDomaine().'&liste='.$liste->getNom().'&mail='.$utilisateur->getInfo('mail')) ;
176
                                    $liste->getDomaine().'&liste='.$liste->getNom().'&mail='.$utilisateur->getInfo('mail')) ;
202
 
177
 
203
            break ;
-
 
204
            case 1 :
-
 
205
                /*
-
 
206
                $commande_serveur = new commande_serveur(PROJET_CHEMIN_APPLI.'script_cron/ezmlm.sh') ;
-
 
207
                if (PEAR::isError($commande_serveur)) {
-
 
208
                    echo $commande->getMessage() ;
-
 
209
                }
-
 
210
                // On désinscrit l'utilisateur de la liste
-
 
211
                $commande_supressoin_utilisateur = 'sudo -u vpopmail /usr/local/bin/ezmlm/ezmlm-unsub '.
-
 
212
                                            '/home/vpopmail/domains/'.$liste->getDomaine().'/'.$liste->getNom().' '.
-
 
213
                                            $utilisateur->getInfo('mail');
-
 
214
                $commande_serveur->ajouterCommande ($commande_supressoin_utilisateur) ;
-
 
215
                // envoie d'une demande d'inscription par email à la liste
178
            break ;
216
                include_once 'Mail.php' ;
-
 
217
                
-
 
218
                // Pour envoyer le mail on utilise la classe Mail de PEAR
-
 
219
                // on a besoin du mail de l'inscrit
-
 
220
        
-
 
221
                $entetes['From'] = $utilisateur->getInfo('mail');
-
 
222
                $entetes['To'] = $liste->getAdresseResume() ;
-
 
223
                $entetes['Subject'] = '' ;
-
 
224
                
-
 
225
                $objet_mail =& Mail::factory('smtp');
-
 
226
                $objet_mail->send($entetes['To'], $entetes, '');
179
            case 1 :
227
            */
180
 
228
            break ;
-
 
229
            case 2 : 
-
 
230
            /*
-
 
231
                $commande_serveur = new commande_serveur(PROJET_CHEMIN_APPLI.'script_cron/ezmlm.sh') ;
-
 
232
                if (PEAR::isError($commande_serveur)) {
-
 
233
                    echo $commande_serveur->getMessage() ;
-
 
234
                }
-
 
235
                // On désinscrit l'utilisateur de la liste
-
 
236
                $commande_ajout_utilisateur = 'sudo -u vpopmail /usr/local/bin/ezmlm/ezmlm-sub '.
-
 
237
                                            '/home/vpopmail/domains/'.$liste->getDomaine().'/'.$liste->getNom().' '.
-
 
238
                                            $utilisateur->getInfo('mail');
181
            break ;
239
                $commande_serveur->ajouterCommande ($commande_ajout_utilisateur) ;
182
            case 2 : 
240
            */
183
 
241
                // Ajout d'un utilisateur
184
                // Ajout d'un utilisateur
242
                $resultat_ajout_utilisateur = file_get_contents ('http://vpopmail.'.$liste->getDomaine().'/ajout_abonne.php?domaine='.
185
                $resultat_ajout_utilisateur = file_get_contents (PROJET_SERVEUR_VPOPMAIL.'/ajout_abonne.php?domaine='.
243
                                    $liste->getDomaine().'&liste='.$liste->getNom().'&mail='.$utilisateur->getInfo('mail')) ;
186
                                    $liste->getDomaine().'&liste='.$liste->getNom().'&mail='.$utilisateur->getInfo('mail')) ;
244
            break ;
187
            break ;
Line 296... Line 239...
296
        $resultat = $this->_db->query ($requete) ;
239
        $resultat = $this->_db->query ($requete) ;
297
        if (DB::isError ($resultat)) {
240
        if (DB::isError ($resultat)) {
298
            die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
241
            die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
299
        }
242
        }
300
        $ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
243
        $ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
301
        $xml = file_get_contents('http://vpopmail.'.$ligne->pl_domaine.'/liste_abonnes.php?domaine='.
244
        $xml = file_get_contents(PROJET_SERVEUR_VPOPMAIL.'/liste_abonnes.php?domaine='.
302
                            $ligne->pl_domaine.'&liste='.$ligne->pl_nom_liste) ;
245
                            $ligne->pl_domaine.'&liste='.$ligne->pl_nom_liste) ;
303
        $tableau_mail = array() ;
246
        $tableau_mail = array() ;
304
        $tableau_ligne = explode ('<email>', $xml) ;
247
        $tableau_ligne = explode ('<email>', $xml) ;
305
        foreach ($tableau_ligne as $ligne) array_push ($tableau_mail, strip_tags($ligne)) ;
248
        foreach ($tableau_ligne as $ligne) array_push ($tableau_mail, strip_tags($ligne)) ;
306
        array_shift($tableau_mail) ;
249
        array_shift($tableau_mail) ;
307
        if (in_array($auth->getUsername(), $tableau_mail)) {
250
        if (in_array($auth->getUsername(), $tableau_mail)) {
308
            return 2;       // Inscrit est le statut  2
251
            return 2;       // Inscrit est le statut  2
309
        }
252
        }
310
        return 0 ;
253
        return 0 ;
311
    } // end of member function getStatutInscrit
254
    } // end of member function getStatutInscrit
312
 
-
 
313
 
-
 
314
 
-
 
315
 
-
 
316
 
-
 
317
 
-
 
318
 
-
 
319
} // end of isncription_liste
255
} // end of isncription_liste
320
?>
256
?>