[ 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 require_once 'include/settings.php'; 20 21 require_once 'design/top.php'; 22 23 // Defines help presented in the right column 24 define('CM_COLUMN_RIGHT', " 25 <h2>Remove</h2> 26 <p>You can remove subscribers...</p> 27 "); 28 ?> 29 30 <div class = "content"> 31 <h1> Remove subscribers</h1> 32 33 <?php 34 $data = array(); 35 36 if (isset($_FILES['cm_file']) && is_uploaded_file($_FILES['cm_file']['tmp_name'])) { 37 $data = array_merge($data, file($_FILES['cm_file']['tmp_name'])); 38 } 39 40 if (isset($_POST['cm_subs']) && strlen($_POST['cm_subs']) > 0) { 41 $subString = ereg_replace("(\n|\r)+", "#", $_POST['cm_subs']); 42 $subArray = explode('#', $subString); 43 $data = array_merge($data, $subArray); 44 } 45 46 if (count($data) > 0) { 47 if (isset($_POST['cm_lists']) && is_array($_POST['cm_lists'])) { 48 $lists = $_POST['cm_lists']; 49 } 50 51 echo '<p>Removing subscribers:</p><p>'; 52 $nbSub = 0; 53 54 foreach ($data as $address) { 55 $address = trim($address); 56 if (ereg("^([^@ ]+@[^@ ]+\.[^@.; ]+)$", $address)) { 57 // format: user@example.com 58 if ($subId = $db->getOne("SELECT sub_id FROM " . CM_TABLE_PREFIX . "_subscribers WHERE sub_email='" . $address . "'")) { 59 $db->query("DELETE FROM " . CM_TABLE_PREFIX . "_lists_subscribers WHERE sub_id = " . $subId); 60 $db->query("DELETE FROM " . CM_TABLE_PREFIX . "_subscribers WHERE sub_id = " . $subId); 61 $db->query("DELETE FROM " . CM_TABLE_PREFIX . "_pending WHERE sub_id = " . $subId); 62 $db->query("DELETE FROM " . CM_TABLE_PREFIX . "_posts_queued WHERE sub_id = " . $subId); 63 $db->query("DELETE FROM " . CM_TABLE_PREFIX . "_posts_done WHERE sub_id = " . $subId); 64 $nbSub++; 65 } 66 } 67 elseif ($address != '') { 68 echo '<span class="error">Error: ' . $address . '</span><br />'; 69 } 70 } 71 echo '<span class="noerror">' . ($nbSub > 0 ? $nbSub : 'No'). ' subscriber' . ($nbSub > 1 ? 's' : ''). ' removed</span></p>'; 72 } 73 ?> 74 75 <table width = "100%" class = "form"> 76 <form enctype = "multipart/form-data" action = "subscribers_remove.php" method = "post"> 77 <tr> 78 <td class = "label"> 79 Upload CSV file:</td> 80 81 <td class = "field"> 82 <input type = "file" name = "cm_file"/> 83 84 <br/> 85 86 <span class = "tips"> Line format: user@example.com</span> 87 </td> 88 </tr> 89 90 <tr> 91 <td class = "label"> 92 Type addresses:</td> 93 94 <td class = "field"> 95 <textarea name = "cm_subs" cols = "50" rows = "10" wrap = "virtual"></textarea> 96 97 <br/> 98 99 <span class = "tips"> Line format: user@example.com</span> 100 </td> 101 </tr> 102 103 <tr> 104 <td colspan = "2"> 105 <input type = "submit" value = "Remove"/> 106 </td> 107 </tr> 108 </form> 109 </table> 110 </div> 111 112 <?php 113 require_once 'design/bottom.php'; 114 ?>
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 |