############################################
##                                        ##
##                 WebBBS                 ##
##           by Darryl Burgdorf           ##
##       (e-mail burgdorf@awsd.com)       ##
##                                        ##
##             version:  4.33             ##
##         last modified:  6/8/00         ##
##           copyright (c) 2000           ##
##                                        ##
##    latest version is available from    ##
##        http://awsd.com/scripts/        ##
##                                        ##
############################################

# COPYRIGHT NOTICE:
#
# Copyright 2000 Darryl C. Burgdorf.  All Rights Reserved.
#
# This program is being distributed as shareware.  It may be used and
# modified by anyone, so long as this copyright notice and the header
# above remain intact, but any usage should be registered.  (See the
# program documentation for registration information.)  Selling the
# code for this program without prior written consent is expressly
# forbidden.  Obtain permission before redistributing this program
# over the Internet or in any other medium.  In all cases copyright
# and header must remain intact.
#
# This program is distributed "as is" and without warranty of any
# kind, either express or implied.  (Some states do not allow the
# limitation or exclusion of liability for incidental or consequential
# damages, so this notice may not apply to you.)  In no event shall
# the liability of Darryl C. Burgdorf and/or Affordable Web Space
# Design for any damages, losses and/or causes of action exceed the
# total amount paid by the user for this software.

# VERSION HISTORY:
#
# 4.33  06/08/00  Allowed profile edits to update user cookies
#                 Allowed users to change their profile passwords
#                 Allowed new profile passwords to delete old messages
#                 Split profile list into two columns
#                 Allowed for "create" or "edit profile" in navbar
#                 Removed views from comp & threaded guestbook indexes
#                 Fixed pagination in reversed threaded guestbook
#                 Fixed guestbook message sort order
#                 Removed system error text from error messages
#                 Added SpellChecker.net files to WebBBS distribution
# 4.32  06/05/00  Pipe characters are now legal in URLs and elsewhere
#                 User names can again include *any* characters
#                 Allowed for optional SpellChecker.net downloaded JS
#                 Added user profiles "index" list
#                 Removed "NOWRAP" attribute from navbar tables
#                 Disallowed "no name" user profiles
#                 Disallowed "NM only" subjects in posts
#                 Removed META "refresh" from submission error pages
#                 Added "Message Awaiting Approval" e-mail subject
#                 Replaced $navbarcolor with $navbarspec
#                 Replaced $tablecolor with $tablespec
#                 Added $AllowProfileXXXX configuration variables
#                 Moved board name definitions from settings to config
# 4.31  05/28/00  Allowed for multiple spaces in profile names
#                 Corrected "no profile password in post form" bug
#                 Added a few missing <P> tags
# 4.30  05/27/00  Added optional SpellChecker.net interface
#                 Added optional user profiles
#                 Added user password to cookie
#                 Added "mixed threaded guestbook-style" index listing
#                 "Paginated" the various threaded guestbook displays
#                 Allowed for specific responses in guestbook displays
#                 Put DBM opens in subroutine to reduce duplicate code
#                 Added webbbs_settings.pl "master config" file
#                 Added various conditionals for admin calls to subs
#                 Replaced $CompleteBan with $BanLevel & "moderation"
#                 Fixed "NM" indicator (broken in 4.22)
#                 Fixed locking of "view count" database
#                 Allowed view counting without actual display
#                 Added "edit" form to post submission error messages
#                 Replaced "banned" & "naughty" variables with files
#                 Removed "naughty" check from URLs
#                 Removed "mandated" auto-hotlink/$AllowHTML=2 conflict
#                 Corrected pic & "NM" flag conflicts with e-mail links
#                 Removed erroneous errors from (un)subscribe responses
# 4.22  04/19/00  Improved line feed handling with pre-formatted text
#                 Fixed "smiley"/e-mail link conflict
#                 Fixed new problem with quote marks in subjects
#                 Removed message URL from "awaiting approval" notices
# 4.21  04/18/00  Improved "smiley" handling
#                 Added "smiley" un-conversion in responses
#                 Added use in e-mail of ALT tags, if present
#                 Split %SmileyCode and %FormatCode
#                 "NM" tag is no longer added if there's a link
#                 "NM" & "Pic" tags are removed in responses
#                 Eliminated now-obsolete "$AllowFormatting" variable
#                 Replaced $Admin_Link variables with %Navbar_Links
#                 Fixed auto-hotlinking to catch URLs at line start
#                 $Autohotlinking *is* incompatible with $AllowHTML=2
#                 Disabled cookies & user prefs with $ArchiveOnly
#                 Added automatic logging of REMOTE_USER variable
# 4.20  04/15/00  Replaced chmod commands with umask definition
#                 Removed index database rebuild checks
#                 Added ability to "force" a rebuild via "?rebuild"
#                 Streamlined and "offlined" DBM rebuild process
#                 Allowed in rebuild for messages missing dates
#                 Moved view counts to a separate database file
#                 Allowed underscores and numbers in search terms
#                 Eliminated $AutoHotlink/$AllowHTML incompatibility
#                 Allowed commas and ending slashes in autohotlinks
#                 Allowed autohotlinking of URLs missing "http://"
#                 Added auto-erase of "empty" message bodies
#                 Added optional $NM_Telltale and $Pic_Telltale
#                 Added optional "Smiley" code
#                 "Compacted" compressed style index listings
#                 Fixed "new" notices in compressed listings
#                 Allowed return to specific *message* in index
#                 Removed TARGET attributes when frames not in use
#                 Changed default search date range to range of forum
#                 Changed default search criteria from all to keyword
#                 "Deflected" $ArchiveOnly raw indexes to search form
#                 Allowed choice between <UL><LI> and <DL><DD> sets
#                 Added e-mail notice to admin on moderated boards
#                 Added $shortboardname for use in e-mail notices
#                 Removed poster e-mail addresses from e-mail notices
#                 Added $ThreadSpacer and $GuestbookSpacer
#                 Squashed $AllowNewThreads bug
#                 Dropped file lock timeout back to 30 seconds
# 4.12  01/24/00  Removed "create" attempt from read-only DB accesses
#                 Removed script abort from read-only access failures
#                 Added auto-delete of DBM files if corrupt
#                 Made DBM files world-writable
#                 Made "refresh" time configurable
#                 Removed GIF/JPEG requirement for images
# 4.11  01/23/00  Added $DBMType config variable
#                 Closed DBM files before re-opening them
# 4.10  01/22/00  SCRIPT NOW REQUIRES PERL 5!
#                 Replaced dbmopen() calls with tie() calls
#                 Properly closed DBM file in "quick info" calls
#                 Fixed problem with deleted files staying in DB
#                 Increased file lock timeout again to 60 seconds
#                 Created "webbbs_basic.pl" file to reduce duplication
#                 Allowed definition of TARGET for "admin link"
#                 Changed "default" archive-only index from all to none
#                 Allowed use of date range in "archive" searches
#                 Allowed for SSI includes in header & footer
#                 Trapped for invalid resolved domain names
#                 Trapped for invalid $DefaultTime (vanishing messages)
#                 Subject is now truncated *before* prefix is added
#                 Made link "title" optional
#                 Eliminated link to "review" posts requiring approval
#                 Made IP resolution optional
#                 Allowed "read/review=0" to point to newest message
#                 Corrected sorting of search results
#                 Corrected short-format year from "0" to "00"
#                 Corrected error messages in SendMail routine
#                 Corrected old message import for "19100" buggy years
#                 Corrected old message import to update message files
#                 Allowed rebuild routine to auto-update data.txt
#                 Squashed 4.0X bug that kept guestbook from working
# 4.02  12/24/99  Fixed 4.01 references to $adminurl instead of $cgiurl
# 4.01  12/22/99  Added "unable to open database" message to text file
#                 Clarified other file error messages
#                 Increased file lock timeout from 15 to 30 seconds
#                 Prevented script from reading "extra" subdirectories
#                 Added "database rebuilt" notice on index page
#                 Corrected DB rebuild to *really* delete bad entries
#                 Added <P> tag to beginning of "previewed" message
#                 Added QUERY_STRING option for "quick info" access
#                 Restored missing post form "A NAME" tags
#                 Automatically turned off $AllowHTML with $AutoHotlink
#                 Added "@" to auto-hotlinking recognition list
#                 Added e-mail addresses to auto-hotlinking
#                 Removed "mandated" subject lists from responses
#                 Enclosed all TARGET destinations in quotation marks
#                 Changed "exit" links from TARGET="_top" to "_blank"
#                 Restored auto separate post forms when using frames
#                 Changed refresh time from 5 to 10 seconds
#                 Restored "reload index" link to some refreshing pages
# 4.00  12/17/99  Replaced flat-file database with true DB file
#                 Added keyword search index file
#                 Divided message files into subdirectories
#                 Removed automatic reaper/harvester function
#                 Finally completed migration of text to separate file
#                 Split main script into several smaller "chunks"
#                 Added ability to run "moderated" boards
#                 Allowed full customization of index "date range"
#                 Added "new only" index listing option
#                 Changed "posted/modified" in index to "posted"
#                 Added $DisplayEmail configuration option
#                 Added $SearchURL configuration option
#                 Added $AllowNewThreads configuration option
#                 Separated "SepPostForm" for index & message pages
#                 Added subjects to mailto: links
#                 Set new files to be created world-writable
#                 Squashed "Top Posters" cookie bug
#                 Squashed "Poster Stats / No Frames" bug
#                 Fixed problem with "&quot;" getting split in subjects
#                 Trapped for JavaScript in IMG URLs
#                 Added verification that IMG URLs are GIFs or JPEGs
#                 Fixed typo that prevented responding to message #1
#                 Prevented override of config if $AllowUserPrefs unset
#                 Allowed editing/posting directly from "preview"
#                 Allowed use of <PRE> formatting in messages
#                 Revised "look" of index header
#                 Added $AdminOpenCode & $AdminCloseCode variables
#                 Expanded ability to define appearance of board
#                 Added visible border bar to frameset
#                 Added links within "Top Posters" list
#                 Added META "Refresh" tag to "incidental" pages
#                 Added resolution of IPs regardless of display setting
#                 Added user's IP and host to "message posted" screen
#                 Made message body text optional to allow "NT" messages
#                 Added option to define mandatory subject prefixes
#                 Added ability to call script via SSI for quick info
#                 Added most recent post date to compressed index
#                 Simplified cookie "path" designation
#                 Removed dependence upon separate "cookie.lib" file
#                   (Code still derived from "cookie.lib")
#                 Updated cookie expiration date from 1999 to 2010
#                 Replaced blocking flock() calls with non-blocking
#                 Replaced multiple semaphore locks with master lock
#                 Adapted Kevin Dearing's revisions to SendMail sub
#                 Simplified WebAdverts interface subroutine
#                 Allowed for "complete" bans from forums
#                 Added true parsing of dates when converting pre-3.20
#                 As usual, "tweaked" virtually everything
# 3.21  04/28/99  Added optional "Top N Posters" list
#                 Added alpha & reversed alpha listings
#                 Reduced size of navbar text
#                 Added $admin_name and revised "credit" link
#                 Added # = and ~ to "autohotlink" regex
#                 Removed banner calls from "NoFrames" page
#                 Captured "duplicate" responses in threaded lists
#                 Corrected "content-type" to precede *all* errors
#                 Revised "insertadvert" subroutine for WebAdverts 2.01
# 3.20  10/10/98  Changed post date storage to "raw" format
#                 Added option to tailor date formatting
#                 Allowed choice of index styles (1-line, 2-line, news)
#                 Replaced $newspec & $newgraphicurl with $NewCode
#                 Made view count optional
#                 Made link info saves optional
#                 Made IP resolution optional
#                 Added optional "auto hotlinking"
#                 Allowed admin definition of autoquote character
#                 Made printing of board name on pages optional
#                 Added link back to index from search results page
#                 Added "Return-Path" header to e-mail notifications
#                 Added direct links to messages in e-mail
#                 $private_list setting no longer depends on $email_list
#                 Script no longer requires addresses.txt file
#                 Made banned IP list checks case insensitive
#                 Added additional "integrity checks" of messages.idx
#                 Closed $LockRemoteUser hole
#                 Closed $ArchiveOnly hole
#                 Disallowed semicolons in e-mail addresses
#                 Allowed semicolons in URLs
# 3.12  08/07/98  Added resolution of posters' IP addresses
# 3.11  08/06/98  Fixed erroneous admin flags in index
#                 Fixed potential security hole in delete function
#                 Added option for "new post" graphic
#                 Response form is now titled "Post Response"
# 3.10  08/04/98  Improved triggering of index rebuild
#                 Improved speed of index rebuild
#                 Added IP addresses to index database
#                 Improved "frames friendliness" with outside framesets
#                 Improved (simplified) "naughty words" censoring
#                 Added IP-based banning
#                 Fixed admin e-mail bug
#                 Included *all* fields in duplicate post check
#                 Allowed definition of "welcome page" in empty frame
#                 Added "admin link" to main navigation bar
#                 Added $messagespec & $newspec variables
#                 Added option to keep mail notification lists "private"
#                 Allowed direct input of SMTP server name
#                 Replaced "the $boardname" refs with just "$boardname"
#                 Reduced ".tmp" file storage to two hours (0.1 day)
#                 Continued migration of text to separate text file
#                 Other minor tweaks (So what else is new?)
# 3.01  07/25/98  Fixed "incorrect exit" bug
#                 Fixed "preview opens new window" bug
# 3.00  07/24/98  FIRST SHAREWARE RELEASE
#                 Added support for frames
#                 Introduced "index database" to speed index creation
#                 Started isolating text for easy translation/alteration
#                 Revised/simplified error handling subroutine(s)
#                 Added direct SMTP interface option
#                   (SendMail subroutine adapted from Matt Wright)
#                 Set messages to display full threads
#                 Corrected ordering of "reversed threaded" lists
#                 Added "mixed threaded" style option
#                 Added reversed "chronological" & "compressed" options
#                 Added classic & threaded "guestbook-style" options
#                 Added "last twelve hours" time option
#                 Added option to put post form on separate page
#                 Added option to display posters' IP addresses
#                 Moved (un)subscribe form to separate page
#                 Removed previous and next "in thread" links
#                 Separated "search" and "set preferences"
#                 Eliminated need for timelocal.pl module
#                 Allowed admin to disable user pref settings
#                 Allowed creation of "main post only" boards
#                 Fixed parsing of multi-character line feeds
#                 Vastly improved word-wrap functions
#                 Improved look and consistency of output pages
#                 Added "message read" counters
#                 Allowed use of $ENV{'REMOTE_USER'}
#                 Moved admin functions to separate script
#                 Allowed Lynx to default to "compressed"
#                 Rewrote file locking routines
#                 Plugged security hole in "delete" function
#                 Added link info to cookies
#                 Defined max length for name & email fields
#                 Added configurable max message length
#                 Allowed "@" in URLs and disallowed "," in e-mails
#                 Cleaned up ("mod_perlized") code
#                 Lots of other "various and sundry" improvements
# 2.25  12/13/97  Improved look of "archive only" boards
#                 Eliminated minimum length for search terms
#                 Added maximum length (100 chars) to subject lines
#                 Added link info to message e-mail notices
#                 Removed mandate that admin screen display all posts
#                 Fixed typo in "data.txt" access error message
#                 Updated "duplicate submission" message
#                 Finally updated WebAdverts subroutine
#                 Various minor tweaks
# 2.24  08/17/97  Squashed bug in previous/next links
#                 Fixed "header only" function
# 2.23  08/16/97  Squashed subscription list add/delete bug
#                 Corrected new message count to ignore temp/deleted
# 2.22  08/09/97  Fixed typo bug in preview confirmation
#                 Allowed subscriptions to "archive only" boards
# 2.21  08/09/97  Added "harvester" option
#                 Improved "context awareness" of censoring routine
#                 Rewrote "not posted" message for better clarity
#                 Added "compressed listing" index option
#                 Corrected URL parsing to allow commas and ampersands
#                 Added IP address info (as comment tag) to messages
#                 Made "preview" capability optional
#                 Added ability to post directly from preview screen
#                 Allowed administrator to post to archive-only boards
#                 Added ability to define HEAD tag header info
#                 Restructured header/footer subroutines for simplicity
#                 Revised header/footer handling of WebAdverts inserts
#                 Fixed bug in various "selective" index displays
#                 Revised display of search results indexes
#                 Added ability to e-mail notices only to administrator
#                 Added "header only" e-mail notification option
#                 Simplified & sped up e-mail word-wrap function
# 2.20  07/11/97  Revised message displays to thread responses
#                 Added "trapping" of IP addresses in message files
#                 Added ability to preview messages before posting
#                 Added ability to "censor" naughty words in posts
#                 Made allowing user deletion of messages optional
#                 Made allowing e-mail notifications optional
#                 Made allowing of URL input optional
#                 Added optional ability to allow pics with messages
#                 Added optional headers & footers on admin pages
#                 Incorporated "reaper" script functionality
#                 Added configuration option for external digest script
#                 Improved handling of banner placements
#                 Improved "structure" of index & message pages
#                 Improved parsing of e-mail addresses for validity
#                 "Cleaned up" configuration variables & BBS setup
# 2.14  05/28/97  Allowed for parsing, display or purging of HTML
#                 Added support for WebAdverts banner displays
#                 Added optional headers & footers on message pages
#                 Allowed easy disabling of all e-mail functions
#                 Simplified word-wrap of quoted message text
#                 Added word-wrap to e-mail notifications
#                 Corrected style of password input boxes
#                 Finally fixed message sorting so it's numeric
#                 Fixed bug in message deletion with admin password
#                 Fixed bug in display of author search results
#                 A lot of minor "tweaks" and format alterations
# 2.13  04/06/97  Added $HourOffset
#                 Added $InputColumns and $InputRows
#                 Set $DefaultTime="archive" to index all posts
#                 Incorporated formerly-separate admin script
#                 Added passwords to allow deletions by authors
#                 Added "reversed threaded" listing option
#                 Added timestamp to avoid "constant" cookie updates
#                 Added number of new messages to welcome blurb
#                 Added "X of Y Messages Displayed" to index page
#                 Added "return to index" links to error messages
#                 "Optionalized" e-mail notification of responses
#                 Closed security hole allowing SSI in messages
#                 Fixed minor bug in file locking
#                 Miscellaneous minor "clean-up" revisions
# 2.12  02/26/97  Added "previous" and "next" message links
#                 Added file locking to prevent dup message IDs
#                 Added configurable default settings
#                 Corrected bug in "archive only" display options
# 2.11  02/14/97  Temporary fix for cookie domain bug
# 2.10  02/11/97  Added optional support for cookies
#                   (Utilizing Matt Wright's "cookie.lib" file)
#                 Eliminated need for initial "setup" page
#                 Added "archive only" option
#                 Added "single line breaks" option
#                 Added ability to search by author's name
#                 Finally tracked down and squashed "new post" bug
# 2.01  02/02/97  Name changed from "WebBoard" to "WebBBS"
#                 Added automatic quoting of previous message
#                 Removed sometimes-problematic "location" call
#                 Eliminated redundant e-mail notifications
#                 Corrected bug with $name variable
# 2.00  01/19/97  Complete "from the ground up" rewrite
#                   (Major change: Use of dynamic page generation)
# 1.01  01/04/97  Added option to allow embedded HTML in messages
#                 Minor bug fixes and format alterations
# 1.00  12/22/96  Initial "public" release
#                   (Had been in use privately for months)
