############################################### # Greymatter 1.3.1 # # Build 208 # # Main Library # # Copyright (c)2000-2005, The Greymatter team # # http://www.greymatterforums.com/ # ############################################### $cookiename = "gm_password"; # *** Your possession of this software indicates that you agree to the terms *** # *** specified under the "Copyright & Usage" heading in the "manual.html" file. *** # Patch for weekdayshort and monthwordshort variables # provided by Rae (rae@tnir.org) # c&p'ed in by domesticat # (gmstuff@domesticat.net) # ----------------- # program variables # ----------------- $gmversion = "1.3.1"; $gmfonttag = qq(); $gmheadtag = qq# Greymatter # #; # end Pete Finnigan - 27/06/05 $gmheadtagtwo = $gmheadtag; $gmheadtag .= qq# //--> #; # start Pete Finnigan - 27/06/05 - the above was:- # $gmheadtag .= qq# # # # # #; # end Pete Finnigan - 27/06/05 # start Pete Finnigan 27/06/05 - add back gmshortcutkeys - deleted in 1.3.1 - also added onKeyPress to body tag $gmheadtagtwo .= qq# function gmshortcutkeys() { if ((parseInt(navigator.appVersion) >= 4) && (navigator.appName == "Microsoft Internet Explorer")) { if (event.ctrlKey != true) return; gmselection = document.selection.createRange().text; if (window.event.keyCode == 1) { gminsertlink = prompt("What do you want to link to?", "http://") if (gminsertlink == null) return; document.selection.createRange().text = '' + gmselection + ''; return; } if (window.event.keyCode == 2) { document.selection.createRange().text = '' + gmselection + ''; return; } if (window.event.keyCode == 9) { document.selection.createRange().text = '' + gmselection + ''; return; } if (window.event.keyCode == 21) { document.selection.createRange().text = '' + gmselection + ''; return; } } } //--> #; # end Pete Finnigan - 27/06/05 $gmframetop = qq(

$gmfonttaggreymatter $gmversion

$gmfonttag); $gmframetoptwo = qq(
$gmfonttag); $gmframebottom = qq(

v$gmversion · ©2000-2003 The Greymatter Team

); $gmframebottomtwo = qq(
); $statusnote = ""; # ------------------ # emoticons subroutine # ------------------ # added by flipped cracker 9/17/2003 # version 1.3 sub gm_emoticons { &gm_readconfig; $_ = shift; if( (($emoticonsallowed eq "both") || ($emoticonsallowed eq $returnto)) && ($thisentryemoticonsallowed eq "yes") ) { s/\:\)/\"smile\"/g; s/\:O/\"shocked\"/g; s/\:\(/\sad\/g; s/\:D/\"big/g; s/\:P/\"razz\"/g; s/\;\)/\"wink\"/g; s/\:angry:/\"angry,/g; s/\:blush:/\"blush\"/g; s/\:confused:/\"confused\"/g; s/\:cool:/\"cool/g; s/\:crazy:/\"crazy\"/g; s/\:cry:/\"crying\"/g; s/\:doze:/\"sleepy\"/g; s/\:hehe:/\"hehe\"/g; s/\:laugh:/\"LOL\"/g; s/\:plain:/\"plain\"/g; s/\:rolleyes:/\"rolls/g; s/\:satisfied:/\"satisfied\"/g; } return($_); } # merged in version 1.3 # ------------------ # emoticons code display subroutine # ------------------ # added by flipped cracker 9/17/2003 # version 1.3 sub gm_emoticons_code { &gm_readconfig; $emoticonsmaincode = ""; if( ($emoticonsallowed eq "both") || ($emoticonsallowed eq "entries") ) { $emoticonsmaincode = "
\":)\" \":O\" \":(\"
\":D\" \":P\" \";)\"
\":angry:\" \":blush:\" \":confused:\"
\":cool:\" \":crazy:\" \":cry:\"
\":doze:\" \":hehe:\" \":laugh:\"
\":plain:\" \":rolleyes:\" \":satisfied:\"
"; $emoticonsmorecode = "
\":)\" \":O\" \":(\"
\":D\" \":P\" \";)\"
\":angry:\" \":blush:\" \":confused:\"
\":cool:\" \":crazy:\" \":cry:\"
\":doze:\" \":hehe:\" \":laugh:\"
\":plain:\" \":rolleyes:\" \":satisfied:\"
"; } } # merged in version 1.3 # --------------- # date subroutine # --------------- sub date { $adjustTime = time() + ($serveroffset * 3600); ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime($adjustTime); $mon++; @months = ("null", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); @weekdays = ("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"); $fullmonth = $months[$mon]; $fullweekday = $weekdays[$wday]; $JSYear = $year + 1900; $shortyear = substr($JSYear, -2, 2); $mintwo = sprintf ("%2d", $min); $mintwo =~ tr/ /0/; $sectwo = sprintf ("%2d", $sec); $sectwo =~ tr/ /0/; $militaryhour = $hour; if ($hour < 12) { $AMPM = "AM"; $AMPMDOT = "A.M."; } if ($hour > 12) { $hour = $hour - 12; $AMPM = "PM"; $AMPMDOT = "P.M."; $militaryhour = $militaryhour + 12; } if ($hour == 12) { $AMPM = "PM"; $AMPMDOT = "P.M."; } if ($hour == 0) { $hour = "12"; } $hourtwo = sprintf ("%2d", $hour); $hourtwo =~ tr/ /0/; $mintwo = sprintf ("%2d", $min); $mintwo =~ tr/ /0/; $montwo = sprintf ("%2d", $mon); $montwo =~ tr/ /0/; $mdaytwo = sprintf ("%2d", $mday); $mdaytwo =~ tr/ /0/; if (($hour eq "12") && ($AMPM eq "AM")) { $militaryhour = "0"; } $militaryhourtwo = sprintf ("%2d", $hour); $militaryhourtwo =~ tr/ /0/; $basedate = "$montwo\/$mdaytwo\/$shortyear $hourtwo\:$mintwo $AMPM"; } # ------------------------- # delouse for textarea edit # ------------------------- sub delouse { $_ = shift; $_ =~ s/\|\*\|/\n/g; $_ =~ s/&([A-Za-z0-9\#]+);/\|AMP\|$1;/g; $_ =~ s//\>/g; $_ =~ s/"/\"/g; return($_); } # --------------------------- # relouse after textarea edit # --------------------------- sub relouse { $_ = shift; $_ =~ s/\n/\|\*\|/g; $_ =~ s/\r//g; $_ =~ s/\<//g; $_ =~ s/\"/"/g; $_ =~ s/\|AMP\|([A-Za-z0-9\#]+);/&$1;/g; return($_); } # --------------------- # configuration delouse # --------------------- sub configdelouse { $_ = shift; $_ =~ s/\|//g; $_ =~ s/\n//g; $_ =~ s/\r//g; $_ =~ s/^\s+//; $_ =~ s/\s+$//; return($_); } # ---------------- # read the counter # ---------------- sub gm_readcounter { open (FUNNYFEETKRACK, "./gm-counter.cgi") || &gm_dangermouse("Can't read the counter file. Please make sure that gm-counter.cgi is CHMODed to 666 and is in the same place as all your other Greymatter CGI files; also try running Diagnostics & Repair from the Configuration screen."); @entrycounters = ; close (FUNNYFEETKRACK); $newentrynumber = $entrycounters[0]; $newarchivenumber = $entrycounters[1]; $newstayattopnumber = $entrycounters[2]; $newalltimepktotalnumber = $entrycounters[3]; $newalltimenktotalnumber = $entrycounters[4]; $newalltimecommentstotalnumber = $entrycounters[5]; $newalltimeopenentriesnumber = $entrycounters[6]; $newalltimeclosedentriesnumber = $entrycounters[7]; chomp ($newentrynumber); chomp ($newarchivenumber); chomp ($newstayattopnumber); chomp ($newalltimepktotalnumber); chomp ($newalltimenktotalnumber); chomp ($newalltimecommentstotalnumber); chomp ($newalltimeopenentriesnumber); chomp ($newalltimeclosedentriesnumber); if ($newentrynumber eq "") { $newentrynumber = 0; } if ($newarchivenumber eq "") { $newarchivenumber = 0; } if ($newstayattopnumber eq "") { $newstayattopnumber = 0; } if ($newalltimepktotalnumber eq "") { $newalltimepktotalnumber = 0; } if ($newalltimenktotalnumber eq "") { $newalltimenktotalnumber = 0; } if ($newalltimeopenentriesnumber eq "") { $newalltimeopenentriesnumber = 0; } if ($newalltimeclosedentriesnumber eq "") { $newalltimeclosedentriesnumber = 0; } } # ----------------- # write the counter # ----------------- sub gm_writecounter { if ($newentrynumber eq "") { $newentrynumber = 0; } if ($newarchivenumber eq "") { $newarchivenumber = 0; } if ($newstayattopnumber eq "") { $newstayattopnumber = 0; } if ($newalltimepktotalnumber eq "") { $newalltimepktotalnumber = 0; } if ($newalltimenktotalnumber eq "") { $newalltimenktotalnumber = 0; } if ($newalltimeopenentriesnumber eq "") { $newalltimeopenentriesnumber = 0; } if ($newalltimeclosedentriesnumber eq "") { $newalltimeclosedentriesnumber = 0; } open (FUNNYFEETAUGH, ">./gm-counter.cgi") || &gm_dangermouse("Can't write to the counter file. Please make sure that gm-counter.cgi is CHMODed to 666 and is in the same place as all your other Greymatter CGI files; also try running Diagnostics & Repair from the Configuration screen."); print FUNNYFEETAUGH "$newentrynumber\n"; print FUNNYFEETAUGH "$newarchivenumber\n"; print FUNNYFEETAUGH "$newstayattopnumber\n"; print FUNNYFEETAUGH "$newalltimepktotalnumber\n"; print FUNNYFEETAUGH "$newalltimenktotalnumber\n"; print FUNNYFEETAUGH "$newalltimecommentstotalnumber\n"; print FUNNYFEETAUGH "$newalltimeopenentriesnumber\n"; print FUNNYFEETAUGH "$newalltimeclosedentriesnumber\n"; close (FUNNYFEETAUGH); } # ------------------ # read the templates # ------------------ sub gm_readtemplates { open (FUNNYFEETTAMMY, "./gm-templates.cgi") || &gm_dangermouse("Can't read the templates file. Please make sure that gm-templates.cgi is CHMODed to 666 and is in the same place as all your other Greymatter CGI files; also try running Diagnostics & Repair from the Configuration screen."); @gmtemplates = ; close (FUNNYFEETTAMMY); $gmcounter = 0; foreach (@gmtemplates) { chomp ($gmtemplates[$gmcounter]); $gmtemplates[$gmcounter] =~ s/\|\*\|/\n/g; $gmcounter++; } $gmindextemplate = $gmtemplates[0]; $gmentrypagetemplate = $gmtemplates[1]; $gmarchiveindextemplate = $gmtemplates[2]; $gmarchiveentrypagetemplate = $gmtemplates[3]; $gmentrytemplate = $gmtemplates[4]; $gmarchiveentrytemplate = $gmtemplates[5]; $gmstayattoptemplate = $gmtemplates[6]; $gmdatetemplate = $gmtemplates[7]; $gmcommentstemplate = $gmtemplates[8]; $gmcommentsformtemplate = $gmtemplates[9]; $gmparaseparationtemplate = $gmtemplates[10]; $gmkarmaformtemplate = $gmtemplates[11]; # new templates {{target}} and dategrouping footer take the place of the long-deprecated ones: linear 9/18/2003 # new in 1.3 $gmlinktargettemplate = $gmtemplates[12]; $gmdategroupingfootertemplate = $gmtemplates[13]; # merged 9/18/2003 $gmkarmalinktemplate = $gmtemplates[14]; $gmcommentslinktemplate = $gmtemplates[15]; $gmcommentauthoremailtemplate = $gmtemplates[16]; $gmcommentauthorhomepagetemplate = $gmtemplates[17]; $gmcommentdividertemplate = $gmtemplates[18]; $gmmoreentrytemplate = $gmtemplates[19]; $gmmoreentrypagetemplate = $gmtemplates[20]; $gmmorearchiveentrypagetemplate = $gmtemplates[21]; $gmpreviouslinktemplate = $gmtemplates[22]; $gmnextlinktemplate = $gmtemplates[23]; $gmpreviousmorelinktemplate = $gmtemplates[24]; $gmnextmorelinktemplate = $gmtemplates[25]; $gmarchivemasterindextemplate = $gmtemplates[26]; $gmlogarchiveslinktemplate = $gmtemplates[27]; $gmentrypagelinktemplate = $gmtemplates[28]; $gmmoreentrypagelinktemplate = $gmtemplates[29]; $gmlogarchiveslinkseparatortemplate = $gmtemplates[30]; $gmentrypagelinkseparatortemplate = $gmtemplates[31]; $gmentrypagelinkmonthseparatortemplate = $gmtemplates[32]; $gmentrypagelinkdayseparatortemplate = $gmtemplates[33]; $gmentrypagelinkyearseparatortemplate = $gmtemplates[34]; $gmheadertemplate = $gmtemplates[35]; $gmfootertemplate = $gmtemplates[36]; $gmsidebartemplate = $gmtemplates[37]; $gmcustomlinktemplate = $gmtemplates[38]; $gmentryseparatortemplate = $gmtemplates[39]; $gmarchiveentryseparatortemplate = $gmtemplates[40]; $gmmorearchiveentrytemplate = $gmtemplates[41]; $gmdatearchivetemplate = $gmtemplates[42]; $gmlogarchiveslinkweeklytemplate = $gmtemplates[43]; $gmcustomonetemplate = $gmtemplates[44]; $gmcustomtwotemplate = $gmtemplates[45]; $gmcustomthreetemplate = $gmtemplates[46]; $gmcustomfourtemplate = $gmtemplates[47]; $gmcustomfivetemplate = $gmtemplates[48]; $gmcustomsixtemplate = $gmtemplates[49]; $gmcustomseventemplate = $gmtemplates[50]; $gmcustomeighttemplate = $gmtemplates[51]; $gmcustomninetemplate = $gmtemplates[52]; $gmcustomtentemplate = $gmtemplates[53]; $gmpopuppagetemplate = $gmtemplates[54]; $gmpopupcodetemplate = $gmtemplates[55]; $gmsearchformtemplate = $gmtemplates[56]; $gmsearchresultspagetemplate = $gmtemplates[57]; $gmsearchresultsentrytemplate = $gmtemplates[58]; $gmcalendartablebeginningtemplate = $gmtemplates[59]; $gmcalendartableendingtemplate = $gmtemplates[60]; $gmcalendarblankcelltemplate = $gmtemplates[61]; $gmcalendarfullcelltemplate = $gmtemplates[62]; $gmcalendarfullcelllinktemplate = $gmtemplates[63]; $gmcalendarweekblankdaytemplate = $gmtemplates[64]; $gmcalendarweekfulldaytemplate = $gmtemplates[65]; $gmcalendarweekfulldaylinktemplate = $gmtemplates[66]; $gmcommentpreviewdividertemplate = $gmtemplates[67]; $gmcommentpreviewformtemplate = $gmtemplates[68]; $gmsmartlinknocommentstemplate = $gmtemplates[69]; $gmsmartlinkonecommenttemplate = $gmtemplates[70]; $gmsmartlinkmanycommentstemplate = $gmtemplates[71]; $gmlinebreaktemplate = $gmtemplates[72]; $gmcommentlinktargettemplate = $gmtemplates[73]; $gmsmartentrymoodtemplate = $gmtemplates[74]; $gmsmartentrymusictemplate = $gmtemplates[75]; $gmdategroupingfooterarchivetemplate = $gmtemplates[76]; $gmsmartemoticonscodetemplate = $gmtemplates[77]; $gmcookiescodetemplate = $gmtemplates[78]; } # --------------------- # delouse all templates # --------------------- sub gm_delousealltemplates { $gmindextemplate = &delouse($gmindextemplate); $gmentrypagetemplate = &delouse($gmentrypagetemplate); $gmarchiveindextemplate = &delouse($gmarchiveindextemplate); $gmarchiveentrypagetemplate = &delouse($gmarchiveentrypagetemplate); $gmentrytemplate = &delouse($gmentrytemplate); $gmarchiveentrytemplate = &delouse($gmarchiveentrytemplate); $gmstayattoptemplate = &delouse($gmstayattoptemplate); $gmdatetemplate = &delouse($gmdatetemplate); $gmcommentstemplate = &delouse($gmcommentstemplate); $gmcommentsformtemplate = &delouse($gmcommentsformtemplate); $gmparaseparationtemplate = &delouse($gmparaseparationtemplate); $gmkarmaformtemplate = &delouse($gmkarmaformtemplate); # new templates {{target}} and dategrouping footer take the place of the long-deprecated ones: linear 9/18/2003 # new in 1.3 $gmlinktargettemplate = &delouse($gmlinktargettemplate); $gmdategroupingfootertemplate = &delouse($gmdategroupingfootertemplate); # merged 9/18/2003 $gmkarmalinktemplate = &delouse($gmkarmalinktemplate); $gmcommentslinktemplate = &delouse($gmcommentslinktemplate); $gmcommentauthoremailtemplate = &delouse($gmcommentauthoremailtemplate); $gmcommentauthorhomepagetemplate = &delouse($gmcommentauthorhomepagetemplate); $gmcommentdividertemplate = &delouse($gmcommentdividertemplate); $gmmoreentrytemplate = &delouse($gmmoreentrytemplate); $gmmoreentrypagetemplate = &delouse($gmmoreentrypagetemplate); $gmmorearchiveentrypagetemplate = &delouse($gmmorearchiveentrypagetemplate); $gmpreviouslinktemplate = &delouse($gmpreviouslinktemplate); $gmnextlinktemplate = &delouse($gmnextlinktemplate); $gmpreviousmorelinktemplate = &delouse($gmpreviousmorelinktemplate); $gmnextmorelinktemplate = &delouse($gmnextmorelinktemplate); $gmarchivemasterindextemplate = &delouse($gmarchivemasterindextemplate); $gmlogarchiveslinktemplate = &delouse($gmlogarchiveslinktemplate); $gmentrypagelinktemplate = &delouse($gmentrypagelinktemplate); $gmmoreentrypagelinktemplate = &delouse($gmmoreentrypagelinktemplate); $gmlogarchiveslinkseparatortemplate = &delouse($gmlogarchiveslinkseparatortemplate); $gmentrypagelinkseparatortemplate = &delouse($gmentrypagelinkseparatortemplate); $gmentrypagelinkmonthseparatortemplate = &delouse($gmentrypagelinkmonthseparatortemplate); $gmentrypagelinkdayseparatortemplate = &delouse($gmentrypagelinkdayseparatortemplate); $gmentrypagelinkyearseparatortemplate = &delouse($gmentrypagelinkyearseparatortemplate); $gmheadertemplate = &delouse($gmheadertemplate); $gmfootertemplate = &delouse($gmfootertemplate); $gmsidebartemplate = &delouse($gmsidebartemplate); $gmcustomlinktemplate = ""; $gmentryseparatortemplate = &delouse($gmentryseparatortemplate); $gmarchiveentryseparatortemplate = &delouse($gmarchiveentryseparatortemplate); $gmmorearchiveentrytemplate = &delouse($gmmorearchiveentrytemplate); $gmdatearchivetemplate = &delouse($gmdatearchivetemplate); $gmlogarchiveslinkweeklytemplate = &delouse($gmlogarchiveslinkweeklytemplate); $gmcustomonetemplate = &delouse($gmcustomonetemplate); $gmcustomtwotemplate = &delouse($gmcustomtwotemplate); $gmcustomthreetemplate = &delouse($gmcustomthreetemplate); $gmcustomfourtemplate = &delouse($gmcustomfourtemplate); $gmcustomfivetemplate = &delouse($gmcustomfivetemplate); $gmcustomsixtemplate = &delouse($gmcustomsixtemplate); $gmcustomseventemplate = &delouse($gmcustomseventemplate); $gmcustomeighttemplate = &delouse($gmcustomeighttemplate); $gmcustomninetemplate = &delouse($gmcustomninetemplate); $gmcustomtentemplate = &delouse($gmcustomtentemplate); $gmpopuppagetemplate = &delouse($gmpopuppagetemplate); $gmpopupcodetemplate = &delouse($gmpopupcodetemplate); $gmsearchformtemplate = &delouse($gmsearchformtemplate); $gmsearchresultspagetemplate = &delouse($gmsearchresultspagetemplate); $gmsearchresultsentrytemplate = &delouse($gmsearchresultsentrytemplate); $gmcalendartablebeginningtemplate = &delouse($gmcalendartablebeginningtemplate); $gmcalendartableendingtemplate = &delouse($gmcalendartableendingtemplate); $gmcalendarblankcelltemplate = &delouse($gmcalendarblankcelltemplate); $gmcalendarfullcelltemplate = &delouse($gmcalendarfullcelltemplate); $gmcalendarfullcelllinktemplate = &delouse($gmcalendarfullcelllinktemplate); $gmcalendarweekblankdaytemplate = ""; $gmcalendarweekfulldaytemplate = &delouse($gmcalendarweekfulldaytemplate); $gmcalendarweekfulldaylinktemplate = &delouse($gmcalendarweekfulldaylinktemplate); $gmcommentpreviewdividertemplate = &delouse($gmcommentpreviewdividertemplate); $gmcommentpreviewformtemplate = &delouse($gmcommentpreviewformtemplate); $gmsmartlinknocommentstemplate = &delouse($gmsmartlinknocommentstemplate); $gmsmartlinkonecommenttemplate = &delouse($gmsmartlinkonecommenttemplate); $gmsmartlinkmanycommentstemplate = &delouse($gmsmartlinkmanycommentstemplate); $gmlinebreaktemplate = &delouse($gmlinebreaktemplate); $gmcommentlinktargettemplate = &delouse($gmcommentlinktargettemplate); $gmsmartentrymoodtemplate = &delouse($gmsmartentrymoodtemplate); $gmsmartentrymusictemplate = &delouse($gmsmartentrymusictemplate); $gmdategroupingfooterarchivetemplate = &delouse($gmdategroupingfooterarchivetemplate); $gmsmartemoticonscodetemplate = &delouse($gmsmartemoticonscodetemplate); $gmcookiescodetemplate = &delouse($gmcookiescodetemplate); } # -------------------- # read the config file # -------------------- sub gm_readconfig { open (FUNNYFEETCOCO, "./gm-config.cgi") || &gm_dangermouse("Can't read the configuration file. Please make sure that gm-config.cgi is CHMODed to 666 and is in the same place as all your other Greymatter CGI files; also try running Diagnostics & Repair from the Configuration screen."); @gmconfig = ; close (FUNNYFEETCOCO); $gmcounter = 0; foreach (@gmconfig) { chomp ($gmconfig[$gmcounter]); $gmcounter++; } $LogPath = $gmconfig[0]; $EntriesPath = $gmconfig[1]; $LogWebPath = $gmconfig[2]; $EntriesWebPath = $gmconfig[3]; $NotifyEmail = $gmconfig[4]; $indexfilename = $gmconfig[5]; $entrysuffix = $gmconfig[6]; $indexdays = $gmconfig[7]; $serveroffset = $gmconfig[8]; $timezone = $gmconfig[9]; $keeplog = $gmconfig[10]; $posttoarchives = $gmconfig[11]; $allowkarmadefault = $gmconfig[12]; $allowcommentsdefault = $gmconfig[13]; $commentsorder = $gmconfig[14]; $generateentrypages = $gmconfig[15]; $allowhtmlincomments = $gmconfig[16]; $logkarmaandcomments = $gmconfig[17]; $mailprog = $gmconfig[18]; $NotifyForStatus = $gmconfig[19]; $autolinkurls = $gmconfig[20]; $striplinesfromcomments = $gmconfig[21]; $allowmultiplekarmavotes = $gmconfig[22]; $versionsetup = $gmconfig[23]; $cgilocalpath = $gmconfig[24]; $cgiwebpath = $gmconfig[25]; $concurrentmainandarchives = $gmconfig[26]; $keeparchivemasterindex = $gmconfig[27]; $entrylistsortorder = $gmconfig[28]; $allowkarmaorcomments = $gmconfig[29]; $entrylistcountnumber = $gmconfig[30]; $cookiesallowed = $gmconfig[31]; $logarchivesuffix = $gmconfig[32]; $censorlist = $gmconfig[33]; $censorenabled = $gmconfig[34]; $keepmonthlyarchives = $gmconfig[35]; $defaultentrylistview = $gmconfig[36]; $linktocalendarentries = $gmconfig[37]; $automaticrebuilddefault = $gmconfig[38]; $commententrylistonlyifokay = $gmconfig[39]; $otherfilelist = $gmconfig[40]; $otherfilelistentryrebuild = $gmconfig[41]; $archiveformat = $gmconfig[42]; $inlineformatting = $gmconfig[43]; $uploadfilesallowed = $gmconfig[44]; $uploadfilesizelimit = $gmconfig[45]; $emoticonspath = $gmconfig[46]; $keepphphacklog = $gmconfig[47]; $mailhacknotice = $gmconfig[48]; $emoticonsallowed = $gmconfig[49]; } # --------------------- # write the config file # --------------------- sub gm_writeconfig { if ($versionsetup eq "") { $versionsetup = $gmversion; } open (FUNNYFEETCONNIE, ">./gm-config.cgi") || &gm_dangermouse("Can't write to the configuration file. Please make sure that gm-config.cgi is CHMODed to 666 and is in the same place as all your other Greymatter CGI files; also try running Diagnostics & Repair from the Configuration screen."); print FUNNYFEETCONNIE "$LogPath\n"; print FUNNYFEETCONNIE "$EntriesPath\n"; print FUNNYFEETCONNIE "$LogWebPath\n"; print FUNNYFEETCONNIE "$EntriesWebPath\n"; print FUNNYFEETCONNIE "$NotifyEmail\n"; print FUNNYFEETCONNIE "$indexfilename\n"; print FUNNYFEETCONNIE "$entrysuffix\n"; print FUNNYFEETCONNIE "$indexdays\n"; print FUNNYFEETCONNIE "$serveroffset\n"; print FUNNYFEETCONNIE "$timezone\n"; print FUNNYFEETCONNIE "$keeplog\n"; print FUNNYFEETCONNIE "$posttoarchives\n"; print FUNNYFEETCONNIE "$allowkarmadefault\n"; print FUNNYFEETCONNIE "$allowcommentsdefault\n"; print FUNNYFEETCONNIE "$commentsorder\n"; print FUNNYFEETCONNIE "$generateentrypages\n"; print FUNNYFEETCONNIE "$allowhtmlincomments\n"; print FUNNYFEETCONNIE "$logkarmaandcomments\n"; print FUNNYFEETCONNIE "$mailprog\n"; print FUNNYFEETCONNIE "$NotifyForStatus\n"; print FUNNYFEETCONNIE "$autolinkurls\n"; print FUNNYFEETCONNIE "$striplinesfromcomments\n"; print FUNNYFEETCONNIE "$allowmultiplekarmavotes\n"; print FUNNYFEETCONNIE "$versionsetup\n"; print FUNNYFEETCONNIE "$cgilocalpath\n"; print FUNNYFEETCONNIE "$cgiwebpath\n"; print FUNNYFEETCONNIE "$concurrentmainandarchives\n"; print FUNNYFEETCONNIE "$keeparchivemasterindex\n"; print FUNNYFEETCONNIE "$entrylistsortorder\n"; print FUNNYFEETCONNIE "$allowkarmaorcomments\n"; print FUNNYFEETCONNIE "$entrylistcountnumber\n"; print FUNNYFEETCONNIE "$cookiesallowed\n"; print FUNNYFEETCONNIE "$logarchivesuffix\n"; print FUNNYFEETCONNIE "$censorlist\n"; print FUNNYFEETCONNIE "$censorenabled\n"; print FUNNYFEETCONNIE "$keepmonthlyarchives\n"; print FUNNYFEETCONNIE "$defaultentrylistview\n"; print FUNNYFEETCONNIE "$linktocalendarentries\n"; print FUNNYFEETCONNIE "$automaticrebuilddefault\n"; print FUNNYFEETCONNIE "$commententrylistonlyifokay\n"; print FUNNYFEETCONNIE "$otherfilelist\n"; print FUNNYFEETCONNIE "$otherfilelistentryrebuild\n"; print FUNNYFEETCONNIE "$archiveformat\n"; print FUNNYFEETCONNIE "$inlineformatting\n"; print FUNNYFEETCONNIE "$uploadfilesallowed\n"; print FUNNYFEETCONNIE "$uploadfilesizelimit\n"; print FUNNYFEETCONNIE "$emoticonspath\n"; print FUNNYFEETCONNIE "$keepphphacklog\n"; print FUNNYFEETCONNIE "$mailhacknotice\n"; print FUNNYFEETCONNIE "$emoticonsallowed\n"; close (FUNNYFEETCONNIE); } # --------------------------------- # gather ye all thy entry variables # --------------------------------- sub gm_getentryvariables { my $thisentrygetmynumber = shift; &gm_readconfig; &gm_readtemplates; &gm_readcounter; $thisentrynumberpadded = sprintf ("%8d", $thisentrygetmynumber); $thisentrynumberpadded =~ tr/ /0/; open (FUNNYFEETENTRY, "$EntriesPath/$thisentrynumberpadded.cgi") || &gm_dangermouse("Can't read $EntriesPath/$thisentrynumberpadded.cgi. Please make sure that your entries/archives directory is correctly configured and is CHMODed to 777, or try running Diagnostics & Repair in the Configuration screen."); @entrylines = ; close (FUNNYFEETENTRY); $gmcounter = 0; foreach (@entrylines) { chomp ($entrylines[$gmcounter]); $entrylines[$gmcounter] =~ s/\|\*\|/\n/g; $gmcounter++; } ($thisentrynumber, $thisentryauthor, $thisentrysubject, $thisentryweekdaynumber, $thisentrymonth, $thisentryday, $thisentryyearyear, $thisentryhour, $thisentryminute, $thisentrysecond, $thisentryampm, $thisentrypositivekarma, $thisentrynegativekarma, $thisentrycommentsnumber, $thisentryallowkarma, $thisentryallowcomments, $thisentryopenstatus, $thisentrymusic, $thisentrymood, $thisentryemoticonsallowed) = split (/\|/, $entrylines[0]); chomp ($thisentryemoticonsallowed); $thisentryisanarchive = "no"; if ($thisentrynumber <= $newarchivenumber) { $thisentryisanarchive = "yes"; } if ($generateentrypages eq "no") { $thisentryallowcomments = "no"; } $thisentryyear = substr($thisentryyearyear, -2, 2); @months = ("null", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); @weekdays = ("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"); $thisentryweekday = $weekdays[$thisentryweekdaynumber]; $thisentrymonthword = $months[$thisentrymonth]; $thisentryweekdayshort = substr($thisentryweekday, 0, 3); $thisentrymonthwordshort = substr($thisentrymonthword, 0, 3); $thisentryweekdayupper = uc($thisentryweekday); $thisentrymonthwordupper = uc($thisentrymonthword); $thisentryweekdaylower = lc($thisentryweekday); $thisentrymonthwordlower = lc($thisentrymonthword); $thisentryweekdayuppershort = uc($thisentryweekdayshort); $thisentrymonthworduppershort = uc($thisentrymonthwordshort); $thisentryweekdaylowershort = lc($thisentryweekdayshort); $thisentrymonthwordlowershort = lc($thisentrymonthwordshort); $thisentrymonthmonth = sprintf ("%2d", $thisentrymonth); $thisentrydayday = sprintf ("%2d", $thisentryday); $thisentryhourhour = sprintf ("%2d", $thisentryhour); $thisentryminuteminute = sprintf ("%2d", $thisentryminute); $thisentrysecondsecond = sprintf ("%2d", $thisentrysecond); $thisentrymonthmonth =~ tr/ /0/; $thisentrydayday =~ tr/ /0/; $thisentryhourhour =~ tr/ /0/; $thisentryminuteminute =~ tr/ /0/; $thisentrysecondsecond =~ tr/ /0/; $thisentryampmdot = "A.M."; $thisentrymilitaryhour = $thisentryhour; if ($thisentryampm eq "PM") { $thisentryampmdot = "P.M."; if ($thisentryhour ne "12") { $thisentrymilitaryhour = $thisentryhour + 12; } } $thisentrymilitaryhour = sprintf ("%2d", $thisentrymilitaryhour); $thisentrymilitaryhour =~ tr/ /0/; $thisentryampmlower = lc($thisentryampm); $thisentryampmdotlower = lc($thisentryampmdot); if (($thisentryhour eq "12") && ($thisentryampm eq "AM")) { $thisentrymilitaryhour = "00"; } $leapyearcheck = $thisentryyearyear % 4; $thisentrymaxdaysinthismonth = 31; if (($thisentrymonthword eq "September") || ($thisentrymonthword eq "April") || ($thisentrymonthword eq "June") || ($thisentrymonthword eq "November")) { $thisentrymaxdaysinthismonth = 30; } if ($thisentrymonthword eq "February") { $thisentrymaxdaysinthismonth = 28; if ($leapyearcheck eq "0") { $thisentrymaxdaysinthismonth = 29; } } $thisentrymaxdaysinpreviousmonth = 31; if (($thisentrymonthword eq "October") || ($thisentrymonthword eq "May") || ($thisentrymonthword eq "July") || ($thisentrymonthword eq "December")) { $thisentrymaxdaysinpreviousmonth = 30; } if ($thisentrymonthword eq "March") { $thisentrymaxdaysinpreviousmonth = 28; if ($leapyearcheck eq "0") { $thisentrymaxdaysinpreviousmonth = 29; } } $thisentryweekbeginningmonth = $thisentrymonth; $thisentryweekbeginningyearyear = $thisentryyearyear; $thisentryweekendingmonth = $thisentrymonth; $thisentryweekendingyearyear = $thisentryyearyear; $thisentryweekbeginningday = $thisentryday - $thisentryweekdaynumber; $thisentryweekendingday = $thisentryweekbeginningday + 6; if ($thisentryweekbeginningday < 1) { $thisentryweekbeginningday = $thisentryweekbeginningday + $thisentrymaxdaysinpreviousmonth; if ($thisentryweekbeginningday > $thisentryday) { $thisentryweekbeginningmonth--; } if ($thisentryweekbeginningmonth < 1) { $thisentryweekbeginningmonth = 12; $thisentryweekbeginningyearyear--; } } if ($thisentryweekendingday > $thisentrymaxdaysinthismonth) { $thisentryweekendingday = $thisentryweekendingday - $thisentrymaxdaysinthismonth; if ($thisentryweekendingday < $thisentryday) { $thisentryweekendingmonth++; } if ($thisentryweekendingmonth > 12) { $thisentryweekendingmonth = 1; $thisentryweekendingyearyear++; } } $thisentryweekbeginningyear = substr($thisentryweekbeginningyearyear, -2, 2); $thisentryweekendingyear = substr($thisentryweekendingyearyear, -2, 2); $thisentryweekbeginningdayday = sprintf ("%2d", $thisentryweekbeginningday); $thisentryweekbeginningdayday =~ tr/ /0/; $thisentryweekendingdayday = sprintf ("%2d", $thisentryweekendingday); $thisentryweekendingdayday =~ tr/ /0/; $thisentryweekbeginningmonthmonth = sprintf ("%2d", $thisentryweekbeginningmonth); $thisentryweekbeginningmonthmonth =~ tr/ /0/; $thisentryweekendingmonthmonth = sprintf ("%2d", $thisentryweekendingmonth); $thisentryweekendingmonthmonth =~ tr/ /0/; $thisentryweekbeginningweekday = "Sunday"; $thisentryweekbeginningmonthword = $months[$thisentryweekbeginningmonth]; $thisentryweekbeginningweekdayshort = substr($thisentryweekbeginningweekday, 0, 3); $thisentryweekbeginningmonthwordshort = substr($thisentryweekbeginningmonthword, 0, 3); $thisentryweekbeginningweekdayupper = uc($thisentryweekbeginningweekday); $thisentryweekbeginningmonthwordupper = uc($thisentryweekbeginningmonthword); $thisentryweekbeginningweekdaylower = lc($thisentryweekbeginningweekday); $thisentryweekbeginningmonthwordlower = lc($thisentryweekbeginningmonthword); $thisentryweekbeginningweekdayuppershort = uc($thisentryweekbeginningweekdayshort); $thisentryweekbeginningmonthworduppershort = uc($thisentryweekbeginningmonthwordshort); $thisentryweekbeginningweekdaylowershort = lc($thisentryweekbeginningweekdayshort); $thisentryweekbeginningmonthwordlowershort = lc($thisentryweekbeginningmonthwordshort); $thisentryweekendingweekday = "Saturday"; $thisentryweekendingmonthword = $months[$thisentryweekendingmonth]; $thisentryweekendingweekdayshort = substr($thisentryweekendingweekday, 0, 3); $thisentryweekendingmonthwordshort = substr($thisentryweekendingmonthword, 0, 3); $thisentryweekendingweekdayupper = uc($thisentryweekendingweekday); $thisentryweekendingmonthwordupper = uc($thisentryweekendingmonthword); $thisentryweekendingweekdaylower = lc($thisentryweekendingweekday); $thisentryweekendingmonthwordlower = lc($thisentryweekendingmonthword); $thisentryweekendingweekdayuppershort = uc($thisentryweekendingweekdayshort); $thisentryweekendingmonthworduppershort = uc($thisentryweekendingmonthwordshort); $thisentryweekendingweekdaylowershort = lc($thisentryweekendingweekdayshort); $thisentryweekendingmonthwordlowershort = lc($thisentryweekendingmonthwordshort); open (FUNNYFEETVISHNU, "./gm-authors.cgi") || &gm_dangermouse("Can't read the authors file. Please make sure that gm-authors.cgi is CHMODed to 666 and is in the same place as all your other Greymatter CGI files; also try running Diagnostics & Repair from the Configuration screen."); @gettheauthordata = ; close (FUNNYFEETVISHNU); $thisentryauthoremail = ""; $thisentryauthorhomepage = ""; $thisentryauthorentrycount = ""; foreach $gettheauthordataline (@gettheauthordata) { chomp ($gettheauthordataline); @gettheauthorinfo = split (/\|/, $gettheauthordataline); if ($gettheauthorinfo[0] eq $thisentryauthor) { $thisentryauthoremail = $gettheauthorinfo[2]; $thisentryauthorhomepage = $gettheauthorinfo[3]; $thisentryauthorentrycount = $gettheauthorinfo[5]; } } $thisentryauthorsmartlink = $thisentryauthor; if ($thisentryauthoremail ne "") { $thisentryauthorsmartlink = "$thisentryauthor"; } if ($thisentryauthorhomepage ne "") { $thisentryauthorsmartlink = "$thisentryauthor"; } $thisentryfilename = "$EntriesWebPath\/$thisentrynumberpadded\.$entrysuffix"; $thisentrycommentspostlink = "$thisentryfilename\#comments"; $thisentrycommentstatussmart = $gmsmartlinkmanycommentstemplate; if ($thisentrycommentsnumber eq "0") { $thisentrycommentstatussmart = $gmsmartlinknocommentstemplate; } if ($thisentrycommentsnumber eq "1") { $thisentrycommentstatussmart = $gmsmartlinkonecommenttemplate; } $thisentrycommentstatussmartupper = uc($thisentrycommentstatussmart); $thisentrycommentstatussmartlower = lc($thisentrycommentstatussmart); $thisentrypagelink = $thisentryfilename; $indexfilenamesmartcheck = "/$indexfilename"; $indexfilenameprefix = substr($indexfilename, 0, 6); if ($indexfilenameprefix eq "index.") { $indexfilenamesmartcheck = "/"; } $thisentrypageindexlink = "$LogWebPath$indexfilenamesmartcheck"; $thisentrypagearchiveindexlink = "$EntriesWebPath$indexfilenamesmartcheck"; if ($keepmonthlyarchives eq "no") { $thisentrypagearchivelogindexlink = $thisentrypageindexlink; } else { if ($archiveformat eq "week") { $thisentrypagearchivelogindexlink = "$EntriesWebPath/archive-$thisentryweekbeginningmonthmonth$thisentryweekbeginningdayday$thisentryweekbeginningyearyear-$thisentryweekendingmonthmonth$thisentryweekendingdayday$thisentryweekendingyearyear\.$logarchivesuffix"; } else { $thisentrypagearchivelogindexlink = "$EntriesWebPath/archive-$thisentrymonthmonth$thisentryyearyear\.$logarchivesuffix"; } } $thisentrypagesmartindexlink = $thisentrypageindexlink; if (($thisentrynumber <= $newarchivenumber) && ($keepmonthlyarchives ne "no")) { $thisentrypagesmartindexlink = $thisentrypagearchivelogindexlink; } $thisentrycommentslink = ""; $thisentrycommentsform = ""; if ($thisentryallowcomments eq "yes") { if (($allowkarmaorcomments eq "comments") || ($allowkarmaorcomments eq "both")) { $thisentrycommentslink = $gmcommentslinktemplate; $thisentrycommentsform = $gmcommentsformtemplate; } } if (($emoticonsallowed eq "both") || ($emoticonsallowed eq "comments")) { $thisentrycommentsform =~ s/{{smartemoticonscode}}/$gmsmartemoticonscodetemplate/; } else { $thisentrycommentsform =~ s/{{smartemoticonscode}}//; } $thisentrykarmalink = ""; $thisentrykarmaform = ""; if ($thisentryallowkarma eq "yes") { if (($allowkarmaorcomments eq "karma") || ($allowkarmaorcomments eq "both")) { $thisentrykarmalink = $gmkarmalinktemplate; $thisentrykarmaform = $gmkarmaformtemplate; } } if (($thisentryisanarchive eq "yes") && ($posttoarchives eq "no")) { $thisentrykarmalink = ""; $thisentrykarmaform = ""; $thisentrycommentslink = ""; $thisentrycommentsform = ""; } $thisentrysearchform = $gmsearchformtemplate; if ($generateentrypages eq "no") { $thisentrycommentslink = ""; $thisentrycommentsform = ""; $thisentrysearchform = ""; } $thisentrypositivekarmalink = "$cgiwebpath/gm-karma.cgi?vote=positive&entry=$thisentrynumberpadded"; $thisentrynegativekarmalink = "$cgiwebpath/gm-karma.cgi?vote=negative&entry=$thisentrynumberpadded"; $thisentrytotalkarma = $thisentrypositivekarma - $thisentrynegativekarma; @thisentrykarmavoters = split (/\|/, $entrylines[1]); $thisentrymainbody = $entrylines[2]; $thisentrymorebody = $entrylines[3]; if (($thisentrymainbody =~ /\|\*\|\|\*\|/) || ($thisentrymorebody =~ /\|\*\|\|\*\|/)) { $thisentrymainbody =~ s/\|\*\|\|\*\|//g; $thisentrymorebody =~ s/\|\*\|\|\*\|//g; } if (($thisentrymainbody =~ /\n\n/) || ($thisentrymorebody =~ /\n\n/)) { $thisentrymainbody =~ s/\n\n//g; $thisentrymorebody =~ s/\n\n//g; } if (($thisentrymainbody =~ /\|\*\|/) || ($thisentrymorebody =~ /\|\*\|/)) { $thisentrymainbody =~ s/\|\*\|/$gmlinebreaktemplate/g; $thisentrymorebody =~ s/\|\*\|/$gmlinebreaktemplate/g; } if (($thisentrymainbody =~ /\n/) || ($thisentrymorebody =~ /\n/)) { $thisentrymainbody =~ s/\n/$gmlinebreaktemplate/g; $thisentrymorebody =~ s/\n/$gmlinebreaktemplate/g; } if (($thisentrymainbody =~ //) || ($thisentrymorebody =~ //)) { $thisentrymainbody =~ s//$gmparaseparationtemplate/g; $thisentrymorebody =~ s//$gmparaseparationtemplate/g; } if (($censorenabled eq "both") || ($censorenabled eq "entries")) { unless ($censorlist eq "") { @censoredterms = split(/\|\*\|/, $censorlist); foreach $thisterm (@censoredterms) { unless ($thisterm eq "") { if ((substr($thisterm, 0, 1) eq "[") && (substr($thisterm, -1, 1) eq "]")) { $thisrealterm = $thisterm; $thisrealterm =~ s/\[//g; $thisrealterm =~ s/\]//g; $thisrealtermlength = length($thisrealterm); $thisrealtermreplace = "*" x $thisrealtermlength; $thisrealtermreplacedash = "-" x $thisrealtermlength; if ($thisentrysubject =~ m/$thisrealterm/i) { $thisentrysubject =~ s/\b$thisrealterm\b/$thisrealtermreplacedash/isg; } if ($thisentrymainbody =~ m/$thisrealterm/i) { $thisentrymainbody =~ s/\b$thisrealterm\b/$thisrealtermreplace/isg; } if ($thisentrymorebody =~ m/$thisrealterm/i) { $thisentrymorebody =~ s/\b$thisrealterm\b/$thisrealtermreplace/isg; } } else { $thisrealtermlength = length($thisterm); $thisrealtermreplace = "*" x $thisrealtermlength; $thisrealtermreplacedash = "-" x $thisrealtermlength; if ($thisentrysubject =~ m/$thisterm/i) { $thisentrysubject =~ s/\b$thisterm\b/$thisrealtermreplacedash/isg; } if ($thisentrymainbody =~ m/$thisterm/i) { $thisentrymainbody =~ s/\b$thisterm\b/$thisrealtermreplace/isg; } if ($thisentrymorebody =~ m/$thisterm/i) { $thisentrymorebody =~ s/\b$thisterm\b/$thisrealtermreplace/isg; } } } } } } $thisentrymorepreface = ""; $thisentrymorelink = ""; if (($thisentrymorebody ne "") && ($generateentrypages ne "no")) { $thisentrymorepreface = $gmmoreprefacetemplate; $thisentrymorelink = $gmmorelinktemplate; } $thisentrycommentdivider = ""; if ($thisentrycommentsnumber ne "0") { $thisentrycommentdivider = $gmcommentdividertemplate; } $thisentrycomments = ""; # changed deprecated , , and tags to corresponding css properties: flipped cracker 9/15/2003 # removed code for entrysubject : 1.3.1 # flipped cracker 6/29/2004 if (($inlineformatting eq "entries") || ($inlineformatting eq "both")) { if (($thisentrymainbody =~ /\*\*(.*?)\*\*/) || ($thisentrymainbody =~ /\\\\(.*?)\\\\/) || ($thisentrymainbody =~ /__(.*?)__/)) { $thisentrymainbody =~ s/\*\*(.*?)\*\*/$1<\/span>/isg; $thisentrymainbody =~ s/\\\\(.*?)\\\\/$1<\/span>/isg; $thisentrymainbody =~ s/__(.*?)__/$1<\/span>/isg; } if (($thisentrymorebody =~ /\*\*(.*?)\*\*/) || ($thisentrymorebody =~ /\\\\(.*?)\\\\/) || ($thisentrymorebody =~ /__(.*?)__/)) { $thisentrymorebody =~ s/\*\*(.*?)\*\*/$1<\/span>/isg; $thisentrymorebody =~ s/\\\\(.*?)\\\\/$1<\/span>/isg; $thisentrymorebody =~ s/__(.*?)__/$1<\/span>/isg; } } # changed 9/15/2003 # emoticons hack revised by flipped cracker 9/17/2003 # merged in version 1.3 $returnto = "entries"; $thisentrymainbody = &gm_emoticons($thisentrymainbody); $thisentrymorebody = &gm_emoticons($thisentrymorebody); # merged 9/17/2003 if (($thisentrycommentsnumber ne "0") && ($generateentrypages ne "no")) { $thisisaspellcheck = "no"; &gm_collatecomments; $thisentrycomments =~ s/\"/"/g; } } # ----------------- # comment collating # ----------------- sub gm_collatecomments { $commentcounter = 4; if ($commentsorder eq "ascending") { $commentcounter = $thisentrycommentsnumber + 3; } $commentcountermax = $thisentrycommentsnumber + 3; $commentcountercurrent = $thisentrycommentsnumber; do { $thiscommentordernumber = $commentcounter - 3; ($thiscommentauthor, $thiscommentauthorip, $thiscommentauthoremailabsolute, $thiscommentauthorhomepageabsolute, $thiscommentweekdaynumber, $thiscommentmonth, $thiscommentday, $thiscommentyearyear, $thiscommenthour, $thiscommentminute, $thiscommentsecond, $thiscommentampm, $thiscommenttext) = split (/\|/, $entrylines[$commentcounter]); $thiscommentyear = substr($thiscommentyearyear, -2, 2); @months = ("null", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); @weekdays = ("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"); $thiscommentweekday = $weekdays[$thiscommentweekdaynumber]; $thiscommentmonthword = $months[$thiscommentmonth]; $thiscommentweekdayshort = substr($thiscommentweekday, 0, 3); $thiscommentmonthwordshort = substr($thiscommentmonthword, 0, 3); $thiscommentweekdayupper = uc($thiscommentweekday); $thiscommentmonthwordupper = uc($thiscommentmonthword); $thiscommentweekdaylower = lc($thiscommentweekday); $thiscommentmonthwordlower = lc($thiscommentmonthword); $thiscommentweekdayuppershort = uc($thiscommentweekdayshort); $thiscommentmonthworduppershort = uc($thiscommentmonthwordshort); $thiscommentweekdaylowershort = lc($thiscommentweekdayshort); $thiscommentmonthwordlowershort = lc($thiscommentmonthwordshort); $thiscommentmonthmonth = sprintf ("%2d", $thiscommentmonth); $thiscommentdayday = sprintf ("%2d", $thiscommentday); $thiscommenthourhour = sprintf ("%2d", $thiscommenthour); $thiscommentminuteminute = sprintf ("%2d", $thiscommentminute); $thiscommentsecondsecond = sprintf ("%2d", $thiscommentsecond); $thiscommentmonthmonth =~ tr/ /0/; $thiscommentdayday =~ tr/ /0/; $thiscommenthourhour =~ tr/ /0/; $thiscommentminuteminute =~ tr/ /0/; $thiscommentsecondsecond =~ tr/ /0/; $thiscommentampmdot = "A.M."; $thiscommentmilitaryhour = $thiscommenthour; if ($thiscommentampm eq "PM") { $thiscommentampmdot = "P.M."; if ($thiscommenthour ne "12") { $thiscommentmilitaryhour = $thiscommenthour + 12; } } $thiscommentmilitaryhour = sprintf ("%2d", $thiscommentmilitaryhour); $thiscommentmilitaryhour =~ tr/ /0/; $thiscommentampmlower = lc($thiscommentampm); $thiscommentampmdotlower = lc($thiscommentampmdot); # new ordinal numbers for {{dayappend}} variable: linear 9/15/2003 # merged in 1.3 $thiscommentdayappend = &gm_toordinal($thiscommentday); #merged 9/15/2003 $thiscommentauthor =~ s/"/\"/g; $thiscommentauthoremailabsolute =~ s/"/\"/g; $thiscommentauthorhomepageabsolute =~ s/"/\"/g; $thiscommentauthoremail = ""; $thiscommentauthorhomepage = ""; $thiscommentauthorsmartlink = $thiscommentauthor; if ($thiscommentauthoremailabsolute ne "") { $thiscommentauthoremail = $gmcommentauthoremailtemplate; $thiscommentauthorsmartlink = "$thiscommentauthor"; } if ($thiscommentauthorhomepageabsolute ne "") { $thiscommentauthorhomepage = $gmcommentauthorhomepagetemplate; $thiscommentauthorsmartlink = "$thiscommentauthor"; } if (($allowhtmlincomments eq "linkboldital") || ($allowhtmlincomments eq "linkonly")) { if ($thiscommenttext =~ m/\*/i) { $thiscommenttext =~ s/\*/\|AMP\|/g; } if (($thiscommenttext =~ m//i)) { $thiscommenttext =~ s//\*a\*/isg; } if ($allowhtmlincomments eq "linkboldital") { if (($thiscommenttext =~ m//i) && ($thiscommenttext =~ m/<\/b>/i)) { $thiscommenttext =~ s//\*b\*/isg; $thiscommenttext =~ s/<\/b>/\*bb\*/isg; } if (($thiscommenttext =~ m//i) && ($thiscommenttext =~ m/<\/i>/i)) { $thiscommenttext =~ s//\*i\*/isg; $thiscommenttext =~ s/<\/i>/\*ii\*/isg; } } } # improved tag removal regex: linear 7/9/2003 # merged into 1.3 unless ($allowhtmlincomments eq "yes") { $thiscommenttext =~ s(<[^>]*>)()gs; } # merged 9/11/2003 if ($autolinkurls eq "yes") { # these two lines of code written in part by Neal Coffey (cray@indecisions.org) $thiscommenttext =~ s#(^|\s)(\w+://)([A-Za-z0-9?=_\-/.%+&'~\#@!\^]+)#$1$2$3#isg; $thiscommenttext =~ s#(^|\s)(www.[A-Za-z0-9?=_\-/.%+&'~\#@!\^]+)#$1$2#isg; # thanks, Neal! $thiscommenttext =~ s/(\w+\@\w+\.\w+)/$1<\/a>/isg; } # emoticons hack revised by flipped cracker 9/17/2003 # merged in version 1.3 $returnto = "comments"; $thiscommenttext = &gm_emoticons($thiscommenttext); # merged 9/17/2003 if (($allowhtmlincomments eq "linkboldital") || ($allowhtmlincomments eq "linkonly")) { if (($thiscommenttext =~ m/\*a href\*/i) && ($thiscommenttext =~ m/\*a\*/i)) { $thiscommenttext =~ s/\*a href\*//isg; } # changed deprecated , and to corresponding css properties: flipped cracker 9/15/2003 if ($allowhtmlincomments eq "linkboldital") { if (($thiscommenttext =~ m/\*b\*/i) && ($thiscommenttext =~ m/\*bb\*/i)) { $thiscommenttext =~ s/\*b\*//isg; $thiscommenttext =~ s/\*bb\*/<\/span>/isg; } if (($thiscommenttext =~ m/\*i\*/i) && ($thiscommenttext =~ m/\*ii\*/i)) { $thiscommenttext =~ s/\*i\*//isg; $thiscommenttext =~ s/\*ii\*/<\/span>/isg; } } # changed 9/15/2003 if ($thiscommenttext =~ m/\|AMP\|/i) { $thiscommenttext =~ s/\|AMP\|/\*/g; } } # changed deprecated , , and to corresponding css properties: flipped cracker 9/15/2003 if (($inlineformatting eq "comments") || ($inlineformatting eq "both")) { if (($thiscommenttext =~ /\*\*(.*?)\*\*/) || ($thiscommenttext =~ /\\\\(.*?)\\\\/) || ($thiscommenttext =~ /__(.*?)__/)) { $thiscommenttext =~ s/\*\*(.*?)\*\*/$1<\/span>/isg; $thiscommenttext =~ s/\\\\(.*?)\\\\/$1<\/span>/isg; $thiscommenttext =~ s/__(.*?)__/$1<\/span>/isg; } } #changed 9/15/2003 if ($striplinesfromcomments eq "yes") { if (($thiscommenttext =~ /\|\*\|/) || ($thiscommenttext =~ /\n/)) { $thiscommenttext =~ s/\|\*\|/ /g; $thiscommenttext =~ s/\n/ /g; } } else { if (($thiscommenttext =~ /\|\*\|/) || ($thiscommenttext =~ /\n/)) { $thiscommenttext =~ s/\|\*\|\|\*\|//g; $thiscommenttext =~ s/\n\n//g; $thiscommenttext =~ s/\|\*\|/$gmlinebreaktemplate/g; $thiscommenttext =~ s/\n/$gmlinebreaktemplate/g; $thiscommenttext =~ s//$gmparaseparationtemplate/g; $thiscommenttext =~ s/a href/a rel="nofollow" href/g; $thiscommenttext =~ s/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w{1,8});)/&/g; } } if (($censorenabled eq "both") || ($censorenabled eq "comments")) { unless ($censorlist eq "") { @censoredterms = split(/\|\*\|/, $censorlist); foreach $thisterm (@censoredterms) { unless ($thisterm eq "") { if ((substr($thisterm, 0, 1) eq "[") && (substr($thisterm, -1, 1) eq "]")) { $thisrealterm = $thisterm; $thisrealterm =~ s/\[//g; $thisrealterm =~ s/\]//g; $thisrealtermlength = length($thisrealterm); $thisrealtermreplace = "*" x $thisrealtermlength; $thisrealtermreplacedash = "-" x $thisrealtermlength; if ($thiscommenttext =~ m/$thisrealterm/i) { $thiscommenttext =~ s/\b$thisrealterm\b/$thisrealtermreplace/isg; } if ($thiscommentauthor =~ m/$thisrealterm/i) { $thiscommentauthor =~ s/\b$thisrealterm\b/$thisrealtermreplacedash/isg; } } else { $thisrealtermlength = length($thisterm); $thisrealtermreplace = "*" x $thisrealtermlength; $thisrealtermreplacedash = "-" x $thisrealtermlength; if ($thiscommenttext =~ m/$thisterm/i) { $thiscommenttext =~ s/\b$thisterm\b/$thisrealtermreplace/isg; } if ($thiscommentauthor =~ m/$thisterm/i) { $thiscommentauthor =~ s/\b$thisterm\b/$thisrealtermreplacedash/isg; } } } } } } $thiscommentfullbody = $gmcommentstemplate; if ($thiscommentfullbody =~ m/{{comment/i) { $thiscommentfullbody =~ s/{{commentbody}}/$thiscommenttext/gi; $thiscommentfullbody =~ s/{{commentauthoremail}}/$thiscommentauthoremail/gi; $thiscommentfullbody =~ s/{{commentauthorhomepage}}/$thiscommentauthorhomepage/gi; $thiscommentfullbody =~ s/{{commentauthor}}/$thiscommentauthor/gi; $thiscommentfullbody =~ s/{{commentauthoremailabsolute}}/$thiscommentauthoremailabsolute/gi; $thiscommentfullbody =~ s/{{commentauthorhomepageabsolute}}/$thiscommentauthorhomepageabsolute/gi; $thiscommentfullbody =~ s/{{commentauthorsmartlink}}/$thiscommentauthorsmartlink/gi; $thiscommentfullbody =~ s/{{commentauthorip}}/$thiscommentauthorip/gi; $thiscommentfullbody =~ s/{{commentordernumber}}/$thiscommentordernumber/gi; } $thiscommentfullbody =~ s/{{day}}/$thiscommentday/gi; $thiscommentfullbody =~ s/{{month}}/$thiscommentmonth/gi; $thiscommentfullbody =~ s/{{year}}/$thiscommentyear/gi; $thiscommentfullbody =~ s/{{hour}}/$thiscommenthour/gi; $thiscommentfullbody =~ s/{{minute}}/$thiscommentminute/gi; $thiscommentfullbody =~ s/{{second}}/$thiscommentsecond/gi; $thiscommentfullbody =~ s/{{dayday}}/$thiscommentdayday/gi; $thiscommentfullbody =~ s/{{monthmonth}}/$thiscommentmonthmonth/gi; $thiscommentfullbody =~ s/{{yearyear}}/$thiscommentyearyear/gi; $thiscommentfullbody =~ s/{{hourhour}}/$thiscommenthourhour/gi; $thiscommentfullbody =~ s/{{minuteminute}}/$thiscommentminuteminute/gi; $thiscommentfullbody =~ s/{{secondsecond}}/$thiscommentsecondsecond/gi; $thiscommentfullbody =~ s/{{weekday}}/$thiscommentweekday/gi; $thiscommentfullbody =~ s/{{weekdayshort}}/$thiscommentweekdayshort/gi; $thiscommentfullbody =~ s/{{monthword}}/$thiscommentmonthword/gi; $thiscommentfullbody =~ s/{{monthwordshort}}/$thiscommentmonthwordshort/gi; $thiscommentfullbody =~ s/{{weekdayupper}}/$thiscommentweekdayupper/gi; $thiscommentfullbody =~ s/{{monthwordupper}}/$thiscommentmonthwordupper/gi; $thiscommentfullbody =~ s/{{weekdaylower}}/$thiscommentweekdaylower/gi; $thiscommentfullbody =~ s/{{monthwordlower}}/$thiscommentmonthwordlower/gi; $thiscommentfullbody =~ s/{{weekdayuppershort}}/$thiscommentweekdayuppershort/gi; $thiscommentfullbody =~ s/{{monthworduppershort}}/$thiscommentmonthworduppershort/gi; $thiscommentfullbody =~ s/{{weekdaylowershort}}/$thiscommentweekdaylowershort/gi; $thiscommentfullbody =~ s/{{monthwordlowershort}}/$thiscommentmonthwordlowershort/gi; $thiscommentfullbody =~ s/{{militaryhour}}/$thiscommentmilitaryhour/gi; $thiscommentfullbody =~ s/{{ampm}}/$thiscommentampm/gi; $thiscommentfullbody =~ s/{{ampmdot}}/$thiscommentampmdot/gi; $thiscommentfullbody =~ s/{{ampmlower}}/$thiscommentampmlower/gi; $thiscommentfullbody =~ s/{{ampmdotlower}}/$thiscommentampmdotlower/gi; # new {{dayappend variable}}: linear 9/15/2003 # merged in 1.3 $thiscommentfullbody =~ s/{{dayappend}}/$thiscommentdayappend/gi; # merged 9/15/2003 $thisentrycomments .= $thiscommentfullbody; if ($commentsorder eq "ascending") { $commentcounter--; } else { $commentcounter++; } $commentcountercurrent--; } until $commentcountercurrent eq "0"; } # ---------------- # format the entry # ---------------- sub gm_formatentry { my $entrygetreturn = shift; # added by flipped cracker 09/12/03 # version 1.3 $domain = $cgiwebpath; $domain =~ s@http://([^\/]+)?.*@$1@; # end additions $entryreturn = $entrygetreturn; # $entryreturn =~ s/\|\*\|/\n/g; if (($entryreturn =~ m/{{header}}/i) || ($entryreturn =~ m/{{footer}}/i) || ($entryreturn =~ m/{{sidebar}}/i)) { $entryreturn =~ s/{{header}}/$gmheadertemplate/gi; $entryreturn =~ s/{{footer}}/$gmfootertemplate/gi; $entryreturn =~ s/{{sidebar}}/$gmsidebartemplate/gi; } if ($entryreturn =~ m/{{custom/i) { $entryreturn =~ s/{{customone}}/$gmcustomonetemplate/gi; $entryreturn =~ s/{{customtwo}}/$gmcustomtwotemplate/gi; $entryreturn =~ s/{{customthree}}/$gmcustomthreetemplate/gi; $entryreturn =~ s/{{customfour}}/$gmcustomfourtemplate/gi; $entryreturn =~ s/{{customfive}}/$gmcustomfivetemplate/gi; $entryreturn =~ s/{{customsix}}/$gmcustomsixtemplate/gi; $entryreturn =~ s/{{customseven}}/$gmcustomseventemplate/gi; $entryreturn =~ s/{{customeight}}/$gmcustomeighttemplate/gi; $entryreturn =~ s/{{customnine}}/$gmcustomninetemplate/gi; $entryreturn =~ s/{{customten}}/$gmcustomtentemplate/gi; } if ($entryreturn =~ m/{{logarchivelist}}/i) { if ($keepmonthlyarchives eq "no") { $entryreturn =~ s/{{logarchivelist}}//gi; } else { &gm_generatearchiveloglist; $entryreturn =~ s/{{logarchivelist}}/$logarchivelistfinal/gi; } } if ($generateentrypages eq "yes") { if (($entryreturn =~ m/{{logshortentrylist/i) || ($entryreturn =~ m/{{logmoreentrylist/i) || ($entryreturn =~ m/{{logentrylist/i)) { &gm_generateentryloglist; $entryreturn =~ s/{{logshortentrylist}}/$logshortentrylistfinal/gi; $entryreturn =~ s/{{logmoreentrylist}}/$logmoreentrylistfinal/gi; $entryreturn =~ s/{{logentrylist}}/$logentrylistfinal/gi; $entryreturn =~ s/{{logshortentrylist month}}/$logshortentrylistmonthfinal/gi; $entryreturn =~ s/{{logshortentrylist day}}/$logshortentrylistdayfinal/gi; $entryreturn =~ s/{{logshortentrylist year}}/$logshortentrylistyearfinal/gi; $entryreturn =~ s/{{logmoreentrylist month}}/$logmoreentrylistmonthfinal/gi; $entryreturn =~ s/{{logmoreentrylist day}}/$logmoreentrylistdayfinal/gi; $entryreturn =~ s/{{logmoreentrylist year}}/$logmoreentrylistyearfinal/gi; $entryreturn =~ s/{{logentrylist month}}/$logentrylistmonthfinal/gi; $entryreturn =~ s/{{logentrylist day}}/$logentrylistdayfinal/gi; $entryreturn =~ s/{{logentrylist year}}/$logentrylistyearfinal/gi; $entryreturn =~ s/{{logshortentrylist number}}/$logshortentrylistnumberfinal/gi; $entryreturn =~ s/{{logmoreentrylist number}}/$logmoreentrylistnumberfinal/gi; $entryreturn =~ s/{{logentrylist number}}/$logentrylistnumberfinal/gi; $entryreturn =~ s/{{logshortentrylist firsthalf}}/$logshortentrylistfirsthalffinal/gi; $entryreturn =~ s/{{logshortentrylist secondhalf}}/$logshortentrylistsecondhalffinal/gi; $entryreturn =~ s/{{logmoreentrylist firsthalf}}/$logmoreentrylistfirsthalffinal/gi; $entryreturn =~ s/{{logmoreentrylist secondhalf}}/$logmoreentrylistsecondhalffinal/gi; $entryreturn =~ s/{{logentrylist firsthalf}}/$logentrylistfirsthalffinal/gi; $entryreturn =~ s/{{logentrylist secondhalf}}/$logentrylistsecondhalffinal/gi; } if (($entryreturn =~ m/{{logshortentrylist comments/i) || ($entryreturn =~ m/{{logmoreentrylist comments/i) || ($entryreturn =~ m/{{logentrylist comments/i)) { &gm_generateentryloglistcomments; $entryreturn =~ s/{{logshortentrylist comments}}/$logshortentrylistfinal/gi; $entryreturn =~ s/{{logmoreentrylist comments}}/$logmoreentrylistfinal/gi; $entryreturn =~ s/{{logentrylist comments}}/$logentrylistfinal/gi; $entryreturn =~ s/{{logshortentrylist commentsminimum}}/$logshortminimumentrylistfinal/gi; $entryreturn =~ s/{{logmoreentrylist commentsminimum}}/$logmoreminimumentrylistfinal/gi; $entryreturn =~ s/{{logentrylist commentsminimum}}/$logminimumentrylistfinal/gi; $entryreturn =~ s/{{logshortentrylist commentsnumber}}/$logshortnumberentrylistfinal/gi; $entryreturn =~ s/{{logmoreentrylist commentsnumber}}/$logmorenumberentrylistfinal/gi; $entryreturn =~ s/{{logentrylist commentsnumber}}/$lognumberentrylistfinal/gi; } if (($entryreturn =~ m/{{logshortentrylist /i) || ($entryreturn =~ m/{{logmoreentrylist /i) || ($entryreturn =~ m/{{logentrylist /i)) { open (FUNNYFEETBRAHMA, "./gm-authors.cgi") || &gm_dangermouse("Can't read the authors file. Please make sure that gm-authors.cgi is CHMODed to 666 and is in the same place as all your other Greymatter CGI files; also try running Diagnostics & Repair from the Configuration screen."); @gettheauthordata = ; close (FUNNYFEETBRAHMA); foreach $gettheauthordataline (@gettheauthordata) { chomp ($gettheauthordataline); @gettheauthorinfo = split (/\|/, $gettheauthordataline); $thisentryloglistauthor = $gettheauthorinfo[0]; &gm_generateentryloglistauthor; $entryreturn =~ s/{{logshortentrylist $thisentryloglistauthor}}/$logshortentrylistfinal/gi; $entryreturn =~ s/{{logmoreentrylist $thisentryloglistauthor}}/$logmoreentrylistfinal/gi; $entryreturn =~ s/{{logentrylist $thisentryloglistauthor}}/$logentrylistfinal/gi; } } } if (($entryreturn =~ m/{{calendar}}/i) || ($entryreturn =~ m/{{calendarweek}}/i)) { $usethisentryweekdaynumber = $thisentryweekdaynumber; $usethisentryday = $thisentryday; $usethisentrymonth = $thisentrymonth; $usethisentrymonthmonth = $thisentrymonthmonth; $usethisentrymonthword = $thisentrymonthword; $usethisentryyear = $thisentryyear; $usethisentryyearyear = $thisentryyearyear; &gm_generatecalendar; $entryreturn =~ s/{{calendar}}/$calendarfull/gi; $entryreturn =~ s/{{calendarweek}}/$calendarweekfull/gi; } if ($entryreturn =~ m/{{calendar (..)\/(..)}}/i) { until ($entryreturn !~ m/{{calendar (..)\/(..)}}/ig) { $usethisentrymonthmonth = $1; $usethisentryyear = $2; open (FUNNYFEETKALI, "./gm-entrylist.cgi") || &gm_dangermouse("Can't read the entry list file. Please make sure that gm-entrylist.cgi is in the same directory as all your other Greymatter files and is CHMODed to 666; also, try running Diagnostics & Repair in the Configuration screen."); @loglistloglines = ; close (FUNNYFEETKALI); $gotthecalendarmonth = "no"; foreach $thisloglistline (@loglistloglines) { ($loglistnumber, $loglistauthor, $loglistsubject, $loglistdate, $loglisttimeampm, $loglistopenstatus, $loglistmorestatus, $loglistentrymusic, $loglistentrymood, $loglistemoticonstatus) = split (/\|/, $thisloglistline); &gm_getloglistvariables; if (($loglistmonthmonth eq $usethisentrymonthmonth) && ($loglistyear eq $usethisentryyear) && ($gotthecalendarmonth eq "no")) { $usethisentryweekdaynumber = $loglistentryweekdaynumber; $usethisentryday = $loglistday; $usethisentrymonth = $loglistmonth; $usethisentrymonthword = $loglistmonthword; $usethisentryyearyear = $loglistyearyear; &gm_generatecalendar; $entryreturn =~ s/{{calendar $usethisentrymonthmonth\/$usethisentryyear}}/$calendarfull/gi; $gotthecalendarmonth = "yes"; } } if ($entryreturn =~ m/{{calendar $usethisentrymonthmonth\/$usethisentryyear}}/i) { $entryreturn =~ s/{{calendar $usethisentrymonthmonth\/$usethisentryyear}}//gi; } } } # emoticons can be off, so we provide {{smartemoticonscode}} to print them only when they are needed/wanted: linear 9/23/2003 # merged in 1.3 # merged 9/23/2003 if (($entryreturn =~ m/{{commentdivider}}/i) || ($entryreturn =~ m/{{entrycommentsform}}/i) || ($entryreturn =~ m/{{entrykarmaform}}/i) || ($entryreturn =~ m/{{searchform}}/i)) { $entryreturn =~ s/{{commentdivider}}/$thisentrycommentdivider/gi; $entryreturn =~ s/{{entrycommentsform}}/$thisentrycommentsform/gi; $entryreturn =~ s/{{entrykarmaform}}/$thisentrykarmaform/gi; $entryreturn =~ s/{{searchform}}/$thisentrysearchform/gi; } #merged 9/29/2003 # added by flipped cracker # version 1.3 ## autolinkentry functionality removed from 1.3.1. linear 2/19/2004 # merged in version 1.3 if ($entryreturn =~ m/{{entry/i) { $entryreturn =~ s/{{entrymainbody}}/$thisentrymainbody/gi; $entryreturn =~ s/{{entrymorebody}}/$thisentrymorebody/gi; $entryreturn =~ s/{{entrycomments}}/$thisentrycomments/gi; if ($entryreturn =~ m/{{entrymainbodyfirstwords (\d+)}}/i) { until ($entryreturn !~ m/{{entrymainbodyfirstwords (\d+)}}/isg) { $firstwordscount = $1; $grabmainbodywords = $thisentrymainbody; if ($grabmainbodywords =~ m/{{link/i) { $grabmainbodywords =~ s/({{linkmo) (http|https|ftp)(:\/\/\S+?) (.+?)(\|)(.+?)(}})/$4/isg; $grabmainbodywords =~ s/({{link) (http|https|ftp)(:\/\/\S+?)(}})/$2$3/isg; $grabmainbodywords =~ s/({{link) (http|https|ftp)(:\/\/\S+?) (.+?)(}})/$4/isg; ########################################################### # 9/2/2001 - CHERYL LAMBERT # ADDED {{linkblank}} TEMPLATE VARIABLE SO THAT I CAN USE target="_blank" TO OPEN NEW WINDOWS $grabmainbodywords =~ s/({{linkblankmo) (http|https|ftp)(:\/\/\S+?) (.+?)(\|)(.+?)(}})/$4/isg; $grabmainbodywords =~ s/({{linkblank) (http|https|ftp)(:\/\/\S+?)(}})/$2$3/isg; $grabmainbodywords =~ s/({{linkblank) (http|https|ftp)(:\/\/\S+?) (.+?)(}})/$4/isg; ########################################################### } if ($grabmainbodywords =~ m/{{email/i) { $grabmainbodywords =~ s/({{emailmo) (\S+\@\S+?) (.+?)(\|)(.+?)(}})/$3/isg; $grabmainbodywords =~ s/({{email) (\S+\@\S+?)(}})/$2/isg; $grabmainbodywords =~ s/({{email) (\S+\@\S+?) (.+?)(}})/$3/isg; } $grabmainbodywords =~ s/<([^>]|\n)*>/ /g; $grabmainbodywords =~ s/{{(.*?)}}/ /g; $grabmainbodywords =~ s/\n/ /g; $grabmainbodywords =~ s/\r/ /g; $grabmainbodywords =~ s/\|\*\|/ /g; $grabmainbodywords =~ s/^\s+//; $grabmainbodywords =~ s/\s+$//; $grabmainbodywords =~ s/\s{2,}/ /g; @grabmainbodywordslist = split (/ /, $grabmainbodywords); $countwordsfromhere = 0; (@finalmainbodywordslist, @finalmainbodywordslist = ()); if ($firstwordscount < 1) { $firstwordscount = 1; } do { $finalmainbodywordslist[$countwordsfromhere] = $grabmainbodywordslist[$countwordsfromhere]; $countwordsfromhere++; } until $countwordsfromhere eq $firstwordscount; $finalmainbodyfirstwords = join (" ", @finalmainbodywordslist); $finalmainbodyfirstwords =~ s/^\s+//; $finalmainbodyfirstwords =~ s/\s+$//; $finalmainbodyfirstwords =~ s/\s{2,}//g; if (substr($finalmainbodyfirstwords, -1) =~ /\W/) { chop($finalmainbodyfirstwords); } if (substr($finalmainbodyfirstwords, -1) eq / /) { chop($finalmainbodyfirstwords); } $entryreturn =~ s/{{entrymainbodyfirstwords ($firstwordscount)}}/$finalmainbodyfirstwords/isg; } } if ($entryreturn =~ m/{{entrymorebodyfirstwords (\d+)}}/i) { until ($entryreturn !~ m/{{entrymorebodyfirstwords (\d+)}}/isg) { $firstwordscount = $1; if ($thisentrymorebody eq "") { $entryreturn =~ s/{{entrymorebodyfirstwords ($firstwordscount)}}//isg; } else { $grabmorebodywords = $thisentrymorebody; if ($grabmorebodywords =~ m/{{link/i) { $grabmorebodywords =~ s/({{linkmo) (http|https|ftp)(:\/\/\S+?) (.+?)(\|)(.+?)(}})/$4/isg; $grabmorebodywords =~ s/({{link) (http|https|ftp)(:\/\/\S+?)(}})/$2$3/isg; $grabmorebodywords =~ s/({{link) (http|https|ftp)(:\/\/\S+?) (.+?)(}})/$4/isg; ########################################################### # 9/2/2001 - CHERYL LAMBERT # ADDED {{linkblank}} TEMPLATE VARIABLE SO THAT I CAN USE target="_blank" TO OPEN NEW WINDOWS $grabmorebodywords =~ s/({{linkblankmo) (http|https|ftp)(:\/\/\S+?) (.+?)(\|)(.+?)(}})/$4/isg; $grabmorebodywords =~ s/({{linkblank) (http|https|ftp)(:\/\/\S+?)(}})/$2$3/isg; $grabmorebodywords =~ s/({{linkblank) (http|https|ftp)(:\/\/\S+?) (.+?)(}})/$4/isg; ########################################################### } if ($grabmorebodywords =~ m/{{email/i) { $grabmorebodywords =~ s/({{emailmo) (\S+\@\S+?) (.+?)(\|)(.+?)(}})/$3/isg; $grabmorebodywords =~ s/({{email) (\S+\@\S+?)(}})/$2/isg; $grabmorebodywords =~ s/({{email) (\S+\@\S+?) (.+?)(}})/$3/isg; } $grabmorebodywords =~ s/<([^>]|\n)*>/ /g; $grabmorebodywords =~ s/{{(.*?)}}/ /g; $grabmorebodywords =~ s/\n/ /g; $grabmorebodywords =~ s/\r/ /g; $grabmorebodywords =~ s/\|\*\|/ /g; $grabmorebodywords =~ s/^\s+//; $grabmorebodywords =~ s/\s+$//; $grabmorebodywords =~ s/\s{2,}/ /g; @grabmorebodywordslist = split (/ /, $grabmorebodywords); $countwordsfromhere = 0; (@finalmorebodywordslist, @finalmorebodywordslist = ()); if ($firstwordscount < 1) { $firstwordscount = 1; } do { $finalmorebodywordslist[$countwordsfromhere] = $grabmorebodywordslist[$countwordsfromhere]; $countwordsfromhere++; } until $countwordsfromhere eq $firstwordscount; $finalmorebodyfirstwords = join (" ", @finalmorebodywordslist); $finalmorebodyfirstwords =~ s/^\s+//; $finalmorebodyfirstwords =~ s/\s+$//; $finalmorebodyfirstwords =~ s/\s{2,}//g; if (substr($finalmorebodyfirstwords, -1) =~ /\W/) { chop($finalmorebodyfirstwords); } if (substr($finalmorebodyfirstwords, -1) eq / /) { chop($finalmorebodyfirstwords); } $entryreturn =~ s/{{entrymorebodyfirstwords ($firstwordscount)}}/$finalmorebodyfirstwords/isg; } } } } if (($entryreturn =~ m/link}}/i) || ($entryreturn =~ m/{{morepreface}}/i)) { $entryreturn =~ s/{{morepreface}}/$thisentrymorepreface/gi; $entryreturn =~ s/{{morelink}}/$thisentrymorelink/gi; $entryreturn =~ s/{{karmalink}}/$thisentrykarmalink/gi; $entryreturn =~ s/{{commentslink}}/$thisentrycommentslink/gi; $entryreturn =~ s/{{pagelink}}/$thisentrypagelink/gi; $entryreturn =~ s/{{pageindexlink}}/$thisentrypageindexlink/gi; $entryreturn =~ s/{{pagearchiveindexlink}}/$thisentrypagearchiveindexlink/gi; $entryreturn =~ s/{{pagearchivelogindexlink}}/$thisentrypagearchivelogindexlink/gi; $entryreturn =~ s/{{pagesmartindexlink}}/$thisentrypagesmartindexlink/gi; $entryreturn =~ s/{{commentspostlink}}/$thisentrycommentspostlink/gi; $entryreturn =~ s/{{authorsmartlink}}/$thisentryauthorsmartlink/gi; } if (($entryreturn =~ m/karma}}/i) || ($entryreturn =~ m/karmalink}}/i)) { $entryreturn =~ s/{{positivekarmalink}}/$thisentrypositivekarmalink/gi; $entryreturn =~ s/{{negativekarmalink}}/$thisentrynegativekarmalink/gi; $entryreturn =~ s/{{positivekarma}}/$thisentrypositivekarma/gi; $entryreturn =~ s/{{negativekarma}}/$thisentrynegativekarma/gi; $entryreturn =~ s/{{totalkarma}}/$thisentrytotalkarma/gi; } # added in 1.3.1 : flipped cracker 1/18/2005 if ($entryreturn =~ m/{{smart/i) { # smartentrymusic and smartentrymood templates: linear 9/20/2003 # merged in 1.3 if ($thisentrymusic ne "") { $entryreturn =~ s/{{smartentrymusic}}/$gmsmartentrymusictemplate/gi; } else { $entryreturn =~ s/{{smartentrymusic}}//gi; } if ($thisentrymood ne "") { $entryreturn =~ s/{{smartentrymood}}/$gmsmartentrymoodtemplate/gi; } else { $entryreturn =~ s/{{smartentrymood}}//gi; } # merged 9/20/2003 } # added 1/18/2005 if ($entryreturn =~ m/{{entry/i) { $entryreturn =~ s/{{entrysubject}}/$thisentrysubject/gi; ########################################################### # 9/3/2001 - CHERYL LAMBERT # ADDED 1 TEMPLATE VARIABLE SO THAT I CAN STRIP THE HTML CODE FROM THE ENTRYSUBJECT # WHEN IT IS USED IN THE TAG my $thisentrysubjectstripped = $thisentrysubject; $thisentrysubjectstripped =~ s/<.*?>//gi; $thisentrysubjectstripped =~ s/<\/.*?>//gi; $entryreturn =~ s/{{entrysubjectstripped}}/$thisentrysubjectstripped/gi; ########################################################### $entryreturn =~ s/{{entrynumber}}/$thisentrynumber/gi; $entryreturn =~ s/{{entrynumberpadded}}/$thisentrynumberpadded/gi; # added by flipped cracker 09/12/03 # version 1.3 $entryreturn =~ s/{{entrymusic}}/$thisentrymusic/gi; $thisentrymood = &gm_emoticons($thisentrymood); $entryreturn =~ s/{{entrymood}}/$thisentrymood/gi; # end additions } if ($entryreturn =~ m/{{author/i) { $entryreturn =~ s/{{author}}/$thisentryauthor/gi; $entryreturn =~ s/{{authoremail}}/$thisentryauthoremail/gi; $entryreturn =~ s/{{authorhomepage}}/$thisentryauthorhomepage/gi; $entryreturn =~ s/{{authorentrycount}}/$thisentryauthorentrycount/gi; } if (($entryreturn =~ m/{{authoremail /i) || ($entryreturn =~ m/{{authorhomepage /i) || ($entryreturn =~ m/{{authorentrycount /i) || ($entryreturn =~ m/{{authoremaillink /i) || ($entryreturn =~ m/{{authorhomepagelink /i) || ($entryreturn =~ m/{{authorsmartlink /i)) { &gm_generateexternalauthorvariables; } if ($entryreturn =~ m/{{comments/i) { $entryreturn =~ s/{{commentstatussmart}}/$thisentrycommentstatussmart/gi; $entryreturn =~ s/{{commentstatussmartupper}}/$thisentrycommentstatussmartupper/gi; $entryreturn =~ s/{{commentstatussmartlower}}/$thisentrycommentstatussmartlower/gi; $entryreturn =~ s/{{commentsnumber}}/$thisentrycommentsnumber/gi; } if (($entryreturn =~ m/{{day/i) || ($entryreturn =~ m/{{month/i) || ($entryreturn =~ m/{{year/i) || ($entryreturn =~ m/{{hour/i) || ($entryreturn =~ m/{{minute/i) || ($entryreturn =~ m/{{second/i) || ($entryreturn =~ m/{{weekday/i) || ($entryreturn =~ m/{{militaryhour}}/i) || ($entryreturn =~ m/{{ampm/i) || ($entryreturn =~ m/{{timezone}}/i)) { $entryreturn =~ s/{{day}}/$thisentryday/gi; $entryreturn =~ s/{{month}}/$thisentrymonth/gi; $entryreturn =~ s/{{year}}/$thisentryyear/gi; $entryreturn =~ s/{{hour}}/$thisentryhour/gi; $entryreturn =~ s/{{minute}}/$thisentryminute/gi; $entryreturn =~ s/{{second}}/$thisentrysecond/gi; $entryreturn =~ s/{{dayday}}/$thisentrydayday/gi; $entryreturn =~ s/{{monthmonth}}/$thisentrymonthmonth/gi; $entryreturn =~ s/{{yearyear}}/$thisentryyearyear/gi; $entryreturn =~ s/{{hourhour}}/$thisentryhourhour/gi; $entryreturn =~ s/{{minuteminute}}/$thisentryminuteminute/gi; $entryreturn =~ s/{{secondsecond}}/$thisentrysecondsecond/gi; $entryreturn =~ s/{{weekday}}/$thisentryweekday/gi; $entryreturn =~ s/{{weekdayshort}}/$thisentryweekdayshort/gi; $entryreturn =~ s/{{monthword}}/$thisentrymonthword/gi; $entryreturn =~ s/{{monthwordshort}}/$thisentrymonthwordshort/gi; $entryreturn =~ s/{{weekdayupper}}/$thisentryweekdayupper/gi; $entryreturn =~ s/{{monthwordupper}}/$thisentrymonthwordupper/gi; $entryreturn =~ s/{{weekdaylower}}/$thisentryweekdaylower/gi; $entryreturn =~ s/{{monthwordlower}}/$thisentrymonthwordlower/gi; $entryreturn =~ s/{{weekdayuppershort}}/$thisentryweekdayuppershort/gi; $entryreturn =~ s/{{monthworduppershort}}/$thisentrymonthworduppershort/gi; $entryreturn =~ s/{{weekdaylowershort}}/$thisentryweekdaylowershort/gi; $entryreturn =~ s/{{monthwordlowershort}}/$thisentrymonthwordlowershort/gi; $entryreturn =~ s/{{militaryhour}}/$thisentrymilitaryhour/gi; $entryreturn =~ s/{{ampm}}/$thisentryampm/gi; $entryreturn =~ s/{{ampmdot}}/$thisentryampmdot/gi; $entryreturn =~ s/{{ampmlower}}/$thisentryampmlower/gi; $entryreturn =~ s/{{ampmdotlower}}/$thisentryampmdotlower/gi; $entryreturn =~ s/{{timezone}}/$timezone/gi; # new ordinal numbers for {{dayappend}} variable: linear 9/15/2003 # merged in 1.3 $thisentrydayappend = &gm_toordinal($thisentryday); #merged 9/15/2003 # new {{dayappend}} variable:: linear 9/15/2003 # merged in 1.3 $thisentrydayappend = &gm_toordinal($thisentryday); $entryreturn =~ s/{{dayappend}}/$thisentrydayappend/gi; # merged 9/15/2003 } if (($entryreturn =~ m/{{weekbeginning/i) || ($entryreturn =~ m/{{weekending/i)) { $entryreturn =~ s/{{weekbeginningday}}/$thisentryweekbeginningday/gi; $entryreturn =~ s/{{weekbeginningdayday}}/$thisentryweekbeginningdayday/gi; $entryreturn =~ s/{{weekbeginningmonth}}/$thisentryweekbeginningmonth/gi; $entryreturn =~ s/{{weekbeginningmonthmonth}}/$thisentryweekbeginningmonthmonth/gi; $entryreturn =~ s/{{weekbeginningyear}}/$thisentryweekbeginningyear/gi; $entryreturn =~ s/{{weekbeginningyearyear}}/$thisentryweekbeginningyearyear/gi; $entryreturn =~ s/{{weekbeginningweekday}}/$thisentryweekbeginningweekday/gi; $entryreturn =~ s/{{weekbeginningweekdayshort}}/$thisentryweekbeginningweekdayshort/gi; $entryreturn =~ s/{{weekbeginningmonthword}}/$thisentryweekbeginningmonthword/gi; $entryreturn =~ s/{{weekbeginningmonthwordshort}}/$thisentryweekbeginningmonthwordshort/gi; $entryreturn =~ s/{{weekbeginningweekdayupper}}/$thisentryweekbeginningweekdayupper/gi; $entryreturn =~ s/{{weekbeginningmonthwordupper}}/$thisentryweekbeginningmonthwordupper/gi; $entryreturn =~ s/{{weekbeginningweekdaylower}}/$thisentryweekbeginningweekdaylower/gi; $entryreturn =~ s/{{weekbeginningmonthwordlower}}/$thisentryweekbeginningmonthwordlower/gi; $entryreturn =~ s/{{weekbeginningweekdayuppershort}}/$thisentryweekbeginningweekdayuppershort/gi; $entryreturn =~ s/{{weekbeginningmonthworduppershort}}/$thisentryweekbeginningmonthworduppershort/gi; $entryreturn =~ s/{{weekbeginningweekdaylowershort}}/$thisentryweekbeginningweekdaylowershort/gi; $entryreturn =~ s/{{weekbeginningmonthwordlowershort}}/$thisentryweekbeginningmonthwordlowershort/gi; $entryreturn =~ s/{{weekendingday}}/$thisentryweekendingday/gi; $entryreturn =~ s/{{weekendingdayday}}/$thisentryweekendingdayday/gi; $entryreturn =~ s/{{weekendingmonth}}/$thisentryweekendingmonth/gi; $entryreturn =~ s/{{weekendingmonthmonth}}/$thisentryweekendingmonthmonth/gi; $entryreturn =~ s/{{weekendingyear}}/$thisentryweekendingyear/gi; $entryreturn =~ s/{{weekendingyearyear}}/$thisentryweekendingyearyear/gi; $entryreturn =~ s/{{weekendingweekday}}/$thisentryweekendingweekday/gi; $entryreturn =~ s/{{weekendingweekdayshort}}/$thisentryweekendingweekdayshort/gi; $entryreturn =~ s/{{weekendingmonthword}}/$thisentryweekendingmonthword/gi; $entryreturn =~ s/{{weekendingmonthwordshort}}/$thisentryweekendingmonthwordshort/gi; $entryreturn =~ s/{{weekendingweekdayupper}}/$thisentryweekendingweekdayupper/gi; $entryreturn =~ s/{{weekendingmonthwordupper}}/$thisentryweekendingmonthwordupper/gi; $entryreturn =~ s/{{weekendingweekdaylower}}/$thisentryweekendingweekdaylower/gi; $entryreturn =~ s/{{weekendingmonthwordlower}}/$thisentryweekendingmonthwordlower/gi; $entryreturn =~ s/{{weekendingweekdayuppershort}}/$thisentryweekendingweekdayuppershort/gi; $entryreturn =~ s/{{weekendingmonthworduppershort}}/$thisentryweekendingmonthworduppershort/gi; $entryreturn =~ s/{{weekendingweekdaylowershort}}/$thisentryweekendingweekdaylowershort/gi; $entryreturn =~ s/{{weekendingmonthwordlowershort}}/$thisentryweekendingmonthwordlowershort/gi; } if ($entryreturn =~ m/{{link/i) { $entryreturn =~ s/({{linkmo) (http|https|ftp)(:\/\/\S+?) (.+?)(\|)(.+?)(}})/<a href="$2$3" onmouseover="window.status='$6';return true" onmouseout="window.status='';return true">$4<\/a>/isg; $entryreturn =~ s/({{link) (http|https|ftp)(:\/\/\S+?)(}})/<a href="$2$3">$2$3<\/a>/isg; $entryreturn =~ s/({{link) (http|https|ftp)(:\/\/\S+?) (.+?)(}})/<a href="$2$3">$4<\/a>/isg; ########################################################### # 9/2/2001 - CHERYL LAMBERT # ADDED {{linkblank}} TEMPLATE VARIABLE SO THAT I CAN USE target="_blank" TO OPEN NEW WINDOWS $entryreturn =~ s/({{linkblankmo) (http|https|ftp)(:\/\/\S+?) (.+?)(\|)(.+?)(}})/<A HREF="$2$3" onMouseOver="window.status='$6';return true" onMouseOut="window.status='';return true" target="_blank">$4<\/A>/isg; $entryreturn =~ s/({{linkblank) (http|https|ftp)(:\/\/\S+?)(}})/<A HREF="$2$3" target="_blank">$2$3<\/A>/isg; $entryreturn =~ s/({{linkblank) (http|https|ftp)(:\/\/\S+?) (.+?)(}})/<A HREF="$2$3" target="_blank">$4<\/A>/isg; ########################################################### } if ($entryreturn =~ m/{{email/i) { $entryreturn =~ s/({{emailmo) (\S+\@\S+?) (.+?)(\|)(.+?)(}})/<a href="mailto:$2" onmouseover="window.status='$5';return true" onmouseout="window.status='';return true">$3<\/>/isg; $entryreturn =~ s/({{email) (\S+\@\S+?)(}})/<a href="mailto:$2">$2<\/a>/isg; $entryreturn =~ s/({{email) (\S+\@\S+?) (.+?)(}})/<a href="mailto:$2">$3<\/a>/isg; } if ($entryreturn =~ m/{{popup (\S+) (.+?) (\d+)x(\d+)}}/i) { until ($entryreturn !~ m/{{popup (\S+) (.+?) (\d+)x(\d+)}}/isg) { $popupfile = $1; $popuptitle = $2; $popupwidth = $3; $popupheight = $4; $popuphtmlfile = $1; $popuphtmlfile =~ s/\.(\S+)$//; $popuphtmlfile .= ".$entrysuffix"; $popuppage = $gmpopuppagetemplate; $popupcode = $gmpopupcodetemplate; $popuppage =~ s/{{popupfile}}/$popupfile/gi; $popuppage =~ s/{{popuphtmlfile}}/$popuphtmlfile/gi; $popuppage =~ s/{{popuptitle}}/$popuptitle/gi; $popuppage =~ s/{{popupwidth}}/$popupwidth/gi; $popuppage =~ s/{{popupheight}}/$popupheight/gi; $popupcode =~ s/{{popupfile}}/$popupfile/gi; $popupcode =~ s/{{popuphtmlfile}}/$popuphtmlfile/gi; $popupcode =~ s/{{popuptitle}}/$popuptitle/gi; $popupcode =~ s/{{popupwidth}}/$popupwidth/gi; $popupcode =~ s/{{popupheight}}/$popupheight/gi; $popuppage =~ s/{{cgiwebpath}}/$cgiwebpath/gi; $popuppage =~ s/{{entrieswebpath}}/$EntriesWebPath/gi; $popuppage =~ s/{{logwebpath}}/$LogWebPath/gi; $popuppage =~ s/{{emoticonspath}}/$emoticonspath/gi; open (FUNNYFEETWAGS, "./gm-entrylist.cgi") || &gm_dangermouse("Can't read the entry list file. Please make sure that gm-entrylist.cgi is in the same directory as all your other Greymatter files and is CHMODed to 666; also, try running Diagnostics & Repair in the Configuration screen."); @loglistloglines = <FUNNYFEETWAGS>; close (FUNNYFEETWAGS); $foundpopupmatch = "no"; foreach $thisloglistline (@loglistloglines) { chomp ($thisloglistline); ($loglistnumber, $loglistauthor, $loglistsubject, $loglistdate, $loglisttimeampm, $loglistopenstatus, $loglistmorestatus) = split (/\|/, $thisloglistline); if (($thisentrynumber eq $loglistnumber) && ($foundpopupmatch eq "no")) { &gm_getloglistvariables; $foundpopupmatch = "yes"; } } $listsubsub = $popuppage; &entrylistsubsub; open (POPUPVIDEO, ">$EntriesPath/$popuphtmlfile") || &gm_dangermouse("Can't write to $EntriesPath/$popuphtmlfile. Please make sure your entries/archives directory is correctly set and is CHMODed to 777; also, try running Diagnostics & Repair in the Configuration screen."); print POPUPVIDEO $listsubsub; close (POPUPVIDEO); $listsubsub = $popupcode; &entrylistsubsub; $entryreturn =~ s/{{popup $popupfile $popuptitle ($popupwidth)x($popupheight)}}/$listsubsub/isg; } } if (($entryreturn =~ m/{{previous/i) || ($entryreturn =~ m/{{next/i)) { open (FUNNYFEETSCRATCH, "./gm-entrylist.cgi") || &gm_dangermouse("Can't read the entry list file. Please make sure that gm-entrylist.cgi is in the same directory as all your other Greymatter files and is CHMODed to 666; also, try running Diagnostics & Repair in the Configuration screen."); @checkingloglistloglines = <FUNNYFEETSCRATCH>; close (FUNNYFEETSCRATCH); $entryreturn =~ s/{{previousmore/{{moreprevious/isg; $entryreturn =~ s/{{nextmore/{{morenext/isg; if ($thisentrynumber ne "1") { $thispreviousentrynumber = $thisentrynumber - 1; $foundregular = "no"; $foundmore = "no"; $foundboth = "no"; do { foreach $thisloglistline (@checkingloglistloglines) { chomp ($thisloglistline); ($loglistnumber, $loglistauthor, $loglistsubject, $loglistdate, $loglisttimeampm, $loglistopenstatus, $loglistmorestatus) = split (/\|/, $thisloglistline); if (($thispreviousentrynumber eq $loglistnumber) && ($loglistnumber < $thisentrynumber) && ($foundregular eq "no") && ($loglistopenstatus ne "C")) { $entryreturn =~ s/{{previouslink}}/$gmpreviouslinktemplate/isg; &gm_getloglistvariables; $listsubsub = $entryreturn; $listsubsub =~ s/{{previous/{{/isg; &entrylistsubsub; $entryreturn = $listsubsub; $foundregular = "yes"; } if (($thispreviousentrynumber eq $loglistnumber) && ($loglistmorestatus eq "Y") && ($loglistnumber < $thisentrynumber) && ($foundmore eq "no") && ($loglistopenstatus ne "C")) { $entryreturn =~ s/{{morepreviouslink}}/$gmpreviousmorelinktemplate/isg; $entryreturn =~ s/{{previousmore/{{moreprevious/isg; &gm_getloglistvariables; $listsubsub = $entryreturn; $listsubsub =~ s/{{moreprevious/{{/isg; &entrylistsubsub; $entryreturn = $listsubsub; $foundmore = "yes"; } } if (($foundregular eq "yes") && ($foundmore eq "yes")) { $foundboth = "yes"; } if ($thispreviousentrynumber eq "1") { $foundboth = "yes"; } $thispreviousentrynumber--; } until $foundboth eq "yes"; } if ($thisentrynumber ne $newentrynumber) { @checkingloglistloglines = reverse @checkingloglistloglines; $thisnextentrynumber = $thisentrynumber + 1; $foundregular = "no"; $foundmore = "no"; $foundboth = "no"; do { foreach $thisloglistline (@checkingloglistloglines) { chomp ($thisloglistline); ($loglistnumber, $loglistauthor, $loglistsubject, $loglistdate, $loglisttimeampm, $loglistopenstatus, $loglistmorestatus) = split (/\|/, $thisloglistline); if (($thisnextentrynumber eq $loglistnumber) && ($loglistnumber > $thisentrynumber) && ($foundregular eq "no") && ($loglistopenstatus ne "C")) { $entryreturn =~ s/{{nextlink}}/$gmnextlinktemplate/isg; &gm_getloglistvariables; $listsubsub = $entryreturn; $listsubsub =~ s/{{next/{{/isg; &entrylistsubsub; $entryreturn = $listsubsub; $foundregular = "yes"; } if (($thisnextentrynumber eq $loglistnumber) && ($loglistmorestatus eq "Y") && ($loglistnumber > $thisentrynumber) && ($foundmore eq "no") && ($loglistopenstatus ne "C")) { $entryreturn =~ s/{{morenextlink}}/$gmnextmorelinktemplate/isg; $entryreturn =~ s/{{nextmore/{{morenext/isg; &gm_getloglistvariables; $listsubsub = $entryreturn; $listsubsub =~ s/{{morenext/{{/isg; &entrylistsubsub; $entryreturn = $listsubsub; $foundmore = "yes"; } } if (($foundregular eq "yes") && ($foundmore eq "yes")) { $foundboth = "yes"; } if ($thisnextentrynumber eq $newentrynumber) { $foundboth = "yes"; } $thisnextentrynumber++; } until $foundboth eq "yes"; } $entryreturn =~ s/{{previouspagelink}}/$thisentrypagesmartindexlink/isg; $entryreturn =~ s/{{nextpagelink}}/$thisentrypagesmartindexlink/isg; $entryreturn =~ s/{{previousmorepagelink}}/$thisentrypagesmartindexlink/isg; $entryreturn =~ s/{{nextmorepagelink}}/$thisentrypagesmartindexlink/isg; $entryreturn =~ s/{{morepreviouspagelink}}/$thisentrypagesmartindexlink/isg; $entryreturn =~ s/{{morenextpagelink}}/$thisentrypagesmartindexlink/isg; $entryreturn =~ s/{{previouslink}}//isg; $entryreturn =~ s/{{nextlink}}//isg; if (($entryreturn =~ m/{{previous/i) || ($entryreturn =~ m/{{next/i)) { foreach $thisloglistline (@checkingloglistloglines) { chomp ($thisloglistline); ($loglistnumber, $loglistauthor, $loglistsubject, $loglistdate, $loglisttimeampm, $loglistopenstatus, $loglistmorestatus) = split (/\|/, $thisloglistline); if ($loglistnumber eq $thisentrynumber) { &gm_getloglistvariables; $listsubsub = $entryreturn; $listsubsub =~ s/{{previous/{{/isg; $listsubsub =~ s/{{next/{{/isg; &entrylistsubsub; $entryreturn = $listsubsub; } } } $entryreturn =~ s/{{morepagelink}}/$thisentrypagesmartindexlink/isg; } # enhanced escaping of metacharacters: linear 8/25/2003 # merged in 1.3 if ($entryreturn =~ m/window.status='(.*?)';/i) { $entryreturn =~ s/\(/GMLEFTPARENTHESES/g; $entryreturn =~ s/\)/GMRIGHTPARENTHESES/g; $entryreturn =~ s/\?/GMQUESTIONMARK/g; $entryreturn =~ s/\+/GMPLUS/g; $entryreturn =~ s/\[/GMLEFTSQUAREBRACKET/g; $entryreturn =~ s/\]/GMRIGHTSQUAREBRACKET/g; $entryreturn =~ s/\$/GMDOLLAR/g; $entryreturn =~ s/\^/GMCARET/g; $entryreturn =~ s/\|/GMPIPE/g; $entryreturn =~ s/\*/GMSPLAT/g; until ($entryreturn !~ m/window.status='(.*?)';/ig) { $windowstatusorigstring = $1; $windowstatusmiddlenew = $1; $windowstatusmiddlenew =~ s#'#\\'#isg; $windowstatusmiddlenew =~ s#"#\\'#isg; $entryreturn =~ s/window.status='$windowstatusorigstring';/WSPLACEHOLDER='$windowstatusmiddlenew';/isg; } $entryreturn =~ s/WSPLACEHOLDER=/window.status=/isg; $entryreturn =~ s/GMLEFTPARENTHESES/\(/g; $entryreturn =~ s/GMRIGHTPARENTHESES/\)/g; $entryreturn =~ s/GMQUESTIONMARK/\?/g; $entryreturn =~ s/GMPLUS/\+/g; $entryreturn =~ s/GMLEFTSQUAREBRACKET/\[/g; $entryreturn =~ s/GMRIGHTSQUAREBRACKET/\]/g; $entryreturn =~ s/GMDOLLAR/\$/g; $entryreturn =~ s/GMCARET/\^/g; $entryreturn =~ s/GMPIPE/\|/g; $entryreturn =~ s/GMSPLAT/\*/g; } # merged 9/11/2003 if ($entryreturn =~ m/{{randomnumber (\d+)-(\d+)}}/i) { until ($entryreturn !~ m/{{randomnumber (\d+)-(\d+)}}/isg) { $minrand = $1; $maxrand = $2; $maxtemprand = $maxrand - $minrand; $maxtemprand++; $randresult = int(rand $maxtemprand) + $minrand; $entryreturn =~ s/{{randomnumber ($minrand)-($maxrand)}}/$randresult/i; } } if (($entryreturn =~ m/{{cgiwebpath}}/i) || ($entryreturn =~ m/{{entrieswebpath}}/i) || ($entryreturn =~ m/{{logwebpath}}/i) || ($entryreturn =~ m/{{emoticonspath}}/i)) { $entryreturn =~ s/{{cgiwebpath}}/$cgiwebpath/gi; $entryreturn =~ s/{{entrieswebpath}}/$EntriesWebPath/gi; $entryreturn =~ s/{{logwebpath}}/$LogWebPath/gi; $entryreturn =~ s/{{emoticonspath}}/$emoticonspath/gi; } if (($entryreturn =~ m/{{gmversion}}/i) || ($entryreturn =~ m/{{gmicon}}/i)) { $entryreturn =~ s/{{gmversion}}/$gmversion/gi; $entryreturn =~ s/{{gmicon}}/<a href="http:\/\/www.greymatterforums.com\/" target="_top"><img border="0" src="$LogWebPath\/gm-icon.gif" alt="Powered By Greymatter" \/><\/a>/gi; } # new {{cookiescode}} template to facilitate setting cookies on commenters: linear 9/23/2003 # merged in 1.3 $entryreturn =~ s/{{cookiescode}}/$gmcookiescodetemplate/gi; # merged 9/23/2003 # added by flipped cracker 09/12/03 # version 1.3 $entryreturn =~ s/{{emoticonspath}}/$emoticonspath/gi; $entryreturn =~ s/{{entrysuffix}}/$entrysuffix/gi; $entryreturn =~ s/{{archivesuffix}}/$logarchivesuffix/gi; $entryreturn =~ s/{{domain}}/$domain/gi; # end additions # added by flipped cracker 1/26/05 # version 1.3.1 $entryreturn =~ s/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w{1,8});)/&/g; # end additions } # ---------------------------- # generate the main index file # ---------------------------- sub gm_generatemainindex { &gm_readconfig; &gm_readcounter; &gm_readtemplates; $indexlogbody = ""; $indexentrycounter = $newentrynumber; $indexcurrentdatemarker = "erewhon"; $indexcurrentdatescounted = 0; if ($newstayattopnumber ne "0") { &gm_getentryvariables($newstayattopnumber); if ($thisentryopenstatus eq "open") { &gm_formatentry($gmstayattoptemplate); $indexlogbody .= $entryreturn; } } do { &gm_getentryvariables($indexentrycounter); $datemark = "$thisentrymonth $thisentryday $thisentryyearyear"; if (($datemark ne $indexcurrentdatemarker) && ($thisentryopenstatus eq "open") && ($indexentrycounter ne $newstayattopnumber)) { $indexcurrentdatescounted++; if ($gmdatetemplate ne "") { $currentdatehead = $gmdatetemplate; $currentdatehead =~ s/{{day}}/$thisentryday/gi; $currentdatehead =~ s/{{dayday}}/$thisentrydayday/gi; $currentdatehead =~ s/{{year}}/$thisentryyear/gi; $currentdatehead =~ s/{{yearyear}}/$thisentryyearyear/gi; $currentdatehead =~ s/{{month}}/$thisentrymonth/gi; $currentdatehead =~ s/{{monthmonth}}/$thisentrymonthmonth/gi; $currentdatehead =~ s/{{weekday}}/$thisentryweekday/gi; $currentdatehead =~ s/{{weekdayshort}}/$thisentryweekdayshort/gi; $currentdatehead =~ s/{{monthword}}/$thisentrymonthword/gi; $currentdatehead =~ s/{{monthwordshort}}/$thisentrymonthwordshort/gi; $currentdatehead =~ s/{{weekdayupper}}/$thisentryweekdayupper/gi; $currentdatehead =~ s/{{monthwordupper}}/$thisentrymonthwordupper/gi; $currentdatehead =~ s/{{weekdaylower}}/$thisentryweekdaylower/gi; $currentdatehead =~ s/{{monthwordlower}}/$thisentrymonthwordlower/gi; $currentdatehead =~ s/{{weekdayuppershort}}/$thisentryweekdayuppershort/gi; $currentdatehead =~ s/{{monthworduppershort}}/$thisentrymonthworduppershort/gi; $currentdatehead =~ s/{{weekdaylowershort}}/$thisentryweekdaylowershort/gi; $currentdatehead =~ s/{{monthwordlowershort}}/$thisentrymonthwordlowershort/gi; # new {{dayappend}} variable: linear 9/15/2003 # merged in 1.3 $thisentrydayappend = &gm_toordinal($thisentryday); $currentdatehead =~ s/{{dayappend}}/$thisentrydayappend/gi; # merged 9/15/2003 unless ($indexcurrentdatescounted > $indexdays) { $indexlogbody .= $currentdatehead; # added new $dategrouping flag : 1.3.1 # flipped cracker 6/29/2004 $dategrouping = "open"; } } $indexcurrentdatemarker = "$thisentrymonth $thisentryday $thisentryyearyear"; } else { if (($indexentrycounter ne $newstayattopnumber) && ($thisentryopenstatus eq "open") && ($indexcurrentdatescounted <= $indexdays) && ($gmentryseparatortemplate ne "")) { $indexlogbody .= $gmentryseparatortemplate; } } if (($indexentrycounter ne $newstayattopnumber) && ($thisentryopenstatus eq "open") && ($indexcurrentdatescounted <= $indexdays)) { if ($thisentrymorebody ne "") { &gm_formatentry($gmmoreentrytemplate); } else { &gm_formatentry($gmentrytemplate); } $indexlogbody .= $entryreturn; } # new date grouping footer template in 1.3: linear 9/18/2003 # merged in 1.3 if ($indexentrycounter > 1) { &gm_getentryvariables($indexentrycounter - 1); # look at the last open entry $nextdatemark = "$thisentrymonth $thisentryday $thisentryyearyear"; $nextentryopenstatus = $thisentryopenstatus; &gm_getentryvariables($indexentrycounter); # look at the current entry again # this logic was in error, fixed in 1.3.1 linear 2/19/2004 # also fixed by flipped cracker 6/29/2004 # added $dategrouping flag checking # merged in 1.3.1 # if (($nextdatemark ne $indexcurrentdatemarker) && ($dategrouping eq "open") && ($nextentryopenstatus eq "open") && ($indexentrycounter ne $newstayattopnumber)) { # if (($nextdatemark ne $indexcurrentdatemarker) && ($thisentryopenstatus eq "open") && ($indexentrycounter ne $newstayattopnumber)) { # merged 2/19/2004 if ($gmdategroupingfootertemplate ne "") { $currentdatefoot = $gmdategroupingfootertemplate; $currentdatefoot =~ s/{{day}}/$thisentryday/gi; $currentdatefoot =~ s/{{dayday}}/$thisentrydayday/gi; $currentdatefoot =~ s/{{year}}/$thisentryyear/gi; $currentdatefoot =~ s/{{yearyear}}/$thisentryyearyear/gi; $currentdatefoot =~ s/{{month}}/$thisentrymonth/gi; $currentdatefoot =~ s/{{monthmonth}}/$thisentrymonthmonth/gi; $currentdatefoot =~ s/{{weekday}}/$thisentryweekday/gi; $currentdatefoot =~ s/{{weekdayshort}}/$thisentryweekdayshort/gi; $currentdatefoot =~ s/{{monthword}}/$thisentrymonthword/gi; $currentdatefoot =~ s/{{monthwordshort}}/$thisentrymonthwordshort/gi; $currentdatefoot =~ s/{{weekdayupper}}/$thisentryweekdayupper/gi; $currentdatefoot =~ s/{{monthwordupper}}/$thisentrymonthwordupper/gi; $currentdatefoot =~ s/{{weekdaylower}}/$thisentryweekdaylower/gi; $currentdatefoot =~ s/{{monthwordlower}}/$thisentrymonthwordlower/gi; $currentdatefoot =~ s/{{weekdayuppershort}}/$thisentryweekdayuppershort/gi; $currentdatefoot =~ s/{{monthworduppershort}}/$thisentrymonthworduppershort/gi; $currentdatefoot =~ s/{{weekdaylowershort}}/$thisentryweekdaylowershort/gi; $currentdatefoot =~ s/{{monthwordlowershort}}/$thisentrymonthwordlowershort/gi; # new {{dayappend}} variable: linear 9/15/2003 # merged in 1.3 $thisentrydayappend = &gm_toordinal($thisentryday); $currentdatefoot =~ s/{{dayappend}}/$thisentrydayappend/gi; # merged 9/15/2003 unless ($indexcurrentdatescounted > $indexdays) { $indexlogbody .= $currentdatefoot; # added $dategrouping flag : 1.3.1 # flipped cracker 6/29/2004 $dategrouping = "closed"; } } } } # merged 9/18/2003 $indexentrycounter--; if ($indexentrycounter eq "0") { if ($indexcurrentdatescounted > $indexdays) { $indexentrycounter++; } $indexcurrentdatescounted = $indexdays + 1; } if (($newstayattopnumber eq "1") && ($newentrynumber eq "1")) { $indexcurrentdatescounted = $indexdays + 1; } if ($indexcurrentdatescounted > $indexdays) { if ($indexentrycounter < 0) { $indexentrycounter = 0; } unless ($indexentrycounter eq "0") { $indexentrycounter = $thisentrynumber; } } } until $indexcurrentdatescounted > $indexdays; # added $dategrouping flag checking : 1.3.1 # flipped cracker 6/29/2004 if ( ($gmdategroupingfootertemplate ne "") && ($dategrouping eq "open") ) { $currentdatefoot = $gmdategroupingfootertemplate; $currentdatefoot =~ s/{{day}}/$thisentryday/gi; $currentdatefoot =~ s/{{dayday}}/$thisentrydayday/gi; $currentdatefoot =~ s/{{year}}/$thisentryyear/gi; $currentdatefoot =~ s/{{yearyear}}/$thisentryyearyear/gi; $currentdatefoot =~ s/{{month}}/$thisentrymonth/gi; $currentdatefoot =~ s/{{monthmonth}}/$thisentrymonthmonth/gi; $currentdatefoot =~ s/{{weekday}}/$thisentryweekday/gi; $currentdatefoot =~ s/{{weekdayshort}}/$thisentryweekdayshort/gi; $currentdatefoot =~ s/{{monthword}}/$thisentrymonthword/gi; $currentdatefoot =~ s/{{monthwordshort}}/$thisentrymonthwordshort/gi; $currentdatefoot =~ s/{{weekdayupper}}/$thisentryweekdayupper/gi; $currentdatefoot =~ s/{{monthwordupper}}/$thisentrymonthwordupper/gi; $currentdatefoot =~ s/{{weekdaylower}}/$thisentryweekdaylower/gi; $currentdatefoot =~ s/{{monthwordlower}}/$thisentrymonthwordlower/gi; $currentdatefoot =~ s/{{weekdayuppershort}}/$thisentryweekdayuppershort/gi; $currentdatefoot =~ s/{{monthworduppershort}}/$thisentrymonthworduppershort/gi; $currentdatefoot =~ s/{{weekdaylowershort}}/$thisentryweekdaylowershort/gi; $currentdatefoot =~ s/{{monthwordlowershort}}/$thisentrymonthwordlowershort/gi; # new {{dayappend}} variable: linear 9/15/2003 # merged in 1.3 $thisentrydayappend = &gm_toordinal($thisentryday); $currentdatefoot =~ s/{{dayappend}}/$thisentrydayappend/gi; # merged 9/15/2003 $indexlogbody .= $currentdatefoot; # added $dategrouping flag : 1.3.1 # flipped cracker 6/29/2004 $dategrouping = "closed"; } $newindexfile = $gmindextemplate; $newindexfile =~ s/{{logbody}}/$indexlogbody/gi; &gm_getentryvariables($newentrynumber); &gm_formatentry($newindexfile); open (THISFILECLAWS, ">$LogPath/$indexfilename") || &gm_dangermouse("Can't write to $LogPath/$indexfilename. Please make sure your paths are configured correctly and that $indexfilename is CHMODed to 666; also try running Diagnostics & Repair from the Configuration screen."); print THISFILECLAWS $entryreturn; close (THISFILECLAWS); $newarchivenumber = $indexentrycounter; &gm_writecounter; } # --------------------- # generate archive file # --------------------- sub gm_generatearchive { my $getstartnumber = shift; $startnumber = $getstartnumber; &gm_readconfig; &gm_readcounter; &gm_readtemplates; $indexarchivebody = ""; $indexentrycounter = $startnumber; $indexcurrentdatemarker = "erewhon"; $indexcurrentdatescounted = 0; &gm_getentryvariables($startnumber); $indexcurrentmonthcounter = $thisentrymonth; $indexcurrentweekcounter = "$thisentryweekbeginningdayday$thisentryweekendingdayday"; do { &gm_getentryvariables($indexentrycounter); $thisentryweek = "$thisentryweekbeginningdayday$thisentryweekendingdayday"; if (($generateentrypages eq "yes") && ($indexentrycounter eq $newarchivenumber)) { if ($thisentryopenstatus eq "open") { &gm_formatentry($gmarchiveentrypagetemplate); open (THISFILE, ">$EntriesPath/$thisentrynumberpadded.$entrysuffix") || &gm_dangermouse("Can't write to $EntriesPath/$thisentrynumberpadded.$entrysuffix. Please make sure that your entries/archives directory is correctly configured and is CHMODed to 777; also try running Diagnostics & Repair from the Configuration screen."); print THISFILE $entryreturn; close (THISFILE); } else { unlink ("$EntriesPath/$thisentrynumberpadded.$entrysuffix"); } } $datemark = "$thisentrymonth $thisentryday $thisentryyearyear"; if (($datemark ne $indexcurrentdatemarker) && ($thisentryopenstatus eq "open") && ($indexentrycounter ne $newstayattopnumber)) { $indexcurrentdatescounted++; if ($gmdatearchivetemplate ne "") { $currentdatehead = $gmdatearchivetemplate; $currentdatehead =~ s/{{day}}/$thisentryday/gi; $currentdatehead =~ s/{{dayday}}/$thisentrydayday/gi; $currentdatehead =~ s/{{year}}/$thisentryyear/gi; $currentdatehead =~ s/{{yearyear}}/$thisentryyearyear/gi; $currentdatehead =~ s/{{month}}/$thisentrymonth/gi; $currentdatehead =~ s/{{monthmonth}}/$thisentrymonthmonth/gi; $currentdatehead =~ s/{{weekday}}/$thisentryweekday/gi; $currentdatehead =~ s/{{weekdayshort}}/$thisentryweekdayshort/gi; $currentdatehead =~ s/{{monthword}}/$thisentrymonthword/gi; $currentdatehead =~ s/{{monthwordshort}}/$thisentrymonthwordshort/gi; $currentdatehead =~ s/{{weekdayupper}}/$thisentryweekdayupper/gi; $currentdatehead =~ s/{{monthwordupper}}/$thisentrymonthwordupper/gi; $currentdatehead =~ s/{{weekdaylower}}/$thisentryweekdaylower/gi; $currentdatehead =~ s/{{monthwordlower}}/$thisentrymonthwordlower/gi; $currentdatehead =~ s/{{weekdayuppershort}}/$thisentryweekdayuppershort/gi; $currentdatehead =~ s/{{monthworduppershort}}/$thisentrymonthworduppershort/gi; $currentdatehead =~ s/{{weekdaylowershort}}/$thisentryweekdaylowershort/gi; $currentdatehead =~ s/{{monthwordlowershort}}/$thisentrymonthwordlowershort/gi; # new {{dayappend}} variable: linear 9/15/2003 # merged in 1.3 $thisentrydayappend = &gm_toordinal($thisentryday); $currentdatehead =~ s/{{dayappend}}/$thisentrydayappend/gi; # merged 9/15/2003 if ($archiveformat eq "week") { unless ($thisentryweek ne $indexcurrentweekcounter) { $indexarchivebody .= $currentdatehead; # added $dategrouping flag : 1.3.1 # flipped cracker 6/29/2004 $dategrouping = "open"; } } else { unless ($thisentrymonth ne $indexcurrentmonthcounter) { $indexarchivebody .= $currentdatehead; # added $dategrouping flag : 1.3.1 # flipped cracker 6/29/2004 $dategrouping = "open"; } } } $indexcurrentdatemarker = "$thisentrymonth $thisentryday $thisentryyearyear"; } else { if ($archiveformat eq "week") { if (($thisentryopenstatus eq "open") && ($thisentryweek eq $indexcurrentweekcounter) && ($gmarchiveentryseparatortemplate ne "")) { $indexarchivebody .= $gmarchiveentryseparatortemplate; } } else { if (($thisentryopenstatus eq "open") && ($thisentrymonth eq $indexcurrentmonthcounter) && ($gmarchiveentryseparatortemplate ne "")) { $indexarchivebody .= $gmarchiveentryseparatortemplate; } } } if ($archiveformat eq "week") { if (($thisentryopenstatus eq "open") && ($thisentryweek eq $indexcurrentweekcounter)) { if ($thisentrymorebody ne "") { &gm_formatentry($gmmorearchiveentrytemplate); } else { &gm_formatentry($gmarchiveentrytemplate); } $indexarchivebody .= $entryreturn; } } else { if (($thisentryopenstatus eq "open") && ($thisentrymonth eq $indexcurrentmonthcounter)) { if ($thisentrymorebody ne "") { &gm_formatentry($gmmorearchiveentrytemplate); } else { &gm_formatentry($gmarchiveentrytemplate); } $indexarchivebody .= $entryreturn; } } # new date grouping footer template in 1.3: linear 9/18/2003 # merged in 1.3 if ($indexentrycounter > 1) { &gm_getentryvariables($indexentrycounter - 1); # look at the previous entry $nextdatemark = "$thisentrymonth $thisentryday $thisentryyearyear"; $nextentryopenstatus = $thisentryopenstatus; &gm_getentryvariables($indexentrycounter); # look at the current entry again # added $dategrouping flag checking : 1.3.1 # flipped cracker 6/29/2004 # Pete Finnigan 26-06-05 - fixed variable name dategrouping and removed space before "open" if (($nextdatemark ne $indexcurrentdatemarker) && ($dategrouping eq "open") && ($thisentryopenstatus eq "open") && ($indexentrycounter ne $newstayattopnumber)) { if ($gmdategroupingfooterarchivetemplate ne "") { $currentdatefoot = $gmdategroupingfooterarchivetemplate; $currentdatefoot =~ s/{{day}}/$thisentryday/gi; $currentdatefoot =~ s/{{dayday}}/$thisentrydayday/gi; $currentdatefoot =~ s/{{year}}/$thisentryyear/gi; $currentdatefoot =~ s/{{yearyear}}/$thisentryyearyear/gi; $currentdatefoot =~ s/{{month}}/$thisentrymonth/gi; $currentdatefoot =~ s/{{monthmonth}}/$thisentrymonthmonth/gi; $currentdatefoot =~ s/{{weekday}}/$thisentryweekday/gi; $currentdatefoot =~ s/{{weekdayshort}}/$thisentryweekdayshort/gi; $currentdatefoot =~ s/{{monthword}}/$thisentrymonthword/gi; $currentdatefoot =~ s/{{monthwordshort}}/$thisentrymonthwordshort/gi; $currentdatefoot =~ s/{{weekdayupper}}/$thisentryweekdayupper/gi; $currentdatefoot =~ s/{{monthwordupper}}/$thisentrymonthwordupper/gi; $currentdatefoot =~ s/{{weekdaylower}}/$thisentryweekdaylower/gi; $currentdatefoot =~ s/{{monthwordlower}}/$thisentrymonthwordlower/gi; $currentdatefoot =~ s/{{weekdayuppershort}}/$thisentryweekdayuppershort/gi; $currentdatefoot =~ s/{{monthworduppershort}}/$thisentrymonthworduppershort/gi; $currentdatefoot =~ s/{{weekdaylowershort}}/$thisentryweekdaylowershort/gi; $currentdatefoot =~ s/{{monthwordlowershort}}/$thisentrymonthwordlowershort/gi; # new {{dayappend}} variable: linear 9/15/2003 # merged in 1.3 $thisentrydayappend = &gm_toordinal($thisentryday); $currentdatehead =~ s/{{dayappend}}/$thisentrydayappend/gi; # merged 9/15/2003 $indexarchivebody .= $currentdatefoot; # added $dategrouping flag : 1.3.1 # flipped cracker 6/29/2004 $dategrouping = "closed"; } } } # merged 9/18/2003 $indexentrycounter--; if ($archiveformat eq "week") { if ($thisentryweek ne $indexcurrentweekcounter) { $indexcurrentmonthcounter = "finis"; } else { $indexcurrentmonthcounter = $thisentrymonth; } } if ($indexentrycounter eq "0") { $indexcurrentmonthcounter = "finis"; } } until $thisentrymonth ne $indexcurrentmonthcounter; # added $dategrouping flag checking : 1.3.1 # flipped cracker 6/29/2004 if ( ($gmdategroupingfootertemplate ne "") && ($dategrouping eq "open") ) { $currentdatefoot = $gmdategroupingfooterarchivetemplate; $currentdatefoot =~ s/{{day}}/$thisentryday/gi; $currentdatefoot =~ s/{{dayday}}/$thisentrydayday/gi; $currentdatefoot =~ s/{{year}}/$thisentryyear/gi; $currentdatefoot =~ s/{{yearyear}}/$thisentryyearyear/gi; $currentdatefoot =~ s/{{month}}/$thisentrymonth/gi; $currentdatefoot =~ s/{{monthmonth}}/$thisentrymonthmonth/gi; $currentdatefoot =~ s/{{weekday}}/$thisentryweekday/gi; $currentdatefoot =~ s/{{weekdayshort}}/$thisentryweekdayshort/gi; $currentdatefoot =~ s/{{monthword}}/$thisentrymonthword/gi; $currentdatefoot =~ s/{{monthwordshort}}/$thisentrymonthwordshort/gi; $currentdatefoot =~ s/{{weekdayupper}}/$thisentryweekdayupper/gi; $currentdatefoot =~ s/{{monthwordupper}}/$thisentrymonthwordupper/gi; $currentdatefoot =~ s/{{weekdaylower}}/$thisentryweekdaylower/gi; $currentdatefoot =~ s/{{monthwordlower}}/$thisentrymonthwordlower/gi; $currentdatefoot =~ s/{{weekdayuppershort}}/$thisentryweekdayuppershort/gi; $currentdatefoot =~ s/{{monthworduppershort}}/$thisentrymonthworduppershort/gi; $currentdatefoot =~ s/{{weekdaylowershort}}/$thisentryweekdaylowershort/gi; $currentdatefoot =~ s/{{monthwordlowershort}}/$thisentrymonthwordlowershort/gi; # new {{dayappend}} variable: linear 9/15/2003 # merged in 1.3 $thisentrydayappend = &gm_toordinal($thisentryday); $currentdatehead =~ s/{{dayappend}}/$thisentrydayappend/gi; # merged 9/15/2003 $indexarchivebody .= $currentdatefoot; # added $dategrouping flag : 1.3.1 # flipped cracker 6/29/2004 $dategrouping = "closed"; } $stoppednumber = $thisentrynumber; &gm_getentryvariables($startnumber); if ($archiveformat eq "week") { $usethisarchivefilename = "$EntriesPath/archive-$thisentryweekbeginningmonthmonth$thisentryweekbeginningdayday$thisentryweekbeginningyearyear-$thisentryweekendingmonthmonth$thisentryweekendingdayday$thisentryweekendingyearyear\.$logarchivesuffix"; } else { $usethisarchivefilename = "$EntriesPath/archive-$thisentrymonthmonth$thisentryyearyear\.$logarchivesuffix"; } $newarchivefile = $gmarchiveindextemplate; $newarchivefile =~ s/{{year}}/$thisentryyear/gi; $newarchivefile =~ s/{{yearyear}}/$thisentryyearyear/gi; $newarchivefile =~ s/{{month}}/$thisentrymonth/gi; $newarchivefile =~ s/{{monthmonth}}/$thisentrymonthmonth/gi; $newarchivefile =~ s/{{monthword}}/$thisentrymonthword/gi; $newarchivefile =~ s/{{monthwordshort}}/$thisentrymonthwordshort/gi; $newarchivefile =~ s/{{monthwordupper}}/$thisentrymonthwordupper/gi; $newarchivefile =~ s/{{monthwordlower}}/$thisentrymonthwordlower/gi; $newarchivefile =~ s/{{monthworduppershort}}/$thisentrymonthworduppershort/gi; $newarchivefile =~ s/{{monthwordlowershort}}/$thisentrymonthwordlowershort/gi; $newarchivefile =~ s/{{archivebody}}/$indexarchivebody/gi; $newarchivefile =~ s/{{logbody}}/$indexarchivebody/gi; &gm_formatentry($newarchivefile); ##if ($archiveformat eq "week") { ## $usethisarchivefilename = "$EntriesPath/archive-$thisentryweekbeginningmonthmonth$thisentryweekbeginningdayday$thisentryweekbeginningyearyear-$thisentryweekendingmonthmonth$thisentryweekendingdayday$thisentryweekendingyearyear\.$logarchivesuffix"; ##} else { ## $usethisarchivefilename = "$EntriesPath/archive-$thisentrymonthmonth$thisentryyearyear\.$logarchivesuffix"; ##} open (THISFILEPAWS, ">$usethisarchivefilename") || &gm_dangermouse("Can't write to $usethisarchivefilename. Please make sure that your entries/archives directory is correctly configured and is CHMODed to 777; also try running Diagnostics & Repair from the Configuration screen."); print THISFILEPAWS $entryreturn; close (THISFILEPAWS); chmod (0666, "$usethisarchivefilename"); } # ----------------------- # rebuild connected files # ----------------------- sub gm_rebuildconnectedfiles { @connectedfilelist = split (/\|\*\|/, $otherfilelist); @variabledatabase = ("{{header}}", "{{footer}}", "{{sidebar}}", "{{log", "{{calendar", "{{comment", "{{entry", "link}}", "karma}}", "{{author", "{{day", "{{month", "{{year", "{{hour", "{{minute", "{{second", "{{weekday", "{{militaryhour}}", "{{ampm", "{{timezone}}", "{{link", "{{email", "{{previous", "{{next", "webpath}}", "{{gm", "{{emoticonspath}}"); &gm_getentryvariables($newentrynumber); $connectedfilesdone = "no"; $connectstartfromhere = $IN{'connectednumber'}; if ($connectstartfromhere eq "") { $connectstartfromhere = 0; } $connectendhere = $connectstartfromhere + 9; if (($connectendhere > $#connectedfilelist) || ($connectendhere eq $#connectedfilelist)) { $connectendhere = $#connectedfilelist; $connectedfilesdone = "yes"; } $IN{'connectednumber'} = $connectendhere + 1; $connectcounter = 0; foreach $usethisfilename (@connectedfilelist) { unless (($connectcounter < $connectstartfromhere) || ($connectcounter > $connectendhere)) { $usethisfilenamestripped = $usethisfilename; $usethisfilenamestripped =~ s/\//BACKSLASH/g; $usethisfilenamestripped =~ s/\W//g; $usethisfilenamestripped =~ s/BACKSLASH/-/g; $thereisapattern = "no"; open (OTHERORIGFILE, "$usethisfilename") || &gm_dangermouse("Can't open $usethisfilename. Please make sure that this file exists and is CHMODed to 666, or else remove it from your list of connected files in configuration."); @otherorigfilelines = <OTHERORIGFILE>; close (OTHERORIGFILE); unless (!(open(CHECKTHISFILE,"$EntriesPath/$usethisfilenamestripped.cgi"))) { open (OTHERPATTERNFILE, "$EntriesPath/$usethisfilenamestripped.cgi") || &gm_dangermouse("Can't open $EntriesPath/$usethisfilenamestripped.cgi. Please make sure that your entries/archives directory is correctly configured and is CHMODed to 777; also try running Diagnostics & Repair from the Configuration screen."); @otherpatternfilelines = <OTHERPATTERNFILE>; close (OTHERPATTERNFILE); $thereisapattern = "yes"; } close(CHECKTHISFILE); $gmcounter = 0; foreach (@otherorigfilelines) { chomp ($otherorigfilelines[$gmcounter]); $gmcounter++; } $otherorigfilebody = join ("|*|", @otherorigfilelines); foreach $thisvariablecheck (@variabledatabase) { if ($otherorigfilebody =~ m/$thisvariablecheck/i) { $thereisapattern = "no"; } } unless ($thereisapattern eq "no") { $gmcounter = 0; foreach (@otherpatternfilelines) { chomp ($otherpatternfilelines[$gmcounter]); $gmcounter++; } $otherpatternfilebody = join ("|*|", @otherpatternfilelines); $otherfilebody = $otherpatternfilebody; } else { $otherfilebody = $otherorigfilebody; } $newfilebodypattern = $otherfilebody; &gm_formatentry($otherfilebody); $entryreturn =~ s/\|\*\|/\n/g; $newfilebodypattern =~ s/\|\*\|/\n/g; chmod (0666, "$usethisfilename"); open (OTHERFILEONE, ">$usethisfilename") || &gm_dangermouse("Can't write to $usethisfilename. Please make sure that this file exists and is CHMODed to 666, or else remove it from your list of connected files in configuration."); print OTHERFILEONE $entryreturn; close (OTHERFILEONE); open (OTHERFILETWO, ">$EntriesPath/$usethisfilenamestripped.cgi") || &gm_dangermouse("Can't write to $EntriesPath/$usethisfilenamestripped.cgi. Please make sure that your entries/archives directory is correctly configured and is CHMODed to 777; also try running Diagnostics & Repair from the Configuration screen."); print OTHERFILETWO $newfilebodypattern; close (OTHERFILETWO); chmod (0666, "$EntriesPath/$usethisfilenamestripped.cgi"); } $connectcounter++; } } # ------------------------- # generate log archive list # ------------------------- sub gm_generatearchiveloglist { &gm_readcounter; ########################################################### # 9/3/2001 - CHERYL LAMBERT # Problem: If the last archived entry is a different month/year from the current month/year, the # {{calendar}} on the Archive Master Index page displays the month/year of the last archived # entry instead of the current month/year. For example, my last archived entry was 8/21/2001 # but the current date was 9/3/2001 when I discovered this problem. The {{calendar}} displayed # on the Archive Master Index page was for August 2001 not for September 2001. # The following section of code corrects this problem by getting the current date and using # the current date instead of the last archived date to create the {{calendar}} on the # Archive Master Index page. my ($tsec,$tmin,$thour,$tmday,$tmon,$tyear,$twday,$tyday,$tisdst) = localtime(time); $tmon += 1; $tyear += 1900; if (($tmon != $thisentrymonth) || ($tyear != $thisentryyearyear)) { $thisentrymonth = $tmon; $thisentryday = $tmday; $thisentryhour = $thour; $thisentryminute = $tmin; $thisentrysecond = $tsec; $thisentryweekdaynumber = $twday; $thisentryweekday = $weekdays[$twday]; $thisentrymonthword = $months[$thisentrymonth]; $thisentrymonthmonth = sprintf ("%2d", $thisentrymonth); $thisentrydayday = sprintf ("%2d", $thisentryday); $thisentryhourhour = sprintf ("%2d", $thisentryhour); $thisentryminuteminute = sprintf ("%2d", $thisentryminute); $thisentrysecondsecond = sprintf ("%2d", $thisentrysecond); $thisentrymonthmonth =~ tr/ /0/; $thisentrydayday =~ tr/ /0/; $thisentryhourhour =~ tr/ /0/; $thisentryminuteminute =~ tr/ /0/; $thisentrysecondsecond =~ tr/ /0/; } ########################################################### open (FUNNYFEETMIDNIGHT, "./gm-entrylist.cgi") || &gm_dangermouse("Can't read the entry list file. Please make sure that gm-entrylist.cgi is in the same directory as all your other Greymatter files and is CHMODed to 666; also, try running Diagnostics & Repair in the Configuration screen."); @loglistloglines = <FUNNYFEETMIDNIGHT>; close (FUNNYFEETMIDNIGHT); $listcountmonthyear = "begin"; $listcountweek = "begin"; $logarchivelistfinal = ""; foreach $loglistline (@loglistloglines) { chomp ($loglistline); ($loglistnumber, $loglistauthor, $loglistsubject, $loglistdate, $loglisttimeampm, $loglistopenstatus, $loglistmorestatus) = split (/\|/, $loglistline); &gm_getloglistvariables; unless ($loglistopenstatus eq "C") { $thisloglistmonthyear = "$loglistmonthmonth $loglistyearyear"; $thisloglistweek = "$loglistweekbeginningdayday$loglistweekendingdayday"; if ($archiveformat eq "week") { if ($thisloglistweek ne $listcountweek) { $listsubsub = $gmlogarchiveslinkweeklytemplate; &entrylistsubsub; $listsubsub .= "|*|"; $logarchivelistfinal .= $listsubsub; $listcountweek = $thisloglistweek; } } else { if ($thisloglistmonthyear ne $listcountmonthyear) { $listsubsub = $gmlogarchiveslinktemplate; &entrylistsubsub; $listsubsub .= "|*|"; $logarchivelistfinal .= $listsubsub; $listcountmonthyear = $thisloglistmonthyear; } } } } @loglistfinalcollection = split (/\|\*\|/, $logarchivelistfinal); if ($entrylistsortorder eq "descending") { @loglistfinalcollection = reverse @loglistfinalcollection; } $logarchivelistfinal = join ("$gmlogarchiveslinkseparatortemplate", @loglistfinalcollection); } # ----------------------- # generate log entry list # ----------------------- sub gm_generateentryloglist { $logshortentrylistfinal = ""; $logmoreentrylistfinal = ""; $logentrylistfinal = ""; $logshortentrylistmonthfinal = ""; $logshortentrylistdayfinal = ""; $logshortentrylistyearfinal = ""; $logmoreentrylistmonthfinal = ""; $logmoreentrylistdayfinal = ""; $logmoreentrylistyearfinal = ""; $logentrylistmonthfinal = ""; $logentrylistdayfinal = ""; $logentrylistyearfinal = ""; $logshortentrylistnumberfinal = ""; $logmoreentrylistnumberfinal = ""; $logentrylistnumberfinal = ""; $logshortentrylistfirsthalffinal = ""; $logshortentrylistsecondhalffinal = ""; $logmoreentrylistfirsthalffinal = ""; $logmoreentrylistsecondhalffinal = ""; $logentrylistfirsthalffinal = ""; $logentrylistsecondhalffinal = ""; open (FUNNYFEETSPOT, "./gm-entrylist.cgi") || &gm_dangermouse("Can't read the entry list file. Please make sure that gm-entrylist.cgi is in the same directory as all your other Greymatter files and is CHMODed to 666; also, try running Diagnostics & Repair in the Configuration screen."); @loglistloglines = <FUNNYFEETSPOT>; close (FUNNYFEETSPOT); if ($entrylistsortorder eq "descending") { @loglistloglines = reverse @loglistloglines; } ($toploglistnumber, $toploglistauthor, $toploglistsubject, $toploglistdate, $toploglisttimeampm, $toploglistopenstatus, $toploglistmorestatus) = split (/\|/, $loglistloglines[0]); ($toploglistmonthmonth, $toploglistdayday, $toploglistyear) = split (/\//, $toploglistdate); $shortentrycounter = 0; $moreentrycounter = 0; $allentrycounter = 0; $shorttotalentrycounter = 0; $moretotalentrycounter = 0; $alltotalentrycounter = 0; foreach $loglistcounterline (@loglistloglines) { chomp ($loglistcounterline); ($loglistcounternumber, $loglistcounterauthor, $loglistcountersubject, $loglistcounterdate, $loglistcountertimeampm, $loglistcounteropenstatus, $loglistcountermorestatus) = split (/\|/, $loglistcounterline); unless ($loglistcounteropenstatus eq "C") { $alltotalentrycounter++; if ($loglistcountermorestatus eq "Y") { $moretotalentrycounter++; } else { $shorttotalentrycounter++; } } } $shorttotalentryhalfcounter = sprintf("%.0f", ($shorttotalentrycounter / 2)); $moretotalentryhalfcounter = sprintf("%.0f", ($moretotalentrycounter / 2)); $alltotalentryhalfcounter = sprintf("%.0f", ($alltotalentrycounter / 2)); $listdaymarker = "tommy"; $listmonthmarker = "tommy"; $listyearmarker = "tommy"; foreach $loglistline (@loglistloglines) { chomp ($loglistline); ($loglistnumber, $loglistauthor, $loglistsubject, $loglistdate, $loglisttimeampm, $loglistopenstatus, $loglistmorestatus) = split (/\|/, $loglistline); unless ($loglistopenstatus eq "C") { &gm_getloglistvariables; $usethismorelinktemplate = $gmmoreentrypagelinktemplate; $usethislinktemplate = $gmentrypagelinktemplate; if (($gmentrypagelinkdayseparatortemplate ne "") && ($listdaymarker ne $loglistday)) { $usethismorelinktemplate = "$gmentrypagelinkdayseparatortemplate|*|$usethismorelinktemplate"; $usethislinktemplate = "$gmentrypagelinkdayseparatortemplate|*|$usethislinktemplate"; } if (($gmentrypagelinkmonthseparatortemplate ne "") && ($listmonthmarker ne $loglistmonth)) { $usethismorelinktemplate = "$gmentrypagelinkmonthseparatortemplate|*|$usethismorelinktemplate"; $usethislinktemplate = "$gmentrypagelinkmonthseparatortemplate|*|$usethislinktemplate"; } if (($gmentrypagelinkyearseparatortemplate ne "") && ($listyearmarker ne $loglistyear)) { $usethismorelinktemplate = "$gmentrypagelinkyearseparatortemplate|*|$usethismorelinktemplate"; $usethislinktemplate = "$gmentrypagelinkyearseparatortemplate|*|$usethislinktemplate"; } if ($loglistmorestatus eq "Y") { $moreentrycounter++; $listsubsub = $usethismorelinktemplate; &entrylistsubsub; $listsubsub .= "|*|"; $logmoreentrylistfinal .= $listsubsub; if ($loglistmonthmonth eq $toploglistmonthmonth) { $logmoreentrylistmonthfinal .= $listsubsub; } if ($loglistdayday eq $toploglistdayday) { $logmoreentrylistdayfinal .= $listsubsub; } if ($loglistyear eq $toploglistyear) { $logmoreentrylistyearfinal .= $listsubsub; } unless ($moreentrycounter > $entrylistcountnumber) { $logmoreentrylistnumberfinal .= $listsubsub; } if ($moreentrycounter <= $moretotalentryhalfcounter) { $logmoreentrylistfirsthalffinal .= $listsubsub; } else { $logmoreentrylistsecondhalffinal .= $listsubsub; } } else { $shortentrycounter++; $listsubsub = $usethislinktemplate; &entrylistsubsub; $listsubsub .= "|*|"; $logshortentrylistfinal .= $listsubsub; if ($loglistmonthmonth eq $toploglistmonthmonth) { $logshortentrylistmonthfinal .= $listsubsub; } if ($loglistdayday eq $toploglistdayday) { $logshortentrylistdayfinal .= $listsubsub; } if ($loglistyear eq $toploglistyear) { $logshortentrylistyearfinal .= $listsubsub; } unless ($shortentrycounter > $entrylistcountnumber) { $logshortentrylistnumberfinal .= $listsubsub; } if ($shortentrycounter <= $shorttotalentryhalfcounter) { $logshortentrylistfirsthalffinal .= $listsubsub; } else { $logshortentrylistsecondhalffinal .= $listsubsub; } } $allentrycounter++; $logentrylistfinal .= $listsubsub; if ($loglistmonthmonth eq $toploglistmonthmonth) { $logentrylistmonthfinal .= $listsubsub; } if ($loglistdayday eq $toploglistdayday) { $logentrylistdayfinal .= $listsubsub; } if ($loglistyear eq $toploglistyear) { $logentrylistyearfinal .= $listsubsub; } unless ($allentrycounter > $entrylistcountnumber) { $logentrylistnumberfinal .= $listsubsub; } if ($allentrycounter <= $alltotalentryhalfcounter) { $logentrylistfirsthalffinal .= $listsubsub; } else { $logentrylistsecondhalffinal .= $listsubsub; } $listdaymarker = $loglistday; $listmonthmarker = $loglistmonth; $listyearmarker = $loglistyear; } } @logshortentrylistfinalcollection = split (/\|\*\|/, $logshortentrylistfinal); @logmoreentrylistfinalcollection = split (/\|\*\|/, $logmoreentrylistfinal); @logentrylistfinalcollection = split (/\|\*\|/, $logentrylistfinal); @logshortentrylistmonthfinalcollection