1c7063db73c71ee2e23c212e7ef768ba0ff21af0
[banana.git] / subscribe.php
1 <?php
2 /********************************************************************************
3 * subscribe.php : subscriptions page
4 * ---------------
5 *
6 * This file is part of the banana distribution
7 * Copyright: See COPYING files that comes with this distribution
8 ********************************************************************************/
9
10 require_once("include/banana.inc.php");
11 require_once("include/header.inc.php");
12
13 $groups = new BananaGroups(2);
14 ?>
15
16 <h1>
17 <?php echo _b_('Abonnements'); ?>
18 </h1>
19
20 <?php
21
22 if (isset($_POST['subscribe']) && isset($_POST['action']) && $_POST['action']=="OK") {
23 update_subscriptions($_POST['subscribe']);
24 $banana->profile['subscribe']=$_POST['subscribe'];
25 }
26
27 if (!sizeof($groups->overview)) error("nntpgroups");
28
29 displayshortcuts();
30 ?>
31
32 <form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
33 <table class="<?php echo $css["bicol"];?>" cellspacing="0" cellpadding="2">
34 <tr>
35 <th>
36 <?php echo _b_('Total'); ?>
37 </th>
38 <th>
39 <?php echo _b_('Abonné'); ?>
40 </th>
41 <th>
42 <?php echo _b_('Nom'); ?>
43 </th>
44 <th>
45 <?php echo _b_('Description'); ?>
46 </th>
47 </tr>
48 <?php
49 $pair = true;
50 foreach ($groups->overview as $g => $d) {
51 $pair = !$pair;
52 $groupinfo = $banana->nntp->group($g);
53 $newarts = $banana->nntp->newnews($banana->profile['lastnews'], $g);
54 ?>
55 <tr class="<?php echo ($pair?$css["pair"]:$css["impair"]);?>" >
56 <td class="<?php echo $css["total"]; ?>">
57 <?php echo $groupinfo[0]; ?>
58 </td>
59 <td class="<?php echo $css["unread"]; ?>">
60 <input type="checkbox" name="subscribe[]" value="<?php echo $g;?>"
61 <?php if (in_array($g, $banana->profile['subscribe'])) echo 'checked="checked"'; ?> />
62 </td>
63 <td class="<?php echo $css["group"]; ?>">
64 <?php echo "<a href=\"thread.php?group=$g\">$g</a>";?>
65 </td>
66 <td class="<?php echo $css["description"]; ?>">
67 <?php echo $d[0];?>
68 </td>
69 </tr>
70 <?php
71 }
72 ?>
73 <tr class="<?php echo (!$pair?$css["pair"]:$css["impair"]); ?>">
74 <td colspan="4" class="bouton">
75 <input type="submit" name="action" value="OK" />
76 </td>
77 </tr>
78 </table>
79 </form>
80 <?php
81
82 displayshortcuts();
83
84 $banana->nntp->quit();
85 require_once("include/footer.inc.php");
86 ?>