#!/usr/bin/perl # # $Log: affilnews.cgi,v $ # Revision 0.2 2002/02/01 19:27:09 epierre # adding english comments # # (C)2001,2002 Emmanuel PIERRE # epierre@e-nef.com # http://www.e-nef.com/users/epierre use lib qw (/usr/local/etc/httpd/sites/e-nef.com/htdocs/cgibin/); use strict; use HTML::Template qw(); # Config file open(IDX,".ssilinks.idx"); my $src=; chomp($src); my $dest=; chomp($dest); my $lang=||1; chomp($lang); my $cnt=0; my @tabdir; close(IDX); # Ignore list my @ignore; open(IGN,".ssilinks.ignore"); while () { chomp; push @ignore,$_; } close(IGN); # Move to work dir chdir($src); push @tabdir,"."; # Recursive work foreach (@tabdir) { &recurse_dir($_); } # Done print STDERR "\nDone !\n"; exit; # # Main Loop # sub recurse_dir { my ($path)=@_; print STDERR "Now in $src/$path\n"; chdir("$src/$path"); FO:foreach (<*>) { next if ($_ eq "."); next if ($_ eq ".."); if (-d $_) { foreach my $ign (@ignore) { if ($_ eq $ign) { print "$_ ignored\n"; next FO; }; } print "$_ PUSHed \n"; push @tabdir,"$path/$_"; } elsif (/.html[.fr|.en]?/) { print "$_ html \n";my $fic=$_; open(SRC,"$_") || print STDERR "can't open $_\n"; # Add PATH !!!; open(DEST,">$dest/$path/$_") || print STDERR "can't open for writing $dest/$path/$_\n"; #add PATH !!! my $txt;my $ficon=$_; while($txt=) { print STDERR "$path/$ficon SSI "; my @tabssi=split(/(.*)$/); #print STDERR ">$str-$inclfic-$rest-\n"; chomp($inclfic); open(INC,$src.$inclfic) || print STDERR "can't open $inclfic\n"; # Add PATH !!! while() { print DEST $_; } close(INC); print DEST $rest; print STDERR "included $src.$inclfic\n"; } } else { print DEST $txt; } } close(SRC); close(DEST); # No Lang on this server if (($lang eq 0)&&($fic=~/.html[\.fr|\.en|\.de|\.es]+/)) { my $ficnolang=$fic; $ficnolang=~s/\.fr|\.en|\.de|\.es$//g; if (! -e $ficnolang) { print "will create $ficnolang\n"; `cp $dest/$path/$fic $dest/$path/$ficnolang`; } } } } }