#! /usr/bin/perl #use CGI::Carp "fatalsToBrowser"; use Socket; require "templates/set.cgi"; require "templates/zentral.cgi"; $cachezeit = 60 if($cachezeit !~ /^\d+$/); # # Autor: Stefan Gipper (Stefanos) # Webseite: http://www.coder-world.de # E-Mail: support@coder-world.de # $spaltenanzahl = 1 if(!$spaltenanzahl or $spaltenanzahl !~ /^\d+$/ or $spaltenanzahl < 1); $drucksaveSPALTEN = 10 if(!$drucksaveSPALTEN or $drucksaveSPALTEN !~ /^\d+$/ or $drucksaveSPALTEN < 1); $zeit = time(); $version = "1.62"; BEGIN { use FindBin; use lib ("$FindBin::Bin", "$FindBin::Bin/libs"); $ENV{'TMPDIR'} = $ENV{'TEMP'} || ""; eval { $died_in_eval = 1; require LWP::Simple; }; if($@){ $lwpsimple = 0; }else{ $lwpsimple = 1; import LWP::Simple; } # eval { $eval_in_died = 1; require Text::Metaphone; }; # if(!$@){ # $mod_metaphone = 1; # import Text::Metaphone; # } eval { $eval_in_died = 1; require Digest::MD5; }; if(!$@){ $mod_md5 = 1; import Digest::MD5; } eval { $died_in_eval = 1; require Encode; }; if($@){ $encode = 0; }else{ $encode = 1; import Encode qw(from_to); } } $OS = $ENV{HTTP_USER_AGENT}; if($OS=~/vms/i){ $CRLF = "\n"; }elsif($OS=~/^MacOS$/i){ $CRLF = "\n\r"; }else{ $CRLF = "\015\012"; } binmode STDIN; read(STDIN, $Daten, $ENV{'CONTENT_LENGTH'}); if($ENV{'CONTENT_TYPE'} =~ /^(.+)boundary=(.+)$/){ $boundary = '--'.$2; @parts = split(/$boundary/, $Daten); }else{ @parts = split(/&/, $Daten); } foreach (@parts){ if($boundary){ ($header,$content) = split(/$CRLF$CRLF/,$_,2); ($namex) = ($header =~ / name="([^"]*?)"/s); }else{ ($namex,$content) = split(/=/, $_,2); } if($content){ if($header =~ /filename/s && $boundary ne "" && $namex =~ /^file-upload-[\d]+$/i){ ($filename) = ($header =~ /; filename="([^"]*?)"/s); $filename =~ s/^.*\\//; ($mimetype) = ($header =~ /Content-Type: (.*)/s); $mimetype =~ s/($CRLF.*)//s; if($filename){ $content =~ s/^$CRLF//gs; $content =~ s/$CRLF$//gs; $FORM{$namex} = $content; $FILE{$namex} = $filename; $MIME{$namex} = $mimetype; } }else{ $namex =~ tr/+/ /; $namex =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $content =~ tr/+/ /; $content =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $content =~ s/$CRLF/\n/g; chomp($content); if($FORM{$namex} ne ""){ $FORM{$namex} .= "\|$content"; # ,$content"; }else{ $FORM{$namex} = $content; } } } } foreach (split(/&/,$ENV{QUERY_STRING})){ ($namex,$value) = split(/=/,$_,2); $namex =~ tr/+/ /; $namex =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s///g; if($INFO{$namex} ne ""){ $INFO{$namex} .= ",$value"; }else{ $INFO{$namex} = $value; } } $action = $INFO{'a'} || $FORM{'a'}; $INFO{'lang'}--; if($action eq "1"){ &index; }elsif($action =~ /^admin/){ require "templates/admin.cgi"; &$action; }elsif($action =~ /^start|^index|^view|^version/){ &$action; } if($startseite != 1){ &view; }else{ &start; } sub index { $check_referer = 1; open(F,"){ $_ =~ s/[\n\r]//g; if($ENV{'HTTP_REFERER'} =~ m|https?://([^/]*)$_|i){ $check_referer = 0; last; } } flock(F,8) if($flock); close(F); &error("Diese Internet-Adresse ist gesperrt.") if($check_referer != 1); $INFO{'js'} = 0 unless($INFO{'js'}); &error("Der max. Wert wieviel News angezeigt werden ist inkorrekt.") if($INFO{'max'} !~ /^\d+$/ or $INFO{'max'} > 99); &error("Die Zeitangabe beinhaltet nicht nur Zahlen.") if($INFO{'time'} !~ /^\d+$/ && $INFO{'time'} ne ""); if($referer){ $ENV{'HTTP_REFERER'} = "Unbekannt" if($ENV{'HTTP_REFERER'} !~ /^http:\/\//); $auf = $ENV{'HTTP_REFERER'} || "Unbekannt"; $noref = 1; open(F,"){ $_ =~ s/[\n\r]//g; if($auf =~ /\Q$_\E/i){ $noref = 0; } } flock(F,8) if($flock); close(F); if($noref == 1){ ($suchwort) = ($auf =~ /(?:context=|searchfor=|domain=|as_epq=|entry=|aqa=|epq=|qry=|keywords=|search=|query=|string=|keyword=|begriff=|name=|asq=|mt=|q2=|qs=|su=|gs=|q=|p=|w=)([^&]+)(?:&|\?|$)/i); if($suchwort ne "" && $auf =~ /(?:context=|searchfor=|domain=|as_epq=|entry=|aqa=|epq=|qry=|keywords=|search=|query=|string=|keyword=|begriff=|name=|asq=|mt=|q2=|qs=|su=|gs=|q=|p=|w=)([^&]+)(?:&|\?|$)/i){ $suchwort = lc($suchwort); $suchwort =~ tr/+/ /; $suchwort =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $suchwort =~ s/[\n\r]//g; $suchwort =~ s/\s\s+//g; $suchwort =~ s/\s$//g; $suchwort =~ s/^\s//g; open(F,"+; $zahl = $#auf+1; seek(F,0,0); truncate(F,0); if($zahl >= 1){ foreach (@auf){ s/[\n\r]//g; ($one,$two) = split(/\|/); if($two eq $suchwort && $aufyes ne 1){ $one++; print F "$one\|$suchwort\n"; $aufyes = 1; }else{ print F "$one\|$two\n"; } } print F "1\|$suchwort\n" if($aufyes ne 1); }else{ print F "1\|$suchwort\n"; } flock(F,8) if($flock); close(F); }else{ open(F,"+; $zahl = $#auf+1; seek(F,0,0); truncate(F,0); if($zahl >= 1){ foreach (@auf){ s/[\n\r]//g; ($one,$two) = split(/\|/); if($two eq $auf && $aufyes ne 1){ $one++; print F "$one\|$auf\n"; $aufyes = 1; }else{ print F "$one\|$two\n"; } } print F "1\|$auf\n" if($aufyes ne 1); }else{ print F "1\|$auf\n"; } flock(F,8) if($flock); close(F); } } } if($INFO{'iframe'} or $INFO{'js'}){ if($INFO{'itemplate'} =~ /^\w+\.\w+$/ && $INFO{'itemplate'} !~ /^admin/){ open(F,"/,join("",)); # flock(F,8) if($flock); close(F); } if((-e("templates/$INFO{'name'}.csv")) && $INFO{'cache'} ne "no" && $cache == 1){ $time = $INFO{'time'} || $cachezeit; $time = $cachezeit if(length($time) < 2); if((((stat("templates/$INFO{'name'}.csv"))[9])+$time) > $zeit){ open(F,"){ $_ =~ s/[\n\r]//g; ($url,$titel,$des,$timeup) = split(/\|/,$_); &wortkuerze; open(Z,"){ s/[\n\r]//g; my $sterne = "\*" x length($_); $titel =~ s/$_/$sterne/ig; } flock(Z,8) if($flock); close(Z); if($newsi == $INFO{'max'}){ last; }elsif($titel ne "" && $url ne ""){ $newsi++; $tempx = $druck2; $tempx =~ s/\'/\\\'/g; $tempx =~ s/__titel__/$titel/g; $tempx =~ s/__titel2__/$titel2/g; if($des){ $tempx =~ s/__des__/txt2html($des)/eg; }else{ $tempx =~ s/__des__//g; } $tempx =~ s/__url__/$url/g; $tempx =~ s/[\n\r]//g; $x .= qq~document.write('$tempx');\n~; } } }elsif($INFO{'js'} == 2){ $x = join("",); }elsif($INFO{'js'} == 3){ &error("Die XML-Funktion wurde deaktiviert.") if($xmloption && !$INFO{'pass'} or !$xmloption && $xmlpass ne $INFO{'pass'}); $x .= qq~\n~; $x .= qq~\n~; $x .= qq~\n~; $x .= qq~\t\n~; $x .= qq~\t\t$INFO{'name'}\n~; while(){ $_ =~ s/[\n\r]//g; ($url,$titel,$des,$timeup) = split(/\|/,$_); &wortkuerze; if($newsi == $INFO{'max'}){ last; }elsif($titel ne "" && $url ne ""){ $newsi++; $x .= qq~\t\n~; $x .= qq~\t\t$titel\n~; $x .= qq~\t\t$url\n~; $x .= qq~\t\t$des\n~; $x .= qq~\t\n~; } } $x .= qq~\t\n~; $x .= qq~~; }else{ while(){ $_ =~ s/[\n\r]//g; ($url,$titel,$des,$timeup) = split(/\|/,$_); &wortkuerze; open(Z,"){ s/[\n\r]//g; my $sterne = "\*" x length($_); $titel =~ s/$_/$sterne/ig; } flock(Z,8) if($flock); close(Z); if($newsi == $INFO{'max'}){ last; }elsif($titel ne "" && $url ne ""){ $newsi++; $tempx = $druck2; $tempx =~ s/\'/\\\'/g; $tempx =~ s/__titel__/$titel/g; $tempx =~ s/__titel2__/$titel2/g; if($des){ $tempx =~ s/__des__/txt2html($des)/eg; }else{ $tempx =~ s/__des__//g; } $tempx =~ s/__url__/$url/g; $x .= $tempx; } } } flock(F,8) if($flock); close(F); }else{ ($save,$externurl,$externname,$externid) = news("$INFO{'name'}"); if($save){ if(!-e("templates/$INFO{'name'}.csv")){ open(F,">templates/$INFO{'name'}.csv"); flock(F,2) if($flock); print F $save; flock(F,8) if($flock); close(F); chmod(0777,"templates/$INFO{'name'}.csv"); @new = split(/\n/,$save); }else{ open(F,"+); foreach(split(/\n/,$oldsave)){ $_ =~ s/[\n\r]//g; ($url,$titel,$des,$timeup) = split(/\|/,$_); $again{$url} = $INFO{'name'}; $againDATA{$url} = $_; $againDATA2{$url} = $timeup; } foreach(split(/\n/,$save)){ $_ =~ s/[\n\r]//g; ($url,$titel,$des,$timeup) = split(/\|/,$_); $again{$url} = $INFO{'name'}; if($againDATA{$url}){ ($OLDurl,$OLDtitel,$OLDdes,$OLDtimeup) = split(/\|/,$againDATA{$url}); $againDATA{$url} = "$url\|$titel\|$des\|$OLDtimeup"; }else{ $againDATA{$url} = $_; } } seek(F,0,0); truncate(F,0); foreach (keys %again){ ($url,$titel,$des,$timeup) = split(/\|/,$againDATA{$_}); if($timeup+($timeupconfig*86400) > $zeit){ if($againDATA2{$_}){ push(@newsave,"$url\|$titel\|$des\|$againDATA2{$_}" . "\n"); }else{ push(@newsave,"$url\|$titel\|$des\|$timeup" . "\n"); } } } @new = (sort{ (split(/\|/,$b)) [3] <=> (split(/\|/,$a)) [3] } @newsave); print F @new; flock(F,8) if($flock); close(F); } }else{ open(F,"+); seek(F,0,0); truncate(F,0); print F $save; flock(F,8) if($flock); close(F); @new = split(/\n/,$save); } if($INFO{'js'} == 1){ foreach(@new){ $_ =~ s/[\n\r]//g; ($url,$titel,$des,$timeup) = split(/\|/,$_); &wortkuerze; open(Z,"){ s/[\n\r]//g; my $sterne = "\*" x length($_); $titel =~ s/$_/$sterne/ig; } flock(Z,8) if($flock); close(Z); if($newsi == $INFO{'max'}){ last; }elsif($titel ne "" && $url ne ""){ $newsi++; $tempx = $druck2; $tempx =~ s/\'/\\\'/g; $tempx =~ s/__titel__/$titel/g; $tempx =~ s/__titel2__/$titel2/g; if($des){ $tempx =~ s/__des__/txt2html($des)/eg; }else{ $tempx =~ s/__des__//g; } $tempx =~ s/__url__/$url/g; $tempx =~ s/[\n\r]//g; $x .= qq~document.write('$tempx');\n~; } } }elsif($INFO{'js'} == 2){ $x = join("",@new); }elsif($INFO{'js'} == 3){ &error("Die XML-Funktion wurde deaktiviert.") if($xmloption && !$INFO{'pass'} or !$xmloption && $xmlpass ne $INFO{'pass'}); $x .= qq~\n~; $x .= qq~\n~; $x .= qq~\n~; $x .= qq~\t\n~; $x .= qq~\t\t$INFO{'name'}\n~; $x .= qq~\t\t$externurl\n~; foreach(@new){ $_ =~ s/[\n\r]//g; ($url,$titel,$des,$timeup) = split(/\|/,$_); if($newsi == $INFO{'max'}){ last; }elsif($titel ne "" && $url ne ""){ $newsi++; $x .= qq~\t\n~; $x .= qq~\t\t$titel\n~; $x .= qq~\t\t$url\n~; $x .= qq~\t\t$des\n~; $x .= qq~\t\n~; } } $x .= qq~\t\n~; $x .= qq~~; }else{ foreach(@new){ $_ =~ s/[\n\r]//g; ($url,$titel,$des,$timeup) = split(/\|/,$_); &wortkuerze; open(Z,"){ s/[\n\r]//g; my $sterne = "\*" x length($_); $titel =~ s/$_/$sterne/ig; } flock(Z,8) if($flock); close(Z); if($newsi == $INFO{'max'}){ last; }elsif($titel ne "" && $url ne ""){ $newsi++; $tempx = $druck2; $tempx =~ s/\'/\\\'/g; $tempx =~ s/__titel__/$titel/g; $tempx =~ s/__titel2__/$titel2/g; if($des){ $tempx =~ s/__des__/txt2html($des)/eg; }else{ $tempx =~ s/__des__//g; } $tempx =~ s/__url__/$url/g; $x .= $tempx; } } } } if($INFO{'iframe'}){ $druck .= $x . $druck3; }else{ $druck = $x; } }else{ ($save,$externurl,$externname,$externid) = news("$INFO{'name'}"); if($save ne "" && $INFO{'cache'} ne "no"){ if(!-e("templates/$INFO{'name'}.csv")){ open(F,">templates/$INFO{'name'}.csv"); flock(F,2) if($flock); print F $save; flock(F,8) if($flock); close(F); chmod(0777,"templates/$INFO{'name'}.csv"); @new = split(/\n/,$save); }else{ open(F,"+); foreach(split(/\n/,$oldsave)){ $_ =~ s/[\n\r]//g; ($url,$titel,$des,$timeup) = split(/\|/,$_); $again{$url} = $INFO{'name'}; $againDATA{$url} = $_; $againDATA2{$url} = $timeup; } foreach(split(/\n/,$save)){ $_ =~ s/[\n\r]//g; ($url,$titel,$des,$timeup) = split(/\|/,$_); $again{$url} = $INFO{'name'}; if($againDATA{$url}){ ($OLDurl,$OLDtitel,$OLDdes,$OLDtimeup) = split(/\|/,$againDATA{$url}); $againDATA{$url} = "$url\|$titel\|$des\|$OLDtimeup"; }else{ $againDATA{$url} = $_; } } seek(F,0,0); truncate(F,0); foreach (keys %again){ ($url,$titel,$des,$timeup) = split(/\|/,$againDATA{$_}); if($timeup+($timeupconfig*86400) > $zeit){ if($againDATA2{$url}){ push(@newsave,"$url\|$titel\|$des\|$againDATA2{$_}" . "\n"); }else{ push(@newsave,"$url\|$titel\|$des\|$timeup" . "\n"); } } } @new = (sort{ (split(/\|/,$b)) [3] <=> (split(/\|/,$a)) [3] } @newsave); print F @new; flock(F,8) if($flock); close(F); } }elsif($INFO{'cache'} ne "no"){ open(F,"+); seek(F,0,0); truncate(F,0); print F $save; flock(F,8) if($flock); close(F); @new = split(/\n/,$save); }else{ @new = split(/\n/,$save); } if($INFO{'js'} == 1){ foreach(@new){ $_ =~ s/[\n\r]//g; ($url,$titel,$des,$timeup) = split(/\|/,$_); &wortkuerze; open(Z,"){ s/[\n\r]//g; my $sterne = "\*" x length($_); $titel =~ s/$_/$sterne/ig; } flock(Z,8) if($flock); close(Z); if($newsi == $INFO{'max'}){ last; }elsif($titel ne "" && $url ne ""){ $newsi++; $tempx = $druck2; $tempx =~ s/\'/\\\'/g; $tempx =~ s/__titel__/$titel/g; $tempx =~ s/__titel2__/$titel2/g; if($des){ $tempx =~ s/__des__/txt2html($des)/eg; }else{ $tempx =~ s/__des__//g; } $tempx =~ s/__url__/$url/g; $tempx =~ s/[\n\r]//g; $x .= qq~document.write('$tempx');\n~; } } }elsif($INFO{'js'} == 2){ $x = join("",@new); }elsif($INFO{'js'} == 3){ &error("Die XML-Funktion wurde deaktiviert.") if($xmloption && !$INFO{'pass'} or !$xmloption && $xmlpass ne $INFO{'pass'}); $x .= qq~\n~; $x .= qq~\n~; $x .= qq~\n~; $x .= qq~\t\n~; $x .= qq~\t\t$INFO{'name'}\n~; $x .= qq~\t\t$externurl\n~; foreach(@new){ $_ =~ s/[\n\r]//g; ($url,$titel,$des,$timeup) = split(/\|/,$_); if($newsi == $INFO{'max'}){ last; }elsif($titel ne "" && $url ne ""){ $newsi++; $x .= qq~\t\n~; $x .= qq~\t\t$titel\n~; $x .= qq~\t\t$url\n~; $x .= qq~\t\t$des\n~; $x .= qq~\t\n~; } } $x .= qq~\t\n~; $x .= qq~~; }else{ foreach(@new){ $_ =~ s/[\n\r]//g; ($url,$titel,$des,$timeup) = split(/\|/,$_); &wortkuerze; open(Z,"){ s/[\n\r]//g; my $sterne = "\*" x length($_); $titel =~ s/$_/$sterne/ig; } flock(Z,8) if($flock); close(Z); if($newsi == $INFO{'max'}){ last; }elsif($titel ne "" && $url ne ""){ $newsi++; $tempx = $druck2; $tempx =~ s/\'/\\\'/g; $tempx =~ s/__titel__/$titel/g; $tempx =~ s/__titel2__/$titel2/g; if($des){ $tempx =~ s/__des__/txt2html($des)/eg; }else{ $tempx =~ s/__des__//g; } $tempx =~ s/__url__/$url/g; $x .= $tempx; } } } if($INFO{'iframe'}){ $druck .= $x . $druck3; }else{ $druck = $x; } } if($druck eq "" && (-e("templates/$INFO{'name'}.csv"))){ open(F,"){ $_ =~ s/[\n\r]//g; ($url,$titel,$des,$timeup) = split(/\|/,$_); &wortkuerze; open(Z,"){ s/[\n\r]//g; my $sterne = "\*" x length($_); $titel =~ s/$_/$sterne/ig; } flock(Z,8) if($flock); close(Z); if($newsi == $INFO{'max'}){ last; }elsif($titel ne "" && $url ne ""){ $newsi++; $tempx = $druck2; $tempx =~ s/\'/\\\'/g; $tempx =~ s/__titel__/$titel/g; $tempx =~ s/__titel2__/$titel2/g; if($des){ $tempx =~ s/__des__/txt2html($des)/eg; }else{ $tempx =~ s/__des__//g; } $tempx =~ s/__url__/$url/g; $tempx =~ s/[\n\r]//g; $x .= qq~document.write('$tempx');\n~; } } }elsif($INFO{'js'} == 2){ $x = join("",); }elsif($INFO{'js'} == 3){ &error("Die XML-Funktion wurde deaktiviert.") if($xmloption && !$INFO{'pass'} or !$xmloption && $xmlpass ne $INFO{'pass'}); $x .= qq~\n~; $x .= qq~\n~; $x .= qq~\n~; $x .= qq~\t\n~; $x .= qq~\t\t$INFO{'name'}\n~; $x .= qq~\t\t$externurl\n~; while(){ $_ =~ s/[\n\r]//g; ($url,$titel,$des,$timeup) = split(/\|/,$_); if($newsi == $INFO{'max'}){ last; }elsif($titel ne "" && $url ne ""){ $newsi++; $x .= qq~\t\n~; $x .= qq~\t\t$titel\n~; $x .= qq~\t\t$url\n~; $x .= qq~\t\t$des\n~; $x .= qq~\t\n~; } } $x .= qq~\t\n~; $x .= qq~~; }else{ while(){ $_ =~ s/[\n\r]//g; ($url,$titel,$des,$timeup) = split(/\|/,$_); &wortkuerze; open(Z,"){ s/[\n\r]//g; my $sterne = "\*" x length($_); $titel =~ s/$_/$sterne/ig; } flock(Z,8) if($flock); close(Z); if($newsi == $INFO{'max'}){ last; }elsif($titel ne "" && $url ne ""){ $newsi++; $tempx = $druck2; $tempx =~ s/\'/\\\'/g; $tempx =~ s/__titel__/$titel/g; $tempx =~ s/__titel2__/$titel2/g; if($des){ $tempx =~ s/__des__/txt2html($des)/eg; }else{ $tempx =~ s/__des__//g; } $tempx =~ s/__url__/$url/g; $x .= $tempx; } } } flock(F,8) if($flock); close(F); if($INFO{'iframe'}){ $druck .= $x . $druck3; }else{ $druck = $x; } } if($INFO{'js'} == 3){ &error("Die XML-Funktion wurde deaktiviert.") if($xmloption && !$INFO{'pass'} or !$xmloption && $xmlpass ne $INFO{'pass'}); print "Content-Type: text/xml\n\n$x"; exit; }else{ $druck =~ s/__iframebreite__/$iframebreite/g; $druck =~ s/__iframehoehe__/$iframehoehe/g; &ausgabe($druck); } } sub view2 { $check_referer = 1; open(F,"){ $_ =~ s/[\n\r]//g; if($ENV{'HTTP_REFERER'} =~ m|https?://([^/]*)$_|i){ $check_referer = 0; last; } } flock(F,8) if($flock); close(F); &error("Diese Internet-Adresse ist gesperrt.") if($check_referer != 1); if($referer or $INFO{'suchwort'}){ $ENV{'HTTP_REFERER'} = "Unbekannt" if($ENV{'HTTP_REFERER'} !~ /^http:\/\//); $auf = $ENV{'HTTP_REFERER'} || "Unbekannt"; $noref = 1; open(F,"){ $_ =~ s/[\n\r]//g; if($auf =~ /\Q$_\E/i){ $noref = 0; } } flock(F,8) if($flock); close(F); if($noref == 1 or $INFO{'suchwort'}){ ($suchwort) = ($auf =~ /(?:context=|searchfor=|domain=|as_epq=|entry=|aqa=|epq=|qry=|keywords=|search=|query=|string=|keyword=|begriff=|name=|asq=|mt=|q2=|qs=|su=|gs=|q=|p=|w=)([^&]+)(?:&|\?|$)/i); $suchwort = $INFO{'suchwort'} if($INFO{'suchwort'}); if($suchwort ne "" && $auf =~ /(?:context=|searchfor=|domain=|as_epq=|entry=|aqa=|epq=|qry=|keywords=|search=|query=|string=|keyword=|begriff=|name=|asq=|mt=|q2=|qs=|su=|gs=|q=|p=|w=)([^&]+)(?:&|\?|$)/i or $INFO{'suchwort'}){ $suchwort = lc($suchwort); $suchwort =~ tr/+/ /; $suchwort =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $suchwort =~ s/[\n\r]//g; $suchwort =~ s/\s\s+//g; $suchwort =~ s/\s$//g; $suchwort =~ s/^\s//g; open(F,"+; $zahl = $#auf+1; seek(F,0,0); truncate(F,0); if($zahl >= 1){ foreach (@auf){ s/[\n\r]//g; ($one,$two) = split(/\|/); if($two eq $suchwort && $aufyes ne 1){ $one++; print F "$one\|$suchwort\n"; $aufyes = 1; $auf = "Suchwort"; }else{ print F "$one\|$two\n"; } } print F "1\|$suchwort\n" if($aufyes ne 1); }else{ $auf = "Suchwort"; print F "1\|$suchwort\n"; } flock(F,8) if($flock); close(F); }else{ open(F,"+; $zahl = $#auf+1; seek(F,0,0); truncate(F,0); if($zahl >= 1){ foreach (@auf){ s/[\n\r]//g; ($one,$two) = split(/\|/); if($two eq $auf && $aufyes ne 1){ $one++; print F "$one\|$auf\n"; $aufyes = 1; }else{ print F "$one\|$two\n"; } } print F "1\|$auf\n" if($aufyes ne 1); }else{ print F "1\|$auf\n"; } flock(F,8) if($flock); close(F); } } } if($INFO{'template'} =~ /^\w+\.\w+$/ && $INFO{'template'} !~ /^admin/){ open(F,"/,join("",)); # flock(F,8) if($flock); close(F); $noit = "0"; open(F,"){ $_ =~ s/[\n\r]//g; ($name,$wert) = split(/=/,$_); ($tempxZAHL) = ($split2 =~ /()/s); if($noit != 3){ if($name){ $plus = $tempxZAHL; $plus =~ s/__xmlname__/$name/g; $name = ucfirst($name); $plus =~ s/__name__/$name/g; $plus =~ s//$1/sg; $noit++; $restZAHL .= $plus; } } if($noit == $spaltenanzahl){ $split2x = $split2; $split2x =~ s//$restZAHL/sg; $rest .= $split2x; $restZAHL = ""; $last = ""; $noit = "0"; } } flock(F,8) if($flock); close(F); if($noit == 1){ $rest .= $plus; $noit = "0"; } $x .= $split . $rest . $split3; $x =~ s//$1/sg; $x =~ s/(.+?)//sg; $x =~ s/__url__/$url/g; $x =~ s/__version__/$version/g; $x =~ s/__iframebreite__/$iframebreite/g; $x =~ s/__iframehoehe__/$iframehoehe/g; &ausgabe($x); } sub view { $check_referer = 1; open(F,"){ $_ =~ s/[\n\r]//g; if($ENV{'HTTP_REFERER'} =~ m|https?://([^/]*)$_|i){ $check_referer = 0; last; } } flock(F,8) if($flock); close(F); &error("Diese Internet-Adresse ist gesperrt.") if($check_referer != 1); if($referer or $INFO{'suchwort'}){ $ENV{'HTTP_REFERER'} = "Unbekannt" if($ENV{'HTTP_REFERER'} !~ /^http:\/\//); $auf = $ENV{'HTTP_REFERER'} || "Unbekannt"; $noref = 1; open(F,"){ $_ =~ s/[\n\r]//g; if($auf =~ /\Q$_\E/i){ $noref = 0; } } flock(F,8) if($flock); close(F); if($noref == 1 or $INFO{'suchwort'}){ ($suchwort) = ($auf =~ /(?:context=|searchfor=|domain=|as_epq=|entry=|aqa=|epq=|qry=|keywords=|search=|query=|string=|keyword=|begriff=|name=|asq=|mt=|q2=|qs=|su=|gs=|q=|p=|w=)([^&]+)(?:&|\?|$)/i); $suchwort = $INFO{'suchwort'} if($INFO{'suchwort'}); if($suchwort ne "" && $auf =~ /(?:context=|searchfor=|domain=|as_epq=|entry=|aqa=|epq=|qry=|keywords=|search=|query=|string=|keyword=|begriff=|name=|asq=|mt=|q2=|qs=|su=|gs=|q=|p=|w=)([^&]+)(?:&|\?|$)/i or $INFO{'suchwort'}){ $suchwort = lc($suchwort); $suchwort =~ tr/+/ /; $suchwort =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $suchwort =~ s/[\n\r]//g; $suchwort =~ s/\s\s+//g; $suchwort =~ s/\s$//g; $suchwort =~ s/^\s//g; open(F,"+; $zahl = $#auf+1; seek(F,0,0); truncate(F,0); if($zahl >= 1){ foreach (@auf){ s/[\n\r]//g; ($one,$two) = split(/\|/); if($two eq $suchwort && $aufyes ne 1){ $one++; print F "$one\|$suchwort\n"; $aufyes = 1; $auf = "Suchwort"; }else{ print F "$one\|$two\n"; } } print F "1\|$suchwort\n" if($aufyes ne 1); }else{ $auf = "Suchwort"; print F "1\|$suchwort\n"; } flock(F,8) if($flock); close(F); }else{ open(F,"+; $zahl = $#auf+1; seek(F,0,0); truncate(F,0); if($zahl >= 1){ foreach (@auf){ s/[\n\r]//g; ($one,$two) = split(/\|/); if($two eq $auf && $aufyes ne 1){ $one++; print F "$one\|$auf\n"; $aufyes = 1; }else{ print F "$one\|$two\n"; } } print F "1\|$auf\n" if($aufyes ne 1); }else{ print F "1\|$auf\n"; } flock(F,8) if($flock); close(F); } } } $INFO{'cat'} = "internet" if(!$INFO{'cat'} && !$INFO{'news'}); if($INFO{'k'} == 1){ if($INFO{'template'} =~ /^\w+\.\w+$/ && $INFO{'template'} !~ /^admin/){ open(F,"/,join("",)); # flock(F,8) if($flock); close(F); if($INFO{'xtemplate'} =~ /^\w+\.\w+$/ && $INFO{'xtemplate'} !~ /^admin/){ open(F,"); # flock(F,8) if($flock); close(F); $x = $split . $kontakt . $split3; $x =~ s///sg; $x =~ s///sg; $x =~ s/(.+?)//sg; $x =~ s/__pages__/$pages/g; $x =~ s/__url__/$url/g; $x =~ s/__version__/$version/g; $x =~ s/__iframebreite__/$iframebreite/g; $x =~ s/__iframehoehe__/$iframehoehe/g; &ausgabe($x); }elsif($INFO{'k'} == 2){ open(F,"){ s/[\n\r]//g; ($XMLname,$XMLtitel,$XMLurl,$XMLhost) = split(/[\|]+/); $INFO{'news'} .= $XMLname . ","; } close(F); open(F,"){ s/[\n\r]//g; ($XMLname,$XMLtitel,$XMLurl,$XMLhost) = split(/\|/); $INFO{'news'} .= $XMLname . ","; } close(F); open(F,"){ $_ =~ s/[\n\r]//g; ($name,$wert) = split(/=/,$_); foreach (split(/\,/,$wert)){ $catkey{$_} = $name; $catzahlseiten{$name}++; } } flock(F,8) if($flock); close(F); open(F,"/,join("",)); # flock(F,8) if($flock); close(F); foreach $idy (split(/\,/,$INFO{'news'})){ $newsi = "0"; open(F,"){ ($timeup) = (split(/\|/,$_))[3]; $timeup = time-$timeup; $catzahl{$catkey{$idy}}++; if($timeup < 86400){ $heute++; $seven++; $dreizig++; $gestern++; }elsif($timeup < (86400*2)){ $gestern++; $seven++; $dreizig++; }elsif($timeup < (86400*7)){ $seven++; $dreizig++; }elsif($timeup < (86400*30)){ $dreizig++; } $gesamt++; } flock(F,8) if($flock); close(F); } foreach (sort keys %catzahl){ $plus = $kontakt2; 1 while $catzahl{$_} =~ s/^(-?\d+)(\d{3})/$1.$2/; $plus =~ s/__katzahl__/$catzahl{$_}/g; 1 while $catzahl{$_} =~ s/^(-?\d+)(\d{3})/$1.$2/; $plus =~ s/__katzahlseite__/$catzahlseiten{$_}/g; next unless($_); # Keine $_ = ucfirst($_); $plus =~ s/__kategorie__/$_/g; $rest .= $plus; } $kontakt .= $rest . $kontakt3; if($INFO{'template'} =~ /^\w+\.\w+$/ && $INFO{'template'} !~ /^admin/){ open(F,"/,join("",)); # flock(F,8) if($flock); close(F); $x = $split . $kontakt . $split3; $x =~ s///sg; $x =~ s/(.+?)//sg; $x =~ s/__pages__/$pages/g; $x =~ s/__url__/$url/g; $x =~ s/__version__/$version/g; 1 while $gesamt =~ s/^(-?\d+)(\d{3})/$1.$2/; $x =~ s/__gesamt__/$gesamt/g; 1 while $heute =~ s/^(-?\d+)(\d{3})/$1.$2/; $x =~ s/__heute__/$heute/g; 1 while $gestern =~ s/^(-?\d+)(\d{3})/$1.$2/; $x =~ s/__gestern__/$gestern/g; 1 while $seven =~ s/^(-?\d+)(\d{3})/$1.$2/; $x =~ s/__seven__/$seven/g; 1 while $dreizig =~ s/^(-?\d+)(\d{3})/$1.$2/; $x =~ s/__dreizig__/$dreizig/g; $x =~ s/__timeupconfig__/$timeupconfig/g; $x =~ s/__iframebreite__/$iframebreite/g; $x =~ s/__iframehoehe__/$iframehoehe/g; &ausgabe($x); } if(!$INFO{'cat'} && !$INFO{'news'}){ open(F,")[0])))[0]; flock(F,8) if($flock); close(F); $INFO{'cat'} =~ s/[\n\r]//g; } if($INFO{'cat'} eq "all"){ open(F,"){ s/[\n\r]//g; ($XMLname,$XMLtitel,$XMLurl,$XMLhost) = split(/\|/); $INFO{'news'} .= $XMLname . ","; } close(F); open(F,"){ s/[\n\r]//g; ($XMLname,$XMLtitel,$XMLurl,$XMLhost) = split(/\|/); $INFO{'news'} .= $XMLname . ","; } close(F); }elsif($INFO{'cat'} eq "allcat"){ open(F,"){ $_ =~ s/[\n\r]//g; ($name,$wert) = split(/=/,$_); $INFO{'news'} .= $wert . ","; } flock(F,8) if($flock); close(F); }elsif(!$INFO{'news'} && $INFO{'cat'}){ foreach (split(/\,/,$INFO{'cat'})){ $hash{$_} = 1; } open(F,"){ $_ =~ s/[\n\r]//g; ($name,$wert) = split(/=/,$_); if($hash{$name}){ $INFO{'news'} .= $wert . ","; } } flock(F,8) if($flock); close(F); } open(F,"){ s/[\n\r]//g; ($XMLname,$XMLtitel,$XMLurl,$XMLhost) = split(/[\|]+/); ($host, $uri) = ($XMLurl =~ m!http://(.*?)(/.*|$)!); $XMLhost = "http://$host" if($XMLhost !~ /^http:\/\//); $nXMLname{$XMLname} = $XMLtitel; $nXMLurl{$XMLname} = $XMLurl; $nXMLhost{$XMLname} = $XMLhost; } close(F); open(F,"){ s/[\n\r]//g; ($XMLname,$XMLtitel,$XMLurl,$XMLhost) = split(/\|/); ($host, $uri) = ($XMLurl =~ m!http://(.*?)(/.*)!); $XMLhost = "http://$host" if($XMLhost !~ /^http:\/\//); $nXMLname{$XMLname} = $XMLtitel; $nXMLurl{$XMLname} = $XMLurl; $nXMLhost{$XMLname} = $XMLhost; } close(F); &error("Keine Newsseiten übergeben.") unless($INFO{'news'}); &error("Unerlaubte Newsseiten übergeben.") if($INFO{'news'} !~ /^[\w\,\.-]+$/); &error("Unerlaubte Kategorie übergeben.") if($INFO{'cat'} !~ /^[\w\,\.-]+$/ && $INFO{'news'} !~ /\,/); $tempcat = $INFO{'cat'}; $INFO{'start'} =~ s/[^\d]//g; unless($mod_md5){ use Digest::Perl::MD5 'md5_hex'; } $cacheIT = md5_hex("$tempcat$INFO{'news'}$INFO{'start'}$INFO{'xml'}$INFO{'wort'}$INFO{'cat'}$INFO{'suchwort'}$INFO{'template'}$INFO{'itemplate'}"); if((-e("./templates/cachecron/$cacheIT.tmp")) && (time-$cachezeit) < (stat("./templates/cachecron/$cacheIT.tmp"))[9] && $cache == 1){ open(F,"); # flock(F,8) if($flock); close(F); }else{ if($INFO{'xml'} != 1){ if($INFO{'itemplate'} =~ /^\w+\.\w+$/ && $INFO{'itemplate'} !~ /^admin/){ open(F,"/,join("",)); # flock(F,8) if($flock); close(F); } if($INFO{'wort'} == 2){ foreach (split(/\s+/,$INFO{'suchwort'})){ $suchwortNEW .= "\Q$_\E\|"; } $suchwortNEW =~ s/\|$//g; } # use Text::Soundex 'soundex'; foreach $idy (split(/\,/,$INFO{'news'})){ $newsi = "0"; open(F,"){ ($url,$titel,$des,$timeup) = split(/\|/,$_); $timeup = time-$timeup; last if($newsi eq $maxnewsprosite && !$INFO{'suchwort'}); $titel =~ s/&/&/g; $titel =~ s/ü/\/g; $titel =~ s/ö/\/g; $titel =~ s/ä/\/g; $titel =~ s/UE/\/g; $titel =~ s/Ü/\/g; $titel =~ s/Ö/\/g; $titel =~ s/Ä/\/g; $titel =~ s/"/\"/g; $titel =~ s/'/\'/g; $titel =~ s/'/\"/g; $titel =~ s/\"\"/\"/g; $titel =~ s/\\\"/\"/g; $titel =~ s/«//g; $titel =~ s/»//g; $titel =~ s/ß//g; $titel2 = $titel; $titel2 =~ s/[^\w]+//g; if($mod_metaphone){ $metaphonetitel = Metaphone($titel2); }else{ # $metaphonetitel = substr($titel, 0, 25); $metaphonetitel = $titel; } # $soundextitel = soundex($titel); if(!$exakt{$metaphonetitel} && !$exakt{$url}){ if($INFO{'suchwort'}){ if($INFO{'wort'} == 1){ if($titel =~ /\Q$INFO{'suchwort'}\E/i){# or $des =~ /\Q$INFO{'suchwort'}\E/i){ push(@new,"$idy\|$url\|$titel\|$des\|$timeup\n"); } }else{ if($titel =~ /$suchwortNEW/i){# or $des =~ /$suchwortNEW/i){ push(@new,"$idy\|$url\|$titel\|$des\|$timeup\n"); } } }else{ push(@new,"$idy\|$url\|$titel\|$des\|$timeup\n"); } $exakt{$metaphonetitel} = 1; $exakt{$url} = 1; $newsi++; } } flock(F,8) if($flock); close(F); } @new = (sort{ (split(/\|/,$a)) [4] <=> (split(/\|/,$b)) [4] } @new); # $INFO{'news'} = "" if($INFO{'cat'}); $zahl = $#new+1; $maxf = 25 unless($maxf); $nv = 1; $start = $INFO{'start'} || 0; $start = $start > $zahl ? $zahl : $start; $start = (sprintf("%.0f",$start / $maxf)) * $maxf; if($start >= (4 * $maxf)){ $startp = $start - (4 * $maxf); $nv = (sprintf("%.0f",$startp / $maxf)) + 1; } if($zahl >= $start + (10 * $maxf)){ $end = $start + (10 * $maxf); }else{ $end = $zahl; } if($INFO{'such'} == 1 && $INFO{'cat'} && !$INFO{'news'}){ if($INFO{'itemplate'}){ if($startp > 0){ $pages = qq~[1] ... ~; } if($startp == $maxf){ $pages = qq~[1] ~; } for($ns = $startp; $ns < $end; $ns += $maxf){ $pages .= $start == $ns ? qq~[$nv] ~ : qq~[$nv] ~; $nv++; } if($end < $zahl){ $lastpn = int(($zahl / $maxf) + 0.9); $lastptn = int($lastpn - 0.9) * $maxf; $page = qq~ ... ~; $page .= qq~ [$lastpn]~; } $pages .= $page; if($nv == 1 or $nv == 2){ $pages =" <<  [1]  >>"; }else{ $xy=($start/$maxf)+1; $xys=$start+$maxf; $xys2=$start-$maxf; if($xy<($nv-1)){ if($xy>1){ $pages=qq~<<  $pages~; }else{ $pages=" $pages"; } $pages .=qq~ >> ~; }else{ if($xy>1){ $pages=qq~<<  $pages~; }else{ $pages=" $pages"; } $pages .="  "; } } }else{ if($startp > 0){ $pages = qq~[1] ... ~; } if($startp == $maxf){ $pages = qq~[1] ~; } for($ns = $startp; $ns < $end; $ns += $maxf){ $pages .= $start == $ns ? qq~[$nv] ~ : qq~[$nv] ~; $nv++; } if($end < $zahl){ $lastpn = int(($zahl / $maxf) + 0.9); $lastptn = int($lastpn - 0.9) * $maxf; $page = qq~ ... ~; $page .= qq~ [$lastpn]~; } $pages .= $page; if($nv == 1 or $nv == 2){ $pages =" <<  [1]  >>"; }else{ $xy=($start/$maxf)+1; $xys=$start+$maxf; $xys2=$start-$maxf; if($xy<($nv-1)){ if($xy>1){ $pages=qq~<<  $pages~; }else{ $pages=" $pages"; } $pages .=qq~ >> ~; }else{ if($xy>1){ $pages=qq~<<  $pages~; }else{ $pages=" $pages"; } $pages .="  "; } } } }else{ $seitennewsANZAHL = $INFO{'news'} unless($INFO{'cat'}); if($startp > 0){ $pages = qq~[1] ... ~; } if($startp == $maxf){ $pages = qq~[1] ~; } for($ns = $startp; $ns < $end; $ns += $maxf){ $pages .= $start == $ns ? qq~[$nv] ~ : qq~[$nv] ~; $nv++; } if($end < $zahl){ $lastpn = int(($zahl / $maxf) + 0.9); $lastptn = int($lastpn - 0.9) * $maxf; $page = qq~ ... ~; $page .= qq~ [$lastpn]~; } $pages .= $page; if($nv == 1 or $nv == 2){ $pages =" <<  [1]  >>"; }else{ $xy=($start/$maxf)+1; $xys=$start+$maxf; $xys2=$start-$maxf; if($xy<($nv-1)){ if($xy>1){ $pages=qq~<<  $pages~; }else{ $pages=" $pages"; } $pages .=qq~ >> ~; }else{ if($xy>1){ $pages=qq~<<  $pages~; }else{ $pages=" $pages"; } $pages .="  "; } } } $pages =~ s/  / /g; if($INFO{'xml'} == 1){ &error("Die XML-Funktion wurde deaktiviert.") if($xmloption && !$INFO{'pass'} or !$xmloption && $xmlpass ne $INFO{'pass'}); $druck .= qq~\n~; $druck .= qq~\n~; $druck .= qq~\t\n~; $druck .= qq~\t\t$INFO{'cat'}\n~; $druck .= qq~\t\n~; } for($i=$start;$i<@new;$i++){ $nnum++; $displayZ++; $new[$i] =~ s/[\n\r]//g; ($id,$url,$titel,$des,$timeup) = split(/\|/,$new[$i]); $titel =~ s/&/&/g; $titel =~ s/ü/\/g; $titel =~ s/ö/\/g; $titel =~ s/ä/\/g; $titel =~ s/Ü/\/g; $titel =~ s/Ö/\/g; $titel =~ s/Ä/\/g; $titel =~ s/"/\"/g; $titel =~ s/'/\'/g; $titel =~ s/'/\"/g; $titel =~ s/\"\"/\"/g; $titel =~ s/\\\"/\"/g; if($INFO{'xml'} == 1){ $titel =~ s/&/&/g; } $titel =~ s//ß/g; $titel =~ s/\/ü/g; $titel =~ s/\/ö/g; $titel =~ s/\/ä/g; $titel =~ s/\/Ü/g; $titel =~ s/\/Ö/g; $titel =~ s/\/Ä/g; open(Z,"){ s/[\n\r]//g; my $sterne = "\*" x length($_); $titel =~ s/$_/$sterne/ig; } flock(Z,8) if($flock); close(Z); $upmin = $timeup / 60; $upstd = $upmin / 60; $updays = sprintf("%.0u",$upstd / 24); $upstd = sprintf("%.0u",$upstd - ($updays * 24)); $upmin = sprintf("%.0u",$upmin - ($updays * 60 * 24) - ($upstd * 60)); $upsec = sprintf("%.0u",$timeup - ($updays * 24 * 60 * 60) - ($upstd * 60 * 60) - ($upmin * 60)); $upmin = "0" unless($upmin); $upsec = "0" unless($upsec); $tempx = $druck2; if($updays){ $upstd = "0" unless($upstd); if($updays == 1 && $upstd != 1){ $tempx =~ s/__zeit__/$updays Tag, $upstd Stunden/g; }elsif($updays != 1 && $upstd == 1){ $tempx =~ s/__zeit__/$updays Tage, $upstd Stunde/g; }elsif($updays == 1 && $upstd == 1){ $tempx =~ s/__zeit__/$updays Tag, $upstd Stunde/g; }elsif($updays != 1 && $upstd != 1){ $tempx =~ s/__zeit__/$updays Tage, $upstd Stunden/g; } }elsif($upstd){ if($upstd == 1 && $upmin != 1){ $tempx =~ s/__zeit__/$upstd Stunde, $upmin Minuten/g; }elsif($upstd != 1 && $upmin == 1){ $tempx =~ s/__zeit__/$upstd Stunden, $upmin Minute/g; }elsif($upstd == 1 && $upmin == 1){ $tempx =~ s/__zeit__/$upstd Stunde, $upmin Minute/g; }elsif($upstd != 1 && $upmin != 1){ $tempx =~ s/__zeit__/$upstd Stunden, $upmin Minuten/g; } }else{ if($upmin == 1 && $upsec != 1){ $tempx =~ s/__zeit__/$upmin Minute, $upsec Sekunden/g; }elsif($upmin != 1 && $upsec == 1){ $tempx =~ s/__zeit__/$upmin Minuten, $upsec Sekunde/g; }elsif($upmin == 1 && $upsec == 1){ $tempx =~ s/__zeit__/$upmin Minute, $upsec Sekunde/g; }elsif($upmin != 1 && $upsec != 1){ $tempx =~ s/__zeit__/$upmin Minuten, $upsec Sekunden/g; } } if($color){ $color = ""; $tempx =~ s/#(\w\w\w\w\w\w):#(\w\w\w\w\w\w)/$1/g; }else{ $color = 1; $tempx =~ s/#(\w\w\w\w\w\w):#(\w\w\w\w\w\w)/$2/g; } $titel =~ s/<([^>]+)>//g; $titel = &html2txt($titel); if($INFO{'xml'} == 1){ $url =~ s/&/&/g; $url =~ s/&/&/g; $titel =~ s/ / /g; $druck .= qq~\t\n~; $druck .= qq~\t\t$titel\n~; $druck .= qq~\t\t$url\n~; if($des){ $des =~ s/&/&/g; $des =~ s/<(.+?)>/ /g; $druck .= qq~\t\t$des\n~; }else{ $druck .= qq~\t\t$titel\n~; } $druck .= qq~\t\n~; }else{ $titel = &txt2html($titel); $titel =~ s/(?:<|\[|<)(.+?)(?:>|\]|>)/ /g; $titel2 = $titel; $titel = substr($titel, 0, $INFO{'lang'}) . $restzeichen if($INFO{'lang'} =~ /^\d+$/ && $INFO{'lang'} < length($titel)); $tempx =~ s/__titel__/$titel/g; $tempx =~ s/__titel2__/$titel2/g; $tempx =~ s/__url__/$url/g; if($des){ $des =~ s/(?:<|\[|<)(.+?)(?:>|\]|>)/ /g; $des =~ s/&/&/g; $tempx =~ s/__des2__/$des/g; $des =~ s/<(.+?)>//sg; $des = substr($des, 0, $anrisstexte) . $restzeichen2 if($anrisstexte =~ /^\d+$/ && $anrisstexte < length($des)); $tempx =~ s/__des__/txt2html($des)/eg; }else{ $tempx =~ s/__(des|des2)__//g; } $tempx =~ s/__quelle__/$nXMLname{$id}/g; $tempx =~ s/__quellehost__/$nXMLhost{$id}/g; $tempx =~ s/__quelleurl__/$nXMLurl{$id}/g; $x .= $tempx; } if($displayZ eq $display){ $displayZ = "0"; $x .= $werbung; } last if($nnum >= $maxf or $INFO{'lang'} =~ /^\d+$/ && $nnum >= $INFO{'max'}); } if($INFO{'xml'} == 1){ $druck .= qq~~; }else{ $druck .= $x . $druck3; $druck =~ s/__url__/$url/g; $druck =~ s/__version__/$version/g; $druck =~ s/__pages__/$pages/g; } open(F,">templates/cachecron/$cacheIT.tmp"); flock(F,2) if($flock); print F $druck; flock(F,8) if($flock); close(F); } $druck =~ s//$1/sg; $druck =~ s/(.+?)/$1/sg; $druck =~ s/__cat__/$INFO{'cat'}/g; $drucksaveSPALTENzahl = sprintf("%.0f",((split(/\,/,$INFO{'news'})) / $drucksaveSPALTEN)); ($drucksave) = ($druck =~ //s); ($drucksave2) = ($druck =~ //s); foreach (split(/\,/,$INFO{'news'})){ $drucksaveBAK = $drucksave; $drucksaveBAK =~ s/__name__/$nXMLname{$_}/g; $drucksaveBAK =~ s/__xmlname__/$_/g; $drucksaveSPALTENzahlN++; $drucksaveRESTz .= $drucksaveBAK; if($drucksaveSPALTENzahl == $drucksaveSPALTENzahlN){ $drucksaveSPALTENzahlN = "0"; $drucksaveBAK2 = $drucksave2; $drucksaveBAK2 =~ s//$drucksaveRESTz/sg; $drucksaveREST .= $drucksaveBAK2; $drucksaveRESTz = ""; } } if($drucksaveRESTz){ $drucksaveSPALTENzahlN = "0"; $drucksaveBAK2 = $drucksave2; $drucksaveBAK2 =~ s//$drucksaveRESTz/sg; $drucksaveREST .= $drucksaveBAK2; } $druck =~ s//$drucksaveREST/sg; $druck =~ s/__iframebreite__/$iframebreite/g; $druck =~ s/__iframehoehe__/$iframehoehe/g; &ausgabe($druck); } sub start { if($INFO{'k'} == 1){ if($INFO{'template'} =~ /^\w+\.\w+$/ && $INFO{'template'} !~ /^admin/){ open(F,"/,join("",)); flock(F,8) if($flock); close(F); open(F,"); flock(F,8) if($flock); close(F); $x = $split . $kontakt . $split3; $x =~ s///sg; $x =~ s/(.+?)//sg; $x =~ s///sg; $x =~ s/__url__/$url/g; $x =~ s/__version__/$version/g; $x =~ s/__iframebreite__/$iframebreite/g; $x =~ s/__iframehoehe__/$iframehoehe/g; &ausgabe($x); } unless($INFO{'cat'}){ open(F,")[0])))[0]; flock(F,8) if($flock); close(F); $INFO{'cat'} =~ s/[\n\r]//g; } $INFO{'cat'} = "internet" if(!$INFO{'cat'} && !$INFO{'news'}); if($INFO{'cat'} eq "all"){ open(F,"){ s/[\n\r]//g; ($XMLname,$XMLtitel,$XMLurl,$XMLhost) = split(/[\|]+/); $INFO{'news'} .= $XMLname . ","; } close(F); open(F,"){ s/[\n\r]//g; ($XMLname,$XMLtitel,$XMLurl,$XMLhost) = split(/\|/); $INFO{'news'} .= $XMLname . ","; } close(F); }elsif($INFO{'cat'} eq "allcat"){ open(F,"){ $_ =~ s/[\n\r]//g; ($name,$wert) = split(/=/,$_); $INFO{'news'} .= $wert . ","; } flock(F,8) if($flock); close(F); }elsif(!$INFO{'news'} && $INFO{'cat'}){ foreach (split(/\,/,$INFO{'cat'})){ $hash{$_} = 1; } open(F,"){ $_ =~ s/[\n\r]//g; ($name,$wert) = split(/=/,$_); if($hash{$name}){ $INFO{'news'} .= $wert . ","; } } flock(F,8) if($flock); close(F); } &error("Keine Newsseiten übergeben.") unless($INFO{'news'}); &error("Unerlaubte Newsseiten übergeben.") if($INFO{'news'} !~ /^[\w\,\.-]+$/); &error("Unerlaubte Kategorie übergeben.") if($INFO{'cat'} !~ /^[\w\,\.-]+$/ && $INFO{'news'} !~ /\,/); unless($mod_md5){ use Digest::Perl::MD5 'md5_hex'; } $cacheIT = md5_hex("$tempcat$INFO{'news'}$INFO{'start'}$INFO{'xml'}$INFO{'wort'}$INFO{'cat'}$INFO{'suchwort'}$INFO{'template'}$INFO{'itemplate'}"); if((-e("./templates/cachealt/$cacheIT.tmp")) && (time-$cachezeit) < (stat("./templates/cachealt/$cacheIT.tmp"))[9] && $cache == 1){ open(F,"); flock(F,8) if($flock); close(F); }else{ open(F,"){ s/[\n\r]//g; ($XMLname,$XMLtitel,$XMLurl,$XMLhost) = split(/[\|]+/); ($host, $uri) = ($XMLurl =~ m!http://(.*?)(/.*|$)!); $XMLhost = "http://$host" if($XMLhost !~ /^http:\/\//); $nXMLname{$XMLname} = $XMLtitel; $nXMLurl{$XMLname} = $XMLurl; $nXMLhost{$XMLname} = $XMLhost; } close(F); open(F,"){ s/[\n\r]//g; ($XMLname,$XMLtitel,$XMLurl,$XMLhost) = split(/\|/); ($host, $uri) = ($XMLurl =~ m!http://(.*?)(/.*)!); $XMLhost = "http://$host" if($XMLhost !~ /^http:\/\//); $nXMLname{$XMLname} = $XMLtitel; $nXMLurl{$XMLname} = $XMLurl; $nXMLhost{$XMLname} = $XMLhost; } close(F); if($INFO{'template'} =~ /^\w+\.\w+$/ && $INFO{'template'} !~ /^admin/){ open(F,"/,join("",)); flock(F,8) if($flock); close(F); @new = split(/\,/,$INFO{'news'}); for($i=0;$i<@new;$i++){ $tempx2 = $split2; ($tempxZAHL) = ($tempx2 =~ /()/s); $last = ""; foreach (1..$spaltenanzahl){ if($new[$i]){ $tempx = $tempxZAHL; $tempx =~ s//$1/sg; $tempx =~ s/__name__/$nXMLname{$new[$i]}/g; $tempx =~ s/__xmlhost__/$nXMLhost{$new[$i]}/g; $tempx =~ s/__xmlname__/$new[$i]/g; $restZAHL .= $tempx; $i++; } } $i--; $tempx2 =~ s//$restZAHL/sg; $rest .= $tempx2; $restZAHL = ""; } $x .= $split . $rest . $split3; $x =~ s//$1/sg; $x =~ s/(.+?)/$1/sg; $x =~ s/__url__/$url/g; $x =~ s/__version__/$version/g; $x =~ s/__cat__/$INFO{'cat'}/g; $drucksaveSPALTENzahl = sprintf("%.0f",((split(/\,/,$INFO{'news'})) / $drucksaveSPALTEN)); ($drucksave) = ($x =~ //s); ($drucksave2) = ($x =~ //s); foreach (split(/\,/,$INFO{'news'})){ $drucksaveBAK = $drucksave; $drucksaveBAK =~ s/__name__/$nXMLname{$_}/g; $drucksaveBAK =~ s/__xmlname__/$_/g; $drucksaveSPALTENzahlN++; $drucksaveRESTz .= $drucksaveBAK; if($drucksaveSPALTENzahl == $drucksaveSPALTENzahlN){ $drucksaveSPALTENzahlN = "0"; $drucksaveBAK2 = $drucksave2; $drucksaveBAK2 =~ s//$drucksaveRESTz/sg; $drucksaveREST .= $drucksaveBAK2; $drucksaveRESTz = ""; } } if($drucksaveRESTz){ $drucksaveSPALTENzahlN = "0"; $drucksaveBAK2 = $drucksave2; $drucksaveBAK2 =~ s//$drucksaveRESTz/sg; $drucksaveREST .= $drucksaveBAK2; } $x =~ s//$drucksaveREST/sg; open(F,">templates/cachealt/$cacheIT.tmp"); flock(F,2) if($flock); print F $x; flock(F,8) if($flock); close(F); } $x =~ s/__iframebreite__/$iframebreite/g; $x =~ s/__iframehoehe__/$iframehoehe/g; &ausgabe($x); } sub version { &ausgabe("Version: $version"); } sub txt2html { local($text) = @_; $text =~ s/\"/"/g; $text =~ s!<!<!g; $text =~ s!>!>!g; $text =~ s/>/>/g; $text =~ s//g; $text =~ s/</