973e4db8ed0acb86b86369575f92edd9aa95a082
[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_once("include/banana.inc.php");
11 require_once("include/header.inc.php");
12
13 $groups = new BananaGroups(0);
14 if (!count($groups->overview)) {
15 $groups = new BananaGroups(2);
16 } else {
17 $newgroups = new BananaGroups(1);
18 }
19
20 ?>
21
22 <h1>
23 <?php echo _b_('Les forums de Banana'); ?>
24 </h1>
25
26 <?php
27 if (!sizeof($groups->overview)) error("nntpgroups");
28
29 displayshortcuts();
30 ?>
31
32 <table class="<?php echo $css["bicol"];?>" cellspacing="0" cellpadding="2">
33 <tr>
34 <th>
35 <?php echo _b_('Total'); ?>
36 </th>
37 <th>
38 <?php echo _b_('Nouveaux'); ?>
39 </th>
40 <th>
41 <?php echo _b_('Nom'); ?>
42 </th>
43 <th>
44 <?php echo _b_('Description'); ?>
45 </th>
46 </tr>
47 <?php
48 $pair = true;
49 foreach ($groups->overview as $g => $d) {
50 $pair = !$pair;
51 $groupinfo = $banana->nntp->group($g);
52 $newarts = $banana->nntp->newnews($banana->profile['lastnews'],$g);
53 ?>
54 <tr class="<?php echo ($pair?$css["pair"]:$css["impair"]);?>" >
55 <td class="<?php echo $css["total"]; ?>">
56 <?php echo $groupinfo[0]; ?>
57 </td>
58 <td class="<?php echo $css["unread"]; ?>">
59 <?php echo sizeof($newarts); ?>
60 </td>
61 <td class="<?php echo $css["group"]; ?>">
62 <?php echo "<a href=\"thread.php?group=$g\">$g</a>";?>
63 </td>
64 <td class="<?php echo $css["description"]; ?>">
65 <?php echo $d[0];?>
66 </td>
67 </tr>
68 <?php
69 }
70 ?>
71 </table>
72 <?php
73 if (count($newgroups->overview) and count($banana->profile['subscribe'])) {
74 ?>
75 <p class="normal">
76 <?php echo _b_('Les forums suivants ont été créés depuis ton dernier passage :'); ?>
77 </p>
78 <table class="<?php echo $css["bicol"];?>" cellspacing="0" cellpadding="2">
79 <tr>
80 <th>
81 <?php echo _b_('Total'); ?>
82 </th>
83 <th>
84 <?php echo _b_('Nom'); ?>
85 </th>
86 <th>
87 <?php echo _b_('Description'); ?>
88 </th>
89 </tr>
90 <?php
91 $pair = true;
92 foreach ($newgroups->overview as $g => $d) {
93 $pair = !$pair;
94 $groupinfo = $banana->nntp->group($g);
95 ?>
96 <tr class="<?php echo ($pair?$css["pair"]:$css["impair"]);?>" >
97 <td class="<?php echo $css["total"]; ?>">
98 <?php echo $groupinfo[0]; ?>
99 </td>
100 <td class="<?php echo $css["group"]; ?>">
101 <?php echo "<a href=\"thread.php?group=$g\">$g</a>";?>
102 </td>
103 <td class="<?php echo $css["description"]; ?>">
104 <?php echo $d[0];?>
105 </td>
106 </tr>
107 <?php
108 } //foreach
109 ?>
110 </table>
111 <?php
112 } // new newsgroups ?
113
114 displayshortcuts();
115
116 $banana->nntp->quit();
117 require_once("include/footer.inc.php");
118 ?>