blob: 99dfc8746ffefbacb120f14faa2818534d837068 [file] [log] [blame]
$dir = "./";
opendir(DIR, $dir) or die $!;
while( defined( $fdir = readdir DIR) ) {
if( -d "$dir$fdir" ) {
opendir(BIN, "$dir$fdir") or die "Can't open $fdir: $!";
while( defined ($file = readdir BIN) ) {
if( $file =~ /main\.html/ ) {
open FILE, "$dir$fdir/$file" or die $!;
$whole = "";
$mode = 0;
while( $line = <FILE> ) {
$mode = 2 if( $line =~ /<\/body/i );
$whole .= $line if( $mode == 1 );
$mode = 1 if( $line =~ /<body/i );
}
close FILE;
$orig = $whole;
if( $whole =~ /CELLSPACING/i ) {
print "$dir$fdir/$file\n";
$whole =~ s/<h3>/<h4>/ig;
$whole =~ s/<\/h3>/<\/h4>/ig;
$whole =~ s/<h2>/<h3>/ig;
$whole =~ s/<\/h2>/<\/h3>/ig;
$whole =~ s/<h1>/<h2>/ig;
$whole =~ s/<\/h1>/<\/h2>/ig;
$whole =~ s/<font class=["]?indextop["]?>(.*)<\/font>/<h1>$1<\/h1>/ig;
$whole =~ s/<font .*?size=["]?6["]?>(.*)<\/font>/<h1>$1<\/h1>/ig;
$whole =~ s/<span class=["]?indextop["]?>(.*)<\/span>/<h1>$1<\/h1>/ig;
$whole =~ s/<span class=["]?indexsub["]?>(.*)<\/span>//ig;
$whole =~ s/<font class=["]?indexsub["]?>(.*)<\/font>//ig;
$whole =~ s/A\b+Technology\b+Project\b+Proposal//isg;
$whole =~ s/<img .*?src="[\.\/]*images\/Idea.jpg".*?>//is;
$whole =~ s/<img .*?src="http:\/\/.*?eclipse.org\/images\/Idea.jpg".*?>//is;
$whole =~ s/<p id="header">.*?<br>//is;
$whole =~ s/<p id="header">//is;
$whole =~ s/"#551A8B" alink="#ff0000">//isg;
while( $whole =~ /^(.*)<table.*?>(.*?)<\/table>(.*)$/is ) {
$n = $2;
$m = $1;
$p = $3;
$n =~ s/<font.*?class=["]?indextop["]?.*?>(.*?)<\/font>/<h1>$1<\/h1>/is;
$n =~ s/<td .*?ALIGN=["]?LEFT["]? .*?VALIGN=["]?TOP["]? .*?BGCOLOR="#0080C0".*?>(.*?)<\/td>/<h2>$1<\/h2>/isg;
$n =~ s/<td .*?VALIGN=["]?TOP["]? .*?ALIGN=["]?LEFT["]? .*?BGCOLOR="#0080C0".*?>(.*?)<\/td>/<h2>$1<\/h2>/isg;
$n =~ s/<td .*?VALIGN=["]?TOP["]? .*?BGCOLOR="#0080C0" .*?ALIGN=["]?LEFT["]?.*?>(.*?)<\/td>/<h2>$1<\/h2>/isg;
$n =~ s/<td .*?VALIGN=["]?TOP["]? .*?BGCOLOR="#0080C0".*?>(.*?)<\/td>/<h2>$1<\/h2>/isg;
$n =~ s/<td .*?ALIGN=["]?LEFT["]? .*?BGCOLOR="#0080C0" .*?VALIGN=["]?TOP["]?.*?>(.*?)<\/td>/<h2>$1<\/h2>/isg;
$n =~ s/<tr .*?ALIGN=["]?LEFT["]? .*?VALIGN=["]?TOP["]? .*?BGCOLOR="#0080C0".*?>(.*?)<\/tr>/<h2>$1<\/h2>/isg;
$n =~ s/<tr .*?VALIGN=["]?TOP["]? .*?ALIGN=["]?LEFT["]? .*?BGCOLOR="#0080C0".*?>(.*?)<\/tr>/<h2>$1<\/h2>/isg;
$n =~ s/<tr .*?VALIGN=["]?TOP["]? .*?BGCOLOR="#0080C0" .*?ALIGN=["]?LEFT["]?.*?>(.*?)<\/tr>/<h2>$1<\/h2>/isg;
$n =~ s/<tr .*?ALIGN=["]?LEFT["]? .*?BGCOLOR="#0080C0" .*?VALIGN=["]?TOP["]?.*?>(.*?)<\/tr>/<h2>$1<\/h2>/isg;
$n =~ s/<td.*?>//isg;
$n =~ s/<\/td>//isg;
$n =~ s/<tr>//isg;
$n =~ s/<\/tr>//isg;
$n =~ s/<tbody>//isg;
$n =~ s/<\/tbody>//isg;
$n =~ s/<b><font.*?>(.*?)<\/font><\/b>/$1/isg;
$n =~ s/<font.*?>(.*?)<\/font>/$1/isg;
$n =~ s/<font.*?>(.*?)<\/font>/$1/isg;
$n =~ s/<h2>\s*<p align=left>(.*?)<\/p>\s*<\/h2>/<h2>$1<\/h2>/isg;
$n =~ s/<h2>\s*<b>(.*?)<\/b>\s*<\/h2>/<h2>$1<\/h2>/isg;
$whole = $m . $n . $p;
}
$whole =~ s/<COL WIDTH=\d*\*>//isg;
$whole = "<?php\n include(\$_SERVER['DOCUMENT_ROOT'] . \"\/eclipse.org-common\/system\/include-before-definitions.php\");\n\n\$pageTitle = \"\";\n\$pageKeywords = \"\";\n\$pageAuthor = \"\";\n\n\include(\$_SERVER['DOCUMENT_ROOT'] . \"\/eclipse.org-common\/system\/include-after-definitions.php\");\n?>\n <div id=\"maincontent\">\n <div id=\"midcolumn\">" . $whole;
$whole = $whole . "<\/div>\n<\/div>\n<?php\n include(\$_SERVER['DOCUMENT_ROOT'] . \"\/eclipse.org-common\/system\/include-end-of-page.php\");\n?>\n";
if( $orig ne $whole ) {
open FILE, ">$dir$fdir/index.php" or die $!;
print FILE $whole;
close FILE;
if( $ARGV[0] ) {
open FILE, ">$dir$fdir/index.html" or die $!;
print FILE "<!doctype html public \"-//w3c//dtd html 4.0 transitional//en\"><html><head><META HTTP-EQUIV=Refresh CONTENT=\"0; URL=index.php\"></head><body>Replaced by <a href=\"index.php\">the new page</a></body></html>\n";
close FILE;
open FILE, ">$dir$fdir/main.html" or die $!;
print FILE "<!doctype html public \"-//w3c//dtd html 4.0 transitional//en\"><html><head><META HTTP-EQUIV=Refresh CONTENT=\"0; URL=index.php\"></head><body>Replaced by <a href=\"index.php\">the new page</a></body></html>\n";
close FILE;
print "Wrote all forwarding files\n";
}
exit 1;
}
}
}
}
closedir(BIN);
}
}
closedir(DIR);