| $dir = "./"; |
| opendir(DIR, $dir) or die $!; |
| while( defined( $fdir = readdir DIR) ) { |
| print "$fdir\n"; |
| if( -d "$dir$fdir" ) { |
| opendir(BIN, "$dir$fdir") or die "Can't open $fdir: $!"; |
| while( defined ($file = readdir BIN) ) { |
| if( $file =~ /main\.html/ |
| || $file =~ /main\.php/ ) { |
| print "$dir$fdir/$file\n"; |
| open FILE, "$dir$fdir/$file" or die $!; |
| $whole = ""; |
| $mode = 0; |
| while( $line = <FILE> ) { |
| $mode = 2 if( $line =~ /<\/body/ ); |
| $whole .= $line if( $mode == 1 ); |
| $mode = 1 if( $line =~ /<body/ ); |
| } |
| close FILE; |
| $orig = $whole; |
| |
| if( $whole =~ /indextop/ && !($whole =~ /<table/) ) { |
| $whole =~ s/<h3>/<h4>/g; |
| $whole =~ s/<\/h3>/<\/h4>/g; |
| $whole =~ s/<h2>/<h3>/g; |
| $whole =~ s/<\/h2>/<\/h3>/g; |
| $whole =~ s/<h1>/<h2>/g; |
| $whole =~ s/<\/h1>/<\/h2>/g; |
| $whole =~ s/<font class="indextop">(.*)<\/font>/<h1>$1<\/h1>/g; |
| $whole =~ s/<span class="indextop">(.*)<\/span>/<h1>$1<\/h1>/g; |
| $whole =~ s/<span class="indexsub">(.*)<\/span>//g; |
| $whole =~ s/<img src="\/images\/Idea.jpg".*?>//s; |
| $whole =~ s/<p id="header">.*?<br>//s; |
| $whole =~ s/<p id="header">//s; |
| $whole =~ s/"..\/..\/org\/processes\/fragments\/proposal-page-header.php"/\$_SERVER['DOCUMENT_ROOT'] . "\/org\/processes\/fragments\/proposal-page-header.php"/g; |
| $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 ) { |
| print "Changed $file\n"; |
| open FILE, ">$dir$fdir/index.php" or die $!; |
| print FILE $whole; |
| close FILE; |
| 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; |
| } |
| } |
| } |
| } |
| closedir(BIN); |
| } |
| } |
| closedir(DIR); |