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