use h1
[banana.git] / subscribe.php
CommitLineData
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
10require("include/session.inc.php");
11require("include/password.inc.php");
12require("include/NetNNTP.inc.php");
13require("include/groups.inc.php");
14require("include/format.inc.php");
15require("include/config.inc.php");
16require("include/profile.inc.php");
17require("include/subscribe.inc.php");
18require("include/error.inc.php");
19
20$profile=getprofile();
21require($profile['locale']);
22
23require("include/header.inc.php");
24
25$nntp = new nntp($news['server']);
26if (!$nntp) error("nntpsock");
27if ($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
40e27a11 34<h1>
f92a4483 35 <?php echo $locale['subscribe']['title'];?>
40e27a11 36</h1>
f92a4483 37
38<?php
39
40if (isset($_POST['subscribe']) && isset($_POST['action'])
41 && $_POST['action']=="OK") {
42 update_subscriptions($_POST['subscribe']);
43 $profile['subscribe']=$_POST['subscribe'];
44}
45
46if (!sizeof($groups->overview)) error("nntpgroups");
47
48displayshortcuts();
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;
70foreach ($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
103displayshortcuts();
104
105$nntp->quit();
106require("include/footer.inc.php");
107?>