#!/usr/pkg/bin/perl # ============================= # GREYMATTER - Comments Module # Weblog/Journal Software # version one point two # Copyright (c)2000 Noah Grey # http://noahgrey.com/greysoft/ # ============================= # *** Your possession of this software indicates that you agree to the terms *** # *** specified under the "Copyright & Usage" heading in the "manual.txt" file. *** use CGI::Carp qw(fatalsToBrowser); require "gm-library.cgi"; print "Content-type: text/html\n\n"; $input = $ENV{'QUERY_STRING'}; @pairs = split(/&/, $input); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $name =~ tr/+/ /; $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $IN{$name} = $value; } &gm_readconfig; &gm_readtemplates; &gm_readcounter; &gm_rebuildallentrypages; sub gm_rebuildallentrypages { &gm_readconfig; if ($generateentrypages ne "yes") { $statusnote = qq(Entry page generation is currently disabled.
); } &gm_readcounter; &gm_readtemplates; if ($newentrynumber eq "0") { $statusnote = qq(There are no entries yet.
); &gm_frontpage; } unlink glob("$EntriesPath/archive-*.$entrysuffix"); $IN{'rebuilding'} = "entryfiles"; $IN{'rebuildfrom'} = "1"; &gm_rebuildupdate; } sub gm_rebuildupdate { $whatimdoing = "Error"; $nowrebuild = ""; &gm_readconfig; &gm_readcounter; &gm_readtemplates; $generateentrypages = "yes"; $currentcount = $IN{'rebuildfrom'}; $counttohere = $newentrynumber+1; do { &gm_getentryvariables($currentcount); if ($thisentryopenstatus eq "open") { &gm_formatentry("{{customone}}{{customseven}}"); $cmnt="cmnt"; $whatimdoing = "Generated comments"; open (THISENTRYFILE, ">$EntriesPath/$thisentrynumberpadded$cmnt.$entrysuffix") || &gm_dangermouse("Can't write to $EntriesPath/$thisentrynumberpadded$cmnt.$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 THISENTRYFILE $entryreturn; close (THISENTRYFILE); chmod (0666, "$EntriesPath/$thisentrynumberpadded$cmnt.$entrysuffix"); } unless ($currentcount eq $counttohere) { $currentcount++; } } until $currentcount eq $counttohere; $statusnote = qq(Rebuilding Files
); $gmrebuildheadtag = qq#