function print_news($show_num, $newsid){
$path=pathinfo($_SERVER["PATH_TRANSLATED"]);
$news_path=$path["dirname"];
require "config.php";
echo "\n
\n
News Asystent v1.5 - Drukowanie newsa...
";
$newsdata="data/newsdata.dat";
if(file_exists($newsdata)){
$newstable=file($newsdata);
$news_total=count($newstable);
$max=$news_total-$show_num;
if($_GET["list"]=="all"){
$max=0;
}
if($max<0){$max=0;}
if($newsid!=-1){
$news_total=$newsid+1;
$max=$newsid;
}
$NEWSHEADTEXT="Pełny tekst newsa:";
include "$news_path/template/$theme/top.tpl";
echo $top_tpl;
for($i=$news_total-1; $i>=$max; $i--){
$newstable[$i]=trim($newstable[$i]);
$data=explode("*;*", $newstable[$i]);
$NEWSTITLE=$data[0];
$NEWSDATE=$data[1].", ".$data[2];
$img_file=$news_path."/images/topics/".$data[7];
if(file_exists($img_file)){
$img_size=GetImageSize($img_file);
if($max_img_width>0 && $img_size[0]>$max_img_width){$resize=$img_size[0]-$max_img_width;}else{$resize=0;}
$width=$img_size[0]-$resize;
}else{$NEWSIMAGE="";}
if($data[7]!=""){$NEWSIMAGE="";}
else{$NEWSIMAGE="";}
if($default_img=="" && $data[7]==""){$NEWSIMAGE="";}
if($disable_images==1){$NEWSIMAGE="";}
$NEWSAUTHOR=$data[4];
$newstext=explode(" ", $data[3]);
$words_all=count($newstext);
if($newsid>-1){
$max_length=$words_all;
}else{
$max_length=$max_news_length;
if($max_length>=$words_all){
$max_length=$words_all;
}else{
$add_end=("...");
}
}
$NEWSBODY="";
for($z=0; $z<$max_length; $z++){
$NEWSBODY .= " ".$newstext[$z];
}
$NEWSBODY=$NEWSBODY.$add_end;
if($add_end!=""){
$NEWSFULLSHOW="[ czytaj więcej ]";
}else{
$NEWSFULLSHOW="";
}
if($disable_comments!=1){
$comment_file=ereg_replace("-", "", $data["1"]);
$comment_file.=ereg_replace(":", "", $data["2"]);
$NEWSCOMMENTS="komentarze [".$data[6]."]";
$NEWSADDCOMMENT="";
$NEWSMENULINKS=$NEWSCOMMENTS;
}else{
$NEWSMENULINKS="";
}
$NEWSSIZE=strlen($NEWSBODY);
include "$news_path/template/$theme/news.tpl";
echo $news_tpl;
unset($words_all);
unset($add_end);
unset($NEWSDATE);
}
$BOTTOMLINKS="";
include "$news_path/template/$theme/bottom.tpl";
if($_GET["news_action"]==""||$_GET["news_action"]=="display" || $_GET["news_base"]=="" || $_GET["news_action"]=="more"){
echo $bottom_tpl;
}
}else{
echo "Plik z newsami \"$newsdata\" nie został odnaleziony!
";
}
}
print_news($show_num,$_GET["newsid"]);
echo "Powered by News Asystent v1.5
";
echo "\n"
?>