"; }
## merged 2/3/2004
$countfromhere++;
} until $countfromhere > $maxdaysinthismonth;
$endofcaldisplay = 6 - $calendardataday[$maxdaysinthismonth];
$calendarfull .= "$gmcalendarblankcelltemplate" x $endofcaldisplay;
$calendarfull .= $gmcalendartableendingtemplate;
$calendarfull =~ s/{{month}}/$usethisentrymonth/g;
$calendarfull =~ s/{{monthmonth}}/$usethisentrymonthmonth/g;
$calendarfull =~ s/{{year}}/$usethisentryyear/g;
$calendarfull =~ s/{{yearyear}}/$usethisentryyearyear/g;
$calendarfull =~ s/{{monthword}}/$usethisentrymonthword/g;
$calendarfull =~ s/{{monthwordupper}}/$usethisentrymonthwordupper/g;
$calendarfull =~ s/{{monthwordlower}}/$usethisentrymonthwordlower/g;
$calendarfull =~ s/{{monthwordshort}}/$usethisentrymonthwordshort/g;
$calendarfull =~ s/{{monthworduppershort}}/$usethisentrymonthworduppershort/g;
$calendarfull =~ s/{{monthwordlowershort}}/$usethisentrymonthwordlowershort/g;
}
# -----------------
# log the author in
# -----------------
sub gm_login {
if (!(open(CHECKMATE,"./gm-counter.cgi"))) {
&gm_dangermouse("gm-counter.cgi is missing. Please upload this file to the same directory as all the other Greymatter cgi files, and make sure you CHMOD it to 666.");
}
close(CHECKMATE);
if (!(open(CHECKMATE,"./gm-karma.cgi"))) {
&gm_dangermouse("gm-karma.cgi is missing. Please upload this file to the same directory as all the other Greymatter cgi files, and make sure you CHMOD it to 755.");
}
close(CHECKMATE);
if (!(open(CHECKMATE,"./gm-comments.cgi"))) {
&gm_dangermouse("gm-comments.cgi is missing. Please upload this file to the same directory as all the other Greymatter cgi files, and make sure you CHMOD it to 755.");
}
close(CHECKMATE);
if (!(open(CHECKMATE,"./gm-upload.cgi"))) {
&gm_dangermouse("gm-upload.cgi is missing. Please upload this file to the same directory as all the other Greymatter cgi files, and make sure you CHMOD it to 755.");
}
close(CHECKMATE);
if (!(open(CHECKMATE,"./gm-entrylist.cgi"))) {
&gm_dangermouse("gm-entrylist.cgi is missing. Please upload this file to the same directory as all the other Greymatter cgi files, and make sure you CHMOD it to 666.");
}
close(CHECKMATE);
if (!(open(CHECKMATE,"./gm-cplog.cgi"))) {
&gm_dangermouse("gm-cplog.cgi is missing. Please upload this file to the same directory as all the other Greymatter cgi files, and make sure you CHMOD it to 666.");
}
close(CHECKMATE);
if (!(open(CHECKMATE,"./gm-authors.cgi"))) {
&gm_dangermouse("gm-authors.cgi is missing. Please upload this file to the same directory as all the other Greymatter cgi files, and make sure you CHMOD it to 666.");
}
close(CHECKMATE);
if (!(open(CHECKMATE,"./gm-templates.cgi"))) {
&gm_dangermouse("gm-templates.cgi is missing. Please upload this file to the same directory as all the other Greymatter cgi files, and make sure you CHMOD it to 666.");
}
close(CHECKMATE);
if (!(open(CHECKMATE,"./gm-banlist.cgi"))) {
&gm_dangermouse("gm-banlist.cgi is missing. Please upload this file to the same directory as all the other Greymatter cgi files, and make sure you CHMOD it to 666.");
}
close(CHECKMATE);
if ($loginnotice eq "") { $loginnotice = qq(Login Prompt
"Not knowing when the dawn will come, I open every door."Emily Dickinson
$getnameandpwcookie
$gmframebottom
GMLOGIN
exit;
}
# ------------------
# validate the login
# ------------------
sub gm_validate {
&gm_bancheck;
&gm_readconfig;
$gmvalidated = "no";
$gmentryaccess = "no";
$gmentryeditaccess = "no";
$gmconfigurationaccess = "no";
$gmtemplateaccess = "no";
$gmauthoraccess = "no";
$gmcplogaccess = "no";
$gmrebuildaccess = "no";
$gmbookmarkletaccess = "no";
$gmuploadaccess = "no";
$gmloginaccess = "no";
$IN{'authorname'} =~ s/\|//g;
$IN{'authorpassword'} =~ s/\|//g;
$IN{'authorname'} =~ s/^\s+//;
$IN{'authorname'} =~ s/\s+$//;
$IN{'authorpassword'} =~ s/^\s+//;
$IN{'authorpassword'} =~ s/\s+$//;
########################################################################
## gm_validate extension to allow a rebuild operation without a password
## by passing a token reference instead. added by linear 9/3/2003
########################################################################
# merged in 1.3
if (($IN{'authorname'} eq "") || ($IN{'authorpassword'} eq "")) {
unless($IN{'gmtoken'}) {
$loginnotice = qq(You left one or more of the fields blank. Please try again.
);
&gm_writetocplog("Invalid login attempt: One or more fields left blank ($IN{'authorname'} $IN{'authorpassword'})");
&gm_login;
}
}
if ($IN{'gmtoken'} && $IN{'rebuilding'}) {
# read the token from the file where we persisted it
open (TOKENPLEASE, "$EntriesPath/gm-token.cgi") || &gm_dangermouse("Can't read the token file.");
@gmtoken = ;
$gmtoken = $gmtoken[0];
chomp ($gmtoken);
$gmtokenauthor = $gmtoken[1];
chomp ($gmtokenauthor);
$gmtokenpass = $gmtoken[2];
chomp ($gmtokenpass);
close (TOKENPLEASE);
# examine the token for validity
if ($IN{'gmtoken'} eq $gmtoken) {
$IN{'authorname'} = $gmtokenauthor;
$IN{'authorpassword'} = $gmtokenpass;
}
}
# merged 9/11/2003
open (FUNNYFEETVALLERY, "./gm-authors.cgi") || &gm_dangermouse("Can't read the authors file. Please make sure that gm-authors.cgi is CHMODed to 666 and is in the same place as all your other Greymatter CGI files.");
@gmauthordata = ;
close (FUNNYFEETVALLERY);
foreach $gmauthordataline (@gmauthordata) {
chomp ($gmauthordataline);
@gmauthorinfo = split (/\|/, $gmauthordataline);
if ($gmauthorinfo[0] eq $IN{'authorname'}) {
$gmvalidated = "foundname";
my $crypted = crypt($IN{'authorpassword'}, $gmauthorinfo[1]);
if ( ($gmauthorinfo[1] eq $crypted) || ($gmauthorinfo[1] eq $IN{'authorpassword'}) ) {
$gmvalidated = "yes";
if ($gmauthorinfo[6] eq "Y") { $gmentryaccess = "yes"; }
if ($gmauthorinfo[7] eq "Y") { $gmentryeditaccess = "yes"; }
if ($gmauthorinfo[7] eq "O") { $gmentryeditaccess = "mineonly"; }
if ($gmauthorinfo[8] eq "Y") { $gmconfigurationaccess = "yes"; }
if ($gmauthorinfo[9] eq "Y") { $gmtemplateaccess = "yes"; }
if ($gmauthorinfo[9] eq "O") { $gmtemplateaccess = "hfsonly"; }
if ($gmauthorinfo[10] eq "Y") { $gmauthoraccess = "yes"; }
if ($gmauthorinfo[11] eq "Y") { $gmrebuildaccess = "yes"; }
if ($gmauthorinfo[12] eq "Y") { $gmcplogaccess = "yes"; }
if ($gmauthorinfo[13] eq "Y") { $gmbookmarkletaccess = "yes"; }
if ($gmauthorinfo[14] eq "Y") { $gmuploadaccess = "yes"; }
if ($gmauthorinfo[15] eq "Y") { $gmloginaccess = "yes"; }
}
}
}
if ($gmvalidated eq "foundname") {
$loginnotice = qq(The password you entered for that author is incorrect. Please try again.
);
&gm_writetocplog("Invalid login attempt: Incorrect password ($IN{'authorpassword'}) for $IN{'authorname'}");
&gm_login;
}
if ($gmvalidated ne "yes") {
$loginnotice = qq(No such author is registered. Please try again.
);
&gm_writetocplog("Invalid login attempt: No such author as $IN{'authorname'} ($IN{'authorpassword'}) registered");
&gm_login;
}
}
# --------------------------
# check if this IP is banned
# --------------------------
sub gm_bancheck {
open (FUNNYFEETBABY, "./gm-banlist.cgi") || &gm_dangermouse("Can't read the banlist file. Please make sure that gm-banlist.cgi is CHMODed to 666 and is in the same place as all your other Greymatter CGI files; also try running Diagnostics & Repair from the Configuration screen.");
@gmbanlist = ;
close (FUNNYFEETBABY);
$currentip = $ENV{'REMOTE_ADDR'};
if ($gmbanlist[0] ne "") {
foreach $gmbanlistline (@gmbanlist) {
chomp ($gmbanlistline);
($checkthisip, $checkthisiphost, $checkthisperson) = split (/\|/, $gmbanlistline);
if (($currentip =~ /$checkthisip/) && ($checkthisip ne "")) {
if ($keeplog eq "yes") {
&date;
open (FUNNYFEET, ">>./gm-cplog.cgi") || &gm_dangermouse("Can't write to the control panel log. Please make sure that gm-cplog.cgi is CHMODed to 666 and is in the same place as all your other Greymatter CGI files; also try running Diagnostics & Repair from the Configuration screen.");
print FUNNYFEET "[$basedate] [$currentip] A banned IP ($checkthisip";
if ($checkthisperson ne "") { print FUNNYFEET ", \"$checkthisperson\""; }
print FUNNYFEET ") attempted to access this program\n";
close (FUNNYFEET);
}
print<(IP: $currentip)
$gmframebottom