[ 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 /* 20 if (!file_exists('include/appconfig.php')) { 21 header('Location: install.php'); 22 } 23 */ 24 require_once 'include/settings.php'; 25 26 require_once 'design/top.php'; 27 ?> 28 29 <div class = "content"> 30 <?php 31 if (isset($_GET['error'])) { 32 echo '<p class="error">' . $_GET['error']. '</p>'; 33 } 34 35 echo '<h1>Newsletters</h1>'; 36 37 if ($db->getOne("SELECT COUNT(*) FROM " . CM_TABLE_PREFIX . "_lists") > 0) { 38 echo '<p>Below is the list of existing newsletters:</p>'; 39 $lists = $db->query("SELECT lst_id, lst_name, lst_comment FROM " . CM_TABLE_PREFIX . "_lists ORDER BY lst_name"); 40 while ($list = $lists->fetchRow()) { 41 $listInfo = array(); 42 $listInfo['subscribers'] = $db->getOne("SELECT COUNT(*) FROM " . CM_TABLE_PREFIX . "_lists_subscribers WHERE lst_id = " . $list['lst_id']); 43 $listInfo['pending_sub'] = $db->getOne("SELECT COUNT(*) FROM " . CM_TABLE_PREFIX . "_pending WHERE lst_id = " . $list['lst_id']. " AND pnd_action = 'subscribe'"); 44 $listInfo['pending_unsub'] = $db->getOne("SELECT COUNT(*) FROM " . CM_TABLE_PREFIX . "_pending WHERE lst_id = " . $list['lst_id']. " AND pnd_action = 'unsubscribe'"); 45 $listInfo['posts_new'] = $db->getOne("SELECT COUNT(*) FROM " . CM_TABLE_PREFIX . "_posts WHERE lst_id=" . $list['lst_id']. " AND pst_date_sent = 0"); 46 $listInfo['posts_queued'] = $db->getOne("SELECT COUNT(DISTINCT p.pst_id) FROM " . CM_TABLE_PREFIX . "_posts p, " . CM_TABLE_PREFIX . "_posts_queued q WHERE p.pst_id = q.pst_id AND p.lst_id=" . $list['lst_id']); 47 $queuedList = implode(',', $db->getCol("SELECT DISTINCT q.pst_id FROM " . CM_TABLE_PREFIX . "_posts p, " . CM_TABLE_PREFIX . "_posts_queued q WHERE p.pst_id = q.pst_id AND p.lst_id=" . $list['lst_id'])); 48 $listInfo['posts_sent'] = $db->getOne("SELECT COUNT(DISTINCT p.pst_id) FROM " . CM_TABLE_PREFIX . "_posts p, " . CM_TABLE_PREFIX . "_posts_done d WHERE p.pst_id = d.pst_id AND p.lst_id=" . $list['lst_id']. (strlen($queuedList) > 0 ? " AND d.pst_id NOT IN (" . $queuedList . ")" : '')); 49 ?> 50 51 <div class = "list"> 52 <h2><?php 53 echo $list['lst_name'] 54 ?></h2> 55 56 <table width = "100%" class = "form"> 57 <tr> 58 <td class = "label"> 59 Description:</td> 60 61 <td class = "field" colspan = "3"><?php 62 echo $list['lst_comment'] 63 ?></td> 64 </tr> 65 66 <tr> 67 <td class = "label"> 68 Subscribers:</td> 69 70 <td class = "field"> 71 <?php 72 if ($listInfo['subscribers'] > 0) { 73 ?> 74 75 <a href = "lists_subscribers.php?id=<?php echo $list['lst_id']?>"><?php 76 echo $listInfo['subscribers'] 77 ?></a> 78 79 <?php 80 } 81 else { 82 echo 'none'; 83 } 84 ?> 85 86 </td> 87 88 <td class = "field"> 89 90 <?php 91 if ($listInfo['pending_sub'] > 0) { 92 echo $listInfo['pending_sub']. ' pending subscription' . ($listInfo['pending_sub'] > 1 ? 's' : ''); 93 } 94 else { 95 echo 'no pending subscription'; 96 } 97 ?> 98 99 </td> 100 101 <td class = "field"> 102 103 <?php 104 if ($listInfo['pending_unsub'] > 0) { 105 echo $listInfo['pending_unsub']. ' pending unsubscription' . ($listInfo['pending_unsub'] > 1 ? 's' : ''); 106 } 107 else { 108 echo 'no pending unsubscription'; 109 } 110 ?> 111 112 </td> 113 </tr> 114 115 <tr> 116 <td class = "label"> 117 Posts:</td> 118 119 <td class = "field"> 120 <?php 121 if ($listInfo['posts_new'] > 0) { 122 ?> 123 124 <a href = "posts.php?lst_id=<?php echo $list['lst_id']?>"><?php 125 echo $listInfo['posts_new'] 126 ?> 127 128 new post<?php 129 echo ($listInfo['posts_new'] > 1 ? 's' : '') 130 ?></a> 131 132 <?php 133 } 134 else { 135 echo 'no new post'; 136 } 137 ?> 138 139 </td> 140 141 <td class = "field"> 142 <?php 143 if ($listInfo['posts_queued'] > 0) { 144 ?> 145 146 <a href = "posts.php?lst_id=<?php echo $list['lst_id']?>"><?php 147 echo $listInfo['posts_queued'] 148 ?> 149 150 post<?php 151 echo ($listInfo['posts_queued'] > 1 ? 's' : '') 152 ?> 153 154 queued</a> 155 156 <?php 157 } 158 else { 159 echo 'no post queued'; 160 } 161 ?> 162 163 </td> 164 165 <td class = "field"> 166 <?php 167 if ($listInfo['posts_sent'] > 0) { 168 ?> 169 170 <a href = "posts.php?lst_id=<?php echo $list['lst_id']?>"><?php 171 echo $listInfo['posts_sent'] 172 ?> 173 174 post<?php 175 echo ($listInfo['posts_sent'] > 1 ? 's' : '') 176 ?> 177 178 sent</a> 179 180 <?php 181 } 182 else { 183 echo 'no post sent'; 184 } 185 ?> 186 187 </td> 188 </tr> 189 190 <tr> 191 <td class = "label"> 192 Actions:</td> 193 194 <td class = "field"> 195 <a href = "lists_edit.php?id=<?php echo $list['lst_id']?>"> modify list</a> 196 </td> 197 198 <td class = "field"> 199 <?php 200 if ($listInfo['subscribers'] == 0) { 201 ?> 202 203 <a href = "lists_remove.php?id=<?php echo $list['lst_id']?>"> remove list</a> 204 205 <?php 206 } 207 else { 208 echo '<span class="help" title="Can\'t remove a list with subscribers">remove list</span>'; 209 } 210 ?> 211 212 </td> 213 214 <td class = "field"> 215 <a href = "post_edit.php?lst_id=<?php echo $list['lst_id']?>&pst_id=-1"> create new post</a> 216 </td> 217 </tr> 218 </table> 219 </div> 220 221 <?php 222 } 223 } 224 else { 225 ?> 226 227 <p> 228 There is currently no list defined.</p> 229 230 <?php 231 } 232 ?> 233 234 <p> 235 <a href = "lists_edit.php?id=-1">Create</a> a new list!</p> 236 </div> 237 238 <div class = "pagefooter"> 239 <a href = "http://php.net/" title = "PHP: Hypertext Preprocessor"><img src = "design/images/icon-php.png" width = "88" height = "31" alt = "Powered by PHP"/></a><a href = "http://pear.php.net/package-info.php?pacid=46"><img src = "design/images/icon-pear.png" width = "88" height = "31" alt = "Powered by PEAR"/></a><a href = "http://validator.w3.org/check/referer"><img src = "design/images/icon-xhtml10.png" width = "88" height = "31" alt = "Valid XHTML 1.0"/></a> 240 </div> 241 242 <?php 243 require_once 'design/bottom.php'; 244 ?>
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 |