big banana update
[banana.git] / index.php
CommitLineData
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
0d407ce1 10require_once("include/session.inc.php");
11require_once("include/password.inc.php");
12require_once("include/NetNNTP.inc.php");
13require_once("include/groups.inc.php");
14require_once("include/format.inc.php");
15require_once("include/config.inc.php");
16require_once("include/profile.inc.php");
17require_once("include/error.inc.php");
e2625e72 18
19$profile=getprofile();
0d407ce1 20require_once("include/header.inc.php");
90962c86 21
22$nntp = new nntp($news['server']);
a3b667fe 23if (!$nntp) error("nntpsock");
90962c86 24if ($news['user']!="anonymous") {
25 $result = $nntp->authinfo($news["user"],$news["pass"]);
a3b667fe 26 if (!$result) error("nntpauth");
90962c86 27}
8f98c1e8 28$groups = new groups($nntp,0);
7345b395 29if (!count($groups->overview)) $groups=new groups($nntp,2);
a3b667fe 30
8f98c1e8 31$newgroups = new groups($nntp,1);
90962c86 32?>
33
40e27a11 34<h1>
e2cae7e3 35 <?php echo _('Les forums de Banana'); ?>
40e27a11 36</h1>
90962c86 37
38<?php
a3b667fe 39if (!sizeof($groups->overview)) error("nntpgroups");
90962c86 40
41displayshortcuts();
42?>
43
e2cae7e3 44<table class="<?php echo $css["bicol"];?>" cellspacing="0" cellpadding="2">
90962c86 45 <tr>
46 <th>
e2cae7e3 47 <?php echo _('Total'); ?>
90962c86 48 </th>
49 <th>
e2cae7e3 50 <?php echo _('Nouveaux'); ?>
90962c86 51 </th>
52 <th>
e2cae7e3 53 <?php echo _('Nom'); ?>
90962c86 54 </th>
55 <th>
e2cae7e3 56 <?php echo _('Description'); ?>
90962c86 57 </th>
58 </tr>
59<?php
60$pair = true;
61foreach ($groups->overview as $g => $d) {
62 $pair = !$pair;
63 $groupinfo = $nntp->group($g);
30359882 64 $newarts = $nntp->newnews($profile['lastnews'],$g);
90962c86 65?>
7ce9f53d 66 <tr class="<?php echo ($pair?$css["pair"]:$css["impair"]);?>" >
67 <td class="<?php echo $css["total"]; ?>">
90962c86 68 <?php echo $groupinfo[0]; ?>
69 </td>
7ce9f53d 70 <td class="<?php echo $css["unread"]; ?>">
30359882 71 <?php echo sizeof($newarts); ?>
90962c86 72 </td>
7ce9f53d 73 <td class="<?php echo $css["group"]; ?>">
90962c86 74 <?php echo "<a href=\"thread.php?group=$g\">$g</a>";?>
75 </td>
7ce9f53d 76 <td class="<?php echo $css["description"]; ?>">
90962c86 77 <?php echo $d[0];?>
78 </td>
79 </tr>
80<?php
81}
82?>
83</table>
84<?php
8f98c1e8 85if (count($newgroups->overview) and count($profile['subscribe'])) {
86?>
87<p class="normal">
e2cae7e3 88<?php echo _('Les forums suivants ont été créés depuis ton dernier passage :'); ?>
8f98c1e8 89</p>
e2cae7e3 90<table class="<?php echo $css["bicol"];?>" cellspacing="0" cellpadding="2">
8f98c1e8 91 <tr>
92 <th>
e2cae7e3 93 <?php echo _('Total'); ?>
8f98c1e8 94 </th>
95 <th>
e2cae7e3 96 <?php echo _('Nom'); ?>
8f98c1e8 97 </th>
98 <th>
e2cae7e3 99 <?php echo _('Description'); ?>
8f98c1e8 100 </th>
101 </tr>
102<?php
103 $pair = true;
104 foreach ($newgroups->overview as $g => $d) {
105 $pair = !$pair;
106 $groupinfo = $nntp->group($g);
107?>
108 <tr class="<?php echo ($pair?$css["pair"]:$css["impair"]);?>" >
109 <td class="<?php echo $css["total"]; ?>">
110 <?php echo $groupinfo[0]; ?>
111 </td>
112 <td class="<?php echo $css["group"]; ?>">
113 <?php echo "<a href=\"thread.php?group=$g\">$g</a>";?>
114 </td>
115 <td class="<?php echo $css["description"]; ?>">
116 <?php echo $d[0];?>
117 </td>
118 </tr>
119<?php
120 } //foreach
121?>
122</table>
123<?php
124} // new newsgroups ?
90962c86 125
126displayshortcuts();
127
128$nntp->quit();
0d407ce1 129require_once("include/footer.inc.php");
90962c86 130?>