[ Index ] |
|
Code source de SPIP Agora 1.4 |
1 <?php 2 /***************************************************** 3 * This file is part of Agora, web based content management system. 4 * 5 * Agora is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; version 2 of the License. 8 * 9 * Agora is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details (file "COPYING"). 13 * 14 * Copyright © Arnaud Martin, Antoine Pitrou et Philippe Rivière. 15 * List of authors detailed in "copyright_fr.html" file. 16 * E-mail : agora@sig.premier-ministre.gouv.fr 17 * Web site : http://www.agora.gouv.fr 18 *****************************************************/ 19 //************ Enregistrement des utilisateurs de la newsletter - fxlacroix@clever-age.com **************************/ 20 // $ID$ 21 // Choix du nom de fichier pour l'exportation au format CSV 22 require_once ("PEAR.php"); 23 24 require_once (dirname(__FILE__). "/include/bd/inc_auteur_factory.php"); 25 include ("inc.php"); 26 include_ecrire ("inc_mots.php"); 27 require_once (dirname(__FILE__). "/include/bd/inc_newsletter_factory.php"); 28 require_once (dirname(__FILE__). "/include/bd/inc_cm_user_groups_factory.php"); 29 require_once (dirname(__FILE__). "/inc_newsletter_constants.php"); 30 require_once (dirname(__FILE__). "/inc_draw_api.php"); 31 require_once (dirname(__FILE__). "/include/bd/inc_subscriber_cm_factory.php"); 32 require_once (dirname(__FILE__). "/include/bd/inc_newsletter_cm_list_factory.php"); 33 require_once (dirname(__FILE__). "/include/bd/inc_subscriber_link_factory.php"); 34 require_once (dirname(__FILE__). "/include/bd/inc_subscriber_pending_factory.php"); 35 36 header ('Content-Type: text/x-csv'); 37 38 if (ereg("MSIE", $_SERVER['HTTP_USER_AGENT'])) { 39 header ('Content-Disposition: inline; filename="newsletter.csv"'); 40 } 41 else { 42 header ('Content-Disposition: attachment; filename="newsletter.csv"'); 43 } 44 45 //fxlacroix - liste_user_non_inscrit 46 //Pour l'exportation, on cree les personnes qui sont inscrits dans le fichier csfv en précisant le lrs mode et le mot inscrit 47 //Pour cela on utilise la table spip_LINK 48 $subscriber = &recuperer_instance_subscriber_link(); 49 $tab_total = $subscriber->liste($id_newsletter); 50 $tab_inscrits = $tab_total[0]; 51 $tab_non_inscrits = $tab_total[1]; 52 53 if (isset($_GET['domaine'])) { 54 if (is_array($tab_inscrits)) { 55 foreach ($tab_inscrits as $inscrits) { 56 if (ereg("(.*)@(" . $domaine . ")\.(.*[^\.])", $inscrits['email'])) { 57 echo ($inscrits['email']. "," . $inscrits['sub_first_name']. "," . $inscrits['sub_middle_name']. "," . $inscrits['sub_last_name']. "," . $inscrits['sub_title']. "," . ($inscrits['mode'] == 1 ? 'html' : 'text'). ",inscrit\n"); 58 } 59 } 60 } 61 if (is_array($tab_non_inscrits)) { 62 foreach ($tab_non_inscrits as $non_inscrits) { 63 if (ereg("(.*)@(" . $domaine . ")\.(.*[^\.])", $non_inscrits['email'])) { 64 echo ($non_inscrits['email']. "," . $non_inscrits['sub_first_name']. "," . $non_inscrits['sub_middle_name']. "," . $non_inscrits['sub_last_name']. "," . $non_inscrits['sub_title']. "," . ($non_inscrits['mode'] == 1 ? 'html' : 'text'). ",en attente\n"); 65 } 66 } 67 } 68 } 69 elseif (isset($_GET['suffixe'])) { 70 if (is_array($tab_inscrits)) { 71 foreach ($tab_inscrits as $inscrits) { 72 if (ereg("(.*)@(.*)\.(" . $suffixe . ")", $inscrits['email'])) { 73 echo ($inscrits['email']. "," . $inscrits['sub_first_name']. "," . $inscrits['sub_middle_name']. "," . $inscrits['sub_last_name']. "," . $inscrits['sub_title']. "," . ($inscrits['mode'] == 1 ? 'html' : 'text'). ",inscrit\n"); 74 } 75 } 76 } 77 if (is_array($tab_non_inscrits)) { 78 foreach ($tab_non_inscrits as $non_inscrits) { 79 if (ereg("(.*)@(.*)\.(" . $suffixe . ")", $non_inscrits['email'])) { 80 echo ($non_inscrits['email']. "," . $non_inscrits['sub_first_name']. "," . $non_inscrits['sub_middle_name']. "," . $non_inscrits['sub_last_name']. "," . $non_inscrits['sub_title']. "," . ($non_inscrits['mode'] == 1 ? 'html' : 'text'). ",en attente\n"); 81 } 82 } 83 } 84 } 85 86 unset ($subscriber); 87 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sat Feb 24 14:40:03 2007 | par Balluche grâce à PHPXref 0.7 |