############################################################################### # Greymatter 1.7.2 # Copyright (c)2000-2007, The Greymatter team # http://greymatterforum.proboards82.com/ # By possessing this software, you agree not to hold the author responsible for # any problems that may arise from your installation or usage of Greymatter # itself, or from any content generated by yourself or others through the use of # this program. You may freely modify and redistribute this program, so # long as every copyright notice (including in this manual and in the Greymatter # code) remains fully intact. Finally, you may not sell or in any way # make a financial profit from this program, either in original or modified form. # Your possession of this software signifies that you agree to these terms; # please delete your copy of this software if you don't agree to these terms. # Original Creators Noah Grey ############################################################################### use lib 'libs'; use Gm_Constants; use Gm_Utils qw( println ); use Gm_Web; use Gm_Storage; # PF use Gm_Trace; ### GLOBAL VARS my $newTemplates = (); # init to empty my $newConfigs = (); # init to empty $cookiename = "gm_password"; # ----------------- # program variables # ----------------- # NOTE that the version is MAJOR NUMBER.YEAR.NO_OF_REL_THAT_YEAR # e.g. a major refactoring is done in 2007 the release would be 2.7.1 # later that year a security fix comes out so release would be 2.7.2 $gmversion = Gm_Constants::GM_VERSION; $gmfonttag = qq(); ## Todo, make this seperate file, doesn't need to be in code to change $gmadmincss = qq# #; $gmheadtag = qq# Greymatter $gmadmincss #; $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; } } } //--> #; $gmframetop = qq(

$gmfonttaggreymatter $gmversion

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

v$gmversion · ©2000-2007 The Greymatter Team

); $gmframebottomtwo = qq(
); $statusnote = Gm_Constants::EMPTY; # ------------------ # emoticons subroutine # ------------------ # added by flipped cracker 9/17/2003 # version 1.3 # DEPRECATED: Gm_Core::translateEmoticons sub gm_emoticons { &gm_readconfig; $_ = shift; if( (($emoticonsallowed eq Gm_Constants::BOTH) || ($emoticonsallowed eq $returnto)) && ($thisentryemoticonsallowed eq Gm_Constants::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 = Gm_Constants::EMPTY; if( ($emoticonsallowed eq Gm_Constants::BOTH) || ($emoticonsallowed eq Gm_Constants::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:\"
"; } } # --------------- # date subroutine # --------------- # DEPRECATED: Gm_Utils::getStdDate( $serveroffset ); # # ---------------- # read the counter # ---------------- # TODO, DEPRECATE THIS AND USE GETCOUNTERS EVERYWHERE sub gm_readcounter { my $gmcounters = Gm_Storage::getCounters( errHandler=>\&Gm_Web::displayAdminErrorExit ); $newentrynumber = $gmcounters->{'entrytotal'}; $newarchivenumber = $gmcounters->{'archivetotal'}; $newstayattopnumber = $gmcounters->{'stayattopentry'}; $newalltimepktotalnumber = $gmcounters->{'karmapos'}; $newalltimenktotalnumber = $gmcounters->{'karmaneg'}; $newalltimecommentstotalnumber = $gmcounters->{'commenttotal'}; $newalltimeopenentriesnumber = $gmcounters->{'opentotal'}; $newalltimeclosedentriesnumber = $gmcounters->{'closedtotal'}; } # ----------------- # write the counter # ----------------- # TODO, DEPRECATE THIS AND USE SETCOUNTERS EVERYWHERE sub gm_writecounter { my %counters = (); $counters{'entrytotal'} = $newentrynumber; $counters{'archivetotal'} = $newarchivenumber; $counters{'stayattopentry'} = $newstayattopnumber; $counters{'karmapos'} = $newalltimepktotalnumber; $counters{'karmaneg'} = $newalltimenktotalnumber; $counters{'commenttotal'} = $newalltimecommentstotalnumber; $counters{'opentotal'} = $newalltimeopenentriesnumber; $counters{'closedtotal'} = $newalltimeclosedentriesnumber; Gm_Storage::setCounters( list=>\%counters, errHandler=>\&Gm_Web::displayAdminErrorExit ); } # ------------------ # read the templates ## TODO REMOVE ALL REFERENCES TO THIS CALL. REPLACED BY GM_STORAGE FUNCTION ## if leave, access global newTemplates hash reference # ------------------ sub gm_readtemplates { $newTemplates = Gm_Storage::getTemplates( errHandler=>\&Gm_Web::displayAdminErrorExit ); ### TODO, NOW THAT WE ARE USING HASH FOR TEMPLATES, GO THROUGH AND REMOVE REFERENCES TO ## INVIDUAL VARS BELOW, E.G. REPLACE $gmindextemplate WITH $newTemplates->{'gmindextemplate'} $gmindextemplate = $newTemplates->{'gmindextemplate'}; $gmentrypagetemplate = $newTemplates->{'gmentrypagetemplate'}; $gmarchiveindextemplate = $newTemplates->{'gmarchiveindextemplate'}; $gmarchiveentrypagetemplate = $newTemplates->{'gmarchiveentrypagetemplate'}; $gmentrytemplate = $newTemplates->{'gmentrytemplate'}; $gmarchiveentrytemplate = $newTemplates->{'gmarchiveentrytemplate'}; $gmstayattoptemplate = $newTemplates->{'gmstayattoptemplate'}; $gmdatetemplate = $newTemplates->{'gmdatetemplate'}; $gmcommentstemplate = $newTemplates->{'gmcommentstemplate'}; $gmcommentsformtemplate = $newTemplates->{'gmcommentsformtemplate'}; $gmparaseparationtemplate = $newTemplates->{'gmparaseparationtemplate'}; $gmkarmaformtemplate = $newTemplates->{'gmkarmaformtemplate'}; $gmlinktargettemplate = $newTemplates->{'gmlinktargettemplate'}; $gmdategroupingfootertemplate = $newTemplates->{'gmdategroupingfootertemplate'}; $gmkarmalinktemplate = $newTemplates->{'gmkarmalinktemplate'}; $gmcommentslinktemplate = $newTemplates->{'gmcommentslinktemplate'}; $gmcommentauthoremailtemplate = $newTemplates->{'gmcommentauthoremailtemplate'}; $gmcommentauthorhomepagetemplate = $newTemplates->{'gmcommentauthorhomepagetemplate'}; $gmcommentdividertemplate = $newTemplates->{'gmcommentdividertemplate'}; $gmmoreentrytemplate = $newTemplates->{'gmmoreentrytemplate'}; $gmmoreentrypagetemplate = $newTemplates->{'gmmoreentrypagetemplate'}; $gmmorearchiveentrypagetemplate = $newTemplates->{'gmmorearchiveentrypagetemplate'}; $gmpreviouslinktemplate = $newTemplates->{'gmpreviouslinktemplate'}; $gmnextlinktemplate = $newTemplates->{'gmnextlinktemplate'}; $gmpreviousmorelinktemplate = $newTemplates->{'gmpreviousmorelinktemplate'}; $gmnextmorelinktemplate = $newTemplates->{'gmnextmorelinktemplate'}; $gmarchivemasterindextemplate = $newTemplates->{'gmarchivemasterindextemplate'}; $gmlogarchiveslinktemplate = $newTemplates->{'gmlogarchiveslinktemplate'}; $gmentrypagelinktemplate = $newTemplates->{'gmentrypagelinktemplate'}; $gmmoreentrypagelinktemplate = $newTemplates->{'gmmoreentrypagelinktemplate'}; $gmlogarchiveslinkseparatortemplate = $newTemplates->{'gmlogarchiveslinkseparatortemplate'}; $gmentrypagelinkseparatortemplate = $newTemplates->{'gmentrypagelinkseparatortemplate'}; $gmentrypagelinkmonthseparatortemplate = $newTemplates->{'gmentrypagelinkmonthseparatortemplate'}; $gmentrypagelinkdayseparatortemplate = $newTemplates->{'gmentrypagelinkdayseparatortemplate'}; $gmentrypagelinkyearseparatortemplate = $newTemplates->{'gmentrypagelinkyearseparatortemplate'}; $gmheadertemplate = $newTemplates->{'gmheadertemplate'}; $gmfootertemplate = $newTemplates->{'gmfootertemplate'}; $gmsidebartemplate = $newTemplates->{'gmsidebartemplate'}; $gmentryseparatortemplate = $newTemplates->{'gmentryseparatortemplate'}; $gmarchiveentryseparatortemplate = $newTemplates->{'gmarchiveentryseparatortemplate'}; $gmmorearchiveentrytemplate = $newTemplates->{'gmmorearchiveentrytemplate'}; $gmdatearchivetemplate = $newTemplates->{'gmdatearchivetemplate'}; $gmlogarchiveslinkweeklytemplate = $newTemplates->{'gmlogarchiveslinkweeklytemplate'}; $gmcustomonetemplate = $newTemplates->{'gmcustomonetemplate'}; $gmcustomtwotemplate = $newTemplates->{'gmcustomtwotemplate'}; $gmcustomthreetemplate = $newTemplates->{'gmcustomthreetemplate'}; $gmcustomfourtemplate = $newTemplates->{'gmcustomfourtemplate'}; $gmcustomfivetemplate = $newTemplates->{'gmcustomfivetemplate'}; $gmcustomsixtemplate = $newTemplates->{'gmcustomsixtemplate'}; $gmcustomseventemplate = $newTemplates->{'gmcustomseventemplate'}; $gmcustomeighttemplate = $newTemplates->{'gmcustomeighttemplate'}; $gmcustomninetemplate = $newTemplates->{'gmcustomninetemplate'}; $gmcustomtentemplate = $newTemplates->{'gmcustomtentemplate'}; $gmpopuppagetemplate = $newTemplates->{'gmpopuppagetemplate'}; $gmpopupcodetemplate = $newTemplates->{'gmpopupcodetemplate'}; $gmsearchformtemplate = $newTemplates->{'gmsearchformtemplate'}; $gmsearchresultspagetemplate = $newTemplates->{'gmsearchresultspagetemplate'}; $gmsearchresultsentrytemplate = $newTemplates->{'gmsearchresultsentrytemplate'}; $gmcalendartablebeginningtemplate = $newTemplates->{'gmcalendartablebeginningtemplate'}; $gmcalendartableendingtemplate = $newTemplates->{'gmcalendartableendingtemplate'}; $gmcalendarblankcelltemplate = $newTemplates->{'gmcalendarblankcelltemplate'}; $gmcalendarfullcelltemplate = $newTemplates->{'gmcalendarfullcelltemplate'}; $gmcalendarfullcelllinktemplate = $newTemplates->{'gmcalendarfullcelllinktemplate'}; $gmcalendarweekfulldaytemplate = $newTemplates->{'gmcalendarweekfulldaytemplate'}; $gmcalendarweekfulldaylinktemplate = $newTemplates->{'gmcalendarweekfulldaylinktemplate'}; $gmcommentpreviewdividertemplate = $newTemplates->{'gmcommentpreviewdividertemplate'}; $gmcommentpreviewformtemplate = $newTemplates->{'gmcommentpreviewformtemplate'}; $gmsmartlinknocommentstemplate = $newTemplates->{'gmsmartlinknocommentstemplate'}; $gmsmartlinkonecommenttemplate = $newTemplates->{'gmsmartlinkonecommenttemplate'}; $gmsmartlinkmanycommentstemplate = $newTemplates->{'gmsmartlinkmanycommentstemplate'}; $gmlinebreaktemplate = $newTemplates->{'gmlinebreaktemplate'}; $gmcommentlinktargettemplate = $newTemplates->{'gmcommentlinktargettemplate'}; $gmsmartentrymoodtemplate = $newTemplates->{'gmsmartentrymoodtemplate'}; $gmsmartentrymusictemplate = $newTemplates->{'gmsmartentrymusictemplate'}; $gmdategroupingfooterarchivetemplate = $newTemplates->{'gmdategroupingfooterarchivetemplate'}; $gmsmartemoticonscodetemplate = $newTemplates->{'gmsmartemoticonscodetemplate'}; $gmcookiescodetemplate = $newTemplates->{'gmcookiescodetemplate'}; $gmusererrorheadertemplate = $newTemplates->{'gmusererrorheadertemplate'}; $gmusererrorfootertemplate = $newTemplates->{'gmusererrorfootertemplate'}; } # --------------------- # delouse all templates # --------------------- ### TODO JUST LOOP THROUGH THE TEMPLATES HASH ARRAY ONCE ALL THESE REFERENCES ARE REMOVED sub gm_delousealltemplates { $gmindextemplate = Gm_Utils::toWebSafe($gmindextemplate); $gmentrypagetemplate = Gm_Utils::toWebSafe($gmentrypagetemplate); $gmarchiveindextemplate = Gm_Utils::toWebSafe($gmarchiveindextemplate); $gmarchiveentrypagetemplate = Gm_Utils::toWebSafe($gmarchiveentrypagetemplate); $gmentrytemplate = Gm_Utils::toWebSafe($gmentrytemplate); $gmarchiveentrytemplate = Gm_Utils::toWebSafe($gmarchiveentrytemplate); $gmstayattoptemplate = Gm_Utils::toWebSafe($gmstayattoptemplate); $gmdatetemplate = Gm_Utils::toWebSafe($gmdatetemplate); $gmcommentstemplate = Gm_Utils::toWebSafe($gmcommentstemplate); $gmcommentsformtemplate = Gm_Utils::toWebSafe($gmcommentsformtemplate); $gmparaseparationtemplate = Gm_Utils::toWebSafe($gmparaseparationtemplate); $gmkarmaformtemplate = Gm_Utils::toWebSafe($gmkarmaformtemplate); $gmlinktargettemplate = Gm_Utils::toWebSafe($gmlinktargettemplate); $gmdategroupingfootertemplate = Gm_Utils::toWebSafe($gmdategroupingfootertemplate); $gmkarmalinktemplate = Gm_Utils::toWebSafe($gmkarmalinktemplate); $gmcommentslinktemplate = Gm_Utils::toWebSafe($gmcommentslinktemplate); $gmcommentauthoremailtemplate = Gm_Utils::toWebSafe($gmcommentauthoremailtemplate); $gmcommentauthorhomepagetemplate = Gm_Utils::toWebSafe($gmcommentauthorhomepagetemplate); $gmcommentdividertemplate = Gm_Utils::toWebSafe($gmcommentdividertemplate); $gmmoreentrytemplate = Gm_Utils::toWebSafe($gmmoreentrytemplate); $gmmoreentrypagetemplate = Gm_Utils::toWebSafe($gmmoreentrypagetemplate); $gmmorearchiveentrypagetemplate = Gm_Utils::toWebSafe($gmmorearchiveentrypagetemplate); $gmpreviouslinktemplate = Gm_Utils::toWebSafe($gmpreviouslinktemplate); $gmnextlinktemplate = Gm_Utils::toWebSafe($gmnextlinktemplate); $gmpreviousmorelinktemplate = Gm_Utils::toWebSafe($gmpreviousmorelinktemplate); $gmnextmorelinktemplate = Gm_Utils::toWebSafe($gmnextmorelinktemplate); $gmarchivemasterindextemplate = Gm_Utils::toWebSafe($gmarchivemasterindextemplate); $gmlogarchiveslinktemplate = Gm_Utils::toWebSafe($gmlogarchiveslinktemplate); $gmentrypagelinktemplate = Gm_Utils::toWebSafe($gmentrypagelinktemplate); $gmmoreentrypagelinktemplate = Gm_Utils::toWebSafe($gmmoreentrypagelinktemplate); $gmlogarchiveslinkseparatortemplate = Gm_Utils::toWebSafe($gmlogarchiveslinkseparatortemplate); $gmentrypagelinkseparatortemplate = Gm_Utils::toWebSafe($gmentrypagelinkseparatortemplate); $gmentrypagelinkmonthseparatortemplate = Gm_Utils::toWebSafe($gmentrypagelinkmonthseparatortemplate); $gmentrypagelinkdayseparatortemplate = Gm_Utils::toWebSafe($gmentrypagelinkdayseparatortemplate); $gmentrypagelinkyearseparatortemplate = Gm_Utils::toWebSafe($gmentrypagelinkyearseparatortemplate); $gmheadertemplate = Gm_Utils::toWebSafe($gmheadertemplate); $gmfootertemplate = Gm_Utils::toWebSafe($gmfootertemplate); $gmsidebartemplate = Gm_Utils::toWebSafe($gmsidebartemplate); $gmentryseparatortemplate = Gm_Utils::toWebSafe($gmentryseparatortemplate); $gmarchiveentryseparatortemplate = Gm_Utils::toWebSafe($gmarchiveentryseparatortemplate); $gmmorearchiveentrytemplate = Gm_Utils::toWebSafe($gmmorearchiveentrytemplate); $gmdatearchivetemplate = Gm_Utils::toWebSafe($gmdatearchivetemplate); $gmlogarchiveslinkweeklytemplate = Gm_Utils::toWebSafe($gmlogarchiveslinkweeklytemplate); $gmcustomonetemplate = Gm_Utils::toWebSafe($gmcustomonetemplate); $gmcustomtwotemplate = Gm_Utils::toWebSafe($gmcustomtwotemplate); $gmcustomthreetemplate = Gm_Utils::toWebSafe($gmcustomthreetemplate); $gmcustomfourtemplate = Gm_Utils::toWebSafe($gmcustomfourtemplate); $gmcustomfivetemplate = Gm_Utils::toWebSafe($gmcustomfivetemplate); $gmcustomsixtemplate = Gm_Utils::toWebSafe($gmcustomsixtemplate); $gmcustomseventemplate = Gm_Utils::toWebSafe($gmcustomseventemplate); $gmcustomeighttemplate = Gm_Utils::toWebSafe($gmcustomeighttemplate); $gmcustomninetemplate = Gm_Utils::toWebSafe($gmcustomninetemplate); $gmcustomtentemplate = Gm_Utils::toWebSafe($gmcustomtentemplate); $gmpopuppagetemplate = Gm_Utils::toWebSafe($gmpopuppagetemplate); $gmpopupcodetemplate = Gm_Utils::toWebSafe($gmpopupcodetemplate); $gmsearchformtemplate = Gm_Utils::toWebSafe($gmsearchformtemplate); $gmsearchresultspagetemplate = Gm_Utils::toWebSafe($gmsearchresultspagetemplate); $gmsearchresultsentrytemplate = Gm_Utils::toWebSafe($gmsearchresultsentrytemplate); $gmcalendartablebeginningtemplate = Gm_Utils::toWebSafe($gmcalendartablebeginningtemplate); $gmcalendartableendingtemplate = Gm_Utils::toWebSafe($gmcalendartableendingtemplate); $gmcalendarblankcelltemplate = Gm_Utils::toWebSafe($gmcalendarblankcelltemplate); $gmcalendarfullcelltemplate = Gm_Utils::toWebSafe($gmcalendarfullcelltemplate); $gmcalendarfullcelllinktemplate = Gm_Utils::toWebSafe($gmcalendarfullcelllinktemplate); $gmcalendarweekfulldaytemplate = Gm_Utils::toWebSafe($gmcalendarweekfulldaytemplate); $gmcalendarweekfulldaylinktemplate = Gm_Utils::toWebSafe($gmcalendarweekfulldaylinktemplate); $gmcommentpreviewdividertemplate = Gm_Utils::toWebSafe($gmcommentpreviewdividertemplate); $gmcommentpreviewformtemplate = Gm_Utils::toWebSafe($gmcommentpreviewformtemplate); $gmsmartlinknocommentstemplate = Gm_Utils::toWebSafe($gmsmartlinknocommentstemplate); $gmsmartlinkonecommenttemplate = Gm_Utils::toWebSafe($gmsmartlinkonecommenttemplate); $gmsmartlinkmanycommentstemplate = Gm_Utils::toWebSafe($gmsmartlinkmanycommentstemplate); $gmlinebreaktemplate = Gm_Utils::toWebSafe($gmlinebreaktemplate); $gmcommentlinktargettemplate = Gm_Utils::toWebSafe($gmcommentlinktargettemplate); $gmsmartentrymoodtemplate = Gm_Utils::toWebSafe($gmsmartentrymoodtemplate); $gmsmartentrymusictemplate = Gm_Utils::toWebSafe($gmsmartentrymusictemplate); $gmdategroupingfooterarchivetemplate = Gm_Utils::toWebSafe($gmdategroupingfooterarchivetemplate); $gmsmartemoticonscodetemplate = Gm_Utils::toWebSafe($gmsmartemoticonscodetemplate); $gmcookiescodetemplate = Gm_Utils::toWebSafe($gmcookiescodetemplate); $gmusererrorheadertemplate = Gm_Utils::toWebSafe($gmusererrorheadertemplate); $gmusererrorfootertemplate = Gm_Utils::toWebSafe($gmusererrorfootertemplate); } # -------------------- # read the config file ## TODO REMOVE ALL REFERENCES TO THIS CALL. REPLACED BY GM_STORAGE FUNCTION ## if leave, access global newConfigs hash reference # -------------------- sub gm_readconfig { $newConfigs = Gm_Storage::getConfigs( errHandler=>\&Gm_Web::displayAdminErrorExit ); ### TODO, NOW THAT WE ARE USING HASH FOR TEMPLATES, GO THROUGH AND REMOVE REFERENCES TO ## INVIDUAL VARS BELOW, E.G. REPLACE $gmindextemplate WITH $newTemplates->{'gmindextemplate'} $LogPath = $newConfigs->{'gmlogpath'}; $EntriesPath = $newConfigs->{'gmentriespath'}; $LogWebPath = $newConfigs->{'gmlogwebpath'}; $EntriesWebPath = $newConfigs->{'gmentrieswebpath'}; $NotifyEmail = $newConfigs->{'gmnotifyemail'}; $indexfilename = $newConfigs->{'gmindexfilename'}; $entrysuffix = $newConfigs->{'gmentrysuffix'}; $indexdays = $newConfigs->{'gmindexdays'}; $serveroffset = $newConfigs->{'gmserveroffset'}; $timezone = $newConfigs->{'gmtimezone'}; $keeplog = $newConfigs->{'gmkeeplog'}; $posttoarchives = $newConfigs->{'gmposttoarchives'}; $allowkarmadefault = $newConfigs->{'gmallowkarmadefault'}; $allowcommentsdefault = $newConfigs->{'gmallowcommentsdefault'}; $commentsorder = $newConfigs->{'gmcommentsorder'}; $generateentrypages = $newConfigs->{'gmgenerateentrypages'}; $allowhtmlincomments = $newConfigs->{'gmallowhtmlincomments'}; $logkarmaandcomments = $newConfigs->{'gmlogkarmaandcomments'}; $mailprog = $newConfigs->{'gmmailprog'}; $NotifyForStatus = $newConfigs->{'gmnotifyforstatus'}; $autolinkurls = $newConfigs->{'gmautolinkurls'}; $striplinesfromcomments = $newConfigs->{'gmstriplinesfromcomments'}; $allowmultiplekarmavotes = $newConfigs->{'gmallowmultiplekarmavotes'}; $versionsetup = $newConfigs->{'gmversionsetup'}; $cgilocalpath = $newConfigs->{'gmcgilocalpath'}; $cgiwebpath = $newConfigs->{'gmcgiwebpath'}; $concurrentmainandarchives = $newConfigs->{'gmconcurrentmainandarchives'}; $keeparchivemasterindex = $newConfigs->{'gmkeeparchivemasterindex'}; $entrylistsortorder = $newConfigs->{'gmentrylistsortorder'}; $allowkarmaorcomments = $newConfigs->{'gmallowkarmaorcomments'}; $entrylistcountnumber = $newConfigs->{'gmentrylistcountnumber'}; $cookiesallowed = $newConfigs->{'gmcookiesallowed'}; $logarchivesuffix = $newConfigs->{'gmlogarchivesuffix'}; $censorlist = $newConfigs->{'gmcensorlist'}; $censorenabled = $newConfigs->{'gmcensorenabled'}; $keepmonthlyarchives = $newConfigs->{'gmkeepmonthlyarchives'}; $defaultentrylistview = $newConfigs->{'gmdefaultentrylistview'}; $linktocalendarentries = $newConfigs->{'gmlinktocalendarentries'}; $automaticrebuilddefault = $newConfigs->{'gmautomaticrebuilddefault'}; $commententrylistonlyifokay = $newConfigs->{'gmcommententrylistonlyifokay'}; $otherfilelist = $newConfigs->{'gmotherfilelist'}; $otherfilelistentryrebuild = $newConfigs->{'gmotherfilelistentryrebuild'}; $archiveformat = $newConfigs->{'gmarchiveformat'}; $inlineformatting = $newConfigs->{'gminlineformatting'}; $uploadfilesallowed = $newConfigs->{'gmuploadfilesallowed'}; $uploadfilesizelimit = $newConfigs->{'gmuploadfilesizelimit'}; $emoticonspath = $newConfigs->{'gmemoticonspath'}; $keepphphacklog = $newConfigs->{'gmkeepphphacklog'}; $mailhacknotice = $newConfigs->{'gmmailhacknotice'}; $emoticonsallowed = $newConfigs->{'gmemoticonsallowed'}; $protectauthorname = $newConfigs->{'gmprotectauthorname'}; $commentlinklimit = $newConfigs->{'gmcommentlinklimit'}; $commentlinklimitnum = $newConfigs->{'gmcommentlinklimitnum'}; $commentforcepreview = $newConfigs->{'gmcommentforcepreview'}; $commentverify = $newConfigs->{'gmcommentverify'}; $commentverifyphrase = $newConfigs->{'gmcommentverifyphrase'}; } # --------------------- # write the config file # --------------------- sub gm_writeconfig { if ($versionsetup eq Gm_Constants::EMPTY) { $versionsetup = $gmversion; } my %confs = (); $confs{'gmlogpath'} = $LogPath; $confs{'gmentriespath'} = $EntriesPath; $confs{'gmlogwebpath'} = $LogWebPath; $confs{'gmentrieswebpath'} = $EntriesWebPath; $confs{'gmnotifyemail'} = $NotifyEmail; $confs{'gmindexfilename'} = $indexfilename; $confs{'gmentrysuffix'} = $entrysuffix; $confs{'gmindexdays'} = $indexdays; $confs{'gmserveroffset'} = $serveroffset; $confs{'gmtimezone'} = $timezone; $confs{'gmkeeplog'} = $keeplog; $confs{'gmposttoarchives'} = $posttoarchives; $confs{'gmallowkarmadefault'} = $allowkarmadefault; $confs{'gmallowcommentsdefault'} = $allowcommentsdefault; $confs{'gmcommentsorder'} = $commentsorder; $confs{'gmgenerateentrypages'} = $generateentrypages; $confs{'gmallowhtmlincomments'} = $allowhtmlincomments; $confs{'gmlogkarmaandcomments'} = $logkarmaandcomments; $confs{'gmmailprog'} = $mailprog; $confs{'gmnotifyforstatus'} = $NotifyForStatus; $confs{'gmautolinkurls'} = $autolinkurls; $confs{'gmstriplinesfromcomments'} = $striplinesfromcomments; $confs{'gmallowmultiplekarmavotes'} = $allowmultiplekarmavotes; $confs{'gmversionsetup'} = $versionsetup; $confs{'gmversion'} = Gm_Constants::GM_VERSION; $confs{'gmcgilocalpath'} = $cgilocalpath; $confs{'gmcgiwebpath'} = $cgiwebpath; $confs{'gmconcurrentmainandarchives'} = $concurrentmainandarchives; $confs{'gmkeeparchivemasterindex'} = $keeparchivemasterindex; $confs{'gmentrylistsortorder'} = $entrylistsortorder; $confs{'gmallowkarmaorcomments'} = $allowkarmaorcomments; $confs{'gmentrylistcountnumber'} = $entrylistcountnumber; $confs{'gmcookiesallowed'} = $cookiesallowed; $confs{'gmlogarchivesuffix'} = $logarchivesuffix; $confs{'gmcensorlist'} = $censorlist; $confs{'gmcensorenabled'} = $censorenabled; $confs{'gmkeepmonthlyarchives'} = $keepmonthlyarchives; $confs{'gmdefaultentrylistview'} = $defaultentrylistview; $confs{'gmlinktocalendarentries'} = $linktocalendarentries; $confs{'gmautomaticrebuilddefault'} = $automaticrebuilddefault; $confs{'gmcommententrylistonlyifokay'} = $commententrylistonlyifokay; $confs{'gmotherfilelist'} = $otherfilelist; $confs{'gmotherfilelistentryrebuild'} = $otherfilelistentryrebuild; $confs{'gmarchiveformat'} = $archiveformat; $confs{'gminlineformatting'} = $inlineformatting; $confs{'gmuploadfilesallowed'} = $uploadfilesallowed; $confs{'gmuploadfilesizelimit'} = $uploadfilesizelimit; $confs{'gmemoticonspath'} = $emoticonspath; $confs{'gmkeepphphacklog'} = $keepphphacklog; $confs{'gmmailhacknotice'} = $mailhacknotice; $confs{'gmemoticonsallowed'} = $emoticonsallowed; $confs{'gmprotectauthorname'} = $protectauthorname; $confs{'gmcommentlinklimit'} = $commentlinklimit; $confs{'gmcommentlinklimitnum'} = $commentlinklimitnum; $confs{'gmcommentforcepreview'} = $commentforcepreview; $confs{'gmcommentverify'} = $commentverify; $confs{'gmcommentverifyphrase'} = $commentverifyphrase; Gm_Storage::setConfigs( configs=>\%confs, errHandler=>\&Gm_Web::displayAdminErrorExit ); } # --------------------------------- # gather ye all thy entry variables # --------------------------------- # DEPRECATED: Gm_Core::getEntryVariables sub gm_getentryvariables { my $thisentrygetmynumber = shift; &gm_readconfig; &gm_readtemplates; &gm_readcounter; # $thisentrynumberpadded = sprintf ("%8d", $thisentrygetmynumber); # $thisentrynumberpadded =~ tr/ /0/; $thisentrynumberpadded = Gm_Utils::toEntryPadded( $thisentrygetmynumber ); 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 = Gm_Constants::NO; if ($thisentrynumber <= $newarchivenumber) { $thisentryisanarchive = Gm_Constants::YES; } if ($generateentrypages eq Gm_Constants::NO) { $thisentryallowcomments = Gm_Constants::NO; } ## THIS IS DUPLICATING DATE SEE GM_UTILS $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/; $thisentrymonthmonth = Gm_Utils::toTwoDigit( $thisentrymonth ); $thisentrydayday = Gm_Utils::toTwoDigit( $thisentryday ); $thisentryhourhour = Gm_Utils::toTwoDigit( $thisentryhour ); $thisentryminuteminute = Gm_Utils::toTwoDigit( $thisentryminute ); $thisentrysecondsecond = Gm_Utils::toTwoDigit( $thisentrysecond ); $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/; $thisentrymilitaryhour = Gm_Utils::toTwoDigit( $thisentrymilitaryhour ); $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/; $thisentryweekbeginningdayday = Gm_Utils::toTwoDigit( $thisentryweekbeginningday ); $thisentryweekendingdayday = Gm_Utils::toTwoDigit( $thisentryweekendingday ); $thisentryweekbeginningmonthmonth = Gm_Utils::toTwoDigit( $thisentryweekbeginningmonth ); $thisentryweekendingmonthmonth = Gm_Utils::toTwoDigit( $thisentryweekendingmonth ); $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); my $gmauthors = Gm_Storage::getAuthors( errHandler=>\&Gm_Web::displayAdminErrorExit ); my $selectedauthor; $thisentryauthoremail = Gm_Constants::EMPTY; $thisentryauthorhomepage = Gm_Constants::EMPTY; $thisentryauthorentrycount = Gm_Constants::EMPTY; if( exists( $gmauthors->{$thisentryauthor} )){ $selectedauthor = $gmauthors->{$thisentryauthor}; $thisentryauthoremail = $selectedauthor->{'email'}; $thisentryauthorhomepage = $selectedauthor->{'homepage'}; $thisentryauthorentrycount = $selectedauthor->{'posttotal'}; } $thisentryauthorsmartlink = $thisentryauthor; if ($thisentryauthoremail ne Gm_Constants::EMPTY) { $thisentryauthorsmartlink = "$thisentryauthor"; } if ($thisentryauthorhomepage ne Gm_Constants::EMPTY) { $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 Gm_Constants::NO) { $thisentrypagearchivelogindexlink = $thisentrypageindexlink; } else { if ($archiveformat eq Gm_Constants::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 Gm_Constants::NO)) { $thisentrypagesmartindexlink = $thisentrypagearchivelogindexlink; } $thisentrycommentslink = Gm_Constants::EMPTY; $thisentrycommentsform = Gm_Constants::EMPTY; if ($thisentryallowcomments eq Gm_Constants::YES) { if (($allowkarmaorcomments eq Gm_Constants::COMMENTS) || ($allowkarmaorcomments eq Gm_Constants::BOTH)) { $thisentrycommentslink = $gmcommentslinktemplate; $thisentrycommentsform = $gmcommentsformtemplate; } } if (($emoticonsallowed eq Gm_Constants::BOTH) || ($emoticonsallowed eq Gm_Constants::COMMENTS)) { $thisentrycommentsform =~ s/{{smartemoticonscode}}/$gmsmartemoticonscodetemplate/; } else { $thisentrycommentsform =~ s/{{smartemoticonscode}}//; } $thisentrykarmalink = Gm_Constants::EMPTY; $thisentrykarmaform = Gm_Constants::EMPTY; if ($thisentryallowkarma eq Gm_Constants::YES ) { if (($allowkarmaorcomments eq Gm_Constants::KARMA) || ($allowkarmaorcomments eq Gm_Constants::BOTH)) { $thisentrykarmalink = $gmkarmalinktemplate; $thisentrykarmaform = $gmkarmaformtemplate; } } if (($thisentryisanarchive eq Gm_Constants::YES) && ($posttoarchives eq Gm_Constants::NO)) { $thisentrykarmalink = Gm_Constants::EMPTY; $thisentrykarmaform = Gm_Constants::EMPTY; $thisentrycommentslink = Gm_Constants::EMPTY; $thisentrycommentsform = Gm_Constants::EMPTY; } $thisentrysearchform = $gmsearchformtemplate; if ($generateentrypages eq Gm_Constants::NO) { $thisentrycommentslink = Gm_Constants::EMPTY; $thisentrycommentsform = Gm_Constants::EMPTY; $thisentrysearchform = Gm_Constants::EMPTY; } $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 Gm_Constants::BOTH) || ($censorenabled eq Gm_Constants::ENTRIES)) { unless ($censorlist eq Gm_Constants::EMPTY) { @censoredterms = split(/\n/, $censorlist); foreach $thisterm (@censoredterms) { unless ($thisterm eq Gm_Constants::EMPTY) { 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 = Gm_Constants::EMPTY; $thisentrymorelink = Gm_Constants::EMPTY; if (($thisentrymorebody ne Gm_Constants::EMPTY) && ($generateentrypages ne Gm_Constants::NO)) { $thisentrymorepreface = $gmmoreprefacetemplate; $thisentrymorelink = $gmmorelinktemplate; } $thisentrycommentdivider = Gm_Constants::EMPTY; if ($thisentrycommentsnumber ne "0") { $thisentrycommentdivider = $gmcommentdividertemplate; } $thisentrycomments = Gm_Constants::EMPTY; # 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 Gm_Constants::ENTRIES) || ($inlineformatting eq Gm_Constants::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 = Gm_Constants::ENTRIES; $thisentrymainbody = &gm_emoticons($thisentrymainbody); $thisentrymorebody = &gm_emoticons($thisentrymorebody); # merged 9/17/2003 if (($thisentrycommentsnumber ne "0") && ($generateentrypages ne Gm_Constants::NO)) { $thisisaspellcheck = Gm_Constants::NO; &gm_collatecomments; ## TODO REFACTOR THIS OUT SINCE ITS DEPRECATED $thisentrycomments =~ s/\"/"/g; } } # ----------------- # comment collating # ----------------- # DEPRECATED: Gm_Core::collateComments( entry=>$gmEntry ); sub gm_collatecomments { $commentcounter = 4; if ($commentsorder eq Gm_Constants::ASCENDING) { $commentcounter = $thisentrycommentsnumber + 3; } $commentcountermax = $thisentrycommentsnumber + 3; $commentcountercurrent = $thisentrycommentsnumber; ## STARTING A LOOP HERE THAT CAN BECOME INFINITE, SINCE IT DOESN'T CHECK IF ITS DEALING WITH A NUMBER 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/; $thiscommentmonthmonth = Gm_Utils::toTwoDigit( $thiscommentmonth ); $thiscommentdayday = Gm_Utils::toTwoDigit( $thiscommentday ); $thiscommenthourhour = Gm_Utils::toTwoDigit( $thiscommenthour ); $thiscommentminuteminute = Gm_Utils::toTwoDigit( $thiscommentminute ); $thiscommentsecondsecond = Gm_Utils::toTwoDigit( $thiscommentsecond ); $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/; $thiscommentmilitaryhour = Gm_Utils::toTwoDigit( $thiscommentmilitaryhour ); $thiscommentampmlower = lc($thiscommentampm); $thiscommentampmdotlower = lc($thiscommentampmdot); # new ordinal numbers for {{dayappend}} variable: linear 9/15/2003 # merged in 1.3 $thiscommentdayappend = Gm_Utils::toOrdinal($thiscommentday); #merged 9/15/2003 $thiscommentauthor =~ s/"/\"/g; $thiscommentauthoremailabsolute =~ s/"/\"/g; $thiscommentauthorhomepageabsolute =~ s/"/\"/g; $thiscommentauthoremail = Gm_Constants::EMPTY; $thiscommentauthorhomepage = Gm_Constants::EMPTY; $thiscommentauthorsmartlink = $thiscommentauthor; if ($thiscommentauthoremailabsolute ne Gm_Constants::EMPTY) { $thiscommentauthoremail = $gmcommentauthoremailtemplate; $thiscommentauthorsmartlink = "$thiscommentauthor"; } if ($thiscommentauthorhomepageabsolute ne Gm_Constants::EMPTY) { $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 Gm_Constants::YES) { $thiscommenttext =~ s(<[^>]*>)()gs; } # merged 9/11/2003 if ($autolinkurls eq Gm_Constants::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 = Gm_Constants::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 Gm_Constants::COMMENTS) || ($inlineformatting eq Gm_Constants::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 Gm_Constants::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 Gm_Constants::BOTH) || ($censorenabled eq Gm_Constants::COMMENTS)) { unless ($censorlist eq Gm_Constants::EMPTY) { @censoredterms = split(/\n/, $censorlist); foreach $thisterm (@censoredterms) { unless ($thisterm eq Gm_Constants::EMPTY) { 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 Gm_Constants::ASCENDING) { $commentcounter--; } else { $commentcounter++; } $commentcountercurrent--; } until $commentcountercurrent eq "0"; ## TODO: FIX THIS SO THAT IT WON'T LOOP INFINATLY IF # COMMENTCOUNTERCURRENT ISN'T A NUMBER, BAD! } # ---------------- # format the entry # ---------------- # Note: doesn't return string, just modifies it # DEPRECATED: Gm_Core::translateEntryTemplates 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 Gm_Constants::NO) { $entryreturn =~ s/{{logarchivelist}}//gi; } else { &gm_generatearchiveloglist; $entryreturn =~ s/{{logarchivelist}}/$logarchivelistfinal/gi; } } if ($generateentrypages eq Gm_Constants::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)) { my $gmauthors = Gm_Storage::getAuthors( errHandler=>\&Gm_Web::displayAdminErrorExit ); foreach my $author ( keys( %$gmauthors ) ) { $thisentryloglistauthor = $gmauthors->{$author}{'author'}; &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; } my $gmentrylist = Gm_Storage::getEntrylist( errHandler=>\&Gm_Web::displayAdminErrorExit ); if ($entryreturn =~ m/{{calendar (..)\/(..)}}/i) { until ($entryreturn !~ m/{{calendar (..)\/(..)}}/ig) { $usethisentrymonthmonth = $1; $usethisentryyear = $2; $gotthecalendarmonth = Gm_Constants::NO; foreach my $entry ( sort { $gmentrylist->{$b}{'id'} <=> $gmentrylist->{$a}{'id'} } keys( %$gmentrylist ) ) { $loglistnumber = $gmentrylist->{$entry}{'id'}; $loglistauthor = $gmentrylist->{$entry}{'author'}; $loglistsubject = $gmentrylist->{$entry}{'subject'}; $loglistdate = $gmentrylist->{$entry}{'created'}; $loglisttimeampm = $gmentrylist->{$entry}{'createt'}; $loglistopenstatus = $gmentrylist->{$entry}{'status'}; $loglistmorestatus = $gmentrylist->{$entry}{'extended'}; $loglistentrymusic = $gmentrylist->{$entry}{'music'}; $loglistentrymood = $gmentrylist->{$entry}{'mood'}; $loglistemoticonstatus = $gmentrylist->{$entry}{'emoticons'}; &gm_getloglistvariables; if (($loglistmonthmonth eq $usethisentrymonthmonth) && ($loglistyear eq $usethisentryyear) && ($gotthecalendarmonth eq Gm_Constants::NO)) { $usethisentryweekdaynumber = $loglistentryweekdaynumber; $usethisentryday = $loglistday; $usethisentrymonth = $loglistmonth; $usethisentrymonthword = $loglistmonthword; $usethisentryyearyear = $loglistyearyear; &gm_generatecalendar; $entryreturn =~ s/{{calendar $usethisentrymonthmonth\/$usethisentryyear}}/$calendarfull/gi; $gotthecalendarmonth = Gm_Constants::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 Gm_Constants::EMPTY) { $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 Gm_Constants::EMPTY) { $entryreturn =~ s/{{smartentrymusic}}/$gmsmartentrymusictemplate/gi; } else { $entryreturn =~ s/{{smartentrymusic}}//gi; } if ($thisentrymood ne Gm_Constants::EMPTY) { $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_Utils::toOrdinal($thisentryday); #merged 9/15/2003 # new {{dayappend}} variable:: linear 9/15/2003 # merged in 1.3 $thisentrydayappend = Gm_Utils::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; $foundpopupmatch = Gm_Constants::NO; if( exists( $gmentrylist->{$thisentrynumber} ) ) { $loglistnumber = $gmentrylist->{$thisentrynumber}{'id'}; $loglistauthor = $gmentrylist->{$thisentrynumber}{'author'}; $loglistsubject = $gmentrylist->{$thisentrynumber}{'subject'}; $loglistdate = $gmentrylist->{$thisentrynumber}{'created'}; $loglisttimeampm = $gmentrylist->{$thisentrynumber}{'createt'}; $loglistopenstatus = $gmentrylist->{$thisentrynumber}{'status'}; $loglistmorestatus = $gmentrylist->{$thisentrynumber}{'extended'}; &gm_getloglistvariables; $foundpopupmatch = Gm_Constants::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)) { $entryreturn =~ s/{{previousmore/{{moreprevious/isg; $entryreturn =~ s/{{nextmore/{{morenext/isg; if ($thisentrynumber ne "1") { $thispreviousentrynumber = $thisentrynumber - 1; $foundregular = Gm_Constants::NO; $foundmore = Gm_Constants::NO; $foundboth = Gm_Constants::NO; do { foreach my $entry ( sort { $gmentrylist->{$b}{'id'} <=> $gmentrylist->{$a}{'id'} } keys( %$gmentrylist ) ) { $loglistnumber = $gmentrylist->{$entry}{'id'}; $loglistauthor = $gmentrylist->{$entry}{'author'}; $loglistsubject = $gmentrylist->{$entry}{'subject'}; $loglistdate = $gmentrylist->{$entry}{'created'}; $loglisttimeampm = $gmentrylist->{$entry}{'createt'}; $loglistopenstatus = $gmentrylist->{$entry}{'status'}; $loglistmorestatus = $gmentrylist->{$entry}{'extended'}; if (($thispreviousentrynumber eq $loglistnumber) && ($loglistnumber < $thisentrynumber) && ($foundregular eq Gm_Constants::NO) && ($loglistopenstatus ne "C")) { $entryreturn =~ s/{{previouslink}}/$gmpreviouslinktemplate/isg; &gm_getloglistvariables; $listsubsub = $entryreturn; $listsubsub =~ s/{{previous/{{/isg; &entrylistsubsub; $entryreturn = $listsubsub; $foundregular = Gm_Constants::YES; } if (($thispreviousentrynumber eq $loglistnumber) && ($loglistmorestatus eq 'Y') && ($loglistnumber < $thisentrynumber) && ($foundmore eq Gm_Constants::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 = Gm_Constants::YES; } } if (($foundregular eq Gm_Constants::YES) && ($foundmore eq Gm_Constants::YES)) { $foundboth = Gm_Constants::YES; } if ($thispreviousentrynumber eq "1") { $foundboth = Gm_Constants::YES; } $thispreviousentrynumber--; } until $foundboth eq Gm_Constants::YES; } if ($thisentrynumber ne $newentrynumber) { $thisnextentrynumber = $thisentrynumber + 1; $foundregular = Gm_Constants::NO; $foundmore = Gm_Constants::NO; $foundboth = Gm_Constants::NO; do { foreach my $entry ( sort { $gmentrylist->{$a}{'id'} <=> $gmentrylist->{$b}{'id'} } keys( %$gmentrylist ) ) { $loglistnumber = $gmentrylist->{$entry}{'id'}; $loglistauthor = $gmentrylist->{$entry}{'author'}; $loglistsubject = $gmentrylist->{$entry}{'subject'}; $loglistdate = $gmentrylist->{$entry}{'created'}; $loglisttimeampm = $gmentrylist->{$entry}{'createt'}; $loglistopenstatus = $gmentrylist->{$entry}{'status'}; $loglistmorestatus = $gmentrylist->{$entry}{'extended'}; if (($thisnextentrynumber eq $loglistnumber) && ($loglistnumber > $thisentrynumber) && ($foundregular eq Gm_Constants::NO) && ($loglistopenstatus ne "C")) { $entryreturn =~ s/{{nextlink}}/$gmnextlinktemplate/isg; &gm_getloglistvariables; $listsubsub = $entryreturn; $listsubsub =~ s/{{next/{{/isg; &entrylistsubsub; $entryreturn = $listsubsub; $foundregular = Gm_Constants::YES; } if (($thisnextentrynumber eq $loglistnumber) && ($loglistmorestatus eq 'Y') && ($loglistnumber > $thisentrynumber) && ($foundmore eq Gm_Constants::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 = Gm_Constants::YES; } } if (($foundregular eq Gm_Constants::YES) && ($foundmore eq Gm_Constants::YES)) { $foundboth = Gm_Constants::YES; } if ($thisnextentrynumber eq $newentrynumber) { $foundboth = Gm_Constants::YES; } $thisnextentrynumber++; } until $foundboth eq Gm_Constants::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)) { if( exists( $gmentrylist->{$thisentrynumber} ) ) { $loglistnumber = $gmentrylist->{$thisentrynumber}{'id'}; $loglistauthor = $gmentrylist->{$thisentrynumber}{'author'}; $loglistsubject = $gmentrylist->{$thisentrynumber}{'subject'}; $loglistdate = $gmentrylist->{$thisentrynumber}{'created'}; $loglisttimeampm = $gmentrylist->{$thisentrynumber}{'createt'}; $loglistopenstatus = $gmentrylist->{$thisentrynumber}{'status'}; $loglistmorestatus = $gmentrylist->{$thisentrynumber}{'extended'}; &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; } 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:\/\/greymatterforum.proboards82.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 = Gm_Constants::EMPTY; $indexentrycounter = $newentrynumber; $indexcurrentdatemarker = "erewhon"; $indexcurrentdatescounted = 0; if ($newstayattopnumber ne "0") { &gm_getentryvariables($newstayattopnumber); if ($thisentryopenstatus eq Gm_Constants::OPEN) { &gm_formatentry($gmstayattoptemplate); $indexlogbody .= $entryreturn; } } do { &gm_getentryvariables($indexentrycounter); $datemark = "$thisentrymonth $thisentryday $thisentryyearyear"; if (($datemark ne $indexcurrentdatemarker) && ($thisentryopenstatus eq Gm_Constants::OPEN) && ($indexentrycounter ne $newstayattopnumber)) { $indexcurrentdatescounted++; if ($gmdatetemplate ne Gm_Constants::EMPTY) { $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_Utils::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 = Gm_Constants::OPEN; } } $indexcurrentdatemarker = "$thisentrymonth $thisentryday $thisentryyearyear"; } else { if (($indexentrycounter ne $newstayattopnumber) && ($thisentryopenstatus eq Gm_Constants::OPEN) && ($indexcurrentdatescounted <= $indexdays) && ($gmentryseparatortemplate ne Gm_Constants::EMPTY)) { $indexlogbody .= $gmentryseparatortemplate; } } if (($indexentrycounter ne $newstayattopnumber) && ($thisentryopenstatus eq Gm_Constants::OPEN) && ($indexcurrentdatescounted <= $indexdays)) { if ($thisentrymorebody ne Gm_Constants::EMPTY) { &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 Gm_Constants::OPEN) && ($nextentryopenstatus eq Gm_Constants::OPEN) && ($indexentrycounter ne $newstayattopnumber)) { # if (($nextdatemark ne $indexcurrentdatemarker) && ($thisentryopenstatus eq Gm_Constants::OPEN) && ($indexentrycounter ne $newstayattopnumber)) { # merged 2/19/2004 if ($gmdategroupingfootertemplate ne Gm_Constants::EMPTY) { $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_Utils::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 = Gm_Constants::CLOSED; } } } } $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; if ( ($gmdategroupingfootertemplate ne Gm_Constants::EMPTY) && ($dategrouping eq Gm_Constants::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; $thisentrydayappend = Gm_Utils::toOrdinal($thisentryday); $currentdatefoot =~ s/{{dayappend}}/$thisentrydayappend/gi; $indexlogbody .= $currentdatefoot; $dategrouping = Gm_Constants::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; &Gm_Trace::Trace( level => 2, msg => "Entering gm_generatearchive: getstartnumber=$getstartnumber"); $startnumber = $getstartnumber; &gm_readconfig; &gm_readcounter; &gm_readtemplates; $indexarchivebody = Gm_Constants::EMPTY; $indexentrycounter = $startnumber; $indexcurrentdatemarker = "erewhon"; $indexcurrentdatescounted = 0; &gm_getentryvariables($startnumber); $indexcurrentmonthcounter = $thisentrymonth; $indexcurrentweekcounter = "$thisentryweekbeginningdayday$thisentryweekendingdayday"; do { &gm_getentryvariables($indexentrycounter); $thisentryweek = "$thisentryweekbeginningdayday$thisentryweekendingdayday"; if (($generateentrypages eq Gm_Constants::YES) && ($indexentrycounter eq $newarchivenumber)) { if ($thisentryopenstatus eq Gm_Constants::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 Gm_Constants::OPEN)) { $indexcurrentdatescounted++; if ($gmdatearchivetemplate ne Gm_Constants::EMPTY) { $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_Utils::toOrdinal($thisentryday); $currentdatehead =~ s/{{dayappend}}/$thisentrydayappend/gi; # merged 9/15/2003 if ($archiveformat eq Gm_Constants::WEEK) { unless ($thisentryweek ne $indexcurrentweekcounter) { $indexarchivebody .= $currentdatehead; # added $dategrouping flag : 1.3.1 # flipped cracker 6/29/2004 $dategrouping = Gm_Constants::OPEN; } } else { unless ($thisentrymonth ne $indexcurrentmonthcounter) { $indexarchivebody .= $currentdatehead; # added $dategrouping flag : 1.3.1 # flipped cracker 6/29/2004 $dategrouping = Gm_Constants::OPEN; } } } $indexcurrentdatemarker = "$thisentrymonth $thisentryday $thisentryyearyear"; } else { if ($archiveformat eq Gm_Constants::WEEK) { if (($thisentryopenstatus eq Gm_Constants::OPEN) && ($thisentryweek eq $indexcurrentweekcounter) && ($gmarchiveentryseparatortemplate ne Gm_Constants::EMPTY)) { $indexarchivebody .= $gmarchiveentryseparatortemplate; } } else { if (($thisentryopenstatus eq Gm_Constants::OPEN) && ($thisentrymonth eq $indexcurrentmonthcounter) && ($gmarchiveentryseparatortemplate ne Gm_Constants::EMPTY)) { $indexarchivebody .= $gmarchiveentryseparatortemplate; } } } if ($archiveformat eq Gm_Constants::WEEK) { if (($thisentryopenstatus eq Gm_Constants::OPEN) && ($thisentryweek eq $indexcurrentweekcounter)) { if ($thisentrymorebody ne Gm_Constants::EMPTY) { &gm_formatentry($gmmorearchiveentrytemplate); } else { &gm_formatentry($gmarchiveentrytemplate); } $indexarchivebody .= $entryreturn; } } else { if (($thisentryopenstatus eq Gm_Constants::OPEN) && ($thisentrymonth eq $indexcurrentmonthcounter)) { if ($thisentrymorebody ne Gm_Constants::EMPTY) { &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 if (($nextdatemark ne $indexcurrentdatemarker) && ($dategrouping eq Gm_Constants::OPEN) && ($thisentryopenstatus eq Gm_Constants::OPEN)) { if ($gmdategroupingfooterarchivetemplate ne Gm_Constants::EMPTY) { $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; $thisentrydayappend = Gm_Utils::toOrdinal($thisentryday); $currentdatefoot =~ s/{{dayappend}}/$thisentrydayappend/gi; $indexarchivebody .= $currentdatefoot; $dategrouping = Gm_Constants::CLOSED; } } } $indexentrycounter--; if( $indexentrycounter eq "0" && $indexcurrentmonthcounter ne $thisentrymonth ){ $gmneedstogeneratefirstarchive=1; }; if( $indexentrycounter eq "0" && $archiveformat eq Gm_Constants::WEEK && $thisentryweek ne $indexcurrentweekcounter ){ $gmneedstogeneratefirstarchive=1; }; if ($archiveformat eq Gm_Constants::WEEK) { if ($thisentryweek ne $indexcurrentweekcounter) { $indexcurrentmonthcounter = "finis"; } else { $indexcurrentmonthcounter = $thisentrymonth; } } if ($indexentrycounter eq "0") { $indexcurrentmonthcounter = "finis"; } } until $thisentrymonth ne $indexcurrentmonthcounter; if ( ($gmdategroupingfooterarchivetemplate ne Gm_Constants::EMPTY) && ($dategrouping eq Gm_Constants::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; $thisentrydayappend = Gm_Utils::toOrdinal($thisentryday); $currentdatefoot =~ s/{{dayappend}}/$thisentrydayappend/gi; $indexarchivebody .= $currentdatefoot; $dategrouping = Gm_Constants::CLOSED; } $stoppednumber = $thisentrynumber; &gm_getentryvariables($startnumber); if ($archiveformat eq Gm_Constants::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 Gm_Constants::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"); &Gm_Trace::Trace( level => 2, msg => "Leaving gm_generatearchive"); } # ----------------------- # rebuild connected files # ----------------------- sub gm_rebuildconnectedfiles { @connectedfilelist = split ('\\n', $otherfilelist); ## TODO: THESE SHOULD BE CONSTANTS @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 = Gm_Constants::NO; $connectstartfromhere = $IN{'connectednumber'}; if ($connectstartfromhere eq Gm_Constants::EMPTY) { $connectstartfromhere = 0; } $connectendhere = $connectstartfromhere + 9; if (($connectendhere > $#connectedfilelist) || ($connectendhere eq $#connectedfilelist)) { $connectendhere = $#connectedfilelist; $connectedfilesdone = Gm_Constants::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 = Gm_Constants::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); ## couldn't use the < because it would freak out and not open file 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 = Gm_Constants::YES; } close(CHECKTHISFILE); $gmcounter = 0; foreach (@otherorigfilelines) { chomp ($otherorigfilelines[$gmcounter]); $gmcounter++; } $otherorigfilebody = join ("|*|", @otherorigfilelines); foreach $thisvariablecheck (@variabledatabase) { if ($otherorigfilebody =~ m/$thisvariablecheck/i) { $thereisapattern = Gm_Constants::NO; } } unless ($thereisapattern eq Gm_Constants::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 # ------------------------- # DEPRECATED: Gm_Core::generateArchiveLogList() 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/; $thisentrymonthmonth = Gm_Utils::toTwoDigit( $thisentrymonth ); $thisentrydayday = Gm_Utils::toTwoDigit( $thisentryday ); $thisentryhourhour = Gm_Utils::toTwoDigit( $thisentryhour ); $thisentryminuteminute = Gm_Utils::toTwoDigit( $thisentryminute ); $thisentrysecondsecond = Gm_Utils::toTwoDigit( $thisentrysecond ); } ########################################################### my $gmentrylist = Gm_Storage::getEntrylist( errHandler=>\&Gm_Web::displayAdminErrorExit ); $listcountmonthyear = 'begin'; $listcountweek = 'begin'; $logarchivelistfinal = Gm_Constants::EMPTY; foreach my $entry ( sort { $gmentrylist->{$b}{'id'} <=> $gmentrylist->{$a}{'id'} } keys( %$gmentrylist ) ) { $loglistnumber = $gmentrylist->{$entry}{'id'}; $loglistauthor = $gmentrylist->{$entry}{'author'}; $loglistsubject = $gmentrylist->{$entry}{'subject'}; $loglistdate = $gmentrylist->{$entry}{'created'}; $loglisttimeampm = $gmentrylist->{$entry}{'createt'}; $loglistopenstatus = $gmentrylist->{$entry}{'status'}; $loglistmorestatus = $gmentrylist->{$entry}{'extended'}; &gm_getloglistvariables; unless ($loglistopenstatus eq "C") { $thisloglistmonthyear = "$loglistmonthmonth $loglistyearyear"; $thisloglistweek = "$loglistweekbeginningdayday$loglistweekendingdayday"; if ($archiveformat eq Gm_Constants::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 Gm_Constants::DESCENDING) { @loglistfinalcollection = reverse @loglistfinalcollection; } $logarchivelistfinal = join ("$gmlogarchiveslinkseparatortemplate", @loglistfinalcollection); } # ----------------------- # generate log entry list # ----------------------- # DEPRECATED BY: Gm_Core::generateEntryLogList sub gm_generateentryloglist { $logshortentrylistfinal = Gm_Constants::EMPTY; $logmoreentrylistfinal = Gm_Constants::EMPTY; $logentrylistfinal = Gm_Constants::EMPTY; $logshortentrylistmonthfinal = Gm_Constants::EMPTY; $logshortentrylistdayfinal = Gm_Constants::EMPTY; $logshortentrylistyearfinal = Gm_Constants::EMPTY; $logmoreentrylistmonthfinal = Gm_Constants::EMPTY; $logmoreent