f92a4483 |
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 | |
0d407ce1 |
10 | require_once("include/session.inc.php"); |
0a65ec9d |
11 | require_once("include/misc.inc.php"); |
0d407ce1 |
12 | require_once("include/password.inc.php"); |
13 | require_once("include/NetNNTP.inc.php"); |
14 | require_once("include/groups.inc.php"); |
15 | require_once("include/format.inc.php"); |
16 | require_once("include/config.inc.php"); |
17 | require_once("include/profile.inc.php"); |
18 | require_once("include/subscribe.inc.php"); |
19 | require_once("include/error.inc.php"); |
f92a4483 |
20 | |
21 | $profile=getprofile(); |
0d407ce1 |
22 | require_once("include/header.inc.php"); |
f92a4483 |
23 | |
24 | $nntp = new nntp($news['server']); |
25 | if (!$nntp) error("nntpsock"); |
26 | if ($news['user']!="anonymous") { |
27 | $result = $nntp->authinfo($news["user"],$news["pass"]); |
28 | if (!$result) error("nntpauth"); |
29 | } |
30 | $groups = new groups($nntp,2); |
31 | ?> |
32 | |
40e27a11 |
33 | <h1> |
0a65ec9d |
34 | <?php echo _b_('Abonnements'); ?> |
40e27a11 |
35 | </h1> |
f92a4483 |
36 | |
37 | <?php |
38 | |
39 | if (isset($_POST['subscribe']) && isset($_POST['action']) |
40 | && $_POST['action']=="OK") { |
41 | update_subscriptions($_POST['subscribe']); |
42 | $profile['subscribe']=$_POST['subscribe']; |
43 | } |
44 | |
45 | if (!sizeof($groups->overview)) error("nntpgroups"); |
46 | |
47 | displayshortcuts(); |
48 | ?> |
49 | |
50 | <form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>"> |
e2cae7e3 |
51 | <table class="<?php echo $css["bicol"];?>" cellspacing="0" cellpadding="2"> |
f92a4483 |
52 | <tr> |
53 | <th> |
0a65ec9d |
54 | <?php echo _b_('Total'); ?> |
f92a4483 |
55 | </th> |
56 | <th> |
0a65ec9d |
57 | <?php echo _b_('Abonné'); ?> |
f92a4483 |
58 | </th> |
59 | <th> |
0a65ec9d |
60 | <?php echo _b_('Nom'); ?> |
f92a4483 |
61 | </th> |
62 | <th> |
0a65ec9d |
63 | <?php echo _b_('Description'); ?> |
f92a4483 |
64 | </th> |
65 | </tr> |
66 | <?php |
67 | $pair = true; |
68 | foreach ($groups->overview as $g => $d) { |
69 | $pair = !$pair; |
70 | $groupinfo = $nntp->group($g); |
71 | $newarts = $nntp->newnews($profile['lastnews'],$g); |
72 | ?> |
73 | <tr class="<?php echo ($pair?$css["pair"]:$css["impair"]);?>" > |
74 | <td class="<?php echo $css["total"]; ?>"> |
75 | <?php echo $groupinfo[0]; ?> |
76 | </td> |
77 | <td class="<?php echo $css["unread"]; ?>"> |
78 | <input type="checkbox" name="subscribe[]" value="<?php echo $g;?>" |
79 | <?php echo (in_array($g,$profile['subscribe'])?'checked="checked"' |
80 | :'');?> /> |
81 | </td> |
82 | <td class="<?php echo $css["group"]; ?>"> |
83 | <?php echo "<a href=\"thread.php?group=$g\">$g</a>";?> |
84 | </td> |
85 | <td class="<?php echo $css["description"]; ?>"> |
86 | <?php echo $d[0];?> |
87 | </td> |
88 | </tr> |
89 | <?php |
90 | } |
91 | ?> |
92 | <tr class="<?php echo (!$pair?$css["pair"]:$css["impair"]); ?>"> |
93 | <td colspan="4" class="bouton"> |
94 | <input type="submit" name="action" value="OK" /> |
95 | </td> |
96 | </tr> |
97 | </table> |
98 | </form> |
99 | <?php |
100 | |
101 | displayshortcuts(); |
102 | |
103 | $nntp->quit(); |
0d407ce1 |
104 | require_once("include/footer.inc.php"); |
f92a4483 |
105 | ?> |