#!/usr/local/bin/perl ### archive_maker_bb.pl ################################################################# # Simply sends all messages in "text" format to the browser, # you can then save the information to a ".txt" file and "ZIP" # it to create a archive file for people to download. # # It only works with WWWBoard , but may work with other # versions with slight modifications. # # This program is not perfect, so you may have to change a # few lines, but if your board is standard and not modified # very much, it should work as - is. # # You can sort by the order they are found in the message list, # or by message number. # # Call it like "archive_maker_bb.pl?sort" to sort by number, # or "archive_maker_bb.pl" for list order. # # WARNING: BACK UP ALL YOUR MESSAGES FIRST!!!! Just in case. # # This program is READ ONLY on your messages, but don't under # estimate a computers ability to screw up your data. # # If you have the space, make a copy of all your messsages # and place them into a new directory and change the settings # below accordingly. If your board is busy this is a better # way to do this because we take a lot of time opening # messages and reading them. # # Formats have changed on some wwwboards. You should try # running my wwwboard-rescue script and then use the # "rescue.html" file it generates as the main list file # for input to this program. It tries it's best, but if # your file's format has changed too much it will have # problems. It also needs those keywords you see below # to find stuff in the messages, so check that too. # # You can use or modifiy this free of charge so long as # this notice and the comments remain intact. By using this # code you agree to indemnify No Crash or it's owners from any # liability that might arise from it's use. # # Selling the code for this program without prior written # consent is expressly forbidden. # # For more examples and free sources, visit www.nocrash.com ################################################################# ################################################################# # NOTE: We look for certian "keywords" in each mesage file to # figure out where the message text starts, so here # they are, if you are having problems with strange text # then look in your message files and find something # that will identify the start/end of the message text. ################################################################# $start_keyword = "Posted by"; $end_keyword = "
\n\n"; print "------------ REMOVE THESE LINES BEFORE ARCHIVING ------------\n"; print "The main message file was at: $basedir/$mesgfile\n"; print "All the messages were at: $basedir/$mesgdir/\n"; print "-------------------------------------------------------------\n\n"; if ( !open(MSGS,"$basedir/$mesgfile") ) { print "\n\nERROR - Can't find/open '$basedir/$mesgfile'\n\n"; } @lines =; close(MSGS); foreach $line (@lines) { if ($line =~ /(.*)href="$mesgdir\/\1\.$ext">(.*)<(.*)(.*)<(.*)(.*)) { push @ENTRIES,$1; ## $2 is junk $SUBJECT{$1} = $3; ## $4 is junk $AUTHOR{$1} = $5; ## $6 is junk $DATE{$1} = $7; } } print "Archive of All Messages Sorted by"; if ($choice eq "sort") { @SORTED_ENT = sort { $a <=> $b } @ENTRIES; print "Message Number\n"; } else { @SORTED_ENT = @ENTRIES; print " Order on Main Page\n"; } print "\nContents:\n\n"; foreach $id (@SORTED_ENT) { print "$id $SUBJECT{$id} ($AUTHOR{$id} $DATE{$id})\n"; } print "\n\nMessages:\n\n"; foreach $id (@SORTED_ENT) { ## get the message text if ( !open(MSGS2,"$basedir/$mesgdir/$id\.$ext") ) { print "\n\nERROR - Can't find/open '$basedir/$mesgdir/$id\.$ext'\n\n"; } @lines2 = ; close(MSGS2); $it = ""; $gonextline = "0"; foreach $line2 (@lines2) { if ($line2 =~ $start_keyword) { $gonextline = "1"; } if ($gonextline eq "1") { ## we have the text we want collect it till end if ($line2 =~ $end_keyword) { ##end of the text we want last; } $line2 =~ s/ /\n/g; ## take out HTML tags, put in CR $line2 =~ s/
/\n/g; $line2 =~ s//\n/g; $line2 =~ s/
/\n/g; $line2 =~ s//\) /g; $line2 =~ s/<\/a>//g; $line2 =~ s///g; $line2 =~ s///g; $it .= $line2; } } print <<"EOM"; $id ############################################################# $baseurl/$mesgdir/$id\.$ext From: $AUTHOR{$id} $DATE{$id} Subject: $SUBJECT{$id} $it EOM } print "