2
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
10
* +-----------------------------------------------------------------------+
12
* | W3C� SOFTWARE NOTICE AND LICENSE |
13
* | http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 |
15
* | This work (and included software, documentation such as READMEs, |
16
* | or other related items) is being provided by the copyright holders |
17
* | under the following license. By obtaining, using and/or copying |
18
* | this work, you (the licensee) agree that you have read, understood, |
19
* | and will comply with the following terms and conditions. |
21
* | Permission to copy, modify, and distribute this software and its |
22
* | documentation, with or without modification, for any purpose and |
23
* | without fee or royalty is hereby granted, provided that you include |
24
* | the following on ALL copies of the software and documentation or |
25
* | portions thereof, including modifications: |
27
* | 1. The full text of this NOTICE in a location viewable to users |
28
* | of the redistributed or derivative work. |
30
* | 2. Any pre-existing intellectual property disclaimers, notices, |
31
* | or terms and conditions. If none exist, the W3C Software Short |
32
* | Notice should be included (hypertext is preferred, text is |
33
* | permitted) within the body of any redistributed or derivative |
36
* | 3. Notice of any changes or modifications to the files, including |
37
* | the date changes were made. (We recommend you provide URIs to |
38
* | the location from which the code is derived.) |
40
* | THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT |
41
* | HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, |
42
* | INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR |
43
* | FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE |
44
* | OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, |
45
* | COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. |
47
* | COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, |
48
* | SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE |
49
* | SOFTWARE OR DOCUMENTATION. |
51
* | The name and trademarks of copyright holders may NOT be used in |
52
* | advertising or publicity pertaining to the software without |
53
* | specific, written prior permission. Title to copyright in this |
54
* | software and any associated documentation will at all times |
55
* | remain with copyright holders. |
57
* +-----------------------------------------------------------------------+
62
* @author Heino H. Gehlsen <heino@gehlsen.dk>
63
* @copyright 2002-2011 Heino H. Gehlsen <heino@gehlsen.dk>. All Rights Reserved.
64
* @license http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 W3C� SOFTWARE NOTICE AND LICENSE
65
* @version SVN: $Id: groups.php 306619 2010-12-24 12:16:07Z heino $
66
* @link http://pear.php.net/package/Net_NNTP
68
* @since File available since release 1.3.0
74
require_once 'config.inc.php';
79
require_once 'common.inc.php';
82
/* Prepare breadcrumbs */
84
$breadcrumbs = array();
85
$breadcrumbs['Frontpage'] = './index.php?' . query();
86
$breadcrumbs['Groups @ ' . ($host == null ? 'localhost' : $host)] = null;
89
$posting = $nntp->connect($host, $encryption, $port);
90
if (PEAR::isError($posting)) {
91
error('Unable to connect to NNTP server: ' . $posting->getMessage());
94
// Start TLS encryption
96
$R = $nntp->cmdStartTLS();
97
if (PEAR::isError($R)) {
98
error('Unable to connect to NNTP server: ' . $R->getMessage());
103
if (!is_null($user) && !is_null($pass)) {
104
$authenticated = $nntp->authenticate($user, $pass);
105
if (PEAR::isError($authenticated)) {
106
error('Unable to authenticate: ' . $authenticated->getMessage());
110
// Fetch list of groups
111
$groups = $nntp->getGroups($wildmat);
112
if (PEAR::isError($groups)) {
113
error('Fetching list of groups failed: ' . $groups->getMessage());
116
// Fetch known (to the server) group descriptions
117
$descriptions = $nntp->getDescriptions($wildmat);
118
if (PEAR::isError($descriptions)) {
119
$logger->notice('Fetching group descriptions failes: ' . $descriptions->getMessage());
122
$descriptions = array();
138
echo '<table border="0" cellpadding="3" cellspacing="4">', "\r\n";
139
echo '<tr><th>Group</th><th>Articles</th><th>Description</th><th>Posting</th></tr>', "\r\n";
141
// Loop through groups
143
foreach ($groups as $group) {
145
$link = 'group.php?' . query('group='.urlencode($group['group']));
147
$messageCount = $group['last'] - $group['first'] + 1;
149
$description = empty($descriptions[$group['group']]) ? '' : $descriptions[$group['group']];
151
switch ($group['posting']) {
152
case 'y': $posting = 'yes'; break;
153
case 'n': $posting = 'no'; break;
154
case 'm': $posting = 'moderated'; break;
155
default: $posting = 'unknown';
158
echo ' <tr class="group ', ($i++ % 2 ? 'even' : 'odd'), ' posting-', $posting, '">', "\r\n";
159
echo ' <td align="left" class="name"><a href="', $link, '">', $group['group'], '</a></td>', "\r\n";
160
echo ' <td align="center" class="count">', $messageCount, '</td>', "\r\n";
161
echo ' <td align="left" class="description">', $description, '</td>', "\r\n";
162
echo ' <td align="center" class="posting">', $posting, '</td>', "\r\n";
163
echo ' </tr>', "\r\n";
167
echo '</table>', "\r\n";
178
include 'header.inc.php';
190
include 'footer.inc.php';