web pages
[banana.git] / index.php
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
10 require("locales/locales.inc.php");
11 require("include/session.inc.php");
12 require("include/password.inc.php");
13 require("include/NetNNTP.inc.php");
14 require("include/groups.inc.php");
15 require("include/format.inc.php");
16 require("include/config.inc.php");
17
18 require("include/header.inc.php");
19
20 $nntp = new nntp($news['server']);
21 if ($news['user']!="anonymous") {
22 $result = $nntp->authinfo($news["user"],$news["pass"]);
23 if (!$result) {
24 echo "<p class=\"error\">\n\t".$locale['error']['credentials']
25 ."\n</p>";
26 require("include/footer.inc.php");
27 exit;
28 }
29 }
30 $groups = new groups($nntp);
31
32 ?>
33
34 <div class="title">
35 <?php echo $locale['index']['title'];?>
36 </div>
37
38 <?php
39 if (!sizeof($groups->overview)) {
40 echo '<p class="normal">';
41 echo "\n".$locale['error']['nogroup']."\n";
42 echo "</p>\n";
43 require("include/footer.inc.php");
44 exit;
45 }
46
47 displayshortcuts();
48 ?>
49
50 <table class="bicol" cellspacing="0" cellpadding="2"
51 summary="<?php echo $locale['index']['summary'];?>">
52 <tr>
53 <th>
54 <?php echo $locale['index']['total'];?>
55 </th>
56 <th>
57 <?php echo $locale['index']['unread'];?>
58 </th>
59 <th>
60 <?php echo $locale['index']['name'];?>
61 </th>
62 <th>
63 <?php echo $locale['index']['description'];?>
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 ?>
72 <tr class="<?php echo ($pair?"pair":"impair");?>" >
73 <td class="total">
74 <?php echo $groupinfo[0]; ?>
75 </td>
76 <td class="unread">
77 0
78 </td>
79 <td class="group">
80 <?php echo "<a href=\"thread.php?group=$g\">$g</a>";?>
81 </td>
82 <td class="description">
83 <?php echo $d[0];?>
84 </td>
85 </tr>
86 <?php
87 }
88 ?>
89 </table>
90 <?php
91
92 displayshortcuts();
93
94 $nntp->quit();
95 require("include/footer.inc.php");
96 ?>