###############################################################################
# News.pl #
###############################################################################
# YaBB: Yet another Bulletin Board #
# Open-Source Project started by Zef Hemel (zef@zefnet.com) #
# Software Version: YaBB 1 Gold - Release #
# =========================================================================== #
# Software Distributed by: http://yabb.xnull.com #
# Support, News, Updates at: http://yabb.xnull.com/community/ #
# =========================================================================== #
# Copyright (c) 2000-2001 X-Null - All Rights Reserved #
# Software by: The YaBB Development Team #
###############################################################################
$recentplver="1 Gold - SP1";
$iscomment="Comment"; ###HbBB
$iscomment2="Comments"; ###HbBB
$showcomments = "View Comments";
$writecomments = "Write Comment";
$display = 10;
$archivlink = qq~
Archive~;
$showattach = qq~
~;
sub NewsAttachments{
my($msf,$mfn,$attachment,$showattach);
my($msf,$mfn,$attachment,$showattach);
require "$sourcedir/Title.pl";
my $viewnum = $INFO{'num'};
if( $viewnum =~ /\D/ ) { &fatal_error($txt{'337'}); }
if( $currentboard eq '' ) { &fatal_error($txt{'1'}); }
$maxmessagedisplay ||= 10;
my($buffer,$views,$lastposter,$moderators,$counter,$counterwords,$pageindex,$msubthread,$mnum,$mstate,$mdate,$msub,$mname,$memail,$mreplies,$musername,$micon,$noposting,$threadclass,$notify,$max,$start,$bgcolornum,$windowbg,$mattach,$mip,$mlm,$mlmb,$lastmodified,$postinfo,$star,$sendm,$topicdate);
my(@userprofile,@messages,@bgcolors);
# For each post in this thread:
foreach (@messages) {
$windowbg = $bgcolors[($counter % $bgcolornum)];
$css = $cssvalues[($counter % $cssnum)];
chomp;
($msub, $mname, $memail, $mdate, $musername, $micon, $mattach, $mip, $postmessage, $ns, $mlm, $mlmb, $msf, $mfn) = split(/[\|]/, $_);
($msub, $mname, $memail, $mdate, $musername, $micon, $mattach, $mip, $postmessage, $ns, $mlm, $mlmb, $msf, $mfn) = split(/[\|]/, $_);
# Should we show an attachment file?
if( $msf && $mfn && $msf ne "" && $mfn ne "") {
if (-e ("$upload_dir/$mfn")) {
$attachment = qq~
$mfn~;
if(($mfn =~ /(jpg|gif|bmp|png|jpeg)$/i) && ($amdisplaypics == 1)) {
$showattach = qq~
~;
} else {
$showattach = '';
}
} else {
$attachment = qq~
$mfn $fatxt{'1'}~;
$showattach = '';
}
} else {
$attachment = '';
$showattach = '';
}
}
}
sub ShowNews {
$currcat = &BoardCatGet($currentboard);
$curboard = $currentboard;
unless ( $currcat ) { &fatal_error("Cat not found"); }
unless( &BoardAccessGet($currentboard) ) { &fatal_error( $txt{'1'} ); }
chomp $curboard;
fopen(FILE, "$boardsdir/$curboard.txt");
@threads = ;
fclose(FILE);
for ($i = 0; $i < @threads; $i++) {
chomp $threads[$i];
($tnum, $tsub, $tname, $temail, $tdate, $treplies, $tusername, $ticon, $tstate) = split( /\|/, $threads[$i] );
fopen(FILE, "$datadir/$tnum.txt") || next;
@messages2 = ;
fclose(FILE);
$message = $messages2[0];
chomp $message;
if( $message ) {
($msub, $mname, $memail, $mdate, $musername, $micon, $mattach, $mip, $message, $mns) = split(/\|/,$message);
$mtime = stringtotime($mdate);
$data{$mtime} = [$curboard, $tnum, $treplies, $tusername, $tname, $msub, $mname, $memail, $mdate, $musername, $micon, $mattach, $mip, $message, $mns, $treplies]; ###HbBB
}
}
@messages2 = sort {$b <=> $a } keys %data;
print "Content-type: text/html\n\n";
$showarchiv = 0;
if( @messages2 ) {
if( @messages2 > $display && $INFO{'archiv'} ne 1) { $#messages2 = $display - 1; $showarchiv = 1; }
$counter = 1;
# Load Censor List
&LoadCensorList;
}
else {
print qq~
No Entries available
~;
}
if ($INFO{'archiv'} eq 1) { $tmp = $display; } else { $tmp = 0 }
for( $i = $tmp; $i < @messages2; $i++ ) {
($board, $tnum, $c, $tusername, $tname, $msub, $mname, $memail, $mdate, $musername, $micon, $mattach, $mip, $message, $mns, $antworten) = @{ $data{$messages2[$i]} }; ###HbBB
foreach (@censored) {
($tmpa,$tmpb) = @{$_};
$message =~ s~\Q$tmpa\E~$tmpb~gi;
$msub =~ s~\Q$tmpa\E~$tmpb~gi;
}
if($enable_ubbc) { require "$sourcedir/YaBBC.pl"; &DoUBBC; }
fopen(TEMPLATE,"news_template.html") || die("$txt{'23'}: news_template.html");
@news_template = ;
fclose(TEMPLATE);
$newsdate = &timeformat($mdate);
$newstitle = $msub;
$newsauthor = qq~$tname~;
$newsmessage = $message;
$newsattachment = $showattach;
#HbBB
if ($antworten eq 1) {$mehr=$iscomment;} else {$mehr=$iscomment2;}
if ($antworten ne 0) {$newscomments = qq~$antworten $mehr, $showcomments \| ~;} else {$newscomments="";}
##HbBB
$newsnewcomment = qq~$writecomments~;
$newsicon = qq~
~;
for( $news_templatemain = 0; $news_templatemain < @news_template; $news_templatemain++ ) {
$news_curline = $news_template[$news_templatemain];
$news_curline =~ s~~${"news$1"}~g;
print $news_curline;
}
++$counter;
}
if ($showarchiv eq 1 && $INFO{'archiv'} ne 1) { print $archivlink; }
exit;
}
1;