90962c86 |
1 | <?php |
2 | /******************************************************************************** |
3 | * index.php : main page (newsgroups list) |
4 | * ----------- |
5 | * |
6 | * This file is part of the banana distribution |
7 | * Copyright: See COPYING files that comes with this distribution |
8 | ********************************************************************************/ |
9 | |
90962c86 |
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"); |
e2625e72 |
16 | require("include/profile.inc.php"); |
a3b667fe |
17 | require("include/error.inc.php"); |
e2625e72 |
18 | |
19 | $profile=getprofile(); |
20 | require($profile['locale']); |
90962c86 |
21 | |
22 | require("include/header.inc.php"); |
23 | |
24 | $nntp = new nntp($news['server']); |
a3b667fe |
25 | if (!$nntp) error("nntpsock"); |
90962c86 |
26 | if ($news['user']!="anonymous") { |
27 | $result = $nntp->authinfo($news["user"],$news["pass"]); |
a3b667fe |
28 | if (!$result) error("nntpauth"); |
90962c86 |
29 | } |
8f98c1e8 |
30 | $groups = new groups($nntp,0); |
7345b395 |
31 | if (!count($groups->overview)) $groups=new groups($nntp,2); |
a3b667fe |
32 | |
8f98c1e8 |
33 | $newgroups = new groups($nntp,1); |
90962c86 |
34 | ?> |
35 | |
7ce9f53d |
36 | <div class="<?php echo $css["title"];?>"> |
90962c86 |
37 | <?php echo $locale['index']['title'];?> |
38 | </div> |
39 | |
40 | <?php |
a3b667fe |
41 | if (!sizeof($groups->overview)) error("nntpgroups"); |
90962c86 |
42 | |
43 | displayshortcuts(); |
44 | ?> |
45 | |
7ce9f53d |
46 | <table class="<?php echo $css["bicol"];?>" cellspacing="0" cellpadding="2" |
90962c86 |
47 | summary="<?php echo $locale['index']['summary'];?>"> |
48 | <tr> |
49 | <th> |
50 | <?php echo $locale['index']['total'];?> |
51 | </th> |
52 | <th> |
53 | <?php echo $locale['index']['unread'];?> |
54 | </th> |
55 | <th> |
56 | <?php echo $locale['index']['name'];?> |
57 | </th> |
58 | <th> |
59 | <?php echo $locale['index']['description'];?> |
60 | </th> |
61 | </tr> |
62 | <?php |
63 | $pair = true; |
64 | foreach ($groups->overview as $g => $d) { |
65 | $pair = !$pair; |
66 | $groupinfo = $nntp->group($g); |
30359882 |
67 | $newarts = $nntp->newnews($profile['lastnews'],$g); |
90962c86 |
68 | ?> |
7ce9f53d |
69 | <tr class="<?php echo ($pair?$css["pair"]:$css["impair"]);?>" > |
70 | <td class="<?php echo $css["total"]; ?>"> |
90962c86 |
71 | <?php echo $groupinfo[0]; ?> |
72 | </td> |
7ce9f53d |
73 | <td class="<?php echo $css["unread"]; ?>"> |
30359882 |
74 | <?php echo sizeof($newarts); ?> |
90962c86 |
75 | </td> |
7ce9f53d |
76 | <td class="<?php echo $css["group"]; ?>"> |
90962c86 |
77 | <?php echo "<a href=\"thread.php?group=$g\">$g</a>";?> |
78 | </td> |
7ce9f53d |
79 | <td class="<?php echo $css["description"]; ?>"> |
90962c86 |
80 | <?php echo $d[0];?> |
81 | </td> |
82 | </tr> |
83 | <?php |
84 | } |
85 | ?> |
86 | </table> |
87 | <?php |
8f98c1e8 |
88 | if (count($newgroups->overview) and count($profile['subscribe'])) { |
89 | ?> |
90 | <p class="normal"> |
91 | <?php echo $locale['index']['newgroupstext']; ?> |
92 | </p> |
93 | <table class="<?php echo $css["bicol"];?>" cellspacing="0" cellpadding="2" |
94 | summary="<?php echo $locale['index']['summary'];?>"> |
95 | <tr> |
96 | <th> |
97 | <?php echo $locale['index']['total'];?> |
98 | </th> |
99 | <th> |
100 | <?php echo $locale['index']['name'];?> |
101 | </th> |
102 | <th> |
103 | <?php echo $locale['index']['description'];?> |
104 | </th> |
105 | </tr> |
106 | <?php |
107 | $pair = true; |
108 | foreach ($newgroups->overview as $g => $d) { |
109 | $pair = !$pair; |
110 | $groupinfo = $nntp->group($g); |
111 | ?> |
112 | <tr class="<?php echo ($pair?$css["pair"]:$css["impair"]);?>" > |
113 | <td class="<?php echo $css["total"]; ?>"> |
114 | <?php echo $groupinfo[0]; ?> |
115 | </td> |
116 | <td class="<?php echo $css["group"]; ?>"> |
117 | <?php echo "<a href=\"thread.php?group=$g\">$g</a>";?> |
118 | </td> |
119 | <td class="<?php echo $css["description"]; ?>"> |
120 | <?php echo $d[0];?> |
121 | </td> |
122 | </tr> |
123 | <?php |
124 | } //foreach |
125 | ?> |
126 | </table> |
127 | <?php |
128 | } // new newsgroups ? |
90962c86 |
129 | |
130 | displayshortcuts(); |
131 | |
132 | $nntp->quit(); |
133 | require("include/footer.inc.php"); |
134 | ?> |