# Source

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 #!/usr/bin/perl use strict; use warnings; use IO::All; foreach my $ad (grep { /\.html$/ } io("Ads-for-Homepage")->all_files()) { my $contents =$ad->slurp(); if ($contents !~ m{\Ahttp://www.shlomifish.org/(\S+)}) { die "No line found in$ad!"; } my $path =$1; if ($path =~ /\/$/) { $path .= "index.html.wml"; } elsif ($path =~ /\.x?html$/) {$path .= ".wml"; } else { die "Path $path does not end with /"; } if ($path =~ m{(\A|/)\.\.?(/|\z)}) { die "Malicious Path"; } if ($contents !~ m{( .*? )}ms) { die "Could not find ad!"; } my$ad = $1; open O, ">>", "t2/$path"; print O <<"END_OF_HTML"; ;;; Ad added at 2007-Oct-20 / 2007-10-20 ;;; To be removed at 2008-Oct-20 / 2008-10-20 ;;; Requested by Lauren Keidis \$ad END_OF_HTML close(O); }