* Copyright: See COPYING files that comes with this distribution
********************************************************************************/
-require("locales/locales.inc.php");
-require("include/session.inc.php");
-require("include/password.inc.php");
-require("include/NetNNTP.inc.php");
-require("include/groups.inc.php");
-require("include/format.inc.php");
-require("include/config.inc.php");
+require_once("include/session.inc.php");
+require_once("include/password.inc.php");
+require_once("include/NetNNTP.inc.php");
+require_once("include/groups.inc.php");
+require_once("include/format.inc.php");
+require_once("include/config.inc.php");
+require_once("include/profile.inc.php");
+require_once("include/error.inc.php");
-require("include/header.inc.php");
+$profile=getprofile();
+require_once($profile['locale']);
+
+require_once("include/header.inc.php");
$nntp = new nntp($news['server']);
+if (!$nntp) error("nntpsock");
if ($news['user']!="anonymous") {
$result = $nntp->authinfo($news["user"],$news["pass"]);
- if (!$result) {
- echo "<p class=\"error\">\n\t".$locale['error']['credentials']
- ."\n</p>";
- require("include/footer.inc.php");
- exit;
- }
+ if (!$result) error("nntpauth");
}
-$groups = new groups($nntp);
-
+$groups = new groups($nntp,0);
+if (!count($groups->overview)) $groups=new groups($nntp,2);
+
+$newgroups = new groups($nntp,1);
?>
-<div class="title">
+<h1>
<?php echo $locale['index']['title'];?>
-</div>
+</h1>
<?php
-if (!sizeof($groups->overview)) {
- echo '<p class="normal">';
- echo "\n".$locale['error']['nogroup']."\n";
- echo "</p>\n";
- require("include/footer.inc.php");
- exit;
-}
+if (!sizeof($groups->overview)) error("nntpgroups");
displayshortcuts();
?>
-<table class="bicol" cellspacing="0" cellpadding="2"
+<table class="<?php echo $css["bicol"];?>" cellspacing="0" cellpadding="2"
summary="<?php echo $locale['index']['summary'];?>">
<tr>
<th>
foreach ($groups->overview as $g => $d) {
$pair = !$pair;
$groupinfo = $nntp->group($g);
+ $newarts = $nntp->newnews($profile['lastnews'],$g);
?>
- <tr class="<?php echo ($pair?"pair":"impair");?>" >
- <td class="total">
+ <tr class="<?php echo ($pair?$css["pair"]:$css["impair"]);?>" >
+ <td class="<?php echo $css["total"]; ?>">
<?php echo $groupinfo[0]; ?>
</td>
- <td class="unread">
- 0
+ <td class="<?php echo $css["unread"]; ?>">
+ <?php echo sizeof($newarts); ?>
</td>
- <td class="group">
+ <td class="<?php echo $css["group"]; ?>">
<?php echo "<a href=\"thread.php?group=$g\">$g</a>";?>
</td>
- <td class="description">
+ <td class="<?php echo $css["description"]; ?>">
<?php echo $d[0];?>
</td>
</tr>
?>
</table>
<?php
+if (count($newgroups->overview) and count($profile['subscribe'])) {
+?>
+<p class="normal">
+<?php echo $locale['index']['newgroupstext']; ?>
+</p>
+<table class="<?php echo $css["bicol"];?>" cellspacing="0" cellpadding="2"
+ summary="<?php echo $locale['index']['summary'];?>">
+ <tr>
+ <th>
+ <?php echo $locale['index']['total'];?>
+ </th>
+ <th>
+ <?php echo $locale['index']['name'];?>
+ </th>
+ <th>
+ <?php echo $locale['index']['description'];?>
+ </th>
+ </tr>
+<?php
+ $pair = true;
+ foreach ($newgroups->overview as $g => $d) {
+ $pair = !$pair;
+ $groupinfo = $nntp->group($g);
+?>
+ <tr class="<?php echo ($pair?$css["pair"]:$css["impair"]);?>" >
+ <td class="<?php echo $css["total"]; ?>">
+ <?php echo $groupinfo[0]; ?>
+ </td>
+ <td class="<?php echo $css["group"]; ?>">
+ <?php echo "<a href=\"thread.php?group=$g\">$g</a>";?>
+ </td>
+ <td class="<?php echo $css["description"]; ?>">
+ <?php echo $d[0];?>
+ </td>
+ </tr>
+<?php
+ } //foreach
+?>
+</table>
+<?php
+} // new newsgroups ?
displayshortcuts();
$nntp->quit();
-require("include/footer.inc.php");
+require_once("include/footer.inc.php");
?>