More stuff ?

This commit is contained in:
Holden Karau 2006-06-11 07:24:56 +00:00
parent 378a02ac21
commit 84a6cd2201
13 changed files with 1706 additions and 0 deletions

85
newsgroup/article.php Executable file
View File

@ -0,0 +1,85 @@
<?
header("Expires: ".gmdate("D, d M Y H:i:s",time()+(3600*24))." GMT");
// register parameters
$id=$_REQUEST["id"];
$group=$_REQUEST["group"];
include "config.inc.php";
/*
$thread_show["replies"]=true;
$thread_show["lastdate"]=false;
$thread_show["threadsize"]=false;
*/
include "auth.inc";
include "$file_newsportal";
$message=message_read($id,0,$group);
if (!$message) {
header ("HTTP/1.0 404 Not Found");
$subject=$title;
$title.=' - Article not found';
if($ns!=false)
nntp_close($ns);
} else {
$subject=htmlspecialchars($message->header->subject);
header("Last-Modified: ".date("r", $message->header->date));
$title.= ' - '.$subject;
}
include "head.inc";
// has the user read-rights on this article?
if((function_exists("npreg_group_has_read_access") &&
!npreg_group_has_read_access($group)) ||
(function_exists("npreg_group_is_visible") &&
!npreg_group_is_visible($group))) {
die("access denied");
}
?>
<h1 class="np_article_headline"><?=htmlspecialchars($subject) ?></h1>
<table cellpadding="0" cellspacing="0" width="100%" class="np_buttonbar"><tr>
<?
echo '<td class="np_button"><a class="np_button" href="'.
$file_index.'">'.$text_thread["button_grouplist"].'</a></td>';
echo '<td class="np_button"><a class="np_button" href="'.
$file_thread.'?group='.urlencode($group).'">'.$text_article["back_to_group"].'</a></td>';
if ((!$readonly) && ($message) &&
(!function_exists("npreg_group_has_write_access") ||
npreg_group_has_write_access($group)))
echo '<td class="np_button"> <a class="np_button" href="'.
$file_post.'?type=reply&id='.urlencode($id).
'&group='.urlencode($group).'">'.$text_article["button_answer"].
'</a></td>';
if(function_exists(npreg_user_is_moderator) && npreg_user_is_moderator($group)) {
echo '<td class="np_button"><a class="np_button" href="'.$file_cancel.'?type=reply&id='.urlencode($id).
'&group='.urlencode($group).'">'.$text_article["button_cancel"].'</a></td>';
}
?>
<td width="100%">&nbsp;</td></tr></table>
<?
if (!$message)
// article not found
echo $text_error["article_not_found"];
else {
if($article_showthread)
$thread=thread_cache_load($group);
//echo "<br>";
message_show($group,$id,0,$message);
if($article_showthread)
message_thread($message->header->id,$group,$thread);
}
include "tail.inc";
?>

23
newsgroup/attachment.php Executable file
View File

@ -0,0 +1,23 @@
<?
header("Expires: ".gmdate("D, d M Y H:i:s",time()+(3600*24))." GMT");
$group=$_REQUEST["group"];
$id=$_REQUEST["id"];
$attachment=$_REQUEST["attachment"];
include "config.inc.php";
include "auth.inc";
require("$file_newsportal");
if (!isset($attachment))
$attachment=0;
$message=message_read($id,$attachment,$group);
//print_r($message->header);
if (!$message) {
header ("HTTP/1.0 404 Not Found");
echo "The Attachment doesn't exists";
} else {
header("Content-Disposition: attachment; filename=".
$message->header->content_type_name[$attachment]);
header("Content-type: ".$message->header->content_type[$attachment]);
message_show("",$id,$attachment,$message);
}
?>

0
newsgroup/auth.inc Executable file
View File

170
newsgroup/config.inc.php Executable file
View File

@ -0,0 +1,170 @@
<?
/*
* directories and files
*/
$spooldir="spool";
$imgdir="img";
$file_newsportal="newsportal.php";
$file_index="index.php";
$file_thread="thread.php";
$file_article="article.php";
// $file_article_full="article.php";
$file_attachment="attachment.php";
$file_post="post.php";
$file_cancel="cancel.php";
$file_language="lang/english.lang";
$file_footer="/users/www/www/footer.html";
$file_groups="groups.txt";
/*
* newsserver setup
*/
$server="news";
$port=119;
// $post_server="";
// $post_port=119;
$maxfetch=0; // depricated
$initialfetch=0; // depricated
//$server_auth_http=true;
/*
* Grouplist Layout
*/
$gl_age=true;
/*
* Thread layout
*/
$thread_treestyle=7;
$thread_show["date"]=true;
$thread_show["subject"]=true;
$thread_show["author"]=true;
$thread_show["authorlink"]=false;
$thread_show["replies"]=true;
$thread_show["lastdate"]=false; // makes only sense with $thread_show["replies"]=false
$thread_show["threadsize"]=false;
$thread_maxSubject=50;
$maxarticles=400;
$maxarticles_extra=100;
$age_count=3;
$age_time[1]=86400; //24 hours
$age_color[1]="red";
$age_time[2]=259200; //3 days
$age_color[2]="#999900";
$age_time[3]=604800; //7 days
$age_color[3]="#00bb00";
$thread_sort_order=-1;
$thread_sort_type="thread";
$articles_per_page=50;
$startpage="first";
/*
* Frames
*/
// for frames-support: read README in the frames-directory
//$frame_article="article";
//$frame_thread="thread";
//$frame_groups="_top";
//$frame_post="_top";
//$frame_threadframeset="_top";
$frame_externallink="_blank";
/*
* article layout
*/
$article_show["Subject"]=true;
$article_show["From"]=true;
$article_show["Newsgroups"]=true;
$article_show["Followup"]=true;
$article_show["Organization"]=true;
$article_show["Date"]=true;
$article_show["Message-ID"]=false;
$article_show["User-Agent"]=false;
$article_show["References"]=false;
$article_show["From_link"]=true;
//$article_show["From_rewrite"]=array('@',' (at) ');
$article_showthread=true;
$article_graphicquotes=true;
/*
* settings for the article flat view, if used
*/
$articleflat_articles_per_page=20;
$articleflat_chars_per_articles=5000;
/*
* Message posting
*/
$send_poster_host=false;
$readonly=false;
$testgroup=false;
$validate_email=1;
$organization="University of Waterloo Computer Science Club";
$setcookies=false;
// $anonym_address="set_this@to_something_valid";
$msgid_generate="md5";
$msgid_fqdn=$_SERVER["HTTP_HOST"];
$post_autoquote=false;
/*
* Attachments
*/
$attachment_show=true;
$attachment_delete_alternative=true; // delete non-text mutipart/alternative
$attachment_uudecode=false; // experimental!
/*
* Security settings
*/
$block_xnoarchive=false;
/*
* Cache
*/
$cache_articles=false; // article cache, experimental!
$cache_index=3600; // cache the group index for one hour before reloading
$cache_thread=60; // cache the thread for one minute reloading
/*
* Misc
*/
$title="CSC Newsportal";
$cutsignature=true;
$compress_spoolfiles=false;
// website charset, "koi8-r" for example
$www_charset = "iso-8859-15";
// Use the iconv extension for improved charset conversions
$iconv_enable=true;
// timezone relative to GMT, +1 for CET
$timezone=-5;
/*
* Group specific config
*/
//$group_config=array(
// '^de\.alt\.fan\.aldi$' => "aldi.inc",
// '^de\.' => "german.inc"
//);
/*
* Do not edit anything below this line
*/
// Load group specifig config files
if((isset($group)) && (isset($group_config))) {
foreach ($group_config as $key => $value) {
if (ereg($key,$group)) {
include $value;
break;
}
}
}
// check the settings
include "lib/check.php";
// load the english language definitions first because some of the other
// definitions are incomplete
include("lang/english.lang");
include($file_language);
?>

4
newsgroup/groups.txt Executable file
View File

@ -0,0 +1,4 @@
:Computer Science Club
uw.csc
uw.csc.hardware
uw.csc.software

7
newsgroup/head.inc Executable file
View File

@ -0,0 +1,7 @@
<html>
<head>
<title><? echo htmlspecialchars($title); ?></title>
<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=<?=$www_charset?>">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body textcolor="black" bgcolor="white">

18
newsgroup/index.php Executable file
View File

@ -0,0 +1,18 @@
<? header("Expires: ".gmdate("D, d M Y H:i:s",time()+7200)." GMT");
include "config.inc.php";
include "auth.inc";
include "head.inc"; ?>
<h1 class="np_index_headline"><? echo htmlspecialchars($title); ?></h1>
<?
include("$file_newsportal");
flush();
$newsgroups=groups_read($server,$port);
echo '<div class="np_index_groups">';
groups_show($newsgroups);
echo '</div>';
?>
<? include "tail.inc"; ?>

BIN
newsgroup/newsportal-0.37.zip Executable file

Binary file not shown.

811
newsgroup/newsportal.php Executable file
View File

@ -0,0 +1,811 @@
<?
/* Newsportal NNTP<->HTTP Gateway
* Version: 0.36
* Download: http://florian-amrhein.de/newsportal
*
* Copyright (C) 2002-2004 Florian Amrhein
* E-Mail: newsportal@florian-amrhein.de
* Web: http://florian-amrhein.de
*
* 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
*/
include "lib/types.inc.php";
include "lib/thread.inc.php";
include "lib/message.inc.php";
include "lib/post.inc.php";
//include "lib/validator.inc.php";
/*
* opens the connection to the NNTP-Server
*
* $server: adress of the NNTP-Server
* $port: port of the server
*/
function nntp_open($nserver=0,$nport=0) {
global $text_error,$server_auth_user,$server_auth_pass,$readonly;
global $server,$port;
// echo "<br>NNTP OPEN<br>";
$authorize=((isset($server_auth_user)) && (isset($server_auth_pass)) &&
($server_auth_user != ""));
if ($nserver==0) $nserver=$server;
if ($nport==0) $nport=$port;
$ns=@fsockopen($nserver,$nport);
$weg=line_read($ns); // kill the first line
if (substr($weg,0,2) != "20") {
echo "<p>".$text_error["error:"].$weg."</p>";
fclose($ns);
$ns=false;
} else {
if ($ns != false) {
fputs($ns,"MODE reader\r\n");
$weg=line_read($ns); // and once more
if ((substr($weg,0,2) != "20") &&
((!$authorize) || ((substr($weg,0,3) != "480") && ($authorize)))) {
echo "<p>".$text_error["error:"].$weg."</p>";
fclose($ns);
$ns=false;
}
}
if ((isset($server_auth_user)) && (isset($server_auth_pass)) &&
($server_auth_user != "")) {
fputs($ns,"AUTHINFO USER $server_auth_user\r\n");
$weg=line_read($ns);
fputs($ns,"AUTHINFO PASS $server_auth_pass\r\n");
$weg=line_read($ns);
if (substr($weg,0,3) != "281") {
echo "<p>".$text_error["error:"]."</p>";
echo "<p>".$text_error["auth_error"]."</p>";
}
}
}
if ($ns==false) echo "<p>".$text_error["connection_failed"]."</p>";
return $ns;
}
/*
* Close a NNTP connection
*
* $ns: the handle of the connection
*/
function nntp_close(&$ns) {
if ($ns != false) {
fputs($ns,"QUIT\r\n");
fclose($ns);
}
}
/*
* Validates an email adress
*
* $address: a string containing the email-address to be validated
*
* returns true if the address passes the tests, false otherwise.
*/
function validate_email($address)
{
global $validate_email;
$return=true;
if (($validate_email >= 1) && ($return == true))
$return = (ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_A-z{|}~]+'.'@'.
'[-!#$%&\'*+\\/0-9=?A-Z^_A-z{|}~]+\.'.
'[-!#$%&\'*+\\./0-9=?A-Z^_A-z{|}~]+$',$address));
if (($validate_email >= 2) && ($return == true)) {
$addressarray=address_decode($address,"garantiertungueltig");
$return=checkdnsrr($addressarray[0]["host"],"MX");
if (!$return) $return=checkdnsrr($addressarray[0]["host"],"A");
}
return($return);
}
/*
* decodes a block of 7bit-data in uuencoded format to it's original
* 8bit format.
* The headerline containing filename and permissions doesn't have to
* be included.
*
* $data: The uuencoded data as a string
*
* returns the 8bit data as a string
*
* Note: this function is very slow and doesn't recognize incorrect code.
*/
function uudecode_line($line) {
$data=substr($line,1);
$length=ord($line[0])-32;
$decoded="";
for ($i=0; $i<(strlen($data)>>2); $i++) {
$pack=substr($data,$i<<2,4);
$upack="";
$bitmaske=0;
for ($o=0; $o<4; $o++) {
$g=((ord($pack[3-$o])-32));
if ($g==64) $g=0;
$bitmaske=$bitmaske | ($g << (6*$o));
}
$schablone=255;
for ($o=0; $o<3; $o++) {
$c=($bitmaske & $schablone) >> ($o << 3);
$schablone=($schablone << 8);
$upack=chr($c).$upack;
}
$decoded.=$upack;
}
$decoded=substr($decoded,0,$length);
return $decoded;
}
/*
* decodes uuencoded Attachments.
*
* $data: the encoded data
*
* returns the decoded data
*/
function uudecode($data) {
$d=explode("\n",$data);
$u="";
for ($i=0; $i<count($d)-1; $i++)
$u.=uudecode_line($d[$i]);
return $u;
}
/*
* returns the mimetype of an filename
*
* $name: the complete filename of a file
*
* returns a string containing the mimetype
*/
function get_mimetype_by_filename($name) {
$ending=strtolower(strrchr($name,"."));
switch($ending) {
case ".jpg":
case ".jpeg":
$type="image/jpeg";
break;
case ".gif":
$type="image/gif";
break;
case ".png":
$type="image/png";
break;
case ".bmp":
$type="image/bmp";
break;
default:
$type="text/plain";
}
return $type;
}
/*
* Test, if the access to a group is allowed. This is true, if $testgroup is
* false or the groupname is in groups.txt
*
* $groupname: name of the group to be checked
*
* returns true, if access is allowed
*/
function testGroup($groupname) {
global $testgroup,$file_groups;
if ($testgroup) {
$gf=fopen($file_groups,"r");
while (!feof($gf)) {
$read=trim(line_read($gf));
$pos=strpos($read," ");
if ($pos != false) {
if (substr($read,0,$pos)==trim($groupname)) return true;
} else {
if ($read == trim($groupname)) return true;
}
}
fclose($gf);
return false;
} else {
return true;
}
}
function testGroups($newsgroups) {
$groups=explode(",",$newsgroups);
$count=count($groups);
$return="";
$o=0;
for ($i=0; $i<$count; $i++) {
if (testgroup($groups[$i]) &&
(!function_exists("npreg_group_has_write_access") ||
npreg_group_has_write_access($groups[$i]))) {
if ($o>0) $return.=",";
$o++;
$return.=$groups[$i];
}
}
return($return);
}
/*
* read one line from the NNTP-server
*/
function line_read(&$ns) {
if ($ns != false) {
$t=str_replace("\n","",str_replace("\r","",fgets($ns,1200)));
return $t;
}
}
/*
* Split an internet-address string into its parts. An address string could
* be for example:
* - user@host.domain (Realname)
* - "Realname" <user@host.domain>
* - user@host.domain
*
* The address will be split into user, host (incl. domain) and realname
*
* $adrstring: The string containing the address in internet format
* $defaulthost: The name of the host which should be returned if the
* address-string doesn't contain a hostname.
*
* returns an hash containing the fields "mailbox", "host" and "personal"
*/
function address_decode($adrstring,$defaulthost) {
$parsestring=trim($adrstring);
$len=strlen($parsestring);
$at_pos=strpos($parsestring,'@'); // find @
$ka_pos=strpos($parsestring,"("); // find (
$kz_pos=strpos($parsestring,')'); // find )
$ha_pos=strpos($parsestring,'<'); // find <
$hz_pos=strpos($parsestring,'>'); // find >
$space_pos=strpos($parsestring,')'); // find ' '
$email="";
$mailbox="";
$host="";
$personal="";
if ($space_pos != false) {
if (($ka_pos != false) && ($kz_pos != false)) {
$personal=substr($parsestring,$ka_pos+1,$kz_pos-$ka_pos-1);
$email=trim(substr($parsestring,0,$ka_pos-1));
}
} else {
$email=$adrstring;
}
if (($ha_pos != false) && ($hz_pos != false)) {
$email=trim(substr($parsestring,$ha_pos+1,$hz_pos-$ha_pos-1));
$personal=substr($parsestring,0,$ha_pos-1);
}
if ($at_pos != false) {
$mailbox=substr($email,0,strpos($email,'@'));
$host=substr($email,strpos($email,'@')+1);
} else {
$mailbox=$email;
$host=$defaulthost;
}
$personal=trim($personal);
if (substr($personal,0,1) == '"') $personal=substr($personal,1);
if (substr($personal,strlen($personal)-1,1) == '"')
$personal=substr($personal,0,strlen($personal)-1);
$result["mailbox"]=trim($mailbox);
$result["host"]=trim($host);
if ($personal!="") $result["personal"]=$personal;
$complete[]=$result;
return ($complete);
}
/*
* Read the groupnames from groups.txt, and get additional informations
* of the groups from the newsserver
*/
function groups_read($server,$port) {
global $gl_age,$file_groups,$spooldir,$cache_index;
// is there a cached version, and is it actual enough?
$cachefile=$spooldir.'/groups.dat';
if((file_exists($cachefile)) && (filemtime($cachefile)+$cache_index>time())) {
// cached file exists and is new enough. so lets read it out.
$file=fopen($cachefile,"r");
$data="";
while(!feof($file)) {
$data.=fgets($file,1000);
}
fclose($file);
$newsgroups=unserialize($data);
} else {
$ns=nntp_open($server,$port);
if ($ns == false) return false;
$gf=fopen($file_groups,"r");
// if we want to mark groups with new articles with colors, wie will later
// need the format of the overview
$overviewformat=thread_overview_read($ns);
while (!feof($gf)) {
$gruppe=new newsgroupType;
$tmp=trim(line_read($gf));
if(substr($tmp,0,1)==":") {
$gruppe->text=substr($tmp,1);
$newsgroups[]=$gruppe;
} elseif(strlen(trim($tmp))>0) {
// is there a description in groups.txt?
$pos=strpos($tmp," ");
if ($pos != false) {
// yes.
$gruppe->name=substr($tmp,0,$pos);
$desc=substr($tmp,$pos);
} else {
// no, get it from the newsserver.
$gruppe->name=$tmp;
fputs($ns,"XGTITLE $gruppe->name\r\n");
$response=line_read($ns);
if (strcmp(substr($response,0,3),"282") == 0) {
$neu=line_read($ns);
do {
$response=$neu;
if ($neu != ".") $neu=line_read($ns);
} while ($neu != ".");
$desc=strrchr($response,"\t");
if (strcmp($response,".") == 0) {
$desc="-";
}
} else {
$desc=$response;
}
if (strcmp(substr($response,0,3),"500") == 0)
$desc="-";
}
if (strcmp($desc,"") == 0) $desc="-";
$gruppe->description=$desc;
fputs($ns,"GROUP ".$gruppe->name."\r\n");
$t=explode(" ",line_read($ns));
$gruppe->count=$t[1];
// mark group with new articles with colors
if($gl_age) {
fputs($ns,'XOVER '.$t[3]."\r\n");
$tmp=explode(" ",line_read($ns));
if($tmp[0]=="224") {
$tmp=line_read($ns);
if($tmp!=".") {
$head=thread_overview_interpret($tmp,$overviewformat,$gruppe->name);
$tmp=line_read($ns);
$gruppe->age=$head->date;
}
}
}
if ((strcmp(trim($gruppe->name),"") != 0) &&
(substr($gruppe->name,0,1) != "#"))
$newsgroups[]=$gruppe;
}
}
fclose($gf);
nntp_close($ns);
// write the data to the cachefile
$file=fopen($cachefile,"w");
fputs($file,serialize($newsgroups));
fclose($file);
}
return $newsgroups;
}
/*
* print the group names from an array to the webpage
*/
function groups_show($gruppen) {
global $gl_age;
if ($gruppen == false) return;
global $file_thread,$text_groups;
$c = count($gruppen);
echo '<div class="np_index_groupblock">';
$acttype="keins";
for($i = 0 ; $i < $c ; $i++) {
$g = $gruppen[$i];
if(isset($g->text)) {
if($acttype!="text") {
$acttype="text";
if($i>0)
echo '</div>';
echo '<div class="np_index_grouphead">';
}
echo $g->text;
} else {
if($acttype!="group") {
$acttype="group";
if($i>0)
echo '</div>';
echo '<div class="np_index_groupblock">';
}
echo '<div class="np_index_group">';
echo '<a ';
if ((isset($frame_threadframeset)) && ($frame_threadframeset != ""))
echo 'target="'.$frame_threadframeset.'" ';
echo 'href="'.$file_thread.'?group='.urlencode($g->name).'">'.$g->name."</a>\n";
if($gl_age)
$datecolor=thread_format_date_color($g->age);
echo '<small>(';
if($datecolor!="")
echo '<font color="'.$datecolor.'">'.$g->count.'</font>';
else
echo $g->count;
echo ')</small>';
if($g->description!="-")
echo '<br><small>'.$g->description.'</small>';
echo '</div>';
}
echo "\n";
flush();
}
echo "</div></div>\n";
}
/*
* gets a list of aviable articles in the group $groupname
*/
/*
function getArticleList(&$ns,$groupname) {
fputs($ns,"LISTGROUP $groupname \r\n");
$line=line_read($ns);
$line=line_read($ns);
while(strcmp($line,".") != 0) {
$articleList[] = trim($line);
$line=line_read($ns);
}
if (!isset($articleList)) $articleList="-";
return $articleList;
}
*/
/*
* Decode quoted-printable or base64 encoded headerlines
*
* $value: The to be decoded line
*
* returns the decoded line
*/
function headerDecode($value) {
if (eregi('=\?.*\?.\?.*\?=',$value)) { // is there anything encoded?
if (eregi('=\?.*\?Q\?.*\?=',$value)) { // quoted-printable decoding
$charset=eregi_replace('(.*)=\?(.*)\?Q\?(.*)\?=(.*)','\2',$value);
$result1=eregi_replace('(.*)=\?.*\?Q\?(.*)\?=(.*)','\1',$value);
$result2=eregi_replace('(.*)=\?.*\?Q\?(.*)\?=(.*)','\2',$value);
$result3=eregi_replace('(.*)=\?.*\?Q\?(.*)\?=(.*)','\3',$value);
$result2=str_replace("_"," ",quoted_printable_decode($result2));
$newvalue=$result1.recode_charset($result2,$charset).$result3;
}
if (eregi('=\?.*\?B\?.*\?=',$value)) { // base64 decoding
$result1=eregi_replace('(.*)=\?.*\?B\?(.*)\?=(.*)','\1',$value);
$result2=eregi_replace('(.*)=\?.*\?B\?(.*)\?=(.*)','\2',$value);
$result3=eregi_replace('(.*)=\?.*\?B\?(.*)\?=(.*)','\3',$value);
$result2=base64_decode($result2);
$newvalue=$result1.$result2.$result3;
}
if (!isset($newvalue)) // nothing of the above, must be an unknown encoding...
$newvalue=$value;
else
$newvalue=headerDecode($newvalue); // maybe there are more encoded
return($newvalue); // parts
} else { // there wasn't anything encoded, return the original string
return($value);
}
}
/*
* calculates an Unix timestamp out of a Date-Header in an article
*
* $value: Value of the Date: header
*
* returns an Unix timestamp
*/
function getTimestamp($value) {
global $timezone;
$months=array("Jan"=>1,"Feb"=>2,"Mar"=>3,"Apr"=>4,"May"=>5,"Jun"=>6,"Jul"=>7,"Aug"=>8,"Sep"=>9,"Oct"=>10,"Nov"=>11,"Dec"=>12);
$value=str_replace(" "," ",$value);
$d=split(" ",$value,6);
if (strcmp(substr($d[0],strlen($d[0])-1,1),",") == 0) {
$date[0]=$d[1]; // day
$date[1]=$d[2]; // month
$date[2]=$d[3]; // year
$date[3]=$d[4]; // hours:minutes:seconds
$gmt=$d[5]; // timezone
} else {
$date[0]=$d[0]; // day
$date[1]=$d[1]; // month
$date[2]=$d[2]; // year
$date[3]=$d[3]; // hours:minutes:seconds
$gmt=$d[4]; // timezone
}
$time=split(":",$date[3]);
// timezone handling
$msgtimezone=0;
if ($gmt[0]=='-') {
$msgtimezone=-substr($gmt,1,2);
$msgminzone=-substr($gmt,3,2);
} else if ($gmt[0]=='+') {
$msgtimezone=+substr($gmt,1,2);
$msgminzone=+substr($gmt,3,2);
}
$time[0]=$time[0]-$msgtimezone+$timezone;
$time[1]=$time[1]-$msgminzone+$minzone;
$timestamp=mktime($time[0],$time[1],$time[2],$months[$date[1]],$date[0],$date[2]);
return $timestamp;
}
function parse_header($hdr,$number="") {
for ($i=count($hdr)-1; $i>0; $i--)
if (preg_match("/^(\x09|\x20)/",$hdr[$i]))
$hdr[$i-1]=$hdr[$i-1]." ".ltrim($hdr[$i]);
$header = new headerType;
$header->isAnswer=false;
for ($count=0;$count<count($hdr);$count++) {
$variable=substr($hdr[$count],0,strpos($hdr[$count]," "));
$value=trim(substr($hdr[$count],strpos($hdr[$count]," ")+1));
switch (strtolower($variable)) {
case "from:":
$fromline=address_decode(headerDecode($value),"nirgendwo");
if (!isset($fromline[0]["host"])) $fromline[0]["host"]="";
$header->from=$fromline[0]["mailbox"]."@".$fromline[0]["host"];
$header->username=$fromline[0]["mailbox"];
if (!isset($fromline[0]["personal"])) {
$header->name="";
} else {
$header->name=$fromline[0]["personal"];
}
break;
case "message-id:":
$header->id=$value;
break;
case "subject:":
$header->subject=headerDecode($value);
break;
case "newsgroups:":
$header->newsgroups=$value;
break;
case "organization:":
$header->organization=headerDecode($value);
break;
case "content-transfer-encoding:":
$header->content_transfer_encoding=trim(strtolower($value));
break;
case "content-type:":
$header->content_type=array();
$subheader=split(";",$value);
$header->content_type[0]=strtolower(trim($subheader[0]));
for ($i=1; $i<count($subheader); $i++) {
$gleichpos=strpos($subheader[$i],"=");
if ($gleichpos) {
$subvariable=trim(substr($subheader[$i],0,$gleichpos));
$subvalue=trim(substr($subheader[$i],$gleichpos+1));
if (($subvalue[0]=='"') &&
($subvalue[strlen($subvalue)-1]=='"'))
$subvalue=substr($subvalue,1,strlen($subvalue)-2);
switch($subvariable) {
case "charset":
$header->content_type_charset=array(strtolower($subvalue));
break;
case "name":
$header->content_type_name=array($subvalue);
break;
case "boundary":
$header->content_type_boundary=$subvalue;
break;
case "format":
$header->content_type_format=array($subvalue);
}
}
}
break;
case "references:":
$ref=trim($value);
while (strpos($ref,"> <") != false) {
$header->references[]=substr($ref,0,strpos($ref," "));
$ref=substr($ref,strpos($ref,"> <")+2);
}
$header->references[]=trim($ref);
break;
case "date:":
$header->date=getTimestamp(trim($value));
break;
case "followup-to:":
$header->followup=trim($value);
break;
case "x-newsreader:":
case "x-mailer:":
case "user-agent:":
$header->user_agent=trim($value);
break;
case "x-face:": // not ready
// echo "<p>-".base64_decode($value)."-</p>";
break;
case "x-no-archive:":
$header->xnoarchive=strtolower(trim($value));
}
}
if (!isset($header->content_type[0]))
$header->content_type[0]="text/plain";
if (!isset($header->content_transfer_encoding))
$header->content_transfer_encoding="8bit";
if ($number != "") $header->number=$number;
return $header;
}
/*
* convert the charset of a text
*/
function recode_charset($text,$source=false,$dest=false) {
global $iconv_enable,$www_charset;
if($dest==false)
$dest=$www_charset;
if(($iconv_enable) && ($source!=false)) {
$return=iconv($source,
$dest."//TRANSLIT",$text);
if($return!="")
return $return;
else
return $text;
} else {
return $text;
}
}
function decode_body($body,$encoding) {
$bodyzeile="";
switch ($encoding) {
case "base64":
$body=base64_decode($body);
break;
case "quoted-printable":
$body=Quoted_printable_decode($body);
$body=str_replace("=\n","",$body);
// default:
// $body=str_replace("\n..\n","\n.\n",$body);
}
return $body;
}
/*
* makes URLs clickable
*
* $text: A text-line probably containing links.
*
* the function returns the text-line with HTML-Links to the links or
* email-adresses.
*/
function html_parse($text) {
global $frame_externallink;
if ((isset($frame_externallink)) && ($frame_externallink != "")) {
$target=' TARGET="'.$frame_externallink.'" ';
} else {
$target=' ';
}
// regular expressions that will be applied to every word in the text
$regexp_replace=array(
'http://((\.*([-a-z0-9_/~@?=%#;+]|&amp;)+)+)' =>
'<a'.$target.'href="http://\1">http://\1</a>',
'(www\.[-a-z]+\.(de|pl|cz|sk|tk|tv|cc|cx|biz|us|uk|info|int|eu|dk|org|net|at|ch|com))' =>
'<a'.$target.'href="http://\1">\1</a>',
'https://([-a-z0-9_./~@?=%#&;\n]+)' =>
'<a'.$target.'href="https://\1">https://\1</a>',
'gopher://([-a-z0-9_./~@?=%\n]+)' =>
'<a'.$target.'href="gopher://\1">gopher://\1</a>',
'news://([-a-z0-9_./~@?=%\n]+)' =>
'<a'.$target.'href="news://\1">news://\1</a>',
'ftp://([-a-z0-9_./~@?=%\n]+)' =>
'<a'.$target.'href="ftp://\1">ftp://\1</a>',
//'([-a-z0-9_./n]+)@([-a-z0-9_.]+)' =>
// $_SESSION["loggedin"]!==true ? '(e-Mail)' :
// '<a href="mailto:\1@\2">\1@\2</a>'
);
$ntext="";
// split every line into it's words
$words=explode(" ",$text);
$n=count($words);
for($i=0; $i<$n; $i++) {
$word=$words[$i];
// test, if we need the slow walk through all the regular expressions
if(eregi('www|\:|@',$word)) {
// apply the regular expressions to the word until a matching
// expression is found
foreach ($regexp_replace as $key => $value) {
$nword=eregi_replace($key,$value,$word);
if($nword!=$word) {
$word=$nword;
break;
}
}
}
// add the spaces between the words
if($i>0)
$ntext.=" ";
$ntext.=$word;
}
return($ntext);
}
/*
* read the header of an article in plaintext into an array
* $articleNumber can be the number of an article or its message-id.
*/
function readPlainHeader(&$ns,$group,$articleNumber) {
fputs($ns,"GROUP $group\r\n");
$line=line_read($ns);
fputs($ns,"HEAD $articleNumber\r\n");
$line=line_read($ns);
if (substr($line,0,3) != "221") {
echo $text_error["article_not_found"];
$header=false;
} else {
$line=line_read($ns);
$body="";
while(strcmp(trim($line),".") != 0) {
$body .= $line."\n";
$line=line_read($ns);
}
return split("\n",str_replace("\r\n","\n",$body));
}
}
/*
* cancel an article on the newsserver
*
* DO NOT USE THIS FUNCTION, IF YOU DON'T KNOW WHAT YOU ARE DOING!
*
* $ns: The handler of the NNTP-Connection
* $group: The group of the article
* $id: the Number of the article inside the group or the message-id
*/
function message_cancel($subject,$from,$newsgroups,$ref,$body,$id) {
global $server,$port,$send_poster_host,$organization,$text_error;
global $file_footer,$www_charset;
flush();
$ns=nntp_open($server,$port);
if ($ns != false) {
fputs($ns,"POST\r\n");
$weg=line_read($ns);
fputs($ns,'Subject: '.quoted_printable_encode($subject)."\r\n");
fputs($ns,'From: '.$from."\r\n");
fputs($ns,'Newsgroups: '.$newsgroups."\r\n");
fputs($ns,"Mime-Version: 1.0\r\n");
fputs($ns,"Content-Type: text/plain; charset=".$www_charset."\r\n");
fputs($ns,"Content-Transfer-Encoding: 8bit\r\n");
if ($send_poster_host)
fputs($ns,'X-HTTP-Posting-Host: '.gethostbyaddr(getenv("REMOTE_ADDR"))."\r\n");
if ($ref!=false) fputs($ns,'References: '.$ref."\r\n");
if (isset($organization))
fputs($ns,'Organization: '.quoted_printable_encode($organization)."\r\n");
fputs($ns,"Control: cancel ".$id."\r\n");
if ((isset($file_footer)) && ($file_footer!="")) {
$footerfile=fopen($file_footer,"r");
$body.="\n".fread($footerfile,filesize($file_footer));
fclose($footerfile);
}
$body=str_replace("\n.\r","\n..\r",$body);
$body=str_replace("\r",'',$body);
$b=split("\n",$body);
$body="";
for ($i=0; $i<count($b); $i++) {
if ((strpos(substr($b[$i],0,strpos($b[$i]," ")),">") != false ) | (strcmp(substr($b[$i],0,1),">") == 0)) {
$body .= textwrap(stripSlashes($b[$i]),78,"\r\n")."\r\n";
} else {
$body .= textwrap(stripSlashes($b[$i]),74,"\r\n")."\r\n";
}
}
fputs($ns,"\r\n".$body."\r\n.\r\n");
$message=line_read($ns);
nntp_close($ns);
} else {
$message=$text_error["post_failed"];
}
return $message;
}
?>

315
newsgroup/post.php Executable file
View File

@ -0,0 +1,315 @@
<?
/* Newsportal NNTP<->HTTP Gateway
* Download: http://florian-amrhein.de/newsportal
*
* Copyright (C) 2002-2004 Florian Amrhein
* E-Mail: florian.amrhein@gmx.de
* Web: http://florian-amrhein.de
*
* 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
*/
@$newsgroups=$_REQUEST["newsgroups"];
@$group=$_REQUEST["group"];
@$type=$_REQUEST["type"];
@$subject=stripslashes($_REQUEST["subject"]);
@$name=$_REQUEST["name"];
@$email=$_REQUEST["email"];
@$body=stripslashes($_REQUEST["body"]);
@$abspeichern=$_REQUEST["abspeichern"];
@$references=$_REQUEST["references"];
@$id=$_REQUEST["id"];
if (!isset($group)) $group=$newsgroups;
include "config.inc.php";
include "auth.inc";
// Save name and email in cookies
if (($setcookies==true) && (isset($abspeichern)) && ($abspeichern=="ja")) {
setcookie("cookie_name",stripslashes($name),time()+(3600*24*90));
setcookie("cookie_email",$email,time()+(3600*24*90));
}
if ((isset($post_server)) && ($post_server!=""))
$server=$post_server;
if ((isset($post_port)) && ($post_port!=""))
$port=$post_port;
include "head.inc";
include $file_newsportal;
?>
<?
// has the user write-rights on the newsgroups?
if((function_exists("npreg_group_has_read_access") &&
!npreg_group_has_read_access($group)) ||
(function_exists("npreg_group_is_visible") &&
!npreg_group_is_visible($group)) ||
(function_exists("npreg_group_has_write_access") &&
!npreg_group_has_write_access($group))) {
die("access denied");
}
// Load name and email from cookies
if ($setcookies) {
if ((isset($_COOKIE["cookie_name"])) && (!isset($name)))
$name=$_COOKIE["cookie_name"];
if ((isset($_COOKIE["cookie_email"])) && (!isset($email)))
$email=$_COOKIE["cookie_email"];
}
// Load name and email from the registration system, if available
if(function_exists("npreg_get_firstname")) {
$name=npreg_get_firstname();
$form_noname=true;
if(function_exists("npreg_get_lastname"))
$name.=" ".npreg_get_lastname();
}
if(function_exists("npreg_get_email")) {
$email=npreg_get_email();
$form_noemail=true;
}
if((!isset($references)) || ($references=="")) {
$references=false;
}
if (!isset($type)) {
$type="new";
}
if ($type=="new") {
$subject="";
$bodyzeile="";
$show=1;
}
// Is there a new article to be bost to the newsserver?
if ($type=="post") {
$show=0;
// error handling
if (trim($body)=="") {
$type="retry";
$error=$text_post["missing_message"];
}
if ((trim($email)=="") && (!isset($anonym_address))) {
$type="retry";
$error=$text_post["missing_email"];
}
if (($email) && (!validate_email(trim($email)))) {
$type="retry";
$error=$text_post["error_wrong_email"];
}
if (trim($name)=="") {
$type="retry";
$error=$text_post["missing_name"];
}
if (trim($subject)=="") {
$type="retry";
$error=$text_post["missing_subject"];
}
if ($type=="post") {
if (!$readonly) {
// post article to the newsserver
if($references)
$references_array=explode(" ",$references);
else
$references_array=false;
if(($email=="") && (isset($anonym_address)))
$nemail=$anonym_address;
else
$nemail=$email;
$message=message_post(quoted_printable_encode($subject),
$nemail." (".quoted_printable_encode($name).")",
$newsgroups,$references_array,addslashes($body));
// Article sent without errors, or duplicate?
if ((substr($message,0,3)=="240") ||
(substr($message,0,7)=="441 435")) {
?>
<h1 class="np_post_headline"><? echo $text_post["message_posted"];?></h1>
<p><? echo $text_post["message_posted2"];?></p>
<p><a href="<? echo $file_thread.'?group='.urlencode($group).'">'.$text_post["button_back"].'</a> '
.$text_post["button_back2"].' '.urlencode($group) ?></p>
<?
} else {
// article not accepted by the newsserver
$type="retry";
$error=$text_post["error_newsserver"]."<br><pre>$message</pre>";
}
} else {
echo $text_post["error_readonly"];
}
}
}
// A reply of an other article.
if ($type=="reply") {
$message=message_read($id,0,$group);
$head=$message->header;
$body=explode("\n",$message->body[0]);
nntp_close($ns);
if ($head->name != "") {
$bodyzeile=$head->name;
} else {
$bodyzeile=$head->from;
}
$bodyzeile=$text_post["wrote_prefix"].$bodyzeile.
$text_post["wrote_suffix"]."\n\n";
for ($i=0; $i<=count($body)-1; $i++) {
if((isset($cutsignature)) && ($cutsignature==true) &&
($body[$i]=='-- '))
break;
if (trim($body[$i])!="") {
if($body[$i][0]=='>')
$bodyzeile.=">".$body[$i]."\n";
else
$bodyzeile.="> ".$body[$i]."\n";
} else {
$bodyzeile.="\n";
}
}
$subject=$head->subject;
if (isset($head->followup) && ($head->followup != "")) {
$newsgroups=$head->followup;
} else {
$newsgroups=$head->newsgroups;
}
splitSubject($subject);
$subject="Re: ".$subject;
// Cut off old parts of a subject
// for example: 'foo (was: bar)' becomes 'foo'.
$subject=eregi_replace('(\(wa[sr]: .*\))$','',$subject);
$show=1;
$references=false;
if (isset($head->references[0])) {
for ($i=0; $i<=count($head->references)-1; $i++) {
$references .= $head->references[$i]." ";
}
}
$references .= $head->id;
}
if ($type=="retry") {
$show=1;
$bodyzeile=$body;
}
if ($show==1) {
if ($testgroup) {
$testnewsgroups=testgroups($newsgroups);
} else {
$testnewsgroups=$newsgroups;
}
if ($testnewsgroups == "") {
echo $text_post["followup_not_allowed"];
echo " ".$newsgroups;
} else {
$newsgroups=$testnewsgroups;
echo '<h1 class="np_post_headline">'.$text_post["group_head"].$newsgroups
.$text_post["group_tail"].'</h1>';
if (isset($error)) echo "<p>$error</p>"; ?>
<form action="<? echo $file_post?>" method="post" name="postform">
<div class="np_post_header">
<table>
<tr><td align="right"><b><? echo $text_header["subject"] ?></b></td>
<td><input type="text" name="subject" value="<?
echo htmlspecialchars($subject);?>" size="40" maxlength="80"></td></tr>
<tr><td align="right"><b><?=$text_post["name"]?></b></td>
<td align="left">
<?
if($form_noname===true) {
echo htmlspecialchars($name);
} else {
echo '<input type="text" name="name"';
if (isset($name)) echo 'value="'.
htmlspecialchars(stripslashes($name)).'"';
echo 'size="40" maxlength="40">';
}
?>
</td></tr>
<tr><td align="right"><b><?=$text_post["email"]?></b></td>
<td align="left">
<?
if($form_noemail===true) {
echo htmlspecialchars($email);
} else {
echo '<input type="text" name="email"';
if (isset($email)) echo 'value="'.htmlspecialchars(stripslashes($email)).'"';
echo 'size="40" maxlength="40">';
}
?>
</td></tr>
</table>
</div>
<div class="np_post_body">
<table>
<tr><td><b><? echo $text_post["message"];?></b><br>
<textarea id="postbody" name="body" rows="20" cols="79" wrap="virtual"><?
if ((isset($bodyzeile)) && ($post_autoquote))
echo htmlspecialchars($bodyzeile); ?>
</textarea></td></tr>
<tr><td>
<? if(!$post_autoquote) { ?>
<input type="hidden" id="hidebody" value="<?
if (isset($bodyzeile)) echo htmlspecialchars(stripslashes($bodyzeile)); ?>">
<script language="JavaScript">
<!--
function quoten() {
document.getElementById("postbody").value=document.getElementById("hidebody").value;
document.getElementById("hidebody").value="";
}
//-->
</script>
<input tabindex="100" type="Button" name="quote" value="<?=$text_post["quote"]?>" onclick="quoten()">
<? } ?>
<input type="submit" value="<? echo $text_post["button_post"];?>">
<? if ($setcookies==true) { ?>
<input type="checkbox" name="abspeichern" value="ja">
<? echo $text_post["remember"];?>
<? } ?>
</td>
</tr>
</table>
</div>
<input type="hidden" name="type" value="post">
<input type="hidden" name="newsgroups" value="<?=htmlspecialchars($newsgroups); ?>">
<input type="hidden" name="references" value="<?=htmlentities($references); ?>">
<input type="hidden" name="group" value="<?=htmlspecialchars($group); ?>">
</form>
<? } } ?>
<? include "tail.inc"; ?>

185
newsgroup/style.css Executable file
View File

@ -0,0 +1,185 @@
/* =========== Page Layout ================ */
BODY {
color: black;
background: white;
}
/* =========== Index Layout ============== */
/* headline */
h1.np_index_headline {
font-size: large;
}
/* border around all groups */
.np_index_groups {
background: #eeeeee;
padding: 0px;
border: solid 1px #26598f;
}
/* a block of groups */
.np_index_groupblock {
margin-bottom: 20px;
}
/* headline of a group of blocks */
.np_index_grouphead {
border: solid 1px #26598f;
background: #26598f;
color: white;
}
/* a single group */
.np_index_group {
margin-left: 10px;
margin-bottom: 5px;
}
/* =========== Thread Layout ============== */
/* Headline */
h1.np_thread_headline {
font-size: large;
}
/* Table around the thread */
table.np_thread_table {
width: 100%;
border: solid 1px #26598f;
border-spacing: 0px;
margin: 0px;
padding: 0px;
}
/* Head of the table */
tr.np_thread_head,td.np_thread_head {
color: white;
background: #26598f;
margin: 0px;
}
/* Even line numbers in the thread */
tr.np_thread_line1,td.np_thread_line1 {
padding-left: 3px;
padding-top: 0px;
padding-right: 0px;
padding-bottom: 0px;
background: #f9f9f9;
margin: 0px;
}
/* Odd line numbers in the thread */
tr.np_thread_line2,td.np_thread_line2 {
padding-left: 3px;
padding-top: 0px;
padding-right: 0px;
padding-bottom: 0px;
background: #eeeeee;
margin: 0px;
}
/* Text inside a Line */
span.np_thread_line_text {
font-size: small;
}
/* The small images, a thread consists of */
img.thread_image {
vertical-align: bottom;
}
/* =========== Article Layout ============= */
/* headline */
h1.np_article_headline {
font-size: large;
}
/* Head of an article */
div.np_article_header {
background: #eeeeee;
padding: 3px;
border: solid 1px #26598f;
}
/* Layout of the Text-Body */
div.np_article_body {
margin-top: 20px;
font-family: "Lucida Console", "Courier New", Courier, "Andale Mono", monospace;
}
/* Layout of quoted text / graphic layout */
blockquote.np_article_quote {
border-left: #002255 solid 1px;
padding-left: 5px;
color: #002277;
margin: 0px;
}
/* =========== Post layout =========== */
/* headline */
h1.np_post_headline {
font-size: large;
}
/* Head with the input fields for subject, name and email */
.np_post_header {
background: #eeeeee;
padding: 3px;
border: solid 1px #26598f;
}
/* Body with the message-field and the post-button in it */
.np_post_body {
background: #eeeeee;
padding: 3px;
border: solid 1px #26598f;
margin-top: 10px;
}
/* =========== navigation buttons on top of every page =========== */
.np_buttonbar {
background: #26598f;
padding: 1px;
margin-bottom: 10px;
color: black;
}
td.np_button {
padding-left: 5px;
padding-right: 5px;
border-right: solid white 1px;
color: white;
white-space: nowrap;
}
a.np_button {
color: white;
text-decoration: underline;
}
.np_pages {
color: white;
}
.np_pages_selected {
color: white:
text-weight: bold;
margin-left: 5px;
}
.np_pages_unselected {
color: white;
text-decoration: underline;
margin-left: 5px;
}

6
newsgroup/tail.inc Executable file
View File

@ -0,0 +1,6 @@
<p align="right"><small>
"<a href="http://florian-amrhein.de/newsportal/">News-Portal</a>"
was written by <a href="http://florian-amrhein.de">Florian Amrhein</a>.
</small></p>
</body></html>

82
newsgroup/thread.php Executable file
View File

@ -0,0 +1,82 @@
<? header("Expires: ".gmdate("D, d M Y H:i:s",time()+7200)." GMT");
// register parameters
$group=$_REQUEST["group"];
if(isset($_REQUEST["first"]))
$first=intval($_REQUEST["first"]);
if(isset($_REQUEST["last"]))
$last=intval($_REQUEST["last"]);
include "config.inc.php";
include("$file_newsportal");
include "auth.inc";
$title.= ' - '.$group;
include "head.inc";
if((!function_exists("npreg_group_has_read_access") ||
npreg_group_has_read_access($group)) &&
(!function_exists("npreg_group_is_visible") ||
npreg_group_is_visible($group))) {
?>
<a name="top"></a>
<h1 class="np_thread_headline"><?=htmlspecialchars($group); ?></h1>
<?
echo '<table cellpadding="0" cellspacing="0" width="100%" class="np_buttonbar"><tr>';
echo '<td class="np_button"><a class="np_button" href="'.
$file_index.'">'.$text_thread["button_grouplist"].'</td></a>';
if (!$readonly &&
(!function_exists("npreg_group_has_write_access") ||
npreg_group_has_write_access($group)))
echo '<td class="np_button"><a class="np_button" href="'.
$file_post.'?newsgroups='.urlencode($group).'&amp;type=new">'.
$text_thread["button_write"]."</a></td>";
// $ns=nntp_open($server,$port);
flush();
$headers = thread_load($group);
$article_count=count($headers);
if ($articles_per_page != 0) {
if ((!isset($first)) || (!isset($last))) {
if ($startpage=="first") {
$first=1;
$last=$articles_per_page;
} else {
$first=$article_count - (($article_count -1) % $articles_per_page);
$last=$article_count;
}
}
echo '<td class="np_pages" width="100%" align="right">';
// Show the replies to an article in the thread view?
if($thread_show["replies"]) {
// yes, so the counting of the shown articles is very easy
$pagecount=count($headers);
} else {
// oh no, the replies will not be shown, this makes life hard...
$pagecount=0;
if(count($headers>0) && is_array($headers)) {
foreach($headers as $h) {
if($h->isAnswer==false)
$pagecount++;
}
}
}
thread_pageselect($group,$pagecount,$first);
echo '</td>';
} else {
$first=0;
$last=$article_count;
}
echo '</tr></table>';
thread_show($headers,$group,$first,$last);
} else {
echo $text_register["no_access_group"];
}
?>
<p align="right"><a href="#top"><? echo $text_thread["button_top"];?></a></p>
<? include "tail.inc"; ?>