# PHP News Reader
# Copyright (C) 2001-2004 Shen Cheng-Da
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
require_once('utils.inc.php');
# ---------------------------------------------------------------------
html_head( $title );
#echo "
\n";
if( $CFG['html_header'] )
readfile( $CFG['html_header'] );
elseif( $CFG['banner'] )
echo "" . $CFG['banner'] . "
\n";
else
echo "$title
";
/*
for( $i = 0 ; $i < $catalog_num ; $i++ ) {
if( ! $nhd[$news_server[$i]] )
$nhd[$i] = $nhd[$news_server[$i]] = nnrp_open( $news_server[$i] );
else
$nhd[$i] = $nhd[$news_server[$i]];
}
*/
$nhd = nnrp_open( $news_server[$curr_catalog], $news_nntps[$curr_catalog] );
#echo "\n";
$maxr = 100;
#echo "\n\n";
echo "\n";
for( $i = 0 ; $i < $maxr ; $i++ ) {
if( $i >= $catalog_num )
break;
if( $news_hidden[$i] )
continue;
echo "\n";
if( $CFG['url_rewrite'] )
$link = "section/$i";
else
$link = "$self?catalog=$i";
if( $i >= $catalog_num )
echo "";
elseif( $i == $curr_catalog )
echo " \n";
elseif( $news_authperm[$i] )
echo " \n";
else
echo " \n";
echo " \n";
}
if( is_array($CFG['links']) )
foreach( $CFG['links'] as $text => $link ) {
if( $config_convert['to'] ) {
$text = $config_convert['to']($text);
$link = $config_convert['to']($link);
}
echo " ';
}
if( $CFG['url_rewrite'] ) {
if( $CFG['auth_type'] != 'open' && $auth_success )
echo " | ";
if( $CFG['auth_type'] == 'optional' && !$auth_success )
echo " | ";
}
else {
if( $CFG['auth_type'] != 'open' && $auth_success )
echo " | ";
if( $CFG['auth_type'] == 'optional' && !$auth_success )
echo " | ";
}
echo " \n";
echo " | \n";
echo " | ";
if( ! $nhd ) {
echo "
$strConnectServerError (" . $news_server[$curr_catalog] . ") |
\n";
html_foot();
html_tail();
exit;
}
nnrp_authenticate( $nhd );
$active = nnrp_list_group( $nhd, $news_groups[$curr_catalog], $article_convert['to'] );
if( $active == null ) {
echo "
$strConnectServerError <" . $news_server[$curr_catalog] . ">\n";
html_foot();
html_tail();
exit;
}
/*
if( $global_readonly ) {
echo "* $strReadonlyNotify\n";
echo '';
}
*/
echo "
\n\n";
// $row = array( $strNumber, $strPostNumber, $strGroup, $strGroupDescription );
if( $CFG['show_group_description'] )
echo <<
EOH;
else
echo <<
EOH;
if( $CFG['group_sorting'] )
ksort( $active );
reset( $active );
$i = 0;
$server = $news_server[$curr_catalog];
while ( list ($group, $value) = each ($active) ) {
$i++;
if( $CFG['magic_tag'] ) {
$magic = $value[0];
if( $CFG['url_rewrite'] ) {
if( $server == $group_default_server )
$glink = "$group";
else
$glink = "$group";
}
else
$glink = "$group";
}
else {
if( $CFG['url_rewrite'] ) {
if( $server == $group_default_server )
$glink = "$group";
else
$glink = "$group";
}
else
$glink = "$group";
}
if( !isset($value[2]) || $value[2] == '' )
$value[2] = ' ';
elseif( strlen( $value[2] ) > 50 )
$value[2] = htmlspecialchars(substr( $value[2], 0, 50 )) . ' ..';
$num = $value[0] - $value[1] + 1;
if( $num < 0 ) $num = 0;
if( $CFG['show_group_description'] )
echo <<
| $i |
$num |
$glink |
$value[2] |
|
EOR;
else
echo <<
$i |
$num |
$glink |
EOR;
}
echo "
\n";
echo "\n";
echo "\n";
#echo "\n";
html_foot();
if( $nhd ) nnrp_close($nhd);
if( $CFG['html_footer'] )
readfile( $CFG['html_footer'] );
html_tail();
?>