### Title: Message Numbers Hack ### Author: Percipient (percipient@yahoo.com) ### Date: 1/19/2001 ### Brief Description: ### ### Add message numbers and a "reply to" link in the header for each ### message. Add a list of links for replies to the footer for each ### message ### ### Detailed Description: ### ### This hack has three user visible effects: ### ### 1. Assigns every message a unique number beginning at 1 for the ### first post of any thread. The message number is included in ### the message header, for example: ### ### Message 16 of 23, posted 01-03-2001 8:53 AM ### ### 2. If a message is a reply to another message, then a link to ### that message is included in the message header, for example: ### ### Reply to message 12 by SammyP, posted 12-24-2000 11:14 PM ### ### The "message 12" portion is a link which when clicked on ### brings you to message 12. ### ### 3. If there are replies to a message then links to those messages ### are included in the message footer, for example: ### ### Replies to this message: ### Message 17 by Percipient, posted 01-05-2001 11:33 AM ### Message 25 by AlleyCat, posted 01-08-2001 10:48 PM ### ### The "Message " portions are links that when clicked ### on bring you to that message. ### ### This hack has one administrator visible effect: ### ### A new field is added to the General Settings control panel for ### selecting whether the message number option is enabled. When ### enabled the thread files (they have names like 000003.cgi) are ### modified to include additional fields. A message table field ### is added to the end of the stats field for rapid lookup of ### messages. The message lines have two fields added, one for ### the message replied to (if any) and another that is a list of ### the replies (if any). ### ### When disabled the thread files are modified to remove all the ### additional fields, effectively removing all reply information. ### This information is lost forever and cannot be restored by ### reenabling message numbers ### ### The baseline for this hack was UBB version 5.47c ### Begin Hack Installation Instructions ### ### Follow these instructions, proceeding consecutively through each ### file. Where you are instructed to find some code it means you ### should search for the very next occurence from where you are in ### the file, not from the beginning. Instruction lines always begin ### with "###", everything else is code. ### ### This is a big hack. You should install the hack in a development ### or test copy of your UBB software and debug it there before ### releasing it for general use. ### Open cgi-bin/cpanel2.cgi ### Find: if ($HotIcons eq "OFF") { $HotIconsOff = "CHECKED"; } else { $HotIconsOn = "CHECKED"; } ### After it add: if ($MessageNumbers eq "ON") { $MsgNumOn = "CHECKED"; } else { $MsgNumOff = "CHECKED"; } ### Find: Number of Replies to Qualify as Hot Topic?

Minimum Replies:
### After it add: THIS5 &InputRadioRow("#dedfdf", "Enable Message Numbers?", "Message numbers are useful for following discussions in long threads. Each message of a thread is assigned a consecutive number beginning at 1, and the number appears in the message header. If the message is a reply to another message then a link to that message is included. Links to replies to a message appear in the message footer. Turning this feature on adds fields to the thread database files. Turning this feature off removes those fields and irrevocably erases all reply links.", " Yes, enable message numbers.
No, disable message numbers."); print <$ForumsPath/$ExactPath/$ThreadFileName"); foreach $line(@ThreadFile) { chomp($line); print UPGRADE ("$line\n"); } close (UPGRADE); &Unlock("lock.file"); chmod (0666, "$ForumsPath/$ExactPath/$ThreadFileName"); } } } } sub DoRegressMessageNumbers { @ForumList = &OpenForumsFile; $ForumNumber = 1; foreach $Forum(@ForumList) { @ForumFields = split(/\|/, $Forum); $ForumNumber = $ForumFields[8]; $number = $ForumNumber; # Needed by OpenThread &GetExactPath($ForumNumber); @ForumThreads = &OpenFile("$ForumsPath/$ExactPath/forum$ForumNumber.threads"); foreach $ThreadLine(@ForumThreads) { @ThisLine = split(/\|\^\|/, $ThreadLine); $ThreadNum = "$ThisLine[1]"; if ($ThreadNum ne "") { $ThreadFileName = "$ThreadNum.cgi"; @ThreadFile = &OpenThread("$ThreadFileName"); chomp($ThreadFile[0]); @TS = split(/\|\|/, $ThreadFile[0]); # TS==ThreadStats $ThreadFile[0] = "$TS[0]||$TS[1]||$TS[2]||$TS[3]||$TS[4]||$TS[5]||$TS[6]||$TS[7]"; $Index = 1; while ($Index <= $#ThreadFile) { chomp($ThreadFile[$Index]); @MF = split(/\|\|/, $ThreadFile[$Index]); # MF==MessageFields $ThreadFile[$Index] = "$MF[0]||$MF[1]||$MF[2]||$MF[3]||$MF[4]||$MF[5]||$MF[6]||$MF[7]||$MF[8]||$MF[9]"; $Index++; } unless (-w "$ForumsPath/$ExactPath/$ThreadFileName") { chmod (0777, "$MembersPath/$ProfileNumber.cgi"); } &Lock("lock.file"); open(REGRESS, ">$ForumsPath/$ExactPath/$ThreadFileName"); foreach $line(@ThreadFile) { chomp($line); print REGRESS ("$line\n"); } close (REGRESS); &Unlock("lock.file"); chmod (0666, "$ForumsPath/$ExactPath/$ThreadFileName"); } } } } ### Close cgi-bin/cpanel2.cgi ### Open cgi-bin/postings.cgi ### Find: if (($ReplyTo ne "") && ($ReplyTo >= 0)) { ### After it add: $ReplyToMsgNum = $ReplyTo + 0; ### Find: @replier = &OpenThread("$topic"); @revreplier = reverse(@replier); $statline = $replier[0]; ### Replace with: @replier = &OpenThread("$topic"); $statline = $replier[0]; chomp($statline); ### Find and delete: $lastpost = $revreplier[0]; @lastpost = split(/\|\|/, $lastpost); $lastnumber = $lastpost[1]; $lastnumber++; #add 1 to last post number $newreplynum = sprintf("%6d", $lastnumber); $newreplynum =~tr/ /0/; ### Find: $ReplyLine = ("Z||$newreplynum||$UserName||$HyphenDate||$Time||$PostEmail||$ReplyMessage||$IPNumber||$RegStatus||$MsgIcon"); ### Replace with: if ($MessageNumbers eq "ON") { @MessageTable = split(/\+/, $stats[8]); $lastnumber = $#MessageTable + 1; $newreplynum = sprintf("%6d", $lastnumber); $newreplynum =~tr/ /0/; $ReplyToMsgNum = $in{'ReplyToMsgNum'}; $ReplyLine = ("Z||$newreplynum||$UserName||$HyphenDate||$Time||$PostEmail||$ReplyMessage||$IPNumber||$RegStatus||$MsgIcon||$ReplyToMsgNum||"); $RepliedToIndex = &GetMessageIndex($replier[0], $ReplyToMsgNum); @RepliedToLine = split(/\|\|/, $replier[$RepliedToIndex]); $MsgReplyTable = $RepliedToLine[11]; chomp($MsgReplyTable); $ReplyNum = $newreplynum + 0; $DisplayReplyNum = $ReplyNum + 1; if ($MsgReplyTable ne "") { $MsgReplyTable = ("$MsgReplyTable+$ReplyNum"); } else { $MsgReplyTable = $ReplyNum; } $RepliedToLine = ("$RepliedToLine[0]||$RepliedToLine[1]||$RepliedToLine[2]||$RepliedToLine[3]||$RepliedToLine[4]||$RepliedToLine[5]||$RepliedToLine[6]||$RepliedToLine[7]||$RepliedToLine[8]||$RepliedToLine[9]||$RepliedToLine[10]||$MsgReplyTable"); $replier[$RepliedToIndex] = $RepliedToLine; } else { @revreplier = reverse(@replier); $lastpost = $revreplier[0]; @lastpost = split(/\|\|/, $lastpost); $lastnumber = $lastpost[1] + 1; $newreplynum = sprintf("%6d", $lastnumber); $newreplynum =~tr/ /0/; $ReplyLine = ("Z||$newreplynum||$UserName||$HyphenDate||$Time||$PostEmail||$ReplyMessage||$IPNumber||$RegStatus||$MsgIcon"); } ### Find: chomp($stats[4]); chomp($stats[5]); chomp($stats[6]); chomp($stats[7]); $newstats = "A||$stats[1]||$replytotal||$stats[3]||$stats[4]||$stats[5]||$stats[6]||$stats[7]"; ### Replace with: if ($MessageNumbers eq "ON") { foreach $num(@MessageTable) { if ($num != 0) { $ReplyIndex = $num; } } $ReplyIndex++; $newstats = "A||$stats[1]||$replytotal||$stats[3]||$stats[4]||$stats[5]||$stats[6]||$stats[7]||$stats[8]+$ReplyIndex"; } else { $newstats = "A||$stats[1]||$replytotal||$stats[3]||$stats[4]||$stats[5]||$stats[6]||$stats[7]"; } ### Find: if (($LWA eq "private") && ($PrivateMax eq "yes")) { $GoTo = "$CGIURL/forumdisplay.cgi?action=displayprivate&number=$number&topic=$ThreadNo"; $FileExt = "cgi"; } else { $GoTo = "$NonCGIURL/$ExactPath/HTML/$ThreadNo.html"; $FileExt = "html"; } ### Replace with: if ($MessageNumbers eq "ON") { if (($HTMLDisplayMax ne "") && ($HTMLDisplayMax ne "NONE")) { $HTMLPageNumber = $replytotal / $HTMLDisplayMax; if ($HTMLPageNumber =~ /\./) { ($HTMLPageNumber, $junk) = split(/\./, $HTMLPageNumber); } $HTMLPageNumber++; } else { $HTMLPageNumber = 1; } if (($LWA eq "private") && ($PrivateMax eq "yes")) { $GoTo = "$CGIURL/forumdisplay.cgi?action=displayprivate&number=$number&topic=$ThreadNo&htmlpagenum=$HTMLPageNumber#$DisplayReplyNum"; $FileExt = "cgi"; } else { if ($HTMLPageNumber == 1) { $GoTo = "$NonCGIURL/$ExactPath/HTML/$ThreadNo.html#$DisplayReplyNum"; } else { $GoTo = "$NonCGIURL/$ExactPath/HTML/$ThreadNo-$HTMLPageNumber.html#$DisplayReplyNum"; } $FileExt = "html"; } } else { if (($LWA eq "private") && ($PrivateMax eq "yes")) { $GoTo = "$CGIURL/forumdisplay.cgi?action=displayprivate&number=$number&topic=$ThreadNo"; $FileExt = "cgi"; } else { $GoTo = "$NonCGIURL/$ExactPath/HTML/$ThreadNo.html"; $FileExt = "html"; } } ### Find: $StatsLine = "A||$Notes||0||$UserName||$TopicSubject||||$MsgIcon||"; ### Replace with: if ($MessageNumbers eq "ON") { $StatsLine = "A||$Notes||0||$UserName||$TopicSubject||||$MsgIcon||||1"; } else { $StatsLine = "A||$Notes||0||$UserName||$TopicSubject||||$MsgIcon||"; } ### Find: $FatherLine = "Z||000000||$UserName||$HyphenDate||$Time||$PostEmail||$Message||$IPNumber||$RegStatus||$MsgIcon"; ### Replace with: $ForumName = "Forum".$number; &GetExactPath($newtopic); if ($MessageNumbers eq "ON") { $FatherLine = "Z||000000||$UserName||$HyphenDate||$Time||$PostEmail||$Message||$IPNumber||$RegStatus||$MsgIcon||||"; if (($LWA eq "private") && ($PrivateMax eq "yes")) { $GoTo = "$CGIURL/forumdisplay.cgi?action=displayprivate&number=$number&topic=$newtopic&htmlpagenum=1#1"; } else { $GoTo = "$NonCGIURL/$ForumName/HTML/$newtopic.html#1"; } } else { $FatherLine = "Z||000000||$UserName||$HyphenDate||$Time||$PostEmail||$Message||$IPNumber||$RegStatus||$MsgIcon"; if (($LWA eq "private") && ($PrivateMax eq "yes")) { $GoTo = "$CGIURL/forumdisplay.cgi?action=displayprivate&number=$number&topic=$newtopic"; } else { $GoTo = "$NonCGIURL/$ForumName/HTML/$newtopic.html"; } } ### Find: &ForwardWithCookies("$CGIURL/forumdisplay.cgi?action=topics&forum=$ForumCoded&number=$number&DaysPrune=$DaysPrune", "Thanks for posting your message, $UserName! We are now taking you back automatically to the topic list for $Forum."); ### Replace with: &ForwardWithCookies("$GoTo", "Thanks for posting your message, $UserName! We are now sending you automatically to your new topic."); ### Find: #create revised stat line for thread $newstatline = "A||$stats[1]||$ReplyTotal||$stats[3]||$TopicSubject||$ArchiveNotes||$TopicMsgIcon||$CloseNotes"; @newthread = @blank; #loop thru thread, remove deleted post foreach $uno(@editthread) { chomp($uno); if ($uno =~ m/^A/) { push(@newthread, $newstatline); } elsif ($uno !~ m/^Z\|\|$in{'ReplyNum'}/) { push(@newthread, $uno); } else { #don't add it } } ### Replace with: $DelNum = $in{'ReplyNum'}; if ($MessageNumbers eq "ON") { # Delete references to deleted messages, create revised stat line for thread chomp($stats[8]); @MsgNums = split(/\+/, $stats[8]); $DelMsgIndex = $MsgNums[$DelNum]; $DelMsg = $editthread[$DelMsgIndex]; @DelMsg = split(/\|\|/, $DelMsg); $ReplyToNum = $DelMsg[10]; if ($ReplyToNum ne "") { # Deleted message is a reply to another message, delete it # from that message's list of replies $ReplyToIndex = $MsgNums[$ReplyToNum]; $ReplyToMessage = $editthread[$ReplyToIndex]; @ReplyToMessage = split(/\|\|/, $ReplyToMessage); $ReplyToMessageReplies = $ReplyToMessage[11]; @ReplyToMessageReplies = split(/\+/, $ReplyToMessageReplies); $NewReplyList = ""; foreach $reply(@ReplyToMessageReplies) { if ($reply != $DelNum) { $NewReplyList .= "+$reply"; } } if ($NewReplyList ne "") { $NewReplyList = substr($NewReplyList,1,length($NewReplyList)-1); } $ReplyToMessage[11] = $NewReplyList; $ReplyToMessage = "$ReplyToMessage[0]||$ReplyToMessage[1]||$ReplyToMessage[2]||$ReplyToMessage[3]||$ReplyToMessage[4]||$ReplyToMessage[5]||$ReplyToMessage[6]||$ReplyToMessage[7]||$ReplyToMessage[8]||$ReplyToMessage[9]||$ReplyToMessage[10]||$ReplyToMessage[11]"; $editthread[$ReplyToIndex] = $ReplyToMessage; } chomp($DelMsg[11]); $ReplyList = $DelMsg[11]; if ($ReplyList ne "") { # There were replies to this message, delete those message's reference to this message @ReplyList = split(/\+/, $ReplyList); foreach $reply(@ReplyList) { $ReplyIndex = $MsgNums[$reply]; $ReplyMessage = $editthread[$ReplyIndex]; @ReplyMessage = split(/\|\|/, $ReplyMessage); $ReplyMessage[10] = ""; $ReplyMessage = "$ReplyMessage[0]||$ReplyMessage[1]||$ReplyMessage[2]||$ReplyMessage[3]||$ReplyMessage[4]||$ReplyMessage[5]||$ReplyMessage[6]||$ReplyMessage[7]||$ReplyMessage[8]||$ReplyMessage[9]||$ReplyMessage[10]||$ReplyMessage[11]"; $editthread[$ReplyIndex] = $ReplyMessage; } } # Deleted messages get an index of 0 location; this means # a message number never changes, even though messages before it are deleted. $MsgNums[$DelNum] = 0; $MessageTable = ""; $count = 1; foreach $MsgNum(@MsgNums) { if ($MsgNum != 0) { $MessageTable .= "+".$count++; } else { $MessageTable .= "+0"; } } $MessageTable = substr($MessageTable,1,length($MessageTable)-1); $newstatline = "A||$stats[1]||$ReplyTotal||$stats[3]||$TopicSubject||$ArchiveNotes||$TopicMsgIcon||$CloseNotes||$MessageTable"; $editthread[0] = $newstatline; $editthread[$DelMsgIndex] = ""; @newthread = @blank; foreach $message(@editthread) { if ($message ne "") { push(@newthread, $message); } } } else { #create revised stat line for thread, delete message $newstatline = "A||$stats[1]||$ReplyTotal||$stats[3]||$TopicSubject||$ArchiveNotes||$TopicMsgIcon||$CloseNotes"; @newthread = @blank; #loop thru thread, remove deleted post foreach $uno(@editthread) { chomp($uno); if ($uno =~ m/^A/) { push(@newthread, $newstatline); } elsif ($uno !~ m/^Z\|\|$DelNum/) { push(@newthread, $uno); } else { #don't add it } } } ### Find: $EditLine = "Z||$in{'ReplyNum'}||$postUserName||$postdate||$posttime||$postemail||$EditedMessage||$IPnum||$regstatus||$MsgIcon"; foreach $one(@editthread) { chomp($one); if ($one =~ /^Z\|\|$in{'ReplyNum'}/) { push (@revised, $EditLine); } else { push (@revised, $one); } } ### Replace with: if ($MessageNumbers eq "ON") { $ReplyNum = $in{'ReplyNum'} + 0; $ReplyIndex = &GetMessageIndex($editthread[0], $ReplyNum); $DisplayReplyNum = $ReplyNum + 1; if (($HTMLDisplayMax ne "") && ($HTMLDisplayMax ne "NONE")) { $HTMLPageNumber = $ReplyIndex / $HTMLDisplayMax; if ($HTMLPageNumber =~ /\./) { ($HTMLPageNumber, $junk) = split(/\./, $HTMLPageNumber); } $HTMLPageNumber++; } else { $HTMLPageNumber = 1; } if (($LWA eq "private") && ($PrivateMax eq "yes")) { $FileExt = "cgi"; $GoTo = "$CGIURL/forumdisplay.cgi?action=displayprivate&number=$number&topic=$ThreadNumber&htmlpagenum=$HTMLPageNumber#$DisplayReplyNum"; } else { $FileExt = "html"; if ($HTMLPageNumber == 1) { $GoTo = "$NonCGIURL/$ExactPath/HTML/$ThreadNumber.html#$DisplayReplyNum"; } else { $GoTo = "$NonCGIURL/$ExactPath/HTML/$ThreadNumber-$HTMLPageNumber.html#$DisplayReplyNum"; } } chomp($editline[11]); $EditLine = "Z||$in{'ReplyNum'}||$postUserName||$postdate||$posttime||$postemail||$EditedMessage||$IPnum||$regstatus||$MsgIcon||$editline[10]||$editline[11]"; @revised = @editthread; $revised[$ReplyIndex] = $EditLine; } else { if (($LWA eq "private") && ($PrivateMax eq "yes")) { $FileExt = "cgi"; $GoTo = "$CGIURL/forumdisplay.cgi?action=displayprivate&number=$number&topic=$ThreadNumber"; } else { $FileExt = "html"; $GoTo = "$NonCGIURL/$ExactPath/HTML/$ThreadNumber.html"; } $EditLine = "Z||$in{'ReplyNum'}||$postUserName||$postdate||$posttime||$postemail||$EditedMessage||$IPnum||$regstatus||$MsgIcon"; foreach $one(@editthread) { chomp($one); if ($one =~ /^Z\|\|$in{'ReplyNum'}/) { push (@revised, $EditLine); } else { push (@revised, $one); } } } ### Find: &Forward("$GoTo", "Thanks for editing the message, $UserName! We are now sending you back automatically to the topic page."); ### Replace with: &Forward("$GoTo", "Thanks for editing the message, $UserName! We are now sending you back automatically to your edited post."); ### Find: chomp($origmessage); $OrigText = &Indexify("$origmessage"); ### I think the above lines can be safely deleted as I could find no ### place in the code that referenced $OrigText, and routine Indexify ### has no global variables that can be referenced from outside it. ### I'm already running without them, please let me know if you find a ### purpose for them. ### Find: ### Before it add: ### Find: if ($in{'which'} eq "open") { $StatsLine = "A||$AddN||$stats[2]||$stats[3]||$stats[4]||$stats[5]||$stats[6]||$stats[7]"; $about = "reopened"; } else { $StatsLine = "A||X$AddN||$stats[2]||$stats[3]||$stats[4]||$stats[5]||$stats[6]||$stats[7]"; $about = "closed"; } ### Replace it with: if ($in{'which'} eq "open") { if ($MessageNumbers eq "ON") { $StatsLine = "A||$AddN||$stats[2]||$stats[3]||$stats[4]||$stats[5]||$stats[6]||$stats[7]||stats[8]"; } else { $StatsLine = "A||$AddN||$stats[2]||$stats[3]||$stats[4]||$stats[5]||$stats[6]||$stats[7]"; } $about = "reopened"; } else { if ($MessageNumbers eq "ON") { $StatsLine = "A||X$AddN||$stats[2]||$stats[3]||$stats[4]||$stats[5]||$stats[6]||$stats[7]||stats[8]"; } else { $StatsLine = "A||X$AddN||$stats[2]||$stats[3]||$stats[4]||$stats[5]||$stats[6]||$stats[7]"; } $about = "closed"; } ### Close cgi-bin/postings.cgi ### Open cgi-bin/ubb_library2.cgi ### Find: $RegName = "$thisline[8]"; chomp($RegName); ### After it add: if ("$MessageNumbers" eq "ON") { $MsgNum = $thisline[1] + 1; $ReplyToMsgNum = $thisline[10]; $RepliesMsgNums = $thisline[11]; chomp($RepliesMsgNums); } ### Find: #format date @datearray = split(/-/, $theDate); chomp($datearray[2]); $YearCheck = $datearray[2]; $YearCheck = $YearCheck + 0; $CheckThisYear = length($YearCheck); if ($CheckThisYear < 4) { if ($CheckThisYear == 2) { $TheYear = ("19" . "$YearCheck"); } else { $TheYear = $YearCheck - 100; $TheYear = sprintf ("%2d", $TheYear); $TheYear =~tr/ /0/; $TheYear = ("20" . "$TheYear"); } } else { $TheYear = $YearCheck; } if ($DateFormat eq "US") { $ThisDate = "$datearray[0]-$datearray[1]-$TheYear"; } elsif ($DateFormat eq "Euro") { $ThisDate = &DateFormat("$theDate", "Euro"); } elsif ($DateFormat eq "USX") { $ThisDate = &DateFormat("$theDate", "USExpanded"); } else { $ThisDate = &DateFormat("$theDate", "EuroExpanded"); } #format time if ($TimeFormat eq "24HR") { @timearray = split(/ /, $thisline[4]); chomp($timearray[1]); ($gethour, $getmin) = split(/:/, $timearray[0]); if ($timearray[1] eq "PM") { if ($gethour < 12) { $gethour = ($gethour + 12); } } if ($timearray[1] eq "AM") { if ($gethour == 12) { $gethour = "0"; } } $gethour = sprintf ("%2d", $gethour); $gethour =~tr/ /0/; $getmin = sprintf ("%2d", $getmin); $getmin =~tr/ /0/; $FormatTime = "$gethour:$getmin"; } else { $FormatTime = "$thisline[4]"; } $theTime = "thisline[4]"; ### Replace with: $ThisDate = &GetDate($theDate, $DateFormat); $FormatTime = &GetTime($thisline[4]); ### Find: } else { $DirectReply = ''; } ### After it add: $MsgNumHTML = ""; $MsgNumRepliesHTML = ""; $MsgNumAnchor = ""; $ReplyToHTML = ""; if ("$MessageNumbers" eq "ON") { $ThreadStats = $threadinfo[0]; @ThreadStats = split(/\|\|/, $ThreadStats); @MessageTable = split(/\+/, $ThreadStats[8]); $LastMsgNum = $#MessageTable + 1; if ($ReplyToMsgNum ne "") { $ReplyToMsgIndex = $MessageTable[$ReplyToMsgNum]; $DisplayReplyToMsgNum = $ReplyToMsgNum + 1; $ReplyToMsg = $threadinfo[$ReplyToMsgIndex]; @ReplyToMsg = split(/\|\|/, $ReplyToMsg); $ReplyToName = $ReplyToMsg[2]; $ReplyToDate = &GetDate($ReplyToMsg[3], $DateFormat); $ReplyToTime = &GetTime($ReplyToMsg[4]); if (($HTMLDisplayMax ne "") && ($HTMLDisplayMax ne "NONE")) { $HTMLPageNumber = ($ReplyToMsgIndex - 1) / $HTMLDisplayMax; if ($HTMLPageNumber =~ /\./) { ($HTMLPageNumber, $junk) = split(/\./, $HTMLPageNumber); } $HTMLPageNumber++; } else { $HTMLPageNumber = 1; } if ($FileExt eq "cgi") { $ReplyToHTML = qq(
Reply to Message $DisplayReplyToMsgNum by $ReplyToName, posted $ReplyToDate $ReplyToTime); } else { if ($HTMLPageNumber == 1) { $ReplyToHTML = qq(
Reply to Message $DisplayReplyToMsgNum by $ReplyToName, posted $ReplyToDate $ReplyToTime); } else { $ReplyToHTML = qq(
Reply to Message $DisplayReplyToMsgNum by $ReplyToName, posted $ReplyToDate $ReplyToTime); } } } else { $ReplyToHTML = ""; } $MsgNumHTML = "Message $MsgNum of $LastMsgNum, "; if ($RepliesMsgNums ne "") { @RepliesMsgNums = split(/\+/, $RepliesMsgNums); $MsgNumRepliesHTML = qq(

Replies to this message:
); foreach $ReplyMsgNum(@RepliesMsgNums) { chomp($ReplyMsgNum); $ReplyMsgIndex = $MessageTable[$ReplyMsgNum]; $DisplayReplyMsgNum = $ReplyMsgNum + 1; $ReplyMsg = $threadinfo[$ReplyMsgIndex]; @ReplyMsg = split(/\|\|/, $ReplyMsg); $ReplyName = $ReplyMsg[2]; $ReplyDate = &GetDate($ReplyMsg[3], $DateFormat); $ReplyTime = &GetTime($ReplyMsg[4]); if (($HTMLDisplayMax ne "") && ($HTMLDisplayMax ne "NONE")) { $HTMLPageNumber = ($ReplyMsgIndex - 1) / $HTMLDisplayMax; if ($HTMLPageNumber =~ /\./) { ($HTMLPageNumber, $junk) = split(/\./, $HTMLPageNumber); } $HTMLPageNumber++; } else { $HTMLPageNumber = 1; } if ($FileExt eq "cgi") { $MsgNumRepliesHTML .= qq(   Message $DisplayReplyMsgNum by $ReplyName, posted $ReplyDate $ReplyTime
); } else { if ($HTMLPageNumber == 1) { $MsgNumRepliesHTML .= qq(   Message $DisplayReplyMsgNum by $ReplyName, posted $ReplyDate $ReplyTime
); } else { $MsgNumRepliesHTML .= qq(   Message $DisplayReplyMsgNum by $ReplyName, posted $ReplyDate $ReplyTime
); } } } $MsgNumRepliesHTML .= qq(
); } $MsgNumAnchor = qq(); } ### Find: $ThisThread .= qq( $MsgNumAnchor $thisline[2]
$ThisStatus $AuthorExtra $ThisIcon $MsgNumHTML posted $ThisDate $FormatTime     $ProfileString $EmailString   $EditLink $DirectReply $ReplyToHTML
$ReplyText$MsgNumRepliesHTML

$ThisIPWording

); ### Replace with: $ThisThread .= qq( $MsgNumAnchor $thisline[2]
$ThisStatus $AuthorExtra
$ThisIcon $MsgNumHTML posted $ThisDate $FormatTime $ReplyToHTML

$ThisIPWording


$ReplyText $MsgNumRepliesHTML
$ProfileString $EmailString $EditLink $DirectReply
); ### Find: $ThisThread .= qq( ### After it add: $MsgNumAnchor ### Find: posted $ThisDate $FormatTime     $ProfileString $EmailString   $EditLink $DirectReply
$ReplyText ### Replace with: $MsgNumHTML posted $ThisDate $FormatTime     $ProfileString $EmailString   $EditLink $DirectReply $ReplyToHTML
$ReplyText$MsgNumRepliesHTML ### Find: @datearray = split(/-/, $Date); chomp($datearray[2]); $YearCheck = $datearray[2]; $YearCheck = $YearCheck + 0; $CheckThisYear = length($YearCheck); if ($CheckThisYear < 4) { if ($CheckThisYear == 2) { $TheYear = ("19" . "$YearCheck"); } else { $TheYear = $YearCheck - 100; $TheYear = sprintf ("%2d", $TheYear); $TheYear =~tr/ /0/; $TheYear = ("20" . "$TheYear"); } $Date = "$datearray[0]-$datearray[1]-$TheYear"; } ### Replace with: $Date = &GetDate($Date, "US"); ### Find (this is the 2nd occurence): @datearray = split(/-/, $Date); chomp($datearray[2]); $YearCheck = $datearray[2]; $YearCheck = $YearCheck + 0; $CheckThisYear = length($YearCheck); if ($CheckThisYear < 4) { if ($CheckThisYear == 2) { $TheYear = ("19" . "$YearCheck"); } else { $TheYear = $YearCheck - 100; $TheYear = sprintf ("%2d", $TheYear); $TheYear =~tr/ /0/; $TheYear = ("20" . "$TheYear"); } $Date = "$datearray[0]-$datearray[1]-$TheYear"; } ### Replace with: $Date = &GetDate($Date, "US"); ### Find (it's the last line of the file): 1; ### Before it add: sub GetMessageIndex { $ThreadStats = shift; $num = shift; chomp($ThreadStats); @ThreadStats = split(/\|\|/, $ThreadStats); @msgtable = split(/\+/, $ThreadStats[8]); return $msgtable[$num]; } sub GetDate { $date = shift; $format = shift; @datearray = split(/-/, $date); chomp($datearray[2]); $YearCheck = $datearray[2]; $YearCheck = $YearCheck + 0; $CheckThisYear = length($YearCheck); if ($CheckThisYear < 4) { if ($CheckThisYear == 2) { $TheYear = ("19" . "$YearCheck"); } else { $TheYear = $YearCheck - 100; $TheYear = sprintf ("%2d", $TheYear); $TheYear =~tr/ /0/; $TheYear = ("20" . "$TheYear"); } } else { $TheYear = $YearCheck; } if ($format eq "US") { return "$datearray[0]-$datearray[1]-$TheYear"; } elsif ($format eq "Euro") { return &DateFormat("$date", "Euro"); } elsif ($format eq "USX") { return &DateFormat("$date", "USExpanded"); } else { return &DateFormat("$date", "EuroExpanded"); } } sub GetTime { $time = shift; if ($TimeFormat eq "24HR") { @timearray = split(/ /, $time); chomp($timearray[1]); ($gethour, $getmin) = split(/:/, $timearray[0]); if ($timearray[1] eq "PM") { if ($gethour < 12) { $gethour = ($gethour + 12); } } if ($timearray[1] eq "AM") { if ($gethour == 12) { $gethour = "0"; } } $gethour = sprintf ("%2d", $gethour); $gethour =~tr/ /0/; $getmin = sprintf ("%2d", $getmin); $getmin =~tr/ /0/; return "$gethour:$getmin"; } else { return "$time"; } } ### Close cgi-bin/ubb_library2.pl ### Open cgi-bin/archive.cgi ### Find: $StatsLine = "A||X$AddN||$stats[2]||$stats[3]||$stats[4]||$stats[5]||$stats[6]||$CloseNote"; ### Replace with: if ($MessageNumbers eq "ON") { chomp($stats[8]); $StatsLine = "A||X$AddN||$stats[2]||$stats[3]||$stats[4]||$stats[5]||$stats[6]||$CloseNote||$stats[8]"; } else { $StatsLine = "A||X$AddN||$stats[2]||$stats[3]||$stats[4]||$stats[5]||$stats[6]||$CloseNote"; } ### Close cgi-bin/archive.cgi ### Open cgi-bin/edit.cgi ### Find: $newline = "A||$rowstats[1]||$rowstats[2]||$rowstats[3]||$in{'NewSubject'}||$rowstats[5]||$rowstats[6]||$rowstats[7]"; ### Replace with: if ($MessageNumbers eq "ON") { chomp($rowstats[8]); $newline = "A||$rowstats[1]||$rowstats[2]||$rowstats[3]||$in{'NewSubject'}||$rowstats[5]||$rowstats[6]||$rowstats[7]||$rowstats[8]"; } else { $newline = "A||$rowstats[1]||$rowstats[2]||$rowstats[3]||$in{'NewSubject'}||$rowstats[5]||$rowstats[6]||$rowstats[7]"; } ### Close cgi-bin/edit.cgi ### Open cgi-bin/forumdisplay.cgi ### Find: #open file my @thisfile = &OpenFile("$ForumsPath/Forum$in{'number'}/private-$thisforum[7]/HTML/$in{'topic'}.cgi"); foreach $row(@thisfile) { print "$row"; } ### Replace with: #open file, print it out { my @thisfile; if ($MessageNumbers eq "ON") { $HTMLPageNumber = $in{'htmlpagenum'}; if (($HTMLPageNumber == 1) || ($HTMLPageNumber eq "")) { $TopicFileName = "$in{'topic'}.cgi"; } else { $TopicFileName = "$in{'topic'}-$HTMLPageNumber.cgi"; } @thisfile = &OpenFile("$ForumsPath/Forum$in{'number'}/private-$thisforum[7]/HTML/$TopicFileName"); } else { @thisfile = &OpenFile("$ForumsPath/Forum$in{'number'}/private-$thisforum[7]/HTML/$in{'topic'}.cgi"); } foreach $row(@thisfile) { print "$row"; } } ### Close cgi-bin/forumdisplay.cgi ### End Hack Installation Instructions